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

int main()
{
    int n;
    string s;

    cin >> n;
    cin >> s;

    int frag = 1;

    if (n % 2 != 0)
    {
        frag = 0;
    }

    int halfSize = s.size() / 2;

    for (int i = 0; i < halfSize; i++)
    {

        if (s[i] != s[i + halfSize])
        {
            frag = 0;
        }
    }

    if (frag == 0)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 256
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second

using namespace std;

int main(){
    ll n, sum = 0;
    cin >> n;
    for (int i = 1; i<= n; i++){
        if ((i%3 != 0)&&(i%5 != 0)){
            sum += i;
        }
    }
    cout << sum;
    return 0;
}




Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String b = sc.next();
		sc.close();
		if(b.contains("A")) {
			System.out.println("T");
		}else if(b.contains("T")) {
			System.out.println("A");
		}else if(b.contains("C")) {
			System.out.println("G");
		}else if(b.contains("G")) {
			System.out.println("C");
		}
	}

}

Measured memory_bytes: 35444
n = int(input())
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))


prev = -1
satisfy = 0

for i in a:
    satisfy += b[i - 1]

    if i - prev == 1:
        satisfy += c[i - 2]

    prev = i

print(satisfy)



Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<iomanip>

using namespace std;

const int N=100+50;

int n,a[N],o;

int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]%2==0)
		{
			if(a[i]%3==0||a[i]%5==0)
			{
				continue;
			}
			else
			{
				o=1;
				break;
			}
		}
	}
	if(o==1)
	{
		cout<<"DENIED"<<endl;
	}
	else
	{
		cout<<"APPROVED"<<endl;
	}
	return 0;
}

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

int main(){
  vvi c(3,vt<int>(3));
  rep(i,3) rep(j,3) std::cin >> c[i][j];

  bool f = true;
  vt<int> a(2), b(2);
  a[0] = c[0][0] - c[1][0];
  a[1] = c[1][0] - c[2][0];
  b[0] = c[0][0] - c[0][1];
  b[1] = c[0][1] - c[0][2];
  rep(i,2){
    if(a[0] != c[0][i+1] - c[1][i+1] || a[1] != c[1][i+1] - c[2][i+1])
      f = false;
    if(b[0] != c[i+1][0] - c[i+1][1] || b[1] != c[i+1][1] - c[i+1][2])
      f = false;
  }

  std::cout << (f ? "Yes" : "No") << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
typedef vector<pair<int,pii> >Vlll;
typedef priority_queue<int>PQL;
typedef map<int,int>M;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n
#define pl(n) cout<<n
const int mod=1e9+7;
const int sze=1e5+2;
const int inf= (int)(1e19+10LL);
void solve()
{
 int a,b;
  sl(a);sl(b);
  cout<<a*b<<endl;

		
}
 
signed main(){
   int test=1;
   //sl(test);
   while(test--){
      solve();
 
   }
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
// const ll INF = 1000000000000000000LL;

int main() {
	string s;
	cin >> s;
	if(s=="zyxwvutsrqponmlkjihgfedcba"){
		cout << -1 << endl;
		return 0;
	}
	vector<bool> a(26);
	rep(i,s.size()){
		a[s[i]-97]= true;
	}
	if(s.size()==26){
		char c_max='a'-1;

		for(int i=s.size()-1;i>=0;i--){
			a[s[i]-'a']=false;
			if(s[i]<c_max&&i!=s.size()-1){
				//書き換え
				for(int j=s[i]-'a'+1;j<=26;j++){
					if(a[j]==0&&s[i]!=char('a'+j)){
						s[i]=char('a'+j);
						break;
					}
				}
				s.erase(i+1);
				break;
			}
			else{
				c_max = max(c_max,s[i]);
			}
		}
	}
	else{
		char add;
		rep(i,26){
			if(a[i]==0){
				add = 'a'+i; 
				break;
			}
		}
		s+=add;
	}
	cout << s << endl;
	return 0;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};


int main(){
  int n; string s1,s2;
  cin >> n >> s1 >> s2;

  ll dp[n] = {};
  if(s1[0] == s2[0]) dp[0] = 3;
  else dp[0] = 6;
  for (int i = 1; i < n; i++) {
    if(s1[i] == s2[i]){
      if(s1[i-1] == s2[i-1]) dp[i] += dp[i-1]*2;
      else dp[i] += dp[i-1];
    }
    else{
      if(s1[i] == s1[i-1]) dp[i] += dp[i-1];
      else if(s1[i-1] == s2[i-1]) dp[i] += dp[i-1]*2;
      else if(s1[i-1] != s2[i-1]) dp[i] += dp[i-1]*3;
    }
    dp[i] %= MOD;
  }

  std::cout << dp[n-1] << '\n';
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;
    int x[n];
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
    }
    int Min = 3 * 100000000; //0 to 10^8 to 0 to -10^8
    for (int i = 0; i < n - k + 1; ++i) {
        int tmp = 0;
        if (x[i] > 0) {
            tmp = x[i + k - 1];
        } else if (x[i + k - 1] < 0) {
            tmp = abs(x[i]);
        } else { //正と負に跨る
            if (abs(x[i + k - 1]) < abs(x[i])) {
                tmp = 2 * x[i + k - 1] + abs(x[i]);
            } else {
                tmp = 2 * abs(x[i]) + x[i + k - 1];
            }
        }
        if (Min > tmp) {
            Min = tmp;
        }
    }
    cout << Min << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
vector<int> v[20010];
int main(){
	int n,x,y,l,r,z,i,j,w,a=1145141919;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>x>>y;x+=10000,y+=10000;
		w=sqrt(a);
		for(j=max(0,x-w);j<=min(20005,x+w);j++){
			l=0,r=v[j].size();
			while(l<r){
				z=(r+l)/2;
				a=min(a,(x-j)*(x-j)+(y-v[j][z])*(y-v[j][z]));
				if(v[j][z]<y)l=z+1;
				else r=z;
			}
		}
		v[x].push_back(y);
	}
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 7240
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

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

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

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

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

#define CLR(a) memset((a), 0 ,sizeof(a))

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

int main(void){
  int N, A, MAX = 50, MAX2 = MAX*MAX;
  cin >> N >> A;
  vector<int> x;
  REP(i, N){
    int xi;
    cin >> xi;
    x.PB(xi);
  }

  long long dp[N+1][MAX2+1][MAX+1];
  long long ans = 0;
  memset(dp, 0, sizeof((N+1)*(MAX+1)*(MAX2+1)));

  dp[0][0][0] = 1;
  dp[0][x[0]][1] = 1;

  for(int i=0;i<N-1;i++){
    for(int j=0;j<=MAX2;j++){
      for(int k=0;k<=MAX;k++){
        dp[i+1][j][k] += dp[i][j][k];
        if(j+x[i+1]>MAX2) continue;
        dp[i+1][j+x[i+1]][k+1] += dp[i][j][k];
      }
    }
  }

  for(int j=0;j<=MAX2;j++){
    for(int k=1;k<=MAX;k++){
      if(j == k*A) ans += dp[N-1][j][k];
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 49024
#include <stdio.h>
#include <iostream>
using namespace std;
int main(void){
	while(1){
		int x,y;
		cin>>x>>y;
		if (x==0&&y==0) break;
		if(x>y){
			cout<<y<<" "<<x<<endl;
		}
		else{
			cout<<x<<" "<<y<<endl;
		}
	}
}

Measured memory_bytes: 1160
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	defaultBufferSize = 1024
	maxBufferSize     = 1e6
	Mod               = 1e9 + 7
)

var sc = bufio.NewScanner(os.Stdin)

// sc.Buffer(make([]byte, defaultBufferSize), maxBufferSize)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func intSliceReverse(slice []int) []int {
	for i, j := 0, len(slice)-1; i < j; i, j = i+1, j-1 {
		slice[i], slice[j] = slice[j], slice[i]
	}
	return slice
}

func stringReverse(str string) string {
	runes := []rune(str)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func primeFactorization(x int) map[int]int {
	result := make(map[int]int, 0)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			result[i]++
			x /= i
		}
	}
	if x != 1 {
		result[x]++
	}
	return result
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	for i := 2; i*i <= x; i++ {
		if i == x {
			continue
		}
		if x%i == 0 {
			return false
		}
	}
	return true
}

func main() {
	sc.Split(bufio.ScanWords)
	k, x := readInt(), readInt()

	for i := x - k + 1; i < x+k; i++ {
		fmt.Printf("%d ", i)
	}
}


Measured memory_bytes: 640
object Main extends App {
  import scala.io.StdIn._

  println(
    readLine.trim.split(' ').map(_.toInt).let(a ⇒ a(0) - a(1)).let(n ⇒ if (n > 0) n else -n)
  )
  implicit class ScopeFunc[T](value: T){
    def let[A](func: T ⇒ A): A = func(value)
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
  }
}


Measured memory_bytes: 44052
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i =0;i<n;i++)cin>>a[i];
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    int ans =0;
    for(int i =0;i<n;i++){
        if(a[i] >= i +1)ans=i+1;
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 3160
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;
using namespace std;

int main() {
    string s;
    cin >> s;
    s[5] = ' ';
    s[13] = ' ';
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long a[] = new long[N];
		long x[] = new long[N];
		long y[] = new long[N];
		long sum = 0;
		for(int i = 0; i < N; i++) {
			a[i] = sc.nextLong();
			if(i == 0) {
				x[i] = a[0];
			} else {
				x[i] += a[i] + x[i - 1];
			}
		}
		sum = x[N - 1];
		long ans = Long.MAX_VALUE;
		for(int i = 1; i < N - 1; i++) {
			y[i] = sum - x[i];
			ans = Math.min(ans, Math.abs(x[i] - y[i]));
		}
		if(N == 2) {
			ans = Math.abs(a[0] - a[1]);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 96296
#include <limits>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <cstdint>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

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

    int N,M,R;
    cin >> N >> M >> R;
    
    vector<int> rs(R);
    for( int& r : rs )
    {
        cin >> r;
        --r;
    }
    
    vector<vector<int>> graph(N, vector<int>(N, INT_MAX/2));

    for( int i : irange(0, N) )
    {
        graph[i][i] = 0;
    }

    for( int i : irange(0, M) )
    {
        int a,b,c;
        cin >> a >> b >> c;
        --a; --b;
        graph[a][b] = graph[b][a] = c;
    }

    // ワーシャルフロイド法
    // 計算量 O(n^3) (n = 200 なら十分間に合う)。
    for( int i : irange(0, N) )
    {
        for( int j : irange(0, N) )
        {
            for( int k : irange(0, N) )
            {
                graph[j][k] = min(graph[j][k], graph[j][i] + graph[i][k]);
            }
        }
    }
    
    // 訪れる都市の全順列を列挙し、それぞれの移動距離を求めて最小値を決定する。
    // 計算量 O(n!) (n = 8 なら十分間に合う)。
    int shortest_path = INT_MAX;
    sort(rs.begin(), rs.end());
    do{
        int path = 0;
        for( int i : irange(1, R) )
        {
            path += graph[rs[i-1]][rs[i]];
        }
        
        shortest_path = min(shortest_path, path);
        
    }while( next_permutation(rs.begin(), rs.end()) );
    
    cout << shortest_path << '\n';

    return 0;
}


Measured memory_bytes: 384
import sys
input = sys.stdin.readline
from collections import defaultdict
H, W, N = map(int, input().split())
cnt = defaultdict(lambda : 0)
for i in range(N):
    a, b = map(lambda x: int(x)-1, input().split())
    for y in range(a-2, a+1):
        for x in range(b-2, b+1):
            if 0 <= y < H-2 and 0 <= x < W-2:
                cnt[(y, x)] += 1
ans = [0] * 10
for key in cnt:
    ans[cnt[key]] += 1
ans[0] += ans[0] + (H-2) * (W-2) - len(cnt)
for i in ans:
    print(i)


Measured memory_bytes: 152088
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

class Main{
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		String s=sc.next();
		int N=s.length();
		int g=0;
		int p=0;
		int win=0;
		int lose=0;
		for(int i=0; i<N; i++) {
			if(i==0) {
				if(s.charAt(0)=='p') {
					lose++;
					g++;
				}
				else if(s.charAt(0)=='g') {
					g++;
				}
			}
			else {
				if(s.charAt(i)=='p') {
					if(p<g) {
						p++;
					}
					else if(p==g) {
						g++;
						lose++;
					}
				}
				else if(s.charAt(i)=='g') {
					if(p<g) {
						p++;
						win++;
					}
					else if(p==g) {
						g++;
					}
				}
			}
		}
		pl(win-lose);
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
}

Measured memory_bytes: 24916
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int r,c;
    cin >> r >> c;
    int Spreadsheet[101][101]={};
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            cin >> Spreadsheet[i][j];
            Spreadsheet[i][c]+=Spreadsheet[i][j];
            Spreadsheet[r][j]+=Spreadsheet[i][j];
        }
    }
    for(int i=0;i<c;i++){
        Spreadsheet[r][c]+=Spreadsheet[r][i];
    }
    for(int i=0;i<r+1;i++){
        for(int j=0;j<c;j++){
            cout << Spreadsheet[i][j] << " ";
        }
        cout << Spreadsheet[i][c] << endl;
    }
}


Measured memory_bytes: 3116
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = onem()

data = [0 for i in range(100)]

data[0] = 2
data[1] = 1


if n == 1:
    print(1)
else:
    for i in range(2,n+1):
        data[i] = data[i-1] + data[i-2]

    print(data[n])

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rept(i,k,n) for(ll i = (k); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<long long,long long> Pll;
typedef tuple<int,int,int> Tii;

template <typename T>
ostream& operator<<(ostream& s, const vector<T> &vec){
    for(int i=0;i<vec.size();i++){
        if(i) s << ',';
        else s << '{';
        s <<setw(2)<< vec[i];
    }
    s << '}' << endl;
    return s;
}


int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    int s=0;
    rep(i,n){
        cin>>a[i];
        s =s^a[i];
    }
    rep(i,n){
        cout<<(s^a[i])<<endl;
    }
    return 0;
}

Measured memory_bytes: 3960
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader inp = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(inp, out);
        out.close();
    }

    private static class Solver {
        private void solve(InputReader inp, PrintWriter out) {
            int n = inp.nextInt(), w = inp.nextInt();
            long[] dp = new long[w+1];
            for (int i = 0; i < n; i++) {
                int a = inp.nextInt(), b = inp.nextInt();
                for (int j = w; j >= 0 && j - a >= 0; j--) {
                    dp[j] = Math.max(dp[j], dp[j-a] + b);
                }
            }
            long res = 0;
            for (long i: dp) res = Math.max(i, res);
            out.print(res);
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 21716
#include<stdio.h>
int main(){
    int m,f,r,sum=0;//m=中間、f=期末、r=再試、sum=中間と期末の合計

    while(1){
        scanf("%d %d %d",&m,&f,&r);
        sum=m+f;


        if(m==-1&&f==-1&&r==-1)
            break;
        if(m==-1||f==-1){
            printf("F\n");
            continue;
        }
        if(sum>=80)
            printf("A\n");
        if(sum>=65&&sum<80)
            printf("B\n");
        if(sum>=50&&sum<65)
            printf("C\n");
        if(sum>=30&&sum<50)
         {  if(r>=50)
                printf("C\n");
            else
                printf("D\n");
         }
        if(sum<30)
            printf("F\n");
    }

    return 0;
}



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

using namespace std;

long long dp[100][4][4][4];
const long long MOD=1000000007ll;
//const char c[]={'A','C','G','T'};

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

    for (int i = 0; i < 4; ++i) {
        for (int j = 0; j < 4; ++j) {
            for (int k = 0; k < 4; ++k) {
                if(i==1&&j==2&&k==0)dp[2][i][j][k]=0;
                else if(i==2&&j==1&&k==0)dp[2][i][j][k]=0;
                else if(i==1&&j==0&&k==2)dp[2][i][j][k]=0;
                else dp[2][i][j][k]=1;
            }
        }

    }
    for (int i = 3; i < 100; ++i) {
        for (int j = 0; j < 4; ++j) {//使う文字{A,C,G,T}
            for (int k = 0; k < 4; ++k) {
                for (int l = 0; l < 4; ++l) {
                    long long t=0;
                    for (int m = 0; m < 4; ++m) {
                        if(j==0||j==3)t+=dp[i-1][k][l][m];
                        else if(j==1){
                            if(k==0&&l==2)continue;//GAC
                            else if(k==2&&m==0)continue;//A?GC
                            else if(l==2&&m==0)continue;//AG?C
                            else if(k==2&&l==0)continue;//AGC
                            else t+=dp[i-1][k][l][m];
                        }
                        else if(j==2){
                            if(k==1&&l==0)continue;//ACG
                            else t+=dp[i-1][k][l][m];
                        }
                        t=t%MOD;
                    }
                    dp[i][j][k][l]=t;
                }
            }
        }
    }
    long long ans=0;
    for (int i = 0; i < 4; ++i) {
        for (int j = 0; j < 4; ++j) {
            for (int k = 0; k < 4; ++k) {
                ans+=dp[n-1][i][j][k];
                ans=ans%MOD;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
using namespace std;
LL a,b,c,n;
int main(){
	cin >> n;
	for(a = 1; a <= 3500; a ++){
		for(b = 1; b <= 3500; b ++){
			if(4ll * a * b - n * b - n * a > 0 && ((n * a * b) % (4ll * a * b - n * b - n * a) == 0)){
				cout << a << ' ' << b << ' ' << (n * a * b) / (4 * a * b - n * b - n * a) << endl;
				return 0;
			}
		}
	} return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int u,v,n,m,k;
int fa[100001];
int siz[100001];
int find(int x){return fa[x]==x?fa[x]:fa[x]=find(fa[x]);}
vector<int>e[100001];
signed main() 
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;i++)
		fa[i]=i,siz[i]=1;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&u,&v);
		if(find(u)!=find(v))
		{
			siz[find(v)]+=siz[find(u)];
			fa[find(u)]=find(v);
		}
		e[u].push_back(v);
		e[v].push_back(u);
	}
	for(int i=1;i<=k;i++)
	{
		scanf("%d%d",&u,&v);
		e[u].push_back(v);
		e[v].push_back(u);
	}
	for(int i=1;i<=n;i++)
	{
		int ans=0;
		for(int j=0;j<e[i].size();j++)
			if(find(i)==find(e[i][j]))
				ans--;
		printf("%d ",siz[find(i)]+ans-1);
	}
	return 0;
}
/*
5
1 2 4 9 10
4
1 2
1 3
1 4
1 5
*/

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

int main() {
    int A, B, K;
    cin >> A >> B >> K;

    if (B - A + 1 > K * 2) {
        for (int i = 0; i < K; i++) {
            cout << A + i << endl;
        }
        for (int i = K - 1; i >= 0; i--) {
            cout << B - i << endl;
        }
    }
    else {
        for (int i = A; i <= B; i++) {
            cout << i << endl;
        }
    }
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n; ll W; cin >> n >> W;
    vector<ll> v(n), w(n);
    for (int i = 0; i < n; i++) cin >> v[i] >> w[i];

    int m = n >> 1;
    vector<pair<ll, ll>> l(1 << m, make_pair(0, 0)), r(1 << (n - m), make_pair(0, 0));
    for (int s = 0; s < (1 << m); s++) {
        for (int i = 0; i < m; i++) {
            if ((s >> i) & 1) l[s].first += w[i], l[s].second += v[i];
        }
    }
    for (int s = 0; s < (1 << (n - m)); s++) {
        for (int i = 0; i < n - m; i++) {
            if ((s >> i) & 1) r[s].first += w[m + i], r[s].second += v[m + i];
        }
    }
    sort(l.begin(), l.end());

    vector<pair<ll, ll>> lu;
    lu.emplace_back(l.front());
    for (int i = 1; i < (1 << m); i++) {
        if (lu.back().second < l[i].second) lu.emplace_back(l[i]);
    }

    ll ans = 0;
    for (auto &p: r) {
        ll wl = p.first, vl = p.second;
        if (wl > W) continue;
        ll vr = (lower_bound(lu.begin(), lu.end(), make_pair(W - wl, linf)) - 1)->second;
        ans = max(ans, vl + vr);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 35704
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;



#define MAX 100000
#define INF 2140000000
#define MOD 1000000007

int main() {
	int n, l;
	string s;
	vector<string> alls;

	cin >> n >> l;

	for (int i = 0; i < n; ++i) {
		cin >> s;
		alls.push_back(s);
	}
	

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

	for (std::vector<string>::iterator i = alls.begin(); i != alls.end(); ++i) {
		cout << *i;
	}

	return 0;
}

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

int main()
{
  char c ;
  
  cin >> c ;
  
  if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u')
    cout << "vowel" << endl ;
  else
    cout << "consonant" << endl ;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(int argc, const char * argv[]){
    double xa,xb,ya,yb,distance=0;
    scanf("%lf %lf %lf %lf",&xa,&ya,&xb,&yb);
    distance = sqrt((xb-xa)*(xb-xa)+(yb-ya)*(yb-ya));
    printf("%f\n",distance);
    return 0;
}

Measured memory_bytes: 652
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int H,W,M;
  cin>>H>>W>>M;
  set<int> s[H];
  vector<int> nh(H,0),nw(W,0);
  REP(i,M){
    int h,w;
    cin>>h>>w;
    h--;w--;
    nh[h]++;
    nw[w]++;
    s[h].insert(w);
  }
  set<int> sh,sw;
  int mh=0,mw=0;
  REP(h,H)mh=max(mh,nh[h]);
  REP(h,H)if(nh[h]==mh)sh.insert(h);
  REP(w,W)mw=max(mw,nw[w]);
  REP(w,W)if(nw[w]==mw)sw.insert(w);
  int ans=mh+mw;
  // cerr<<"sh"<<endl;
  // for(auto eh:sh)cerr<<eh<<" ";
  // cerr<<endl;
  // cerr<<"sw"<<endl;
  // for(auto eh:sw)cerr<<eh<<" ";
  // cerr<<endl;
  for(auto eh:sh){
    for(auto ew:sw)if(s[eh].find(ew)==s[eh].end()){
      cout<<ans<<endl;
      return 0;
    }
  }
  cout<<ans-1<<endl;
  return 0;
}


Measured memory_bytes: 61848
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <deque>
#include <queue>

using namespace std;
typedef long long ll;
using namespace std;
        
int main(){
    string s,t;
    cin >> s >> t;
    cout << t << s << endl;
}


Measured memory_bytes: 256
using System;

	class Program
	{
		public static void Main(string[] args)
		{
			double n=double.Parse(Console.ReadLine());
			int[] array= new int[(int)n];
			for(int k=0;k<array.Length;k++)
			{
				array[k]=int.Parse(Console.ReadLine());
			}
			int cnt=0;
			int m=1;//?????£??????????????°???h=3???m?????????/??? h<n???

			for(int gap=2;(Math.Pow(3,gap)-1)/2<n;gap++)
			{			
				m++;
			}
			
			int []  G=new int[m];//?????£??????????´???????????????£???????????????????????????????????????????????£??????
			for(int i=0;i<G.Length;i++)//??????.Length????????????????????? m=G.Length
			{
				G[m-1-i]=(int)((Math.Pow(3,i+1)-1)/2);
			}
			for(int j=0;j<G.Length;j++)
			{
				cnt+=sort( array, G[j]);//?????\?????????????????????
			}
			//?????????????????????m???????????????G[i]????????????????????§???????????????G?????¨????????´??????count?????????
			//????????????????????????????????????
			Console.WriteLine(m);
			for(int o=0;o<G.Length-1;o++)
			{
				Console.Write(G[o]+" ");
			}
			Console.Write(G[G.Length-1]+"\r\n");//???????????§?????????
			Console.WriteLine(cnt);//?????????
			for(int l=0;l<array.Length;l++)
			{
				Console.WriteLine(array[l]);
			
			}
			
			
		}
		public static int sort(int [] A,int g)
		{
			int count=0;//??????????????°
			int v=0;
			int j=0;
			for (int k=0;k<g;k++)
			{
				
			for(int i=k+g;i<A.Length;i+=g)
			{
				
				 v=A[i];
				 j=i-g;
				while(j>=0&&
				       A[j]>v)
				{
					A[j+g]=A[j];
					j=j-g;
				count ++; //????????????????????§????????????????????§??????????????¢??????
				A[j+g]=v;//????????????A[j]???????????????????§?????????????????????\????????????
				//??????????????????????°?????????????????????´?????????????????£?????????????????????????´??????´???????????????????°?????????????????????????0
				//?????????????????????????????\???
				}
				
			}
			}
			return count;
		}
		
	}
	

Measured memory_bytes: 16748
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <numeric>

/* debug macros */
#ifdef WAFDAYO
#define DBG_LINE() {std::cerr<<"\e[2m[L"<<__LINE__<<"]\e[m ";}
#define DBG_PRINT(s,t,u) {std::cerr<<(s)<<" \e[2m=\e[m \e[1m"<<(t)<<"\e[m"<<(u);}
#define SELECT_7TH(x1,x2,x3,x4,x5,x6,x7,...) x7
#define dbg1(x1) DBG_PRINT(#x1,x1,std::endl)
#define dbg2(x1,x2) DBG_PRINT(#x1,x1,", ")dbg1(x2)
#define dbg3(x1,x2,x3) DBG_PRINT(#x1,x1,", ")dbg2(x2,x3)
#define dbg4(x1,x2,x3,x4) DBG_PRINT(#x1,x1,", ")dbg3(x2,x3,x4)
#define dbg5(x1,x2,x3,x4,x5) DBG_PRINT(#x1,x1,", ")dbg4(x2,x3,x4,x5)
#define dbg6(x1,x2,x3,x4,x5,x6) DBG_PRINT(#x1,x1,", ")dbg5(x2,x3,x4,x5,x6)
#define dbg(...) DBG_LINE()\
SELECT_7TH(__VA_ARGS__,dbg6,dbg5,dbg4,dbg3,dbg2,dbg1)(__VA_ARGS__)
#else
#define dbg(...) {}
#endif

/* utility functions */
struct read_item{read_item(){};
template<class T>operator T(){T t;std::cin>>t;return t;}};
char splf(int i,int n){return(i+1<n)?' ':'\n';};
template<bool up>
struct _RI{int i;_RI(int a):i(a){}
int operator*(){return i;}void operator++(){i+=(up?1:-1);}
bool operator!=(const _RI& r){return up?i<r.i:i>=r.i;}};
template<bool up>
struct _RX{_RI<up> x,y;_RI<up> begin(){return x;}_RI<up> end(){return y;}
_RX(int a,int b):x(up?a:(a-1)),y(b){}_RX(int a):_RX(up?0:a,up?a:0){}};
typedef _RX<true> range;
typedef _RX<false> revrange;

/* types and constants */
typedef int64_t i64;
typedef uint64_t u64;
// const i64 inf = (i64)1.05e18;
// const int inf = (int)1.05e9;

using namespace std;

int main() {

	const int N = read_item();
	const int K = read_item();
	vector<int> As(N);

	for(auto i : range(N)) {
		As[i] = read_item();
	}

	vector<int> nums = As;
	vector<int> buffer(N);

	for(auto step : range(K)) {

		dbg(step);

		fill(buffer.begin(), buffer.end(), 0);
		for(auto i : range(N)) {
			int left = i - nums[i];
			int right = i + nums[i] + 1;
			buffer[max(left, 0)] += 1;
			if(right < N) {
				buffer[right] -= 1;
			}
		}
		int cur = 0;
		for(auto i : range(N)) {
			cur += buffer[i];
			buffer[i] = cur;
		}
		swap(buffer, nums);

		bool all_n = true;
		for(auto num : nums) {
			all_n = all_n && num == N;
		}

		if(all_n) {
			break;
		}
	}

	for(auto i : range(N)) {
		printf("%d%c", nums[i], splf(i, N));
	}

	return 0;
}

/* wafdayo~~~ */


Measured memory_bytes: 5636
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

int N,K;
ll ans;
vector<int> a;
vector<int> G[100010];

int dfs(int v){
    int depth=0;
    REP(i,G[v].size())if(v!=G[v][i])depth=max(depth,dfs(G[v][i])+1);
    //cout<<v<<" "<<depth<<endl;
    if((depth==K-1&&a[v]!=1)){
        ans++;
        depth=-1;
    }
    return depth;
}

int main(){
    
    cin>>N>>K;
    a.resize(N+1);
    REP(i,N)cin>>a[i+1];
    
    if(a[1]!=1)ans=1;
    else ans=0;
    a[1]=1;
    
    for(int i=1;i<=N;i++)G[a[i]].push_back(i);
    
    dfs(1);
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 13952
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N;
    int T = 0;
    cin >> N;
    for (int i = 1; i <= 100000000; i = i * 10){
        T = (N % (10 * i) - T) / i + T;
    }
    if (N % T == 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

    int n, m, k;
    cin >> n >> m >> k;
    rep(i, n + 1) {
      rep(j, m + 1) {
        if (m*i + n*j - 2*i*j == k) {
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
    cout << "No" << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>
#include <iomanip>

typedef long long ll;

using namespace std;

int main() {
    ll N, K;
    cin >> N >> K;
    vector<double> a(N + 1);
    a[0] = 0.0;
    for (int i = 1; i < N + 1; i++) {
        int p;
        cin >> p;
        a[i] = (p + 1) / 2.0;
        a[i] += a[i - 1];
    }
    double ans = 0.0;
    for (int i = K; i < N + 1; i++) {
        ans = max(ans, a[i] - a[i - K]);
    }
    cout << fixed << setprecision(15) << ans << endl;
    return 0;
}



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


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


	int H, W;
	cin >> H >> W;

	string A[8];
	rep(i, H) cin >> A[i];

	int OK = 1;
	rep(i, H) rep(j, W) {
		if (i == 0 && j == 0) {
			int ato = 0;
			if (A[i + 1][j] == '#') ato++;
			if (A[i][j + 1] == '#') ato++;
			if (ato != 1) OK = 0;
		}
		else if (i == H - 1 && j == W - 1) {
			int mae = 0;
			if (A[i - 1][j] == '#') mae++;
			if (A[i][j - 1] == '#') mae++;
			if (mae != 1) OK = 0;
		}
		else if (A[i][j] == '#') {
			int mae = 0;
			if (i != 0) if (A[i - 1][j] == '#') mae++;
			if (j != 0) if (A[i][j - 1] == '#') mae++;
			if (mae != 1) OK = 0;
			int ato = 0;
			if (i != H - 1) if (A[i + 1][j] == '#') ato++;
			if (j != W - 1) if (A[i][j + 1] == '#') ato++;
			if (ato != 1) OK = 0;
		}
	}

	if (OK) co("Possible");
	else co("Impossible");

	Would you please return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int A[1000000],n;

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

int main(void){
    int i,q,k,sum=0;

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

    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d",&k);
        if(binarysearch(k))
            sum++;
    }
    printf("%d\n",sum);
    return 0;
}


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

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

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

    REP(r, n) {
        int gx, gy;
        cin >> gx >> gy;

        /* dpテーブル生成 */
        vector<vector<int>> dp(gy+2, vector<int> (gx+2, 0));
        dp[0][1] = 1;

        /* 通り抜けることができるかどうかの判定要素 */
        vector<vector<bool>> vert(gy+2, vector<bool> (gx+2, false));
        vector<vector<bool>> hori(gy+2, vector<bool> (gx+2, false));

        int p;
        int x0, y0, x1, y1;
        cin >> p;

        REP(i, p) {
            cin >> x0 >> y0 >> x1>> y1;
            if (x0 == x1)   vert[max(y0, y1)+1][x0+1] = true;
            else            hori[y0+1][max(x0, x1)+1] = true;
            
        }

        for (int i = 1; i < gy+2; i++) {
            for (int j = 1; j < gx+2; j++) {

                if (vert[i][j] && hori[i][j])     dp[i][j] = 0;
                else if (vert[i][j])              dp[i][j] = dp[i][j-1];
                else if (hori[i][j])              dp[i][j] = dp[i-1][j];
                else    dp[i][j] = dp[i-1][j] + dp[i][j-1];
            }
        }

        if (dp[gy+1][gx+1] == 0)    cout << "Miserable Hokusai!" << endl;
        else cout << dp[gy+1][gx+1] << endl;
        
        /*
        REP(i, gy+2) {
            REP(j, gx+2) {
                cout << dp[i][j] << " ";
            }
            cout << endl;
        }
        */
    }
}


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

using namespace std;

#define rep(i, a) for (int i = 0; i < a; i++)
#define reps(i, a, b) for (int i = a; i < b; i++)

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  if (a+b>=c) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
# coding: utf-8

a, b = map(int, input().split())
# print(a,b)
# x=-1
# y=-1

# xr=[]
# yr=[]
# for i in range(1,101):
#     if i*0.08//1==a:
#         # print("x:{}".format(i))
#         x=i
#         xr.append(x)
# for i in range(1,101):
#     if i *0.1//1==b:
#         # print("y:{}".format(i))
#         y=i
#         yr.append(y)
# flag=False
#
# result=[]
# for i in xr:
#     for j in yr:
#         if i==j:
#             result.append(i)
#
# if len(result)>0:
#     print(result[0])
# else:
#     print('-1')
flag =False
for i in range(1,1010):
    if i*0.08//1==a and i*0.1//1==b:
        print(i)
        flag=True
        break

if not flag:
    print(-1)


Measured memory_bytes: 2940
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>

#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))

#define SIZE (10*10*10*10*10)

typedef struct _tmp_t {
  int a;
//  int64    a;
//  int64    b;
} tmp_t;

tmp_t d[SIZE];

int compare_a(const void *a, const void *b)
{
  tmp_t *x;
  tmp_t *y;

  x = (tmp_t *)a;
  y = (tmp_t *)b;

  if (x->a > y->a) return 1;
  if (x->a < y->a) return -1;

  return 0;
}

void qsort_a (tmp_t *array, int size)
{
  qsort(array, size, sizeof(tmp_t), compare_a);
}


int main()
{
  int cnt;
  int N;
  int i, min, max;
  int result = 0;
  
  cnt = scanf("%d", &N);

  for(i=0; i<N; i++) {
    cnt = scanf("%d", &d[i].a);
  }

  qsort_a(d, N);
  min = d[(N/2 - 1)].a;
  max = d[(N/2 - 0)].a;

  if (min == max) {
    result = 0;
  } else {
    result = max - min;
  }
  
  printf("%d", result);

  return 0;
}



Measured memory_bytes: 892
#include<iostream> 
#include<string> 
#include<vector> 
#include<algorithm> 
using namespace std; 

int main()
{
	int n, h, w;
	cin >> n >> h >> w;

	int p = 0,q = 0;
	for (int i=0;i<100;i++)
	{
		if (i + h > n)
		{
			break;
		}
		p++;

	}
	for (int i = 0; i < 100; i++)
	{
		if (i + w > n)
		{
			break;
		}
		q++;
	}
	cout << p * q << endl;
	



	


}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
C - GeT AC
https://atcoder.jp/contests/abc122/tasks/abc122_c
WA
"""
import sys


def main(args):
    N, Q = map(int, input().split())
    S = input()
    ans = [0] * (N + 1)
    for i, a, c in zip(range(2, N), S, S[1:]):
        ans[i] = ans[i-1] + (a == 'A' and c == 'C')
    ans[-1] = ans[-2] + (S[-2:] == 'AC')

    ans_d = {i:n for i, n in enumerate(ans)}
    for _ in range(Q):
        l, r = map(int, input().split())
        print(ans_d[r] - ans_d[l])


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 19184
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

int n;

int main(){
	while(cin>>n&&n){
		priority_queue<pair<int,int> > q;
		int h1,m1,s1,h2,m2,s2,ans=0,cur=0;
		char c;
		rep(i,n){
			cin>>h1>>c>>m1>>c>>s1>>h2>>c>>m2>>c>>s2;
			q.push(make_pair(h1*3600+m1*60+s1,1));
			q.push(make_pair(h2*3600+m2*60+s2,0));
		}
		while(!q.empty()){
			if(q.top().second)cur--;
			else cur++;
			q.pop();
			ans=max(ans,cur);
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1168
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

s=get_nsp
n=s.size
if n.odd?
  m=(n-1)/2
else
  m=n/2
end
ans=0
m.times do|i|
  unless s[i]==s[n-1-i]
    ans+=1
  end 
end
puts ans

Measured memory_bytes: 1788
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

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

    int n,m; cin >> n >> m;
    vector<int> p(m),y(m);
    for(int i = 0;i < m;i ++){
        cin >> p.at(i) >> y.at(i);
    }

    vector<vector<int> > a(n+1,vector<int>(0));
    for(int i = 0;i < m;i ++){
        a.at(p.at(i)).push_back(y.at(i));
    }

    for(int i = 0;i < n+1;i ++){
        sort(a.at(i).begin(),a.at(i).end());
    }

    for(int i = 0;i < m;i ++){
        cout << setw(6) << setfill('0') << p.at(i);

        auto iter = lower_bound(a.at(p.at(i)).begin(),a.at(p.at(i)).end(),y.at(i));
        cout << setw(6) << setfill('0') << iter - a.at(p.at(i)).begin() +1 << endl;

    }

    
}

Measured memory_bytes: 10252