akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
char c;
string ans="";
rep(i,3){
    rep(j,3){
        cin>>c;
        if(i==j){
            ans+=c;
        }
    }
}
cout<<ans<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int n,k,a;
bool C[15];

bool Check(int x)
{
	char s[10];
	sprintf(s+1,"%d",x);
	for(int i=1;s[i];i++)
		if(C[s[i]-'0'])
			return false;
	return true;
}

int main()
{
	scanf("%d %d",&n,&k);
	for(int i=1;i<=k;i++)
	{
		scanf("%d",&a);
		C[a]=1;
	}
	for(int i=n;;i++)
		if(Check(i))
		{
			printf("%d\n",i);
			break;
		}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>


int main(void)
{
	int			n,w,a,b, array[30];
	int			i,s;
	
	for(i=0; i<30; i++)		array[i] = i+1;
		
	scanf("%d",&w);
	scanf("%d",&n);
		
	for(i=0; i<n; i++){
		scanf("%d, %d",&a, &b);	
		s =  array[a-1];
		array[a-1] = array[b-1];
		array[b-1] = s;
	}
	for(i=0;i<w;i++){
		printf("%d\r\n", array[i]);
	}
	return 0;
}

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
using ll = long long;

int main() {
    FAST;

    int n;
    map<string,int> mp;

    cin >> n;
    while (n--) {
        string s;
        cin >> s;
        ++mp[s];
    }

    cout << "AC x " << mp["AC"] << "\n";
    cout << "WA x " << mp["WA"] << "\n";
    cout << "TLE x " << mp["TLE"] << "\n";
    cout << "RE x " << mp["RE"] << "\n";

    return 0;
}


Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using Debug;
//using static System.Globalization.CultureInfo;

class Program
{
    class S:IComparable<S>
    {
        public int key;
        public bool isp;
        public S(int key,bool isp)
        {
            this.key = key;
            this.isp = isp;
        }
        public int CompareTo(S s)
            => key.CompareTo(s.key);
    }
    static void Main(string[] args)
    {
        //Solve();
        WriteLine(Solve());
    }
    static long Solve()
    {
        var num = Input.num;
        var ss = new S[2 * num];
        for (var i = 0; i < 2 * num; i++)
            ss[i] = new S(Input.num, i < num);
        Array.Sort(ss);
        var res = 1L;
        var pa = 0;
        var e = 0;
        for (var i = 0; i < 2 * num; i++)
            if (ss[i].isp)
            {
                if (e > 0)
                {
                    res = res * e % Input.MOD;
                    e--;
                }
                else
                    pa++;
                
            }
            else
            {
                if (pa > 0)
                {
                    res = res * pa % Input.MOD;
                    pa--;
                }
                else
                    e++;
            }
        return res;
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}

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

int N;

int main() {
    cin>>N;
    string ans="No";
    for (int i=1; i<=9; i++) {
        for (int j=1; j<=9; j++) {
            if (i*j==N) {
                ans="Yes";
                break;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
def solve():
  N = int(input())
  A = list(map(int, input().split()))
  B = list(map(int, input().split()))
  C = []
  for a,b in zip(A,B):
    C.append(a-b)
  if sum(C)<0:
    return -1
  minus = sum([abs(x) for x in C if x<0])
  ans = len([abs(x) for x in C if x<0])
  C.sort(reverse=True)
  for i in range(N):
    if minus==0:
      break
    if C[i]>0:
      ans += 1
      if minus>C[i]:
        minus -= C[i]
      else:
        minus = 0
  return ans
print(solve())

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

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

  vector<vector<char>> v;
  vector<char> x;
  for (int i = 0; i < h; i++)
  {
    x.push_back('!');
  }
  v.push_back(x);

  for (int i = 0; i < h; i++)
  {
    string s;
    vector<char> a;
    a.push_back('!');
    cin >> s;
    for (int j = 0; j < w; j++)
    {
      a.push_back(s[j]);
    }
    a.push_back('!');

    v.push_back(a);
  }
  vector<char> y;
  for (int i = 0; i < h; i++)
  {
    y.push_back('!');
  }
  v.push_back(y);

  for (int i = 1; i <= h; i++)
  {
    for (int j = 1; j <= w; j++)
    {
      if (v[i][j] == '#' && v[i + 1][j] == '.' && v[i - 1][j] == '.' && v[i][j + 1] == '.' && v[i][j - 1] == '.')
      {
        cout << "No" << endl;
        return 0;
      }
    }
  }

  cout << "Yes" << endl;
}

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

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

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
int main() {
  int N;
  cin >> N;
  vector<int> a(N);

  for(int i = 0; i < N; i++) cin >> a[i];
  ll l = 1;
  for(int i = 0; i < N; i++) {
    l = lcm(l, a[i]);
  }
 
  ll ans = 0;
  for(int i = 0; i < N; i++) {
    ans += a[i] - 1;
  }

  cout << ans;

    return 0;
}


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

#define fi first
#define se second
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define FOR(i, a, b) for (int i = a; i <= (b); i++)
#define ROF(i, a, b) for (int i = a; i >= (b); i--)

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<ll>; using vvll = vector<vll>;

int main() {
    int k; cin >> k;
    int cur = 7 % k;
    FOR(i, 1, 1000000) {
        if (cur == 0) return cout << i << endl, 0;
        cur = (cur * 10 + 7) % k;
    }
    cout << -1 << endl;
}

Measured memory_bytes: 3592
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=200000000000000;
double pi=3.141592653589793;

const int MOD = 1000000007;

long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
long myPow(long long x, long long n, long long m=MOD){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

ll N,M;
vector<ll>A(106);

void batten(ll i,ll k){
	if(i==N)return;
	if((A[i]%k)>(A[i+1]%k)){
		swap(A[i],A[i+1]);
		batten(i+1,k);
		return;
	}else{
		batten(i+1,k);
		return;
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll N,A,B;
	cin>>N>>A>>B;
	ll one=0,two=0,three=0;
	for(int i=0;i<N;i++){
		ll p;
		cin>>p;
		if(p<=A)one++;
		if(A<p&&p<=B)two++;
		if(B<p)three++;
	}
	cout<<min(one,min(two,three))<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR0(i,n) for(int i=0;i<n;i++)
#define FOR1(i,n) for(int i=1;i<=n;i++)
#define FORl(i,l,n) for(int i=l;i<n;i++)
using namespace std;
#define pi pair<int,int>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<int>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e14
ll mod = 1e9+7;
ll power(ll num,ll g,ll mod)
{
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power((num*num)%mod,g/2,mod);
}
 
  
int main() { 
 	int r;
 	cin >> r;
 	cout << r*r;

} 

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			int length = sc.nextInt();
			int[] nums = new int[length];
			for(int i = 0; i < length; i++) {
				nums[i] = i + 1;
			}
			permutation(nums, "");
		}
	}
	public static void permutation(int[] nums, String usedNums) {
		if(nums.length == 1) {
			System.out.println(usedNums + nums[0]);
		}
		else {
			for(int i = 0; i < nums.length; i++) {
				int[] pNums = new int[nums.length - 1];
				System.arraycopy(nums, 0, pNums, 0, i);
				System.arraycopy(nums, i + 1, pNums, i, nums.length - i - 1);
				permutation(pNums, usedNums + nums[i] + " ");
			}
		}
	}
}


Measured memory_bytes: 118612
#include<bits/stdc++.h>
#define lld long long
#define pb push_back
#define mk make_pair
#define MAX 1e9+7
#define lim 1e5
using namespace std;
 
int main()
{
	string s,t;
	cin>>s>>t;
 
	int n=s.length();
	int m=t.length();
 
	int dp[n+1][m+1];
 
	
 
	memset(dp,0,sizeof(dp));
 
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(s[i-1]==t[j-1])
				dp[i][j] = dp[i-1][j-1]+1;	
 
			else
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
 
	//cout<<dp[n][m]<<endl;
 
 
 
	int i=n , j=m , len=dp[n][m]+1;
 
	char ans[len];
		
	ans[len-1]='\0';
	len-=2;
 
	while(i>0 && j>0)
	{
		if(s[i-1]==t[j-1])
		{
			ans[len] = s[i-1];
			i--;
			j--;
			len--;
		}	
 
		
		else if(dp[i-1][j]>dp[i][j-1])
		{
			i--;
		}
 
		else
		{
			j--;
		}	
	}
 
	cout<<ans<<endl;
 
}

Measured memory_bytes: 35456
line = gets
line.chomp!

/(\d+)\s+(\d+)/ =~ line
H = $1.to_i
W = $2.to_i

line = gets
line.chomp!

/(\d+)\s+(\d+)/ =~ line
h = $1.to_i
w = $2.to_i


white = H*W - H*w - W*h + h*w

print white

Measured memory_bytes: 1788
use std::io;
use std::cmp::min;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let n = v[0];
	let v:Vec<i32> = procon_read();
	let k = v[0];
	let mut ret = 1;
	for i in 0..n {
		ret = min(2*ret, ret+k)
	}
	println!("{}", ret);
}

Measured memory_bytes: 4352
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

int solve()
{
    int S, W;

    std::cin >> S >> W;

    if (W >= S)
        cout << "unsafe" << endl;
    else
        cout << "safe" << endl;

    return 0;
}

int main()
{
//    std::cout << solve() << std::endl;
    solve();

    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>

using namespace std;

const int MAX = 1e6;
const int INF = 2e9;
typedef long long ll;

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

    int n;
    cin >> n;

    // 500 yen : 1000
    // 5 yen : 5

    cout << (n / 500 * 1000) + (n % 500) / 5 * 5;

    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
n,q = map(int,input().split())
s = input().strip()
a = [list(input().split()) for i in range(q)]
def cheak(x):
  for i in range(q):
      if s[x] == a[i][0]:
          if a[i][1] == "L":
              x-=1
          else:
              x+=1
      if x >= n :
          return 0
      elif x < 0:
          return 1
  return 0
def cheak2(x):
  for i in range(q):
      if s[x] == a[i][0]:
          if a[i][1] == "L":
              x-=1
          else:
              x+=1
      if x >= n :
          return 1
      elif x < 0:
          return 0
  return 0
dai = n-1
syo = 0
hi = cheak(syo)
mi = cheak2(dai)
if hi== 0 and mi==0:
    print(n)
elif hi and mi:
  while True:
    if dai-syo <= 1:
        if cheak(dai) != 1:
            dai = syo
        break
    kon = (dai+syo)//2
    c = cheak(kon)
    if c == 0:
        dai = kon
    else:
        syo = kon
  ab = dai
  dai = n-1
  syo = 0
  while True:
    if dai-syo <= 1:
        if cheak2(syo) == 1:
            dai = syo
        break
    kon = (dai+syo)//2
    c = cheak2(kon)
    if c == 1:
        dai = kon
    else:
        syo = kon
  if dai <= ab:
      print(0)
      exit()
  print(n-(ab+1+n-dai))
elif hi==1 and mi == 0:
  while True:
    if dai-syo <= 1:
        if cheak(dai) != 1:
            dai = syo
        break
    kon = (dai+syo)//2
    c = cheak(kon)
    if c == 0:
        dai = kon
    else:
        syo = kon
  print(n-1-dai)
else:
  while True:
    if dai-syo <= 1:
        if cheak2(syo) == 1:
            dai = syo
        break
    kon = (dai+syo)//2
    c = cheak2(kon)
    if c == 1:
        dai = kon
    else:
        syo = kon
  print(dai)


Measured memory_bytes: 78968
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;
const ll LINF=1e18;

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans[10][10][10]={};
    ans[s[0]-'0'][s[1]-'0'][s[2]-'0']=2;
    for(int i=3;i<n;i++){
        int d=s[i]-'0';
        for(int j=0;j<10;j++){
            for(int k=0;k<10;k++){
                for(int l=0;l<10;l++){
                    if(ans[j][k][l]&&ans[j][k][l]!=i){
                        if(ans[j][k][d]==0)ans[j][k][d]=i;
                        if(ans[j][l][d]==0)ans[j][l][d]=i;
                        if(ans[k][l][d]==0)ans[k][l][d]=i;
                    }
                }
            }
        }
    }
    int num=0;
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            for(int k=0;k<10;k++){
                if(ans[i][j][k]){
                    num++;
                }
            }
        }
    }
    cout<<num<<endl;
}

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

int makeFibonacci(int n) {
	int a[100];
	a[0] = 1;
	a[1] = 1;

	for (int i = 2;i <= n ;i++) {
		a[i] = a[i - 2] + a[i - 1];
	}

	return a[n];
}


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

	int ans = makeFibonacci(n);

	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 3092
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n){
    Int res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
    return a * b / gcd(a, b);
}
// a x + b y = gcd(a, b)
Int extgcd(Int a, Int b, Int &x, Int &y) {
    Int g = a; x = 1; y = 0;
    if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
    return g;
}

int bits[200005][21];
int a[200005];

int main(){
    cin.tie(0);

    int N;
    cin >> N;
    for (int i = 0; i < N; i++){
        cin >> a[i];
        for (int j = 0; j < 21; j++){
            if (a[i] & (1 << j)){
                bits[i][j] = 1;
            }
        }
    }
    Int ans = 0;
    int right = 0;
    set<int> s;
    for (int left = 0; left < N; left++){
        while (right < N){
            int flag = 1;
            for (int i = 0; i < 21; i++){
                if (bits[right][i] && s.count(i)){
                    flag = 0;
                }
            }
            if (flag){
                for (int i = 0; i < 21; i++){
                    if (bits[right][i]){
                        s.insert(i);
                    }
                }
                ans += (right - left + 1);
                right++;
            }else{
                break;
            }
        }
        for (int i = 0; i < 21; i++){
            if (bits[left][i]){
                s.erase(i);
            }
        }
    }

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


Measured memory_bytes: 17408
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Multiplication 2
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const long long MAX_A = 1000000000000000000;

/* typedef */

typedef long long ll;

/* global variables */

ll as[MAX_N];

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", as + i);
    if (as[i] == 0) {
      puts("0");
      return 0;
    }
  }

  ll p = 1;
  for (int i = 0; i < n; i++) {
    ll q = p * as[i];
    if (q > MAX_A || q < p) {
      puts("-1");
      return 0;
    }
    p = q;
  }

  printf("%lld\n", p);
  return 0;
}


Measured memory_bytes: 4008
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

//二分探査なのは分かる
int main() {

    ll A, B, Q;
    cin >> A >> B >> Q;

    vector<ll > s;
    vector<ll > t;
    vector<ll > q;
    //0＝寺 1=社
    for(ll i = 0; i < A; i++){
        ll x = 0; cin >> x;
        s.push_back(x);
    }
    for(ll i = 0; i < B; i++){
        ll x = 0; cin >> x;
        t.push_back(x);
    }

    //クエリQ
    for(ll i = 0; i < Q; i++){
        ll x = 0; cin >> x;
        q.push_back(x);
    }

    //番兵
    //matome.push_back(make_pair(-1,-1));
    //matome.push_back(make_pair(-1,INF));
    s.push_back(-INF);
    s.push_back(INF);
    t.push_back(-INF);
    t.push_back(INF);
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    //sort(q.begin(), q.end());

    vector<ll > ans;
    for(ll i = 0; i < Q; i++){
        //答え
        ll t_ans = 0;
        //現在地
        ll n = q[i];

        //n以上になるindex
        ll tIdx = lower_bound(t.begin(), t.end(), n) - t.begin();
        ll sIdx = lower_bound(s.begin(), s.end(), n) - s.begin();

        //右の寺
        ll rightT = t[tIdx];
        //右の神社
        ll rightS = s[sIdx];

        //左の寺
        ll leftT = t[tIdx-1];
        //左の神社
        ll leftS = s[sIdx-1];

        //右寺右神社
        t_ans = max(rightT, rightS) - n;
        //左寺左神社
        t_ans = min(t_ans, n - min(leftT, leftS));
        //左の寺に行って右の神社に戻ってくるパターン
        //右の神社にいって左の寺に戻ってくるパターン
        if(rightT > rightS && leftT > leftS){
            t_ans = min(t_ans, rightS - leftT + min(rightS - n, n - leftT));
        }

        if(rightT < rightS && leftT < leftS){
            t_ans = min(t_ans, rightT - leftS + min(rightT - n, n - leftS));
        }

        cout << t_ans << endl;

    }


}

Measured memory_bytes: 3828
n = int(input())
strings_list = [list(input()) for i in range(n)]
counter = 0
dict = {}
 
for strings in strings_list:
    strings = "".join(sorted(strings))
    if strings in dict.keys():
        counter += dict[strings]
        dict[strings] += 1
    else:
        dict[strings] = 1
print(counter)

Measured memory_bytes: 39040
// E - League
#include <bits/stdc++.h>
using namespace std;
using P = pair<int,int>;
using vi = vector<int>;
#define rp(i,n) for(int i=0;i<(n);i++)

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

	vector<vi> A(N, vi(N-1));
	rp(i,N){
		rp(j,N-1){ cin>>A[i][j]; --A[i][j]; }
		reverse(A[i].begin(), A[i].end());
	}

	vector<P> q;
	auto check = [&](int s){
		if(A[s].size()==0) return;
		int d = A[s].back();
		if(A[d].size()==0) return;
		if(A[d].back()==s){
			if(s > d) swap(s,d);
			q.push_back(P(s,d));
		}
	};

	rp(i,N) check(i);

	int day = 0;
	while(q.size()){
		++day;
		sort(q.begin(), q.end());
		q.erase(unique(q.begin(), q.end()), q.end());

		vector<P> prevQ;
		swap(prevQ, q);

		for(P p:prevQ){
			int s = p.first, d = p.second;
			A[s].pop_back();
			A[d].pop_back();
		}

		for(P p:prevQ){
			int s = p.first, d = p.second;
			check(s);
			check(d);
		}
	}

	rp(i,N) if(A[i].size()){ cout<< -1 <<endl; return 0; }
	cout<< day <<endl;
}

Measured memory_bytes: 6272
#include <stdio.h>

int main(void)
{
	int i;
	int f[3];
	
	scanf("%d %d %d", &f[0], &f[1], &f[2]);
	
	if (f[0] == 1 && f[1] == 1){
		printf("Open\n");
	}
	else if (f[2] == 1){
		printf("Open\n");
	}
	else {
		printf("Close\n");
	}
	
	return (0);
}

Measured memory_bytes: 584
#include <iostream>
#include <algorithm>
#include <map>
#define rep(i,n) for(int i=0; i<n; i++)

using namespace std;

int main(void) {
    int n, m;
    cin >> n >> m;
    int a[m], b[m];
    rep(i, m) {
        cin >> a[i] >> b[i];
    }

    pair<int, int> ps[m];
    rep(i, m) {
        ps[i] = make_pair(a[i], b[i]);
    }
    int c = 1;
    sort(ps, ps+m);
    pair<int, int> p = make_pair(0, 1e6);
    rep(i, m) {
        if (p.first <= ps[i].first  and ps[i].first  < p.second or
            p.first <  ps[i].second and ps[i].second <= p.second) {
            p.first =  max(p.first, ps[i].first);
            p.second = min(p.second, ps[i].second);
            continue;
        }
        c++;
        p.first = ps[i].first;
        p.second = ps[i].second;
    }
    cout << c << endl;
}

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

const int INF = 1073741823; // 10^30-1、使わない辺とかに用いる
int main() {
	int N, T, c, t;
	cin >> N >> T;
	int minCost = INF;
	for (int i = 0;i < N;++ i) {
		cin >> c >> t;
		if (t <= T) minCost = min(minCost, c);
	}
	if (minCost == INF) cout << "TLE";
	else cout << minCost;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

これもやるだけ
*/

Measured memory_bytes: 888
//

//round2

#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;


int main() {

	stack<int> S1;
	stack<pair <int, int > >S2;
	char ch;
	int sum = 0;

	for (int i = 0; cin >> ch; i++) {
		if (ch == '\\') {
			S1.push(i);
		}
		else if (ch == '/' && S1.size() > 0) {
			int j = S1.top(); S1.pop();
			sum += i - j;
			int a = i - j;
			while (S2.size() > 0 && S2.top().first > j) {
				a += S2.top().second; S2.pop();
			}
			S2.push(make_pair(j, a));
		}
	}

	vector<int>ans;
	while (S2.size() > 0) { ans.push_back(S2.top().second); S2.pop(); }
	reverse(ans.begin(), ans.end());
	cout << sum << endl;
	cout << ans.size();
	for (int i = 0; i < ans.size(); i++) {
		cout << " ";
		cout << ans[i];
	}
	cout << endl;


}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int H,W;
char s[105][105];
int sum[105][105],a,b;
int dp[2][105][105][105],ans;
int query(int x1,int y1,int x2,int y2) {
    
    x2 = min(H,x2);y2 = min(W,y2);
    if(x1 > x2 || y1 > y2) return 0;
    return sum[x2][y2] - sum[x2][y1 - 1] - sum[x1 - 1][y2] + sum[x1 - 1][y1 - 1];
}
void update(int &x,int y) {
    x = max(x,y);
}
void Solve() {
    read(H);read(W);
    for(int i = 1 ; i <= H ; ++i) scanf("%s",s[i] + 1);
    for(int i = 1 ; i <= H ; ++i) {
	for(int j = 1 ; j <= W ; ++j) {
	    sum[i][j] = (s[i][j] == 'o');
	    sum[i][j] += sum[i][j - 1];
	    if(s[i][j] == 'E') {a = i;b = j;}
	}
    }
    for(int i = 1 ; i <= H ; ++i) {
	for(int j = 1 ; j <= W ; ++j) {
	    sum[i][j] += sum[i - 1][j];
	}
    }
    int cur = 0;
    dp[0][0][0][0] = 0;
    for(int i = 0 ; i < a ; ++i) {
	memset(dp[cur ^ 1],0,sizeof(dp[cur ^ 1]));
	for(int j = 0 ; j < b ; ++j) {
	    for(int k = 0 ; k <= H - a ; ++k) {
		for(int t = 0 ; t <= W - b ; ++t) {
		    ans = max(ans,dp[cur][j][k][t]);
		    int tmp = dp[cur][j][k][t];
		    if(k < a - i - 1) tmp += query(a - i - 1,max(b - j,t + 1),a - i - 1,min(b + t,W - j));
		    update(dp[cur ^ 1][j][k][t],tmp);
		    tmp = dp[cur][j][k][t];
		    if(t < b - j - 1) tmp += query(max(a - i,k + 1),b - j - 1,min(a + k,H - i),b - j - 1);
		    update(dp[cur][j + 1][k][t],tmp);
		    tmp = dp[cur][j][k][t];
		    if(H - i >= a + k + 1) tmp += query(a + k + 1,max(b - j,t + 1),a + k + 1,min(b + t,W - j));
		    update(dp[cur][j][k + 1][t],tmp);
		    tmp = dp[cur][j][k][t];
		    if(W - j >= b + t + 1) tmp += query(max(a - i,k + 1),b + t + 1,min(a + k,H - i),b + t + 1);
		    update(dp[cur][j][k][t + 1],tmp);
		}
	    }
	}
	cur ^= 1;
    }
    out(ans);enter;
}

int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 9344
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
void solve() {
	int N; cin >> N;
	map<string, int> cnt;
	string W; cin >> W;
	char last_char = W[W.size() - 1];
	cnt[W]++;
	for (int i  = 1; i < N; ++i) {
		cin >> W;
		if (W[0] != last_char) {
			cout << "No" << endl;
			return;
		}
		if (cnt[W] != 0) {
			cout << "No" << endl;
			return;
		} else {
			cnt[W]++;
		}
		last_char = W[W.size() - 1];
	}
	cout << "Yes" << endl;
	return;
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>

int main()
{
  int a,b,c,k;
  std::cin >> a >> b >> c >> k;
  for (;k>0;--k)
  {
    if (a >= b)
    {
      b *= 2;
    }
    else if (b >= c)
    {
      c *= 2;
    }
    else
    {
      break;
    }
  }
  if (a < b && b < c)
  {
    std::cout << "Yes";
  }
  else
  {
  	std::cout << "No";
  }
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define int long long
#define double long double
const int INF = 1e18, MOD = 1e9 + 7;

int modpow(int x, int n) {
    int ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return ret;
}

int modcomb(int n, int k) {
    if (n < k || n < 0 || k < 0) return 0;
    if (n - k < k) k = n - k;
    int x = 1, y = 1;
    for (int i = 0; i < k; i++) x = x * (n - i) % MOD;
    for (int i = k; i > 0; i--) y = y * i % MOD;
    return x * modpow(y, MOD - 2) % MOD;
}

signed main() {
    int x, y;
    cin>>x>>y;
    if ((x + y) % 3 != 0) {
        cout<<0<<endl;
        return 0;
    }
    int a, b;
    a = (2 * x - y) / 3;
    b = (2 * y - x) / 3;
    cout<<modcomb(a + b, a)<<endl;
}

Measured memory_bytes: 256
N = int(input())
V = list(map(int, input().split()))

evens = [(0, 0)]*(10**5+1)
odds = [(0, 0)]*(10**5+1)
for i in range(N):
    if (i+1) % 2 == 0:
        evens[V[i]] = (V[i], evens[V[i]][1] + 1)
    else:
        odds[V[i]] = (V[i], odds[V[i]][1] + 1)

evens.sort(key=lambda x: x[1], reverse=True)
odds.sort(key=lambda x: x[1], reverse=True)

if evens[0][0] != odds[0][0]:
    print(N - evens[0][1] - odds[0][1])
else:
    print(min(N - evens[0][1] - odds[1][1], N - evens[1][1] - odds[0][1]))


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

int main(){
    int n;cin >> n;
    string taro, hanako;
    int point_taro = 0, point_hanako = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> taro >> hanako;
        if (taro < hanako)
        {
            point_hanako+=3;
        }else if(taro > hanako){
            point_taro+=3;
        }else{
            point_hanako++;
            point_taro++;
        }
        
    }
    cout << point_taro << " " << point_hanako << endl;
    
}


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

int main(){
    long long int x;
    long long int a=0;
    int b=0;
    cin >> x;

    b = x%11;
    a = (x-b)/11;

    if(b==0)
        cout << 2*a;
    else if(b<=6)
        cout << 2*a+1 << endl;
    else
        cout << 2*a+2 << endl;

  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ABdiff = sorted([A[i]-B[i] for i in range(N)], reverse = True)
if sum(ABdiff) < 0:
    print(-1)
    exit()

ABminus = [A[i]-B[i] for i in range(N) if A[i]-B[i] < 0]
if len(ABminus) == 0:
    print(0)
    exit()

all_minus = sum(ABminus)
plus = 0

for i in range(N):
    plus += ABdiff[i]
    if plus >= abs(all_minus):
        print(i+1 + len(ABminus))
        break

Measured memory_bytes: 18524
n, m, x = map(int, input().split())
cl = []
al = []

for _ in range(n):
    c, *a = map(int, input().split())
    cl.append(c)
    al.append(a)

ans = float('inf')
for i in range(2 ** n):
    sum = 0
    l = [0] * m
    flg = False

    for j in range(n):
        if i >> j & 1:
            sum += cl[j]
            for k in range(m):
                l[k] += al[j][k]

    for e in l:
        if e < x:
            flg = True
            break

    if not flg:
        ans = min(ans, sum)

print(-1 if ans == float('inf') else ans)

Measured memory_bytes: 73748
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>

using namespace std;

int a, b, c;

int main() {
	scanf("%d %d %d", &a, &b, &c);
	printf("%d", (int)ceil(a * 1.0 / b) * c);
	return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  int b = 0;
  vector<tuple<char, int, int>> V;
  int Q;
  cin >> Q;
  for (int i = 0; i < Q; i++) {
    int T;
    cin >> T;
    if (T == 2) {
      int F;
      char C;
      cin >> F >> C;
      if (F == 1) {
        V.push_back(make_tuple(C, 0, b));
      } else {
        V.push_back(make_tuple(C, 1, b));
      }
    } else {
      b = (b == 0) ? 1 : 0;
    }
  }
  string L = "", R = "";
  for (int i = 0; i < V.size(); i++) {
    if (get<1>(V.at(i)) + get<2>(V.at(i)) == 2 || get<1>(V.at(i)) + get<2>(V.at(i)) == 0) {
      L += get<0>(V.at(i));
    } else {
      R += get<0>(V.at(i));
    }
  }
  reverse(L.begin(), L.end());
  S = L + S + R;
  if (b) reverse(S.begin(), S.end());
  cout << S << "\n";
}

Measured memory_bytes: 5060
//============================================================================
// Name        : sample.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include<iostream>
using namespace std;

int main() {
	int a, b;
	char op;
	while (true) {
		cin >> a >> op >> b;
		if (op == '?')
			break;
		switch (op) {
		case '+':
			cout << a + b << endl;
			continue;

		case '-':
			cout << a - b << endl;
			continue;

		case '*':
			cout << a * b << endl;
			continue;

		case '/':
			cout << a / b << endl;
			continue;
		}
	}
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <climits>

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

const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(2000005);

mint g(int r, int c) {
	return comb(r + c + 2, r + 1) - 1;
}

queue<long long> ue;
long pp = 0;
long k;
void check()
{
	for (int i = 1; i <= 9; i++)
	{
		ue.push(i);
	}
	k -= 9;
	while (true)
	{
		long long v = ue.front();
		ue.pop();
		int shita = v % 10;
		if (shita == 0)
		{
			if (k <= 2)
			{
				cout << (v * 10 + (((long long)k - 1) + shita));
				break;
			}
			else
			{
				k -= 2;
			}
			ue.push(v * 10 + 0);
			ue.push(v * 10 + 1);
		}
		else if(shita == 9)
		{
			if (k <= 2)
			{
				cout << (v * 10 + (((long long)k - 2) + shita));
				break;
			}
			else
			{
				k -= 2;
			}
			ue.push(v * 10 + 8);
			ue.push(v * 10 + 9);
		}
		else
		{
			if (k <= 3)
			{
				cout << (v * 10 + (((long long)k - 2) + shita));
				break;
			}
			else
			{
				k -= 3;
			}
			ue.push(v * 10 + shita - 1);
			ue.push(v * 10 + shita);
			ue.push(v * 10 + shita + 1);
		}
	}
}

int main()
{
	cin >> k;

	if (k <= 9)
	{
		cout << k;
	}
	else
	{
		check();
	}
}


Measured memory_bytes: 32000
//#include "bits/stdc++.h"

#include <iostream>
#include <array>
// #include <map>
// #include <string>
// #include <algorithm>
// #include <numeric>
// #include <limits>

using namespace std;

struct Dir{
	int i;
	int j;
	Dir(int _i, int _j) : i(_i), j(_j) {
	}
};

array<array<char, 8>, 8> cloth; // [i][j]
array<Dir, 8> dirs = {
	//Dir( 0, 0),
	Dir( 1, 0),
	Dir(-1, 0),
	Dir( 0, 1),
	Dir( 1, 1),
	Dir(-1, 1),
	Dir( 0,-1),
	Dir( 1,-1),
	Dir(-1,-1)
};

inline bool inRange(int i, int j) {
	if (i < 0 or 8 <= i) {
		return false;
	}
	if (j < 0 or 8 <= j) {
		return false;
	}
	return true;
}

int turnLine(int i, int j, int c, Dir d) {
	int count = 0;
	i += d.i;
	j += d.j;
	while (inRange(i, j)) {
		if (cloth[i][j] == c) {
			return count;
		}
		if (cloth[i][j] == '.') {
			break;
		}
		count++;
		i += d.i;
		j += d.j;
	}
	return 0;
}

void turnLineReal(int i, int j, int c, Dir d, int count) {
	cloth[i][j] = c;
	for (int k = 0; k < count; k++) {
		i += d.i;
		j += d.j;
		cloth[i][j] = c;
	}
}

int put(int i, int j, char c) {
	if (cloth[i][j] != '.') {
		return 0;
	}
	int count = 0;
	for (auto d : dirs) {
		count += turnLine(i, j, c, d);
	}
	return count;
}

void putReal(int i, int j, char c) {
	for (auto d : dirs) {
		int count = turnLine(i, j, c, d);
		turnLineReal(i, j, c, d, count);
	}
}

bool mami() {
	int m = 0; // max
	int put_i;
	int put_j;
	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 8; j++) {
			int p = put(i, j, 'o');
			if (m < p) {
				m = p;
				put_i = i;
				put_j = j;
			}
		}
	}
	if (m == 0) {
		return false;
	}
	putReal(put_i, put_j, 'o');
	return true;
}

bool bebe() {
	int m = 0; // max
	int put_i;
	int put_j;
	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 8; j++) {
			int p = put(i, j, 'x');
			if (m <= p) {
				m = p;
				put_i = i;
				put_j = j;
			}
		}
	}
	if (m == 0) {
		return false;
	}
	putReal(put_i, put_j, 'x');
	return true;
}

void print() {
	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 8; j++) {
			cout << cloth[i][j];
		}
		cout << endl;
	}
}

int main() {
	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 8; j++) {
			cin >> cloth[i][j];
		}
	}
	bool flg = true;
	while (flg) {
		flg = false;
		flg = mami() or flg;
		//std::cout << "debug mami end" << std::endl; // debug
		//print();
		flg = bebe() or flg;
		//std::cout << "debug bebe end" << std::endl; // debug
		//print();
	}
	//std::cout << "debug " << std::endl; // debug
	print();
	//std::cout << "\e[38;5;0m\e[48;5;40m --- end ---  \e[m" << std::endl; // debug
	return 0;
}

Measured memory_bytes: 3072
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
#include <ext/numeric>
using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
      cin>>arr[i];
      ans = ans^arr[i];
    } 

    for(int i=0; i<n; i++) {
        cout<<(arr[i]^ans)<<" ";
    }
    cout<<endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 5208
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define t ll t;cin>>t;while(t--)
#define nn cout<<endl;
int main()
{
	ll n;
	cin>>n;
	ll a[n+1],b[n+1];
	for(ll i=0;i<n;i++) cin>>a[i];
	for(ll i=0;i<n;i++)
	{
		ll x; cin>>x;
		b[i]=a[i]-x;
	}
	ll y=0;
	for(ll i=0;i<n;i++)
	{
		if(b[i]>=0) y+=b[i];
	}
	cout<<y<<endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	int N;
	cin >> N;
	vector<ll> sum(N + 1);
	sum[0] = 0;
	REP(i, N) {
		ll a;
		cin >> a;
		sum[i + 1] = sum[i] + a;
	}
	ll res = INT64_MAX;
	REP(i, N - 1) {
		res = min(res, abs(sum[i + 1] - (sum[N] - sum[i + 1])));
	}
	cout << res << "\n";

	return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String[] s = stdR.readLine().split(" ");
        int N = Integer.parseInt(s[0]);
        int K = Integer.parseInt(s[1]);
        double percent = 0d;
        for(int i = 1 ; i <= N ; i++) {
            int point = i;
            int turn = 0;
            while(point < K) {
                turn++;
                point *= 2;
            }
            percent += 1 / (Math.pow(2, turn) * N);
        }
        System.out.println(percent);
    }
}


Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
main() {
    char s[105];
    scanf(" %s",s);
    if(strlen(s)<4) printf("No");
    else {
        if(s[0]=='Y' && s[1]=='A' && s[2]=='K' && s[3]=='I') printf("Yes");
        else printf("No");
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
using namespace std;
int n;
int P[24];

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >>n;
    rep(i,n) cin >> P[i];
    int cnt=0;
    rep(i, n){
        int a = P[i];
        int b = P[i+1];
        int c = P[i+2];
        if (c==0) break;
        if(((a<b)&(b<c))|((a>b)&(b>c))) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int top, S[1000];
void push(int x) {
	S[++top] = x;
}
int pop() {
	top--;
	return S[top + 1];
}
int main() {
	int a, b;
	top = 0;
	char s[100];

	while (scanf("%s", s) != EOF) {
		if (s[0] == '+') {
			a = pop();
			b = pop();
			push(a + b);
		}
		else if (s[0] == '-') {
			b = pop();
			a = pop();
			push(a - b);
		}
		else if (s[0] == '*') {
			a = pop();
			b = pop();
			push(a * b);
		}else{
			push(atoi(s));
		}
	}

	printf("%d\n", pop());
	return 0;
}



Measured memory_bytes: 2052
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void){

  int N,M;
  scanf("%d %d", &N, &M);

  int p=M/N,ans=1;

  while(p>0){
    if(M%p==0 && N*p<=M){
      printf("%d\n", p);
      return 0;
    }
    p--;
  }

  return 0;
}



Measured memory_bytes: 128
import sys
N = int(input())
if N == 2:
  print(2)
  sys.exit()
n = N-1
Flag = True
while Flag:
  n += 1
  for i in range(2,int(n**0.5)+1):
    if n%i == 0:
      break
    if i == int(n**0.5) and n%i != 0:
      Flag = False
  
print(n)

Measured memory_bytes: 9376
#include <iostream>
using namespace std;
int main() 
{
	int m, f, r;
	while(1) {
		cin >> m >> f >> r;
		if(m == -1 && f == -1 && r == -1) {
            		break;
		}
		if(m == -1 || f == -1) {
            		cout << "F" << endl;
		}
		else if(m + f >= 80) {
            		cout << "A" << endl;
		}
		else if(m + f >= 65 && m + f < 80) {
            		cout << "B" << endl;
		}
		else if(m + f >= 50 && m + f < 65) {
            		cout << "C" << endl;
		}
		else if(m + f >= 30 && m + f < 50) {
            		if(r < 50) {
            			cout << "D" << endl;
            		}
            		else {
            			cout << "C" << endl;
            		}
		}
		else if(m + f < 30) {
            		cout << "F" << endl;
		}
	}
	return 0;
}


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

int main(){

        string s;
        cin>>s;
        
        
        long long ans=0;
        
        for(int i=0 ; i<s.size() ; i++)
            ans+=(s[i]-'0');
        
        
        if(ans%9==0)
            cout<<"Yes"<<endl;
        
        else
            cout<<"No"<<endl;





}


Measured memory_bytes: 3736
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

act=sum(B)-sum(A)
if act<0:
    print("No")
else:

    cnt=0
    for a,b in zip(A, B):
        if a<=b:
            cnt+=int((b-a+1)/2)
    if cnt<=act:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 4596
#include<cstdio>
#include<iostream>
using namespace std;
int box[100050];
int red[100050];
int main()
{
    int m,n,l,r,ans=0;
    scanf("%d%d",&n,&m);
    for(l=1;l<=n;l++)
        box[l]=1;

    red[1]=1;

    while(m--)
    {
        scanf("%d%d",&l,&r);
        if(red[l]==1)
        {
            red[r]=1;
            box[r]++;
            box[l]--;
            //printf("%d %d\n",l,box[l]);
            if(box[l]==0)
            {
                red[l]=0;
            }
            continue;
        }
        box[r]++;
        box[l]--;
    }
    for(m=1;m<=n;m++)
        if(red[m])
           ans++;
    printf("%d",ans);
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  string count = "Three";
  for(int i; i<n; i++){
    string color;
    cin >> color;
    if(color == "Y"){
      count = "Four";
      break;
    }
  }
  cout << count << endl;
      
}


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

class Main {

	void solve() {
		
		HashSet<Integer> set = new HashSet<>();
		set.add(inint());
		set.add(inint());
		set.add(inint());
		out.println(set.size());
		
	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}

	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

	public char[][] incharmap(int h, int w) {
		char[][] a = new char[h][w];
		for (int i=0; i<h; i++) {
			String temp = in.next();
			for (int j=0; j<w; j++) {
				a[i][j] = temp.charAt(j);
			}
		}
		return a;
	}

}

Measured memory_bytes: 21204