akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<deque>
#include<algorithm>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int const MAXN = 1e5;
int const INF = 1e9+1;

int main() {
  int N; std::cin >> N;
  std::deque<int> tmp(N, INF);
  for(int i = 0; i < N; ++i) {
    int A; std::cin >> A;
    auto it = std::lower_bound(tmp.begin(), tmp.end(), A);
    if(it != tmp.begin()) *(it-1) = A;
    else tmp.push_front(A);
  }
  int ans = std::lower_bound(tmp.begin(), tmp.end(), INF) - tmp.begin();
  fin(ans);
  return 0;
}


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

int a[3] = {0};

int main() {
  int ans = 0;
  cin >> a[0] >> a[1] >> a[2];
  for(int i = 0; i < 3; ++i)
    ans = max(ans, a[i % 3] * 10 + a[(i + 1) % 3] +
                       a[(i + 2) % 3]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        int[] b = new int[n%2 == 0 ? n+2 : n+1];
        int left = b.length/2;
        int right = left+1;

        for (int i = 0; i < n; i++) {
            if (n%2 == (i+1)%2) {
                b[left--] = sc.nextInt();
            } else {
                b[right++] = sc.nextInt();
            }
        }
        for (int i = left+1; i < right; i++) {
            System.out.print(b[i] + " ");
        }
        System.out.println();
    }
}


Measured memory_bytes: 93936
"use strict";

const main = arg => {
    const inputList = arg.trim().split("\n");
    // 回答を記述
    const XList = inputList[0].split(" ");
    XList.forEach((ele, idx) => {
        if (ele == "0") {
            console.log(idx + 1)
        }
    })
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const int mod = 1000000007;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, c = 0,ans = 0;
  string s;
  cin >> n >> s;
  rep(i,n){
    if(s[i] == 'I'){
      c++;
    }
    else
      --c;
    ans = max(ans,c);
  }
  cout << ans << endl;
  return 0;
}


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

const int MAXN = 3003;
double dp[MAXN][MAXN];

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

	int n;
	cin >> n;
	vector<double> p(n);
	for (int i = 0; i < n; i++) cin >> p[i];

	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		dp[i][0] = dp[i-1][0] * (1 - p[i-1]);
		for (int j = 1; j <= i; j++) {
			dp[i][j] = dp[i-1][j] * (1 - p[i-1]) + dp[i-1][j-1] * p[i-1];
		}
	}

	double ans = 0;
	for (int j = n; j > n - j; --j) {
		ans += dp[n][j];
	}

	cout.precision(10);
	cout << ans << endl;
}


Measured memory_bytes: 68992
class SegTree:
    def __init__(self, init_val, ide_ele, segfunc):
        self.n = len(init_val)
        self.num =2**(self.n-1).bit_length()
        self.ide_ele = ide_ele
        self.seg = [self.ide_ele]*2*self.num
        self.segfunc = segfunc
        
        #set_val
        for i in range(self.n):
            self.seg[i+self.num-1] = init_val[i]    
        #built
        for i in range(self.num-2,-1,-1) :
            self.seg[i] = segfunc(self.seg[2*i+1], self.seg[2*i+2]) 
    
    def update(self, k, x):
        k += self.num-1
        self.seg[k] = x
        while k+1:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1], self.seg[k*2+2])
    
    def query(self, p, q):
        if q<=p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res = self.ide_ele
        while q-p>1:
            if p&1 == 0:
                res = self.segfunc(res, self.seg[p])
            if q&1 == 1:
                res = self.segfunc(res, self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res, self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res, self.seg[p]), self.seg[q])
        return res
    
import sys
input = sys.stdin.readline
N = int(input())
S = input()
L = [-1]*N
for i in range(N):
    L[i] = 2**(ord(S[i]) - ord('a'))
    
def segfunc(a,b):
    return a | b

Seg = SegTree(L,0,segfunc)

Q = int(input())

for _ in range(Q):
    q,a,b = input().split()
    if q == '1':
        i = int(a)-1
        c = 2**(ord(b) - ord('a'))
        Seg.update(i,c)
    elif q=='2':
        l = int(a)-1
        r = int(b)-1
        X = Seg.query(l,r+1)
        tmp = 0
        for j in range(30):
            if X%2==1:
                tmp += 1
            X//=2
        print(tmp)

Measured memory_bytes: 69848
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

    int N, M;
    cin >> N >> M;

    int X    = 0;
    int time = 1;
    REP(i, M) time *= 2;

    X = (1900 * M + 100 * (N - M)) * time;

    cout << X << endl;
    return 0;
}

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

int main(){
	string map ;
	int n = 0 , s = 0 , e = 0 , w = 0 ;
	cin >> map ;
	for( int i = 0 ; i < map.size() ; i++ ){
		if( map[i] == 'S' )
			s += 1 ;
		if( map[i] == 'N' )
			n += 1 ;
		if( map[i] == 'E' )
			e += 1 ;
		if( map[i] == 'W' )
			w += 1 ;
	}
	if( s != 0 && n == 0 ){
		cout << "No" ;
		return 0 ;
	}
	if( n != 0 && s == 0 ){
		cout << "No" ;
		return 0 ;
	}
	if( w != 0 && e == 0 ){
		cout << "No" ;
		return 0 ;
	}
	if( e != 0 && w == 0 ){
		cout << "No" ;
		return 0 ;
	}
	cout << "Yes" ;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://beta.atcoder.jp/contests/abc099/tasks/abc099_d>
 問題文============================================================
 =================================================================
 解説=============================================================
 条件より余りが0,1,2になるグループの色を決め打ちすればよい
 この時、初期状態の時に各グループの各色がいくつ存在するのか配列でまとめておけば
 O(N^3*C)で解ける
 ================================================================
 */

ll solve(){
    ll res = LINF;
    ll N,C; cin >> N >> C;
    vector<vector<ll>> D(C+1,vector<ll>(C+1));
    vector<vector<ll>> c(N+1,vector<ll>(N+1));
    for(int i = 1; i <= C;i++)for(int j = 1; j <= C;j++) cin >> D[i][j];
    for(int i = 1; i <= N;i++)for(int j = 1; j <= N;j++) cin >> c[i][j];
    vector<vector<ll>> cnt(3,vector<ll>(C+1));
    for(int i = 1; i<=N;i++)for(int j = 1;j<=N;j++) cnt[(i+j)%3][c[i][j]]++;
    for(int c1 = 1; c1 <= C; c1++){
        for(int c2 = 1; c2 <=C; c2++){
            if(c1 == c2) continue;
            for(int c3 = 1; c3 <= C;c3++){
                if(c1 == c3) continue;
                if(c2 == c3) continue;
                ll T = 0;
                for(int j = 1; j <= C;j++) T += cnt[0][j]*D[j][c1];
                for(int j = 1; j <= C;j++) T += cnt[1][j]*D[j][c2];
                for(int j = 1; j <= C;j++) T += cnt[2][j]*D[j][c3];
                res = min(res,T);
            }
        }
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 2304
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double btc = 380000.0; 
		double sum = 0;
		for(int i = 0; i < n; i++) {
			sum += sc.nextDouble() * (sc.next().equals("BTC") ? btc : 1);
		}
		System.out.println(sum);
	}
}

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

ll n;

int main() {
	cin>>n;
	if (n%10==3) cout<<"bon"<<endl;
  	else if (n%10==0||n%10==1||n%10==6||n%10==8) cout<<"pon"<<endl;
  	else cout<<"hon"<<endl;
}

Measured memory_bytes: 3648
#include <stdio.h>

long int F_func(long int a, long int b) {
    long int c=0;
    if(a>b) {
        while(a) {
            c += 1;
            a /= 10;
        }
    } else {
        while(b) {
            c += 1;
            b /= 10;
        }
    }
    return c;
}

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

    long int flag=1, tmp, min=100;
    while(n>=flag*flag) {
        if(n%flag==0) {
            tmp = F_func(flag, n/flag);
            if(min>tmp) {
                min = tmp;
            }
        }
        flag++;
    }

    printf("%ld\n", min);

    return 0;

}

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

int main(){
  long long h,n;
  cin >> h >> n;
  long long sum = 0;
  for(int i = 0; i < n; i++){
    long long a;
    cin >> a;
    sum += a;
    if(sum >= h){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, -1, 0, 1};

const int INF = 1e9;
string b[21];
int h, w;

bool inRange(int y, int x) {
	return y >= 0 && y < h && x >= 0 && x < w;
}

int main(void) {
	ios_base::sync_with_stdio(false); cin.tie(0);
	//freopen("in.txt", "r", stdin);
	cin >> h >> w;
	rep(i,0,h) {
		cin >> b[i];
	}
	int ret = 0;
	rep(y,0,h) rep(x,0,w) {
		if(b[y][x] == '#') continue;
		vector<vi> d(h, vi(w,INF));
		d[y][x] = 0;
		queue<pair<int, int> > q;
		q.push(mp(y,x));
		while(!q.empty()) {
			int hy = q.front().F;
			int hx = q.front().S;
			q.pop();
			rep(i,0,4) {
				int ny = hy + dy[i];
				int nx = hx + dx[i];
				if(inRange(ny,nx) && b[ny][nx] == '.' && d[ny][nx] == INF) {
					d[ny][nx] = d[hy][hx] + 1;
					q.push(mp(ny,nx));
				}
			}
		}
		rep(i,0,h) rep(j,0,w) {
			if(d[i][j] != INF) {
				ret = max(ret, d[i][j]);
			}
		}
	}
	cout << ret << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#define ALL(a) (a).begin(),(a).end()

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;
 
	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}
 
	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}
 
	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい]
	}
 
	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}
 
		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);
 
		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;
 
		return true;
	}
};




long long fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {
  // 前処理
  //COMinit();

  ll N;
  cin>>N;


  cout<<N*(N+1)/2<<endl;
  return 0;
 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair
#define sz(x)       int(x.size())
//#define int         int64_t

using namespace std;

typedef pair<int, int> pii;
const int N = 302;
const int mod = 998244353;

string s;
int k, n, f[N][N][N];

int DP(int l, int r, int k) {
    if(f[l][r][k] != -1) return f[l][r][k];
    if(r < l) return f[l][r][k] = 0;
    if(l == r) return f[l][r][k] = 1;
    if(l + 1 == r) {
       if(k >= 1 || s[l] == s[r]) return f[l][r][k] = 2;
       return f[l][r][k] = 1;
    }
    int&res = f[l][r][k];
    res = max(DP(l + 1, r, k), DP(l, r - 1, k));
    if(s[l] == s[r]) {
        res = max(res, DP(l + 1, r - 1, k) + 2);
    } else if(k >= 1) {
        res = max(res, DP(l + 1, r - 1, k - 1) + 2);
    }
    return res;
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> s >> k; n = sz(s);
    s = ' ' + s;
    memset(&f, -1, sizeof f);
    cout << DP(1, n, k);
}


Measured memory_bytes: 107904
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 **/
int dp[11][331][1025];

int solve(int n,int s,int used) {
    if (n==0 && s==0) return 1;
    if (n<=0 || s<0) return 0;
    if (dp[n][s][used] != -1) return dp[n][s][used];

    int sum=0;
    for (int i=0;i<10;++i) {
        if ((used>>i)%2==0) {
            used+=1<<i;
            sum+=solve(n-1,s-i*n,used);
            used-=1<<i;
        }
    }
    return dp[n][s][used]=sum;
}


int main(){
    int n,s;
    memset(dp,-1,sizeof(dp));

    while (scanf("%d %d",&n,&s)!=EOF) {
        if (0<=s && s<=330) {
            int used=0;
            printf("%d\n",solve(n,s,used));
        } else {
            printf("0\n");
        }
    }
    return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, ans[int(2e5+5)];

int main(){
  cin >> N;
  for (int i = 2; i <= N; i++){
    int A; cin >> A;
    ans[A]++;
  }
  for (int i = 1; i <= N; i++) cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 4348
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#include <utility>
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1e9
typedef long long int ll;
using namespace std;

int main()
{
    int N;
    cin  >> N;
    vector<int> a(N);
    FOR(i,1,N+1){
        cin >> a[i];
    }

    int cnt=0;

    FOR(i,1,N+1){
        if(a[a[i]]==i)  cnt++;
    }

    cout << int(cnt/2) << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define inf 1<<29
using namespace std;

int Station[301][301];
pair<int,int> p[20];
int dp[(1<<18)][18];

void init(){
  for(int i=0;i<(1<<17);i++)for(int j=0;j<17;j++)dp[i][j]=inf;
  
  for(int i=0;i<301;i++){
    for(int j=0;j<301;j++){
      if(i==j)Station[i][j]=0;
      else Station[i][j]=inf;
    }
  }
}

int main()
{
  int n,m,l,s,t,a,b,c,x,y;

  while(1){
    cin>>n>>m>>l>>s>>t;
    if(n+m+l+s+t==0)break;
    s--;
    init();
    for(int i=0;i<m;i++){
      cin>>a>>b>>c;
      a--;b--;
      Station[a][b]=c;
      Station[b][a]=c;
    }
    for(int i=0;i<l;i++){
      cin>>p[i].f>>p[i].s;
      p[i].f--;
    }

    for(int k=0;k<n;k++){
      for(int i=0;i<n;i++){
	for(int j=0;j<n;j++){
	  Station[i][j]=min(Station[i][j],Station[i][k]+Station[k][j]);
	}
      }
    }

    dp[0][0]=0;
    for(int i=0;i<l;i++)dp[(1<<i)][i]=Station[s][p[i].f]+p[i].s;

    for(int i=1;i<(1<<l);i++){
      for(int j=0;j<l;j++){
	if((i>>j)%2==1){
	  for(int k=0;k<l;k++){
	    if((i>>k)%2==0){
	      dp[(i|(1<<k))][k]=min(dp[(i|(1<<k))][k],
                               dp[i][j]+Station[p[j].f][p[k].f]+p[k].s);
	    }
	  }
	}
      }
    }
    int ans=0;
    for(int i=1;i<(1<<l)+1;i++){
      for(int j=0;j<l;j++){
	//cout<<dp[i][j]<<" "<<Station[p[j].f][s]<<" "<<i<<" "<<p[j].f<<endl;;
	if((dp[i][j]+Station[p[j].f][s])<=t){
	  int sum=0;
	  for(int k=0;k<l;k++)if((i>>k)%2==1)sum++;
	  ans=max(ans,sum);
	}
      }
    }
    cout<<ans<<endl;;
  }    
  return 0;
}

Measured memory_bytes: 11748
#include <iostream>
#include <deque>

using namespace std;

const int MAX_DIGIT = 33;

void my_divide(int a, int b, int *q, int *r)
{
    /* caliculate q and r such that
     * a = b * q + r and
     * 0 <= r < |b| (r is always non negative)
     * both a and b can be negative
     */
    if(b == 0){
        cerr << "zero division\n";
        exit(1);
    }
    int sign_b = (b > 0) ? 1 : -1;
    int i = 0, rem;
    while(1){
        rem = a - b*i;
        if(rem >= abs(b)) i += sign_b;
        else if(rem < 0) i -= sign_b;
        else break;
    }
    *q = i;
    *r = rem;
}

deque<int> base_n(int x, int n)
{
    /* convert x into base-n expression */
    if(n == 0){
        cerr << "n must be non zero value\n";
        exit(1);
    }
    deque<int> ans;
    if(x == 0){
        ans.push_front(0);
        return ans;
    }
    int num = x;
    while(num != 0){
        int r;
        my_divide(num, n, &num, &r);
        ans.push_front(r);
    }

    return ans;
}

int main()
{
    int n;
    cin >> n;
    deque<int> ans = base_n(n, -2);
    for(auto i = ans.begin(); i != ans.end(); i++){
        cout << *i;
    }
    cout << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    x, k, d = MI()
    x = abs(x)

    min_idou = x // d
    amari = x % d

    if min_idou >= k:
        print(min(abs(x - k*d), x))
        return

    k -= min_idou
    if k % 2 == 0:
        print(amari)
    else:
        print(-1*(amari - d))


main()


Measured memory_bytes: 64768
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

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

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

  
  int n, k; cin >> n >> k;

	set<int> st;
    rep1(i,n) st.insert(i);
  
  rep(i,k){
    int d;cin >> d;
    rep(j,d){
      int a; cin >> a;
      st.erase(a);
    }
  }
  
  cout << st.size() << endl;
}


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

int main(){
  int N;
  cin >> N;
  
  int n1 = N / 1000;
  int n2 = (N % 1000) / 100;
  int n3 = (N % 100) / 10;
  int n4 = (N % 10);
  
  if((n1 == n2 && n2== n3) || (n2 == n3 && n3== n4)){
    cout << "Yes" << endl;
  }
  else{
  	cout << "No" << endl;
  }
}

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

int main() {
    int N, Y;
    cin >> N >> Y;
    int res10000 = -1, res5000 = -1, res1000 = -1;
    for(int a = 0; a <= N; ++a) {
        for(int b = 0; b + a <= N; ++b) {
            int c = N - a - b;
            int total = 10000*a + 5000*b + 1000*c;
            if(total == Y) {
                res10000 = a;
                res5000 = b;
                res1000 = c;
            }
        }
    }
    cout << res10000 << " " << res5000 << " " << res1000 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <set>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;
typedef unsigned long ul;

const int MOD = 1000000007;  // 1 000 000 007

vector<ll> findChar(string& str, char pattern) {
    size_t len = str.length();
    vector<ll> vec;
    REP(i, len) {
        if (str[i] == pattern) {
            vec.push_back(i);
        }
    }
    return vec;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    // input
    string S;
    cin >> S;
    
    // calculation
    ll ans = 0, cnt = 0;
    ll len = (ll)S.length();
    REP(i, len) {
        if (S[i] == 'B') {
            cnt++;
        } else {
            ans += cnt;
        }
    }
    cout << ans << "\n";
    
    return 0;
}


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

using namespace std;

const int N = 2e5 + 5;

int n;
long long f[N];
pair <int, int> a[N];

struct FenwickTree {
    long long bit[N];
    void init(){
        memset(bit, 0, sizeof bit);
    }
    
    void update (int x, long long val) {
        for (int i = x; i < N; i += i & -i) bit[i] = max(bit[i], val);
    }
    
    long long query (int x) {
        long long ans = 0;
        for (int i = x; i > 0; i -= i & -i) ans = max(ans, bit[i]);
        return ans;
    }
} fw;

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n; fw.init();
    for (int i = 1; i <= n; i++) cin >> a[i].first;
    for (int i = 1; i <= n; i++) cin >> a[i].second;
    for (int i = 1; i <= n; i++) f[i] = a[i].second;
    for (int i = 1; i <= n; i++) {
        f[i] = max(f[i], fw.query(a[i].first - 1) + a[i].second);
        fw.update(a[i].first, f[i]);
    }
    
    cout << *max_element(f + 1, f + n + 1);
    return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
 #define pb push_back
 #define ll long long
 using namespace std;

const double pi = 3.141592654;
const int maxn = 1e6+5;
ll a[maxn], b[maxn];

int main()
{
   ll n, k; cin >> n >> k;
   for(int i = 1; i <= n; i++) cin >> a[i];
   for(int i = 1; i <= n; i++) cin >> b[i];
   sort(a+1, a+n+1);  sort(b+1, b+n+1, greater<int>());
   ll r = -1;
   for(int i = 1; i <= n; i++) {
       r = max(r, a[i]*b[i]);
   }
   ll l = 0;
   while(l < r) {
      ll mid = (l+r)>>1;
      ll tmp = 0;
      bool flag = 1;
      for(int i = 1; i <= n; i++) {
          ll q = mid/b[i];
          if(q > a[i]) continue;
          tmp += a[i] - q;
          if(tmp > k) {
            flag = 0;
            break;
          }
      }
      if(flag) r = mid;
      else l = mid+1;
   }
   cout << l << endl;
}


Measured memory_bytes: 5888
#include <cstdio>
#include <iostream>
#include <cmath>
#include <set>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
using namespace std;
typedef long long ll;
int main()
{
    //freopen("a.in","r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,a,b;
    cin>>n>>a>>b;
    ll tmp=n/(a+b);
    ll ans=tmp*a+min(a,n%(a+b));
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 256
from itertools import accumulate
n, k = map(int, input().split())
p = list(map(int, input().split()))
if (n != k):
    pp = list(accumulate(p))
    ppp = [pp[i + k] - pp[i] + k for i in range(len(p) - k)]
    print((max(ppp)) / 2)
else:
    print((sum(p) + n) / 2)

Measured memory_bytes: 25540
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    string s,t;
    cin>>s>>t;
    int ans=t.size();
    rep(i,s.size()-t.size()+1){
        int c=0;
        rep(j,t.size()){
            if(s[i+j]!=t[j])c++;
        }
        chmin(ans,c);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
//{{{
#include <bits/stdc++.h>
using namespace std;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
typedef long long ll;
const int MOD = 1e9+7;
//}}}

int cost[100000];
int main(){
	int H, W, D;
	cin >> H >> W >> D;

	map<int, pair<int, int>> m;
	rep(h, H){
		rep(w, W){
			int a;
			cin >> a;
			m[a] = make_pair(h, w);
		}
	}

	rep(d, D){
		int prev_h = 0;
		int prev_w = 0;
		for(int i = d; i < H * W + 1; i += D){
			cost[i] = (i - D <= 0 ? 0 : cost[i - D]) + abs(m[i].first - prev_h) + abs(m[i].second - prev_w);
			prev_h = m[i].first;
			prev_w = m[i].second;
		}
	}
	int Q;
	cin >> Q;
	int ans = 0;
	rep(q, Q){
		int l, r;
		cin >> l >> r;
		cout << (cost[r] - cost[l]) << endl;
	}
	return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline void fastio () {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
}

#define whats(x) cerr << #x << " = " << (x) << "\n"; 

using LL = long long;
using LD = long double;

const LL INF = LLONG_MAX;
const LL MOD = static_cast<LL>(1e9+7);
const LL N = 5e5+1;

int main() {
	fastio();

	LL n;
	cin >> n;

	unordered_map<string, LL> mp;

	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		mp[s]++;
	}

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

Measured memory_bytes: 3668
x,n=map(int,input().split())
if n==0:
	print(x)
else:
	l=list(map(int,input().split()))
	if x not in l:
		print(x)
	else:
		v=0
		c=0
		d=0
		for i in range(1,len(l)+1):
			if x-i not in l:
				print(x-i)
				v=1
				break
			else:
				c+=1
			if x+i not in l:
				print(x+i)
				v=1
				break
			else:
				d+=1	
		if v==0:
			print(min(x-c-1,x+d+1))
	

Measured memory_bytes: 9144
#include <iostream>
using namespace std;
int main(void){
    char a,b;
    cin>>a>>b;
    int x=0;
    int y=0;
    if(a=='A'){
    x=0;
    }else if(a=='B'){
    x=1;
    }else if(a=='C'){
    x=2;
    }else if(a=='D'){
    x=3;
    }else if(a=='E'){
    x=4;
    }else if(a=='F'){
    x=5;
    }
    if(b=='A'){
    y=0;
    }else if(b=='B'){
    y=1;
    }else if(b=='C'){
    y=2;
    }else if(b=='D'){
    y=3;
    }else if(b=='E'){
    y=4;
    }else if(b=='F'){
    y=5;
    }
    if(x>y){
    cout<<">"<<endl;
    }else if(x<y){
    cout<<"<"<<endl;
    }else{
        cout<<"="<<endl;
    }
}

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

namespace AGC032_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] strs = Console.ReadLine().Split(' ');
            int[] b = new int[n];
            List<int> bList = new List<int>(n);
            Stack<int> ans = new Stack<int>(n);

            for (int i = 0; i < n; ++i)
            {
                b[i] = int.Parse(strs[i]);
                bList.Add(b[i]);
            }

            int count = n;

            for (int i = n; i >= 1; --i)
            {
                if (bList[i-1] == i)
                {
                    ans.Push(i);
                    bList.RemoveAt(i-1);

                    i = count;
                    --count;
                }
            }

            if (bList.Count != 0)
            {
                Console.WriteLine("-1");
            }
            else
            {
                int ansCount = ans.Count;
                for (int i = 0; i < ansCount; ++i)
                {
                    Console.WriteLine("{0}", ans.Pop());
                }
            }
        }
    }
}


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

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
  int n, m;
  cin >> n >> m;
  vector<int> a, b;
  for(int i = 0; i < n; i++){
    int x, y;
    cin >> x >> y;
    a.pb(x);
    b.pb(y);
  }
  vector<int> c, d;
  for(int i = 0; i < m; i++){
    int x, y;
    cin >> x >> y;
    c.pb(x);
    d.pb(y);
  }
  for(int i = 0; i < n; i++){
    int res = 0;
    int cal = inf;
    for(int j = 0; j < m; j++){
      int dis = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if(dis < cal){
        cal = dis;
        res = j;
      }
    }
    cout << res + 1 << endl;
  }
	return 0;
}


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

using namespace std;

int main()
{
  string S;
  cin >> S;

  int max_length = 0;
  for (int i = 0; i < (int)S.size(); ++i)
  {
    if (S[i] != 'A' && S[i] != 'T' && S[i] != 'C' && S[i] != 'G') continue;

    int count = 1;
    for (int j = i + 1; j < (int)S.size(); ++j)
    {
      if (S[j] != 'A' && S[j] != 'T' && S[j] != 'C' && S[j] != 'G') break;
      ++count;
    }
    if (max_length < count) max_length = count;
  }
  cout << max_length << endl;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

vector<ll> enum_prime(ll N){
	deque<bool> is_prime(N+1,true);
	vector<ll> P;
	for(ll i=2;i<=N;i++){
		if(is_prime[i]){
			for(ll j=i*i;j<=N;j+=i){
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
	return P;
}

vector<ll> prime_factor(ll n){
	ll sn = sqrt(n)+1;
	auto prime_list = enum_prime(sn);
	vector<ll> res;
	for(int i=0,ei=prime_list.size();i<ei;i++){
		ll v = prime_list[i];
		if(v*v>n) break;
		while(!(n%v)){
			n /= v;
			res.push_back(v);
		}
	}
	if(n>1){
		res.push_back(n);
	}

	return res;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	ll N=in<ll>(),P=in<ll>();
	auto V=prime_factor(P);
	map<ll,ll> C;
	for(auto& x:V) C[x]++;
	ll ans=1;
	for(auto& x:C){
		for(int i=0;i<x.second/N;i++) ans *= x.first;
	}
	out(ans);
	return 0;
}


Measured memory_bytes: 2428
def resolve():
    n, Y = map(int, input().split())

    for x in range(0, n+1):
        for y in range(0, n-x+1):
            z = n-x-y
            sum = 10000*x + 5000*y + 1000*z
            if sum == Y:
                return print(' '.join(map(str, [x, y, z])))

    print(' '.join(map(str, [-1, -1, -1])))

if __name__ == '__main__':
    resolve()

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

int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    int x;
    rep(i,n-1){
        cin>>x;
        a[x-1]++;
    }
    rep(i,n){
        cout<<a[i]<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 4020
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define Nmax 100008
ll n,m,x,y,z ,k,e,r,a,b,nb,q,c,test;
ll ai[Nmax], bi[Nmax]  ;
long double h,l;
string s , s1 ;

int main ()
{
    cin>> s ; cin>> s1 ;
    for(int i =0 ; i<3 ;i++) nb+=s[i]==s1[i] ;
    cout << nb ;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int x=sc.nextInt();
		for(int i=x-k+1;i<x+k;i++) {
			if(i==x+k-1) System.out.println(i);
			else System.out.print(i+" ");

		}



	}
}


Measured memory_bytes: 21716
from collections import defaultdict
n=int(input())
a=[]
d=defaultdict(int)
D=[]
for i in range(n):
    a.append(input())

for key in a:
    d[key]+=1

for k,v in d.items():
    if v%2==1:
        D.append(k)
print(len(D))

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

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

using namespace std;

struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};

//using Graph = vector<vector<Edge>>
using Graph = vector<vector<int>>;

// header area

int main() {
    string S;
    cin >> S;

    if (S.compare("ABC") == 0) {
        cout << "ARC";
    }
    else cout << "ABC";
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define repA(i,n) for(ll i=n; i>=0; i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (ll)(a.size())
typedef long long ll;
typedef long double ld;
const ll mod = 998244353;//1e9+7

void solve() {
  ll a,b,v,w,t;
  cin>>a>>v>>b>>w>>t;
  if(a == b)   {
    cout<<"YES";return;
  }
  if(v <= w) {
    cout<<"NO";return;
  }
  if((v-w)*t >= abs(a-b)) {
    cout<<"YES";
  }
  else {
    cout<<"NO";
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  #endif
  ll t = 1;
  //cin>>t;
  rep(i,t)  {
    solve();
    cout<<'\n';
  }
  return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	
	if((a==5 && b==5 && c==7)||(a==5 && b==7 && c==5)||(a==7 && b==5 && c==5)) printf("YES\n");
	if(!((a==5 && b==5 && c==7)||(a==5 && b==7 && c==5)||(a==7 && b==5 && c==5))) printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/python
# -*- coding: utf-8 -*-
import math

while True:
    amount, number, per = map(int, input().split())
    if amount == 0 and number == 0 and per == 0:
        break

    vote = [int(input()) for _ in range(amount)]

    if vote[number-1] == 0:
        print("0")
    else:
        print(math.floor(100 * sum(vote) * (100 - per) / 100 / vote[number-1]))

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


int main (){   
    int N;
  	ll M;
 	cin >> N >> M;
    vector<ll> A(N);
    for (auto& x : A) cin >> x;
    sort(A.begin(), A.end());
    ll pass = 0, fail = 2 * 1e5 + 10;
    while (fail - pass > 1) {
      ll X = (pass + fail) / 2;
      ll cnt = 0;
      for (int i = 0, j = N - 1; i < N; i++) {
        while (j >= 0 && A[i] + A[j] >= X) --j;
        cnt += N - j - 1;
      }
      if (cnt >= M) {
        pass = X;
      } else {
        fail = X;
      }
    }
    ll res = 0;
    ll sum = 0, rem = M;
  int j = N - 1;
    for (int i = 0; i < N; i++) {
      
      while (j >= 0 && A[i] + A[j] > pass) {
        sum += A[j];
        --j;
      }
      ll c = N - j - 1;
      rem -= c;
      res += sum + c * A[i];
    }
    res += pass * rem;
    cout << res << endl;
  
 
}





Measured memory_bytes: 1024
n = list(map(int,input().split()))
order = list(input())

for i in range(len(order)):
    if order[i] == 'E':
        temp = n[0]
        n[0] = n[3]
        n[3] = n[5]
        n[5] = n[2]
        n[2] = temp
    elif order[i] == 'W':
        temp = n[0]
        n[0] = n[2]
        n[2] = n[5]
        n[5] = n[3]
        n[3] = temp
    elif order[i] == 'S':
        temp = n[0]
        n[0] = n[4]
        n[4] = n[5]
        n[5] = n[1]
        n[1] = temp
    else:
        temp = n[0]
        n[0] = n[1]
        n[1] = n[5]
        n[5] = n[4]
        n[4] = temp

print(n[0])



Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int N, K; cin >> N >> K;
    vector<int> A(N); for (auto &a : A) cin >> a;
    for (int i = K; i < N; i++) {
        cout << (A[i - K] < A[i] ? "Yes" : "No") << '\n';
    }
    return 0;
}


Measured memory_bytes: 3984
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

int main(){
  ll n,m;cin>>n>>m;
  priority_queue<ll> q;
  rep(i,0,n){
    ll a;cin>>a;
    q.push(a);
  }
  rep(i,0,m){
    ll tmp=q.top();
    q.pop();
    q.push(tmp/2);
  }
  ll ans=0;
  rep(i,0,n){
    ans+=q.top();
    q.pop();
  }
  cout<<ans<<endl;
}



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

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

Measured memory_bytes: 256
def solve():
    N, M, C = map(int, input().split())
    B = list(map(int, input().split()))
    A = [[0 for _ in range(M)] for _ in range(N)]
    for i in range(N):
        A[i] = list(map(int, input().split()))

    ans = 0
    for i in range(N):
        t = 0
        for a, b in zip(A[i], B):
            t += a * b
        if 0 < t + C:
            ans += 1
    print(ans)


if __name__ == '__main__':
    solve()


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define graph vector<vi>

const ll mod = 1000000007;
ll po(ll x, ll n ){ 
    ll ans=1;
     while(n>0){
         if(n&1) ans=(ans*x)%mod;
         x=(x*x)%mod;
         n/=2;
     }
     return ans;
}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int T=1;
    //cin >> T;
    while(T--){
        ll n,k;
        cin>>n>>k;
        ll ans=0;
        ll l=0,r=0;
        rep(i,k) l+=i;
        rep_a(i,n-k+1,n+1) r+=i;
        ans+=(r-l+1);
        l=k;
        r=n-k;
        ll x=ans%mod;
        //cout<<x<<el;
        while(r>=0){
            x+=(r-l);
            x=(x+mod)%mod;
            ans+=x;
            ans%=mod;
            l++;
            r--;
        }
        cout<<ans%mod<<el;
    }

    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
vector<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'};
vector<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'};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


int main()
{
  cout << fixed << setprecision(10);
  int N,K;
  cin >> N >> K;
  vector<char> D(K);
  rep(i,K) cin >> D[i];
  vector<string> vec(100100);
  rep(i,100100)
  {
    int n = i;
    string str;
    str = to_string(n);
    vec[i] = str;
  }
  for(int i=N;i<P;i++)
  {
    int n = vec[i].size();
    bool ok = true;
    rep(j,n)
    {
      rep(k,K)
      {
        if(vec[i][j]==D[k])
        {
          ok = false;
        }
      }
    }
    if(ok)
    {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 6416