akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() /4;
const ll linf = numeric_limits<ll>::max() /4;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

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

ll dp[100] = {};

ll dfs(int n){
    if(dp[n] != 0)ret dp[n];
    ret dp[n] = dfs(n-1) + dfs(n-2);
}

int main(){
    int n;
    cin >> n;
    dp[0] = 2;dp[1]=1;
    P(dfs(n));
	return  0;
}

Measured memory_bytes: 384
//============================================================================
// Name        : atcoderC++.cpp
// Author      : ������
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
int n;
  cin >> n;
vector<int> p(n),q(n);
rep(i,n) cin >> p[i];
rep(i,n) cin >> q[i];

vector<int> a(n);
rep(i,n) a[i] = i+1;

map<vector<int>,int> mp;
do{
	mp[a] = mp.size();
}while(next_permutation(a.begin(),a.end()));

int ans = abs(mp[p] - mp[q]);
cout<<ans<<endl;
	return 0;
}


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

int main(){
	ll A, B, M; cin >> A >> B >> M;
	ll a[A], b[B];
	rep(i, A) cin >> a[i];
	rep(i, B) cin >> b[i];
	ll ans = 1e9;
	rep(i, M){
		ll x, y, c; cin >> x >> y >> c;
		x--; y--;
		if(ans > a[x] + b[y] - c) ans = a[x] + b[y] - c;
	}
	ll m1 = 1e9, m2 = 1e9;
	rep(i, A){
		if(m1 > a[i]) m1 = a[i];
	}
	rep(i, B){
		if(m2 > b[i]) m2 = b[i];
	}
	if(ans > m1 + m2) ans = m1 + m2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main(){
  int n,k,x,y,sum;
  scanf("%d\n%d\n%d\n%d\n",&n,&k,&x,&y);
  if(n>k){
     sum=(x*k)+y*(n-k);
  }
  else{
    sum = n*x;
  }
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 1688
object App {
    private val outputBuffer = mutableListOf<Any>()

    private var i = 0
    private var inputBuffer = listOf<String>()

    fun next(): String = if (i < inputBuffer.size) {
        inputBuffer[i++]
    } else {
        inputBuffer = readLine()?.split(" ") ?: throw Exception("EOF")
        i = 0
        next()
    }

    fun int() = next().toInt()

    fun long() = next().toLong()

    fun double() = next().toDouble()

    fun writeln(obj: Any) = write("$obj\n")

    fun write(obj: Any) = outputBuffer.add(obj)

    fun writes(l: Iterable<Any>, sep: String = " ") = write(l.joinToString(sep))

    fun writeln(l: Iterable<Any>, sep: String = " ") = writeln(l.joinToString(sep))

    fun flush() {
        print(outputBuffer.joinToString(""))
        outputBuffer.clear()
    }
}


inline fun app(body: App.() -> Unit) {
    try {
        App.body()
    }
    finally {
        App.flush()
    }
}


fun main(args: Array<String>) = app {
    val n = long()
    val k = long()

    println(Math.min(n%k, k-n%k))
}

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

bool chk(string s){
    int n = s.size();
    if(n%2 != 0) return false;
    return (s.substr(0,n/2) == s.substr(n/2));
}

int main(){
    string s;
    cin >> s;
    for(int i = s.size()-1;;i--){
        if(chk(s.substr(0,i))){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

ll dp[101][5][2];  // dp[i][j][k]: i桁目までで0でない数字がj個あって(k ? N未満 : Nと同じ)通り数

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    int K;
    cin >> S >> K;
    int N = (int)S.size();
    dp[0][0][0] = 1;
    rep(i, 0, N) rep(j, 0, K + 1) rep(k, 0, 2) {
        int D = (int)(S[i] - '0') + 1;
        if (k) {
            D = 10;
        }
        rep(d, 0, D) {
            dp[i + 1][j + (int)(d != 0)][k || (d + 1 < D)] += dp[i][j][k];
        }
    }
    cout << dp[N][K][0] + dp[N][K][1] << endl;
    return 0;
}

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

using namespace std;

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    if (s[k-1] == 'A')
        s[k-1] = 'a';
    if (s[k-1] == 'B')
        s[k-1] = 'b';
    if (s[k-1] == 'C')
        s[k-1] = 'c';
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
def main():
	while(1):

		a = int(input())
		if a == 0:
			break

		b = list(map(int, input().split()))
		mean = sum(b)/a
		count=0
		for i in range(a):
			if mean>= b[i]:
				count+=1
		print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 6620
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  int ans;
  int c;
  if(a==b) ans=a*2;
  else {c=max(a,b);ans=c+c-1;}

  cout << ans << endl;




}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
int num_visited=0;
vector<int> G[300000];
vector<int> C[300000];
int visit[300000] = {};
int cnt[300000]={};
//親子関係把握 O(N);
void SearchC(int now){
    visit[now] = 1;
    for(unsigned int i=0;i<G[now].size();i++){
        if(!visit[G[now][i]]){
            C[now].push_back(G[now][i]); //訪ねたことがない=子なので追加
            SearchC(G[now][i]);
        }
    }
}
void dfs(int now){
    //cout <<"called dfs(" <<now<<","<<plus<<")"<<endl;
    //cnt[now] += plus;
    for(unsigned int i=0;i<C[now].size();i++){
        //cout <<G[now].size()<<endl;
        cnt[C[now][i]] += cnt[now];
        dfs(C[now][i]);
    }

}
int main(){
    int n,q;
    cin >> n>>q;
    vector<int> a(n),b(n);
    rep(i,n-1){
        cin >> a[i]>>b[i];
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    SearchC(1);
    vector<int> p(q),x(q);
    rep(i,q){
        cin >> p[i]>>x[i];

    }
    /*
    for(int i=1;i<=n;i++){
        cout << "G[" <<i <<"]={";
        for(unsigned int j=0;j<G[i].size();j++){
            cout<<G[i][j]<<" ";
        }
        cout<<"}"<<endl;
    }
    */
    for(int i=0;i<q;i++){
        //dfs(p[i],x[i]);
        cnt[p[i]] += x[i];
    }
    dfs(1);
    for(int i=1;i<=n;i++){
        cout << cnt[i]<<" ";
    }
}

Measured memory_bytes: 43392
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int len = Integer.parseInt(scanner.nextLine());
        String inputs[] = scanner.nextLine().split(" ", -1);

        int numbers[] = new int[len];
        for (int i = 0; i < len; i++) {
            numbers[i] = Integer.parseInt(inputs[i]);
        }

        new Main().insertionSort(numbers, len);
    }

    private void insertionSort(int numbers[], int len) {
        for (int i = 0; i < len; i++) {
            int v = numbers[i];
            int j = i - 1;
            while (j >= 0 && numbers[j] > v) {
                numbers[j + 1] = numbers[j];
                j--;
            }
            numbers[j + 1] = v;

            for (j = 0; j < len; j++) {
                System.out.print(numbers[j]);
                if (j == len - 1) {
                    System.out.print("\n");
                } else {
                    System.out.print(" ");
                }
            }
        }
    }
}



Measured memory_bytes: 34780
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var N, i int
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d %d", &N, &i)

	fmt.Println(N - i + 1)
}


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

int main(void)
{
    long long int a=0,b,c,d,i,j,k,n;
    string s;
    char C[5];

    cin >> s;
    for(i=0;i<3;i++){
        if(s.at(i)=='1') a++;
    }
    cout << a;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;	// n = 入力
  int a, b, c, d; // a = 千, b = 百, c = 十, d = 一
  cin >> n;
  a = n / 1000;
  b = ( n - a * 1000 ) / 100;
  c = ( n - a * 1000 - b * 100) /10;
  d = ( n - a * 1000 - b * 100 - c * 10);
  if((a == b && b == c) || (b == c && c == d)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
N = [0] * (n+1)
for i in range(1, n+1):
    N[i] += N[i-1] + a[i-1]

Max = N[-1]
ans = float("INF")
for i in range(1, n):
    if abs(N[i] - (Max-N[i])) < ans:
        ans =  abs(N[i] - (Max-N[i]))
print(ans)

Measured memory_bytes: 24812
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DCaracalVsMonster solver = new DCaracalVsMonster();
        solver.solve(1, in, out);
        out.close();
    }

    static class DCaracalVsMonster {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long h = in.nextLong();
            long ans = 0;
            long temp = 1;
            while (h > 0) {
                h = h / 2;
                ans += temp;
                temp = temp << 1;
            }
            out.println(ans);

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 22228
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int x;
    cin >> x;
    cout << 10 - x / 200 << endl;
    return 0;
}

Measured memory_bytes: 3548
N,M = map(int, input().split())
switch_inf = []
for i in range(M):
    temp  = list(map(int, input().split()))
    switch_inf.append(temp)
p = list(map(int, input().split()))

res = 0
for i in range(2**N):#bit全探索開始
    switch = [0]*N
    for j in range(N):
        if (i >> j) & 1:
            switch[j] = 1
    light_cnt = 0 #点灯しているライトの数
    for j in range(M): #スイッチの情報から転倒するものを探索
        cnt = 0 #ライト_jにおいて押されているスイッチの数
        for k in range(1,switch_inf[j][0]+1):
            if switch[switch_inf[j][k]-1]:
                cnt += 1
        if cnt%2 == p[j]:
            light_cnt += 1
    if light_cnt == M:
        res += 1
print(res)

Measured memory_bytes: 42480
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <iterator>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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

typedef long long ll;
typedef pair<ll, ll> p;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint dp[1000010][2][2];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  mint n;
  cin >> n.x;

  for (int i = 0; i < 1000010; ++i) {
    for (int j = 0; j < 2; ++j) {
      dp[i][j][0] = 0;
      dp[i][j][1] = 0;
    }
  }
  dp[1][0][0] = 8;
  dp[1][1][0] = 1;
  dp[1][0][1] = 1;
  dp[1][1][1] = 0;

  for (int i = 2; i < 1000010; ++i) {
    dp[i][0][0] = dp[i-1][0][0] * 8;
    dp[i][1][1] = dp[i-1][0][1] + dp[i-1][1][0] + dp[i-1][1][1] * 10;
    dp[i][0][1] = dp[i-1][0][0] + dp[i-1][0][1] * 9;
    dp[i][1][0] = dp[i-1][0][0] + dp[i-1][0][1] * 9;
  }

  cout << dp[n.x][1][1].x << endl;

  // rep(i, 10){
  //   rep(j, 2){
  //     cout << dp[i][j][0] << ' ' << dp[i][j][1] << endl;
  //   }
  // }

}


Measured memory_bytes: 34892
import scala.io.StdIn.readLine

object Main {
  def main(args: Array[String]) {
    def printFrame: Unit = {
      val Array(a, b) = readLine().split(" ").map(_.toInt)
      if(a != 0 && b != 0) {
        for(i <- 1 to a) {
          if(i == 1 || i == a) println("#" * b)
          else println("#" + "." * (b - 2) + "#")
        }
        println()
        printFrame
      }
    }

    printFrame
  }
}

Measured memory_bytes: 45276
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define MOD2 100000000
#define ll long long
#define cnl(d) cout<<d<<'\n'
#define cns(d) cout<<d<<' '
#define endl '\n'
#define cno cout<<"NO\n"
#define cyes cout<<"YES\n"
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define pl pair<ll,ll>
#define vll vector<pl>
#define sl set<ll>
#define sll set<pl>
#define msl map<string,ll>
#define mll map<ll,ll>
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(a);i<=(b);i++)
#define rdp(i,a,b) for(i=(a);i>=(b);i--)
#define lb(v,z) lower_bound(all(v),z)
#define ub(v,z) upper_bound(all(v),z)
#define trvl(c,it) for(vl::iterator it=(c).begin();it!=(c).end();it++)
#define trvll(c,it) for(vll::iterator it=(c).begin();it!=(c).end();it++)
#define trsll(c,it) for(sll::iterator it=(c).begin();it!=(c).end();it++)
#define trmsl(c,it) for(msl::iterator it=(c).begin();it!=(c).end();it++)
#define trmll(c,it) for(mll::iterator it=(c).begin();it!=(c).end();it++)
#define trsl(c,it) for(sl::iterator it=(c).begin();it!=(c).end();it++)
#define trsi(c,it) for(set<int>::iterator it=(c).begin();it!=(c).end();it++)

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   ll n,a,b;
   cin>>a>>b;
   for(ll i=1;i<=3;i++)
   {
       n=a*b*i;
       if(n%2){cout<<"Yes\n";return 0;}
   }
    cout<<"No\n";
}


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

int main() {
  int N, K; cin >> N >> K;
  vector<int> A(N);
  for (auto& a: A) cin >> a;
  for (int i = 0; i < K; i++) {
    vector<int> B(N+1);
    for (int j = 0; j < N; j++) {
      B[max(j - A[j], 0)]++;
      B[min(j + A[j] + 1, N)]--;
    }
    for (int j = 1; j <= N; j++) {
      B[j] += B[j-1];
    }
    B.pop_back();
    swap(A, B);
    if (*min_element(A.begin(), A.end()) == N) break;
  }
  for (int i = 0; i < N; i++) {
    cout << A[i] << " \n"[i==N-1];
  }
}


Measured memory_bytes: 5176
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

def sieve(n):
    count = [1 for i in range(n+1)]
    count[0] = 0

    for i in range(1, n+1):
        j = 2 * i
        while j <= n:
            count[j] += 1
            j += i
    return count

N = ii()
l = sieve(N)

print(sum([l[i] * i for i in range(1, N+1)]))

Measured memory_bytes: 385124
n,x = map(int,input().split())
a = list((map(int,input().split())))

b = [0]
for i in range(n):
    b.append(a[i])
b.append(0)    
counter = 0

if b[1] > x:
    counter = b[1] - x
    b[1] = x
for i in range(n+1):
    if b[i] + b[i+1] > x:
        s = b[i] + b[i+1] - x
        if b[i+1] - s > -1:
            b[i+1] = b[i+1] -s
            counter = counter + s
        else:
            k = b[i+1]
            counter = counter + s
            b[i+1] = 0
            b[i] = x
        
print(counter)

Measured memory_bytes: 14812
import numpy as np
n = int(input())
a = np.sort(np.array(list(map(int, input().split()))))
max_num = a[-1]+1
dp = np.array([0]*(max_num))

if np.count_nonzero(a==1)  >= 1:
    if np.count_nonzero(a==1)  >1:
        print(0)
    else:
        print(1)
else:
    for i in a:
        for j in np.arange(i, max_num, i):
            dp[j] += 1
    print(np.count_nonzero(dp[a] == 1))

Measured memory_bytes: 51324
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;
const int MOD = 1e9+7;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//C++17以上
template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main() {
    int n,w;
    cin >> n >> w;
    vector<ll> weight(110);
    vector<ll> value(110);
    rep(i,n)cin >> weight[i] >> value[i];
    vector<vector<ll>> dp(n+1,vector<ll>(w+1));
    for(int i=0;i<n;i++){
        for(int sum_w=0;sum_w<=w;sum_w++){
            if(sum_w - weight[i]>=0){
                chmax(dp[i+1][sum_w],dp[i][sum_w - weight[i]] + value[i]);
            }
            chmax(dp[i+1][sum_w],dp[i][sum_w]);
        }
    }
   cout << dp[n][w] << endl;
    return 0;
}


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

int main(void)
{
	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;

typedef long long ll;
const ll INF = 1LL<<60, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(v) (v).begin(), (v).end()
#define first fi
#define second se

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll c,a;
  cin >> c >> a;
  if(c<a) cout << 0 << endl;
  else cout << 10 << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		for(;cin.hasNext();){
			int[] array=new int[10001];
			int a=cin.nextInt();
			int b=cin.nextInt();
			int c=cin.nextInt();
			a = a%b;
			a*=10;
			for(int i=0;i<10001;i++){
				array[i]=a/b;
				a=(a%b)*10;
			}
			int ans=0;
			for(int i=0;i<c;i++){
				ans+=array[i];
			}
			System.out.println(ans);
		}
	}

}

Measured memory_bytes: 23508
// -*- coding:utf-8-unix -*-

use proconio::input;
use proconio::marker::Chars;
use std::iter::FromIterator;
use std::collections::VecDeque;

fn print_vec(v: &Vec<char>, b: bool) {
    if b { println!("{}", String::from_iter(v)); }
    else { print!("{}", String::from_iter(v)); }
}

fn print_vec_range(v: &Vec<char>, s: usize, t: usize, b: bool) {
    for i in s..t {
        print!("{}", v[i]);
    }
    if b { print!("\n"); }
}

fn main() {
    input! {
        n: usize, m: usize
    }
    let mut g = vec![vec![]; n];
    for i in 0..n {
        g[i] = Vec::new();
    }
    for _ in 0..m {
        input! {
            mut a: usize, mut b: usize
        }
        g[a-1].push(b-1);
        g[b-1].push(a-1);
    }
    let mut q = VecDeque::new();
    let mut checked = vec![false; n];
    let mut ans = vec![0; n];
    q.push_front(0);
    checked[0] = true;
    while q.len() > 0 {
        let b = q.pop_back().unwrap();
        for i in &g[b] {
            if !checked[*i] {
                ans[*i] = b;
                q.push_front(*i);
                checked[*i] = true;
            }
        }
    }
    println!("Yes");
    for i in 1..n {
        println!("{}", ans[i]+1);
    }
}


Measured memory_bytes: 14312
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
const ll MOD = 1000000007;
long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}

int K;
int main(){
    cin >> K;
    if(K%2==0){
        cout << -1 << endl;
        return 0;
    }
    int tmp = 0;
    int sur = 0;
    int counter = 1;

    while(1) {
        tmp += 7;
        sur = tmp%K;
        if(sur == 0)break;
        tmp = sur * 10;
        counter++;
        if(counter > 50000000){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 3656
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N):
    n = N - 1
    print((n + 1) * n // 2)


if __name__ == '__main__':
    # S = input()
    N = int(input())
    # N, M = map(int, input().split())
    # As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N)


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

int main(){

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

    if( a >= 13 ){
        cout << b << endl;
    }
    else if(a >= 6){
        cout << b/2 << endl;
    }
    else{
        cout << 0 << endl;
    }

    return 0;
}

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

using namespace std;

#define rep(i, a, n) for (int i = a, _n = n; i <= _n; ++i)
#define drep(i, a, n) for (int i = a, _n = n; i >= _n; --i)
#define debug(x) cout << #x << " = " << x << endl

const int N = 65000;
const int Mod = 1e9 + 7;

int n, k;
int L[N], R[N], Cnt[N];

long long dp[105][N];
int main () {
	scanf ("%d%d", &n, &k);
	swap(n, k);
	int y = 1, cnt = 0;
	while (y <= k) {
		int t = k / y;
		int c = k / t;
		L[++cnt] = y, R[cnt] = c;
		y = c + 1;
	}
	rep (i, 1, cnt) dp[1][i] = Cnt[i] = R[i] - L[i] + 1;
	rep (i, 2, n) {
		long long Sum = 0;
		rep (j, 1, cnt) {
			(Sum += dp[i - 1][j]) %= Mod;
			dp[i][cnt - j + 1] = Sum * Cnt[cnt - j + 1] % Mod;
		}
	}
	long long Ans = 0;
	rep (i, 1, cnt) (Ans += dp[n][i]) %= Mod;
	cout << Ans << endl;
	return 0;
}


Measured memory_bytes: 53760
use std::io;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let s:Vec<char> = buf.trim().chars().collect();
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let t:Vec<char> = buf.trim().chars().collect();
	let mut flag = false;
	
	for i in 0..s.len() {
		let s1 = &s[(s.len() - i - 1)..s.len()];
		let s2 = &s[0..(s.len() - i -1)];
		let t1 = &t[0..(i + 1)];
		let t2 = &t[(i + 1)..t.len()];
		if s1 == t1 && s2 == t2 {
			flag = true;
			break;
		}
	}
	if flag {
		println!("Yes");
	}else{
		println!("No");
	}
}

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define Nmax 300000 

typedef long long ll;

const ll mod = 1e9+7;
const double pi = acos(-1);

int n,i,j,k,t,m;
int a[200002];
int lis[200002];

int main(){
	scanf("%d", &n);
	for(i=0;i<n;++i){
		scanf("%d", a+i);
	}
	int c=0, d=0;
	int now = n;
	for(i=n-1;i>=0;--i){
		if(a[i]==now){
			c++;
			now--;
		}
	}
	c = n-c;
	now = 1;
	for(i=0;i<n;++i){
		if(a[i]==now){
			d++;
			now++;
		}
	}
	memset(lis, 0, sizeof lis);
	for(i=0;i<n;++i){
		lis[a[i]] = 1 + lis[a[i]-1];
	}
	d = n-d;
	printf("%d\n", min(min(c,d), n-*max_element(lis, lis+n)));
	return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<math.h>
int main(void)
{
    int a,b,c,d,e;
    scanf("%d%d",&a,&b);
    c=b;
    while(c/10!=0){
        a=a*10;
        c=c/10;
    }
    d=a*10+b;
    e=d/sqrt(d);
    if(e==sqrt(d))
        printf("Yes\n");
    else 
        printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for1(i, a, b) for (int i = (int)a; i < (int)(b); ++i)
#define rfor1(i, a, b) for (int i=(int)b-1;i>=(int)a;i--)
#define for2(i, a, b) for (int i = (int)a; i <= (int)(b); ++i)
#define for3(i, a, b) for (int i = (int)a; i < (int)(b); i=i+2)
#define for4(i, a, b) for (int i = (int)a; i <= (int)(b); i=i+2)
#define tc(t) int t; cin>>t; while(t--)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
//==================================================================//

int main() {
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
//=================================================================//
	int d; cin >> d;
	if (d == 25) cout << "Christmas" << endl;
	else if (d == 24) cout << "Christmas Eve " << endl;
	else if (d == 23) cout << "Christmas Eve Eve " << endl;
	else {
		cout << "Christmas Eve Eve Eve" << endl;
	}
}








Measured memory_bytes: 3640
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

char s[100005];
int a[100005];

int main()
{
	int k,l=0;
	scanf("%s",s);
	k=strlen(s);
	for(int i=0; i<k-1; i++)
	{
		if(s[i]!=s[i+1])
		{
			l+=1;
		}
//		if(s[i]=='W')
//		{
//			a[i]=1;
//		}
//		if(s[i]=='B')
//		{
//			a[i]=0;
//		}
	}
//	l=0;
//	for(int i=0; i<k-1; i++)
//	{
//		if(a[i]!=a[i+1])
//		{
//			l++;
//		}
//	}
	printf("%d\n",l);
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long long ret[110];
int main(){
	long long a;scanf("%lld",&a);
	for(int i=0;i<50;i++){
		ret[i]=49+a/50;
		if(i<a%50)ret[i]+=51-(a%50);
		else ret[i]-=a%50;
	}
	printf("50\n");
	for(int i=0;i<50;i++){
		if(i)printf(" ");
		printf("%lld",ret[i]);
	}printf("\n");
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	string s; cin>>s;
	if( s[2]==s[3] && s[4]==s[5] ) cout<<"Yes";
	else cout<<"No";
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N = sc.nextInt();
		int M = sc.nextInt();
		double[] L = new double[N];
		double[] a = new double[N];
		double[] b = new double[N];
		for (int i = 0; i < N; ++i) {
			L[i] = sc.nextDouble();
			a[i] = sc.nextDouble();
			b[i] = sc.nextDouble();
		}
		double[][] dist = new double[N][N];
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < i; ++j) {
				dist[i][j] = dist[j][i] = sq(L[i] - L[j]) + sq(a[i] - a[j]) + sq(b[i] - b[j]);
			}
		}
		double ans = 0;
		for (int i = 1; i < (1 << N); ++i) {
			if (Integer.bitCount(i) != M) continue;
			double sum = 0;
			for (int j = 0; j < N; ++j) {
				if ((i & (1 << j)) == 0) continue;
				for (int k = 0; k < j; ++k) {
					if ((i & (1 << k)) == 0) continue;
					sum += dist[j][k];
				}
			}
			ans = Math.max(ans, sum);
		}
		System.out.println(ans);
	}

	static double sq(double v) {
		return v * v;
	}
}

Measured memory_bytes: 20868
K, S = [int(i) for i in input().split()]
c = 0
for x in range(K+1):
    for y in range(x+1):
        z = S - x - y
        if x >= y >= z >= 0:
            if len({x, y, z}) == 3:
                c += 6
            if len({x, y, z}) == 2:
                c += 3
            if len({x, y, z}) == 1:
                c += 1
print(c)

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int a, b, c;
    cin >> a >> b >> c;

    if(a+b+c<22) cout << "win" << endl;
    else cout << "bust" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <iostream>
using namespace std;
#define lson l,(l+r)/2,rt<<1
#define rson (l+r)/2+1,r,rt<<1|1
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define pb push_back
#define fi first
#define se second
#define ll long long
#define sz(x) (int)(x).size()
const int mxn=1e5+10;
int b[mxn];
int cnt[16];
int a[20];
int sz=0;
int dp[mxn];
bool check(int mask){
	int x=0;
	for(int i=0;i<sz;i++){
		if(mask &(1<<i))x^=a[i];
	}
	return x==0;
}
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int u,v,w;
		scanf("%d %d %d",&u,&v,&w);
		b[u]^=w;
		b[v]^=w;
	}
	for(int i=0;i<n;i++){
		cnt[b[i]]++;
	}
	int component=cnt[0];
	for(int i=1;i<16;i++){
		component+=cnt[i]/2;
		if(cnt[i]%2)a[sz++]=i;
	}
	int up=(1<<sz)-1;
	for(int i=1;i<=up;i++){
		for(int x=i;x;x=((x-1)&i)){
			if(check(x))dp[i]=max(dp[i],1+dp[x^i]);
		}
	}
	cout<<n-component-dp[up];
	return 0;
}

Measured memory_bytes: 768
#include<iostream>

using namespace std;

int main(void) {
  int n;
  cin >> n;
  int a[n];
  int mx = 0;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > mx) mx = a[i];
    sum += a[i];
  }

  if (sum - mx > mx) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

ll solve(ll X){
    ll ret = 0;
    ll base = 1;
    for(int b = 0; b < 60; b++){
        ll next = base * 2;
        ll n = 0;
        n += base * (X / next);
        ll r = X % next;
        n += max(0LL, r - base + 1);
        if(n%2)
            ret += 1LL << b;
        base = next;
    }
    return ret;
}

int main(){
    ll A, B;
    cin >> A >> B;
    ll a = solve(A-1);
    ll b = solve(B);
    ll ans = a ^ b;
    //cout << a << endl;
    //cout << b << endl;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

/* modとる */
inline ll modu(ll a){
    return(a % mod + mod) % mod;
}

/* modつき二項係数 前処理必要*/
const ll binomialmax = 510000;
ll fac[binomialmax], finv[binomialmax], inv[binomialmax];

void cominit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < binomialmax; i++){
        fac[i] = modu(fac[i - 1] * i);
        inv[i] = modu(-inv[mod%i] * (mod / i));
        finv[i] = modu(finv[i - 1] * inv[i]);
    }
}

/* 二項係数計算 */
ll com(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return modu(fac[n] * (modu(finv[k] * finv[n - k])));
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll answer = 0;
    cominit();
    int H = in(),W = in(), A = in(), B = in();
    for(int i = B+1;i <= W;i++){
        answer += modu(com(H-A-1+i-1,i-1) * com(A-1+W-i,A-1));
    }
    cout << modu(answer) << "\n";
}

Measured memory_bytes: 12160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int N;
string s;
int ans=0;
int main(void)
{
    cin >> N;
    cin >> s;
    for(int i=0;i<N;i++)
    {
        if(s[i]=='>') 
        {
            ans=N-i;
            break;
        }
    }
    for(int i=N-1;i>=0;i--)
    {
        if(s[i]=='<') 
        {
            ans=max(ans,i+1);
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3332
N = int(input())
a = list(map(int, input().split()))

ans = 0
while True:
    count = 0
    for i in range(N):
        if a[i] % 2 == 0:
            ans += 1
            a[i] //= 2
        else:
            count += 1
    if count == N:
        break
        
print(ans)

Measured memory_bytes: 4148
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(j, m) for (int j = 0; j <= (int)(m); j++)



int main(){

int n, q;
cin >> n >> q;

deque<pair<string,int>>a;

rep(i,n){
  string name;
  int time;
  pair<string,int>tmp;
  cin >> name >> time;
  tmp.first = name;
  tmp.second = time;
  a.push_back(tmp);
}

int head = 1;
int tail = n + 1;
int total = 0;//totaltime

//simulation
while(head < tail){

int c = min(a.front().second,q);
a.front().second -= c;
total += c;

if(a.front().second>0){
  a.push_back(a.front());
  a.pop_front();
}
else{
  cout << a.front().first << " "<< total << endl;
  tail--;
  a.pop_front();
}


}


return 0;

}


Measured memory_bytes: 6320
import java.io.*;
import java.util.Scanner;

class Main{
    public static void main(String args[]) throws IOException{
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        
        System.out.println(num/3600 + ":" + (num%3600)/60 + ":" + num%60);
        
    }
}


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

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

    int maxv = -2000000000;
    int minv = 2000000000;

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

        maxv = max(maxv, tmp - minv);
        minv = min(minv, tmp);
    }

    cout << maxv << endl;

    return 0;
}


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

int mod2(long int n){
	int o = 0;
	if(n%2){
		return o;
	}else{
		while((n%2) == 0){
			o++;
			n/=2;
		}
		return o;
	}
}

int main(){
	/*input*/
	int n;	cin >> n;
	vector<long int>a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	/*calculation*/
	int ans = 0;
	for(int i = 0; i < n; i++){
		ans += mod2(a[i]);
	}
	/*output*/
	cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i = (int)(n)-1; i>=0; --i)
#define For(i,a,b) for(auto i=(a);i<=(b);++i)
#define rFor(i,a,b) for(auto i=(b);i>=(a);--i)
#define call(var) cerr<<#var<<"="<<var<<"\n";
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const double pi = acos(-1);
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}
template<class T> istream& operator>>(istream& is, vector<T>& a){rep(i,a.size()) is >> a[i]; return is;}
template<class T> ostream& operator<<(ostream& os, vector<T>& a){rep(i,a.size()) os << a[i] << " "; return os;}
template<class T, class U> istream& operator>>(istream& is, pair<T,U>& p){is >> p.first >> p.second; return is;}
template<class T, class U> ostream& operator<<(ostream& os, const pair<T,U>& p){os << "("<< p.first << "," << p.second << ")"; return os;}
template<class T, class U> ostream& operator<<(ostream& os, const map<T,U>& mp){for(auto& t : mp) os << t.first << " " << t.second << "\n"; return os;}

int main(){
    ll a,v,b,w;cin >> a >> v >> b >> w;
    ll t;cin >> t;

    bool ok = false;
    if(a == b){
        ok = true;
    }else if(w >= v){
        ok = false;
    }else{
        ll di = v - w;
        if(di * t >= abs(a - b)){
            ok = true;
        }else{
            ok = false;
        }
    }
    cout << (ok? "YES\n" :"NO\n");
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,a,b,ma=0,mb=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		if(a>ma){
			ma=a;
			mb=b;
		}
	}
	cout<<ma+mb<<endl;
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    map<string, int> mp;
    rep(i, n){
        string s;
        cin >> s;
        mp[s]++;
    }
    int mx = 0;
    for(auto p: mp)mx = max(mx, p.second);
    for(auto p: mp){
        if(p.second != mx)continue;
        cout << p.first << endl;
    }
    return 0;
}

Measured memory_bytes: 25216
#include <stdio.h>

int main(void){
    int d;
    scanf("%d" ,&d);
    switch(d){
        case 25:
            printf("Christmas");
            break;
        case 24:
            printf("Christmas Eve");
            break;
        case 23:
            printf("Christmas Eve Eve");
            break;
        case 22:
            printf("Christmas Eve Eve Eve");
            break;
    }
    return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

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

	vector<string> v1(N), v2(M);
	for (int i = 0; i < N; i++) {
		cin >> v1.at(i);
	}
	for (int i = 0; i < M; i++) {
		cin >> v2.at(i);
	}

	bool b = false;
	for (int i = 0; i <= N - M; i++) {
		for (int j = 0; j <= N - M; j++) {
			string s = v1.at(i).substr(j, M);

			if (s==v2.at(0)) {
				int f = 1;
				for (int k = 1; k < M; k++) {
					s = v1.at(i+k).substr(j, M);
					if (s != v2.at(k)) {
						f = 0;
						break;
					}
				}

				if (f) {
					b = true;
					break;
				}
			}
		}

		if (b) break;
	}

	if (b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

//defines
typedef long long ll;

using namespace std;

double pi=1.57079632679489661923;
ll modu=1e9+7;

ll t=1,n=1,q;

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

    ll x,k,d;
    cin>>x>>k>>d; x=abs(x);

    ll ans=1e18;

    ll cur,mid,eve;

    mid = min(k,x/d);

    cur = x - mid*d;
    eve = (k-mid)%2;
    ans = min( ans , min( abs(cur - eve*d), abs(cur + eve*d)  ) );


    mid++; if(mid>k) mid--;

    cur = x - mid*d;
    eve = (k-mid)%2;

    ans = min( ans , min( abs(cur - eve*d), abs(cur + eve*d)  ) );

    cout<<ans<<endl;


}
/*
10
5 4
8 1 7 2
1 3
2 4
3 3
*/


Measured memory_bytes: 3552
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
    	x:chars,
        k:chars
    }
    let mut a:Vec<char> = Vec::new();
    for c in k {
    a.push(c);
    }
    for c in x {
    a.push(c);
    }
  println!("{}", a.into_iter().collect::<String>());
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int INF = 1001001001;
int dp[1000005][2];

int main(){
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    s += '0';
    int n = s.size();
    rep(i,n+1) rep(j,2) dp[i][j] = INF;
    dp[0][0] = 0;
    rep(i,n) rep(j,2){
        int x = s[i] - '0';
        x += j;
        rep(a, 10){
            int ni = i + 1, nj = 0;
            int b = a - x;
            if(b < 0){
                nj = 1;
                b += 10;
            }
            dp[ni][nj] = min(dp[ni][nj], dp[i][j] + a + b);
        }
    }
    int ans = dp[n][0];
    cout << ans << endl;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using li = __int128;
using uli = unsigned __int128;

#define fi first
#define se second

template <typename T> void s_min(T& a, T b) {
	if (a > b) a = b;
}

template <typename T> void s_max(T& a, T b) {
	if (a < b) a = b;
}

const int MAXN = 3005;
int N, a[MAXN];
ll dp[MAXN][MAXN][2];
bool vis[MAXN][MAXN][2];

ll rec(int l, int r, int t) {
	if (l > r) return 0;
	if (vis[l][r][t]) return dp[l][r][t];
	vis[l][r][t] = true;
	if (t == 0) return dp[l][r][t] = max(a[l] + rec(l + 1, r, 1), a[r] + rec(l, r - 1, 1));
	else return dp[l][r][t] = min(-a[l] + rec(l + 1, r, 0), -a[r] + rec(l, r - 1, 0));
}

int main() {
	ios_base::sync_with_stdio(0);

	cin >> N;
	for (int i = 0; i < N; i++) cin >> a[i];
	memset(vis, false, sizeof(vis));
	ll ans = rec(0, N - 1, 0);
	cout << ans;

	return 0;
}

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

int main() {
	int n,sum;
	cin >> n;
	vector<int> l(n);
	for (int i = 0; i < n; i++)
		cin >> l[i];
	sort(l.begin(), l.end());
	sum = accumulate(l.begin(), l.end(), 0) - l.back();
	if (sum > l.back())
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


Measured memory_bytes: 256
from collections import defaultdict

n = int(input())
d = defaultdict(int)
for _ in range(n):
    s = input()
    d[s] += 1
print('AC x '+str(d["AC"]))
print('WA x '+str(d["WA"]))
print('TLE x '+str(d["TLE"]))
print('RE x '+str(d["RE"]))


Measured memory_bytes: 9468