akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1145141919364364
#define double long double
using namespace std;
typedef pair<ll, ll>P;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll a[114];
ll dp[114];
signed main() {
	ll n, x, ans = 0;
	cin >> n >> x;
	rep(i, n)cin >> a[i];
	dp[0] = 0;
	rep(i, n) {
		dp[i + 1] = dp[i] + a[i];
	}
	rep(i, n + 1) {
		if (dp[i] <= x)ans++;
	}
	cout << ans << endl;
	ggr
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) { a = b; return true;}
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) { a = b; return true;}
    return false;
}
int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    vector<pair<int, int>> res;
    int resn = n;
    if (n % 2 == 1){
        repr(i,1,n) {
            res.emplace_back(n, i);
        }
    } else {
        resn++;
    }
    repr(i,1,resn) {
        repr(j,i+1,resn) {
            if (i+j != resn) {
                res.emplace_back(i, j);
            }
        }
    }
    cout << res.size() << endl;
    for(auto x: res) {
        cout << x.first << " " << x.second << endl;
    }
    return 0;
}


Measured memory_bytes: 384
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0):
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

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

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    ans = min(a,b)
    ans += min(c,d)
    print(ans)
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 38636
#include<cstdio>
#define MAXN 800010
using namespace std;
int n;
long long k;
int tel[MAXN],seq[MAXN];
bool vis[MAXN];
int lastpos[MAXN];
int loopseq[MAXN];
int s;

int check(int head,int tail){
	int ring = tail - head - 1;
	int to = seq[tail];
	for(int i = 0;i < ring;i++){
		to = tel[to];
		if(to != seq[head + i + 1])return -1;
	}
	s = head; 
	for(int i = head;i < tail;i++){
		loopseq[i - head + 1] = seq[i];
	}
	return ring + 1;
}
int main()
{
	scanf("%d%lld",&n,&k);
	for(int i = 1;i<=n;i++)
		scanf("%d",&tel[i]);
	
	int mod = 0;	
	int loop = 0;
	int i = 1;
	bool flag = 0;
	while(1){
		seq[++loop]=i;
		if(k+1 == loop){
			flag = 1;
			break;
		}
		if(vis[i]){
			mod = check(lastpos[i], loop);
			if(mod != -1)break; 
		}
		vis[i] = 1;
		lastpos[i] = loop;
		i = tel[i];
	}
	
	if(flag)return !printf("%d",seq[loop]);
	if(k+1 < s)return !printf("%d",seq[k]);
	int pos = ((k-s+2) % mod == 0) ? mod : ((k-s+2) % mod);
	return !printf("%d",loopseq[pos]);
}

Measured memory_bytes: 4468
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
// sort(a.begin(), a.end(), std::greater<int>());

/*
std::vector<std::string> split(const std::string &input, char delimiter)
{
    std::istringstream stream(input);

    std::string field;
    std::vector<std::string> result;
    while (std::getline(stream, field, delimiter))
    {
        result.push_back(field);
    }
    return result;
}
*/

#define num 10
int main()
{
    rep(i,3){
        string a;
        cin>>a;
        cout<<a[i];
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  int N; cin >> N;
  int count = 0;
  stringstream ss;
  for (int i=1; i<=N;i++) {
 	ss.str("");
    ss << i;
    if (ss.str().size()%2 == 1) count++; 
  }
  cout << count << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.lang.Math.*;

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

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int H = scanner.nextInt();
        int W = scanner.nextInt();

        List<String> list = new ArrayList<>();
        for (int i = 0; i < H; i++) {
            list.add(scanner.next());
        }

        for (int i = 0; i < H+2; i++) {
            if (i == 0 || i == H+1) {
                for (int j = 0; j < W + 2; j++) {
                    System.out.print("#");
                }
                System.out.println("");
            } else {
                System.out.print("#");
                System.out.print(list.get(i-1));
                System.out.print("#");
                System.out.println("");
            }
        }
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";

        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {
                    line = br.readLine();
                }
                s = line.split(reg, 0);
                i = 0;
                return s[i++];
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public int nextInt() {
            try {
                return Integer.parseInt(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }

        public double nextDouble() {
            try {
                return Double.parseDouble(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }

        public long nextLong()  {
            try {
                return Long.parseLong(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }
    }
}


Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> d(n);
    for(int i = 0; i < m; i++){
        int a,b;
        cin >> a >> b;
        a--;b--;
        d[a]++;
        d[b]++;
    }   
    bool flag = true; 
    for(int i = 0; i < n; i++){
        if(d[i]%2 == 1) flag = false;
    }
    if(flag) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 640
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    K = int(readline())

    print(A[K-1])



if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  for(int i=0; i<n; ++i) cin >> p[i];
  sort(p.begin(), p.end());
  int sum = 0;
  for(int i=0; i<k; ++i){
    sum += p[i];
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  
  cin >> D;
  
  A = D / 100;
  B = D / 10 % 2;
  C = D % 2;
//  int Q = A + B + C;
 
  cout << A + B + C << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main(void) {
    int i, N;
    int d1, d2;
    int counter = 0;
    
    std::cin >> N;
    
    for(i = 1; i <= N; i++) {
        std::cin >> d1 >> d2;
        if(d1 == d2) {
            counter += 1;
            if(counter>=3) {
                break;
            }
        } else {
            counter = 0;
        }
    }
    
    if(counter>=3) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
    
    return 0;
}



Measured memory_bytes: 3580
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
int P[500010];
struct segtree{
	int A[2000010],tag[2000010];
#define mid ((l+r)>>1)
	void Upd(int x,int o){tag[x]=A[x]=o;}
	void down(int x){if(tag[x])Upd(x<<1,tag[x]),Upd(x<<1|1,tag[x]),tag[x]=0;}
	void update(int x,int l,int r,int L,int R,int d){
		if(L<=l&&r<=R)return Upd(x,d);
		down(x);
		if(L<=mid)update(x<<1,l,mid,L,R,d);
		if(mid<R)update(x<<1|1,mid+1,r,L,R,d);
	}
	int query(int x,int l,int r,int p){
		if(l==r)return A[x];
		down(x);
		if(p<=mid)return query(x<<1,l,mid,p);
		else return query(x<<1|1,mid+1,r,p);
	}
#undef mid
}A,B;
int fir[500010],dis[1000010],nxt[1000010],id,in[500010];
void link(int a,int b){++in[b];nxt[++id]=fir[a],fir[a]=id,dis[id]=b;}
int p[500010],tpn[500010];
struct cmp{bool operator()(int a,int b){return P[a]>P[b];}};
std::priority_queue<int,std::vector<int>,cmp>que;
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi(),K=gi()-1;
	for(int i=1;i<=n;++i)P[gi()]=i;
	for(int i=n,_;i;--i){
		if(_=A.query(1,1,n,P[i]))link(i,_);
		if(_=B.query(1,1,n,P[i]))link(i,_);
		A.update(1,1,n,P[i],std::min(n,P[i]+K),i);
		B.update(1,1,n,std::max(1,P[i]-K),P[i],i);
	}
	for(int i=1;i<=n;++i)if(!in[i])que.push(i);
	for(int _=1,x;_<=n;++_){
		tpn[_]=P[x=que.top()];que.pop();
		for(int i=fir[x];i;i=nxt[i])if(!--in[dis[i]])que.push(dis[i]);
	}
	for(int i=1;i<=n;++i)p[tpn[i]]=i;
	for(int i=1;i<=n;++i)printf("%d\n",p[i]);
	return 0;
}


Measured memory_bytes: 46964
#include <bits/stdc++.h> 
#define pb push_back
#define ll long long int
#define M 1000000007
#define rep(i,n) for(int i=1;i<=n;i++)
#define mp(a,b) make_pair(a,b)
#define gcd(a,b)    __gcd(a,b)
#define lcm(a,b) ((a)*((b)/gcd(a,b)))
using namespace std;
const int MAX=2000004;
int p,q,r,x,y,z,n,m,c=0,sum=0,len,cnt=0;
int a[MAX],b[MAX]; string s;
void input()
{
cin>>s;
}
void solve()
{
//sort(s.begin(),s.end());
if((s[0]==s[1] and s[1]==s[2]) or (s[1]==s[2] and s[2]==s[3]))puts("Yes");
else puts("No");
}
void output()
{

}
int main()
{
	input();
	solve();
	output();
	return 0;
}


Measured memory_bytes: 384
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.container, std.math, std.typecons;

immutable int mod = 10^^9 + 7;
immutable int inf = 20000;

long s;

void main() {
    s = readln.chomp.to!long;
    solve(s).writeln;
}

string solve(long s) {
    long top = s, btm = 0, mid;

    while (top - btm > 1) {
        mid = btm + (top - btm) / 2;

        if (calc(mid) < s) {
            btm = mid;
        }
        else {
            top = mid;
        }
    }

    debug {
        writeln("btm:", btm);
    }

    int dif = cast(int)(s - calc(btm) - 1);

    string ans;
    long i = btm + 1;

    while (ans.length < 20 + dif) {
        if (i % 15 == 0) ans ~= "FizzBuzz";
        else if (i % 3 == 0) ans ~= "Fizz";
        else if (i % 5 == 0) ans ~= "Buzz";
        else ans ~= i.to!string;
        i++;
    }

    ans = ans.drop(dif).to!string;
    ans = ans[0 .. 20];

    return ans;
}

unittest {
    assert(solve(1) == "12Fizz4BuzzFizz78Fiz");
    assert(solve(20) == "zzBuzz11Fizz1314Fizz");

    //stderr.writeln(solve(10000000000));
    assert(solve(10000000000) == "93FizzBuzz1418650796");
}

long calc(long n) {
    if (n == 0) return 0L;

    static long[] nonfz = new long[](21);
    static bool fc = true;

    if (fc) {
        foreach (i ; 1 .. 21) {
            nonfz[i] = countnonfz(10L^^i - 1) - countnonfz(10L^^(i - 1));
            if (i == 1) nonfz[i]++;
        }

        debug {
            writeln("nonfz:", nonfz);
        }

        fc = false;
    }

    long res = (n / 3 + n / 5) * 4;

    int keta = calcdig(n);

    foreach (i ; 1 .. keta) {
        res += nonfz[i] * i;
    }

    res += (countnonfz(n) - countnonfz(10L^^(keta - 1) - 1)) * keta;
    return res;
}

unittest {
    assert(calc(4) == 7);
    assert(calc(10) == 25);
    assert(calc(2) == 2);
    assert(calc(100) == 313);
    assert(calc(1000) == 3673);
    assert(calc(983) == 3609);
}

int calcdig(long n) {
    return n > 0 ? calcdig(n / 10) + 1 : 0;
}

unittest {
    assert(calcdig(8) == 1);
    assert(calcdig(132) == 3);
    assert(calcdig(101010101010) == 12);
}

long countnonfz(long n) {
    return n - n / 3 - n / 5 + n / 15;
}

unittest {
    assert(countnonfz(10) == 5);
    assert(countnonfz(3) == 2);
    assert(countnonfz(100) == 53);
}

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

string S; int dp[500009][27], nex[500009][22];

int main() {
	cin >> S;
	for (int i = 0; i <= S.size(); i++) {
		for (int j = 0; j < 27; j++) dp[i][j] = (1 << 30);
	}
	for (int i = S.size() - 1; i >= 0; i--) {
		int A = S[i] - 'a';
		for (int j = 0; j <= 26; j++) {
			if (j == A) dp[i][j] = i + 1;
			if (j > A) {
				int cx = i + 1;
				for (int k = A; k < j; k++) {
					if (dp[cx][k] == (1 << 30)) { cx = (1 << 30); break; }
					cx = dp[cx][k];
				}
				dp[i][j] = cx;
			}
			if (j < A) {
				int cx = i + 1;
				for (int k = A; k < 26; k++) {
					if (dp[cx][k] == (1 << 30)) { cx = (1 << 30); break; }
					cx = dp[cx][k];
				}
				if (cx == (1 << 30)) continue;
				dp[i][j] = dp[cx][j];
			}
		}
	}
	for (int i = 0; i <= S.size(); i++) { for (int j = 0; j <= 20; j++) nex[i][j] = (1 << 30); }
	for (int i = 0; i < S.size(); i++) nex[i][0] = dp[i][26];
	for (int i = 0; i < 20; i++) {
		for (int j = 0; j < S.size(); j++) {
			if (nex[j][i] == (1 << 30)) continue;
			nex[j][i + 1] = nex[nex[j][i]][i];
		}
	}
	int Q; cin >> Q;
	for (int i = 1; i <= Q; i++) {
		int L, R; cin >> L >> R; L--; R--;
		int cx = L;
		for (int j = 20; j >= 0; j--) {
			if (nex[cx][j] <= R + 1) cx = nex[cx][j];
		}
		if (cx == R + 1) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

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

///////////////////////////////////////////
const long long int INF = 1000000000000000000LL;
using ll = long long int;
using vi = vector<int>;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return 1; } return 0; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return 1; } return 0; }
template<class T>T sqar(T x){ return x*x; }
///////////////////////////////////////////

ll ans = 0;

int bekijyou(int x,int y){//x^y
    ll r=1;
    for(int i=0;i<y;i++){
        r*=x;
    }
    return r;
}

void query(int x){
    if(x==1){
        ans =1;
    }else {
        for (int i = 2; i <= (int) sqrt(x); i++) {
            for (int j = 2; bekijyou(i,j) <= x; j++) {
                ans = max(ans,bekijyou(i, j));
               // cout<<i<<" "<<j<<endl;
            }
        }
    }
}

int main(){
    ll a;
    cin>>a;
   // cout<<(int )sqrt(a)<<endl;
  //  cout<<bekijyou(2,3)<<endl;
    query(a);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		if(s.length() < t.length()) {
			System.out.println("UNRESTORABLE");
			return;
		}
		String ans = "";
		for(int i = s.length() - t.length() ; i >= 0 ; i--) {
			String temp = s.substring(i, i + t.length());
			boolean ok = true;
			for(int j = 0 ; j < temp.length() ; j++) {
				if(temp.charAt(j) != t.charAt(j) && temp.charAt(j) != '?') ok = false;
			}
			if(ok) {
				ans += s.substring(0, i) + t + s.substring(i + t.length());
				break;
			}
		}
		if(ans.equals("")) {
			System.out.println("UNRESTORABLE");
		}
		System.out.println(ans.replaceAll("\\?", "a"));
	}
}

Measured memory_bytes: 21844
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        
        int x = stdIn.nextInt();
        int y = stdIn.nextInt();
        
        //String s = stdIn.next();
        boolean flag = false;
        
        for(int i = 0; i <= x; i++){
            if(i * 4 + (x - i) * 2 == y){
                flag = true;
                break;
            }
        }
        
        if(x == 0 && y == 0){
            flag = true;
        }
        
        if(flag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
    }
}


Measured memory_bytes: 35848
import sys
from collections import Counter
def input():
    return sys.stdin.readline()[:-1]
def main():
    N = int(input())
    A = list(map(int,input().split()))
    D = [0]*100001
    for e in A:
        D[e] += 1
    Q = int(input())
    ans = sum(A)
    for _ in range(Q):
        B, C = map(int,input().split())
        if D[B] > 0:
            t = D[B]
            D[B] = 0
            D[C] += t
            ans += (C-B)*t
        print(ans)
if __name__ == '__main__':
    main()


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

vector<int> G[100005];
bool used[100005];
int dp[100005];
vector<int> topo;

void tpsort(int v){
    used[v]=true;
    for(int i=0;i<G[v].size();i++){
        if(!used[G[v][i]]) tpsort(G[v][i]);
    }
    topo.push_back(v);
}


int main(){
    int n,m;
    cin>>n>>m;
    int x,y;
    for(int i=0;i<m;i++){
        cin>>x>>y;
        G[x].push_back(y);
    }

    for(int i=1;i<=n;i++){
        if(!used[i]) tpsort(i);
    }
    reverse(topo.begin(),topo.end());
    
    for(int i=0;i<topo.size();i++){
        int v=topo[i];
        for(int j=0;j<G[v].size();j++){
            dp[G[v][j]]=max(dp[G[v][j]],dp[v]+1);
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        ans=max(ans,dp[i]);
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 8056
#include <iostream>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;

int N;

int digit(char c) {
  if(c == 'm') return 1000;
  if(c == 'c') return 100;
  if(c == 'x') return 10;
  return 1;
}

char undigit(int k) {
  if(k == 1000) return 'm';
  if(k == 100) return 'c';
  if(k == 10) return 'x';
  return 'i';
}

int decode(string s) {
  int d = 0;
  REP(i, 0, s.length()) {
    if('2' <= s[i] && s[i] <= '9') {
      // cout << "2:  " << s[i] << s[i + 1] << endl;
      d += (s[i] - '0') * digit(s[i + 1]);
      i++;
    } else {
      // cout << "1:  " << s[i] << endl;
      d += digit(s[i]);
    }
  }
  // cout << d << endl;
  return d;
}

string encode(int d) {
  string s;
  int k = 1000;
  REP(i, 0, 4) {
    int p = d / k;
    if(2 <= p && p <= 9) {
      char c = p + '0';
      s = s + c;
      s = s + undigit(k);
    } else if(p == 1) {
      s = s + undigit(k);
    }
    d -= p * k;
    k /= 10;
  }
  return s;
}

int main(void) {
  cin >> N;
  REP(i, 0, N) {
    string S1, S2;
    cin >> S1 >> S2;
    cout << encode(decode(S1) + decode(S2)) << endl;
  }

  return 0;
}

Measured memory_bytes: 3024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
int MOD = 1e9+7;

int main(){
    int n;
    cin >> n;
    map<int, int> mp;
    ll ans = 1;
    for (int i=2; i<=n; i++) {
        int tmp = i, d = 2;
        while(tmp!=1 || d <= tmp) {
            if (tmp%d==0) {
                tmp /= d;
                mp[d]++;
                d = 2;
            } else {
                d++;
            }
        }
    }
    for (auto p: mp) {
        ans *= p.second+1;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
bool fanc(int n){
  int tmp;
  for(int i =0 ; i <3;i++){
    tmp = n %10;
    if(tmp == 7){
      return true;
    }
    n = (n-tmp)/10;
  }
  return false;
}
int main(){
  int n ;
  cin >> n;
  if(fanc(n)){
    printf("Yes");
  }
  else{
    printf("No");
  }
  return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int A,B;
  cin >> A >> B;
  for(int i=1;i<4;i++)
  {
    if(i!=A&&i!=B)
    {
      cout << i << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 384
package main

import "fmt"

func main() {
	var n, y int
	fmt.Scan(&n, &y)
	for m := 0; m <= n; m++ {
		for g := 0; g <= n; g++ {
			k := y - m*10000 - g*5000
			if k < 0 {
				continue
			}
			s := k / 1000
			if m+g+s == n {
				fmt.Printf("%d %d %d\n", m, g, s)
				return
			}
		}
	}
	fmt.Println("-1 -1 -1")
}

func d(a, b int) int {
	v := a - b
	if v < 0 {
		return -v
	}
	return v
}


Measured memory_bytes: 512
N=int(input())
AB=[list(map(int,input().split())) for i in range(N)]

AB.sort(key=lambda x:x[1])
t=0
for ab in AB:
  a=ab[0]
  b=ab[1]
  t+=a
  if b<t:
    print("No");exit()
print("Yes")

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

long long int ncr[3001][1001];
int main()
{
    long long int s;
    cin >> s;
    long long int mod = 1e9 + 7;
    ncr[0][0]=1;
    for (int j = 0; j < 1001; j++)
    {
        for (int i = 1; i < 3001; i++)
        {
            if (i < j)
                continue;
            else if (i == j)
                ncr[i][j] = 1;
            else if (j == 0)
            {
                ncr[i][j] = 1;
            }
            else if (j == 1)
            {
                ncr[i][j] = i;
            }
            else
            {   
                ncr[i][j] = (ncr[i-1][j] + ncr[i - 1][j - 1]) % mod;
                // cout<<ncr[i][j]<<" ";
            }
        }
        // cout<<endl;
    }
    int m = s / 3;
    long long int ans = 0;
    for (int i = 1; i <= m; i++)
    {
        ans = (ans + ncr[s - 3 * i + i - 1][i - 1]) % mod;
    }
    cout << (ans + mod) % mod << endl;
}

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

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

  int sum = 0;

  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;

    if (x <= k / 2) {
      sum += 2 * x;
    } else {
      sum += 2 * (k - x);
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n = int(input())
A = list(map(int, input().split()))
L = [(a, i) for i, a in enumerate(A)]
L.sort(reverse=True)
dp = [[-1]*n for _ in range(n)]
def dfs(l, r):
    i = (n-1-r) + l
    a, idx = L[i]
    if i == n-1:
        res = max(idx-l, r-idx) * a
        return res
    if dp[l][r] != -1:
        return dp[l][r]
    res = max((idx-l)*a + dfs(l+1, r), (r-idx)*a + dfs(l, r-1))
    dp[l][r] = res
    return res
ans = dfs(0, n-1)
print(ans)

Measured memory_bytes: 228028
#include<bits/stdc++.h> 
using namespace std; 
  
int main() 
{
    int n, x, y;
    cin >> n >> x;
    int pos = 0;
    int sol = 1;
    for(int i = 1; i <= n; i++) {
        cin >> y;
        pos += y;
        if(pos <= x) {
            sol++;
        }
    }
    cout << sol;
    return 0;
} 


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

int main() {
	ll h, w;
	cin >> h >> w;
	if (h == 1 || w == 1) {
		cout << 1;
		return 0;
	}
	ll a,b,c,x;
	a = double(double(h) / 2) + 0.6;
	b =double(double(w) / 2) + 0.6;
	x = a * b;
	if (h % 2 == 0) {
		c = a;
	}
	else {
		c = a - 1;
	}
	
	x = a * b + c * (w - b);
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  cout<<(n+1)*n/2<<"\n";
  return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int r; cin>>r;
	if (r<1200) cout<<"ABC"<<endl;	
	else if (r<2800) cout<<"ARC"<<endl;
	else cout<<"AGC"<<endl;
	return 0;
}


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

const int nm = 100;
int n, k, c = 0;
bool b[nm];

int main() {
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		int d;
		cin >> d;
		for (int i = 0, a; i < d; i++) {
			cin >> a;
			a--;
			b[a] = 1;
		}
	}
	for (int i = 0; i < n; i++)
		if (!b[i])
			c++;
	cout << c << endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


signed main(){
  int n,z,w;cin>>n>>z>>w;
  int a[2100];rep(i,n)cin>>a[i];
  cout << max(abs(w-a[n-1]), abs(a[n-1]-a[n-2])) << endl;
}


Measured memory_bytes: 256
import collections
import math
import operator as op
from functools import reduce
from collections import Counter
import numpy as np
import math
import bisect
import heapq


MOD = 1000000007


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


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


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():

    N, M = get_inputs(int)
    A = get_inputs(int)
    A.sort(reverse=True)
    # print(A)

    if A[M-1] >= sum(A) / (4 * M):
        print("Yes")
    else:
        print("No")



if __name__ == '__main__':
    main()


Measured memory_bytes: 12520
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<cstring>
#include<iomanip>
#include<math.h>
#include<queue>
#define inf 0x3f3f3f
#define M 100000000
#define ll  long long
using namespace std;
ll x[M],p[M];
ll n,a,b;
bool judge(ll y)
{
    ll sum=0;
    ll t;
    for(int i=0;i<n;i++)
    {
        t=(ll)x[i]-b*y;
        if(t>0)
        {
            sum=sum+(ll)ceil(t*1.0/(a-b));
            if(sum>y||sum<0)
                return false;
        }
    }
    return true;
}
int fin()
{
    sort(x,x+n);
    ll mid,c,d;
    c=x[n-1]/a+1;
    d=x[n-1]/b+1;
    while(c<d)
    {
        mid=(c+d)/2;
        if(judge(mid))
            d=mid;
        else
            c=mid+1;
    }
    cout<<c<<endl;
}
int main()
{

    cin>>n>>a>>b;
    int i,j;
    for(i=0; i<n; i++)
        cin>>x[i];
    fin();
    return 0;
}




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

using namespace std;
#define ll long long
const long double EPS = 1e-8;
const long double PI = acos(-1);
const int N = 1e2 + 2;
const int mod = 1e9 + 7;
int arr[N];
int n, k;

int main() {
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    vector<ll> dp(k + 1);
    //the number of ways that we used i candies so far
    dp[0] = 1;
    for (int i = 0; i < n; i++) {
        vector<int> diff(k + 1);
        for (int used = k; used >= 0; used--) {
            ll tmp = dp[used];
            int L = used + 1;
            int R = used + min(arr[i], k - used);
            if (L <= R) {
                diff[L] = (diff[L] + tmp) % mod;
                if (R + 1 <= k)
                    diff[R + 1] = ((diff[R + 1] - tmp)+mod) % mod;
            }
        }
        ll prefix = 0;
        for (int j = 0; j <= k; j++) {
            prefix = (prefix + diff[j]) % mod;
            dp[j] = (dp[j] + prefix) % mod;
        }
    }
    cout << dp[k] << endl;
}




Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vs vector<string>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-7
//#define endl "\n"
using namespace std;
using namespace __gnu_pbds;

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

int main() 
{
    fastio
    int n;
    cin>>n;
    vector<ll> vec(n);
    for(auto& it : vec) cin>>it;

    vector<ll> pref(n+1);
    pref[1] = vec[0];
    vector<ll> dp(n+1);
    for(int i = 3; i<=n; i+=2) 
        pref[i] = pref[i-2]+vec[i-1];

    for(int i = 2; i<=n; ++i) {
        if(i&1)
            dp[i] = max(dp[i-1], dp[i-2]+vec[i-1]);
        else {
            dp[i] = vec[i-1] + dp[i-2];
            dp[i] = max(dp[i], pref[i-1]);
        }
    }
    cout<<dp[n]<<endl;
}   


Measured memory_bytes: 7948
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n;
  cin>>n;
  vector<int> x(n),y(n);
  for(int i=0;i<n;i++){
    cin>>x[i];
    y[i]=x[i];
  }
  sort(y.begin(),y.end());
  int med1=y[n/2-1];
  int med2=y[n/2];
  for(int i=0;i<n;i++){
    if(x[i]<=med1){
      cout<<med2<<endl;
    }else{
      cout<<med1<<endl;
    }
  }
  return 0;
}

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

using namespace std;

typedef long long ll;

static const ll md = 1e9+7;
static const ll mx = 100000;

string s;
ll n;
ll k;
int mans = 0;
int ans = 0;

int main(int, char**) 
{
	ll ans = 0;
	cin >> s;
 
	n = s.length();
	vector<int> y(n, 100001);
	vector<int> z(n, 0);
 
	bool f = false;
	int t = 0;
	for (int i = 0; i < n; ++i) {
		if (f) {
			if (s[i] == 'L') {
				y[i] = 0;
				int j = i - 1;
				int k = 0;
				while (s[j] == 'R') {
					if (k % 2 > 0)
						y[j] = k + 1;
					else
						y[j] = k;
					k++;
					j--;
				}
				f = false;
			}
		} else {
			if (s[i] == 'R') {
				t = 0;
				f = true;
			} else {
				--t;
				if (t % 2 != 0)
					y[i] = t - 1;
				else
					y[i] = t;
			}
		}
 
	}
	for (int i = 0; i < n; ++i) {
		if (y[i] == 0) z[i]++;
		else z[i + y[i]]++;
	}
 
	for (int i = 0; i < n - 1; ++i)
		cout << z[i] << " ";
	cout << z[n-1] << endl;
	return 0;
}



Measured memory_bytes: 1408
n = int(input())

alphabet = "abcdefghijk"

ans = [[] for _ in range(11)]
ans[1].append([0, "a"])

for i in range(n):
    for j, r in ans[i]:
        for k, t in enumerate(alphabet[:j+2]):
            if k == j+1:
                ans[i+1].append([j+1, r+t])
                continue
            ans[i+1].append([j, r+t])

for t in ans[n]:
    print(t[1])

Measured memory_bytes: 28024
using System;

namespace AtCoder
{
	public class ProblemA
	{
		public static void Main(string[] args)
		{
			string[] line = Console.ReadLine().Split(' ');
			int a = int.Parse(line[0]);
			int b = int.Parse(line[1]);
			int c = int.Parse(line[2]);
			int d = int.Parse(line[3]);

			a = Math.Max(a, c);
			b = Math.Min(b, d);
			Console.WriteLine(Math.Max(0, b - a));
		}
	}
}


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

bool go() {
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    int x;
    cin >> x;
    if (x % 2 == 1) continue;
    if (x % 3 == 0 || x % 5 == 0) continue;
    return false;
  }
  return true;
}

int main() {
  if (go()) {
    cout << "APPROVED\n";
  } else {
    cout << "DENIED\n";
  }
}


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

const int MOD = 1e4;

int n, k;
int sc[100];
int dp[101][4][4];

int main()
{
	scanf("%d %d", &n, &k);
	
	for (int i = 0; i < n; i++) sc[i] = 3;
	for (int i = 0; i < k; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		sc[--a] = --b;
	}
	
	dp[0][3][3] = 1;
	for (int i = 0; i < n; i++){
		for (int a = 0; a < 4; a++){
			for (int b = 0; b < 4; b++){
				for (int c = 0; c < 3; c++){
					if (sc[i] < 3 && sc[i] != c) continue;
					if (a == b && b == c) continue;
					dp[i + 1][b][c] = (dp[i + 1][b][c] + dp[i][a][b]) % MOD;
				}
			}
		}
	}
	
	int res = 0;
	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 4; j++){
			res = (res + dp[n][i][j]) % MOD;
		}
	}
	printf("%d\n", res);
}

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

int main(){
    int N; cin >> N;
    char S[N]; cin >> S;

    int ans = 1;
    for(int i = 0; i < N-1; i++){
        if(S[i] != S[i+1]){ans++;}
    }

    cout << ans << endl;
}

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

int main() {
  int K, S;
  cin >> K >> S;
  int count = 0;
  for (int x=0; x<=K; x++) {
    for (int y=0; y<=K; y++){
      int z = S-x-y;
      if (z>=0 && z<=K)
        count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int a, b;
  cin >> a >> b;
  cout << a * b << endl;
}

Measured memory_bytes: 3100
#include <iostream>
#include <map>

std::map<int,int> map;

int main() {

    int n;

    std::cin>>n;

    for(int i=2;i<=n;++i){
        int a;
        std::cin>>a;
        ++map[a];
    }

    for(int i=1;i<=n;++i)
        std::cout<<map[i]<<std::endl;

    return 0;
}

Measured memory_bytes: 12564
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    md = 10 ** 9 + 7
    k = [int(c) for c in input()]
    n=len(k)
    d = int(input())
    dp = [[0] * d for _ in range(n)]
    for b in range(k[0]):
        dp[0][b % d] += 1
    border = k[0]
    dpi = dp[0]
    for i, a in enumerate(k[1:], 1):
        dpi1 = dpi
        dpi = dp[i]
        for j in range(d):
            pre = dpi1[j]
            if pre == 0: continue
            for b in range(10):
                nj = (j + b) % d
                dpi[nj] = (dpi[nj] + pre) % md
        for b in range(a):
            nj = (border + b) % d
            dpi[nj] += 1
        border = (border + a) % d

    #p2D(dp)
    ans = dp[n-1][0] - 1 + (border % d == 0)
    print(ans % md)

main()


Measured memory_bytes: 43612
h, w = gets.split.map(&:to_i)
s = []
h.times {s << gets.chomp}

dp = Array.new(h) {Array.new(w, 0)}

h.times do |i|
    if i == 0
        dp[0][0] = 1 if (pre = s[0][0]) == "#"
        1.upto(w-1) do |j|
            dp[0][j] = dp[0][j-1] + (pre == "." && s[0][j] == "#" ? 1 : 0)
            pre = s[i][j]
        end
    else
        dp[i][0] = dp[i-1][0] + (s[i-1][0] == "." && s[i][0] == "#" ? 1 : 0)
        1.upto(w-1) do |j|
            x = dp[i-1][j] + (s[i-1][j] == "." && s[i][j] == "#" ? 1 : 0)
            y = dp[i][j-1] + (s[i][j-1] == "." && s[i][j] == "#" ? 1 : 0)
            dp[i][j] = x < y ? x : y
        end
    end
end
#p dp
puts dp[h-1][w-1]

Measured memory_bytes: 1916
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  string s1, s2;
  cin >> s1 >> s2;

  if(s1 > s2){
    cout << ">" << endl;
  }else if(s1 < s2){
    cout << "<" << endl;
  }else{
    cout << "=" << endl;
  }
  return 0;
}



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

ll n, mod = 998244353;
const ll MAX = 1e7 + 1;
vector<ll> v(MAX);

ll inv[MAX];

int main()
{
    ll N;
    cin >> N;
    ll D[100000];
    ll max = 0;
    
    
    rep(i,N){
        cin >> D[i];
        if (max < D[i]){
            max = D[i];
        }
    }
    if (D[0] != 0){
        cout << 0;
        return 0;
    }
    
    ll cnt[100000];
    rep(i, N)cnt[i] = 0;
    rep(i, N)cnt[D[i]]++;
    
    if (cnt[0] != 1){
        cout << 0;
        return 0;
    }
    ll ans = 1;
    for (int i = 1; i <= max; i++){
        if (cnt[i] == 0){
            cout << 0;
            return 0;
        }
        for (int j = 0; j < cnt[i]; j++){
            (ans *= cnt[i - 1]) %= mod;
        }
    }
    cout << ans << endl;
    return 0;    
}


Measured memory_bytes: 80000
#include<iostream>
using namespace std;
int main()
{
    int x;
    while(cin>>x){
        if(x>=400&&x<=599)
            cout<<8<<endl;
        if(x>=600&&x<=799)
            cout<<7<<endl;
        if(x>=800&&x<=999)
            cout<<6<<endl;
        if(x>=1000&&x<=1199)
            cout<<5<<endl;
        if(x>=1200&&x<=1399)
            cout<<4<<endl;
        if(x>=1400&&x<=1599)
            cout<<3<<endl;
        if(x>=1600&&x<=1799)
            cout<<2<<endl;
        if(x>=1800&&x<=1999)
            cout<<1<<endl;
        }
    return 0;
}


Measured memory_bytes: 3624
import Foundation

func readInts() -> [Int]{
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let n = Int(readLine()!)!
    var ans = 0
    
    for i in 1...n {
        if i % 3 != 0 && i % 5 != 0 {
            ans += i
        }
    }
    print(ans)
}

main()


Measured memory_bytes: 13192
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')

n = I()
a = LI()
ans = INF
for i in range(-100, 101):
    cost = 0
    for j in a:
        cost += (i - j) ** 2
    ans = min(ans, cost)
print(ans)


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

int main(){
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		double sall = (x1-x2)*(y1+y2) + (x2-x3)*(y2+y3) + (x3-x1)*(y3+y1);
		double s1 = (x1-x2)*(y1+y2) + (x2-xp)*(y2+yp) + (xp-x1)*(yp+y1);
		double s2 = (x1-xp)*(y1+yp) + (xp-x3)*(yp+y3) + (x3-x1)*(y3+y1);
		double s3 = (xp-x2)*(yp+y2) + (x2-x3)*(y2+y3) + (x3-xp)*(y3+yp);
		sall = sall < 0 ? -1*sall : sall;
		s1 = s1 < 0 ? -1*s1 : s1;
		s2 = s2 < 0 ? -1*s2 : s2;
		s3 = s3 < 0 ? -1*s3 : s3;
		// ½Ì©fabsÆ©absªstdilib.hÆ©CN[hµÄàg¦È¢
		if(sall == s1+s2+s3){
			cout<<"YES"<<endl;
		} else {
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 0
N, Ma, Mb= (int(i) for i in input().split())
L = []
for i in range(N):
    a, b, c = (int(i) for i in input().split())
    L.append((a, b, c))

dp= [[[float("inf")] * (10 * N + 11) for a in range(10 * N + 11) ] for i in range(N + 1)]
dp[0][0][0] = 0

for i in range(N):
    a, b, c = L[i]
    for ca in range(10 * N + 1):
        for cb in range(10 * N + 1):
            dp[i+1][ca][cb] = min(dp[i+1][ca][cb], dp[i][ca][cb])
            dp[i+1][ca + a][cb + b] = min(dp[i+1][ca + a][cb + b], dp[i][ca][cb] + c)

reslis = []
ra, rb = (Ma, Mb)
while ra <= 10 * N and rb <= 10 * N:
    reslis.append(dp[N][ra][rb])
    ra += Ma
    rb += Mb

reslis.sort()
res = reslis[0]
if res == float("inf"):
    print(-1)
else:
    print(res)


Measured memory_bytes: 136924
s = str(input())
Q = int(input())
forward = 1
front = ""
back = ""

for i in range(Q):
    q = list(input().split())
    if q[0] == "1":
        forward *= -1
    else:
        if q[1] == "1":
            if forward == 1:
                front = q[2] + front
            else:
                back = back + q[2]        
        else:
            if forward == 1:
                back = back + q[2]
            else:
                front = q[2] + front

s = front + s + back
if forward == -1:
    s = s[::-1]
print(s)

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

int main()
{
	string S;
	cin >> S;
	int n = S.size();
	ll res = 0, it = 0;
	for (int i = 0; i < n; i++) {
		if (S[i] == 'W') {
			res += i - it++;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
//INF = 1 061 109 567 ; INF + INF = 2 122 219 134 ;
//LINF = 4 557 430 888 798 830 399 ; LINF + LINF = 9 114 861 777 597 660 798 ;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = (int)1e9+7;
const int N = (int)1e5+7;

//浮点型运算
const db eps = 1e-6;
bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }

//--------变量--------//

int n;

//--------函数--------//

void Init() {
}

void Solve() {
	printf("%d\n", (24-n)+24);
}

//--------main--------//

int main ()
{
	while (~scanf("%d", &n)) {
		Init();
		Solve();
	}
    return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
MOD = 1000000007
def main():
    bits = input()
    ans = 1
    pow3 = 1
    for i, b in enumerate(reversed(bits)):
        if b == '1':
            ans = ((ans * 2 % MOD) + pow3) % MOD
        pow3 = (pow3 * 3) % MOD
    print(ans)
main()

Measured memory_bytes: 12472
/*
_____________________$$o____________________o$$$$$o__
___________________o$o_$$o____oo$$$$$$$oo______o$$$$o
______________$o________o$$$$$o___oo$$$$$$$o______$$$
______________$$$ooo________o$$$$o______o$$$$$o_____o
____________oo_____oo_____oo___o$$$$$______$$$$$$____
_________ooooo___$$o_$___oooooo___o$$$$o__o__o$$$$___
_______ooo__ooo$$$$o_$$ooooooooooo__o$$$o__oo_oo$$$o_
______oo_o$$o_$$_o$o_o$o__oooooooooo__o$$$o_oo__o$$$o
____oooooo$$$$o___oo__$$o_ooo_oooooooo__o$$o_ooo_o$$$
___ooooooo__o___oooo__$$ooooo$_oooooooo__o$$__ooo_$$$
_$$o_ooooo___o$$$$$o__o$o__o_$o__oooooooo_o$$o_oo__$$
_$$$o_ooo_________o$$_$$o____$$o_ooooooooo_$$$o_oo_$$
__oo________o$$o____o_$$o____o$ooooooooooo_o$$o_oo_o$
___o$$$$$$$$$$$$$o___$$$o____$$o_oooooooooo_$$$o_o_o$
________o__oo$$$$$o__$$$o____$$o____oooooo__$$$o_o_o$
_________$$$$$$$$$o__$$_____$$$o___________$$$oooooo_
__________o$$$$$$$o_________$$___________o$o___oooooo
___________o$$$$o_______________ooooo__oo$__ooo__oooo
________________________________ooo_$$oo___oooo$o____
________________________________oooo_$$$$$o___oo$$$o_
________________________________ooooo_o$$$$$o_____$$$
________________________________oooooo_o$$$$$$ooo___o
________________________________ooooooo__o$$$$$o_____
*/
#include<bits/stdc++.h>
#define ll long long
#define ft first
#define sd second
#define HageBaIO_KPOCCbI int LOL;scanf("%d", &LOL);for(int i = 0; i < LOL; i++)
#define Terrorist ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
//BY |3 |<
const int dx[] = {1, 0, -1,  0};
const int dy[] = {0, 1,  0, -1};
//Where I am?
const ll N = 1e5 + 5;
const ll NN = 1e3 + 3;
const ll MOD = (1e9 + 7);
const ll MOD1 = 998244353;
const double PI = 3.14159265;
const int INF32 = 2e9;
const ll INF64 = 2e18;
//Don`t believe!!!//
ll n, ans;
map<ll, bool>mp;
void ff(ll x){
	if(x == 1)return;
	ll m = n;
	while(m % x == 0)m = m / x;
	m = m % x;
	if(m == 1 && !mp[x]){
		ans++;
		mp[x] = 1;
	}
	return;
}
void fun(ll x){
	for(int i = 1; i <= sqrt(x); i++){
		if(x % i == 0){
			ff(i);
			ff(x / i);
		}
	}
	return;
}
void KEK(){
	cin>>n;
	fun(n - 1);
	fun(n);
	cout<<ans;
	return;
}
int main(){
	Terrorist
	//HageBaIO_KPOCCbI
	KEK();
	return 0;
}
//TAUMAC, 9| BbIWEJI 3A TObOU!!!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 256
N, M = map(int, input().split())

P = [0]*(N+1)

for i in range (0, M):
	A, B = map(int, input().split())
	P[A-1]+=1
	P[B]-=1
    
for i in range (1, N+1):
	P[i]+=P[i-1]
    
P = sorted(P, reverse = True)

count = 0

for i in range (0, N+1):
	if P[i] == M:
		count+=1
	else:
		print(count)
		exit()

Measured memory_bytes: 13996