akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int N;
int before, after;
string S[10500];
string T;
void g(string tmp) {
    for(int i = 0; i < tmp.size(); i++) {
        if(tmp[i] == '?') tmp[i] = 'z';
    }
    //cerr << tmp << endl;
    if(tmp >= T) after++;
}

void f(string tmp) {
    for(int i = 0; i < tmp.size(); i++) {
        if(tmp[i] == '?') tmp[i] = 'a';
    }
    //cerr << tmp << endl;
    if(tmp <= T) before++;
}

int main() {
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> S[i];
    cin >> T;
    for(int i = 1; i <= N; i++) {
        f(S[i]);
        g(S[i]);
    }
    cerr << before << " " << after << endl;
    for(int i = N - after + 1; i <= before; i++) {
        cout << i << " ";
    }
    cout << before + 1 << endl;
    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n, m;
    while (cin >> n >> m) {
        if (n == 0 && m == 0) break;
        vector<int> car(n+m+1);
        car[0] = 0;
        for (int i = 0; i < n+m; i++) {
            cin >> car[i+1];
        }
        sort(car.begin(), car.end());
        vector<int> interval;
        for (int i = 0; i < n+m; i++) {
            interval.push_back(car[i+1] - car[i]);
        }
        cout << *max_element(interval.begin(), interval.end()) << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
#define eps 1e-8
using namespace std;
const ll maxn = 1e6 + 5;
ll a,b,c,d,k,n,m,t,num[maxn];
ll ans[maxn];
queue<ll> qu;
vector<ll> v;
set<ll> st;
void slove(){
    cin >> k;
    for(int i = 0; i < 9; i++)
        qu.push(i + 1);
    while(qu.size()){
        ll t = qu.front();
        qu.pop();
        if(v.size() > k * 10)
            continue;
        v.push_back(t);
        ll temp2 = t % 10;
        if(temp2 == 9){
            qu.push(t * 10 + 9);
            qu.push(t * 10 + 8);
        }
        else if(temp2 == 0){
            qu.push(t * 10);
            qu.push(t * 10 + 1);
        }
        else{
            qu.push(t * 10 + temp2);
            qu.push(t * 10 + temp2 - 1);
            qu.push(t * 10 + temp2 + 1);
        }
    }
}
int main()
{
    slove();
    sort(v.begin(),v.end());
    cout << v[k - 1] << endl;
    return 0;
}


Measured memory_bytes: 23784
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define mod 1000000007 //1e9+7
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 1001


void calc(int x,int y,int s){
  int ans = 0;
  vector<int> vec[SIZE];

  for(int i=1;i<=1000;i++){
    if(i*(100+x)/100 > 1000) break;
    vec[i*(100+x)/100].push_back(i);
  }
  
  for(int i=1;i<s;i++){
    int a = s-i;
    int b = i;
    
    for(int j=0;j<vec[a].size();j++){
      for(int k=0;k<vec[b].size();k++){
	ans = max(ans, vec[a][j]*(100+y)/100 + vec[b][k]*(100+y)/100);
      }
    }
  }
  
  printf("%d\n",ans);
  
  return;
}

int main(){
  int x,y,s;
  
  while(1){
    scanf("%d%d%d",&x,&y,&s);
    
    if(x==0) break;
    
    calc(x,y,s);
  }

  return 0;
}

Measured memory_bytes: 3276
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

class point {
public:
    int x;
    int y;
    int cnt;
    point(int a, int b, int c) {
        x = a;
        y = b;
        cnt = c;
    }
};

const int dx[] = {0, 1, 0, -1};
const int dy[] = {-1, 0, 1, 0};
int h, w, n;

int main()
{
    cin >> h >> w >> n;
    vector<string> map(h);

    for (int i = 0; i < h; i++)
        cin >> map[i];

    int ans = 0;
    int sx, sy;

    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            if (map[i][j] == 'S') {
                map[i][j] == '.';
                sy = i;
                sx = j;
                break;
            }

    for (int i = 1; i <= n; i++) {
        point p(sx, sy, 0);
        queue<point> q;
        vector<vector<bool> > memo(h, vector<bool>(w, false));

        q.push(p);
        memo[sy][sx] = true;

        while (!q.empty()) {
            point now = q.front();
            q.pop();

            if (map[now.y][now.x] == i + '0') {
                ans += now.cnt;
                sy = now.y;
                sx = now.x;
                break;
            }

            for (int j = 0; j < 4; j++) {
                int nx = now.x + dx[j];
                int ny = now.y + dy[j];
                if (nx < 0 || nx >= w || ny < 0 || ny >= h || 
                    map[ny][nx] == 'X' || memo[ny][nx])
                    continue;

                q.push(point(nx, ny, now.cnt + 1));
                memo[ny][nx] = true;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2404
def MI():return map(int,input().split())
N,M=MI()
sc=[]
for i in range(M):
    x,y=MI()
    sc.append((x,y))
for i in range(0,10**3):
    h=str(i)
    if len(h)==N:
        if all([h[s-1]==str(c) for (s,c) in sc]):
            print(i)
            exit()
print(-1)
        

Measured memory_bytes: 38640
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

bool solve_one(void)
{
    long long n, max = 0;
    bool ans = true;
    cin >> n;
    vector<long long> h(n);
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
        if(h[i] > max) max = h[i];
        if ((h[i] - max) <= -2)
        {
            ans = false;
        }
    }

    return ans;
}

int main(void)
{
    bool ans = solve_one();
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 1024
public class Main {

	public void run(java.util.Scanner sc, java.io.PrintStream out) {
		for (;;) {
			final int w = sc.nextInt();
			final int h = sc.nextInt();
			if (w == 0 && h == 0) break ;
			final Cell[][] map = new Cell[w][h];
			for (int i = 0; i < w; ++i)
			for (int j = 0; j < h; ++j)
				map[i][j] = new Cell();
			for (int i = 1; i < w; ++i) {
				if (sc.nextInt() == 0) {
					map[i - 1][0].right = map[i][0];
					map[i][0].left = map[i - 1][0];
				}
			}
			for (int j = 1; j < h; ++j) {
				for (int i = 0; i < w; ++i) {
					if (sc.nextInt() == 0) {
						map[i][j].top = map[i][j - 1];
						map[i][j - 1].bottom = map[i][j];
					}
				}
				for (int i = 1; i < w; ++i) {
					if (sc.nextInt() == 0) {
						map[i - 1][j].right = map[i][j];
						map[i][j].left = map[i - 1][j];
					}
				}
			}
			
			java.util.Queue<Cell> lis = new java.util.LinkedList<Cell>();
			map[0][0].visited = 1;
			lis.add(map[0][0]);
			while (!lis.isEmpty()) {
				final Cell e = lis.remove();
				if (e == map[w - 1][h - 1])
					break ;
				if (e.top != null && e.top.visited == 0) {
					e.top.visited = e.visited + 1;
					lis.add(e.top);
				}
				if (e.left != null && e.left.visited == 0) {
					e.left.visited = e.visited + 1;
					lis.add(e.left);
				}
				if (e.right != null && e.right.visited == 0) {
					e.right.visited = e.visited + 1;
					lis.add(e.right);
				}
				if (e.bottom != null && e.bottom.visited == 0) {
					e.bottom.visited = e.visited + 1;
					lis.add(e.bottom);
				}
			}
			out.println(map[w - 1][h - 1].visited);
		}
	}
	
	public static void main(String[] args) {
		(new Main()).run(new java.util.Scanner(System.in), System.out);
	}

	private class Cell {
		public int visited;
		public Cell top, left, right, bottom;
		public Cell() {
			this.visited = 0;
			this.top = null;
			this.left = null;
			this.right = null;
			this.bottom = null;
		}
	}
	
}

Measured memory_bytes: 69484
from collections import Counter
n = int(input())
S = [input() for i in range(n)]
S = Counter(S).most_common()
max_v = S[0][1]
ans = []
for k ,v in S:
    if v == max_v:
        ans.append(k)
ans.sort()
for i in ans:
    print(i)

Measured memory_bytes: 45120
import java.util.*;


public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int ans = 0;
        
        for(int i=0; i<n; i++){
            int a = sc.nextInt();
            ans += a - 1;
        }
		
		System.out.println(ans);
    }
}


Measured memory_bytes: 40760
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x;
  cin >> x >> n;
  int a[n],b[110]={0};
  for(int i=0;i<n;i++){
    cin >> a[i];
    b[a[i]]=1;
  }
  for(int i=0;i<110;i++){ 
    if(b[x-i]==0){
      cout << x-i << endl;
      break;
    }
    if(b[x+i]==0){
      cout << x+i << endl;
      break;
    }
  }
}


Measured memory_bytes: 3636
// author : ksumit

// jo darr gya vo gya

#include<unordered_map>
#include<bits/stdc++.h>
typedef long long ll;

bool isPrime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0) return 0;
	}
	return 1;
}

using namespace std;

void solve() {
	int n;
	cin >> n;
	ll temp;
	ll ans = 0;
	ll maxv = 0;
	for (int i = 0; i < n; i++) {
		cin >> temp;
		if (i == 0) {
			maxv = temp;
		} else {
			if (temp > maxv) {
				maxv = temp;
			} else {
				ans += maxv - temp;
			}
		}
	}
	cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	// int tt;
// 	cin >> tt;
// 	while (tt--)
		solve();
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define mod 1000000007
#define ull unsigned ll
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi acos(-1)
#define nu 100
#define INF 100000000000
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define F(i,a,n) for(ll i=a;i<n;i++)
#define B(i,a,n) for(ll i=n-1;i>=a;i--)

#define tc int t;cin>>t;while(t--)
#define tcf ll t;cin>>t;for(int w=1;w<=t;w++)

using namespace std;

ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res *= a;
        }
        a *= a;
        b >>= 1;
    }
    return res;
}
void dex(int a)
{
    if (a == 1)
        cout << "1\n";
    else if (a == -1)
        cout << "-1\n";
    else if (a == 0)
        cout << "0\n";
    else if (a == 2)
        cout << "YES\n";
    else if (a == 3)
        cout << "NO\n";
}


int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);


    string s;
    cin>>s;
    if(s[s.size()-1]=='s')
    {
        cout<<s<<"es\n";
    }
    else
    {
        cout<<s<<"s\n";
    }


    return 0;

}

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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());

signed main()
{   
    gearup;
    ll n,m; cin >> n >> m;
    vl x(n),y(n),z(n);
    rep(i,n)cin>>x[i]>>y[i]>>z[i];
    ll res = -L_INF;
    
    //i = 0,..7
    const ll ex[8] = {-1, 1, -1, 1, -1, 1, -1, 1};
    const ll ey[8] = {-1, -1, 1, 1, -1,-1, 1, 1};
    const ll ez[8] = {-1, -1,-1, -1, 1, 1, 1, 1};
    rep(i,8){
        vl num(n);
        rep(j,n)num[j] = ex[i]*x[j] + ey[i]*y[j] + ez[i]*z[j];
        sort(rall(num));
        ll ans = 0;
        rep(j,m)ans+=num[j];
        res = max(res,ans);

        //out(ans);
    }
    out(res);
}

Measured memory_bytes: 3652
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, n;

  std::cin >> N;

  n = N % 10;

  if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
    std::cout << "hon" << std::endl;
  }
  else if (n == 0 || n == 1 || n == 6 || n == 8) {
    std::cout << "pon" << std::endl;
  }
  else {
    assert(n == 3);
    
    std::cout << "bon" << std::endl;
  }

  return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <unistd.h>
#define inf 1000000007LL
#define INF 1000000000000000007LL
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define st first
#define nd second
#define ll long long
#define ld long double
#define pii pair<int,int>
#define vi vector<int>
#define vll vector<long long>
#define vpii vector< pair<int,int> >
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define bit(i) (1LL<<(i))
#define log(x) (63-__builtin_clzll(x))
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i, n) for(int i=1; i<=(n); ++i)
#define pv(...) cerr<<'\n',dbg(#__VA_ARGS__, __VA_ARGS__)
#define ps(x) {cerr<<#x<<":\n:";for(auto q:(x)){cerr<<q<<" ";}cerr<<'\n';}
#define pa(x, xs) {cerr<<#x<<":\n:";for(int q=0; q<=(xs); ++q){cerr<<x[q]<<" ";}cerr<<'\n';}
#define pal(x, xs) {cerr<<'\n'<<#x<<":\n";for(int q=0; q<=(xs); ++q){cerr<<q<<": "<<setw(q? 3-(int32_t)log10(q):3)<<x[q]<<'\n';}cerr<<'\n';}
#define ppii(x, xs) {cerr<<'\n'<<#x<<":\n";for(int q=0; q<=(xs); ++q){cerr<<q<<": "<<setw(q? 6-(int32_t)log10(q):6)<<x[q].first<<" "<<setw(5)<<x[q].second<<'\n';}cerr<<'\n';}
#define pm(x, xn, xm) {cerr<<'\n'<<#x<<":\n";for(int qa=0; qa<=(xn); ++qa){for(int qb=0; qb<=(xm); ++qb){cerr<<setw(6)<<x[qa][qb]<<" ";}cerr<<'\n';}cerr<<'\n';}
#define endr cerr<<'\n'
#define endl '\n'
#ifndef DEBUG
#define cerr if(0)cout
#define pv(...) if(0)endr
#define ps(x) if(0)endr
#define pa(x, xs) if(0)endr
#define pal(x, xs) if(0)endr
#define ppii(x, xs) if(0)endr
#define pm(x, xn, xm) if(0)endr
#endif
using namespace std;
template<class T> void dbg(const char* xn, T x){cerr<<xn<<": "<<x<<"\n";} template<class T, class... TA> void dbg(const char* xn, T x, TA... t){while(*xn!=',')cerr<<*xn++;cerr<<": "<<x<<",";dbg(xn+1, t...);}
template<class T> inline bool upd_max(T &x, T y){return y>x?x=y,true:false;} template<class T> inline bool upd_min(T &x, T y){return y<x?x=y,true:false;}
const int N = 1000007;
#define int long long

int n;
vi pairs;
unordered_map<int, int> cnt;


void solve()
{
  cin>>n;
  rep1(i, n)
  {
    int a; cin>>a;
    ++cnt[a];
    if (!(cnt[a]&1) && cnt[a] > 0) pairs.pb(a);
  }

  sort(all(pairs));

  if (sz(pairs) < 2) cout<<"0", exit(0);

  int a1 = pairs.back(); pairs.pop_back();
  int a2 = pairs.back();

  cout<<a1*a2;
}

int32_t main()
{
ios_base::sync_with_stdio(0); cin.tie(NULL);
cout<<fixed<<setprecision(10);

  solve();

return 0;
}


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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

int n;
int p[20001];
int a[20001], b[20001];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  //stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  //if (stream2 == NULL) return 0;:w
#endif
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  for (int i = 1; i <= n; i++) {
    a[i - 1] = n * i;
  }
  for (int i = 0; i < n; i++) {
    b[i] = a[n - i - 1];
  }
  for (int i = 0; i < n; i++) {
    a[p[i]] += i;
  }
  for (int i = 0; i < n; i++) {
    if (i != n - 1) cout << a[i] << " ";
    else cout << a[i] << endl;
  }
  for (int i = 0; i < n; i++) {
    if (i != n - 1) cout << b[i] << " ";
    else cout << b[i] << endl;
  }
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}

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

int main() {
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  if (e - a > k){
    cout << ":(" << endl;
  }
  else {
    cout << "Yay!" << endl;
  }
}


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

int main(){
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> A(Q);
  vector<int> point(N);
  for(int i=0; i<Q; i++){
    cin >> A.at(i);
    point.at(A.at(i)-1)++;
  }
  int mustnum=Q-K+1;
  for(int i=0; i<N; i++){
    if(point.at(i)>=mustnum) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 1408
#include<iostream>
using namespace std;
int main(void)
{
    int n;
    cin >> n;
    int a=n%10;
    if(a==2 || a==4 || a==5 || a==7 || a==9)
        cout << "hon";
    else if(a==0 || a==1 || a==6 || a==8)
        cout << "pon";
    else cout << "bon";
    return 0;
}


Measured memory_bytes: 3632
n = gets.to_i
red = []
blue = []
cnt = 0

n.times do
  a, b = gets.split.map(&:to_i)
  red.push([a, b])
end

n.times do
  c, d = gets.split.map(&:to_i)
  blue.push([c, d])
end

blue.sort.each do |b|
  pair = red.select{|r| (r[0] < b[0]) && (r[1] < b[1])}
  next if pair.empty?
  blue.delete(b)
  red.delete(pair.sort_by{|r| r[1]}.last)
  cnt += 1
end

p cnt


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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

#define loop(i, n) for(int i = 0;i < n;i++)
#define IINF 2e9
#define MOD 1e9+7

int main(void){

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    loop(i, n) cin >> a[i];

    vector<long double> change(n);

    loop(i, n){
        change[i] = log10l(a[i]);
    }
    vector<long double> value(n);

    long double sum = 0;
    loop(i, n){
        sum += change[i];
        value[i] = sum;
    }

    vector<long double> ans(n-k+1);
    
    loop(i, n-k+1){
        if(i == 0) ans[i] = value[k-1+i];
        else ans[i] = value[k-1+i] - value[i-1];
    }

    // loop(i, n){
    //     cout << value[i] << " ";
    // }
    // cout << endl;

    // loop(i, n-k+1){
    //     cout << ans[i] << " ";
    // }
    // cout << endl;

    for(int i = 1;i < n-k+1;i++){
        if(ans[i-1] < ans[i]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }



    return 0;
}

Measured memory_bytes: 13528
#include <iostream>

int main(){
    int a,b,c,m,count,d[100];
    count=0;
    std::cin>>a>>b;
    for(int i=0;i<a;i++){
        d[i]=0;
    }
    for(int i=0;i<b;i++){
        std::cin>>c;
        for(int j=0;j<c;j++){
            std::cin>>m;
            d[m-1]=1;
        }
    }
    for(int i=0;i<a;i++){
        if(d[i]!=1)count++;
    }
    std::cout<<count<<std::endl;
    return 0;
    
}


Measured memory_bytes: 3184
a, b, k = map(int, input().split())


for i in range(0,k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        diff = a//2
        a -= diff
        b += diff
    else:
        if b % 2 == 1:
            b -= 1
        diff = b//2
        b -= diff
        a += diff

print(a,b)

Measured memory_bytes: 3060
def solve(A,N,Q,BC):
    A_dict = {}
    for a in A:
        if a in A_dict:
            A_dict[a] += 1
        else:
            A_dict[a] = 1

    ans_list = [sum(A)]
    for b,c in BC:
        diff = 0
        if b in A_dict:
            diff += (c-b) * A_dict[b]
            if c in A_dict:
                A_dict[c] += A_dict[b]
            else:
                A_dict[c] = A_dict[b]
            A_dict.pop(b)
        ans_list.append(ans_list[-1] + diff)

    return ans_list[1:]

def main():
    N = int(input())
    A = list(map(int,input().split()))
    Q = int(input())
    BC = [list(map(int,input().split())) for _ in range(Q)]

    ans = solve(A,N,Q,BC)
    for i in range(Q):
        print(ans[i])

if __name__ == "__main__":
    main()


Measured memory_bytes: 41516
import java.util.Scanner;

public class Main {
	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int[] ret = new int[2];
		for(int i = 0; i < 3; i++) {
			int tmp = sc.nextInt();
			if(tmp == 5)
				ret[0]++;
			if(tmp == 7)
				ret[1]++;
		}
		System.out.println(ret[0] == 2 && ret[1] == 1 ? "YES" : "NO");
	}
}

Measured memory_bytes: 21716
use std::collections::BinaryHeap;
use std::cmp::Ordering;

#[derive(Eq, PartialEq)]
struct Reverse<T>(T);

impl<T> Ord for Reverse<T> where T: Ord {
    fn cmp(&self, other: &Reverse<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

impl<T> PartialOrd for Reverse<T> where T: PartialOrd {
    fn partial_cmp(&self, other: &Reverse<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

fn main() {
    let (n, m): (usize, usize) = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };

    let s: Vec<char> = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.chars().collect()
    };

    let mut heap = BinaryHeap::new();
    heap.push((Reverse(0), Reverse(n)));

    let mut next: Vec<usize> = vec![0; n + 1];

    for i in (0..n).rev() {
        if s[i] == '1' { continue; }

        while let Some((Reverse(d), Reverse(j))) = heap.pop() {
            if j - i > m { continue; }

            heap.push((Reverse(d), Reverse(j)));
            heap.push((Reverse(d + 1), Reverse(i)));
            next[i] = j;
            break;
        }
    }

    if next[0] == 0 {
        println!("-1");
    } else {
        let mut i: usize = 0;

        while i < n {
            print!("{}", next[i] - i);
            print!("{}", if next[i] < n { ' ' } else { '\n' });
            i = next[i];
        }
    }
}

Measured memory_bytes: 8444
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define repe1(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll func(ll n) {
  if (n<5) return 0;
  ll nn = n/5;
  return nn+func(nn);
}

int main() {
  ll n;
  ll res = 0;
  cin >> n;
  if (n%2 == 1) {
    cout << 0 << "\n";
  } else {
  ll nn = n/2;
  cout << func(nn) << "\n";
  }
}


Measured memory_bytes: 256
N = int(input())
A = [0] + list(map(int, input().split()))

#  nの約数をO(root(n))で全列挙、
# sortするなら O(root(n) * root(n)log(root(n))) --> O(n * log(n))
def make_divisors(n):
    import math
    divisors = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0: #割り切れるとき
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    # divisors.sort()
    return divisors

B = [0] * (N + 1)
ans = [0] * (N + 1)
for i in range(N, 0, -1):
    if B[i] == A[i]:
        continue
    ans[i] = 1
    lst = make_divisors(i)
    for tmp in lst:
        B[tmp] += 1
        B[tmp] %= 2

M = sum(ans)
print (M)
for index, b in enumerate(ans):
    if b == 1:
        print (index, end = ' ')


Measured memory_bytes: 68456
import fractions

K = int(input())
ans = 0

for a in range(1,K+1):
    for b in range(a,K+1):
        t = fractions.gcd(a,b)
        for c in range(b,K+1):
            if(t!=1):
                tmp = fractions.gcd(t,c)
            else:
                tmp = 1
            if(a==b and b==c):
                ans += tmp
            elif(a!=b and b!=c and c!=a):
                ans += 6*tmp
            else:
                ans += 3*tmp
print(int(ans))

Measured memory_bytes: 10672
n = int(input())
a = [0] + list(map(int,input().split())) + [0]
lenth = 0

for i in range(1,n+2):
    lenth += abs(a[i] - a[i-1])

for i in range(1,n+1):
    sbs = abs(a[i]-a[i-1]) + abs(a[i+1] - a[i])
    add = abs(a[i+1]-a[i-1])
    ans = lenth -sbs + add
    print(ans)

Measured memory_bytes: 86744
N,h = gets.split.map &:to_i
As,Bs = (0...N).map{ gets.split.map &:to_i }.transpose
A = As.max
B = Bs.select{ |b| b >= A }.sort.reverse
ans = 0
B.each{ |b|
  h -= b
  ans += 1
  break if h <= 0
}
p ans + (h > 0 ? (h-1)/A + 1 : 0)


Measured memory_bytes: 15472
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		double[] v =new double[n];
		for(int i=0; i<n; i++){
			v[i] =sc.nextDouble();
		}
		Arrays.sort(v);
		for(int i=0; i<n-1; i++){
			v[i+1]=(v[i]+v[i+1])/2.0;
		}
		System.out.println(v[n-1]);
	}
}


Measured memory_bytes: 23252
n=int(input())
G=[]
for i in range(n):
    u,k,*l=map(int,input().split())
    G.append(l)
#print(G)
log_finish=[0]*n
log_start=[0]*n

from collections import deque
def dfs(G):
    q=deque()
    for i in range(n,0,-1):
        q.append((i,-1,0))
    log_finish[0]=1
    log_start[0]=1
    cnt=0
    while q:
        #print(q,cnt)
        V,P,S=q.pop()
        if log_finish[V-1]==0 or log_finish[V-1]==log_start[V-1]:
            cnt+=1
            if not log_finish[V-1]:log_start[V-1]=cnt
            log_finish[V-1]=cnt
        #print(V,P,S,cnt)


        if S==0:
            #下に遷移していくときの処理
            q.append((V,P,1))
            l=[]
            if not G[V-1]:continue
            for new_v in G[V-1]:
                if log_start[new_v-1]!=0:continue
                l.append((new_v,V,0))
            q+=l[::-1]

dfs(G)
for i in range(n):
    print(i+1,log_start[i],log_finish[i])


Measured memory_bytes: 6052
// ---------- begin chmin, chmax ----------
trait ChangeMinMax {
    fn chmin(&mut self, x: Self) -> bool;
    fn chmax(&mut self, x: Self) -> bool;
}

impl<T: PartialOrd> ChangeMinMax for T {
    fn chmin(&mut self, x: Self) -> bool {
        *self > x && {
            *self = x;
            true
        }
    }
    fn chmax(&mut self, x: Self) -> bool {
        *self < x && {
            *self = x;
            true
        }
    }
}
// ---------- end chmin, chmax ----------

use proconio::*;
use std::cmp::*;

fn run() {
    input! {
        n: usize,
        p: [(i64, i64, i64); n],
    }
    let mut cost = vec![0; 1 << n];
    for i in 1..(1 << n) {
        let mut a = vec![];
        let mut b = vec![];
        for (j, &(x, y, p)) in p.iter().enumerate() {
            if (i >> j) & 1 == 1 {
                a.push((x, p));
                b.push((y, p));
            }
        }
        let mut val = std::i64::MAX;
        for &(z, _) in a.iter() {
            let mut s = 0;
            for &(x, p) in a.iter() {
                s += (z - x).abs() * p;
            }
            val.chmin(s);
        }
        for &(z, _) in b.iter() {
            let mut s = 0;
            for &(x, p) in b.iter() {
                s += (z - x).abs() * p;
            }
            val.chmin(s);
        }
        cost[i] = val;
    }
    let mut q = std::collections::VecDeque::new();
    let inf = std::i64::MAX / 100;
    let mut dp = vec![vec![inf; 1 << n]; n + 1];
    dp[0][(1 << n) - 1] = 0;
    q.push_back((0, (1 << n) - 1));
    while let Some((k, bit)) = q.pop_front() {
        let v = dp[k][bit];
        let mut j = bit;
        while j > 0 {
            let x = bit ^ j;
            if dp[k + 1][x] == inf {
                q.push_back((k + 1, x));
            }
            dp[k + 1][x].chmin(v + cost[j]);
            j = (j - 1) & bit;
        }
    }
    let mut ini = vec![0; 1 << n];
    for i in 1..(1 << n) {
        let mut s = 0;
        for (j, &(x, y, p)) in p.iter().enumerate() {
            if (i >> j) & 1 == 1 {
                s += min(x.abs(), y.abs()) * p;
            }
        }
        ini[i] = s;
    }
    let mut ans = vec![inf; n + 1];
    for (i, dp) in dp.into_iter().enumerate() {
        for (j, v) in dp.into_iter().enumerate() {
            if v == inf {
                continue;
            }
            ans[i].chmin(v + ini[j]);
        }
    }
    for a in ans {
        println!("{}", a);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 7140
MOD = 1_000_000_007

def memoize(name)
  original = "__original_#{name}__"
  self.class.class_eval {
    alias_method(original, name)
    private(original)
    cache = {}
    define_method(name){|*args|
      cache[args] ||= send(original, *args)
    }
  }
end 

def f(n, k)
  return 1 if n == 0
  return 0 if n < 0
  return 0 if k == 0
  (f(n, k-1) + f(n-k, k)) % MOD
end

memoize :f

n0, k0 = gets.split.map(&:to_i)
p f(n0, k0)


Measured memory_bytes: 80220
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include <set>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<fstream>
#include<stdio.h>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

#define PI  3.141592
//----------------------------------------
int main(void)
{

	int n;
	cin >> n;
	vector<int> x(n);

	rep(i, n) cin >> x[i];


	sort(x.begin(), x.end());

	ll ma = 99999999999999999;

	for (int i = 0; i <= 100; i++)
	{
		ll sum = 0;

		rep(j, n)
		{
			sum += pow((x[j]-i),2);
		}

		ma = min(sum, ma);
	}


	cout << ma << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

func run() {
	n := nextInt()
	v := make([]int, 0)
	for i := 0; i < n; i++ {
		v = append(v, nextInt())
	}
	last := 0
	combo := 0
	answer := 0
	for _, x := range v {
		if last >= x {
			combo++
		} else {
			combo = 0
		}
		last = x
		if answer < combo {
			answer = combo
		}
	}
	Println(answer)
}

// --- template ---
// Thanks https://gist.github.com/halllllll/853ab587fd82ee3ffe6f7fb7fb499695

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

// Caution: You will get unexpected result if a single token is larger than this size.
const BufferSize = 64 * 1024 * 1024

func Print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(out, a...)
}

func Printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, format, a...)
}

func Println(a ...interface{}) (n int, err error) {
	return fmt.Fprintln(out, a...)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, err := strconv.Atoi(next())
	if err != nil {
		log.Fatal(err)
	}
	return a
}

func nextFloat() float64 {
	a, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}

func main() {
	sc.Buffer(make([]byte, 0, BufferSize), BufferSize)
	sc.Split(bufio.ScanWords)
	run()
	out.Flush()
}


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

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()

int main(){
    int n, k, x, y;
    cin >> n >> k >> x >> y;

    int ans = 0;
    ans += x * min(n, k);
    if(n - k > 0){
        ans += y * (n - k);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN = 15;
const int MAXM = MAXN*(MAXN - 1) / 2;
const int MOD = 1000000007;

int n, m;
int a[MAXM], b[MAXM];

int p2[MAXM + 1];
int nedges[1 << MAXN];

int ways[2][1 << MAXN];


void printmask(int mask) { REP(i, n) printf("%c", mask&(1 << i) ? 'x' : '.'); }


void run() {
	scanf("%d%d", &n, &m); REP(i, m) scanf("%d%d", &a[i], &b[i]), --a[i], --b[i];

	p2[0] = 1; FORE(i, 1, MAXM) p2[i] = (ll)p2[i - 1] * 2 % MOD;
	REP(i, 1 << n) { nedges[i] = 0; REP(j, m) if ((i&(1 << a[j])) != 0 && (i&(1 << b[j])) != 0) ++nedges[i]; }

	FOR(amask, 1, 1 << n) if ((amask&(1 << 0)) != 0 && (amask&(1 << 1)) == 0) {
		ways[0][amask] = p2[nedges[amask]];
		int othermask = (1 << n) - 1 - amask;
		for (int pmask = (othermask + 1)&amask; pmask != amask; pmask = (pmask + othermask + 1)&amask) if ((pmask&(1 << 0)) != 0) {
			ways[0][amask] = (ways[0][amask] + MOD - (ll)ways[0][pmask] * p2[nedges[amask - pmask]] % MOD) % MOD;
		}
		//printf("A"); printmask(amask); printf(" = %d (nedges=%d)\n", ways[0][amask],nedges[amask]);
	}
	FOR(bmask, 1, 1 << n) if ((bmask&(1 << 1)) != 0 && (bmask&(1 << 0)) == 0) {
		ways[1][bmask] = p2[nedges[bmask]];
		int othermask = (1 << n) - 1 - bmask;
		for (int pmask = (othermask + 1)&bmask; pmask != bmask; pmask = (pmask + othermask + 1)&bmask) if ((pmask&(1 << 1)) != 0) {
			ways[1][bmask] = (ways[1][bmask] + MOD - (ll)ways[1][pmask] * p2[nedges[bmask - pmask]] % MOD) % MOD;
		}
		//printf("B"); printmask(bmask); printf(" = %d (nedges=%d)\n", ways[1][bmask], nedges[bmask]);
	}

	int ret = 0;
	REP(amask, 1 << n) if ((amask&(1 << 0)) != 0 && ((amask&(1 << 1)) == 0)) {
		int forbid = amask;
		REP(j, m) { if (amask&(1 << a[j])) forbid |= 1 << b[j]; if (amask&(1 << b[j])) forbid |= 1 << a[j]; }
		for (int bmask = 0; bmask < (1 << n); bmask = (bmask + forbid + 1)&~forbid) if ((bmask&(1 << 1)) != 0 && (bmask&(1 << 0)) == 0) {
			int cmask = (1 << n) - 1 - amask - bmask;
			int cur = (ll)ways[0][amask] * ways[1][bmask] % MOD*p2[nedges[cmask]] % MOD;
			//printf("sol "); printmask(amask); printf(" "); printmask(bmask); printf(" "); printmask(cmask); printf(" -> %d\n", cur);
			ret = (ret + cur) % MOD;
		}
	}
	ret = (p2[m] + MOD - ret) % MOD;
	printf("%d\n", ret);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 640
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def main():
    a, b = intin()

    if a % 2 == 1 and b % 2 == 1:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3544
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N;
	string S;
	cin >> N >> S;
	VI ans(S.size());
	vector<char> t(S.size());
	REP(i, S.size()) {
		ans[i] = S[i] - 'A' + N;
		ans[i] %= 26;
		t[i] = ans[i] + 'A';
		cout << t[i];
	}
	cout << endl;
	//REP(i,S.size())
	return 0;
}



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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll x; cin >> x;
  vector<bool> table(1000000, true);
  for (int i = 2; i < table.size(); i++) {
    if (table[i]) {
      if (i >= x) {
        cout << i << endl;
        return 0;
      }
      for (int j = i * 2; j < table.size(); j += i) {
        table[j] = false;
      }
    }
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

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

	ll A, B, C, K; cin >> A >> B >> C >> K;

	ll res = 0LL;
	if (K % 2LL == 0){
		res = A - B;
	}else{
		res = B - A;
	} // end if
	
	if (abs(res) > (ll)1e18){
		cout << "Unfair" << endl;
	}else{
		cout << res << endl;
	} // end if

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <cassert>
#include <array>
#include <iomanip>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << x << endl
// #define int long long 

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = ((1<<30)-1);
const ll linf = (1LL<<60);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(1)
    {
        c -= b;
        if(c<=0)
        {
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if(a<=0)
        {
            cout << "No" << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3600
eyes = [[0 for i in range(2)] for j in range(4)]
while True:
    try:
        a = list(map(float, input().split()))
    except:
        break
    for i in range(2):
        if a[i] >= 1.1: eyes[0][i]+=1
        elif a[i] >= 0.6: eyes[1][i]+=1
        elif a[i] >= 0.2: eyes[2][i]+=1
        else: eyes[3][i]+=1
for i in range(4):
    print(*eyes[i])


Measured memory_bytes: 5580
#include <cmath>
#include <vector>
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
	unsigned int n;
	double a1 = 0.0;
	double a2 = 0.0;
	double a3 = 0.0;
	double a4 = 0.0;
	vector<double> x, y;

	cin >> n;
	x.resize(n);
	y.resize(n);

	for (unsigned int i = 0; i < n; ++i) {
		cin >> x[i];
	}
	for (unsigned int i = 0; i < n; ++i) {
		cin >> y[i];
	}
	for (unsigned int i = 0; i < n; ++i) {
		a1 += fabs(x[i] - y[i]);
		a2 += pow(x[i] - y[i], 2);
		a3 += pow(fabs(x[i] - y[i]), 3);
		a4 = max(a4, fabs(x[i]-y[i]));
	}

	cout << setprecision(10) << a1 << endl;
	cout << setprecision(10) << sqrt(a2) << endl;
	cout << setprecision(10) << cbrt(a3) << endl;
	cout << setprecision(10) << a4 << endl;
	return 0;
}



Measured memory_bytes: 3476
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int k;
  cin>>k;
  cout<<(k%2==0 ? (k/2)*(k/2) : (k/2)*(k/2)+k/2);
  return(0);
}



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

int s;
typedef long long ll;
ll memo[2005][2005];
#define MOD 1000000007

ll choose(int n, int r){
    if (memo[n][r] != -1) return memo[n][r];
    if (n == r || r == 0) return 1;
    return memo[n][r] = (choose(n - 1, r) + choose(n - 1, r - 1)) % MOD;
}

int main(){
    scanf("%d", &s);
    ll ans = 0;
    memset(memo, -1, sizeof memo);
    for (int i = 1; i * 3 <= s; ++i){
        int tmps = s - 3 * i;
        ll tmp = choose(tmps + i - 1, i - 1);
        ans += tmp;
        ans %= MOD;
    }
    printf("%lld", ans);
}


Measured memory_bytes: 35208
n=int(input())
alist=[int(i) for i in input().split()]
blist=[int(i) for i in input().split()]
clist=[int(i) for i in input().split()]
before=-1
ans=0
for i in alist:
	ans=ans+blist[i-1]
	if before!=-1 and i==before+1:
		ans=ans+clist[before-1]
	if i==n:
		before=-1
	else:
		before=i
print(ans)

Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func main() {
	var (
		s string
		count = 0
	)
	fmt.Scan(&s)

	for i := 0; i < len(s); i++ {
		if s[i] == '1' {
			count++
		}
	}

	fmt.Println(count)
}





Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long N, M = 0, ANS = 0, GA, SA, BA, GB, SB, BB;
	cin >> N >> GA >> SA >> BA >> GB >> SB >> BB;
	for (long long i = 0; i <= N / GA; i++) {
		for (long long j = 0; j <= (N - GA * i) / SA; j++) {
			long long k = (N - GA * i - SA * j) / BA;
			M = max(M, N + (GB - GA) * i + (SB - SA) * j);
			M = max(M, N + (GB - GA) * i + (SB - SA) * j + (BB - BA) * k);
		}
	}
	if (M <= 5000) {
		for (long long i = 0; i <= M / GB; i++) {
			for (long long j = 0; j <= (M - GB * i) / SB; j++) {
				long long k = (M - GB * i - SB * j) / BB;
				ANS = max(ANS, M + (GA - GB) * i + (SA - SB) * j);
				ANS = max(ANS, M + (GA - GB) * i + (SA - SB) * j + (BA - BB) * k);
			}
		}
		cout << ANS;
	}
	else {
		long long COUNT = 0, X[2] = {}, Y[2] = {};
		if (GA > GB) X[0] = GA, Y[0] = GB, COUNT++;
		if (SA > SB) X[COUNT] = SA, Y[COUNT] = SB, COUNT++;
		if (BA > BB) X[COUNT] = BA, Y[COUNT] = BB, COUNT++;
		if (COUNT == 0) cout << M;
		else if (COUNT == 1) cout << (M % Y[0]) + (M / Y[0]) * X[0];
		else {
			for (long long i = 0; i <= M / Y[0]; i++) {
				long long j = (M - Y[0] * i) / Y[1];
				ANS = max(ANS, M + (X[0] - Y[0]) * i + (X[1] - Y[1]) * j);
			}
			cout << ANS;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    string S; cin >> S;
    bool ans = true;
    for (int i = 0; i < S.size(); i++) {
        int irev = S.size() - 1 - i;
        ans &= (S[i] == 'b' && S[irev] == 'd')
            || (S[i] == 'd' && S[irev] == 'b')
            || (S[i] == 'p' && S[irev] == 'q')
            || (S[i] == 'q' && S[irev] == 'p');
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<iomanip>
#define pi 3.14159265358979323846
#define ll long long
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  int n, a, b;
  cin >> n >> a >> b;
  a = a * n;
  if(a < b){
    cout << a << "\n";
    return 0;
  }
  cout << b << "\n";
}

Measured memory_bytes: 3592
var
	K:Longint;
	L,R,M:int64;
function check(T:int64):Longint;
var
	dp:Array[1..15,0..1,0..1,0..9]of Longint;
	S:String;
	i,j,k,l,nj,lim,sum,z,llim,rlim:Longint;
begin
	Str(T,S);
	for i:=1 to length(S)+1 do for j:=0 to 1 do for z:=0 to 1 do for k:=0 to 9 do dp[i,j,z,k]:=0;
	dp[1,0,1,0]:=1;
	for i:=1 to length(S) do begin
		for j:=0 to 1 do begin
			if j=0 then lim:=ord(S[i])-48 else lim:=9;
			inc(dp[i+1,1,1,0],dp[i,j,1,0]);
			for l:=1 to lim do begin
				nj:=j;
				if l<lim then nj:=1;
				inc(dp[i+1,nj,0,l],dp[i,j,1,0]);
			end;
			for k:=0 to 9 do begin
				llim:=k-1;if llim<0 then llim:=0;
				rlim:=k+1;if rlim>lim then rlim:=lim;
				for l:=llim to rlim do begin
					nj:=j;
					if l<lim then nj:=1;
					inc(dp[i+1,nj,0,l],dp[i,j,0,k]);
				end;
			end;
		end;
	end;
	sum:=0;
	for k:=0 to 9 do for i:=0 to 1 do begin
		inc(sum,dp[length(S)+1,i,0,k]);
	end;
	check:=sum;
end;
begin
	read(K);
	L:=0;
	R:=3234566667;
	while R-L>1 do begin
		M:=(L+R)div 2;
		if check(M)>=K then R:=M else L:=M;
	end;
	writeln(R);
end.


Measured memory_bytes: 128