akhauriyash/Code-Regression huggingface dataset:
def solve():
  N, T = map(int, input().split())
  A = [list(map(int, input().split())) for _ in range(N)] 
  A.sort()
  dp = [[0]*(T+1) for _ in range(N+1)]
  for i in range(N):
    for j in range(0,T+1):
      dp[i+1][j] = max(dp[i+1][j],dp[i][j])
      if j<T:
        t = min(T,j+A[i][0])
        dp[i+1][t] = max(dp[i+1][t],dp[i][j]+A[i][1])
  ans = dp[-1][-1]
  return ans
print(solve())

Measured memory_bytes: 145260
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main(){
	while(1){
		int n;
		cin>>n;
		if(n==0) break;
		vs a(n);
		for(int i=0;i<n;i++){
			string s,t;
			cin>>s;
			t+=s[0];
			bool B=0;
			for(auto c:s){
				if(B) t+=c,B=0;
				if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o') B=1;
			}
			a[i]=t;
		}
		int res=-1;
		for(int i=1;i<=50;i++){
			set<string> st;
			for(int j=0;j<n;j++) st.insert(a[j].substr(0,i));
			if(st.size()==n){
				res=i;
				break;
			}
		}
		cout<<res<<endl;
	}
}


Measured memory_bytes: 3176
n = int(input())
a = []
b = []
c = []
for i in range(n):
    x, y, z = map(int, input().split())
    a.append(x)
    b.append(y)
    c.append(z)
dp = [[0 for i in range(3)] for j in range(n)]
dp[0][0] = a[0]
dp[0][1] = b[0]
dp[0][2] = c[0]

for i in range(1,n):
    dp[i][0] = max(dp[i-1][1]+a[i],dp[i-1][2]+a[i])
    dp[i][1] = max(dp[i-1][0]+b[i],dp[i-1][2]+b[i])
    dp[i][2] = max(dp[i-1][0]+c[i],dp[i-1][1]+c[i])
print(max(dp[n-1]))

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

struct Job {
    int time, limit;
    bool operator<(const Job &j) const {
        return limit < j.limit;
    }
};

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

    int N;
    cin >> N;
    priority_queue<Job> que;
    for (int i = 0; i < N; i++) {
        Job j;
        cin >> j.time >> j.limit;
        que.push(j);
    }
    Job j = que.top();
    que.pop();
    int time = j.limit - j.time;
    if (time < 0) {
        cout << "No" << endl;
        return 0;
    }
    while (!que.empty()) {
        Job j = que.top();
        que.pop();
        time = min(time, j.limit);
        time -= j.time;
        if (time < 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 2420
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author tarek
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        AEatingSymbolsEasy solver = new AEatingSymbolsEasy();
        solver.solve(1, in, out);
        out.close();
    }

    static class AEatingSymbolsEasy {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            char[] a = in.readLine().toCharArray();
            int n = 0;
            for (int i = 0; i < a.length; i++) {
                if (a[i] == '+') {
                    n++;
                } else {
                    n--;
                }
            }
            out.printLine(n);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        private String readLine0() {
            StringBuilder buf = new StringBuilder();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r') {
                    buf.appendCodePoint(c);
                }
                c = read();
            }
            return buf.toString();
        }

        public String readLine() {
            String s = readLine0();
            while (s.trim().length() == 0) {
                s = readLine0();
            }
            return s;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void printLine(int i) {
            writer.println(i);
        }

    }
}



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

int main() {
  int64_t N,K;
  cin >> N >> K;
  if (K==1){
   cout << 0 << endl;
  }
  else {
  int64_t a=N%K,b=K-a;
  int64_t c=min(a,b);
   cout << c << endl;
  }
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pr;
typedef vector<ll> vc;
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)

int main() {
    // your code goes here
    char s[5];
    bool sv=false;
    cin >> s;
    rep(i,0,2) if(s[i]=='7') sv=true;
    if(sv) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3592
while True:
    words, type_ = input().split()
    if type_ == "L":
        if "_" in words:
            words = words.split("_")
            words = words[0] + "".join([w[0].upper() + w[1:] for w in words[1:]])
        else:
            words = words[0].lower() + words[1:]
    elif type_ == "U":
        if "_" in words:
            words = words.split("_")
            words = "".join([w[0].upper() + w[1:] for w in words])
        else:
            words = words[0].upper() + words[1:]
    elif type_ == "D":
        indices = [i for i, w in enumerate(words) if w.isupper()] + [len(words)]
        if words[0].islower():
            indices.insert(0, 0)
        words = "_".join([words[indices[i]].lower() + words[indices[i]+1: indices[i+1]] for i in range(len(indices) - 1)])
    else:
        break
    print(words)

Measured memory_bytes: 7480
s = input()
front = int(s[:2])
back = int(s[2:])

# MM 01 ~ 12
# YY 00 ~ 99

def withinMonths(num):
  if (num >= 1 and num <= 12):
    return True
  else:
    return False

if (withinMonths(front) and withinMonths(back)):
  print("AMBIGUOUS")
elif (withinMonths(front) and not withinMonths(back)):
  print("MMYY")
elif (not withinMonths(front) and withinMonths(back)):
  print("YYMM")
else:
  print("NA")

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

int main(){
	
	int n; cin >>n;
	vector<vector<pair<int,bool>>> xy(n); 
	for(int i=0; i<n; i++){
		int a; cin>>a;
		for(int j=0; j<a; j++){
			int x, y; cin >>x>>y;
			xy.at(i).push_back({--x,y});
		}
	}
	int cnt{0};
	for(int i=0; i<(1<<n); i++){
		vector<bool> ho(n);
		for(int j=0; j<n; j++){
			if(i&(1<<j)){
				ho.at(j)=1;
			}
		}
		bool flg{1};
		for(int j=0; j<n; j++){
			for(auto &k:xy.at(j)){
				if(ho.at(j)){
					if(k.second!=ho.at(k.first)) flg=0;
				}
			}
		}
		if(flg) cnt = max(cnt,__builtin_popcount(i));
	}
	cout << cnt << endl;
	
}

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

int n, *a;
void maxheapify(int i){
  int l, r, m, c;
  l = 2*i;
  r = 2*i+1;
  if(l <= n && a[l] > a[i])
    m = l;
  else m = i;
  if(r <= n && a[r] > a[m])
    m = r;
  if(m != i){
    c = a[i];
    a[i] = a[m];
    a[m] = c;
    maxheapify(m);
  }
  return;
}
void buildmaxheap(){
  int i;
  for(i = n/2; i > 0; i--)
    maxheapify(i);
}

int main(){
  int i;
  scanf("%d",&n);
  a = malloc(sizeof(int)*(n+1));
  for(i = 1; i <= n; i++) scanf("%d",&a[i]);
  buildmaxheap();
  for(i = 1; i <= n; i++)
    printf(" %d",a[i]);
  printf("\n");
  free(a);
  return 0;
}

Measured memory_bytes: 2472
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;

int main() {
  int N, K; cin>>N>>K;
  ll ans = 0;
  ll cnt ;
  if(K % 2 == 0) {
    cnt	= (N + K / 2) /	K;
    ans += cnt*cnt*cnt;
    //    cout << ans << endl;                                         

  }
    cnt = N / K;
    ans += cnt*cnt*cnt;

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



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()
 
using namespace std;
using ll = long long;
using pii = pair<int, int>;
 
const int oo = 1e9 + 7;
const int mod = 1e9 + 7, maxn = 100100;
const long double PI = acos(-1);
 
int main (){
    int k, x;
    cin >> k >> x;
 
    if (k*500 >= x) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <iostream>

using namespace std;

#define FOR(i, a, b)   for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)  for(int i = (a); i > (b); --i)
#define rep(i, n)      for(int i = 0; i < (n); ++i)
#define all(c)         begin(c), end(c)
#define rall(c)        rbegin(c), rend(c)
#define SZ(a)          ((ll) a.size())

typedef long long ll;
typedef unsigned long long ull;

int main(){
	int N;
	cin >>  N;
	vector<int> A1(N);
	vector<int> A2(N);
	rep(i,N) scanf("%d",&A1[i]);
	rep(i,N) scanf("%d",&A2[i]);
	vector<int> sum(N,0);
	rep(i,N){
		rep(j,N){
			if(j<=i) sum[i]+=A1[j];
			if(j>=i) sum[i]+=A2[j];
		}
	}
	cout << *max_element(all(sum));
}


Measured memory_bytes: 256
def main():
    W, H, N = map(int, input().split())
    lx = 0
    rx = W
    by = 0
    ty = H

    for _ in range(N):
        x, y, a = map(int, input().split())

        if a == 1:
            lx = max(x, lx)
        if a == 2:
            rx = min(x, W, rx)
        if a == 3:
            by = max(y, by)
        if a == 4:
            ty = min(y, H, ty)

    print(max(rx-lx, 0) * max(ty-by, 0))


main()


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

#define ull unsigned long long
#define endl '\n'
#define ll long long
const int N = 2e3 + 5;
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        //freopen("VLJUM.INP", "r", stdin);
        //freopen("VLJUM.OUT", "w", stdout);
        ll a[3];
        for (int i = 0; i < 3; i++){
                cin >> a[i];
        }
        sort(a, a + 3);
        if (a[1] == 5 && a[0] == 5 && a[2] == 7) cout << "YES";
        else cout << "NO";
}



Measured memory_bytes: 256
//#pragma GCC optimization ("O3")
//#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx,avx2,fma")

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

#define all(s) s.begin(), s.end()
#define ok puts("ok")
#define ll long long
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define vi vector < int >
#define pl pair < ll, ll >
#define pi pair < int, int >
#define pii pair < int, pi >
#define next next123
#define left left123

const int N = 2007;
const ll INF = 1e18 + 7;

ll dp[N][N], ans;
pair < ll, int > a[N];
int n;

main(){
    cin >> n;
    for (int i = 1; i <= n; i++){
        scanf("%lld", &a[i].fr);
        a[i].sc = i;
    }
    sort(a + 1, a + n + 1, greater<pi>());
    for (int i = 1; i <= n; i++){
        for (int j = 0; j <= i; j++){
            if (j != i)
                dp[i][j] = dp[i - 1][j] + a[i].fr * abs(a[i].sc - (n - i + j + 1));
            if (j != 0)
                dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + a[i].fr * abs(a[i].sc - j));
        }
    }
    for (int j = 0; j <= n; j++)
        ans = max(ans, dp[n][j]);
    cout << ans;
}


Measured memory_bytes: 26380
#include <bits/stdc++.h>
using namespace std;
int main (){
    long long ans=1,N,i,x;
    cin >> N;// 要素数宣言前に入力
    vector<long long> v(N);

    cin >> v.at(0);
    for(i=1;i<N;i++){
        cin >> x;
        if(v.at(i-1) == x){
            N--;
            i--;
            continue;
        }
        v.at(i) = x;
    }
    
    for(i=0;i<N-2;i++){
        if((v.at(i+1)-v.at(i))*(v.at(i+2)-v.at(i+1)) <0){
           ans ++;
           i++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<cstdio>
using namespace std;
int main()
{
//	freopen("A.in","r",stdin);
	long long A,B,C;
	scanf("%lld%lld%lld",&A,&B,&C);
	if((A%2)||(B%2)||(C%2))
	{
		printf("0\n");
		return 0;
	}
	if(A==B&&B==C){
		printf("-1\n");
		return 0;
	}
	int cnt=0;
	long long sum=A+B+C;
	while(1){
		if((A%2)||(B%2)||(C%2)){
			printf("%d\n",cnt);
			return 0;
		}
		A=(sum-A)/2;
		B=(sum-B)/2;
		C=(sum-C)/2;
		cnt++;
	}
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cstdio>
using namespace std;


int main() {
  vector<int> v, ov;
  for (int i = 1; i*(i+1)*(i+2)/6 < 1000000; i++)
    v.push_back(i*(i+1)*(i+2)/6);

  vector<int> table(1000000, INT_MAX);
  vector<int> otable(1000000, INT_MAX);
  for (int i = 0; i < v.size(); i++) {
    table[v[i]] = 1;
    if (v[i] % 2)
      otable[v[i]] = 1;
  }
  
  for (int i = 1; i < 1000000; i++) {
    for (int j = 0; j < v.size() && v[j] < i; j++) {
      table[i] = min(table[v[j]] + table[i-v[j]], table[i]);
      if (v[j] % 2)
        otable[i] = min(otable[v[j]] + otable[i-v[j]], otable[i]);
    }
    //   cout << i << " " << table[i] << endl;
  }

  int n;
  while (cin >> n && n)
    printf("%d %d\n", table[n], otable[n]);
}

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

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int a; cin >> a;
	string s; cin >> s;
	if (a < 3200) {
		cout << "red";
	}
	else cout << s;
}

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 1010
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n;
char ans[N][N];
char w[4][4]={
{'a','a','c','d'},
{'b','b','c','d'},
{'e','f','g','g'},
{'e','f','h','h'}
};
char _5[5][5]={
{'j','j','h','h','c'},
{'g','b','b','.','c'},
{'g','d','.','f','f'},
{'i','d','.','.','e'},
{'i','.','a','a','e'}
};
char _6[6][6]={
{'b','h','h','.','.','i'},
{'b','.','g','g','.','i'},
{'d','a','.','.','f','f'},
{'d','a','.','k','k','.'},
{'.','.','l','c','j','j'},
{'e','e','l','c','.','.'}
};
char _7[7][7]={
{'l','l','.','g','c','.','.'},
{'k','.','.','g','c','.','.'},
{'k','e','e','.','m','.','.'},
{'.','.','.','.','m','d','h'},
{'.','.','i','i','.','d','h'},
{'n','b','b','.','.','f','f'},
{'n','.','.','a','a','j','j'}
};
void Solve(int x){
	for(int i=0;i<4;++i){
		for(int j=0;j<4;++j){
			ans[x+i][x+j]=w[i][j];
		}
	}
}
void Copy5(){
	for(int i=1;i<=5;++i){
		for(int j=1;j<=5;++j){
			ans[i][j]=_5[i-1][j-1];
		}
	}
}
void Copy6(){
	for(int i=1;i<=6;++i){
		for(int j=1;j<=6;++j){
			ans[i][j]=_6[i-1][j-1];
		}
	}
}
void Copy7(){
	for(int i=1;i<=7;++i){
		for(int j=1;j<=7;++j){
			ans[i][j]=_7[i-1][j-1];
		}
	}
}

//构造较小矩阵。 
/*
char mp[12][12];
inline int Get(int n){
	return (1LL*rand()*rand()+rand())%n+1;
}
const int d[4][2]={{-1,0},{0,-1},{0,1},{1,0}};
bool check(){
	for(int i=1;i<=n;++i){
		int cnt=0;
		for(int j=1;j<=n;++j){
			if(mp[i][j]^'.'&&mp[i][j]^mp[i][j-1])++cnt;
		}
		if(cnt^3)return false;
	}
	for(int j=1;j<=n;++j){
		int cnt=0;
		for(int i=1;i<=n;++i){
			if(mp[i][j]^'.'&&mp[i-1][j]^mp[i][j])++cnt;
		}
		if(cnt^3)return false;
	}
	return true;
}
void Get(){
	while(true){
		memset(mp,'.',sizeof(mp));
		for(int i=1;i<=(n<<1);++i){
			int x=Get(n),y=Get(n),k=Get(4)-1;
			int nx=x+d[k][0],ny=y+d[k][1];
			if(nx<1||ny<1||nx>n||ny>n||mp[x][y]^'.'||mp[nx][ny]^'.'){
				--i;continue;
			}
			mp[x][y]=mp[nx][ny]='a'+i-1;
		}
		if(check()){
			for(int i=1;i<=n;++i){
				putchar('{');
				for(int j=1;j<=n;++j){
					putchar('\'');
					putchar(mp[i][j]);
					putchar('\'');
					putchar(j==n?'}':',');
				}
				if(i<n)putchar(',');
				putchar('\n');
			}
			break;
		}
	}
}
*/

int main(){
	n=read();
	//Get();
	if(n==2){
		printf("-1\n");
		return 0;
	}
	if(n==3){
		printf("aab\n");
		printf("c.b\n");
		printf("cdd\n");
		return 0;
	}
	int qwq=n;
	memset(ans,'.',sizeof(ans));
	while(n>=8){
		Solve(n-3);
		n-=4;
	}
	switch(n){
		case 4:
			Solve(1);break;
		case 5:
			Copy5();break;
		case 6:
			Copy6();break;
		case 7:
			Copy7();break;
	}
	for(int i=1;i<=qwq;++i){
		for(int j=1;j<=qwq;++j){
			putchar(ans[i][j]);
		}
		putchar('\n');
	}
	return 0;
}



Measured memory_bytes: 4636
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		long N = long.Parse(str);
		long[,] A = new long[N,N];
		for(var i=0;i<N;i++){
			string str2 = Console.ReadLine();
			for(var j=0;j<str2.Length;j++){
				if(str2.Substring(j,1) == "#"){
					A[i,j] = 1;
				}
			}
		}
		long ans = 0;
		long[] C1 = new long[N];
		long[] C2 = new long[N];
		long c1max = 0;
		long c1min = N;
		for(var i=0;i<N;i++){
			for(var j=0;j<N;j++){
				if(A[i,j] == 1){
					C1[i] += 1;
				}
			}
			c1max = Math.Max(c1max,C1[i]);
			c1min = Math.Min(c1min,C1[i]);
		}
		long c2max = 0;
		long c2min = N;
		long c2maxct = 0;
		for(var i=0;i<N;i++){
			for(var j=0;j<N;j++){
				if(A[j,i] == 1){
					C2[i] += 1;
				}
			}
			if(C2[i] == N){
				c2maxct += 1;
			}
			c2max = Math.Max(c2max,C2[i]);
			c2min = Math.Min(c2min,C2[i]);
		}
		if(c1max == 0){
			ans = -1;
		} else {
			if(c1max == N){
				ans += N - c2maxct;
			} else {
				long ctmin = N;
				for(var i=0;i<N;i++){
					if(C1[i] > 0){
						for(var j=0;j<N;j++){
							if(A[i,j] == 1){
								long ct = N - C1[j];
								ctmin = Math.Min(ctmin,ct);
							}
						}
					}
				}
				ans += ctmin;
				ans += N - c2maxct;
			}
			if(c1max <= N-1 && c2min == 0){
				ans = Math.Min(ans,N - c2maxct + 1 + (N-c1max));
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 16988
import java.io.*;
import java.util.regex.Pattern;

public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader bf =new BufferedReader(new InputStreamReader(System.in));
		String t;
		while((t=bf.readLine())!=null){
			String m = "(.* )?th(e|is|at) .*",em="",dec="";
			int n,c=0;
			for(n=0;n<26;n++){
				em="";for(int i=0;i<m.length();i++){c=m.charAt(i);em+=(char)((c>=97&&c<=123)?(((c-71+n)%26)+97):(c));}
				if(((Pattern.compile(em)).matcher(t)).matches())break;
			}
			for(int i=0;i<t.length();i++){c=t.charAt(i);c=(c>=97&&c<=123)?(((c-71-n)%26)+97):(c);dec+=(char)c;}
			System.out.println(dec);
		}
	}
}

Measured memory_bytes: 9820
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <utility>
#include <functional>

using namespace std;

#define int long long

signed main() {
	vector<pair<int, int>> v;
	int n, k, a, b;
	cin >> n >> k;
	for (int i = 0; i < n; ++i) {
		cin >> a >> b;
		v.push_back(make_pair(a, b));
	}
	sort(v.begin(), v.end());

	for (int i = 0; i < n; ++i) {
		if (k <= v[i].second) {
			cout << v[i].first << endl;
			break;
		}
		else {
			v[i + 1].second += v[i].second;
		}
	}

	return 0;
}

Measured memory_bytes: 2420
/*
//1——巨佬
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;
struct edge { LL to, cost; };

const LL inf = 11234567890123456;
std::vector<LL>dist;
std::vector<std::vector<edge>>G;
bool bellman_ford(LL n, LL s, LL t)
{
    std::fill(dist.begin(), dist.end(), inf);
    dist[s] = 0;
    rep(i, 2 * n)
    {
        for (LL v = 1; v <= n; ++v)
        {
            for (auto e : G[v])
            {
                if (dist[v] != inf && dist[e.to] > dist[v] + e.cost)
                {
                    dist[e.to] = dist[v] + e.cost;
                    if (i >= n - 1 && e.to == t) return true;
                }
            }
        }
    }
    return false;
}

int main()
{
    LL N, M, P;
    in >> N >> M >> P;
    std::vector<LL>a(M), b(M), c(M);
    rep(i, M) in >> a[i] >> b[i] >> c[i];
    
    dist.resize(N + 1); G.resize(N + 1);
    rep(i, M) G[a[i]].push_back({ b[i],-c[i] + P });
    if (bellman_ford(N, 1, N)) out << -1 << std::endl;
    else out << std::max(0ll, -dist[N]) << std::endl;
}
*/
//2——巨佬
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define MAX 5050
#define INF (1LL<<60LL)
typedef pair<int,int> P;
int V;
struct edge2{
  int from,to,cost;
  edge2(){}
  edge2(int from,int to,int cost):from(from),to(to),cost(cost){}
};
edge2 es[MAX];
int d[MAX];
int ok[MAX];
int used[MAX];
int shortest_path(int s,int e){
  for(int i=0;i<V;i++) d[i]=INF;
  d[s]=0;
  for(int j=0;j<V;j++){
    bool update=0;
    for(int i=0;i<e;i++){
      edge2 e=es[i];
      if(!ok[e.from]||!ok[e.to]) continue;
      if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
        d[e.to]=d[e.from]+e.cost;
        update=1;
      }
    }
    if(!update) break;
    if(j==V-1){
      cout<<-1<<endl;
      exit(0);
    }
  }
  return d[V-1];
}

vector<int> G[MAX];
void dfs2(int v){
  if(used[v]) return;
  used[v]=1;
  for(int u:G[v]){
    dfs2(u);
  }
}

signed main(){
  int v,e,p;
  cin>>v>>e>>p;
  for(int i=0;i<e;i++){
    int u,v,d;
    cin>>u>>v>>d;u--;v--;
    G[u].push_back(v);
    es[i]=edge2(u,v,p-d);
  }
  for(int i=0;i<v;i++){
    memset(used,0,sizeof(used));
    dfs2(i);
    ok[i]=used[v-1];
  }
  V=v;
  cout<<max<int>(-shortest_path(0,e),0)<<endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

const i64 MOD = 998244353;

int main()
{
  i64 N;
  cin >> N;
  vector<pair<i64, i64>> xy(N);
  for (i64 i = 0; i < N; i++)
    cin >> xy[i].first >> xy[i].second;
  sort(xy.begin(), xy.end(), [](const pair<i64, i64> &l, const pair<i64, i64> &r) {
    return atan2(l.second, l.first) < atan2(r.second, r.first);
  });
  i64 ans = 0;
  for (i64 i = 0; i < N; i++)
    for (i64 j = 1; j <= N; j++)
    {
      i64 x = 0, y = 0;
      for (i64 k = 0; k < j; k++)
      {
        x += xy[(i + k) % N].first;
        y += xy[(i + k) % N].second;
      }
      ans = max(ans, x * x + y * y);
    }

  cout << fixed << setprecision(11) << sqrt(ans) << endl;
  return 0;
}


Measured memory_bytes: 256
# (d1+d2)/2 == n1, (d2+d3)/2 == n2... が矛盾なくなるようにする
# にぶたんを使う
# rを10**9にしてたらなんかしらんけど駄目だった 10にしたらいけた...

n = int(input())
dum = list(map(int, input().split()))
l, r = 0, (10 ** 10) // 2

while True:
    mid = (l + r) // 2
    rain = [0 for _ in range(n)]
    rain[0] += mid * 2
    for i in range(1, n):
        next_amount = (dum[i - 1] - (rain[i - 1] // 2)) * 2
        rain[i] += next_amount

    if dum[-1] == (rain[-1] + rain[0]) // 2:
        rain = list(map(str, rain))
        print(" ".join(rain))
        exit()
    if (rain[0] + rain[-1]) // 2 < dum[-1]:
        l = mid + 1
    else:
        r = mid


"""
7
110 50 53 50 11 36 88

11
38 7 15 15 9 31 23 1 5 55 81
"""


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

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

#define MOD 1000000007
#define PI 3.14159265359
#define endl '\n'
#define eb emplace_back
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define dbg(x) cout << #x << " = " << x << '\n'
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;

void test()
{
    float t,d,s;
    cin>>d>>t>>s;

    float tt = d/s;

    float tr = t;

    if(tt<=tr)
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
}

int main()
{   
fast_io();
cout << fixed << setprecision(15);
int t = 1;

//cin>>t;

for(int i = 0; i < t; i++)
{
    test();
}
return 0;
}

Measured memory_bytes: 3736
from collections import Counter

N, K, Q = map(int, input().split())
A_i = [int(input()) for _ in range(Q)]

counter = Counter()

for i in range(Q):
    counter[A_i[i]] += 1

for j in range(N):
    print('Yes' if Q - counter[j+1] < K else 'No')



Measured memory_bytes: 11904
def chmin(a,b):
	if a >= b :
		a = b
		return a
	else:
		return a

n = int(input())
h = list(map(int,input().split()))
dp = [-1]*(n+1)
dp[1] = 0
dp[2] = abs(h[1]-h[0])

for i in range(1,n-1):
	dp[i+2] = chmin(
		dp[i+1]+abs(h[i+1]-h[i])
		,dp[i]+abs(h[i+1]-h[i-1]))

print(dp[n])

Measured memory_bytes: 13980
import sys

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


def main():
    n = input()

    res = ""
    for x in n:
        res += "9" if x == "1" else "1"

    print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61472
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

D = sorted(D)
T = sorted(T)

i, j = 0, 0
count = 0
while True:
    now = T[i]
    tmp = 0
    for k in range(j, N):
        if D[k] == now:
            j = k+1
            count += 1
            i += 1
            break
        else:
            tmp = k
    if count == M:
        print("YES")
        exit()
    if tmp == N-1:
        print("NO")
        exit()

Measured memory_bytes: 39348
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,k;
  cin>>n>>m>>k;
  FOR(i,0,n+1)FOR(j,0,m+1){
    if(k==i*(m-j)+(n-i)*j){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        long x = sc.nextLong();
        long y = sc.nextLong();
        long z = sc.nextLong();
        long k = sc.nextLong();
        ArrayList<Long> aList = new ArrayList<>();
        ArrayList<Long> bList = new ArrayList<>();
        ArrayList<Long> cList = new ArrayList<>();

        for (int i = 0; i < x; i++) {
            aList.add(sc.nextLong());
        }
        aList.sort(Comparator.reverseOrder());

        for (int i = 0; i < y; i++) {
            bList.add(sc.nextLong());
        }
        bList.sort(Comparator.reverseOrder());

        for (int i = 0; i < z; i++) {
            cList.add(sc.nextLong());
        }
        cList.sort(Comparator.reverseOrder());

        sc.close();

        long a, b, c;

        ArrayList<Long> ans = new ArrayList<>();

        for (int i = 0; i < x; i++) {
            for (int j = 0; j < y; j++) {
                for (int l = 0; l < z; l++) {
                    if ((i + 1) * (j + 1) * (l + 1) <= k) {
                        a = aList.get(i);
                        b = bList.get(j);
                        c = cList.get(l);
                        ans.add(a + b + c);
                    } else {
                        break;
                    }
                }
            }
        }

        ans.sort(Comparator.reverseOrder());

        for (int i = 0; i < k; i++) {
            System.out.println(ans.get(i));
        }
    }
}

Measured memory_bytes: 35436
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int tmp=0;
    int MIN=0;
    for(int i=0;i<n;i++){
        if(s[i]=='(' && tmp>=0)tmp++;
        else if(s[i]=='(' && tmp<0){
            MIN-=tmp;
            tmp=1;
        }
        else tmp--;
    }
    if(tmp<0)MIN-=tmp;
    for(int i=0;i<MIN;i++)cout << "(";
    cout << s;
    for(int i=0;i<tmp;i++)cout << ")";
}

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


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

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

    int maxv = -1e+9;
    int minv = R[0];

    for (int i=1; i<n; ++i) {
        maxv = max(maxv, R[i]-minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;
}


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

int main() {
	int n,t_point,h_point;
	cin >> n;
	string a[n][2];
	for(int i = 0; i < n; i++){
		cin >> a[i][0];
		cin >> a[i][1];
	}
	for(int i = 0; i < n; i++){
		if(a[i][0] > a[i][1]){
			t_point += 3;
		}else if(a[i][0] < a[i][1]){
			h_point += 3;
		}else{
			t_point++;
			h_point++;
		}
	}
	cout << t_point << " " << h_point << endl;
	return 0;
}


Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int n,m,a,b;
    cin >> n >> m;
    vector<int> vec(n);
    rep(i,m){
        cin >> a >> b;
        vec.at(a-1)++;
        vec.at(b-1)++;
    }
    rep(i,n){
        cout << vec.at(i) << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8

static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;


ll sum[10010]={0};
bool prime[200000];
vector<int> v;

int main(){
	rep(i,200000) prime[i]=true;
	prime[0]=prime[1]=false;
	for(int i=2;i*i<=200000;i++){
		if(prime[i]){
			for(int j=i*i;j<200000;j+=i){
				prime[j]=false;
			}
		}
	}
	v.PB(2);
	for(int i=3;i<200000;i++){
		if(prime[i]){
			v.PB(i+v[v.size()-1]);
		}
	}
	int n;
	while(cin>>n,n!=0) cout<<v[n-1]<<endl;
	
	
	return 0;
}

Measured memory_bytes: 1544
mod=10**9+7
n=int(input())
a=list(map(int,input().split()))
def gcd(a,b):
  while b:a,b=b,a%b
  return a
def lcm(a,b):return a*b//gcd(a,b)
l=a[0]
for i in range(1,n):
  l=lcm(l,a[i])
ans=0
l%=mod
for i in range(n):
  ans+=l*pow(a[i],mod-2,mod)
  ans%=mod
print(ans)


Measured memory_bytes: 42076
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pNO cout << "NO" << endl
#define pYES cout << "YES" << endl
#define endl "\n"
#define pi 3.14159265358979
using namespace std;
using ll = long long;

class LargeNumber {
private:
	bool is_prime[179424691 + 3];// Up to 3e5 + 1
	vector<long long> Prime_table;
public:
	vector<long long> Eratosthenes(const long long N = 300007) { // return primes up to N
		for (ll i = 0; i <= N; i++)
		{
			is_prime[i] = true;
		}
		for (ll i = 2; i <= N; i++)
		{
			if (is_prime[i])
			{
				for (ll j = 2 * i; j <= N; j += i)
				{
					is_prime[j] = false;
				}
				Prime_table.emplace_back(i);
			}
		}
		return Prime_table;
	}

	template<typename T>
	map<T, T> Factorization(T N) const {
		map<T, T> mp;
		if (N == 1) {
			return mp;
		}

		for (ll i = 0; i < Prime_table.size(); i++) {
			while (N % Prime_table[i] == 0) {
				mp[Prime_table[i]]++;
				N /= Prime_table[i];
			}
		}

		if (N > 1) mp[N]++;

		return mp;
	}


	bool isPrime(long long x) {
		if (x == 0 || x == 1) {
			return false;
		}
		return is_prime[x];
	}
};

void recursion(vvll& dp, const vll& prime_table, ll ind, ll pind) {
	//ここからk*pindを求める
	for (ll i = pind; i < prime_table.size(); i++) {
		ll p = prime_table[i];

		if (ind * p > dp.size()) break;

		if (p == dp[ind][0]) {
			ll num = (dp[ind][2] * (dp[ind][1] + 2)) / (dp[ind][1] + 1);
			dp[ind * p] = { p,dp[ind][1] + 1,num };
			recursion(dp, prime_table, ind * p, i);
		}
		else {
			dp[ind * p] = { p,1,dp[ind][2] * 2 };
			recursion(dp, prime_table, ind * p, i);
		}
	}
}
int main() {
	ll N; cin >> N;
	LargeNumber lg;
	ll M = 10000000;
	vll prime_table = lg.Eratosthenes(M+1);
	vector<vector<ll>> dp(M + 1, vll(3)); // {minP,minP_N,cur}
	for (auto& d : dp) {
		d = { 0,0,2 };
	}
	dp[0] = { -1,-1,-1 };
	dp[1] = { 1,1,1 };
	recursion(dp, prime_table, 1, 0);

	ll ans = 0;
	for (ll i = 1; i <= N; i++) {
		ans += i * dp[i][2];
	}
	cout << ans << endl;
}


Measured memory_bytes: 570216
X, Y, Z, K = map(int, input().split())

A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)

AB = []
for i in range(X):
    for j in range(Y):
        AB.append(A[i] + B[j])

AB.sort(reverse=True)

ABC = []
for i in range(min(K, len(AB))):
    for j in range(Z):
        ABC.append(AB[i] + C[j])

ABC.sort(reverse=True)
for i in range(K):
    print(ABC[i])


Measured memory_bytes: 148548
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::cmp::{max, min} ;

fn main() {
    input! {
        n: usize,
        p: [usize; n],
    }
    let mut ans = 0;
    let mut min = *(p.first().unwrap());
    for p_i in p {
        if  p_i <= min {
            min = p_i;
            ans += 1;
        }
    }
    println!("{}", ans);
}


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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mod 1000000007
int getTheAnswer() {
    return 42;
}

using namespace std;
using ll=long long;

class CMultiplication3 {
public:
    int solve(string &s){
        int val=0;
        val=(s[0]-'0')*100+(s[2]-'0')*10+(s[3]-'0');
        return val;
    }
	void solve(std::istream& cin, std::ostream& cout) {
        ll a;
        cin>>a;
        string b;
        cin>>b;
        int val=solve(b);
        cout<<(a*val)/100;

	}
};


int main() {
	CMultiplication3 solver;
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

    int main(){
      int n,m,c;
      cin >> n >> m >> c;
      int b[m];
      rep(i,m)cin >> b[i];
      int a[n][m];
      rep(i,n){
       rep(j,m)cin >> a[i][j]; 
      }
      int ans=0;
      rep(i,n){
       int sum=0;
        rep(j,m)sum+=a[i][j]*b[j];
        sum+=c;
        if(sum>0)ans++;
      }
      cout << ans << endl;
      return 0;}

Measured memory_bytes: 256
#include <cstring>
#include <cstdlib>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define ABS(a) ((a)<0?(-(a)):(a))
#define CS while(cases())
#define I(n) int n = gi()
#define II(n) n = gi()
#define L(n) ll n = gli()
#define LL(n) n = gli()
#define F(i, n) for (int i = 0; i < n; i++)
#define Fa(n, a) for (int i = 0; i < n; i++) a[i] = gi()
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

template<class T>
T gcd(T a, T b) {
    return (b == 0 ? a : gcd(b, a%b));
}

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int cases() {
    static int t = gi();
    return t--;
}

#define MD 1000000007
int a[1000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    I(n); I(k);
    Fa(n, a);
    sort(a, a+n);
    int s = 0;
    F(i, k) s += a[i];
    printf("%d\n", s);

    return 0;
}


Measured memory_bytes: 3816
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        long K = long.Parse(Console.ReadLine());
        sb.Append("50\n");
        long[] A = new long[50];
        for(int i=0;i<50;i++){
            A[i] = K/50+49;
        }
        for(int i=0;i<K%50;i++){
            A[i] += 51; 
        }
        for(int i=0;i<50;i++){
            A[i] -= K%50;
        }
        for(int i=0;i<50;i++){
            sb.Append(A[i]);
            if(i == 49){
                sb.Append("\n");
            }
            else{
                sb.Append(" ");
            }
        }
    }
}

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

int main(){
  string S;
  cin >> S;
  int count = 0;
  
  for (int i = 0; i < S.size() / 2; i++){
    
    if (S.at(i) != S.at(S.size() - 1 - i)){
      count++;
    }
  }
        
  cout << count << endl;
}
   


Measured memory_bytes: 256
M, K = gets.split.map(&:to_i)

m = 2 ** M - 1

if K > m || (M == 1 && K == 1)
  puts -1
  exit
end

list = [*0..m]

if K == 0
  puts (list + list.reverse).join(' ')
else
  list[m], list[K] = list[K], list[m]

  temp = list.dup
  temp.pop

  list += temp.reverse
  list << K

  puts list.join(' ')
end



Measured memory_bytes: 9080
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
  int n;cin>>n;
  int v[n],c[n],ans=0;
  rep(i,n)cin>>v[i];
  rep(i,n){cin>>c[i];if(v[i]>c[i])ans+=v[i]-c[i];}
  cout<<ans;
}
  

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

int n, y;

int main() {
    std::cin >> n >> y;
    y /= 1000;
    for (int i = 0; i <= n; i++) {
        for (int p = 0; p <= n - i; p++) {
            if (10*i+5*p+1*(n-i-p) == y) {
                std::cout << i << " " << p << " " << (n-i-p) << std::endl;
                return 0;
            }
        }
    }
    std::cout << "-1 -1 -1" << std::endl;
}


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

typedef long double ld;

const ld EPS = 1e-9;
const ld INF = 1e10;
const ld PI = M_PI;

struct Point{
  ld x, y;
  Point(ld x, ld y):x(x), y(y){}
  Point(){}
};

Point operator+(const Point &a, const Point &b){
  return Point(a.x + b.x, a.y + b.y);
}
Point operator-(const Point &a, const Point &b){
  return Point(a.x - b.x, a.y - b.y);
}
Point operator*(const Point &a, const ld b){
  return Point(a.x * b, a.y * b);
}
Point operator*(const Point &a, const Point &b){
  return Point(a.x*b.x-a.y*b.y, a.x*b.y+a.y*b.x);
}
Point operator/(const Point &a, const ld b){
  return Point(a.x / b, a.y / b);
}

ld cross(const Point &a, const Point &b){
  return a.x*b.y - a.y*b.x;
}

ld dot(const Point &a, const Point &b){
  return a.x*b.x + a.y*b.y;
}

ld norm(const Point &a){
  return dot(a, a);
}

struct Line:vector<Point>{
  Line(Point a = Point(0, 0), Point b = Point(0, 0)){
    this->push_back(a);
    this->push_back(b);
  }
};

typedef vector<Point> Polygon;

int ccw(Point a, Point b, Point c){
  b = b - a;
  c = c - a;
  if(cross(b, c) > EPS) return +1; // 反時計周り
  if(cross(b, c) < -EPS) return -1; // 時計周り
  if(dot(b, c) < 0) return +2; // c -- a -- b がこの順番に一直線上
  if(norm(b) < norm(c)) return -2; // a -- b -- c がこの順番に一直線上
  return 0; // a -- c -- b が一直線上
}

Point next(const Polygon &a, int x){
  return a[(x+1)%a.size()];
}

Point prev(const Polygon &a, int x){
  return a[(x-1+a.size()) % a.size()];
}

bool is_convex(const Polygon &poly){
  for(int i = 0 ; i < (int)poly.size() ; i++){
    if(ccw(prev(poly, i), poly[i], next(poly, i)) == -1) return false;
  }
  return true;
}

int contain(const Polygon &poly, const Point &p){
  bool in = false;
  for(int i = 0 ; i < (int)poly.size() ; i++){
    Point a = poly[i] - p;
    Point b = next(poly, i) - p;
    if(a.y > b.y) swap(a, b);
    if(a.y <= 0 && 0 < b.y && cross(a, b) < 0) in = !in;
    if(cross(a, b) == 0 && dot(a, b) <= 0) return 1;
  }
  return in ? 2 : 0;
}

int main(){  
  int q;
  cin >> q;
  Polygon poly;
  while(q--){
    Point p;
    cin >> p.x >> p.y;
    poly.push_back(p);
  }
  cin >> q;
  while(q--){
    Point p;
    cin >> p.x >> p.y;
    cout << contain(poly, p) << endl;    
  }
  return 0;
}

Measured memory_bytes: 1248
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007

 

int main() {
	char cord[200][200]; // cord[W][H]
	int W, H, N; cin >> W >> H >> N;
	for (int i = 0; i < N; i++) {
		int x, y, a; cin >> x >> y >> a;
		if (a == 1) {
			for (int w = 0; w < W; w++) {
				for (int h = 0; h < H; h++) {
					if (w < x)cord[w][h] = 'B';
				}
			}

		}
		else if (a == 2) {
			for (int w = 0; w < W; w++) {
				for (int h = 0; h < H; h++) {
					if (w >= x)cord[w][h] = 'B';
				}
			}

		}
		else if (a == 3) {
			for (int w = 0; w < W; w++) {
				for (int h = 0; h < H; h++) {
					if (h < y)cord[w][h] = 'B';
				}
			}

		}
		else {
			for (int w = 0; w < W; w++) {
				for (int h = 0; h < H; h++) {
					if (h >= y)cord[w][h] = 'B';
				}
			}

		}


	}
	int out = 0;
	for (int w = 0; w < W; w++) {
		for (int h = 0; h < H; h++) {
			if (cord[w][h] != 'B')out++;
		}
	}

	print(out);






	return 0;
}

Measured memory_bytes: 256
s = []
for i in range(5):
    s.append(int(input()))
k = int(input())
flag = True
for x in s:
    for y in s:
        if x != y:
            z = x - y
            if z <= k:
                pass
            else:
                flag = False
if flag:
    print('Yay!')
else:
    print(':(')

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

int main(){
    char a;
    cin  >>a ;
    if (a == 'A'
    || a == 'B'
    || a == 'C'
    || a == 'D'
    || a == 'E'
    || a == 'F'
    || a == 'G'
    || a == 'H'
    || a == 'I'
    || a == 'J'
    || a == 'K'
    || a == 'L'
    || a == 'M'
    || a == 'N'
    || a == 'O'
    || a == 'P'
    || a == 'Q'
    || a == 'R'
    || a == 'S'
    || a == 'T'
    || a == 'U'
    || a == 'V'
    || a == 'W'
    || a == 'X'
    || a == 'Y'
    || a == 'Z'
    ){
        cout << 'A' << endl;
    }else {
        cout << 'a' << endl;
    }

}

Measured memory_bytes: 3632
#include <iostream>
#include <deque>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n; long long c; cin >> n >> c;
    deque<pair<long long, long long> > hull;
    long long h, dp[n]; cin >> h;
    hull.push_back(make_pair(-2 * h, (dp[0] = 0) + h * h));
    for (int i = 1; i < n; i++) {
        cin >> h;
        while (hull.size() >= 2 && hull[0].first * h + hull[0].second >= hull[1].first * h + hull[1].second) hull.pop_front();
        dp[i] = hull[0].first * h + hull[0].second + h * h + c;
        hull.push_back(make_pair(-2 * h, dp[i] + h * h));
        while (hull.size() >= 3 && (hull[hull.size() - 2].second - hull[hull.size() - 3].second) * (hull[hull.size() - 2].first - hull[hull.size() - 1].first) >= (hull[hull.size() - 1].second - hull[hull.size() - 2].second) * (hull[hull.size() - 3].first - hull[hull.size() - 2].first)) {
            hull[hull.size() - 2] = hull[hull.size() - 1];
            hull.pop_back();
        }
    }
    cout << dp[n - 1];
    return 0;
}


Measured memory_bytes: 4096