akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=100000+100;
const db pi=acos(-1.0);
#define lowbit(x) ((x)&(-x))
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u],v=sq[i].to;i;i=sq[i].nxt,v=sq[i].to)
#define fir first
#define sec second
#define mkp make_pair
#define pb push_back
#define maxd 998244353
#define eps 1e-8
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

inline ll readll()
{
    ll x=0;int f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int a,b,c,d,k;

int chk(int mid)
{
    //cout << "now " << mid << endl;
    if (!mid) return 1;
    if (mid%(k+1)==0) return chk(mid-1);
    int rsta=a-(mid-mid/(k+1)),rstb=b-mid/(k+1);
    //cout << rsta << " " << rstb << endl;
    return rstb<=1ll*(rsta+1)*k;
}

int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int q=read();
    while (q--)
    {
        a=read();b=read();c=read();d=read();
        k=(max(a,b)-1)/(min(a,b)+1)+1;
        //cout << k << endl;
        int l=0,r=a+b,pos=0;
        while (l<=r)
        {
            int mid=(l+r)>>1;
            //cout << "result " << mid << " " << chk(mid) << endl;
            if (chk(mid)) {pos=mid;l=mid+1;}
            else r=mid-1;
        }
        //cout << "pos=" << pos << endl;
        rep(i,c,min(pos,d))
        {
            if (i%(k+1)) putchar('A');
            else putchar('B');
        }
        rep(i,max(c,pos+1),d)
        {
            int tmp=a+b-i+1;
            if (tmp%(k+1)) putchar('B');
            else putchar('A');
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
typedef long long int ll;
#define FOR(i,a,n) for(int i=a;i<n;++i)
#define TFOR(i,n)FOR(i,0,n)
#define ALL(x) x.begin(),x.end();
const int INF = 1LL << 30;
const ll LLINF = 1LL << 60;
int V;//??????
int E;//???
struct edge { int from, to, cost; };
typedef std::pair<int, int> PP;
std::vector<edge> e;
int Par[100000];
int Rank[100000];
void init(int n) {
	for (int i = 0; i < n; i++) {
		Par[i] = i;
		Rank[i] = 0;
	}
}
int find(int x) {
	if (Par[x] == x) {
		return x;
	}
	else {
		return Par[x] = find(Par[x]);
	}
}
void unite(int  x, int y) {
	x = find(x);
	y = find(y);
	if (x == y) return;
	if (Rank[x] < Rank[y]) {
		Par[x] = y;
	}
	else {
		Par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}
bool same(int x, int y) {
	return find(x) == find(y);
}
// ??????????????????????????????????????¢??° 
bool comp(const edge& e1, const edge& e2) {
	return e1.cost < e2.cost;
}
int kruskal() {
	init(V);
	sort(e.begin(), e.end(), comp);
	int ans = 0;
	for (int i = 0; i<E; i++) {
		if (!same(e[i].from, e[i].to)) {
			unite(e[i].from, e[i].to);
			ans += e[i].cost;
		}
	}
	return ans;
}
int main() {
	while (std::cin >> V>>E&&V) {
		int a, b, c;
		for (int i = 0; i < E; i++) {
			std::cin >> a >> b >> c;
			e.push_back(edge{ a,b,c });
		}
		std::cout << kruskal()<< std::endl;
		e = {};
	}
	return 0;
}

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






#define pf                  printf
#define sf(a)               scanf("%d",&a)
#define sfl(a)              scanf("%lld",&a)
#define sff(a,b)            scanf("%d %d",&a,&b)
#define sffl(a,b)           scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)         scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)        scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d)      scanf("%d %d %d %d",&a,&b,&c,&d)
#define sffffl(a,b,c,d)     scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define sfffff(a,b,c,d,e)   scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
#define sfffffl(a,b,c,d,e)  scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e)
#define sfc(a)              scanf("%c",&a)
#define pii                 pair<int,int>
#define ms(a,b)             memset(a,b,sizeof(a))
#define pb(a)               push_back(a)
#define pbp(a,b)            push_back({a,b})
#define db                  double
#define ft                  float
#define ll                  long long
#define ull                 unsigned long long
#define pii                 pair<int,int>
#define ff                  first
#define ss                  second
#define sz(x)               x.size()
#define all(x)              x.begin(),x.end()
#define CIN                 ios_base::sync_with_stdio(0); cin.tie(0)
#define max3(a, b, c)       max(a, b) > max(b, c) ? max(a, b) : max(b, c)
#define min3(a, b, c)       min(a, b) < min(b, c) ? min(a, b) : min(b, c)
#define for0(i,n)           for(int i=0;i<n;i++)
#define for1(i,n)           for(int i=1;i<=n;i++)
#define forrev(i,n)         for(int i=n-1; i>=0; i--)
#define forab(i,a,b)        for(int i=a;i<=b;i++)
#define forba(i,b,a)        for(int i=b;i>=a;i--)
#define stlloop(x)          for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define case1(z)            cout<<"Case "<<z<<": "
#define case2(z)            printf("Case %d: ",z)
#define PI                  acos(-1) //3.14159265358979323846264338328
#define valid(tx,ty)        tx>=0 && tx<row && ty>=0 && ty<col
#define intlim              2147483648
#define N                   100007
#define inf                 100000008
#define mod                 1000000007

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/




int b[100];

int main()
{
    ll x,ans=100000000000000,i,j,a;

    cin>>x;
    for(i=1;i<=sqrt(x);i++)
    {
        if(x%i==0)
        {
            a=(i-1)+(x/i-1);
            if(a<ans)
                ans=a;
        }
    }

    cout<<ans<<endl;
    //main();
    return 0;

}
































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

using namespace std;

void func_A() {

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

    for (int i = a; i <= b; ++i) {
        if (i%k == 0) {
            cout << "OK";
            return;
        }
    }
    cout << "NG";
}

void func_B() {

    unsigned long long x;
    cin >> x;
    unsigned long long okane = 100;
    for (int i = 1; ; ++i) {
         okane *= 1.01;
         if (okane >= x) {
             cout << i;
             return;
        }
    }

}

void func_C() {


}

int main() {

    func_A();
    //func_B();
    //func_C();

    return 0;

}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()


using namespace std;

const ll N = 1e5 + 120;
const ll big = 1e18;
const ll M = 2020;
const ll mod = 998244353;

ll n, m;

ll a[N];

vector<ll> answ;

int main() {
    speed;
	cin >> n >> m;
	bool can = 0;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	ll memo = -1;
	rep(1, n, 1)
		if(a[i] + a[i - 1] >= m) {
			can = 1;
			memo = i - 1;
		}
	if(!can)	
		cout << "Impossible",ex;
	cout << "Possible\n";
	for(int j = 1; j < memo + 1; j++)
		cout << j << '\n';
	for(int l = n - 1; l > memo + 1; l--)
		cout << l << '\n';
	cout << memo + 1;
}

/*
*/



Measured memory_bytes: 1664
N,A= [int(i) for i in input().split()]
n = [int(input()) for i in range(N)]
n.sort()
mn = 10**9
for i in range(N-A+1):
	m = n[i+A-1] - n[i]	
	if m == 0:
		print(0)
		exit()
	elif mn > m: mn=m 
print(mn)

Measured memory_bytes: 7384
#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
ll bpow(ll,ll,ll);
typedef vector<int> vec;
typedef vector<vec> mat;
mat mul(mat &A,mat &B);
mat pow(mat A,ll n);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
const int MOD = 1000000007;

int dsum(int n){
  if(n == 0)
    return 0;
  else
    return dsum(n/10)+n%10;
}

int main()
{
  string s,t;
  cin >> s >> t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if(s < t)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}



Measured memory_bytes: 256
a = list(map(int,input().split(" ")))
b = list()
c = list()
ans = list()

for i in range(a[0]):
    b.append(list(map(int,input().split(" "))))

for i in range(a[1]):
    c.append(list(map(int,input().split(" "))))

for i in range(a[0]):
    d = 0
    e = 9999999999
    for ii in range(a[1]):
        if e > abs(b[i][0] - c[ii][0]) + abs(b[i][1] - c[ii][1]):
            e = abs(b[i][0] - c[ii][0]) + abs(b[i][1] - c[ii][1])
            d = ii
    ans.append(d+1)
    
for i in range(a[0]):
    print(ans[i])

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
using namespace std;
void wc(char *buf){
	for(int i=0;i<3;i++){ if(buf[i*3]==buf[i*3+1] && buf[i*3+1]==buf[i*3+2] && buf[i*3]!='s'){ printf("%c\n", buf[i*3]); return;}}
	for(int i=0;i<3;i++){ if(buf[i]==buf[3+i] && buf[3+i]==buf[6+i] && buf[i]!='s'){ printf("%c\n", buf[i]); return;}}
	if(buf[0]==buf[4] && buf[4]==buf[8] && buf[0]!='s'){ printf("%c\n", buf[0]); return;}
	if(buf[2]==buf[4] && buf[4]==buf[6] && buf[2]!='s'){ printf("%c\n", buf[2]); return;}
	printf("d\n");
}
signed main(){
	char buf[256];
	while ( fgets(buf, 256, stdin) != NULL ) {
		wc(buf);
	}
	return 0;
}

Measured memory_bytes: 3076
#include <iostream>
#include <cmath>
 
using namespace std;
 
int main()
{
	int yen;
  	int N;
  	cin >> N;
    while(yen < N){
     
      yen += 1000;
      
    }
	
	if(yen == N){
     
      cout << 0;
      
    }else{
     
      cout << yen - N;
      
    }
 
    return 0;
}

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

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

ll factorual(ll n){
    ll res = 1;
    for (ll i = 1; i <= n; i++){
        res *= i;
        res %= MOD;
    }
    return res;

    //階乗を出力
    //入力:ll
    //出力:ll
}

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

    ll n,m;
    cin >> n >> m;

    if (abs(n-m) > 1){
        cout << 0 << endl;
        return 0;
    }

    if (n == m){
        ll x = factorual(n);
        ll ans = (2*x*x)%MOD;
        cout << ans << endl;
    }
    else{
        ll ans = (factorual(n) * factorual(m))%MOD;
        cout << ans << endl;
    }
}

Measured memory_bytes: 3564
#include<cstdio>
#include<cmath>
int main(){
  double a,b,c;
  scanf("%lf %lf %lf",&a,&b,&c);
  printf("%.7f\n",a*b*sin((M_PI*c/180))/2);
  printf("%.7f\n",a+b+sqrt(pow(a,2)+pow(b,2)-2*a*b*cos((M_PI*c/180))));
  printf("%.7f\n",b*sin((M_PI*c/180)));
}


Measured memory_bytes: 2884
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define rep(i, a, b) for(int i = a; i < b; i++)
#define repr(i, a, b) for(int i = a - 1; i >= b; i--)
#define iter(m) for(auto it = m.begin(); it != m.end(); it++)
#define iterr(m) for(auto it = m.rbegin(); it != m.rend(); it++)
#define N 500500
#define PI 3.14159265358979323846264338327950L
#define speed ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
const ll mod = (ll)1e9 + 7;
	
int main(){
	speed;
	string s; cin >> s;
	cout << s;
	if(s[s.size() - 1] == 's') {
		cout << "es";
	} else {
		cout << 's';
	}
	return 0;
}

Measured memory_bytes: 3620
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  auto n = readln.chomp.to!int;
  auto a = readln.chomp.split.to!(int[]);
  int[int] cnt;
  foreach (e; a) {
    cnt[e]++;
  }
  auto keys = cnt.keys.sort!((a,b)=>a > b);
  
  auto l = new long[](2);
  int index;
  a:foreach (k; keys) {
    while (cnt[k] > 1) {
      l[index] = k;
      cnt[k] -= 2;
      index++;
      if (index == 2) {
        writeln(l[0] * l[1]);
        break a;
      }
    }
  }
  if (index != 2) {
    writeln("0");
  }
}


Measured memory_bytes: 9268
N,M,Q = list(map(int,input().split()))

LR = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
    Ltmp,Rtmp = list(map(int,input().split()))
    LR[Ltmp][Rtmp] += 1

LRc = [[0]*(N+1) for i in range(N+1)]
for i in range(1,N+1):
    for j in range(1,N+1):
        LRc[i][j] = LRc[i-1][j]+LRc[i][j-1]-LRc[i-1][j-1]+LR[i][j]

for i in range(Q):
    p,q = list(map(int,input().split()))
    out = LRc[q][q]-LRc[q][p-1]-LRc[p-1][q]+LRc[p-1][p-1]
    print(out)

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
typedef complex<ld> Point;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

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

ll a[3005];
ll dp[3005][3005];
ll f(int l, int r) {
    if (dp[l][r])
        return dp[l][r];
    if (l == r)
        return a[l];

    dp[l][r] = max(a[l] - f(l + 1, r), a[r] - f(l, r - 1));
    return dp[l][r];
}

int main() {
    int n;
    cin >> n;
    rep(i, n) cin >> a[i];
    out(f(0, n - 1));
}


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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if(b < c || d < a){
        cout << 0 << endl;
    }else{
        cout << min(b, d) - max(a, c) << endl;
    }

    return 0;
}

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

vector<int> V[300010];
int n,m,k,a[300010],ans,now;
multiset<int> S;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin>>n>>m>>k;
	while(k--)
	{
		int p,q;
		cin>>p>>q;
		V[p].push_back(q);
		a[q]++;
	}
	for(int i=1;i<=m;i++) S.insert(a[i]);
	for(int i=1;i<=n;i++)
	{
		now=(int)V[i].size();
		for(int p : V[i])
		{
			S.erase(S.find(a[p]));
			a[p]--;
			S.insert(a[p]);
		}
		now+=*S.rbegin();
		ans=max(now,ans);
		//printf("%d : %d\n",i,now);
		for(int p : V[i])
		{
			S.erase(S.find(a[p]));
			a[p]++;
			S.insert(a[p]);
		}
	}
	cout<<ans;
}


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

int main() {
  long int N, X, Y;
  std::cin >> N >> X >> Y;
  X -= 1;
  Y -= 1;
  long int gap = Y - X - 1;
  std::vector<long int> num(N, 0);
  for(int i=0; i<N; ++i) {
    for(int j=i+1; j<N; ++j) {
      long int minimum = j-i;
      if(i<=X) {
        if(X<j && j<Y) {
          minimum = std::min(minimum, X-i + Y-j + 1);
        }
        else if(Y<=j) {
          minimum = minimum - gap;
        }
      }
      else if(i<Y) {
        if(j<Y) { // obviously X<j in this case.
          minimum = std::min(minimum, i-X + Y-j + 1);
        }
        else if(Y<=j) {
          minimum = std::min(minimum, i-X + j-Y + 1);
        }
      }
      num[minimum]++;
    }
  }
  for(int k=1; k<N; ++k){
    std::cout << num[k] << std::endl;
  }
  return 0; 
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  int a,b,c,k;
  cin >> a >>b>>c>>k;
 
  int x = max(a,max(b,c));
  
  cout << a+b+c-x+x*pow(2,k) << endl;
  
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int k = saori.saori_hayami();
		int x = saori.saori_hayami();
		int num = x - k + 1;
		for(int i = num;i < x + k;i++){
			System.out.print(i);
			System.out.print(" ");
		}
		System.out.println("");
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21332
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;
 
class Program
 {
  
        static int[] L;
        
        static void Main(string[] args)
        {
          //入力を受け取る
          int N = int.Parse(Console.ReadLine());
          L = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
          L = L.OrderBy(a => -a).ToArray();
          long sum = 0;
          for(int i = 0 ;i < N ;i++){
            for(int j = i+1 ; j < N ;j++){
              //二分探索で何個三角形を作れるかを求める
              if(j+1 < N){
                sum += LowerBound(L,L[i]-L[j],j+1);
              }
            }
          }
          Console.WriteLine(sum);
        }
  
        static int BinarySearchTriangle(int i,int j,int k){
          int first = L[i];
          int second = L[j];
          //Console.WriteLine("first:"+first+"second:"+second+"third:"+L[k]);
          //二分探索の初期設定をする
          int head = k;
          int tail = L.Length-1;
          int mid = (head+tail)/2;
          if(mid != head){
            while(mid != head){
              if(first < second + L[mid]){
                head = mid;
                mid = (head+tail)/2;
              }else{
                tail = mid;
                mid = (head+tail)/2;
              }
            }
          }else if(head != tail && first < second + L[tail]){
            return 2;
          }else if(first < second + L[mid]){
            //Console.WriteLine(1);
            return 1;
          }else{
            //Console.WriteLine(0);
            return 0;
          }
          //Console.WriteLine(head-j+1);
          return head-j+1;
        }
  
  public static int LowerBound(int[] a,int v,int ini)
{
    var l = ini;
    var r = a.Length - 1;
    while (l <= r)
    {
        var mid = l + (r - l) / 2;
        if (a[mid] > v) l = mid + 1;
        else r = mid - 1;
    }
    return l-ini;
}
  
 }

Measured memory_bytes: 13524
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

#define ll long long

int X, ans = 1;

void solve(){
    int range = sqrt(X);

    for(int i = 2; i <= range; i++){
        int buff = 1;
        while(true){
            buff *= i;
            if(buff > X) break;
            ans =  max(ans, buff);
        }
    }

    cout << ans << endl;
}

int main(){
    cin >> X;

    solve();
}


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

using namespace std;
#define X first
#define Y second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define debug(x) cerr << #x << " = " << (x) << endl;
template<typename T>
ostream& operator<<(ostream& o, vector<T>& v) {
    for (auto& x : v) o << x << ' ';
    return o;
}

const int MAXN = 1e5 + 5;
int n, w;
int arr[MAXN];
int val[MAXN];
ll memo[105][MAXN];
ll dp(int i, int w) {
  ll &res = memo[i][w];
  if (res != -1) return res;
  if (i == n) return res = 0;
  res = dp(i+1, w);
  if (w >= arr[i]) {
    res = max(res, dp(i+1, w - arr[i]) + val[i]);
  }
  return res;
}

int main(){
    std::ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> w;
    for (int i = 0; i < n; i++)
      cin >> arr[i] >> val[i];
    memset(memo, -1, sizeof memo);
    cout << dp(0, w) << endl;
}


Measured memory_bytes: 82304
#include <vector>
#include <cstdio>
using namespace std;

int joseph(int n,int diff,int initial){
	int r=0,i=1;
	for(;i<n;i++)r=(r+diff)%i;
	return (r+1+initial)%n+1;
}

int main(){
	int n,k,m;
	for(;scanf("%d%d%d",&n,&k,&m),n;printf("%d\n",joseph(n,k,m-1)));
}

Measured memory_bytes: 1012
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=k-n+1;i<=n-1+k;i++){
		cout<<i;
		if(i==n-1+k)cout<<"\n";
		else cout<<" ";
	}
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

int n;
int main() {
    cin >> n;
    int m = n;
    int sum = 0;
    while (m) {
        sum += m % 10;
        m /= 10;
    }
    if (n % sum)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    return 0;
}


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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

ll INF = 1ll << 60;

int main(){
  char c;
  cin >> c;
  c++;
  
  cout << c << endl;
  
  return 0;
  
}

Measured memory_bytes: 3628
#include<iostream>

using namespace std;

int main() {
    int k, n, total = 0;
    cin >> k>> n;
    int *p = new int[k];
    for (int i = 0; i < k; i++) {
        cin >> p[i];
    }
    for (int i = 0; i < k; i++)
        for (int q = 0; q < k - i - 1; q++) {
            if (p[q] > p[q + 1]) {
                swap(p[q], p[q + 1]);
            }
        }
    for (int i = 0; i < n; i++) {
        total += p[i];
    }
    cout<<total;
    return 0;
}

Measured memory_bytes: 3652
//***********************
//Author:kibi11
//Quarantine Days
//***********************

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define fr(i, n) for(int i = 0; i < n; i++)
#define fr1(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,k) for(int i=a;i>=k;i--)
#define same int t;cin>>t;while(t--)
#define check(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define f first
#define s second
#define XOX

//////////////////////////////////////////////////////////////////////////
/////////////////DEBUGING ZONE//////////////////////////////

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
///////////////////////////////////////////////////////////////////////////
 
ll powermod(ll base, ll exp, ll mod) {
	ll result = 1;
	while (exp != 0) {
		if ((exp % 2) == 1) {
			result = (result * base) % mod;
		}
		base = (base * base) % mod;
		exp /= 2;
	}
	return result;
}

///////////////////////////////////////////////////////////////////////////
//Fuctions if any:





///////////////////////////////////////////////////////////////////////////
int main() 
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tt = clock();
ios_base& scientific (ios_base& str);

int n;
cin>>n;
ll a[n];
bool on=false;
ll p=1;
int z=0;
fr(i,n)
{
	cin>>a[i];
	z+=(a[i]==0);

}
// cout<<z<<endl;
if(z)
{
	cout<<0<<endl;
	
}
else
{
	fr(i,n)
{

	
	if(a[i]<=1000000000000000000/p)
	{
		p*=a[i];
	}
	else
	{
		on=true;
		break;
	}
}
// cout<<"adf";
if(on)
	cout<<-1<<endl;
else
	cout<<p<<endl;

}


cerr << "TIME = " << (double) 1.0 * (clock() - tt) / CLOCKS_PER_SEC << " seconds" << endl;
return 0;
}

Measured memory_bytes: 4548
'use strict';
process.stdin.on('data', function(chunk) {
  var inputs = chunk.toString().trim().split(' ');
  var a = Number(inputs[0]);
  var b = Number(inputs[1]);
  var c = Number(inputs[2]);

var sortTable = [a,b,c].sort(function(a,b){
	return a-b;
});
console.log(sortTable.join(' '));

});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 15504
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n):
     if b[i] > a[i] + a[i+1]:
          ans += a[i] + a[i+1]
          a[i+1] = 0
     elif a[i] <= b[i] <=a[i] + a[i+1]:
          ans += b[i]
          a[i+1] = a[i] + a[i+1] - b[i]
     else:
          ans += b[i]
     
print(ans)

Measured memory_bytes: 19156
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		long s = sc.nextLong();
		long c = sc.nextLong();
		long count = 0;
		
		if(s * 2 > c) {
			count = c / 2;
		} else {
			count = s + (c - s * 2) / 4;
		}

		System.out.println(count);
	}
}

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

int main(){
    int D, N;
    cin >> D >> N;
    int div = 1;
    while(D){
        div *= 100;
        D--;
    }
    if (N == 100)
        N++;
    cout << N*div << endl;
    return 0;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i + 100*j + 50*k == X:
                count = count +1
print(count)

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

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
    if (a < b)
        swap(a, b);
    return a % b == 0 ? b : gcd(b, a % b);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b;
    cin >> a >> b;
    ll g = gcd(a ,b);
    ll len = sqrt(g) + 1;
    vector<bool> isPrime(len, true);
    for (int i = 2; i < len; i++) {
        if (!isPrime[i])
            continue;
        for (ll ind = i * 2; ind < len; ind += i)
            isPrime[ind] = false;
    }
    ll c = 1;
    for (ll i = 2; i < len; i++)
        if (isPrime[i] && g % i == 0) {
            c++;
            while (g % i == 0) {
                g /= i;
            }
        }
    if (g != 1)
        c++;
    cout << c << endl;
    return 0;
}


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

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

   vector<int> S;
   while(M!=0)
   {
      S.push_back(M%10);
      M = M/10;
   }
   
   int S_N = accumulate(S.begin(), S.end(),0);
   if(N%S_N==0) cout << "Yes" << endl;
   else cout << "No" << endl;
}

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

const long long int MOD = 1000000007LL;
long long int dp[210][210];
int main() {
  int N; cin >> N;

  dp[0][0] = 1;
  for(int i=0; i<N; i++) {
    char c; cin >> c;
    for(int j=0; j<=i+1; j++) { 
      if(c == '-') {
        dp[i+1][j] = dp[i][j];
      }
      else {
        /*
        if(c == 'D') {
          (dp[i+1][j] += dp[i][j] * j) %= MOD;
        }
        else {
          dp[i+1][j] = 1;
        }

        int is_u = (c == 'U');
        long long int add = 0;
        (add += dp[i][j     - is_u]) %= MOD;
        (add += dp[i][j + 1 - is_u] * (j + 1 - is_u)) %= MOD;


        printf("i = %d, j = %d, c = %c, add = %lld\n", i, j, c, add);
        (dp[i+1][j] *= add) %= MOD;
        */

        if(c == 'U') {
          if(j > 0) (dp[i+1][j] += dp[i][j-1]) %= MOD;
          (dp[i+1][j] += dp[i][j] * j) %= MOD;
        }
        else {
          (dp[i+1][j] += dp[i][j] * j) %= MOD;
          (dp[i+1][j] += dp[i][j+1] * (j+1) * (j+1)) %= MOD;
        }
      }
    }
  }

  /*
  for(int i=1; i<=N; i++) {
    for(int j=0; j<=N; j++) {
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }
  */
  
  cout << dp[N][0] << endl;
  return 0;
}

/*
5
U
U
-
D
D
1 0 0 0 0 0 
1 0 0 0 0 0 
1 0 0 0 0 0 
0 1 0 0 0 0 
0 2 1 0 0 0 
0

3
-
U
D
1 0 0 0 
1 0 0 0 
0 1 0 0 
0

*/

/*

8
U
D
D
D
D
D
D
D
i = 0, j = 0, c = U, add = 0
i = 0, j = 1, c = U, add = 1
i = 1, j = 0, c = D, add = 1
i = 1, j = 1, c = D, add = 1
i = 1, j = 2, c = D, add = 0
i = 2, j = 0, c = D, add = 1
i = 2, j = 1, c = D, add = 1
i = 2, j = 2, c = D, add = 0
i = 2, j = 3, c = D, add = 0
i = 3, j = 0, c = D, add = 1
i = 3, j = 1, c = D, add = 1
i = 3, j = 2, c = D, add = 0
i = 3, j = 3, c = D, add = 0
i = 3, j = 4, c = D, add = 0
i = 4, j = 0, c = D, add = 1
i = 4, j = 1, c = D, add = 1
i = 4, j = 2, c = D, add = 0
i = 4, j = 3, c = D, add = 0
i = 4, j = 4, c = D, add = 0
i = 4, j = 5, c = D, add = 0
i = 5, j = 0, c = D, add = 1
i = 5, j = 1, c = D, add = 1
i = 5, j = 2, c = D, add = 0
i = 5, j = 3, c = D, add = 0
i = 5, j = 4, c = D, add = 0
i = 5, j = 5, c = D, add = 0
i = 5, j = 6, c = D, add = 0
i = 6, j = 0, c = D, add = 1
i = 6, j = 1, c = D, add = 1
i = 6, j = 2, c = D, add = 0
i = 6, j = 3, c = D, add = 0
i = 6, j = 4, c = D, add = 0
i = 6, j = 5, c = D, add = 0
i = 6, j = 6, c = D, add = 0
i = 6, j = 7, c = D, add = 0
i = 7, j = 0, c = D, add = 1
i = 7, j = 1, c = D, add = 1
i = 7, j = 2, c = D, add = 0
i = 7, j = 3, c = D, add = 0
i = 7, j = 4, c = D, add = 0
i = 7, j = 5, c = D, add = 0
i = 7, j = 6, c = D, add = 0
i = 7, j = 7, c = D, add = 0
i = 7, j = 8, c = D, add = 0
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0

*/


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

const int MAT=50;
struct Mat { ll v[MAT][MAT]; Mat(){ZERO(v);};};
ll mo=1000000007;

Mat mulmat(Mat& a,Mat& b,int n=MAT) {
	ll mo2=4*mo*mo;
	int x,y,z; Mat r;
	FOR(x,n) FOR(y,n) r.v[x][y]=0;
	FOR(x,n) FOR(z,n) FOR(y,n) {
		r.v[x][y] += a.v[x][z]*b.v[z][y];
		if(r.v[x][y]>mo2) r.v[x][y] -= mo2;
	}
	FOR(x,n) FOR(y,n) r.v[x][y]%=mo;
	return r;
}

Mat powmat(ll p,Mat a,int n=MAT) {
	int i,x,y; Mat r;
	FOR(x,n) FOR(y,n) r.v[x][y]=0;
	FOR(i,n) r.v[i][i]=1;
	while(p) {
		if(p%2) r=mulmat(r,a,n);
		a=mulmat(a,a,n);
		p>>=1;
	}
	return r;
}

int N;
ll K;
Mat A;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	FOR(y,N) FOR(x,N) cin>>A.v[y][x];
	
	A=powmat(K,A,N);
	ll ret=0;
	FOR(y,N) FOR(x,N) ret+=A.v[y][x];
	cout<<ret%mo<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 384
import sys
input = sys.stdin.readline
N,C=map(int,input().split())
x=[]
v=[0]
for i in range(N):
    xx,vv=map(int,input().split())
    x.append(xx)
    v.append(v[i]+vv)

cw=[0]
for i in range(N):
    cw.append(max(cw[i],v[i+1]-x[i]))

ccw=[0]
for i in range(N):
    ccw.append(max(ccw[i],v[N]-v[N-i-1]-(C-x[-i-1])))

cw_ccw=0
for i in range(N-1):
    cw_ccw=max(cw_ccw,v[i+1]-x[i]*2+ccw[N-i-1])

ccw_cw=0
for i in range(N-1):
    ccw_cw=max(ccw_cw,v[N]-v[N-i-1]-(C-x[-i-1])*2+cw[N-i-1])
#print(cw,ccw)
#print(list([cw_ccw,ccw_cw]))
print(max(cw+ccw+list([cw_ccw,ccw_cw])))


Measured memory_bytes: 64092
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
#define INF 100000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 100005;
const int MOD = 1000000007;
int main(){
    int x,y,z,k;
    cin>>x>>y>>z>>k;
    vector<ll>a(x);
    vector<ll>b(y);
    vector<ll>c(z);
    REP(i,x)IN(a[i]);
    REP(i,y)IN(b[i]);
    REP(i,z)IN(c[i]);
    vector<ll>w(x*y);
    REP(i,x){
        REP(j,y){
            w[j+y*i]=a[i]+b[j];
        }
    }
    sort(ALL(w));
    reverse(ALL(w));
    int t=z*min(x*y,3000);
    vector<ll>r(t);
    REP(i,min(x*y,3000)){
        REP(j,z){
            r[j+z*i]=c[j]+w[i];
        }
    }
    sort(ALL(r));
    reverse(ALL(r));
    REP(i,k)OUT(r[i]);
    return 0;
}

Measured memory_bytes: 31616
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	ary := make([]int, n)
	for i := 0; i < n; i++ {
		ary[i] = nextInt(sc)
	}
	fmt.Println(selectionSort(ary, n))
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	num, _ := strconv.Atoi(sc.Text())
	return num
}

func trace(ary []int, n int) {
	s := strconv.Itoa(ary[0])
	for i := 1; i < n; i++ {
		s += " " + strconv.Itoa(ary[i])
	}
	fmt.Println(s)
}

func selectionSort(ary []int, n int) int {
	sw := 0
	for i := 0; i < n; i++ {
		minj := i
		for j := i; j < n; j++ {
			if ary[j] < ary[minj] {
				minj = j
			}
		}
		if i < minj {
			ary[i], ary[minj] = ary[minj], ary[i]
			sw++
		}
	}

	trace(ary, n)
	return sw
}



Measured memory_bytes: 1152
from collections import Counter 
from collections import defaultdict
from collections import deque
import math
import itertools
import heapq
import sys
sys.setrecursionlimit(10**6)

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
input_list = lambda : list(map(int,input().split()))

n,k=input_list()
k-=1
s=[v for v in input()]

diff=ord("A")-ord("a")

s[k]=(chr(ord(s[k])-diff))
print("".join(s))

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
char s[maxn];
int main()
{
	int n;
	scanf("%d %s",&n,s+1);
	int len=strlen(s+1);
	for(int i=1;i<=len;i++){
		s[i]+=n;
		if(s[i]>'Z')s[i]-=26; 
	}
	printf("%s\n",s+1);
}


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

int main() {
  int n, m, i, a;
  cin >> n >> m;
  priority_queue<int> pq;
  for (i = 0; i < n; i++) {
    cin >> a; pq.push(a);
  }
  for (i = 0; i < m; i++) {
    a = pq.top(); pq.pop();
    pq.push(a/2);
  } 
  unsigned long long ans = 0;
  for (i = 0; i < n; i++) {
    ans += pq.top(); pq.pop();
  }
  cout << ans << endl;
}

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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int INF = 1e9 + 7;

int main() {
  int n, a, b;
  cin >> n >> a >> b;

  int ans = n * a > b ? b : n * a;
  cout << ans << endl;
  return 0;
}


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

int main() {
    int N;
    cin >> N;
    const double conv = 380000;
    double x;
    string u;
    double total = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> x;
        cin >> u;
        if (u == "BTC")
            x *= conv;

        total += x;
    }

    cout << total;
    return 0;
}

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

int main() {
    string s;
    cin >> s;
    int counter = 0;
    if (s[0] == '1') ++counter;
    if (s[1] == '1') ++counter;
    if (s[2] == '1') ++counter;
    cout << counter << endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int n; ll W; cin >> n >> W;
    vll w(n), v(n);
    rep(i, n) cin >> w[i] >> v[i];

    const int M = 301;
    vector<vector<vll>> dp(n + 1, vector<vll>(n + 1, vll(M, -1)));
    dp[0][0][0] = 0;
    rep(i, n){
        rep(j, i + 1){
            rep(k, M){
                ll& cur = dp[i][j][k];
                if(cur == -1) continue;

                // not use
                chmax(dp[i + 1][j][k], cur);

                // use
                if(w[0] * (j + 1) + k + (w[i] - w[0]) <= W){
                    chmax(dp[i + 1][j + 1][k + w[i] - w[0]], cur + v[i]);
                }
            }
        }
    }

    ll res = 0;
    rep(j, n + 1){
        rep(k, M){
            chmax(res, dp[n][j][k]);
        }
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 24832
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

#define C(I) cout<<(I)<<endl

ll n,m,a,b,c,x,y,z,aa[100010],ba[100010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc;
vector<ll> va,vb,vc;

int main(){
    cin>>n;
    C(n*800-n/15*200);
}

Measured memory_bytes: 256
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
 */
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);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            in.nextInt();
            in.nextInt();
            String s = in.next();
            String t = in.next();
            long g = gcd(s.length(), t.length());
            for (int i = 0; i < g; ++i) {
                int ps = (int) ((long) i * s.length() / g);
                int pt = (int) ((long) i * t.length() / g);
                if (s.charAt(ps) != t.charAt(pt)) {
                    out.println(-1);
                    return;
                }
            }
            out.println(s.length() * (long) t.length() / g);
        }

        private long gcd(int a, int b) {
            while (b > 0) {
                int t = a % b;
                a = b;
                b = t;
            }
            return a;
        }

    }

    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 int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 25044
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N=sc.nextInt();
    int M=sc.nextInt();
    if(N==M) {
    	System.out.println("Yes");
    }else {
    	System.out.println("No");
    }
  }
}

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

int main()
{
    int n, x[200010] = {}, t[200010] = {};
    cin >> n;
    for (int i = 0; i < n; i++) {
        scanf("%d", &x[i]);
        t[i] = x[i];
    }
    sort(t, t + n);

    for (int i = 0; i < n; i++) {
        if (x[i] < t[n / 2]) printf("%d\n", t[n / 2]);
        else printf("%d\n", t[n / 2 - 1]);
    }

    return 0;
}


Measured memory_bytes: 3712
fun main(args: Array<String>) {
    readLine()
    val xs = readLine()!!.split(' ').map { it.toInt() }
    println(minimumCostSort(xs))
}

private const val MAX = 10000

private fun minimumCostSort(xs: List<Int>): Int {

    val sorted = xs.sorted()
    val table = IntArray(MAX + 1)
    val visited = BooleanArray(xs.size) { false }

    var min = MAX

    for (i in 0 until xs.size) {
        min = minOf(min, xs[i])
        table[sorted[i]] = i
    }

    var ans = 0

    for (i in 0 until xs.size) {
        if (visited[i]) continue

        var cur = i
        var s = 0
        var m = MAX
        var n = 0
        while (true) {
            visited[cur] = true
            n++
            val v = xs[cur]
            m = minOf(m, v)
            s += v
            cur = table[v]
            if (visited[cur]) break
        }

        ans += minOf(s + (n - 2) * m, s + m + (n + 1) * min)
    }

    return ans
}


Measured memory_bytes: 34024
#include <bits/stdc++.h>
using namespace std;
long a,b,c,i,ans;

int main()
{
  cin >> a >> b;
  c=__gcd(a,b);
  for(i=2;i*i<=c;++i){
    if(c%i==0){
      ++ans;
      while(c%i==0){
        c/=i;
      }
    }
  }
  
  if(c!=1){
    ++ans;
  }
  cout << ans+1;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#pragma warning(disable:4996)
using namespace std;

int main()
{
	int x;
	cin >> x;
	if (x == 7 || x == 5 || x == 3)
		printf("YES");
	else
		printf("NO");
}

Measured memory_bytes: 256