akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, a, b) for(ll i = a;i<b; i++)
int main()
{

	int k, a, b;
	cin>>k>>a>>b;
	if(b%k==0)
    {
         cout<<"OK"<<endl;
        //break;
    }
    else
    {
        int t = b%k;
        b-=t;
        if(a<=b)
            cout<<"OK";
        else cout<<"NG";

    }
    return 0;
}


Measured memory_bytes: 3604
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
int main(void) {
	int x = 0, i = 0;
	while (true) {
		i++;
		scanf("%d", &x);
		if (x == 0) {
			break;
		}
		printf("Case %d: %d\n", i, x);
	}

	return 0;
}

Measured memory_bytes: 3128
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n; cin >> n;
    ll a[n];
    rep(i, n){
        cin >> a[i];
    }

    ll cnt[n+1] = {};
    rep(i, n){
        cnt[a[i]] ++;
    }

    ll cmb[n+1] = {};
    reps(i, 1, n+1){
        if(cnt[i] <= 1){
            cmb[i] = 0;
        }
        else{
            cmb[i] = cnt[i] * (cnt[i] - 1) / 2;
        }
    }

    ll total = accumulate(cmb, cmb + n + 1, 0LL);
    reps(i, 0, n){
        cout << total - (cnt[a[i]]) + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 7296
N,M = map(int,input().split())
H = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range (M)]

import sys
sys.setrecursionlimit(10**9)
Edge = [[] for _ in range(N)]
for a,b in AB:
    Edge[a-1].append(b-1)
    Edge[b-1].append(a-1)

visited = [False]*N
isPeak = [False]*N

def dfs(v):
    p = H[v]
    m = 0
    for nv in Edge[v]:
        m = max(m, H[nv])
        if visited[nv]:
            continue
        visited[nv] = True
        dfs(nv)
    if p>m:
        isPeak[v] = True

for i in range(N):
    if not visited[i]:
        visited[i] = True
        dfs(i)
ans = 0
for v in isPeak:
    if v:
        ans += 1
print(ans)


Measured memory_bytes: 693536
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://cf16-final-open.contest.atcoder.jp/tasks/codefestival_2016_final_c>
問題文============================================================
 問題文
 ある星には M 種類の言語があり、1[sim]M の番号が付けられています。
 
 この星のある年のCODE FESTIVALには星中から N 人の参加者が集まりました。
 
 i(1≦i≦N) 人目の参加者は Ki 種類の言語 Li,1,Li,2,…,Li,Ki を話すことが出来ます。
 
 ある 2 人は以下のいずれかの条件を満たすときに限り、コミュニケーションを取ることが出来ます。
 
 2 人ともが話すことの出来る言語が存在する。
 ある人 X が存在して、 2 人ともが X とコミュニケーションを取ることが出来る。
 このとき、N 人すべての参加者が他のすべての参加者とコミュニケーションを取ることが出来るかどうかを判定してください。
 
 制約
 2≦N≦105
 1≦M≦105
 1≦Ki≦M
 Kiの総和≦105
 1≦Li,j≦M
 Li,1,Li,2,…,Li,Ki は相異なる。
=================================================================

解説=============================================================

================================================================
*/

struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N,M; cin >> N >> M;
    vector<vector<ll>> lang(M);
    for(int i = 0; i < N;i++){
        ll K; cin >> K;
        for(int j = 0; j < K;j++){
            ll L; cin >> L;
            L--; lang[L].push_back(i);
        }
    }
    UnionFind uf(N);
    for(int i = 0; i < M;i++){
        for(int j = 0; j < (int)lang[i].size() - 1;j++){
            uf.unionSet(lang[i][j],lang[i][j+1]);
        }
    }
    set<ll> s;
    for(int i = 0; i < N;i++){
        s.insert(uf.root(i));
    }
    if(s.size() == 1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
	return 0;
}


Measured memory_bytes: 4736
import java.util.*;

public class Main{
  public static void main(String[] args){
     Scanner sc = new Scanner(System.in);
     int h = sc.nextInt();
     int w = sc.nextInt();

     String[] h_array = new String[h];

     for(int i=0; i<h; i++){
       h_array[i] = sc.next();
     }

     boolean[] h_judge = new boolean[h];
     boolean[] w_judge = new boolean[w];
     Arrays.fill(h_judge,false);
     Arrays.fill(w_judge,false);

     for(int i=0; i<h; i++){
       for(int j=0; j<w; j++){
         if(h_array[i].charAt(j)=='#'){
           h_judge[i] = true;
           w_judge[j] = true;
         }
       }
     }

     StringBuilder str = new StringBuilder();
     for(int i=0; i<h; i++){
       if(h_judge[i]){
         for(int j=0; j<w; j++){
           if(w_judge[j]){
             str.append(h_array[i].charAt(j));
           }

         }
         str.append(System.getProperty("line.separator"));
       }
     }

     System.out.println(str);



  }
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
//const int mod = 100000;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  string s, t;
  cin >> s >> t;
  int n = s.size();
  int ans = 0;
  rep(i, n) if(s[i]!=t[i]) ++ans;
  cout << ans << endl;
}


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

using namespace std;

#define PI 3.14159265358979323846264338327950L

int main(void){

    int H1,M1,H2,M2,K;
    int ans;

    cin>>H1>>M1>>H2>>M2>>K;

    ans=60*(H2-H1)+(M2-M1)-K;

    ans=max(ans,0);


    cout<<ans<<endl;


    return 0;
}



Measured memory_bytes: 3672
#include<stdio.h>
int main(void){
	int m,n,l;
	int a[100][100]={0},b[100][100]={0};
	long long int res[100][100]={0};
	int i,j,k;
	
	scanf(" %d %d %d",&m,&n,&l);
	for(i=0; i<m; i++) for(j=0; j<n; j++) scanf("%d",&a[i][j]);
	for(i=0; i<n; i++) for(j=0; j<l; j++) scanf("%d",&b[i][j]);
	
	for(i=0; i<m; i++)for(j=0; j<l; j++) for(k=0; k<n; k++) res[i][j]=res[i][j]+a[i][k]*b[k][j];
	for(i=0; i<m; i++) {
		for(j=0; j<l; j++){
			printf("%lld",res[i][j]); if(j!=l-1)printf(" ");
		} 	
	printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 768
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[100005], finv[100005], inv[100005];

int dp[100005][5], n, k[100005], l[100005], m[100005];
int main() {
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> k[i] >> l[i] >> m[i];
	}
	for (int i = 1; i <= n; ++i) {
		dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + k[i];
		dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + l[i];
		dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + m[i];
	}
	cout << max({ dp[n][0], dp[n][1],dp[n][2] }) << endl;
}

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


int main(){

	long long a,b;
	cin>>a>>b;

	if(a<=0 && 0<=b) cout<<"Zero"<<endl;
	else if(0<a) cout<<"Positive"<<endl;
	else if( (b-a+1)%2 ) cout<<"Negative"<<endl;
	else cout<<"Positive"<<endl;



}

Measured memory_bytes: 764
N,D=map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]

total_d = 0
count=0
for i in range(N-1):
    for k in range(i+1,N):
        for j in range(D):
            d = abs(X[i][j]-X[k][j])
            total_d += d**2
            #print(d)
        #print(d,total_d)
        if (total_d**(1/2)).is_integer():
            count+=1
            total_d = 0
        else:
            total_d = 0
        
print(count)

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

using namespace std;
#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n;
int x, y;
int a[N];
int b[N];

inline bool check (int cur) {

	for (int i = 1; i <= n; i ++) {
		if (a[i] > cur * (ll)y) {
			b[i] = a[i] - cur * y;
		} else {
			b[i] = 0;
		}
	}
	int sum = 0;
	for (int i = 1; i <= n; i ++) {
		sum += (b[i] + x - 1) / x;
		if (sum > cur) return 0;
	}
	return 1;
}


int main () {
	SpeedForce;
	cin >> n >> x >> y;
	x -= y;

	for (int i = 1; i <= n; i ++) {
		cin >> a[i];
	}

	int l = 0, r = 1e9;

	while (r - l > 1) {
		int md = (l + (ll)r) >> 1;
		if (check(md)) r = md;
		else l = md;
	}

	cout << r << '\n';

   	return Accepted;
}

// B...a

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define mod 998244353
using namespace std;

int read();
int M(int x) { return x >= mod ? x - mod : x; }
int fsp(int bs, int p) {
    int rt = 1;
    while (p) {
        if (p & 1) rt = 1ll * rt * bs % mod;
        bs = 1ll * bs * bs % mod, p >>= 1;
    }
    return rt;
}
int C2(int x) { return x * (x - 1) / 2; }
int fac[10004], caf[10004];
int C(int x, int y) { return 1ll * fac[x] * caf[y] % mod * caf[x - y] % mod; }
void init() {
    int lim = 10000;
    fac[0] = 1;
    for (int i = 1; i <= lim; ++i) fac[i] = 1ll * fac[i - 1] * i % mod;
    caf[lim] = fsp(fac[lim], mod - 2);
    for (int i = lim; i >= 1; --i) caf[i - 1] = 1ll * caf[i] * i % mod;
}

int rtt[20004], O[20004], ny;
void getrtt(int w, int len) {
    for (int i = 1; i < len; ++i) rtt[i] = rtt[i >> 1] >> 1 | ((i & 1) << w);
    for (int l = 2; l <= len; l <<= 1) O[l] = fsp(3, (mod - 1) / l);
    ny = fsp(len, mod - 2);
}

struct Poly {
    int x[20004];
    int &operator[](int p) { return x[p]; }
    void ntt(int len) {
        for (int i = 1; i < len; ++i)
            if (rtt[i] > i) swap(x[rtt[i]], x[i]);
        for (int l = 2; l <= len; l <<= 1) {
            for (int i = 0, m = l >> 1; i < len; i += l) {
                for (int j = i, tO = 1, t; j < i + m; ++j) {
                    t = 1ll * tO * x[j + m] % mod, tO = 1ll * tO * O[l] % mod;
                    x[j + m] = M(x[j] - t + mod), x[j] = M(x[j] + t);
                }
            }
        }
    }
    void idft(int len) {
        ntt(len), reverse(x + 1, x + len);
        for (int i = 0; i < len; ++i) x[i] = 1ll * x[i] * ny % mod;
    }
} f, g, tf;

int n, m;
int main() {
    // freopen("a.in", "r", stdin);
    // freopen("a.out", "w", stdout);
    n = read(), m = read();
    init();
    int w = 1, len = 2;
    while (len < 2 * n + 1) len <<= 1, ++w;
    for (int i = 1; i <= n; ++i) g[i] = caf[i + 2];
    getrtt(w - 1, len), g.ntt(len);
    tf[0] = f[0] = 1;
    for (int i = 1; i <= m; ++i) {
        f.ntt(len);
        for (int j = 0; j < len; ++j) f[j] = 1ll * f[j] * g[j] % mod;
        f.idft(len);
        for (int j = 0; j <= n; ++j) {
            tf[j] = M(1ll * f[j] * fac[j + 2] % mod +
                      1ll * tf[j] * (1 + j + C2(j)) % mod);
            f[j] = 1ll * tf[j] * caf[j] % mod;
        }
        for (int j = n + 1; j < len; ++j) f[j] = 0;
    }
    int res = 0;
    for (int i = 0; i <= n; ++i) res = M(res + 1ll * C(n, i) * tf[i] % mod);
    printf("%d\n", res);
    return 0;
}

int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') f = (c == '-') ? -1 : f, c = getchar();
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}

Measured memory_bytes: 640
let readInt _ = stdin.ReadLine() |> int
let modmul m x y = ((x % m) * (y % m)) % m
let mul = modmul 1000000007L

()
|> readInt
|> Seq.init
<| (fun x -> (x + 1) |> int64)
|> Seq.reduce mul
|> printfn "%d"


Measured memory_bytes: 48708
from math import sqrt
for t in xrange(input()):
    x0, y0, x1, y1, x2, y2, x3, y3 = map(int, raw_input().split())
    dx0 = x1 - x0
    dy0 = y1 - y0
    dx1 = x3 - x2
    dy1 = y3 - y2

    s = (y0-y2)*dx1 - (x0-x2)*dy1
    sm = dx0*dy1 - dy0*dx1
    if s < 0:
        s = -s
        sm = -sm
    t = (y2-y0)*dx0 - (x2-x0)*dy0
    tm = dx1*dy0 - dy1*dx0
    intersection = 0
    if t < 0:
        t = -t
        tm = -tm
    dis = sqrt(
            min(
                (x2-x0)**2 + (y2-y0)**2,
                (x3-x0)**2 + (y3-y0)**2,
                (x2-x1)**2 + (y2-y1)**2,
                (x3-x1)**2 + (y3-y1)**2
                )
            )
    ov = dx0*dy1 - dy0*dx1
    if 0 <= s <= max(sm, 0) and 0 <= t <= max(tm, 0):
        if ov == 0:
            r0 = dx0**2 + dy0**2
            r1 = (x2-x0)*dx0 + (y2-y0)*dy0
            r2 = (x3-x0)*dx0 + (y3-y0)*dy0
            if r1 > r2: r1, r2 = r2, r1
            if r2 < 0 or r0 < r1:
                intersection = 0
            else:
                intersection = 1
        else:
            intersection = 1
    else:
        if ov == 0:
            r0 = dx0**2 + dy0**2
            r1 = dx0*(x2-x0) + dy0*(y2-y0)
            r2 = dx0*(x3-x0) + dy0*(y3-y0)
            if 0 <= r2 and r1 <= r0:
                dis = min(dis, abs(dx0*(y2-y0) - dy0*(x2-x0)) / sqrt(r0))
        else:
            r0 = dx0**2 + dy0**2
            r1 = dx0*(x2-x0) + dy0*(y2-y0)
            r2 = dx0*(x3-x0) + dy0*(y3-y0)
            if 0 <= r1 <= r0:
                o1 = abs(dx0*(y2-y0) - dy0*(x2-x0))
                dis = min(dis, o1 / sqrt(r0))
            if 0 <= r2 <= r0:
                o2 = abs(dx0*(y3-y0) - dy0*(x3-x0))
                dis = min(dis, o2 / sqrt(r0))
            s0 = dx1**2 + dy1**2
            s1 = dx1*(x0-x2) + dy1*(y0-y2)
            s2 = dx1*(x1-x2) + dy1*(y1-y2)
            if 0 <= s1 <= s0:
                o1 = abs(dx1*(y0-y2) - dy1*(x0-x2))
                dis = min(dis, o1 / sqrt(s0))
            if 0 <= s2 <= s0:
                o2 = abs(dx1*(y1-y2) - dy1*(x1-x2))
                dis = min(dis, o2 / sqrt(s0))

        intersection = 0
    if intersection:
        print "%.09f" % 0
    else:
        print "%.09f" % dis

Measured memory_bytes: 6564
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

int N, M, K, Q, W, H, R, C;
char S[400][400];
int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);

    cin >> N;
    REP(i, N) {
        REP(j, N) { cin >> S[i][j]; }
    }

    int ans = 0;
    REP(A, N) {
        bool flag = true;
        // cout << A << endl;
        REP(h, N) {
            REP(w, N) {
                // cout << h << " " << w << " " << S[h][w] << " : ";
                // cout << (N + w - A) % N << " " << (h + A) % N << " " << S[(N + w - A) % N][(h + A) % N] << endl;
                if (S[h][w] != S[(N + w - A) % N][(h + A) % N]) {
                    flag = false;
                    break;
                }
            }
            if (!flag) break;
        }
        if (flag) ans += N;
    }

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


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

int rem(int x) {
	int ret = 0;
	while(x % 100 == 0) {
		x /= 100;
		++ret;
	}
	return ret;
}

int main()
{
	
	int d,n;
	cin>>d>>n;
	int count = 0, val = 0;
	while(count < n) {
		++val;
		if(rem(val) == d) ++count;
	}
	cout << val << '\n';
	
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define BeatMeScanf ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define sz 150010
const int mod=1000000007;

int main(){
    BeatMeScanf;
    int n;
    while(cin>>n){
        string s,ans;
        cin>>s;

        for(int i=0;i<s.size();i++){
            int x=s[i]+n;
            if(x>90) x=x-90+64;
            cout<<char(x);
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
def is_prime(num):
    """ ??°???????´???°????????????????????????
    http://judge.u-aizu.ac.jp/onlinejudge/commentary.jsp?id=ALDS1_1_C
    :param num: ?????????????????°???
    :return: num????´???°??§????????°True
    """
    if num == 2:
        return True
    if num < 2 or num % 2 == 0:
        return False

    i = 3
    while i <= num**0.5:
        if num % i == 0:
            return False
        i += 2
    return True


if __name__ == '__main__':
    # ??????????????\???
    data = []
    num = int(input())
    for i in range(num):
        data.append(int(input()))
    # data = [6, 2, 3, 4, 5, 6, 7]

    # ?´???°????????°?????????
    num_of_prime = 0
    for d in data:
        if is_prime(d):
            num_of_prime += 1

    # ???????????????
    print('{0}'.format(num_of_prime))

Measured memory_bytes: 8048
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <bitset>
#include <queue>

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

using namespace std;
int main() {
    long long ans = 0;
    string S;
    cin >> S;
    for(int i = 0; i < (1 << S.size()); i++) {
        long long divide = 0;
        vector<long long> d;
        for(int j = 0; j < S.size(); j++) {
            if (i & (1 << j)) {
                d.push_back(divide);
                divide = 0;
            } else {
                divide *= 10;
                divide += (long long)S[j] - '0';
            }
        }
        d.push_back(divide);

        for(int k = 0; k < d.size(); k++) {
            ans += d[k];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
l=[set() for i in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  l[a-1].add(b-1)
  l[b-1].add(a-1)
ope=[1]*N
ope[0]=0
s={0}
ans=[-1]*N
while len(s):
  news=set()
  for j in s:
    for k in l[j]:
      if ope[k]:
        news.add(k)
        ans[k]=j
        ope[k]=0
  s=news
print('Yes')
for i in range(1,N):
  print(ans[i]+1)
    

Measured memory_bytes: 67612
#include <stdio.h>
#include <math.h>

#define MAX 1000000

int main(void) {
	double v;
	double t;
	double y;
	int n;

	while (scanf("%lf", &v) != EOF) {
		t = v/9.8;
		y = 4.9*t*t;
		for(n = 0; n < MAX; n += 5) {
			if (n-5<y && y<n)
				break;
		}
		printf("%d\n", (n+5)/5);
	}
	return 0;
}

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

int ans=0;

void sol(int num, int keta, int N, bool t, bool f, bool s){
  if(keta==0){
    if(N>=num && t && f && s) ans++;
    return;
  }
  sol(num*10+3, keta-1, N, true, f, s);
  sol(num*10+5, keta-1, N, t, true, s);
  sol(num*10+7, keta-1, N, t, f, true);
  return;
}


int main(){
  int N;
  cin >> N;
  int keta = log10(N)+1;
  for(int i=1; i<=keta; i++){
    sol(0, i, N, false, false, false);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <math.h> 
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <string>
#include <numeric>
#include <bitset>
#include <queue>
#include <map>

using namespace std;


int main() {
	/*
	①同じ文字が異なる文字に変換された。(a->b,a->c)  例:aab&cdd
	②異なる文字が同じ文字に変換された。(b->a,c->a) こっちはOK 例：chokudai&redcoder
	の一つでも該当したらNo
	*/

	//input
	string S, T;
	cin >> S >> T;

	map<char, char> st, ts;
	int ans_st = 0;

	//S,Tの同じ番目のmapをつくる
	for (int i = 0; i < S.size(); ++i) {
		char s = S[i];
		char t = T[i];

		st.insert(make_pair(s, t));
		ts.insert(make_pair(t, s));
	}

	//①ここを高速化したい
	for (int i = 0; i < S.size(); ++i) {
		char tmp = T[i];
		if (st[S[i]] != tmp) {
			ans_st = 1;
			cout << "No" << endl;
			return 0;
		}
	}

	//Sの重複の削除
	sort(S.begin(), S.end());
	S.erase(unique(S.begin(), S.end()), S.end());

	//st[S[i]]をvecに格納する(Tに重複があるとき)
	vector<char> vec;
	for (int i = 0; i < st.size(); ++i) {
		vec.push_back(st[S[i]]);
	}
	//②vecに同じ文字があったら一つの文字が二つの変換先を持つということになるのでフラグを立てる
	for (int i = 0; i < vec.size(); ++i) {
		for (int j = i + 1; j < vec.size(); ++j) {
			if (vec[i] == vec[j]) {
				ans_st = 1;
				cout << "No" << endl;
				return 0;
			}
		}
	}

	//Tの重複の削除
	sort(T.begin(), T.end());
	T.erase(unique(T.begin(), T.end()), T.end());

	//st[T[i]]をvecに格納する(Sに重複があるとき)
	vector<char> vec2;
	for (int i = 0; i < ts.size(); ++i) {
		vec2.push_back(ts[T[i]]);
	}
	//②vecに同じ文字があったら一つの文字が二つの変換先を持つということになるのでフラグを立てる
	for (int i = 0; i < vec2.size(); ++i) {
		for (int j = i + 1; j < vec2.size(); ++j) {
			if (vec2[i] == vec2[j]) {
				ans_st = 1;
				cout << "No" << endl;
				return 0;
			}
		}
	}

	if (ans_st == 0) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 776
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
using ll = long long;
#define pi 3.1415926

int x[3];

int main(){
    int a, b;
    cin >> a >> b;
    int p = a * b;
    int cesta = 1*a + 1*b - 1*1;
    cout << p - cesta;
}
	


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,k;
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
		if(i%k==0)
		{
			puts("OK");
			return 0;
		}
	puts("NG");
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
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(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	debug("debug test\n");
   	int n,m;cin>>n;
	vint a(n), b(n), c(n), d(n);
	vector<P> s, t;
	rep(i, n){cin>>a[i]>>b[i];s.push_back(P(a[i], b[i]));}
	rep(i, n){cin>>c[i]>>d[i];t.push_back(P(c[i], d[i]));}
	sort(all(t));
	//sort(all(s));
	vint used(n, 0);

	int ans = 0;
	rep(i, n){
		int ma = -1;
		int pos = -1;
		rep(j, n){
			if(used[j]!=1&&s[j].first< t[i].first&&s[j].second < t[i].second){
				if(chmax(ma, s[j].second)){
					pos = j;
				}
			}
		}
		if(pos != -1){
			ans++;
			used[pos] = 1;
			debug("%d %d\n", i, pos);
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define int long long
using namespace std;

int a[10];
int x[5];
int n;

signed main()
{
	for (int i = 0; i < 6; i++) {
		cin >> n;
		a[n]++;
	}
	for (int i = 1; i <=4; i++) {
		x[a[i]]++;
	}
	if (x[1] == 2 && x[2] == 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}


	return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
 
#define PI 3.141592653589793
 
int main(void){
    int a,b,c;
    double s,l,h;
     
    scanf("%d%d%d",&a,&b,&c);
     
    s = sin(c * PI / 180.0)*a*b/2;
    l = a + b + sqrt(a*a + b*b - 2*a*b * cos(c * PI / 180.0));
    h = s/a*2;
     
    printf("%lf %lf %lf\n" ,s,l,h);
     
    return 0;
}


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

int main(){
  int N,A,B;
  int numA=0,numB=0;
  char S[100000];

  cin >> N >> A >> B ;
  for (int i = 0;i<N;i++){
    cin >> S[i];
  }

  for(int i=0;i<N;i++){
    if (S[i]=='c'){cout << "No" << endl;}

    else{
      if((A+B)<=(numA+numB)){cout << "No" << endl;}

      else if(S[i]=='a'){numA++;cout << "Yes" << endl;}
      
      else {
	if(numB>=B){cout << "No" << endl;}
	else{numB++;cout << "Yes" << endl;}
      }
    } 
  }
}


Measured memory_bytes: 768
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
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 13
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 = str(I())
K = I()
digit_len = len(n)
dp = [[[0] * (K + 1) for _ in range(2)] for _ in range(digit_len + 1)]
dp[0][0][0] = 1
for i in range(digit_len):
    d = int(n[i])
    for j in range(2):
        for k in range(K + 1):
            for l in range(10 if j else d + 1):
                if k + bool(l) <= K:
                    dp[i + 1][j or (l < d)][k + bool(l)] += dp[i][j][k]



print(dp[digit_len][0][K] + dp[digit_len][1][K])





Measured memory_bytes: 41968
#include <iostream>
#include <vector>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using pii = pair<int, int>;
using pll = pair<LL, LL>;


int main()
{
    cin.sync_with_stdio(0);

    int N;
    cin >> N;

    int xor_all = 0;
    vector<int> nrs;
    for (int i = 0; i < N; ++i)
    {
        int nr;
        cin >> nr;

        xor_all ^= nr;
        nrs.emplace_back(nr);
    }
    
    vector<int> res;
    for (int i = 0; i < N; ++i)
    {
        res.emplace_back(xor_all ^ nrs[i]);
    }

    for (const int &nr : res)
    {
        cout << nr << " ";
    }
}

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

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

    int ans = 0;
    if (N / 1000 == 2)
        ans++;
    N -= N / 1000 * 1000;
    if (N / 100 == 2)
        ans++;
    N -= N / 100 * 100;
    if (N / 10 == 2)
        ans++;
    N -= N / 10 * 10;
    if (N == 2)
        ans++;

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

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

int main() {
    int N,M,X,Y;
    cin >> N >> M >> X >> Y;
    vector<int>x(N);
    vector<int>y(M);
    for(int i = 0; i < N; i++) {
        cin >> x[i];
    }
    for(int i = 0; i < M; i++) {
        cin >> y[i];
    }
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    if(x[N-1] < y[0]) {
        if(y[0] > X && x[N-1] < Y) {
            cout << "No War" << endl;
            return 0;
        } 
    }
    cout << "War" << endl;
}

Measured memory_bytes: 256
# import bisect
# import heapq
# import math
# import random
# from collections import Counter, defaultdict, deque
# from decimal import Decimal
# from functools import lru_cache, reduce
# from itertools import combinations, combinations_with_replacement, product, permutations
# from operator import add, mul, sub, itemgetter
# import numpy as np

import sys
sys.setrecursionlimit(10000)

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time
	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

def read_int(input=None):
	if input == None:
		input = sys.stdin.readline().strip()
	ret = [int(x) for x in input.split()]
	if len(ret) == 1:
		ret = ret[0]
	return ret

def read_float(input):
	if input == None:
		input = sys.stdin.readline().strip()
	ret = [float(x) for x in input.split()]
	if len(ret) == 1:
		ret = ret[0]
	return ret
	
def read_str(input):
	if input == None:
		input = sys.stdin.readline().strip()
	ret = [x for x in input.split()]
	if len(ret) == 1:
		ret = ret[0]
	return ret
		
@mt
def slv(*args): 
	# 処理
	# ここから
	
	if max(L) < sum(L) - max(L):
		ans = 'Yes'
	else:
		ans = 'No'
	
	# ここまで
	return ans

if __name__ == '__main__':
	
	# テスト用入力
	t = '''4
3 8 5 1'''.splitlines()
	
	# 入力 (変数= read_xxx(test[行数]))
	# ここから
	
	N = read_int()
	L = read_int()
	
	# ここまで
		
	# 出力
	# ここから
	
	print(slv(N, L))
	
	# ここまで

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9


int main(){ 
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  REP(i, N){
    cin >> h[i];
  }
  int cnt = 0;
  REP(i, N){
    if(h[i] >= K){
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}



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

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

  vector<int> A(N);
  for ( int i = 0; i < M; i++ ) {
    int a, b;
    cin >> a >> b;

    A.at(a-1)++;
    A.at(b-1)++;
  }

  for ( int i = 0; i < N; i++ ) cout << A.at(i) << endl;
}

Measured memory_bytes: 256
// 2020-09-13 21:00:38
// clang-format off
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

// clang-format on
const ll inf = 1e18;
void answer() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll ans = -inf;
  chmax(ans, a * c);
  chmax(ans, a * d);
  chmax(ans, b * c);
  chmax(ans, b * d);
  cout << ans << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3648
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define SZ(x) ((ll)(x).size())
typedef long long ll;
typedef pair<int, int> P;
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;}

int main(){
    int n,m;
    cin >> n >> m;
    vector<string> a(n);
    vector<string> b(n);
    REP(i,n){
        cin >> a[i];
    }
    REP(i,m){
        cin >> b[i];
    }
    REP(k,n-m+1){
        REP(l,n-m+1){
            bool flag = true;
            REP(i,m){
                REP(j,m){
                    if(a[k+i][l+j]!=b[i][j])flag = false;
                }
            }
            if(flag){
                put("Yes");
                return 0;
            }
        }
    }
    put("No");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 200000000000000
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long  

/////////////


signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n,l;
	cin>>n>>l;
	int to=0;
	int mi=inf;
	int v=0;
	for(int i=1;i<=n;++i)
	{
		to+=l+i-1;
		if(mi>abs(l+i-1))
		{
			mi=abs(l+i-1);
			v=l+i-1;
		}
	}
	cout<<to-v;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    string S, T;
    cin >> S >> T;

    string ans = "";

    for (int i = 0; i < N; i++) {
        ans += S.at(i); 
        ans += T.at(i); 
    }
    

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i,n) for (int i=0;i<n;i++)
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> b(n);
  rep(i,n) cin >> b[i];
  vector<int> c(n-1);
  rep(i,n-1) cin >> c[i];
  rep(i,n) a[i]--;
  int count = 0;
  rep(i,n){
    count += b[a[i]];
  }
  rep(i,n){
    if(a[i] + 1 == a[i+1]){
      count += c[a[i]];
    }
  }
  cout << count << endl;
  return 0;
}


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

int main() {
    ll n, p;
    cin >> n >> p;

    vector<pair<ll, ll>> prime;

    for(ll i = 2; i*i <= p; ++i) {
        if(p % i != 0) continue;

        ll ex = 0;
        while(p % i == 0) {
            ++ex;
            p /= i;
        }
        prime.emplace_back(i, ex);
    }

    if(p != 1) prime.emplace_back(p, 1);

    /*rep(i, prime.size()) {
        cout << prime[i].first << " " << prime[i].second << endl;
    }
    */

    ll ans = 1;

    for(ll i = 0; i < (ll)prime.size(); ++i) {
        ll t = prime[i].second / n;

        //cout << t << endl;

        if(t == 0) continue;
        else {
            ll c = 1;
            for(ll j = 0; j < t; ++j) {
                c *= prime[i].first;
            }

            ans *= c;
        }
    }

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

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

// 復習場所
int main() {
    ll n;
    cin >> n;
    vector<int> ans;
    while(n!=0){
        if(n%2 != 0){
            n--;
            ans.push_back(1);
        }else{
            ans.push_back(0);
        }
        n/=-2;
    }

    if(ans.size()==0){
        cout << 0 << endl;
        return 0;
    }

    reverse(ans.begin(), ans.end());
    for(auto e: ans){
        cout << e;
    }
    return 0;
}

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

int main() {
  int N; cin >> N;
  int heal = 0;
  vector<int> d;

  for(int i=0; i<N; ++i) {
    int a; cin >> a;
    d.push_back(a);
  }
  for(int i=0; i<N-1; ++i) {
    for(int j=i+1; j<N; ++j) {
      heal += (d[i] * d[j]);
    }
  }
  cout << heal << endl;
}


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

public class Main{
	 public static void main(String[] args) {
		 ArrayList<Integer> a  = new ArrayList<>();
		 Scanner sc = new Scanner(System.in);
		 int n = sc.nextInt(); 
		 for(int i = 0; i < n; i++) {
			 int command = sc.nextInt();
			 switch(command) {
			 	case 0:
			 		a.add(sc.nextInt());			 		
			 		break;
			 		
			 	case 1:
			 		System.out.println(a.get(sc.nextInt()));
			 		break;
			 		
			 	case 2:
			 		a.remove(a.size() - 1);
			 		break;	
			 
			 }
		 }
	 }
}



Measured memory_bytes: 130788
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.bm", "r", stdin);
	string str = "";

	while (getline (cin, str ) ){

		if (str.length() == 1 && str[0] == '0'){
			break;
		} // end if
		int i;
		int len = str.length();
		int scoreA = 0;
		int scoreB = 0;
		for (i = 1; i < len; ++i){
			if (str[i] == 'A'){
				++scoreA;
			}else{
				++scoreB;
			} // end if
		} // end for

		if (scoreA > scoreB ){
			++scoreA;
		}else if (scoreA < scoreB){
			++scoreB;
		} // end if

		cout << scoreA << ' ' << scoreB << endl;

	} // end loop

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <stack>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    stack<int> S1;
    stack<pair<int,int>> S2;
    char ch;
    int area = 0;
    for(int i=0; cin >> ch; i++ ){
        if( ch =='\\'){
            S1.push(i);
        }else if( ch == '/' and S1.size()>0){
            int j= S1.top();
            S1.pop();
            area += i-j;
            int a = i-j;
            while( S2.size()>0 and S2.top().first > j ){
                a+= S2.top().second;
                S2.pop();
            }
            S2.push(make_pair(j,a));
        }
    }

    vector<int> ans;
    while( S2.size() > 0){
        ans.push_back(S2.top().second);
        S2.pop();
    }
    reverse(ans.begin(),ans.end());

    cout << area << endl;
    cout << ans.size();
    for(int i=0; i<ans.size(); ++i){
        cout <<" " << ans[i];
    }
    cout << endl;

}


Measured memory_bytes: 3232
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;


ll sumOfRange(ll N) {
	return N * (N - 1) / 2;
}


struct UF
{
public:
	ll tsize;
	ll mode;
	ll connect = 0;
	vll nodeSize;
	vll par;
	vll rank;
	UF(){};
	UF(const UF &uf) {}
	UF(ll _size, ll _mode = 0)
	{
		tsize = _size;
		mode = _mode;
		par.assign(tsize, -1);
		if (!mode)
			rank.resize(tsize, 0);
		nodeSize.resize(tsize, 1);
	}
	ll root(ll x)
	{
		return par[x] < 0 ? x : par[x] = root(par[x]);
	}
	bool isRoot(ll x)
	{
		return root(x) == x;
	}
	void unite(ll x, ll y)
	{
		x = root(x);
		y = root(y);
		if (x == y)
			return;
		if (mode)
		{
			par[x] += par[y];
			par[y] += x;
		}
		else
		{
			connect -= sumOfRange(nodeSize[x]) + sumOfRange(nodeSize[y]);
			connect += sumOfRange(nodeSize[x] + nodeSize[y]);
			if (rank[x] < rank[y])
			{
				nodeSize[y] += nodeSize[x];
				par[y] += par[x];
				par[x] = y;
			}
			else
			{
				nodeSize[x] += nodeSize[y];
				par[x] += par[y];
				par[y] = x;
				if (rank[x] == rank[y])
					rank[x]++;
			}
		}
	}
	bool same(ll x, ll y)
	{
		return root(x) == root(y);
	}
	ll size(ll x)
	{
		return -par[root(x)];
	}
};

int main () {
    ll N, M;
    cin >> N >> M;
    vpll vp;
    for(int i = 0; i < M; i++)
    {
        ll a, b;
        cin >> a >> b;
        vp.push_back(make_pair(a, b));
    }
    ll ans = 0;
    for(int i = 0; i < M; i++)
    {
	    UF *uf = new UF(N);
        for(int node = 0; node < M; node++)
        {
            if(i != node) {
                uf->unite(vp[node].first - 1, vp[node].second - 1);
            }
        }
        // 根の数=島の数
        set<ll> parents;
        for(int node = 0; node < N; node++)
        {
            parents.insert(uf->root(node));
        }
        if(parents.size() >= 2) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%lld%lld", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 1000000000000000000
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
ll dp[100005],v[105],w[105],V;
ll minm(ll a,ll b){
	return a<b?a:b;
}
int main(){
	ll n,W;
	while(~getII(n,W)){
		F(i,0,n) getII(w[i],v[i]);
		V=0;
		F(i,0,n) V+=v[i];
		FE(i,0,V) dp[i]=INF;
		dp[0]=0;
		F(i,0,n) for(int j=V;j>=v[i];j--) dp[j]=minm(dp[j-v[i]]+w[i],dp[j]);
		int ans=-1;
		FE(j,0,V) if(dp[j]<=W&&j>ans) ans=j;
		printf("%d\n",ans);
	}
}


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

int main() {
  string _,s;
  cin >> _; cin >> s; cin >> _;
  cout << "A" << s[0] << "C" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<30)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  int H[N+10];
  H[0]=0;
  for(int i=1;i<=N;i++){
    cin >> H[i];
  }
  int ans=0;
  for(int i=1;i<=N;i++){
    bool flag =true;
    for(int j=0;j<i;j++){
      if(H[j]>H[i]){
        flag=false;
        break;
      }
    }
    if(flag){
      ans++;
    }
  }

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


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INF 10000000000
#define mod 1000000007
typedef long long int ll;
ll u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
ll d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll gcd(ll a,ll b){
  if(!b)return a;
  return gcd(b,a%b);
}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
int f(ll a){
  for(int i=2;i<=sqrt(a);i++)if(a%i<1)return 0;
  return 1;
}
int x[1001];
int main(void){
  int n;
  scanf("%d",&n);
  int a;
  int list[n],r=0;
  FOR(n){
    scanf("%d",&a);
    if(a>0){
      if(x[a]){
        PRN(i+1);
        return 0;
      }else{
        x[a]++;
        list[r]=a;
        r++;
      }
    }else{
      a*=-1;
      if(list[r-1]==a){
        x[a]--;
        r--;
      }else{
        PRN(i+1);
        return 0;
      }
    }
  }
  PRS("OK");
  return 0;
}



Measured memory_bytes: 2044