akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s;
        cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    int n,k;
    scanf("%d%d",&n,&k);
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    sort(a,a+n);

    if(k>a[n-1]){
        puts("IMPOSSIBLE");
        return 0;
    }
    if(a[0]==1){
        puts("POSSIBLE");
        return 0;
    }
    rep(i,n){
        if(a[i]==k){
            puts("POSSIBLE");
            return 0;
        }
    }

    // 最大公約数を考える

    ll kou = a[0];
    rep(i,n){
        if(kou==1){
            puts("POSSIBLE");
            return 0;
        }
        kou = __gcd(kou,a[i]);
    }

    if(k%kou==0){
        puts("POSSIBLE");
        return 0;
    }else{
        puts("IMPOSSIBLE");
        return 0;
    }


    return 0;
}
 
 


Measured memory_bytes: 1024
main :: IO ()
main = do
    ab <- fmap read . words <$> getLine :: IO [Int]
    putStrLn $ if ab!!0 == ab!!1
                  then "Draw"
                  else if ab!!0 == 1
                          then "Alice"
                          else if ab!!1 == 1
                                  then "Bob"
                                  else if ab!!0 > ab!!1
                                          then "Alice"
                                          else "Bob"

Measured memory_bytes: 508
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    let a: usize = read!();
    let mut ans:usize = 1;
    for i in 2..33 {
        let mut sum:usize = 1;
        while sum<=a {
            sum*=i;
        }
        sum/=i;
        if ans<sum&&sum!=i {
            ans=sum;
        }
    }
    println!("{}",ans)
}

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

#define N 100010
int n, a[N];

int main() {
	while (scanf("%d", &n) != EOF) {
		multiset <int> se;
		for (int i = 1; i <= n; ++i) scanf("%d", a + i);
		for (int i = 1; i <= n; ++i) {
			if (se.empty()) {
				se.insert(a[i]);
			} else {
				auto pos = se.lower_bound(a[i]);
				if (pos != se.begin()) {
					--pos;
					se.erase(pos);
				}
				se.insert(a[i]);
			}
		}
		printf("%d\n", (int)se.size());
	}
	return 0;
}


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

template<typename T, typename U>
using pv=vector<pair<T,U>>;
template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using ilpair=pair<int,ll>;
using lipair=pair<ll,int>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;

#define PI 3.141592653589793
#define INTINF ((1<<30)-1)
#define LLINF ((1LL<<62)-1)
#define MPRIME 1000000007
#define MPRIME9 998244353
#define MMPRIME ((1ll<<61)-1)

#define len length()
#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

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

template<class T>
inline void init(T& v) {
	for(auto &a: v) cin>>a;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a: v) cin>>a.first>>a.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a.first>>a.second;
}

inline void out() {
	cout<<endl;
}
template<class T, class... U>
inline void out(T a, U... alist) {
	cout<<a<<" ";
	out(forward<U>(alist)...);
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

bool isout(int h, int w, int H, int W) {
	return ( h<0 || h>=H || w<0 || w>=W );
}

ll binpow(ll a, ll ex, ll p) {
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}


string N;
int ans;

void input() {
	cin>>N;
}

void solve() {
	for(int i=0; i<N.len; i++) {
		ans += int(N[i]-'0');
	}
	if(ans%9==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(15);
	int t=1;
	while(t) {
		input();
		solve();
		t--;
	}
}


Measured memory_bytes: 3784
import sys
sys.setrecursionlimit(100000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from copy import *

s = input()
atoz = [chr(i) for i in range(97,97+26)]
ans = 10000
for c in atoz:
    cnt = 0
    t = s
    while 1:
        if len(Counter(t)) == 1:
            ans = min(ans, cnt)
            break
        td = ''
        for i in range(len(t)-1):
            if t[i] == c or t[i+1] == c:
                td += c
            else:
                td += t[i]
        t = td
        cnt += 1
print(ans)


Measured memory_bytes: 3572
/**
*    author:  y_takano
*    created: 19.06.2020 09:04:22
**/

#include <bits/stdc++.h>

using namespace std;

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

  int h, w;

  for (;;)
  {

      cin >> h >> w;

      if (h != 0 || w != 0)
      {
          for (int i = 0; i < h; i++)
          {
              for (int j = 0; j < w; j++)
              {
                  cout << '#';
              }
              cout << endl;    
          }
          cout << endl;
      }
      else
      {
          break;
      }
  }
  
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  set<int> paper;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    auto it = paper.find(a);
    if (it == paper.end())
      paper.insert(a);
    else
      paper.erase(it);
  }
  cout << paper.size();
  return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int cap, n;
    cin>>n>>cap;

    long long dp[n][cap+1];
    vector<long long> v;
    vector<long long> w;
    for(int i=0; i<n; i++){
        long long size;  long long value;
        cin>>size>>value;
        v.push_back(value);
        w.push_back(size);
    }
    for(int i=0; i<=cap; i++){
        dp[0][i] = 0;
    }
    dp[0][w[0]] = v[0];
    
    for(int i=1; i<n; i++){
        for(int x=0; x<=cap; x++){
            if(x==0){
                dp[i][x] = 0;
            }
            else{
                if(w[i]<=x){
                    if(dp[i-1][x-w[i]]||w[i]==x){
                        dp[i][x] = max(dp[i-1][x], (dp[i-1][x-w[i]]+v[i]));
                    }
                    else{
                        dp[i][x] = dp[i-1][x];
                    }
                }
                else{
                    dp[i][x] = dp[i-1][x];
                }
            }
        }
    }
    long long m=0;
    //for(int i=0; i<n; i++){for(int i1=0; i1<=cap; i1++){cout<<dp[i][i1]<<" ";}}
    for(int x=0; x<=cap; x++){
        m = max(m, dp[n-1][x]);
    }
    cout<<m;

}

Measured memory_bytes: 81620
import heapq

N,M = map(int,input().split())
A = list(map(int,input().split()))

B = []

for i in A:
    B.append(-i)

heapq.heapify(B)

for i in range(M):
    tmp = heapq.heappop(B)
    heapq.heappush(B,-1*(-tmp//2))

print(-sum(B))


Measured memory_bytes: 14180
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
	long long n, k;
	cin >> n >> k;
	long long sum = 0;
	for (long long i = k; i <= n + 1; i++) {
		//long long p = ((2 * n - i + 1) * i / 2 - (i - 1) * i / 2) % mod;
		sum = (sum + (n + 1) * i - i * i + 1) % mod;
		//sum += ((2 * n - i + 1) * i / 2 - (i - 1) * i / 2) + 1;
	} 
	cout << (sum) % mod << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
using namespace std;
int main(){
	ios::sync_with_stdio(0);
    cin.tie(0);
	int a,b;
	cin>>a>>b;
	cout<<a/b+(a%b!=0); 
	RE 0;
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] c = new char[h][w];
        char[][] g = new char[h][w];
        for (int i = 0; i < h; i++) {
            String s = sc.next();
            c[i] = s.toCharArray();
            for (int j = 0; j < w; j++) {
                g[i][j] = '.';
            }
        }

        int[] dy = {-1, 0, 0, 1};
        int[] dx = {0, -1, 1, 1};
        for (int y = 0; y < h; y++) {
            for (int x = 0; x < w; x++) {
                if (c[y][x] == '.' && g[y][x] == '.') {
                    continue;
                }
                if (c[y][x] == '#') {
                    if (g[y][x] == '.') {
                        g[y][x] = '#';
                    } else {
                        continue;
                    }
                    boolean f = false;
                    for (int i = 0; i < 4; i++) {
                        if (y + dy[i] < 0 || x + dx[i] < 0 || y + dy[i] >= h || x + dx[i] >= w) {
                            continue;
                        }
                        if (c[y + dy[i]][x + dx[i]] == '.') {
                            continue;
                        }
                        if (c[y + dy[i]][x + dx[i]] == '#') {
                            g[y + dy[i]][x + dx[i]] = '#';
                            f = true;
                            break;
                        }
                    }
                    if (!f) {
                        break;
                    }
                }
            }
        }
        for (int y = 0; y < h; y++) {
            //System.out.println(">>>"+(new String(g[y])));
            for (int x = 0; x < w; x++) {
                if (c[y][x] != g[y][x]) {
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 35912
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());



signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, k; cin >> n >> k;
  string s; cin >> s;

  char before = '1';
  int cnt = 0;
  vector<int> vec;
  rep(i, n) {
    if (s[i] != before) {
      vec.push_back(cnt);
      cnt = 1;
      before = s[i];
    } else {
      cnt++;
    }
  }
  vec.push_back(cnt);

  int size = vec.size();
  int ans = 0;
  int now = 0;
  int pos = k;
  rep(i, size) {
    now += vec[i];
    chmax(ans, now);
    if (i == 2*pos) {
      now -= vec[i-2*k];
      now -= vec[i-(2*k-1)];
      pos++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1020
using System;
using System.Linq;
using static System.Console;

static class Extensions {
   public static int ToInt(this string str) {
      return int.Parse(str);
   }
}

class Program {
   public static void Main(string[] args) {
      var tarr = ReadLine().Split(' ').Select(x => x.ToInt()).ToArray();
      var n = tarr[0];
      var m = tarr[1];
      
      int [][] arr = new int[n][];
      for (int i = 0; i < n; i++) {
         arr[i] = ReadLine().Split(' ').Select(x => x.ToInt()).ToArray();
      }

      bool[] barr = new bool[m + 1];
      for (int i = 0; i <= m; i++) {
         barr[i] = false;
         for (int j = 0; j < n; j++) {
            if (arr[j].Skip(1).Contains(i)) {
               continue;
            } else {
               goto label1;
            }
         }
         barr[i] = true;

         label1:
            continue;
      }
      
      WriteLine(barr.Where(x => x).Count());
   }
}


Measured memory_bytes: 13524
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <unordered_set>
#include <unordered_map>

using namespace std;

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

int main() {
  int n;
  scanf(" %d", &n);

  int m = -1;
  long long sum = 0;
  FOR (i, 1, n+1) {
    sum += i;
    if (sum >= n) {
      m = i;
      break;
    }
  }

  for (int i = m; i > 0; i--) {
    if (n >= i) {
      n -= i;
      printf("%d\n", i);
    }
  }
  
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#define k 10000

using namespace std;

void CountingSort(int a[],int b[],int n){
  int cnt[k+1];
  for(int i=0;i<=k;i++) cnt[i]=0;
  for(int i=1;i<=n;i++) cnt[a[i]]++;
  for(int i=1;i<=k;i++) cnt[i]=cnt[i]+cnt[i-1];
  for(int j=1;j<=n;j++){
    b[cnt[a[j]]]=a[j];
    cnt[a[j]]--;
  }
}

int main(){
  int n;
  cin >> n;
  int a[n+1],b[n+1];
  for(int i=1;i<=n;i++) cin >> a[i];
  CountingSort(a,b,n);
  for(int i=1;i<=n;i++){
    if(i==1) cout << b[1];
    else cout << " " << b[i];
  }
  cout << endl;
}

Measured memory_bytes: 18712
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
class UnionFind():

    def __init__(self, n):
        self.n = n
        self.node = [i for i in range(n)]
        self.size = [1 for _ in range(n)]

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

    def root(self, x):
        if self.node[x] == x:
            return x
        else:
            self.node[x] = self.root(self.node[x])  # 経路圧縮
            return self.node[x]

    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x == y:
            return  # 結合不要
        if self.size[x] < self.size[y]:
            x, y = y, x
        self.node[y] = x
        self.size[x] += self.size[y]

    def return_size(self, x):
        return self.size[self.root(x)]


n = II()
d = sorted(LI())
print(d[n//2] - d[n//2-1])


Measured memory_bytes: 79772
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace kp
{
    public class Program
    {
        //static long[,] cmb;
        static int MAX_INT = 1000000007;
        static void Main(string[] args)
        {
            //long N = long.Parse(Console.ReadLine());
            int[] input = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
            int N = input[0];
            int M = input[1];
            SortedDictionary<int, int> sd = new SortedDictionary<int, int>();
            for(int i=0; i<N; i++)
            {
                input = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
                if(sd.ContainsKey(input[0]))
                {
                    sd[input[0]] += input[1];
                }
                else
                {
                    sd.Add(input[0], input[1]);
                }
            }

            int drink = 0; //ドリンク何本買った
            long money = 0; //何円かかった
            foreach(var a in sd.Keys)
            {
                if(drink + sd[a] >= M)
                {
                    money += (long)(M - drink) * a;
                    break;
                }
                else
                {
                    drink += sd[a];
                    money += (long)a * sd[a];
                }
            }
            

            Console.WriteLine(money + "");
        }
    }
}


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

#define int long long

int n, k;

vector<int> v(109);

int memo[100009][2];

int dp(int left, int pl){
    if(left == 0){
        return 0;
    }
    if(memo[left][pl] != -1) return memo[left][pl];
    for(int i = 0; i < n; i++){
        if(left - v[i] >= 0){
            if(!dp(left-v[i], !pl)){
                return memo[left][pl] = 1;
            }
        }
    }
    return memo[left][pl] = 0;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> v[i];
    for(int i = 0; i < 100009; i++){
        for(int j = 0; j < 2; j++){
            memo[i][j] = -1;
        }
    }
    if(dp(k,1) == 1){
        cout << "First" << endl;
    }else cout << "Second" << endl;
}


Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    int n;
    cin >> n;
    string str;
    cin >> str;
    if(count(begin(str), end(str), 'R') * 2 > n){
        cout << "Yes\n";
    }else{
        cout << "No\n";   
    }
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

N = ini()
A = inl()
amax = max(A)
imax = A.index(amax)
amin = min(A)
imin = A.index(amin)


def make_positive():
    global amax, imax
    ans = []
    assert amax >= 0
    for i in range(N):
        if i > 0 and A[i] < 0:
            ans.append((imax, i))
            A[i] += amax
            assert A[i] >= 0
    for i in range(1, N):
        if A[i] < A[i - 1]:
            ans.append((imax, i))
            A[i] += amax
            assert A[i] >= A[i - 1]
            if A[i] > amax:
                amax = A[i]
                imax = i
    assert len(ans) <= 2 * N
    print(len(ans))
    for x, y in ans:
        print(x + 1, y + 1)


def make_negative():
    global amin, imin
    ans = []
    assert amin <= 0
    for i in range(N):
        if i < N - 1 and A[i] > 0:
            ans.append((imin, i))
            A[i] += amin
            assert A[i] <= 0
    for i in range(N - 2, -1, -1):
        if A[i] > A[i + 1]:
            ans.append((imin, i))
            A[i] += amin
            assert A[i] <= A[i + 1]
            if A[i] < amin:
                amin = A[i]
                imin = i
    assert len(ans) <= 2 * N
    print(len(ans))
    for x, y in ans:
        print(x + 1, y + 1)


def solve():
    if abs(amax) > abs(amin):
        make_positive()
    else:
        make_negative()
    return


solve()


Measured memory_bytes: 9296
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program
{
    public static void Main(string[] args)
    {
        string[] s = Console.ReadLine().Split(' ');
        int N = int.Parse(s[0]);
        int X = int.Parse(s[1]);
        int[] L = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        int cnt = 1;
        int sum = 0;
        for (int i = 0; i < N; i++)
        {
            sum += L[i];
            if (sum > X) break;
            cnt++;
        }
        Console.WriteLine(cnt);
    }
}

Measured memory_bytes: 13140
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		//文字列A
		String charStr1 = scan.nextLine();
		//文字列B
		String charStr2= scan.nextLine();

		//文字列Aを一字ごとに格納する配列
		char[] char1 = new char[charStr1.length()];

		//文字列Aを一字ごとに配列に格納
		for(int i = 0 ;i < charStr1.length() ;i++){
			char1[i] = charStr1.charAt(i);
		}

		int result = -1;
		for(int i = 0 ;i < charStr1.length() ;i++){
			String sumChar ="";
			for(int j = 0 ; j < charStr1.length() ;j++){
				//配列の要素をすべてつなげる
				sumChar += String.valueOf(char1[j]);
			}
			//比較し、結果を数字として格納
			result =sumChar.indexOf(charStr2);
			if(result !=-1){
				break;
			}
			//先頭の要素を最後尾にスライドさせる
			for(int j = 0 ; j < charStr1.length()-1 ;j++){
				char charChange = char1[j];
				char1[j] = char1[j+1];
				char1[j+1] = charChange;
			}
		}
		//結果を出力
		if(result != -1 ){
			System.out.println("Yes");
		}else if(result ==-1){
			System.out.println("No");
		}
	scan.close();
	}
}



Measured memory_bytes: 33048
#include <algorithm>
#include <climits>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string.h>
#include <utility>
#include <vector>
using namespace std;

#define dlog(str) cout << "====" << str << endl;
#define INF 999999999
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define REPR(i, n) for(int i = n - 1; 0 <= i; i--)
#define FOR(i, s, e) for(int i = s; i <= e; i++)
#define FORR(i, s, e) for(int i = s; e <= i; i--)
#define LLI long long int
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

vector<bool> m;

int N, M;
vector<vector<int>> v;
vector<int> p;
void f(int bit, int cnt) {
    if(cnt == N) {
        REP(i, M) {
            // i番目電球
            int c = 0;

            REP(j, v[i].size()) {
                if(bit & (1 << v[i][j])) {
                    c++;
                }
            }
            if((c & 1) != p[i]) {
                m[bit] = false;
                break;
            }
        }
        return;
    }

    f(bit, cnt + 1);

    f(bit | (1 << cnt), cnt + 1);
}

int main() {
    cin >> N >> M;
    m.resize(2 << (N - 1));
    REP(i, 2 << (N - 1)) { m[i] = true; }
    int k, t;
    REP(i, M) {
        cin >> k;
        vector<int> s(k);
        REP(j, k) {
            cin >> s[j];
            s[j]--;
        }
        v.push_back(s);
    }
    p.resize(M);
    REP(i, M) { cin >> p[i]; }
    f(0, 0);

    int cnt = 0;
    for(auto f : m) {
        if(f)
            cnt++;
    }
    cout << cnt;
    return 0;
}

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

#define int long long
#define fi first
#define se second
#define otp(n) cout << n;
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define ctv(v) rep(i,(v).size()) ct(v[i])
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define repv(i,v) for(int i=0;i<(v).size();i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);

int n,k;

main() {
    cin >> n >> k;
    if (((n-1)/2+1) >= k) ct("YES")
    else ct("NO")
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
    int a;
    cin >> a;
      vector<int> b(a);
        for (int i = 0; i < a; i++) {
  cin >> b.at(i);
}
      int c = 0;
      sort(b.begin(), b.end());
        for (int i = 0; i < a-1; i++){
          if(b.at(i) == b.at(i+1)){
            c = 1;}
        }
      if(c == 0){
        cout << "YES" << endl;
      }
      else{
        cout << "NO" << endl;
      }
    }

Measured memory_bytes: 1024
xlst = []
ylst = []
while True:
  try:
    x, y = map(float, input().split(","))
    xlst.append(x)
    ylst.append(y)
  except EOFError:
    break

num = len(xlst)
cx, cy = sum(xlst) / num, sum(ylst) / num

xlst.append(xlst[0])
ylst.append(ylst[0])
ans = 0
for i in range(num):
  x1, y1, x2, y2 = xlst[i], ylst[i], xlst[i + 1], ylst[i + 1]
  a = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** (1 / 2)
  b = ((x1 - cx) ** 2 + (y1 - cy) ** 2) ** (1 / 2)
  c = ((x2 - cx) ** 2 + (y2 - cy) ** 2) ** (1 / 2)
  z = (a + b + c) / 2
  s = (z * (z - a) * (z - b) * (z - c)) ** (1 / 2)
  ans += s 
print(ans)


Measured memory_bytes: 5648
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
def test(d,m,u):
    global ans
    p = 0
    for i in range(n):
        if m < a[i]:
            p += a[i]//m
    if u-d <= 1:
        ans = max(ans,m)
        pass
    elif p > k:
        ans = max(ans,m)
        d = m
        m = -(-(m+u)//2)
        test(d,m,u)
    else:
        u = m
        m = -(-(m+d)//2)
        test(d,m,u)
d = 0
m = 1
u = 10**9+7
test(d,m,u)
print(ans)

Measured memory_bytes: 31000
#include <iostream>

using namespace std;

int main() {
  int n, d1, d2;
  cin >> n >> d1 >> d2;
  int n1 = 0, n2 = 0;
  while (d1 % (1 << (n1 + 1)) == 0) n1++;
  while (d2 % (1 << (n2 + 1)) == 0) n2++;
  int c = 0;
  for (int i = 0; i < 2 * n && c < n * n; i++) {
    for (int j = 0; j < 2 * n && c < n * n; j++) {
      if ((n1 % 2 == 0 ? (i >> (n1 / 2)) % 2 == (j >> (n1 / 2)) % 2 : (i >> (n1 / 2)) % 2 == 0) && (n2 % 2 == 0 ? (i >> (n2 / 2)) % 2 == (j >> (n2 / 2)) % 2 : (i >> (n2 / 2)) % 2 == 0)) {
	cout << i << ' ' << j << endl;
	c++;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 896
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <bits/stdc++.h>

using namespace std;
int main()
{
    string t;
    cin >> t;
    for(int i=0; i < t.size(); i++) {
        cout << "x";
    }
    cout << endl;
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	num := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&num[i])
	}

	for _, v := range num {
		if v == 0 {
			fmt.Println(0)
			return
		}
	}
	res := 1
	for _, v := range num {
		if v > 1000000000000000000/res {
			fmt.Println(-1)
			return
		} else {
			res *= v
		}
	}
	fmt.Println(res)
}


Measured memory_bytes: 6320
#include<bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
#define ls i<<1
#define rs ls | 1
#define mid ((ll+rr)>>1)
#define pii pair<int,int>
#define MP make_pair
typedef long long LL;
const long long INF = 1e18+1LL;
const double pi = acos(-1.0);
const int N = 5e5+10, M = 1e3+20,inf = 2e9;

int n,p,a[N];
LL dp[N][3];
int main() {
    scanf("%d%d",&n,&p);
    for(int i =1; i <= n; ++i) scanf("%d",&a[i]);
    dp[0][0] = 1;
    dp[0][1] = 0;
    for(int i = 1; i <= n; ++i) {
        dp[i][a[i]%2] += dp[i-1][0];
        dp[i][(a[i]+1)%2] += dp[i-1][1];
        dp[i][0] += dp[i-1][0];
        dp[i][1] += dp[i-1][1];
    }
    cout<<dp[n][p]<<endl;
    return 0;
}


Measured memory_bytes: 2304
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


s = input()
v1 = ("N" in s) + ("S" in s)
v2 = ("W" in s) + ("E" in s)
if v1==1 or v2==1:
    ans = "No"
else:
    ans = "Yes"
print(ans)

Measured memory_bytes: 61900
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<iterator>
#include<set>
#include<queue>

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

using namespace std;


int main(){
	int n; cin >> n;
	vector<int> a;
	rep(i,n){
		int temp; cin >> temp;
		a.push_back(temp);
	}
	int miniv = 1;
	long long res = 0;
	rep(i,a.size()){
		if(a[i] <= miniv){
			miniv = max(a[i] + 1, miniv);
			continue;
		}
		else{
			long long q = (a[i] - 1) / miniv;
			res += q;
			miniv = max(miniv,2);
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
vector<int>dp;
int main()
{
    
    int n,k;
    cin>>n>>k;
    vector<int>A(n);
    dp.resize(k+1,-1);
    for(int &i:A)
        cin>>i;
    dp[0]=0;
    for(int i=1;i<=k;i++)
    {
        for(int j=0;j<A.size();j++)
        {
            if(i>=A[j])
            {
                if(dp[i-A[j]])
                    continue;
                else {
                    dp[i]=1;
                    break;
                }
            }
        }
        if(dp[i]!=1)
            dp[i]=0;
    }
    if(dp[k])
        cout<<"First";
    else cout<<"Second";
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <tuple>
#include <unordered_set>
#include <unordered_map>

typedef long long ll;
using namespace std;

int main(void) {
  ll N; cin >> N;
  vector<int> A(N);
  unordered_map<int, int> counter;

  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (counter.find(A[i]) == counter.end()) {
      counter[A[i]] = 1;
    } else {
      counter[A[i]]++;
    }
  }

  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  ll hw[2] = {0, 0}, l = 0, c = 0, p = 0;

  for (int i : A) {
    if (l == i) {
      c++;
    } else {
      l = i;
      c = 1;
    }

    if (c == 2) {
      hw[p] = i;
      if (p == 1)
        break;
      p++;
      c = 0;
    }
  }

  cout << (hw[0] * hw[1]) << endl;
}


Measured memory_bytes: 4772
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, x, t = inintm()

print(-(-n//x)*t)

Measured memory_bytes: 9168
<?php
$n = fgets(STDIN);
$a = explode(' ', fgets(STDIN));
rsort($a);
$p = 0;
for ($i = 0; $i < $n; $i++) {
    if ($i % 2 === 0) {
        $p += $a[$i];
    } else {
        $p -= $a[$i];
    }
}
echo $p;
?>

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

int main()
{
  	int n;
  	cin>>n;
  	int s[n];
  	ll sum = 0;
  	for(int i = 0; i < n; i++)
    {
      	cin>>s[i];
  		sum += s[i];
    }
  	if(sum % 10 == 0)
    {
      	bool all = true;
    	for(int i = 0; i < n; i++)
        {
          	if(s[i] % 10 != 0)
            {
              	all = false;
      			break;
            }
        }
      	if(all)
          	cout<<0;
      	else
        {
          	ll res = INT_MIN;
        	for(int i = 0; i < n; i++)
            {
            	ll t = sum - s[i];
              	if(t % 10 == 0)
                  	continue;
              	res = max(t, res);
            }
            cout<<res;
        }
    }
  	else
      	cout<<sum;
	return 0;
}

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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    string s;
    int k,n;
    cin>>n>>k>>s;
    s[k-1]=tolower(s[k-1]);
    cout<<s;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String[] strlist = str.split(" ");
		int n = Integer.parseInt(strlist[0]);
		int m = Integer.parseInt(strlist[1]);
		int[] list = new int[n];
		Arrays.fill(list, 0);

		int a,b;

		for(int i=0; i<m; i++){
			str = input.readLine();
			strlist = str.split(" ");
			a = Integer.parseInt(strlist[0]);
			b = Integer.parseInt(strlist[1]);
			list[a-1]++;
			list[b-1]++;
		}

		for(int i=0; i<n; i++){
			System.out.println(list[i]);
		}

	}


}


Measured memory_bytes: 23252
#include<stdio.h>

#define whi 0
#define gra 1
#define bla 2
#define M 100

int T[M][M],color[M],d[M],ti=0,f[M];
int n;

void visit(int u){
  int v;
  
  color[u] = gra;
  d[u] = ++ti;
  for(v=0; v<n; v++){
    if(T[u][v] == 0)continue;
    if(color[v] == whi){
      visit(v);
    }
  }
  color[u] = bla;
  f[u] = ++ti;
}

void dfs(void){
  int i;
  
  for(i=0; i<n; i++){
    color[i] = whi;
  }
    
  for(i=0; i<n; i++){
    if(color[i] == whi)visit(i);
  }
}

int main(){
  int i,j;
  int u,k,v;

  scanf("%d",&n);

  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      T[i][j] = 0;
    }
  }

  for(i=0; i<n; i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j=0; j<k; j++){
      scanf("%d",&v);
      v--;
      T[u][v] = 1;
    }
  }

  dfs();

  for(i=0; i<n; i++){
    printf("%d %d %d\n",i+1,d[i],f[i]);
  }

  return 0;
}



Measured memory_bytes: 2112
#include<cstdio>

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

using namespace std;

int card[14];

bool dfs(int sum){
	if(sum==0) return true;

	for(int i=1;i<=13;i++) if(card[i]>0 && (sum-i)%i==0) {
		card[i]--;
		if(dfs(sum-i)){ printf("%d ",i); return true; }
		card[i]++;
	}
	return false;
}

int main(){
	for(int n;scanf("%d",&n),n;){
		for(int i=1;i<=13;i++) card[i]=0;
		int sum=0;
		rep(i,n){
			int a; scanf("%d",&a);
			card[a]++;
			sum+=a;
		}
		puts(dfs(sum)?"":"No");
	}

	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N, K;
  cin >> N >> K;
  if(K > (N-1) * (N-2) / 2)
    cout << -1 << endl;
  else {
    int tmp = (N-1) * (N-2) / 2 - K;
    cout << N-1+tmp << endl;
    REP(i, 1, N)
      cout << 1 << ' ' << i+1 << endl;
    REP(i, 1, N) {
      REP(j, i+1, N) {
	if(tmp == 0) return 0;
	cout << i+1 << ' ' << j+1 << endl;
	tmp--;
      }
    }
  }
  return 0;
}


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

using namespace std;

int dx[] = { -1, 0, 1, 0};
int dy[] = { 0, 1, 0, -1};

int dfs(vector< vector<bool> > &m, int x, int y){
	if(!m[x][y])return 0;
	int ret = 1;
	m[x][y] = false;
	for(int i = 0; i < 4; i++){
		ret += dfs(m, x+dx[i], y+dy[i]);
	}
	return ret;
}

int main(){
	while(true){
		int h,w; cin >> w >> h;
		if(h == 0)break;
		pair<int,int> s;
		vector< vector<bool> > m(h+2, vector<bool>(w+2, false));
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				char c; cin >> c;
				if( c == '.'){
					m[i+1][j+1] = true;
				}
				else if( c == '@'){
					m[i+1][j+1] = true;
					s = make_pair(i+1, j+1);
				}
			}
		}
		int ans = dfs(m,s.first, s.second);
		cout << ans << endl;
	}
	return 0;
}




Measured memory_bytes: 3008
import math
L = int(input())
N = math.floor(math.log2(L))+1

M = N*2-2
add_path = []
for i in range(1,N)[::-1]:
    if L-2**(i-1) >= 2**(N-1):
        add_path.append([i, L-2**(i-1)]); L -= 2**(i-1)
print(N, M+len(add_path))
for i in range(1,N):
    print(i, i+1, 0)
    print(i, i+1, 2**(i-1))
for i in add_path:
    print(i[0], N, i[1])

Measured memory_bytes: 3188
import sys
input = sys.stdin.buffer.readline
from collections import deque

def main():
    N,M = map(int,input().split())
    edge =[[[] for _ in range(3)] for _ in range(N)]
    for _ in range(M):
        u,v = map(int,input().split())
        for i in range(3):
            edge[u-1][i].append((v-1,(i+1)%3))

    S,T = map(int,input().split())
    go =[[0 for _ in range(3)] for _ in range(N)]
    q = deque([(S-1,0)])
    while q:
        now,rest = q.popleft()
        for fol,fr in edge[now][rest]:
            if go[fol][fr] == 0:
                go[fol][fr] = go[now][rest]+1
                q.append((fol,fr))
                
    if go[T-1][0] != 0 and go[T-1][0]%3 == 0:
        print(go[T-1][0]//3)
        exit()
    
    print(-1)

if __name__ == "__main__":
    main()


Measured memory_bytes: 98156
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b;
  c = a*b%2;
  if (c == 0){
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
private fun getLongs(): LongArray {
    return readLine()!!.split(" ").map {it.toLong()}.toLongArray()
}


fun main(){
    val ns = getLongs()
    val arr = getLongs()
    var currentMaxHeight = 0L
    var stand = 0L
    for (i in arr.indices) {
        if (arr[i]<currentMaxHeight) {
            stand += currentMaxHeight - arr[i]
        }
        if (arr[i]>currentMaxHeight) {
            currentMaxHeight = arr[i]
        }
    }
    print(stand)
}

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

int main() {
	int a,b,c,x;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> x;
	int cnt = 0;
	for (int i = 0; i < a + 1; ++i) {
		if (x < 500 * i) break;
		if (x == 500 * i) {
			++cnt;
			break;
		}
		int r = x - 500 * i;
		for(int j = 0 ; j < b + 1; ++j) {
			if (r < 100 * j) break;
			if (r == 100 * j) {
				++cnt;
				break;
			}
			int r2 = r - 100 * j;
			for (int k = 0; k < c + 1; ++k) {
				if (r2 < 50 * k) break;
				if (r2 == 50 * k) {
					++cnt;
					break;
				}
			}
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

bool gb(int i){
  return i == 4 || i == 6 ||
  i == 9 || i == 11;
}
bool gc(int i){
  return i == 2;
}
bool ga(int i){
  return !gb(i) && !gc(i);
}

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

  int x, y;
  cin >> x >> y;

  if((ga(x) && ga(y)) ||
    (gb(x) && gb(y)) ||
    (gc(x) && gc(y))){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int n;
char s[20];

void doSearch(int depth, int maxLetter) {
	if (depth >= n) {
		printf("%s\n", s);
	} else {
		for (int i = 0 ; i < maxLetter ; i++) {
			s[depth] = i + 'a';
			doSearch(depth + 1, maxLetter);
		}
		
		s[depth] = maxLetter + 'a';
		doSearch(depth + 1, maxLetter + 1);
		
	}
}

int main()
{
	scanf("%d", &n);
	
	for (int i = 0 ; i < 20 ; i++)
		s[i] = '\0';
		
	doSearch(0, 0);
	
	
	
	return 0;
}



Measured memory_bytes: 1408
#include <cstdint>
#include <iostream>
#include <string>

using namespace std;

int32_t main()
{
  string _, str;
  cin >> _;
  cin >> str;

  int32_t count = 0;
  uint32_t left_paren = 0;
  uint32_t right_paren = 0;

  for (uint32_t i = 0; i < str.size(); i++) {
    if (str[i] == '(') {
      count++;
    } else if (str[i] == ')') {
      count--;
      if (count < 0) {
        count = 0;
        left_paren++;
      }
    }
  }

  right_paren = count;

  for (uint32_t i = 0; i < left_paren; i++) {
    cout << '(';
  }
  cout << str;

  for (uint32_t i = 0; i < right_paren; i++) {
    cout << ')';
  }

  cout << endl;

  return 0;
}


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

int calc(int n, int k, int c[]) {
  int res = 0;
  for(int i = 0; i+k <= n; ++i) {
    int seki = 1;
    for(int j = 0; j < k; ++j) {
      seki *= c[i+j];
    }
    res = max(res, seki);
  }
  return res;
}

int main() {
  int n, k, c[101];
  while(cin >> n >> k && (n|k)) {
    for(int i = 0; i < n; ++i) {
      cin >> c[i];
    }
    int C0 = calc(n,k,c);
    int C1 = 0;
    for(int i = 0; i < n; ++i) {
      for(int j = i+1; j < n; ++j) {
	swap(c[i],c[j]);
	C1 = max(C1, calc(n,k,c));
	swap(c[i],c[j]);
      }
    }
    if(C1-C0 < 0) cout << "NO GAME" << endl;
    else cout << C1-C0 << endl;
  }
  return 0;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/
long long GCD(long long a, long long b){
    return (b ? GCD(b, a%b) : a);
}
long long LCM(long long a, long long b) {
    return a*b/GCD(a,b);
}

/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(15);

    int n; cin >> n;
    vi a(n); rep(i,n) cin >> a[i];
    int ans = a[0];
    for(int i = 1; i < n; ++i) {
        ans = GCD(ans, a[i]);
    }
    cout << ans << '\n';
}

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





void SelectionSort(int A[],int N){
    int minj;
    int sw = 0;
    for (int i =0; i < N; i++){
        minj = i;
        for (int j = i; j < N; j++){
            if (A[j] < A[minj]){
                minj = j;
            }
        }
        if (i !=minj){
            swap(A[i],A[minj]);
            sw++;
        }
    }
    for (int i = 0; i < N-1; i++) cout << A[i] << " ";
    cout << A[N-1] << endl;
    cout << sw << endl;
}


int main(){
    int N;
    int A[100];
    
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];

    SelectionSort(A,N);  
    
    
}


Measured memory_bytes: 3100
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>; using vvi = vector<vector<int>>;
using vl = vector<ll>; using vvl = vector<vector<ll>>;
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
#define int ll
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  int k,a,b;
  cin >> k >> a >>b;
  if(k<a+1) {
    cout << k+1 << endl;
    return 0;
  }
  int ans = b;
  int ko=k;
  k-=a+1;
  ans+=k/2*(b-a);
  ans+=k%2;
  cout << max(ans,ko+1) << endl;
}



Measured memory_bytes: 256
#feel like this is to easy

def read_input():
  n = int(input())
  a = []
  for i in range(n):
    a.append(int(input()))
  return n,a

def TLE():
  n,a = read_input()
  sheet = []
  for item in a:
    if item not in sheet:
      sheet.append(item)
    else:
      sheet.pop(sheet.index(item))
  print(len(sheet))
  
def TLE2():
  n,a = read_input()
  items = list(set(a))
  count = 0
  for item in items:
    if a.count(item)%2 != 0:
      count += 1
  print(count)

def main():
  n,a = read_input()
  a.sort()
  items = list(set(a)).sort()
  t = 1
  count = 0
  for i in range(len(a)):
    if i+1 == len(a):
      count += t%2
      break
    if a[i] == a[i+1]:
      t += 1
    else:
      count += t%2
      t = 1
  print(count)

if __name__ == '__main__':
  main()

Measured memory_bytes: 13256
import java.util.Scanner;

/**
 * コンソールテスト用Main クラス
 *
 */
public class Main {

	/* コンストラクタ */
	Main() {
	//何もしない
	}

	/**
	 * 提出
	 *
	 */

	public static void main(String args[]) {
		Scanner scanner= new Scanner(System.in);
		int a = 0;
		int b = 0;
		int tmpB = 0;


		for (int i = 0; i < 3000; i++) {
			a = scanner.nextInt();
			b = scanner.nextInt();

			/* aの方がbより大きい場合 */
			if (a > b) {
				/* aとbの値を交換 */
				tmpB = b;
				b = a;
				a = tmpB;
				System.out.println(a + " " + b);

			} else if (a < b) {
				System.out.println(a + " " + b);
			} else if (a == 0 && b== 0) {
				break;
			} else if (a == b) {
				System.out.println(a + " " + b);
			}
		}

	}
}



Measured memory_bytes: 35812