akhauriyash/Code-Regression huggingface dataset:
#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;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
} 
void solve()
{
    int n;
    cin >> n;
    vector<int> v;
    for (int i = 2; i * i <= n;i++){
        if(n%i==0){
            int c = 0;
            while(n%i==0){
                n /= i;
                c++;
            }
           
            v.pb(c);
        }       
    }
    if(n>1){
        v.pb(1);
    }
    int ans = 0;
    for (int i = 0; i < v.size();i++){
        int d = v[i];
        int lo = 0, hi = d;
        int cc = 0;
        while(lo<=hi){
            int mid = lo + hi;
            mid /= 2;
            int f = mid * (mid + 1);
            f /= 2;
            if(f<=d){
                cc = mid;
                lo = mid + 1;
            }
            else{
                hi = mid - 1;
            }
        }
        ans += cc;
    }
    cout << ans << endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tc;
    tc = 1;
    // cin >> tc;
    while (tc--)
    {
        solve();
    }

    return 0;
}

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

using namespace std;
int main(int argc, char *argv[]) {
	
	string weather;
	
	cin >>weather;
	
	if (weather == "Sunny") {
		cout << "Cloudy";
	} if (weather == "Cloudy") {
		cout << "Rainy";
	} if (weather == "Rainy") {
		cout << "Sunny";
	}

	return 0;
}

Measured memory_bytes: 256
def main():
    N, Z, W = map(int, input().split())
    A = list(map(int, input().split()))
    if N >= 2:
        print(max(abs(W - A[-1]), abs(A[-2] - A[-1])))
    else:
        print(abs(W - A[-1]))


if __name__ == "__main__":
    main()


Measured memory_bytes: 38768
#include <bits/stdc++.h>
using namespace std; 
int main(){
	int N, K, R, S, P; 
	cin >> N >> K >> R >> S >> P; 
	string T; cin >> T; 
	int dp[100010][3] = {}; 
	for(int i = 0; i < K; i++){
		if(T.at(i) == 'r') dp[i][2] = P; 
		if(T.at(i) == 's') dp[i][0] = R;
		if(T.at(i) == 'p') dp[i][1] = S;
	}
	for(int i = K; i < N; i++){
		if(T.at(i) == 'r'){
			dp[i][0] = max({dp[i][0], dp[i-K][1], dp[i-K][2]}); 
			dp[i][1] = max({dp[i][1], dp[i-K][0], dp[i-K][2]}); 
			dp[i][2] = max({dp[i][2], dp[i-K][0] + P, dp[i-K][1] + P}); 
		}
		if(T.at(i) == 's'){
			dp[i][0] = max({dp[i][0], dp[i-K][1] + R, dp[i-K][2] + R}); 
			dp[i][1] = max({dp[i][1], dp[i-K][0], dp[i-K][2]}); 
			dp[i][2] = max({dp[i][2], dp[i-K][0], dp[i-K][1]}); 
		}
		if(T.at(i) == 'p'){
			dp[i][0] = max({dp[i][0], dp[i-K][1], dp[i-K][2]}); 
			dp[i][1] = max({dp[i][1], dp[i-K][0] + S, dp[i-K][2] + S}); 
			dp[i][2] = max({dp[i][2], dp[i-K][0], dp[i-K][1]}); 
		}
	}
	int ans = 0; 
	for(int i = N - K; i < N; i++){
		ans += max({dp[i][0], dp[i][1], dp[i][2]}); 
	}
	cout << ans << endl; 
}

Measured memory_bytes: 1664
from collections import deque

N = int(input())
K = 0
Ans = [0] * (N-1)
Edge = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    Edge[a].append((b, _))
    Edge[b].append((a, _))

Q = deque()
Q.append((0, 0))
P = [-1] * N
while Q:
    now, color = Q.popleft()
    cnt = 1
    for nex, num in Edge[now]:
        if cnt == color:
            cnt += 1
        if nex == P[now]:
            continue
        if Ans[num] != 0:
            continue
        Q.append((nex, cnt))
        Ans[num] = cnt
        K = max(cnt, K)
        cnt += 1

print(K)
for a in Ans:
    print(a)

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

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

  int l, i = 0, a[n];
  while (cin>>l){
    a[i] = l;
    i ++;
    if(i>=n){
      break;
    }
  }
 
  for (int k = 0; k<n; k++){
    if (k) cout<<' ';
    cout << a[k];
  }
  cout << endl;
   
  for (int i = 1; i<n; i++){
    int v = a[i];
    int j = i - 1;
    while(j>=0 && a[j]>v){
      a[j+1] = a[j];
      j--;
    }
    a[j+1] = v;
    for (int k = 0; k<n; k++){
      if (k) cout<<' ';
      cout << a[k];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3092
from collections import deque

def BFS(x,y):
    dist = 1
    visited = deque()
    visited.append((x,y))
    destination = deque()
    search = [(1,0),(-1,0),(0,1),(0,-1)]
    for (dx,dy) in search:
        if maze[y+dy][x+dx] == ".":
            destination.append((x+dx,y+dy))
    same_dist = len(destination)
    moved = 0
    x = destination[0][0]
    y = destination[0][1]
    while destination:
        visited.append((x,y))
        destination.popleft()
        for (dx,dy) in search:
            if maze[y+dy][x+dx] == ".":
                if (x+dx,y+dy) not in destination and (x+dx,y+dy) not in visited:
                    destination.append((x+dx,y+dy))
        if len(destination) >= 1:
            x = destination[0][0]
            y = destination[0][1]
            moved += 1
            if moved == same_dist:
                dist += 1
                moved = 0
                same_dist = len(destination)
    return dist

H,W = map(int,input().split())
maze = [list("#"*(W+2))] + [list("#" + input() + "#") for i in range(H)] + [list("#"*(W+2))]
ans = 0

for y in range(1,H+1):
    for x in range(1,W+1):
        if maze[y][x] == ".":
            ans = max(ans,BFS(x,y))

print(ans)

Measured memory_bytes: 48604
import java.util.Scanner;

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

	private static final void solve() {
		try (Scanner cin = new Scanner(System.in)) {

			while (cin.hasNext()) {
				int N = cin.nextInt();
				int max = 0;
				int ans = 0;

				for (int i = 1; i <= N; i++) {
					int num = i;
					int count = 0;
					while ((num % 2) == 0) {
						num /= 2;
						count++;
					}
					if (count >= max) {
						max = count;
						ans = i;
					}
				}
				System.out.println(ans);
			}
		} finally {
		}
	}
}


Measured memory_bytes: 20948
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; i--)
#define loop(i, r, n) for (int i = (r); i < (n); i++)
#define pb push_back
#define all(in) in.begin(),in.end()

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; }

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

const ll INF = 1ll<<60;

int main(){
    ll n, k, q; cin >> n >> k >> q;
    vector<ll> a(n); rep(i,n) cin >> a[i];
    vector<ll> b = a; sort(all(b));
    ll ans = INF;
    rep(i,n){
        ll count = 1-k;
        vector<ll> c;
        rep(j,n){
            if(b[i] <= a[j]) count++;
            else{
                if(count >= 1){
                    vector<ll> d;
                    rep(s,count+k-1) d.pb(a[j-s-1]);
                    sort(all(d));
                    rep(s,count) c.pb(d[s]);
                }
                count = 1-k;
            }
        }
        if(count >= 1){
            vector<ll> d;
            rep(s,count+k-1) d.pb(a[n-s-1]);
            sort(all(d));
            rep(s,count) c.pb(d[s]);
        }
        if(c.size() < q) break;
        sort(all(c));
        chmin(ans,c[q-1]-c[0]);
    }
    cout << ans << endl;
}

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

using i64 = int_fast64_t;
using f64 = double;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    string s;
    cin >> s;
    i64 n = s.size();

    i64 ans = 0;
    i64 i = n - 1;
    while (i > 2) {
        if (s[i] != s[i - 1]) ans += 1, i -= 1;
        else ans += 2, i -= 3;
    }

    switch (i) {
    case 0:
        ans += 1;
        break;
    case 1:
        ans += s[0] != s[1] ? 2 : 1;
        break;
    case 2:
        ans += s[0] != s[1] && s[1] != s[2] ? 3 : 2;
        break;
    }

    cout << ans << endl;
}

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


Measured memory_bytes: 720
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();

        if((a+b)%2==0){
            System.out.println((a+b)/2);
        }
        else{
            System.out.println((int)((a+b)/2+1));
        }
    } 
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
	
	int x[3];
	cin >> x[0] >> x[1] >> x[2];
	sort(x, x + 3);
	if (x[0] == 5 && x[1] == 5 && x[2] == 7) { cout << "YES" << endl; }
	else cout << "NO" << endl;
	

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

class Magatro
{
    static string s = Console.ReadLine();
    static void Main()
    {
        int myp = s.Length / 2;
        int aitep = s.Replace("g", "").Length;
        Console.WriteLine(myp - aitep);
    }
   
}




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

int main(void){
    int n;
    cin >> n;
    vector<bool> p(101, true);
    p[0] = false;
    p[1] = false;
    for(int i=2; i<=100; i++){
        if(p[i] == true){
            int m = 2*i;
            while(m <= 100){
                p[m] = false;
                m += i;
            }
        }
    }
    vector<int> prime;
    for(int i=0; i<=100; i++){
        if(p[i]){
            prime.push_back(i);
        }
    }
    vector<int> v(prime.size(), 0);
    for(int i=2; i<=n; i++){
        int m = i;
        while(m > 0){
            int j = 0;
            bool cont = false;
            while(j < prime.size()){
                if(m%prime[j] == 0){
                    v[j]++;
                    m /= prime[j];
                    cont = true;
                    break;
                }
                j++;
            }
            if(!cont){
                break;
            }
        }
    }

    int ans = 0;

    for(int i=0; i<v.size(); i++){
        if(v[i] >= 2){
            int cnt1 = 0, cnt2 = 0;
            for(int j=0; j<v.size(); j++){
                if(v[j] >= 4 && j != i){
                    cnt1++;
                }
                if(v[j] >= 24 && j != i){
                    cnt2++;
                }
            }
            ans += (cnt1*(cnt1-1))/2;
            ans += cnt2;
        }
        if(v[i] >= 4){
            int cnt = 0;
            for(int j=0; j<v.size(); j++){
                if(v[j] >= 14 && j != i){
                    cnt++;
                }
            }
            ans += cnt;
        }
        if(v[i] >= 74){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
map<string,int>memo;//二つの要素を持つものを作る
int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
    string s;
    cin >>s;
    memo[s]+=1;//文字入れカウンター
    }
    int kazu =0;
    for(const auto& x : memo)//memoの要素分やる
    {
        int v =x.second;
        if(v> kazu)kazu=v;

    }
    for(auto it =memo.begin();it!=memo.end();it++){
        if(it->second==kazu){
        cout << it->first << endl;
    }


}
}

Measured memory_bytes: 25216
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{
    public static void Main()
    {
        string S = Console.ReadLine();
        //string S = "";
        //for (int i = 0; i < 100000 / 2; i++) S += "B";
        //for (int i = 100000 / 2; i < 100000; i++) S += "W";
        int Wend = S.Count(c => c == 'W') - 1;
        int Bcount = 0;
        long ans = 0;
        for (int i = 0; i < S.Length; i++)
        {
            if (S[i] == 'W')
            {
                ans += Bcount;
            }
            else
            {
                Bcount++;
            }
        }
        Console.WriteLine(ans);
    }
}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int intRead()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }

}


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

int main()
{
  int a,b,c;
  
  cin>>a>>b>>c;
  int p,q,r;
  
  q=a;
  r=b;
  p=c;
    
    cout<<p<<" "<<q<<" "<<r<<endl;
  
  
  return 0;
}


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

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int T = sc.nextInt();

		boolean flag = false;

		int ans = 10000;

		for(int i=0;i<N;i++) {

			int c = sc.nextInt();

			int t = sc.nextInt();

			if(t<=T && c<ans) {

				ans = c;

				flag = true;
			}
		}

		if(flag == true) System.out.println(ans);

		else System.out.println("TLE");

	}

}


Measured memory_bytes: 20820
object Main extends App {
  val in = new java.util.Scanner(System.in)
  val X, N = in.nextInt
  val Ps = Array.fill(201)(true)
  (1 to N).foreach {_ => Ps(in.nextInt) = false}

  def search(diff: Int): Int = {
    if (Ps(X - diff)) X - diff
    else if (Ps(X + diff)) X + diff
    else search(diff + 1)
  }

  println(search(0))
}

Measured memory_bytes: 55648
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int INF = pow(2,29);
const int MOD = 1000000007;

int main() {
  ll N; cin >> N;
  ll ga, sa, ba; cin >> ga >> sa >> ba;
  ll gb, sb, bb; cin >> gb >> sb >> bb;

  ll r1[N+1] = {};
  rep(i,N+1) {
    r1[i] = i;
    if (i>=ga) r1[i] = max(r1[i], r1[i-ga]+gb);
    if (i>=sa) r1[i] = max(r1[i], r1[i-sa]+sb);
    if (i>=ba) r1[i] = max(r1[i], r1[i-ba]+bb);
  }
  ll r2[r1[N]+1] = {};
  rep(i,r1[N]+1) {
    r2[i] = i;
    if (i>=gb) r2[i] = max(r2[i], r2[i-gb]+ga);
    if (i>=sb) r2[i] = max(r2[i], r2[i-sb]+sa);
    if (i>=bb) r2[i] = max(r2[i], r2[i-bb]+ba);
  }

  // cout << r1[N] << endl;
  cout << r2[r1[N]] << endl;
  return 0;
}


Measured memory_bytes: 195584
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(),a.end()
#define forn(i,n) for(int i=0;i<int(n);i++)
#define forr(i,n) for(int i=int(n-1);i>=0;i--)
#define fora(i,a,b) for(int i=int(a);i<=int(b);i++)
#define forb(i,a,b) for(int i=int(a);i>=int(b);i--)
#define mod 1000000007
using namespace std;
using ll=long long int;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
const int N=1e7;
int m[N];
void f()
{
	int c=0;
	fora(i,1,100)
	{
		fora(j,1,100)
		{
			fora(k,1,100)
			{
				m[i*i+j*j+k*k+i*j+j*k+k*i]++;
			}
		}
	}
}
void solve()
{
	int n;
	cin>>n;
	f();
	fora(i,1,n)
	{
		cout<<m[i]<<endl;
	}
}
int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    int t=1;
  	//cin>>t;
    while(t--)
   	solve();
}


Measured memory_bytes: 3888
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#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 mp make_pair
#define pb push_back

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------



int main() {
  int n, m;
  cin >> n >> m;
  cout << (n-1) * (m-1) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
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; }
ll mod= 1e9 + 7;



int main(){
  int a,b;
  cin >> a >>b;
  cout << a+b/2 << endl;
}


Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<iomanip>

using namespace std;

class edge
{
public:
	int source,target;
	double cost;
	edge(int insource=0,int intarget=0,double incost=0):
	source(insource),target(intarget),cost(incost){}
	bool operator<(const edge &e)const{return cost>e.cost;}
};

class disjointset
{
public:
	vector<int> rank;
	vector<int> p;
	
	void makeset(int x)
	{
		p[x]=x;
		rank[x]=0;
		return;
	}
	disjointset(int s)
	{
		rank.resize(s);
		p.resize(s);
		for(int i=0;i<s;i++)makeset(i);
		return;
	}
	int findset(int x)
	{
		if(x!=p[x])p[x]=findset(p[x]);
		return p[x];
	}
	void link(int x,int y)
	{
		if(rank[x]>rank[y])p[y]=x;
		else
		{
			p[x]=y;
			if(rank[x]==rank[y])rank[y]++;
		}
		return;
	}
	bool same(int x,int y)
	{
		return findset(x)==findset(y);
	}
	void unite(int x,int y)
	{
		link(findset(x),findset(y));
		return;
	}
};

int n;

double kruskal(vector<edge> e)
{
	sort(e.begin(),e.end());
	disjointset d=disjointset(n);
	edge ne;
	double allcost=0.0;
	
	for(int i=0;i<e.size();i++)
	{
		ne=e[i];
		if(!d.same(ne.source,ne.target))
		{
			allcost+=ne.cost;
			d.unite(ne.source,ne.target);
		}
	}
	
	return allcost;
}

double distance(double x1,double y1,double x2,double y2)
{
	return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

int main()
{
	int m;cin>>n>>m;
	double px[10000],py[10000];
	for(int i=0;i<n;i++)
	{
		cin>>px[i]>>py[i];
	}
	vector<edge> e;
	double all=0.0,now;
	int a,b;
	for(int i=0;i<m;i++)
	{
		cin>>a>>b;
		a--;b--;
		now=distance(px[a],py[a],px[b],py[b]);
		e.push_back(edge(a,b,now));
		e.push_back(edge(a,b,now));
		all+=now;
	}
	
	cout<<fixed<<setprecision(3)<<all-kruskal(e)<<endl;
	return 0;
}

Measured memory_bytes: 4856
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main(){
    std::ios::sync_with_stdio(false); cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    int i,mini=0;
    for(i=1;i*i<=m;i++){
    	if(m%i)
    		continue;
    	if(m/i>=n)
    		mini=max(mini,i);
    	if(i>=n){
    		mini=max(mini,m/i);
    	}
    }
    cout<<mini<<endl;
    return 0;   
}



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

int N;
int L[8];
int A, B, C;

int dfs(int k, int a, int b, int c) {
  if (k == N) {
    if (a == 0 || b == 0 || c == 0) return 1e9;
    return abs(a - A) + abs(b - B) + abs(c - C);
  }
  int ans = 1e9;
  ans = min(ans, dfs(k + 1, a + L[k], b, c) + (a > 0 ? 10 : 0));
  ans = min(ans, dfs(k + 1, a, b + L[k], c) + (b > 0 ? 10 : 0));
  ans = min(ans, dfs(k + 1, a, b, c + L[k]) + (c > 0 ? 10 : 0));
  ans = min(ans, dfs(k + 1, a, b, c));
  return ans;
}

int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
}


Measured memory_bytes: 256
<?php
while (true) {
    list($height, $width) = getSpacesByExplodeTrimInput();

    if ($height == 0 && $width == 0) {
        break;
    }
    
    $widthSymbolNum = str_repeat('#', $width).PHP_EOL;
    echo str_repeat($widthSymbolNum, $height).PHP_EOL;
}
   
function getSpacesByExplodeTrimInput()
{
    return explode(' ', trim(fgets(STDIN)));
}

Measured memory_bytes: 15376
// in the name of Allah
// Ya Ali!
#include <bits/stdc++.h>
using namespace std;

typedef long long ll ;
typedef long double ld ;

const ll maxn = 18 ;
const ll INF = 1e18 ;

#define f first
#define s second

ll n , a[maxn][maxn] , dp[(1<<maxn)] , tmp[(1<<maxn)];

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

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

 for(int mask = 0 ; mask < (1<<n) ; mask ++){
    vector<ll> vv ;
    for(int j = 0 ; j < n ; j ++)if(mask&(1<<j))vv.push_back(j) ;

    for(int i = 1 ; i < vv.size() ; i ++)
     for(int j = 0 ; j < i ; j ++)
         tmp[mask] += a[vv[i]][vv[j]] ;
 }

 dp[0] = 0 ;
 for(int mask = 1 ; mask < (1<<n) ; mask ++)
    for(int mask2 = mask ; mask2 > 0 ; mask2 = (mask2-1)&mask)
      dp[mask] = max(dp[mask] , dp[mask^mask2]+tmp[mask2]) ;

 cout << dp[(1<<n)-1] ;

    return 0;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int A, B;
  cin >> A >> B;
  string ans = ":(";
  if (A < 9 && B < 9)
    ans = "Yay!";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

const (
	N = 30
)

func main() {
	sc := newInputScanner(true, 256*1024)
	Q := sc.nextInt()
	sol := &solution{
		sideLength: uint64(math.Pow(3, N)),
	}
	for i := 0; i < Q; i++ {
		fmt.Println(sol.solve(sc.nextUInt64()-1, sc.nextUInt64()-1, sc.nextUInt64()-1, sc.nextUInt64()-1))
	}
}

type solution struct {
	debuggable
	sideLength uint64
}

func (sol *solution) solve(x1, y1, x2, y2 uint64) uint64 {
	sol.debug(func() {
		fmt.Printf("\nsolving %d %d %d %d\n", x1, y1, x2, y2)
	})
	return sol.abs(x1, x2) + sol.abs(y1, y2) + sol.max(sol.getExtra(x1, y1, x2, y2), sol.getExtra(y1, x1, y2, x2))
}

func (sol *solution) abs(m, n uint64) uint64 {
	if m < n {
		return n - m
	} else {
		return m - n
	}
}

func (spl *solution) max(m, n uint64) uint64 {
	if m < n {
		return n
	} else {
		return m
	}
}

func (spl *solution) min(m, n uint64) uint64 {
	if m < n {
		return m
	} else {
		return n
	}
}

func (sol *solution) getExtra(x1, y1, x2, y2 uint64) uint64 {
	s := sol.sideLength
	var blockX1, blockY1, blockX2, blockY2 uint64
	var left, right uint64
	var result uint64 = 0
	for {
		s /= 3
		if s == 0 {
			break
		}
		blockX1, blockX2 = x1/s, x2/s
		if blockX1 != blockX2 {
			break
		}
		if blockX1%3 != 1 {
			continue
		}
		blockY1, blockY2 = y1/s, y2/s
		if sol.abs(blockY1, blockY2) <= 1 {
			continue
		}
		left = s*blockX1 - 1
		right = s * (blockX1 + 1)
		result = sol.max(result, 2*sol.min(sol.min(x1, x2)-left, right-sol.max(x1, x2)))
		sol.debug(func() {
			fmt.Printf("size %d: (%d, %d), (%d, %d); left %d, right %d, result %d\n", s, x1, y1, x2, y2, left, right, result)
		})
	}
	return result
}

type inputScanner struct {
	*bufio.Scanner
}

func newInputScanner(enabledScanWords bool, sizeInKB int) *inputScanner {
	scanner := bufio.NewScanner(os.Stdin)
	if enabledScanWords {
		scanner.Split(bufio.ScanWords)
	}
	capacity := sizeInKB * 1024
	buf := make([]byte, capacity)
	scanner.Buffer(buf, capacity)
	return &inputScanner{
		Scanner: scanner,
	}
}

func (inputSc *inputScanner) nextInt() int {
	i, e := strconv.Atoi(inputSc.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (inputSc *inputScanner) nextUInt64() uint64 {
	i, e := strconv.ParseUint(inputSc.nextStr(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func (inputSc *inputScanner) nextStr() string {
	inputSc.Scan()
	return inputSc.Text()
}

type debuggable struct {
}

const (
	DEBUG_ON = false
)

func (d *debuggable) debug(f func()) {
	if DEBUG_ON {
		f()
	}
}


Measured memory_bytes: 10496
import fractions
def mainFunc():
    N = int(input())
    arr = list(map(int, input().split(" ")))
    if N == 1:
        print(1)
        return
    
    lcmOfArr = lcm(arr[0], arr[1])
    for i in range(2, N):
        lcmOfArr = lcm(lcmOfArr, arr[i])
    
    ans = 0

    for i in range(N):
        ans += lcmOfArr // arr[i]
    
    print(ans % (10 ** 9 + 7))

def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)

mainFunc()

Measured memory_bytes: 6108
H, W = map(int, input().split())
s = ['.' + input() +'.' for _ in range(H)]
s = ['.' * (W + 2)] + s + ['.' * (W + 2)]
flag = True
for h in range(1, H + 1):
    for w in range(1, W + 1):
        if (s[h][w] == '#' and (not '#' in [s[h - 1][w], s[h + 1][w], s[h][w - 1], s[h][w + 1]])):
            flag = False
                
print('Yes' if flag else 'No')


Measured memory_bytes: 3188
a = input().split()
a = [int(i) for i in a]

if a[2] < 1000000000:
    out = [a[2]] * a[1] + [a[2] + 1] * (a[0] - a[1])
else:
    out = [a[2]] * a[1] + [a[2] - 1] * (a[0] - a[1])

out = [str(i) for i in out]
print(" ".join(out))

Measured memory_bytes: 56892
n, x, y = map(int, input().split())

cnt = [0] * n
cycle = y - x + 1

for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        if i < x and j > y:
            cnt[j - y + x - i + 1] += 1
        elif i < x:
            d = min(j - x, y - j + 1)
            cnt[x - i + d] += 1
        elif j > y:
            d = min(y - i, i - x + 1)
            cnt[j - y + d] += 1
        else:
            d = min(j - i, y - j + 1 + i - x)
            cnt[d] += 1

print(*cnt[1:], sep="\n")


Measured memory_bytes: 46300
import java.util.*;
import java.math.*;

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

class Solve{
	Solve(){}
	
	Scanner in = new Scanner(System.in);

	void solve(){
		int n = in.nextInt() - 1, m = in.nextInt();

		int [] d = new int[n + 1];
		d[0] = 0;

		for(int i = 1; i <= n; i++) d[i] = d[i - 1] + in.nextInt();

		int ans = 0, pos = 0;

		for(int i = 0; i < m; i++){
			int k = in.nextInt();
			ans += Math.abs(d[pos] - d[pos + k]);
			ans %= 100000;
			pos += k;
		}

		System.out.println(ans % 100000);
		
	}
	
}

// while(in.hasNext()){
		// 	int n = in.nextInt();
		// 	if(n == 0) return;
			
		// }

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

int main() {
  int n;
  cin >> n;
  string S;
  int SA = 0, SW = 0, ST = 0, SR = 0;
  for (int i = 0; i < n; i++) {
    cin >> S;
    if (S == "AC") SA++;
    if (S == "WA") SW++;
    if (S == "TLE") ST++;
    if (S == "RE") SR++;
  }
  
  cout << "AC x " << SA << endl;
  cout << "WA x " << SW << endl;
  cout << "TLE x " << ST << endl;
  cout << "RE x " << SR << endl;
}

Measured memory_bytes: 3628
//無断転用の一切を禁ずるよ//////////////////////////
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
#define rt "\n"//改行を最速化するよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define cncn int cnt=0
#define please return
#define AC 0
/////////////////////////////////////////////////
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool; 
//////////////////////////////////////////////////
//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　（A＋B）÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}


int main(void) {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	Yes((abs(a - b) <= d && abs(b - c) <= d) || abs(a - c) <= d);
	please AC;
}

// abc : 141 , aoj : ITP1_6_D
//sort, abs, swap, reverse, max, min
//__gcd, sbstring, erase, push_back,stoll、stoi

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ci cin >>
#define co cout <<

int main() {
	bool b =true;
	int A, B;
	ci A >> B;
	if (A > 8 || B > 8)b = false;
	if (b)co "Yay!";
	else co ":(";

}

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

int main(){

  string str;
  int cnt, len;

  cnt = 0;
  while(cin >> str){
    len = str.length() - 1;
    for(int i=0; i<=len; i++, len--){
      if(str[i] != str[len]) break;
      if(i == len || i == len-1) cnt++;
    }
  }
  
  cout << cnt << endl;

  return 0;

}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
#define mod 1000000007
#define ull unsigned ll
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi acos(-1)
#define nui 100
#define INF 100000000000
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define F(i,a,n) for(ll i=a;i<n;i++)
#define B(i,a,n) for(ll i=n-1;i>=a;i--)
#define tc int t;cin>>t;while(t--)
#define tcf int t;cin>>t;for(int w=1;w<=t;w++)
#define pfn cout<<"-1\n"
#define pfp cout<<"1\n";



using namespace std;


ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res *= a;
        }
        a *= a;
        b >>= 1;
    }
    return res;
}

ll fermat_inv(ll y) {return binpow(y, mod - 2);}



int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);



    /*ll n, x;
    cin >> n >> x;
    ll a[n];
    F(i, 0, n)
    {
        cin >> a[i];
    }
    ll ans = 0;
    F(i, 0, n)
    {
        if (i - 1 >= 0)
        {
            if (a[i] + a[i - 1] > x)
            {
                if (a[i] >= a[i - 1])
                {
                    ans += a[i] + a[i - 1] - x;
                    a[i] -= a[i] + a[i - 1] - x;

                }
                else
                {
                    ans += a[i] + a[i - 1] - x;
                    a[i] -= a[i] + a[i - 1] - x;

                }
            }
        }
        if (i + 1 < n)
        {
            if (a[i] + a[i + 1] > x)
            {
                if (a[i] > a[i + 1])
                {
                    ans += a[i] + a[i + 1] - x;
                    a[i+1] -= a[i] + a[i + 1] - x;

                }
                else if (a[i] == a[i + 1])
                {
                    ans += a[i] + a[i + 1] - x;
                    a[i + 1] -= a[i] + a[i + 1] - x;
                }
                else
                {
                    ans += a[i + 1] + a[i] - x;
                    a[i + 1] -= a[i] + a[i + 1] - x;

                }
            }
        }
    }
    cout << ans << "\n";*/
    ll n, a, b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    ll passed = 0;
    ll orank = 1;
    F(i, 0, s.size())
    {
        if (s[i] == 'c')
        {
            cout << "No\n";
        }
        else if (s[i] == 'a')
        {
            if (passed < a + b)
            {
                cout << "Yes\n";
                passed++;
            }
            else
            {
                cout << "No\n";
            }
        }
        else
        {
            if (passed < a + b && orank <= b)
            {
                orank++;
                passed++;
                cout << "Yes\n";
            }
            else
            {
                cout << "No\n";
            }
        }

    }

    return 0;

}

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

int main(){
  string s;
  cin >> s;
  int num=0;
  for(int i=0;i<4;i++){
    if(s[i]=='+'){
      num++;
    }else{
      num--;
    }
  }
  cout << num << endl;
  return 0;
}


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

int main(){
    string s;  cin >> s;
    string S;
    int n = s.length();
    for(int i=0; i<n; i++){
        if(s[i]=='A') S += "A";
        else if(i+1<n && s[i]=='B' && s[i+1]=='C'){
            S += "X";
            i++;
        }else{
            S += s.substr(i,1);
        }
    }
    int N = S.length();
    vector<int> cnt(N+1,0);
    for(int i=N-1; i>=0; i--){
        if(S[i]=='A'){
            cnt[i] = cnt[i+1];
        }else if(S[i]== 'X'){
            cnt[i] = cnt[i+1] + 1;
        }else{
            cnt[i] = 0;
        }
    }

    ll ans = 0;
    for(int i=0; i<N; i++){
        if(S[i]=='A') ans += cnt[i];
    }
    cout << ans << endl;
}



Measured memory_bytes: 1544
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
 
using namespace std;
 
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
 
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
 
 
 
 
long long gcd(long long x, long long y) {
  return x % y ? gcd(y, x % y) : y;
}
 
int main() {
  int n;
  long long m;
  cin >> n >> m;
  long long g = 1;
  long long a[n];
  set<int> st;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    a[i] /= 2;
    long long b = a[i];
    int cnt = 0;
    while (b % 2 == 0) {
      b /= 2;
      ++cnt;
    }
    st.insert(cnt);
  }
  if (st.size() > 1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    g = g / gcd(g, a[i]) * a[i];
    if (g > m) {
      cout << 0 << endl;
      return 0;
    }
  }
  cout << m/g - m/g/2 << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main (void){

    int N,i;
    int x;
    char c;
    int count=0;


    scanf("%d",&N);
    scanf("%c",&c);

    for(i=1;i<=N;i++){

        scanf("%d",&x);
        scanf("%c",&c);

        //printf("block:%d get %d\n",i+1,x[i]);
        if(i%2==0){
            continue;
        }

        if(x%2==0){
            continue;
        }

        count++;

    }


    printf("%d",count);

    return 0 ;

}

Measured memory_bytes: 1732
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll x;
    cin>>x;
    ll y = ceil( (-1+sqrt(8.0*x-3))/2.0 );

    
    std::cout << y << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
vi a;

int main(){
	cin>>n;
	int S=1<<n;
	a=vi(S);
	for(int i=0;i<S;i++) cin>>a[S-i-1];
	vvi b(S,vi(2));
	for(int i=0;i<S;i++) b[i][0]=a[i];
	for(int i=0;i<n;i++){
		for(int j=0;j<S;j++) if(!(j&1<<i)){
			int I=j|1<<i;
			int d[4]={b[j][0],b[j][1],b[I][0],b[I][1]};
			sort(d,d+4);
			b[j][0]=d[2],b[j][1]=d[3];
		}
	}
	int res=0;
	for(int i=S-2;i>=0;i--){
		res=max(res,b[i][0]+b[i][1]);
		cout<<res<<endl;
	}
}

Measured memory_bytes: 18432
#include <bits/stdc++.h>
using namespace std;
int n,i,a;
int main(){
  for(cin>>n;i<n+1;i++){
    a=n-i*100;
    if(0<=a&&a<=5*i)return cout<<1,0;
    if(a<0)break;
  }
  cout<<0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N, W; cin >> N >> W;
    vector<long long> dp(W+1);

    for (int i = 0; i < N; i++) {
        int w, v;
        cin >> w >> v;
        for (int j = W; j >= w; j--) {
            dp[j] = max(dp[j-w] + v, dp[j]);
        }
        //for (int k = 0; k <= N; k++)
    }

    long long ans = 0;
    for (int i = 0; i <= W; i++) {
        ans = max(dp[i], ans);
    }
    cout << ans;
    return 0;
}

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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 200005;
bool isPrime[MAXN];
vector<int> pr;
vector<int> ans;
void sieve()
{
    memset(isPrime, 1, sizeof isPrime);
    isPrime[0] = isPrime[1] = 0;

    for (int i = 2; i * i <= MAXN; i += 1 + (i & 1))
    {
        if (isPrime[i])
        {

            for (int j = i * i; j < MAXN; j += i)
                isPrime[j] = 0;
        }
    }
    for(int i=0; i<MAXN; i++)
    {
        if(isPrime[i])
        {

            ans.push_back(i);
        }
    }
}

ld power(ld x, ll y)
{
    ll temp;
    if (y == 0)
        return 1;
    temp = power(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
        return x * temp * temp;
}

void debug_out()
{
    cerr << endl;
}

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

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
int main()
{
    FAST
    int n;
    cin>>n;
    if(n%1000==0)
        cout<<0<<endl;
    else
   cout<<1000-n%1000<<endl;
    return 0;
}


Measured memory_bytes: 3664
#include <cstdio>
#include <unordered_map>
#define rr register
using namespace std;
const int mod=1e9+7;
unordered_map<long long,int>dp; long long n;
inline signed modd(int x1,int x2,int x3){
    rr int ans=x1+x2>=mod?x1+x2-mod:x1+x2;
    return ans+x3>=mod?ans+x3-mod:ans+x3;
}
inline signed dfs(long long n){
    if (dp[n]) return dp[n];
    else return dp[n]=modd(dfs(n>>1),dfs((n-1)>>1),dfs((n-2)>>1));
}
signed main(){
    dp[dp[0]=1]=2; scanf("%lld",&n);
    return !printf("%d\n",dfs(n));
}

Measured memory_bytes: 3244
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(A: int, B: int, C: int):
    if(A <= C <= B or A >= C >= B):
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

int main() {
	int n;
	cin >> n;
	vector<double> p(n);
	REP(i, n) { cin >> p[i]; }
	vector<vector<double>> dp(n, vector<double>(n + 1, 0));
	REP(i, n) {
		REP(j, n + 1) {
			if(i + 1 < j) {
				break;
			}
			if(i == 0) {
				dp[0][j] = j == 0 ? 1 - p[i] : p[i];
				continue;
			}
			if(j == 0) {
				dp[i][0] = dp[i - 1][0] * (1 - p[i]);
			}
			dp[i][j] = (dp[i - 1][j] * (1 - p[i])) + (dp[i - 1][j - 1] * p[i]);
		}
	}
	double result = 0;
	RANGE(i, (n + 1) / 2, n + 1) { result += dp[n - 1][i]; }
	cout << std::fixed << std::setprecision(15) << result << endl;
	return 0;
}


Measured memory_bytes: 73768
#include <bits/stdc++.h>
#include <map>
#include <cmath>
#include <array>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include <iostream>
#include <ctype.h>
#include <string>

typedef long long ll;
using namespace std;



int main(){
  string st;
  int n,m;
  cin>>n>>st;
  m=st.size();
  if(m<=n) cout<<st;
  else{
    rep(i,n)
      cout<<st[i];
    cout<<"...";
  }
  
}

Measured memory_bytes: 3628
n = int(input())
ans = {}
for _ in range(n):
    a = int(input())
    if a in ans.keys():
        ans[a] += 1
    else:
        ans[a] = 1
x = 0
for i in ans.values():
    if i % 2 == 0:
        pass
    else:
        x += 1
print(x)

Measured memory_bytes: 15072
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main(){
  int A, B;
  cin >> A >> B;
  if(A <= 9 && B <= 9){
    cout << A * B << endl;
  }
  else{
    cout << -1 << endl;
  }
}

Measured memory_bytes: 256
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
# endregion
print(sum(sorted(ri_())[:2]))

Measured memory_bytes: 62956
#include <bits/stdc++.h>
#define CFS           \
    cin.tie(nullptr); \
    ios::sync_with_stdio(false);
#define CST(x) cout << fixed << setprecision(x);
using namespace std;
constexpr int IINF = numeric_limits<int>::max();
constexpr long LINF = numeric_limits<long>::max();
constexpr int MOD = (int)1e9 + 7;
// constexpr int MOD = 998244353;

struct Query {
    int a;
    int b;
    int c;
    int d;
};

int main()
{
    int n, m, q;
    cin >> n >> m >> q;
    vector<Query> qv;
    for (size_t i = 0; i < q; i++) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        qv.push_back({ a - 1, b - 1, c, d });
    }
    vector<int> u(n, 1);

    int max_v = 0;
    auto dfs = [&](auto&& dfs, int depth) -> void {
        if (depth == u.size()) {
            int ans = 0;
            for (size_t i = 0; i < q; i++) {
                if (u[qv[i].b] - u[qv[i].a] == qv[i].c) {
                    ans += qv[i].d;
                }
            }
            max_v = max(max_v, ans);
        } else {
            size_t init = depth == 0 ? 1 : u[depth - 1];
                for (size_t i = init; i <= m; i++) {
                    u[depth] = i;
                    dfs(dfs, depth + 1);
                }
        }
    };
    dfs(dfs, 0);
    cout << max_v << "\n";
}

Measured memory_bytes: 3612
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a) = min((a), (b)))
#define chmax(a, b) ((a) = max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = acos(-1);
const double eps = 1e-10;

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

int main(){
	int n; cin>>n;
	vector<int> p(n);
	for(int i=0; i<n; i++) cin>>p[i];

	int ans = 1;
	for(int i=1; i<=100; i++){
		int cnt = 0;
		for(int j=0; j<n; j++){
			if(i <= p[j]) cnt++;
		}

		if(i <= cnt) ans = i;
	}

	cout << ans << endl;
}


Measured memory_bytes: 3100