akhauriyash/Code-Regression huggingface dataset:
#include <vector> 
#include <list> 
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <complex>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

const LL mod = 1000000007;


#define Yes_ cout<<"Yes"<<endl; return 0;
#define No_ cout<<"No"<<endl; return 0;


#define YES_ cout<<"YES"<<endl; return 0;
#define NO_ cout<<"NO"<<endl; return 0;

int main() {

	string s;
	cin >> s;

	string b[4] = { "maerd", "remaerd", "esare", "resare" };
	int a[4] = { 5,7,5,6 };
	reverse(ALL(s));
	int index = 0;
	while (index < SZ(s)) {

		string s2 = s.substr(index, 5);
		string s3 = s.substr(index, 7);
		string s4 = s.substr(index, 6);

		if (s3 == b[1]) {
			index += a[1];
		}
		else if (s4 == b[3]) {
			index += a[3];
		}
		else if (s2 == b[0] || s2 == b[2]) {
			index += a[0];
		}
		else {
			NO_;
		}

	}

	YES_;

}

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

class UnionFind {
	vector<int> par;
	int find(int a) {
		return par[a] < 0 ? a : par[a] = find(par[a]);
	}
public:
	UnionFind(int n) : par(n, -1) {}
	bool same(int a, int b) {
		return find(a) == find(b);
	}
	void unite(int a, int b) {
		a = find(a);
		b = find(b);
		if (a == b) return;
		if (par[a] < par[b]) {
			par[a] += par[b];
			par[b] = a;
		}
		else {
			par[b] += par[a];
			par[a] = b;
		}
	}
	int size(int a) {
		return -par[find(a)];
	}
};

struct edge {
	int from, to;
	int cost;
	edge(int f, int t, int c) : from(f), to(t), cost(c) {}
	bool operator<(const edge& e) const {
		return cost < e.cost;
	}
};

const int INF = 1e9;

int main()
{
	int n, m;
	while (cin >> n >> m, n | m) {
		vector<edge> es;
		for (int i = 0; i < m; i++) {
			int a, b, w;
			cin >> a >> b >> w; a--, b--;
			es.emplace_back(a, b, w);
		}
		sort(es.begin(), es.end());
		int res = INF;
		for (int i = 0; i < m; i++) {
			UnionFind uf(n);
			int slim = INF;
			for (int j = i; j < m; j++) {
				uf.unite(es[j].from, es[j].to);
				if (uf.size(es[j].from) == n) {
					slim = es[j].cost - es[i].cost;
					break;
				}
			}
			res = min(res, slim);
		}
		cout << (res == INF ? -1 : res) << endl;
	}
	return 0;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
typedef long long ll;
ll a[maxn];
int main()
{
    ll n,x;
    scanf("%lld%lld",&n,&x);
    for(int i=0;i<n;i++) scanf("%lld",&a[i]);
    ll ans=0;
    for(int i=0;i<n-1;i++)
    {
        if(a[i]+a[i+1]>x)
        {
            ll d=a[i]+a[i+1]-x;
            ans+=d;
            if(d<=a[i+1]) a[i+1]-=d;
            else
            {
                a[i]-=(d-a[i+1]);
                a[i+1]=0;
            }
        }
    }
    printf("%lld\n",ans);
}


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

using namespace std;

int main()
{
    map<string,int>m;
    int n;
    cin>>n;
    string a[n];
    int maks=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        m[a[i]]++;
        if(m[a[i]]>maks)
        {
            maks=m[a[i]];
        }
    }
    sort(a,a+n);
    int t=1;
    for(int i=0;i<n;i=i+t)
    {
        if(m[a[i]]==maks)
        {
            cout<<a[i]<<endl;
            t=maks;
        }
    }

}


Measured memory_bytes: 26752
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <string>
#include <set>
using namespace std;
int main()
{
    string s; cin >> s;
    int cnt=0;
    string prev="";
    string t = "";
    for(int i=0; i<s.size(); ++i){
        t += s[i];
        if(prev != t){
            cnt++;
            prev = t;
            t = "";
        }
    }

    cout << cnt << endl;
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
template<typename T>inline void read(T &x){
	short f=1;x=0;char c=getchar();
	while(!isdigit(c)){ if(c=='-')f=-1;c=getchar(); }
	while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=getchar();
	x*=f;
}
int main(){
	int a,b,c;
	read(a),read(b),read(c);
	cout<<(a-c)/(b+c)<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int m = (a+b)/2;
		String s;
		if(x>m){
			if(a>b){
				s="A";
			}
			else{
				s="B";
			}
		}
		else{
			if(a>b){
				s="B";
			}
			else{
				s="A";
			}
		}
		System.out.println(s);
	}
}

Measured memory_bytes: 22868
#include<queue>
#include<iostream>
#include<string>
using namespace std;
struct process { string name; int time; };
void Debug();
queue<process> Q;
int n, q;

int main() {
	int processed = 0,sumTime = 0;
	cin >> n >> q;
	process p[n];

	//input
	for (int i = 0; i < n; i++) {
		cin >> p[i].name >> p[i].time;
		Q.push(p[i]);
	}

	//process
	while (1) {
		process t = Q.front();
		Q.pop();
		t.time -= q;
		if (t.time <= 0) {
			processed++;
			sumTime += (q + t.time);
			cout << t.name << " " << sumTime << endl;

			if (processed == n)		break;
		}
		else{
			Q.push(t);
			sumTime += q;
			//cout << t.name << " " << t.time << " processing now " << endl; //Debug
		}

	}

	//Debug();
	


	return 0;
}

void Debug() {
	for (int i = 0; i < n; i++) {
		process t = Q.front();
		Q.pop();
		cout << t.name << " " << t.time << endl;
	}
}

Measured memory_bytes: 5188
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include <vector>
#include <queue>
#include <iomanip>

using namespace std;
typedef long long ll;

ll ans, mx, sum, mn = 1e8, cnt;


ll gcd(ll a,ll b) { 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 

int main(){
	ll n;
	cin>>n;
	for(ll i=1; i<=n; i++){
		for(ll j=1; j<=n; j++){
			ll flag=gcd(i,j);
			for(ll k=1; k<=n; k++){
				ll temp=gcd(flag,k);
				sum +=temp;
			}
		}
	}
	cout<<sum<<endl;
}

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

using namespace std;

typedef long long ll;

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

	string s;
	cin >> s;

	cout << "2018" << s.substr(4, (int)s.size() - 4) << endl;
}


Measured memory_bytes: 256
# 逆元を利用した組み合わせの計算
#############################################################
def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n - r] % mod

mod = 10**9 + 7
NN = 10**6

g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range(2, NN + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)
#############################################################

N, K = map(int, input().split())

# M = 空き部屋数の最大値
M = min(N - 1, K)

"""
m = 0,1,2,...,M

N部屋から、空き部屋をm個選ぶ
-> N_C_m

残りの(N-m)部屋に、N人を配置する（空き部屋が出来てはいけない）
まず、(N-m)部屋に1人ずつ配置し、残ったm人を(N-m)部屋に配置する
これは、m個のボールと(N-m-1)本の仕切りの並び替えに相当する
-> (m+N-m-1)_C_m = N-1_C_m
"""

ans = 0
for m in range(0, M + 1):
    ans += cmb(N, m, mod) * cmb(N - 1, m, mod)
    ans %= mod

print(ans)


Measured memory_bytes: 213088
from sys import stdout
def main():
    n = int(raw_input())
    k = 1
    while k * (k - 1) / 2 < n:
        k += 1
    if k * (k - 1) / 2 != n:
        print "No"
        return
    ans = [[n * 2 / k] for _ in xrange(k)]
    c = 0
    for i in xrange(k):
        for j in xrange(i + 1, k):
            c += 1
            ans[i].append(c)
            ans[j].append(c)
    stdout.write('Yes\n')
    stdout.write(str(k) + '\n')
    for l in ans:
        stdout.write(' '.join(map(str, l)))
        stdout.write('\n')
main()


Measured memory_bytes: 8196
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,i,j,k;
    char c[10009];
    scanf("%d %s",&n,&c);
    m=strlen(c);
    for(i=0;i<m;i++){
        j=c[i]+n;
        if(j>90){
            j=j-90+64;
        }
        c[i]=j;
    }
    printf("%s",c);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main() {
 string N;
 cin >> N;
 if( N.substr(0,1) == N.substr(1,1) &&N.substr(0,1) == N.substr(2,1)){
	cout << "Yes" << endl;
 }
 else if( N.substr(1,1) == N.substr(2,1) &&N.substr(1,1) == N.substr(3,1)){
	cout << "Yes" << endl;
 }
 else {
 	cout << "No" << endl;
 }
}

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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

string a,b,c;

main() {
    cin >> a >> b >> c;
    if (a[a.size()-1] == b[0] && b[b.size()-1] == c[0]) ct("YES")
    else ct("NO")
}


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

using ll = long long;
#define int long long

// [a -> b-1]
#define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
// [0 -> a-1]
#define rep(i, a) reps(i, 0, (a))
// [a-1 -> b]
#define rreps(i, a, b) for (int i = (int)((a)-1); i >= (int)(b); i--)
// [a-1 -> 0]
#define rrep(i, a) rreps(i, a, 0)
#define all(v) (v).begin(), (v).end()
// next_permutation(all(v))
#define PERM(v) next_permutation(all(v))
/*sort(all(v));
 * (v).erase(unique(all(v)), v.end())*/
#define UNIQUE(v)\
	sort(all(v));\
	(v).erase(unique(all(v)), v.end())
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
// b is [a, c)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
// c is [a, e) && d is [b, f)
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(15)
#define YES(f) cout << ((f) ? YES_STR : NO_STR) << endl;

using namespace std;

int solve(int n, int r) {
	vector<int> res(n);
	iota(res.rbegin(), res.rend(), 1);
	rep(i, r) {
		int p, c; cin >> p >> c;
		vector<int> t;
		t.insert(t.end(), res.begin() + p - 1, res.begin() + p + c - 1);
		t.insert(t.end(), res.begin(), res.begin() + p - 1);
		t.insert(t.end(), res.begin() + p + c - 1, res.end());
		res = t;
	}
	return res[0];
}

signed main() {
	int n, r;
	while (cin >> n >> r, n) cout << solve(n, r) << endl;
}




Measured memory_bytes: 3128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.BitSet;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		E_OddSubrectangles solver = new E_OddSubrectangles();
		solver.solve(1, in, out);
		out.close();
	}

	static class E_OddSubrectangles {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			final int MOD = 998244353;
			int height = in.nextInt();
			int width = in.nextInt();
			BitSet[] a = new BitSet[height];
			for (int r = 0; r < height; r++) {
				a[r] = new BitSet(width);
				for (int c = 0; c < width; c++) {
					int x = in.nextInt();
					if (x == 1) {
						a[r].set(c);
					}
				}
			}

			int rank = calcRank(a.clone());

			long[] p2 = new long[height + width + 1];
			p2[0] = 1;
			for (int i = 1; i < p2.length; i++) {
				p2[i] = 2 * p2[i - 1] % MOD;
			}
			long ans = p2[height + width - 1] - p2[height + width - 1 - rank];
			if (ans < 0) {
				ans += MOD;
			}
			out.println(ans);
		}

		private int calcRank(BitSet[] rows) {
			diagonalize(rows);
			int res = 0;
			for (BitSet row : rows) {
				if (row.cardinality() != 0) {
					++res;
				}
			}
			return res;
		}

		private void diagonalize(BitSet[] a) {
			int lastR = a.length - 1;
			int r = 0;
			while (r <= lastR) {
				if (a[r].cardinality() == 0) {
					BitSet t = a[r];
					a[r] = a[lastR];
					a[lastR] = t;
					--lastR;
					continue;
				}

				int or = a[r].nextSetBit(r);
				if (or != r) {
					for (int i = 0; i <= lastR; i++) {
						boolean bitR = a[i].get(r);
						boolean bitOR = a[i].get(or);
						a[i].set(r, bitOR);
						a[i].set(or, bitR);
					}
				}
				for (int i = r + 1; i <= lastR; i++) {
					if (a[i].get(r)) {
						a[i].xor(a[r]);
					}
				}

				++r;
			}
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					String rl = in.readLine();
					if (rl == null) {
						return null;
					}
					st = new StringTokenizer(rl);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

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

	}
}



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

using namespace std;

int main(){
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            int x = (j < a) ^ (i < b);
            cout << x;
        }
        cout << endl;
    }
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main() {
    int N, M;
    cin >> N;
    vector<int> T(N);
    for (int i = 1; i <= N; i++) {
        cin >> T[i - 1];
    }
    cin >> M;
    vector<int> P(M), X(M);
    for (int i = 1; i <= M; i++) {
        cin >> P[i - 1] >> X[i - 1];
    }

    for (int i = 0; i < M; i++) {
        int index = P[i] - 1;
        int temp  = T[index];
        T[index]  = X[i];
        int sum   = accumulate(T.begin(), T.end(), 0);
        cout << sum << endl;
        T[index]  = temp;
    }

    return 0;
}



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

int main() {
    int n;
    cin>>n;
    vector<string>v;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        v.push_back(s);
    }
    int a[n][26]={0};
    for(int i=0;i<n;i++){
        for(int j=0;j<v[i].size();j++){
            a[i][v[i][j]-'a']++;
        }
    }
    //debug- correct until here
    /*for(int i=0;i<n;i++){
        for(int j=0;j<26;j++)cout<<a[i][j];
        cout<<endl;
    }*/
    vector<int>ans;
    int mn=12345;
    int temp=0;
    for(int i=0;i<26;i++){
        mn=12345;
        for(int j=0;j<n;j++){
            if(a[j][i]<mn)mn=a[j][i];
        }
        ans.push_back(mn);
    }
    for(int i=0;i<26;i++){
        for(int j=0;j<ans[i];j++)cout<<char(i+97);
    }
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a>=-1000&&b<=1000){
        if(a>b){
            printf("a > b\n");
        }
        if(a<b){
            printf("a < b\n");
        }
        if(a==b){
            printf("a == b\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2104
import java.util.*;

// ABC 47-C
// http://abc047.contest.atcoder.jp/tasks/arc063_a

public class Main {
	
	static int MOD = 1000000007;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		char[] c = in.next().toCharArray();
		
		int answer1 = 0;
		int answer2 = 0;
		
		char cc = c[0];
		for (int i = 1; i < c.length; i++) {
			if (cc != c[i]) {
				answer1++;
				cc = c[i];
			}
		}
		
		cc = c[c.length - 1];
		for (int i = c.length - 2; i >= 0; i--) {
			if (cc != c[i]) {
				answer2++;
				cc = c[i];
			}
		}
		
		System.out.println(Math.min(answer1, answer2));
	}
}

Measured memory_bytes: 23644
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	
	static final long INF = 10000000000000000L;
	static int n;
	static List<Node>[] Edge;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		n = Integer.parseInt(sc.next());
		
		Edge = new ArrayList[n];
		
		for(int i = 0 ;i < n ;i++) {
			Edge[i] = new ArrayList<>();
		}
		
		for(int i = 0 ;i < n-1 ;i++) {
			int a = Integer.parseInt(sc.next());
			int b = Integer.parseInt(sc.next());
			int cost = Integer.parseInt(sc.next());
			
			Edge[a-1].add(new Node(b-1,cost));
			Edge[b-1].add(new Node(a-1,cost));
		}
		
		int q = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		
		long []d = dijkstra(k-1);
		
		for(int i = 0 ; i < q ;i++) {
			int x = Integer.parseInt(sc.next())-1;
			int y = Integer.parseInt(sc.next())-1;
			
			long ans = d[x] + d[y];
			System.out.println(ans);
		}

	}


static long[] dijkstra(int s){
	
	Queue <Pos> que = new PriorityQueue<Pos>();
	long[]d = new long [n]; //頂点sからの距離
	for(int i = 0 ; i < n ;i++) {
		d[i] = INF;
	}
	BitSet used = new BitSet(n);
	que.add(new Pos(0,s)); //初期値を代入、自身の距離は0
	d[s] = 0 ;				
	
	while(!que.isEmpty()) {
		Pos p = que.poll();		//
		int v = p.getTo();
		if(used.get(p.getTo())) {
			continue;
		}
		used.set(p.getTo());
		for(Node e : Edge[v]) {
			if(d[e.getTo()] > d[v] + e.getCost()) {
				d[e.getTo()] = (long)( d[v] + e.getCost());
				que.add(new Pos(d[e.getTo()],e.getTo()));
			}
		}
	}
	return d;	
}
}

class Pos implements Comparable<Pos>{

private long cost;
private int to;

public Pos (long cost, int to) {
	this.cost = cost;
	this.to = to;
}

public long getCost() {
	return cost;
}

public int getTo() {
	return to;
}

public void setCost(long cost) {
	this.cost = cost;
}

public void setTo(int to) {
	this.to = to;
}

@Override
public int compareTo(Pos o) {
	return Long.compare(cost, o.cost);
}

}
class Node{
private int to;
private int cost;

public Node(int to, int cost) {
	this.to = to;
	this.cost = cost;
}

public int getTo() {
	return to;
}

public int getCost() {
	return cost;
}

public void setTo(int to) {
	this.to = to;
}

public void setCost(int cost) {
	this.cost = cost;
}
}


Measured memory_bytes: 118492
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>

int main() {
  char c;
  std::vector<char> result;
  while (std::cin >> c) {
    switch (c) {
    case '0':
    case '1':
      result.push_back(c);
      break;
    case 'B':
      if (!result.empty()) result.pop_back();
      break;
    }
  }
  std::cout << std::string(result.begin(), result.end()) << std::endl;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
if n<10:
  print(n)
elif n>=10 and n<100:
  print(9)
elif n>=100 and n<1000:
  print(9+n-99)
elif n>=1000 and n<10000:
  print(909)
elif n>=10000 and n<100000:
  print(909+n-9999)
else:
  print(90909)

Measured memory_bytes: 38484
//
//  main.c
//  ITP1_2_C
//
//  Created by k16031kk on 2018/05/17.
//  Copyright © 2018年 AIT. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int a,b,c,tmp;
    scanf("%d %d %d",&a, &b, &c);//a=6 b=9 c=5
    if(a>b){//b<cにする
        tmp=b;
        b=a;
        a=tmp;
    }
    if(a>c){//a<bにする
        tmp=a;
        a=c;
        c=tmp;
    }
    if(b>c){//b<cにする
        tmp=b;
        b=c;
        c=tmp;
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}



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

int main() {
    int a, b;
    cin >> a >> b;
    int ans = -1;
    for (int i = 1000; i >= 1; i--) {
        if ((int)(i * 0.08) == a && (int)(i * 0.1) == b) {
            ans = i;
        }
    }
    cout << ans << endl;
}

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

typedef long long ll;
typedef long double ld;
typedef std::vector<int> vi;
typedef std::vector<long long> vll;

#define pub push_back
#define pob pop_back
#define mp make_pair
#define ff first
#define ss second
#define umap unordered_map
#define uset unordered_set

#define forn(i, n)     for(ll i = 0; i< (ll)n; i++)
#define forf(i, x, y)  for(ll i=(x); i<=(ll)y; i++)
#define forb(i, x, y)  for(ll i=(x); i>=(ll)y; i--)
#define lpt() 		   ll T; std::cin>>T; while(T--)

#define nl "\n"
#define newl std::cout<<"\n";
#define bug(x) std::cerr<<"debug "<<#x<<" : "<<x<<"\n";
#define all(x) x.begin(),x.end()
#define fastio() ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);

template<typename X> std::ostream& operator<< (std::ostream& out, std::vector<X> v)
{ for(auto &i : v) out<<i<<" "; return out; }
template<typename X, typename Y> std::ostream& operator<< (std::ostream& out, std::pair<X,Y> p)
{ out<<p.first<<" "<<p.second; return out; }

static const long long mod = 1000000007;

using namespace std;

int main()
{fastio()
	
	ll a;
	ld b;
	cin>>a>>b;
	ld ans = (ld)a*(ld)b;
	ll x = ans;
	cout<<x<<nl;
	
return 0;}


Measured memory_bytes: 3740
#q:0.25,h:0.5,s:1,d:2
#q,h,s,d=
cost=list(map(int,input().split()))

one=min(cost[0]*4,cost[1]*2,cost[2])

n=int(input())

if n==1:
    print(one)
    exit()

if n%2==0:
    print(n//2*min(one*2,cost[3]))
else:
    print(n//2*min(one*2,cost[3])+one)






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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;
using pdl = pair<double,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-6 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}


double calc(int r1,int r2){
  return sqrt((r1+r2)*(r1+r2) - (r1-r2)*(r1-r2));
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  stringstream ss;
  ll w;
  while(getline(cin,s)){
    ss.clear();
    ss << s;
    ss >> w;
    vector<ll> v(12);
    ll n = 0,k;
    while(ss >> k){
      v[n] = k;
      ++n;
    }
    vector<vector<double>> dp(1 << n,vector<double>(n,1e9));
    bool f = false;
    rep(i,n){
      dp[1 << i][i] = v[i];
    }
    double ans = 10000000.0;
    REP(i,1,(1 << n)){
      REP(j,0,n){
        if(i & (1 << j)) continue;
        ll nxt = i | (1 << j);
        REP(k,0,n){
          if((i & (1 << k)) == 0) continue;
          double bw = 0;
          if(nxt == (1 << n)-1){
            bw += v[j];
          }
          bw += calc(v[k],v[j]);
          dp[nxt][j] = min(dp[nxt][j],bw + dp[i][k]);
        }
      }
    }
    rep(i,n){
      ans = min(ans,dp[(1 << n)-1][i]);
    }
    if(ans <= w){
      cout << "OK" << endl;
    }
    else{
      cout << "NA"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3340
// ABC053B - 

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;

int main() {
	string s;
	cin >> s;

	int top = 0;
	int tail = s.size() - 1;

	while (1) {
		if (s[top] == 'A') {
			break;
		}
		++top;
	}

	while (1) {
		if (s[tail] == 'Z') {
			break;
		}
		--tail;
	}

	cout << tail - top + 1 << endl;

	return 0;
}


Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

int main(){
  string s;
  cin >> s;
  string t = "";
  int i = 0;
  while(i < s.size()){
    t += s.at(i);
    i += 2;
  }
  cout << t << endl;
}

Measured memory_bytes: 512
//#i#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <stack>
#include <deque>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <time.h>
#include <stdio.h>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

template<typename T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }
template<typename T>
void vdeb(std::vector<T> &da) {
	for (int i = 0;i < da.size();i++) {
		if (i == da.size() - 1) std::cout << da[i];
		else std::cout << da[i] << ' ';
	}
	std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
	for (int i = 0;i < da.size();i++) vdeb(da[i]);
	std::cout << std::endl;
}
struct UnionFind{
    int size;
    std::vector<int> par;
    std::vector<int> rank;
    UnionFind(int x){
        size=x;
        par=std::vector<int> (x);
        rank=std::vector<int> (x,1);
        for (int i=0;i<x;i++) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        else return par[x]=root(par[x]);
    }
    void unite(int x,int y){
        x=root(x);y=root(y);
        if(x==y) return;
        if(rank[x]<rank[y]) par[x]=y;
        else par[y]=x;
        if(rank[x]==rank[y]) rank[x]++;
    }
    bool check(int x,int y){
        return root(x)==root(y);
    }
    void initialize(){
        for (int i=0;i<size;i++){
            par[i]=i;rank[i]=1;
        }
    }
};
using namespace std;
int main(){
	int n,m,k;
	cin >> n >> m >> k;
	vector<int> co(n),ans(n);
	UnionFind uf(n);
	int a,b;
	rip(i,m,0){
		cin >> a >> b;
		a--;b--;
		uf.unite(a,b);
		ans[a]--;
		ans[b]--;
	}
	rip(i,n,0){
		co[uf.root(i)]++;
	}
	rip(i,n,0){
		ans[i] += co[uf.root(i)]-1;
	}
	rip(i,k,0){
		cin >> a >> b;
		a--;b--;
		if(uf.check(a,b)){
			ans[a]--;
			ans[b]--;
		}
	}
	vdeb(ans);
}

Measured memory_bytes: 2432
from math import sqrt
n = int(input())
class Point:
    def __init__(self, x, y):
        self.x = x
        self.y = y
        return
    def __lt__(self, p2):
        return self.quadrant() < p2.quadrant() or self.quadrant() == p2.quadrant() and self.x * p2.y - self.y * p2.x > 0
    def __repr__(self):
        return repr((self.x, self.y))
    def __add__(self, p2):
        return Point(self.x+p2.x, self.y+p2.y)
    def __sub__(self, p2):
        return Point(self.x-p2.x, self.y-p2.y)
    def quadrant(self):
        if self.x > 0 and self.y >= 0:
            return 1
        elif self.y > 0:
            return 2
        elif self.x < 0:
            return 3
        else:
            return 4
    def square(self):
        return self.x ** 2 + self.y ** 2

xy = [Point(xi, yi) for xi, yi in (map(int, input().split()) for _ in range(n)) if not xi == yi == 0]


cur_point = sum((p for p in xy if p.y > 0 or p.y == 0 and p.x >= 0), Point(0, 0))

inv = list(Point(-p.x, -p.y) for p in xy)
xy.extend(inv)
xy.sort()

mx = cur_point.square()
for p in xy:
    cur_point -= p
    mx = max(mx, cur_point.square())

print(sqrt(mx))


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;  
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b){
    if (a < b){ a = b;return 1;}
    return 0;
}
template <class T, class U> //chmin(min,a)
bool chmin(T &a, U b){
    if (a > b){ a = b; return 1;}
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}

// g++ -std=c++11 prac.cpp 
int main(){
    ll y,z,n,p,m=0,k,h,w,sum=0,sum_a=0,sum_b=0,ans=0,Max=-1e9,count=0,Min=1e9+1;
    string s,t,u,v;
    bool ok=true;
    cin >> k >> n;
    VI a(n);
    rep(i,n){
        cin >> a[i];
        if(chmax(Max,a[i])){
            m = i;
        }
    }
    rep(i,n){
        if(i != m || a[i] != Max){
            sum += a[i];
        }
    }  
    Max--;  
    ans = Max - sum;
    if(ans <= 0){
        cout << 0 << endl;
    }
    else if(sum == 0){
        cout << Max << endl;
    }
    else{
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        string str;
        string[] strer;
        int[] data = new int[4];
        int[,,] nem = new int[4,3,10];
        int b,f,r,v;

        for (int i = 0; i < n; i++)
        {
            str = Console.ReadLine();

            strer = str.Split(' ');

            for (int j = 0; j < 4; j++)
            {
                data[j] = int.Parse(strer[j]);
            }

            b = data[0] - 1;
            f = data[1] - 1;
            v = data[2] - 1;
            r = data[3];

            nem[b, f, v] += r;
            
        }

        
     
        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                for (int k = 0; k < 10; k++)
                {
                    Console.Write(" " + nem[i,j,k]);
                   
                }

                Console.WriteLine();

            }
            if (i != 3)
            {
                Console.WriteLine("####################");
            }           
        }
              
    }
}


Measured memory_bytes: 15956
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N,W;
ll dp[100*1000+5];
ll max(ll a, ll b){
	if(a>b) return a;return b;
}

// dp[w][i] = max(dp[w-wt[i]][i-1]+v[i], dp[w][i-1])

// dp[v] = min(wt[i] + dp[v-V[i]], dp[v])
ll wt[100+5], V[100+5];

ll MAXV = 1;
int main(){
	cin>>N>>W;
	for(int i = 0;i<N;i++){
		cin>>wt[i]>>V[i];
		MAXV+=V[i];
	}
	
	for(ll j = 0;j<=MAXV;j++) 
		dp[j] = 1e18;
	
	dp[0] = 0;
	for(ll i = 0;i<N;i++){
		for(ll v = MAXV;v>=V[i];v--){
			dp[v] = min(dp[v], wt[i]+dp[v-V[i]]);
		}
	}
	ll ans = 0;
	for(ll v = MAXV;v>=1;v--){
		if(dp[v]<=W){
			ans = v;break;
		}
	}
	
	cout<<ans<<endl;
}


Measured memory_bytes: 1152
#include <stdio.h>

int binarysearch(int A[], int n, int key){
    int left = 0, right = n, mid = n/2;
    while(A[mid] != key){
        if(right == left + 1) return 0;
        if(A[mid] > key){
            right = mid;
            mid = (left + right) / 2;
        }else{
            left = mid;
            mid = (left + right) / 2;
        }
    }
    return 1;
}

int main(){
    int i, n, S[100000+1], q, key, sum = 0;
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d", &S[i]);
    }
    scanf("%d", &q);
    for(i = 0; i < q; i++){
        scanf("%d", &key);
        if(binarysearch(S, n, key)) sum++;
    }
    printf("%d\n", sum);
    return 0;
}


Measured memory_bytes: 2088
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication27
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int a = int.Parse(Console.ReadLine());
                if (a == 0)
                    break;
                int b = 0;
                int c = 0;
                while (true)
                {
                    b += a / 5;
                    c = a / 5;
                    if (c < 5)
                        break;
                    a = c;
                }
                Console.WriteLine(b);
            }
        }
    }
}

Measured memory_bytes: 9136
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

ll A[3000];
ll C[3000][3000];
int main(){
    int N;
    ll x;
    cin >> N >> x;
    REP(i,N){
        ll a;
        cin >> a;
        A[i] = a;
    }
    
    REP(s,N){
        ll cost = LLONG_MAX;
        REP(d,N){
            int index;
            if(s-d >= 0) index = s-d;
            else index = N+(s-d);
            cost = min(cost, A[index]);
            C[s][d] = cost; 
        }
    }
/*
    REP(i,N){
        REP(k,N){
            printf("%lld ", C[i][k]);
        }
        printf("\n");
    }
*/
    ll ans = LLONG_MAX;
    REP(m,N){
        ll cost = x*m;
        REP(i,N){
            cost += C[i][m];
        }
        //printf("cost:%lld\n", cost);
        ans = min(ans, cost);
    }

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


Measured memory_bytes: 46976
#include <algorithm>
#include <iostream>
#include <initializer_list>


using namespace std;


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

    int c[100000+1] = {0, 1, 2, 3, 4, 5, 1, 7, 8, 1};

    for (int i = 10; i <= N; i++) {
        int pow6 = 1;
        while ((pow6 * 6) <= i)
            pow6 *= 6;
        int pow9 = 1;
        while ((pow9 * 9) <= i)
            pow9 *= 9;

        c[i] = min({c[i - 1], c[i - pow6], c[i - pow9]}) + 1;
    }
    cout << c[N] << endl;
}


Measured memory_bytes: 640
s = input() + 'n'
ans = 0
fans = 0
for i in range(len(s)):
    if s[i] =='A' or s[i] =='C' or s[i] =='G' or s[i] =='T':
        ans += 1
    elif fans < ans:
        fans = ans
        ans = 0
print(fans)

Measured memory_bytes: 3060
def main():
    n = int(input())
    print(n // 3)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()


Measured memory_bytes: 2940
Module A
    Sub Main()
        Dim s As String = Console.ReadLine()
        Dim wk As String = s(0)
        For i As Integer = 1 To 2
            If s(0) <> s(i) Then
                Console.WriteLine("Yes")
                Return
            End If
        Next
        Console.WriteLine("No")
    End Sub
End Module

Measured memory_bytes: 11092
MOD = 10 ** 9 + 7

n=int(input())
alst=list(map(int,input().split()))

total=sum(alst)
sum=0

# for i in range(n-1):
#   for j in range(i+1,n):
#     sum=pow(sum+alst[i]*alst[j],1,MOD)

# print(sum)

for a in alst:
  sum = sum+a * (total - a)
  sum %= MOD

sum *= pow(2, MOD - 2, MOD)
sum %= MOD
print(sum)

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

int main() {
  int a[3], sum = 0;

  for(int i = 0; i < 3; i++){
    cin >> a[i];

    sum += a[i];
  }

  if(sum >= 22){
    cout << "bust" << endl;
  }
  else{
    cout << "win" << endl;
  }

  return 0;
}

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

int main(){
    int N;
    cin >> N;
    int M;
    cin >> M;
    int sum = 0;
    vector<int> A(N);
    for (int i = 0; i < N;i++)
    {
        cin >> A[i];
        sum += A[i];
    }
    bool flag = false;
    double c =  sum *((double)1 / (4 * M));
    int count = 0;
    for (int i = 0; i < N; i++)
    {
        if(c <= A[i]){
            count++;
        }
    }
    if(count >= M){
        flag = true;
    }
    if(flag){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >>a >>b;
  
  if (a%3==0 || b%3==0 || (a+b)%3==0)
    cout << "Possible";
  
  else
    cout << "Impossible";
}

Measured memory_bytes: 3636
#include <stdio.h>
int main(void){
    int a=0,b=0;
  
    scanf("%d %d",&a,&b);
    
    if((a>8) || (b>8) || (a+b>16)){
        printf(":(\n");
    }else{
        printf("Yay!\n");
    }
      
}


Measured memory_bytes: 128
from math import sin, cos, pi

A, B, H, M = map(int, input().split())
H, M = pi * (H + M / 60) / 6, pi * M / 30
XA, YA = A * sin(H), A * cos(H)
XB, YB = B * sin(M), B * cos(M)
print(((XA - XB) ** 2 + (YA - YB) ** 2) ** 0.5)


Measured memory_bytes: 9492
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>//pair
#include<cmath>//abs,sqrt
#include<cstring>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const int INF=1e+9;
const ll INFLL=1e+17;
int main(){
  int a,b;cin>>a>>b;
  if(a+b>=10) prin("error");
  else prin(a+b);

  

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int main(){
	int n;
	int a[100];
	
	scanf(" %d", &n);
	for(int i=0; i<n; ++i)
		scanf(" %d", &a[i]);

	for(int i=n-1; i>=0; --i) {
		printf("%d", a[i]);
		if(i!=0) printf(" ");
	}
	printf("\n");

	return 0;
}


Measured memory_bytes: 2716
#include<stdio.h>
int main(){
	
	int c[100],t[100],i=0,j=-1,k=0;
	
	scanf("%d%d",&c[i],&t[i]);
	
	while(i<c[0]){
		
		i++;
		k++;
		scanf("%d%d",&c[i],&t[i]);
		if(j==-1)
			j=c[i];
		if(c[i]<=j && t[i]<=t[0]){
				j=c[i];
				k--;
		}
				
		
	}
	
	if(k==i)
		printf("TLE");
	else
		printf("%d",j);

return 0;

}

Measured memory_bytes: 128
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    # divisors.sort()
    return divisors
x = int(input())
for i in make_divisors(x):
    b = -i//2
    a = b + i
    while a**5-b**5 <= x:
        if a**5-b**5 == x:
            print(a,b)
            exit()
        a += 1
        b += 1


Measured memory_bytes: 63480
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0430_atcoder問題02
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = Convert.ToInt32(input[0]);
            int b = Convert.ToInt32(input[1]);
            int c = Convert.ToInt32(input[2]);
            int count = 0;
            for(int i = 1; i <= c; ++i)
            {
                if (b >= a)
                {
                    b -= a;
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }
}

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

#define int long long
#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cps CLOCKS_PER_SEC
#define mod (int)(1000000007)
#define f first
#define s second
#define debug1(x) cerr<<x<<"\n"
#define debug2(x,y) cerr<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cerr<<x<<" "<<y<<" "<<z<<"\n"
#define nl cerr<<"\n";
#define pq priority_queue
#define inf 9999999999999999
#define test cerr<<"abcd\n";
#define pi pair<int,int>
#define pii pair<int,pi>
#define pb push_back
#define mxn 200005
#define mxnn 2000005
int hei[mxn],tree[mxn<<2],val[mxn],dp[mxn];
void update(int i,int tl,int tr,int pos,int val){
if(tl >tr || tl >pos || tr <pos) return;
if(tl == tr){
    tree[i] = val;
    return;
}
int mid = (tl+tr)>>1;
if(mid>=pos) update(i+i,tl,mid,pos,val);
else update(i+i+1,mid+1,tr,pos,val);
tree[i] = max(tree[i+i],tree[i+i+1]);}

int query(int i,int tl,int tr,int l,int r){
if(tl >tr|| tl > r || tr<l) return 0;
if(tl >=l && tr<=r) return tree[i];
int mid = (tl+tr)>>1;
return max(query(i+i,tl,mid,l,r),query(i+i+1,mid+1,tr,l,r));
}

int32_t main(){
sp;
int n;
cin >>n;
for(int i = 1;i<=n;i++) cin >>hei[i];
for(int i = 1;i<=n;i++) cin >>val[i];
int mx = 0;
for(int i = 1;i<=n;i++) mx = max(mx,hei[i]);
int ans = 0;
for(int i = 1;i<=n;i++){
    int x = hei[i];
    int a = query(1,0,mx,1,x);
    ans = max(ans,a+val[i]);
    update(1,0,mx,x,a+val[i]);
}
cout<<ans;
return 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using namespace std;

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
    template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
    template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
    };

    // 2次元用の標準入出力
    template<typename T>
    struct inpn {
        std::size_t szi, szj;
        inpn(std::size_t _szi, std::size_t _szj) : szi(_szi), szj(_szj) {}
        operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i)
                for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j];
            return a;
        }
    };

    inp inp1; // input one
}


int main() {

    ll n, W;
    cin >> n >> W;
    vector<ll> w(n), v(n);
    rep(i, n) cin >> w[i] >> v[i];

    ll max_v = *max_element(allof(v));
    // dp[i][j] := i番目までを見たときに，価値の総和がjとなるときの重さの最小値
    vector<vector<ll>> dp(n + 1, vector<ll>(max_v * n + 1, infll));

    rep(i, n + 1) dp[i][0] = 0LL;

    ll max_vn = max_v * n;
    rep(i, n) {
        rep(j, max_vn + 1) {
            // 入れない
            chmin(dp[i + 1][j], dp[i][j]);
            // 入れた
            if(j - v[i] >= 0)
                chmin(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
        }
    }

    ll ans = 0LL;
    rep(j, max_vn + 1) {
        if (dp[n][j] > W) continue;
        ans = j;
    }

    Cout(ans);

    return 0;
}

Measured memory_bytes: 80256
s = input()[::-1]
t = input()[::-1]
l = []
pre = 0

for i in range(len(s)):
    l.clear()
    cnt = 0
    pre = i
    while cnt < len(t) :
        if pre + cnt >= len(s):
            break
        if s[i] == t[cnt] or s[i] == "?":
            l.append(t[cnt])
            i += 1
            cnt += 1
        else:
            break
    else:
        ans = s[:pre] + "".join(l) + s[i:]
        ans = ans.replace("?", "a")
        ans = ans[::-1]
        print(ans)
        exit()
print("UNRESTORABLE")

Measured memory_bytes: 8984
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

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

  vector<int> A(N);
  for(int i = 0;i < N;i++) cin >> A.at(i);
  sort(A.begin(),A.end());

  for(int i = 0;i < N-1;i++) {
    if(A.at(i) == A.at(i+1)) {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;
}


Measured memory_bytes: 1024