akhauriyash/Code-Regression huggingface dataset:
import sys
from collections import deque
sys.setrecursionlimit(10**7)


def bfs(h, w):  
    for i in dhw:
        dh = i[0]
        dw = i[1]
        if h+dh < 0 or h+dh > H-1 or w+dw < 0 or w+dw > W-1 or field[h+dh][w+dw] == '#':
            continue
        if seen[h+dh][w+dw] == -1:
            seen[h+dh][w+dw] = seen[h][w] + 1
            todo.append([h+dh, w+dw])
        
        
H, W = map(int, input().split())
field = [list(input()) for _ in range(H)]
black_origin = 0
for i in range(H):
    black_origin += field[i].count('#')
dhw = ((-1, 0), (1, 0), (0, -1), (0, 1))
seen = [[-1]*W for _ in range(H)]
todo = deque()
seen[0][0] = 0
todo.append([0, 0])

while len(todo) > 0:
    n_ad = todo.popleft()
    bfs(n_ad[0], n_ad[1])

if seen[H-1][W-1] == -1:
    print(-1)
else:
    print(H*W-(seen[H-1][W-1]+1)-black_origin)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
const int N = 605;
const int M = 200005;
int n,m;
double em[M];
double en[N];
double enk[N];
vector<ii> adjlist[N+1];
int vis[N];
vector<int> preorder;
int dfs(int u){
    for (auto v : adjlist[u]){
        if (!vis[v.first]){
            vis[v.first] = 1;
            dfs(v.first);
        }
    }
    //printf("done with %d",u);
    preorder.push_back(u);
}
int id;
int main(){
    scanf("%d%d",&n,&m);
    if (n-1 == m){
        printf("%f",(double)m);
        return 0;
    }
    for (int i = 0; i< m ; i++){
        int a,b;
        scanf("%d%d",&a,&b);
        a--; b--;
        adjlist[a].push_back(ii(b,id++));
    }
    dfs(0);
    for (auto u : preorder){
        //printf("visiting %d\n",u);
        if (u == n-1){
            en[u] = 0;
            continue;
        }
        double sum = 0;
        int ct = 0;
        int best = -1;
        for (auto v : adjlist[u]){
            em[v.second] = en[v.first]+1;
            if (best == -1 || em[v.second] >= em[best]){
                //printf("%d %f \n",v.second,em[v.second]);
                best = v.second;
            }
            sum += em[v.second];
            ct++;
        }
        en[u] = (double)sum/(ct);
        //printf("%f %d\n",sum,ct);
        //printf("%f %d\n",sum-em[best],ct-1);
        if (ct == 1){
            enk[u] = en[u];
        }
        else{
            enk[u] = (double)(sum-em[best])/(ct-1);
        }
    }
    for (int i = 0; i < n; i++){
        //printf("%f ",enk[i]);
    }
    double ans = 1000000000;

    for (int i = 0; i < n; i++){
        //printf("block off %d\n",i);
        double ene[n];
        for (auto u : preorder){
            //printf("visiting %d\n",u);
            if (u == n-1){
                ene[u] = 0;
                continue;
            }
            if (u == i){
                ene[u] = enk[u];
                continue;
            }
            double sum = 0;
            int ct = 0;
            for (auto v : adjlist[u]){
                //printf("considering %d %d\n",v.first,v.second);
                if (v.first == i){
                    sum += enk[v.first]+1;
                }
                else {sum += ene[v.first]+1;}
                ct++;
            }
            ene[u] = (double)sum/ct;
        }

        //printf("%f\n",ene[0]);
        ans = min(ans,ene[0]);
    }
    printf("%f",ans);
}


Measured memory_bytes: 3968
n=int(input())
l=[str(input()) for i in range(n)]
l.sort()
r=[-1]
#print(l)
for i in range(n-1):
	if l[i]!=l[i+1]:
		r.append(i)
r.append(n-1)
#print(r)
s=[]
for i in range(len(r)-1):
	s.append(r[i+1]-r[i])
#print(s)
X=max(s)
A=[]
for i in range(len(s)):
	if s[i]==X:
		A.append(l[r[i]+1])
for i in A:
	print(i)



Measured memory_bytes: 89556
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  string s;
  cin >> n >> s;
  
  int a=0;
  
  for(int i=0;i<n;i++){
    if(s[i]=='(') a++;
    else a--;
    if(a<0){
      cout << '(';
      a++;
    }
  }
  
  cout << s;
  
  for(int i=0;i<a;i++) cout << ')';
  
  cout << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define LL long long

const int oo = 0x3f3f3f3f;
const int H = 10 + 5;
const int W = 1e3 + 5;

int h, w, k, ans = oo;
char s[H][W];
int state, pre[H][W], cut[W];

int main() {
    scanf("%d %d %d", &h, &w, &k);
    for(int i = 1; i <= h; ++i) scanf("%s", s[i] + 1);
    for(int i = 1; i <= h; ++i)
        for(int j = 1; j <= w; ++j)
            pre[i][j] = pre[i][j - 1] + (s[i][j] - '0');
    for(int state = 0; state < 1 << h ; ++state) {
        // pos[i] = state & (1 << i - 1)
        int finish = 1, last = 0, now = 0, cur = 0;
        for(int j = 1; j <= w; ++j) { // 第 j 列右边切
            for(int i = 1; i <= h; ++i) {
                now += pre[i][j] - pre[i][last];
                if(i == h || state & (1 << i - 1)) { // 第 i 行下面切
                    if(now > k) cut[j - 1] = 1, last = j - 1;
                    now = 0;
                }
            }
        }
        last = now = 0;
        for(int j = 1; j <= w; ++j) if(cut[j]) {
            for(int i = 1; i <= h; ++i) {
                now += pre[i][j] - pre[i][last];
                if(i == h || state & (1 << i - 1)) { // 第 i 行下面切
                    if(now > k) finish = 0;
                    now = 0;
                }
            }
            last = j;
        }
        for(int i = 1; i <= w - 1; ++i) if(cut[i]) cur++, cut[i] = 0;
        if(finish)
          ans = std::min(ans, __builtin_popcountl(state) + cur);
    }
    printf("%d", ans);
    return 0;
}
/*
4 10 4
1110010010
1000101110
0011101001
1101000111

*/


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] list = new int[n];

        int sum = 0;

        for (int i = 0; i < n; i++) {
            list[i] += scanner.nextInt();
            sum += list[i];
        }

        Arrays.sort(list);
        int index = 0;
        while (sum % 10 == 0 && index < n) {
            if (list[index] % 10 != 0) {
                sum -= list[index];
            }
            index++;
        }

        if (index == n && sum % 10 == 0) {
            sum = 0;
        }

        System.out.println(sum);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

class Puzzle {
  vvi g;
  int height;
  bool update;
  vector<vector<bool>> del;
  int score;

public:  
  void init(int h, vvi a) {
    g = a;
    height = h;
    update = false;
    del.resize(h);
    REP(i, h) {
      del[i].resize(5, false);
    }
    score = 0;
  }

  int getScore() {
    return score;
  }
  
  void searchdel() {
    REP(i, height) {
      int cnt = 1;
      REP(j, 5) {
        if(j != 0 && g[i][j] == g[i][j-1] && g[i][j] != 0) {
          cnt++;
          if(cnt == 3) {
            update = true;
            del[i][j-2] = true;
            del[i][j-1] = true;
            del[i][j] = true;
          } else if(cnt > 3) {
            del[i][j] = true;
          }
        }
        else cnt = 1;
      }
    }
  }

  void upd() {
    REP(i, height) {
      REP(j, 5) {
        if(del[i][j]) {
          score += g[i][j];
          g[i][j] = 0;
        }
      }
    }
  }

  bool turnend() {
    REP(i, height) {
      REP(j, 5) {
        del[i][j] = false;
      }
    }

    REP(k, height) {
      RREP(i, height-2) {
        REP(j, 5) {
          if(g[i+1][j] == 0) {
            g[i+1][j] = g[i][j];
            g[i][j] = 0;
          }
        }
      }
    }


    if(!update) return true;
    else {
      update = false;
      return false;
    }
  }
};

int main () {
  cin.tie(0);
  cout << setprecision(10);

  while(1) {
    int h; cin >> h;
    if(h == 0) break;
    vvi a(h);
    REP(i, h) {
      a[i].resize(5);
      REP(j, 5) cin >> a[i][j];
    }
    Puzzle p;
    p.init(h, a);
    while(1) {
      p.searchdel();
      p.upd();
      if(p.turnend()) break;
    }
    cout << p.getScore() << endl;
  }
}



Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main()
{
	int t; cin>>t;
	int e=0,o=0;
	for (int i = 1; i <= t; ++i)
	{
		if(i%2==0) e++;
		else o++; 
	}

	cout<<e*o;




	 
}		

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int x,par,impar;
	scanf("%d", &x);
	if(x%2){
		impar = x/2+1;
		par = x/2;
	}
	else {
		par = x/2;
		impar = par;
	}
	printf("%d\n", impar*par);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <iomanip>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1ll << 60;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int A[n], B[n];
    rep(i, 0, n) cin >> A[i] >> B[i];

    ll rsl = 0;

    for(int i = n - 1; i >= 0; i--) {
        rsl += (B[i] - (A[i] + rsl) % B[i]) % B[i];
    }
    cout << rsl << endl;


}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int a, b, c, numRectagle = 0, numLozenge = 0;
	String[] input;
	while (scan.hasNext()) {
	    input = scan.nextLine().split(",");
	    a = Integer.parseInt(input[0]);
	    b = Integer.parseInt(input[1]);
	    c = Integer.parseInt(input[2]);
	    if (a * a + b * b == c * c) {
		numRectagle++;
	    }
	    if (a == b) {
		numLozenge++;
	    }
	}
	System.out.println(numRectagle);
	System.out.println(numLozenge);
    }
}

Measured memory_bytes: 25772
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;

const int MAX_N=100000;
int x[MAX_N],n=0;

int main(){
	for(int i=0;i<100000;i++){
		cin >> x[i];
		if(x[i]==0){
			n=i;
			break;
		}
	}
	for(int i=0;i<n;i++){
		cout << "Case " << i+1 << ": " << x[i] << "\n";
	}
	return 0;
}

Measured memory_bytes: 3120
#include<iostream>
using namespace std;

int main(){
    int n;
    int A[100];
    cin>>n;
    for(int i=0;i<n;i++) cin>>A[i];
    
    for(int i=0;i<n;i++){
        int v=A[i];
        int j=i-1;    
        
        while(j>=0&&A[j]>v){
            A[j+1]=A[j];
            j--;
        }
        
        A[j+1]=v;
        
        for(int i=0;i<n-1;i++) cout<<A[i]<<" ";
        cout<<A[n-1]<<endl;
    }
}

Measured memory_bytes: 3108
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.IO;

namespace ConsoleTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine((nm[0] - 1) * (nm[1] - 1));

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;

int main() {

    string s;
    cin >> s;

    int n = s.length();
    vector<ll> a(n+1), b(n+1);
    rep(i, n){
        if(s[i] == '<'){
            a[i+1] = a[i] + 1;
        }
    }
    for(int i=n-1; i>=0; --i){
        if(s[i] == '>'){
            b[i] = b[i+1] + 1;
        }
    }

    ll ans = 0;
    rep(i, n+1){
        ans += max(a[i], b[i]);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 8708
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,A,B,P1,P2;
  cin >> N >> A >> B;
  
  P1=N*A;
  P2=B;

  if (P1 >= P2 ) {
    cout << P2 << endl;
  }
  else {
    cout << P1 << endl;
  }  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fr, to)    for (int i = fr; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

const int nsz = 2e5, lgsz = 18;
bool f;
int n, k, a[nsz + 5], ans = 1;

struct sparse_table {
    int mn[nsz + 5][lgsz + 5], mx[nsz + 5][lgsz + 5], lg[nsz + 5];
    
    void inline init() {
        cont (i, n) {
            lg[i] = lg[i >> 1] + 1;
            mn[i][0] = mx[i][0] = a[i];
        }
        cont (k, lgsz) {
            cont (u, n) {
                if (u + (1 << k) - 1 > n)  break;
                int p = u + (1 << (k - 1));
                mn[u][k] = min(mn[u][k - 1], mn[p][k - 1]);
                mx[u][k] = max(mx[u][k - 1], mx[p][k - 1]);
            }
        }
    }
    
    int inline qry_min(int l, int r) {
        int k = lg[r - l + 1] - 1, len = 1 << k;
        return min(mn[l][k], mn[r - len + 1][k]);
    }
    
    int inline qry_max(int l, int r) {
        int k = lg[r - l + 1] - 1, len = 1 << k;
        return max(mx[l][k], mx[r - len + 1][k]);
    }
};
sparse_table st;

struct segment {
    bool g;
    int l, r;
    
    segment() {}
    
    segment(int a) {
        l = r = a;
        g = 1;
    }
};
segment inline operator & (segment ls, segment rs) {
    segment u;
    u.g = ls.g & rs.g & (ls.r <= rs.l);
    u.l = ls.l, u.r = rs.r;
    return u;
}

struct segment_tree {
    segment tr[4 * nsz + 5];
    
    void init(int u = 1, int l = 1, int r = n) {
        if (l == r) {
            tr[u] = segment(a[l]);
            return;
        }
        int md = (l + r) >> 1;
        init(u << 1, l, md);
        init(u << 1 | 1, md + 1, r);
        tr[u] = tr[u << 1] & tr[u << 1 | 1];
    }
    
    segment qry(int el, int er, int u = 1, int l = 1, int r = n) {
        if (l >= el && r <= er)  return tr[u];
        bool f = 0;
        int md = (l + r) >> 1;
        segment res;
        if (el <= md) {
            res = qry(el, er, u << 1, l, md);
            f = 1;
        }
        if (er >= md + 1) {
        	segment tmp = qry(el, er, u << 1 | 1, md + 1, r);
            if (f) {
                res = res & tmp;
            } else {
                res = tmp;
            }
        }
        return res;
    }
};
segment_tree tr;

int main() {
    ios_base::sync_with_stdio(0);
    cin >> n >> k;
    cont (i, n) {
        cin >> a[i];
    }
    st.init();
    tr.init();
    f = tr.qry(1, 1 + k - 1).g;
    for (int l = 2, r = l + k - 1; r <= n; ++l, ++r) {
        int l1 = st.qry_min(l - 1, r - 1), r1 = st.qry_max(l - 1, r - 1), l2 = st.qry_min(l, r), r2 = st.qry_max(l, r);
        if (l1 == a[l - 1] && r2 == a[r])  continue;
        ++ans;
        bool tmp = tr.qry(l, r).g;
        ans -= tmp & f;
        f |= tmp;
    }
    cout << ans << ln;
}


Measured memory_bytes: 47104
/*Read the problem carefully before starting to work on it*/
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

//ll ncr(ll n,ll r){ll ans=1;r=min(r,n-r);for (int i=1;i<=r;i++){ans*=(n-r+i);ans/=i;}return ans;}

#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007

double PI=3.1415926535897932384626;

//template<typename T> T power(T x,T y,ll m=mod){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

#define bip(n) __builtin_popcount(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctz(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clz(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffs(n)//index of first one bit!!

typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;

typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ld> vd;
typedef vector<ll> vl;

//#define fi1 ifstream fin("input.txt")
//#define of1 ofstream fout("output.txt")
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;

#define fi first
#define se second

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin>>s;
	int x=0,o=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='x')
		{
			x++;
		}
		else if(s[i]=='o')
		{
			o++;
		}
	}
	o+=(15-(s.size()));
	if(o>=8)
		cout<<"YES";
	else
		cout<<"NO";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>
#include <random>
#include <ctime>
#include <chrono>

using namespace std;

long long t, n, m, u, v, q, k, p;
const int N = 1e6 + 1e5 + 500;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;

bool arr[N];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> m >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> u;
    arr[u] = true;
  }
  
  int lo = m, hi = m;
  
  for (int i = 0; i <= 200; ++i) {
    if (arr[lo] and arr[hi]) {
      lo--;
      hi++;
      continue;
    }
    else {
      if (arr[lo]) cout << hi << endl;
      else cout << lo << endl;
      return 0;
    }
  }
}





















Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;
const int mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

int main() {
	string s, t;
	cin >> s >> t;
	int n = t.size(), ans = INF;

	rep(i, s.size() - n + 1) {
		int cnt = 0;
		rep(j, n) {
			if (s[i + j] == t[j])continue;
			cnt++;
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3620
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back


signed main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a[i];

    vector<bool> use(n,false);

    int m = 0;
    rep(i,n){
        if(a[i]==2 or a[i]==-2)use[i] = true;
        if(a[i]==-2)m++;
    }

    if(m%2==1){
        rep(i,n){
            if(a[i]==-1){
                use[i] = true;
                m++;
                break;
            }
        }
    }
    if(m%2==1){
        for(int i=n-1;i>=0;i--){
            if(a[i]==-2){
                use[i] = false;
                m--;
                break;
            }
        }
    }

    assert(m%2==0);

    vector<int> ans;
    rep(i,n){
        if(use[i])ans.pb(i+1);
    }
    cout<<ans.size()<<endl;
    rep(i,ans.size()){
        cout<<ans[i]<<endl;
    }
}



Measured memory_bytes: 3160
def minimumOpt1(seq):
    dest = {}
    b = sorted(seq)
    for i in xrange(len(b)):
        dest[b[i]] = i
    foo = 0
    for i in xrange(0, len(seq), 2):
        if dest[seq[i]]%2==1:
            foo += 1
    return foo

def main():
    n = int(raw_input().strip())
    seq = [0] * n
    for i in xrange(n):
        seq[i] = int(raw_input().strip())
    print minimumOpt1(seq)

if __name__ == '__main__':
    main()


Measured memory_bytes: 17852
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mx 10000008

ll divs[mx+1];

void sieve()
{
    for(ll i=1; i<=mx; i++) divs[i]=2;
    divs[1]=1;
    for(ll i=2; i<=mx; i++)
    {
        for(ll j=2*i; j<=mx; j+=i)
            divs[j]++;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    string s;
    cin>>n;
    int ac,wa,tle,re;
    ac=wa=tle=re=0;
    while(n--)
    {
        cin>>s;
        if(s.compare("AC")==0) ac++;
        else if(s.compare("TLE")==0)tle++;
        else if(s.compare("RE")==0)re++;
        else wa++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
 
using namespace std;

using LL = long long;
using LD = long double;
 
LL mod = 10e9+7;

int main()
{
	LL x;
	cin >> x;

	LL amt = 0;

	amt += 1000*(x/500);
	x %= 500;

	amt += 5*(x/5);

	cout << amt << "\n";
	

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mpp make_pair
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    fast;
    ll n,k,sum=0;
    ll arr[10005];
    cin>>n>>k;
    for(ll i=1; i<=n; i++)
    {
        cin>>arr[i];
    }
    sort(arr+1,arr+n+1);
    for(ll i=1; i<=k; i++)
    {
        sum+=arr[i];
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3600
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
using namespace std;

int main(){
	int k;
	cin >> k;
	
	int count_k=(k+1)/2;
	int count_g=k-count_k;
	
	cout << count_k*count_g << endl;
	
	return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
p = [0]* m
s = ["a"] * m


for i in range(m):
    p[i],s[i] = input().split()
    p[i] = int(p[i])



ac_num = [0] * n
wa_num = [0] * n

for i in range(m):
    if s[i] == "AC":
        ac_num[p[i]-1] = 1
    elif s[i] == "WA":
        if ac_num[p[i]-1] == 0:
            wa_num[p[i]-1] += 1

for i in range(n):
    if ac_num[i] == 0:
        wa_num[i] = 0
#print(ac_num,wa_num)

print(sum(ac_num),sum(wa_num))


Measured memory_bytes: 14836
#include <iostream>
using namespace std;
int main() {
  string S;
  cin >> S;
  int flag = 1;
  int length = S.length();
  for (int i = 0; i < length; i++) {
    if (i % 2 == 1 && S[i] == 'R') {
      flag = 0;
      break;
    }
    if (i % 2 == 0 && S[i] == 'L') {
      flag = 0;
      break;
    }
  }
  if (flag) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//最終奥義 #define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
//lambda: [](int x, int y){return x<y;}

signed main(void){
    int n;cin>>n;
    if(n%2){
        cout << n/2+1 << endl;
    }else{
        cout << n/2 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a = 0, b = 0;
  cin >> a >> b;
  if ((a * b) % 2 == 0) {
    cout << "Even" << endl;
  } else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

const int MOD = TEN(9) + 7;
inline void add(int &x, int y) { x += y; if (x >= MOD) x -= MOD; }

const int maxn = 62;

int dp[maxn][2][2][2]; //L<x, y<R, highest (x <= y can be ignored)

int main() {
	ll L, R; cin >> L >> R;
	--L; ++R;

	int now = 0;
	dp[0][0][0][0] = 1;

	for (int i = 60; i >= 0; --i) {
		int p = (L >> i) & 1;
		int q = (R >> i) & 1;

		rep(a, 2) rep(b, 2) rep(c, 2) {
			if (dp[now][a][b][c] == 0) continue;
			rep(r, 2) rep(s, 2) { //for x, y
				int na = a, nb = b, nc = c;
				if (p == 1 && r == 0 && !a) continue;
				if (p == 0 && r == 1) na = 1;
				if (s == 1 && q == 0 && !b) continue;
				if (s == 0 && q == 1) nb = 1;
				if (!c && r + s == 1) continue;
				if (r || s) nc = 1;
				if (r > s) continue;

				add(dp[now + 1][na][nb][nc], dp[now][a][b][c]);
			}
		}

		now++;
	}

	cout << dp[now][1][1][1] << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;

int min(int a, int b)
{
	return (a > b ? b : a);
}

int main(void)
{
	int A, B, C, D;
	
	cin >> A >> B >> C >> D;
	cout << (min(A, B) + min(C, D)) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ri register int
#define fi first
#define se second
using namespace std;
inline int read(){
	#define gc getchar
	int ans=0;
	char ch=gc();
	bool f=1;
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	return f?ans:-ans;
	#undef gc
}
typedef long long ll;
typedef pair<int,int> pii;
const int mod=998244353;
inline int add(const int&a,const int&b){return a+b>=mod?a+b-mod:a+b;}
inline int dec(const int&a,const int&b){return a>=b?a-b:a-b+mod;}
inline int mul(const int&a,const int&b){return (ll)a*b%mod;}
inline void Add(int&a,const int&b){a=a+b>=mod?a+b-mod:a+b;}
inline void Dec(int&a,const int&b){a=a>=b?a-b:a-b+mod;}
inline void Mul(int&a,const int&b){a=(ll)a*b%mod;}
inline int ksm(int a,int p){int ret=1;for(;p;p>>=1,a=mul(a,a))if(p&1)Mul(ret,a);return ret;}
const int N=2e5+5;
int n,vx[N],sx=0,vy[N],sy=0,clu[N],cld[N],cru[N],crd[N],pw[N];
pii a[N];
int bit[N];
inline int lowbit(const int&x){return x&-x;}
inline void update(int x,int v){for(;x<=n;x+=lowbit(x))Add(bit[x],v);}
inline int query(int x){int ret=0;for(;x;x-=lowbit(x))Add(ret,bit[x]);return ret;}
inline int query(int l,int r){return dec(query(r),query(l-1));}
int main(){
	n=read();
	pw[0]=1;
	for(ri i=1;i<=n;++i)pw[i]=add(pw[i-1],pw[i-1]);
	for(ri i=1;i<=n;++i){
		vx[i]=a[i].fi=read();
		vy[i]=a[i].se=read();
	}
	sort(vy+1,vy+n+1),sort(a+1,a+n+1);
	for(ri i=1;i<=n;++i){
		a[i].se=lower_bound(vy+1,vy+n+1,a[i].se)-vy;
		clu[i]=query(1,a[i].se-1);
		cld[i]=query(a[i].se+1,n);
		update(a[i].se,1);
	}
	memset(bit,0,sizeof(bit));
	for(ri i=n;i;--i){
		cru[i]=query(1,a[i].se-1);
		crd[i]=query(a[i].se+1,n);
		update(a[i].se,1);
	}
	int ans=0;
	for(ri i=1;i<=n;++i){
		int t=0;
		Add(t,pw[n-1]);
		Add(t,pw[n-1]);
		Dec(t,pw[clu[i]+cld[i]]);
		Dec(t,pw[cru[i]+crd[i]]);
		Dec(t,pw[clu[i]+cru[i]]);
		Dec(t,pw[cld[i]+crd[i]]);
		Add(t,pw[clu[i]]);
		Add(t,pw[cru[i]]);
		Add(t,pw[cld[i]]);
		Add(t,pw[crd[i]]);
		Add(ans,t-1);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define INF 1e9
#define MOD 1000000007
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main(void) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    ll minxminy = a * c;
    ll minxmaxy = a * d;
    ll maxxminy = b * c;
    ll maxxmaxy = b * d;

    ll ans = -1e18;

    ans = max(ans, minxminy);
    ans = max(ans, minxmaxy);
    ans = max(ans, maxxminy);
    ans = max(ans, maxxmaxy);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3632
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    ll H, W, N;
    cin >> H >> W >> N;

    map<pair<ll, ll>, int> mp;

    FOR(i, 0, N){
        ll a, b; // a is y axis...
        cin >> a >> b;
        //cout << "point " << b << " " << a << endl;

        // 周辺にカウント
        for(int dx=-1; dx<2; dx++){
            for(int dy=-1; dy<2; dy++){
                ll index_x = b + dx;
                ll index_y = a + dy;
                if(1<=index_x && index_x<=W && 1<=index_y && index_y<=H){
                    pair<ll, ll> p = make_pair(index_x, index_y);
                    mp[p]++;
                    //cout << index_x << " " << index_y << " +1" << endl;
                }
            }    
        }
    }

    ll C[10];
    FOR(i, 0, 10){
        C[i] = 0;
    }

    for(auto p : mp){
        auto pair_xy = p.first;

        ll x = pair_xy.first;
        ll y = pair_xy.second;
        int count = p.second;
        
        //cout << "p " << pair_xy.first << " " << pair_xy.second << " " << count << endl;
        
        if(2<=x && x<=W-1 && 2<=y && y<=H-1){
            C[count]++;
        }
    }


    // 最後にC[0]
    ll sum = 0;
    FOR(i, 1, 10){
        sum += C[i];
    }

    C[0] = (W-2)*(H-2) - sum;

    FOR(i, 0, 10){
        p(C[i]);
    }

    
    return 0;
}

Measured memory_bytes: 56576
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  int n, k, ans;
  cin >> n >> k;
  if (n % 2 == 0) {
    ans = n / 2;
  } else {
    ans = n / 2 + 1;
  }
  if (k <= ans) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;


int main() {
	long long X; cin >> X;
	long long ans = 100;
	long long cnt =0 ;
	for (int i = 0; i < 1e9; i++)
	{
		if (ans >= X)break;
		ans *=1.01;
		cnt++;
	}
	cout << cnt << endl;
}



Measured memory_bytes: 3632
list=[]
N = int(input())
D,X = [int(i) for i in input().split()]
for i in range(1,N+1):
	a = int(input())
	list.append(a)


chocolate = 0
for i in list:	
	count = 0
	while(True):
		if count*i + 1 <= D:
			chocolate += 1
			count += 1
		else:
			break

print(chocolate+X)


Measured memory_bytes: 3064
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_A
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int n,q;
	cin>>n;
	vector<int> a(n);
	rep(i,n)cin>>a[i];
	cin>>q;
	vector<int> m(q);
	rep(i,q)cin>>m[i];

	set<int> s;
	rep(bit, (1<<n)){
		int res=0;
		rep(j,n){
			if((bit>>j)&1)res+=a[j];
		}
		s.insert(res);
	}
	rep(i,q){
		int target=m[i];
		bool flag=s.find(target)!=s.end();
		
		cout<<(flag?"yes":"no")<<endl;
	}
	return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <stack>
#include <map>
#include <cmath>
#include <algorithm>

unsigned long int GCD(unsigned long int m, unsigned long int n){
    unsigned long int r;
    while((r=m%n) != 0){
        m = n;
        n = r;
    }
    return n;
}

int main(int argc, char *argv[]){
    int N;
    std::cin >> N;
    unsigned long int A[N];
    for(auto &a : A){
        std::cin >> a;
    }
    unsigned long int gcd = 0;
    for(const auto &a : A){
        gcd = GCD(gcd,a);
    }
    std::cout << gcd << std::endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int n, k;
int a, b, plan[110];
int dp[110][10][10];
long long int solve(int i, int sum, int bef);
int main(){
  memset(plan, -1, sizeof(plan));
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for(int i = 0; i < k; i++){
    cin >> a >> b;
    plan[a] = b;
  }
  cout << solve(1, 0, 0) % 10000 << endl;
}

long long int solve(int i, int sum, int bef){
  if(sum == 2) return 0;
  if(dp[i][sum][bef] >= 0) return dp[i][sum][bef];
  if(i == n + 1){
    return 1;
  }
  if(plan[i] == -1){
    return dp[i][sum][bef] = solve(i + 1, bef == 1? sum + 1 : 0 , 1) + solve(i + 1, bef == 2? sum + 1 : 0, 2) + solve(i + 1, bef == 3? sum + 1 : 0, 3) % 10000;
  }
  else{
    return dp[i][sum][bef] = solve(i + 1, bef == plan[i]? sum + 1 : 0, plan[i]) % 10000;
  }
}

Measured memory_bytes: 1212
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeSet;

import static java.util.Arrays.binarySearch;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();
        out.println(a < b ? 0 : 10);

    }

}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;

int main() {
  int K, X;
  cin >> K >> X;
  int A, B;
  A = X - K + 1;
  B = X + K - 1;
  for (int i = A; i < B; i++){
    cout << i << " ";
  }
  cout << B << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,a) for(ll i=ll(a-1);i>=0;--i)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MOD3 = 1e6;
const ll EPS = 1e-10;
int sgn(const double a){
    return (a < -EPS ? -1 : (a > EPS ? +1 : 0));
}
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<long double,long double> point;
typedef complex<long double> Point;
const ll MAX = 3000;
constexpr ll nx[4] = {-1,0,1,0};
constexpr ll ny[4] = {0,1,0,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> d(n);
    ll a,b;
    rep(i,n){
        cin >> a >> b;
        if (a == b) d[i] = 1;
        else d[i] = 0;
    }
    rep(i,n-2){
        if (d[i] && d[i+1] && d[i+2]){
            PRINT("Yes");
            return 0;
        }
    }
    PRINT("No");
}


Measured memory_bytes: 3620
#include <iostream>

int main() {
    int a, b;
    std::cin >> a >> b;
    
    for (int i = 1; i < 10010; i++) {
        double p = i;
        if ((int)(p * 0.08) == a && (int)(p * 0.1) == b) {
            std::cout << i << std::endl;
            return 0;
        }
    }

    std::cout << -1 << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n, cnt, ans;
  cin >> n;
  cnt = n % 1000;
  if (cnt == 0) ans = 0;
  else ans = 1000 - cnt;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int a,b,c,d;

    cin >> a >> b >>c >>d;

    int i = 0;
    while (1)
    {
        if(i % 2 == 0)
        {
            c -= b;
        }
        else
        {
            a -= d;
        }
        if(c <= 0 || a <= 0)break;
        i++;
    }
    
    if(c <= 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}


Measured memory_bytes: 3636
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    string S;
    cin >> S;
    cout << (S == string(3, S[0]) ? "No" : "Yes") << endl;
    return 0;
};

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

//using
using VI = vector<int>;
using VVI = vector<VI>;
using VS = vector<string>;
using PII = pair<int, int>;
using LL = long long;

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);i++)
#define REP(i,n)  for(LL i=0;i<(n);i++)

//constant
const int INF = 1 << 29;
const double EPS = 1e-10;
const double PI = acos(-1.0);

//debug
#define dump(x)  cout << #x << " = " << (x) << endl;

int main() {
  LL N;
  cin >> N;
  // 4hnw == N(hn + nw + hw)

  FOR(i, 1, 3501) {
    FOR(j, i, 3501) {
      if (4*i*j < N*(i + j + j*i) & 4*i*j*3500 > N*(i*3500 + 3500*j + j*i)) {
        FOR(k, j, 3501) {
          if(4*i*k*j == N*(i*k + k*j + j*i)) {
            cout << i << ' ' << j << ' ' << k << endl;
            return 0;
          }
        }
      }
    }
  }
  // cout << "error";
  // cout << i << ' ' << j << ' ' << k << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = sorted([int(x) for x in input().split()])
B = sorted([int(x) for x in input().split()])
C = sorted([int(x) for x in input().split()])
a = 0
c = 0
cnt = 0
for i in range(N):
  while a < N:
    if A[a] < B[i]:
      a += 1
    else:
      break
  while c < N:
    if C[c] <= B[i]:
      c += 1
    else:
      break
  cnt += a * (N - c)
print(cnt)

Measured memory_bytes: 106340
K=[int(input()) for _ in range(5)]
ans=0
c=10
for i in range(5):
  r=K[i]%10
  if r==0:
    r=10
  c=min(r,c)
for k in range(5):
  if K[k]%10==0:
    ans+=K[k]
  else:
    ans+=(K[k]//10)*10+10
print(ans-10+c)

Measured memory_bytes: 9160
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define len(v) (int)(v).size()
#define ll long long

using namespace std;

void dfs(ll n,ll i,ll j,string& s)
{
    ll l,r;
    if(j % 2){
        l = i, r = (1LL << n)+1LL-i;
    }else{
        l = (1LL << n)+1-i, r = i;
    }
    ll mn = min(i,(1LL << n)+1LL-i);
    ll up = (1LL << (n-1))-mn+1LL;
    if(n == 1){
        if(l < r){
            s.push_back('L');
        }else{
            s.push_back('R');
        }
        return;
    }
    if(up%2){
        if(l < r){
            s.push_back('R');
        }else{
            s.push_back('L');
        }
    }else{
        if(l < r){
            s.push_back('L');
        }else{
            s.push_back('R');
        }
    }
    dfs(n-1,up,(j+1)/2,s);
}

int main()
{
    while(1){
        ll n,i,j;
        cin >> n >> i >> j;
        if(n == 0){
            break;
        }
        string s;
        dfs(n,i,j,s);
        reverse(s.begin(),s.end());
        cout << s << "\n";
    }
}



Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  string s;cin>>s;
  vector<int> vec(26);
  rep(i,s.size()){
    vec[s[i]-'a']++;
  }
  rep(i,26){
    if(vec[i]==0){
      cout<<(char)(i+'a')<<endl;
      return 0;
    }
  }
  cout<<"None"<<endl;
}

Measured memory_bytes: 3692
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstdio>
using namespace std;

#define int long long
#define INF 1e18

signed main() {
    int n, k; cin >> n >> k;
    int sum = 0;
    for(int i = 0; i < n; i++) {
        int x; cin >> x;
        sum += min(abs(x) * 2, abs(k - x) * 2);
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
namespace IO
{
	template <typename T> inline void read(T &x)
	{
		int f = 1; x = 0; char c = getchar();
		for (; !isdigit(c); c = getchar()) if (c == '-') f = -1;
		for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
		x *= f;
	}

	template <typename T> inline void chkmax(T &x, T y) { x = x > y ? x : y; }
	template <typename T> inline void chkmin(T &x, T y) { x = x < y ? x : y; }

	template <typename T> inline void write(T x)
	{
		if (x < 0) putchar('-'), x = -x;
		if (x > 9) write(x / 10);
		putchar(x % 10 + '0');
	}
	template <typename T> inline void writesp(T x) { write(x); putchar(' '); }
	template <typename T> inline void writeln(T x) { write(x); putchar('\n'); }
}
using namespace IO;
int main(){
	int a;
	cin >> a;
	cout << a + a * a + a * a * a << endl; 
  return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
const int N=2e3+200;
typedef long long ll;
ll n,X,Y;
ll cnt[N];
int main()
{
	cin>>n>>X>>Y;X--,Y--;
	for(ll i=0;i<n;i++)
	{
	   ll v;
	   for(ll j=i+1;j<n;j++)
	   {
	   	   v=min({j-i,abs(i-X)+abs(j-Y)+1,abs(i-Y)+abs(j-X)+1});cnt[v]++;
	   }
	   
	} 
	for(int i=1;i<n;i++)
	{
		printf("%lld\n",cnt[i]);
	}
}

Measured memory_bytes: 256