akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define MAX_N 10000
#define INF 1e9

using namespace std;

typedef int long long ll;
typedef int long l;
typedef pair<int, int> Pii;
const ll MOD = 1000000007;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n;
    cin >> s;
    vector<int> a[10];
    for (int i = 0; i < n; i++) {
        a[s[i] - '0'].push_back(i);
    }
    bool ans[1000];
    for (int i = 0; i < 1000; i++) {
        int a3 = i % 10;
        int a2 = (i % 100) / 10;
        int a1 = (i) / 100;

        auto tmp = lower_bound(a[a1].begin(), a[a1].end(), 0);
        if (tmp == a[a1].end()) {
            ans[i] = false;
            continue;
        }
        tmp = lower_bound(a[a2].begin(), a[a2].end(), *tmp + 1);
        if (tmp == a[a2].end()) {
            ans[i] = false;
            continue;
        }
        tmp = lower_bound(a[a3].begin(), a[a3].end(), *tmp + 1);
        if (tmp == a[a3].end()) {
            ans[i] = false;
            continue;
        }
        ans[i] = true;
    }
    int res = 0;
    for (int i = 0; i < 1000; i++) {
        if (ans[i]) {
            res++;
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<algorithm>
using namespace std;
struct node{
	int LT,RT,LB,RB;
	int val;
	node(){
		LT=RT=LB=RB=-1;
		val=0;
	}
	node(int a,int b,int c,int d,int e){
		LT=a;
		RT=b;
		LB=c;
		RB=d;
		val=e;
	}
};
node pool[8000000];
int ind;
int Ret;
int nowret=0;
int query(int a,int b,int c,int d,int e,int f,int g,int h,int t){
	if(d<a||b<c)return 0;
	if(h<e||f<g)return 0;
	if(c<=a&&b<=d&&g<=e&&f<=h)return pool[t].val;
	if(nowret>=pool[t].val)return 0;
	int ret=0;
	if(~pool[t].LT){
		ret=nowret=max(ret,query(a,(a+b)/2,c,d,e,(e+f)/2,g,h,pool[t].LT));
	}
	if(~pool[t].RT){
		ret=nowret=max(ret,query(a,(a+b)/2,c,d,(e+f)/2+1,f,g,h,pool[t].RT));
	}
	if(~pool[t].LB){
		ret=nowret=max(ret,query((a+b)/2+1,b,c,d,e,(e+f)/2,g,h,pool[t].LB));
	}
	if(~pool[t].RB){
		ret=nowret=max(ret,query((a+b)/2+1,b,c,d,(e+f)/2+1,f,g,h,pool[t].RB));
	}
	return ret;
}
inline void update(int row,int col,int C){
	int now=0;
	int a=0;
	int b=1048575;
	int c=0;
	int d=1048575;
	while(1){
		pool[now].val=max(pool[now].val,C);
		if(a==b)break;
		int M=(a+b)/2;
		int N=(c+d)/2;
		if(row<=M&&col<=N){//LT
			b=M;
			d=N;
			if(~pool[now].LT){
				now=pool[now].LT;
			}else{
				pool[ind]=node();
				pool[now].LT=ind;
				now=ind++;
			}
		}
		if(row<=M&&col>N){//RT
			b=M;
			c=N+1;
			if(~pool[now].RT){
				now=pool[now].RT;
			}else{
				pool[ind]=node();
				pool[now].RT=ind;
				now=ind++;
			}
		}
		if(row>M&&col<=N){//LB
			a=M+1;
			d=N;
			if(~pool[now].LB){
				now=pool[now].LB;
			}else{
				pool[ind]=node();
				pool[now].LB=ind;
				now=ind++;
			}
		}
		if(row>M&&col>N){//RB
			a=M+1;
			c=N+1;
			if(~pool[now].RB){
				now=pool[now].RB;
			}else{
				pool[ind]=node();
				pool[now].RB=ind;
				now=ind++;
			}
		}	
	}
}
pair<int,pair<int,int> >dat[400000];
int x[400000];
int y[400000];
int z[400000];
int Q[400000];
int wolfa,wolfb,wolfC=~(1<<31),wolfM=(1<<16)-1;
int r(){
	wolfa=36969*(wolfa&wolfM)+(wolfa>>16);
	wolfb=18000*(wolfb&wolfM)+(wolfb>>16);
	return (wolfC&((wolfa<<16)+wolfb))%1000000;
}
int main(){
	int a,b,c,d;
	while(scanf("%d%d%d%d",&a,&b,&c,&d),a+b){
		for(int i=0;i<a;i++){
			scanf("%d%d%d",x+i,y+i,z+i);
			dat[i]=make_pair(x[i],make_pair(-y[i],-z[i]));
		}
		wolfa=c;
		wolfb=d;
		for(int i=0;i<b;i++){
			int X=r();
			int Y=r();
			int Z=r();
			dat[i+a]=make_pair(X,make_pair(-Y,-Z));
		}
		int n=a+b;
		std::sort(dat,dat+n);
		pool[0]=node();
		ind=1;
		Ret=0;
		for(int i=0;i<n;i++){
			nowret=0;
			int P=max(nowret,query(0,1048575,0,-dat[i].second.first-1,0,1048575,0,-dat[i].second.second-1,0))+1;
			Ret=max(Ret,P);
			Q[i]=P;
			update(-dat[i].second.first,-dat[i].second.second,P);
		}
		printf("%d\n",Ret);
	}
}

Measured memory_bytes: 167812
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <random>

using namespace std;
constexpr int D = 365;
vector<int> c(26);
vector< vector<int> > s(D, vector<int>(26));
vector<int> num(D), num2(D), ans(D);

int score() {
    int sat = 0;
    vector<int> last(26);
    for (int d=0; d<D; d++) {
        int j = num[d] - 1;
        last[j] = d + 1;
        for(int i=0; i<26; i++) {
            sat -= (d + 1 - last[i]) * c[i];
        }
        sat += s[d][j];
    }
        // assert(1 <= out[d] and out[d] <= 26)
        // j = out[d] - 1
        // last[j] = d + 1
        // for i in range(26):
        //     sat -= (d + 1 - last[i]) * c[i]
        // sat += s[d][j]
    return sat;
}

int main(void) {
    int g;
    cin >> g;
    for(int i=0; i<26; i++) {
        cin >> c[i];
    }
    for(int i=0; i<D; i++) {
        for(int j=0; j<26; j++) {
            cin >> s[i][j];
        }
    }

    // for(int i=0; i<D; i++) {
    //     num[i] = num2[i] = (i%26) + 1;
    // }

    int temp = numeric_limits<int>::min();
    for(int zurasu=0; zurasu<26; zurasu++) {
        for(int i=0; i<D; i++) {
            num[i] = (i+zurasu)%26 + 1;
        }
        if(int sat = score(); sat > temp) {
            ans = num;
            temp = sat;
        }
    }
    for(int zurasu=0; zurasu<26; zurasu++) {
        for(int i=0; i<D; i++) {
            num[i] = 26 - (i+zurasu)%26;
        }
        if(int sat = score(); sat > temp) {
            ans = num;
            temp = sat;
        }
    }
    // int temp = score();
    // int loop = 100000;
    // random_device seed_gen;
    // // mt19937 engine(seed_gen());
    // default_random_engine engine(seed_gen());
    // uniform_int_distribution<> dist(0, D-1);
    // while(loop--) {
    //     int l = dist(engine);
    //     int r = dist(engine);
    //     swap(num2[l], num2[r]);
    //     // shuffle(num2.begin(), num2.begin()+26, engine);
    //     if(int sat = score(); sat > temp) {
    //         num[l] = num2[l];
    //         num[r] = num2[r];
    //         temp = sat;
    //     } else {
    //         num2[l] = num[l];
    //         num2[r] = num[r];
    //     }
    // }
    // for(int a=0; a<100000; a++) {
    //     for(int i=0; i<D; i++) {
    //         num[i] = dist(engine);
    //     }
    //     if(int sat = score(); sat > temp) {
    //         ans = num;
    //         temp = sat;
    //     }
    // }
    
    // ans = num;
    for(int i=0; i<D; i++) {
        cout << ans[i] << endl;
    }
    cerr << temp << endl;
    return 0;
}


Measured memory_bytes: 3680
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
#include <cassert>
using namespace std;

typedef long long ll;

ll mod = 1e9 + 7;
map<string, ll> dp[103];


int main() {
	int n; cin >> n;
	char a[] = { 'A', 'G', 'C', 'T' };
	vector<string> key;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 4; k++) {
				key.push_back({ a[i], a[j], a[k] });
			}
		}
	}
	
	dp[0]["TTT"] = 1;
	for (int i = 1; i <= n; i++) {
		for (string k : key) {
			dp[i][{k[1], k[2], 'A'}] += dp[i - 1][k];
			dp[i][{k[1], k[2], 'A'}] %= mod;
		}
		for (string k : key) {
			if (k[1] == 'A' && k[2] == 'G') continue;
			if (k[0] == 'A' && k[1] == 'G') continue;
			if (k[0] == 'A' && k[2] == 'G') continue;
			if (k[1] == 'G' && k[2] == 'A') continue;
			dp[i][{k[1], k[2], 'C'}] += dp[i - 1][k];
			dp[i][{k[1], k[2], 'C'}] %= mod;
		}
		for (string k : key) {
			if (k[1] == 'A' && k[2] == 'C') continue;
			dp[i][{k[1], k[2], 'G'}] += dp[i - 1][k];
			dp[i][{k[1], k[2], 'G'}] %= mod;
		}
		for (string k : key) {
			dp[i][{k[1], k[2], 'T'}] += dp[i - 1][k];
			dp[i][{k[1], k[2], 'T'}] %= mod;
		}
	}
	ll ans = 0;
	for (auto k : key) ans += dp[n][k], ans %= mod;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  string s;
  cin >> s;
  vector<int> v(26);
  rep(i,s.size()) {
    v[s[i] - 'a']++;
  }
  rep(i,26) {
    if (v[i] % 2 != 0) {
      cout << "No" << endl;
      return;
    }
  }
  cout << "Yes" << endl;
}

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

Measured memory_bytes: 3648
#include <stdio.h>
 
typedef struct {
    int Up;
    int South;
    int East;
    int West;
    int North;
    int Down;
     
} Dice;
 
Dice moveNorth(Dice *d);
Dice moveWest(Dice *d);
Dice moveSouth(Dice *d);
Dice moveEast(Dice *d);
 
int main(int argc, const char * argv[]) {
    int d[6];
    int i;
    for(i=0;i<6;i++){
        scanf("%d",&d[i]);
    }
     
    Dice dice = {d[0],d[1],d[2],d[3],d[4],d[5]};
     
    char op[100];
    scanf("%s",op);
     
    int j=0;
    while(1){
        if(op[j]=='\0'){
            break;
        }
         
        switch (op[j]) {
            case 'N':
                dice = moveNorth(&dice);
                break;
            case 'W':
                dice = moveWest(&dice);
                break;
            case 'S':
                dice = moveSouth(&dice);
                break;
            case 'E':
                dice = moveEast(&dice);
                break;
            default:
                break;
        }
         
        j++;
    }
     
    printf("%d\n",dice.Up);
     
    return 0;
}
 
Dice moveNorth(Dice *d){
    Dice tmp = {d->South,d->Down,d->East ,d->West,d->Up,d->North};
    return tmp;
}
 
Dice moveWest(Dice *d){
    Dice tmp = {d->East,d->South,d->Down,d->Up,d->North,d->West};
    return tmp;
}
 
Dice moveSouth(Dice *d){
    Dice tmp = {d->North,d->Up,d->East ,d->West,d->Down,d->South};
    return tmp;
}
 
Dice moveEast(Dice *d){
    Dice tmp = {d->West,d->South,d->Up,d->Down,d->North,d->East};
    return tmp;
}

Measured memory_bytes: 596
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] a = new int[n+1];
      int[] b = new int[n+1];
      int m = 0;
      for(int i = 1;i <= n;i++)a[i]=sc.nextInt();
      for(int i = n;i >= 1;i--){
      	int x = 0;
        for(int j = i;j <= n;j+=i)x+=b[j];
        if(x%2==a[i])b[i]=0;
        else{
          b[i]=1;
          m++;
        }
      }
      System.out.println(m);
      for(int i = 1;i <= n;i++)if(b[i]==1)System.out.println(i);
    }
}

Measured memory_bytes: 100772
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10000;
typedef long long ll;
ll a[N];
int n;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+1+n,greater<ll>());
	ll sum=a[1];
	int pos=2;
	for(int i=2;i<n;i++)
	{
		if(i%2==0) sum+=a[pos];
		else sum+=a[pos++];
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 5236
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)998244353;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }
        static void Solve()
        {
            var NC = Sarray();
            var N = NC[0];
            var C = NC[1];
            var lst = Enumerable.Range(0, (int)C).Select(_ => new List<Tuple<long, long, long>>()).ToArray();//s,t,c
            for (var i = 0; i < N; ++i)
            {
                var stc = Sarray();
                lst[stc[2]-1].Add(Tuple.Create(stc[0], stc[1], stc[2]));
            }
            for (var i = 0; i < C; ++i)
                lst[i].Sort((l, r) => (int)(l.Item1 - r.Item1));
            
            var slst = new List<Tuple<long, long, long>>();
            for (var j = 0; j < C; ++j)
                for (var i = 0; i < lst[j].Count; ++i) 
                {
                    var s = lst[j][i].Item1;
                    var t = lst[j][i].Item2;
                    var c = lst[j][i].Item3;
                    while (i < lst[j].Count - 1 && lst[j][i].Item2 == lst[j][i + 1].Item1)
                    {
                        t = lst[j][i + 1].Item2;
                        ++i;
                    }
                    slst.Add(Tuple.Create(s, t, c));
                }
            var imos = new long[100000 + 2];
            foreach(var s in slst )
            {
                ++imos[s.Item1];
                --imos[s.Item2 + 1];
            }
            var ch = 0L;
            var ct = 0L;
            for (var i = 0; i < 100000 + 2; ++i)
            {
                ct += imos[i];
                ch = Max(ch, ct);
            }
            WriteLine(ch);
        }
    }
}

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

int H, W;
vector<ll> a;

int ID(int i, int j) { return W * (i - 1) + j; }

void abc109d() {
  int n = 0;
  vector<pair<int, int>> p, q;
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W - 1; j++) {
      if (a[ID(i, j)] % 2 == 1) {
        a[ID(i, j)]--;
        a[ID(i, j + 1)]++;
        n++;
        p.push_back(make_pair(i, j));
        q.push_back(make_pair(i, j + 1));
      }
    }
  }
  for (int i = 1; i <= H - 1; i++) {
    if (a[ID(i, W)] % 2 == 1) {
      n++;
      a[ID(i, W)]--;
      a[ID(i + 1, W)]++;
      p.push_back(make_pair(i, W));
      q.push_back(make_pair(i + 1, W));
    }
  }

  cout << n << '\n';
  for (int i = 0; i < p.size(); i++) {
    cout << p[i].first << ' ' << p[i].second << ' ';
    cout << q[i].first << ' ' << q[i].second << '\n';
  }
  return;
}

int main() {
  cin >> H >> W;
  a.resize(H * W + 1);
  for (int i = 1; i <= H * W; i++) {
    cin >> a[i];
  }
  abc109d();
  return 0;
}


Measured memory_bytes: 6252
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
typedef long long tolong;
const tolong mo = 1000000007;

int main(){
    int S;
    cin >> S;
    vector<tolong> A(S+1,0);

    A[0] = 1;

    for(tolong x = 3; x <= S;x++){
        A[x] = (A[x - 3] + A[x - 1]) % mo;
    }

    cout << A[S] << endl;
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct Point {
  int x, y;
  Point(){}
  Point(int x, int y):x(x), y(y){}
  Point operator + (const Point p) {
    return Point(x+p.x, y+p.y);
  }
  Point operator - (const Point p) {
    return Point(x-p.x, y-p.y);
  }
};

struct Man {
  Point p;
  int d;
  Man(){}
  Man(Point p, int d):p(p), d(d){}
};

struct Interval {
  int l, r;
  Interval(){}
  Interval(int l, int r):l(l), r(r){}
  Interval operator + (Interval i) {
    return Interval(l+i.l, r+i.r);
  }
  Interval operator - (Interval i) {
    return Interval(l-i.l, r-i.r);
  }
  bool operator < (const Interval &i) const {
    return l != i.l ? l < i.l : r < i.r;
  }
};

string D = "NESW";
Point dv[] = {
  Point(-1, 1),
  Point(1, 1),
  Point(1, -1),
  Point(-1, -1)
};

int n, w, h;
vector<Man> men;
vector<Interval> vec;

bool intersect(Point p) {
  return p.x<=0||w<=p.x||p.y<=0||h<=p.y;
}

int project(Point p) {
  if(p.y == 0) return p.x;
  if(p.x == w) return w+p.y;
  if(p.y == h) return w+h+(w-p.x);
  if(p.x == 0) return w+h+w+(h-p.y);
  assert(false);
}

Interval getInterval(Man man) {
  Point cpl = man.p, cpr = man.p;
  while(!intersect(cpl)) cpl = cpl+dv[(man.d+1)%4];
  while(!intersect(cpr)) cpr = cpr+dv[man.d];
  Interval res(project(cpl), project(cpr));
  return res;
}

bool contain(Interval i, int pos) {
  if(i.l <= pos && pos <= i.r) return true;
  if(i.r < i.l && pos <= i.r) return true;
  if(i.r < i.l && i.l <= pos) return true;
  return false;
}

int solve(int pos) {
  vector<Interval> rem;
  rep(i, n) {
    if(contain(vec[i], pos)) continue;
    int l = vec[i].l, r = vec[i].r;
    if(r < l) r += (w+h)*2;
    rem.push_back(Interval(l, r));
  }
  if(rem.empty()) return 1;
  sort(all(rem));
  int res = 2;
  int prev = inf;
  rep(i, rem.size()) {
    if(rem[i].l <= prev) chmin(prev, rem[i].r);
    else res++, prev = rem[i].r;
  }
  return res;
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin >> n >> w >> h;
  rep(i, n) {
    int x, y; char d;
    cin >> x >> y >> d;
    men.push_back(Man(Point(x, y), D.find(d)));
  }

  rep(i, n) {
    vec.push_back(getInterval(men[i]));
    //cout<<vec[i].l<<" "<<vec[i].r<<endl;
  }

  int ans = inf;
  rep(i, n) {
    chmin(ans, solve(vec[i].l));
    chmin(ans, solve(vec[i].r));
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b)
{
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
//cout << 'H' << endl;
/*--------------------------------------------*/

int main()
{
    //cout << fixed << setprecision(10)
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<int> h(N);
    rep(i, N) cin >> h[i];

    int dp[100010];
    memset(dp, 0, sizeof(dp));

    dp[1] = abs(h[0] - h[1]);

    for (int i = 2; i < N; i++) {
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]));
    }

    cout << dp[N - 1] << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

char input[10001];
int pos, n, length, vote[3335], vp;

int solve(void);
int cmp(const void *a, const void *b);

int main(void)
{
    int i, j;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%s", input);
        length = strlen(input);
        pos = 1;
        vp = 0;
        printf("%d\n", solve());
    }
    return 0;
}

int solve(void)
{
    int i = vp, num = 0, tmp, j, k;

    while (1) {
        if (input[pos] == '[') {
            pos++;
            vote[vp] = solve();
            vp++;
        } else if (input[pos] == ']') {
            pos++;
            if (num) {
                return num / 2 + 1;
            } else {
                qsort(vote+i, vp-i, sizeof(int), cmp);
                if ((vp-i+1)&1) {
                    for(j = i; j < (vp-i+1)/2 + i; j++) {
                        num += vote[j];
                    }
                } else {
                    for(j = i; j < (vp-i)/2+1 + i; j++) {
                        num += vote[j];
                    }
                }
                vp = i;
                return num;
            }
        } else {
            num *= 10;
            num += (input[pos] - '0');
            pos++;
        }
    }
}

int cmp(const void *a, const void *b)
{
    return *(int *)a - *(int *)b;
}

Measured memory_bytes: 676
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <map>
#include <queue>
#include <deque>
#include <set>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define FOR(i,a,b) for (int i = (a) ; i <= (b); ++i)
#define all(x) (x).begin(), (x).end()
//#define repitr(itr, st) for(auto itr = st.begin(); itr != st.end(); ++itr)
#define P_B push_back
#define PO_B pop_back
#define E_B emplace_back
#define M_P make_pair
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << endl
//#define print(x) printf("%d\n", x)

using namespace std;
using ll = long long;
using Pii = pair<int,int>;
using Pll = pair<ll,ll>;
using VI = vector<int>;
using VL = vector<ll>;
using VVI = vector<vector<int> >;
using VVL = vector<vector<ll> >;
//int dx[4] = {1, 0, -1, 0};
//int dy[4] = {0, 1, 0, -1};
//const ll LINF = (ll)1e18 - 1;
//const int INF = 1e9 - 1;
//int:±2*10^9くらい　ll:±9*10^18くらい



void Main(){
	int N, Q, M = 100005;
	ll ans=0;
	cin >> N;
	VI a(M, 0);
	rep(i, N) {
		int A;
		cin >> A;
		a[A]++;
		ans += A;
	}
	cin >> Q;
	VI b(Q), c(Q);
	rep(i, Q){
		cin >> b[i] >> c[i];
	}

	rep(i, Q){
		ll p;
		p = a[b[i]];
		ans += p * (c[i] - b[i]);
		a[b[i]] = 0;
		a[c[i]] += p;
		cout << ans << endl;
	}

//1000000000

}

int main()
{
	cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();

  return 0;
}


Measured memory_bytes: 4504
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(s);
  bool test1 = s[0] == 'A';
  int test2 = 0;
  bool test3 = true;
  FOR(i,2,s.size()-1){
    if(s[i]=='C') test2++;
    else if((s[i]>= 'A') && (s[i]<='Z')) test3 = false;
  }
  bool test4 = !((s[s.size()-1]>= 'A') && (s[s.size()-1]<='Z'));
  bool test5 = !((s[1]>= 'A') && (s[1]<='Z'));
  if(test1 && test2==1 && test3 && test4 && test5) OUT("AC");
  else OUT("WA");
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
#include <array>
#include <numeric>
#include <regex>
#include <bitset>
#include <deque>
#include <cassert>

using namespace std;
typedef long long ll;
typedef pair<int, int> p_ii;

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount

ll mod_pow(ll x, ll p) {
	if (p == 0)return 1LL;
	if (p % 2 == 1) {
		return mod_pow(x, p - 1)* x %MOD;
	}
	else {
		ll t = mod_pow(x, p / 2) % MOD;
		return t * t%MOD;
	}
}

ll fact[200010];

int main() {
    int N, M;
    cin >> N >> M;

    fact[0] = 1;
	for (int i = 1; i < 200001; i++) {
		fact[i] = (ll)(fact[i - 1] * i) % MOD;
	}

    map<ll, ll> cnt;
    for (ll i = 2; i*i <= M; i++) {
        while(M%i==0){
            cnt[i]++;
            M /= i;
        }
    }

    if(M!=1)
        cnt[M] = 1;

    ll res = 1;
    for(auto i : cnt){
        res = (res * ((fact[i.second+N-1] * mod_pow(fact[i.second], MOD - 2) % MOD) * mod_pow(fact[N-1], MOD - 2) % MOD)) % MOD;
    }
    cout << res << endl;

    return 0;
}

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

#define range 100005
#define mod 1000000007
#define eps 1e-9
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<
#define int long long 

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;



signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("test.txt","r",stdin);
	int a,b,c;
	cin>>a>>b>>c;
	int rem = a - b;
	int d = max((int)0,(int)(c-rem));
	cout<<d;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> h(n);
  vector<int> dp(n, 0);

  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  dp[1] = abs(h[1] - h[0]);
  for (int i = 2; i < n; i++) {
    int tmp1 = dp[i - 1] + abs(h[i] - h[i - 1]);
    int tmp2 = dp[i - 2] + abs(h[i] - h[i - 2]);
    if (tmp1 < tmp2) {
      dp[i] = tmp1;
    } else {
      dp[i] = tmp2;
    }
  }
  printf("%d\n", dp[n - 1]);
  return 0;
}

Measured memory_bytes: 4028
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define INF 1e9
using ll = std::int64_t;

template <class T>bool chmax(T &a, const T &b);
template <class T>bool chmin(T &a, const T &b);
//最大公約数
std::int64_t gcd(std::int64_t a, std::int64_t b);
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb);
//ラングレス圧縮
std::vector<std::pair<char, std::int64_t>> rle(std::string str);
//素数判定
bool is_prime(std::int64_t n);
// 約数の列挙
std::vector<std::int64_t> divisor(std::int64_t n);
// 素因数分解
std::map<std::int64_t,std::int64_t> prime_factor(std::int64_t n);

//10^9 + 7
#define yojo 1000000007
#define MAX_NUM 200001

void Main()
{
  int a, b;
  cin >> a >> b;
  std::cout << (0 <= a - (2 * b) ? a - (2 * b) : 0) << std::endl;

  return;
}

int main()
{
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

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

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

//最大公約数
std::int64_t gcd(std::int64_t a, std::int64_t b)
{
  // a >= b && b != 0
  std::int64_t c;
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}

//最大公約数安全版
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb)
{
  std::int64_t a = max(aa, bb);
  std::int64_t b = min(aa, bb);
  std::int64_t c;
  if (b == 0)
  {
    return -1;
  }
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}

//ラングレス圧縮
std::vector<std::pair<char, std::int64_t>> rle(std::string str)
{
  std::vector<std::pair<char, std::int64_t>> data;
  char now = str[0];
  std::int64_t count = 0;
  for (std::int64_t i = 0; i < str.size() + 1; i++)
  {
    if (i == str.size())
    {
      data.push_back(make_pair(str[i - 1], count));
      break;
    }
    else if (now != str[i])
    {
      data.push_back(make_pair(now, count));
      now = str[i];
      count = 0;
    }
    count++;
  }

  return data;
}

//素数判定
bool is_prime(std::int64_t n)
{
  for (std::int64_t i = 0; i * i <= n; i++)
  {
    if (n % i == 0)
    {
      return false;
    }
  }
  
  return n != 1;
}

//約数の列挙
std::vector<std::int64_t> divisor(std::int64_t n)
{
  std::vector<std::int64_t> res;
  for (int i = 0; i < n; i++)
  {
    if(n % i == 0){
      res.push_back(i);
      if (i != n / i) res.push_back(n / i);
    }
  }
  return res;
}

// 素因数分解
std::map<std::int64_t, std::int64_t> prime_factor(std::int64_t n)
{
  std::map<std::int64_t, std::int64_t> res;
  for (int i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      ++res[i];
      n /= i;
    }
  }

  if (n != 1)
  {
    res[n] = 1;
  }
  
  return res;
}

Measured memory_bytes: 256
#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
    int a, b, c;
    cin >> a >> b >> c;

    FOR(i, 1, 20000){
        if(a * i % b == c){
            p_yes();
            return 0;
        }
    }

    p_no();
    
    return 0;
}

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

void check(double w) {
    if(w <= 48) {
        cout << "light fly" << endl;
    } else if(48 < w && w <= 51) {
        cout << "fly" << endl;
    } else if(51 < w && w <= 54) {
        cout << "bantam" << endl;
    } else if(54 < w && w <= 57) {
        cout << "feather" << endl;
    } else if(57 < w && w <= 60) {
        cout << "light" << endl;
    } else if(60 < w && w <= 64) {
        cout << "light welter" << endl;
    } else if(64 < w && w <= 69) {
        cout << "welter" << endl;
    } else if(69 < w && w <= 75) {
        cout << "light middle" << endl;
    } else if(75 < w && w <= 81) {
        cout << "middle" << endl;
    } else if(81 < w && w <= 91) {
        cout << "light heavy" << endl;
    } else {
        cout << "heavy" << endl;
    }
}

int main(void) {
    double w;
    
    while(cin >> w) {
        check(w);
    }
    
    return 0;
}


Measured memory_bytes: 3084
char*p,E0[128],E1[128],da[128],db[128],dc[128],X;
StrRev(char*s){
	char*p=s+strlen(s),t;
	for(;--p>s;s++){
		t=*p,*p=*s,*s=t;
	}
}
C(){
	int ia,ib,ic,v;
	for(v=ia=ib=ic=0;dc[ic];){
		if(da[ia])
			v+=da[ia++]-'0';
		if(db[ib])
			v+=db[ib++]-'0';
		if(v%10+'0'!=dc[ic++])
			return 0;
		v/=10;
	}
	if(v||da[ia]||db[ib])
		return 0;
	return 1;
}
main(){
	for(;~scanf("%[^\n]\n",E0);){
		for(X='0';X<='9';X++){
			strcpy(E1,E0);
			while(p=strchr(E1,'X'))
				*p=X;
			sscanf(E1,"%[^+]+%[^=]=%s",da,db,dc);
			if(*da=='0'&&da[1]||*db=='0'&&db[1]||*dc=='0'&&dc[1])
				continue;
			StrRev(da);
			StrRev(db);
			StrRev(dc);
			if(C()){
				printf("%c\n",X);
				break;
			}
		}
		if(X=='9'+1)
			puts("NA");
	}
}

Measured memory_bytes: 0
implicit none
integer :: n
character(10) :: name(100), cswp
integer :: score(100), name_idx(100)
integer :: i, j,rswp
logical :: flg_swp
   
read *,n
do i = 1, n
   read *,name(i),score(i)
   name_idx(i) = i
enddo
   
! Sort name and score at the same time
! If two names are the same, see the two scores.
   i = n
   flg_swp = .false.
   do while (i > 1 .or. flg_swp)
      i = (i * 10) / 13
      if (i < 1) then
         i = 1
      else if (i == 9 .or. i == 10) then 
         i = 11
      endif
      flg_swp = .false.
      do j = 1, n-i
         if (name(j) == name(j+i)) then
            if (score(j) < score(j+i)) then  
               cswp = name(j) 
               name(j) = name(j+i)
               name(j+i) = cswp
               rswp = score(j)
               score(j) = score(j+i)
               score(j+i) = rswp
               rswp = name_idx(j)
               name_idx(j) = name_idx(j+i)
               name_idx(j+i) = rswp
               flg_swp = .true.
            endif
         else if (name(j) > name(j+i)) then
            cswp = name(j) 
            name(j) = name(j+i)
            name(j+i) = cswp
            rswp = score(j)
            score(j) = score(j+i)
            score(j+i) = rswp
            rswp = name_idx(j)
            name_idx(j) = name_idx(j+i)
            name_idx(j+i) = rswp
            flg_swp = .true.
         endif
      enddo
   enddo
   
do i = 1, n
   print '(i0)',name_idx(i)
enddo

end

Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

A, B = map(int, input().split())
S = input()

if S.count("-") == 1 and S[A] == "-":
    print('Yes')
else:
    print('No')

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

// 区間スケジューリング問題
int main(){

    int n;
    cin >> n;
    // first : 活動の終わり, second : 活動の始まり
    vector<pair<int, int>> activity(n);
    for(int i = 0; i < n; ++i){
        cin >> activity[i].second >> activity[i].first;
    }
    // 終わりが早い順に並べる
    sort(activity.begin(), activity.end());

    int time = 0;
    int cnt = 0;
    for(int i = 0; i < n; ++i){
        if(activity[i].second > time){
            time = activity[i].first;
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
const int N = 1005;

char s[N][N];
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
int vis[N][N];
int n, m, sx, sy, ex, ey;
vector<int> G[N * N];
void dfs(int x, int y, int c) {
    vis[x][y] = c;
    for (int i = 0; i < 4; i++) {
        int tx = x + dx[i], ty = y + dy[i];
        if (tx >= 1 && tx <= n && ty >= 1 && ty <= m && vis[tx][ty] == 0 && s[tx][ty] == '.') {
            dfs(tx, ty, c);
        }
    }
}
int d[N * N];
int main() {
    scanf("%d%d%d%d%d%d", &n, &m, &sx, &sy, &ex, &ey);
    for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
    int tot = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (vis[i][j] == 0 && s[i][j] == '.') dfs(i, j, ++tot);
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (s[i][j] == '#') continue;
            for (int x = i - 2; x <= i + 2; x++) {
                for (int y = j - 2; y <= j + 2; y++) {
                    if (x < 1 || y < 1 || x > n || y > m || s[x][y] == '#' || vis[x][y] == vis[i][j]) continue;
                    G[vis[i][j]].push_back(vis[x][y]);
                }
            }
        }
    }

    queue<int> q;
    memset(d, -1, sizeof d);
    d[vis[sx][sy]] = 0;
    q.push(vis[sx][sy]);
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        if (u == vis[ex][ey]) {
            printf("%d\n", d[u]);
            return 0;
        }
        for (auto v : G[u]) {
            if (d[v] == -1) {
                d[v] = d[u] + 1;
                q.push(v);
            }
        }
    }
    puts("-1");
    return 0;
}


Measured memory_bytes: 47808
#include<stdio.h>
int main()
{
    int n,i,j,k,l,max,min,b[200];
    while(scanf("%d",&n)!=EOF)
    {
        int count=0;
        int a[10]= {0};
        for(i=0; i<n; i++)
        {
            scanf("%d",&b[i]);
        }
        for(i=0; i<n; i++)
        {
            if(b[i]<=399)
            {
                if(a[0]==0)
                {
                    count++;
                    a[0]++;
                }
            }
            else if(b[i]<=799)
            {
                if(a[1]==0)
                {
                    count++;
                    a[1]++;
                }
            }
            else if(b[i]<=1199)
            {
                if(a[2]==0)
                {
                    count++;
                    a[2]++;
                }
            }
            else if(b[i]<=1599)
            {
                if(a[3]==0)
                {
                    count++;
                    a[3]++;
                }
            }
            else if(b[i]<=1999)
            {
                if(a[4]==0)
                {
                    count++;
                    a[4]++;
                }
            }
            else if(b[i]<=2399)
            {
                if(a[5]==0)
                {
                    count++;
                    a[5]++;
                }
            }
            else if(b[i]<=2799)
            {
                if(a[6]==0)
                {
                    count++;
                    a[6]++;
                }
            }
            else if(b[i]<=3199)
            {
                if(a[7]==0)
                {
                    count++;
                    a[7]++;
                }
            }

        }
        min=count;
        for(i=0; i<n; i++)
        {
            if(b[i]>=3200 && b[i]<=4800)
            {
                count++;
            }
        }
        if(min==0)
        {
            min=1;
        }
        max=count;
        printf("%d %d\n",min,max);
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	string a;
	while (getline(cin,a)&&a != "0000") {
		int b[4], l = 0, s = 0, f = atoi(a.c_str()), sum = 0;
		if (a[0] != a[1] || a[1] != a[2] || a[2] != a[3]) {
			while (f != 6174) {
				a = to_string(f);
				if (a.length() == 1)
					a = "000" + a;
				else if (a.length() == 2)
					a = "00" + a;
				else if (a.length() == 3)
					a = "0" + a;
				for (int i = 0; i < 4; i++) {
					b[i] = (int)a[i] - '0';
				}
				sort(b, b + 4);
				for (int i = 3; i >= 0; i--) {
					l += (pow(10, i)*b[i]);
				}
				for (int i = 0; i < 4; i++){
					s += (pow(10,3 - i)*b[i]);
				}
				f = l - s;
				sum++;
				l = 0;
				s = 0;
			}
			cout << sum << endl;
		}
		else 
			cout << "NA" << endl;
	}
}

Measured memory_bytes: 3400
#pragma comment (linker, "/STACK:256000000")
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long a = 0;a < b;++a)
#define ALL(x) (x).begin(),(x).end()
void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}
void solve() {
    cout << "square1001" << endl;
}
int main() {
    init();
    solve();
}


Measured memory_bytes: 3100
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni();
        int min = inf;
        int sum = 0;
        for (int i = 1; i < n; i++) {
            String a = String.valueOf(i);
            String b = String.valueOf(n-i);
            sum = 0;
            for (int j = 0; j < a.length(); j++) {
                sum += a.charAt(j)-'0';
            }
            for (int j = 0; j < b.length(); j++) {
                sum += b.charAt(j)-'0';
            }
            min = Math.min(min, sum);
        }
        out.println(min);
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 33692
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    string s, t; cin >> s >> t;

    cout << t + s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <cctype>
using namespace std;
#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)

string upperCamel(string& s){
    return (char)(s[0]-'a'+'A')+s.substr(1,s.size());
}
 
int main(void){
    string s;
    while(cin>>s){
        char c;cin>>c;
        if(c=='X')break;
        vector<string> ws;
        string tmp;
        rep(i,s.size()){
            if(isupper(s[i])){
                if(i==0){
                    tmp+=tolower(s[i]);
                    continue;
                }
                ws.push_back(tmp);
                tmp=tolower(s[i]);
            }else if(s[i]=='_'){
                ws.push_back(tmp);
                tmp="";
            }else tmp+=s[i];
        }
        ws.push_back(tmp);
        if(c=='L'){
            rep(i,ws.size()){
                if(i) cout<<upperCamel(ws[i]);
                else cout<<ws[i];
            }
            cout<<endl;
        }else if(c=='U'){
            rep(i,ws.size()){
                cout<<upperCamel(ws[i]);
            }
            cout<<endl;
        }else if(c=='D'){
            rep(i,ws.size()){
                if(i)cout<<"_";
                cout<<ws[i];
            }
            cout<<endl;
        }
    }
}

Measured memory_bytes: 1196
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iterator>
#include <set>
#include <functional>

using namespace std;

#define DT long long
#define forn(i,n)for(i=0;i<n;i++)
#define forc(i,c,n)for(i=c;i<=n;i++)

int main() {
	ifstream fin("Text.txt");
	int i, j, q;
	DT a, b, c, d,p, n, m, k, s, t, r;
	//scanf("%I64d", &n);
	//scanf_s("%d", &n);
	cin >> k;
	if (k < 50) {
		if (k == 0) {
			cout << 2 << endl;
			cout << "1 1" << endl;
			return 0;
		}
		if (k == 1) {
			cout << 2 << endl;
			cout << "2 0" << endl;
			return 0;
		}
		cout << k << endl;
		forn(i, k) {
			cout << k << " ";
		}
		return 0;
	}
	vector<DT>vc(50);
	p = k / 50;
	r = k - 50 * p;
	forn(i, 50) {
		vc[i] = 49 + p;
	}
	forn(i, r) {
		forn(j, 50) {
			if (j == i)
				vc[j] += 50;
			else
				vc[j]--;
		}
	}
	cout << 50 << endl;
	forn(i, 50) {
		cout << vc[i] << " ";
	}
	return 0;
}

Measured memory_bytes: 256
n,k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
now = a[0]
leng = 1
b = []
for i in a[1:]:
  if i == now:
    leng += 1
  else:
    b.append(leng)
    leng = 1
  now = i
b.append(leng)
b.sort()
len_b = len(b)
if len_b > k:
  print(sum(b[:len_b - k]))
else:
  print(0)

Measured memory_bytes: 24996
#include<stdio.h>

int main(void){
  int a,b;
  scanf("%d %d",&a,&b);

  if(a>b){
    printf("a > b\n");
  }else if(a<b){
    printf("a < b\n");
  }else{
    printf("a == b\n");
  }

}



Measured memory_bytes: 2040
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007



n, m, d = LI()
if d:
    print((m - 1) * (n - d) * 2 / n ** 2)
else:
    print((m - 1) / n)

Measured memory_bytes: 40816
candy_bag = list(map(int, input().split()))
max_bag_num = max(candy_bag)
bag = 0
small_bag_sum = 0
for bag in candy_bag:
	if bag == max_bag_num:
		continue
	else:
		small_bag_sum += bag

if max_bag_num == small_bag_sum:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 2940