akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
const static int tx[] = {0,1,0,-1};
const static int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

struct Student {
  bool win;
  int next;
  int prev;
  Student(bool _win,int _prev,int _next)
    : win(_win),prev(_prev),next(_next) {}
};

int main(){
  int total_students;
  int total_repeat_count;
  int total_questions;
  while(~scanf("%d %d %d",
               &total_students,
               &total_repeat_count,
               &total_questions)){

    vector<Student> students;
    for(int student_i = 0; student_i < total_students; student_i++){
      students.push_back(Student(true,
                                 ((student_i - 1) + total_students) % total_students,
                                 (student_i + 1) % total_students));
    }
    
    int current_pos = 0;

    for(int repeat_i = 0; repeat_i < total_repeat_count; repeat_i++){
      int target;
      scanf("%d",&target);
      int limit = target;
      while(limit > 0){
        if(target % 2 == 0){
          current_pos = students[current_pos].next;
        }
        else{
          current_pos = students[current_pos].prev;
        }
        limit--;
      }

      students[current_pos].win = false;
      students[students[current_pos].prev].next
        = students[current_pos].next;
      students[students[current_pos].next].prev
        = students[current_pos].prev;
      current_pos = students[current_pos].next;
    }

    for(int question_i = 0; question_i < total_questions; question_i++){
      int query;
      scanf("%d",&query);
      printf("%d\n",students[query].win ? 1 : 0);
    }
  }
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    ll x;
    cin>>x;

    ll m=100,c=0;
    while(m<x){
       m=m+(m/100);
       c++;
    }

    cout<<c<<"\n";

    return 0;
}

Measured memory_bytes: 3632
import java.util.*;
public class Main{
    public static void main(String [] args){
        Scanner input = new Scanner(System.in);
       
        int N = input.nextInt();
        int K = input.nextInt();
        int X = input.nextInt();
        int Y = input.nextInt();
        
        int sum = 0;
        if(N>=K){
            for(int i = 1; i<=K; i++)
                sum+=X; 
            for(int j = 1; j<=N-K; j++)
                 sum+=Y;
        }else
            for(int i = 1; i<=N; i++)
              sum+=X;
        
        System.out.println(sum);
        
    }
}


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

#define INF 900000000
#define LINF 9000000000000000000
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)

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

ll n;

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

	cin >> n;
	FOR(i,1,3501) {
		FOR(j,i,3501) {
			ll a = n*i*j, b = 4*i*j-n*i-n*j;
			if (b>0 && a%b==0) {
				cout << i << ' ' << j << ' ' << a/b << endl;
				return 0;
			}
		}
	}

	return 0;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    int X[110];
    cin >> N;
    rep(i,N) cin >> X[i];
    int res;
    int min_val = INF;
    for(int i = 1; i <= 100 ; i++){
        res = 0;
        for(int j = 0; j < N;j++){
            res += abs((i - X[j]))*abs((i - X[j]));
        }
        min_val = min(min_val,res);
    }
    cout << min_val << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
struct S{
  S(int a,int b){
    num=a;ac=b;
  }
  int num,ac;
};

bool operator<(S a,S b){
  return a.ac<b.ac;
}

int ans[100];


int main(){
  int num,ac;
  for(int i=0;i<100;i++){
    ans[i]=0;
  }
  vector<S> list;
  while(scanf("%d,%d",&num,&ac),ac!=0||num!=0){
    list.push_back(S(num,ac));
  }
  sort(list.begin(),list.end());
  int tmp=1;
  ans[ list[list.size()-1].num ] =1;
  for(int i=list.size()-2;i>=0;i--){
    if( list[i+1].ac != list[i].ac ){
      tmp++;
    }
    ans[list[i].num]=tmp;
  }
  while(cin>>tmp){
    cout<<ans[tmp]<<endl;
  }
}

Measured memory_bytes: 1248
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll INF=1000000010;
const ll MOD=1000000007;
const ll LINF=4000000000000000000;
const long double EPS=1e-9;
typedef pair<int,int> P;
int main(){
    int h1,h2;cin>>h1>>h2;
    int k1,k2;cin>>k1>>k2;
    int a,b,c,d;cin>>a>>b>>c>>d;
    int a1=a*h1+b*h2;
    int a2=a*k1+b*k2;
    a1+=(h1/10)*c+(h2/20)*d;
    a2+=(k1/10)*c+(k2/20)*d;
    if(a1>a2){
        cout<<"hiroshi"<<endl;
    }else if(a2>a1){
        cout<<"kenjiro"<<endl;
    }else{
        cout<<"even"<<endl;
    }
}   



Measured memory_bytes: 3100
N = int(input())
ans = 0
MARCH = [0] * 5  # 順にM、A、R、C、H
for i in range(N):
    S = input()
    if S[0] == "M":
        MARCH[0] += 1
    elif S[0] == "A":
        MARCH[1] += 1
    elif S[0] == "R":
        MARCH[2] += 1
    elif S[0] == "C":
        MARCH[3] += 1
    elif S[0] == "H":
        MARCH[4] += 1

for j in range(3):
    for k in range(j+1, 4):
        for m in range(k+1, 5):
            ans += MARCH[j] * MARCH[k] * MARCH[m]
print(ans)
#print(MARCH)


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

int main(){
	string s1, s2;
	cin >> s1 >> s2;
	if(s1 == s2) {
		cout << "EQUAL";
	} else {
		if(s1.size() > s2.size()) {
			cout << "GREATER";
		} else if (s1.size() < s2.size()) {
			cout << "LESS";
		} else {
			for(int i = 0; i <s1.size(); i++) {
				if (s1[i] > s2[i]) {
					cout << "GREATER";
					return 0;
				} else if (s1[i] < s2[i]) {
					cout << "LESS";
					return 0;
				}
			}
		}
	}
	return 0;
}



Measured memory_bytes: 256
//https://atcoder.jp/contests/abc143/tasks/abc143_a
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    ll A,B; cin>>A>>B;    
    ll ans=0;
    ans=max(ans,A-2*B);
    cout<<ans<<endl;
    return 0;
}

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

int main(int argc,char* argv[] ){
    int a;
    cin >> a;

    long sum = 0;
    for(int i = 1;i <= a;i ++){
        if((i % 3 != 0) &&  (i % 5 != 0)){
            sum += i;
        }
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int max1 = Math.max(a, b);
		int max2 = Math.max(max1, c);
		if(a == max2) {
			System.out.println(b + c);
			return;
		}
		if(b == max2) {
			System.out.println(a + c);
			return;
		}
		if(c == max2) {
			System.out.println(a + b);
			return;
		}
	}
}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define va vector<long long int> a 
#define vb vector<long long int> b
const ll M = 1e9+7;
const ll inf = 1e18+5;
using namespace std;
void fast(){cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);}
ll bs(ll arr[], ll l, ll r, ll x){
	ll mid=0;
    if (r >= l){
		if (arr[mid] == x) return mid; 
        if (arr[mid] > x) return bs(arr, l, mid - 1, x); 
        return bs(arr, mid + 1, r, x); 
    }
    return -1;
}
ll power(ll x,ul y,ll p){
	ll res = 1;
	x = x % p;
	if(x == 0) return 0;
	while (y > 0){
		if (y & 1) res = (res*x) % p;
		y = y>>1;
		x = (x*x) % p;
		}
	return res;
}

void solve(){
	ll t,n;
	cin>>n;
	ll sum=1000;
	while(n>sum) sum+=1000;
	cout<<sum-n<<"\n";
	
	
 }
int main(){
	fast();
	solve();
	return 0;
}



Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define rep(i, f, n) for (int i = (f); i < (int)(n); i++)
#define repe(i, f, n) for (int i = (f); i <= (int)(n); i++)
using namespace std;
using ll = long long;
using pint = pair<int, int>;

const int INF = 1001001001;

int main() {
  int N;
  cin >> N;
  string s = to_string(N);
  int tot = 0;
  rep(i, 0, s.size()) tot += s[i] - '0';

  if (N % tot == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3696
#include <cstdio>

int main() {
    int A, B;
    scanf(" %d %d", &A, &B);

    int ans = 0;
    for (int i = A; i <= B; i++) {
        // printf("i: %d\n", i);
        char i_c[6];
        sprintf(i_c, "%d", i);
        // printf("i_c: %s\n", i_c);
        int cnt = 0;
        for (int j = 0; j < 3; j++) {
            if (i_c[j] == i_c[4-j]) {
                cnt++;
            } else {
                break;
            }
        }
        if (cnt == 3) {
            ans++;
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n;cin>>n;
    vector<ll> a(n);
    rep(i,n){
        cin>>a[i];
    }
    ll ans=LINF;
    for(int i=-10;i<=110;i++){
        ll tmp=0;
        rep(j,n){
            tmp+=(i-a[j])*(i-a[j]);
        }
        chmin(ans,tmp);
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
	int N, Y;
	std::cin >> N >> Y;

	for(int x = 0; x <= N; ++x) {
		for(int y = 0; x + y <= N; ++y) {
			int z = N - x - y;
			if(10000 * x + 5000 * y + 1000 * z == Y) {
				std::cout << x << " " << y << " " << z << std::endl;
				return 0;
			} else {
				continue;
			}
		}
	}

	std::cout << "-1 -1 -1" << std::endl;
 }

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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;

int H, W, D;
vector<pair<int, int>> A;
int Q;

int main(void) {
    cin >> H >> W >> D;
    A.resize(H * W + 1);
    REP(x, 0, H) {
        REP(y, 0, W) {
            int a;
            cin >> a;
            A[a] = pair<int, int>(x, y);
        }
    }

    int d[90001] = {};
    for(int i = D + 1; i <= H * W; ++i) {
        d[i] = d[i - D] + abs(A[i].first - A[i - D].first) + abs(A[i].second - A[i - D].second);
    }

    cin >> Q;
    rep(i, Q) {
        int L, R;
        cin >> L >> R;
        cout << (d[R] - d[L]) << endl;
    }

    return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define all(a) a.begin(),a.end()
#define fi first
#define se second
#define deb(x) cout << #x << "=" << x << endl
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
int M=1e9+7,N=205001;

int mm(int x,int y){x%=M,y%=M;return (x*y)%M;}//Modular Multiply
int po(int x,int y){ if(!y)return 1;int a=po(x,y/2)%M;if(y%2)return mm(a,mm(a,x));return mm(a,a);}//(x**y)%M




void solve() {
	int n,s=0;
	cin>>n;
	int a[n];
	rep(i,0,n) cin>>a[i];
	rep(i,1,n){
		if(a[i]<a[i-1]) {
			s+=a[i-1]-a[i];
			a[i]=a[i-1];	
		}
	}
	cout<<s;
		
}


signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}





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

using namespace std;

int main(){
    string s, t, r;
    int a, b;
    cin >>s>>t>>a>>b>>r;
    if(s==r){
        cout<<a-1<<" "<<b<<endl;
    }
    else{
        cout <<a<<" "<<b-1<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main()
{
    int N;
    cin >> N;
    vector<string> S(N);
    rep(i, N)
    {
        cin >> S[i];
    }
    int C0 = 0;
    int C1 = 0;
    int C2 = 0;
    int C3 = 0;
    rep(i, N)
    {
        if (S[i] == "AC")
        {
            ++C0;
        }
        else if (S[i] == "WA")
        {
            ++C1;
        }
        else if (S[i] == "TLE")
        {
            ++C2;
        }
        else
        {
            ++C3;
        }
    }
    cout << "AC x " << C0 << endl;
    cout << "WA x " << C1 << endl;
    cout << "TLE x " << C2 << endl;
    cout << "RE x " << C3 << endl;
}

Measured memory_bytes: 6360
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
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; }
const int MOD = 1e9 + 7;
const int INF = 1e9 + 200;
const ll INFLL = 2e18 + 200;

int main() {
    int N;
    cin >> N;
    vector<vector<int>> graph(N);
    vector<int> parent(N);
    for (int i = 1; i < N; i++) {
        int temp;
        cin >> temp;
        temp--;
        parent[i] = temp;
        graph[temp].push_back(i);
        graph[i].push_back(temp);
    }
    vector<int> X(N);
    cin >> X;
    function<pi(int, int)> dfs = [&](int now, int  before) {
         pi info = {INF, INF};
        vector<vector<int>> dp(graph[now].size() + 1, vector<int>(6000, INF));
        dp[0][0] = 0;
        int idx = 0;
        for (int next : graph[now]) {
            if (next == before) continue;
            pi plus = dfs(next, now);
            for (int i = 0; i + X[next] <= 5000; i++) {
                chmin(dp[idx + 1][i + X[next]], dp[idx][i] + plus.second);
            }
            for (int i = 0; i + plus.first <= 5000; i++) {
                chmin(dp[idx + 1][i + plus.first], dp[idx][i] + X[next]);
            }
            idx++;
        }
        for (int i = 0; i <= X[now]; i++) chmin(info.second, dp[idx][i]);
        for (int i = 0; i <= 5000; i++) {
            int &temp = dp[idx][i];
            if (temp <= X[now]) {
                info.first = i;
                break;
            }
        }
         return info;
    };
    auto ans = dfs(0, -1);
    if (ans.first == INF && ans.second == INF) {
        cout << "IMPOSSIBLE" << endl;
    } else {
        cout << "POSSIBLE" << endl;
    }
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#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 debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  VI a(m), b(m), c(m, 0);
  rep(i, m) {
    cin >> a[i] >> b[i];
    rep(j, b[i]) {
      int d;
      cin >> d;
      d--;
      c[i] |= (1 << d);
    }
  }
  VVI dp(m + 1, VI(1 << n, INF));
  rep(i, m + 1) dp[i][0] = 0;
  rep(i, m) rep(j, (1 << n)) {
    dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
    dp[i + 1][j | c[i]] = min(dp[i + 1][j | c[i]], dp[i][j] + a[i]);
  }
  if(dp[m][(1 << n) - 1] != INF) out(dp[m][(1 << n) - 1]);
  else out(-1);
  return 0;
}


Measured memory_bytes: 16384
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;

int main() {
    int n;
    cin >> n ;
    vector<long long> v;
    long long sum = 0;
    for (int i = 0; i < n; ++i) {
        long long x;
        cin >> x;
        sum += x-1;
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n,m=map(int,readline().split())

    ans=0
    t=min(n,m//2)
    ans+=t
    n-=t
    m-=2*t
    ans+=m//4
    print(ans)
    
if __name__=="__main__":
    main()

Measured memory_bytes: 3060
#include <valarray>
#include <cstdio>
using namespace std;
typedef valarray<int>V;
int N,M,A,B,C,T;
V mul(const V &a, const V &b){
	V c(N*N);
	int i=0,j;
	for(;i<N;i++)for(j=0;j<N;j++)c[i*N+j]=(a[slice(i*N,N,1)]*b[slice(j,N,N)]).sum()%M;
	return c;
}
V exp(const V &a, const int n){
	if(n==1)return a;
	if(n&1)return mul(a,exp(a,n-1));
	V b=exp(a,n>>1);
	return mul(b,b);
}
V z(){
	V x(N*N);
	int i;
	if(T){
		for(i=0;i<N;i++){
			if(i>0)x[i*N+i-1]=A;
			x[i*N+i]=B;
			if(i<N-1)x[i*N+i+1]=C;
		}
		return exp(x,T);
	}else{
		for(i=0;i<N;i++)x[i*N+i]=1;
		return x;
	}
}
main(){
	int i;
	V s;
	for(;scanf("%d%d%d%d%d%d",&N,&M,&A,&B,&C,&T),N;){
		s.resize(N);
		for(i=0;i<N;i++)scanf("%d",&s[i]);
		const V r=z();
		for(i=0;i<N;i++)printf(i<N-1?"%d ":"%d\n",(r[slice(i*N,N,1)]*s).sum()%M);
	}
}

Measured memory_bytes: 1080
import sys
import numpy as np

MOD = 10 ** 9 + 7


def prepare(n, MOD):
    nrt = int(n ** 0.5) + 1
    nsq = nrt * nrt
    facts = np.arange(nsq, dtype=np.int64).reshape(nrt, nrt)
    facts[0, 0] = 1
    for i in range(1, nrt):
        facts[:, i] = facts[:, i] * facts[:, i - 1] % MOD
    for i in range(1, nrt):
        facts[i] = facts[i] * facts[i - 1, -1] % MOD
    facts = facts.ravel().tolist()

    invs = np.arange(1, nsq + 1, dtype=np.int64).reshape(nrt, nrt)
    invs[-1, -1] = pow(facts[-1], MOD - 2, MOD)
    for i in range(nrt - 2, -1, -1):
        invs[:, i] = invs[:, i] * invs[:, i + 1] % MOD
    for i in range(nrt - 2, -1, -1):
        invs[i] = invs[i] * invs[i + 1, 0] % MOD
    invs = invs.ravel().tolist()

    return facts, invs


def comb(n, r, facts, invs, MOD):
    return facts[n] * invs[r] * invs[n - r] % MOD


def main():
    input = sys.stdin.buffer.readline
    n, k = map(int, input().split())
    facts, invs = prepare(2100, MOD)
    for i in range(1, k + 1):
        if n - k < i - 1:
            print(0)
        else:
            print(
                comb(n - k + 1, i, facts, invs, MOD)
                * comb(k - 1, i - 1, facts, invs, MOD)
                % MOD
            )


if __name__ == "__main__":
    main()


Measured memory_bytes: 27436
#include <bits/stdc++.h>
#define ps push_back
#define LL long long
using namespace std;
void solve()
{

}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin>>t;
    cout<<t+t*t+t*t*t<<endl;
    return 0;
}


Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
template<typename T>
struct Treap{
  struct Node{
    Node *l,*r;
    T key,pri;
    Node(){}
    Node(T key,T pri):key(key),pri(pri){l=r=nullptr;}
  };
  const size_t LIM = 1e6;
  vector<Node> pool;
  size_t ptr;

  Treap():pool(LIM),ptr(0){}
  
  inline Node* create(){
    return &pool[ptr++];
  }
  
  inline Node* create(T key,T pri){
    return &(pool[ptr++]=Node(key,pri));
  }
  
  Node* rotR(Node* t){
    Node* s=t->l;
    t->l=s->r;
    s->r=t;
    return s;
  }
  
  Node* rotL(Node* t){
    Node* s=t->r;
    t->r=s->l;
    s->l=t;
    return s;
  }
  
  Node* insert(Node* t,T key,T pri){
    if(t==nullptr) return create(key,pri);
    if(key==t->key) return t;
    if(key < t->key){
      t->l=insert(t->l,key,pri);
      if(t->pri < t->l->pri) t=rotR(t);
    }else{
      t->r=insert(t->r,key,pri);
      if(t->pri < t->r->pri) t=rotL(t);
    }
    return t;
  }

  Node* erase(Node* t,T key){
    if(t==nullptr) return t;
    if(key < t->key) t->l=erase(t->l,key);
    else if(key > t->key) t->r=erase(t->r,key);
    else return del(t,key);
    return t;
  }

  Node* del(Node* t,T key){
    if(t->l==nullptr&&t->r==nullptr) return nullptr;
    if(t->l==nullptr) t=rotL(t);
    else if(t->r==nullptr) t=rotR(t);
    else if(t->l->pri < t->r->pri) t=rotL(t);
    else t=rotR(t);
    return erase(t,key);
  }

  Node* find(Node* t,T key){
    if(t==nullptr) return t;
    if(key < t->key) return find(t->l,key);
    if(key > t->key) return find(t->r,key);
    return t;
  }

  void print1(Node* t){
    if(t==nullptr) return;
    print1(t->l);
    cout<<" "<<t->key;
    print1(t->r);
  }
  
  void print2(Node* t){
    if(t==nullptr) return;
    cout<<" "<<t->key;
    print2(t->l);
    print2(t->r);
  }
  
};
signed main(){
  int q;
  cin>>q;
  Treap<int> G;
  Treap<int>::Node* r=nullptr;
  for(int i=0;i<q;i++){
    string s;
    cin>>s;
    if(s=="insert"){
      int key,pri;
      cin>>key>>pri;
      r=G.insert(r,key,pri);
    }
    if(s=="delete"){
      int key;
      cin>>key;
      r=G.erase(r,key);
    }
    if(s=="find"){
      int key;
      cin>>key;
      cout<<(G.find(r,key)!=nullptr?"yes":"no")<<endl;
    }
    if(s=="print"){
      G.print1(r);
      cout<<endl;
      G.print2(r);
      cout<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 7680
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

ll modpow(ll a, ll b, ll p = 1e9+7){
    if(b == 0)  return 1;

    if(b % 2 == 0){
        ll d = modpow(a, b/2, p);
        return (d*d) % p;
    }else{
        return (a%p * modpow(a, b-1, p)) % p;
    }
}

struct ModComb{
    vector<ll> po, inv;
    ll N;

    ModComb(ll n) : N(n), po(n), inv(n) {
        po[0] = 1;
        for(int i = 1; i < N; i++)  po[i] = (po[i-1] * i) % mod;
        inv[N-1] = modpow(po[N-1], mod-2, mod);
        for(int i = N-2; i >= 0; i--)   inv[i] = (inv[i+1] * (i+1)) % mod;
    }
    
    ll nCk(ll n, ll k){
        if(k == 0)  return 1;
        if(n < k)   return 0;
        return (((po[n]*inv[n-k])%mod)*inv[k])%mod;
    }

    ll nPk(ll n, ll k){
        if(k == 0)  return 1;
        if(n < k)   return 0;
        return (po[n]*inv[n-k])%mod;
    }

    ll nHk(ll n, ll k){
        if(n == 0 && k == 0)    return 1;
        return nCk(n+k-1, k-1);
    }
};

int main(){
    int n, k;
    cin >> n >> k;

    ModComb mc(n*5);
    for(int i = 1; i <= k; i++){
        
        if(i-1 > n-k){
            cout << 0 << endl;
            continue;
        }
        // cout << mc.nHk(n-k-(i-1), i+1) << endl;
        // cout << mc.nCk(k-1, i-1) << endl;
        cout << mc.nHk(n-k-(i-1), i+1) * mc.nCk(k-1, i-1) % mod << endl;
    }
    return 0;
}

Measured memory_bytes: 384
N, M, C = $stdin.readline.split(" ").map(&:to_i)
bs = $stdin.readline.split(" ").map(&:to_i)
n = 0
N.times.each do
  as = $stdin.readline.split(" ").map(&:to_i)
  sum = 0
  M.times do |i|
    sum += as[i] * bs[i]
  end
  sum += C
  if sum > 0
    n += 1
  end
end

puts n


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

namespace AtcoderSubmit
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = double.Parse(Console.ReadLine());
            long y = 100;
            var i = 0;
            while(true) {
                if(y >= x) {
                    Console.WriteLine(i);
                    return;
                }
                y = (long)(y * 1.01);
                i++;
            }
        }
    }
}


Measured memory_bytes: 27440
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES //円周率M_PIを使用するための定義
#include<math.h> 
using namespace std;

int main()
{
	double r ,menseki, enshu;
	cin >> r;
	if(0 < r < 10000)
	{
		menseki = r * r * M_PI;
		enshu = 2 * r * M_PI;
	}
	cout <<  fixed << menseki << " " << fixed << enshu << endl;
	return 0;

}


Measured memory_bytes: 3284
function Main(input){
  var N = parseInt(input.split(' ')[0]);
  var A = parseInt(input.split(' ')[1]);
  var B = parseInt(input.split(' ')[2]);

  var sum = 0;
  for(var i = 1; i <= N; i++){
    var is = i.toString().split('')
      .map((a) => parseInt(a, 10)).reduce((b, c) => { return b + c });
    
    if(A <= is && is <= B){
      sum += i;
    }
  }
  console.log(sum);
}

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

Measured memory_bytes: 25048
#include<stdio.h>
int main(void){
int ai,n,i,min,max;
long sum;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&ai);
if(i==0){
min=ai;
max=ai;
sum=ai;}
else{
sum=sum+ai;
if(min>ai){
min=ai;}
if(max<ai){
max=ai;}}}
printf("%d %d %ld\n",min,max,sum);
return 0;
}

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

int main(){
  int64_t a;
  string s;
  cin >> a >> s;
  int b=0;
  for(int i=0;i<s.size(); i++){
    char c = s.at(i);
    if(c=='.')continue;
    b*=10;
    b+= c-'0';
  }
  int64_t ans =a*b/100;
  cout << ans << endl;
}


Measured memory_bytes: 3624
package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d", &n)

	nums := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &nums[i])
	}

	var ans int
	for i := 0; i < n; i++ {
		if (i+1)%2 != 0 && nums[i] != 0 && nums[i]%2 != 0 {
			ans++
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 1836
#include <iostream>
#include<cstdio>
#include<algorithm>

using namespace std;

struct req{
  int st,ln;
};

bool cmp1(req a,req b){
  return a.ln>b.ln;
}

bool cmp2(req a,req b){
  return a.st<b.st;
}

req r[200000];
int chk[200000];

int main() {
  int n,m;
  scanf("%d%d",&n,&m);
  for(int i=0;i<m;i++){
    scanf("%d%d",&r[i].st,&r[i].ln);
    r[i].ln-=r[i].st;
    //printf("%d %d ",r[i].st,r[i].ln);
  }
  
  //printf("asd");
  sort(r,r+m,cmp1);
  sort(r,r+m,cmp2);
  
  int ans = 0,s,e,j;
  for(int i=0;i<m;i++){
    if(chk[i])
      continue;
    chk[i]=1;
    ans++;
    s=r[i].st;
    e=r[i].st+r[i].ln;
    j=i+1;
    while(r[j].st<e&&j<m){
      //printf("%d",j);
      chk[j]=1;
      e=min(e,r[j].st+r[j].ln);
      j++;
    }
  }
  printf("%d\n",ans);
  
}

Measured memory_bytes: 1408
if __name__ == "__main__":
    N = int(input())
    A = map(int, input().split())
    for i in A:
        if i % 2 ==0:
            if i % 3 != 0 and i % 5 != 0:
                    print("DENIED")
                    exit(0)
            else:
                pass
        else:
            pass
    print("APPROVED")



Measured memory_bytes: 2940
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */



import java.util.* ;

/**
 *
 * @author nai
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception{
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        HashSet<Integer> set = new HashSet<>();
        for(int i = 0 ; i< N ; i++){
            set.add(sc.nextInt());
        }
        System.out.println(set.size());
    }
  }
    



Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
long long N,R,M=1e6,a,k,Inf=(1ULL<<62),p=Inf;

int main() {
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    sort(begin(A),end(A));
    vector<bool> d(M+1);
    rep(i,N){
        a=A[i];
        if(p==a) { d[a]=1; continue; }
        p=a;
        for(k=2;a*k<=M;++k) d[a*k]=1;
    }
    rep(i,N) R+=!d[A[i]];
    cout << R;
}

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

int main(void){
    set<int> S;
    int q;
    cin >> q;
    for(int i=0; i<q; i++){
        int cmd;
        cin >> cmd;
        if(cmd==0){
            int x;
            cin >> x;
            S.insert(x);
            cout << S.size() << "\n";
        }
        else if(cmd==1){
            int x;
            cin >> x;
            if(S.find(x) != S.end()){
                cout << 1 << "\n";
            }
            else{
                cout << 0 << "\n";
            }
        }
    }
    return 0;
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)

using P = std::tuple<int,int>;
using ll = long long;

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

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

    string S;
    std::cin >> S;

    std::cout << S.substr(0, 4) << " " << S.substr(4, 8) << std::endl;
}


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

using namespace std;
using llint = long long;

#define LOG(x) cout << "# " << #x <<" => "<< (x) <<endl

string s;
int w=0, l=0;

int main() {
    cin >> s;

    for (int i = 0; i < s.size(); ++i)
    {
        if (s.at(i) == 'o')
        {
            ++w;
        }
    }


    if ((15-s.size())+w >= 8)
    {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);

    int a, b;
    cin >> a >> b;
    cout << (a + b == 15 ? '+' : a * b == 15 ? '*' : 'x') << endl;
}

Measured memory_bytes: 256
import fractions
from functools import reduce
n = int(input())
t = []
for _ in range(n):
  t.append(int(input()))
def lcm_base(x, y):
  return (x * y) // fractions.gcd(x, y)

def lcm(numbers):
  return reduce(lcm_base, numbers, 1)

print(lcm(t))  

Measured memory_bytes: 5048
#include <stdio.h>
#include <string.h>

int width,height;
long long steps;
int visited[4][102][102];
char map[104][104];

const int dx[4]={ 0, 1, 0,-1};
const int dy[4]={-1, 0, 1, 0};
const char dirstr[4]={'N','E','S','W'};

struct {
	int x,y,dir;
} position[4*100*100+10];

int getTheNumber(int offset,int max,long long steps) {
	if(steps<offset)return steps;
	return (steps-offset)%(max-offset)+offset;
}

int main(void) {
	int i,j;
	int nowstep;
	int nowdir;
	int x,y;
	int offset,max,result;
	while(1) {
		scanf("%d%d%lld",&height,&width,&steps);
		if(width==0 && height==0 && steps==0)break;
		memset(map,'#',sizeof(map));
		for(i=1;i<=height;i++) {
			scanf("%s",&map[i][1]);
			map[i][width+1]='#';
		}
		x=y=0;
		for(i=1;i<=height;i++) {
			for(j=1;j<=width;j++) {
				if(map[i][j]=='N'){x=j;y=i;nowdir=0;}
				else if(map[i][j]=='E'){x=j;y=i;nowdir=1;}
				else if(map[i][j]=='S'){x=j;y=i;nowdir=2;}
				else if(map[i][j]=='W'){x=j;y=i;nowdir=3;}
			}
		}
		if(x<=0 || y<=0)return 1;
		memset(visited,0,sizeof(visited));
		nowstep=0;
		while(1) {
			if(visited[nowdir][y][x]>0)break;
			visited[nowdir][y][x]=nowstep+1;
			position[nowstep].x=x;
			position[nowstep].y=y;
			position[nowstep].dir=nowdir;
			while(map[y+dy[nowdir]][x+dx[nowdir]]=='#') {
				nowdir=(nowdir+1)%4;/* turn right */
			}
			x+=dx[nowdir];
			y+=dy[nowdir];
			nowstep++;
		}
		offset=visited[nowdir][y][x]-1;
		max=nowstep;
		result=getTheNumber(offset,max,steps);
		printf("%d %d %c\n",position[result].y,position[result].x,
			dirstr[position[result].dir]);
	}
	return 0;
}

Measured memory_bytes: 844
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) REP((i),0,(n))
#define RREP(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rrep(i,n) RREP(i,n,0)
#define each(it,X) for(__typeof((X).begin())  it=(X).begin();it!=(X).end();it++)
#define all(v) ((v).begin(),(v).end())
#define fi first
#define se second
#define pb push_back
typedef pair<int,int>pr;
typedef vector<int>vi;
typedef vector<vi>vvi;
typedef set<int>si;
const int INF=1070000000ll;
const int mod=1000000007ll;

int N;
int a[100];

int seet[17];
queue<int>Q;

void in(int t){
    while(!Q.empty()){
        int p=Q.front();
        int n=(p%5==1?5:2);
        bool in_flag=false;
        for(int i=0;i+n<=17;i++){
            bool flag=true;
            for(int j=i;j<i+n;j++){
                if(seet[j]){
                    flag=false;
                    break;
                }
            }
            if(!flag)continue;
            Q.pop();
            for(int j=i;j<i+n;j++){
                seet[j]=17*(p%2)+3*(p%3)+19;
            }
            a[p]=t-5*p;
            in_flag=true;
            break;
        }
        if(!in_flag)return;
    }
}
void eat(){
    for(int i=0;i<17;i++)if(seet[i])seet[i]--;
}
signed main(){

    for(int i=0;i<500||!Q.empty();i++){
        if(i%5==0&&i<500)Q.push(i/5);
        in(i);
        eat();
    }

    while(scanf("%d",&N)!=EOF)printf("%d\n",a[N]);
    return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define emp emplace

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int N = 3010, MOD = 1000 * 1000 * 1000 + 7;
char s[N];
int pd[N][N];
int a[N][N];

int main()
{
	int n;
	scanf("%d %s", &n, s);
	pd[0][1] = 1;
	a[0][1] = 1;

	for (int i = 1; i < n; i++)
	{
		if (s[i-1] == '<')
		{
			for (int j = 1; j <= i+1; j++)
			{
				pd[i][j] = a[i-1][j-1];
				a[i][j] = (a[i][j-1] + pd[i][j])%MOD;
			}
		}
		else
		{
			for (int j = 1; j <= i+1; j++)
			{
				pd[i][j] = (MOD + a[i-1][i] - a[i-1][j-1])%MOD;
				a[i][j] = (a[i][j-1] + pd[i][j])%MOD;
			}
		}
	}
	int ans = 0;
	for (int j = 1; j <= n; j++)
	{
		ans += pd[n-1][j];
		ans %= MOD;
	}
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 69632
#include<bits/stdc++.h> 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define int long long
#define swap(x,y) (x^=y^=x^=y)

#define debug1(a) cerr<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

using namespace std;
 
#define mod 1000000007
long long modexpo(long long x, long long p){
    int res = 1;x = x%mod;
    while(p){
        if(p%2)res = res * x;
        p >>= 1;
        x = x*x % mod;
        res %= mod;
    }
    return res;
}
 
// int max(int a,int b){return (a>b?a:b);} 
// int min(int a,int b){return (a<b?a:b);}


struct compare{
    bool operator() (const pair<int,int> a, const pair<int,int> b) const{
        return a.first < b.first;
    }
};

int32_t main(){
    IOS
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    a--;
    int x = a/c;
    int y = b/c;
    x += a/d;
    y += b/d;
    int l = c*d;
    l /= __gcd(c,d);
    int e = a/l;
    int f = b/l;
    // cout << x << " " << y << " " << e << " " << f << endl;
    a++;
    cout << b-a+1 - ((y-f) - (x - e)) << endl;
} 

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

vector<ll> dijkstra(const WGraph &G, const int s) {
    int n = (int)G.size();
    std::vector<long long> dis(n, LINF);
    dis[s] = 0;
    using P = std::pair<long long, int>;
    std::priority_queue<P, std::vector<P>, std::greater<P>> que;
    que.push(std::make_pair(0, s));

    while (!que.empty()) {
        auto p = que.top();
        que.pop();
        int v = p.second;
        if (dis[v] < p.first) continue;
        for (auto e : G[v]) {
            if (dis[e.first] > dis[v] + e.second) {
                dis[e.first] = dis[v] + e.second;
                que.push(std::make_pair(dis[e.first], e.first));
            }
        }
    }
    return dis;
}

void solve() {
    int N, M, S;
    cin >> N >> M >> S;
    WGraph G(N*2500);
    for (int i=0; i<M; ++i) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        --u, --v;
        for (int i=a; i<2500; ++i) {
            G[2500*u+i].push_back({2500*v+i-a, b});
            G[2500*v+i].push_back({2500*u+i-a, b});
        }
    }
    for (int i=0; i<N; ++i) {
        int c, d;
        cin >> c >> d;
        for (int j=0; j<2500-1; ++j) {
            G[2500*i+j].push_back({2500*i+min(2499, j+c), d});
        }
    }

    auto dis = dijkstra(G, min(2499, S));
    for (int i=1; i<N; ++i) {
        ll res = LINF;
        for (int j=0; j<2500; ++j) chmin(res, dis[2500*i+j]);
        cout << res << '\n';
    }
}

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

    solve();

    return 0;
}


Measured memory_bytes: 23808
#include <cstdlib>
#include <string>
#include <iostream>
#include <sstream>

using namespace std;

int main()
{
    string str[2];

    for (int i = 0; i < 2; i++)
    {
        getline(cin, str[i]);
//        cout << "Input: " << str[i] << endl;
    }
    str[1] += ' ';


    int num = atoi(str[0].c_str());
//    cout << "Input Number: " << num << endl;

    long* a = new long[num];

    stringstream ss;
//    ss = stringstream(str[1]);
    ss << str[1];

    string buff;
    int n = 0;
    while (getline(ss, buff, ' '))
    {
        if (n >= num) break;

        a[n] = atoi(buff.c_str());
//        cout << "Input Number: " << a[n] << endl;

        n++;
    }


    for (int x = 0; x < num - 1; x++)
    {
        for (int y = 0; y < num - 1 - x; y++)
        {
            if (a[y] > a[y+1])
            {
                swap(a[y], a[y+1]);
            }
        }

//        for (int i = 0; i < num; i++)
//        {
//            cout << "Step " << x << ": " << a[i] << endl;
//        }

    }


    long min = a[0];
    long max = a[num - 1];
    long long sum = 0;
    for (int i = 0; i < num; i++)
    {
        sum += a[i];
//        cout << "Sorted Number: " << a[i] << endl;
    }

    delete [] a;

    cout << min << " " << max << " " << sum << endl;

    return 0;
}



Measured memory_bytes: 3372
#include <iostream>
using namespace std;
int main()
{
   int A,B;
   cin>>A>>B;

        if(A<=12 && A>=6)
        {
            cout<<B/2<<endl;
        }
        else if(A<=5 && A>=0)
        {
            cout<<B*0<<endl;
        }
        else if(A<=100 && A>=13)
        {
            cout<<B<<endl;

        }


    return 0;
}


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

#define _USE_MATH_DEFINES

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <functional>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <iterator>
#include <bitset>
#include <complex>
#include <limits>
#include <random>
#include<fstream>
#include<array>


using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;

const double EPS = 1e-9;

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

	int N;
	cin >> N;

	int ans = 0;

	rep(i, 1, N + 1)
	{
		ans += (N - 1) / i;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <cmath>

int main()
{
  uint64_t N;
  std::cin >> N;
  uint64_t v;
  std::cin >> v;
  for(int i=0; i<4; i++) {
    uint64_t t;
    std::cin >> t;
    v = std::min(v, t);
  }

  uint64_t m = std::ceil(N/double(v)) + 4;
  std::cout << m << std::endl;

  return 0;
}


Measured memory_bytes: 3580
#include <iostream>
#include <cstring>
#include <string>
using namespace std;

int q;
string X, Y;

int dp[1000][1000];

int solve(int idx_x, int idx_y) {
  if (idx_x < 0 || idx_y < 0)
    return 0;

  if (dp[idx_x][idx_y] != -1)
    return dp[idx_x][idx_y];

  int ret;
  
  if (X[idx_x] == Y[idx_y]) {
    ret = solve(idx_x - 1, idx_y - 1) + 1;
  } else {
    ret = solve(idx_x - 1, idx_y);
    ret = max(solve(idx_x, idx_y - 1), ret);
  }
  
  return dp[idx_x][idx_y] = ret;
}

int main(void) {
  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> X >> Y;
    memset(dp, -1, sizeof(dp));
    cout << solve(X.size()-1, Y.size()-1) << endl;
  }
  return 0;
}

Measured memory_bytes: 7188
#C
n, m = map(int, input().split())
probrem = [0] * n
warn = [0] * n
for i in range(m):
    a, b = map(str, input().split())
    a=int(a)
    if probrem[a - 1] == 0 and b == 'AC':
        probrem[a - 1] = 1
    if probrem[a - 1] == 0 and b == "WA":
        warn[a - 1] += 1
# print(probrem,warn)
for i in range(n):
    if probrem[i] == 0:
        warn[i] = 0
print(sum(probrem),sum(warn))

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


int main() {

  int64_t a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;

  //4パターン計算して一番安いものが答え
  //A,Bで買った場合
    int64_t money1 = a*x+b*y;
  //Cで買った場合
    int64_t money2 = max(x,y)*2*c;
  //A,B+Cで買った場合
    int64_t money3 = min(x,y)*2*c;
    if(max(x,y)==x){
      money3+=(x-y)*a;
    }else{
      money3+=(y-x)*b;
    }

  cout<<min(money1,min(money2,money3));

  return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
 class Main{
public static void main(String[] args){
  
  Scanner stdIn = new Scanner(System.in);
  
  int a = stdIn.nextInt();
  int b = stdIn.nextInt();
  	if ( a < 10 && b < 10){
      System.out.println(a*b);
    }else{
      System.out.println(-1);
      
    }
}
 }

Measured memory_bytes: 23764
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
data = [A, B, C, D, E]
h = min(data)
if N % h == 0:
    time = (N // h) + 4
else:
    time = (N // h) + 5

print(time)


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(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 repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    string s;
    cin >> s;
    string t;
    rep(i, sz(s)) {
        if (s[i]!='B') t.pb(s[i]);
        else if (!t.empty()) t.pop_back();
    }
    cout << t << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.rbegin(),a.rend())
#define lb(a,b) lower_bound(a.begin(),a.end(),b)
#define ub(a,b) upper_bound(a.begin(),a.end(),b)
#define MOD ((int)(1e9+7  ))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double
#define sqrt sqrtl
#define cbrt cbrtl
#define endl '\n'
typedef vector<int> vi;
typedef vector<float> vf;
typedef pair<float,int> fi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<fi> vfi;
typedef vector<vi> vvi;
typedef vector<vf> vvf;
typedef vector<vii> vvii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<fi> pqfi;
typedef priority_queue <int, vector<int>, greater<int> > rpqi; 
typedef priority_queue <ii, vector<ii>, greater<ii> > rpqii; 
typedef priority_queue <fi, vector<fi>, greater<fi> > rpqfi;


int32_t main()
{
	IOS
	int n;cin>>n;
	string s;cin>>s;
	if(n&1)
	{
		cout<<"No"<<endl;return 0;
	}
	string r=s.substr(0,n/2);
	if(r+r==s)
	{
		cout<<"Yes"<<endl;return 0;
	}
	cout<<"No"<<endl;return 0;

	
	
	
	
	
}



Measured memory_bytes: 256