akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
double dfs(int n, int m, int sum, int k){
  if (n == 0){
    return max(sum - k, 1);
  } else {
    double ans = 0;
    for (int i = 1; i <= m; i++){
      ans += dfs(n - 1, m, sum + i, k);
    }
    return ans / m;
  }
}
int main(){
  cout << fixed << setprecision(10);
  while (1){
    int n, m, k;
    cin >> n >> m >> k;
    if (n == 0 && m == 0 && k == 0){
      break;
    }
    cout << dfs(n, m, 0, k) << endl;
  }
}


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

long long x, m, i;

int main() {
    scanf("%lld", &x);
    m = 100;
    while (m < x) {
        m = m * 1.01;
        ++i;
    }
    printf("%lld\n", i);
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	ll n,k;
	cin>>n>>k;
		cout<<min(n%k,(k-n%k))<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
bool chmin(ll& a, ll b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
bool chmax(ll& a, ll b) {
    if (b > a) {
        a = b;
        return 1;
    }
    return 0;
}
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
map<ll, ll> ZIPX, ZIPY;
vl UNZIPX, UNZIPY;
vector<PP> tasu, hiku;
vl dp(100010,0);
int main() {
    cin >> n>>m;
    rep(i, n) { cin >> x >> y;
        dp[x]++;
        dp[y]--;
     }

     rep(i, 100000) {
         chmax(ans, dp[i]);
         dp[i + 1] += dp[i];
     }

     cout << ans << endl;
}



Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<typename A, size_t N, typename T>void Fill(A (&a)[N], const T &v){fill((T*)a,(T*)(a+N),v);}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const int N=2e5;
int n, c1[N], c2[N];
string s;

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  n = sz(s);
  Fill(c1, -IINF);
  Fill(c2, -IINF);
  c1[0] = 1;
  c2[1] = 1;
  FOR(i, 0, n){
    if(i>=1 && s[i]!=s[i-1]) maxs(c1[i], c1[i-1]+1);
    if(i>=3 && (s[i]!=s[i-2] || s[i-1]!=s[i-3])) maxs(c2[i], c1[i-2]+1);
    if(i>=2){
      maxs(c1[i], c2[i-1]+1);
      maxs(c2[i], c1[i-2]+1);
    }
  }
  cout << max(c1[n-1], c2[n-1]) << endl;
}

Measured memory_bytes: 2196
N, M = map(int, input().split())
S = [[] for _ in range(N)]
for i in range(M):
    ss = list(map(int, input().split()))[1:]
    for s in ss:
        S[s - 1].append(i)
P = [int(x) for x in input().split()]
ans = 0
for bit in range(1 << N):
    den = [0] * M
    for i in range(N):
        if bit >> i & 1:
            for s in S[i]:
                den[s] += 1
    if all(d % 2 == p for d, p in zip(den, P)):
        ans += 1
print(ans)


Measured memory_bytes: 42736
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順
#include <map>

using namespace std;
using ll = long long int;

int main(){
    int a;cin>>a;
    cout << a+a*a+a*a*a << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
long long int n,A,B;
int a[100001];
int ff(int p)
{
    long long int i;
    long long int sum,t=0;
    for(i=0; i<n; i++)
    {
        sum=a[i]-p*B;
        if(sum>0)
        {
         t+=(int)ceil(sum*1.0/(A-B));
            if(t>p||t<0)
                return false;
        }
    }
     return true;
}
int main()
{
    cin>>n>>A>>B;

        int maxn=0;
        for(int i=0; i<n; i++)
        {
            cin>>a[i];
            maxn=max(maxn,a[i]);
        }
      long long  int l=0,r,h;
        h=maxn;
        while(l<h)
        {
            r=(l+h)/2;
            if(ff(r))
                h=r;
            else l=r+1;
        }
        cout<<h<<endl;

    return 0;
}


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

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

int main() {
  ll n, ans = 0, mx = 0, a;
  cin >> n;
  cin >> a;
  mx = a;
  rep(i, n - 1) {
    cin >> a;
    if (a > mx)
      mx = a;
    else if (a < mx)
      ans += mx - a;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

lange = abs(B - A)
s = V - W

res = 0

if s != 0:
    tmp = lange / s
    if tmp <= T and tmp >= 0:
        res = 1

if (res == 0):
    print("NO")
else:
    print("YES")

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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define INF (int)1e9  //
#define LINF (ll)4e18  //
#define MOD (int)(1e9)+7
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define PI 3.1415926535898

//------------------------------------------------------

int main() {
    int n;
    cin >> n;
    cout << 800 * n - (n / 15)*200 << endl;

    return 0;
}



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

using namespace std;
	
	
class Hoge{
			
		long long iN,iA,iB,iC,iD,iE;
		long long imin,itime;
		
		void findmin();
		
		public:
			Hoge(int hoge){
							cin>>iN>>iA>>iB>>iC>>iD>>iE;
			}
							
							
		void findtime();
		virtual ~Hoge(){	
						
						
						}
};

void Hoge::findmin(){

						imin=iA;
						//cout<<imin<<endl;
					if(imin>iB){
								imin=iB;
								//cout<<imin<<endl;
								}
					if(imin>iC){
								imin=iC;
								//cout<<imin<<endl;
								}
					if(imin>iD){
								imin=iD;
								//cout<<imin<<endl;
								}
					if(imin>iE){
								imin=iE;
								//cout<<imin<<endl;
								}
									
							//cout<<"imin="<<imin<<endl;
						}//endfunc

void Hoge::findtime(){
							findmin();
							itime=(iN/imin)-1+5;
							if(iN%imin!=0){itime++;}
							cout<<itime<<endl;
							
						}
						



int main()
{
	
	Hoge* ph0=new Hoge(0);

	
	
	ph0->findtime();
	delete ph0;

	
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
using namespace std;

//素数判定
inline bool IsPrime(int p) {
	if (p == 1) return false;
	for (int i = 2; i <= sqrt(p); i++) {
		if (p%i == 0) return false;
	}
	return true;
}

//10進数の自然数の桁数を返す
inline int GetDigit(int num) {
	return (int)log10(num) + 1;
}

//各位の和を返す
int GetDigitsSum(int num) {
	int N = 0;
	while (num > 0) {
		N += num % 10;
		num /= 10;
	}
	return N;
}

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

	if (N == 7 || N == 5 || N == 3) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y, int m) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y, int m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n;
vector<int> vec;

signed main() {
	cin >> n;
	if (n <= (n ^ (n - 1))) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	vec.push_back(0);
	for (int i = 4;; i *= 2) {
		if (n < i - 1)break;
		vec.push_back(i - 1);
	}
	for (int i = 1; i < (int)vec.size(); i++) {
		if (1 < i)cout << vec[i - 1] + n << " " << vec[i - 1] + 1 << endl;
		for (int j = vec[i - 1] + 2; j <= vec[i]; j++)cout << j - 1 << " " << j << endl;
		cout << vec[i] << " " << vec[i - 1] + n + 1 << endl;
		for (int j = vec[i - 1] + 2 + n; j <= vec[i] + n; j++)cout << j - 1 << " " << j << endl;
	}
	if (vec.back() == n)return 0;
	int p = vec.back();
	cout << p + 1 << " " << 1 << endl;
	cout << p + 2 + n << " " << p + 1 << endl;
	cout << p + 2 << " " << 1 << endl;
	cout << p + 2 << " " << p + 1 + n << endl;
	int k = p + 3;
	int s = 0;
	for (int i = 1; i < (int)vec.size(); i++) {
		for (int j = vec[i - 1] + 1; j <= vec[i]; j++) {
			if (n < k)return 0;
			s ^= j;
			if (j % 2)continue;
			if (s % 2) {
				cout << p + 2 << " " << k << endl;
				cout << j << " " << k + n << endl;
				k++;
				if (n < k)return 0;
				cout << p + 1 << " " << k << endl;
				cout << j << " " << k + n << endl;
				k++;
			}
			else {
				cout << p + 1 << " " << k << endl;
				cout << j << " " << k + n << endl;
				k++;
				if (n < k)return 0;
				cout << p + 2 << " " << k << endl;
				cout << j << " " << k + n << endl;
				k++;
			}
		}
	}
}

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

void dfs(string s, char mc){
  if(s.size()==N){
    cout << s << endl;
  }else{
    for(char c='a'; c<=mc; c++){
      if(c==mc){
        dfs(s+c, (char)(mc+1));
      }else{
        dfs(s+c, mc);
      }
    }
  }
}

int main(){
  cin >> N;
  dfs("",'a');
  return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;n>i;++i)
#define MOD 1000000007
using namespace std;
using ll=int64_t;
using pii=pair<int,int>;
using vi=vector<int>;
using VI=vector<ll>;
using vis=vector<string>;
using vvi=vector<vi>;
//最大公約数
int gcd(int a,int b){
    if(a%b==0)
    return b;
    return gcd(b,a%b);
}
//最小公倍数
int lcm(int a,int b){
   return a*b/gcd(a,b);
}
bool prime(int num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0)
        return false;
    }
    return true;
}
int main(){
    ll h,n,ans=0;
    cin>>h>>n;
    VI a(n);
    rep(i,n){
        cin>>a[i];
        ans+=a[i];
    }
    if(ans>=h)
    cout<<"Yes"<<endl;
    else
    {
        cout<<"No"<<endl;
    }
}

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const int INF = 1001001000;
const double EPS = 0.000000001;

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

bool pC(const P& pair1, const P& pair2) {
    return pair1.second > pair2.second;
}

VI par(100001);
VI drank(100001);
VI chi(100001);
void init(int n) {
  for(int i = 0; i < n; i++) {
    par[i] = i;
    drank[i] = 0;
    chi[i] = 1;
  }
}

int find(int x) {
  if(par[x] == x) {
    return x;
  }
  else {
    return par[x] = find(par[x]);
  }
}

void unite(int x, int y) {
  int parx = find(x);
  int pary = find(y);
  if(parx == pary) return;

  if(drank[parx] < drank[pary]) {
    chi[pary] += chi[parx];
    par[parx] = pary;
  }
  else {
    chi[parx] += chi[pary];
    par[pary] = parx;
    if(drank[parx] == drank[pary]) drank[parx]++;
  }
}

bool same(int x, int y) {
  return find(x) == find(y);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  VI x(m), y(m), z(m);
  init(n);
  REP(i, m){
    cin >> x[i] >> y[i] >> z[i];
    unite(x[i], y[i]);
  }
  set<int> set;
  REP(i, n){
    set.insert(find(i));
  }
  out(set.size());
  return 0;
}


Measured memory_bytes: 7296
#include<stdio.h>
#include<string.h>

void insert(int);
void delete(int);
void deleteF(void);
void deleteL(void);
int data[1000000],top=0,Last=0;

int main(){
	int n,i,b,x=0;
	char a[15];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",a);
		if(strcmp(a,"insert")==0){
			scanf("%d",&b);
			insert(b);
		}else if(strcmp(a,"delete")==0){
			scanf("%d",&b);
			delete(b);
		}else if(strcmp(a,"deleteFirst")==0){
			deleteF();
		}else if(strcmp(a,"deleteLast")==0){
			deleteL();
		}
	}
	for(i=top-1;i>=Last;i--){
		if(i==Last){
			if(data[i]==NULL){
				printf("\n");
				break;
			}else{
				if(x>0)printf(" ");
				printf("%d\n",data[i]);
				break;
			}
		}else if(data[i]==NULL){
			continue;
		}else{
			 if(x>0){
			 	printf(" %d",data[i]);
			 }else{
			 x++;
			 printf("%d",data[i]);
			 }
		}
	}
	return 0;
}
void insert(int x){
	data[top]=x;
	top++;
}
void delete(int x){
	int i;
	for(i=top-1;i>=Last;i--){
		if(data[i]==x){
			data[i]=NULL;
			break;
		}
	}
}
void deleteF(){
	int i=top-1;
	while(1){
		if(data[i]!=NULL){
			data[i]=NULL;
			top=i;
			break;
		}
		i--;
	}
}
void deleteL(){
	int i=Last;
	while(1){
		if(data[i]!=NULL){
			data[i]=NULL;
			Last=i+1;
			break;
		}
		i++;
	}
}


Measured memory_bytes: 5700
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long n = (c - a - b) * (c - a - b);

		if(c - a - b < 0) {
			System.out.println("No");
		}else if(4 * a * b < n){
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	}
}


Measured memory_bytes: 21972
#include <cstdio>
#include <vector>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n;
	scanf("%d",&n);
	vector<long long> a(n);
	rep(i,n) scanf("%lld",&a[i]);

	vector<int> par(60); // parity
	rep(t,60) rep(i,n) if(a[i]&(1LL<<t)) par[t]^=1;

	vector<vector<int>> A; // augmented matrix
	vector<int> piv,res(60);
	for(int t=59;t>=0;t--) if(!par[t]) {
		A.emplace_back(vector<int>(n+1));
		int m=A.size();
		rep(i,n) if(a[i]&(1LL<<t)) A[m-1][i]=1; // lhs
		A[m-1][n]=1; // rhs

		// Gauss-Jordan on F_2
		rep(i,m-1) if(~piv[i] && A[m-1][piv[i]]) {
			rep(j,n+1) A[m-1][j]^=A[i][j];
		}
		int p=-1; // pivot of m-th row (-1: don't exist)
		rep(j,n) if(A[m-1][j]) { p=j; break; }
		if(p==-1 && A[m-1][n]){ // NG
			res[t]=0;
			A[m-1][n]=0;
		}
		else{ // OK
			res[t]=1;
		}
		piv.emplace_back(p);
	}

	long long ans=0;
	bool carry=false;
	rep(t,60){
		if(!par[t]){
			if(res[t]){ // 1 + 1 + carry
				if(carry) ans+=1LL<<t;
				carry=true;
			}
			else{ // 0 + 0 + carry
				if(carry) ans+=1LL<<t;
				carry=false;
			}
		}
		else{ // 0 + 1 + carry
			if(!carry){
				ans+=1LL<<t;
			}
		}
	}
	if(carry) ans+=1LL<<60;

	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 24576
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    int N;
    cin >> N;
    vec<int> C(N - 1), S(N - 1), F(N - 1);
    rep(i, N - 1) cin >> C[i] >> S[i] >> F[i];

    rep(i, N - 1) {
        int nows = S[i] + C[i];
        for (int j = i + 1; j < N - 1; ++j) {
            if (nows >= S[j])
                nows = nows + (F[j] - ((nows) % F[j])) % F[j];
            else
                nows = S[j];
            nows += C[j];
        }
        cout << nows << endl;
    }
    cout << 0 << endl;
}

Measured memory_bytes: 256
package main

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

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int64) (int, int64) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	x := nextInt()
	y := nextInt()
	a := nextInt()
	b := nextInt()
	c := nextInt()
	p := nextInts(a)
	q := nextInts(b)
	r := nextInts(c)
	sort.Ints(p)
	sort.Ints(q)
	p = p[len(p)-x : len(p)]
	q = q[len(q)-y : len(q)]
	r = append(r, p...)
	r = append(r, q...)
	sort.Ints(r)
	r = r[len(r)-(x+y) : len(r)]
	var ans int64
	for _, ri := range r {
		ans += int64(ri)
	}
	fmt.Println(ans)
}


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

#define inf 0x3f3f3f3f
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector <ull> vu;
typedef vector <vector <int>> vvi;
typedef pair <int, int> pi;
typedef vector <pair <int, int>> vpi;

int n, t;

void read() {
  cin >> n >> t;
}

void solve() {
  int mincost = 1e9, time = 1e9;
  for(int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    if (x < mincost)
      if (y <= t) {
        mincost = x;
        time = y;
      }
  }
  if (time > t) {
    cout << "TLE";
  } else cout << mincost;
}

int main() {
  ios :: sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  //cin >> t; //please do not forget to comment this if there are no queries
  while(t) {
    --t;
    read();
    solve();
  }
  return 0;
}


Measured memory_bytes: 256
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){

    int N;
    cin >> N;

    int V[N],C[N];

    for( int ni = 0 ; ni < N ; ni++ ){
        cin >> V[ni];
    }
    for( int ni = 0 ; ni < N ; ni++ ){
        cin >> C[ni];
    }

    int ans=0;
    for( int ni = 0 ; ni < N ; ni++ ){
        if(V[ni]-C[ni]>0){
            ans = ans + V[ni]-C[ni];
        }
    }


    cout << ans;    

}

Measured memory_bytes: 256
module Main where

import Control.Applicative
import Numeric

main :: IO ()
main = loop

loop :: IO ()
loop = do
  { [m, f, r] <- getInts
  ; if m == -1 &&  f == -1 && r == -1 then return()
    else if m == -1 || f == -1 then putStrLn "F" >> loop 
    else if m + f >= 80 then putStrLn "A" >> loop
    else if m + f >= 65 then putStrLn "B" >> loop
    else if m + f >= 50 then putStrLn "C" >> loop
    else if m + f >= 30 then putStrLn (if r >= 50 then "C" else "D" ) >>loop
    else putStrLn "F" >> loop
  }

--
getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDoubles

showDoubles :: Double -> String
showDoubles d = showFFloat Nothing d ""





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

int main() {
  int n; cin>>n;
  vector<int> x(n);
  
  for (int i; i<n; i++) cin>>x[i];
  sort(x.begin(), x.end());
  
  int ans=1000000;
  for (int j=x[0]; j<=x[n-1]; j++){
    int t_ans=0;
    for (auto d : x){
      t_ans+=pow(j-d,2);
    }
    ans=min(ans,t_ans);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class ADigitsSum {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        int N, ans = 10101010;
        in>>N;
        auto dsum = [](int x){
            int res = 0;
            while(x){
                res += x % 10;
                x /= 10;
            }
            return res;
        };
        FOR(i, 1, N){
            int j = N - i;
            chmin(ans, dsum(i)+dsum(j));
        }
        out<<ans<<'\n';
    }
};


int main() {
	ADigitsSum solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main(){
  string s;
  cin>>s;
  bool flag(false);
  for (int i(1);i<s.size();i++){
    if (s[i]!='9') flag=true;
  }
  if (flag){
    cout << (s[0]-'1')+9*(s.size()-1) << endl;
  }else{
    int cnt(0);
    for (int i(0);i<s.size();i++){
      cnt+=(s[i]-'0');
    }
    cout << cnt << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main()
{
    string s;
    cin >> s;
    string ans = "";
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == 'B') {
            if (!ans.empty()) ans.pop_back();
        }
        else ans.push_back(s[i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl

const ll INF = (ll)(1e18) + 1;
const int MAXN = 200005;

vector<ll> a(MAXN);

bool f(ll x, ll k) {
  ll sum = 0LL;
  int n = a.size();
  rep(i, n) {
    int ng = a[i] < 0 ? -1 : n;
    int ok = a[i] < 0 ? n : -1;
    while(abs(ok - ng) > 1) {
      int mid = (ng + ok) / 2;
      if(a[mid] * a[i] < x)
        ok = mid;
      else
        ng = mid;
    }
    sum += a[i] < 0 ? n - ok : ok + 1;
  }
  rep(i, n) if(a[i] * a[i] < x) sum--;
  sum >>= 1;
  return sum < k;
}

int main() {
  int n;
  ll k;
  cin >> n >> k;
  a.resize(n);
  rep(i, n) cin >> a[i];
  sort(all(a));
  ll ok = -INF, ng = INF;
  while(abs(ok - ng) > 1) {
    ll mid = (ok + ng) / 2;
    if(f(mid, k))
      ok = mid;
    else
      ng = mid;
  }
  cout << ok << endl;
  return 0;
}

Measured memory_bytes: 1792
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

aa=sorted(nl())[::-1]

ans = 0
if(aa[1]-aa[2])%2==1:
  aa[0]+=1
  aa[1]+=1
  ans=1
ans+=(aa[1]-aa[2])//2
ans += aa[0]-aa[1]
print(ans)


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

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++)  cin >> v[i];
    multiset<int> s;
    for(int i = 0; i < n; i++){
        if(s.empty()){
            s.insert(v[i]);
        }else{
            auto it = s.lower_bound(v[i]);
            if(it == s.begin()){
                s.insert(v[i]);
            }else{
                it--;
                s.erase(it);
                s.insert(v[i]);
            }
        }
    }
    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 5376
#include"bits/stdc++.h"
using namespace std;

#define ll long long
#define INF INT_MAX/3
#define pi 2*acos(0.0)
#define eps 1e-14
typedef pair<int, int> P;
const int MAX_H = 1001;
const int MAX_M = (int)1e+2;
int H, W, N;
char x[MAX_H][MAX_H];
bool used[MAX_H][MAX_H];
int d[MAX_H][MAX_H];

//???????????°
int xp[10], yp[10]; //1???????????????????????????????????¨?????¨???
void input()
{
	cin >> H >> W >> N;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> x[i][j];
			if (x[i][j] != 'X'&&x[i][j] != 'S' && x[i][j]!='.') {
				int a = atoi(&x[i][j]);
				xp[a] = i, yp[a] = j; 
			}
			if (x[i][j] == 'S') {
				xp[0] = i, yp[0] = j;
			}
		}
	}
}

int dx[] = { -1,0,0,1 }, dy[] = { 0,-1,1,0 };
int x_l, y_l;
int sx, sy, gx, gy;
int bfs() {
	
	queue<P> que;
	for (int i = 0; i < H; i++)
		for (int j = 0; j < W; j++)
			d[i][j] = INF;
	que.push(P(sx, sy));
	d[sx][sy] = 0;

	while (que.size()) {
		P p = que.front(); que.pop();
		if (p.first == gx&&p.second == gy) break;
		for (int i = 0; i < 4; i++) {
			int nx = p.first + dx[i], ny = p.second + dy[i];

			if (0 <= nx&&nx < H && 0 <= ny&&ny < W&&x[nx][ny] != 'X' &&d[nx][ny] == INF) {
				que.push(P(nx, ny));
				d[nx][ny] = d[p.first][p.second] + 1;
			}
		}
	}
	return d[gx][gy];
}
int main() {
	input();
	int ans = 0;
	for (int i = 0; i < N; i++) {
		sx = xp[i], sy = yp[i];
		gx = xp[i + 1], gy = yp[i + 1];
		ans += bfs();
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7908
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
signed main()
{
int x=0,y=0,z=0,w=0,n=0,m=0,a=0,b=0;
string s="";
std::cin >> s;
rep(i,s.size()){
  if(i==0){
    if(s[i]!='A'){
      std::cout << "WA" << '\n';
      return 0;
    }
  }
  else if(i>=2&&i<=s.size()-2&&s[i]=='C'){
    x++;
  }
  else if(isupper(s[i])){
    std::cout << "WA" << '\n';
    return 0;
  }
}
if(x==1)std::cout << "AC" << '\n';
else std::cout << "WA" << '\n';
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N, K;
char buf[5111];
string S;

void MAIN() {
    scanf("%d%d%s", &N, &K, buf);
    S = buf;

    char mi = *min_element(S.begin(), S.end());
    bool all = false;
    string ans = "|";
    if (K >= 20) {
	all = true;
    } else {
	string T = S;
	reverse(T.begin(), T.end());
	string U = S+T;
	REP (i, N+1) if (U[i+N-1] == mi) {
	    string sub = U.substr(i, N);
	    LL cnt = 0;
	    REP (j, N) {
		if (sub[j] == mi) cnt++;
		else cnt = 0;
	    }
	    LL r = cnt<<(K-1);
	    if (r >= N) {
		all = true;
		break;
	    } else {
		sub += string(r-cnt, mi);
		reverse(sub.begin(), sub.end());
		sub = sub.substr(0, N);
		amin(ans, sub);
	    }
	}

    }

    if (all) {
	puts(string(N, mi).c_str());
    } else {
	puts(ans.c_str());
    }
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 384
import sys
N=int(sys.stdin.readline().strip())
A=map(int, sys.stdin.readline().split())
ans=0
trend=None
prev=None
for a in A:
    if prev is None:
        ans+=1
    elif prev<a:
        if trend is None:
            trend="plus"
        elif trend=="plus":
            pass
        elif trend=="minus":
            ans+=1
            trend=None
    elif prev>a:
        if trend is None:
            trend="minus"
        elif trend=="plus":
            ans+=1
            trend=None
        elif trend=="minus":
            pass
    elif prev==a:
        if trend is None:
            pass
        elif trend=="plus":
            pass
        elif trend=="minus":
            pass
    prev=a

print ans

Measured memory_bytes: 41644
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

int INF = 1000000;
/* sample input

*/
ll n;
ll answer = 0;
struct point {
	int x;
	int y;
	int type;//1:red, 2:blue;
};

bool compx(point a, point b) {
	return a.x < b.x;
}

bool compy(point a, point b) {
	return a.y > b.y;
}

int main()
{
	cin >> n;

	//point *p;
	// p = new point[2 * n];
	point p[200];

	for (ll i = 0; i < n; i++) {
		cin >> p[i].x >> p[i].y;
		p[i].type = 1;
	}
	for (ll i = n; i < 2*n; i++) {
		cin >> p[i].x >> p[i].y;
		p[i].type = 2;
	}

	sort(p, p + 2 * n, compx);


	vector<point> v;
	for (int i = 0; i < 2 * n; i++) {
		if (p[i].type == 1) {
			v.push_back(p[i]);
		}
		else if (p[i].type == 2) {
			if (!v.empty()&&p[i].x>v[v.size()-1].x) {
				sort(v.begin(), v.end(), compy);
				for (int j = 0; j < v.size(); j++) {
					if (v[j].y < p[i].y) {
						v.erase(v.begin()+j);
						answer++;
						break;
					}
				}
			}
		}
	}

	cout << answer << endl;


	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N,M = map(int,input().split())
PY =[]
for i in range(M):
    P,Y = map(int,input().split())
    PY.append([i,P,Y])
PY.sort(key=lambda x:x[2])
PY.sort(key=lambda x:x[1])
lis = [0]*M
tmp = 0
num = 1
for ind,j in enumerate(PY):
    if j[1] == tmp:
        num += 1
        PY[ind][2] = num
        tmp = PY[ind][1]
    else:
        num = 1
        PY[ind][2] = num
        tmp = PY[ind][1]
PY.sort(key=lambda x: x[0])
for i in range(M):
    prt1 = str(1000000+PY[i][1])
    prt2 = str(1000000+PY[i][2])
    print(prt1[1:]+prt2[1:])



Measured memory_bytes: 25116
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B._1_Dimensional_World_s_Tale
{
    class Program
    {
        static void Main(string[] args)
        {
            var NMXY = Console.ReadLine().Split(null).Select(x => int.Parse(x)).ToList();
            var N = NMXY[0];
            var M = NMXY[1];
            var X = NMXY[2];
            var Y = NMXY[3];

            var Xn = Console.ReadLine().Split(null).Select(x => int.Parse(x)).ToList();
            var Yn = Console.ReadLine().Split(null).Select(x => int.Parse(x)).ToList();

            Xn.Add(X);
            Yn.Add(Y);

            if (Xn.Max() < Yn.Min())
                Console.WriteLine("No War");
            else
                Console.WriteLine("War");
        }
    }
}

Measured memory_bytes: 13396
A, B, C = map(int, input().split())
ans = 0
if A == B and B == C and A%2 == 0:
    print(-1)
else:
    while A%2 == 0 and B%2 == 0 and C%2 == 0:
        ans += 1
        A, B, C = B//2+C//2, A//2+C//2, A//2+B//2
    print(ans) 

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <set>
#define INF 1000000000000
using namespace std;
using ll = long long;
int main(){
    ll n;
    cin >> n;
    vector<ll> h(n,0);
    ll ans = 0;
    ll temp;
    bool flag = false;
    for(ll i=1;i<=n;i++){
        ll x;
        cin >> x;
        if(flag == false){
            if(x != 0){
                ans+=x;
                temp = x;
                flag=true;
            }
        }else{
            if(x == 0){
                flag = false;
                
            }else{
                if(x-temp>0){
                    ans+=x-temp;
                }
                temp = x;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define newl "\n"
using namespace std;
using lli = long long int;
using vvint = vector <vector <int>>;
const int mod = 1e9 + 7;

const int N = 2e5 + 1;

void solve(){
	int r,c,k;
	cin >> r >> c >> k;
	vector <vector <int>> a(r,vector <int>(c));
	for(int i = 0;i < k;++i){
		int ri,ci,vi;
		cin >> ri >> ci >> vi;
		--ri,--ci;
		a[ri][ci] = vi;
	}	
	vector <vector <lli>> dp(r * c,vector <lli>(4));
	dp[(r - 1) * c + c - 1][3] = dp[(r - 1) * c + c - 1][2] = dp[(r - 1) * c + c - 1][1] = a[r - 1][c - 1];
	dp[(r - 1) * c + c - 1][0] = 0;
	for(int i = r - 2;i >= 0;--i){
		dp[i * c + c - 1][3] = dp[(i + 1) * c + c - 1][3] + a[i][c - 1];
		dp[i * c + c - 1][2] = dp[(i + 1) * c + c - 1][2] + a[i][c - 1];
		dp[i * c + c - 1][1] = dp[(i + 1) * c + c - 1][1] + a[i][c - 1];
		dp[i * c + c - 1][0] = 0;
	}
	for(int j = c - 2;j >= 0;--j){
		dp[(r - 1) * c + j][3] = max(dp[(r - 1) * c + j + 1][2] + a[r - 1][j], dp[(r - 1) * c + j + 1][3]);
		dp[(r - 1) * c + j][2] = max(dp[(r - 1) * c + j + 1][1] + a[r - 1][j], dp[(r - 1) * c + j + 1][2]);
		dp[(r - 1) * c + j][1] = max(dp[(r - 1) * c + j + 1][0] + a[r - 1][j], dp[(r - 1) * c + j + 1][1]);
		dp[(r - 1) * c + j][0] = 0;
	}
	for(int i = r - 2;i >= 0;--i){
		for(int j = c - 2;j >= 0;--j){
			dp[i * c + j][3] = max(max(dp[i * c + j + 1][2] + a[i][j],dp[(i + 1) * c + j][3] + a[i][j]),dp[i * c + j + 1][3]);
			dp[i * c + j][2] = max(max(dp[i * c + j + 1][1] + a[i][j],dp[(i + 1) * c + j][3] + a[i][j]),dp[i * c + j + 1][2]);
			dp[i * c + j][1] = max(max(dp[i * c + j + 1][0] + a[i][j],dp[(i + 1) * c + j][3] + a[i][j]),dp[i * c + j + 1][1]);
			dp[i * c + j][0] = dp[(i + 1) * c + j][3];
		}
	}
	cout << dp[0][3] << newl;
	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(10);
	#ifdef EXECUTE_LOCALLY
		   freopen("in.txt","r",stdin);
	#endif
	int t = 1;
	//cin >> t;
	while(t--) solve();
	#ifdef EXECUTE_LOCALLY
    	cout << setprecision(3) << "program time: " << (double)clock() / CLOCKS_PER_SEC << newl;
	#endif
	return 0;
}


Measured memory_bytes: 671308
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		try {
			String input = br.readLine();
			String[] splitInput = input.split(" ");
			
			List<Integer> inputList = new ArrayList<Integer>();

			inputList.add(Integer.parseInt(splitInput[0]));
			inputList.add(Integer.parseInt(splitInput[1]));
			inputList.add(Integer.parseInt(splitInput[2]));
			
			for (int num : inputList) {
				if (!(num >= 1 && num <= 10000)){
					throw new IllegalArgumentException();
				}
			}
			
			Collections.sort(inputList);
			
			System.out.println(inputList.get(0) + " " + inputList.get(1) + " " + inputList.get(2));

		
		} catch(NumberFormatException e) {
			e.printStackTrace();
		} catch(IllegalArgumentException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 24208
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

ll gcd(ll x,ll y){
    if(y==0) return x;
    return gcd(y,x%y);
}

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

    ll div_c,div_d,div_cd;
    div_c = b/c-(a-1)/c;
    div_d = b/d-(a-1)/d;
    ll x = c*d/gcd(c,d);
    if(c==1 || d==1){
        cout<<0<<endl;
        return 0;
    }else{
        div_cd = b/x - (a-1)/x;
        cout<<b-a+1 - (div_c+div_d- div_cd)<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
const int inf=1e9+7;
const ll mod=1e9+7;

int main() {
    double R;
    cin>>R;
    double PI = 3.1415926535;
    cout<<setprecision(10)<<2*PI*R<<endl;
}



Measured memory_bytes: 3784
//C
#include <cassert>
//#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//ここまで標準include

using namespace std;

long aCb(long a, long b) {
	long out = 1;
	for (long i = 1; i <= b; i++) {
		out = out * (a + 1 - i) / i;
	}
	return out;
}

long long gcd(long long a, long long b) {
	long long r = -1;
	if (a < b) {
		swap(a, b);
	}
	while (r != 0) {
		r = a % b;
		if (r == 0) {
			return b;
		}
		else {
			a = b;
			b = r;
		}
	}
}

long long lcm(long long a, long long b) {
	return a * b / gcd(a, b);
}

int main() {
	int n;
	cin >> n;
	vector<string>a(n);
	vector<int>b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	string s;
	cin >> s;
	int m;
	for (int i = 0; i < n; i++) {
		if (a[i] == s) {
			m = i + 1;
			break;
		}
	}
	int sum = 0;
	for (int i = m; i < n; i++) {
		sum += b[i];
	}
	cout << sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <map>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;

int N, M;
int a[51], b[51];
bool graph[51][51];
bool visited[51];
string S, T;

void dfs(int from){
    visited[from]=true;
    for(int to=0; to<N; ++to){
        if(!graph[from][to]) continue;
        if(visited[to]) continue;
        dfs(to);
    }
}
void solve(){
    for(int i=0; i<M; ++i){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;
    }
    int ans=0;
    
    for(int i=0; i<M; ++i){
        graph[a[i]][b[i]]=graph[b[i]][a[i]]=false;
        
        for(int j=0; j<N; ++j) visited[j]=false;
        
        dfs(0);
        bool bridge = false;
        for(int j=0; j<N; ++j) if(!visited[j]) bridge=true;
        if(bridge) ans++;
    
        graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;
    }
    cout << ans << endl;
        
}
int main() {
    cin >> N >> M;
    solve();
	return 0;
}

Measured memory_bytes: 256
al = [chr(ord('a') + i) for i in range(26)]

H, W = map(int, input().split())
A = [input() for _ in range(H)]

cnt = [0] * 26
for h in range(H):
    for w in range(W):
        cnt[al.index(A[h][w])] += 1
cnt = [i for i in cnt if i != 0]
cnt.sort(reverse=True)

if H % 2 == 1 and W % 2 == 1:
    count = (H//2) * (W//2)
    while count > 0:
        count -= 1
        cnt[0] -= 4
        cnt.sort(reverse=True)
    cnt = [i for i in cnt if i != 0]
    count = (H//2) + (W//2)
    while count > 0:
        count -= 1
        cnt[0] -= 2
        cnt.sort(reverse=True)
    cnt = [i for i in cnt if i != 0]
    if sum(cnt) == 1 and len(cnt) == 1:
        ans = "Yes"
    else:
        ans = "No"
elif H % 2 == 0 and W % 2 == 0:
    count = (H//2) * (W//2)
    while count > 0:
        count -= 1
        cnt[0] -= 4
        cnt.sort(reverse=True)
    cnt = list(set(cnt))
    if cnt[0] == 0 and len(cnt) == 1:
        ans = "Yes"
    else:
        ans = "No"
else:
    count = (H//2) * (W//2)
    while count > 0:
        count -= 1
        cnt[0] -= 4
        cnt.sort(reverse=True)
    cnt = [i for i in cnt if i != 0]
    cnt.sort(reverse=True)
    count = (H%2) * (W//2) + (H//2) * (W%2)
    while count > 0:
        count -= 1
        cnt[0] -= 2
        cnt.sort(reverse=True)
    cnt =list(set(cnt))
    if cnt[0] == 0 and len(cnt) == 1:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int a, b;
  cin >> a >> b;
  
  if((a + b) % 2 == 0){
    cout << (a + b) / 2 << endl;
  }
  else
    cout << "IMPOSSIBLE" << endl;
}
     

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N;
    cin >> N;
    vector<ll> v(10001);
    REP(i,1,101){
        REP(j,1,101){
            REP(k,1,101){
                if(i*i + j*j + k*k + i*j + j*k + k*i <10001){
                    v[i*i + j*j + k*k + i*j + j*k + k*i]++; 
                }
            }
        }
    }
    REP(i,1,N+1){
        cout << v[i] << endl;
    }
}


Measured memory_bytes: 3668
if __name__ == "__main__":
    H1, M1, H2, M2, K= list(map(int, input().split()))

    H = (H2 - H1)*60
    M = (M2 - M1)

    if H + M - K > 0:
        print(H + M - K)
    else:
        print(0)


Measured memory_bytes: 9104
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        double x=Math.PI;
        Scanner scanner = new Scanner(System.in);
        // System.out.println("Input real number");
        double num = scanner.nextDouble();
        // System.out.println(x);
        System.out.println(String.format("%.6f",num*num*x) + " " + String.format("%.6f",2*num*x));
        
    }


    
}


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

bool cmp(pair<int, pair<string, int>> n, pair<int, pair<string, int>> m)
{
  if (n.second.first == m.second.first) {
	return n.second.second > m.second.second;
  } else {
	return n.second.first < m.second.first;
  }

}


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

  vector<pair<int, pair<string, int>>> rest;
  for (int i = 0; i < n; i++) {
	string s;
	int p;
	cin >> s >> p;
	rest.push_back(make_pair(i, make_pair(s, p)));
  }

  sort(rest.begin(), rest.end(),  cmp);
  
  for (pair<int, pair<string, int>> tmp : rest)
	cout << tmp.first + 1 << endl; 

  return 0;
}


Measured memory_bytes: 256