akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

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

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n;
    cin >> n;
    ll mi = LLINF;
    REP(i, 5) {
        ll a; cin >> a;
        chmin(mi, a);
    }

    cout << 4 + ceil(n, mi) << endl;

    return 0;
}


Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=2e5+5,M=(1<<19)+5;
int x[N],li[19][N],ri[19][N],sl[M],sr[M],mr[N],val[19];
int n,v,t,lim;
int main(){
	scanf("%d%d",&n,&v);
	fp(i,1,n)scanf("%d",&x[i]);
	val[0]=v;while(v)val[++t]=(v>>=1);
	lim=(1<<t);
	fp(j,0,t){
		li[j][1]=1,ri[j][n]=n;
		fp(i,2,n)li[j][i]=(x[i]-x[i-1]<=val[j]?li[j][i-1]:i);
		fd(i,n-1,1)ri[j][i]=(x[i+1]-x[i]<=val[j]?ri[j][i+1]:i);
	}
	sl[0]=0,sr[0]=n+1;
	fp(i,1,lim-1)sl[i]=1,sr[i]=n;
	fp(i,0,lim-1)fp(j,1,t)if(i>>(j-1)&1^1){
		cmax(sl[i|(1<<(j-1))],ri[j][sl[i]+1]);
		cmin(sr[i|(1<<(j-1))],li[j][sr[i]-1]);
	}
	fp(i,0,n+1)mr[i]=2333333;
	fp(i,0,lim-1)cmin(mr[sl[i]],sr[(lim-1)^i]);
	fd(i,n,0)cmin(mr[i],mr[i+1]);
	fp(i,1,n)puts(mr[li[0][i]-1]<=ri[0][i]+1?"Possible":"Impossible");
	return 0;
}

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

#define REP(i,n) for (int i=0;i<signed(n);i++)
#define EOM 100

using namespace std;

int main() {
	int H,W; //Hight, Width
	char G[EOM][EOM]; //Graph
	std::fill(G[0], G[EOM], 'B'); //Gを'B'で埋める
	cin >> H >> W;
	REP(i,H) REP(j,W) cin >> G[i+1][j+1]; //1マス分すきまをあける
	REP(i,EOM) REP(j,EOM) {
		if (G[i][j] != '#') continue;
		char u,r,d,l; //Up, Right, Down, Left
		u = G[i][j-1];
		r = G[i+1][j];
		d = G[i][j+1];
		l = G[i-1][j];
		if (u=='#' || r=='#' || d=='#' || l=='#') continue;
		cout << "No";
		return 0;
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols
    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])
    return ret


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_map_as_int(H):
    '''
    #→1,.→0として読み込む
    '''
    ret = []
    for _ in range(H):
        ret.append([1 if s == '#' else 0 for s in read()[:-1]])
        # 内包表記はpypyでは若干遅いことに注意
        # #numpy使うだろうからこれを残しておくけど
    return ret


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from math import gcd


def lcm(a, b):
    # 最小公倍数
    g = gcd(a, b)
    return a * b // g


N = read_a_int()
if str(N).count('7'):
    print('Yes')
else:
    print('No')


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


n = int(input())
xyu = [None]*n
from collections import defaultdict
dx = defaultdict(list)
dy = defaultdict(list)
dxpy = defaultdict(list)
dxmy = defaultdict(list)
for i in range(n):
    x,y,u = input().split()
    x,y = (int(x), int(y))
    dx[x].append((y, u))
    dy[y].append((x, u))
    dxpy[x+y].append((x,u))
    dxmy[x-y].append((x,u))

def sub(maru, batu):
    ans = float("inf")
    if not maru or not batu:
        return ans
    maru.sort()
    batu.sort()
    j = -1
    for i in range(len(batu)):
        while j+1<len(maru) and maru[j+1]<=batu[i]:
            j += 1
        if j<len(maru) and -maru[j]+batu[i]>=0:
            ans = min(ans, -maru[j]+batu[i])
#         print(i,j, maru[i], batu[j])

#     for i in range(len(maru)):
#         while j+1<len(batu) and batu[j+1]<=maru[i]:
#             j += 1
#         if j<len(batu) and batu[j]-maru[i]>=0:
#             ans = min(ans, batu[j]-maru[i])
#         print(i,j, maru[i], batu[j])
    return ans
ans = float("inf")
for v in dy.values():
    maru = [item[0] for item in v if item[1]=="R"]
    batu = [item[0] for item in v if item[1]=="L"]
    ans = min(ans, sub(maru, batu)*5)
for v in dx.values():
    maru = [item[0] for item in v if item[1]=="U"]
    batu = [item[0] for item in v if item[1]=="D"]
    ans = min(ans, sub(maru, batu)*5)
for v in dxpy.values():
    maru = [item[0] for item in v if item[1]=="R"]
    batu = [item[0] for item in v if item[1]=="U"]
    ans = min(ans, sub(maru, batu)*10)
    maru = [item[0] for item in v if item[1]=="D"]
    batu = [item[0] for item in v if item[1]=="L"]
    ans = min(ans, sub(maru, batu)*10)
for v in dxmy.values():
    maru = [item[0] for item in v if item[1]=="R"]
    batu = [item[0] for item in v if item[1]=="D"]
    ans = min(ans, sub(maru, batu)*10)
    maru = [item[0] for item in v if item[1]=="U"]
    batu = [item[0] for item in v if item[1]=="L"]
    ans = min(ans, sub(maru, batu)*10)
if ans==float("inf"):
    ans = "SAFE"
print(ans)

Measured memory_bytes: 237048
#include <iostream>
#include <cstring>
#include <algorithm>
#include <limits.h>
#include <cstdio>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define MOD1 1000000007;
#define MOD2 1000007
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/*  */

ull pow(ull x,ull n) {
  ull res = 1;
  while(n > 0) {
    if(n&1) res = res * x;
    x = x * x;
    n >>= 1;
  }
  return res;
}
int dic_op(char str[14])
{
  int j;
  long long f = 1;
  long long g = 0;
  for(j = 0;;j++) {
    if(str[j] == 'A')
      g += f * 1;
    else if(str[j] == 'C')
      g += f * 2;
    else if(str[j] == 'G')
      g += f * 3;
    else if(str[j] == 'T')
      g += f * 4;
    else break;
    f *= 5;
  }
  return g; 
}

int main()
{
  static long i,j,k,l;
  long n;
  long cnt = 0;
  int f,g;
  long left,right,mid;
  long ans = 0;
  static char dic[200000000];
  char opstr[14];
  char str[13];
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%s %s",opstr,str);
    if(opstr[0] == 'i') {
      dic[dic_op(str)] = 1;
    }
    else if(opstr[0] == 'f') {
      if(dic[dic_op(str)] == 1)
        puts("yes");
      else
        puts("no");
      j++;
    }
  }
  return 0;
}

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

#define MOD 1000000007

long long A[55][55], X[55][55], R[55][55];

void multiply(long long P[][55], long long Q[][55])
{
    for(int i=1; i<=50; i++)
        for(int j=1; j<=50; j++)
        {
            R[i][j] = 0;
            
            for(int k=1; k<=50; k++)
                R[i][j] += P[i][k] * Q[k][j] % MOD;
        }
    
    for(int i=1; i<=50; i++)
        for(int j=1; j<=50; j++)
            P[i][j] = R[i][j] % MOD;
}

void expo(long long N)
{
    if(N == 1)
        return;
    
    expo(N/2);
    multiply(A, A);
    
    if(N % 2)
        multiply(A, X);
}

int main() {

    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);
    
    int N;
    long long K;
    cin >> N >> K;
    
    for(int i=1; i<=N; i++)
        for(int j=1; j<=N; j++)
        {
            cin >> A[i][j];
            X[i][j] = A[i][j];
        }
    
    expo(K);
    
    long long ans = 0;
    
    for(int i=1; i<=N; i++)
        for(int j=1; j<=N; j++)
            ans += A[i][j];
    
    cout << ans % MOD << "\n";
    return 0;
}

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

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

  if(S == "Sunny")
  cout << "Cloudy" << endl;
  if(S == "Cloudy")
  cout << "Rainy" << endl;
  if(S == "Rainy")
  cout << "Sunny" << endl;
}


Measured memory_bytes: 256
<?php
// Your code here!
$arr = array(0, 0, 0, 0);

$n = fgets(STDIN);
for ($i = 0; $i <= $n; $i++){
    $s = trim(fgets(STDIN));
    switch ($s){
        case 'AC':
            $arr[0] = $arr[0] + 1;
            break;
        case 'WA':
            $arr[1] = $arr[1] + 1;
            break;
        case 'TLE':
            $arr[2] = $arr[2] + 1;
            break;
        case 'RE':
            $arr[3] = $arr[3] + 1;
            break;
        default:
            break;
    }
}

print "AC x $arr[0]\n";
print "WA x $arr[1]\n";
print "TLE x $arr[2]\n";
print "RE x $arr[3]\n";

?>


Measured memory_bytes: 16172
#include <stdio.h>

int main()
{
    int n, m, c,i,j,ans,sum;
    scanf("%d %d %d",&n,&m,&c);
    int b[m], a[n][m];
    for(i=0;i<m;i++){
        scanf("%d",&b[i]);

    }
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&a[i][j]);
        }
    }
    ans=0;
    for(i=0;i<n;i++){
        sum=0;
        for(j=0;j<m;j++){
            sum+=a[i][j]*b[j];
        }
        if(sum+c>0) ans++;
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 128
// This amazing code is by Eric Sunli Chen.
#include<bits/stdc++.h>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

const int maxn=2111;

int n,m,seq[maxn],fa[maxn],timer;
vector<int> g[maxn];

void dfs(int x,int f)
{
	fa[x]=f;seq[++timer]=x;
	for(auto v:g[x])if(v!=f)dfs(v,x);
}

vector<int> get_ans(vector<pii> es,int cur)
{
	vector<int> nw;nw.resize(es.size(),0);
	if(cur==1)return nw;
	int piv=seq[cur],val=-1;
//	printf("piv= %d\n",piv);
	
	vector<pii> n_es,tp;
	
	for(int i=0;i<(int)es.size();i++)
	{
		if(es[i].ff!=piv&&es[i].ss!=piv)
		{
			n_es.pb(es[i]);
			tp.pb(mp(i,-1));
			continue;
		}
		if(es[i].ff==piv)
		{
			swap(es[i].ff,es[i].ss);
			nw[i]=1;
		}
		if(es[i].ff==piv)continue;
		if(val==-1)val=i;
		else
		{
			n_es.pb(mp(es[val].ff,es[i].ff));
			tp.pb(mp(val,i));
			val=-1;
		}
	}
	if(val!=-1)
	{
		n_es.pb(mp(es[val].ff,fa[piv]));
		tp.pb(mp(val,-1));
	}
	vector<int> old=get_ans(n_es,cur-1);
	for(int i=0;i<(int)old.size();i++)
	{
		nw[tp[i].ff]^=old[i];
		if(tp[i].ss>=0)nw[tp[i].ss]^=old[i]^1;
	}
	return nw;
}

int main()
{
	get2(n,m);
	for(int i=1,u,v;i<n;i++)
	{
		get2(u,v);
		g[u].pb(v);
		g[v].pb(u);
	}
	vector<pii> es;
	for(int i=1,u,v;i<=m;i++)
	{
		get2(u,v);
		es.pb(mp(u,v));
	}
	dfs(1,0);
	vector<int> ans=get_ans(es,n);
	set<pii> st;
	for(int i=0;i<(int)es.size();i++)
	{
		if(ans[i])swap(es[i].ff,es[i].ss);
		timer=0;dfs(es[i].ff,0);
		int tmp=es[i].ss;
		while(tmp!=es[i].ff)
		{
			st.insert(mp(fa[tmp],tmp));
			tmp=fa[tmp];
		}
	}
	printf("%d\n",(int)st.size());
	for(int i=0;i<(int)es.size();i++)printf("%d %d\n",es[i].ff,es[i].ss);
	return 0;
}


Measured memory_bytes: 65792
#include <stdlib.h>
#include <iostream>
#include <math.h>
 
using namespace std;
 
int main(){
  int n; cin >> n;
  int a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int ans = 0;
  for(int i=1;i<=n;i++){
      if(i==a[a[i-1]-1] && i != a[i-1]){
        ans++;
        //a[i-1]=0;
      }
    
  }
  cout << ans/2 << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#define rep(i,s,n) for (int i=(s); i<(n); i++)
using namespace std;
using ll = long long;

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

    vector<int> A(N);
    rep(i,0,N-1) {
        int tmp;
        cin >> tmp;
        A[tmp - 1]++;
    }

    for (auto &&a : A) {
        cout << a << endl;
    }
}


Measured memory_bytes: 3968
m,n = map(int,input().split())
if n>=1 and m>=1:
	print(m*(m-1)//2 + n*(n-1)//2)
elif n == 0 and m!=0:
	print(m*(m-1)//2)
elif n!=0 and m ==0:
	print(n*(n-1)//2)

Measured memory_bytes: 3060
#include<stdio.h>

#define INF 1<<20

#define A 0
#define B 1
#define C 2

int n;
int ori[100][100];

void Dijkstra();

int main()
{
  int i,j,k,l,m,o;


  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      ori[i][j] = INF;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&k,&l);
    for(j=0;j<l;j++){
      scanf("%d%d",&m,&o);
      ori[k][m]=o;
    }
  }


  Dijkstra();

  return 0;
}

void Dijkstra()
{
  int omomi[100];
  int judgement[100];
  int i,j,k,min,x;

  for(i=0;i<n;i++){
    omomi[i]=INF;
    judgement[i]=A;
  }

  omomi[0]=0;
  judgement[0]=B;

  for(x=0;;x++){

    min=INF;
    j=-1;

    for(i=0;i<n;i++){
      if(judgement[i] !=C && min>omomi[i]){
        min=omomi[i];
        j=i;
      }
    }

    if(j==-1)break;
    judgement[j] = C;

    for(k=0;k<n;k++){
     if(judgement[k] != C && ori[j][k] != INF){
       if(omomi[k] > omomi[j] + ori[j][k]){
         omomi[k] = omomi[j] + ori[j][k];
         judgement[k]=B;
       }
     }
   }
 }

  for(i=0;i<n;i++){
    printf("%d",i);
    if(i>=0) printf(" ");

    if(omomi[i]==INF) omomi[i]=-1;
    printf("%d\n",omomi[i]);
  }

}



Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int>num(n);
  for(int i = 0; i < n; i++) {
    cin >> num.at(i);
  }
  if(n<=2) cout << 0;
  else{
    int ans = 0;
  for(int i = 0; i < n-2; i++) {
    for(int j = i+1; j < n-1; j++) {
      for(int k = j+1; k < n; k++) {
        if(num.at(i)==num.at(j)) ans = ans;
        else if(num.at(i)==num.at(k)) ans = ans;
        else if(num.at(j)==num.at(k)) ans = ans;
        else if(num.at(i)+num.at(j)<=num.at(k)) ans = ans;
        else if(num.at(j)+num.at(k)<=num.at(i)) ans = ans;
        else if(num.at(k)+num.at(i)<=num.at(j)) ans = ans;
        else ans++;
      }
    }
  }
    cout << ans;
  }
}

Measured memory_bytes: 3628
def solve(x)
  a1 = x / 11
  r1 = x - (a1 * 11)
  a = a1 * 2
  if r1 > 0
    if r1 < 7
      a += 1
    else
      a += 2
    end
  end
  a
end
x = gets.to_i
puts solve(x)

Measured memory_bytes: 1788
def c_to_infinity(S, K):
    for s in S[:min(K, len(S))]:
        if s != '1':
            return s  # 現れた数字が5000兆回の操作によってK文字目に必ず現れる
    return '1'

S = input().strip()
K = int(input())
print(c_to_infinity(S, K))

Measured memory_bytes: 2940
using System;
using System.Collections.Generic;

class Program
{
	static void Main(string[] args)
	{
        
       // List<int> a = new List<int>();
		int n = int.Parse(Console.ReadLine());
        long[] a = new long[n];
        long sum = 0;

		// List<int> b = new List<int>();


		string[] s = Console.ReadLine().Split(' ');

		// int a = int.Parse(Console.ReadLine());

		
        for (int i = 0; i < n;i++)
        {
            a[i] = long.Parse(s[i]);
            sum += a[i];
        }

        Array.Sort(a);

        Console.WriteLine("{0} {1} {2}", a[0], a[n - 1], sum);

		//Console.WriteLine("");


	}
}

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

int main()
{
   string s;
   int q;
   cin >> s >> q;

   deque<char> que;
   for(char x : s) que.push_back(x);
   bool isReverse = false;

   rep(i,q){
      int t;
      cin >> t; 
      if(t != 1) 
      {
         int f; char str;
         cin >> f;
         cin >> str;

         if(isReverse) f = 3-f;
         if(f == 1) que.push_front(str);
         else que.push_back(str);
      }
      else
      {
         isReverse = !isReverse;
      }
      
   }

   string ret;
   if(isReverse) reverse(que.begin(), que.end());
   for(char c : que) ret+=c;
   cout << ret << endl;
}

Measured memory_bytes: 1412
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    x = I()
    if x >= 30:
        print("Yes")
    else:
        print("No")
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 65452
using System;

class Program{
	static void Main(){
		string s;
		while((s = Console.ReadLine()) != null){
			char[] c = s.ToCharArray();
			while(!s.Contains("the") && !s.Contains("this") && !s.Contains("that")){
				for(int i = 0; i < c.Length; i++){
					if(char.IsLetter(c[i])){
						if (c[i] == 'z') c[i] = 'a';
						else c[i] += (char)1;
					}
				}
				s = new string(c);
			}
			Console.WriteLine(s);
		}
	}
}

Measured memory_bytes: 9576
#include <stdio.h>

#define WIDTH 10
#define HEIGHT 10

int main(void) {
	int case_num,case_count;
	if(scanf("%d",&case_num)!=1)return 1;
	for(case_count=0;case_count<case_num;case_count++) {
		int search;
		int i,j;
		int status[HEIGHT];
		int answer[HEIGHT];
		for(i=0;i<HEIGHT;i++) {
			status[i]=0;
			for(j=0;j<WIDTH;j++) {
				int cur;
				if(scanf("%d",&cur)!=1)return 1;
				if(cur!=0)status[i]|=(1<<j);
			}
		}
		for(search=0;search<(1<<WIDTH);search++) {
			int prev_prev_status=0;
			int prev_status=search;
			int cur_status=0;
			for(i=0;i<HEIGHT;i++) {
				answer[i]=prev_status;
				cur_status=status[i]^prev_prev_status;
				if(prev_status&1)cur_status^=3;
				for(j=1;j<WIDTH;j++) {
					if(prev_status&(1<<j))cur_status^=7<<(j-1);
				}
				cur_status&=(1<<WIDTH)-1;
				prev_prev_status=prev_status;
				prev_status=cur_status;
			}
			if(cur_status==0)break;
		}
		for(i=0;i<HEIGHT;i++) {
			for(j=0;j<WIDTH;j++) {
				printf("%d%c",(answer[i]&(1<<j))?1:0,j+1<WIDTH?' ':'\n');
			}
		}
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
using namespace std;
int mod = 1'000'000'000 + 7;
struct edge {
    int to;
    ll cost;
};
namespace mp = boost::multiprecision;

void COME_LET_THE_GAMES_BEGIN() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
}

ll x[110];
vector<int> v;
ll N;

int main() {
    COME_LET_THE_GAMES_BEGIN();
    cin >> N;
    for (int i = 2; i <= N; i++) {
        int a = i;
        for (int j = 2; j <= a; j++) {
            int r = 0;
            while (1) {
                if (a % j == 0) {
                    a /= j;
                    r++;
                } else {
                    break;
                }
            }
            x[j] += r;
        }
    }
    for (int i = 2; i <= 100; i++) {
        v.push_back(x[i]);
    }
    sort(v.begin(), v.end());
    int a75, a25, a15, a5, a3;
    a75 = v.end() - lower_bound(v.begin(), v.end(), 74);
    a25 = v.end() - lower_bound(v.begin(), v.end(), 24);
    a15 = v.end() - lower_bound(v.begin(), v.end(), 14);
    a5 = v.end() - lower_bound(v.begin(), v.end(), 4);
    a3 = v.end() - lower_bound(v.begin(), v.end(), 2);
    ll ans = 0;
    ans += a75;
    if (a3 - 1 > 0)ans += a25 * (a3 - 1);
    if (a5 - 1 > 0)ans += a15 * (a5 - 1);
    if (a5 - 1 > 0 && a3 - 2 > 0)ans += a5 * (a5 - 1) / 2 * (a3 - 2);
    cout << ans << endl;
}

Measured memory_bytes: 256
def m():
    n, k = map(int, input().split())
    d = dict()
    for i in range(n):
        a, b = map(int, input().split())
        if d.get(a, 0) == 0:
            d[a] = b
        else:
            d[a] +=b
    keys = list(d.keys())
    keys.sort()
    for key in keys:
        k -= d[key]
        if k <= 0:
            return key
print(m())

Measured memory_bytes: 10596
from bisect import bisect_left, bisect_right

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(n-1): a[i+1] = a[i] + a[i+1]
for i in range(m-1): b[i+1] = b[i] + b[i+1]
a = [0] + a; b = [0] + b

c = bisect_right(a, k)-1
ans = 0

for i in range(c+1)[::-1]:
    r = k-a[i]
    j = bisect_right(b, r)-1
    ans = max(ans, i+j)

print(ans)


Measured memory_bytes: 118348
const val EOF = "END_OF_TEXT"

fun main(args: Array<String>) {
    val target = readLine() ?: return
    var count = 0
    while (true) {
        val texts = readLine()?.split(" ")?.map { if(!it.equals(EOF))it.toLowerCase() else it } ?: break
        texts.forEach{
            if(it.equals(target)) count++
        }
        if(texts.contains(EOF)) break
    }
    println(count)
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - Chocolate
            int N = int.Parse(Console.ReadLine());

            var line = ReadLine();
            int D = line[0];
            int X = line[1];

            int chocolates = X;

            for(int i = 0; i < N; i++)
            {
                int A = int.Parse(Console.ReadLine());
                chocolates += CountEatings(A, D);
            }

            Console.WriteLine(chocolates);
        }

        static int CountEatings(int A, int D)
        {
            int count = 0;

            while (A * count + 1 <= D)
            {
                count++;
            }

            return count;
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 13268
import java.io.*;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(true) {
			int n = stdIn.nextInt();
			int m = stdIn.nextInt();
			if(n == 0 && m == 0) break;
			Data[] list = new Data[m];
			for(int i = 0; i < m; i++) {
				list[i] = new Data(i+1);
			}
			for(int i = 0; i < n; i++) {
				for(int j = 0; j < m; j++) {
					list[j].num += stdIn.nextInt();
				}
			}
			Arrays.sort(list,new Comp());
			System.out.print(list[0].id);
			for(int i = 1; i < m; i++) {
				System.out.print(" " + list[i].id);
			}
			System.out.println();
			
		}
		
	}
}
class Comp implements Comparator<Data> {

	@Override
	public int compare(Data o1, Data o2) {
		if(o1.num < o2.num) return 1;
		if(o1.num > o2.num) return -1;
		if(o1.id < o2.id) return -1;
		
		return 1;
	}
	
}
class Data {
	int id;
	int num;
	Data(int a) {
		id = a;
		num = 0;
	}
}

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

int main() {
  int N,M;
  int A[10010];
  cin>>N>>M;
  int ans=0;
  for(int i=0;i<M;i++){
    cin>>A[i];
    ans+=A[i];
  }
  if(ans<=N){
    cout<<N-ans<<endl;
  }
  else{
    cout<<"-1"<<endl;
  }
}      
  


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<unsigned long long> X(N);
	vector<unsigned long long> s(N);
	for (auto i = 0; i < N; ++i)
	{
		cin >> X[i];
		s[i] = X[i];
	}

	sort(s.begin(), s.end());

	auto left = s[N / 2 - 1];
	auto right = s[N / 2];

	for (auto i = 0; i < N; ++i)
	{
		if (X[i] <= left)
		{
			cout << right << endl;
		}
		else
		{
			cout << left << endl;
		}
	}

	return 0;
}


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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll a, b, c, d; cin >> a >> b >> c >> d;
    ll ans = -LLINF;
    ans = max(ans, a*c);
    ans = max(ans, a*d);
    ans = max(ans, b*c);
    ans = max(ans, b*d);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    int a[5];
    rep(i,5){
        cin >> a[i];
        if(!a[i]) cout << i+1 <<endl;
    }
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main() {
  string huu;
  cin>>huu;
  int N = huu.size();
  int ans = 0;
  for(int i = 0; i < N / 2 + 1/2; i++){
    if(huu.at(i) != huu.at(N - i - 1)){
      ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <string>
#include <iostream>

using namespace std;

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

    for (char c = 'a'; c <= 'z'; c++) {
        if (S.find(c) == string::npos) {
            cout << c << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

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

public class Main {

    private static int LEN = 1046527;
    private static String[] HASHTABLE = new String[LEN];

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        for (int i=0; i<n; i++){
            String string = br.readLine();
            if (string.charAt(0) == 'i'){
                insert(string.substring(7));
            }
            else {
                if (find(string.substring(5))){
                    System.out.println("yes");
                }
                else {
                    System.out.println("no");
                }
            }
        }
    }

    private static boolean find(String string) {

        int key = getKey(string);
        for (int i=0; ;i++){
            int h = (hash1(key)+i*hash2(key)) % LEN;
            if (HASHTABLE[h] == null){
                return false;
            }
            else if (HASHTABLE[h].equals(string)){
                return true;
            }
        }
    }

    private static void insert(String string) {

        // ???????°?????¬??????¬????????°????????¶????°???°?????£??\??£????????°?????°????????\?????????
        // ???????????????????????¨????¬?????????????????????\??????????????????????????????????????????????????¨????????´??\?????\?????????
        int key = getKey(string);
        for (int i=0; ;i++){
            int h = (hash1(key)+i*hash2(key)) % LEN;
            if (HASHTABLE[h] == null){
                HASHTABLE[h] = string;
                break;
            }
            else if (HASHTABLE[h].equals(string)){
                break;
            }
        }
    }

    // ?°?????¬??????¬????????°?????¶??????key
    private static int getKey(String string) {

        int sum = 0;
        int p = 1;
        for (int i=0; i<string.length(); i++){
            sum += p*getChar(string.charAt(i));
            p *= 5;
        }

        return sum;
    }

    private static int getChar(char c) {
        switch (c){
            case 'A':
                return 1;
            case 'C':
                return 2;
            case 'G':
                return 3;
            case 'T':
                return 4;
            default:
                return 0;
        }
    }

    // ??????????????£????????°
    private static int hash1(int key){
        return key % LEN;
    }

    private static int hash2(int key){
        return 1 + (key % (LEN-1));
    }
}

Measured memory_bytes: 117360
#include <iostream>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;

	int ans = 0;
	for (int i = 0; i < 2; ++i) {
		if (a >= b) {
			ans += a;
			--a;
		}
		else {
			ans += b;
			--b;
		}
	}

	cout << ans << "\n";
}

Measured memory_bytes: 256
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
																								   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra	   
																													   																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////


/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	string t;
	int R, S, P;
	int n, k;
	cin >> n >> k;
	cin >> R >> S >> P;
	cin >> t;
	LL ans = 0;
	
	for(int i = 0; i < n; i++){
		if(i >= k && t[i] == t[i-k]) t[i] = 0;
		if(t[i] == 's') ans += R;
		if(t[i] == 'p') ans += S;
		if(t[i] == 'r') ans += P;
	}
	
	cout << ans << '\n';
	
	
	
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){
    
    int a,b;
    cin>>a>>b;
    
    int c = b-a;
    int i,h=0;;
    for(i=1;i<c;++i){
        h+=i;
    }
    cout << h-a;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
#define INF 1000000000
typedef long long ll;

ll nums[2000009];

int main() {
    int N;
    cin >> N;
    
    ll total=0;
    rep(i,N){
        ll a; cin >> a;
        total += a;
        nums[i] = total;
        
    }
    
    ll minv = 1e18;
    rep(i,N-1){
        if(minv> abs(total-nums[i]*2)) minv = abs(total-nums[i]*2);
    }
    
    cout << minv << endl;
    
    
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;
#define REP(i, n) for (long long i = 0; i < (n); i++)

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t % mod;
    } else {
        return modpow(m, n - 1) * m % mod;
    }
}

long long moddiv(long long a, long long b) { return (a * modpow(b, mod - 2)) % mod; }

long long nCkmod(long long n, long long k) {
    long long denomi = 1;
    REP(i, n) {
        denomi *= (i + 1);
        denomi %= mod;
    }
    long long numera = 1;
    for (int i = n - k; i > 0; i--) {
        numera *= i;
        numera %= mod;
    }
    REP(i, k) {
        numera *= (i + 1);
        numera %= mod;
    }
    return moddiv(denomi, numera);
}

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}

vector<int> h, memo;

// int dp(int n) {
//     if (memo[n] != -1) {
//         return memo[n];
//     }
//     if (n == 0) {
//         return 0;
//     }
//     if (n == 1) {
//         return abs(h[1] - h[0]);
//     }
//     memo[n] = min(dp(n - 1) + abs(h[n] - h[n - 1]), dp(n - 2) + abs(h[n] - h[n - 2]));
//     return min(dp(n - 1) + abs(h[n] - h[n - 1]), dp(n - 2) + abs(h[n] - h[n - 2]));
// }
signed main() {
    long long n, m, x;
    cin >> n >> m >> x;
    vector<vector<int>> as(n, vector<int>(m));
    vector<int> cs(n);
    REP(i, n) {
        cin >> cs[i];
        REP(j, m) { cin >> as[i][j]; }
    }
    int minn = 1e8;
    for (int i = 0; i < (1 << n); i++) {
        vector<int> uloa(m);
        int cost = 0;
        REP(j, n) {
            if ((i >> j) & 1) {
                cost += cs[j];
                REP(k, m) { uloa[k] += as[j][k]; }
            }
        }
        for (int l = 0; l < m; l++) {
            if (uloa[l] < x) {
                break;
            }
            if (l == m - 1) {
                minn = min(cost, minn);
            }
        }
    }
    if (minn == 1e8) {
        cout << -1 << endl;
        return 0;
    }
    cout << minn << endl;
}

Measured memory_bytes: 3656
#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
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#include <random>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod2 = 1'000'000'007;
constexpr ll mod = 998244353;
const double PI = 3.14159265358;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  int A,B;
  cin >> A >> B;
  int sum = 0;
  for(int i=1; i<=N; i++){
    string S = to_string(i);
    int now = 0;
    for(int j=0; j<S.size(); j++){
      now += S[j] - '0';
    }
    if(A <= now && now <= B){
      sum += i;
    }
  }
  cout << sum << "\n";
  return 0;
}

Measured memory_bytes: 3792
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let k: usize = read();
    let q: usize = read();
    let mut user_points: Vec<i32> = vec![-(q as i32); n];
    for _ in 0..q {
        user_points[read::<usize>() - 1] += 1;
    }
    for i in user_points {
        if i > -(k as i32) {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}


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

vector<int> C(26, 0); // C[i]
vector<vector<int> > S(365, vector<int>(26, 0)); // S[d][i]
int D;
int N;

int score(vector<int> V) {
	vector<int> c = C;
	int s = 0;
	for (int d = 0; d < D; d++) {
		c[V[d]] = 0;
		s += S[d][V[d]];
		s -= accumulate(c.begin(), c.end(), 0);
		for (int i = 0; i < N; i++) {
			c[i] += C[i];
		}
	}
	return s;
}

vector<int> findmin() {
	vector<int> V(D, 0);
	vector<int> c = C;
	int s = 0;
	for (int d = 0; d < D; d++) {
		int mi = 0;
		for (int i = 0; i < N; i++) {
			if (S[d][mi] + 5 * c[mi] < S[d][i] + 5 * c[i]) mi = i;
		}
		V[d] = mi;
		c[V[d]] = 0;
		s += S[d][V[d]];
		s -= accumulate(c.begin(), c.end(), 0);
		for (int i = 0; i < N; i++) {
			c[i] += C[i];
		}
	}
	return V;
}

int main() {
	cin >> D;
	N = 26;
	for (int i = 0; i < N; i++) {
		cin >> C[i];
	}
	for (int d = 0; d < D; d++) {
		for (int i = 0; i < N; i++) {
			cin >> S[d][i];
		}
	}
	vector<int> V(D, 0);
	for (int d = 0; d < D; d++) {
//		cin >> V[d];
//		V[d]--;
		int i = 0;
		for (int j = 1; j < N; j++) {
			if (S[d][i] < S[d][j]) i = j;
		}
		V[d] = i;
	}

	vector<int> sV = findmin();
	if (score(V) < score(sV)) V = sV;

	random_device seed_gen;
	mt19937 engine(seed_gen());
	uniform_real_distribution<> dist1(0.0, 1.0);


	vector<int> newV = V;
//	cout << "cur " << score(V);
//	for (int d = 0; d < D; d++) { cout << " " << V[d]+1; }
//	cout << endl;
	int ms = score(V);
	for (int j = 0; j < 50000; j++) {
		newV = V;
		for (int k = 0; k < 3; k++) {
			newV[int(dist1(engine) * D)] = int(dist1(engine) * N);
		}
		int ns = score(newV);
//		cout << "new " << ns;
//		for (int d = 0; d < D; d++) { cout << " " << newV[d]+1; }
//		cout << endl;
		if (ms < ns) V = newV;
	}

	for (int d = 0; d < D; d++) {
		cout << V[d] + 1 << endl;
	}
//	cerr << score(V) << endl;
  	return(0);
}


Measured memory_bytes: 3636
#include<iostream>
#include<cstdlib>
#include<map>
using namespace std;
int n;
int a,b,c;
string opt[100005];
char ans[100005];
bool f[4];
void dfs(int i)
{
    if(a<0||b<0||c<0)
        return;
    if(i==n+1)
    {
        cout<<"Yes\n";
        for(int i=1;i<=n;i++)
            cout<<ans[i]<<'\n';
        exit(0);
    }
    if(opt[i]=="AB")
    {
       if(f[1]==1)
       {
            f[i]*=-1;
            a++;
            b--;
            ans[i]='A';
            dfs(i+1);
            a--;
            b++;

            a--;
            b++;
            ans[i]='B';
            dfs(i+1);
            a++;
            b--;
       }
       else
       {
            f[i]*=-1;
            a--;
            b++;
            ans[i]='B';
            dfs(i+1);
            a++;
            b--;

            a++;
            b--;
            ans[i]='A';
            dfs(i+1);
            a--;
            b++;
       }
    }
    if(opt[i]=="AC")
    {
        if(f[1]==1)
       {
            f[i]*=-1;
            a++;
            c--;
            ans[i]='A';
            dfs(i+1);
            a--;
            c++;

            a--;
            c++;
            ans[i]='C';
            dfs(i+1);
            a++;
            c--;
       }
       else
       {
            f[2]*=-1;
            a--;
            c++;
            ans[i]='C';
            dfs(i+1);
            a++;
            c--;

            a++;
            c--;
            ans[i]='A';
            dfs(i+1);
            a--;
            c++;
       }
    }
    if(opt[i]=="BC")
    {
        if(f[3]==1)
        {
            f[3]*=-1;
            b++;
            c--;
            ans[i]='B';
            dfs(i+1);
            b--;
            c++;

            b--;
            c++;
            ans[i]='C';
            dfs(i+1);
            b++;
            c--;
       }
       else
       {
            f[i]*=-1;
            b--;
            c++;
            ans[i]='C';
            dfs(i+1);
            a++;
            b--;

            b++;
            c--;
            ans[i]='B';
            dfs(i+1);
            b--;
            c++;
       }
    }
}
int main()
{
    cin>>n>>a>>b>>c;
    f[1]=f[2]=f[3]=1;
    for(int i=1;i<=n;i++)
        cin>>opt[i];
    dfs(1);
    cout<<"No";
    return 0;
}   

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

ll int knap(ll int k[],ll int v[],ll int n,ll int w){
	ll int t[n+1][w+1];
	//memset(t,-1,sizeof(t));
	for(int i=0;i<n+1;i++){
		for(int j=0;j<w+1;j++){
			if(i==0 || j==0){
				t[i][j]=0;
			}
			else if(k[i-1]<=j){
				t[i][j]=max(v[i-1]+t[i-1][j-k[i-1]],t[i-1][j]);
			}
			else{
				t[i][j]=t[i-1][j];
			}
		}
	}
	return t[n][w];
}

int main(){
	ll int n,w;
	cin>>n>>w;
	ll int k[n],v[n];
	for(int i=0;i<n;i++){
		cin>>k[i]>>v[i];
		//cout<<k[i]<<" "<<v[i]<<endl;
	}
	ll int x=knap(k,v,n,w);
	cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 82456
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main()
{
    string s;
    cin>>s;
    int ans=0,cnt=0;
    char flag='1';
    for(int i=0;i<s.length();i++){//1010
        if(flag!=s[i]){
            ans++;
        }
        if(flag=='0'){
            flag='1';
        }else{
            flag='0';
        }
    }
    flag='0';
    for(int i=0;i<s.length();i++){//0101
        if(flag!=s[i]){
            cnt++;
        }
        if(flag=='0'){
            flag='1';
        }else{
            flag='0';
        }
    }
    ans=min(ans,cnt);
    cout<<ans<<endl;
    return 0;
}

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

int32_t main() {
	// your code goes here
	int n, k;
	cin >> n;
	int arr[n];
	int mn = 1990;
	int mx = -1;
	for(int i = 0; i < n; i++){
	    cin >> arr[i];
	    mn = min(mn, arr[i]);
	    mx = max(mx, arr[i]);
	}
	int ans = 1e12;
	for(int i = mn; i <= mx; i++){
	    int res = 0;
	    for(int j = 0; j < n; j++){
	        res += (arr[j] - i) * (arr[j] - i);
	    }
	    ans = min(ans, res);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.Panasonic2020
{
    class A
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int k = ReadInt();
            int[] array = new int[32] { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
            WriteLine(array[k - 1]);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11092