akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<"!"<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vi A(n);
  for(auto &a:A)cin>>a;
  sort(ALL(A),greater<ll>());
  ll mi=llINF;
  ll ans;
  for(int i=1;i<n;i++){
    if(mi>abs(A[i]-(A[0]-A[0]/2))){
      mi=abs(A[i]-(A[0]-A[0]/2));
      ans=A[i];
    }
  }
  cout<<A[0]<<" "<<ans<<endl;
  return 0;
}


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

int main(){
  int x,a,b;
  cin >> x >> a >> b;
  if(abs(a-x) < abs(b-x)){
    cout << "A" << endl;
  }else{
    cout << "B" << endl;
  }


  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int c = scan.nextInt();
    int X;
    if(a > b) {
      X = a; a = b; b = X;
    }
    if(b > c) {
      X = b; b = c; c = X;
    }
    if(a > b) {
      X = a; a = b; b = X;
    } 
      System.out.println(a + " " + b + " " + c);
  }
}

Measured memory_bytes: 26052
#include<stdio.h>
int main(void)
{
	int c1,c5,c10,c50,c100,c500,A,o,p,f,g,m,k;
	scanf("%d",&c1);
	o=c1*1;
	scanf("%d",&c5);
	p=c5*5;
	scanf("%d",&c10);
	f=c10*10;
	scanf("%d",&c50);
	g=c50*50;
	scanf("%d",&c100);
	m=c100*100;
	scanf("%d",&c500);
	k=c500*500;
	A=o+p+f+g+m+k;
	if(A>=1000) printf("%d\n",1);
	else printf("%d\n",0);
	return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <bits/stdc++.h>
#include <iomanip>
// Pyだと想定回厳しいのでコピペ（飛ばし）
using namespace std;
vector<int> rad[605];
long double bf[605],rl[605],tcnt[605];
int n,m;
 
long double gl(int now)
{
    //bf[now]+=g;
    if(rl[now]) return rl[now];
    long double trl = 0;
    for(int i=0;i<rad[now].size();++i)
    {
        trl+=gl(rad[now][i])+1;
    }
//    if(rad[now].size()==0) {
//        if(now==n) return rl[now] = 0;
//        return rl[now] = 1000;
//    }
    if(now==n) return 0;
    return rl[now] = trl/rad[now].size();
}
 
//void ggl(int now,long double g)
//{
//    bf[now]+=g;
//    if(--tcnt[now]>0) return;
//    for(int i=0;i<rad[now].size();++i)
//        ggl(rad[now][i],bf[now]/rad[now].size());
//}
 
 
int main()
{
    scanf("%d%d",&n,&m);
    int s,t;
    for(int i=0;i<m;++i)
    {
        scanf("%d%d",&s,&t);
        rad[s].push_back(t);
    }
 
    gl(1);
    bf[1] = 1;
 
    for(int i=1;i<n;++i)
    {
        long double tv = bf[i]/rad[i].size();
        for(int j=0;j<rad[i].size();++j)
            bf[rad[i][j]]+=tv;
    }
 
    long double ans = 0;
    for(int i=0;i<rad[1].size();++i){
        ans += (1+rl[rad[1][i]]);
    }
    ans/=rad[1].size();
 
 
    long double df = 0;
    for(int i=1;i<=n;++i){
        if(rad[i].size()==1) continue;
        long double tsm = rl[i]*rad[i].size();
        for(int j=0;j<rad[i].size();++j){
            long double sdf = ((tsm-rl[rad[i][j]]-1)/(rad[i].size()-1)-tsm/rad[i].size())*bf[i];
            if(sdf<df) df = sdf;
        }
    }
    cout << setprecision(25) <<std::fixed<<ans+df<< endl;
    return 0;
}

Measured memory_bytes: 5040
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
deque<int> a;
int x,n; 
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x;
		if(i%2==1){
			a.push_back(x);
			continue;
		}
		a.push_front(x);
	}
	if(n%2==1){
		while(!a.empty()){
			cout<<a.back()<<' ';
			a.pop_back();
		}
		return 0;
	}
	while(!a.empty()){
		cout<<a.front()<<' ';
		a.pop_front();
	}	
	return 0;
}



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

int main() {
  int n;
  cin >> n;
  long a[n],b[n],c[n];
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i] >> c[i];
  }
  long dpA[n],dpB[n],dpC[n];
  dpA[0]=a[0],dpB[0]=b[0],dpC[0]=c[0];
  for(int i=1;i<n;i++){
    dpA[i]=a[i]+max(dpB[i-1],dpC[i-1]);
    dpB[i]=b[i]+max(dpA[i-1],dpC[i-1]);
    dpC[i]=c[i]+max(dpA[i-1],dpB[i-1]);
  }
  cout << max(dpA[n-1],max(dpB[n-1],dpC[n-1]));
}

Measured memory_bytes: 4992
#include <stdio.h>

int main(void) {

  int n;
  scanf("%d", &n);
  char s[n+1],t[n+1];
  scanf("%s %s", s, t);
  int flag;
  for (int i = 0; i < n; i++) {
    flag = 1;
    for (int j = i; j < n; j++) {
      if (s[j] != t[j-i]) {
        flag = 0;
        break;
      }
    }
    if (flag == 1) {
      printf("%d\n", n+i);
      return 0;
    }
  }
  printf("%d\n", n*2);

  return 0;
}

Measured memory_bytes: 128
# 15:35 giveup
def P(s):
    print(s)
    exit(0)

s = input()
l = int(s[:2])
r = int(s[2:])
if 1 <= l and l <= 12:
    if 1 <= r and r <= 12:
        P("AMBIGUOUS")
    else:
        P("MMYY")
else:
    if 1 <= r and r <= 12:
        P("YYMM")
    else:
        P("NA")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define N 200020
#define mod 1000000007
#define ll long long
using namespace std;
inline int read(){
  int x=0,f=1;char ch=getchar();
  while(ch>'9'||ch<'0')ch=='-'&&(f=0)||(ch=getchar());
  while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
  return f?x:-x;
}
int a[N], b[N];
template <typename T, int L, int R>
struct Array {
  T a[R - L + 1];
  T& operator [] (int x) {
    return a[x - L];
  }
  T* operator + (int x) {
    return a + (x - L);
  }
};
Array<Array<int, -2020, 2020>, -2020, 2020> dp;
ll frac[8020];
ll fast_pow(ll x, ll y) {
  ll z = 1;
  for (; y; y >>= 1, x = x * x % mod) {
    if (y & 1) {
      z = z * x % mod;
    }
  }
  return z;
}
ll inv(ll x) {
  return fast_pow(x, mod - 2);
}
ll C(ll n, ll m) {
  return frac[n] * inv(frac[m]) % mod * inv(frac[n - m]) % mod;
}
int main(int argc, char const *argv[]) {
  frac[0] = 1;
  for (int i = 1; i <= 8000; ++ i) {
    frac[i] = frac[i - 1] * i % mod;
  }

  int n = read();
  for (int i = 1; i <= n; ++ i) {
    a[i] = read();
    b[i] = read();
    dp[-a[i]][-b[i]] += 1;
  }
  for (int i = -2000; i <= 2000; ++ i) {
    for (int j = -2000; j <= 2000; ++ j) {
      dp[i][j] = (dp[i][j] + dp[i][j - 1] + dp[i - 1][j]) % mod;
    }
  }
  int ans = 0, res = 0;
  for (int i = 1; i <= n; ++ i) {
    ans = (ans + dp[a[i]][b[i]]) % mod;
    res = (res + C(a[i]+b[i]+a[i]+b[i], a[i]+a[i])) % mod;
  }
  ans = ((ans - res) % mod + mod) % mod;
  ans = ans * 500000004ll % mod;
  printf("%d\n", ans);
  return 0;
}
/*
求
\sigma{(i,j)∈S} C(Bi+Bj, Ai+Aj)
*/

Measured memory_bytes: 65024
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <unordered_map>
#include <sstream>
using namespace std;

class Dalmation{
public:
  string getName(long long n){
    int maxP = 1;
    long long maxPV = 26LL;
    long long prevN = n;
    while(true){
      n -= maxPV;
      if(n<=0)break;
      maxP++;
      maxPV *= 26LL;
      prevN = n;
    }
    string retS = getSOffset(prevN,maxP);
    return retS;
  }

  string getSOffset(long long n, int p){
    string retS = "";
    long long currP = 1LL;
    for(int i=0;i<(p-1);i++){
      currP*=26LL;
    }
    //    cout<<"getSOffset, n "<<n<<", p "<<p<<", currP "<<currP<<endl;
    n--;
    for(int i=0;i<p;i++){
      //      cout<<"for, n "<<n<<", currP "<<currP<<endl;
      long long off = n/currP;
      char c = 'a' + (off);
      n %= currP;
      retS += c;
      currP/=26LL;
    }
    return retS;
  }
};

int main(int argc, const char*argv[]){
  Dalmation d;
  string nLn;
  long long n;
  stringstream ss;
  getline(cin,nLn);
  ss<<nLn;
  ss>>n;
  string nm = d.getName(n);
  cout<<nm<<endl;
}


Measured memory_bytes: 3632
N,M = map(int,input().split())
S = []
for i in range(M):
    S.append(list(map(int,input().split()))[1:])
P = list(map(int,input().split()))
res = 0
for i in range(2**N):
    ON = 0
    for j in range(M):
        cnt = 0
        for s in S[j]:
            if (i >> s-1)&1 == 1:
                cnt += 1
        if cnt%2 == P[j]:
            ON += 1
    if ON == M:
        res += 1 
print(res)

Measured memory_bytes: 3188
input_line = list(map(int,input().split()))
c = []
d = []
result_list = []

for i in range(input_line[1]):
    c.append(input_line[0])
    map_result = map(str, c)
    c_result = ''.join(map_result)

for i in range(input_line[0]):
    d.append(input_line[1])
    map_result = map(str, d)
    d_result = ''.join(map_result)

result_list.append(c_result)
result_list.append(d_result)

e = list(map(int, result_list))
print(sorted(e)[1])

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

int main() {
	int N, C, K; cin >> N >> C >> K;
	int T[100010];
	for(int i=0; i<N; ++i) cin >> T[i];
	sort(T, T+N);
	int min=1, dep=T[0]+K, num=1;
	for(int i=1; i<N; ++i){
	    if(num==C || T[i]>dep){
	        ++min;
	        dep=T[i]+K;
	        num=1;
	    }else ++num;
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#define nmax_def 110000
#define Cmax_def 2200
#define mod 1000000007
using namespace std;
typedef long long ll;

int main() {
	ll i, j;
	ll N;
	double v[nmax_def];
	double ans = 0.0;
	cin >> N;
	for (i = 0; i < N; i++)
		cin >> v[i];
	sort(v, v + N, greater<double>());
	for (i = 0; i < N; i++)
	{
		if (i == N - 1)
			ans += v[i] * pow(0.5, i);
		else
			ans += v[i] * pow(0.5, i + 1);
	}
	printf("%.12f", ans);
	return 0;
}

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

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

    long long h, w; cin >> h >> w;
    if(h == 1 || w == 1) cout << 1 << endl;
    else if(h&1 && w&1) cout << (h*w)/2 + 1 << endl;
    else cout << (h*w)/2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;
 
int main(){
 
 int tri[1000][3];
 int a,b,c,N;
 
 cin >> N;
 
 for(int i = 0; i < N; i++){
 
  cin >> tri[i][0] >> tri[i][1] >> tri[i][2];
 
  a = tri[i][0]*tri[i][0];
  b = tri[i][1]*tri[i][1];
  c = tri[i][2]*tri[i][2];

 if(a == b+c || b == a+c || c == a + b)
  cout << "YES" << endl;
 else
  cout << "NO" << endl;
 }
 return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<vector>

using namespace std;


int main() {
	int N, cnt;
	string S;
	int i;
	cin >> N >> S;
	for (i = 0; i < 1000; i++) {
		int c[3] = { i / 100,(i / 10) % 10, i % 10 };
		int f = 0;
		for (int j = 0; j < N; j++) {
			if (S[j] == ('0' + c[f])) f++;
			if (f == 3) break;
		}
		if (f == 3) cnt++;
	}
	cout << cnt << endl;
	return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#include <stack>
#include <map>
#include <unordered_map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    string s;
    cin >> s;
    REP(i,3) {
        cout << s[i];
    }
    cout << 8;
    REPI(i,4,s.size()) cout << s[i];
    cout << endl;
}


Measured memory_bytes: 256
N = int(input())
W = list(map(int,input().split()))
T = 0
S1 = 0
S2 = 0
sa = []
for t in W:
     for i,w in enumerate(W):
          if T > i:
               S1 += w
          else:
               S2 += w
     T += 1
     sa.append(S2 - S1)
     S1 = 0
     S2 = 0

print(min(list(map(abs, sa))))

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    t = list(map(int, input().split()))
    v = list(map(int, input().split()))
    
    
    length = sum(t)*2
    
    dp = [0]*(length+1)
    border = v[0]
    count = t[0]*2
    index = 0
    for i in range(length):
        dp[i+1] = min(dp[i]+0.5, border)
        count -= 1
        if i == length-1:
            break
        if count == 0:
            index += 1
            border = v[index]
            count = t[index]*2
    
    dp[length] = 0
    border = v[n-1]
    count = t[n-1]*2
    index = n-1
    for i in range(length, 0, -1):
        dp[i-1] = min([dp[i]+0.5, border, dp[i-1]])
        count -= 1
        if i == 0:
            break
        if count == 0:
            index -= 1
            border = v[index]
            count = t[index]*2
    
    ans = 0
    for i in range(length):
        ans += (dp[i]+dp[i+1])/4
        
    print(ans)
    
    
    
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 9256
#input
n = int(input())
AC, WA, TLE, RE = 0, 0, 0, 0
for _ in range(n):
    s = str(input())
    if s == "AC":
        AC += 1
    elif s == "WA":
        WA += 1
    elif s == "TLE":
        TLE += 1
    else:
        RE += 1

#output
print("AC x {0}".format(AC))
print("WA x {0}".format(WA))
print("TLE x {0}".format(TLE))
print("RE x {0}".format(RE))

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

int main() {
  string A;
  cin >> A;
  
  if(A[0]==A[1] && A[1]!=A[2] && A[2]==A[3]){
    cout << "Yes" << endl;
  }
  else if(A[0]==A[2]&& A[2]!=A[1] && A[1]==A[3]){
    cout << "Yes" << endl;
  }
  else if(A[0]==A[3]&& A[3]!=A[1] && A[1]==A[2]){
    cout << "Yes"<< endl;
  }
  else{
    cout << "No"<< endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#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
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
   ll dp[2000000];
 int gcd(int a, int b)
{
  if (a%b == 0)
{
return(b);
}
else
{
return(gcd(b,a%b));
}
}
  vector<vector<bool>>d(5001,vector<bool>(5001));
int main(){
  ll a,ans=0;cin>>a;
  string b;cin>>b;
  rep(i,1000){
    ll c=i/100;
    ll d=(i%100)/10;
    ll e=(i%10);
    bool f=false,g=false,h=false;
    rep(o,a){
      if(f==false&&b[o]==c+'0')f=true;
      else if(f&&g==false&&b[o]==d+'0')g=true;
       else if(f&&g&&h==false&&b[o]==e+'0'){
        ans++;
        break;
      }
    }
  }
  cout<<ans;
}



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

int main() {
	double A,B;
	cin >>A>>B;
	double p;
	p=B*10;
	int c;
	c=0;
	for(int i=0;i<10;i++){
		if((p+i)*0.08>=A&&(p+i)*0.08<(A+1)){
			cout <<p+i;
			break;
		}
		c++;
	}
	if(c==10){
		cout <<-1;
	}
	

}

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

template<typename T> void drop(const T &x){cout<<x<<'\n';exit(0);}

void milkshake() {
  int n;
  cin >> n;
  int count = 0;
  int ok = 0;
  for(int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if(a == b) {
      count++;
      if(count == 3) ok = 1;
    }
    else count = 0;
  }
  cout << (ok ? "Yes" : "No") << '\n';
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T=1;
  //cin >> T;
  while(T--) milkshake();

  return 0;
}


Measured memory_bytes: 3648
N = int(input())
A = list(map(int, input().split()))
import collections

A_count = collections.Counter(A)
A_count_nCr = {}

from operator import mul
from functools import reduce

def cmb(n, r):
    r = min(n - r, r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

all_count = 0

for k, v in A_count.items():
    if v >= 2:
        A_count_nCr[k] = cmb(v, 2)
    else:
        A_count_nCr[k] = 0
    all_count += A_count_nCr[k]

for a in A:
    if A_count[a]-1 >= 2:
        print(all_count - A_count_nCr[a] + cmb(A_count[a]-1, 2))
    else:
        print(all_count - A_count_nCr[a])

Measured memory_bytes: 112716
#include<bits/stdc++.h>
int main()
{
    int n,a[105];
    scanf("%d",&n);
    double sum;
    sum=0.0;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=1/(a[i]*1.0);
    }
    printf("%f",1/sum);
    printf("\n");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 200005
using namespace std;
int ans[maxn];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i=2,p;i<=n;i++) {
		cin >> p;
		ans[p]++;
	}
	for(int i=1;i<=n;i++)
		cout << ans[i] << '\n';
	return 0;
}


Measured memory_bytes: 4292
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,A,B=MI()
    ans=0
    rem=N-2
    ans=rem*(B-A)+1
    ans=max(ans,0)
    if A>B or (rem<0 and B-A>=1):
        ans=0
    print(ans)

main()


Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    string S;
    cin >> S;
    if (S[0] == S[1] && S[1] == S[2]) cout << "No\n";
    else cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 256
h,w = map(int, input().split())
S = ['.' + input() + '.' for _ in range(h)]
S.insert(0,'.'*(w+2))
S.append('.'*(w+2))

for r in range(1, h+1):
    for c in range(1, w+1):
        if S[r][c] == '#':
            print('#', end='')
            continue
        else:
            count = 0
            count += S[r-1][c-1:c+2].count('#')
            count += S[r][c-1:c+2].count('#')
            count += S[r+1][c-1:c+2].count('#')
            print(count, end='')
    print()

Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define FOR(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define FORN(i,b,a)for(int i=(b);_a=(a);i>=_a;i--)
#define REP(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define re return
#define vi vector<int>
#define pb push_back
#define si set<int>
#define in insert
#define fl float
#define db double
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define size(s) s.size()
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll dg(ll n)
{
	if(n==1)return 1;
	else return dg(n/2)*2+1;
}
int main()
{
	ll n;
	cin>>n;
	cout<<dg(n)<<endl;
	return 0;
}


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

int main(){
  int n; cin >> n;
  if(n < 10){ cout << "Yes" << endl; return 0; }
  for(int i = 2; i < 10; ++i){
    if((n%i) == 0 && (n/i) < 10){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int n, a; cin >> n >> a;
    if(n  % a == 0) cout <<  n / a << endl;
    else cout << n / a + 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;

int N,M;

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> N >> M;
	ll ans = 1800*M+100*N;
	F0R(i,M) ans *= 2;
	cout << ans;
}

// read!
// ll vs. int!

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

using namespace std;

int main () {

    string str;
    cin >> str;
    if(str=="Rainy") cout << "Sunny" << endl;
    else if(str=="Sunny") cout << "Cloudy" << endl;
    else cout << "Rainy" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[])
{
    int N, C, K;
    cin >> N >> C >> K;
    vector<int> T;
    T.resize(N);
    for (int i = 0; i < N; i++)
    {
        cin >> T[i];
    }

    sort(T.begin(), T.end());
    int lim = T[0] + K;
    int p = 0;
    int ans = 1;
    for (int n : T)
    {
        if (n > lim || p == C)
        {
            ans++;
            p = 1;
            lim = n + K;
            continue;
        }else
        {
            p++;
        }

    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
N=int(input())
ans=''

if N==0:
    print('0')
    exit()

while N!=0:
    Nmod=N%(-2)
    ans+=str(abs(Nmod))
    
    if Nmod==-1:
        N=N//(-2)+1
    else:
        N=N//(-2)

print(''.join(list(reversed(ans))))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    vector<int> D(N); for (auto &d : D) cin >> d;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            ans += D[i] * D[j];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    let mut v2 = Vec::new();
    for _ in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        let v = s.trim().split_whitespace()
            .map(|e| e.parse().ok().unwrap()).collect();
        v2.push(v);
    }
    v2
}
fn main() {
    let v: Vec<i32> = read_vec();
    println!("{} {}", v[0] * v[1], (v[0] * 2) + (v[1] * 2));
}



Measured memory_bytes: 5028
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n+1];
  for(int i=1;i<n+1;i++){
    a[i]=0;
  }
  int q=0;
  for(int i=1;i<=100;i++){
    for(int j=1;j<=100;j++){
      for(int k=1;k<=100;k++){
        q=pow(i,2)+pow(j,2)+pow(k,2)+i*j+j*k+k*i;
        if(q<=n) a[q]++;
      }
    }
  }
  for(int i=1;i<=n;i++){
   cout<<a[i]<<endl;
  }
  return 0;
}


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


bool isprime(ll val) {
    if (val <= 1)return false;
    for (ll i = 2; i*i <= val; i++) {
        if (val%i == 0LL)return false;
    }
    return true;
}

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

    ll n;
    cin>>n;
    ll a[n],b[n+n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
        b[i+n] = b[i];
    }
    vector<ll> mod;
    for(ll i=1e9+7;i<1e9+30;i++){
        if(isprime(i)) mod.push_back(i);
    }
    ll mul[3];
    mul[0]=10007, mul[1]=10009, mul[2]=1007;
    ll h[3]={}, base[3]={1,1,1};
    ll x[3]={};
    for(int i=1;i<n;i++){
        for(int j=0;j<3;j++){
            if(i>1) base[j] = (base[j]*mul[j]) % mod[j];
            h[j] = (h[j]*mul[j] + (a[i]^a[i-1])) % mod[j];
            x[j] = (x[j]*mul[j] + (b[i]^b[i-1])) % mod[j];
        }
    }
    bool pos = true;
    for(int j=0;j<3;j++){
        if(h[j] != x[j]) pos = false;
    }
    vector<pair<ll,ll>> ans;
    if(pos){
        cout << 0 << " " << (a[0]^b[0]) << "\n";
    }
    for(int i=1;i<n;i++){
        bool pos = true;
        for(int j=0;j<3;j++){
            x[j] += mod[j] - (base[j] * (b[i]^b[i-1])) % mod[j];
            x[j] %= mod[j];
            x[j] = (x[j]*mul[j] + (b[n-1+i]^b[n-2+i])) % mod[j];
            if(x[j] != h[j]) pos = false;
        }
        if(pos){
            ans.push_back({n-i, (a[0]^b[i])});
        }
    }
    sort(ans.begin(),ans.end());
    for(auto i:ans){
        cout << i.first << " " << i.second << "\n";
    }
}

Measured memory_bytes: 11372
## coding: UTF-8
s = input().split()
t = [int(p) for p in s]
#print(t)

#print(max(t))
count = 0
for i in range(1, max(t)+1):
    if(t[0] < i and i <= t[1] and t[2] < i and i <= t[3]):
        count += 1
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
deque<char> deq;
int main() 
{
    string s;
    cin >> s;
    for(int i=0;i<s.size();i++)
        deq.push_back(s[i]);
    bool on = false;
    int Q;
    cin >> Q;
    while(Q--) 
	{
        int T;
        cin >> T;
        if(T == 1) 
			on ^= true;
        else 
		{
            int F;
            cin >> F;
            char c;
            cin >> c;
            if(on^(F == 1)) 
				deq.push_front(c);
            else 
				deq.push_back(c);
        }
    }
    string ans;
    while(!deq.empty()) 
    {
    	ans.push_back(deq.front());
    	deq.pop_front();
	}
    if(on) 
		reverse(ans.begin(), ans.end());
    cout<<ans;
    return 0;
}

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni(), a = in.ni(), b = in.ni();
        out.println(Math.min(a*n, b));
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,x;
  cin >> N >> x;
  vector<int> data(N);
  for (int i=0; i<N; i++){
    cin >> data[i];
  }
  sort(data.begin(),data.end());
  for (int i=0; i<N; i++) {
    x = x - data[i];
    if (x == 0) {
      cout << i+1 <<endl;
      return 0;
    }
    if (x < 0){
      cout << i << endl;
      return 0;
    }
    
  }
  cout << N-1 << endl; 
}

Measured memory_bytes: 3608
abc = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
gets.chomp.bytes{|c| abc[c - 97] = 1}
offset = abc.index(0)
if offset == nil
	puts "None"
	exit(0)
end
putc (97 + offset)

Measured memory_bytes: 1916
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define ll long long
#define vi vector<int>
#define pi pair<int, int>
#define pb push_back
#define ppb pop_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()


using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const int MAXN = 2e5 + 667;
int a[MAXN];

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

    set<int> s;
    int n, k = 0;
    cin >> n;
    for(int i = 0;i<n;i++){
        cin >> a[i];
        if(s.count(a[i]) != 0) k++;
        s.insert(a[i]);
    }
    if(k > 0) cout << "NO";
    else cout << "YES";
    return 0;
}


Measured memory_bytes: 10368
#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
using namespace std;

// _________コーディングはここから！！___________
template <typename T = long long, const int sz = 5 * 10000000> struct IO {
    char reader[sz], writer[sz];
    char *now, *now2 = writer;
    IO() {
        reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
        now = reader;
    }
    inline T read() {
        while(*now && *now <= 32) now++;
        if(*now == '-') {
            now++;
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return -res;
        } else {
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return res;
        }
    }
    inline string read_str() {
        string res;
        while(*now and *now != '\n' and *now != ' ') res += *now++;
        now++;
        return res;
    }
    inline void write(T x, char margin = ' ') {
        if(x == 0) {
            putchar('0');
            putchar(margin);
            return;
        }
        if(x < 0) {
            putchar('-');
            x = -x;
        }
        while(x) {
            *now2 = '0' + x % 10;
            now2++;
            x /= 10;
        }
        do {
            now2--;
            putchar(*now2);
        } while(now2 != writer);
        putchar(margin);
    }
    inline void write_str(string s, char margin = ' ') {
        for(auto c : s) putchar(c);
        putchar(margin);
    }
};
IO<int> io;
int n, m, k;
constexpr int MAX = 1e9 + 1;
constexpr int N = 200010;
int a[N], b[N];
int nn;
main() {
    n = io.read(), m = io.read(), k = io.read();
    nn = n;
    rep(i, n) {
        a[i + 1] = io.read() + a[i];
        if(a[i + 1] > k) {
            nn = i;
            ++i;
            for(; i < n; ++i) {
                while(*io.now && *io.now <= 32) io.now++;
                while('0' <= *io.now and *io.now <= '9') io.now++;
            }
            break;
        }
    }
    rep(i, m) {
        b[i + 1] = io.read() + b[i];
        if(b[i + 1] > k) {
            m = i;
            break;
        }
    }
    int now = nn;
    int ans = now;
    for(int i = 1; i <= m; i++) {
        while(b[i] + a[now] > k) now--;
        ans = max(ans, i + now);
    }
    io.write(ans);
}


Measured memory_bytes: 7692
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int n;
pair<int, int> a[200000];

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i].first, a[i].second = i;
	sort(a, a + n, greater<pair<int, int>>());
	for(int i = 0; i < n; i++)
		if(a[0].second == i) cout << a[1].first << "\n";
		else cout << a[0].first << "\n";
	return 0;
}

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

int main()
{
    string s,t ; 
    cin>>s>>t ; 
    
    int n=s.size() ; 
    int m=t.size() ; 
    
    int lcs[n+1][m+1] ; 
    string ans = "" ; 
    
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i==0 || j==0)
                lcs[i][j] =0 ;
                
            else if(s[i-1]==t[j-1])
                lcs[i][j] = 1+ lcs[i-1][j-1] ; 
                
            else
                lcs[i][j] = max(lcs[i][j-1], lcs[i-1][j]) ; 
        }
    }
    
    int x = n ; 
    int y = m ; 
 
    while(x && y){
        
        if(s[x-1] == t[y-1]){
            ans = s[x-1] + ans ; 
            x-- ;
            y-- ; 
        }else if(lcs[x-1][y] > lcs[x][y-1]){
            x-- ; 
        }else
            y-- ; 
        
    }
    
    cout<<ans ; 
   
    return 0;
}


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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

typedef pair<ll,ll> ii;
typedef vector<ii>  vi;

string S[12];
int used[12];
int R, C;
ll  p[12];

ll  HAS[12];
ll  REV[12];

void check()    {
    for(int i = 1 ; i < C ; i += 2) {
        int a = -1;
        int b = -1;

        for(int j = 0 ; j < C ; ++j)    if(!used[j])    {   used[j] = 1;    a = j;  break;  };
        for(int j = 0 ; j < C ; ++j)
            if(!used[j] && (HAS[j] == REV[a]))  {
                used[j] = 1;    b = j;
                break;
            }
        if (b < 0)  return;
    }
    cout << "YES";
    exit(0);
}

void backtrack(int l,int r) {
    if (l > r)  {
        fill(used,used + C,0);

        fill(HAS,HAS + C,0);
        fill(REV,REV + C,0);

        for(int i = 0 ; i < R ; ++i)
        for(int j = 0 ; j < C ; ++j)    {
            int c = S[i][j] - 'a';

            HAS[j] = HAS[j] * 26 + c;
            REV[j] = REV[j] + p[i] * c;
        }
        if (C & 1)  {
            for(int i = 0 ; i < C ; ++i)
                if (HAS[i] == REV[i])   {
                    used[i] = 1;    check();
                    used[i] = 0;
                }
        }
        else    check();

        return;
    }
    if (l == r) {
        for(int i = 0 ; i < R ; ++i)    {
            swap(S[i],S[l]);    backtrack(l + 1,r - 1);
            swap(S[i],S[l]);
        }
        return;
    }
    for(int i = l + 1 ; i <= r ; ++i)   {
        swap(S[i],S[r]);    backtrack(l + 1,r - 1);
        swap(S[i],S[r]);
    }
}

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

    p[0] = 1;   for(int i = 1 ; i < 12 ; ++i)   p[i] = p[i - 1] * 26;

    cin >> R;
    cin >> C;

    for(int i = 0 ; i < R ; ++i)
        cin >> S[i];
    
    backtrack(0,R - 1);

    cout << "NO";
}


Measured memory_bytes: 384
# D
N, K = map(int, input().split())
lst = list(map(int, input().split()))
lst1 = [(lst[0] + 1) / 2]
ma = 0
for i in range(1, len(lst)):
    lst1.append(lst1[i-1] + ((lst[i]+1) / 2))
    if (i >= K):
        ma = max(ma,lst1[i] - lst1[i-K])
ma = max(ma,lst1[K-1])
print(ma)

Measured memory_bytes: 76040
# coding=utf-8
import math


def divide_segment(left, right):
    """divide segment

    Args:
        left: left edge coordinate
        right: right edge coordinate

    Returns:
        divided points
    """
    delta_x_quarter = (right[0] - left[0]) / 3.0
    delta_y_quarter = (right[1] - left[1]) / 3.0

    delta_x_quarter_rotated = (delta_x_quarter - math.sqrt(3) * delta_y_quarter) / 2.0
    delta_y_quarter_rotated = (math.sqrt(3) * delta_x_quarter + delta_y_quarter) / 2.0

    s = [left[0] + delta_x_quarter, left[1] + delta_y_quarter]
    t = [left[0] + delta_x_quarter * 2.0, left[1] + delta_y_quarter * 2.0]
    u = [s[0] + delta_x_quarter_rotated, s[1] + delta_y_quarter_rotated]

    return s, t, u


def make_coch_curve(depth, left, right):
    """make coch curve with depth iteration_number between point left, right
    each vertices positions are printed

    Args:
        depth: depth
        left: left edge point
        right: right edge point

    Returns:
        None
    """
    print("{0:2.8f} {1:2.8f}".format(left[0], left[1]))
    if depth == 0:
        print("{0:2.8f} {1:2.8f}".format(right[0], right[1]))
    else:
        make_coch_curve_recursively(depth-1, left, right)


def make_coch_curve_recursively(depth, left, right):
    """recursion part of coch curve

    Args:
        depth: depth
        left: left edge coordinate
        right: right edge coordinate

    Returns:
        None
    """
    # get coordinate of divided points
    s, t, u = divide_segment(left, right)

    if depth == 0:
        print("{0:2.8f} {1:2.8f}".format(s[0], s[1]))
        print("{0:2.8f} {1:2.8f}".format(u[0], u[1]))
        print("{0:2.8f} {1:2.8f}".format(t[0], t[1]))
        print("{0:2.8f} {1:2.8f}".format(right[0], right[1]))
    else:
        make_coch_curve_recursively(depth - 1, left, s)
        make_coch_curve_recursively(depth - 1, s, u)
        make_coch_curve_recursively(depth - 1, u, t)
        make_coch_curve_recursively(depth - 1, t, right)


def main():
    depth = int(input().strip())
    make_coch_curve(depth, left=[0.0, 0.0], right=[100.0, 0.0])


if __name__ == '__main__':
    main()

Measured memory_bytes: 7900
from math import gcd
MOD = 10 ** 9 + 7
N = int(input())
d = dict()
zeros = 0
for _ in range(N):
    a, b = tuple(map(int, input().split()))
    if not any((a, b)):
        zeros += 1
        continue
    g = gcd(a, b) * (a // abs(a)) if all((a, b)) else a if a else b
    p = a // g, b // g
    d[p] = d.get(p, 0) + 1
counts = dict()
for (a, b), v in d.items():
    if counts.get((b, -a), False) or counts.get((-b, a), False):
        continue
    counts[(a, b)] = v, d.get((b, -a), 0) + d.get((-b, a), 0)
total = 1
for a, b in counts.values():
    total = (total * (pow(2, a, MOD) + pow(2, b, MOD) - 1)) % MOD
print((total + zeros + MOD - 1) % MOD)

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

#define X first
#define Y second

#define reps(X,Y,Z) for(int X=Y; X <= Z; X++)
#define rep(X,Y) for(int (X)=0;(X) < (Y); ++(X))
#define rrep(X,Y) for(int (X)=(Y-1); X >= 0; ++(X))

#define all(X) (X).begin(),(X).end()


using namespace std;

int N,M,w;
int s[512];
int l[512];
int p[512];
int d[512];

int main(){
  cin >> N;
  rep(i,512)d[i] = -1;

  rep(i,N)
    cin >> s[i] >> l[i] >> p[i];

  d[0] = 0;
  rep(t,394){
    rep(i,N){
      reps(j,s[i],l[i]){
        int x = t + j;
        if(x > 393)break;
        if(d[t] == -1)continue; 
        d[x] = max(d[x], d[t]+p[i]);
      }
    }
  }
  cin >> M;

  vector<int> ans;
  rep(i,M){
    cin >> w;
    if(d[w] == -1){
      cout << "-1" << endl;
      return 0;
    }
    ans.push_back(d[w]);
  }
  rep(i,ans.size()){
    cout << ans[i]<< endl;
  }
  return 0;
}

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


def main():
    N = int(input().strip())
    edges = [[] for _ in range(N)]
    for i in range(N-1):
        a, b = map(int, input().strip().split())
        edges[a-1].append([b-1, i])
        edges[b-1].append([a-1, i])
    color = [-1 for i in range(N-1)]
    trgt = deque([[0, -1], ])
    while len(trgt) > 0:
        now, parent_color = trgt.pop()
        cand_color = 0
        for node, edge_num in edges[now]:
            if color[edge_num] == -1:
                cand_color += 1
                if cand_color == parent_color:
                    cand_color += 1
                color[edge_num] = cand_color
                trgt.append([node, cand_color])
    print(max(color))
    print("\n".join(map(str, color)))


if __name__ == "__main__":
    main()


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);

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

    int cnt = 0, ans = 0;

    for(int i = 0; i < n; i++){
        if(a[i] == cnt + 1){
            cnt++;
        }else{
            ans++;
        }
    }

    if(cnt == 0) ans = -1;

    cout << ans << endl;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
bool calc(string s){
  string t = s;
  reverse(ALL(s));
  return s==t;
}
int main() {
  cout << fixed << setprecision(10);
  int a,b;
  cin >> a >> b;
  int ans = 0;
  for(int i = a; i<=b; i++){
    string s = to_string(i);
    if(calc(s)) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */

int64_t agc012a()
{
  size_t n;
  cin >> n;
  vector<int64_t> a(3 * n);
  cin >> a;

  sort(begin(a), end(a));
  int64_t out = 0;
  for(size_t i = n; i < a.size(); i += 2)
    out += a[i];

  return out;
}

int main(const int argc, char * argv [])
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout << agc012a();

  return EXIT_SUCCESS;
}



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

#define INFTY 2001
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define N 100

// 最小全域木を構成し、重みの総和を返す関数
int prim(int n, int A[N][N]) {
  int i, vertex, min_cost, sum_weight, cost[N], color[N];
  // 初期化
  for (i = 0; i < n; i++) {
    cost[i] = INFTY;
    color[i] = WHITE;
  }
  cost[0] = 0;
  color[0] = GRAY;
  sum_weight = 0;
  
  while (1) {
    // Tに隣接する頂点の中で最小のコストを持つものを選ぶ
    vertex = -1;
    min_cost = INFTY;
    for (i = 0; i < n; i++) {
      if (color[i] == GRAY && cost[i] < min_cost) {
        min_cost = cost[i];
        vertex = i;
      }      
    }
    // T = V ならば終了
    if (vertex == -1) break;

    color[vertex] = BLACK;  // vertexをTに加える
    sum_weight += cost[vertex];

    // vertexに隣接し、Tに属していない頂点のコストを更新
    for (i = 0; i < n; i++) {
      if (color[i] != BLACK && A[vertex][i] < INFTY) {
        color[i] = GRAY;
        if (cost[i] > A[vertex][i]) cost[i] = A[vertex][i];
      }
    }
  }

  return sum_weight;
}


// 最小全域木の辺の重みの和を計算する関数
int sum_weight(int n, int parent[], int A[N][N]) {
  int sum = 0;
  
  for (int i = 1; i < n; i++) sum += A[i][parent[i]];
  
  return sum;
}

int main() {
  int i, j, n, w, A[N][N];

  cin >> n;
  // 隣接行列が与えられる
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      cin >> w;
      if (w == -1) A[i][j] = INFTY;
      else A[i][j] = w;
    }
  }

  cout << prim(n, A) << endl;

  return 0;
}



Measured memory_bytes: 3112
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 26 20:58:37 2020

@author: H_Hoshigi
"""

H, N = map(int, input().split())

A_list = list(map(int, input().split()))

sum_A = 0
for i in A_list:
    sum_A += i

answer = ""
if H <= sum_A:
    answer = "Yes"
else:
    answer = "No"

print(answer)



Measured memory_bytes: 13964
//om nama sivaya
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
    int n,m,c=0,co=0,x;
    cin>>n>>m;
    int a[n]={},w[n]={};
    string s;
    while(m--){
        cin>>x>>s;
        x--;
        if(!a[x]){
            if(s=="AC")
            a[x]++;
            else
            w[x]++;
        }
    }
    for(int i=0;i<n;i++){
        if(a[i]){
            c++;
            co+=w[i];
        }
    }
    cout<<c<<" "<<co;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--)
    solve();
}

Measured memory_bytes: 4396
#include<bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N), B(N, 0);
    for (auto& a:A) cin >> a;
    for (int i = N-1; i >= 0; i--) {
        for (int j = i*2+1; j<N; j += i+1) {
            B[i] ^= B[j];
        }
        B[i] ^= A[i];
    }
    int sum = accumulate(B.begin(), B.end(), 0), tmp = sum;
    printf("%d\n", sum);
    for (int i = 0; i<N; i++) {
        if (B[i]) {
            printf("%d%c", i+1, --tmp ? '\n' : ' ');
        }
    }
    return 0;
}

Measured memory_bytes: 2560