akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
string sixdigits(int n){
    string ret = to_string(n);
    int digits = ret.length();
    for(size_t i = 0; i < 6 - digits; i++)
    {
        ret = "0" + ret;
    }
    return ret;
}
int main(){
    int N, M;
    cin >> N >> M;
    vector<int> P(M, 0);
    vector<int> Y(M, 0);
    vector<vector<int> > Pref(N);
    for(size_t i = 0; i < M; i++)
    {
        cin >> P[i] >> Y[i];
        Pref[P[i]-1].push_back(Y[i]);
    }
    for( auto& vec : Pref){
        if (!vec.empty())
            sort(vec.begin(), vec.end());
    }
    for(size_t i = 0; i < M; i++)
    {
        string ret = sixdigits(P[i]);
        int order = 1 + distance(Pref[P[i]-1].begin(), lower_bound(Pref[P[i]-1].begin(), Pref[P[i]-1].end(), Y[i]));
        ret += sixdigits(order);
        cout << ret << endl;
    }
    


    return 0;
}

Measured memory_bytes: 7808
#include <algorithm>
#include <cmath>
#include <cstring>  // memset()
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define ll long long
#define For(i, a, b) for (int i = (int)(a), sz = (int)(b); i < sz; i++)
#define rFor(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fill(a, b) memset(a, b, sizeof(a))
#define IO ios_base::sync_with_stdio(0), cin.tie(0)

const int MAX = 2e2 + 5;

int main() {
    IO;
    int n, a, c = 0;
    cin >> n;
    For(i, 1, n + 1) {
        cin >> a;
        if (i & 1 && a & 1)
            c++;
    }
    printf("%d\n", c);
    return 0;
}

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

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)
#define TRACE(x) cerr << #x << " = " << x << endl

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

const int mod = 1e9 + 7;

int add(int x, int y) {x += y; if(x >= mod) return x - mod; return x;}
int sub(int x, int y) {x -= y; if(x < 0) return x + mod; return x;}
int mul(int x, int y) {return (ll) x * y % mod;}

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

  int sol = 0, mn = 1e9;
  int n; cin >> n;
  REP(i, n){
    int x; cin >> x;
    if(x < mn)
      sol ++;
    mn = min(x, mn);
  }
  cout << sol;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define H (200)
#define D (201)
#define L (100)
#define C (0)
#define INF (1 << 28)

struct State {
	int now, done, sum;
	State(){}
	State(int now, int done, int sum) : now(now), done(done), sum(sum){}
	bool operator < (const State &t) const {
		return sum > t.sum;
	}
};

int m;
//	to, cost
vector<pair<int, int> > g[300];
int cal[300];
int d[300][1 << 6];

void solve()
{
	priority_queue<State> pq;
	for (pq.push(State(H, 0, 0)); pq.size(); ){
		State st = pq.top(); pq.pop();
		int now = st.now;
		int done = st.done;
		int sum = st.sum;
		if (d[now][done] < sum) continue;
		//printf("%d %d %d\n", now, done, sum);
		
		for (int i = 0; i < g[now].size(); i++){
			pair<int, int> &e = g[now][i];
			int to = e.first;
			int ndone = done;
			int nsum = sum + e.second;
			
			if (to < L && (done & (1 << to))) continue;
			if (to < L) ndone |= (1 << to);
			
			if (d[to][ndone] > nsum){
				pq.push(State(to, ndone, nsum));
				d[to][ndone] = nsum;
			}
		}
	}
	
	
	int res = INF;
	for (int i = 0; i < (1 << m); i++){
		int t = d[D][i];
		for (int j = 0; j < m; j++){
			int x = (1 << j);
			if (i & x) t -= cal[j];
		}
		res = min(res, t);
	}
	printf("%d\n", res);
}

int getID(string s)
{
	if (s == "H") return H;
	if (s == "D") return D;
	if (s[0] == 'L'){
		int a = atoi(s.c_str() + 1);
		return L + a - 1;
	}
	if (s[0] == 'C'){
		int a = atoi(s.c_str() + 1);
		return C + a - 1;
	}
}

int main()
{
	int n, K, _d;
	while (scanf("%d %d %d %d", &m, &n, &K, &_d), m){
		for (int i = 0; i < 300; i++){
			g[i].clear();
		}
		memset(cal, 0, sizeof(cal));
		fill((int*)d, (int*)d + sizeof(d) / sizeof(int), INF);
		
		for (int i = 0; i < m; i++){
			scanf("%d", &cal[C + i]);
		}
		
		for (int i = 0; i < _d; i++){
			string s[2];
			int cost;
			cin >> s[0] >> s[1] >> cost;
			int p1 = getID(s[0]), p2 = getID(s[1]);
			g[p1].push_back(make_pair(p2, cost * K));
			g[p2].push_back(make_pair(p1, cost * K));
		}
		
		solve();
	}
}

Measured memory_bytes: 1452
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!();
    let k = get!();
    let mut xs = vec![];
    for _ in 0..n {
    	let x = get!();
        xs.push(x);
    }
    let mut tmp = vec![vec![0; 64]; 2];
    for i in 0..63 {
    	let i = 62 - i;
        if (1 << i) > k {
        	let mut s = 0;
        	for &x in xs.iter() {
            	s += x & (1 << i);
            }
            tmp[0][i] = s;
        } else {
        	let mut s = 0;
            let mut t = 0;
        	for &x in xs.iter() {
            	let b = x & (1 << i);
                s += b;
                t += b ^ (1 << i);
            }
            tmp[0][i] = s;
            tmp[1][i] = t;
        }
    }
    let mut ans = 0;
    let mut e = 0;
    for i in 0..63 {
    	let i = 62 - i;
        let b = 1 << i;
        if b > k {
        	ans += tmp[0][i];
        } else {
        	if (b | e) <= k {
            	if tmp[1][i] > tmp[0][i] {
                	e |= b;
                	ans += tmp[1][i];
                } else {
                	ans += tmp[0][i];
                }
                
            } else {
            	ans += tmp[0][i];
            }
        }
    }
    println!("{}", ans);
    // println!("{:?}", tmp);
}


Measured memory_bytes: 8444
#include <iostream>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    int64_t L0 = 2;
    int64_t L1 = 1;
    while(N--) {
        int64_t L2 = L0 + L1;
        L0 = L1;
        L1 = L2;
    }
    cout << L0 << endl;
    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
l = gets.split().map{|x| x.to_i}.sort!

# sum = l.slice(0..-2).sum
sum = 0
l.slice(0..-2).each do |n|
    sum += n
end

if sum > l[-1]
    puts "Yes"
else
    puts "No"
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  int b;
  int c;
  cin >> a >> b >> c;
  int X = a/c;
  int Y = b/c;
  int ans = Y-X;
  if(a%c == 0){
    ans += 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3552
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static final int MOD = 1000000007;

	static int add(int a, int b) {
		int res = a + b;
		return res >= MOD ? res - MOD : res;
	}

	static void solve() throws Exception {
		int n = scanInt();
		int dyn[] = new int[200001];
		int prev = scanInt();
		dyn[prev] = 1;
		for (int i = 1; i < n; i++) {
			int cur = scanInt();
			if (cur != prev) {
				dyn[cur] = add(dyn[cur], dyn[prev]);
				prev = cur;
			}
		}
		out.print(dyn[prev]);
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

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

using namespace std;

constexpr int MAXN=1e5+5,MAXM=2e5+5;
int n;
int head[MAXN];
int pre[MAXN];

struct Edge{int to,next;}edge[MAXM*2];

void add_edge(int u,int v){
	static int ecnt;
	auto add=[](int u,int v)->void{
		edge[++ecnt]=Edge{v,head[u]};
		head[u]=ecnt;
	};
	add(u,v),add(v,u);
}

void BFS(){
	fill_n(pre+1,n,-1);
	pre[1]=0;
	queue<int> que;
	que.push(1);
	while(!que.empty()){
		int u=que.front();
		que.pop();
		for(int i=head[u];i;i=edge[i].next){
			int v=edge[i].to;
			if(pre[v]==-1){
				pre[v]=u;
				que.push(v);
			}
		}
	}
}

int main(){
	int m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;++i){
		int u,v;
		scanf("%d%d",&u,&v);
		add_edge(u,v);
	}
	BFS();
	puts("Yes");
	for(int i=2;i<=n;++i)
		printf("%d\n",pre[i]);
}

Measured memory_bytes: 7796
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;

int main() {
  string s;
  cin >> s;
  bool res = true;
  int c_cnt = 0;
  for (int i=0 ; i<s.size() ; i++) {
    if (i == 0) {
      if (s[i] != 'A') {
        res = false;
        break;
      }
    } else if (i >= 2 && i <= s.size() - 2) {
      if (s[i] == 'C') c_cnt++;
    } else {
      if (s[i]>= 'A' && s[i]<='Z') {
        res = false;
        break;
      }
    }
  }
  if (res && c_cnt == 1) printf("AC\n");
  else printf("WA\n");
}

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

int main(){
    int N, K;
    cin >> N >> K;
    vi p(N);
    rep(i, N) cin >> p[i];

    sort(p.begin(), p.end());
    int ans = 0;
    rep(i, K){
        ans += p[i];
    }

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

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
#define rp(i, f, t) for (int i = f; i < t; i++)
#define pr(i, f, t) for (int i = t - 1; i >= f; i--)

int main()
{
   ll n;
   cin>>n;
   ll x[n];
   rp(i,0,n)cin>>x[i];
   ll a=inf;
   rp(i,1,100){
	   ll t=0;
	   rp(j,0,n){
		   t+=pow(x[j]-i,2);
	   }
	   a=min(a,t);
   }
   cout<<a;
}


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

#define MAX 1000

int N, D;
int cnt[MAX][MAX];
int A[2][MAX][MAX];
int sum[2][MAX * 2 + 1][MAX * 2 + 1];

int count( int idx, int x1, int y1, int x2, int y2 )
{
	int res = sum[idx][x2][y2];
	res -= sum[idx][x1 - 1][y2];
	res -= sum[idx][x2][y1 -1];
	res += sum[idx][x1 - 1][y1 - 1];
	return res;
}
bool check( int b )
{
	for( int x = 1; x <= D; x++ ) {
		for( int y = 1; y <= D; y++ ) {
			if( count( 0, x + b + 1, y + b + 1, x + D - 1, y + D - 1 ) ) {
				continue;
			}
			if( count( 1, x + b + 1, y, x + D - 1, y + b ) ) {
				continue;
			}
			if( count( 1, x, y + b + 1, x + b, y + D - 1 ) ) {
				continue;
			}
			return true;
		}
	}
	return false;
}

int main() {
	cin >> N >> D;
	for( int i = 0; i < N; i++ ) {
		int x, y;
		cin >> x >> y;
		cnt[x % D][y % D]++;
	}

	int ma = 0;
	for( int i = 0; i < D; i++ ) {
		for( int j = 0; j < D; j++ ) {
			ma = max( ma, cnt[i][j] );
		}
	}
	int R = ceil( sqrt( ma ) ) - 1;
	for( int i = 0; i < D; i++ ) {
		for( int j = 0; j < D; j++ ) {
			int c = cnt[i][j];
			if( c > R * R ) {
				A[0][i][j]++;
			}
			if( c > R * (R + 1) ) {
				A[1][i][j]++;
			}
		}
	}

	for( int i = 1; i <= D * 2; i++ ) {
		for( int j = 1; j <= D * 2; j++ ) {
			sum[0][i][j] += sum[0][i][j - 1] + sum[0][i - 1][j] - sum[0][i - 1][j - 1] + A[0][(i - 1) % D][(j - 1) % D];
			sum[1][i][j] += sum[1][i][j - 1] + sum[1][i - 1][j] - sum[1][i - 1][j - 1] + A[1][(i - 1) % D][(j - 1) % D];
		}
	}
	int l = 0;
	int r = D;
	while( r > l ) {
		int m = (l + r) / 2;
		if( check( m ) ) {
			r = m;
		}
		else {
			l = m + 1;
		}
	}

	cout << R * D + r << endl;

	return 0;
}


Measured memory_bytes: 43264
#include <cstdio>
#include <iostream>

using namespace std;

int main() {
	int n;
	scanf("%d", &n);

	int A[n];
	for (int i = 0; i < n; ++i) {
		int v;
		scanf("%d", &v);
		A[i] = v;
	}

	int L[n];
	L[0] = A[0];
	int length = 1;
	for (int i = 1; i < n; ++i) {
		if (L[length - 1] < A[i]) {
			L[length++] = A[i];
		} else {
// L[j] (j ??? 0 ?????? lengh-1) ????????§ A[i] ??\?????¨??????????????? j ????????? = A[i]
			int left = 0;
			int right = length - 1;
			int mid = (left + right) / 2;

			while (left < right) {
				if (L[mid] >= A[i]) {
					right = mid;
				} else {
					left = mid + 1;
				}
				mid = (left + right) / 2;
			}
			L[mid] = A[i];
		}
	}

	cout << length << endl;

	return 0;
}

Measured memory_bytes: 3908
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
 int main(){
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a ,b;
    cin>>a>>b;
    int c=a-(2*b);
    if(c>0)
    	cout<<c;
    	else cout<<"0";
    
	return 0;
}

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

typedef pair< int, int > pii;

class SegmentTree {
private:
	int size__;
	vector< pii > data;
	
	inline int left_t(int k) { return 2 * k + 1; }
	inline int right_t(int k) { return 2 * k + 2; }
	
public:
	SegmentTree(int n) {
		for (size__ = 1; size__ < n; size__ *= 2);
		data.assign(2 * size__ - 1, pii(0, -(1e9)));
	}
	
	pii calc(pii d1, pii d2) { return max(d1, d2); }
	
	void add(int k, int a) {
		int id = -k;
		k += size__ - 1;
		
		int cur = data[k].first;
		data[k] = pii(cur + a, id);
		
		while (k > 0) {
			k = (k - 1) / 2;
			data[k] = calc(data[left_t(k)], data[right_t(k)]);
		}
	}
	
	pii query(int a, int b) {
		return query(a, b, 0, 0, size__);
	}
	
	pii query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) return pii(-1, -(1e9));
		if (a <= l && r <= b) return data[k];
		return calc(query(a, b, left_t(k), l, (l + r) / 2),
					query(a, b, right_t(k), (l + r) / 2, r));
	}
};

int main() {
	int n, q;
	cin >> n >> q;
	
	SegmentTree segtree(n);
	for_(i,0,n) segtree.add(i, 0);
	
	for_(i,0,q) {
		int a, v;
		cin >> a >> v;
		
		segtree.add(a-1, v);
		
		pii maxp = segtree.query(0, n+1);
		cout << (-maxp.second) + 1 << " " << maxp.first << endl;
	}
}

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

int main(){
  long long int a,b;
  cin>>a>>b;
  long long int c,d;
  c=min(a,b);
  d=max(a,b);
  for(long long int x=0; x<d;x++){
    cout<<c;
  }
}

Measured memory_bytes: 256
import Control.Monad (forM_)

solve [_] _ maxans = maxans
solve ((_,a10):(a01,a11):as) ans maxans = solve ((a01,a11):as) newans $ max maxans newans
  where newans = ans+a01-a10


main :: IO ()
main = do
  n <- read <$> getLine :: IO Int
  a1s <- map read.words <$> getLine :: IO [Int]
  a2s <- map read.words <$> getLine :: IO [Int]
  let as = zip a1s a2s
      firstAns = (head a1s+sum a2s)
  print $ solve as firstAns firstAns


Measured memory_bytes: 1020
#include <stdio.h>
int main(void){
    int i, n, l[101], sum = 0, max;
    scanf("%d", &n);
    
    for( i = 0; i < n; i++ ){
        scanf("%d", &l[i]);
        sum += l[i];
    }
    
    max = l[0];
    
    for( i = 0; i < n; i++ ){
        if( max < l[i] ){
            max = l[i];
        }
    }
    
    if( max < sum - max ){
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    
    return 0;
}


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

int main(){
  double A,B,H,M;
  cin >> A >> B >> H >> M;
  H = H*30 + M*0.5 ;
  M *= 6;
  double rad = min(abs(H-M),360-abs(H-M));
  double co = cos(M_PI*rad/180);
  double aa = A*A + B*B - 2.0*A*B*co;
  cout << fixed << setprecision(10) << sqrt(aa) << endl;
}

Measured memory_bytes: 4228
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<numeric>

using namespace std;

typedef long long LL;

struct edge {
	int to;
	int cost;
};

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

int main(void) {
	int n, x;
	cin >> n >> x;
	vector<int>a(n);
	LL sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	if (x == sum) {
		cout << n;
	}
	else if (x > sum) {
		cout << n - 1;
	}
	else {
		int i = 0;
		sort(a.begin(), a.end());
		while (x - a[i] >= 0) {
			x -= a[i];
			i++;
		}
		cout << i;
	}
	return 0;
}

Measured memory_bytes: 256
"use strict";

var main = function main(input) {
  var N = parseInt(input.split("\n")[0]);
  var a = input.split("\n")[1].split(" ");
  a.sort(function (a, b) {
    return b - a;
  });
  var num = a.length;
  var Alice = 0;
  var Bob = 0;

  for (var i = 0; i < num; i++) {
    if (i % 2 == 0) {
      Alice += parseInt(a[i], 10);
    } else {
      Bob += parseInt(a[i], 10);
    }
  }

  console.log(Alice - Bob);
};

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7500
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n, m;
  cin >> n >> m;
  vector<pair<int, bool>> vec(n);
  rep(i, n) vec[i] = make_pair(0, false);
  rep(i, m) {
    int s, c;
    cin >> s >> c;
    if (s == 1 && c == 0 && n != 1) {
      cout << -1 << endl;  
      return 0;      
    }
    if (vec[s-1].second && vec[s-1].first != c) {
      cout << -1 << endl;  
      return 0;
    }
    vec[s-1].first = c;
    vec[s-1].second = true;
  }
  
  if (vec[0].first == 0 && vec[0].second && n != 1) {
    cout << -1 << endl;
  } else {
    int ans = 0;
    rep(i, n) {
      int d = vec[i].second ? vec[i].first : (i == 0 && n != 1  ? 1 : 0);
      int p = d * pow(10, n-(1+i));
      ans += p;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3744
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define inf 1e9
#define INF 1000000000000000000

int main() {
    int N;
    cin >> N;
    vector<int> H(N);

    rep(i, N) { cin >> H[i]; }

    for (int i = 1; i < N; i++) {
        if (H[i] >= H[i - 1])
            continue;
        if (H[i] - 1 == H[i - 1])
            H[i]--;
        if (H[i] + 1 == H[i - 1])
            H[i]++;
        else {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int d,n; cin >> d >> n;
    if(d==0){
        if(n!=100)cout << 1*n << endl;
        else cout << 101 << endl;
    }
    else if(d==1){
        if(n!=100)cout << 100*n << endl;
        else cout << 10100 << endl;
    }
    else{
        if(n!=100)cout << 10000*n << endl;
        else cout << 10000*100+10000 << endl;
    } 
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main (void)
{
	char s[4];
	int i,n;
	scanf("%s",s);

	for(i=0;i<strlen(s);i++){
		if(s[i]=='1'){
			s[i]='9';
		}
		else if(s[i]=='9'){
			s[i]='1';
		}
	}
	printf("%s\n",s);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,j) for (int (i)=0;(i)<(int)(j);++(i))
#define put(i) cout << (i) << endl
using namespace std;
typedef long long ll;

int main() {
    int m, nmin, nmax;
    while (cin >> m >> nmin >> nmax, (m||nmin||nmax)) {
        vector<int> p(m);
        rep(i,m) cin >> p[i];
        sort(p.begin(), p.end(), [](const int & a, const int & b) {return a > b;});
        int ans = -1, v = -1;
        for (int i = nmin-1; i < nmax; ++i) {
            int gap = p[i]-p[i+1];
            if (gap >= v) {
                v = gap;
                ans = i+1;
            }
        }
        put(ans);
    }
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp);
void ipgraph(int m);
//void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
// vector<int>adj[100005];
// int dp[100005];
// bool vis[100005];
// int in_degree[100005];
// void dfs(int src){
//     vis[src]=true;    
//     for(auto it:adj[src]){
//         dp[it]=max(dp[it],dp[src]+1);
//         --in_degree[it];
//         if(in_degree[it]==0)dfs(it);
//         }
//
//
//
// }
//


double solve(double a[],int n){
    if(n==1)return 1;
    return (solve(a,n-1)*a[n-1]+solve(a,n-1)*(1-a[n-1]));
}

int main(){
ios_base::sync_with_stdio(0);
ll int t,n,i,j,k,m;
t=1;
// cin>>t;
int T;
Fo(T,1,t+1){
double dp[1000000];
//  cout<<"Case #"<<T<<": ";
    cin>>n;
    double a[n+1];
    dp[0]=1;
    fo(i,n){

    cin>>a[i];
    
    for(int j=i+1;j>=0;j--){
    dp[j]=(j==0?0:dp[j-1]*a[i])+dp[j]*(1-a[i]);
    }

    }
    double ans=0;
    fo(i,n+1){
        int j=n-i;
        if(i>j)ans+=dp[i];
    }
    printf("%.10lf\n",ans );

    //double p=solve(a,n);
    //cout<<p;

}
}


Measured memory_bytes: 3856
a,b,c = map(int,input().split())
if a == 5 and b == 7 and c ==5:
    print('YES')
elif a == 5 and b == 5 and c == 7:
    print('YES')
elif a == 7 and b == 5 and c == 5:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 2940
while True:
	a,b,c=map(str, input().split())
	if b=='?':
		break
	a=int(a)
	c=int(c)
	if b=='+':
		print(a+c)
	elif b=='*':
		print(a*c)
	elif b=='/':
		print(int(a/c))
	elif b=='-':
		print(a-c)

Measured memory_bytes: 6732
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls int
#define give main()
const int mod = 1000000007;
#pragma endregion

const int N = 1e6+5;

pls give {
    AC;
    string a;
    cin >> a;
    for (int i=0; i<a.length(); i++) cout << 'x';
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int b = 0;
    for (int i = 0; i < 3; i++) {
        if (a[i] == a[i + 1] && a[i + 1] != a[i + 2]) b = 1;
    }

    cout << (b ? "Yes" : "No") << endl;

    return 0;
}

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

#define int long long
#define rep(i,a,n) for(int i = a; i < n; i++)
#define pb push_back
#define eb emplace_back
#define dump(x) cout << #x << " = " << (x) << endl
#define chk() cout << "now" << endl;
#define ALL(x) (x).begin(),(x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTG(c) sort(ALL(c), greater<int>());
#define fi first
#define se second
int INF = 1e9 + 7;

typedef pair<int,int> P;
typedef vector<int> vi;


// 素因数分解
vector<pair<int, int> > prime_factorize(int n) {
    vector<pair<int, int> > res;
    for (int p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

// combination2
// n,kが大きいとき(INFは素数)
const int MAX=200000;

int fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % INF;
        inv[i] = INF - inv[INF%i] * (INF / i) % INF;
        finv[i] = finv[i - 1] * inv[i] % INF;
    }
}

// 二項係数計算
int COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % INF) % INF;
}

int N,M;

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

    cin>>N>>M;
    vector<P> v=prime_factorize(M);
    COMinit();
    int ans=1;
    rep(i,0,v.size()) {
        int A=v[i].se;
        int B=COM(A+N-1,N-1);
        ans=(ans*B)%INF;
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

int main() {
  i64 N, K;
  cin >> N >> K;

  vector<i64> A(N);
  vector<set<i64>> st(10);
  for(i64 i = 0;i < N;i++) {
    cin >> A[i];
    st[A[i]].insert(i);
  }


  i64 now = -1;
  for(i64 i = N - K;i --> 0;) {
    i64 ans = 0;
    for(i64 n = 10;n --> 1;) {
      auto iter = st[n].upper_bound(now);
      if(iter == st[n].end()) continue;
      else if(N - *iter > i){
        ans = n;
        now = *iter;
        break;
      }
    }
    cout << ans;
  }
  cout << endl;
}



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

using ll = long long;
#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 

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

    int N, x;
    cin >> N >> x;

    vector<int> a(N); cin >> a;

    ll ans = 0;
    
    rep(i, N-1) {
        ll s = a[i] + a[i+1];
        if (s > x) {
            ll d = s - x;
            ll r = min(d, (ll)a[i+1]);
            ll l = d - r;
            a[i] -= l;
            a[i + 1] -= r;
            ans += l + r;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define F first
#define fr(i,n) for(ll i=1;i<=n;i++)
#define mm(a,k) memset(a,k,sizeof(a))
#define S second
#define all(a) a.begin(),a.end()
#define mod 1000000007
template<class T>
void printQueue(T& q)
{while (!q.empty()){cout << q.top() << endl;q.pop();}}


ll power(ll a,ll b)
{
    ll r=1;
    while(b!=0)
    {
        if(b%2!=0){r=r*a;}
        a=a*a; b=b/2;
    }
    return r;
}


int main()
{   ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll n,k; cin>>n>>k;
        ll ast[n+1];
        for(ll i=1;i<=n;i++){
            cin>>ast[i];
        }

        ll dp[n+1];
        dp[n]=0;

        for(int i=n-1;i>=1;i--){
            dp[i]=INT_MAX;
            for(int j=i+1;j<=min(n,i+k);j++){
                dp[i]=min(dp[i],dp[j]+abs(ast[j]-ast[i]));
            }
            //dp[i]= min((dp[i+1]+abs(ast[i+1]-ast[i])),(dp[i+2]+abs(ast[i+2]-ast[i])));
        }

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


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <bitset>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = true;


int main(){

    ll N;
    string s;

    cin >> N;
    cin >> s;

    ll cnt[26] = {0};
    for(int i = 0; i < N; i++){
        cnt[ (s[i] - 'a') ] ++;
    }

    ll ans = 1;
    for(int i = 0; i < 26; i++){
        ans *= (cnt[i] + 1);
        ans %=  1000000007;
    }
    cout << ans - 1 << endl;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main () {
    int a = 0;
    int b = 0;
    int c = 0;
    char ary_a[128];
    char ary_b[128];
    char ary_c[128];
    char turn = 'a';

    fgets(ary_a,sizeof(ary_a),stdin);
    fgets(ary_b,sizeof(ary_b),stdin);
    fgets(ary_c,sizeof(ary_c),stdin);
    //printf("%s%s%s", ary_a, ary_b, ary_c);

    //printf("%c\n", ary_a[0]);

    while(1){
        //printf("turn: %c\n", turn);
        //printf("p[%d]: %c\n", tmp, p[tmp]);

        if(turn == 'a'){
            turn = ary_a[a];
            if(isspace(ary_a[a]) != 0){
                puts("A");
                return 0;
            }
            a++;
        }else if(turn == 'b'){
            turn = ary_b[b];
            if(isspace(ary_b[b]) != 0){
                puts("B");
                return 0;
            }
            b++;
        }else{
            turn = ary_c[c];
            if(isspace(ary_c[c]) != 0){
                puts("C");
                return 0;
            }
            c++;
        }
    }

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int N;
  cin >> N;
  
  vector<int>mochi(N,0);
  for(int i=0;i<N;i++){
    cin >> mochi[i];
  }
  
  vector<int>length(101,0);
  for(int i=0;i<N;i++){
    length[mochi[i]]++;
  }
  
  int ans = 0;
  
  for(int i=1;i<=100;i++){
    if(length[i] != 0)
      ans++;
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
// http://abc065.contest.atcoder.jp/tasks/arc076_b

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>

class UnionFind {
	int n;
	int * parent;
	int * depth;
	int NumOfSets;
public:
	UnionFind (int n) {
		this->n = n;
		parent = new int[n];
		depth = new int[n];
		for (int i = 0; i < n; ++i) {
			parent[i] = i;
			depth[i] = 1;
		}
		NumOfSets = n;
	}
	~UnionFind () {
		delete[] parent;
		delete[] depth;
	}
	int find (int node) {
		while (parent[node] != parent[parent[node]]) {
			parent[node] = parent[parent[node]];
		}
		return parent[node];
	}
	void union_ (int nodeA, int nodeB) {
		int rootA = find(nodeA), rootB = find(nodeB);
		if (rootA != rootB) {
			if (depth[rootA] < depth[rootB]) {
				std::swap(rootA, rootB);
			}
			parent[rootB] = rootA;
			depth[rootA] = std::max(depth[rootA], depth[rootB] + 1);
			--NumOfSets;
		}
	}
	int getNumOfSets () { return NumOfSets; }
};

struct Town {
	int x, y, id;
	Town (int x, int y, int id) : x(x), y(y), id(id) {}
};

struct Road {
	int a, b, cost;
	Road (int a, int b, int cost) : a(a), b(b), cost(cost) {}
};

int main () {

	int n;
	scanf("%d", &n);

	std::vector<Town> towns;
	std::vector<Road> roads;

	UnionFind unionFind(n);

	int tempX, tempY, totalCost = 0;

	for (int i = 0; i < n; ++i) {
		scanf("%d%d", &tempX, &tempY);
		towns.push_back(Town(tempX, tempY, i));
	}

	std::sort(towns.begin(), towns.end(), [] (const Town & a, const Town & b) {
		return a.x < b.x;
	});

	for (int i = 1; i < n; ++i) {
		roads.push_back(Road(towns[i].id, towns[i - 1].id, towns[i].x - towns[i - 1].x));
	}

	std::sort(towns.begin(), towns.end(), [] (const Town & a, const Town & b) {
		return a.y < b.y;
	});

	for (int i = 1; i < n; ++i) {
		roads.push_back(Road(towns[i].id, towns[i - 1].id, towns[i].y - towns[i - 1].y));
	}

	std::sort(roads.begin(), roads.end(), [] (
		const Road & a,
		const Road & b
	) -> bool {
		return a.cost < b.cost;
	});

	for (Road road : roads) {
		if (unionFind.find(road.a) != unionFind.find(road.b)) {
			totalCost += road.cost;
			unionFind.union_(road.a, road.b);
			if (unionFind.getNumOfSets() == 1) break;
		}
	}

	printf("%d\n", totalCost);

	return 0;

}


Measured memory_bytes: 6900
//
//  main.cpp
//  CoderTest
//
//  Created by yuya on 2019/07/25.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;


int main()
{
    
    int L,R;
    cin >> L >> R;
    if(abs(L-R) + 1 >= 2019) {
        cout << 0 << endl;
    } else {
        int l = L % 2019;
        int r = R % 2019;
        if(l >= r) {
            cout << 0 << endl;
        } else {
            int res, minres=2019;
            for(int i=l;i<=r-1;i++){
                for(int j=l+1;j<=r;j++){
                    res = (i * j) % 2019;
                    minres = min(res , minres);
                }
            }
            cout << minres << endl;
        }
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <list>
#include <sys/timeb.h>
#include <fstream>
#include <set>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int n;
	cin >> n;
	vi d(n);
	rep(i,n) cin>> d[i];
	sort(all(d));
	int ans = 1;
	int t = d[0];
	rep(i, n-1) {
		if(d[i] != d[i+1]) {
			t = d[i];
			ans++;
		}
	}
	cout << ans<<endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
bool prime[d5];
void era(){
    for(int i=0;i<d5;i++)prime[i]=true;
    prime[0]=prime[1]=false;
    for(int i=0;i<d5;i++){
        if(!prime[i])continue;
        for(int j=2*i;j<d5;j+=i)prime[j]=false;
    }
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k,r,s,p;
    cin>>n>>k>>r>>s>>p;
    string t;
    cin>>t;
    for(int i=0;i<n;i++){
        if(i<k)continue;
        else{
            if(t[i-k]==t[i]){
                t[i]='!';
            }
        }
    }
    int res=0;
    for(int i=0;i<n;i++){
        if(t[i]=='s'){
            res+=r;
        }else if(t[i]=='r'){
            res+=p;
        }else if(t[i]=='p'){
            res+=s;
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 512
//#include<bits/stdc++.h>
#include<cstdio>
#include<string>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	char C = getcha();
	int A = C - '0';
	while ((C = getcha()) >= '0') A = A * 10 + C - '0';
	return A;
}

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


	int N = getint(), K = getint(), Q = getint();

	int P[100001];
	rep1(i, N) {
		P[i] = K - Q;
	}
	rep(i, Q) {
		P[getint()]++;
	}
	string S;
	rep1(i, N) {
		if (P[i] > 0) S += "Yes\n";
		else S += "No\n";
		if (i % 1000 == 0) {
			printf("%s", S.c_str());
			S = "";
		}
	}
	printf("%s", S.c_str());

	Would you please return 0;
}

Measured memory_bytes: 1152
#include <iostream>
using namespace std;
 
int main() 
{
  int n,i;
  cin >> n;
  int x[n],y[n],h[n];
  for(i = 0;i < n;i++){
    cin >> x[i] >> y[i] >> h[i];
  }
  int cx,cy,ch;
  int ax,ay;
  int dh;
  for(cx = 0;cx <= 100;cx++){
    for(cy = 0;cy <= 100;cy++){
      for(i = 0;i < n;i++){
        if(h[i] == 0){
          continue;
        }else{
          break;
        }
      }
      ax = x[i] - cx;
      ay = y[i] - cy;
      if (ax < 0){
        ax = -ax;
      }
      if(ay < 0){
        ay = -ay;
      }
      ch = h[i] + ax + ay;
      for(i = 0;i < n;i++){
        ax = x[i] - cx;
        ay = y[i] - cy;
        if (ax < 0){
        ax = -ax;
        }
        if(ay < 0){
        ay = -ay;
        }
        dh = ch - ax - ay;
        if(dh < 0){
          dh = 0;
        }
        if(dh == h[i]){
          continue;
        }else{
          break;
        }
      }
      if(i == n){
        break;
      }
    }
    if(i == n){
      break;
    }
  }
  cout << cx << " " << cy << " " << ch << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    if (M <= 1) {
        if (K == 0) {
            rep(i, M+1) {
                cout << i << ' ' << i << ' ';
            }
            cout << endl;
        } else {
            cout << -1 << endl;
        }
    } else {
        int ub = 1 << M;
        if (K < ub) {
            for (int n = 0; n < ub; ++n) {
                if (n == K) continue;
                cout << n << ' ';
            }
            cout << K << ' ';
            for (int n = ub-1; 0 <= n; --n) {
                if (n == K) continue;
                cout << n << ' ';
            }
            cout << K << endl;
        } else {
            cout << -1 << endl;
        }        
    }

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i,n) for (long i=0;i<(n);i++)
#define FOR(i,a,b) for (long i=(a);i<(b);i++)
#define RREP(i,n) for(long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long i=(a);i>(b);i--)
#define dump1d_arr(array) REP(i,array.size()) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl;
#define dump2d_arr(array) REP(i,array.size()) REP(j,array[i].size()) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl;
#define dump(x)  cerr << #x << " => " << (x) << endl;
#define CLR(vec) { REP(i,vec.size()) vec[i] = 0; } 
#define llINF (long long) 9223372036854775807
#define loINF (long) 2147483647
#define shINF (short) 32767
#define SORT(c) sort((c).begin(),(c).end())
#define DEBUG

using namespace std;
typedef vector<long> VI;
typedef vector<VI> VVI;
typedef pair<long,long> pr;
typedef map<double,pr> mp;

typedef map<string, bool> mb;

mb notes;

int N;
int total = 0;

int main(void){
    cin >> N;
    string t;

    REP(i, N){
        cin >> t;

        auto itr = notes.find(t);
        if( itr != notes.end() ) {
            notes[t] = !notes[t];
        } else {
            notes[t] = true;
        }

    }

    for(auto itr = notes.begin(); itr != notes.end(); ++itr) {
        if (itr->second){
            total++;
        }
    }

    cout << total;

    return 0;
}

Measured memory_bytes: 12544
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
	N, M = MAP()
	dp = [INF]*(1<<N)
	dp[0] = 0

	for _ in range(M):
		a, b = MAP()
		c = LIST()
		tmp = 0
		for x in c:
			tmp = tmp|1<<(x-1)
		for S in range(1<<N):
			dp[S|tmp] = min(dp[S|tmp], dp[S]+a)

	print(dp[-1] if dp[-1] != INF else -1)

if __name__ == "__main__":
	main()


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

int main() {

  int A, B, C, D;
  cin >> A >> B >> C >> D;

  bool flg = true;
  int count = 1;
  while(flg) {
    if (count % 2 == 0) {
      A -= D;
    } else {
      C -= B;
    }
    if (A <= 0 || C <= 0) {
      flg = false;
    } else {
      count++;
    }
  }

  if (count % 2 == 1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;

}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

struct data {
	int d[7];
} dice;

int search(int a)
{
	int i;

	for(i=1;i<=6;i++){
		if(dice.d[i] == a)
			return i;
	}
}

int main(void)
{
	int q;
	int i, j, tmp, a, b;


	for(i=1;i<=6;i++)
		scanf("%d", &dice.d[i]);
	scanf("%d", &q);

	for(i=0;i<q;i++){
		scanf("%d %d", &a, &b);

		
		switch(search(a)){
			case 4 :	tmp = dice.d[3];
						dice.d[3] = dice.d[1];
						dice.d[1] = dice.d[4];
						dice.d[4] = dice.d[6];
						dice.d[6] = tmp;
						break;
			case 2 :	tmp = dice.d[5];
						dice.d[5] = dice.d[1];
						dice.d[1] = dice.d[2];
						dice.d[2] = dice.d[6];
						dice.d[6] = tmp;
						break;
			case 5 :	tmp = dice.d[2];
						dice.d[2] = dice.d[1];
						dice.d[1] = dice.d[5];
						dice.d[5] = dice.d[6];
						dice.d[6] = tmp;
						break;
			case 3 :	tmp = dice.d[4];
						dice.d[4] = dice.d[1];
						dice.d[1] = dice.d[3];
						dice.d[3] = dice.d[6];
						dice.d[6] = tmp;
						break;
			case 6 :	tmp = dice.d[6];
						dice.d[6] = dice.d[1];
						dice.d[1] = tmp;
						tmp = dice.d[3];
						dice.d[3] = dice.d[4];
						dice.d[4] = tmp;
						break;
		}

		while(dice.d[2] != b){
			tmp = dice.d[2];
			dice.d[2] = dice.d[3];
			dice.d[3] = dice.d[5];
			dice.d[5] = dice.d[4];
			dice.d[4] = tmp;
		}

		printf("%d\n", dice.d[3]);
	}

	return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b / gcd(a,b);}

int main() {
    string s;
    cin >> s;
    int res = count(s.begin(), s.end(), 'o');
    cout << 700+res*100 << "\n";
}


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

using namespace std;

int n;
int a1[105];
int a2[105];
int dp[105][2];

int rec(int i, int tu) {

  if(dp[i][tu] >= 0) return dp[i][tu];
  
  if(i == n-1 && tu == 1) return a2[i];
 
 

  int res = 0;

  if(!tu) {
    res = max(res,max(rec(i + 1, 0) + a1[i],rec(i,1) + a1[i]));
  }
  else res = max(res,rec(i + 1,1) + a2[i]);

  return dp[i][tu] = res;
}

int main() {
  cin >> n;
  for(int i = 0; i < n; i++) cin >> a1[i];
  for(int i = 0; i < n; i++) cin >> a2[i];

  memset(dp,-1,sizeof dp);
  
  
  cout << rec(0,0) << endl;
}
  


Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main() {
  int m, d;
  scanf("%d%d", &m, &d);
  int ans = 0;
  for (int i = 1; i <= m; ++i) {
    for (int j = 10; j <= d; ++j) {
      if (j % 10 >= 2 && j / 10 >= 2 && (j % 10) * (j / 10) == i) {
        ++ans;
      }
    }
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n, m = map(int, input().split())
l_key = []
r_key = []
for i in range(m):
    l, r = map(int, input().split())
    l_key.append(l)
    r_key.append(r)

print(max(0, min(r_key) - max(l_key) + 1))


Measured memory_bytes: 76012
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a == b && b == c)System.out.println("1");
		else if(a != b && b != c && c != a)System.out.println("3");
		else{
			System.out.println("2");
		}
	}
}

Measured memory_bytes: 19924