akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <locale>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

ll factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
    }
    return ans;
}

ll extended_factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
        ans %= (ll)(1e9+7);
    }
    return ans;
}

vector<ll> Eratosthenes(ll N){
    bool arr[N+1];
    //initialization
    arr[0] = false;
    arr[1] = false;
	for(ll i = 2; i < N+1; i++){
		arr[i] = true;
	}
    //eratosthenes
	for(ll i = 2; i <= sqrt(N); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = false;//not prime number
			}
		}
	}
    vector<ll> prime;
    llRep(i,N){
        if (arr[i]==true){
            prime.push_back(i);
        }
    }
    return prime;
}

ll gcd(ll a, ll b){
  ll temp;
	while (a % b != 0){
		temp = b;
		b = a % b;
		a = temp;
	}
	return b;
}

ll lcm(ll a, ll b){
  return a * b / gcd(a,b);
}

char alphabet[] = {
    'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
};


int main(){
    int get[100002]={};
    int N,a,K,Q;
    cin >> N >> K >> Q;
    rep(i,Q){
        cin >> a;
        get[a-1] ++;
    }
    rep(i,N){
        // cout << "(K - (Q - get[i])) = " << (K - (Q - get[i])) << " ";
        if ( (K - (Q - get[i])) <= 0 ){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 1024
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

using Graph = vector< vector<int> >;
int deg[100010];

int solve(Graph &G, int cur, int par=-1) {
    int ret = 0;

    bool appear_zero = false;
    for(auto to : G[cur]) {
        if(to == par) continue;
        int val = solve(G, to, cur);
        
        if(val != 0) ret += val;
        else {
            if(!appear_zero) {
                appear_zero = true;
            }
            else {
                ret++;
            }
        }
    }

    return ret;
}

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

    Graph G(N);
    for(int i=0; i<N-1; i++) {
        int u, v; cin >> u >> v;
        deg[u]++; deg[v]++;
        G[u].push_back(v);
        G[v].push_back(u);
    }

    int root = -1, max_deg = 0;
    for(int i=0; i<N; i++) {
        if(max_deg < deg[i]) {
            max_deg = deg[i];
            root = i;
        }
    }

    cout << max(1LL, solve(G, root)) << endl;
    return 0;
}

Measured memory_bytes: 14208
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    T = input().replace("?", "D")
    print(T)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9200
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Integer.parseInt;

/**
 * Selecting Subjects
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		int sum = 0;
		int min1 = 101, min2 = 101;

		for (int i = 0; i < 6; i++) {
			int n = parseInt(br.readLine());
			sum += n;
			if (i < 4) {
				min1 = Math.min(min1, n);
			} else {
				min2 = Math.min(min2, n);
			}
		}

		System.out.println(sum - min1 - min2);
	}
}

Measured memory_bytes: 24284
#include <iostream>
int main()
{
  int W, H, x, y, r;
  std::cin >> W >> H >> x >> y >> r;
  if(x - r >= 0 && x + r <= W){
    if(y - r >= 0 && y + r <= H) std::cout << "Yes\n";
    else std::cout << "No\n";
  } else std::cout << "No\n";
  return (0);
}

Measured memory_bytes: 1128
import java.util.*;
public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> List = new ArrayList<>();
        int N = sc.nextInt();
        for(int i=0;i<N;i++){
            int num = sc.nextInt();
            int b_num = num - (i+1);
            List.add(b_num);
        }
        Collections.sort(List);
        int mid = List.get((int)Math.ceil(N/2));
        long sum = 0;
        for(int i=0;i<List.size();i++) sum+= Math.abs(List.get(i)-mid);
        System.out.println(sum);
    }
}

Measured memory_bytes: 94044
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=sum(b)
for i in range(n-1):
  if a[i+1]==a[i]+1:
    ans+=c[a[i]-1]
print(ans) 

Measured memory_bytes: 9172
//     _/    _/  _/                        _/                
//    _/    _/      _/_/_/      _/_/_/  _/_/_/_/    _/_/_/   
//   _/_/_/_/  _/  _/    _/  _/    _/    _/      _/    _/    
//  _/    _/  _/  _/    _/  _/    _/    _/      _/    _/     
// _/    _/  _/  _/    _/    _/_/_/      _/_/    _/_/_/ 
// C++ Conpetitive Programming Template 
// Ver 1.0 (code name:Hinata)
// Last Modified : 2019-05-27
// Created       : 2019-05-27
// Auther        : shirataki3
#include <bits/stdc++.h>
using namespace std;
// typename alias
template <class T> using vec = vector<T>;
template <class T, class U> using vep = vec<pair<T,U> >;
template <class T> using PQ = priority_queue<T>;
using ll = long long;
using vll = vec<ll>;
using pll = pair<ll, ll>;
using vpll = vec<pll>;
using str = string;

// const
static const long long INF = 1LL<<59;
static const long long MOD = (ll)1e9+7;
static const double PI = 3.14159265358979323846;

// accelerate stdin, stdout
#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
// repeat macro
#define FOR(i, a, b) for(ll (i)=(a);(i)<=(b);i++)
#define rFOR(i, a, b) for(ll (i)=(b);(i)>=(a);i--)
#define REP(i, n) for(ll i=0;i<n;i++)
// vector macro
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort(WHOLE(v))
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse(WHOLE(v))
#define FOLDL(src, dst, lambda) partial_sum(WHOLE(src), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum(WHOLE(src), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate(WHOLE(v), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}

void solve() {
    ll A, P;
    cin >> A >> P;
    ll p = 3 * A + P;
    out(p/2);
}

int main() {
    fast_io;
    cout << setprecision(20) << fixed;
    solve();
    return 0;
}

Measured memory_bytes: 256
// 2014/08/30 Tazoe

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

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

		if(N==0)
			break;

		string c;
		cin >> c;

		int n[10] = {0};
		int m = 0;

		for(int i=0; i<100; i++){
			n[i%N]++;

			if(c[i]=='S'){
				m += n[i%N];
				n[i%N] = 0;
			}
			else if(c[i]=='L'){
				n[i%N] += m;
				m = 0;
			}
		}

		sort(n, n+N);

		for(int i=0; i<N; i++){
			cout << n[i] << ' ';
		}
		cout << m << endl;
	}

	return 0;
}

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

using namespace std;

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

  int plan_a = N * A;
  int plan_b = B;

  if(plan_a >= plan_b){
    cout << plan_b << endl;
  }
  else{
    cout << plan_a << endl;
  }
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	//ios_base::sync_with_stdio(false);
	bool ans=false;
	string s;

	cin >> s;
	ans = (s.find("AC") != string::npos);

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

	return 0;
}


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

int main () {
  int k;cin>>k;
  string s;cin>>s;
  long long a = s.size();
  if(a < k+1){
    cout<<s<<endl;
  }else{
    for(int i=0;i<k;i++){
      cout<<s.at(i);
    }
    cout<<"..."<<endl;
  }
return 0;

}


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

using namespace std;

int n, m, par[200005], si[200005];

int find(int a) {
	return par[a] == a ? a : par[a] = find(par[a]);
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++) {
		par[i] = i;
		si[i] = 1;
	}
	while (m--) {
		int ta, tb;
		scanf("%d%d", &ta, &tb);
		ta = find(ta);
		tb = find(tb);
		if (ta == tb)
			continue;
		si[ta] += si[tb];
		par[tb] = ta;
	}
	int ans = 0;
	for (int i = 1; i <= n; i++)
		ans = max(ans, si[find(i)]);
	printf("%d\n", ans);
}

Measured memory_bytes: 5620
from sys import stdin
import sys
import numpy as np
import collections
from functools import cmp_to_key
import heapq
sys.setrecursionlimit(100000)

##  input functions for me
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def rip(sep = ''):
    if sep == '' :
        return map(int, input().split()) 
    else: return map(int, input().split(sep))
def ria(sep = ''): 
    return list(rip(sep))
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##
def main():
    N = ri()
    P = [N+1,N+1] + ria() + [N+1,N+1]

    ord = []
    for i in range(2,N+2):
        ord.append((P[i], i))

    ord = sorted(ord) # P[i], i , P[i]順でソート

    # ..AsssBssCssDsssE.. のようになっている（Cが自分 A,B,D,E>C，s<C）
    # CからA,B,D,Eのインデクスを知りたいので，Cより小さい区間は連結にして置き，
    # スキップできるように各連結成分の両端に情報を乗せておく
    #  union-findで管理してもいいが，アクセスする場所と回数が限られているので配列で管理できる
    tot = 0
    l = [i for i in range(N + 4)]
    r = [i for i in range(N + 4)]
    used = [False] * (N + 4)
    for v, idx in ord:
        # 左右がusedならマージする
        used[idx] = True
        if used[idx - 1]:
            l[idx] = l[idx - 1]
        if used[idx + 1]:
            r[idx] = r[idx + 1]
        r[l[idx]] = r[idx]
        l[r[idx]] = l[idx]

        l0 = l[idx] - 1
        r0 = r[idx] + 1
        l1 = l0 - 1 if not used[l0 - 1] else (l[l0-1] - 1)
        r1 = r0 + 1 if not used[r0 + 1] else (r[r0+1] + 1)
        #print(l1,l0,idx,r0,r1)

        if l1 != 0:
            rseg = r0 - idx
            lseg = l0 - l1
            tot += lseg * rseg * v
        if r1 != N + 3:
            rseg = r1 - r0
            lseg = idx - l0
            tot += lseg * rseg * v

    print(tot)




if __name__ == "__main__":
    main()


Measured memory_bytes: 36220
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 入力
		int n = sc.nextInt();// N回

		// 計算
		double p = 1;
		for(int i = 0; i < n; i++){
			p = (p * (i + 1))%(pow(10 ,9) + 7);
		}

		// 出力
		System.out.println((int)p);

	}
}


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

int main() {
  int a,b;
  cin >>a >>b;
  int sum = 0;
  
  for(int i=0; i<2;i++){
    if(a>=b){
      sum+=a;
      a--;
    }
    else{
      sum+=b;
      b--;
    }
  }
  
  printf("%d\n",sum);
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long; 
int main(){
  long long N;
  ll money=1000;
  ll result;
  ll l=0;
  long long k=0;
  cin>>N;
  vector<long long> vec(N);
  for(long long i=0;i<N;i++){
    cin>>vec.at(i);
  }
  for(long long i=0;i<N-1;i++){
    
    if(vec.at(i)<vec.at(1+i)){
      
      k+=money/vec.at(i);
      l=money/vec.at(i);
      
      
      money-=l*vec.at(i);
     
      
      
    }
    if(vec.at(i)>vec.at(1+i)){
      money=money+k*vec.at(i);
      result=money;
      k=0;
      
    }
    
  }
  money+=vec.at(N-1)*k;
  if(money<result){
    cout<<result<<endl;
  }
  else{
    cout<<money<<endl;
  }
  
}
    
    
    


Measured memory_bytes: 3632
#include <iostream>
#include <cstring>

using namespace std;

int main()
{
	int n, m;
	int sim[1000];
	
	while( cin >> n >> m, (n||m))
	{
		int cnt = 1, rem = n;
		memset( sim, 0, sizeof(sim));
		
		for(int i = 1 ;  ; i++)
		{
			if( i > n )
				i = 1;
				
			if( sim[i] != 1)
			{
				if( rem == 1 )
				{
					cout << i << endl;
					break;	
				}
				
				if( cnt == m )
				{
					sim[i] = 1;
					cnt = 0;
					rem--;
				}
				
				cnt++;
			}
		}
	}
	
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

map<ll,ll> M;

int main(){
  ll N,A,C=0;
  cin >> N;
  rep(i,N){
    cin >> A;
    M[A]++;
  }
  for(auto P : M){
    if(P.second>0 && P.second%2==1){
      C++;
    }
  }
  cout << C << endl;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000010;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
typedef pair<int, int> pint;
ifstream ifs("2152_input.txt");
ofstream ofs("op.txt");
void solve(int N){
    map<pint, int> disk;//disk[[l, r)] = id;
    char q; int t, w; bool accessed = false;
    rep(casenum, N){
        cin >> q >> t;
        if(q == 'W'){
            cin >> w;
            int crr = 0;
            accessed = true;
            for(const auto& k : disk){
                if(k.first.first - crr > 0){
                    int r = min(k.first.first, crr + w);
                    disk[pint(crr, r)] = t;
                    w -= r - crr;
                }
                crr = k.first.second;
                if(w <= 0) break;
            }
            if(w > 0) disk[pint(crr, crr + w)] = t;
        }else if(q == 'D'){
            auto it = disk.begin();
            while(it != disk.end()){
                if(it->second == t) disk.erase(it++);
                else it++;
            }
        }else{
            auto lb = disk.upper_bound(pint(t, INF));
            if(lb != disk.begin()) lb--;
            pint temp = lb->first;
            if(temp.first <= t && t < temp.second && accessed)
              cout << lb->second << endl;
            else
              cout << "-1" << endl;
        }
        
    }
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while(cin >> n && n){
        solve(n);
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3300
#include <bits/stdc++.h>
#define range(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
using namespace std;
int main(void){
    int a, b, c; cin >> a >> b >> c;
    int t = 0;
    int res = 0;
    vector<vector<int>> visited(121, vector<int>(2, 0));
    visited[0][0] = 1;
    bool ok = false;

    while(1){
        int nt = t;
        nt += a;
        res += a;
        if((t <= c      and c      <= nt) or
           (t <= c + 60 and c + 60 <= nt)){
            res -= (nt - c) % 60;
            ok = true;
            break;
        }
        nt %= 60;
        if(visited[nt][1] != 0) break;
        visited[nt][1] = 1;

        t = nt;
        nt += b;
        res += b;
        nt %= 60;
        if(visited[nt][0] != 0) break;
        visited[nt][0] = 1;

        t = nt;
    }

    if(not ok) res = -1;
    cout << res << endl;

	return 0;
}

Measured memory_bytes: 3180
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <time.h>
#include <complex>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;
using std::complex;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::min;
using std::max;
using std::fill;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;
typedef complex<double> cd;

namespace MySpace{
    struct Small_Segment_Tree{
        vector<int> a;
        int l, r;

        private:
        int __summ(int L, int R, int l, int r, int v)
        {
            if (L <= l && r <= R)
                return a[v];
            if (R <= l || r <= L)
                return 0;
            int m = (l + r) / 2;
            return __summ(L, R, l, m, 2 * v + 1) + __summ(L, R, m, r, 2 * v + 2);
        }

        void __set(int P, int l, int r, int v, int V)
        {
            if (l + 1 == r)
            {
                a[v] = V;
                return;
            }
            int m = (l + r) / 2;
            if (P < m)
            {
                __set(P, l, m, 2 * v + 1, V);
                a[v] = a[2 * v + 1] + a[2 * v + 2];
            }
            else
            {
                __set(P, m, r, 2 * v + 2, V);
                a[v] = a[2 * v + 1] + a[2 * v + 2];
            }
        }

        public:
        int Summ(int L, int R)
        {
            if (R < L)
                return 0;
            return __summ(L, R + 1, l, r, 0);
        }

        void Set(int P, int V)
        {
            __set(P, l, r, 0, V);
        }

        Small_Segment_Tree(int _n)
        {
            a.resize(4 * _n);
            l = 0, r = _n;
        }
    };
    long long inq(long long x, long long q, long long MOD)
    {
        if (q == 0)
            return 1;
        long long l = inq(x, q / 2, MOD);
        if (q % 2)
            return l * l % MOD * x % MOD;
        return l * l % MOD;
    }
};


using namespace MySpace;

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()
#define int long long
const ll MOD = 998244353;

int n;

signed main()
{
    ios_base::sync_with_stdio();
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    int x = 0, a = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        x ^= a;
    }
    if (x == 0)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll N;
    cin >> N;
    for (ll h = 1; h < 3501;h++){
        for (ll n = 1; n < 3501;n++){
            ll a = N * n * h;
            ll b = 4 * h * n - N * (n + h);
            if (b>0 and a%b==0) {
                cout << h << " " << n << " " << a/b << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3672
package main

import (
	"fmt"
)

func main() {
	var d, n int
	fmt.Scan(&d, &n)

	if n == 100 {
		n = 101
	}
	var ans int
	switch d {
	case 0:
		ans = 1 * n
	case 1:
		ans = 100 * n
	case 2:
		ans = 10000 * n
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
def main():
    n = int(input())
    l = [ int(input().rstrip()) for i in range(n)]

    s = {}
    for i in l:
        if i - 1 in s:
            s[i] = s[i - 1] + 1
            del s[i - 1]
        else:
            s[i] = 1
    print(n - max(s.values()))

if __name__ == '__main__':
    main()


Measured memory_bytes: 29472
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<bitset>
#include<map>
#include<queue>
#include<vector>
#include<set>
#include<iostream>
#include<string>
#define ll long long
#define N 505
#define For(i,x,y) for(int i=x;i<=y;i++)
#define Rep(i,x,y) for(int i=x;i>=y;i--)
#define Forn(i,x,y) for(int i=x;i<y;i++)
using namespace std;
int read(){int x=0,f=0;char ch=getchar();for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=1;for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+ch-48;return f?-x:x;}
void write(int x){if(x<10) putchar(x+48);else write(x/10),putchar(x%10+48);}
void writeln(int x){if(x<0) putchar('-'),x=-x;write(x);putchar('\n');}
int n,m;
char s[N][N];
int main(){
	n=read();m=read();
	For(i,1,n) scanf("%s",s[i]+1);
	For(i,1,n) if(i&1){
		For(j,1,m-1) cout<<"#";
		cout<<'.'<<endl;
	}else{
		For(j,1,m) if(s[i][j]=='#'||j==1) cout<<'#';else cout<<".";
		cout<<endl;
	}
	For(i,1,n) if(!(i&1)){
		cout<<".";
		For(j,2,m) cout<<"#";
		cout<<endl;
	}else{
		For(j,1,m) if(s[i][j]=='#'||j==m) cout<<"#";else cout<<".";
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1024
from collections import Counter
n = int(input())
a = list(int(_) for _ in input().split())
t1,t2 = [0,0],[0]
for k,v in Counter(a).items():
    if v >= 2: t1.append(k)
    if v >= 4: t2.append(k)

t1.sort()
t2.sort()
print(max(t1[-1]*t1[-2],t2[-1]**2))


Measured memory_bytes: 18600
n, m=map(int,input().split())
ans=[0]*n
h=list(map(int,input().split()))

for i in range(m):
    a,b=map(int,input().split())
    if h[a-1]==h[b-1]:
        ans[a-1]-=1
        ans[b-1]-=1
    elif h[a-1]<h[b-1]:
        ans[a-1]-=1
    else:
        ans[b-1]-=1

print(ans.count(0))

Measured memory_bytes: 20892
#include <bits/stdc++.h>
using namespace std;
using P = complex<double>;

namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

double cross(const P& a, const P& b) {
  return imag(conj(a) * b);
}

double area2(const vector<P> p) {
  P a { p[1] - p[0] };
  P b { p[2] - p[0] };
  return abs(cross(a, b));
}

int main() {
  vector<P> p(3);
  for (int i = 0; i < 3; i++) {
    double x, y; cin >> x >> y;
    p[i] = { x, y };
  }
  double ls {}, lmx {};
  auto m = [](int x) { return x % 3; };
  for (int i = 0; i < 3; i++) {
    double l { abs(p[m(i + 1)] - p[m(i)]) };
    ls += l;
    lmx = max(lmx, l);
  }
  double r { area2(p) / ls };
  cout << fixed << setprecision(10) << lmx * r / (lmx + 2.0 * r) << endl;
  return 0;
}


Measured memory_bytes: 256
n,k=list(map(int,input().split(" ")))
i=0
if k%2==1:
    i=1
    num1=0
    while i<=n:
        if i%k==0:
            num1+=1
        else:
            pass
        i+=1
    print(num1**3)
else:
    i=1
    num2=0
    num3=0
    while i<=n:
        if i%k==0:
            num2+=1
        elif i%k==k/2:
            num3+=1
        else:
            pass
        i+=1
    print(num2**3+num3**3)

Measured memory_bytes: 3064
def binary(n):
    l = [0] * 40#n<10^12<2^40
    for i in range(39,-1,-1):
        if n >= 2 ** i:
            l[i] = 1
            n = n - 2 ** i
        else:
            l[i] = 0
    
    return l#返り値はリストであることに注意

def xor_plus(l1,l2):#引数はリストであることに注意
    l = [0] * 40
    for i in range(0,40):
        if l1[i] == l2[i]:
            l[i] = 0
        else:
            l[i] = 1
    return l#返り値はリストであることに注意

def xor_sum(n):
    result = [0] * 40
    if n % 4 == 1:
        result[0] = 1
    elif n % 4 == 0:
        result = binary(n)
    elif n % 4 == 2:
        result = xor_plus(binary(1),binary(n))
        
    return result

a, b = map(int, input().split())

fa = xor_sum(a-1)
fb = xor_sum(b)
#print([fa,fb])
fab = xor_plus(fa,fb)

x = 0

for i in range(0,40):
    x = x + fab[i] * (2 ** i)
    
print(x)



Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BABC solver = new BABC();
        solver.solve(1, in, out);
        out.close();
    }

    static class BABC {
        static final char A = 'A';
        static final char B = 'B';
        static final char C = 'C';

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            char[] s = in.next().toCharArray();
            int n = s.length;

            int countAs = 0;
            long answer = 0;
            for (int i = 0; i + 1 < n; i++) {
                if (s[i] == A) {
                    countAs++;
                    continue;
                }
                if (s[i] == B && s[i + 1] == C) {
                    answer += countAs;
                    i++;
                    continue;
                }
                countAs = 0;
            }

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

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

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

    }
}



Measured memory_bytes: 25300
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int imos[1111][1111];
  memset(imos,0,sizeof(imos));
  for(int i=0;i<n;i++){
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    imos[x1][y1]++;
    imos[x1][y2]--;
    imos[x2][y1]--;
    imos[x2][y2]++;
  }
  for(int i=0;i<1100;i++)
    for(int j=0;j<1100;j++)
      imos[i][j+1]+=imos[i][j];
  for(int j=0;j<1100;j++)
    for(int i=0;i<1100;i++)
      imos[i+1][j]+=imos[i][j];
  int ans=0;
  for(int j=0;j<1100;j++)
    for(int i=0;i<1100;i++)
      ans=max(ans,imos[i][j]);
  cout<<ans<<endl;
  return 0;
}

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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef long long ll; typedef vector<int> VI; typedef pair<ll,int> pii;
const ll mod = 1e9+7;


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

	int n;
	string s;
	cin >>n >> s;
	
	int ct=0, bf=0;
	rep(i,n){
		if(s[i]=='(') ct++;
		else{
			if(ct> 0) ct--;
			else bf++;
		}
	}
	
	cout << string(bf, '(') + s + string(ct, ')')<<"\n";
	return 0;
}




Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(" ");
        var N = long.Parse(input[0]);
        var K = long.Parse(input[1]);

        var rem = N % K;
        if (rem == 0) Console.WriteLine(0);
        else
        {
            if (rem < Math.Abs(rem - K)) Console.WriteLine(rem);
            else Console.Write(Math.Abs(rem - K));
        }
    }
}



Measured memory_bytes: 27136
/*Shivam Bhalla */
  /* f2016941@pilani.bits-pilani.ac.in */


  #include <iostream>
  #include <cstdio>
  #include <cstring>
  #include <cstdlib>
  #include <cctype>
  #include <algorithm>
  #include <map>
  #include <vector>
  #include <list>
  #include <set>
  #include <queue>
  #include <deque>
  #include <stack>
  #include <iostream>
  #include <string>
  #include <cmath>
  #include <cassert>
  #include <bits/stdc++.h>
  #define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
  using namespace std;
  long long maxv = 1e9+7;


  int main()
  {
      string str;
      cin>>str;
      int total=0;
      int n=str.length();
      for(int i=0;i<n/2;i++){
        if(str[i]!=str[n-1-i])
            total++;
      }
      cout<<total;
      return 0;
  }


Measured memory_bytes: 256
let sx, sy, tx, ty = Scanf.scanf " %d %d %d %d" @@ fun a b c d -> a, b, c, d
let dx, dy, f = tx - sx, ty - sy, print_string
let g e c = if e = 1 then f c
let h n c = f @@ String.make n c
let _ = for e = 0 to 1 do g e "L"; h (dy + e) 'U'; h (dx + e) 'R'; g e "D"; g e "R"; h (dy + e) 'D'; h (dx + e) 'L'; g e "U" done

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
long long int gcd(long long int a,long long int b) { return b?gcd(b,a%b):a;}
int main()
{
    int K;
    cin >> K;
    ll ans = 0;
    for(int i = 1;i <= K;i++)
    {
        for(int j = 1;j <= K;j++)
        {
            for(int k = 1;k <= K;k++)
            {
                ans += gcd(i,gcd(j,k));
            }
        }
    }
    cout << ans << "\n";
    
    return 0;
}

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

using namespace std;
#define int long long
#define all(a) (a).begin(), (a).end()
#define ms(a,v) memset(a, v, sizeof(a))
#define sz(v) ((int)(v).size())
#define mp make_pair
#define pb push_back
#define prev biiiiirl_sai_de_casa_comi_pra_caralho
#define next trapezio_descendente
#define index eh_ele_que_nos_vai_buscar
#define left aqui_eh_37_anos_porra
#define R32 ({int32_t x; scanf("%d", &x); x;})
#define RL ({long long x; scanf("%lld", &x); x;})
#define RC ({char x; scanf(" %c", &x); x;})
#define RI RL
#define ff first
#define ss second
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef long long ll;

int32_t main(){
  int n = RI;
  int a[n+2], sum[n+2];
  ms(a, 0);
  ms(sum, 0);

  for(int i = 1; i <= n; i++){
    a[i] = RI;
  }
  sort(a+1, a+n+1);
  for(int i = 1; i <= n; i++){
    sum[i] = sum[i-1] + a[i];
  }

  a[n+1] = 0;
  int ans = 0;
  for(int i = n; i; i--){
    if(sum[i]*2 >= a[i+1])
      ans++;
    else break;
  }

  cout << ans << endl;
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
    int a[100][100],b[100],n,m,c[100];
    cin>>n>>m;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<m;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
           c[i]+=a[i][j]*b[j];
        }
        cout<<c[i]<<endl;
    }
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxN = 2e5+7;
const int maxV = 90010;
//const int INF = 1e9+9;
//const ll INF = (1ll)<<60;
const int INF = 2e9+9;
const int MOD = 1e9+7;

int n,m;


char s[maxN];
int a[maxN];

ll pow_(ll x,ll p)
{
	if(p == 0)
		return 1;
	ll t = pow_(x,p/2);
	t = t*t%MOD;
	if(p%2 == 1)
		t = t*x%MOD;
	return t;
}
int main()
{
	scanf("%s",s+1);
	int n = strlen(s+1);
	int cnt = 0;
	for(int i=1;i<=n;i++)
	{
		if(s[i] == '1')
		{
			a[i] = 1;
		}
	}
	ll ans = 0;
	a[0] = 0;
	for(int i=1;i<=n;i++)
		a[i] = a[i-1]+a[i]; 
	ans = pow_(3,n-1);
	for(int i=1;i<=n;i++)
	{
		int x = a[i-1];
		if(i>1 && s[i] == '1')
			ans = (ans+pow_(2,x)*pow_(3,n-i)%MOD)%MOD;
	}
	ans = (ans + pow_(2,a[n]))%MOD;
	cout<<ans<<endl;
	return 0;
}

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

#define ll long long

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

    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
    	cin>>a[i];
    sort(a,a+n);
    ll ans = 0;

    for(int i=0;i>=0 && i<(n-k);i++)
    	ans += a[i];
    cout<<ans;
}

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

namespace Atcoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        private static void print(object obj) { Console.WriteLine(obj); }

        static void Main(string[] args)
        {
           var a =  ReadInts();
            var b = a[0] % a[1];
            if(b > 0)
            {
                print(1);
            }
            else

            print(b);
        }



    }
}

Measured memory_bytes: 11092
//
// Created by Myabu on 2020/01/10.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <numeric>

using namespace std;


int main(void){
    string S, T;
    cin>>S>>T;
    
    cout<<T<<S<<endl;


    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-8;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T& a, T b, bool equal = false){
    if(a < b || equal && a == b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b, bool equal = false){
    if(b < a || equal && a == b){
        a = b;
        return true;
    }
    return false;
}

int n, m;
vector< P > es;

void judge(vector<int>& depth, int l, int r){
    vector<int> s(n), t(n);
    rep(i, m){
        int u = es[i].first;
        int v = es[i].second;
        if(l <= depth[u] && depth[u] <= r && l <= depth[v] && depth[v] <= r){
            ++t[u];
            ++s[u];
        }
    }

    bool flag = true;
    vector<int> ans;
    rep(i, n){
        if(depth[i] < l || r < depth[i]){
            continue;
        }
        flag &= (s[i] == 1 && t[i] == 1);
        ans.emplace_back(i);
    }

    if(flag){
        cout << ans.size() << endl;
        rep(i, ans.size()){
            cout << ans[i] + 1 << endl;
        }
        exit(0);
    }

    return;
}

void dfs(int v, int cnt, vector<bool>&visited, vector<int>& depth, const vector< vector<int> >& g){
    visited[v] = true;
    depth[v] = cnt;

    for(auto to : g[v]){
        if(visited[to]){
            judge(depth, depth[to], cnt);
        }else{
            dfs(to, cnt + 1, visited, depth, g);
        }
    }

    depth[v] = -1;
    return;
}

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

    cin >> n >> m;

    vector< vector<int> > g(n);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        g[--a].emplace_back(--b);
        es.emplace_back(a, b);
    }

    vector<bool> visited(n, false);
    vector<int> depth(n, -1);

    rep(i, n){
        if(!visited[i]){
            dfs(i, 0, visited, depth, g);
        }
    }

    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	
	int AB = A * B;
	int CD = C * D;
	if (AB > CD)
		printf("%d\n", AB);
	else
		printf("%d\n", CD);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
#define PI 3.14159265358979323846264338327950L
const int mod=1000000007,MAX=200005,INF=1<<30;

int main() {
	int d,t,s;
  	cin>>d>>t>>s;
  
  	int dist=s*t;
  
  	if(dist>=d){
    	cout<<"Yes"<<endl;
    }
     else{
      	cout<<"No"<<endl; 
     }
    }



Measured memory_bytes: 3620
N,M=map(int,input().split())
A=[int(x) for x in input().split()]
vote={}
cum=[0 for _ in range(N)]
for i in range(N):
    cum[i]=cum[i-1]+A[i]
cummod=[x%M for x in cum]
for x in cummod:
    if x in vote:
        vote[x]+=1
    else:
        vote[x]=1
result=vote[0] if 0 in vote else 0
for k in vote:
    if vote[k]>1:
        result+=vote[k]*(vote[k]-1)/2
print(int(result))

Measured memory_bytes: 64536
#include <iostream>
using namespace std;
int main() {
  int S;
  int h = 0, m = 0, s = 0;
  cin >> S;
  while (S >= 3600) {
    h++;
    S -= 3600;
  }
  while (S >= 60) {
    m++;
    S -= 60;
  }
  s = S;
  cout << h << ":" << m << ":" << s << endl;
  return 0;
}



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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	int n, k;
	cin >> n >> k;

	int M = 0, m = 1e9;
	rep(i,k){
		int a, b;
		cin >> a >> b;
		chmax(M,a);
		chmin(m,b);
	}
	int ans = m - M + 1;
	ans = max(0,ans);
	cout << ans << endl;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#define findmax(a,b) (a)>(b)?(a):(b)
#define findmin(a,b) (a)<(b)?(a):(b)
#define inout freopen("in.txt","r",stdin);freopen("out.txt","w",stdout)
#define swap(a,b) (a)+=(b);(b)=(a)-(b);(a)-=(b)
#define quicksort(a,n) qsort(a,n,sizeof(a[0]),cmp)
#define inputarr(a,n) for(int i=0;i<n;i++){scanf("%d",&a[i]);}
#define printarr(a,n) for(int i=0;i<n;i++){printf("%d ",a[i]);}puts("");
int cmp(const void *a,const void *b){return *(int *)a - *(int *)b;}

int main(){ 
	char n[5];

	scanf("%s", n);

	char a = n[strlen(n) - 1];

	if(a == '2' || a == '4' || a == '5' || a== '7' || a== '9'){
		puts("hon");
	}
	else if(a == '3'){
		puts("bon");
	}
	else{
		puts("pon");
	}

}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
/* constant */
const int INF = 1 << 30;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
struct mint {
    ll x;
    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;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
struct combination {
    // vector size : n + 1
    vector<mint> fact, ifact;
    // precaliculation O(n)
    combination(int n):fact(n+1), ifact(n+1) {
        assert(n < mod);
        // 0! = 1;
        fact[0] = 1;
        // 1! = 0! * 1 ... n! = (n-1)! * n
        for (int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
        // 1/n! = n!^(-1)
        ifact[n] = fact[n].inv();
        // (n-1)!^(-1) = n!^(-1) * n ... 0!^(-1) = 1!^(-1) * 1
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i] * i;
    }
    // combination O(1)
    // nCk = n! / (k! * (n-k)!)
    //     = n! * k!^(-1) * (n-k)!^(-1)
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n-k];
    }
} c(2000);

mint Bell(int n, int k) {
    if (k > n) k = n;
    // \sum_{j=0}^{k-i} (-1)^j / j!
    vector<mint> jsum(k+2, 0);
    for (int j = 0; j <= k; ++j) {
        mint add = c.ifact[j];
        if (j % 2 == 0) jsum[j+1] = jsum[j] + add;
        else jsum[j+1] = jsum[j] - add;
    }
    mint res = 0;
    // B(n, k) = \sum_{i=0}^k i^n / i! * jsum[k-i+1]
    for (int i = 0; i <= k; ++i) {
        res += mint(i).pow(n) * c.ifact[i] * jsum[k-i+1];
    }
    return res;
}
/* global variables */
/* function */
/* main */
int main() {
    int n, k;
    cin >> n >> k;
    cout << Bell(n, k) << '\n';
}


Measured memory_bytes: 3144
import java.util.Scanner;
class Main{
	static int yn=0;//YES,NO→0,Yes,No→1,yes,no→2
	static Scanner scan=new Scanner(System.in);
	public static void main(String[]args) {
		/*
		 Yes,No出力→plyn(Yes→1,No→0)
		 入力→sc();void
		 */
		int a=sc();
		int ans=1;
		int waru=1;
		for(int i=0;i<a;i++) {
			int b=sc();
			ans*=3;
			if(b%2==0) {
				waru*=2;
			}
		}
		System.out.println(ans-waru);
	}
	
	public static int sc() {
		int sc=scan.nextInt();
		return sc;
	}
	public static void plyn(int a) {
		if(yn==0) {
			if(a==1) {
		System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}
		}
		else if(yn==1){
			if(a==1) {
				System.out.println("Yes");
				}
			else {
				System.out.println("No");
			}
		}
		else if(yn==2){
			if(a==1) {
				System.out.println("yes");
				}
			else {
				System.out.println("no");
			}
		}
	}
}

Measured memory_bytes: 21716