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

#define mk make_pair
#define pb push_back

typedef long long lld;
typedef pair<lld,lld> pr;
typedef priority_queue <lld> max_heap;
typedef priority_queue <lld, vector<lld>, greater<lld> > min_heap;
lld const mod = 1e9+7;

lld power(lld x, lld y)
{
    lld res = 1;
    while (y > 0) {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x * x;
    }
    return res;
}

lld power_mod(lld base, lld y)
{
    lld t = 1;
    while (y > 0)
    {

        if (y % 2 != 0)
            t = (t * base) % mod;
        base = (base * base) % mod;
        y /= 2;
    }
    return t % mod;
}

lld nCrModp(lld n, lld r, lld p)
{
    if (r > n - r)
        r = n - r;
    lld C[r + 1]={0};
    C[0] = 1;

    for (lld i = 1; i <= n; i++)
    {
      for (lld j = min(i, r); j > 0; j--)
      {
        C[j] = (C[j] + C[j - 1]) % p;

      }
    }
    return C[r];
}
// void makePrime(lld n)
// {
//   lld i=4;
//   for(i=2;i*i<=n;i++)
//   {
//     if(prime[i]==0)
//     {
//       for(lld j = i*i; j<=n;j+=i)
//       {
//         prime[j]=1;
//       }
//     }
//   }
//
// }


int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  lld n;
  cin>>n;
  // makePrime(n);
  lld prime[lld(1e6+5)]={0};
  lld a[n];
  lld i;
  for(i=0;i<n;i++)
  {
    cin>>a[i];
    // a[i].second = i;
  }
  sort(a,a+n);
  lld cnt = 0;
  for(i=0;i<n;i++)
  {

    if(prime[a[i]]==0)
    {
      if(i!=n-1 && a[i]==a[min(n-1,i+1)])
      {
        prime[a[i]]=1;
        for(lld j = a[i];j<=a[n-1];j = j + a[i])
        {
          prime[j]=1;
        }
        continue;
      }
      // cout<<a[i]<<endl;
      cnt++;
      for(lld j = a[i];j<=a[n-1];j = j + a[i])
      {
        prime[j]=1;
      }
    }
  }
  cout<<cnt<<endl;

}


Measured memory_bytes: 13036
#include<bits/stdc++.h>
#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define int long long
#define mp make_pair
#define fr(i,a,b) for(i=a;i<b;i++)
#define mod 1000000007
#define FILEIO freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
using namespace std;

signed main()
{
	//FILEIO
 	//start_routine
	
	int tests = 1;
	//cin>>tests;
	int n;
	cin>>n;
	int ans = 0;
	while(n)
	{
		if(n%10 == 2) ans++;
		n /= 10;
	}
	cout<<ans;
 	//end_routine
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e15;

#include <math.h>
#define PI 3.14159265358979323846264338327950L
const int mxN = 1e9 + 7;

int main() {
    long long a, b;
    cin >> a >> b;
    long long sum = a + b;
    if (sum % 2) {
        cout << "IMPOSSIBLE";
    }
    else {
        cout << sum / 2;
    }

    return 0;
}

Measured memory_bytes: 3552
/*
 * Author:  heyuhhh
 * Created Time:  2020/6/21 20:02:08
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <assert.h>
#include <functional>
#include <numeric>
#define MP make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << std::endl; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
  template <template<typename...> class T, typename t, typename... A> 
  void err(const T <t> &arg, const A&... args) {
  for (auto &v : arg) std::cout << v << ' '; err(args...); }
#else
  #define dbg(...)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 1e5 + 5;

void run() {
    char c; cin >> c;
    if (c >= 'A' && c <= 'Z') {
        cout << 'A' << '\n';
    } else {
        cout << 'a' << '\n';
    }
}

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

Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include <iomanip>
using namespace std;


int main(void){
  long double L;
  cin >> L;
  cout << std::fixed <<  std::setprecision(7) <<  pow(L/3,3) << endl;
  return 0;
}

Measured memory_bytes: 3764
#include<stdio.h>

int main(){
	while(1){
		int n,p,d1,d2;
		scanf("%d",&n);
		if(n==0)return 0;
		int an_n;
		int an_d=0;
		for(int i=0;i<n;i++){
			scanf("%d %d %d",&p,&d1,&d2);
			if(d1+d2>an_d){
				an_n=p;
				an_d=d1+d2;
			}
		}
		printf("%d %d\n",an_n,an_d);
	}
}

		

Measured memory_bytes: 1028
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define rep(i,n)    for(ll i=0; i<n; i++)
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n'
#define no cout<<"No"<<'\n'
using namespace std;

int main()
{
    godspeed
    ll i,j,x,y,ans=0;
   string s,t;
   cin>>x>>y;
    rep1(i,x,y)
    {
        s=to_string(i);
        t=s;
        reverse(s.begin(),s.end());
        if(s==t) ans++;
    }
    cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 3712
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] x = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
		}
		sc.close();

		int ans = Integer.MAX_VALUE;
		int d = n - k;
		for (int i = 0; i <= d; i++) {
			int left = Math.abs(x[i]) + x[i + k - 1] - x[i];
			int right = Math.abs(x[i + k - 1]) + x[i + k - 1] - x[i];
			ans = Math.min(ans, Math.min(left, right));
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 52324
#include <bits/stdc++.h>
using namespace std;
typedef long long inte;
const int maxn = 45, maxStatus = (1 << 17), fullStatus = maxStatus - 1, mods = 1e9 + 7;
inte f[maxn][maxStatus], g[maxn][maxStatus];
#define getbit(x) (1 << (x - 1))
#define checkable(s) ((s & getbit(X)) && (s & getbit(Y)) && (s & getbit(Z)))
inline inte fpow(inte x, int b) {
    inte res = 1;
    while (b) {
        if (b & 1) {
            res *= x;
            res %= mods;
        }
        x *= x;
        x %= mods;
        b >>= 1;
    }
    return res;
}
#define goright(x) (((x) % mods + mods) % mods)
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N, X, Y, Z;
	cin >> N >> X >> Y >> Z;
	Z += Y += X;
	f[0][0] = 1;
	for (int i = 0; i < N; ++i) {
	   for (int s = 0; s < maxStatus; ++s) {
	       for (int j = 1; j <= 10; ++j) {
	           int xs = ((s << j) & fullStatus) | getbit(j);
	           if (!checkable(xs)) {
	               f[i + 1][xs] += f[i][s];
	               f[i + 1][xs] %= mods;
               }
           }
       }
    }
    inte tmp = 0;
    for (int s = 0; s < maxStatus; ++s) {
        tmp += f[N][s];
        tmp %= mods;
    }
    cout << goright(fpow(10, N) - tmp) << endl;
	return 0;
}


Measured memory_bytes: 44504
program ABC086C;
var
	i,n,t,x,y: integer;
	t0,x0,y0,dt,dx,dy: integer;
begin
	read(n);
	t:=0;
	x:=0;
	y:=0;
	for i:=1 to n do begin
		read(t0);
		read(x0);
		read(y0);
		dt:=t0-t;
		dx:=x0-x;
		dy:=y0-y;
		if (dx+dy>dt) or ((dt-dx-dy) mod 2>0) then begin
			writeln('No');
			exit;
		end;
		t:=t0;
		x:=x0;
		y:=y0;
	end;
	writeln('Yes');
end.


Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int dx[] = {-1, 0, 0, 1};
int dy[] = {0, -1, 1, 0};
int h, w;
int id(int x, int y){
    return x * w + y;
}
bool C[1000006];
bool ok(int i,int j){
    return 0<= i and i < h and 0 <= j and j < w and C[id(i, j)];
}
int dist[1000006];
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int k;
    cin >> h >> w >> k;
    rep(i,h*w)dist[i] = 1<<30;
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    a--;b--;c--;d--;
    rep(i,h){
        string s;
        cin >> s;
        rep(j,w)if(s[j]=='.')C[i * w + j] = true;
    }
    dist[id(a,b)] = 0;
    queue<int> q;
    q.emplace(id(a,b));
    while(!q.empty()){
        auto p = q.front();
        q.pop();
        const int x = p / w;
        const int y = p % w;
        rep(i,4){
            for(int j = 1; j <= k; j++){
                const int xx = x + dx[i] * j;
                const int yy = y + dy[i] * j;
                if(!ok(xx,yy))break;
                const int zz = id(xx, yy);
                if(dist[zz] <= dist[p])break;
                if(dist[zz] > dist[p] + 1){
                    dist[zz] = dist[p] + 1;
                    q.emplace(zz);
                }
            }
        }
    }
    int ans = dist[id(c, d)];
    if(ans == 1<<30)ans = -1;
    cout << ans << endl;
}


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

int main() {
    int a=0;
    string s;
    cin >> s;
    rep(i,4)
        a += (s.at(i) == '+');
    cout << a-(4-a) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
 
using namespace std;
 
int main(void){
    int n;
    cin >> n;
    int card[13][13];
    for (int i = 0; i < 4; i++)
        for (int j = 0; j < 13; j++)
            card[i][j] = 0;
 
    for (int h = 0; h < n; h++){
        char c;
        int cn, num;
        cin >> c >> num;
        switch (c){
        case 'S': cn = 0; break;
        case 'H': cn = 1; break;
        case 'C': cn = 2; break;
        case 'D': cn = 3; break;
        }
        card[cn][num - 1] = 1;
    }
    for (int i = 0; i < 4; i++){
        for (int j = 0; j < 13; j++){
            if (card[i][j] == 0){
                char c;
                switch (i){
                case 0: c = 'S'; break;
                case 1: c = 'H'; break;
                case 2: c = 'C'; break;
                case 3: c = 'D'; break;
                }
                cout << c << " " << j + 1 << endl;
            }
        }
    }
}

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

diff = float('inf')
for i in range(N-1):
  if abs(sa[i] - (sa[-1] - sa[i])) < diff:
    diff = abs(sa[i] - (sa[-1] - sa[i]))

print(diff)

Measured memory_bytes: 30544
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  string S,T;
  cin>>S>>T;
  S+=S;
  string ans="No";
  rep(j,0,T.size()){
    bool flag=1;
    rep(i,0,T.size()){
      if(S[i+j]!=T[i]){
        flag=0;
        break;
      }
    }
    if(flag){
      ans="Yes";
      break;
    }
  }
  cout<<ans;
  }


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
 
int time, h, m, s;
 
scanf("%d", &time);
 
h=time/3600;
time=time-3600*h;
 
m=time/60;
s=time-60*m;
 
printf("%d:%d:%d\n", h, m, s);
 
return 0;
 
} 

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,x,z,i;
  int t[4];
  for(i=0;i<4;i++){
    t[i]=0;
  }
  cin >>x;
  string s[x];
  for(i=0;i<x;i++){
    cin >>s[i];
    if(s[i]=="AC"){
      t[0]++;
    }
        if(s[i]=="WA"){
      t[1]++;
    }    if(s[i]=="TLE"){
      t[2]++;
    }    if(s[i]=="RE"){
      t[3]++;
    }
  }
  cout <<"AC x "<<t[0]<<endl;
  cout <<"WA x "<<t[1]<<endl;
    cout <<"TLE x "<<t[2]<<endl;
    cout <<"RE x "<<t[3]<<endl;
  
}
  

Measured memory_bytes: 6724
#include<bits/stdc++.h>
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define N 100005

using namespace std;

int main()
{
    __

   int a,b,ans =0,p1,p2,t1,t2,t3,t4;

   cin >> a >> b;
/*
   p1 = (100*a)/8;

   p2 = (100*b)/10;

   t1 = (p1*8)/100;
   t2 = (p1*10)/100;
   t3 = (p2*8)/100;
   t4 = (p2*10)/100;
*/
  // if(t1==a && t2==b || t3==a && t4==b){

    for(int i=1;i<=1000;i++)
    {
        if(((i*8)/100) == a && ((i*10)/100 == b)){
         ans = i;
         break;
        }
    }
   //}
   /* cout << min(p1,p2) << '\n';

   else if(t1==a && t2==b) cout << p1 << '\n';

   else if(t3==a && t4==b) cout << p2 << '\n';*/
    if(ans>0) cout << ans << '\n';
   else cout << -1 << '\n';



    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define in2(a,b) scanf("%lld %lld",&(a),&(b))
#define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c))
#define ind(a) scanf("%lf", &(a))
#define ins(a) scanf("%s", (a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a))
//      puts(a) printf("%s\n", a) 文字はこっち
//your code here!
int cmp(const void *a, const void *b){
    ll A=*(ll *)a, B=*(ll *)b;
    if(A==B)return 0;
    else return A>B ? 1:-1;//昇順ソート 1,2,....9
}

int main(void){
    ll N, D[101], ans=1;
    in(N);
    rep(i, N) in(D[i]);
    qsort(D, N, sizeof(ll), cmp);
    rep(i, N-1) if(D[i] < D[i+1]) ans++;
    put(ans);
    return 0;
}


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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N; scanf("%d", &N);
  vector<ll> A(N + 5, 0);
  for (int i = 1; i <= N; ++i) {
    scanf("%lld", &A[i]);
    A[i] += A[i - 1];
  }
  ll ans = 1e18;
  for (int i = 1; i < N; ++i) {
    ans = min(ans, abs(A[i] - (A[N] - A[i])));
  }
  printf("%lld\n", ans);
  return 0;
}


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

using ll = long long;

int main() {
	ll S; scanf("%lld", &S);
	const ll base = ll(1e9);
	ll a = (S + base - 1) / base;
	ll b = base * a - S;
	assert(base * a - b == S);
	printf("0 0 1 %lld %lld %lld\n", base, a, b);

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int x, y, k;
	
	while(1){
	   scanf("%d %d",&x, &y);
	   if (x > y){
		   k = y;
		   y = x;
		   x = k;
	   }	
	   if (x == 0 && y == 0)
	   break;
	   printf("%d %d\n",x ,y);
	}   
	return 0;
}

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

int main() {
	int a, b, c, x;
	scanf("%d %d %d %d", &a, &b, &c, &x);
	int cnt = 0;
	for(int i = 0; i <= min(a, x/500); i++) {
		for(int j = 0; j <= min(b, x/100); j++) {
			for(int k = 0; k <= min(c, x/50); k++) {
				if(500*i + 100*j + 50*k == x) {
					cnt++;
				}
			}
		}
	}
	printf("%d\n", cnt);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
using ll = long long;
const ll M = 1000000007;
const ll infi = 1000000000000000;
const ll md = 998244353;
using namespace std;
using vl = vector<ll>;
using pll =  pair<ll,ll>;

ll solve(){
    ll n,r;
    cin>>n>>r;
    if(n>=10)
    cout<<r<<endl;
    else
    cout<<r+100*(10-n)<<endl;
}
 
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 384
alp = str(input())
lst = list(alp)
l = len(lst)
K = 0
U = 0
P = 0
C = 0
for i in range(l):
    if lst[i] == "K": K += 1
    elif lst[i] == "U": U += 1
    elif lst[i] == "P": P += 1
    elif lst[i] == "C": C += 1
print(min(K,U,P,C))


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

int main(){
  int n,m;
  cin >> n; vector<string> s(n); for(int i=0;i<n;i++) cin >> s.at(i);
  cin >> m; vector<string> t(m); for(int i=0;i<m;i++) cin >> t.at(i);
  sort(s.begin(),s.end());
  
  vector<int> x(0);
  
  for(int i=0;i<n;i++){
    if(i!=0){
      if(s.at(i)!=s.at(i-1)){
        x.push_back(1);
        for(int j=0;j<m;j++){
          if(t.at(j)==s.at(i)) x.at(x.size()-1)--;
        }
      }
      else{
        x.at(x.size()-1)++;
      }
    }
    else{
      x.push_back(1);
      for(int j=0;j<m;j++){
        if(t.at(j)==s.at(i)) x.at(x.size()-1)--;
      }
    }
  }
    
  int ans=0;
    
  for(int i=0;i<x.size();i++){
    ans=max(ans,x.at(i));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/03/12.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC131
//
//

#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const ll MOD = 1000000007;
//#define __DBG__




void solve(void){
  
  string S;
    
  cin >> S;
  
  bool flag=true;
  
  REP(i,S.size()-1){
    if(S[i]==S[i+1]){flag=false; break;}
  }
  
  puts(flag?"Good":"Bad");
  
  return;
}

#define TESTCASES 1

int main(int argc, const char * argv[]) {

    cin.tie(0);
    ios::sync_with_stdio(false);

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int NA, NB, S=0;
  cin >> NA;
  NB=NA;
  for (int i=0; i<10; i++) {
    S+=NA%10;
    NA/=10;
  }
  if (NB%S==0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

int main(int argc, const char * argv[]) {
    int i, n;
    
    cin >> n;
    
    int num[n];
    
    for(i=0;i<n;i++){
        cin >> num[i];
    }
    
    for(i=n-1;i>0;i--){
        cout << num[i] << " ";
    }
    cout << num[0] << endl;
    
    return 0;
}


Measured memory_bytes: 3136
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String K = "keyence";

		String k[] = new String[K.length()];
		String s[] = new String[S.length()];

		boolean ans = true;

		for (int i = 0; i < K.length(); i++) {
			k[i] = K.substring(i, i+1);
		}
		for (int i = 0; i < S.length(); i++) {
			s[i] = S.substring(i, i+1);

		}

		for (int i = 0; i < 7; i++) {
			if (!s[i].equals(k[i])) {
				for (int j = 0; j < 7 - i; j++) {
					if (!s[S.length()-1-j].equals(k[6-j])) {
						ans = false;
					}
				}
			}

		}

		if (ans) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

}


Measured memory_bytes: 21588
import java.util.Scanner;

public class Main {
  public static void main(String[] arg) {
    Scanner sc = new Scanner(System.in);
    int h = sc.nextInt();
    int v = sc.nextInt();
    sc.close();
    int area = h * v;
    int perimeter = 2 * h + 2 * v;

    System.out.println(area + " " + perimeter);
  }
}


Measured memory_bytes: 26140
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=200200;
const ll oo=1000000000000000000ll;
int i,j,k,n,m,ch,ff,nls;
ll sum;
int Ls[N],a[N],b[N];
struct cc { int l,r;} A[N];
struct tree { int fg;ll mi;} T[N<<2];
void R(int &x) {
	x=0;ch=getchar();
	while (ch<'0' || '9'<ch) { if (ch=='-') ff=1;ch=getchar();}
	while ('0'<=ch && ch<='9') x=x*10+ch-'0',ch=getchar();
	if (ff) x=-x;
}
void W(ll x) {
	if (x<0) putchar('-'),x=-x;
	if (x>=10) W(x/10);
	putchar(x%10+'0');
}
int find(int x) {
	int l=1,r=nls,mid;
	while (l<r) {
		mid=(l+r)>>1;
		if (Ls[mid]==x) return mid;
		if (Ls[mid]<x) l=mid+1;
		else r=mid-1;
	}
	return l;
}
void down(int k) {
	if (T[k].fg) {
		T[k<<1].fg=T[k<<1|1].fg=1;
		T[k<<1].mi=T[k<<1|1].mi=oo;
		T[k].fg=0;
	}
}
void T_add(int L,int R,int x,ll y,int k) {
	T[k].mi=min(T[k].mi,y);
	if (L==R) return;
	down(k);
	int mid=(L+R)>>1;
	if (x<=mid) T_add(L,mid,x,y,k<<1);
	else T_add(mid+1,R,x,y,k<<1|1);
}
void T_clear(int L,int R,int l,int r,int k) {
	if (l>r) return;
	if (L==l && R==r) {
		T[k].fg=1;
		T[k].mi=oo;
		return;
	}
	int mid=(L+R)>>1;
	if (r<=mid) T_clear(L,mid,l,r,k<<1);
	else {
		if (l>mid) T_clear(mid+1,R,l,r,k<<1|1);
		else T_clear(L,mid,l,mid,k<<1),T_clear(mid+1,R,mid+1,r,k<<1|1);
	}
	T[k].mi=min(T[k<<1].mi,T[k<<1|1].mi);
}
ll T_min(int L,int R,int l,int r,int k) {
	if (l>r) return oo;
	if (L==l && R==r) return T[k].mi;
	down(k);
	int mid=(L+R)>>1;
	if (r<=mid) return T_min(L,mid,l,r,k<<1);
	if (l>mid) return T_min(mid+1,R,l,r,k<<1|1);
	return min(T_min(L,mid,l,mid,k<<1),T_min(mid+1,R,mid+1,r,k<<1|1));
}
void T_build(int L,int R,int k) {
	T[k].mi=Ls[L];
	if (L==R) return;
	int mid=(L+R)>>1;
	T_build(L,mid,k<<1);
	T_build(mid+1,R,k<<1|1);
}
ll T_bl(int L,int R,int k) {
	if (L==R) return T[k].mi-Ls[L];
	if (T[k].fg) return oo;
	int mid=(L+R)>>1;
	return min(T_bl(L,mid,k<<1),T_bl(mid+1,R,k<<1|1));
}
/*void T_BL(int L,int R,int k) {
	if (L==R) {
		printf("%d %lld\n",Ls[L],T[k].mi-Ls[L]+2ll*sum);
		return;
	}
	//if (T[k].fg) return oo;
	down(k);
	int mid=(L+R)>>1;
	T_BL(L,mid,k<<1),T_BL(mid+1,R,k<<1|1);
}*/
ll Query(int x) {
	return min(T_min(1,nls,x,nls,1)-x,T_min(1,nls,1,x,1)+m-x);
}
int main() {
	R(n);R(m);
	for (i=1;i<=n;i++) {
		R(a[i]);R(b[i]);
		sum+=a[i];
		if (b[i]==1 && 2*a[i]>m) return puts("-1"),0;
	}
	for (i=1;i<=n;i++) a[i]=(a[i]+a[i-1])%m;
	for (i=1;i<=n;i++) if (b[i]==1) A[i].l=2*(m-a[i])%m,A[i].r=2*(m-a[i-1])%m;
	for (i=1;i<=n;i++) Ls[++nls]=A[i].l,Ls[++nls]=A[i].r;
	sort(Ls+1,Ls+nls+1);
	int tmp=nls;nls=0;
	for (i=1;i<tmp;i++) if (Ls[i]!=Ls[i+1]) Ls[++nls]=Ls[i];
	if (tmp) Ls[++nls]=Ls[i];
	for (i=1;i<=n;i++) A[i].l=find(A[i].l),A[i].r=find(A[i].r);
	T_build(1,nls,1);
	for (i=n;i;i--) if (b[i]==1) {
		//printf("%d %d\n",Ls[A[i].l],Ls[A[i].r]);
		T_add(1,nls,A[i].l,A[i].l+Query(A[i].l),1);
		T_add(1,nls,A[i].r,A[i].r+Query(A[i].r),1);
		if (A[i].l<A[i].r) T_clear(1,nls,A[i].l+1,A[i].r-1,1);
		else T_clear(1,nls,A[i].l+1,nls,1),T_clear(1,nls,1,A[i].r-1,1);
		//T_BL(1,nls,1);
		//puts("========================");
	}
	W(T_bl(1,nls,1)+2ll*sum);puts("");
}

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

const int M = 1e9 + 7;
int n;
long long a[2001];
int main()
{
    scanf("%d", &n);

    a[3] = 1;
    for(int i = 4; i <= n; i ++ )
    {
        for(int j = i - 3; j >= 3; j -- )
        {
            a[i] += a[j];
        }
        a[i] ++;
        a[i] %= M;
    }
    cout<<a[n]<<endl;
    return 0;
}

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

int main(){
    long long x, y;
    cin >> x >>y;
    long long o=0,e=0;
    if(x>1){
        o = x*(x-1);
        o = o/2;
    }
    if(y>1){
        e = y*(y-1);
        e = e/2;
    }

    cout << e+o;

}


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

#define LL                      long long
#define Ulong                   unsigned long long
#define REP(i,n)                for(long long i=0; i < n ; i++ )
#define mp                      make_pair
#define pb                      push_back
#define all(x)                  (x).begin(),(x).end()
#define PI                      acos(-1.0)
#define EPS                     1e-14
#define F                       first
#define S                       second
#define di(x)                   int x; input(x)
#define in(x)                   input(x)
#define in2(x,y)                in(x),in(y)
#define in3(x,y,z)              in(x),in2(y,z)
#define lc                      ((n)<<1)
#define rc                      ((n)<<1|1)
#define db(x)                   cout << #x << " -> " << x << endl
#define nl                      cout<<endl
#define ms(ara_name,value)      memset(ara_name,value,sizeof(ara_name))
#define IO                      ios_base::sync_with_stdio(0);cin.tie(0)
#define READ                    freopen("/home/matrixcode/Desktop/in.txt","r",stdin)
#define WRITE                   freopen("out.txt","w",stdout)
template<class T> inline void input(T &x) {
  register char c = getchar();x = 0;
  int neg = 0;
  for(; ((c<48 || c>57) && c != '-'); c = getchar());
  if(c=='-'){neg = 1;c = getchar();}
  for(; c>47 && c<58 ; c = getchar()){x = (x<<1) + (x<<3) + c - 48;}
  if(neg) x = -x;
}
inline long long bigmod(long long p,long long e,long long M){
  long long ret = 1;
  for(; e > 0; e >>= 1){
    if(e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  } return ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}

/***************************** END OF TEMPLATE *******************************/

const int N = 305;

double vis[N][N][N], dp[N][N][N];
int n;

double solve(int a,int b, int c) {
  if(a == 0 && b == 0 && c == 0) return 0;
  if(vis[a][b][c]) return dp[a][b][c];
  double ret = 0;
  double p = 1 - (a + b + c) * 1. / n;
  if(a) ret += (1 + solve(a-1,b,c)) * a/n;
  if(b) ret += (1 + solve(a+1,b-1,c)) * b/n;
  if(c) ret += (1 + solve(a,b+1,c-1)) * c/n;
  ret = ret + p;
  double e = ret/(1-p);
  vis[a][b][c] = 1;
  return dp[a][b][c] = e;
}
int main()
{
  
  in(n);
  int cnt[4] = {0};
  for(int i = 0; i < n; i ++) {
    int x;
    in(x);
    ++ cnt[x];
  }
  printf("%.10lf\n", solve(cnt[1], cnt[2], cnt[3]) );
}

Measured memory_bytes: 438528
import java.util.*;
public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		String s=sc.nextLine();
      	s=sc.nextLine();
      	s=s.replace("ABC","");
		System.out.println((a-s.length())/3);
		
		
	}
}


Measured memory_bytes: 35688
# -*- coding: utf-8 -*-
N = int(input())
sum = 0

for i in range(10000):
  q, mod =divmod(N, 10**(i+1))
  if i == 0:
    if q > 0:
      sum += 9
    else:
      sum += N
      break
  elif i % 2 == 0:
    if q > 0:
      sum += 9*(10**i)
    else:
      mod2 = N - 10**i
      sum += mod2 + 1
      break
  else:
    if q == 0:
      break
      
print(sum)
      

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define PER(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define PAIR pair<double, double>
#define MOD ((LL)1e9+7) 
#define INF ((LL)1e9+7)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define BIT(x) (1LL << (x))
#define PI acos(-1)
using namespace std;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

LL modpow(LL x, LL b){
	LL res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

LL modinv(LL x){
	return modpow(x, MOD-2);
}

int main(){
	int N;
	cin >> N;
	map<int, int> m;
	REP(i, BIT(N)){
		int d;
		cin >> d;
		++m[d];
	}
	map<int, int> used;
	++used[m.rbegin()->first];
	if(--m.rbegin()->second==0)m.erase(m.rbegin()->first);
	REP(i, N){
		map<int, int> nm;
		foreach(i, used){
			REP(k, i.second){
				++nm[i.first];
				auto po = m.lower_bound(i.first);
				--po;
				if(po==m.end()||po->first>=i.first){
					cout << "No" << endl;
					return 0;
				}
				++nm[po->first];
				if(--m[po->first]==0)m.erase(po->first);
			}
		}
		used = nm;
	}

	foreach(i, m)cout << i.first << " " << i.second << endl;


	cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 24832
#include<bits/stdc++.h>
using namespace std ; 
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fast ios_base:: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long int
#define endl "\n"
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define pii pair<int,int> 
long long M  = 1e9+7;
 
 
signed main(){
    fast;
    int n,k ;cin >> n >>k;
    vector <long double> a(n+1,0);
     int sum = 0;
    for(int i=1 ; i<=n ; i++){
        cin >> a[i];
        
    }
    long double ans = 0;

    vector <long double> b(n+1,0);
    for(int i=1 ; i<=n ; i++){
        long double t1 = (a[i]*(a[i]+1))/2;
        long double t = t1*((long double)1/a[i]);
       // cout << t << endl;
        b[i] = b[i-1] + t;
    }

    for(int i=k ; i<=n ; i++){
        ans = max(ans , b[i] - b[i-k]);
    }
    cout << fixed << setprecision(20) << ans << endl;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  int l, r, ans;
  for (int i = 0; i < N; i++) {
    cin >> l >> r;
    ans += r - l + 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=0
mod=10**9+7
for i in range(n):
    al=0
    tento=0
    for j in range(n):
        if a[j]<a[i]:
            al+=1
            if j>i:
                tento+=1
    ans+=tento*k
    ans%=mod
    ans+=(k-1)*(k)//2*al
    ans%=mod
print(ans)
        


Measured memory_bytes: 3188
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String S = stdR.readLine();
        boolean MMYY = false;
        boolean YYMM = false;
        int st1 = Integer.parseInt(S.substring(0, 2));
        int st2 = Integer.parseInt(S.substring(2, 4));
        if(1 <= st1 && st1 <= 12) {
            MMYY = true;
        }
        if(1 <= st2 && st2 <= 12) {
            YYMM = true;
        }
        if(YYMM && MMYY) {
            System.out.println("AMBIGUOUS");
        }else if(YYMM) {
            System.out.println("YYMM");
        }else if(MMYY) {
            System.out.println("MMYY");
        }else {
            System.out.println("NA");
        }
    }
}


Measured memory_bytes: 23252
n,h = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(n)]
AB.sort(reverse=True)
weapon = []
x = AB[0][0]
for a,b in AB:
	if b >= x:
		weapon.append(b)
weapon.sort(reverse=True)
weapon.append(x)
cnt = 0
for w in weapon[:-1]:
	h -= w
	cnt += 1
	if h <= 0:
		print(cnt)
		exit()
from math import ceil
cnt += ceil(h/weapon[-1])
print(cnt)


Measured memory_bytes: 29164
#include <stdio.h>
       
       int main(void) {
           int a, b, c;
         
           scanf("%d %d %d" , &a, &b, &c);
    
           int min = a + b;

           if(min > b + c) {
              min = b + c;
           }if(min > a + c){
              min = a + c;
           }printf("%d", min);
    }

Measured memory_bytes: 128
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		List<Integer> listG = new ArrayList<Integer>();
		List<Integer> listL = new ArrayList<Integer>();
		while(scan.hasNext()){
			int a = scan.nextInt();
			int b = scan.nextInt();
			int g = gcd(a, b);
			int l = lcm(a, b, g);
			listG.add(g);
			listL.add(l);
		}
		Iterator<Integer> itG = listG.iterator();
		Iterator<Integer> itL = listL.iterator();
		while(itG.hasNext()){
			int g = itG.next();
			int l = itL.next();
			System.out.printf("%d %d\n", g, l);
		}
	}

	public static int gcd(int a, int b){
		if(b != 0)return gcd(b, a % b);
		else return a;
	}

	public static int lcm(int a, int b, int g){
		int v = a / g;
		int l = v * b;
		return l;
	}
}

Measured memory_bytes: 25888
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s[3];
    cin >>s[0]>>s[1]>>s[2];
    int i=0;
    while(true){
      if(s[i].size()==0){
        cout<<char('A'+i)<<endl;
        return 0;
      }
      char c=s[i][0];
      s[i].erase(0,1);
      i=c-'a';
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	//java11

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		StringBuilder sb = new StringBuilder(S);
		boolean matchAnswer = false;
		for(int i=S.length()-T.length(); i>=0; i--) {
			boolean isMatch = true;

			for(int j=i; j<i+T.length(); j++) {
				if(!(S.charAt(j) == T.charAt(j-i) || S.charAt(j) == '?')) {
					isMatch = false;
					break;
				}
			}

			if(isMatch) {
				sb.replace(i, i+T.length(), T);
				matchAnswer = true;
				break;
			}
		}

		String ans = "UNRESTORABLE";
		if(matchAnswer) {
			ans = sb.toString();
			ans = ans.replace("?", "a");
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 23892
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq

# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7

def solve(f):
    a, b = f.read_int_list()
    if a+b == 15:
        return '+'
    elif a*b == 15:
        return '*'
    else:
        return 'x'


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case #%d\n"%f.case, solve(f)
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    ll N,C,K;
    cin >> N >> C >> K;
    vector<ll> T(N);
    for (int i = 0; i < N; i++) {
        cin >> T[i];
    }
    SORT(T);
    int id = 0;
    ll ans = 1;
    for (int i = 0; i < N; i++)
    {
        if(i-id >= C || T[i]-T[id] > K){
            id = i;
            ans++;
        }
    }
    pr(ans);
}

Measured memory_bytes: 1024
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int a[100010],b[100010],c[100010],s[100010];

int main()
{
	//	freopen("input.txt","r",stdin);
	//	freopen("output.txt","w",stdout);
	int n,m;scanf("%d%d",&n,&m);
	int q;scanf("%d",&q);
	for (int i=1;i<=q;i++) scanf("%d",&a[i]);
	int l=0;
	for (int i=q;i;i--)
		if (!c[a[i]])
		{
			b[++l]=a[i];c[a[i]]=l;s[a[i]]++;
		}
		else
			if (c[a[i]]==1||s[b[c[a[i]]-1]]>s[a[i]]) s[a[i]]++;
	int k=l+1;
	for (int i=1;i<=l;i++) if (s[b[i]]<n) {k=i;break;}
	for (int i=k+1;i<=l;i++) if (b[i]<b[i-1]) {puts("No");return 0;}
	for (int i=1;i<=m;i++) if (k<=l&&c[i]==0&&i<b[l]) {puts("No");return 0;}
	puts("Yes");
	return 0;
}



Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(I,N) for(int I=0;I<N;I++)
using ll=long long int;
using namespace std;

int main(){
	int ac=0;
	int wa=0;
	int tle=0;
	int re=0;
	long long N;
	cin>>N;
	string S[N];
	for(int i=0;i<N;i++){
		cin>>S[i];
		if(S[i]=="AC")ac++;
		else if(S[i]=="WA")wa++;
		else if(S[i]=="TLE")tle++;
		else if(S[i]=="RE")re++;
	}
	cout<<"AC x "<<ac<<endl;
	cout<<"WA x "<<wa<<endl;
	cout<<"TLE x "<<tle<<endl;
	cout<<"RE x "<<re<<endl;
}


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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
 	ll cost;
 };
using Graph = vector<vector<Edge>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = LLONG_MAX;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const ll MAX = 10000000;
/****** define constant end ********/
/****** define variable start ******/
ll n, k;
/******* define variable end *******/
int solve() {
	cin >> n >> k;
	ll ans = 0;
	for(ll i = k; i <= n+1; i++){
		ll mi = i*(i-1)/2;
		ll ma = n*(n+1)/2 - (n-i+1)*(n-i)/2;
		ans += ma - mi + 1;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}

int main() {
	//clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

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(){
    ll Q,H,S,D;
    cin >> Q >> H >> S >> D;
    ll N;
    cin >> N;

    Q = 4 * Q;
    H = 4 * H;
    D = 4 * D;
    S = 4 * S;
    N = 4 * N;

    ll gre8 = min({D,S*2,H*4,Q*8}); //each 8
    ll gre4 = min({S*2,H*4,Q*8});
    ll gre2 = min({H*4,Q*8});
    ll gre1 = Q*8;
    ll ans = 0;

    ans = (N/8)*gre8;
    N = N % 8;

    //cout << "test = " << ans << "\n";

    ans += (N/4)*(gre4/2);
    N = N % 4;

    ans += (N/2) *(gre2/4);
    N = N % 2;

    ans += N*(gre1/8);

    cout << ans/4 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>
 
using namespace std;
using namespace __gnu_pbds;
 
#define endl '\n'
 
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template<typename T>
static T randint(T lo, T hi){
	return uniform_int_distribution<T>(lo, hi)(rng);
}
 
 
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
 	
 	ll n;
 	cin >> n;

 	cout << (360 / __gcd(n, 360ll)) << endl;


	return 0;	
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define pb push_back
#define f first
#define s second

using namespace std;
int main()
{
   ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   
   int a,b,c,k;
   cin>>a>>b>>c>>k;
   
   
   if(k<=a || k<=(a+b))
   cout<<min(k,a)<<endl;
   else
   {
       int sum = a;
       
       k-=(a+b);
       
       if(a==0 && b==0 && c==0)
       cout<<0<<endl;
       else
       cout<<sum-k<<endl;
   }
}


Measured memory_bytes: 3580
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <math.h>
#include<iomanip>
using namespace std;

int N;
long long K;

bool possible(long long x, vector<pair<long long, int>>& S) {
    long long cnt = 0, tmp;
    int d;
    for (int i = 0; i < N; i++) {
        d = S[i].second;
        tmp = (S[i].first - x + d - 1) / d;
        if (tmp < 0) continue;
        cnt += tmp;
    }
    return cnt <= K;
}

int main() {
    cin >> N >> K;
    priority_queue<long long> A, F;
    vector<pair<long long, int>> S;
    long long a, f;
    for (int i = 0; i < N; i++) {
        cin >> a;
        A.push(a);
    }
    for (int i = 0; i < N; i++) {
        cin >> f;
        F.push(-f);
    }
    long long mx = 0;
    for (int i = 0; i < N; i++) {
        a = A.top(); A.pop();
        f = - F.top(); F.pop();
        mx = max(mx, a * f);
        S.push_back(make_pair(a * f, f));
    }
    long long left = -1, right = mx, mean;
    while (left + 1 < right) {
        mean = (left + right) / 2;
        if (possible(mean, S)) {
            right = mean;
        } else {
            left = mean;
        }
    }
    cout << right << endl;
}


Measured memory_bytes: 9584
import std.stdio;
import std.ascii;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.random;
import std.regex;
import std.typecons;

void main() {
    int H, W;
    bool[][] F;
    bool input() {
        scanf("%d %d\n", &H, &W);
        if (H == 0 && W == 0) return false;
        F = new bool[][H];
        foreach (i; 0 .. H) {
            F[i] = readln.chomp.split(" ").map!((x) => cast(bool)x.to!int).array;
        }
        return true;
    }
    void solve() {
        int C = 0;
        auto I = new int[][](H, W);
        foreach (i; 0 .. H) I[i][] = -1;
        int[] Y, X;
        foreach (int i; 0 .. H) foreach (int j; 0 .. W) {
            if (F[i][j]) {
                Y ~= i;
                X ~= j;
                I[i][j] = C++;
            }
        }

        int dist(int y1, int x1, int y2, int x2) {
            return abs(y1 - y2) + abs(x1 - x2);
        }

        const INF = 1<<28;
        auto dp = new int[][][](H, W, 1 << C);
        foreach (y; 0 .. H) {
            foreach (x; 0 .. W) {
                foreach (bit; 0 .. (1 << C)) {
                    dp[y][x][bit] = INF;
                }
            }
        }
        foreach (y; 0 .. H) {
            foreach (x; 0 .. W) {
                foreach (k; 0 .. C) {
                    dp[y][x][1 << k] = dist(y, x, Y[k], X[k]);
                }
            }
        }
        foreach (y; 0 .. H) {
            foreach (x; 0 .. W) {
                foreach (y1; 0 .. H) {
                    foreach (x1; 0 .. W) {
                        foreach (s; 1 .. (1 << C)) {
                            foreach (s1; 1 .. s) {
                                if ((s | s1) != s) continue;
                                if (s == s1) continue;
                                int s2 = s ^ s1;
                                dp[y][x][s] = min(dp[y][x][s], dp[y1][x1][s1] + dp[y1][x1][s2] + dist(y, x, y1, x1));
                            }
                        }
                    }
                }
            }
        }
        int Ans = INF;
        foreach (y; 0 .. H) {
            foreach (x; 0 .. W) {
                Ans = min(Ans, dp[y][x][(1 << C) - 1]);
            }
        }
        writeln(H * W - Ans - 1);
    }
    while (input) solve;
}

Measured memory_bytes: 2064
# Aizu Problem 0208: Room Numbers of a Hospital

import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


    
while True:
    n = int(input())
    if n == 0:
        break
    print(oct(n)[2:].replace('7','9').replace('6','8').replace('5','7').replace('4','5'))

Measured memory_bytes: 7692
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int a[N];
int main()
{
	int n,k;
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	int flag=1;
	for(int i=0;i<n-1;i++)
	{
		if(a[i]==a[i+1])flag=0;
	}
	if(flag)cout<<"YES";
else cout<<"NO";
    return 0;
}


Measured memory_bytes: 1024