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

using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")

#define fastIO               \
    ios::sync_with_stdio(0); \
    cin.tie(NULL);              \
    cout.tie(NULL);

#define int long long

#define el "\n"
#define sz(a) ((int)(a).size())
#define lh(a) ((int)(a).length())
#define all(v) (v).begin(), (v).end()
#define tr(c, it) for ((it) = (c).begin(); (it) != (c).end(); it++)
#define pt(v, val) ((v).find(val) != (v).end())      
#define vpt(v, val) (find(all(v), val) != (v).end()) 
#define lb(v,val) lower_bound(all(v),val)
#define ub(v,val) upper_bound(all(v),val)
#define fr(i,n) for (int i = 0; i < n; i++)
#define fr1(j,a,b) for(int j = a; j<b; j++) 
#define fb(i, a, b) for (int i = (b); i >= (a); i--)
#define fri(n) for(int i=0;i<n;) 

#define pb push_back
#define mp make_pair
#define in insert
#define ft first
#define sd second
#define lmi LLONG_MIN
#define lma LLONG_MAX
#define ulma ULLONG_MAX
#define rsort(v) (sort(all(v), greater<int>()))

#define cn \
    int n; \
    cin >> n
#define ii(a) \
   int a; \
   cin >> a
#define get(v) \
   vector<int> v; \
   fr(i,n){ \
   ii(x); \
   v.pb(x); \
   }

#define fia cin >> a[i]
#define foa cout << a[i] << " "
#define sg string

typedef vector<int>::iterator vit;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int, int> > vpii;
typedef set<int> si;
typedef set<char> sc;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef map<string,int> msi;
typedef pair<int, int> pii;
typedef stack<int> sti;
typedef stack<char> stc;

void solve()
{
    cn;
    ii(k);
    get(v);
    int sum=0;
    sort(all(v));
    fr(i,k){
        sum+=v[i];
    }
    cout<<sum;
}
int32_t main(int32_t argc, char **argv)
{

fastIO;

int t=1;
//cin>>t;
while(t--) {
solve();
cout<<el;
}

cerr << "Time : " << ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

return 0;
}

Measured memory_bytes: 3840
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <tr1/unordered_map>
#define mo 1000000007
#define num(x) (x>='0' && x<='9')
typedef unsigned long long ull;
typedef long long ll;
using namespace std::tr1;
using namespace std;
int read(){
    int p=0, q=1;
    char ch=getchar();
    while (!num(ch))
        (ch=='-'?q=-1:0),
        ch=getchar();
    while (num(ch)) p=p*10+ch-'0', ch=getchar();
    return p*q;
}
int power(ll a, int b){
	ll c=1;
	while (b){
		if (b&1) c=c*a%mo;
		a=a*a%mo;
		b>>=1;
	}
	return c;
}
int n=8;
int rt[]={400,600,800,1000,1200,1400,1600,1800};
int sc[]={8,7,6,5,4,3,2,1};
int main(){
	int x=read();
	int res;
	for (int i=0;i<n;i++)
		if (rt[i]<=x) res=sc[i];
	cout<<res<<endl;
	
    return 0;
}

Measured memory_bytes: 3632
def main():
    n = int(input())
    a = [list(map(int, input().split())) for i in range(n)]
    t, x, y = [0], [0], [0]
    t.extend([row[0] for row in a])
    x.extend([row[1] for row in a])
    y.extend([row[2] for row in a])
    flag = True
    for i in range(n):
        dt = t[i+1] - t[i]
        dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
        if dt < dist:
            print('No')
            flag = False
            break
        elif dt % 2 != dist % 2:
            print('No')
            flag = False
            break
    if flag == True:
        print('Yes')
if __name__ == '__main__':
    main()
    


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


int main(){
  
  
  unsigned long long int n,l,cnt=0,i,x;
  unsigned long long int d=0;
  cin>>n>>x;
  
  if(d<=x) cnt=1;
  
  for(i=1;i<=n;i++){
    cin>>l;
    d = d+l;
    if(d<=x)
      cnt++;
   
  }
  cout<<cnt;
  
  return 0;
}
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,ma=0,mi=1000,a;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		ma=max(ma,a);
		mi=min(mi,a);
	}
	cout<<ma-mi<<endl;
}

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

int A[410],B[410],f[410][410][410],fac[410],inv[410];

inline ll read()
{
	ll ans=0,f=1;char c=getchar();
	while(c>'9'||c<'0') {if(c=='-') f=-1;c=getchar();}
	while(c>='0'&&c<='9') ans=(ans<<1)+(ans<<3)+(c^48),c=getchar();
	return ans*f;
}

int mul(int a,int b)
{
	int ans=1;
	while(b)
	{
		if(b&1)ans=1ll*ans*a%p;
		a=1ll*a*a%p;b>>=1;
	}
	return ans;
}

inline void add(int &x,int y){x=(x+y<p)?x+y:x+y-p;}

int main(){
	int n=read(),SA=0,S=0;
	for(int i=1;i<=n;++i)SA+=A[i]=read(),S+=B[i]=read();
	fac[0]=1;for(int i=1;i<=S;++i)fac[i]=1ll*fac[i-1]*i%p;
	inv[S]=mul(fac[S],p-2);
	for(int i=S;i;--i)inv[i-1]=1ll*inv[i]*i%p;
	f[1][0][0]=p-1;
	for(int i=1;i<=n;++i)
		for(int j=0;j<=SA;++j)
			for(int k=0;k<=S;++k)
			{
				if(!f[i][j][k])continue;
				add(f[i+1][j][k],f[i][j][k]);
				for(int l=0,x=1;l<B[i];++l,x=1ll*x*A[i]%p)
					add(f[i+1][j+A[i]][k+l],p-1ll*f[i][j][k]*x%p*inv[l]%p);
			}
	int ans=0;
	for(int i=0;i<=SA;++i)
		for(int j=0;j<=S;++j)
			add(ans,1ll*f[n+1][i][j]*mul(i,p-j-2)%p*fac[j]%p*SA%p);
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 262400
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
    long long a,b,k;
    cin>>a>>b>>k;
    a = min(a,b);
    b = max(a,b);
    if(b-a+1 >= k*2)
    {
        int temp = a;
        for(int i=0; i<k; i++)
        {
            cout<<temp<<endl;
            temp++;
        }
        temp = b;
        for(int i=k-1; i>=0; i--)
        {
            cout<<temp-i<<endl;

        }
    }
    else
    {
        for(int i=a; i<=b; i++)
            cout<<i<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define mset(s,_) memset(s,_,sizeof s)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
//head

void run() {
	int x,y;
	cin>>x>>y;
	for(int i=0;i<=100;i++){
		for(int j=0;j<=100;j++){
			if(i+j!=x) continue;
			if(i*2+j*4==y){
			 cout<<"Yes"<<'\n';
			 return ;
		  }
		}
	}
	cout<<"No"<<'\n';
}

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


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 0x3fffffff;


int main(){
	//ios_base::sync_with_stdio(0);
	ll N;
	int a[200005];

	cin >> N;
	rep(i,N) cin >> a[i];

	vector<int> ans;
	rep(i,(N+1)/2) ans.push_back( a[i*2] );
	reverse( all(ans) );
	rep(i,(N+0)/2) ans.push_back( a[i*2+1] );
	if( N%2 == 0 ) reverse( all(ans) );

	for(auto t: ans)
		cout << t << " ";
	cout << endl;

	return 0;
}

Measured memory_bytes: 3956
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int>s(n);
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
    sort(s.begin(),s.end());
    int sum=accumulate(s.begin(),s.end(),0);
    if(sum%10!=0){
        cout << sum;
        return 0;
    }
    for(int i=0;i<n;i++){
        if(s[i]%10!=0){
            sum-=s[i];
            break;
        }
    }
    if(sum%10==0) cout << 0;
    else cout << sum;
}

Measured memory_bytes: 256
import math
def kosu(n):
    l=[]
    sosu = [True] * (n + 1)
    sosu[0]= False
    sosu[1]= False
    for i in range(2,math.floor(math.sqrt(n))+1):
        if not sosu[i]:
            continue
        for j in range(i*2,n+1,i):
            sosu[j] = False
    for i in range(len(sosu)):
        if sosu[i]:
            l.append(i)
    return(l)
    
while True:
    n = int(input())
    if n == 0:
        break
    ln = kosu(n)
    ans = 0
    for i in ln:
        for j in ln:
            x = i + j
            if x == n:
                ans += 1
                ln.remove(j)
    print(ans)


Measured memory_bytes: 6252
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

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

    vector<long long> h(n);
    rep(i, 0, n) cin >> h[i];

    sort(h.begin(), h.end());

    long long ans = 1e9+7;
    rep(i, 0, n-k+1)
    {
        long long next = h[i+k-1] - h[i];
        if (ans > next)
        {
            ans = next;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
#define INF 0x3f3f3f3f
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
ll mod=2019;
ll res=0;
ll sum[1000000+10];
map<int,ll>ma,ma1;
ll qpow(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1){
			res=res*a%mod;
		}
		b/=2;
		a=a*a%mod;
	}
	return res;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	string s;
	cin >> s;
	int n=s.size();
	ll tmp=1;
	ma1[0]=1;
	per(i,0,n){
		if(i==n) sum[i]=s[i]-'0';
		else{
			sum[i]=(sum[i+1]+(s[i]-'0')*tmp)%mod;
		}tmp=tmp*10%mod;
	//	ma[sum[i+1]*qpow(tmp,mod-2)%2019]++;
		ma1[sum[i]%2019]++;
	//	cout<<i<<" "<<sum[i]<<" "<<sum[i]%2019<<" "<<sum[i+1]*qpow(tmp,mod-2)%2019<<endl;
		
	}
	ll res=0;
	for(auto i:ma1){
		res=res+i.se*(i.se-1)/2;
	}
	cout<<res<<endl;
	return 0;
}



Measured memory_bytes: 5316
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
#define debug(...) cout << "[" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "]\n"
#define rd() abs((int)rng())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn = 3e3 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int n, dp[maxn][maxn];
string s;
int add(int a, int b)
{
	if(a + b >= mod) return a + b - mod;
	else if(a + b < 0) return a + b + mod;
	else return a + b;
}
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0);
    cin >> n;
    cin >> s;
    dp[1][1] = 1;
    for(int i = 2; i <= n; i++)
    {
    	vector<int>pref(i, 0);
    	for(int j = 1; j < i; j++)
    	    pref[j] = add(dp[i - 1][j], pref[j - 1]);
    	for(int cur = 1; cur <= i; cur++)
    	{
    	    if(s[i - 2] == '<')
    	    	dp[i][cur] = pref[cur - 1];
    	    else 
    	    	dp[i][cur] = add(pref[i - 1], -pref[cur - 1]);
    	}
    }
    int ans = 0;
    for(int i = 1; i <= n; i++) 
    	ans = add(ans, dp[n][i]);
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 35968
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()
#define pb push_back

#define error(x) cout << #x << " = " << x << endl

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

const int N = 2e5 + 20;
int n, k;
int sum = 0;
string s;

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

	cin >> n >> k;
	cin >> s;

	for (int i = 0; i < n; i++)
	{
		if ((i & 1) ^ (s[i] == 'A')) sum++;

		if (sum == k)
		{
			string ans = "";

			for (int j = i; j < n; j++)
			{
				char c = s[j];
				if (i & 1) c = 'A' + 'B' - c;
				if (j == i) c = 'B';
				ans += c;
			}

			for (int j = 0; j < i; j++) ans += ".";

			char c = 'A';
			for (int j = n - 1; j >= n - i; j--)
			{
				ans[j] = c;
				c = 'A' + 'B' - c;
			}

			cout << ans << '\n';
			return 0;
		}

		sum++;
	
		if (sum == k)
		{
			string ans = "";

			for (int j = i + 1; j < n; j++)
			{
				char c = s[j];
				if ((i + 1) & 1) c = 'A' + 'B' - c;
				ans += c;
			}

			for (int j = 0; j < i + 1; j++) ans += ".";

			char c = 'A';
			for (int j = n - 1; j >= n - i - 1; j--)
			{
				ans[j] = c;
				c = 'A' + 'B' - c;
			}

			cout << ans << '\n';
			return 0;
		}
	}

	k -= sum;

	if (!(n & 1)) {
		char c = 'B';
		string ans = "";
		
		for (int i = 0; i < n; i++)
		{
			ans += c;
			c = 'A' + 'B' - c;
		}

		cout << ans << '\n';
		return 0;
	}
	else 
	{
		char c = 'A';
		string ans = "";

		for (int i = 0; i < n; i++)
		{
			ans += c;
			c = 'A' + 'B' - c;
		}

		if (k & 1) ans[0] = 'B';

		cout << ans << '\n';
		return 0;
	}
}


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

Measured memory_bytes: 256
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
 
using namespace std;
using ll = long long;
 
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

int main()
{
	string s;
	char t;
	map<char, int> m;
	int i, n;
	ll ans = 1;

	cin >> s;

	n = s.size();
	
	for(i = 0; i < s.size(); i++){
		t = s[i];
		m[t]++;
	}

	for(i = 0; i < s.size(); i++){
		t = s[i];
		ans += n - m[t];
		m[t]--;
		n--;
	}

	cout << ans << endl;
}

Measured memory_bytes: 640
#include <stdio.h>

int main() {
  int K[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int num = 0;
  
  scanf("%d", &num);
  
  printf("%d", K[num-1]);
  
}

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

using namespace std;
typedef long long ll;

int N;
int main(){
    cin >> N;
    vector<ll> a(3*N);
    ll ans=0;
    for(int i=0;i!=3*N;i++){
      cin >> a[i];
    }
    sort(a.begin(),a.end());
    for(int i=0;i!=N;i++){
      ans+=a[(3*N)-2-(i*2)];
    }
    cout << ans << endl;
}


Measured memory_bytes: 2560
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
ll dp[1010][1010];
#define SIZE 2000000
ll inv[SIZE + 1];
ll kai[SIZE + 1];
ll invkai[SIZE + 1];
void invinit()
{
	inv[1] = 1;
	for (int i = 2; i <= SIZE; i++)
	{
		inv[i] = mod - (mod / i)*inv[mod%i] % mod;
	}
	kai[0] = invkai[0] = 1;
	for (int i = 1; i <= SIZE; i++)
	{
		kai[i] = kai[i - 1] * i%mod;
		invkai[i] = invkai[i - 1] * inv[i] % mod;
	}
}
ll com(ll a, ll b)
{
	if (b < 0 || a < b)return 0;
	return (invkai[b] * invkai[a - b]) % mod*kai[a] % mod;
}
int main()
{
	int num, a, b, c, d;
	scanf("%d%d%d%d%d", &num, &a, &b, &c, &d);
	invinit();
	dp[0][0] = 1;
	for (int i = 1; i <= num; i++)
	{
		for (int j = 0; j <= num; j++)
		{
			dp[i][j] += dp[i - 1][j];
			dp[i][j] %= mod;
		}
		if (a <= i&&i <= b)
		{
			for (int j = 0; j <= num; j++)
			{
				ll now = 1;
				for (int k = 1; k <= d && j + k*i <= num; k++)
				{
					now = now*com((num - j) - (k - 1)*i, i) % mod*inv[k] % mod;
					if (c <= k)
					{
						dp[i][j + k*i] += dp[i - 1][j] * now;
						dp[i][j + k*i] %= mod;
					}
				}
			}
		}
		//for (int j = 0; j <= num; j++)printf("%lld ", dp[i][j]); printf("\n");
	}
	printf("%lld\n", dp[num][num]);
}

Measured memory_bytes: 54912
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		while (in.hasNext()) {
			int lenH = in.nextInt();
			int lenW = in.nextInt();

			if (lenH == 0) {
				break;
			}

			String topBottom = repeat('#', lenW);
			sb.append(topBottom).append("\n");
			if (lenH > 1) {
				String side = "#" + repeat('.', lenW - 2) + "#";
				for (int i = 0, len = lenH - 2; i < len; i++) {
					sb.append(side).append("\n");
				}
				sb.append(topBottom).append("\n");
			}

			sb.append("\n");
		}
		System.out.print(sb.toString());
	}

	private static String repeat(char c, int len) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < len; i++) {
			sb.append(c);
		}
		return sb.toString();
	}
}

Measured memory_bytes: 18444
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
 
int main(){
  int n,ans,d;
  cin>>n;
  for(int i=n;;i++){
    d=1;
    for(int j=2;j*j<=i;j++){
    if(i%j==0){
      d=0;
      break;
    }
    }
    if(d){
      ans=i;
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	string a, b, c;
	cin >> a >> b >> c;
	
	int bias = 5000;
	vector<int> ok2[3]; // a->b, b->c, a->c
	REP(i, 3) ok2[i].resize(bias * 2, true);
	
	int al = a.size(), bl = b.size(), cl = c.size();
	REP(i, a.size()) REP(j, b.size()) ok2[0][i - j + bias] &= a[i] == b[j] || a[i] == '?' || b[j] == '?';
	REP(i, b.size()) REP(j, c.size()) ok2[1][i - j + bias] &= b[i] == c[j] || b[i] == '?' || c[j] == '?';
	REP(i, a.size()) REP(j, c.size()) ok2[2][i - j + bias] &= a[i] == c[j] || a[i] == '?' || c[j] == '?';
	
	int ans = INF;
	FOR(i, -bias, bias) {
		FOR(j, -bias, bias) {
			// a から b の相対位置 i
			bool ok = true;
			// a, b
			ok &= i + bl <= 0 || i >= al || ok2[0][i + bias];
			// b, c
			int k = j - i;
			ok &= k + cl <= 0 || k >= bl || ok2[1][k + bias];
			// a, c
			ok &= j + cl <= 0 || j >= al || ok2[2][j + bias];
			
			if (ok) {
				int cur = max({i + bl, j + cl, al}) - min({i, j, 0});
				chmin(ans, cur);
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <math.h>
#include <iomanip>

int main() {
  
  long double n1, n2;
  std::cin >> n1 >> n2;
  
  long double prod = n1 * n2;

  std::cout << std::fixed << std::setprecision(0) << floor(prod) << "\n";
  
  return 0;
}


Measured memory_bytes: 3272
N, K = map(int, input().split())
S = input()
if(S[K-1] == 'A'):
  S = S[:(K-1)] + 'a' + S[K:]
elif(S[K-1] == 'B'):
  S = S[:(K-1)] + 'b' + S[K:]
else:
  S = S[:(K-1)] + 'c' + S[K:]
print(S)

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

#include<algorithm>
#define str(a) to_string(a)
#define int long long
#define pb push_back
#define mp make_pair
#define SORT(c) sort(c.begin(),c.end())
#define max_heap priority_queue<int>
#define min_heap priority_queue< int,vector<int>, greater<int> >
#define mod 1000000007
#define setbits(x) __builtin_popcount(x)
#define ps(x,y) fixed<<setprecision(y)<<x
#define start(t) int x;cin>>x;while(x--)
#define inf LLONG_MAX
#define sync ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define N 1000001



int32_t main()
{
// 	ios_base::sync_with_stdio(0);
// 	cin.tie(0);
// 	cout.tie(0);
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	int h, w; cin >> h >> w;
	vector<vector<char> > grid(h, vector<char>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++)
			cin >> grid[i][j];
	}
	int dp[h][w];  // dp[i][j] means number of paths from i,j to h,w
	dp[h - 1][w - 1] = 1;  // an empty path.
	for (int i = h - 2; i >= 0 ; i--) {
		if (grid[i][w - 1] == '#')
			dp[i][w - 1] = 0;
		else dp[i][w - 1] = dp[i + 1][w - 1];
	}
	for (int i = w - 2; i >= 0 ; i--) {
		if (grid[h - 1][i] == '#')
			dp[h - 1][i] = 0;
		else dp[h - 1][i] = dp[h - 1][i + 1];
	}
	for (int i = h - 2; i >= 0; i--) {
		for (int j = w - 2; j >= 0; j--) {
			if (grid[i][j] == '#')
				dp[i][j] = 0;
			else {
				dp[i][j] = (dp[i + 1][j] + dp[i][j + 1]) % 1000000007;
			}
		}

	}
	cout << dp[0][0] << endl;

}










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

using namespace std;

constexpr int N = 1e5 + 1;

int w, h, k, n, dp[N];
vector<vector<bool>> dogs;

int main() {
  scanf("%d %d %d %d", &w, &h, &k, &n); --h, --w;
  if(k < (w+2)/2) {
    puts("-1");
    return 0;
  }
  k -= (w+2) / 2;
  dogs.resize(h+1, vector<bool>(w+1));
  for(int i = 0; i < n; ++i) {
    int x, y; scanf("%d %d", &x, &y); --x, --y;
    dogs[y][x] = true;
  }
  int ans = 0, bad = 0;
  for(int i = 2; i <= h; i += 2) {
    fill(dp, dp+w+1, 0);
    dp[0] = dogs[i-1][0] + 1;
    if(w >= 2)
      dp[2] = min(dp[0] + dogs[i-1][2] + 1, (dogs[i-1][1] + 1) * 2);
    for(int j = 4; j <= w; j += 2)
      dp[j] = min(dp[j-2] + dogs[i-1][j] + 1,
                  dp[j-4] + (dogs[i-1][j-1] + 1) * 2);
    bad += (dp[w] - ((w+2) / 2));
    ans += dp[w];
  }
  printf("%d\n", max(0, ans - k - min(k, bad)));
}

Measured memory_bytes: 15580
#include<stdio.h>
int main(void)
{
	int  a, i = 1;
	while(scanf("%d", &a))
	{
	    if(a == 0)
	    {
	    	break;
	    } 
	    printf("Case %d: %d\n", i++, a);
	}
	return 0;
} 


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

int main(){
    int x,y,a,b,c;
    cin >> x >> y >> a >> b >> c;
    priority_queue<int> p,q,r;
    rep(i,a){
        int t;
        cin >> t;
        p.push(t);
    }
    rep(i,b){
        int t;
        cin >> t;
        q.push(t);
    }
    rep(i,c){
        int t;
        cin >> t;
        r.push(t);
    }

    vector<int> xlist(x);
    vector<int> ylist(y);
    rep(i,x){
        int xval = p.top();
        p.pop();
        xlist.at(i) = xval;
    }
    rep(i,y){
        int yval = q.top();
        q.pop();
        ylist.at(i) = yval;
    }

    int xindex = x-1;
    int yindex = y-1;
    while(!r.empty()){
        int zval = r.top();
        r.pop();
        if(zval <= min(xlist.at(xindex), ylist.at(yindex))){
            break;
        }
        if(xlist.at(xindex) < ylist.at(yindex)){
            xlist.at(xindex) = zval;
            xindex = max(xindex-1, 0);
        }else {
            ylist.at(yindex) = zval;
            yindex = max(yindex-1,0);
        }
    }

    ll total = 0;
    rep(i,x){
        total += xlist.at(i);
    }
    rep(i,y){
        total += ylist.at(i);
    }
    cout << total << endl;

    return 0;
} 

Measured memory_bytes: 2296
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int x = sc.nextInt();


		if(a*a*b/2 <= x){
			//傾けたときの上部のこちらから見たときの面積
			double area = ((double)a*a*b - x)/a;
			//上部三角形のaじゃないほうの長さ
			double l = area*2/a;

			System.out.println(Math.atan(l/a)/Math.PI*180);
		}
		else {
			//傾けたときの下部のこちらから見たときの面積
			double area = ((double)x)/a;
			//上部三角形のbじゃないほうの長さ
			double l = area*2/b;

			System.out.println(Math.atan(b/l)/Math.PI*180);

		}
	}

}


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

void solve(double x) {
	unsigned char y = (char)x;
	if (y != ((int)x)) {
		cout << "NA" << endl;
		return;
	}
	x -= y;
	int res[4] = {0, 0, 0, 0};
	for (int i = 0; i < 4; i++) {
		x *= 2.;
		res[i] = (int)x;
		x -= res[i];
	}
	if (x > 0) cout << "NA" << endl;
	else {
		for (int i = 7; i >= 0; i--) {
			cout << ((y & (1u << i)) >> i);
		}
		cout << '.';
		for (int i = 0; i < 4; i++) {
			cout << res[i];
		}
		cout << endl;
	}
}

int main () {
	double x;
	while (cin >> x, x >= 0.) {
		solve(x);
	}
	return 0;
}

Measured memory_bytes: 1224
#include <stdio.h>
int main(void){
    char str[100],work;
    int i,n,j,t;
    scanf("%s",str);
    n = strlen(str);
    t=n;
    if(n%2!=0){
        n=n-1;
        j=n/2;
    }else{
        j=n/2;
    }
    for(i=0;i<j;i++){
        work=str[i];
        str[i]=str[n-1];
        str[n-1]=work;
        n--;
    }
    for(i=0;i<t;i++){
        printf("%c",str[i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 520
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};

int N;
ll L, T;
vector<ll> X;
vector<int> W;

int main(){
    cin >> N >> L >> T;
    X.resize(N);  W.resize(N);
    rep(i,N) cin >> X[i] >> W[i];
//-------------------------------------------
    vector<ll> tmp(N);
    rep(i,N){
        if(W[i]==1) tmp[i] = (X[i]+T)%L;
        else tmp[i] = ((X[i]-T)%L+L)%L; //tmp[i] = (X[i]-T)%L;
    }

    int cnt = 0;
    rep(i,N){
        if(W[i]==1) cnt += (X[i]+T)/L;
        else{
            //if(T > X[i])
              //  cnt -= 1+(T-X[i])/L;
            cnt += (X[i]-T)/L;
            //if((X[i]-T)%L<0) tmp[i]+=L, cnt--;
            if((X[i]-T)%L<0) cnt--;
        }
    }
    int flag = (cnt%N+N)%N;
    sort(tmp.begin(), tmp.end());
//-------------------------------------------
    for(int i = flag; i < N; i++) cout << tmp[i] << endl;
    for(int i = 0; i < flag; i++) cout << tmp[i] << endl;
}

Measured memory_bytes: 3200
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
	{
		// your code goes here
		try {
		    Scanner sc=new Scanner(System.in);
		    String s=sc.next();
		    if(s.equals("ARC"))
		    System.out.println("ABC");
		    else
		    System.out.println("ARC");
		} catch(Exception e) {
		}
	}
}


Measured memory_bytes: 35740
//Atcoder
import java.io.*;
import java.util.*;

public class Main {

	static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e){e.printStackTrace();}
        }

        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {st = new StringTokenizer(br.readLine());}
            catch (Exception e) {e.printStackTrace();}
            return st.nextToken();
        }

        public int nextInt() {return Integer.parseInt(next());}

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

        public double nextDouble() {return Double.parseDouble(next());}

        public String nextLine() {
            String line = "";
            if(st.hasMoreTokens()) line = st.nextToken();
            else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
            while(st.hasMoreTokens()) line += " "+st.nextToken();
            return line;
        }
    }

	public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);

        int h = sc.nextInt();
        int w = sc.nextInt();

        for(int i=0;i<h;i++) {
            String s = sc.nextLine();
            pw.println(s);
            pw.println(s);
        }

        pw.close();
    }
}


Measured memory_bytes: 21204
# -*- coding: utf-8 -*-

N, M = map(int, input().split())
N_list = [list(map(int, input().split())) for i in range(N)]
M_list = [list(map(int, input().split())) for i in range(M)]

# 学生の数ループ
for i in range(N):
    # 最小値の初期値は無限大
    min_point = float("inf")
    ans = 0
    # チェックポイントの数ループ
    for j in range(M):
        # マンハッタン距離の計算
        x = abs(N_list[i][0] - M_list[j][0])
        y = abs(N_list[i][1] - M_list[j][1])
        tmp = x + y
        # 最短距離なら、最短距離を更新してチェックポイントの番号を出力
        if tmp < min_point:
            min_point = tmp
            ans = j + 1
    print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

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

const int N = 2e5 + 500;
const int OFF = N / 2;

int A[N], P[N], loga[N], n;

inline int get(int l, int r){
	return P[r] - (l ? P[l - 1] : 0);
}

void add(int x, int y = 1){
	for(x += OFF; x < N; x += x & -x)
		loga[x] += y;
}

int query(int x){
	int ret = 0;
	for(x += OFF; x ; x -= x & -x)
		ret += loga[x];
	return ret;
}

bool check(int x){
	P[0] = (A[0] >= x ? 1 : -1);
	for(int i = 1;i < n;i++)
		P[i] = P[i - 1] + (A[i] >= x ? 1 : -1);
	memset(loga, 0, sizeof(loga));
	add(0);
	ll ret = 0;
	for(int i = 0;i < n;i++){
		ret += query(P[i]);
		add(P[i]);
	}
	return ret >= ((ll)n * (n + 1) / 2 + 1) / 2;
}

int main(){
	scanf("%d", &n);
	for(int i = 0;i < n;i++)
		scanf("%d", A + i);
	int ans = 0;
	for(int i = 30;i >= 0;i--)
		if(check(ans + (1 << i)))
			ans += (1 << i);
	printf("%d\n", ans);
}

Measured memory_bytes: 3284
#include<stdio.h>
int main(){
  int a,b;
  scanf("%d%d",&a, &b);
  if(a < b){
    printf("a < b\n");
  }
  else if(a > b){
    printf("a > b\n");
  }
  else if(a == b){
    printf("a == b\n");
  }

  
  return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int main(){
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    rep(i, h)cin >> a[i];

    queue<P> q;
    rep(i,h)rep(j,w){
        if(a[i][j] == '#') q.push(P(i,j));
    }

    ll ans = 0;
    bool flag=true;

    while(1){
        rep(i,h){
            if(flag){
                rep(j,w){
                    if(a[i][j]== '.'){
                        flag = false;
                        break;
                    }
                }
            }
        }
        queue<P> nq;
        swap(q,nq);
        while(!nq.empty()){
            P u = nq.front();
            nq.pop();
            int x=u.first, y=u.second;
            rep(i,4){
                int nx = x+dx[i];
                int ny = y+dy[i];
                if(nx<0||ny<0||nx>=h||ny>=w)continue;
                if(a[nx][ny]=='#')continue;
                a[nx][ny] = '#';
                q.push(P(nx,ny));
            }
        }

        if(flag)break;
        else{
            flag = true;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
#define ll long long
#define rep(i,m,n) for(ll (i)=(ll)(m);i<(ll)(n);i++)
#define REP(i,n) rep(i,0,n)
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
constexpr long double m_pi = 3.1415926535897932L;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 61;
constexpr long double EPS = 1e-10;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

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

	ll n;
	cin >> n;
	vector s(2, vector<string>(n));//元の文字列と反転した文字列
	Array cost(n);
	REP(i, n)cin >> s[0][i] >> cost[i];
	REP(i, n)s[1][i] = s[0][i], reverse(all(s[1][i]));

	//ダイクストラ
	using T = tuple<ll, string, bool>;//コスト、文字列、反転しているかどうか
	map<pair<string, ll>, ll> mp;
	priority_queue<T, vector<T>, greater<T>> que;
	auto push = [&](ll c, string v, ll f) {
		if (mp.count({ v,f }) == 0 || mp[{v, f}] > c)que.push({ c,v,f }), mp[{v, f}] = c;
	};
	ll ans = INF;
	auto pcheck = [&](string& s) {
		REP(i, s.size() / 2)if (s[i] != s[s.size() - 1 - i])return false;
		return true;
	};
	REP(i, n) if(pcheck(s[0][i]) == true)chmin(ans, cost[i]);
	REP(i, n) push(cost[i], s[0][i], 1);
	while (que.size()) {
		auto [c, v, flip] = que.top();
		que.pop();
		if (mp[{v, flip}] < c || ans <= c)continue;
		if (pcheck(v) == true) {
			chmin(ans, c);
			continue;
		}
		REP(i, n) {
			auto check = [&](string a, string b)->string {
				REP(i, min(a.size(), b.size()))if (a[i] != b[i])return "!";
				if (a.size() == b.size())return "";
				else if (a.size() > b.size())return a.substr(b.size());
				else return b.substr(a.size());
			};
			auto ret = check(v, s[flip][i]);
			if (ret == "!")continue;
			else if (ret.size() <= 1)chmin(ans, c + cost[i]);
			else if (v.size() > s[flip][i].size())push(c + cost[i], ret, flip);
			else push(c + cost[i], ret, flip ^ 1);
		}
	}
	if (ans == INF)cout << -1 << "\n";
	else cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3652
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    string s;
    cin >> s;
    int n = s.size();
    rep(bit, 1 << n - 1)
    {
        int sum = s[0] - '0';
        vector<char> op(n - 1);
        rep(i, n - 1)
        {
            if (bit & (1 << i))
            {
                sum += s[i + 1] - '0';
                op[i] = '+';
            }
            else
            {
                sum -= s[i + 1] - '0';
                op[i] = '-';
            }
        }
        if (sum == 7)
        {
            int j = 1;
            rep(i, n - 1)
            {
                s.insert(s.begin() + j, op[i]);
                j += 2;
            }
            cout << s << "=7" << endl;
            break;
        }
    }
}


Measured memory_bytes: 3656
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

        public static void swap(ref long x, ref long y)
        {
            var tmp = x;
            x = y;
            y = tmp;
        }


        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var x = Read();
            var y = x / 500;
            var z = x % 500;
            Console.WriteLine(y * 1000 + z / 5 * 5);

            
            
            

            

        Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 11092
using System;
class p
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    string[] vInput = Console.ReadLine().Split(' ');
    string[] cInput = Console.ReadLine().Split(' ');
    
    int sum = 0;
    for (int i = 0; i < N; i++) {
      int v = int.Parse(vInput[i]);
      int c = int.Parse(cInput[i]);
      sum += Math.Max(0, v - c);
    }
    Console.WriteLine(sum);
  }
}

Measured memory_bytes: 13140
#include <stdio.h>
  int main(){
    int n,k,a1,b1,i;
      scanf("%d%d",&n,&k);
	  int x=n/2+1;
      for(i=0;i<k;i++){
           scanf("%d%d",&a1,&b1);
           if(a1<=x && a1<=b1 && b1<= n-a1+1){
             if(a1%3==0){
                 printf("3\n");goto qqq;
                 }else if(a1%3==1){
                 printf("1\n");goto qqq;
                 }else{
                 printf("2\n");goto qqq;
                 }
}else if(a1>x && a1>=b1 && b1>=n-a1+1){
                  int y=n-a1+1;
                  if(y%3==0){
                 printf("3\n");goto qqq;
                 }else if(y%3==1){
                 printf("1\n");goto qqq;
                 }else{
                 printf("2\n");goto qqq;
                 }
}else if(b1<=x && b1<=a1 && a1<= n-b1+1){
                 if(b1%3==0){
                 printf("3\n");goto qqq;
                 }else if(b1%3==1){
                 printf("1\n");goto qqq;
                 }else{
                 printf("2\n");goto qqq;
                 }
}else if(b1>x && b1>=a1 && a1>=n-b1+1){
                  int y=n-b1+1;
                  if(y%3==0){
                 printf("3\n");goto qqq;
                 }else if(y%3==1){
                 printf("1\n");goto qqq;
                 }else{
                 printf("2\n");goto qqq;
                 }goto qqq;
}
qqq:;
}
return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
 
using namespace std;
using LL = long long int;

#define int long long
const int INF = 100000000000000000;


const int MAX_N = 100005;
const int MAX_M = 100005;

int N, M;
int S, T;
int U[MAX_M], V[MAX_M];
int A[MAX_M], B[MAX_M];

struct Edge{
    int to;
    int a, b;
};

class Node{
public:
    int pos;
    int cost;
    bool operator > (const Node& n) const {
        return cost > n.cost;
    }
};

vector<Edge> edgeList[MAX_N];

int dist[2][MAX_N];

void dijkstra(int s, int d[MAX_N], bool flag) {
    for(int i = 0; i < MAX_N; i++) {
        d[i] = INF;
    }
    d[s] = 0;

    priority_queue<Node, vector<Node>, greater<Node> > que;
    Node node; node.pos = s; node.cost = 0; que.push(node);

    while(que.size()) {
        node = que.top(); que.pop();
        int pos = node.pos;
        int cost = node.cost;
        if(d[pos] < cost) {
            continue;
        }
        for(int i = 0; i < edgeList[pos].size(); i++) {
            Edge nextEdge = edgeList[pos][i];
            int nextC = 0;
            if(flag) {
                nextC = nextEdge.a;
            } else {
                nextC = nextEdge.b;
            }
            if(d[nextEdge.to] > cost + nextC) {
                d[nextEdge.to] = cost + nextC;
                Node nextNode; nextNode.pos = nextEdge.to; nextNode.cost = d[nextEdge.to];
                que.push(nextNode);
            }
        }
    }

}

signed main()
{
    cin >> N >> M >> S >> T;
    S--; T--;
    for(int i = 0; i < M; i++) {
        cin >> U[i] >> V[i] >> A[i] >> B[i];
        U[i]--; V[i]--;
        Edge edge; edge.to = V[i]; edge.a = A[i]; edge.b = B[i];
        edgeList[U[i]].push_back(edge);
        edge.to = U[i];
        edgeList[V[i]].push_back(edge);
    }

    dijkstra(S, dist[0], true);
    dijkstra(T, dist[1], false);

    using II = pair<int, int>;
    priority_queue<II, vector<II>, greater<II> > que;
    for(int i = 0; i < N; i++) {
        // cerr << dist[0][i] << " " << dist[1][i] << endl;
        que.push(II(dist[0][i] + dist[1][i], i));
    }

    for(int i = 0; i < N; i++) {
        II p = que.top();
        while(p.second < i) {
            que.pop();
            p = que.top();
        }
        cout << (LL)1000000000000000 - p.first << endl;
    }

    return 0;
}

Measured memory_bytes: 17524
'use strict'

const INF = 900719925474099;


function Main(input){
    let temp = input.trim().split(' ');
    let r = parseInt(temp[0]);
    let d = parseInt(temp[1]);
    let x = parseInt(temp[2]);

    for(let i=1;i<=10;i++){
        x = r * x - d;
        console.log(x);
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21320
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String c = scan.next();
		if(c.equals("a") || c.equals("e")
			|| c.equals("i") ||c.equals("o")
			|| c.equals("u")) {
			System.out.println("vowel");
		} else {
			System.out.println("consonant");
		}
	}
}


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

int main(){

    string s; cin>>s;

    bool odd=true,even=true; 

    for(int i=0; i<s.size(); i++){
        if(i%2 ==0){
            if(s[i] == 'R' || s[i] == 'U' || s[i] == 'D') odd = true;
            else{
                odd = false;
                break;
            }
        }

            if(i%2 != 0){
                if(s[i] == 'L' || s[i] == 'U' || s[i] == 'D') even = true;
                else{
                    even = false;
                    break;
            }
        }
    }

    if(even && odd)cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

    return 0;

}

Measured memory_bytes: 256
n, *a = map(int, open(0).read().split())
x = [[0, 0] for i in range(n)]
for i in range(n):
    if 0<=i-a[i]<n: x[i-a[i]][0] += 1
    if 0<=i+a[i]<n: x[i+a[i]][1] += 1
ans = 0
for y in x:
    ans += y[0] * y[1]
print(ans)

Measured memory_bytes: 36220
#include <iostream>
#include <cstdio>
#include <cstring>
const int N=1e5+5;
int n,q;

inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

inline int jdg(){
	int las=nxi();
	for(int x,i=2;i<=n;++i){
		x=nxi();
		if(las+x>=q) return i-1;
		las=x;
	}
	return 0;
}

int main(){
	n=nxi(),q=nxi();
	int ans=jdg();
	if(!ans) puts("Impossible");
	else{
		puts("Possible");
		for(int i=1;i<ans;++i) printf("%d\n",i);
		for(int i=n-1;i>ans;--i) printf("%d\n",i);
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int n; string s;
signed main() {
    cin >> s; n = s.size();
    for (int i = 0; i < n; i += 2) {
        if (s[i] != 'h' || s[i + 1] != 'i')
            return cout << "No" << endl, 0;
    }
    return cout << "Yes" << endl, 0;
}

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

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b) cout << c << endl;
    else if(b==c) cout << a << endl;
    else cout << b << endl;        
    return 0;
}

Measured memory_bytes: 256
import numpy as np

mod=1000000007
s=input().split()
h,w,k=int(s[0]),int(s[1]),int(s[2])
l=[]
for i in range(2**(w-1)):
    s=bin(i)[2:].zfill(w-1)
    if s.find("11")==-1:
        l.append(s)
mat=np.zeros((w,w),dtype="int64")
for s in l:
    dest=[i for i in range(w)]
    for i in range(w-1):
        if s[i]=="1":
                dest[i],dest[i+1]=dest[i+1],dest[i]
    for i in range(w):
        mat[i][dest[i]]+=1
res=np.zeros(w,dtype="int64")
res[0]=1
for i in range(h):
    res=np.dot(mat,res)
    for i in range(w):
        res[i]%=mod
print(res[k-1])

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

#include <bits/stdc++.h>
using namespace std;
int h,w,dp[1009][1009];
char mat[1009][1009];
long long mod = 1e9+7;
long long solve(int i,int j){
	if(j>=w||i>=h||mat[i][j]=='#')return 0;
	if(j==w-1&&i==h-1)return 1;

	if(dp[i][j]!=-1)return dp[i][j]%mod;

	dp[i][j] = solve(i+1,j)%mod+solve(i,j+1)%mod;
	return dp[i][j]%mod;

}

int main() {
	memset(dp,-1,sizeof(dp));
	cin>>h>>w;
	for(int i = 0 ; i < h ; i++){
		for(int j = 0 ; j <w ; j++){
			cin>>mat[i][j];
		}
	}
	cout<<solve(0,0);

}


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

int main() {
	//入力
	int n;
	cin >> n;
	int a[200];
	for (int i = 0; i < n; i++) cin >> a[i];

	//計算
	int count = 0;
	int p = 0;
	for (int i = 0;; i++) {
		for (int j = 0; j < n; j++) {
			if (a[j] % 2 == 1) {
				p++;
				break;
			}
			a[j] /= 2;
		}

		if (p == 1) break; //奇数が出てきたとき

		count++;
	}
	
	//出力
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
import numpy as np
N,M,C=map(int,input().split())
B=np.array(list(map(int,input().split())))
sum = 0
for _ in range(N):
    A=np.array(list(map(int,input().split())))
    if np.sum(A*B) + C > 0:
        sum += 1

print(sum)



Measured memory_bytes: 27260
//nuber of cures ho raha hai multiplied by 2 naaki x
//pehla element jo x se bada ho.. agar koi bhi nhi toh siidha shuru se shuru kar
#include<bits/stdc++.h>
#define Imposter ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
#define f(n) for(ll i=0;i<n;i++)
#define vll vector<ll>
#define all(x) x.begin(),x.end()
#define vlll vector<vll>
int main()
{
    Imposter
    
    int t=1;
    //cin>>t;
    while(t--)
    {
       ll n;
       cin>>n;
       ll a[n];
       f(n) cin>>a[i];
       sort(a,a+n);
       reverse(a,a+n);ll comfort=a[0];
       if(n==2)
       {
           cout<<a[0]<<endl;
           return 0;
       }
       if(n==3)
       {
           cout<<a[0]+a[1]<<endl;
           return 0;
       }
       if(n&1)
       {
           ll c=0, i=1;
           for( i=1;i<n;i++)
           {
               comfort+=2*a[i];
               c+=2;
               //cout<<c<<" "<<a[i]<<endl;
               if(c==n-3)
               break;
           }
           comfort+=a[i+1];
       }
       else
       {
           ll c=0;
           for(ll i=1;i<n;i++)
           {
               comfort+=2*a[i];
               c+=2;
               if(c==n-2)
               break;
           }
       }
       
       cout<<comfort<<endl;
    }
    return 0;
}

Measured memory_bytes: 5212
#define _CRT_SECURE_NO_WARNINGS

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

/* define */
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = a; i < b ; i++)
#define REP(i, n) for ( int i = 0; i < n ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = (int)1e9 + 7;

/* alias */
typedef long long ll;
typedef unsigned  u;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
ll Lgcd(ll a, ll b) {
	if (b != 0) return Lgcd(b, a % b); 
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
ll Llcm(ll a, ll b) {
	return a / Lgcd(a, b) * b;
}

/* main */

int main() {
	int n, m, c = 0;
	char a[50][100], b[50][100];
	scanf("%d%d", &n, &m);
	REP(i, n)scanf("%s", &a[i]);
	REP(i, m)scanf("%s", &b[i]);
	REP(i, n - m + 1) {
		REP(j, n - m + 1) {
			int f = 1;
			REP(k, m) {
				REP(l, m) {
					if (a[i + k][j + l] != b[k][l])f = 0;
				}
			}
			if (f)c = 1;
		}
	}
	Yes(c);
	return 0;
}

Measured memory_bytes: 128
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
typedef long long ll;typedef pair<int,int> PII;const ll mod=1e9+7;const int N = 1e6+10;ll a[N];
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int main() {
	//ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n,k;
	cin>>n>>k;
	double sum=0;
	rep(i,0,n)cin>>a[i];
	for(int i=0;i<k;i++)sum+=(double)(1+a[i])/2.0;
	double ans = sum;
	for(int i=k;i<n;i++){
		sum+=(double)(1+a[i])/2.0;
		sum-=(double)(1+a[i-k])/2.0;
		ans = max(ans,sum);
	}
	printf("%.9f",ans);
  	return 0;
}



Measured memory_bytes: 1792