akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#ifdef PRINTERS
#include "printers.hpp"
using namespace printers;
#define tr(a)		cerr<<#a<<" : "<<a<<endl
#else
#define tr(a)    
#endif
#define int 		long long
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;

void solve(){
	int N;
	cin>>N;
	vi x(N);
	rep(i,0,N){
		cin>>x[i];
	}
	int tempmax=*max_element(all(x));
	if(tempmax<=0){
		auto it=find(all(x),tempmax)-x.begin();
		cout<<tempmax<<endl;
		cout<<N-1<<endl;
		for(int i=N-1;i>it;i--){
			cout<<i+1<<endl;
		}
		for(int i=0;i<it;i++){
			cout<<1<<endl;
		}
		return;
	}
	int maxx=0;
	int maxy=0;
	rep(i,0,N){
		if(x[i]>0){
			if(i%2)maxx+=x[i];
			else maxy+=x[i];
		}
	}
	if(maxx>maxy){
		cout<<maxx<<endl;
		int firstpos=-1;
		int lastpos=-1;
		for(int i=1;i<N;i+=2){
			if(x[i]>0){
				lastpos=i;
				if(firstpos<0)firstpos=i;
			}
		}
		vi anss;
		for(int i=N-1;i>lastpos;i--)
			anss.pb(i+1);
		for(int i=0;i<firstpos;i++){
			anss.pb(1);
		}
		vi newarr(x.begin()+firstpos,x.begin()+lastpos+1);
		lastpos-=firstpos;
		firstpos=0;
		for(int i=lastpos;i>=0;i-=2){
			if(newarr[i]>0)continue;
			else{
				anss.pb(i+1);
				newarr[i-1]+=newarr[i+1];
				newarr[i]=LLONG_MAX;
				newarr[i+1]=LLONG_MAX;
			}
		}
		vi newarr2;
		for(auto i:newarr)
			if(i<LLONG_MAX)newarr2.pb(i);
		rep(i,0,sz(newarr2)/2)anss.pb(2);
		cout<<sz(anss)<<endl;
		for(auto i:anss)cout<<i<<endl;
	}
	else{
		cout<<maxy<<endl;
		int firstpos=-1;
		int lastpos=-1;
		for(int i=0;i<N;i+=2){
			if(x[i]>0){
				lastpos=i;
				if(firstpos<0)firstpos=i;
			}
		}
		vi anss;
		for(int i=N-1;i>lastpos;i--)
			anss.pb(i+1);
		for(int i=0;i<firstpos;i++){
			anss.pb(1);
		}
		vi newarr(x.begin()+firstpos,x.begin()+lastpos+1);
		lastpos-=firstpos;
		firstpos=0;
		for(int i=lastpos;i>=0;i-=2){
			if(newarr[i]>0)continue;
			else{
				anss.pb(i+1);
				newarr[i-1]+=newarr[i+1];
				newarr[i]=LLONG_MAX;
				newarr[i+1]=LLONG_MAX;
			}
		}
		vi newarr2;
		for(auto i:newarr)
			if(i<LLONG_MAX)newarr2.pb(i);
		rep(i,0,sz(newarr2)/2)anss.pb(2);
		cout<<sz(anss)<<endl;
		for(auto i:anss)cout<<i<<endl;
	}
}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

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

int main(){
	char c;
	int total = 0;
	while(cin.get(c)){
		int n;
		if(isdigit(c)){
			cin.unget();
			cin >> n;
			total += n;
		}
	}
	cout << total << endl;
	return 0;
}

Measured memory_bytes: 0
#include <vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<queue>
#include<string>
//#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;

using weight = int;
const int inf = 1e9;
struct edge {
	int to;
	weight cap;
	int rev;
};

using edges = std::vector<edge>;
using graph = std::vector<edges>;

void add_edge(graph& g, int from, int to, weight cap) {
	g[from].push_back(edge{ to, cap, static_cast<int>(g[to].size()) });
	g[to].push_back(edge{ from, 0, static_cast<int>(g[from].size() - 1) });
}

void bfs(graph& g, std::vector<int>& level, int s) {
	for (int i = 0; i < (int)level.size(); ++i) {
		level[i] = -1;
	}
	level[s] = 0;
	std::queue<int> que;
	que.push(s);
	while (!que.empty()) {
		int v = que.front(); que.pop();
		for (int i = 0; i < (int)g[v].size(); ++i) {
			edge& e = g[v][i];
			if (e.cap > 0 && level[e.to] < 0) {
				level[e.to] = level[v] + 1;
				que.push(e.to);
			}
		}
	}
}

weight dfs(graph& g, std::vector<int>& level, std::vector<int>& iter, int v, int t, weight f) {
	if (v == t) {
		return f;
	}
	for (int& i = iter[v]; i < (int)g[v].size(); ++i) {
		edge& e = g[v][i];
		if (e.cap > 0 && level[v] < level[e.to]) {
			weight d = dfs(g, level, iter, e.to, t, std::min(f, e.cap));
			if (d > 0) {
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

weight max_flow(graph& g, int s, int t) {
	weight flow = 0;
	std::vector<int> level(g.size(), -1);
	std::vector<int> iter(g.size(), 0);
	weight INF = 1e9;
	while (true) {
		bfs(g, level, s);
		if (level[t] < 0) {
			return flow;
		}
		for (int i = 0; i < (int)iter.size(); ++i) {
			iter[i] = 0;
		}
		weight f;
		while ((f = dfs(g, level, iter, s, t, INF)) > 0) {
			flow += f;
		}
	}
}

int main() {
	int H, W;
	cin >> H >> W;
	vector<string> a(H);
	for (int i = 0; i < H; ++i) {
		cin >> a[i];
	}
	graph g(2 * H * W);
	int source, sink;
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (a[i][j] == 'S') {
				source = i * W + j;
			}
			else if (a[i][j] == 'T') {
				sink = i * W + j;
			}
			if (a[i][j] == '.') {
				continue;
			}
			add_edge(g, i * W + j, i * W + j + H * W, (a[i][j] == 'T' || a[i][j] == 'S' ? inf : 1));
			for (int k = 0; k < H; ++k) {
				if (i != k && a[k][j] != '.') {
					add_edge(g, i * W + j + H * W, k * W + j, 1);
				}
			}
			for (int k = 0; k < W; ++k) {
				if (j != k && a[i][k] != '.') {
					add_edge(g, i * W + j + H * W, i * W + k, 1);
				}
			}
		}
	}
	if (source / W == sink / W || source % W == sink % W) {//同じ行or同じ列
		cout << -1 << endl;
	}
	else {
		cout << max_flow(g, source, sink) << endl;
	}
	return 0;
}


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

struct P
{
    int x,y;

    bool operator<(const P &a)const{
        if(x!=a.x)
              return x>a.x;
        return y>a.y;
    }

};

vector<int> v[1],v1;

//bitset<4001000> b;
int i,n,d,m,k,a,b,c,h;

int o[5];
int l[3];
int j[1];
int e;


//int dx[10]={2,2,-2,-2,1,1,-1,-1},dy[10]={1,-1,1,-1,2,-2,2,-2};

int dx[10]={0,1,0,-1,1,1,-1,-1},dy[10]={1,0,-1,0,1,-1,1,-1},dz[10]={0,0,0,0,1,-1};
long long mod=1000000007,mod2=1000000009,mod3=2017;
long long x,z,y;
double pi=3.14159265;
P u[1];
stack<int> s;
//set<int> s[222][22];
//priority_queue<long long,vector<long long>,greater<long long> > q;
queue<int> q;
//2147483647
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
//map<int,int> p;
/*
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
unordered_map<long long, int, custom_hash> safe_map;
*/
//list<int> l;

//string r,r1;
//char r[2];
//deque<int> de;
//srand((int)time(NULL));
/*bool as(P a,P b)
{
    if(a.x!=b.x)
    return a.x<b.x;
    return a.y<b.y;
}*/



bool as(P a,P b)
{
    if(a.x!=b.x)
        return a.x<b.x;
    return a.y<b.y;

}



int main()
{
    scanf("%d %d %d",&a,&b,&c);
    printf("%d",(a-b+1)*(a-c+1));
}





Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def input(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')


sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

d, n = map(int, input().split())
print(n*(100**d) if n != 100 else (n+1)*(100**d))


Measured memory_bytes: 38416
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
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 chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 18;
char cn[cm], * ci = cn, ct;
const int dm = 1 << 16;
char dn[dm], * di = dn;
inline int getint() {
	int A = 0;
	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
inline void putint(int X) {
	if (X == 0) {
		*di++ = '0';
		*di++ = '\n';
		return;
	}
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

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


	fread(cn, 1, cm, stdin);
	int K = getint(), Q = getint();
	int D[5000];
	rep(i, K) D[i] = getint();

	rep(i, Q) {
		int N = getint(), X = getint(), M = getint();
		N--;
		X %= M;

		int N2 = N / K;
		N %= K;

		ll kosuu = 0, kosuu2 = 0;
		ll kazu = 0, kazu2 = 0;
		rep(i, N) {
			int kari = D[i] % M;
			if (kari) {
				kosuu++;
				kazu += kari;
			}
		}
		for (int i = N; i < K; i++) {
			int kari = D[i] % M;
			if (kari) {
				kosuu2++;
				kazu2 += kari;
			}
		}
		kosuu *= N2 + 1;
		kazu *= N2 + 1;
		kosuu2 *= N2;
		kazu2 *= N2;
		kosuu += kosuu2;
		kazu += kazu2 + X;

		kosuu -= kazu / M;

		putint(kosuu);
	}

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 512
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int A = Integer.parseInt(in.next());
		int B = Integer.parseInt(in.next());
		int K = Integer.parseInt(in.next());
		int c = 0;
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		for(int i = A;i <= B; i++){
			if(i - A < K || B - i < K)list.add(i);
		}
		Collections.sort(list);
		for(int i = 0; i < list.size(); i++)System.out.println(list.get(i));
	}
}

Measured memory_bytes: 23252
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
long nCr(int n, int r) {
	long ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};
struct edge { int to, cost; };
char c[100010][15];
string s[100010];
map<string, int>mp;
signed main() {
	int n;
	cin >> n;
	rep(i, n) {
		rep(j, 10) {
			cin >> c[i][j];
		}
		sort(c[i], c[i] + 10);
	}
	rep(i, n) {
		rep(j, 10) {
			s[i] += c[i][j];
		}
	}
	rep(i, n) {
		mp[s[i]]++;
	}
	int ans = 0;
	for (auto p : mp) {
		if (p.second > 1) {
			ans += nCr(p.second, 2);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 14976
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define all(v) v.begin(), v.end()
#define pb push_back
#define rep(p, a, b) for (ll p = a; p < b; p++)
#define F first
#define S second
using namespace std;

int main()
{
    ll t, i, j, k, ans, n;

    //cin>>t;
    t = 1;
    while (t--)
    {
        ld d, x, y;
        cin >> n >> d;

        ans = 0;
        while (n--)
        {
            cin >> x >> y;
            if(sqrt(x*x+y*y)<=d)ans++;
        }
        cout<<ans;
    }

    return 0;
}

Measured memory_bytes: 3808
<?php

class Scanner
{
    private $arr = [];
    private $count = 0;
    private $pointer = 0;

    public function next()
    {
        if ($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(" ", $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }

    public function hasNext()
    {
        return $this->pointer < $this->count;
    }

    public function nextInt()
    {
        return (int)$this->next();
    }

    public function nextDouble()
    {
        return (double)$this->next();
    }
}

class out
{
    public static function printIn($str = "")
    {
        echo $str . PHP_EOL;
    }
}

$sc = new Scanner;

$n = $sc->nextInt();
$a = $sc->nextInt();

if ($n < 500) {
    $remainder = $n;
} else {
    $remainder = $n % 500;
}


if ($a >= $remainder) {
    echo 'Yes';
} else {
    echo "No";
}

Measured memory_bytes: 4728
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


class UnionFindWeighted:
    # Reference: https://note.nkmk.me/python-union-find/
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        self.weight = [0] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            root = self.find(self.parents[x])
            self.weight[x] += self.weight[self.parents[x]]
            self.parents[x] = root
            return root

    def union(self, x, y, w):
        rx = self.find(x)
        ry = self.find(y)

        if rx == ry:
            return

        if self.parents[rx] > self.parents[ry]:
            x, y, rx, ry, w = y, x, ry, rx, -w

        self.parents[rx] += self.parents[ry]
        self.parents[ry] = rx
        self.weight[ry] = self.weight[x] - self.weight[y] - w

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def diff(self, x, y):
        return self.weight[x] - self.weight[y]


def main():
    N, M, *LRD = map(int, read().split())

    uf = UnionFindWeighted(N)
    for l, r, d in zip(*[iter(LRD)] * 3):
        l -= 1
        r -= 1
        if uf.same(l, r) and uf.diff(l, r) != d:
            print('No')
            return
        else:
            uf.union(l, r, d)

    print('Yes')
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 148820
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
    cin >> n;
    int cnt4 = 0;
    int cnt2 = 0;
    for(int i = 0; i < n; ++i) {
        long long a;
        cin >> a;
        if(a % 4 == 0) cnt4++;
        else if(a % 2 == 0) cnt2++;
    }

    int gomi = n-cnt4-cnt2;
    if(cnt2 == 0) {
        if(gomi <= cnt4+1) {
            cout << "Yes" << endl;
        }else {
            cout << "No" << endl;
        }
    }else {
        if(gomi <= cnt4) {
            cout << "Yes" << endl;
        }else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

char s[maxn];
int t1,t2,t3,t4;

int main()
{
	scanf("%s",s+1); int len=strlen(s+1);
	rep(i,1,len) if(s[i]=='S') t1=1; else if(s[i]=='N') t2=1;
	else if(s[i]=='W') t3=1; else if(s[i]=='E') t4=1;
	if(t1+t2==1||t3+t4==1) puts("No"); else puts("Yes");
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)

typedef long long ll;

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

string MAZE[1010];
ll dp[1010][1010];
ll law = 1000000007;

void Main()
{
	int H, W; cin >> H >> W;
	rep(i,H) cin >> MAZE[i];
	memset(dp, 0, sizeof(dp));
	dp[0][0] = 1;
	rep(i,H) {
		rep(j, W) {
			if (MAZE[i][j] == '#') continue;
			if (i + 1 < H && MAZE[i + 1][j] != '#') dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % law;
			if (j + 1 < W && MAZE[i][j + 1] != '#') dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % law;
		}
	}
	cout << dp[H - 1][W - 1] << endl;
}

int main()
{
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	Main();
}


Measured memory_bytes: 9344
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

vi C(26), Last(26, -1), T(365);
vector<vi> S(365, vi(26));
vector<vi> table(365, vi(26));
ll ans = 0;
int D, M;

void Query() {
  int d, q, prev;
  cin >> d >> q;
  d--, q--;
  prev = T.at(d);
  T.at(d) = q;
  ll sabun = 0;
  sabun += (S.at(d).at(q) - S.at(d).at(prev));

  sabun += table.at(d).at(q);
  table.at(d).at(q) = 0;
  for (int i = d + 1; i < D && table.at(i).at(q) != 0; i++) {
    sabun += table.at(i).at(q);
    table.at(i).at(q) = table.at(i - 1).at(q) + C.at(q);
    sabun -= table.at(i).at(q);
  }
  /*
  cout << "table " << q << ": ";
  REP(i, D) cout << table.at(i).at(q) << " ";
  cout << "\n";
  */

  table.at(d).at(prev) =
      (d == 0) ? C.at(prev) : table.at(d - 1).at(prev) + C.at(prev);
  sabun -= table.at(d).at(prev);
  for (int j = d + 1; j < D && table.at(j).at(prev) != 0; j++) {
    sabun += table.at(j).at(prev);
    table.at(j).at(prev) = table.at(j - 1).at(prev) + C.at(prev);
    sabun -= table.at(j).at(prev);
  }
  /*
  cout << "table " << prev << ": ";
  REP(i, D) cout << table.at(i).at(prev) << " ";
  cout << "\n";
  cout << "sabun = " << sabun << endl;
*/
  ans += sabun;
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"

  cin >> D;
  REP(i, 26) cin >> C.at(i);
  REP(i, D) REP(j, 26) cin >> S.at(i).at(j);
  REP(i, D) {
    int tmp;
    cin >> tmp;
    T.at(i) = tmp - 1;
  }

  for (int i = 0; i < D; i++) {
    REP(j, 26) {
      if (j == T.at(i)) {
        Last.at(j) = i;
        table.at(i).at(j) = 0;
      } else {
        table.at(i).at(j) = C.at(j) * (i - Last.at(j));
      }
    }
    // cout << count << endl;

    // cout << "T = " << T.at(i) << " S = " << S.at(i).at(T.at(i)) << endl;
    ans += S.at(i).at(T.at(i));
  }

  REP(i, D) {
    REP(j, 26) { ans -= table.at(i).at(j); }
  }
  /*
  REP(i, 26) {
    cout << "table " << i << ": ";
    REP(j, D) cout << table.at(j).at(i) << " ";
    cout << "\n";
  }
 cout << ans << endl;
*/
  // Query
  cin >> M;
  REP(i, M) Query();
}

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

int main(){
  int a,b;
  cin>>a>>b;
  int i=0;
  for(a;a<=b;a++){
    if ((a/10000==a%10)&&(a/1000%10==a/10%10))
      i++;
  }
  cout<<i<<endl;
}


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

#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    vector<int> a(n), p(n), q(n);
    rep(i, n)
    {
        a.at(i) = i + 1;
        cin >> p.at(i);
    }
    rep(i, n) cin >> q.at(i);

    int idx(-1);
    int pp(-1), qq(-1);
    do
    {
        ++idx;
        if (a == p)
        {
            pp = idx;
        }
        if (a == q)
        {
            qq = idx;
        }
        if (pp > 0 && qq > 0)
            break;
    } while (next_permutation(a.begin(), a.end()));
    cout << abs(pp - qq) << endl;
    return 0;
}

Measured memory_bytes: 256
object Main extends App{
  override def main(args:Array[String])={
    var num = readInt
    var resFlag = false
    if(num%4==0) {
      println("Yes")
      resFlag=true
    }
    else if(num%7==0) {
      println("Yes")
      resFlag=true
    }
    else{
      var n = num/4
      var flag = false
      for(i <- 1 to n if !flag){
        var money = 4*i
        var left = num-money
        if(left%7==0){
          println("Yes")
          flag = true
          resFlag=true
        }
    }
      
  }
    if(!resFlag){    
    	println("No")
    }
  }
}

Measured memory_bytes: 27076
type xy = record x,y:int64; 
                 end;
     p = record a:int64;
                t:array[1..20] of xy;
                end;
var i,j,l,maker,power,ans,n,store:int64;
    people:array[1..20] of p;
    check:array[1..20] of int64;
    flag :boolean;
    
function power2(q:int64):int64;
var po,k:int64;
begin
 po:=1;
 for k := 1 to q do po := po *2;
 power2 := po
end;

begin
read(n);
for i := 1 to n do
 begin
  read(people[i].a);
   for j := 1 to people[i].a do read(people[i].t[j].x,people[i].t[j].y)
 end;

power := power2(n);
ans:=0;
for i := power-1 downto 0 do
 begin
  maker := i;
  for j := 1 to n do
   begin 
    if odd(maker) then check[j] := 1
    else check[j]:=0;
    maker := maker >> 1
   end;
  for j := 1 to n do
   begin 
    flag := true;
    if (check[j] = 1) then
     begin
      for l := 1 to people[j].a do 
       if check[people[j].t[l].x] <> people[j].t[l].y then 
        begin
         flag := false;
         break
        end
     end;
    if not (flag) then break;
   end;
 store:=0;
 if flag then
  for l := 1 to n do
   if check[l] = 1 then inc(store);
 if ans < store then ans := store;
end;

write(ans)

end.

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

void solve() 
{
    string s;cin>>s;
    REP(i,s.size()){
        if(s.substr(i,5)=="dream"){
            i+=4;
            if(s.substr(i+1,2)=="er"&&s.substr(i+1,5)!="erase")i+=2;
        }
        else if(s.substr(i,5)=="erase"){
            i+=4;
            if(s.substr(i+1,1)=="r")i+=1;
        }else {cout<<"NO"<<endl;return;}
    }
    cout<<"YES"<<endl;
}

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

Measured memory_bytes: 512
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    k,s = readInts()
    cnt = 0
    for x in range(k+1):
        for y in range(k+1):
            z = s - x - y
            if 0 <= z <= k:
                cnt += 1
    print(cnt)
if __name__ == '__main__':
  main()


Measured memory_bytes: 6300
#include <iostream>
#include <cstdio>
long long n, s, t, a[100005], b[100005];
int main() {
	int i;
	scanf("%lld", &n);
	for(i=1; i<=n; i++) scanf("%lld", &a[i]), b[i]=a[i];
	for(i=1; i<=n; i++) {
		a[i] += a[i-1];
		if(i%2) {
			if(a[i]<=0) s += 1-a[i], a[i]=1;
		} else {
			if(a[i]>=0) s += a[i]+1, a[i]=-1;
		}
	}
	for(i=1; i<=n; i++) {
		b[i] += b[i-1];
		if(i%2) {
			if(b[i]>=0) t += b[i]+1, b[i]=-1;
		} else {
			if(b[i]<=0) t += 1-b[i], b[i]=1;
		}
	}
	printf("%lld", std::min(s,t));
	return 0;
}

Measured memory_bytes: 1792
def main():
    N = int(input())
    S = input()

    if N % 2 != 0 or len(S) % 2 != 0:
        print("No")
        exit()

    for i in range(N//2):
        if S[i] != S[i+N//2]:
            print("No")
            exit()

    print("Yes")

if __name__ == '__main__':
    main()

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

const long long mod=1000000007;

long long mod_pow(long long x, long long n){
	if(n==0) return 1;
	long long res=mod_pow(x*x%mod, n/2);
	if(n%2==1)res=res*x%mod;
	return res;
}

int main() {
	long long int m, n;
	cin>>m>>n;
	cout<<mod_pow(m, n)%mod<<endl;
	return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define int long long int
#define MOD 1000000007
using namespace std;
void solve() {
        string s, t;
        cin >> s >> t;
        int count = 0;
        for(int i=0;i<s.length();i++) {
                if(s[i] == t[i])
                        count++;
        }
        cout << count << endl;
        return;
}

int32_t main() {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        solve();
        return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int st[20],d[20],n,x[20],y[20];
ll ans[20],p[20],calc;

void solve(int i, int k){
	int pr[20],j,t;
	if(i == n){
		calc = 0ll;
		for(j=0; j<n; ++j){
			calc += p[j]*d[j];
		}
		ans[k] = std::min(ans[k],calc);
		return;
	}
	for(j=0; j<n; ++j){
		pr[j] = d[j];
	}
	for(t=0; t<3; ++t){
		if(t==1){
			for(j=0; j<n; ++j){
				d[j] = std::min(d[j],abs(x[i]-x[j]));
			}
			solve(i+1,k+1);
		}else if(t==2){
			for(j=0; j<n; ++j){
				d[j] = std::min(d[j],abs(y[i]-y[j]));
			}
			solve(i+1,k+1);
		}else{
			solve(i+1,k);
		}
		for(j=0; j<n; ++j){
			d[j] = pr[j];
		}
	}
}

int main(void){
	int i;
	ll calc=0ll;
	std::fill(ans,ans+20,INFLL);
	std::cin >> n;
	for(i=0; i<n; ++i){
		std::cin >> x[i] >> y[i] >> p[i];
		d[i] = std::min(abs(x[i]),abs(y[i]));
	}
	solve(0,0);
	for(i=0; i<=n; ++i){
		std::cout << ans[i] << std::endl;
	}
	return 0;
}


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

namespace AtC
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int H = int.Parse(str[0]);
            int N = int.Parse(str[1]);
            string[] strA = Console.ReadLine().Split();
            int[] A = new int[N];
            int sum = 0;
            for (int i = 0; i < N; i++)
            {
                A[i] = int.Parse(strA[i]);
                sum += A[i];
            }
            string ans;
            if (sum >= H) ans = "Yes";
            else ans ="No";
            Console.WriteLine(ans);
            Console.ReadLine();

        }
    }
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar[0].size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

template<typename T>
T digitsum(T x){
    T y=0;
    while(x){
        y += x % 10;
        x /= 10;
    }

    return y;
}
// }}}
/* vim:set foldmethod=marker: */

int main(int argc, char const* argv[])
{
    int a,b;
    cin >> a >> b;
    if (a + b >= 10) {
        cout << "error" << endl;
    }else{
        cout << a+b << endl;
    }
    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }

// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
B=[[0,0] for i in range(N)]
for i in range(N):
    B[i][0]=i
    B[i][1]=A[i]
B.sort(key=lambda x:x[1])
Ans=[]
for i in range(N):
    Ans.append(B[i][0]+1)
print(*Ans)

Measured memory_bytes: 26724
#include <iostream>

using namespace std;

int main() {
    int n,ok=0;
    cin>>n;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(n==i*j)      ok=1;
        }
    }
    if(ok==1)   cout<<"Yes";
    else        cout<<"No";
    return 0;
}

Measured memory_bytes: 256
solver::[[Int]]->Bool
solver [[c11,c12,c13],[c21,c22,c23],[c31,c32,c33]]=
        and [(c21-c11)==(c22-c12),(c22-c12)==(c23-c13)
            ,(c31-c21)==(c32-c22),(c32-c22)==(c33-c23)
            ,(c12-c11)==(c22-c21),(c22-c21)==(c32-c31)
            ,(c13-c12)==(c23-c22),(c23-c22)==(c33-c32)]

main::IO()
main=do
  a1<-getLine
  a2<-getLine
  a3<-getLine
  let mat = (map (map read)) (map words [a1,a2,a3])
  putStr (if solver mat then "Yes\n" else "No\n")

Measured memory_bytes: 508
#include<iostream>
#include<climits>
#include<numeric>
#include<algorithm>
#include <sstream>
#include<cstring>
#include<cmath>
#include<iterator>
#include<utility>
#include<array>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<iomanip>
#include<forward_list>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int,int>>
#define vs vector<string>
#define pa(a) cout<<a<<endl;
#define lin1(x) ll int x; x = scan();
#define lin2(x,y) ll int x, y; x = scan(), y = scan();
#define lin3(x,y,z) ll int x, y, z; x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x,y) make_pair(x,y)
#define mx(a,b) (a)>(b)?(a):(b)
#define mn(a,b) (a)<(b)?(a):(b)
#define fori(s,e) for(i=s;i<=e;i++)
#define forj(s,e) for(j=s;j<=e;j++)
#define fork(s,e) for(k=s;k<=e;k++)
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;

int main()
{
#ifdef RAHUL
    freopen("input.txt","r",stdin);
#endif


int t;
int k;
cin>>t;
cin>>k;

if (k==t)
{
    /* code */
    cout<<"Yes"<<endl;
}
else{
    cout<<"No"<<endl;
}


return 0;
}

Measured memory_bytes: 256
//ID:computerbox --> Hajiyev Huseyn
#include <bits/stdc++.h>
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define _CRT_SECURE_NO_WARNINGS
//#include <boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;
#define FAST_READ ios_base::sync_with_stdio(0);/*cin.tie(0); cout.tie(0);*/
#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define ll long long
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define COUT(n, a) cout<< fixed << setprecision(a) << n<<endl
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";
#define CURTIME() cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl
#define DTIME(ccc) __begin = clock(); ccc; cerr<<"Time of work = "<<(clock()-__begin)/CLOCKS_PER_SEC<<endl;
#define MAXN 2000

using namespace std;

#define debug(args...)(Debugger()) , args
class Debugger
{
  public:
  Debugger(const std::string& _separator=", ") :
  first(true),separator(_separator){}
  template<typename ObjectType>
  Debugger& operator,(const ObjectType& v)
  {
        if(!first)cerr<<separator;
        cerr<<v;
        first=false;
        return *this;
  }
  ~Debugger() {cerr<<endl;}      
  private:
    bool first;
    string separator;
};
 
template <typename T1, typename T2>
inline ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p)
{
   return os<<"("<<p.first<<", "<<p.second<<")";
}
template<typename T>
inline ostream &operator<<(ostream & os,const vector<T>& v)
{
    bool first=true;
    os<<"[";
    for(unsigned ll i=0;i<v.size();i++)
    {
        if(!first)os<<", ";
        os<<v[i];
        first=false;
    }
        return os<<"]";
}
template<typename T>
inline ostream &operator<<(ostream & os,const set<T>&v)
{
    bool first=true;
    os<<"[";
    for(typename set<T>::const_iterator ii=v.begin();ii!=v.end();++ii)
    {
        if(!first)os<<", ";
        os<<*ii;
        first=false;
    }
    return os<<"]";
}
template<typename T1, typename T2>
inline ostream &operator<<(ostream & os,const map<T1, T2>&v)
{
        bool first=true;
        os<<"[";
        for(typename map<T1,T2>::const_iterator ii=v.begin(); ii!=v.end();++ii)
        {
            if(!first)os<<", ";
            os<<*ii;
            first=false;
        }
        return os<<"]";
}

ll N,D,X;
ll massiv[MAXN];

int main(){
FAST_READ;
cin>>N;
cin>>D>>X;
for(ll i=1;i<=N;i++)
{
  cin>>massiv[i];
}

ll vsego=0;
ll sum=0;
for(ll i=1;i<=N;i++)
{
  sum=1;
  ll j;
  for(j=1;massiv[i]*j<D;j++)
  {
    //deb(massiv[i]*j);
     sum++;
  }
  //deb(massiv[i]*j);
 vsego+=(sum);
}
vsego+=X;

cout<<vsego<<endl;



return 0;
} 

Measured memory_bytes: 256
#include <algorithm>
#include <atcoder/dsu>
#include <cassert>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < (n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < (n); ++(i))
#define sz(x) int(x.size())
using namespace std;
template <class T>
void setmax(T &a, T const &b) {
    if (a < b) a = b;
}

template <class T>
void setmin(T &a, T const &b) {
    if (a > b) a = b;
}

template <typename T, typename X>
auto vectors(T a, X x) { return vector<T>(x, a); }

template <typename T, typename X, typename Y, typename... Zs>
auto vectors(T a, X x, Y y, Zs... zs) {
    auto cont = vectors(a, y, zs...);
    return vector<decltype(cont)>(x, cont);
}

using namespace atcoder;

int main() {
    int N, M;
    cin >> N >> M;
    dsu uf(N);
    repeat(i, M) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        uf.merge(a, b);
    }

    vector<bool> used(N);
    int s = 0;
    repeat(i, N) {
        if (!used[uf.leader(i)]) {
            ++s;
            used[uf.leader(i)] = true;
        }
    }
    cout << s - 1 << endl;
    return 0;
}

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

int main(){
	int a, b;
	cin >> a >> b;

	if(a - 2*b > 0) cout << a - 2*b;
	else cout << 0;
	
	return 0;
}

Measured memory_bytes: 256
// 3_abc134_c
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int m = 0;
    int sec = 0;
    vector<int> a(n);
    rep(i, n){
        cin >> a[i];
        if(a[i] >= m){
            sec = m;
            m = a[i];
        }else if(a[i] > sec){
            sec = a[i];
        }
    }

    rep(i, n){
        if(a[i] == m){
            cout << sec << endl;
        }else{
            cout << m << endl;
        }
    }
    return 0;
}


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

    int ans = 1;

    for(int i=0;i<N-1;i++){
        if(S[i] != S[i+1]) ans++;
    }

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

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

#define ForA(i,b,a) for(int i = a; i >= b; i--)
#define ForB(i,a,b) for(int i = a; i <= b; i++)
#define IOS ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mmset(arr, n) memset(arr, n, sizeof arr)
#define PI 3.1415926535897932384626433832795l
#define deci(n) cout<<fixed<<setprecision(n);
#define F first
#define S second
#define mk make_pair
#define pb push_back
#define ALPHA 27
#define IT(a , b) map <a , b> :: iterator
#define ll long long int
#define ld long double
#define debug(x) cerr << '#' << ' ' << x << '\n'
#define len(s) s.length()
#define maxn 1002

using namespace std;

const ll INF = (ll)(8e18);
const ll MOD = 1e9 + 7;

class Print{
   public:
   void print(int n){
       cout << n << '\n';
       exit(0);
   }
   void print(ll n){
       cout << n << '\n';
       exit(0);
   }
   void print(string s){
       cout << s << '\n';
       exit(0);
   }
   void print(ld n){
       cout << n << '\n';
       exit(0);
   }
};

ll ans[101][101];

int main()
{
    IOS;
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //#endif
    Print _p;
    int x,k; cin >> x >> k;
    cout << (x < k ? 0 : 10) << '\n';
    #ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;
string print(string, int, int);
string reverse(string, int, int);
string replace(string, int, int, string);

string print(string str, int a,int b) {
  string ans="";
  for(int i = a; i < b+1; i++) {
    ans += str[i];
  }
  return ans ;
}
string reverse(string str, int a, int b) {
  string ans="";
  REP(i,a) {
    ans+=str[i];
  }
  for(int i=b;i>=a;i--) {
    ans+=str[i];
  }
  for(int i=b+1;i < str.length();i++) {
    ans+=str[i];
  }
  return ans;
}
string replace(string str, int a, int b, string p) {
  string ans="";
  REP(i,str.length()) {
    if(a<=i&&i<=b) {
      ans+=p[i-a];
    } else {
      ans+=str[i];
    }
  }
  return ans;
}

int main() {
  int n;
  cin >> n;
  double x[n];
  double y[n];
  REP(i,n) {
    cin >> x[i];
  }
  REP(i,n) {
    cin >> y[i];
  }

  double distance[4] = {0.0};

  REP(i,n) {
    distance[0] += abs(x[i]-y[i]);
    distance[1] += pow((x[i]-y[i]),2.0);
    distance[2] += pow(abs(x[i]-y[i]),3.0);
    distance[3] = max(distance[3],abs(x[i]-y[i]));
  }
  distance[1] = sqrt(distance[1]);
  distance[2] = cbrt(distance[2]);

  REP(i,4) {
    cout << setprecision(12) << distance[i] << endl;
  }
  
  return 0;
}



Measured memory_bytes: 3484
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    cin>>n;
    //vector<vector<ll>> v(tate,vector<ll> (yoko));
    vector<ll> v(n);
    rep(i,n)   cin >> v[i];
    rep(i,n) sum^=v[i];
    rep(i,n) {
        f=sum^v[i];
        cout<<f<<" ";
    }

    return 0;
}


Measured memory_bytes: 4656
import static java.util.Arrays.deepToString;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	Scanner sc = new Scanner(System.in);
	public void run() {
		makePrimes();
		for (;sc.hasNext();) {
			int n = sc.nextInt();
			if (n == 0) break;
			
			int res = 0;
			for (int p1: primes) {
				if (p1 < n && isPrime[n - p1] && p1 >= n - p1) {
					res++;
				}
			}
			System.out.println(res);
		}
	}
	

	static final int MAX_N = 50000 + 10;
	boolean[] isPrime = new boolean[MAX_N];
	int[] primes;
	void makePrimes(){
		if (primes != null) return;
		for (int i = 0; i < isPrime.length; i++) isPrime[i] = true;
		isPrime[0] = isPrime[1] = false;
		for (int i = 2; i * i < isPrime.length; i++)
			if (isPrime[i])
				for(int j = i * i; j < isPrime.length; j += i)
					isPrime[j] = false;
		int p = 0;
		for (int i = 2; i < isPrime.length; i++) p += isPrime[i] ? 1 : 0;
		primes = new int[p];
		p = 0;
		for (int i = 2; i < isPrime.length; i++) if (isPrime[i]) primes[p++] = i;
	}
}

Measured memory_bytes: 32820
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(i=a; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define foreach(it,x) for(typeof(x.begin()) it=x.begin(); it!=x.end(); it++)

int n,hx,hy,dx,dy,cx[25], cy[25];
int ans;
const double inf = 999999999.9;
double dist[25][25], start[25], dead[25];
bool used[25];
double memo[1<<20];

double sqr(int x){ return (double)x*x; }


void solve(int node, int cnt, double cost, int S){
    int i,j;

    //printf("cost = %lf, dead[%d] = %lf\n",cost ,node, dead[node]);
    if( cost >= dead[node] || memo[S] <= cost ) return;

    ans = max(ans, cnt);
    memo[S] = cost;
    if( cnt == n ) return;

    /*
      »Ýn©çÜ¾EÁÄ¢È¢NX^Ì¤¿AêÂÅàæêÈ¢Ìª éÈçOUT
     */
    rep(i,n){
        if( !used[i] ){
            if( cost + dist[node][i] >= dead[i] ) return;
        }
    }

    //printf("cnt = %d, node = %d, cost = %lf\n",cnt, node, cost);

    rep(i,n){
        if( !used[i] ){
            used[i] = true;
            solve(i, cnt + 1, cost + dist[node][i], S|(1<<i));
            used[i] = false;
            if( ans == n ) return;
        }
    }
}


int main(){
    int i,j;

    while( cin >> n >> hx >> hy >> dx >> dy, n|hx|hy|dx|dy ){
        // init
        ans = 0;
        rep(i,25) rep(j,25) dist[i][j] = inf;
        rep(i,1<<n) memo[i] = inf;
        memset(used, false, sizeof(used));

        // input
        set<pair<int,int> > sc;
        rep(i,n){
            int x,y; cin >> x >> y;
            sc.insert(make_pair(x,y));
        }

        j = 0;
        foreach(it,sc){
            cx[j] = it->first, cy[j] = it->second;
            j++;
        }
        n = j;

        // start -> other crystal
        rep(i,n) start[i] = sqrt( sqr(hx - cx[i]) + sqr(hy - cy[i]) );

        // dead line
        rep(i,n) dead[i] = sqrt( sqr(dx - cx[i]) + sqr(dy - cy[i]) );

        // crystal -> crystal
        rep(i,n){
            REP(j,i+1,n){
                double d = sqrt( sqr(cx[i] - cx[j]) + sqr(cy[i] - cy[j]) );
                dist[i][j] = dist[j][i] = d;
            }
        }

        rep(i,n){
            used[i] = true;
            solve(i, 1, start[i], 1<<i);
            used[i] = false;
        }

        puts( ans == n ? "YES" : "NO" );
    }

    return 0;
}

Measured memory_bytes: 9092