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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

struct UnionFind {
    UnionFind(int n) {
        rank.assign(n, 0);
        parent.resize(n);
        for (int i = 0; i < n; ++i) {
            parent[i] = i;
        }
    }

    int find(int x) {
        if (x == parent[x])
            return x;
        return parent[x] = find(parent[x]);
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }

    void unit(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y)
            return;

        if (rank[x] < rank[y]) {
            parent[x] = y;
        }
        else {
            parent[y] = x;
            if (rank[x] == rank[y])
                rank[x]++;
        }
    }

    vector<int> rank;
    vector<int> parent;
};

int main() {
    ll N;
    cin >> N;
    vector<tuple<ll, ll, ll>> v(N);
    REP(i, N) {
        ll x, y;
        cin >> x >> y;
        auto t = make_tuple(x, y, i);
        v[i] = t;
    }

    sort(v.begin(), v.end(), [](tuple<ll, ll, ll> a, tuple<ll, ll, ll> b) { return get<0>(a) < get<0>(b); });

    vector<tuple<ll, ll, ll>> e;
    REP(i, N - 1) {
        ll c = abs(get<0>(v[i]) - get<0>(v[i + 1]));
        auto t = make_tuple(get<2>(v[i]), get<2>(v[i + 1]), c);
        e.push_back(t);
    }
    sort(v.begin(), v.end(), [](tuple<ll, ll, ll> a, tuple<ll, ll, ll> b) { return get<1>(a) < get<1>(b); });
    REP(i, N - 1) {
        ll c = abs(get<1>(v[i]) - get<1>(v[i + 1]));
        auto t = make_tuple(get<2>(v[i]), get<2>(v[i + 1]), c);
        e.push_back(t);
    }

    sort(e.begin(), e.end(), [](tuple<ll, ll, ll> a, tuple<ll, ll, ll> b) { return get<2>(a) < get<2>(b); });

    UnionFind uf(N);
    ll ans = 0;
    REP(i, e.size()) {
        ll a = get<0>(e[i]);
        ll b = get<1>(e[i]);
        ll c = get<2>(e[i]);
        if (uf.same(a, b))
            continue;
        ans += c;
        uf.unit(a, b);
    }

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

Measured memory_bytes: 10736
N, M = map(int, input().split())
Edge = []
for i in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    Edge.append([a, b])


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0] * n
        self.size = [1] * n

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
            self.size[x] = 0
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            self.size[y] = 0
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # すべての頂点に対して親を検索する
    def all_find(self):
        for n in range(len(self.par)):
            self.find(n)


UF = UnionFind(N)
Score = N * (N - 1) // 2
ans = []
while Edge:
    ans.append(Score)
    a, b = Edge.pop()
    pa, pb = UF.find(a), UF.find(b)
    if not UF.same(pa, pb):
        Score -= (UF.size[pa] * UF.size[pb])
    UF.union(a, b)

print(*ans[::-1], sep='\n')


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

#define pb         push_back

const int INF = 100000000;

int main(void) {
	while(1){
		int n;
		cin >> n;
		if(n == 0) break;
		int left = 0;
		int right = 0;
		int cnt = 0;
		int dir = 1;
		for(int i=0; i<n; i++){
			string t;
			cin >> t;

			if(t[0] == 'l'){
				left = 1 - left;
			}else{
				right = 1 - right;
			}
			if(left == right && dir == left){
				cnt++;
				dir = 1 - dir;
			}
		}
		cout << cnt << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1200
import java.util.Map.Entry;
import java.io.*;
import java.util.*;

public class Main {
	
	public static final long INF = Long.MAX_VALUE / 2 - 1;
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		int n = 100000;
		ArrayList<Integer> prime = new ArrayList<>();
		boolean[] arr = new boolean[n+1];
		for(int i = 2; i <= n; i++){
			if(arr[i]) continue;
			for(int j = i+i; j <= n; j += i){
				arr[j] = true;
			}
		}
		
		int[] sum = new int[n+1];
		for(int i = 2; i <= n; i++){
			sum[i] = sum[i-1] + ((i % 2 != 0 && !arr[i] && !arr[(i+1)/2]) ? 1 : 0);
		}
		
		int Q = sc.nextInt();
		for(int i = 0; i < Q; i++){
			int L = sc.nextInt();
			int R = sc.nextInt();
			System.out.println(sum[R]-sum[L-1]);
		}
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}


Measured memory_bytes: 39044
#include <iostream>

int main() {
    int64_t h;
    std::cin >> h;

    int64_t ans = 0, num = 1;
    while (h > 0) {
        ans += num;
        h /= 2;
        num *= 2;
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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;
}

ll gcd(ll x,ll y){
    if (y==0) return x;
    return gcd(y,x%y);
}
ll lcm(ll x,ll y){
    return x/gcd(x,y)*y;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b; cin >> a >> b;
    cout << lcm(a,b) << endl;
}

Measured memory_bytes: 256
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let n = Int(readLine()!)!
    
    if n % 2 == 0 {
        print(n / 2)
    } else {
        print(n / 2 + 1)
    }
}

main()


Measured memory_bytes: 7732
from collections import deque
a = input()
a = deque(a)
n = int(input())
tmp = 0
for i in range(n):
    q = input().split()
    if len(q) == 1:
        tmp += 1
    elif len(q) == 3:
        if q[1] == '1':
            if tmp % 2 == 0:
                a.appendleft(q[2])
            else:
                a.append(q[2])
        elif q[1] == '2':
            if tmp % 2 == 0:
                a.append(q[2])
            else:
                a.appendleft(q[2])

print(''.join(a) if tmp % 2 == 0 else ''.join(a)[::-1])

Measured memory_bytes: 8436
#include <iostream>
#include <string>

using namespace std;

int main()
{
  int input;
  int num[3];
  cin >> input;

  if (input <= 111) cout << "111" << endl;
  else if (input<= 222) cout << "222" << endl;
  else if (input<= 333) cout << "333" << endl;
  else if (input<= 444) cout << "444" << endl;
  else if (input<= 555) cout << "555" << endl;
  else if (input<= 666) cout << "666" << endl;
  else if (input<= 777) cout << "777" << endl;
  else if (input<= 888) cout << "888" << endl;
  else  cout << "999" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <functional> //sort(A,A.end(),greater<int>());降順ソート
#include <queue>
#include <stack>
#include <vector>

#define INF 10 << 10

int main() {
	long long x;
	cin >> x;

	long long cnt = 0;
	if (x >= 11) {
		cnt += (x / 11) * 2;
		x = x % 11;
	}
	if (x >= 6) {
		++cnt;
		x -= 6;
	}
	if (x >= 5) {
		++cnt;
		x -= 5;
	}
	if (x > 0) { ++cnt; }

	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
#define n_max 10000
#define INF 10001000

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep2(i,a,n) for(int i = a; i < (n); i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll; 

int main()
{
    int n;
    int min = INF;

    cin >> n;
    int w[n];
    int sum = 0;
    rep(i,n) {
        cin >> w[i];
        sum+=w[i];
    }
    rep(i,n-1) { 
        int sum2 = 0;
        int sum1 = 0;
        rep2(j,i+1,n) { 
            sum2+=w[j];
        }
        sum1 = sum-sum2;
        if(min >= abs(sum1-sum2)) { min = abs(sum1-sum2); } ;
    }

    cout << min << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   String S = sc.next();
   int[] Si = new int[S.length()];
   for(int i = 0; i<S.length();i++)
   {
		Si[i] = getNumber(S.substring(i,i+1));       
   }
   for(int i = 0; i<S.length();i++)
   {
		if(Si[i] + N >= 26) Si[i] = Si[i] + N -26;
     	else Si[i] += N;
   }
   String Ans = "";
   for(int i = 0; i<S.length();i++)
   {
    	Ans += getAlphabet(Si[i]); 
   }
   System.out.println(Ans);
 }
  public static int getNumber(String p)
  {
    int k = 0;
    if(p.equals("A")) k =0;
    else if(p.equals("B")) k =1;
    else if(p.equals("C")) k =2;
    else if(p.equals("D")) k =3;
    else if(p.equals("E")) k =4;
    else if(p.equals("F")) k =5;
    else if(p.equals("G")) k =6;
    else if(p.equals("H")) k =7;
    else if(p.equals("I")) k =8;
    else if(p.equals("J")) k =9;
    else if(p.equals("K")) k =10;
    else if(p.equals("L")) k =11;
    else if(p.equals("M")) k =12;
    else if(p.equals("N")) k =13;
    else if(p.equals("O")) k =14;
    else if(p.equals("P")) k =15;
    else if(p.equals("Q")) k =16;
    else if(p.equals("R")) k =17;
    else if(p.equals("S")) k =18;
    else if(p.equals("T")) k =19;
    else if(p.equals("U")) k =20;
    else if(p.equals("V")) k =21;
    else if(p.equals("W")) k =22;
    else if(p.equals("X")) k =23;
    else if(p.equals("Y")) k =24;
    else if(p.equals("Z")) k =25;
    return k;
  }
  
  public static String getAlphabet(int k)
  {
    	String SS = "";
    	if(k == 0) SS = "A";
    	else if(k == 1) SS = "B";
    	else if(k == 2) SS = "C";
    	else if(k == 3) SS = "D";
    	else if(k == 4) SS = "E";
    	else if(k == 5) SS = "F";
    	else if(k == 6) SS = "G";
    	else if(k == 7) SS = "H";
    	else if(k == 8) SS = "I";
    	else if(k == 9) SS = "J";
    	else if(k == 10) SS = "K";
    	else if(k == 11) SS = "L";
    	else if(k == 12) SS = "M";
    	else if(k == 13) SS = "N";
    	else if(k == 14) SS = "O";
    	else if(k == 15) SS = "P";
    	else if(k == 16) SS = "Q";
    	else if(k == 17) SS = "R";
    	else if(k == 18) SS = "S";
    	else if(k == 19) SS = "T";
    	else if(k == 20) SS = "U";
    	else if(k == 21) SS = "V";
    	else if(k == 22) SS = "W";
    	else if(k == 23) SS = "X";
    	else if(k == 24) SS = "Y";
    	else if(k == 25) SS = "Z";
    	return SS;
  }
}

Measured memory_bytes: 149588
#include<cstdio>
#define MM	5000
using namespace std;

int main(void)
{
	int n,m,r,i,j,x,k,xx;
	int bshi[20000],bbo[20000];
	scanf("%d %d %d",&n,&m,&r);
	int ansa[10000],ansb[10000],wk;
	int flg;
	

	r=r-m*n;
	if(r<0)	{
		printf("0\n");
	}
	else if(r==0)	{
		printf("1\n");
	}
	else{
		n=n+r-1;
		for(i=2;i<=n;i++)	{
			bshi[i]=0;
			bbo[i]=0;
		}
		x=n;
//		printf("n=%d r=%d\n",n,r);
		
		for(i=x;i>=2;i--)	{
			xx=i;
			for(j=2;j<=i;j++)	{
				while(xx%j==0)	{
					bshi[j]++;
					xx/=j;
//					printf("i=%d xx=%d\n",i,xx);
				}
			}
		}
//		for(i=2;i<=n;i++)	{
//			printf("shi=%d\n",bshi[i]);
//		}

		
		x=r;
		for(i=x;i>=2;i--)	{
			xx=i;
			for(j=2;j<=i;j++)	{
				while(xx%j==0)	{
					bbo[j]++;
					xx/=j;
				}
			}
		}		
		x=n-r;
		for(i=x;i>=2;i--)	{
			xx=i;
			for(j=2;j<=i;j++)	{
				while(xx%j==0)	{
					bbo[j]++;
					xx/=j;
				}
			}
		}
		for(i=2;i<=n;i++)	{
			bshi[i]=bshi[i]-bbo[i];
		}
//		for(i=2;i<=n;i++)	{
//			printf("shi=%d\n",bshi[i]);
//		}		
		
//		printf("check\n");
		for(i=0;i<MM;i++)	{
			ansa[i]=0;
		}
		ansa[0]=1;
		i=2;
		while(i<=n)	{
			if(bshi[i]!=0)	{
//							printf("i=%d\n",i);
				for(j=0;j<MM;j++)	{
					ansb[j]=0;
				}
				for(j=0;j<MM;j++)	{
					wk=ansa[j]*i;
//					if(wk!=0)	printf("wk=%d bshi=%d\n",wk,bshi[i]);
					ansb[j]+=wk%10000;
					ansb[j+1]+=wk/10000;
					k=j;
					while(1)	{
						if(ansb[k]>=10000)	{
							ansb[k+1]+=ansb[k]/10000;
							ansb[k]=ansb[k]%10000;
						}
						else {
							if(k>j)	break;
						}
						k++;
					}
				}
				for(j=0;j<MM;j++)	{
					ansa[j]=ansb[j];
				}
				bshi[i]--;
			}
			else {
				i++;
//				printf("i=%d\n",i);
			}
		}
		flg=0;
		for(i=MM-1;i>=0;i--)	{
			if(flg==0)	{
				if(ansa[i]!=0)	{
					flg=1;
					printf("%d",ansa[i]);
				}
			}
			else {
				printf("%04d",ansa[i]);
			}
		}
		printf("\n");
			
	}
	return 0;
}


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

using namespace std;

double solve() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int64_t N;
  cin >> N;

  vector<pair<int, int>> xys;
  for (int i = 0; i < N; ++i) {
    xys.emplace_back();
    cin >> xys.back().first >> xys.back().second;
  }

  vector<vector<double>> dists(N, vector<double>(N));

  for (size_t i = 0; i < xys.size(); ++i) {
    for (size_t j = i + 1; j < xys.size(); ++j) {
      auto dx = xys[i].first - xys[j].first;
      auto dy = xys[i].second - xys[j].second;
      dists[j][i] = dists[i][j] = sqrt(dx * dx + dy * dy);
    }
  }

  double x = 1.;
  for (int i = 1; i <= N; ++i) {
    x *= i;
  }

  double sum_ = 0.;

  vector<int> nums(N);
  for (int i = 0; i < N; ++i) {
    nums[i] = i;
  }

  do {
    for (size_t i = 0; i < nums.size() - 1; ++i) {
      sum_ += dists[nums[i]][nums[i + 1]];
    }
  } while (next_permutation(nums.begin(), nums.end()));


  return sum_ / x;
}

int main() {
  cout << setprecision(15) << solve() << endl;
}


Measured memory_bytes: 256
n, m, l = gets.split.map(&:to_i)

a, b = [], []

c = Array.new(n) { Array.new(l) { 0 } }

n.times do
  row = gets.split.map(&:to_i)
  a << row
end

m.times do
  row = gets.split.map(&:to_i)
  b << row
end

n.times do |i|
  l.times do |j|
    m.times do |k|
      c[i][j] += a[i][k] * b[k][j]
    end
  end
  puts c[i].join(' ')
end

Measured memory_bytes: 9476
import java.util.*;
import static java.lang.System.*;
 
public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        while (sc.hasNext()) {
            int arrive = 0;
            for (int i=0; i<3; i++) {
                if (i==0) arrive += sc.nextInt()*3600;
                else if (i==1) arrive += sc.nextInt()*60;
                else if (i==2) arrive += sc.nextInt();
            }
            int leave = 0;
            for (int i=0; i<3; i++) {
                if (i==0) leave += sc.nextInt()*3600;
                else if (i==1) leave += sc.nextInt()*60;
                else if (i==2) leave += sc.nextInt();
            }
             
            int time = leave - arrive;
            int h = time/3600;
            time %= 3600;
            int m = time/60;
            time %= 60;
            int s = time;
             
            out.println(h+" "+m+" "+s);
        }
    }
}


Measured memory_bytes: 26180
import bisect

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

lst = [0]

for i in range(len(a)):
    tmp = []
    for sm in lst:
        tmp.append(sm+a[i])
    lst += tmp

lst.sort()

ans = ["no"]*q
for i in range(q):
    left = bisect.bisect_left(lst,m[i])
    if left != len(lst):
        if lst[left] == m[i]:
            ans[i] ="yes"
for i in range(q):
    print(ans[i])



Measured memory_bytes: 53908
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

int main(){

  int num_of_rows,num_of_cols;
  bool is_first = true;
  while(~scanf("%d",&num_of_rows)){
    if(num_of_rows == 0) break;

    scanf("%d",&num_of_cols);
    int table[101][101];
    vector<P> masks;
    for(int row = 0; row < num_of_rows + 1; row++){
      for(int col = 0; col < num_of_cols + 1; col++){
        char val[32];
        scanf("%s",val);
        if(val[0] == '?'){
          table[row][col] = 5000000;
          masks.push_back(P(row,col));
        }
        else{
          table[row][col] = atoi(val);
        }
      }
    }

    bool visited[101] = {};
    for(int round = 0; round < 100; round++){
      for(int mask_i = 0; mask_i < masks.size(); mask_i++){
        if(visited[mask_i]) continue;

        int masked_row = masks[mask_i].first;
        int masked_col = masks[mask_i].second;
        
        int sum = 0;
        for(int row = 0; row < num_of_rows; row++){
          if(row == masked_row) continue;
          sum += table[row][masked_col];
        }
        if(-10000 <= sum && sum <= 10000){
          table[masked_row][masked_col] = table[num_of_rows][masked_col] - sum;
          visited[mask_i] = true;
          continue;
        }
        
        sum = 0;
        for(int col = 0; col < num_of_cols; col++){
          if(col == masked_col) continue;
          sum += table[masked_row][col];
        }
        if(-10000 <= sum && sum <= 10000){
          table[masked_row][masked_col] = table[masked_row][num_of_cols] - sum;
          visited[mask_i] = true;
          continue;
        }
      }
    }

    bool isok = true;
    for(int mask_i = 0; mask_i < masks.size(); mask_i++){
      if(!visited[mask_i]){
        isok = false;
      }
    }

    if(!is_first){
      printf("\n");
    }

    if(isok){
      for(int mask_i = 0; mask_i < masks.size(); mask_i++){
        int row = masks[mask_i].first;
        int col = masks[mask_i].second;
        printf("%d\n",table[row][col]);
      }
    }
    else{
      printf("NO\n");      
    }
    is_first = false;
  }
}

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

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

    if (a>=13) {
        cout << b << endl;
    }

    else if (a>=6 && a<=12) {
        cout << b/2 << endl;
    }

    else {
        cout << 0 << endl;
    }
}

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

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int a,b;
  cin >> a >> b;
  if(a+b >= 10){
    cout << "error" << endl;
  }else{
    cout << a+b << endl;
  }
}


Measured memory_bytes: 256
n, m, d = [int(i) for i in input().split()]

c = 0
if d ==0:
    c = n
elif n > 2*d:
    c = 2*(n-2*d) + 2*d
else:
    c = 2*(n-d)

p = c / pow(n, 2)
print(c*(m-1) / pow(n, 2))

Measured memory_bytes: 3060
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    PrintWriter pw = new PrintWriter(System.out);

    while (true) {
        int n = sc.nextInt();
        int x = sc.nextInt();

        if (n == 0 && x == 0) break;

        int ans = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = i+1; j <= n; j++) {
                for (int k = j+1; k <= n; k++) {
                    if (i + j + k == x) ans++;
                }
            }
        }
        pw.println(ans);
    }

    pw.flush();
    sc.close();
  }
}


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

int main() {
  int x,y,z;
  cin >> x;
  y = x % 1000;
  z = x / 1000;
  if(y != 0){
    z += 1;
  }
  z *= 1000;
  cout << z - x <<endl;
}

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

int main(){
  int n,ans = 0;cin >> n;
  int d[n];rep(i,n)cin >> d[i];
  for(int i=0;i<n;++i){
    for(int j= i+1;j<n;++j){
      ans += d[i]*d[j];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A;
  cin >> N >> A;
  if(N%500 <= A){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  // ここにプログラムを追記
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,T,s,dp[3001],t[3000],v[3000],a;
int main(){scanf("%d%d%d",&n,&T,&s);rep(i,n) scanf("%d%d",&v[i],&t[i]);rep(i,n){for(int j = T; j >= 0; j--){if((j<s&&j+t[i]>s)||j+t[i]>T)continue;dp[j+t[i]]=max(dp[j+t[i]],dp[j]+v[i]);}}rep(i,T+1)a=max(a,dp[i]);printf("%d\n",a);}

Measured memory_bytes: 1060
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
typedef double lf;
typedef long double Lf;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

#define TRACE(x) cerr << #x << "  " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define _ << " " <<

#define fi first
#define sec second
#define mp make_pair

const int MAXN = 200100;

int n, p[MAXN];
bool bio[MAXN];

int main() {
	scanf("%d",&n);
	REP(i, n) scanf("%d",&p[i]);
	for (int i = n - 1; i >= 0; i -= 2) {
		bio[i] = 1;
		printf("%d ",p[i]);
	}

	REP(i, n) if (!bio[i]) printf("%d ",p[i]);
	puts("");
	return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define rep(i, s, e) for(int i = s; i < e; i++)
#define rrep(i, s, e) for(int i = s; i > (s)-(e); i--)
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;



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


  string s;
  cin >> s;

  if (s == "a" || s == "e" || s == "i" || s == "o" || s == "u") pr("vowel");
  else pr("consonant");


  return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)
#define Rep(i, n) for(i = 1; i < n; i++)
#define ANS(s) cout << s << endl;

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

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; }

typedef long long ll;

// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

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

	if (a >= (n % 500))
	{
		ANS("Yes");
	}
	else
	{
		ANS("No");
	}
}


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

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define REP2(i,n) for(int i=0;i<(int)(n);i++)
#define REP3(i,m,n) for(int i=m;i<(int)(n);i++)
#define REP4(i,m,n,s) for(int i=m;(s>0 and i<(int)(n)) or (s<0 and i>(int)(n));i+=s)
#define REP(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define REPIT(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define PIS(x) printf("%d ",x)
#define PN() putchar('\n')
#define PRINTARR(a,b) for(int i=0;(a+i)!=(b);i++){cout << *(a+i) << " ";}PN();
#define MP make_pair
#define PB push_back
#define EB emplace_back

typedef pair<int,int> PII;
typedef long long LL;
typedef unsigned long long ULL;

void RI() {}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d", &head);
    RI(tail...);
}
void RLL() {}
template<typename... T>
void RLL( LL& head, T&... tail ) {
    scanf("%lld", &head);
    RI(tail...);
}
void print() {putchar('\n');}
template<typename T, typename... U>
void print(T head, U... tail) {
    cout << head << " ";
    print(tail...);
}

const int MOD = 1000000007;
#define MAX_N 200005

int n;
vector<int> G[MAX_N];

bool dfs(int v, int depth) {
    if(v == n) {
        return true;
    }
    if(depth == 2) {
        return false;
    }
    REPIT(ii, G[v]) {
        bool ret = dfs(*ii, depth+1);
        if(ret) {
            return true;
        }
    }
    return false;
}

int main()
{
    int m;
    RI(n, m);
    REP(i, m) {
        int a, b;
        RI(a, b);
        G[a].PB(b);
        G[b].PB(a);
    }
    bool ret = dfs(1, 0);
    if(ret) {
        printf("POSSIBLE\n");
    } else {
        printf("IMPOSSIBLE\n");
    }
    return 0;
}


Measured memory_bytes: 12016
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef queue<int, int> qii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rept(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum=0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}

void yes() {
	cout << "Yes" << endl;
}

void no() {
	cout << "No" << endl;
}

int main() {
	int n;
	cin >> n;
	rep(i, 1, 10) {
		rep(j, 1, 10) {
			if (i*j == n) {
				yes();
				return 0;
			}
		}
	}

	no();

	system("pause");
	return 0;
}


Measured memory_bytes: 504
#include<stdio.h>
#include<string.h>
int main()
{
      char w[100];
      int i,j,c=1,temp,x;
      scanf("%s",w);
      x=strlen(w)-1;
    for(i=0;i<=x;i++)
   {
       for(j=0;j<=x;j++)
       {
           if(w[i]<w[j])
           {
               temp=w[i];
               w[i]=w[j];
               w[j]= temp;
           }
       }
   }
   w[i]='\0';
   for(i=0;i<=x;i++)
   {
       if(w[i]==w[i+1])
       {
          c++;
       }
       else
       {
           if(c%2!=0)
           {
               printf("No\n");
               return 0;
           }
           c=1;
       }
   }
    printf("Yes\n");
}


Measured memory_bytes: 1660
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)




int main() {
	const double PI = acos(-1);
	double A, B, H, M;
	std::cin >> A >> B >> H >> M;

	double x = 6*M;
	double y = 30 * H + 0.5 * M;
	double z;
	if (y >= x) {
		z = min(y - x, 360 - y + x);
	}
	else {
		z = min(x - y, 360 - x + y);
	}

	std::cout << std::fixed << std::setprecision(15) << sqrt(A * A + B * B - 2 * A * B * cos(PI/180*z)) << endl;

	return 0;
}


Measured memory_bytes: 4216
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxv=1e7;
const int maxn=100;
int n,cnt_a,cnt_b,tot,cnt;
int V[maxn+8],a[maxn+8],b[maxn+8],prime[maxv+8],match[maxn+8];
bool map[maxn+8][maxn+8],vis[maxv+8],inq[maxn+8];

int read()
{
    int x=0,f=1;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
    return x*f;
}

void add(int x){x&1?a[++cnt_a]=x:b[++cnt_b]=x;}

void prepare()
{
    vis[1]=1;
    for (int i=2;i<=maxv+1;i++)
	{
	    if (!vis[i]) prime[++tot]=i;
	    for (int j=1;j<=tot&&1ll*prime[j]*i<=maxv+1;j++)
		{
		    vis[prime[j]*i]=1;
		    if (i%prime[j]==0) break;
		}
	}
}

bool extra(int x)
{
    for (int i=1;i<=cnt_b;i++)
	{
	    if (inq[i]||(map[x][i]==0)) continue;
	    inq[i]=1;
	    if ((!match[i])||(extra(match[i])))
		{
		    match[i]=x;
		    return 1;
		}
	}
    return 0;
}

void solve()
{
    int ans=0,rest_a=cnt_a,rest_b=cnt_b;
    for (int i=1;i<=cnt_a;i++)
	{
	    memset(inq,0,sizeof(inq));
	    if (extra(i)) ans++;
	}
    for (int i=1;i<=cnt_b;i++) if (match[i]) rest_a--,rest_b--;
    ans+=rest_a+rest_b+(rest_a&1);
    printf("%d\n",ans);
}

int main()
{
    n=read();
    for (int i=1;i<=n;i++) V[i]=read();
    sort(V+1,V+n+1);
    add(V[1]);
    for (int i=2;i<=n;i++)if (V[i]!=V[i-1]+1) add(V[i-1]+1),add(V[i]);add(V[n]+1);
    prepare();
    for (int i=1;i<=cnt_a;i++)
	for (int j=1;j<=cnt_b;j++)
	    map[i][j]=!vis[abs(a[i]-b[j])];
    solve();
}


Measured memory_bytes: 14592
#include <stdio.h>

int main(void)
{
    int K;
    
    printf("\n");
    scanf("%d", &K);
    
    if (1<=K<=100)
    {
        printf("%d\n",K*K/4);
    }
    else
    {
        printf("error\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    cin>>s>>t;
    int num=0;
    for(int i=0;i<3;i++){
        if(s[i]==t[i]){
            num++;
        }
    }
    cout << num<<endl;
    return 0;
}



Measured memory_bytes: 256
def XorSum2():
    n = int(input())
    a = list(map(int, input().split()))
    ans, tmp0, tmp1 = 0, 0, 0
    
    # 尺取法インデックス
    right = 0

    for left in range(n):
        while right < n and tmp0^a[right] == tmp1+a[right]:
            tmp0 ^= a[right]
            tmp1 += a[right]
            right += 1
        ans += right-left
        if right == left:
            right += 1
            tmp0, tmp1 = 0, 0
        else:
            tmp0 ^= a[left]
            tmp1 -= a[left]
    print(ans)


if __name__ == '__main__':
    XorSum2()
    


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2097162
#define inf 1e9
#define MOD 1000000007

int main()
{
    ll n;
    double ans = 0.0;
    cin >> n;
    for(ll i =0; i < n; i++)
    {

        string ss;
        double x;
        cin >> x >> ss;
        if(ss=="BTC") ans+=380000.0*x;
        else ans+=x;
    }
    printf("%.15lf", ans);
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int M = sc.nextInt();
        int L = sc.nextInt();
        double[][] D = new double[N][N];
        for(int i = 0; i < N; i++){
            for(int j = 0; j < N; j++){
                if(i!=j)
                    D[i][j] =Double.POSITIVE_INFINITY;
            }
        }
        int[][] A = new int[3][M];
        for(int i = 0; i < M; i++){
            A[0][i] = sc.nextInt();
            A[1][i] = sc.nextInt();
            A[2][i] = sc.nextInt();
            if(A[2][i] <= L){
                D[A[0][i]-1][A[1][i]-1] = A[2][i];
                D[A[1][i]-1][A[0][i]-1] = A[2][i];
            }
        }
         
        int Q = sc.nextInt();
        int[][] s = new int[2][Q];
        for(int i = 0; i < Q; i++){
           s[0][i] = sc.nextInt();
           s[1][i] = sc.nextInt();
        }
        sc.close();

        for(int k = 0; k < N; k++){
            for(int i = 0; i < N; i++){
                for(int j = 0; j < N; j++){
                    D[i][j] = Math.min(D[i][j], D[i][k]+D[k][j]);
                }
            }
        }
        
        for(int i = 0; i < N; i++){
            for(int j = 0; j < N; j++){
                if(i == j)
                    D[i][j] = 0;
                else if(D[i][j] > L){
                    D[i][j] = Double.POSITIVE_INFINITY;
                } else
                    D[i][j] = 1;
            }
        }
        for(int k = 0; k < N; k++){
            for(int i = 0; i < N; i++){
                for(int j = 0; j < N; j++){
                    D[i][j] = Math.min(D[i][j], D[i][k]+D[k][j]);
                }
            }
        }
        
        for(int i = 0; i < Q; i++){
            if(D[s[0][i]-1][s[1][i]-1] == Double.POSITIVE_INFINITY)
                System.out.println(-1);
            else
                System.out.println((int)D[s[0][i]-1][s[1][i]-1]-1);
        }
    }
}

Measured memory_bytes: 91720
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{	
	int a,b,k;
	cin>>a>>b>>k;
	if(k>=a){
		k-=a;
		if(k>=b){
			cout<<"0 0"<<endl;
		}
		else{
			cout<<"0 "<<b-k<<endl;
		}
	}
	else{
		cout<<a-k<<" "<<b<<endl;
	}
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}







Measured memory_bytes: 3636
using System;

class Sample32
{
    public static void Main()
    {
        var material   = Console.ReadLine().Trim();
        var p = Console.ReadLine().Trim();
        var s = material + material;
        int pNumber = p.Length;
        int sNumber = material.Length;
        
        
        //out of range
        try
        {
            if (pNumber < 1 || sNumber < pNumber|| 100 < sNumber)
            {
                throw new ArgumentOutOfRangeException();
            }
        }
        catch(ArgumentOutOfRangeException e)
        {
            Console.WriteLine(e.StackTrace);
            Console.WriteLine("データの要素が範囲外です。");
            Environment.Exit(0);
        }
        
        //出力
        if (s.Contains(p))
        {
            Console.WriteLine("Yes");
        }
        else 
        {
            Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 19904
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
	ll n;
	cin >> n;
	vector<ll> a(n);
	for (ll i = 0; i < n; i++)
	{
		cin >> a[i];
	}

	sort(a.begin(), a.end());

	cout << (a[n / 2] - a[n / 2 - 1]) << endl;
}

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

int main(){
    double r;
    cin >> r;
    double pi=3.14159265;
    cout << pi*r*2.0000 << endl;
    return 0;
}

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

#define INF (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define N 100005
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795


//vl a(1001);

ll powM(ll a,ll b, ll m)
{ 
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans%m;
}



int main()
{

ll n,m,x;cin>>n>>m>>x;

vector<vector<ll>>v(n+1,vector<ll>(m+1));

for(int i=0;i<n;i++)
{
  for(int j=0;j<=m;j++)cin>>v[i][j];
}
ll ans=INT_MAX;
for(int mask=0;mask<1<<n;mask++)
{
  vector<ll>algo(m+1);
  ll sum=0;
  ll flag=0;
  for(int i=0;i<n;i++)
  {
    if(mask&(1<<i))
    {
      sum+=v[i][0];
        for(int j=1;j<=m;j++)algo[j]+=v[i][j];
    }
  }
  for(int i=1;i<=m;i++)
  {
    if(algo[i]<x)
    {
      flag=1;
      break;
    }
  }
  if(!flag)
  {
    ans=min(ans,sum);
  }

}
if(ans==INT_MAX)ans=-1;
cout<<ans<<"\n";

  return 0;

}






Measured memory_bytes: 3632
#include<iostream>
#include<cmath>
#include<vector>
using namespace std;

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

    int A, B;
    A = abs(x-a);
    B = abs(x-b);
    string  ans;

    if(A > B) {
        ans = 'B';
    } else {
        ans = 'A';
    }

    cout << ans << endl;

}


Measured memory_bytes: 256
s1 = raw_input()
s2 = raw_input()

n = len(s1)
m = len(s2)

DP = [[0]*(m+1) for _ in range(n+1)]

for i in range(n+1):
    DP[i][0] = i

for i in range(m+1):
    DP[0][i] = i

for i in range(1, n+1):
    for j in range(1, m+1):
        c = 0 if s1[i-1] == s2[j-1] else 1
        DP[i][j] =  min(DP[i-1][j] + 1, # insertion
                        DP[i][j-1] + 1, # deletion
                        DP[i-1][j-1] + c)   # replacement/nop

print DP[n][m]


Measured memory_bytes: 34956
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N = I()
D = [tuple(MI()) for _ in range(N)]
for i in range(N-2):
    if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
        print('Yes')
        break
else:
    print('No')


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll ci(26,-1);
  rep(i,n){
    string s; cin>>s;
    vll ci2(26);
    rep(j,s.size()){
      ci2[s[j]-'a']++;
    }
    rep(j,26){
      if(ci[j]==-1) ci[j]=ci2[j];
      else chmin(ci[j],ci2[j]);
    }
  }
  rep(i,26){
    rep(j,ci[i]){
      char c='a'+i;
      cout<<c;
    }
  }
  cout<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		int length = Integer.parseInt(scan.nextLine());
		String[] numStrings = scan.nextLine().split(" ");
		int[] nums = new int[length];
		for(int i = 0; i < length; i++)
			nums[i] = Integer.parseInt(numStrings[i]);
		
		for(int n = 0; n < length; n++) {
			System.out.print(nums[n]);
			if(n < length - 1)
				System.out.print(" ");
		}
		System.out.println();
		
		for(int i = 1; i < nums.length; i++) {
			int current = nums[i];
			
			int index = 0;
			while(current > nums[index] && index < i)
				index++;
			
			for(int n = i; n > index; n--)
				nums[n] = nums[n - 1];
			
			nums[index] = current;
		
			for(int n = 0; n < length; n++) {
				System.out.print(nums[n]);
				if(n < length - 1)
					System.out.print(" ");
			}
			System.out.println();
		}
	}
}



Measured memory_bytes: 33380