akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll mod = 1e9+7;

ll modpower(ll a, ll r){ //a^r
    ll x = 1;
    while (r > 0) {
        if (r & 1) x = x * a % mod;
        r >>= 1;
        a = a * a % mod;
    }
    return x;
}

ll modinv(ll a){
    return modpower(a, mod-2);
}

vector<ll> fact;
vector<ll> invfact;

void set_fact(int n){
    fact.resize(n+1, 1);
    invfact.resize(n+1, 1);
    for (int i = 2; i <= n; i++) {
        fact[i] = fact[i-1] * i % mod;
    }
    invfact[n] = modinv(fact[n]);
    for (int i = n-1; i >= 2; i--) {
        invfact[i] = invfact[i+1] * (i+1) % mod;
    }
    return;
}

ll comb(int n, int k) {
    if (k > n || k < 0) return 0;
    if (k == n || k == 0) return 1;
    return fact[n] * invfact[n-k] % mod * invfact[k] % mod;
}
int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = modpower(2, n);
    ans--;
    set_fact(200010);
    ll ac = 1, bc = 1;
    for (int i = 1; i <= a; i++) {
        ac = ac * modinv(i) % mod * (n+1-i) % mod;
    }
    for (int i = 1; i <= b; i++) {
        bc = bc * modinv(i) % mod * (n+1-i) % mod;
    }
    ans = (ans + 2*mod - ac - bc)%mod;
    cout << ans << endl;
    
    
    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  string s, t;
  cin >> s >> t;
  int cnt = 0;
  rep(i, sz(s)) if (s[i] != t[i]) cnt++;
  cout << cnt << endl;
  return 0;
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	vector<int>x(N), y(M);
	int XMAX = X;
	int YMIN = Y;

	for (int i = 0; i < N; i++)
	{
		cin >> x[i];
		XMAX = max(XMAX, x[i]);
	}
	for (int i = 0; i < M; i++)
	{
		cin >> y[i];
		YMIN = min(YMIN, y[i]);
	}
	
	if (XMAX < YMIN) {
		cout << "No War" << endl;
	}
	else {
		cout << "War" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
arr = gets.chomp.split(' ').map(&:to_i)

result = []
correct = Array.new(n)
n.downto(1) do |i|
    if i > n / 2
        correct[i - 1] = arr[i - 1]
        result.push(i) if arr[i - 1] == 1
    else
        sum = 0
        (i + i).step(n, i) do |num|

            sum += correct[num - 1]
        end
        correct[i - 1] = sum % 2 != arr[i - 1] % 2 ? 1 : 0
        result.push(i) if sum % 2 != arr[i - 1] % 2
    end
end

puts result.size
puts result.join(' ') if result.size != 0

Measured memory_bytes: 22468
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>

using namespace std;
#define ll long long
#define pb push_back

 
int main()
{
    // g++ -std=c++11 -o d.o d.cpp
    int N, sum=0;
    cin >> N;
    vector<int> a(N);
    vector<int> x(N);
    for(int i=0;i<N;i++){
        cin >> a[i];
        sum += a[i];
    }
    x[0] = sum;
    // cout << x[0] << endl;
    for(int i=0;i<N/2;i++){
        x[0] -= 2*a[i*2 + 1]; 
    }
        // cout << x[0] << endl;

    for(int i=1; i<N;i++){
        x[i] = 2*a[i-1] - x[i-1];
    }
    for(int i=0; i<N;i++){
        cout << x[i] << " ";
    }
    cout << endl;
    
}


Measured memory_bytes: 2048
import java.io.PrintWriter

//private val inp = java.io.File("in")
private val inp = System.`in`
private val reader = inp.bufferedReader()
private val wr = PrintWriter(System.out.bufferedWriter())

private fun readLn(): String = reader.readLine()
private fun readInt(): Int = readLn().toInt()
private fun readLong(): Long = readLn().toLong()
private fun readStrs(): List<String> = readLn().split(" ")
private fun readInts(): IntArray = readStrs().map { it.toInt() }.toIntArray()
private fun readChars(): CharArray = readStrs().map { it.single() }.toCharArray()

fun main() {
    val r = readInt()
    println(2*Math.PI*r)
}


Measured memory_bytes: 34688
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //ATTENTION: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/
int N;
int a[100010];
bool d[100010];
/**********************************/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    REP(i, N) cin >> a[i+1];

    int now = 1;
    int ans = 0;
    while(now != 2) {
        if(d[now]) {
            cout << -1 << endl;
            return 0;
        }
        d[now] = true;
        ans++;
        now = a[now];
    }
    cout << ans << endl;
}


Measured memory_bytes: 768
using System;
using System.Linq;

namespace abc135_c
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();
            var B = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();
            var a1 = A.Sum();

            if (N == 1)
            {
                var a = A[0] + A[1];
                if (a <= B[0]) Console.WriteLine(a);
                else Console.WriteLine(B[0]);
            }
            else
            {
                for (int i = N; i > 0; i--)
                    foreach (var j in new int[] { 0, 1 })
                        if (A[i - j] <= B[i - 1])
                        {
                            B[i - 1] -= A[i - j];
                            A[i - j] = 0;
                        }
                        else
                        {
                            A[i - j] -= B[i - 1];
                            B[i - 1] = 0;
                        }
                
                Console.WriteLine(a1 - A.Sum());

            }
        }
    }
}


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

int main() {
    ll n, k;
    cin >> n >> k;
    vector<int> a(n);
    vector<int> b(n);

    rep(i, 0, n) {
        cin >> a[i] >> b[i];
    }

    vector<ll> count(100100, 0);
    rep(i, 0, n) {
        count[a[i]] += b[i];
    }

    ll ans = 0;
    ll sum = 0;
    rep(i, 1, count.size()) {
        sum += count[i];
        if(sum == k) {
            ans = i;
            break;
        }
        else if(sum > k) {
            ans = i;
            break;
        }
        else if(sum < k) {
            
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int sum_elements(int n) {
  int sum = 0, m;

  while(n > 0) {    
    m = n % 10;    
    sum = sum + m;    
    n = n / 10;    
  }
  return sum;
}

int main () {
  
  int N, ans = INT_MAX;

  cin >> N;

  int A = 1, B = N - 1, t;

  while (A <= (N / 2)) {
    t = sum_elements(A) + sum_elements(B);
    if (t < ans) {
      ans = t;
    }
    A++;
    B--;
  }

  cout << ans << endl;

  return 0;
}

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

int main()
{
	int num1,num2,num3,get,ans = 0;
  cin>>num1;
  cin>>num2;
  cin>>num3;
  cin>>get;
  if(get<=num1)
  {
  ans = get;
  }
  else if(get<= num1+num2)
  {
  ans = num1;
  }
  else
  {
  ans = num1*2+num2-get ;
  }
  cout << ans;
}

Measured memory_bytes: 3620
S = input()

x, y = int(S[:2]), int(S[2:])
if 1 <= x <= 12 and 1 <= y <= 12:
    print('AMBIGUOUS')
elif 1 <= x <= 12:
    print('MMYY')
elif 1 <= y <= 12:
    print('YYMM')
else:
    print('NA')


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
struct Let {
    int in, w;
    Let(int i, int c):in(i),w(c) {}
    bool operator<(Let b)const {
        return this->w > b.w;
    }
};
int getD(int Tree[], int j) {
    int depth = 0;
    while (Tree[j] != -1) {
        j = Tree[j];
        depth++;
    }
    return depth;
}
int main() {
    string S; cin >> S;
    int len = S.length(), Count[27] = { 0 };
    for (int i = 0; i < len; i++)
        Count[S[i] - 'a' + 1]++;

    priority_queue <Let> PQ;
    for (int i = 1; i <= 26; i++)
        if (Count[i])
            PQ.push(Let(i, Count[i]));

    if (PQ.size() == 1) {
        cout << PQ.top().w << endl;
        return 0;
    }

    int indx = 26;
    int Tree[55] = { 0 };
    while (PQ.size() > 1) {
        indx++;
        Let x = PQ.top(); PQ.pop();
        Let y = PQ.top(); PQ.pop();
        PQ.push(Let(indx, x.w + y.w));
        Tree[x.in] = Tree[y.in] = indx;
    }

    Tree[indx] = -1;
    int ans = 0;
    for (int i = 1; i <= 26; i++) 
        if (Tree[i]) 
            ans += getD(Tree, i) * Count[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3344
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt(), K = sc.nextInt();
		
		long ans = 0;
		
		for(int i=K+1;i<=N;i++){
			
			int cnt = i-K;
			ans += cnt * (N/i);
			
			ans +=  Math.max(0, (N - N/i*i)-K+1);
		}
		if(K==0)
			ans -= N;
		
		System.out.println(ans);
	}
	
	
}


Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;
typedef pair<ll, string> PLS;

int n, m;

int main(){
	while (cin >> n&&n){
		string s, table = "I";
		cin >> m >> s;
		REP(i, n)table += "OI";
		int ans = 0;
		REP(i, m - n * 2){
			int search = s.find(table, i);
			if (search == -1)break;
			else{
				//cout << search << endl;
				i = search;
				ans++;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3940
import java.util.Scanner;

public class Main {

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

    private void solve() {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            long A = in.nextInt();
            long B = in.nextInt();
            long[] X = new long[N];
            for (int i = 0; i < N; i++) {
                X[i] = in.nextInt();
            }

            long sum = 0;
            for (int i = 1; i < N; i++) {
                sum += Math.min(A * (X[i] - X[i - 1]), B);
            }

            System.out.println(sum);
        }
    }

}


Measured memory_bytes: 33580
n, a, b = map(int, input().split())

ans = 0
for i in range(1,n+1):
    # i = 10
    n1 = i
    n2 = 0
    while n1 != 0:
        n2 += n1%10
        n1 = n1//10
    if a <= n2 <= b:
        ans += i

print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	int x,n;
	cin>>x>>n;
	
	bool jud[102]={};
	REP(i,n){
		int p;
		cin>>p;
		jud[p]=true;
	}
	
	int d=0;
	while(d<105){
		int l=x-d, r=x+d;
		if(!jud[l]){
			cout<<l<<endl;
			return 0;
		}else if(!jud[r]){
			cout<<r<<endl;
			return 0;
		}
		d++;
	}
}

Measured memory_bytes: 3592
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
//const int mod=(int)998244353;
const llint big=(llint)(2.19e16)+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
using pli=pair<llint,int>;
using daic=priority_queue<pli,vector<pli>,greater<pli>>;
int main(void){
	llint A,B;cin>>A>>B;
	int h;
	for(h=60;h>=0;h--){
		if(A&(1LL<<h)){
			A-=(1LL<<h);
			B-=(1LL<<h);
		}else if((B&(1LL<<h))==0){}
		else{break;}
	}
	int k=h;
	h--;
	for(;h>=0;h--){if(B&(1LL<<h)){break;}}
	//hが桁
	B|=(1LL<<(h+1))-1;
	if(B<(A+(1LL<<k))){cout<<((1LL<<(k+1))-(A+(1LL<<k))+B+1-A)<<endl;}
	else{cout<<((1LL<<(k+1))-A)<<endl;}
	RE;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int a;
  cin >> a;
  if(100+10+1 == a) cout << 3;
  if(100+10 == a) cout << 2;
  if(100+1 == a) cout << 2;
  if(100 == a) cout << 1;
  if(10+1 == a) cout << 2;
  if(10 == a) cout << 1;
  if(1 == a) cout << 1;
  if(0 == a) cout << 0;
}


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

int main(){
    ll X,Y; cin >> X >> Y;
    ll ans = 0;
    while(X<=Y){
        X *= 2;
        ans ++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int x, n; cin >> x >> n;
    vector<int> p(n);for (int i = 0; i < n; i++) { cin >> p[i];}
    for (int i = 0; i <= 101; i++) {
        for (auto j : {-1, 1} ) {
            if ( find(p.begin(), p.end(), x+( i*j )) != p.end() ){
                continue;
            }else{
                if (x+( i*j ) >= 0) {
                    cout << x+( i*j );
                    return 0;
                }
            }
        }
    }
}


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

int main(int argc, const char * argv[]) {
    uint64_t N;
    cin >> N;
    uint64_t ans = 1 + N - 2; // N-1マス移動。
    
    for (uint64_t i = 2; i < int(sqrt(N))+1; i++) {
        if (N % i == 0) {
            ans = std::min(ans, i + N/i - 2);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 888
#include<stdio.h>

int main(){

        int n,x,i;

        scanf("%d",&n);

        for( i = 1 ; i <= 50000 ; i++)
                if( i*27/25 == n ){
                        printf("%d\n",i);
                        break ;
                }   

        if( i == 50001 )
                printf(":(\n");

        return 0;



}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

#include <atcoder/all>
using namespace atcoder;

int main(void)
{
    IOS
    int t; cin >> t;
    REP(_,t) {
        int n, m;
        cin >> n >> m;
        int a, b;
        cin >> a >> b;
        OUT(floor_sum(n,m,a,b))
    }

    return 0;
}

Measured memory_bytes: 3712
#include <iostream>
using namespace std;
int main(void){
    int r,D,x,prex;
    cin >> r >> D >> x;
    prex = x;
    for (int i = 1;i<11;i++){
        cout << prex * r - D << endl;
        prex = prex * r - D;
    }
    return 0;
}


Measured memory_bytes: 256
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N = sys.stdin.buffer.readline().decode().rstrip()

S = []
T = []
for c in N:
    S.append(int(c))
    T.append(9 - int(c))
T[-1] += 1
i = len(T) - 1
while T[i] == 10:
    T[i] = 0
    T[i - 1] += 1
    i -= 1

N = len(S)

# maekaramiteku
# dp[i][j]: i まで見て最小の答え、反転してるかどうか
dp = [[IINF, IINF] for _ in range(N + 1)]
dp[0][0] = 0
dp[0][0] = 0
for i in range(N):
    # 1 使って反転できる
    dp[i + 1][0] = min(dp[i][0] + S[i], dp[i][1] + 1 + S[i])
    dp[i + 1][1] = min(dp[i][1] + T[i], dp[i][0] + 1 + T[i])

print(min(dp[-1]))


Measured memory_bytes: 146640
#include <iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<cstdlib>
#include<cmath>

using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int ans=0;
    for(int i=0; i<a;i++){
        if((i*b+c)%a==0)ans=1;
    }
      ans?cout<<"YES"<<endl:cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
//JSD
#include<iostream>
#define ll long long 
using namespace std;
ll n;
ll a[100005][3];
ll dp[100005][3];
ll solve(ll k,ll last){
	ll ans=0;
	if(last!=-1 && dp[k][last]!=-1) 
		return dp[k][last];
	if(k==(n-1)){
		for(int i=0;i<3;i++){
			if(i!=last){
				ans=max(ans,a[k][i]);
			}
		}
	}
	else{
		for(int i=0;i<3;i++){
			if(i!=last){
				ll p=solve(k+1,i)+a[k][i];
				ans=max(ans,p);
			}
		}
	}
	dp[k][last]=ans;
	return ans;
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++) {
			cin>>a[i][j];
			dp[i][j]=-1;
		}
	}
	cout<<solve(0,-1);
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;

#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()



int main()
{
    string s,t;
    cin>>s>>t;
    int cnt=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
        {
            cnt++;
        }
    }cout<<cnt;
}


Measured memory_bytes: 3852
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - 48;}
char myitoc(int N) {return '0' + N;}

template <class A> class unionfind
{
public:
  vector<int> parent;
  vector<int> rank;
  vector<A> diffw;

  unionfind(int N, A U = 0)
  {
    parent = vector<int>(N, -1);
    rank = vector<int>(N, 0);
    diffw = vector<A>(N, U);
  }

  int root(int X)
  {
    if (parent.at(X) < 0) return X;
    int R = root(parent.at(X));
    diffw.at(X) += diffw.at(parent.at(X));
    return parent.at(X) = R;
  }

  int size(int X)
  {
    return -parent.at(root(X));
  }

  A weight(int X)
  {
    root(X);
    return diffw.at(X);
  }

  A diff(int X, int Y)
  {
    return weight(Y) - weight(X);
  }

  bool same(int X, int Y)
  {
    return (root(X) == root(Y));
  }

  bool unite(int X, int Y, A W)
  {
    W += weight(X);
    W -= weight(Y);

    X = root(X);
    Y = root(Y);
    if (X == Y) return false;
    
    if (rank.at(X) < rank.at(Y)) 
    {
      swap(X, Y);
      W = -W;
    }
    if (rank.at(X) == rank.at(Y)) rank.at(X)++;
    parent.at(X) += parent.at(Y);
    parent.at(Y) = X;
    diffw.at(Y) = W;
    return true;
  }
};

signed main()
{
  int N, M;
  cin >> N >> M;

  unionfind<int> uf(N);

  for (int i = 0; i < M; i++)
  {
    int L, R, D;
    cin >> L >> R >> D;
    L--; R--;
    if (uf.same(L, R))
    {
      if (abs(uf.diff(L, R)) != D)
      {
        cout << "No" << endl;
        return 0;
      }
    }
    else
      uf.unite(L, R, D);
  }

  cout << "Yes" << endl;
}

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

using namespace std;

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

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

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

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int n, m;

	cin >> n >> m;

	int ans = m;

	int s, t;
	bool flag = false;
	rep(i, 0, n) 
	{
		cin >> s >> t;
		m += (s - t);
		if (m < 0)
		{
			flag = true;
		}
		chmax(ans, m);
	}
	if (flag)
	{
		cout << "0" << endl;
	}
	else
	{
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3200
#include <iostream>
#include <cstdlib>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
#include <sstream>
#include <math.h>

using namespace std;

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecchar vector<char>
#define vecstr vector<string>
#define vecbool vector<bool>
#define vec2bool vector<vector<bool>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s >= 0;s--)

#define Pi 3.1415926535897932384626


int main() {
	ll a; long double b;
	cin >> a >> b;
	cout << fixed << setprecision(0) << floor(a*b) << endl;
}

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

using namespace std;

#define il inline
#define re register
#define Rep(i, s, e) for (re int i = s; i <= e; ++i)
#define Dep(i, s, e) for (re int i = s; i >= e; --i)
#define file(a) freopen(#a".in", "r", stdin), freopen(#a".out", "w", stdout)

const int H = 11;
const int W = 1010;

const int MAXVAL = 1030;

il int read() {
    int x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = false; c = getchar();}
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}

int h, w, K, sum[H][W];
char s[W];

il int Get(int r, int c, int R, int C) {
    return sum[R][C] - sum[R][c - 1] - sum[r - 1][C] + sum[r - 1][c - 1];
}

int f[MAXVAL][W];
int tot, pos[H], now[H], tp[H];

int ans = 0x3f3f3f3f;

int main() {
    h = read(), w = read(), K = read();
    Rep(i, 1, h) {
        gets(s + 1);
        Rep(j, 1, w) sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + (s[j] == '1');
    }
    int MAX = (1 << (h - 1)) - 1;
    Rep(i, 0, MAX) {
    	memset(now, 0, sizeof(now));
        //cout << "i: " << i << endl;
        tot = 0; int tp_ans = 0;
        Rep(j, 0, h - 2) {
            if (i & (1 << j)) pos[++tot] = j + 1;
        }
        //Rep(i, 1, tot) cout << pos[i] << ' ';
        //cout << endl;
        tp_ans = tot, pos[++tot] = h;
        bool failed = false;
        Rep(j, 1, w) {
        	Rep(k, 1, tot) {
        		tp[k] = Get(pos[k - 1] + 1, j, pos[k], j);
        		if (tp[k] > K) {failed = true; break;}
			}
			if (failed) break;
        	Rep(k, 1, tot) {
        		now[k] += tp[k];
        		if (now[k] > K) {
        			Rep(l, 1, tot) now[l] = tp[l];
        			++tp_ans;
        			break;
				}
			}
			//cout << "j: " << j << endl;
			//Rep(k, 1, tot) cout << now[k] << ' ';
			//cout << endl;
		}
	    if (failed) continue;
        //cout << tp_ans << endl;
        ans = min(ans, tp_ans);
    }
    printf("%d", ans);
    //system("pause"); //Remember to delete before submition!!!
    return 0;
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	ll A,B;

	scanf("%lld %lld",&A,&B);

	if(B%A == 0){

		printf("-1\n");

	}else{

		ll num = A*(B/A+1);

		if(num%B < A && num/A < num/B+num%B){

			printf("%lld\n",num);
			return 0;
		}else{

			printf("-1\n");
		}
	}

	return 0;
}



Measured memory_bytes: 3232
import java.util.*;

public class Main {
	static final long MOD = 1000000007;
	public static void main (String[] args)  {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int prev = sc.nextInt();
		long nValue = 0;
		for (int i = 0; i < n - 1; i++) {
			int x = sc.nextInt();
			nValue += (x - prev) * calc(n - 1, i) % MOD;
			nValue %= MOD;
			prev = x;
		}
		prev = sc.nextInt();
		long mValue = 0;
		for (int i = 0; i < m - 1; i++) {
			int x = sc.nextInt();
			mValue += (x - prev) * calc(m - 1, i) % MOD;
			mValue %= MOD;
			prev = x;
		}
      System.out.println(nValue * mValue % MOD);
	}
	
	static long calc(int max, int idx) {
		idx = Math.min(idx, max - idx - 1);
		long ans = max;
		ans = (ans - idx) * (idx + 1);
		return ans;
	}
}


Measured memory_bytes: 62432
#include <iostream>
using namespace std;
int main (int argc, const char * argv[])
{
    int a,b;
    cin >> a >> b;
    
    if (a>b){
        cout<<  "a > b"<<endl;
    } 
    else if (a<b){
        cout <<"a < b"<<endl;
    }
    else{
        cout <<"a == b"<<endl;
    }
    // insert code here...
 //   std::cout << \n";
    return 0;
}

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

#define pb push_back
#define fi first
#define se second
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pii pair<int,int>
#define mod 998244353

int lowbit(int x) {return x&(-x);}

int n,W;
int w[111],v[111];
int f[111911];

int main(){
	scanf("%d%d",&n,&W);
	for (int i=1;i<=n;i++) scanf("%d%d",&w[i],&v[i]);
	for (int i=1;i<111911;i++) f[i]=W+1;
	int sum=0,ans=0;
	for (int i=1;i<=n;i++) {
		sum+=v[i];
		for (int j=sum;j>=v[i];j--) {
			f[j]=min(f[j],f[j-v[i]]+w[i]);
			if (f[j]>W) f[j]=W+1;
			else ans=max(ans,j);
		}
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 640
import sys,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

ans = 0
w,h = m()

p = []

for i in range(w):
    k = onem()
    p.append([k,0])
for i in range(h):
    k = onem()
    p.append([k,1])
p.sort()
w,h = w+1,h+1

for i in range(len(p)):
    if p[i][1] == 0:
        ans += h*p[i][0]
        w -= 1
    else:
        ans += w * p[i][0]
        h -= 1
print(ans)


Measured memory_bytes: 32428
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int n;int h=0;int m=0;
    cin >> n;
    while(n>=3600){
        n-=3600;h++;
    }
    while(n>=60){
        n-=60;m++;
    }
    cout << h << ":" << m << ":" << n << endl;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111


	int mo  = 1e9+7;
	int dp[3100][3100];
	int pre[3100][3100];
	void solve(){

		ini(n);
		ini(n1);
		vi morty(n);
		vi morty1(n1);
		FOR(i,0,n)in(morty[i]);
		FOR(i,0,n1)in(morty1[i]);
		//FOR(i,0,3100)pre[i][0] = pre[0][i] = 1;
		int rick = 1;
		FOR(i,0,n){
			int i1;
			for(i1 = 0;i1<n1;i1++){
				if(morty[i] == morty1[i1]){dp[i+1][i1+1] = pre[i][i1]+1;
				rick+=dp[i+1][i1+1];
				rick%=mo;}
				pre[i+1][i1+1] = (pre[i][i1+1]+pre[i+1][i1]+mo-pre[i][i1]+dp[i+1][i1+1])%mo;}
		}
		out(rick);







	}









































int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


Measured memory_bytes: 100224
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int ctoi(char c) {return c-'0';}// char to int
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}//MAX
int lcm(ll a,ll b){return a*b/gcd(a,b);}//MIN
 
int  main(){
int n;
cin >> n;
string s,t;
cin >> s >> t;
string ans;
int che = 0,chea=0;
for(int i=0;i<n*2;i++){
    if(i%2==0){
        ans+=s.at(che);
        che++;
    }
    else{
        ans+=t.at(chea);
        chea++;
    }
}
cout << ans << endl;
}
 


Measured memory_bytes: 256
x = int(input())

import random


def is_prime3(q, k=50):
    q = abs(q)
    # 計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q & 1 == 0: return False

    # n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q - 1) >> 1
    while d & 1 == 0:
        d >>= 1

    # 判定をk回繰り返す
    for i in range(k):
        a = random.randint(1, q - 1)
        t = d
        y = pow(a, t, q)
        # [0,s-1]の範囲すべてをチェック
        while t != q - 1 and y != 1 and y != q - 1:
            y = pow(y, 2, q)
            t <<= 1
        if y != q - 1 and t & 1 == 0:
            return False
    return True


while True:
    if is_prime3(x):
        print(x)
        exit()
    x += 1

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

#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> ii;

const int len = 2e5+5;
int arr1[len], arr2[len], dp[len][4];
char str1[len], str2[len];

int main(){
    int a, b, n, x, y;
    scanf("%d %d %d %d %d", &a, &b, &n, &x, &y);
    scanf("%s %s", str1, str2);

    /*
    U->0
    L->1
    R->2
    D->3
    */
    for (int i = 0; i < n; i++){
        if (str1[i] == 'U') arr1[i] = 0;
        else if (str1[i] == 'D') arr1[i] = 3;
        else if (str1[i] == 'L') arr1[i] = 1;
        else arr1[i] = 2;

        if (str2[i] == 'U') arr2[i] = 0;
        else if (str2[i] == 'D') arr2[i] = 3;
        else if (str2[i] == 'L') arr2[i] = 1;
        else arr2[i] = 2;
    }

    for (int i = n-1; i >= 0; i--){
        for (int j = 0; j < 4; j++)
            dp[i][j] = dp[i+1][j];
        dp[i][3-arr2[i]] = max(0, dp[i][3-arr2[i]]-1);
        dp[i][arr1[i]]++;
    }

    int ans = 0;
    for (int k = 0, i = x, j = y; k < n; k++){
        if (arr1[k] == 0) i--;
        if (arr1[k] == 1) j--;

        //printf("k = %d, i = %d, j = %d\n", k, i, j);
        if (i < 1 || j < 1) ans = 1;

        if (arr2[k] == 3 && i < a) i++;
        if (arr2[k] == 2 && j < b) j++;
    }

    for (int k = 0, i = x, j = y; k < n; k++){
        if (arr1[k] == 3) i++;
        if (arr1[k] == 2) j++;

        if (i > a || j > b) ans = 1;

        if (arr2[k] == 0 && i > 1) i--;
        if (arr2[k] == 1 && j > 1) j--;
    }

    //printf("%d %d %d %d\n", dp[0][0], dp[0][3], dp[0][1], dp[0][2]);
    /*int ans = 0;
    if (dp[0][0] > x-1) ans++;
    if (dp[0][3] > a-x) ans++;
    if (dp[0][1] > y-1) ans++;
    if (dp[0][2] > b-y) ans++;*/

    if (ans)
        printf("NO\n");
    else
        printf("YES\n");
    return 0;
}


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

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if ((A - 1) / D >= (C - 1) / B){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    ll a; int b1,b2;
    scanf("%lld %d.%d",&a,&b1,&b2);
    ll b=b1*100+b2;
    ll ans=a*b/100;
    cout<<ans<<endl;
}



























Measured memory_bytes: 3764
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> m = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
string getMax(string a, string b)
{
    if(a.size()>b.size()) return a;
    else if(a.size()<b.size()) return b;
    return max(a,b);
}
int main()
{
    int N, M;
    scanf("%d%d",&N,&M);
    vector<int> A(M, 0);
    for(int i=0;i<M;i++)
        scanf("%d",&A[i]);
    sort(A.begin(), A.end(), greater<int>());
    vector<string> dp(max(N+1,10), "");
    for(int i=0;i<M;i++)
        dp[m[A[i]]] = getMax(dp[m[A[i]]],to_string(A[i]));
    for(int j=0;j<=N;j++)
        for(int i=0;i<M;i++)
            if(j-m[A[i]]>=0&&dp[j-m[A[i]]]!="")
                dp[j]=getMax(dp[j], dp[j-m[A[i]]]+to_string(A[i]));
    cout<<dp[N]<<endl;
}


Measured memory_bytes: 32896
#include<cstdio>
#include<set>
using namespace std;
int main()
{
	set<int> st;
	int n,x;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d",&x);
		if(st.count(x)==0)
			st.insert(x);
		else st.erase(x);
	}
	printf("%d\n",st.size());
	return 0;
}


Measured memory_bytes: 4864
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll N=1e5+10,M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
const int INF=1e9+7;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}

#define trace(...) cerr<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma=strchr(names+1,',');
    cerr.write(names,comma-names)<<" : "<<arg1<<" | ";
    __f(comma+1,args...);
}

int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    cout << (n*(n-1))/2;
    return 0;
}

Measured memory_bytes: 256
import Control.Monad

main = do
  n <- readLn
  unless (n==0) $ do
    print $ sum.take n $ primes
    main

primes :: [Int]
primes = 2 : filter isPrime [3,5..]
isPrime :: Int -> Bool
isPrime n = foldr ((&&).(/= 0).mod n) True $ takeWhile (<=sqrtn) primes
  where sqrtn = floor.sqrt.fromIntegral $ n

Measured memory_bytes: 6652
#include <bits/stdc++.h>
#define all(x) (x).begin() , (x).end()
#define rall(x) (x).rbegin() , (x).rend()

using namespace std;



long long dist(long long x , long long y){
	return x * x  + y * y;
}

int main(){
	// freopen("input.text" , "r" , stdin);
	// freopen("output.text" , "w" , stdout);
	int k ; cin >> k;
	if(k % 2 == 0 || k % 5 == 0){
		cout << -1 << "\n";
		return 0;
	}
	int val = 7 % k;
	for(int i = 1 ; i <= 1e6; ++i){
		if(val % k == 0){
			cout << i << "\n";
			return 0;
		}
		val = ((val * 10 + 7)) % k;
		// cout << val << endl;
	}
	cout << -1 << "\n";
	return 0;
}

Measured memory_bytes: 3608
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
void Solve()
{
    int a1,a2,a3;
    scanf("%d%d%d",&a1,&a2,&a3);
    if(a1+a2+a3>=22) printf("bust");
    else printf("win");
}
int main()
{
    Solve();
    return 0;
}

Measured memory_bytes: 256
x = int(input())
rank = {
    600: 8,
    800: 7,
    1000: 6,
    1200: 5,
    1400: 4,
    1600: 3,
    1800: 2,
    2000: 1
}

for p, r in rank.items():
    if p-200 <= x < p:
        print(r)

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

	int x, y;

	while (1){

		cin >> x >> y;

		if (x == 0 && y == 0){
			break;
		}

		if (x >= y){
			cout << y <<" "<< x << endl;
		}

		else{
			cout << x <<" "<< y << endl;
		}
	}


	return 0;
}

Measured memory_bytes: 2964
#include <stdio.h>
int main(void){
  int x1, y1;
  int x2, y2;
  int x3, y3;
  int x4, y4;
  int xdiff, ydiff;
  scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
  xdiff = x2-x1;
  ydiff = y2-y1;
  x3 = x2-ydiff;
  y3 = y2+xdiff;
  x4 = x1-ydiff;
  y4 = y1+xdiff;
  printf("%d %d %d %d", x3, y3, x4, y4);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N;
	cin >> N;
	int A[100000];
	ll sa = 0;
	rep(i, N) cin >> A[i];
	rep(i, N) {
		int b;
		cin >> b;
		if (A[i] >= b) sa -= A[i] - b;
		else sa += (b - A[i]) / 2;
	}
	if (sa >= 0) co("Yes");
	else co("No");

	Would you please return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
#define inf -999999999
int main()
{	
	int n,i;
	string a,b;
	cin>>n>>a>>b;
	for(i=0;i<n;i++)
	{
		cout<<a[i]<<b[i];
	}
	

	
		
}


Measured memory_bytes: 256
import math
import numpy as np
from collections import deque
def main():
    a_1 = [int(t)for t in input().split()]
    a_2 = [int(t)for t in input().split()]
    a_3 = [int(t)for t in input().split()]

    a = [a_1,a_2,a_3]

    card = np.array(a)

    n = int(input())

    b = [int(input())for _ in range(n)]

    result = np.zeros((3,3),np.int)!=0

    for i in b:
        t = card==i
        result |= t

    rest = result.T
    c = result[0].all() or result[1].all() or result[2].all()
    r = rest[0].all() or rest[1].all() or rest[2].all()

    sl = result[0][0] and result[1][1] and result[2][2]
    bs = result[2][0] and result[1][1] and result[0][2]

    print("Yes" if c or r or sl or bs else "No")
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 12260
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;cin>>N;
  int P[N],dp[N+1];
  FOR(i,0,N)cin>>P[i];
  CLR(dp);
  int mx = 0;
  FOR(i,0,N){
    dp[P[i]] = dp[P[i]-1] + 1;
    mx = max(mx, dp[P[i]]);
  }
  cout<<N-mx<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#define ll long long
using namespace std;
inline ll read()
{
	ll f = 1, x = 0;
	char ch;

	do{
		ch = getchar();
		if (ch == '-')
			f = -1;
	}while(ch < '0' || ch > '9');
	do{
		x = x * 10 + ch - '0';
		ch = getchar();
	}while(ch >= '0' && ch <= '9');
	return f * x;
}
const int N = 1e5;

int n, q, top;
ll st[N + 2], f[N + 2], sum[N + 1];

inline void solve(ll x, ll y)
{
	if (!x)
		return;
	int w = upper_bound(st + 1, st + 1 + top, x) - st - 1;
	if (!w) {
		sum[1] += y;
		sum[x + 1] -= y;
	} else {
		f[w] += x / st[w] * y;
		solve(x % st[w], y);
	}
	return;
}
int main()
{
	n = st[++top] = read();
	q = read();

	for (int i = 1; i <= q; i++) {
		ll x = read();
		while (x <= st[top])
			top--;
		st[++top] = x;
	}
	f[top] = 1;
	for (int i = top - 1; i >= 1; i--) {
		f[i] += st[i + 1] / st[i] * f[i + 1];
		solve(st[i + 1] % st[i], f[i + 1]);
	}
	sum[1] += f[1];
	sum[st[1] + 1] -= f[1];

	for (int i = 1; i <= n; i++) {
		sum[i] += sum[i - 1];
		printf("%lld\n", sum[i]);
	}
	return 0;
}


Measured memory_bytes: 6060
//
//  main.cpp
//  atcoder-permutations
//
//  Created by r on 6/7/19.
//  Copyright © 2019 r. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <assert.h>
#include <limits>
#include <cstdio>
using namespace std;

//#define RDEBUG 1
#ifdef RDEBUG
#define D(x) x
#else
#define D(x)
#endif
#define inf 0x7fffffff
#define MOD 1000000007

long long add(long long a, long long b) {
    a += b;
    if(a >= MOD) {
        a -= MOD;
    }
    return a;
}
long long sub(long long a, long long b) {
    a -= b;
    if(a < 0) {
        a += MOD;
    }
    return a;
}
void add_self(long long& a, long long b) {
    a = add(a, b);
}
void sub_self(long long& a, long long b) {
    a = sub(a, b);
}

int N;
char cs[3010];
long long pref[3010][2];
long long dp[3010][3010];

int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N;
    for (int i = 1; i<N; i++) {
        cin >> cs[i];
    }
    dp[0][1] = 1;
    pref[1][0] = 1;
    for (int i = 1; i<N; i++) {
        long long currsum = 0;
        for (int j = 1; j<=i+1; j++) {
            if (cs[i] == '<') {
                add_self(dp[i][j], pref[j-1][0]);
                add_self(currsum, dp[i][j]);
                pref[j][1] = currsum;
            } else {
                add_self(dp[i][j], sub(pref[i][0],pref[j-1][0]));
                add_self(currsum, dp[i][j]);
                pref[j][1] = currsum;
            }
        }
        for (int j = 1; j<=N; j++) {
            pref[j][0] = pref[j][1];
        }
    }
    long long ans = 0;
    for (int i = 1; i<=N; i++) {
        add_self(ans, dp[N-1][i]);
    }
    cout << ans << endl;
    return 0;
}





Measured memory_bytes: 69248
N,M=map(int,input().split())
f=set()
t=set()
for i in range(M):
  a,b=map(int,input().split())
  if a<2:
    f.add(b)
  elif b==N:
    t.add(a)
print(("IM","")[len(f&t)]+"POSSIBLE")

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const long long INF = 2e18;
const long long MOD = 1e9+7;

#define sx(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i < n; i++)
#define ALL(a) begin(a),end(a)

int main(void) {
    ll N;
    cin >> N;
    ll ok = 1e9+10;
    ll ng = -1;
    while(abs(ok-ng) > 1) {
        ll mid = (ok+ng)/2;
        if (mid*(mid+1)/2 >= N) {
            ok = mid;
        }
        else {
            ng = mid;
        }
    }
    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

n, m = list(map(int, input().split()))
mid_set1 = set([])
mid_set2 = set([])

for i in range(m):
    a, b = list(map(int, input().split()))
    if a == 1:
        mid_set1.add(b)
    elif b == n:
        mid_set2.add(a)

if len(mid_set1&mid_set2) > 0:
    print('POSSIBLE')
    sys.exit()
print('IMPOSSIBLE')


Measured memory_bytes: 18996
#include <bits/stdc++.h>
using namespace std;
int arr[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main()
{
    int k;
    cin >> k;
    cout << arr[k - 1];
    return 0;
}


Measured memory_bytes: 256