akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

int main(void)
{
    string s;
    cin >> s;

    map<char,int> mp;

    for(char c = 'a';c <= 'z';c++){
        mp[c] = 0;
    }

    rep(i, s.size()){
        mp[s[i]]++;
    }

    for(char c = 'a';c <= 'z';c++){
        if(mp[c] == 0){
            cout << c << endl;
            return 0;
        }
    }

    cout << "None" << endl;

    return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
#define vecmin(A) *min_element(A.begin(),A.end())
#define vecmax(A) *max_element(A.begin(),A.end())
typedef long long ll;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(pow(2,a)+pow(2,b)+pow(2,c)+pow(2,d) == pow(2,1)+pow(2,9)+pow(2,7)+pow(2,4)){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

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

typedef long long ll;

int main()
{
    int a,b,c,i=0;
    cin>>a>>b>>c;
    if(a==b&&b==c&&a%2==0)i=-1;
    else 
    for(i=0;a%2==0&b%2==0&c%2==0;i++){
      int s=a,t=b,u=c;
      a=(t+u)/2;
      b=(s+u)/2;
      c=(s+t)/2;
    }
    cout<<i<<endl;
    return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const double PI=3.14159265358979323846;

int main() {
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    //double h_k = h * 30 + m * 0.5;
    double h_k = h * 60 * 0.5 + m * 0.5;
    double m_k = m * 6;
    double kakudo = min(360 - min(abs(h_k - m_k),abs(m_k - h_k)), min(abs(h_k - m_k),abs(m_k - h_k)));
    double res = sqrt((pow(a, 2) + pow(b, 2)) - (2*a*b*cos(kakudo*(M_PI/180))));
    cout << fixed << setprecision(15);
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4188
N = int(input())
F = [int(input().replace(' ',''),2) for _ in [0]*N]
P = [[int(x) for x in input().split()] for _ in [0]*N]
print(max([sum([P[j][bin(i&F[j]).count('1')] for j in range(N)])for i in range(1,2**10)]))

Measured memory_bytes: 3060
#include<iostream>
using namespace ::std;
int main(){
    
    int s,t,number=1,i=1;
    cin>>s>>t;
  if(t==1)
  {
  cout<<0; 
  return 0;   
  }
  if(s>=t){
  cout<<i;
    return 0;
  }
  
  
  number+=s-1;
  //cout<<number<<endl;
    while(number<=t){
        number+=s-1;
      //cout<<number<<endl;
        i++;
      if(number>=t)
        break;
    }    
    cout<<i;
}

Measured memory_bytes: 256
a,b,c,d = map(int,input().split())
s = c - a
t = d - b
x_3 = c - t
y_3 = d + s
x_4 = x_3 - s
y_4 = y_3 - t
print(str(x_3)+' '+str(y_3)+' '+str(x_4)+' '+str(y_4) )

Measured memory_bytes: 9180
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 2005

struct Line{

	ll A,B,C;
};

struct Info{
	Info(){
		x = y = 0;
	}
	Info(ll arg_x,ll arg_y){
		x = arg_x;
		y = arg_y;
	}
	ll x,y;
};

ll N,M;
ll diff_row[4] = {-1,0,0,1},diff_col[4] = {0,-1,1,0};
Line tate[SIZE],yoko[SIZE];
map<ll,ll> mapX,mapY;
short table[4*SIZE][4*SIZE];


int main(){

	scanf("%lld %lld",&N,&M);

	vector<ll> X,Y;
	X.push_back(0);
	Y.push_back(0);

	//縦線
	for(int i = 0; i < N; i++){

		scanf("%lld %lld %lld",&tate[i].A,&tate[i].B,&tate[i].C);

		X.push_back(tate[i].A);
		X.push_back(tate[i].B);
		Y.push_back(tate[i].C);
	}

	//横線
	for(int i = 0; i < M; i++){

		scanf("%lld %lld %lld",&yoko[i].A,&yoko[i].B,&yoko[i].C);

		X.push_back(yoko[i].A);
		Y.push_back(yoko[i].B);
		Y.push_back(yoko[i].C);
	}

	sort(X.begin(),X.end());
	sort(Y.begin(),Y.end());
	X.erase(unique(X.begin(),X.end()),X.end());
	Y.erase(unique(Y.begin(),Y.end()),Y.end());

	for(ll i = 0; i < X.size(); i++){

		mapX[X[i]] = i;
	}
	for(ll i = 0; i < Y.size(); i++){

		mapY[Y[i]] = i;
	}

	ll H = X.size()*2; //偶数行が、ダミー
	ll W = Y.size()*2; //偶数列が、ダミー

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){

			table[row][col] = 0;
		}
	}

	for(int i = 0; i < N; i++){

		ll a = mapX[tate[i].A]*2;
		ll b = mapX[tate[i].B]*2;
		ll c = mapY[tate[i].C]*2;
		for(ll x = a; x <= b; x++){

			table[x][c] = -1;
		}
	}
	for(int i = 0; i < M; i++){

		ll a = mapX[yoko[i].A]*2;
		ll b = mapY[yoko[i].B]*2;
		ll c = mapY[yoko[i].C]*2;

		for(int y = b; y <= c; y++){

			table[a][y] = -1;
		}
	}

	queue<Info> Q;
	ll start_x = mapX[0]*2;
	ll start_y = mapY[0]*2;
	table[start_x][start_y] = 1;

	Q.push(Info(start_x,start_y));

	Info info;

	while(!Q.empty()){

		info = Q.front();
		Q.pop();

		for(int i = 0; i < 4; i++){

			ll adj_x = info.x+diff_row[i];
			ll adj_y = info.y+diff_col[i];

			if(adj_x < 0 || adj_x >= H)	continue;
			if(adj_y < 0 || adj_y >= W)continue;
			if(table[adj_x][adj_y] != 0)continue;


			table[adj_x][adj_y] = 1;

			Q.push(Info(adj_x,adj_y));
		}
	}

	ll ans = 0;

	for(ll row = 0; row < H; row++){
		for(ll col = 0; col < W; col++){
			if(table[row][col] != 1)continue;

			if(row == 0 || row == H-1 || col == 0 || col == W-1){

				printf("INF\n");
				return 0;
			}
			if(row%2 == 0 || col%2 == 0)continue;

			ll tmp_x = X[row/2+1]-X[row/2];
			ll tmp_y = Y[col/2+1]-Y[col/2];

			ans += tmp_x*tmp_y;
		}
	}

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

	return 0;
}


Measured memory_bytes: 98308
import sys
N,Y = map(int,input().split())

for i in range(N+1):
    for j in range(N-i+1):
        k = N-i-j
        ans = i*10000 + j*5000 + k*1000

        if ans == Y:
            print("{0} {1} {2}" .format(i,j,k))
            sys.exit()

print("-1 -1 -1")



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

static const double pi = 3.14159265358979323846;
static const int N = 100;

int main(){
  int N;
  cin >> N;
  cout << "ABC" << N << endl;
  return 0;
}


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

int main() {
  int c1[3], c2[3], c3[3], d1, d2;
  bool p = false;
  cin >> c1[0] >> c2[0] >> c3[0];
  d1 = c1[0] - c2[0]; //b1 - b2
  d2 = c2[0] - c3[0]; //b2 - b3
  for(int i = 1; i < 3; i++){
    cin >> c1[i] >> c2[i] >> c3[i];
    if(d1 != c1[i] - c2[i] || d2 != c2[i] - c3[i]) p = true;
  }
  if(p) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
using System;

public class Program
{
    public static void Main()
    {
        int Word_Length=int.Parse(Console.ReadLine());
        var line=Console.ReadLine();
        int num=int.Parse(Console.ReadLine())-1;
        
        var j=0;
        for(var i=0;i<Word_Length;i++){
            if(line[i]!=line[num])j=1;
            else j=2;
            
            if(j==1)Console.Write("*");
            else Console.Write(line[num]);
            
            j=0;
            
        }
        Console.WriteLine();
    }
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)

int main(int argc, char** argv) {
    //ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) {
        freopen("d:\\code\\cpp\\stdin", "r", stdin);
        //freopen("d:\\code\\cpp\\stdout", "w", stdout);
    }

    string s;
    cin >> s;
   
    vector<int> v;
    int n = s.length();
    for(int i=0; i<n; i++){
        if (s[i]=='A')
            v.push_back(1);
        else if (s[i]=='B' && i+1<n && s[i+1]=='C'){
            v.push_back(0);
            i++;
        }
        else
            v.push_back(2);
    }

    ll sol = 0, cnt = 0;
    for(int i=v.size()-1; i>=0; i--){
        if (v[i]==0)
            cnt++;
        else if (v[i]==1)
            sol += cnt;
        else
            cnt = 0;
    }
    cout << sol << '\n';

    if (argc == 2 && atoi(argv[1]) == 123456789)        cerr << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

Measured memory_bytes: 1660
n = int(input())
a = list(map(int, input().split()))

from collections import Counter
c = Counter(a)

check_ary = []
if n&1:
    check_ary.append(0)

for i in range(n//2):
    for _ in range(2):
        check_ary.append((i+1)*2 if n&1 else i*2+1)

c2 = Counter(check_ary)

if c != c2:
    print(0)
    exit()

print(pow(2, n//2, 10**9+7))

Measured memory_bytes: 24624
#include <stdio.h>
 
int main() {
	int N, K, Z = 1;
	scanf("%d", &N);
	scanf("%d", &K);
	for (int i = 0; i < N; i++) {
		if (Z * 2 < Z + K) {
			Z *= 2;
		} else {
			Z += K;
		}
	}
	printf ("%d", Z);
	return 0;
}

Measured memory_bytes: 2112
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

#define MIN(a,b) ((a)<(b)?(a):(b))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))
#define SORT(a,num,cmp) qsort((a),(num),sizeof(*(a)),cmp)

int cmp_int (const void *a, const void *b) {
  i32 d = *(i32 *)a - *(i32 *)b;
  return d == 0 ? 0 : d < 0 ? -1 : 1;
}

void run (void) {
  i32 n, a, b;
  scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32, &n, &a, &b);
  i32 *x = ALLOC (n, i32);
  for (i32 i = 0; i < n; ++i) {
    scanf ("%" SCNi32, x + i);
  }
  i32 *d = ALLOC (n - 1, i32);
  for (i32 i = 0; i < n - 1; ++i) {
    d[i] = x[i + 1] - x[i];
  }
  SORT (d, n - 1, cmp_int);
  i64 min = (i64) (n - 1) * b;
  i64 sum = 0;
  for (i32 i = 0; i < n - 1; ++i) {
    sum += d[i];
    i64 v = sum * a + (i64) (n - 2 - i) * b;
    min = MIN (min, v);
  }
  printf ("%" PRIi64 "\n", min);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 1404
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;
bool pict[55][55];
int main() {
    char a [55][55];
    int h,w;
    bool flag = true;
    cin >> h >> w;
    rep(i, h) rep(j, w) cin >> a[i+1][j+1];
    for(int i = 1; i < h+1; i++) {
        for(int j = 1; j < w+1; j++) {
            if(a[i+1][j+1] == '#') {
                bool flagi = false;
                if(a[i+2][j+1] == '#' or a[i][j+1] == '#' or a[i+1][j+2] == '#' or a[i+1][j] == '#') flagi = true;
                if(!flagi) flag = false;
            }
        }
    }

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



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

#define fastIO                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL)
#define here cout << "here\n" // debug
#define int long long int
#define pb push_back
#define mp make_pair
#define pi pair<int, int>
#define sl(x) cin >> x
#define pfl(x) printf("%lld\n", x)
#define pf printf //debug
#define mod 1000000007
#define modu(x) x % 1000000007
#define isEqualf(a, b) (abs(a - b) < 1e-9) // comapre 2 float nums
#define inputVec(v, n)        \
  for (int i = 0; i < n; i++) \
  {                           \
    int d;                    \
    sl(d);                    \
    v[i] = d;                 \
  }
#define loop(i, n) for (; i < n; i++)

int32_t main()
{
  fastIO;

  int n;
  sl(n);
  vector<int> v(n);
  inputVec(v, n);
  sort(v.begin(), v.end());
  int i = 2;
  double prev = (v[0] + v[1]) / 2.0;
  loop(i, n)
  {
    prev = (prev + v[i]) / 2;
  }
  pf("%lf\n", prev);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
     int H,W,i,j;
     //bool a=false;
     while(cin>>H>>W){
          if(H==0 && W==0){
			  break;
		  }
		//if(a==true)cout<< endl;
		//a=true;
		  for(i=0;i<H;i++){
			for(j=0;j<W;j++){
				if(j==0 || j==W-1 || i==0 || i==H-1){
					cout<<"#";
				}
				else{
						cout<<"."; 
					}
				}
						cout<< endl;
  }
  cout<<endl;
}
}




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

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

  string s;
  cin >> s;

  if (s.find('7') == s.npos) cout << "No\n";
  else cout << "Yes\n";

  return (0);
}


Measured memory_bytes: 3492
/* ex4_1
    suuxxu */

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

int main(void){
    double num, diff;
    int ans;

    // get inputs
    scanf("%lf %lf", &num, &diff); // N D

    // calculate answer
    // a man can watch (2 * diff + 1) trees
    // We need ceil(num / (2 * diff + 1)) men
    ans = (int)ceil(num / (2 * diff + 1));

    // output answer
    printf("%d\n", ans);

    return 0;
}

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

int base[101];
int ans[101];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int b[n];
    for(int i = 0; i < n; i++){
        cin >> b[i];
        if(b[i] > i+1){
            cout << -1 << endl;
            return 0;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = n-1; j >= 0; j--){
            if(b[j] == -1) continue;
            if(b[j]+base[j] == j+1){
                ans[i] = b[j];
                b[j] = -1;
                j = -1;
            }
            else base[j]++;
        }
    }
    for(int i = n-1; i >= 0; i--){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import math
n = int(input())
t = [int(input()) for _ in range(n)]
if n == 1:
    print(t[0])
    exit()
a = t[0]*t[1]//math.gcd(t[0],t[1])
for i in range(2, n):
    a = t[i]*a//math.gcd(t[i],a)
print(a)

Measured memory_bytes: 9196
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    A2IN(ll, L, ll, R, N);
    ll L_max = *max_element(ALL(L));
    ll R_min = *min_element(ALL(R));
    ll ans = 0;
    priority_queue<ii> l;
    pq_asc<ll> r;
    REP(i, N)
    {
        l.push({L[i], R[i]});
        if (R[i] == R_min)
        {
            l.push({L[i], R[i]});
        }
        if (L[i] == L_max)
        {
            r.push(R[i]);
        }
        CH(max, ans, max(0LL, R_min - L_max + 1) + R[i] - L[i] + 1);
    }
    ans = CH(max, ans, max(0LL, R_min - l.top().first + 1) + max(0LL, r.top() - L_max + 1));
    REP(i, N)
    {
        r.push(l.top().second);
        l.pop();
        CH(max, ans, max(0LL, R_min - l.top().first + 1) + max(0LL, r.top() - L_max + 1));
    }
    OUT(ans);
}

Measured memory_bytes: 5232
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n,m;
	cin >> n >> m;
	cout << n*(n-1)/2 + m*(m-1)/2 << '\n';
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n;
    cin >> n;
    vi a(n), b(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(all(a));
    for(int i = 0; i < n; i++){
        if(b[i] != a[n-1]) cout << a[n-1];
        else cout << a[n-2];
        cout << '\n';
    }
    
}

Measured memory_bytes: 3200
#include <stdio.h>
int main(void) {
	int a, b;
	char op;

	while (1) {
		scanf("%d %c %d", &a, &op, &b);


		if (op == '+') {
			printf("%d\n", a + b);
		}
		else if (op == '-') {
			printf("%d\n", a - b);
		}
		else if (op == '*') {
			printf("%d\n", a*b);
		}
		else if (op == '/') {
			printf("%d\n", a / b);
		}
		else {
			break;
		}

	}

	return 0;

}


Measured memory_bytes: 2124
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (int)1e9 //10^9:∞
#define LLINF (long long)1e12
#define MOD (int)1e9+7 //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/

VI v(100005);
/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__


	int N;
	cin>>N;
	vector<VI> g(2,VI(N));
	REP(i,2)REP(j,N)cin>>g[i][j];

	int ans=0;

	REP(i,N){
		int res=0;
		FOR(j,0,i)res+=g[0][j];
		FOR(k,i,N-1)res+=g[1][k];
		ans=max(ans,res);
	}
	cout<<ans<<endl;
















	return 0;
}













Measured memory_bytes: 3676
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
#include<functional>
#include<numeric>
#include<utility>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<string>
#include<cstring>
#include<list>
using namespace std;
typedef vector<int>VI;
typedef vector<VI>VVI;
typedef vector<string>VS;
typedef pair<int,int>PII;
typedef long long LL;
typedef pair<LL,LL>PLL;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define PB push_back
#define EACH(i,c) for(typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define F first
#define S second

int N;
vector<PLL>bug;

bool solve(int n){
    if(!n)return true;
    priority_queue<LL>Q;
    LL sum=0;
    REP(i,N+1){
        if(i<n){
            sum+=bug[i].S;
            Q.push(bug[i].S);
            continue;
        }
        if(bug[i-1].F*n>=sum)return true;
        if(i==N)break;
        sum-=Q.top();
        sum+=bug[i].S;
        Q.pop();
        Q.push(bug[i].S);
    }
    return false;
}
int main(){
    cin>>N;
    bug.resize(N);
    REP(i,N)cin>>bug[i].S>>bug[i].F;
    sort(RALL(bug));

    int ub=N+1,lb=0;

    while(ub-lb>1){
        int mid=(ub+lb)/2;
        if(solve(mid))lb=mid;
        else ub=mid;
    }

    cout<<lb<<endl;

    return 0;
}

Measured memory_bytes: 13304
#include<cstdio>
#include<algorithm>
using namespace std;
int n,h,ans;

struct Stu{
	long long a,b; 
}k[1000100];

int cmp(Stu x,Stu y)
{
	return x.a<y.a;
}

int main()
{
	scanf("%d%d",&n,&h);
	int oo=1;
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&k[oo++].a);
		k[oo-1].b=1;
		scanf("%d",&k[oo++].a);
	}
/*	if(n==1)
	{
		if(h%k[1].a==0) cout<<h/k[1].a<<endl;
		else cout<<h/k[1].a+1<<endl;
		return 0;
	}
*/

	sort(k+1,k+2*n+1,cmp);
	int o=2*n;
	while(h>0)
	{
		if(k[o].b==0)
		{
			h-=k[o].a;
			ans++;
		}
		else break;
		o--;
	}
	if(h<0) h=0;
	if(h%k[o].a==0) printf("%d\n",ans+h/k[o].a);
	else printf("%d\n",ans+h/k[o].a+1);
	
	
	return 0;
}

Measured memory_bytes: 4224
void solve();

int main() {
	solve();
	return 0;
}

//////////////////////////////////////////////////
//////////////////////////////////////////////////
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <boost/multiprecision/cpp_int.hpp>
#include <limits.h>

using namespace std;
using namespace boost::multiprecision;
int R, G, B, N;

void solve() {
	cin >> R >> G >> B >> N;
	long long ans = 0;
	for (int g = 0; g <= N; g += G) {
		for (int r = 0; r <= N; r += R) {
			if (N - g - r >= 0 && (N - g - r) % B == 0)ans++;
		}
	}
	cout << ans << endl;
	return;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define swap(a,b) temp=p[a],p[a]=p[b],p[b]=temp;
using namespace std;
int p[31],moto[31];
int q[8],ans[30],now;
void sousa1(void);
void sousa2(void);
void sousa3(void);
void sousa4(void);
bool check(void);
void reset(void);
void create4sinsuu(int a,int d);
void calc();
bool puzzle(int d)
{
	static int n;
	//printf("%d:",n);
	create4sinsuu(n,d);
	reset();
	for (int i=0;i<d;i++)
	{
		//printf("%d,",q[i]);
		switch (q[i])
		{
			case 0:sousa1();break;
			case 1:sousa2();break;
			case 2:sousa3();break;
			case 3:sousa4();break;
		}
	}
	if (check())
	{
		//printf("%d\n",d);
		ans[now]=d;
		return true;
	}
	//cout<<endl;
	n++;
	return false;
}
void calc()
{
	int i,a=1,j;
	for (i=1;i<=30;i++)
	{
		cin>>moto[i];
		p[i]=moto[i];
	}
	if (check())
	{
		//puts("0");
		ans[now]=0;
		return;
	}
	for (j=0;j<8;j++)
	{
		a*=4;
		for (i=0;i<a;i++)
		{
			if (puzzle(j+1)) goto end;
		}
	}
	end:
	;
}
int main()
{
	int N;
	cin>>N;
	for (int i=0;i<N;i++)
	{
		now=i;
		calc();
	}
	for (int i=0;i<N;i++)
	{
		printf("%d\n",ans[i]);
	}
	return 0;
}
void sousa1()
{
	static int temp;
	swap(1,24)
	swap(7,30)
	swap(4,27)
	swap(16,18)
	swap(21,10)
}
void sousa2()
{
	static int temp;
	swap(7,22)
	swap(10,12)
	swap(9,24)
	swap(8,23)
	swap(18,13)
}
void sousa3()
{
	static int temp;
	swap(3,22)
	swap(9,28)
	swap(6,25)
	swap(13,15)
	swap(12,19)
}
void sousa4()
{
	static int temp;
	swap(1,28)
	swap(3,30)
	swap(2,29)
	swap(15,16)
	swap(21,19)
}
bool check()
{
	int a=0,b=0;
	bool b1,b2;
	b1=(p[a+1]==p[a+2]&&p[a+2]==p[a+3]&&p[a+3]==p[a+4]&&p[a+4]==p[a+5]&&
	p[a+5]==p[a+6]&&p[a+6]==p[a+7]&&p[a+7]==p[a+8]&&p[a+8]==p[a+9]&&
	p[b+10]==p[b+11]&&p[b+11]==p[b+12]&&p[b+16]==p[b+17]&&p[b+17]==p[b+18]);
	a=21;b=3;
	b2=(p[a+1]==p[a+2]&&p[a+2]==p[a+3]&&p[a+3]==p[a+4]&&p[a+4]==p[a+5]&&
	p[a+5]==p[a+6]&&p[a+6]==p[a+7]&&p[a+7]==p[a+8]&&p[a+8]==p[a+9]&&
	p[b+10]==p[b+11]&&p[b+11]==p[b+12]&&p[b+16]==p[b+17]&&p[b+17]==p[b+18]);
	if (b1==1&&b2==1)
	{
		return true;
	} else {
		return false;
	}
}
void reset(void)
{
	for (int i=1;i<=30;i++)
	{
		p[i]=moto[i];
	}
}
void create4sinsuu(int a,int d)
{
	//数字を4進数に変換
	int i;
	for (i=0;i<d;i++)
	{
		q[i]=a%4;
		a/=4;
	}
}



Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,ans;
    cin>>n;
    ans=0;
    ll a1=0;
    ll a2=0;
    fr(i,n){
        cin>>a1;
        ans+=max(0ll,a2-a1);
        a2=max(a2,a1);
    }
    cout<<ans;
}

Measured memory_bytes: 3604
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
//		 static int mod =  (int) (Math.pow(10,9)+7);
		 static int mod =  (int) 998244353;
		 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
	    public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);
	        int N= sc.nextInt();
	        int K= sc.nextInt();
	        String S = sc.next()+"0000";
	        char[] c = S.toCharArray();
	        int[] a=new int[N+10];
	        int[] b=new int[N+10];
	        int cnt=0;
	        for(int k=0;cnt<N;k++) {
		        int acnt=0;
		        int bcnt=0;
		        while(c[cnt]=='1') {
		        	acnt++;
		        	cnt++;
		        }		        
		        a[k]=acnt;
	        	while(cnt<N&&c[cnt]=='0') {
	        		bcnt++;
	        		cnt++;
	        	}
	        	b[k]=bcnt;
	        }
	        long ans=0;
	        int[] sum = new int[N+10];
	        sum[0]=a[0];
	        for(int i=0;i<K;i++) {
	        	sum[0]=sum[0]+b[i]+a[i+1];	        	
	        }
	        ans=sum[0];
	        for(int i=1;i<N-K;i++) {
	        	sum[i]=sum[i-1]+a[i+K]+b[i+K-1]-a[i-1]-b[i-1];
	        	ans=Math.max(ans,sum[i]);
	        }
	        
	        System.out.println(ans);
	        

	    }
	    
	    

	}

Measured memory_bytes: 26020
#include <iostream>
#include <vector>
#include<string>
#include <set>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
	int N;
	cin >> N;
	vector<int> p(N);
	
	for(int i = 0;i<N;i++){
		cin >> p[i];
	}
	int total = 0;
	int max = 0;
	for(int i = 0;i<N;i++){
		total += p[i];
		if(max<p[i]){
			max = p[i];
		}
	}
	
	total = total - max / 2;
	
	std::cout << total << endl; 	
	return 0;
}


Measured memory_bytes: 3656
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include<iomanip>
using namespace std;

int main()
{
    int N;
    cin>>N;
    int B[N-1];
    for(int i =0;i<N-1;i++)
    {
        cin>>B[i];
    }
    long long sum =0;
    sum += B[0];
    sum += B[N-2];
    for(int i = N-2;i>0;i--)
    {
        if(B[i-1]>B[i])
        {
            sum += B[i];
        }
        else
        {
            sum += B[i-1];
        }
    }
    cout<<sum<<endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
	int n;
	cin >> n;
	double res = 0;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		res += 1.0 / a;
	}
	cout << setprecision(10) << 1 / res << endl;
}


Measured memory_bytes: 3760
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<utility>
#include<queue>
#include<cmath>
#include<cstdio>
using namespace std;
#define REP(i, a,b) for(i=a;i<b;i++) 
#define REP1(i,b,a) for(i=b-1;i>=a;i--)
#define output(x) cout<<x<<endl;
#define pb(x) push_back(x);
typedef long long int ll;
typedef pair<int, int> P;


int main() {
	ll i, j, k, l, m, n, sum, flag, cc,M,X,H,W;
	sum = 0;
	flag = 0;
	int N[4];
	cin >> N[0] >> N[1] >> N[2] >> N[3];
	sort(N, N + 4);
	if (N[0] == 1 && N[1] == 4 && N[2] == 7 && N[3] == 9) {
		output("YES");
	}
	else {
		output("NO");
	}



	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a[3];
    for(int i = 0;i < 3;i++)
    {
        cin >> a[i];
    }
    sort(a,a + 3);
    cout << (a[1] - a[0]) + (a[2] - a[1]);

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e4+10;
int n,w,f[MAXN],ans;
int main (){
	scanf("%d %d",&n,&w);
	f[0]=0;
	for(int i=0;i<n;i++){
		int x,y;
		scanf("%d %d",&x,&y);
		for(int j=w;j>=y;j--) f[j]=max(f[j-y]+x,f[j]);
	}
	for(int i=0;i<=w;i++) ans=max(ans,f[i]);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 3252
import Data.List

main = do
  getLine
  ps <- map read . words <$> getLine
  print (der ps)

der = count . map fst . filter (uncurry (==)) . zip [1..] 

count [] = 0
count [n] = 1
count (n1:n2:ns)
  | n1 + 1 == n2 = 1 + count ns
  | otherwise = 1 + count (n2:ns)

Measured memory_bytes: 26236
#include<stdio.h>

int main(int argc, char *argv[]){

  int n;
  scanf("%d", &n);

  char s[n+1];
  scanf("%s", &s);
  //printf("%s\n", s);
  // s[0], s[1], s[2],..., s[n-2], s[n-1]

  int cnt = 0;
  int i = 0; // reader index
  for(int j=1; j<n; j++){
    //printf("%c\n", s[i]);
    if(s[j] == 'E') cnt++;
  }
  int cnt_min = cnt;

  for(i=1; i<n; i++){
    if(s[i-1] == 'W') cnt++;
    if(s[i] == 'E') cnt--;
    if(cnt <= cnt_min){
      cnt_min = cnt;
    }else{
      //break;
    }
  }



  printf("%d\n", cnt_min);

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x, cx, fx = 0;
  cin >> x;
  cx = x;
  while (x > 0) {
    fx += x % 10;
    x /= 10;
  }

  if (cx % fx == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
    
int main() {
  int a, b, d, r;
  double f;
  cin >> a >> b;
  cout << a / b << " " << a % b << " ";
  printf("%.5lf\n", 1.0 * a / b);
  return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

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

const ll MOD = 1e9 + 7;
int N;
ll dp[(1 << 22) + 9];
int can[21][21];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    cin >> N;

    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            cin >> can[i][j];
        }
    }

    dp[0] = 1;
    for (int mask = 0; mask < (1 << N) - 1; mask++)
    {
        // cerr << mask << " ";
        int chlop = __builtin_popcount(mask);
        // cerr << chlop << "\n";

        for (int kobieta = 0; kobieta < N; kobieta++)
        {
            if (can[chlop][kobieta] && !(mask & (1 << kobieta)))
            {
                int mask2 = mask | (1 << kobieta);

                dp[mask2] += dp[mask];

                dp[mask2] %= MOD;
                dp[mask] += MOD;
                dp[mask2] %= MOD;
            }
        }
    }

    cout << dp[(1 << N) - 1] << "\n";
}

Measured memory_bytes: 20016
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define INF 10000000001
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n,w;
  cin>>n>>w;
  vector<pair<ll,ll>>v;
  ll sum=0;
  for(ll i=0;i<n;i++)
  {
    ll a,b;
    cin>>a>>b;
    v.pb({b,a});
    sum+=b;
  }
  ll dp[n+1][sum+1];
  for(ll i=1;i<=n;i++)
  {
    for(ll j=0;j<sum+1;j++)
    {
      dp[i][j]=INF;
    }
  }
  for(ll i=0;i<n;i++)
  {
    dp[i+1][v[i].first]=v[i].second;

  }
  for(ll i=2;i<=n;i++)
  {
    for(ll j=0;j<sum+1;j++)
    {
      if(v[i-1].first>j)
      {
        dp[i][j]=dp[i-1][j];
      }
      else
      {

        dp[i][j]=min(dp[i][j],min(dp[i-1][j],dp[i-1][j-v[i-1].first]+v[i-1].second));
      }
    }
  }
  ll ans=0;
  for(ll i=1;i<=n;i++)
  {
    for(ll j=0;j<sum+1;j++)
    {
      if(dp[i][j]<=w)
      {
        ans=max(ans,j);
      }
    }
  }
  cout<<ans;
}


Measured memory_bytes: 78336
#include <iostream>
#include <cmath>
using namespace std;
int isPrime(int x){
	if(x==2)return true;
	else if(x<2 || x%2==0)return false;
	double xx=x;
	int i=3;
	while(i<=ceil(sqrt(xx))){
		if(x%i==0){
			return false;
		}
		i=i+2;
	}
	return true;
}

int main(){
	int ans=0;
	int n,number;
	cin>>n;
	for(int ii=0;ii<n;ii++){
		cin>>number;
	    ans+=isPrime(number);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3076
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

mod = 1000000007

"""
# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    print(lcm(2, N))

Measured memory_bytes: 63212
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll>P;
int main(){
    
    ll N, M;
    cin >> N >> M;
    vector<ll>A(N);
    for(int i = 0; i < N; i++)cin >> A[i];
    sort(A.begin(), A.end());
    priority_queue<P>Q;
    for(ll i = 0; i < M; i++){
        ll B, C;
        cin >> B >> C;
        Q.push(P(C, B));
    }
    for(ll i = 0;!Q.empty();){
        ll B = Q.top().second;
        ll C = Q.top().first;
        Q.pop();
        for(;i < N && B > 0 && A[i] < C;i++, B--){
            A[i] = C;
        }
    }
    ll ans = 0;
    for(ll i = 0; i < N; i++)ans += A[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
long long dis[40][40];
char l[40][40];
queue <pair <int ,int > > q;
long long ma;
pair <int , int > maj;
int main(){
	int n,m;
	cin>>n>>m;

	for (int i = 0;i<n;i++){
		for (int j =0;j<m;j++)
			cin>>l[i][j];
	}
	for (int i =0;i<n;i++){
		for (int j =0;j<m;j++){
			if(l[i][j]=='#')
				continue;
	for (int b =0;b<n;b++){
		for (int k =0;k<m;k++)
			dis[b][k]=-1;
	}
	dis[i][j]=0;
	q.push({i,j});
	while (q.size()){
		int i = q.front().F, j = q.front ().S;
		q.pop();
		if (dis[i][j]>ma)
			ma  = dis[i][j];
		
		if (i+1<n and l[i+1][j]=='.' and dis[i+1][j]==-1){
			dis[i+1][j] = dis[i][j]+1;
			q.push({i+1,j});
		}
		if (j+1<m and l[i][j+1]=='.' and dis[i][j+1]==-1){
			dis[i][j+1]= dis[i][j]+1;
			q.push({i,j+1});
		}
		if (i-1>-1 and l[i-1][j]=='.' and dis[i-1][j]==-1){
			dis[i-1][j]= dis[i][j]+1;
			q.push({i-1,j});
		}
		if (j-1>-1 and l[i][j-1]=='.' and dis[i][j-1]==-1){
			dis[i][j-1]= dis[i][j]+1;
			q.push({i,j-1});
		}
	}
	}
}
cout<<ma;	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=100000000000000000;

ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

int main(){
    ll n;cin>>n;
    cout<<n*n*n<<endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <vector>
#include <set>

#include <map>
#include <unordered_map>
#include <deque>
#include <string>
#include <utility>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <climits>

using namespace std;

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

const int INF = 1e9;
const long long LINF = 1e18;

int main() {
    string S, T;
    cin >> S >> T;
    cout << T << S << endl;

    return 0;
}


Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000000000000


int main(){
	
	int N,M;
	cin>>N>>M;
	
	if(N>M)swap(N,M);
	
	int ans = 0;
	
	int x = 1;
	for(int i=0;i<N;i++){
		x = mod(x*(i+1));
	}
	
	int y = 1;
	for(int i=0;i<M;i++){
		y = mod(y*(i+1));
	}
	
	ans = mod(x*y);
	
	if(N==M){
		ans = mod(ans*2);
	}
	else if(N+1==M){
	}
	else{
		ans=0;
	}
	
	cout<<ans<<endl;
	
		
	
	return 0;
}


Measured memory_bytes: 256
#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>;

int main() {
  int n;
  string s;
  cin >> n >> s;
  set<int> rs, gs, bs;
  rep(i, n) {
    switch (s[i]) {
    case 'R':
      rs.insert(i);
      break;
    case 'G':
      gs.insert(i);
      break;
    case 'B':
      bs.insert(i);
      break;
    default:
      break;
    }
  }
  ll ans = 0;
  for (auto ir = rs.begin(); ir != rs.end(); ++ir) {
    for (auto ig = gs.begin(); ig != gs.end(); ++ig) {
      ll now = bs.size();
      int r = *ir;
      int g = *ig;
      if (bs.find(2*r-g) != bs.end()) --now;
      if (bs.find(2*g-r) != bs.end()) --now;
      if ((r+g)%2 == 0 && bs.find((r+g)/2) != bs.end()) --now;
      ans += now;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  string s;
  cin >>s;
  int n = s.size();
  int ans = 999;
  for(int i = 0; i <= n-3; i++){
    int num = (s[i]-'0')*100+(s[i+1]-'0')*10+s[i+2]-'0';
    ans = min(ans, abs(num-753));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n, r, t; cin >> n >> r >> t;
	vi p(n);
	rep(i, n) cin >> p[i];
	
	auto solve = [&](){
		int ans = 0;
		vi pos(n), cnt(r);
		rep(it, t){
			vi cur(r);
			rep(i, n) ++cur[pos[i] = (pos[i] + p[i]) % r];
			rep(i, r){
				if(cnt[i] < cur[i]) ans += cur[i] - cnt[i], cnt[i] = cur[i];
				cnt[i] -= cur[i];
				if(it) cnt[i] += cur[i];
			}
		}
		return ans;
	};
	cout << solve() << endl;
	
	return 0;
}


Measured memory_bytes: 3196
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;


namespace atcorder2
{
    class Program
    {
        public static long Read()
        {

            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

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

       
         public static long GCM(long x,long y)
        {
            if (x < y)  GCM(y, x);


            while (y > 0)
            {
                var z = y;
                y = x % y;
                x = z;
            }
            
            return x;
        }

        



        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var n = Read();
            long t =0, x = 0, y = 0;
            long bx = 0, by = 0, bt = 0;
            bool f = true ;
            for (int i = 0; i < n; i++)
            {
                var txy = Reads();
                t = txy[0];
                x = txy[1];
                y = txy[2];
                var ff = t-bt >= Math.Abs(x - bx) + Math.Abs(y - by) && (t-bt - (Math.Abs(x - bx) + Math.Abs(y - by))) % 2 == 0;
                if (!ff) f = false;
                bt = t;
                bx = x;
                by = y;
            }
            WriteLine(f ? "Yes" : "No");

            






            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 17452
#include<bits/stdc++.h>
using namespace std;
#define nmax 100000
int main(){
  int n,a,mx=0;
  int d[nmax+5]={};
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    d[a]++;
    if(a!=0) d[a-1]++;
    d[a+1]++;
  }
  for(int i=0;i<nmax+2;i++) mx=max(mx,d[i]);
  cout<<mx<<endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(itr,c) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	ll x,y;
	cin>>x>>y;
	int ans=1;
	while(x<=y){
		x*=2;
		ans++;
	}
	ans--;
	cout<<ans;
	re 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < s.length()/2; i++){
        if(s[i] != s[s.length()-i-1]) ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc100/tasks/abc100_d
# 定式化 M個のidxの集合idsに対して、
# max(|sum_ids (x_i)| +|sum_ids (y_i)| + |sum_ids (z_i)|) という問題
# 各項について正負を仮定すると、どのケーキを取ればいいのか優先度が決まる(ソート)
# bit全探索とソートの合わせ技
N, M = read_ints()
XYZ = read_tuple(N)

ans = -1 * 10**13 - 100
for is_mina_x, is_mina_y, is_mina_z in product(range(2), repeat=3):
    is_mina_x = -1 if is_mina_x else 1
    is_mina_y = -1 if is_mina_y else 1
    is_mina_z = -1 if is_mina_z else 1

    XYZ.sort(key=lambda x: is_mina_x *
             x[0] + is_mina_y * x[1] + is_mina_z * x[2], reverse=True)
    x_sum = 0
    y_sum = 0
    z_sum = 0
    for x, y, z in XYZ[:M]:
        x_sum += x
        y_sum += y
        z_sum += z
    ans = max(ans, abs(x_sum) + abs(y_sum) + abs(z_sum))

print(ans)


Measured memory_bytes: 39664
K = int(input())

a = [49 for i in range(50)]

for i in range(50):
    a[i] += K//50
    
for i in range(50):
    mod = K % 50
#     if mod != 0:
    if mod >= i+1:
        a[i] = a[i] + 50 - (mod)
    else:
        a[i] = a[i] - (mod)

print(50)
print(*a)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int maxn=200000+5;
typedef long long ll;

typedef pair<int,int> P;

P a[maxn];

int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;++i)
        cin>>a[i].second>>a[i].first;

    sort(a,a+n);

    int t=0;
    for(int i=0;i<n;++i)
    {
        t+=a[i].second;
        if(t>a[i].first)
        {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <tuple>
#include <queue>
using namespace std;

const int inf = (1 << 28);

int sum_[100000];

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

    fill(sum_, sum_ + k, inf);

    using T = tuple<int, int>;

    priority_queue<T, vector<T>, greater<T>> que;
    for (int n = 1; n <= 9; n++) {
        if (sum_[n % k] > n) {
            sum_[n % k] = n;
            que.push(T(n, n % k));
        }
    }

    while (!que.empty()) {
        int dsum, mod;
        tie(dsum, mod) = que.top(); que.pop();

        if (sum_[mod] < dsum) continue;

        // cerr << "dsum: " << dsum << " mod: " << mod << endl;

        for (int n = 0; n < 10; n++) {
            if (sum_[(mod * 10 + n) % k] > dsum + n) {
                sum_[(mod * 10 + n) % k] = dsum + n;
                que.push(T(dsum + n, (mod * 10 + n) % k));
            }
        }
    }

    cout << sum_[0] << endl;

    return 0;
}

Measured memory_bytes: 2804
h, w = [int(i) for i in input().split()]
s = [input() for _ in range(h)]

a = [[0]*w for _ in range(h)]
for i in range(h):
    k = 0
    for j in range(w):
        if s[i][j] == ".":
            k += 1
        else:
            k = 0
        a[i][j] += k
for i in range(h):
    k = 0
    for j in reversed(range(w)):
        if s[i][j] == ".":
            k += 1
        else:
            k = 0
        a[i][j] += k
for j in range(w):
    k = 0
    for i in range(h):
        if s[i][j] == ".":
            k += 1
        else:
            k = 0
        a[i][j] += k
for j in range(w):
    k = 0
    for i in reversed(range(h)):
        if s[i][j] == ".":
            k += 1
        else:
            k = 0
        a[i][j] += k
b = max([max(i) for i in a])
print(0 if b == 0 else b-3)


Measured memory_bytes: 96856
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	int M;

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		M = Integer.parseInt(strArr[1]);
		A = new int[N][M];
	}

	public boolean hasNext() {
		return cnt < N;
	}

	int A[][];

	public void readBody(String str) {
		// System.out.println(str);
		String[] strArr = str.split(" ");
		int k = Integer.parseInt(strArr[0]);
		for (int i = 1; i <= k; i++) {
			A[cnt][Integer.parseInt(strArr[i]) - 1] = 1;
		}
		cnt++;
	}

	public void solve() {
		int ans = 0;
		for (int m = 0; m < M; m++) {
			int c = 0;
			for (int n = 0; n < N; n++) {
				if (A[n][m] == 1)
					c++;
			}
			if (c == N)
				ans++;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 24788