akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
 
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
typedef long long ll;

int lcm(int x, int y){
    if(x<y) swap(x,y);
    if(y==0) return x;     
    int c=x%y;
    lcm(y,c);
    }


int main(){
    int N,K;
    int a[100010];
    cin>>N>>K;
    REP(i,N) cin>>a[i];
    int ans=a[0];
    sort(a,a+N);
    REP(i,N) ans=lcm(ans,a[i]);
    if(K>a[N-1]) {
        cout<<"IMPOSSIBLE"<<endl;
    }   
    else if(K%ans==0) cout<<"POSSIBLE"<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
    return 0;
} 

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  int H1,M1,H2,M2,K; cin >> H1 >> M1 >> H2 >> M2 >> K;
  int t1  = H1*60+M1;
  int t2 = H2*60+M2;
  int ans = max(0,t2-t1-K);
  cout << ans << endl;
  return 0;
}


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

int main() {
    int w,a,b;
    cin >> w >> a >> b;
  // 上の図形が下の図形より左側にある場合
  if (b<a) {
   if (a<=b+w){
       cout << 0 << endl;
   }
   else {
       cout << a-(b+w) << endl;
       }
  }

  else {
       if (b<=a+w) {
        cout << 0 << endl;
       }
       else {
	      cout << b-(a+w)  << endl;
	   }
      }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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 (a>b) { a=b; return 1; } return 0; }

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

    int N; cin >> N;
    vei a(N); rep(i,N) cin >> a[i];

    ll ans = acc(all(a), 0) - N;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
def solve():
    N, M = map(int, input().split())
    isAC = [False] * N
    errCnt = [0] * N

    for i in range(M):
        p, S = input().split()
        p = int(p) - 1

        if S == 'WA':
            if not isAC[p]:
                errCnt[p] += 1
        
        if S == 'AC':
            isAC[p] = True
    
    n_penalty = 0
    for i in range(N):
        if isAC[i]:
            n_penalty += errCnt[i]

    print(sum(isAC), n_penalty)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 46552
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
#define pb push_back
#define pll pair<ll, ll>
#define mll map<ll, ll>
#define ff first
#define oo 1000000000000000005
#define ss second
#define el "\n"
#define maxS 100005
#define MOD 1000000007
using namespace std;
typedef long long ll;

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

    // ll t;cin>>t;while(t--)
    {
        ll s, w;
        cin>>s>>w;
        if(w >= s)
            cout<<"unsafe\n";
        else
            cout<<"safe\n";
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  priority_queue<int> q;
  rep(i, n){
    int in;
    cin >> in;
    q.push(in);
  }
  rep(i, m){
    int t = q.top(); q.pop();
    t >>= 1;
    q.push(t);
  }

  ll ans = 0;
  while(!q.empty()){
    ans += q.top();
    q.pop();
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 892
#include<stdio.h>
int main()
{
	char l[3][3],s[9],m;
	int i;
	while(scanf("%s",s)!=EOF){
		l[0][0]=s[0];
		l[0][1]=s[1];
		l[0][2]=s[2];
		l[1][0]=s[3];
		l[1][1]=s[4];
		l[1][2]=s[5];
		l[2][0]=s[6];
		l[2][1]=s[7];
		l[2][2]=s[8];
		m='d';
		for(i=0;i<3;i++){
			if(l[i][0]=='o'&&l[i][1]=='o'&&l[i][2]=='o'){
				m='o';
			}else if(l[i][0]=='x'&&l[i][1]=='x'&&l[i][2]=='x'){
				m='x';
			}
		}
		for(i=0;i<3;i++){
			if(l[0][i]=='o'&&l[1][i]=='o'&&l[2][i]=='o'){
				m='o';
			}else if(l[0][i]=='x'&&l[1][i]=='x'&&l[2][i]=='x'){
				m='x';
			}
		}
		if(l[0][0]=='o'&&l[1][1]=='o'&&l[2][2]=='o'){
			m='o';
		}
		if(l[0][0]=='x'&&l[1][1]=='x'&&l[2][2]=='x'){
			m='x';
		}
		if(l[2][0]=='o'&&l[1][1]=='o'&&l[0][2]=='o'){
			m='o';
		}
		if(l[2][0]=='x'&&l[1][1]=='x'&&l[0][2]=='x'){
			m='x';
		}
		printf("%c\n",m);
	}
	return 0;
}

Measured memory_bytes: 2708
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

char grid[101][101];

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

	int a, b;
	cin >> a >> b;

	for (int i = 0; i < 100; i++) {
		char c = (i < 50)? '#' : '.';
		for (int j = 0; j < 100; j++) grid[i][j] = c;
	}

	for (int i = 0; i < 49 && a > 1; i += 2) {
		for (int j = 0; j < 100 && a > 1; j += 2) {
			grid[i][j] = '.';
			a--;
		}
	}
	for (int i = 51; i < 100 && b > 1; i += 2) {
		for (int j = 0; j < 100 && b > 1; j += 2) {
			grid[i][j] = '#';
			b--;
		}
	}

	cout << "100 100\n";
	for (int i = 0; i < 100; i++) cout << grid[i] << "\n";
}


Measured memory_bytes: 256
def solve():
    max_weight, list_of_weight_and_value = read()
    result = think(max_weight, list_of_weight_and_value)
    write(result)


def read():
    n, max_weight = read_int(2)
    list_of_weight_and_value = []
    for i in range(n):
        list_of_weight_and_value.append(read_int(2))
    return max_weight, list_of_weight_and_value


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(max_weight, list_of_weight_and_value):
    MAX_WEIGHT = 10 ** 5
    MAX_N = 100
    INVALID_VALUE = -1

    # dp[w] means max value at total weight 'w'
    dp = [INVALID_VALUE for x in range(max_weight + len(list_of_weight_and_value) + 1)]
    dp[0] = 0

    for weight, value in list_of_weight_and_value:
        for i in range(len(dp) - 1, -1, -1):
            if dp[i] != INVALID_VALUE and i + weight < len(dp):
                if dp[i + weight] == INVALID_VALUE:
                    dp[i + weight] = dp[i] + value
                else:
                    dp[i + weight] = max(dp[i + weight], dp[i] + value)
    return max(filter(lambda x: x != INVALID_VALUE, dp[:max_weight + 1]))


def write(result):
    print(result)


if __name__ == '__main__':
    solve()

Measured memory_bytes: 44784
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter("\\s");
		int a = sc.nextInt();
		int b = sc.nextInt();
		int d = a / b;
		int r = a % b;
		double A = a;
		double B = b;
		double f = A / B;
		System.out.println(d+" "+r+" " + String.format("%.5f", f));
	}

}

Measured memory_bytes: 26616
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int x;
	cin>>x;
	for(int i=8,y=600;i>=1;--i,y+=200)
	{
		if(x<y)
		{
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<1<<endl;
	return 0;
}

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

#define sswap(x, y) { x+=y; y=x-y; x-=y; }
#define LSOne(S) ((S) & (-S))

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
	string s;
	cin >> s;
	int m = 100000;
	for (int i = 0; i < s.size()-2; i++) {
		int v = s[i]*100+s[i+1]*10+s[i+2]-'0'*(111);
		if (abs(753-v) < m) m = abs(753-v);
	}
	cout << m << ende;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long[] ryuka=new long[87];
        ryuka[0]=2;
        ryuka[1]=1;
        for(int i=2;i<87;i++){
            ryuka[i]=ryuka[i-1]+ryuka[i-2];
        }
        System.out.println(ryuka[sc.nextInt()]);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <map>
using namespace std;
using ll = long long;

int main(){
        ll i,n;
        ll ans=0;
        cin >> n;
        vector<ll> counter(n+1);
        vector<ll> a(n);
        map<ll,ll> m;
        for(i=0;i<n;++i){
                cin >> a.at(i);
                ++counter.at(a.at(i));
        }
        for(i=1;i<n+1;++i){
                if(counter.at(i)==0) continue;
                ans += counter.at(i)*(counter.at(i)-1)/2;
        }
        for(i=0;i<n;++i){
                if(m[a.at(i)]>0){
                        cout << m[a.at(i)] << endl;
                        continue;
                }
                m[a.at(i)] = ans - (counter.at(a.at(i))-1);
                cout << m[a.at(i)] << endl;
        }
        return 0;
}

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

#define fi first
#define se second
#define ll long long

using namespace std;

const int N = 3e5 + 7;
const int mod = 1e9 + 7;

void solve1()
{
    int n,k;
    cin >> n >> k;
    if( (n + 1) / 2 >= k )cout << "YES";
    else cout << "NO";
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;//cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


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

int main(){
    while(true){
        int n, m;
        std::vector<char> str;
        std::vector<std::pair<char, char> > change_list;

        std::cin >> n;
        if(n == 0)
            break;

        for(int i = 0; i < n; ++i){
            change_list.push_back(std::pair<char, char>(-1, -1));
            std::cin >> change_list[i].first >> change_list[i].second;
        }
        std::cin >> m;
//        std::cout << "debug: " << m << std::endl;
        for(int i = 0; i < m; ++i){
            char c;
            std::cin >> c;
            for(int j = 0; j < change_list.size(); ++j){
                if(c == change_list[j].first){
                    c = change_list[j].second;
                    break;
                }
            }
            str.push_back(c);
//            std::cout << "debug: " << "size: " << change_list.size() << " i: " << i << " c: " << c << std::endl;
        }
//        std::cout << "debug: loop end. str[0] : " << str[0] << std::endl;
        for(int j = 0; j < str.size(); ++j){
            std::cout << str[j];
        }
        std::cout << std::endl;
    }
    return 0;
}

Measured memory_bytes: 1340
#include <iostream>
#include <string>
using namespace std;
int main() {

	string S, T;
	cin >> S >> T;
	int A, B;
	cin >> A >> B;
	string U;
	cin >> U;
	if (S == U)
		A -= 1;
	else if (T == U)
		B -= 1;
	cout << A << ' ' << B << "\n";
}

Measured memory_bytes: 3636
import sys
def input(): return sys.stdin.readline().rstrip()
import fractions
def lcm(a,b):
    f=a*b//fractions.gcd(a,b)
    return f
def main():
    a,b=map(int,input().split())
    print(lcm(a,b))

if __name__=='__main__':
    main()

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)

#define SORT(c) sort((c).begin(),(c).end())
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(int argc, char const *argv[]) {
  cin.tie(0); ios::sync_with_stdio(false);
  int N; std::cin >> N;
  int rule=1;
  VS words; words.reserve(N+1);
  string word;

  REP0(i,N){
    std::cin >> word;
    if (i>=1) {
      if(word[0] != words[i-1][words[i-1].size()-1]) rule=0;
      REP0(j,i) if(word == words[j]) rule=0;
    }
    words.PB(word);
  }

  if (rule==1) {
    std::cout << "Yes" << '\n';
  }else{
    std::cout << "No" << '\n';
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  int N;
  cin >>N;
  if(N==1) {
cout<< 1<< endl;
  }
else if (N==2) {
  cout<< 2<< endl;
}
else if (N<4) {
  cout<< 2<< endl;
}
else if (N<8) {
cout<< 4 << endl;
}
else if(N<16) {
cout<< 8 << endl;
}
else if (N<32) {
cout<< 16 << endl;
}

  else if (N<64) {
    cout << 32<< endl;
  }
else if (N<128) {
cout << 64 << endl;
}

  
  
  
  
}

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

int main(){
    string S;
    while(cin>>S,S!="#"){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        vector<string> V;
        V.push_back("");
        for(auto s:S){
            if(s=='b'){
                V.back()+='b';
            }else if(s=='/'){
                V.push_back("");
            }else{
                V.back()+=string(s-'0','.');
            }
        }
        V[a-1][b-1]='.'; V[c-1][d-1]='b';
        string ans;
        for(auto v:V){
            int cnt = 0;
            for(int c:v){
                if(c=='b'){
                    if(cnt){
                        ans+='0'+cnt;
                        cnt=0;
                    }
                    ans+='b';
                }else{
                    cnt++;
                }
            }
            if(cnt){
                ans+='0'+cnt;
                cnt=0;
            }
            ans+='/';
        }
        ans.pop_back();
        cout<<ans<<endl;
    }

    return 0;
}

Measured memory_bytes: 3148
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

typedef pair<int, int> pint;
typedef long long ll;

int main()
{
    int N;
    int T, A;
    cin >> N;
    cin >> T >> A;
    vector<pair<double, int>> data(N, pair<double, int>(0, 0));
    rep(i, N)
    {
        double tmp;
        cin >> tmp;
        data[i] = pair<double, int>(abs(double(A) - (double(T) - tmp * 0.006)), i);
    }
    sort(data.begin(), data.end());
    cout << data[0].second + 1 << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main {
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                PrintWriter ou = new PrintWriter(System.out);
                int n = Integer.parseInt(sc.next());
                int k = Integer.parseInt(sc.next());
                int q = Integer.parseInt(sc.next());
                int[] s = new int[n];
                int i;
                Arrays.fill(s , k - q);
                for(i = 0 ; i < q ; i++){
                        s[Integer.parseInt(sc.next()) - 1]++;
                }
                for(i = 0 ; i < n ; i++){
                        if(s[i] > 0) ou.print("Yes\n");
                        else ou.print("No\n");
                }
                ou.flush();
        }
}

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

int main(){
  int a=0,w=0,t=0,r=0;
  int n;
  cin>>n;
  while(n--){
    string s;
    cin>>s;
    if (s=="AC")a++;
    if (s=="WA")w++;
    if (s=="TLE")t++;
    if (s=="RE")r++;
  }
  cout<<"AC x "<<a<<"\n";
  cout<<"WA x "<<w<<"\n";
  cout<<"TLE x "<<t<<"\n";
  cout<<"RE x "<<r;
}

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

using namespace std;

void solve()
{
	int N;
	cin >> N;
	deque<long> powers;
	multiset<long> as;
	for (int i = 0; i < N; i++)
	{
		long a;
		cin >> a;
		as.insert(a);
	}

	long t = 2;
	while(t <= 2*1e9) powers.push_front(t), t*=2;

	long ans = 0;
	while(!as.empty())
	{
		auto i = as.rbegin();
		long x = *i;
		as.erase(as.find(x));
		for (long p : powers)
		{
			auto j = as.find(p-x);
			if (j == as.end()) continue;
			ans++;
			as.erase(j);
			break;
		}
	}

	cout << ans << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 10240
def main():
    n, k = [int(i) for i in input().split()]
    s = input() + "3"
    s0 = []
    s1 = []
    cnt = 0
    start = 1
    for i in range(n+1):
        if start == 1 and s[i] != "1":
            s1.append(cnt)
            cnt = 1
            start = 0
        elif start == 0 and s[i] != "0":
            s0.append(cnt)
            cnt = 1
            start = 1
        else:
            cnt += 1
    if len(s0) == len(s1):
        s1.append(0)

    ans = sum(s1[0:0+k+1]) + sum(s0[0:0+k])
    n_ans = ans
    for i in range(len(s0) - k):
        n_ans = n_ans + s1[k+1+i] + s0[k+i] - s1[i] - s0[i]
        ans = max(ans, n_ans)
        
    print(ans)

main()

Measured memory_bytes: 4396
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<int>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  int n,x,t;
  cin >> n >> x >> t;
  cout << t*(1+(n-1)/x) << endl;
}


Measured memory_bytes: 3632
using System;


namespace _119_ABC
{
    class Program01
    {
        static void Main(string[] args)
        {

            int N = int.Parse(Console.ReadLine());
            double Answer = 0.0;

            for(int i = 0; i < N; i++)
            {
                string[] Input = Console.ReadLine().Split(' ');
                double X = double.Parse(Input[0]);
                string U = Input[1];

                if(U == "JPY")
                {
                    Answer += X;
                }
                else
                {
                    Answer += X * 380000.0;
                }
            }

            Console.WriteLine(Answer);

        }
    }
}


Measured memory_bytes: 11092
#include "bits/stdc++.h"
using namespace std;

using ll = long long;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using val = valarray<T>;

using pi = pair<int,int>;

#define rep(a,b) for(int a=0; a<b; ++a)
#define Rep(a,b,c) for(int a=b; a<c; ++a)
#define ran(a,b) for(auto &a:b)
#define all(v) v.begin(),v.end()

int main(){
	int N; cin>>N;
	vec<pi> asa(N),hiru(N),yoru(N);
	set<int> morning,lunch,dinner;
	rep(i,N){
		int aa,ab,ba,bb;
		cin>>aa>>ab>>ba>>bb;
		asa[i]=pi(aa*60+ab,ba*60+bb);
		morning.emplace(aa*60+ab),morning.emplace(ba*60+bb);
		cin>>aa>>ab>>ba>>bb;
		hiru[i]=pi(aa*60+ab,ba*60+bb);
		lunch.emplace(aa*60+ab),lunch.emplace(ba*60+bb);
		cin>>aa>>ab>>ba>>bb;
		yoru[i]=pi(aa*60+ab,ba*60+bb);
		dinner.emplace(aa*60+ab),dinner.emplace(ba*60+bb);
	}
	
	int ans=-1;
	ran(i,morning){
		ran(j,lunch){
			ran(k,dinner){
				int tmp=0;
				rep(l,N){
					bool able=true;
					able&=(asa[l].first<=i&&i<=asa[l].second);
					able&=(hiru[l].first<=j&&j<=hiru[l].second);
					able&=(yoru[l].first<=k&&k<=yoru[l].second);
					tmp+=(able?1:0);
				}
				//cout<<i<<" "<<j<<" "<<k<<" "<<tmp<<endl;
				ans=max(ans,tmp);
			}
		}
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
	cin>>s;
	for(int i=0;i<s.size();++i){
		if(s[i]=='C'){
			for(int j=i;j<s.size();++j){
				if(s[j]=='F'){
					cout<<"Yes\n";
					return 0;
				}
			}
		}
	}
	cout<<"No\n";
	return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())

    for i in range(0, 10001, 1000):
        if i >= n:
            print(i - n)
            break


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9164
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, x: "List[int]", y: "List[int]", h: "List[int]"):
    for i, j in product(range(0, 101), range(0, 101)):
        H = set()
        for xx, yy, hh in zip(x, y, h):
            if 0 < hh:
                ch = hh + abs(xx - i) + abs(yy - j)
                H.add(ch)
        if len(H) != 1:
            continue

        hhh = list(H)[0]
        no = False
        for xx, yy, hh in zip(x, y, h):
            if 0 == hh:
                if 0 < hhh - abs(xx - i) - abs(yy - j):
                    no = True
        if no:
            continue

        return "{} {} {}".format(i, j, hhh)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]" 
    y = [int()] * (N)  # type: "List[int]" 
    h = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
        h[i] = int(next(tokens))
    result = solve(N, x, y, h)
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5124
#include<bits/stdc++.h>
#define ll long long
#define ii pair<int,int>
#define vi vector<int>


using namespace std;

int power(int a,int b){
    if(b == 0)return 1;
    int r = power(a,b/2);
    if(b%2)return r*r*a;
    else return r*r;
}


int main(){
    int n;cin>>n;
    int i = 1;int c = 0;
    for(;i <=n;i++){
        string a = to_string(i);
        if(a.size()%2){
            c++;
        }
    }
    cout<<c;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<unordered_set>
#include<unordered_set>
#include<cmath>
#define mod 1000000000000000000
int main(void) {
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
int x=arr[0];
for(int i=1;i<n;i++)
x=x^arr[i];
for(int i=0;i<n;i++)
{
    cout<<(x^arr[i])<<" ";
}
cout<<"\n";
	return 0;
}



Measured memory_bytes: 4364
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
vector<ll>v[3];
int main()
{
    FASTINOUT;
    ll x;
    cin>>x;
    string s;
    cin>>s;
    for (int i=0;i<x;i++){
        if (s[i]=='B')
            v[0].push_back(i);
        else if (s[i]=='R')
            v[1].push_back(i);
        else
            v[2].push_back(i);
    }
    ll ans=(ll)v[0].size()*(ll)v[1].size()*(ll)v[2].size();
    if (!ans){
        cout<<0<<endl;
        return 0;
    }
    for (int i=0;i<x;i++){
        for (int j=i+1;j<x;j++){
            if (s[i]==s[j])
                continue;
            char a[26]={0};
            a[s[i]-'A']=1;
            a[s[j]-'A']=1;
            int t;
            if (!a[1])
                t=0;
            else if (!a['R'-'A'])
                t=1;
            else
                t=2;
            int kl=j-i;
            vector<ll>::iterator it;
            it=lower_bound(v[t].begin(),v[t].end(),j+kl);
            if (*it==j+kl)
                ans--;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3696
#include<stdio.h>

void kansu(int,int);

int main(void)
{
	int a,b;
	
	scanf("%d %d",&a,&b);
	while(a!=0 && b!=0){
		kansu(a,b);
		scanf("%d %d",&a,&b);
	}
	return 0;
}
void kansu(int a,int b)
{
	int x,y,n,i,j;
	int kouji[17][17];
	int suu[17][17];
	
	scanf("%d",&n);
	for(i=1;i<=a;i++){
		for(j=1;j<=b;j++){
			kouji[i][j]=0;
		}
	}
	for(i=0;i<n;i++){
		scanf("%d %d",&x,&y);
		kouji[x][y]=1;
	}
	for(i=1;i<=a;i++){
		for(j=1;j<=b;j++){
			if(i==1 && j==1){
				suu[i][j]=1;
			}
			else {
				if(kouji[i][j]==1){
					suu[i][j]=0;
				}
				else{
					if(i==1){
						suu[i][j]=suu[i][j-1];
					}
					else if(j==1){
						suu[i][j]=suu[i-1][j];
					}
					else {
						suu[i][j]=suu[i][j-1]+suu[i-1][j];
					}
				}
			}
		}
	}
	printf("%d\n",suu[a][b]);
}

Measured memory_bytes: 600
a,b = map(int,input().split())
min_mod = 2018

if b-a > 2019:
	min_mod=0

else:	
	for aa in range(a,b):
	   for bb in range(a+1,b+1):
	       if aa < bb:
	           cc=aa*bb
	 
	           if min_mod > cc%2019:
	               min_mod = cc%2019

print(min_mod)



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

int main(){
  int N, L;
  int maxL = 0;
  int sumL = 0;
  vector<int> length;
  cin >> N;
  
  for(int i = 0; i < N; i++){
    cin >> L;
    length.push_back(L);
    sumL += L;
  }
  
  maxL = *max_element(length.begin(), length.end());
  if(maxL < sumL - maxL){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3596
n,m,c = map(int,input().split())

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

ans = 0
for i in range(n):
  checkNum = 0
  a = list(map(int,input().split()))
  for j in range(m):
    checkNum += b[j] * a[j]
  if checkNum + c > 0:
    ans += 1
print(ans)

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

using namespace std;

constexpr int N = 1e5 + 10;

long long n, q, a, ps[N], cnt[N], tool;
vector <long long> v;

int bin (int b, int e) {
    if (b + 1 == e)
        return b;
    int mid = (b + e) >> 1;
    if (v[mid] < tool)
        return bin (mid, e);
    return bin (b, mid);
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> q;
    v.push_back (n);
    for (int i = 0; i < q; i++) {
        cin >> a;
        while ((int)v.size() && v.back() >= a)
            v.pop_back();
        v.push_back (a);
    }
    cnt[(int)v.size() - 1] = 1;
    for (int i = (int)v.size() - 1; i; i--) {
        tool = v[i];
        int p = (int)v.size(), x;
        while (tool) {
            if (tool < v[0]) {
                ps[1] += cnt[i];
                ps[tool + 1] -= cnt[i];
                break;
            }
            p = bin (0, (int)v.size());
            cnt[p] += cnt[i] * (tool / v[p]);
            tool %= v[p];
        }
    }
    ps[1] += cnt[0];
    ps[v[0] + 1] -= cnt[0];
    for (int i = 1; i <= n; i++) {
        ps[i] += ps[i - 1];
        cout << ps[i] << '\n';
    }
    return 0;
}


Measured memory_bytes: 4212
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define vii vector < pii >
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
int cnt[N];
int dp[N];
int s[N];
int main(void) {
    dp[0] = 1;
    int n;
    cin>>n;
    for (int i = 1;i <= n;++i)
    	cin>>s[i];
    for (int i = 1;i <= n;++i) {
    	if (s[i] != s[i - 1] && cnt[s[i]])
	    	dp[i] = (dp[i - 1] + dp[cnt[s[i]]]) % mod;
	    else
	    	dp[i] = dp[i - 1];
	    cnt[s[i]] = i;
    }
    cout << dp[n] << '\n';
    return 0;
}

Measured memory_bytes: 9216
#include <iostream>
using namespace std;
typedef long long llong;

int N, K, W[100000];

int check(llong P) {
	int v = 1;
	llong sum = 0;
	for (int i = 0; i < N; i++) {
		if (W[i] > P) {
			return -1;
		}
		if (sum + W[i] > P) {
			sum = 0;
			v++;
		}
		sum += W[i];
	}
	return v;
}

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) cin >> W[i];
	llong low = 0, high = 10000 * 100000, mid;
	int v;
	while (high - low > 1) {
		mid = (low + high) / 2;
		v = check(mid);
		//cout << "v:" << v << " mid:" << mid << " low:" << low << " high:" << high << endl;
		if (v > K) {
			low = mid;
		}
		else if (v >= 0) {
			high = mid;
		}
		else {
			low = mid;
		}
	}
	cout << high << endl;
	return 0;
}

Measured memory_bytes: 3500
while True:
	a, b, c = input().split()
	a = int(a)
	c = int(c)
	if b == "?":
		break
	if b == "+":
		print(a + c)
	if b == "-":
		print(a - c)
	if b == "*":
		print(a * c)
	if b == "/":
		print(a // c)



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

int main() {
  int a,b;
  cin >> a >> b;
  if(a >= b){
    for(int i = 0; i < a; i++){
      cout << b;
    }
    }else{
    for(int i = 0; i < b; i++){
      cout << a;
    }
  }
}

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



int main(void){
    string s;
    cin>>s;
    long long K;
    cin>>K;
    int count=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='1') count++;
        else break;
    }
    if(s.size()==1){
        cout<<s<<endl;
    }else{
        if(count>=K){
            cout<<s[0]<<endl;
        }else{
            for(int i=0;i<s.size();i++){
                if(s[i]!='1'){
                cout<<s[i]<<endl;
                break;
                }
            }
        }
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000000;

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

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

//gcd,lcm,べき,二進展開
//組み合わせ、mod計算
//最短路問題、bit、union find

///////////////////////////

bool prime(ll n) {

	if (n == 1) { return false; }

	for (int i = 2; i*i <= n; i++) {
		if (n%i == 0) { return false; }
	}
	return true;
}


int main() {

	ll X;
	cin >> X;

	while (1 == 1) {
		if (prime(X)) { cout << X; break; }
		X++;
	}


	system("PAUSE");


}


Measured memory_bytes: 504
n = int(input())
memo = [0 for _ in range(n + 1)]
for x in range(1, int(n ** 0.5) + 1):
    for y in range(1, int(n ** 0.5) + 1):
        for z in range(1, int(n ** 0.5) + 1):
            num = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if num <= n:
                memo[num] += 1
            elif num > n:
                break
for i in range(1, n + 1):
    print(memo[i])

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

char base[] = "keyence";

int main() {
	char s[ 256 ];
	scanf( "%s", s );
	int n = strlen( s ), pre = 7, suf = 7;
	for ( int i = 0 ; i < 7 ; ++ i ) {
		if ( s[ i ] != base[ i ] ) {
			pre = i;
			break;
		}
	}
	for ( int i = 0 ; i < 7 ; ++ i ) {
		if ( s[ n - i - 1 ] != base[ 6 - i ] ) {
			suf = i;
			break;
		}
	}
	puts( pre + suf >= 7 ? "YES" : "NO" );
	return 0;
}

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


#define li			long long int
#define rep(i,to)	for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)	for(li i=(li)(start);i<((li)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)		idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)	for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)		idp p2((x).F, (x).S)
#define dump(x,n)	idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)	idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)	idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)	idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)	rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)	rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li cnt[256];

int main() {
	string s;
	cin >> s;
	rep(i, sz(s)) {
		cnt[s[i]]++;
	}
	bool res = true;
	if ((cnt['S'] > 0 && cnt['N'] == 0) ||
	        (cnt['S'] == 0 && cnt['N'] > 0)) {
		res = false;
	}
	if ((cnt['E'] > 0 && cnt['W'] == 0) ||
	        (cnt['E'] == 0 && cnt['W'] > 0)) {
		res = false;
	}
	cout << (res ? "Yes" : "No") << endl;

	return 0;
}

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

#define MEM(a, b) memset(a, b, sizeof a);
#define REP(i, k) for(int i = (0); i < int(k); i++ )
#define FOR(i, a, b) for(int i = (a); i <= int(b); i++)
#define TRAV(a, e) for(auto x : e)

#define ALL(cont) cont.begin(), cont.end()
#define RALL(cont) cont.begin(), cont.end()
#define FOREACH(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define INF (int)INT_MAX
#define EPS (int)1e-9
#define PI acos(-1)
#define MOD 1000000007

#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

typedef long L;
typedef unsigned long UL;
typedef long long LL;
typedef unsigned long long ULL;

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

void solve(__attribute__((unused)) int tc = 0) {
    int n, a, b;
    cin >> n;
    vector<pair<int, int>> v;
    REP(_, n) {cin >> a >> b; v.pb(mp(a, b)); }
    sort(ALL(v), [](const pair<int, int> &p1, const pair<int, int> &p2) {
        return p1.second <  p2.second;
    });
    int curr = 0;
    for (auto &p : v) {
        if (curr + p.first > p.second) goto fail;
        curr += p.first;
    }
    cout << "Yes" << endl;
    return;

fail:
    cout << "No" << endl;
    return;
}

int main() {
#ifdef FILE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    /*int TC;
      cin >> TC;
      REP(tc, TC) {
      solve(tc);
      }*/
    solve();
#ifdef TIME
    cout << "Execution time(second) : " << int(clock() * 1000.0 / CLOCKS_PER_SEC) << " ms" << endl;
#endif
}


Measured memory_bytes: 2420
#include <iostream>
    using namespace std;
    namespace Fastio {
    void fastio() {
      ios_base::sync_with_stdio(0);
      cin.tie(0);
    }
    } // namespace Fastio
    namespace output {
    int func(int n) {
      while (n) {
        if (n % 10 == 7)
          return 1;
        n /= 10;
      }
      return 0;
    }
    } // namespace output
    using namespace Fastio;
    using namespace output;
    int main() {
      int n;
      cin >> n;
      if (output::func(n))
        cout << "Yes\n";
      else
        cout << "No\n";
      return 0;
    }

Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <ctime>
#define pb(x) push_back(x)
#define me(x,y) memset(x,y,sizeof(x))
#define sd(x) scanf("%d",&x)
#define ss(x) scanf("%s",x)
#define sf(x) scanf("%f",&x)
#define slf(x) scanf("%lf",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define pc(x) printf("%c",x)
#define pn() printf("\n")
#define plld(x) printf("%lld\n",x)
#define ps(x) printf("%s\n",x)
#define max(x,y) (x>=y?x:y)
#define min(x,y) (x<y?x:y)
#define sum(x,y) (x+y)
#define INF 0x3f3f3f3f

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

const int maxn=999999+5;

bool vis[maxn];
int prime[maxn];
int sum[maxn];

int get_prime() {
    me(vis,true);
    vis[0]=vis[1]=true;
    int cnt=1;
    for(int i=2;i<maxn;i++) {
        if(vis[i]) prime[cnt++]=i;

        for(int j=1;j<cnt && i*prime[j]<maxn;j++) {
            vis[i*prime[j]]=false;
            if(i%prime[j]==0) break;
        }
    }
    return cnt;
}

void solve() {
    int cnt=get_prime();
    me(sum,0);
    prime[0]=0;
    for(int i=1;i<cnt;i++) {
        for(int j=prime[i];j<prime[i+1];j++) sum[j]=i;
    }
}


int main() {
    solve();
    int n;
    while(sd(n)!=EOF) pd(sum[n]);
	return 0;
}



Measured memory_bytes: 8372
N = int(input())
S = [str(input()) for _ in range(N)]
#print(S)
dic={}
for i in range(N):
  if S[i] in dic.keys():
     dic[S[i]]+=1
  else:
     dic[S[i]]=1    
#print(dic)
sortedd = sorted(dic.items(), key=lambda x:x[1])
#print(sortedd)

maxc=sortedd[-1][1]
#maxc=max(dic.items())
#print(maxc)
#print(dic.keys())

sol=[]
for key in dic.keys():
  if dic[key] == maxc:
    sol+=[str(key)]
#print(sorted(sol))
for x in sorted(sol):
  print(x)
#  print(x+'\n')



Measured memory_bytes: 48912
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

char cv[5]={'M','A','R','C','H'};

void Main(){

  int N;
  cin>>N;

  ll st[5]={};

  rep(i,N){
    string S; cin>>S;
    rep(j,5){
      if(S[0]==cv[j]) ++st[j];
    }
  }

  ll ans=0;

  ans+=st[0]*st[1]*st[2];
  ans+=st[0]*st[1]*st[3];
  ans+=st[0]*st[1]*st[4];
  ans+=st[0]*st[2]*st[3];
  ans+=st[0]*st[2]*st[4];
  ans+=st[0]*st[3]*st[4];
  ans+=st[1]*st[2]*st[3];
  ans+=st[1]*st[2]*st[4];
  ans+=st[1]*st[3]*st[4];
  ans+=st[2]*st[3]*st[4];

  cout<< ans<<"\n";

}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using edge = int;
using graph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;


int main() {
	ll  n;cin >>n;
	vector<bitset<10>> a;
	for(int i = 0; i < n; ++i){
		string s(10, ' ');
		for(int j = 0; j < 10; ++j){
			cin >>s[j];
        }
        bitset<10> b ( s);
        a.push_back(b);
    }
  
  vector<vector<int> >p(n, vector<int> (11));
  for(int i = 0; i < n; ++i){
    for(int j = 0; j < 11; ++j){
      cin >> p[i][j];
    }
  }
  ll ans = -1* INF;
  for(int i = 1; i < (1<<10); ++i){
    bitset<10> s =(i);
    ll tmp = 0;
    for(int j = 0; j < n; ++j){
      bitset<10> ands = a[j]&s;
      ll num = ands.count();
      tmp += p[j][num];
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const double pi = acos(-1);
const int maxn = 2e6 + 10;
const double eps = 1e-8;
const ll mod = 1e9 + 7;
const ull base = 131;
const ull mod1 = 1e9 + 9;
const ull mod2 = 1610612741;

string ans;
char s[maxn];

int main()
{
	scanf("%s", s+1);
	for (int i = 1; s[i]; ++i)
	{
		if (s[i] == '1') ans += '1';
		else if (s[i] == '0') ans += '0';
		else 
		{
			if (!ans.empty())
				ans.erase(ans.size()-1);
		}
 	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, z, n) for(int64_t i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
//const int64_t INF = 1LL << 60;
//const int INF = 1 << 29;
//const int MODINF = 1000000007;
//const int64_t INF = 998244353;
using namespace std;
int main(){
    int N;
    cin >> N;
    cout << (N + 1) / 2 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void) {
	int i;
	int N = 0;
	int mid;
	int end_first;
	int start_latter;
	int strong = 0;
	char buf[128], *ch;

	fgets(buf, sizeof(buf), stdin);
	while(buf[N] != '\0') {
		N += 1;
	}
	N -= 1;
	//これでNは文字数
	mid = ((N + 1) / 2) - 1;
	start_latter = mid + 1;
	end_first = mid - 1;

	for(i = 0; i < mid / 2; i += 1) {
		if(buf[i] != buf[end_first - i]) {
			strong = 1;
			break;
		}
		if(buf[start_latter + i] != buf[N - i - 1]) {
			strong = 1;
			break;
		}
	}

	if(strong == 0) {
		for(i = 0; i < mid - 1; i += 1) {
			if(buf[i] != buf[N - i - 1]) {
				strong = 1;
				break;
			}
		}
	}

	if(strong == 0) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

	return 0;
}


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

using namespace std;

int64_t dp_same[110][12][110];
int64_t dp_small[110][12][110];

int main() {
  string N;
  int K;
  cin >> N >> K;
  int L = N.length();

  memset(dp_same, 0LL, sizeof(dp_same));
  memset(dp_small, 0LL, sizeof(dp_small));
  dp_same[0][0][0] = 1;

  for (int n = 0; n < L; n++) {
    int d = N[n] - '0';

    for (int d_prev = 0; d_prev < 10; d_prev++) {
      for (int k_prev = 0; k_prev <= n; k_prev++) {
	// same -> same (choose d)
	{
	  int choice = d;
	  int plus_non_zero = (choice == 0) ? 0 : 1;
	  dp_same[n + 1][choice][k_prev + plus_non_zero] += dp_same[n][d_prev][k_prev];
	}

	// same -> small (choose 0..d-1)
	{
	  for (int choice = 0; choice < d; choice++) {
	    int plus_non_zero = (choice == 0) ? 0 : 1;
	    dp_small[n + 1][choice][k_prev + plus_non_zero] += dp_same[n][d_prev][k_prev];
	  }
	}

	// small -> small (choose 0..d)
	{
	  for (int choice = 0; choice <= 9; choice++) {
	    int plus_non_zero = (choice == 0) ? 0 : 1;
	    dp_small[n + 1][choice][k_prev + plus_non_zero] += dp_small[n][d_prev][k_prev];
	  }
	}
      }
    }
  }

  int64_t result = 0;
  for (int i = 0; i < 10; i++) {
    result += dp_same[L][i][K];
    result += dp_small[L][i][K];
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 2560