akhauriyash/Code-Regression huggingface dataset:
a=list(input())
b=list(input())
c=list(input())
x=a.pop(0)
while True:
    if x=="a":
        if not a:
            print("A")
            break
        x=a.pop(0)
    elif x=="b":
        if not b:
            print("B")
            break
        x=b.pop(0)
    else:
        if not c:
            print("C")
            break
        x=c.pop(0)

Measured memory_bytes: 38384
#include <stdio.h>
#include <stdlib.h>

int cmp(const void *a, const void *b){
	return *(int *)a - *(int *)b;
}

int main()
{
	int N, M, x[100000], d[100000];
	scanf("%d%d", &N, &M);

	int lmax = 0, lmaxindex = -1;
	for(int m=0; m<M; m++){
		scanf("%d", x+m);
	}

	/* sort at x */
	qsort(x, M, sizeof(int), cmp);

	for(int m=1; m<M; m++){
		d[m-1] = x[m] - x[m-1];
	}

	/* sort at d */
	qsort(d, M-1, sizeof(int), cmp);

	int res = 0;
	for(int i=0; i<M-N; i++){
		res += d[i];
	}
	printf("%d\n", res);

	return 0;
}


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

void searchMinProbNum(vector<int> &p, vector<long>& c, int &minProbNum, int tmpProbNum, int goal, int const D) {
  
  for (int i = 0; i < D; i++) {
    int tmp = p.at(i);
    if (tmp == 0) {
      continue;
    }
    
    int point = tmp * (i + 1) + c.at(i);
    if (goal <= point) {
      point = 0;
      int j = 1;
      while (j < tmp) {
        point += (i + 1);
        if (goal <= point) {
          break;
        }
        j++;
      }
      minProbNum = min(tmpProbNum + j, minProbNum);
      //cout << i << " " << probNum << endl;
      continue;
    }
    
    if (tmpProbNum + tmp >= minProbNum) {
      continue;
    } else {
      p.at(i) = 0;
      searchMinProbNum(p, c, minProbNum, tmpProbNum + tmp, goal - point, D);
      p.at(i) = tmp;
    }
  }
}  

int main() {
  int D;
  long long G;
  cin >> D >> G;
  G /= 100;
  
  vector<int> p(D);
  vector<long> c(D);
  for (int i = 0; i < D; i++) {
    long b;
    cin >> p.at(i) >> b;
    c.at(i) = b / 100; 
  }
  
  int minProbNum = 1000;
  searchMinProbNum(p, c, minProbNum, 0, G, D);
  cout << minProbNum;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i32,
        x: [i32; n],
    }
    let mut ans = -1;

    for i in 1..101 {
        let mut sum = 0;
        for j in x.iter() {
            sum += (j - i) * (j - i);
        }
        if ans == -1 || sum < ans {
            ans = sum
        };
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
from math import ceil
d,g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = float('INF')
inf = float('INF')
for i in range(2**d):
    tmp = 0
    cnt = 0
    for j in range(d):
        p,c = pc[j]
        if i & (1 << j):
            tmp += p * (j+1) * 100 + c
            cnt += p
    if g <= tmp and cnt < ans:
        ans = cnt
    if g > tmp:
        tmp_cnt = inf 
        tmp_ = 0
        gg = (g - tmp) / 100
        for j in range(d):
            p,c = pc[j]
            if i & (1 << j):
                continue
            if ceil(gg / (j+1)) < min(p,tmp_cnt):
                cc = ceil(gg / (j+1))
                tmp_ = cc * (j+1) * 100
                tmp_cnt = cc
            elif gg - c / 100 <= p * (j+1) and p < tmp_cnt:
                tmp_ = p * (j+1) * 100 + c
                tmp_cnt = p
        if g <= tmp + tmp_ and cnt + tmp_cnt < ans:
            ans = cnt + tmp_cnt

print(ans)


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

const int p=1e9+7;

ll pow(ll x, ll n) { //x^nの計算
  ll res = 1;
  while (n > 0) {
    if (n & 1){
      res = res*x%p;  // n の最下位bitが 1 ならば x^(2^i) をかける
    }
    x = x*x%p;
    n >>= 1;  // n を1bit 左にずらす
  }
  return res;
}

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  if(N%2==0){
    vector<int> B(N/2,0);
    for(int i=0;i<N;i++){
      B[(N+1-A[i])/2-1]++;
    }
    for(int i=0;i<N/2;i++){
      if(B[i]!=2){
        cout << 0 << endl;
        return 0;
      }
    }
    cout << pow(2,N/2) << endl;
    return 0;
  }
  else if(N%2==1){
    vector<int> B((N+1)/2,0);
    for(int i=0;i<N;i++){
      B[(N+1-A[i])/2-1]++;
    }
    for(int i=0;i<(N-1)/2;i++){
      if(B[i]!=2){
        cout << 0 << endl;
        return 0;
      }
    }
    cout << pow(2,(N-1)/2) << endl;
    return 0;
  }
}

Measured memory_bytes: 3804
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
using namespace std;

int main(){
	int n;
	cin>>n;
	
	vector<tuple<string,int,int> > v(n);
	REP(i,n){
		string s;
		int p;
		cin>>s>>p;
		v[i]=make_tuple(s,-1*p,i+1);
	}
	
	sort(ALL(v));
	
	REP(i,n){
		cout<<get<2>(v[i])<<endl;
	}
}//復習.解説参考.

Measured memory_bytes: 256
n,a,b=map(int,input().split())
s=input()
ab_count=0
b_count=0

for i in s:
    if i=="a":
        if ab_count<a+b:
            print('Yes')
            ab_count+=1
        else:
            print('No')
    elif i=="b":
        if ab_count<a+b and b_count<b:
            print('Yes')
            ab_count+=1
            b_count+=1
        else:
            print('No')
    else:
        print('No')

Measured memory_bytes: 4016
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
const int MAX = 1000000;
const int MOD = 1000000007;
int modPow(long long a, long long n) {
  if (n == 1) return a % MOD;
  if (n % 2 == 1) return (a * modPow(a, n - 1)) % MOD;
  long long t = modPow(a, n / 2);
  return (t * t) % MOD;
}
int main(){
	int n,a,b;
	cin>>n>>a>>b;
	ll x=1;
	ll y=1;
	REP(i,a){
		x*=(n-i);
		x%=MOD;
		y*=(i+1);
		y%=MOD;
	}
	ll ans=-1;
	ans+=modPow(2,n)-(x*modPow(y,MOD-2))%MOD;
	x=y=1;
	REP(i,b){
		x*=(n-i);
		x%=MOD;
		y*=(i+1);
		y%=MOD;
	}
	ans-=(x*modPow(y,MOD-2))%MOD;
	if(ans<0) ans=(ans+2*MOD)%MOD;
	OUT(ans);
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8

def F_0n(n): # F(0, n)を求める
    if n % 2 == 0:
        return (n // 2 % 2) ^ n
    else:
        return (n + 1) // 2 % 2

def F(a, b):
    return F_0n(a - 1) ^ F_0n(b)

A, B = [int(i) for i in input().split()]

print(F(A, B))

Measured memory_bytes: 2940
#include <stdio.h>
#include <math.h>
int main(){
	int d,n,x;
	scanf("%d %d",&d,&n);
	if (d==0)
	{
		x=1;
		if (n==100)
		{
			printf("101\n");
		}else
		{
			printf("%d\n",n*x);
		}
	}else if (d==1)
	{
		x=100;
		if (n==100)
		{
			printf("10100\n");
		}else
		{
			printf("%d\n",n*x);
		}
	}else if (d==2)
	{
		x=10000;
		if (n==100)
		{
			printf("1010000\n");
		}else
		{
			printf("%d\n",n*x);
		}
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=300005;
const ll INF=1LL<<60;

string S;
map<char,int> to;
vector<pair<int,int>> cnt(62);
int L=0,sum=0;
vector<char> ans;
vector<int> ok;

void DFS(int l,int r,int i,int rem){
    if(!rem) return;
    if(r-l<=0) return;
    int t=0;
    for(int j=l;j<r;j++){
        if(!ok[j]) t++;
    }
    if(t==rem){
        for(int j=l;j<r;j++){
            if(!ok[j]){
                ok[j]=1;
                ans[j]=S[cnt[i].se];
            }
        }
        return;
    }
    
    string Q;
    for(int j=0;j<L;j++) Q+=S[cnt[0].se];
    
    int tt=0;
    for(int j=l;j<r;j++){
        if(!ok[j]){
            tt++;
            Q[j]=S[cnt[i].se];
        }
        
        if(tt==t/2){
            cout<<"? "<<Q<<endl;
            int x;cin>>x;
            x=L-x;
            x-=cnt[0].fi;
            if(x){
                DFS(l,j+1,i,x);
            }
            int y=rem-x;
            if(y){
                DFS(j+1,r,i,y);
            }
            break;
        }
    }
    
}

int main(){
  
  srand((unsigned int)time(NULL));
    
    for(char a='a';a<='z';a++) S+=a;
    for(char a='A';a<='Z';a++) S+=a;
    for(char a='0';a<='9';a++) S+=a;
    
    for(int i=0;i<si(S);i++) to[S[i]]=i;
    
    for(int i=0;i<62;i++){
        cout<<"? ";
        for(int j=0;j<128;j++){
            cout<<S[i];
        }
        cout<<endl;
        cin>>cnt[i].fi;
        cnt[i].fi=128-cnt[i].fi;
        L+=cnt[i].fi;
        cnt[i].se=i;
    }
    
    sort(all(cnt),[](auto a,auto b){
        return a.fi>b.fi;
    });
  
  for(int t=0;t<10000;t++){
    int a=rand()%58+4,b=rand()%58+4;
    swap(cnt[a],cnt[b]);
  }
    
    ans.resize(L);
    ok.resize(L);
    
    for(int i=0;i<L;i++){
        cout<<"? ";
        for(int j=0;j<L;j++){
            if(i==j) cout<<S[cnt[0].se];
            else cout<<S[cnt[61].se];
        }
        cout<<endl;
        
        int x;cin>>x;
        x=L-x;
        if(x==cnt[61].fi+1){
            ans[i]=S[cnt[0].se];
            ok[i]=1;
            sum--;
        }
    }
    
    for(int i=1;i<62;i++){
        if(cnt[i].fi==0) continue;
        
        DFS(0,L,i,cnt[i].fi);
    }
    
    cout<<"! ";
    for(int i=0;i<L;i++) cout<<ans[i];
    cout<<endl;
    
}


Measured memory_bytes: 3784
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n, d;
  cin >> n >> d;
  vector<vector<int>> data(n, vector<int>(d));
  rep(i, n) {
    rep(j, d) {
      int x;
      cin >> x;
      data.at(i).at(j) = x;
    }
  }
  int count = 0;
  rep(i, n) {
    for (int j = i+1; j < n; j++) {
      double dis = 0;
      rep(k, d) {
        dis += (data.at(i).at(k) - data.at(j).at(k))*(data.at(i).at(k) - data.at(j).at(k));
      }
      //cout << dis << endl;
      double disru = sqrt(dis);
      double syo;
      syo = disru - (int)disru;
      //cout << (int)disru << endl;
        
      if (syo == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
}
        


Measured memory_bytes: 3600
#include<iostream>
#include<iomanip>
#include<limits>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>


using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define big ((ll)(1e9)+7)


// double c(double x)
// {
//   double X = x;
//   X = int(X) % 10;
//   return X;
// }

int main()
{
  int n;
  cin >> n;
  vector<int> x(n);
  int sum = 0;
  for(int i = 0;i < n;i++)
  {
    cin >> x[i];
    sum += x[i];
  }
  int ave = sum/n;
  int ans = 0;
  int ans_1 = 0;
  for(int i = 0;i < n;i++)
  {
    ans += pow(x[i]-ave,2);
  }
  for(int i = 0;i < n;i++)
  {
    ans_1 += pow(x[i]-ave-1,2);
  }
  // cout << ave <<" " << ans << " " << ans_1 << endl;
  
  cout << min(ans,ans_1) << endl;
}


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

int main() {
  int N, K, sum = 0;
  cin >> N >> K;
  
  for (int i = 0; i < N; i++){
    int a;
    cin >> a;
    
    if (a > K - a){
      sum += K - a;
    }
    else {
      sum += a;
    }
  }
  cout << sum * 2 << endl;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int r; cin >> r;
	cout << 3 * r*r;

	return 0;
}

Measured memory_bytes: 3600
using System;

class B{
  static void Main(){
    int[] Ar = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
    int[] Asr = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
    int su = 0;
    Array.Sort(Asr);
    for (int i = 0; i < Ar[1]; i++){
      su += Asr[i];
    }
    Console.WriteLine(su);
  }
}

Measured memory_bytes: 18568
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll a, b;
int main() {
    cin>>a>>b;
    if(a>=13) cout<<b<<endl;
    else if(a<=5) cout<<0<<endl;
    else cout<<b/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  long long N, M;
  cin >> N >> M;
  long long N_ = N, M_ = M;
  //  if(N > 2*M || M > 2*N){
  //cout << 0 << endl;
  //return 0;
  //}
  int ans = 0;
  long long n = 2*N, m = 2*M;
  while(n > 0 && m > 0){
    m -= N;
    if(m <= 0) break;
    ++ans;
    M = min(m,M);
    n -= M;
    if(n <= 0) break;
    ++ans;
    N = (n+1)/2;
  }
  int ans2 = 0;
  N = N_;
  M = M_;
  n = 2*N;
  m = 2*M;
  while(n > 0 && m > 0){
    m -= N;
    if(m <= 0) break;
    ++ans2;
    M = (m+1)/2;
    n -= M;
    if(n <= 0) break;
    ++ans2;
    N = min(n,N);
  }
  cout << min(ans,ans2) << endl;
  return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    int N;
    cin >> N;
    vl A(N);
    in(N,A);
    
    bool f = true;
    int d = 0;
    ll mon = 1000;
    ll pap = 0;
    
    while (d < N) {
        if(f){
            if(d == N-1) break;
            else if(A[d] < A[d+1]){
                pap = mon/A[d];
                mon -= pap*A[d];
                f = false;
            }
            
            
        }else{
            if(d == N-1){
                mon += pap*A[d];
                pap = 0;
                f = true;
            }else if(A[d] > A[d+1]){
                mon += pap*A[d];
                pap = 0;
                f = true;
            }
            
        }
        
        //cout << d csp mon csp pap << endl;
        d++;
    }
    
    cout << mon << endl;
    
    
    

    return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	int N, K, S;
	cin >> N >> K >> S;

	vector<int> a(N, 0);
	if (S < 1000000000) {
		for (int i = 0; i < N; ++i) {
			if (i < K) { a[i] = S; }
			else { a[i] = 1000000000; }
		}
	} else {
		for (int i = 0; i < N; ++i) {
			if (i < K) { a[i] = S; }
			else { a[i] = 1; }
		}
	}

	for (int i = 0; i < N; ++i) {
		cout << a[i] << (i < N - 1 ? " " : "\n");
	}

	return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<pair<int,int> >a(n);
    REP(i,n){
        int temp;
        cin >> temp;
        a[i] = make_pair(temp,i+1);
    }

    SORT(a);

    REP(i,n)cout << a[i].second << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 1664
import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)

mn = 0
ma = abs(a[0])
ans = 0
for i in a:
    if i < 0:
        mn += 1
    ans += abs(i)
    if abs(i) < ma:
        ma = abs(i)

if mn%2 == 1:
    ans -= ma*2

print(ans)


Measured memory_bytes: 24800
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    string s,ans="YAKI";
    cin>>s;
    bool c=true;
    if(s.size()<3) c=false;
    else{
        rep(i,4){
            if(s[i]!=ans[i]) c=false;
        }
    }
    out((c?"Yes":"No"));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define pb push_back
#define rng(a) a.begin(),a.end()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (i64)(x).size()
#define bit(n) (1LL<<(n))
#define fi first
#define se second
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
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;}

i64 pow_mod(i64 n, i64 k, i64 m){
  i64 r = 1;
  for(;k;k>>=1){
    if(k&1) r=(r*n)%m;
    n=(n*n)%m;
  }
  return r;
}

void Main()
{
  i64 A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;

  i64 ans = X*A + Y*B;
  chmin(ans,C*X*2+max(i64(0),Y-X)*B);
  chmin(ans,C*Y*2+max(i64(0),X-Y)*A);

  cout << ans << endl;

}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}


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

typedef long long LL;

const int N = 1e5+7, RT = 200;
int a[N];
LL sum[N][RT];

LL query(int l, int r, int d) {
    assert((r-l)%d==0);
    if (d < RT) {
        if (l<=d)    return sum[r][d];
        return sum[r][d] - sum[l-d][d];
    }

    LL ans = 0;
    for (int i=l; i<=r; i+=d)   ans += a[i];
    return ans;
}

vector<int> divs[N];
int cnt[N];

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

    for (int i=1; i<N; i++)
        for (int j=i; j<N; j+=i)
            divs[j].push_back(i);

    int n;
    cin>>n;
    n--;

    for (int i=0; i<=n; i++)    cin>>a[i];
    for (int i=1; i<RT && i<=n; i++) {
        for (int j=1; j<=n; j++) {
            sum[j][i] = a[j];
            if (j>=i)  sum[j][i] += sum[j-i][i];
        }
    }

    LL ans = 0;
    for (int a=1; a<n; a++) {
        for (int d: divs[n-a]) {
            if (d >= a) break;
            int k = (n-a)/d;
            if (a%d==0 && k*d>=a)   continue;
            LL x = query(a, n, d) ;
            LL y = query(d, k*d, d);
            LL cur =  x + y;
            ans = max(ans, cur);
//            cout<<a<<" "<<a-d<<" = "<<cur<<" "<<x<<" "<<y<<endl;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 167296
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
#define ll long long
#define _for(i,a,b) for(int i = (a); i < (b); i++)
#define _rep(i,a,b) for(int i = (a); i <= (b); i++)

int main(){
    ll n, ans = 1e12+100;
    cin >> n;
    int q = 1e6+100, flag = 1;
    for(int i = 2; i < q && i<=n; i++)
        {
            if(n%i) continue;
           ans = min(ans, i+n/i-2);
        }
    cout << min(ans, n-1) << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define INF 9000000000000000000
#define ff first
#define ss second
#define mod 1000000007
#define endl "\n"
#define BS binary_search

int32_t main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int tc=1;
    //cin>>tc;
    while(tc--){
        int n,k;cin>>n>>k;
        int a[n+1];
        for(int i=1;i<=n;i++){
            cin>>a[i];
        }

        for(int i=k+1;i<=n;i++){
            if(a[i]<=a[i-k])
                cout<<"No"<<endl;
            else
                cout<<"Yes"<<endl;
        }
        /*if(flag)
            cout<<"No"<<endl;
        else
            cout<<"Yes"<<endl;*/
    }
}


Measured memory_bytes: 5192
def main():
    N = int(input())
    V = [int(n) for n in input().split()]
    C = [int(n) for n in input().split()]
    VC = [0]*N
    for i in range(N):
        VC[i] = V[i] - C[i]
    res = 0
    for v in VC:
        if v > 0:
            res += v
    print(res)
main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000000000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll f = 1;
    while(a > 0 && c > 0)
    {
        if(f)
            c -= b;
        else
            a -= d;
        f = !f;
    }
    if(a > 0)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 3652
s = input()
ans = True
for i in range(len(s)):
  if s[i] != s[len(s)-i-1]:
    ans = False
for i in range((len(s)-1)//2):
  if s[i] != s[(len(s)-1)//2-i-1]:
    ans = False
for i in range((len(s)+3)//2, len(s)):
  if s[i] != s[len(s)-i-1]:
    ans = False
if ans:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
import java.io.*;

public class Main {

    class Point {
        public final double x;
        public final double y;

        public Point(double x, double y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return String.format("%f %f", x, y);
        }
    }

    void f(int n, Point s, Point e) {
        if (n == 0) return;
        double unitX = e.x - s.x;
        double unitY = e.y - s.y;
        Point e1 = new Point(s.x + unitX / 3, s.y + unitY / 3);
        f(n - 1, s, e1);
        System.out.println(e1.toString());
        Point e2 =
                new Point(e1.x + unitX / 3 * Math.cos(Math.PI / 3) - unitY / 3 * Math.sin(Math.PI / 3),
                        e1.y + unitX / 3 * Math.sin(Math.PI / 3) + unitY / 3 * Math.cos(Math.PI / 3));
        f(n - 1, e1, e2);
        System.out.println(e2.toString());
        Point e3 = new Point(s.x + unitX * 2 / 3, s.y + unitY * 2 / 3);
        f(n - 1, e2, e3);
        System.out.println(e3.toString());
        f(n - 1, e3, e);
    }

    void solve() {
        int n = io.nextInt();
        Point s = new Point(0, 0);
        Point e = new Point(100, 0);
        System.out.println(s.toString());
        f(n, s, e);
        System.out.println(e.toString());
    }

    boolean f(int n, int[] A, int idx, int sum) {
        if (idx == A.length) return n == sum;
        return f(n, A, idx + 1, sum + A[idx]) || f(n, A, idx + 1, sum);
    }

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

    IO io = new IO();

    class IO {
        private final int SIZE = 1 << 12;
        private final InputStream stream = System.in;
        private final byte[] buffer = new byte[SIZE];
        private int ptr = 0, buffLen = 0;

        private boolean hasNextByte() {
            if (ptr < buffLen) return true;
            ptr = 0;
            try {
                buffLen = stream.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            return buffLen > 0;
        }

        private byte readByte() {
            if (hasNextByte()) return buffer[ptr++];
            return -1;
        }

        private boolean isAscii(byte i) {
            return '!' <= i && i <= '~';
        }

        public char nextChar() {
            byte b = readByte();
            while (!isAscii(b)) b = readByte();
            return (char) b;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();
            byte b = readByte();
            while (isAscii(b)) {
                sb.append((char) b);
                b = readByte();
            }
            return sb.toString();
        }

        public int nextInt() {
            return Integer.valueOf(next());
        }

        public long nextLong() {
            return Long.valueOf(next());
        }

        public double nextDouble() {
            return Double.valueOf(next());
        }
    }
}



Measured memory_bytes: 38780
def resolve():
    import itertools

    n, m, x = list(map(int, input().split()))

    prices = []
    gains = []
    for i in range(n):
        price, *gain = list(map(int, input().split()))
        prices.append(price)
        gains.append(gain)

    combs = []
    for i in range(n + 1):
        for comb in itertools.combinations(list(range(n)), i):
            combs.append(comb)

    successful = []
    for comb in combs:
        levels = [0] * m
        sum = 0

        for i in comb:
            sum += prices[i]
            for j in range(m):
                levels[j] += gains[i][j]

        levels = list(filter(lambda item: item >= x, levels))
        if len(levels) == m:
            successful.append(sum)

    print(min(successful)) if len(successful) != 0 else print(-1)
resolve()

Measured memory_bytes: 69040
#include <bits/stdc++.h>
#include <cstring> 
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define For2(i, st, en) for(ll i=st; i<en; i+=2)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define int long long int
#define F first
#define mem(a,b) memset(a,b,sizeof(a))
#define S second
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 1000000000000000007
#define MAXN 200008

int dis[MAXN];
std::vector<std::vector<int>> adj(MAXN);

bool BFS(int src, int dest, int v, int pred[], int dist[]) 
{
	list<int> queue; 
	bool visited[v]; 

	for (int i = 0; i < v; i++) { 
		visited[i] = false; 
		dist[i] = INT_MAX; 
		pred[i] = -1; 
	} 

	visited[src] = true; 
	dist[src] = 0; 
	queue.push_back(src); 

	while (!queue.empty()) { 
		int u = queue.front(); 
		queue.pop_front(); 
		for (int i = 0; i < adj[u].size(); i++) { 
			if (visited[adj[u][i]] == false) { 
				visited[adj[u][i]] = true; 
				dist[adj[u][i]] = dist[u] + 1; 
				pred[adj[u][i]] = u; 
				queue.push_back(adj[u][i]); 

				if (adj[u][i] == dest) 
				return true; 
			} 
		} 
	} 

	return false; 
} 


int printShortestDistance(int s, int dest, int v) 
{ 
	int pred[v], dist[v]; 

	if (BFS(s, dest, v, pred, dist) == false) 
	{
		return 1000000; 
	}

	return dist[dest];
} 

signed main(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    #ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
 
    int n, m, i, j;
    cin>>n>>m;
    string arr[n];
    std::vector<int> v;
    for(i=0;i<n;i++)
    	cin>>arr[i];
    for(i=0;i<n;i++){
    	for(j=0;j<m;j++){
    		int k=i*m+j;
    		if(arr[i][j]=='#')
    			continue;
    		if(arr[i][j]=='.')
    			v.pb(k);
    		if(j+1<m&&arr[i][j]=='.'&&arr[i][j+1]=='.')
    		{
    			adj[k].pb(k+1);
    			adj[k+1].pb(k);
    		}
    		if(i+1<n&&arr[i][j]=='.'&&arr[i+1][j]=='.'){
    			adj[k].pb(k+m);
    			adj[k+m].pb(k);
    		}
    	}
    }
    int ans=-1;
    for(i=0;i<v.size();i++){
    	for(j=0;j<v.size();j++){
    		if(v[i]==v[j])
    			continue;
    		ans = max(ans, printShortestDistance(v[i], v[j], 500));
    	}
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define eb              emplace_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mpii            map<int,int>
#define mpsi            map<string,int>
#define mpss            map<string,string>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define all(v)          v.begin(),v.end()
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x

#define deb(x)          cout<<"("<<#x<<")"<<"----->"<<x<<"\n"
#define clr(ar)         memset(ar,0,sizeof(ar))
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define sz 100009
#define si(x) scanf("%lld",&x)
#define sii(x,y) scanf("%lld %lld",&x,&y)
#define out(x) printf("%lld\n",x)
#define spc  printf(" ")
#define line printf("\n")
#define mod 1000000007
#define pf printf
int32_t main()
{
	int i,n,cs,test,m,k,j,q,u,v,w;
	si(n);
  	n = n^1;
  	out(n);




return 0;
}





Measured memory_bytes: 3760
N=int(input())
c=input()
dataR=[int(c[i]=="R") for i in range(N)]
dataW=[int(c[i]=="W") for i in range(N)]

for i in range(N-2,-1,-1):
    dataR[i]+=dataR[i+1]
for i in range(1,N):
    dataW[i]+=dataW[i-1]

ans=min(dataR[0],dataW[N-1])
for i in range(1,N):
    test=max(dataR[i],dataW[i-1])
    ans=min(ans,test)

print(ans)


Measured memory_bytes: 95516
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#define endl '\n'
//#define ll long long
#define mod 1000000007
#define NCONS 100001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
#define int long long
#define double long double
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
typedef long long ll;

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

#define YYYY cout << "YES" << endl
#define NNNN cout << "NO" << endl
#define yyyy cout << "Yes" << endl
#define nnnn cout << "No" << endl

int32_t main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int a, b; cin >> a >> b;
    cout << max(a + b, max(a - b, a * b)) << endl;
    
    return 0;
}


Measured memory_bytes: 256
/* 
   AOJ 1335
   Equal Sum Sets
   2015/8/6
*/

#include<stdio.h>

int count = 0;

void dfs(int n, int k, int s, int m)
{
  int max_n = n, num = k, sum = s, min = m, i, j;
  
  //  printf("%d %d %d %d\n", n, k, s, m);
  
  if(num == 1)
    {
      if(min < sum && sum <= max_n)
	{
	  count++;
	  //	  printf("FUCK!!\n");
	}
      return ;
    }
  
  for(i = min + 1; i <= max_n; i++)
    {
      dfs(max_n, num - 1, sum - i, i);
    }
}


int main(void)
{
  int n, k, s, ans;

  while(1)
    {
      count = 0;
      scanf("%d %d %d", &n, &k, &s);
      if(n == 0 && k == 0 && s == 0)
	{
	  break;
	}
      dfs(n, k, s, 0);
      printf("%d\n", count);
    }
  return 0;
}

Measured memory_bytes: 600
#include "bits/stdc++.h"
using namespace std;
typedef long long int lli;
#define pb push_back
#define mp make_pair
#define mod 998244353
#define ff first
#define ss second
#define pi pair<lli,lli>
#define pii pair<pi,lli>
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 1e6 + 5;

int main() {
	IOS
	int T = 1;
	// cin >> T;
	while(T--) 
	{
		char c;
		cin >> c;
		if(c >= 'A' && c <= 'Z') cout << 'A' << endl;
		else cout << "a\n";
	}	
	return 0;
}

Measured memory_bytes: 3644
h1=gets.chomp
h2=gets.chomp
h3=gets.chomp
h4=gets.chomp
h5=gets.chomp
h6=gets.chomp
h7=gets.chomp
h8=gets.chomp
h9=gets.chomp
h10=gets.chomp

height=[h1.to_i,h2.to_i,h3.to_i,h4.to_i,h5.to_i,h6.to_i,h7.to_i,h8.to_i,h9.to_i,h10.to_i]
height2=height.sort

puts height2[9]
puts height2[8]
puts height2[7]

Measured memory_bytes: 6092
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int L=61;

inline LL pos(LL a,LL i) {return a&(1ll<<i);}
inline LL solve_lu(LL i,LL a,LL b) {
	if(!~i) return 1;
	if(a>=b) {
		return (1ll<<(i+1))-b;
	} else if(pos(a,i)^pos(b,i)) {
		return solve_lu(i-1,a,b^pos(b,i));
	} else return solve_lu(i-1,a^pos(a,i),b^pos(b,i))+(pos(b,i)?0:(1ll<<i));
}
inline LL solve_ul(int i,LL a,LL b) {
	if(!~i) return 1;
	if(a>=b) return 1ll<<(i+1);
	if(pos(a,i)^pos(b,i)) {
		LL t=a, p=-1;
		while(t) t>>=1, ++p;
		LL ans=(1ll<<(p+1));
		ans+=solve_lu(i-1,a,b^pos(b,i));
		return ans;
	} else {
		LL ans=0;
		if(pos(a,i)) {
			ans+=(1ll<<(i+1));
		} else {
			ans+=solve_ul(i-1,a,b);
			ans+=(1ll<<i);
		}
		return ans;
	}
}
inline LL solve_area(int i,LL a,LL b) {
	if(!~i) return 1;
	if(pos(a,i)^pos(b,i)) {
		LL ans=solve_ul(i-1,b^pos(b,i),a^pos(a,i));
		ans+=(1ll<<i)-a; 
		return ans;
	} else return solve_area(i-1,a^pos(a,i),b^pos(b,i));
}
int main() {
	LL a,b; cin>>a>>b;
	cout<<solve_area(L-1,a,b);
}


Measured memory_bytes: 256
def getval():
    n = int(input())
    a = list(map(int,input().split()))
    return n,a

def main(n,a):
    m = 1000
    f = 0
    for i in range(n):
        if i>0:
            if a[i]>a[i-1]:
                m += f*a[i]
                f = 0
        if i<n-1:
            if a[i]<a[i+1]:
                f += m//a[i]
                m %= a[i]
    if f!=0:
        m += f*a[i-1]
    print(m)
            

if __name__=="__main__":
    n,a = getval()
    main(n,a)

Measured memory_bytes: 61380
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using llong = long long;
using vi    = vector<int>;
using vvi   = vector<vi >;
using vvvi  = vector<vvi >;
using pii   = pair<int,int>;
constexpr int    INF=1e9;
constexpr double EPS=1e-9;
constexpr int    MOD=1e9+7;
template<class Type>
void line(const Type &a){int cnt=0;for(const auto &elem:a){cerr<<(cnt++?' ':'>');cerr<<elem;}cerr<<endl;}

struct UnionFind{
	vi par;		//par[i]:=(0以上の場合iの親, 0未満の場合は親iのグループのサイズ).
	int num;	//num:=(グループ数).
	
	UnionFind(size_t n):par(n,-1),num(n){}//constructor.
	
	void init(){fill(ALL(par),-1), num=par.size();}//初期化する.
	int root(int x){return (par[x]<0)?x:par[x]=root(par[x]);}//xの親を返す. recrusion.
	int size(int x){return -par[root(x)];}//xが属するグループのサイズを返す.
	bool same(int x,int y){return root(x)==root(y);}//xとyが同じグループに属するか.
	bool unite(int x,int y){//xとyのグループを結合する.
		x=root(x), y=root(y);
		if(x==y) return false;//do nothing.
		if(size(x)<size(y)) swap(x,y);//merge technique(y->x).
		par[x]+=par[y];
		par[y]=x;
		num--;
		return true;
	}
};

int main(){
	int n,m;
	cin>>n>>m;
	
	UnionFind uf(n);
	REP(i,m){
		int a,b;
		cin>>a>>b;
		a--, b--;
		
		uf.unite(a,b);
	}
	
	cout<<uf.num-1<<endl;
}

Measured memory_bytes: 3788
/*

*/
#include<iostream>
#include<iomanip>
#include<ios>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>
#include<cstdlib>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)
#define MAX_N 10000

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

const int INF = 1<<30;
const ll MOD = ll(1e9+7);

int main(){
  vector<int> vec(5);
  rep(i, 5)cin>>vec[i];
  cout<<find(vec.begin(), vec.end(), 0)-vec.begin()+1<<endl;
  // system("read -n 1 -s -p \"Press any key to continue...\"");
}


Measured memory_bytes: 3636
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	LL n, m;
	while(cin >> n >> m){
		LL k = 1;
		REP(i,m) k *= 2;
		cout << k*(n*100+m*1800) << endl;
	}
	return 0;
}


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

ll H;
ll W;
ll N;

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

    if (H > W) {
        if(N % H == 0) {
            cout << N/H << endl;
        } else {
            cout << N/H + 1 << endl;
        }
    } else {
        if(N % W == 0) {
            cout << N/W << endl;
        } else {
            cout << N/W + 1 << endl;
        }
    }

    return 0;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define PB push_back

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVi;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;

int main(){
	ios::sync_with_stdio(false);
    long long n,c,k;

    cin>>n>>c>>k;
    VI t(n);
    rep(i,n){
        cin>>t[i];
    }
    sort(t.begin(),t.end());
    int fs = 0;
    int bcnt=0;
    int ans = 0;
    int i = 0;
    while(i<n){
        while(i < n && t[i] <= t[fs] + k && bcnt < c){
            bcnt++;
            i++;
        }
        fs = i;
        if(bcnt>0){
            ans++;
            bcnt=0;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string.h>
#include <queue>
#include <tuple>

using namespace std;

const int N = 1000;
char a[N][N];
int d[N][N];
int n, m, k;

bool inside(int x, int y) {
    return 0 <= x && x < n && 0 <= y && y < m;
}

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

int div_up(int a, int b) {
    return (a + b - 1) / b;
}

int main() {
    cin >> n >> m >> k;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int x = -1, y = -1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == 'S') {
                x = i;
                y = j;
            }
        }
    }
    memset (d, -1, sizeof d);
    d[x][y] = 0;
    queue <tuple<int, int>> q;
    q.push(make_tuple(x, y));

    while (!q.empty()) {
        int cx, cy;
        tie(cx, cy) = q.front();
        q.pop();
        if (d[cx][cy] == k) continue;
        for (int side = 0; side < 4; side++) {
            int nx = cx + dx[side];
            int ny = cy + dy[side];
            if (inside(nx, ny) && a[nx][ny] == '.' && d[nx][ny] == -1) {
                d[nx][ny] = d[cx][cy] + 1;
                q.push(make_tuple(nx, ny));
            }
        }
    }
    int ans = N * N;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (d[i][j] != -1) {
                int more = div_up(min(min(i, j), min(n-1-i, m-1-j)), k);
                ans = min(ans, more + 1);
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

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

const int maxN = 110;

int C[4];
int cnt[26];
char str[maxN];

int main (){
	int h, w, i, j, ans = 0;
	scanf("%d%d", &h, &w);
	for(i = 0; i < h; ++i){
		scanf("%s", str);
		for(j = 0; j < w; ++j)
			++cnt[str[j] - 'a'];
	}
	for(i = 0; i < 26; ++i) ++C[cnt[i] % 4];
	if(h % 2 == 0){
		if(w % 2 == 0)
			ans = !C[1] && !C[2] && !C[3];
		else
			ans = !C[1] && !C[3] && (C[2] <= h / 2);
	}
	else{
		if(w % 2 == 0)
			ans = !C[1] && !C[3] && (C[2] <= w / 2);
		else
			ans = C[1] == 1 && !C[3] && (C[2] <= w / 2 + h / 2);
	}
	puts(ans ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define ll long long
#define fr first
#define sc second
#define ii pair<ll,ll>
#define mp make_pair
using namespace std;
string s[200005];
int a[200005];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>s[i]>>a[i];
    }
    string t;
    cin>>t;
    int ok = 0;
    int ans = 0;
    for(int i=0;i<n;i++)
    {
        if(ok)
        ans+=a[i];
        if(s[i] == t)
            ok = 1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2300
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
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; }
 
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
 
	int A[3];
	rep(i,3) cin >> A[i];
	sort(A, A+3);
	int sum = A[2]+A[2]-A[1]-A[0];
	if(sum % 2 == 0){
		cout << sum/2 << endl;
	}
	else{
		cout << sum/2+2 << endl;
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
const int MAXN = 1e5+5;
ll dp[MAXN]={0};
inline ll max(ll a,ll b){
    return a>b?a:b;
}
int main(){
    int N,W;
    cin>>N>>W;
    ll maxx=0;
    for(int i=0;i<N;++i){
        ll w,v;
        cin>>w>>v;
        for(int j=W;j>=w;--j){
            dp[j]=max(dp[j],dp[j-w]+v);
            maxx=max(maxx,dp[j]);
        }
    }
    cout<<dp[W]<<endl;
    return 0;
}

Measured memory_bytes: 1024