akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
#define ENDL cout<<endl

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
int main(){
    CIN(N);
    I vec;
    REP(a,N){
        CIN(b);
        vec.push_back(b);
    }
    sort(ALL(vec));
    LL ans= 0;
    REP(a,N){
        if(a==N-1)ans += vec.at(a)/2;
        else ans += vec.at(a);
    }
    COUT(ans);
    return 0;
}


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

int main() {
	long long n,ww;
	cin>>n>>ww;
	long long v[n+1],w[n+1];
	long long dp[n+1][ww+1];
	for(long long i=1;i<=n;i++){
	        cin>>w[i]>>v[i];
	
	}for(long long i=0;i<=ww;i++){
	       dp[0][i]=0;
	}for(long long j=0;j<=n;j++){
	    dp[j][0]=0;
	}
	for(long long i=1;i<=n;i++){
	    for(long long j=1;j<=ww;j++){
	        dp[i][j]=dp[i-1][j];
	        if(j-w[i]>=0){
	            dp[i][j]=max(dp[i][j],dp[i-1][j-w[i]]+v[i]);
	        }
	    }
	}cout<<dp[n][ww];
	
}


Measured memory_bytes: 79104
#include <iostream>

using namespace std;

const int MAXN = 100010;
int a[MAXN];

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int min = 1;
	long long res = 0;
	for (int i = 0; i < n; i++)
	{
		if (a[i] < min)
			continue;
		if (a[i] == min)
		{
			min++;
			continue;
		}
		res += (a[i] - 1) / min;
		min = max(min, 2);
	}
	cout << res << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, K;
    cin >> A >> B >> K;
    int cnt = 0;
    vector<int> ans;
    reps(i, min(A, B)+1, 1)
    {
        if (A % i == 0 && B % i == 0)
        {
            cnt++;
            ans.pb(i);
        }
    }

    cout << ans[cnt-K] << endl;
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
// ?????¬???????????¬??????

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int N;
int board[1010][1010];

signed main() {
    cin >> N;
    rep(i,0,N) {
        int sx, sy, tx, ty;
        cin >> sx >> sy >> tx >> ty;
        board[sx][sy]++;
        board[sx][ty]--;
        board[tx][sy]--;
        board[tx][ty]++;
    }

    rep(i,0,1010) rep(j,1,1010) board[i][j] += board[i][j-1];
    rep(j,0,1010) rep(i,1,1010) board[i][j] += board[i-1][j];
    
    int ans = 0;
    rep(i,0,1010) rep(j,0,1010) {
        chmax(ans, board[i][j]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11076
#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
using namespace std;
const int N = 15;
int n,m,x,a[N][N],c[N],cnt[N];
int main()
{
	cin>>n>>m>>x;
	for(int i=0;i<n;i++)
	{
		cin>>c[i];
		for(int j=0;j<m;j++)
		{
			cin>>a[i][j];
		}
	}
	int ans=1e9;
	for(int i=0;i<(1<<n);i++)
	{
		for(int j=0;j<m;j++)cnt[j]=0;
		int sum=0;
		for(int j=0;j<n;j++)
		{
			if((i>>j)&1)
			{
				sum+=c[j];
				for(int k=0;k<m;k++)
				{
					cnt[k]+=a[j][k];
				}
			}
		}
		bool flag=true;
		for(int j=0;j<m;j++)
		{
			if(cnt[j]<x)
			{
				flag=false;
			}
		}
		if(flag)ans=min(ans,sum);
	}
	if(ans==1e9)ans=-1;
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 3624
/* Manish Pant - insider_pants */

#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
    #include "debug.h"
#endif

#define F first
#define S second
#define endl "\n"
#define pb push_back
typedef long long ll;
typedef long double ldob;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

/*
    there will be n - 1 adjacent pairs of element
    ans = 
    for i in [0, k]:
        ans += (n - 1)C(i) * m * (m - 1) ^ (n - 1 - i)
        if we choose i pairs with same colour, colour it with m different options and other remaining n - i - 1 pairs have m - 1 options to paint with
*/

const ll MOD = 998'244'353;
const int N = 2e5 + 5;
vector<ll> fact(N, 1), inv(N, 1);
ll n, m, k;

ll power(ll x, ll y)
{
    ll ans = 1;
    while(y > 0)
    {
        if(y & 1) ans = (ans * x) % MOD;

        x = (x * x) % MOD;
        y >>= 1;
    }
    return ans;
}

ll ncr(ll a, ll b)
{
    ll ans = fact[a];
    ans = (ans * inv[b]) % MOD;
    ans = (ans * inv[a - b]) % MOD;
    return ans;
}

void solve()
{
    for(int i = 2; i < N; i++)
    {
        fact[i] = (fact[i - 1] * i) % MOD;
        inv[i] = power(fact[i], MOD - 2);
    }


    ll ans = 0;
    for(int i = 0; i <= k; i++)
    {
        ll temp = ncr(n - 1, i);
        temp = (temp * m) % MOD;
        temp = (temp * power(m - 1, n - i - 1)) % MOD;
        ans = (ans + temp) % MOD;
    }
    cout << ans << endl;
}

int main()
{
    fast();
    cin >> n >> m >> k;
    solve();
}

Measured memory_bytes: 6280
#include <iostream>
#include <algorithm>

int main(){
	int W[10],K[10],p;
	for(int i = 0;i < 20;i++){
		std::cin>>p;
		if(i<10)W[i] = p;
		else{K[i-10] = p;}
	}
	std::sort(W,W+10,std::greater<int>());
	std::sort(K,K+10,std::greater<int>());
	int Wp = W[0] + W[1] + W[2],
		Kp = K[0] + K[1] + K[2];
	std::cout<<Wp<<" "<<Kp<<std::endl;
	return 0;
}

Measured memory_bytes: 0
// Last Change: 05/19/2019 21:38:31.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

vector<int> nodeColor;
vector<queue<pair<ll, ll>>> edge;

void dfs(ll pos, ll dist) {
  if (nodeColor[pos] != -1) {
    return;
  }

  nodeColor[pos] = dist % 2;

  while (!edge[pos].empty()) {
    dfs(edge[pos].front().first, dist + edge[pos].front().second);
    edge[pos].pop();
  }
}

int main() {
  ll N;
  cin >> N;
  nodeColor.resize(N);
  fill(nodeColor.begin(), nodeColor.end(), -1);

  edge.resize(N);
  ll u, v, w;
  for (ll i = 0; i < N - 1; ++i) {
    cin >> u >> v >> w;
    edge[u - 1].push(make_pair(v - 1, w));
    edge[v - 1].push(make_pair(u - 1, w));
  }

  dfs(0, 0);

  for (auto &&e : nodeColor) {
    cout << e << endl;
  }

  //NS::LoopUntilZeroInpput();
}


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

struct node
{
    unsigned int key;
    struct node *next;
    struct node *prev;
};

typedef struct node *NodePointer;

NodePointer nil;

NodePointer listSearch(unsigned int key)
{
    NodePointer cur = nil->next;

    while (1)
    {
        if (cur == nil)
        {
            return nil;
        }
        if (cur->key == key)
        {
            return cur;
        }
        cur = cur->next;
    }
}

void init()
{
    nil = (NodePointer)malloc(sizeof(struct node));
    nil->next = nil;
    nil->prev = nil;
}

void printList()
{
    NodePointer cur = nil->next;
    int isf = 1;
    while (1)
    {
        if (cur == nil)
            break;
        if (isf == 0)
            printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
        isf = 0;
    }
    printf("\n");
}

void deleteNode(NodePointer t)
{
    if (t == nil)
    {
        return;
    }
    else
    {
        (t->prev)->next = t->next;
        (t->next)->prev = t->prev;
        free(t);
    }
}

void deleteFirst()
{
    NodePointer t = nil->next;
    if (t == nil)
    {
        return;
    }
    deleteNode(t);
}

void deleteLast()
{
    NodePointer t = nil->next;

    if (t == nil)
    {
        return;
    }
    else
    {
        deleteNode((t->prev)->prev);
    }
}

void deleteKey(unsigned int key)
{
    NodePointer t = listSearch(key);
    if (t == nil) {
        return;
    } else {
        (t->prev)->next = t->next;
        (t->next)->prev = t->prev;
        free(t);
    }
}

void insert(unsigned int key)
{
    NodePointer x;
    x = (NodePointer)malloc(sizeof(struct node));
    x->key = key;

    x->prev = nil;
    x->next = nil->next;
    (nil->next)->prev = x;
    nil->next = x;
}

int main()
{
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for (i = 0; i < n; i++)
    {
        scanf("%s%d", com, &key);
        if (com[0] == 'i')
        {
            insert(key);
            np++;
            size++;
        }
        else if (com[0] == 'd')
        {
            if (strlen(com) > 6)
            {
                if (com[6] == 'F')
                    deleteFirst();
                else if (com[6] == 'L')
                    deleteLast();
            }
            else
            {
                deleteKey(key);
                nd++;
            }
            size--;
        }
    }

    printList();
    return 0;
}


Measured memory_bytes: 34416
#include<bits/stdc++.h>
using namespace std;
int n,m,s[15],d[100],dp[101][1<<15];

void minimize(int &a,int b){
  a=min(a,b);
}

int main(){


  int n,m;
  while(cin>>n>>m,n){
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=0;i<m;i++)cin>>d[i];
    sort(d,d+m);

    int sum[1<<15]={};
    for(int i=0;i<(1<<n);i++)
      for(int j=0;j<n;j++)
	if((1<<j)&i)sum[i]+=s[j];

    for(int j=0;j<=m;j++)
      for(int i=0;i<(1<<n);i++)dp[j][i]=1e9;
    dp[0][0]=0;

    for(int i=0;i<m;i++)
      for(int j=0;j<(1<<n);j++){

	for(int k=0;k<n;k++){
	  if(((1<<k)&j)!=0)continue;
	  
	  minimize( dp[i+1][j+(1<<k)] , dp[i][j]+abs(sum[j+(1<<k)]-d[i]));
	  minimize( dp[i][j+(1<<k)] , dp[i][j]);
	}

	minimize(dp[i+1][j],dp[i][j]+abs(sum[j]-d[i]));
      }



    int mn=1e9;
    for(int i=0;i<(1<<n);i++)mn=min(mn,dp[m][i]);
    cout<<mn<<endl;
  }
  return 0;
}

Measured memory_bytes: 16204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    vector<int> a(3);
    for (int i = 0; i < 3; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int sum = 0;
    for (int i = 1; i < 3; ++i) {
        sum += a[i] - a[i - 1];
    }
    cout << sum << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
 
    int a,b,c;
 
    cin>>a>>b>>c;
 
    if(a==5 && b==5 && c==7)
    {
        cout<<"YES"<<endl;
    }
    else if(a==7 && b==5 && c==5)
    {
        cout<<"YES"<<endl;
    }
    else if(a==5 && b==7 && c==5)
    {
       cout<<"YES"<<endl;
    }
    else
        cout<<"NO"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int N = scan.nextInt();
		long K = scan.nextLong();

		long[] A = new long[N];

		double left = 0.0;
		double right = 0.0;

		for (int i = 0; i < N; i++) {
			A[i] = scan.nextLong();
			if (A[i] > right) {
				right = A[i];
			}
		}

		//演算
		if (K != 0L) {
			while (right - left > 0.000001) {
				double mid = (left + right) / 2.0;

				long result = 0L;

				for (int i = 0; i < N; i++) {
					result += (long) Math.ceil(A[i] / mid) - 1L;
				}

				if (result > K) {
					left = mid;
				} else {
					right = mid;
				}
			}
		}

		//結果出力
		System.out.println((long) Math.ceil(right));
	}
}


Measured memory_bytes: 61268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int N;
int sum = 0;
int main()
{
    cin >> N;
    vector<int> L(2 * N);

    for (int i = 0; i < 2 * N; i++)
    {
        cin >> L[i];
    }
    sort(L.begin(), L.end());
    for (int i = 0; i < 2 * N; i += 2)
    {
        sum += L[i];
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3576
s=input()
if len(s)<26:
  for i in range(97,123):
    if not chr(i) in s:
      print(s+chr(i))
      exit()
else:
  for i in range(25)[::-1]:
    for j in range(i+1,26)[::-1]:
      if s[i]<s[j]:
        print(s[:i]+s[j])
        exit()
  else:
    print(-1)

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

vector<vector<int>>field;
vector<vector<bool>>used;


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

pair<int, int>getans(const int y, const int x) {
	if (used[y][x]) {
		return make_pair(field[y][x]?field[y][x]:3, 0);
	}
	used[y][x] = true;
	if (field[y][x]) {
		return make_pair(field[y][x], 0);
	}
	int nowcolor = 3;
	int nowcount = 1;
	for (int i = 0; i < 4; ++i) {
		pair<int, int>p(getans(y + dy[i], x + dx[i]));
		nowcolor &= p.first;
		nowcount += p.second;
		
	}
	return make_pair(nowcolor, nowcount);
}

int main() {
	while (1) {
		int w, h; cin >> w >> h;
		field.clear();
		used.clear();
		field.resize(h + 2);
		used.resize(h + 2);
		for (int i = 0; i < h + 2; ++i) {
			used[i].resize(w + 2);
		}
		for (int i = 0; i < w + 2; ++i) {
			field[0].push_back(3);
		}
		if (!w)break;
		for (int i = 0; i < h; ++i) {
			field[i + 1].push_back(3);
			string st; cin >> st;
			for (int j = 0; j < w; ++j) {
				if (st[j] == '.') {
					field[i + 1].push_back(0);
				}
				else if (st[j] == 'W') {
					field[i + 1].push_back(1);
				}
				else {
					field[i + 1].push_back(2);
				}
			}
			field[i + 1].push_back(3);
		}
		for (int i = 0; i < w + 2; ++i) {
			field[h+1].push_back(3);
		}
		int whnum = 0;
		int blnum = 0;
		for (int y = 0; y < h + 2; ++y) {
			for (int x = 0; x < w + 2; ++x) {
				if (!used[y][x]) {
					pair<int, int>a(getans(y, x));
					if (a.first == 1)whnum+=a.second;
					if (a.first == 2)blnum+= a.second;

				}
			}
		}
		cout << blnum << " " <<whnum << endl;
	}
	return 0;
}

Measured memory_bytes: 3252
#include<iostream>
#include<queue>
#include<cstring>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
#define INF (1e9)
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

struct state {
  int y,x,cost;
  bool operator < (const state &p)const{
    return cost > p.cost; 
  }
};

int R;
int th,tw,uh,uw,ty,tx,uy,ux;
int t[500][500],u[500][500];
int T[1000000],U[1000000];
int d[500][500];
vector<int> G;
map<int,int> g;

void compute(int a[500][500],int H,int W,int sy,int sx,int v[1000000]){
  for(int i=0;i<500;i++)for(int j=0;j<500;j++)d[i][j]=INF;
  priority_queue<state> Q;
  Q.push((state){sy,sx,1});
  d[sy][sx]=1;
  while(!Q.empty()){
    state s=Q.top();Q.pop();
    if(d[s.y][s.x]<s.cost)continue;
    v[g[s.cost]]++;
    for(int i=0;i<4;i++){
      int ny=s.y+dy[i],nx=s.x+dx[i];
      if(ny<0||nx<0)continue;
      if(ny>=H||nx>=W)continue;
      int ncost=max(a[ny][nx],s.cost);
      if(d[ny][nx]<=ncost)continue;
      d[ny][nx]=ncost;
      Q.push((state){ny,nx,ncost});
    }
  }
}

void solve(){
  sort(G.begin(),G.end());
  G.erase(unique(G.begin(),G.end()),G.end());
  for(int i=0;i<(int)G.size();i++)g[G[i]]=i;
  compute(t,th,tw,ty,tx,T);
  compute(u,uh,uw,uy,ux,U);
  int size=G.size();
  for(int i=0;i<size;i++){
    if(i)T[i]+=T[i-1];
    if(i)U[i]+=U[i-1];
    //cout<<T[i]<<" "<<U[i]<<" "<<G[i]<<endl;
  }

  int ans=INF;
  for(int i=0;i<size;i++){
    int target=R-T[i];
    int* it=lower_bound(U,U+size,target);
    if(it==U+size){
      continue;
    }
    ans=min(ans,G[i]+G[it-U]);
  }
  cout<<ans<<endl;
}

void init(){
  G.clear();
  g.clear();
  G.push_back(0);
  for(int i=0;i<1000000;i++)
    T[i]=U[i]=0;
}

int main(){
  while(cin>>R,R){    
    init();
    cin>>tw>>th>>tx>>ty;
    ty--,tx--;
    for(int i=0;i<th;i++){
      for(int j=0;j<tw;j++){
	cin>>t[i][j];
	G.push_back(t[i][j]);
      }
    }
    cin>>uw>>uh>>ux>>uy;
    uy--,ux--;
    for(int i=0;i<uh;i++){
      for(int j=0;j<uw;j++){
	cin>>u[i][j];
	G.push_back(u[i][j]);
      }
    }
    solve();
  }
  return 0;
}

Measured memory_bytes: 37660
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000
ll MOD=1e9+7;

main(){
    vector<ll> v(3,0);
    string s;cin>>s;
    ll t=1;
    for(int i=0;i<s.size();i++){
        char c=s[i];
        if(c=='?'){
            v[2]=(v[2]*3ll+v[1])%MOD;
            v[1]=(v[1]*3ll+v[0])%MOD;
            v[0]=(v[0]*3ll+t)%MOD;
            t=t*3ll%MOD;
        }
        else if(c=='A'){
            v[0]=(v[0]+t)%MOD;
        }
        else if(c=='B'){
            v[1]=(v[0]+v[1])%MOD;
        }
        else{
            v[2]=(v[1]+v[2])%MOD;
        }
    }
    cout<<v[2];
}



Measured memory_bytes: 512
void main() {
    writeln(2 ^^ readln.chomp.to!int.log2.to!int);
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
import math

n,m = map(int,input().split())
large = n if n >= m else m
ans = math.factorial(large)
if abs(n-m)>1:
    ans = 0
elif n == m:
    ans *= (math.factorial(n)*2)
else:
    ans *= math.factorial(large-1)
print(ans%(10**9+7))

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

int N;
vector<int> d;

void solve() {
  sort(d.begin(), d.end());
  cout << d[N / 2] - d[N / 2 - 1] << '\n';
}

int main() {
  cin >> N;
  d.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> d[i];
  }
  solve();
  return 0;
}

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

int main(void) {
	int n; cin >> n;
	set<int> st;
	for (int i = 0; i < n; i++) {
		int tmp; scanf("%d", &tmp);
		st.insert(tmp);
	}

	cout << (n == st.size() ? "YES" : "NO") << endl;

	return 0;
}

Measured memory_bytes: 9600
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

n,m = inp
h = {}
ans = []
l=r=0
now = 1
oc = 0
ec = n/2
(1..m).each do |i|
  if(i.even?)
    ans.push([ec%n+1,(ec+i)%n+1])
    ec -= 1
    ec  %= n
  else
    ans.push([oc%n+1,(oc + i)%n+1])
    oc -= 1
    oc %= n
  end
end
c = 0
ans.each do |a|
  if (c <m)
    puts a.join(" ")
  end
  c += 1
end


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long int lli;
typedef long long ll;

int main() {
    string s,t;
    cin >> s >> t;

    int ans = 0;
    rep(i,3) if(s[i] == t[i]) ans++;

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9+10)
#define ll_MIN (ll)(-1e9*1e9-10)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
//using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX
 

void solve()
{
  int n,x,t;
  cin >> n >> x >> t;
  cout << (n/x + (n%x!=0))*t << endl;
}


 
signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 3644
#include <stdio.h>

int main(void)
{
    int a, b;
    
    scanf("%d%d", &a, &b);
    
    if(a>b){
        printf("a > b\n");
    }
    else if(a < b){
        printf("a < b\n");
    }
    else{
        printf("a == b\n");
    }
    
    return 0;
}

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

int main(int argc, char **argv) {
	int n, x;
	cin >> n >> x;
	int p = 0;
	int ans = 1;
	for (int i = 0; i < n; ++i) {
		int l;
		cin >> l;
		p += l;
		if (p <= x)
			ans++;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair < ll, ll > pll;
typedef vector < ll > vll;
#define s second
#define f first
int main()
{   
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//cin>>t;
	while (t-- )
	{	int x,n;
		cin>>x>>n;
		int l=x,r=x;

		vector<int> v(n);
		for(int i=0;i<n;i++)
			cin>>v[i];

		sort(v.begin(),v.end());
		while(true)
		{	if(upper_bound(v.begin(),v.end(),l)==lower_bound(v.begin(),v.end(),l))
			{cout<<l;break;}
			if(upper_bound(v.begin(),v.end(),r)==lower_bound(v.begin(),v.end(),r))
			{cout<<r;break;}
			l--;
			r++;
		}
	}
	return 0;  
}

Measured memory_bytes: 3660
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Map.Entry;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int n = in.nextInt();
			int[] arr = new int[n];
			int total = 0;
			for (int i = 0; i < n; i++) {
				arr[i] = in.nextInt();
				total += arr[i];
			}
			Arrays.sort(arr);
			for (int i = 0; i < arr.length; i++) {
				if (total % 10 != 0) {
					break;
				} else {
					if (arr[i] % 10 != 0) {
						total -= arr[i];
					}
				}
			}
			if (total % 10 == 0) {
				total = 0;
			}
			out.println(total);
		}
	}

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

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

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

		public char nextChar() {
			return next().charAt(0);
		}

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

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

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

	}
}


Measured memory_bytes: 21460
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion
void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    string S;
    cin >> S;
    int N = S.length();
    string keyence = "keyence";
    REP(i, min(N, 7)){
        if(S[i] != keyence[0]){
            //keyence = keyence.substr(i);
            break;
        }
        keyence = keyence.substr(1);
    }
    //cout << keyence << el;
    REP(i, min(N, (int)keyence.length())){
        if(S[N-i-1] != keyence[keyence.length()-i-1]){
            cout << "NO" << el;
            return;
            break;
        }
    }
    cout << "YES" << el;
}



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

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main(){
    int a, b;
    cin>>a>>b;
    if(b%a==0) cout<<a+b<<endl;
    else cout<<b-a<<endl;

    return 0;
}

Measured memory_bytes: 256
H,W = input().split()
H,W = int(H),int(W)
MP = []
for i in range(10):
    MP.append(list(map(int,input().split())))

board = []
for h in range(H):
    board.append(list(map(int,input().split())))

def mincost(start,goal):
    queue = []
    queue.append((start,[],0))
    queue[0][1].append(start)
    mincost = 99999999999999999999999999999
    while len(queue) != 0:
        q = queue.pop(0)
        if q[0] == goal:
            if q[2] < mincost:
                mincost = q[2]
        else:
            for i in range(10):
                if i not in q[1]:
                    tq = q[1].copy()
                    tq.append(i)
                    if q[2]+MP[q[0]][i] < mincost:
                        queue.append((i,tq,q[2]+MP[q[0]][i]))
    return mincost

need_magical_power = 0
mincost_list = []
for i in range(10):
    mincost_list.append(mincost(i,1))


for h in range(H):
    for w in range(W):
        if board[h][w] == -1 or board[h][w] == 1:
            pass
        else:
            need_magical_power += mincost_list[board[h][w]]

print(need_magical_power)


Measured memory_bytes: 3444
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#define ll long long int
using namespace std;
map<string,int>mp;
string s1,s2;
int n;
int main(){
    scanf("%d",&n);
    cin>>s1;
    for(int i=2;i<=n;i++){
        s2=s1;//上一个
        if(i==2)
        mp[s2]=1;
        cin>>s1;//当前的
        if(mp[s1]){
            printf("No");
            return 0;
        }
        mp[s1]=1;
        if(s1[0]!=s2[s2.size()-1]){
            printf("No");
            return 0;
        }
    }
    
    printf("Yes");
    return 0;
}

Measured memory_bytes: 256
/*...Part - 01...*/

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <iterator>
#include <bitset>
#include <assert.h>
#include <new>
#include <sstream>
//#include <bits/stdc++.h>
using namespace std ;

/*...Part - 02...*/

typedef long long               ll ;
typedef long double             ld ;
typedef unsigned long long      ull ;
typedef pair<int,int>           pii ;
typedef pair<ll,ll>             pll ;
typedef vector<int>             vi ;
typedef vector<ll>              vll ;
typedef vector<vector<int>>     vvi ;

int Int(){int x ; scanf("%d",&x) ; return x ;}
ll Long(){ll x ; scanf("%lld",&x) ; return x ;}

/*...Part - 03...*/
/*....Debugger....*/

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl ;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}

/*...Part - 04...*/
/*...Needed to change according to problem requirements...*/

const int N          = (int)2e5 + 5 ;
const int maxN       = (int)1e6 + 6 ;
const ll  Mod        = (ll)1e9 + 7 ;
const int inf        = (int)2e9 ;
const ll  Inf        = (ll)1e18 ;

/*..........................................................*/
/*...Part - 05...*/

#define     debug(x)    cerr << #x << " = " << x << '\n' ;
#define     rep(i,b,e)  for(__typeof(e) i = (b) ; i != (e + 1) - 2 * ((b) > (e))  ; i += 1 - 2 * ((b) > (e)))
#define     Int         Int()
#define     Long        Long()
#define     all(x)      x.begin() , x.end()
#define     sz(x)       (int)x.size()
#define     ff          first
#define     ss          second
#define     pb          push_back
#define     eb          emplace_back
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)

/*...Part - 06...*/
/*...... ! Code start from here ! ......*/

const int max_n = 110 ;
const int max_v = 100100 ;

ll dp[max_n][max_v] ;
int val[max_n], cap[max_n] ;

int main(){
    int test = 1 , tc = 0 ;
    while(test--){
        int n = Int, w = Int ;
        for(int i = 1 ; i <= n ; ++i)cap[i] = Int, val[i] = Int ;
        for(int i = 0 ; i < max_n ; ++i){
        	for(int j = 0 ; j < max_v ; ++j)
        		dp[i][j] = Inf ;
        }
        dp[0][0] = 0 ;
        for(int i = 1 ; i <= n ; ++i){
        	for(int j = 0 ; j < max_v ; ++j){
        		if(j >= val[i])dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - val[i]] + cap[i]) ;
        		else dp[i][j] = dp[i - 1][j] ;
        	}
        }
        int res = 0 ;
        for(int i = 0 ; i < max_v ; ++i){
        	if(dp[n][i] <= w){
        		res = i ;
        	}
        }
        cout << res << '\n' ;
    }
    return 0 ;
}

/*...Always look at the part - 04...*/
/*...............END................*/




Measured memory_bytes: 86400
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX(a,b) (a > b) ? a : b
#define MIN(a,b) (a < b) ? a : b
const int inf = 1000000000; // 10^9

int main(){
   int a,b,c;scanf("%d %d %d",&a,&b,&c);
   if(a==b&&b==c&&a==c){
      printf("1");
   }else if(a!=b&&b!=c&&a!=c){
      printf("3");
   }else printf("2");
   return 0;
   }

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll      long long
#define pii     pair<int, int>
#define f       first
#define s       second
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d ", a)
#define pfl(a) printf("%lld\n", a)
#define Case(a) printf("Case %d: ", a)

using namespace std;
int main()
{
    int n;
    cin>>n;

    ll sum = 0;
    for(ll i=1;i<=n;i++){
        if(i %3 == 0 || i%5 == 0)
            continue;
        sum += i;

    }
    cout<<sum;
}



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

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

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

int main() {
  int n, k;
  cin >> n >> k;
  k = min(k, n - 1);
  combination c(n);
  mint ans = 0;
  for (int i = 0; i <= k; i++) {
    int r = n - i;
    ans += c(n, i) * c((n - i - 1) + i, i);
  }
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>
#include <algorithm>
using namespace std;
int n, m; double l[20], a[20], b[20];
int popcount(int x) {
	int ret = 0;
	for (int i = 0; i < 20; i++) {
		if (x & (1 << i)) ret++;
	}
	return ret;
}
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) scanf("%lf%lf%lf", &l[i], &a[i], &b[i]);
	double ret = 0.0;
	for (int i = 0; i < (1 << n); i++) {
		if (popcount(i) == m) {
			double res = 0.0;
			for (int j = 0; j < n; j++) {
				for (int k = j + 1; k < n; k++) {
					if ((i & (1 << j)) && (i & (1 << k))) {
						res += (l[j] - l[k]) * (l[j] - l[k]) + (a[j] - a[k]) * (a[j] - a[k]) + (b[j] - b[k]) * (b[j] - b[k]);
					}
				}
			}
			ret = max(ret, res);
		}
	}
	printf("%.9f\n", ret);
	return 0;
}

Measured memory_bytes: 2748
N, M = list(map(int, input().split()))
A_i = list(map(int, input().split()))
A_i = sorted(A_i, reverse=True)
Ans = []
for i in range(M):
    if A_i[i] >= sum(A_i)/(4*M):
        Ans.append(A_i[i])
if len(Ans) >= M:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v) v.begin(), v.end()
#define vl vector<ll>
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define ff first
#define ss second
ll INF = 1e9;
const int N=100005;
void solve()
{
    ll n,k=1,m=0,i=1,j,x,y,l,r;
    ll ans=0,sum;
    cin>>n>>k;
    ll a[N]{},dp[N]{};
    for(i=1;i<=n;i++) cin>>a[i];
    for(i=1;i<=n;i++)dp[i]=INF;
    dp[1]=0;
    for(i=1;i<=n;i++)
    {
        for(j=i+1;j<=i+k;j++)
            if(j<=n)
                dp[j]=min(dp[i]+abs(a[j]-a[i]),dp[j]);
    }
    cout<<dp[n];
}
int main()
{
    ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
     #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("output.txt", "w", stdout) ;
    #endif 
    int t=1;
    //cin>>t;
    while(t--)solve();
    return 0;
}


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

int main( void )
{
  int N;
  cin >> N;
  int bt = 0, bx = 0, by = 0;
  int at, ax, ay;
  int t, x, y;
  bool can = false;
  
  for( int i = 0; i < N; i++ ) {
    cin >> at >> ax >> ay;
    
    t = at - bt;
    x = abs( ax - bx );
    y = abs( ay - by );

    if( t >= x + y && t % 2 == ( x + y ) % 2 )
      can = true;
    else
      can = false;
    
    bt = at;
    bx = ax;
    by = ay;  
  }

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

Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    bool ans = 0;
    for(int i = 1; i < 10; i++){
        if(N % i == 0){
            if(N / i < 10){
                ans = 1;
            }
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import numpy as np

N = int(input())
upper = tuple(map(int, input().split()))
lower = tuple(map(int, input().split()))
upper_sum = np.cumsum(upper)
lower_sum = np.cumsum(np.flipud(lower))

s = np.zeros((N,), dtype=np.int32)

for i in range(N):
    s[i] = lower_sum[-1 - i] + upper_sum[i]
print(np.max(s))


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

using namespace std;

int main () {

    int n;          // 学生の人数
    int s[1000];    // 得点, Score

    double m;       // 得点の平均

    double a2;      // 分散 a^2
    double a;       // 標準偏差 a

    while (1) {

        cin >> n;
        if (n == 0) {
            break;
        }

        m = 0;

        for (int i = 0; i < n; i++) {
            cin >> s[i];
            m += s[i];
        }

        m /= n;

        a2 = 0;

        for (int i = 0; i < n; i++) {
            a2 += pow(s[i] - m, 2) / n;
        }

        a = sqrt(a2);

        cout << a << endl;

    }    

    return 0;
}


Measured memory_bytes: 3292
/*
 * cpp_filepath
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


void solve() {
  int n, t;
  cin >> n >> t;
  vector<int> C(n), T(n);
  loop(i,0,n) cin >> C[i] >> T[i];
  int cost = 100000;
  loop(i,0,n) {
    if (T[i] > t) continue;
    if (cost > C[i]) cost = C[i];
  }
  if (cost == 100000) cout << "TLE" << endl;
  else cout << cost << endl;
}


Measured memory_bytes: 256
n,m,x=map(int,input().split())
a=[]
for _ in range(n):
	aa=list(map(int,input().split()))
	a.append(aa)
ans=10**15
def two(x):
	return (n-len(bin(x)[2:]))*"0"+bin(x)[2:]
for i in range(2**n):
	r=two(i)
	b=[0]*m
	pre_ans=0
	for j in range(n):
		if r[j]=="1":
			pre_ans+=a[j][0]
			for k in range(m):
				b[k]+=a[j][k+1]
	f=1
	for j in range(m):
		if b[j]<x:
			f=0
			break
	if f:
		ans=min(ans,pre_ans)
print(ans if ans!=10**15 else -1)



Measured memory_bytes: 9264
using System;
using System.Text;
 
class AtCoder
{
    static void Main(){
		string s = Console.ReadLine();
      	int cnt =0;
      if(s == "SUN"){Console.WriteLine("7");}
      else if(s == "MON"){Console.WriteLine("6");}
      else if(s == "TUE"){Console.WriteLine("5");}
      else if(s == "WED"){Console.WriteLine("4");}
      else if(s == "THU"){Console.WriteLine("3");}
      else if(s == "FRI"){Console.WriteLine("2");}
      else if(s == "SAT"){Console.WriteLine("1");}
    }
}

Measured memory_bytes: 11092
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


class ModInt:
    MOD = 10 ** 9 + 7

    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    def __repr__(self):
        return str(self.x)

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    __radd__ = __add__

    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )

    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )

    def set_mod_divisor(self, divisor):
        ModInt.MOD = divisor


def comb_mod(n, r):
    res = 1
    r = min(n - r, r)

    for i in range(r):
        res *= (n - i)
        res %= MOD
        res *= pow((r - i), MOD - 2, MOD)

    return res


def main():
    n, m = map(int, readline().split())
    comb = ModInt(0)
    p1 = ModInt(1)  # mPs
    p2 = ModInt(1)  # m-sPn-s
    c1 = ModInt(1)  # nCs
    sign = -1

    for i in range(n):
        p2 *= (m - i)

    ans = p2 * p2

    for i in range(1, n + 1):
        p1 *= (m - i + 1)
        p2 *= pow(m - i + 1, MOD - 2, MOD)
        c1 *= (n - i + 1)
        c1 *= pow(i, MOD - 2, MOD)
        sign *= (-1)
        comb += p1 * p2 * p2 * c1 * sign

    ans -= comb

    print(ans)



if __name__ == '__main__':
    main()


Measured memory_bytes: 73964
n = int(input())
num = [[[0]*10 for floor in range(3)] for building in range(4)]
for i in range(n):
    b, f, r, v = map(int, input().split())
    num[b-1][f-1][r-1] += v
for building in range(4):
    for floor in range(3):
        for room in range(10):
            print('',num[building][floor][room], end='')
        print()
    if building in range(3):
        print('#'*20)


Measured memory_bytes: 5632
object Main {
  def main(args: Array[String]): Unit = {
    val house = Array.ofDim[Int](4,3,10)
    val in = new java.util.Scanner(System.in)
    val n = in.nextInt
    for(i <- 1 to n){
       val b = in.nextInt()
       val f = in.nextInt()
       val r = in.nextInt()
       val v = in.nextInt()
       house(b-1)(f-1)(r-1) +=v 
    }
    printHouse(house)
  }
  def printHouse(house:Array[Array[Array[Int]]]):Unit ={
    for(i <- 0 to 3){
      for(j <- 0 to 2){
        for(k <- 0 to 9){
          print(" "+house(i)(j)(k))
        }
        println("")
      }
      if(i < 3){
        println("####################")
      }
    }
  }
}

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

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



Measured memory_bytes: 256
#include <iostream>
#include <iterator>
#include <utility>
#include <set>
#include <algorithm>
#include <string>
#include <limits>

using namespace std;

int main()
{
  // skip the first line
  cin.ignore(numeric_limits<streamsize>::max(), '\n');

  vector<char> suits {'S', 'H', 'C', 'D'};

  multiset<pair<char, int>> missing_cards;

  for (char c : suits)
    for (int rank = 1; rank <= 13; ++rank)
      missing_cards.insert(make_pair(c, rank));

  char suit; 
  int rank;
  while ((cin >> suit) && (cin >> rank)) {
    missing_cards.erase(make_pair(suit, rank)); 
  }

  for (auto suit : suits)
    for (auto card : missing_cards)
      if (card.first == suit)
        cout << card.first << " " << card.second << endl;
}


Measured memory_bytes: 3052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int gcd(int a, int b) {  
  return b != 0 ? gcd(b, a % b) : a;
}//MAX
int lcm(int a, int b) { 
   return a * b / gcd(a, b);
   }
//MIN

 main() {
int n;
cin >> n;
vector<int>che(1e5+10,0);
for(int i=0;i<n;i++){
    int a;
    cin >> a;
if(a==0){
    che.at(a)++;
    che.at(a+1)++;
}
else{
    che.at(a-1)++;
    che.at(a)++;
    che.at(a+1)++;
}
}
sort(che.begin(),che.end());
reverse(che.begin(),che.end());
cout << che.at(0)<<endl;
 }


Measured memory_bytes: 640