akhauriyash/Code-Regression huggingface dataset:
using System;

public class Tube
{
    public int b { get; set; }
    public int c { get; set; }
    public bool suc { get; set; }
}

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var ary = Array.ConvertAll(line, int.Parse);
            var t = new Tube { b = ary[0] + 1, c = 1 };
            for (int j = 1; j < 10; j++)
            {
                var res = ChkBall(t, ary[j]);
                if (!res.suc)
                {
                    Console.WriteLine("NO");
                    goto nextloop;
                }
            }
            Console.WriteLine("YES");
        nextloop:;
        }
    }
    public static Tube ChkBall (Tube t ,int ball)
    {
        if (ball < t.b && ball < t.c)
        {
            t.suc = false;
            return t;
        }
        if (ball < t.b && ball >= t.c)
        {
            t.c = ball + 1;
            t.suc = true;
            return t;
        }
        if (ball >= t.b && ball  < t.c)
        {
            t.b = ball + 1;
            t.suc = true;
            return t;
        }
        if (t.b > t.c) t.b = ball + 1;
        else t.c = ball + 1;
        t.suc = true;
        return t;
    }
}

Measured memory_bytes: 8892
S = input()
if len(set(S)) % 2 == 1:
    print('No')
elif len(set(S)) == 4:
    print('Yes')
elif len(set(S)) == 2:
    if 'N' in S and 'S' in S:
        print('Yes')
    elif 'W' in S and 'E' in S:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 3060
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = long.Parse(line[1]);
        var w = "0 " + Console.ReadLine().Trim();
        line = w.Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        getAns(n, k, a);
    }
    static void getAns(int n, long k, int[] a)
    {
        var visited = new int[n + 1];
        for (int i = 0; i < n + 1; i++) visited[i] = -1;
        var step = 1;
        var p = 1;
        while (true)
        {
            if (step == k) { Console.WriteLine(a[p]); return; }
            if (visited[a[p]] == -1) visited[a[p]] = step;
            else
            {
                long e = visited[a[p]];
                long loop = step - e;
                var start = a[p];
                getAns2(e, loop, k, start, a);
                break;
            }
            p = a[p];
            step++;
        }
    }
    static void getAns2(long e, long loop, long k, int start, int[] a)
    {

        var nstep = (k - e) % loop;
        var p = start;
        while (nstep > 0)
        {
            p = a[p];
            nstep--;
        }
        Console.WriteLine(p);
    }
}



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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double
# define ull unsigned long long

# define pb push_back
# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vld vector < ld >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < long , long >
# define pDD pair < D , D >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b));
# define mod 1000000007

# define pp(n) printf("%.10f",n);
# define line cout<<"\n";

const D pie = acos(-1);
const D hpie = asin(1);
const D qpie = atan2(1,1);
const D tpie = 2*pie;

string vow = "aeiou";

void solve( int test_case )
{
    int n;
    cin >> n;

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

    int cnt = 0;
    for ( int i=1 ; i<n-1 ; i++ )
    {
        vi temp { v[i-1] , v[i] , v[i+1] };
        sort ( all(temp) );

        if ( temp[1] == v[i] ) cnt++;
    }

    cout << cnt;
    line;
}

int main()
{
    fast
    int t = 1;
    //cin>>t;

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


Measured memory_bytes: 256
/*
  AtCoder Beginner Contest 098
  C - Attention
*/

#include<iostream>
using namespace std;

int N;
char S[300001];

int main() {
  scanf("%d", &N);
  scanf("%s", S);

  int mincost, cost = 0;
  for (int i = 1; i < N; ++i) if (S[i] == 'E') ++cost;
  
  mincost = cost;
  for (int i = 1; i < N; ++i) {
    if (S[i-1] == 'W') ++cost;
    if (S[i] == 'E') --cost;
    if (cost < mincost) mincost = cost;
  }
  
  printf("%d\n", mincost);
  return 0;
}

Measured memory_bytes: 512
def main():
    N, S = map(int, input().split())
    A = tuple(map(int, input().split()))

    MOD = 998244353

    dp = [[0]*(S+1) for _ in range(N+1)]
    dp[0][0] = 1
    # morau
    for i, a in enumerate(A):            
        for j in range(S+1):
            if j >= a:
                dp[i+1][j] = 2 * dp[i][j]
                dp[i+1][j] %= MOD
                dp[i+1][j] += dp[i][j-a]
                dp[i+1][j] %= MOD
            else:
                dp[i+1][j] = 2 * dp[i][j]
                dp[i+1][j] %= MOD
                

    print(dp[N][S])
if __name__ == "__main__":
    main()

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

void Main() {
  char c;
  cin >> c;
  cout << char(c + 1) << endl;
}

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


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

int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    A[i] -= i + 1;
  }
  sort(A, A + N);

  long long sum = 0;
  for (int i = 0; i < N; i++) {
    sum += abs(A[i] - A[N/2]);
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <queue>
#include<map>
#include<algorithm>
#include<set>
#include<iomanip>
#include<string>
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1; i<=n;i++)
#define rrep(i,n) for(int i = n-1;i >=0;i--)
#define ALL(a) a.begin(),a.end()
#define PI  acos(-1)
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
typedef long long int ll;
typedef long double ld;
const int MOD = 1e9 + 7;
int dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 }, sum = 0, h, w;
int main() {
    ld n, d, x, y;int cnt = 0; cin >> n >> d;
    rep(i, n) {
        cin >> x >> y;
        if (x * x + y * y <= d * d) cnt++;
    }cout << cnt << endl;
}

Measured memory_bytes: 3784
#include "bits/stdc++.h"

#define REP(i,num) for(ll i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	vll Q(200),O;
	REP(i,200){
		Q[i] = (i+1ll)*(i+2ll)*(i+3ll)/6ll;
		if(Q[i]%2) O.push_back(Q[i]);
	}

	vll dp(1000010),dp2(1000010);
	REP(i,1000010){
		dp[i]=1ll<<60;
		dp2[i]=1ll<<60;
	}
	dp[0]=0,dp2[0]=0;
	int X=Q.size(),Y=O.size();
	REP(i,X){
		REP(j,1000000){
			if(j+Q[i]<=1000000) chmin(dp[j+Q[i]],dp[j]+1);
		}
	}
	REP(i,Y){
		REP(j,1000000){
			if(j+O[i]<=1000000) chmin(dp2[j+O[i]],dp2[j]+1);
		}
	}
	while(true){
		int N=in();
		if(!N) break;
		
		out(dp[N],dp2[N]);
	}
	return 0;
}



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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

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;

const int mod = 1e9 + 7;
typedef vector<vi> M;
inline M operator*(const M & a, const M &b){
	M c(a.size(), vi(b[0].size()));
	rep(i, c.size()) rep(j, c[0].size()){
		ll s = 0;
		rep(k, a[0].size()) s += (ll)a[i][k] * b[k][j] % mod;
		c[i][j] = s % mod;
	}
	return c;
}
inline M pow(M a, ll m){
	M res(a.size(), vi(a.size()));
	rep(i, a.size()) res[i][i] = 1;
	for(; m; m /= 2){
		if(m & 1) res = res * a;
		a = a * a;
	}
	return res;
}

int n, K, c, T, a[1000], b[1000], t[1000];
int dp[10][40];


int main(){
	cin >> n >> K >> c >> T;
	rep(i, K) cin >> a[i] >> b[i] >> t[i], a[i]--;
	
	M A(5 * n, vi(5 * n));
	
	rep(s, 5 * n){
		memset(dp, 0, sizeof(dp));
		dp[s / n][s % n] = 1;
		rep(i, 5) rep(j, n) if(dp[i][j]) rep(k, K){
			int nj = j >= a[k] + b[k] ? j : j >= a[k] ? j - a[k] : j + b[k];
			(dp[i + t[k]][nj] += dp[i][j]) %= mod;
		}
		for(int i = 5; i < 10; i++) rep(j, n) (A[(i - 5) * n + j][s] += dp[i][j]) %= mod;
	}
	A = pow(A, T / 5);
	M x(5 * n, vi(1));
	x[c - 1][0] = 1;
	x = A * x;
	
	memset(dp, 0, sizeof(dp));
	rep(i, 5 * n) dp[i / n][i % n] = x[i][0];
	rep(i, 5) rep(j, n) if(dp[i][j]) rep(k, K){
		int nj = j >= a[k] + b[k] ? j : j >= a[k] ? j - a[k] : j + b[k];
		(dp[i + t[k]][nj] += dp[i][j]) %= mod;
	}
	cout << dp[T % 5][0] << endl;
	return 0;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            char a = (char)System.Console.Read();
            System.Console.Read();
            char b = (char)System.Console.Read();
            if (a > b) System.Console.WriteLine(">");
            else if (a == b) System.Console.WriteLine("=");
            else System.Console.WriteLine("<");
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i,n) for(ll i = 0; i < (ll)(n); ++i)
#define MOD 1000000007

using namespace std;
using ll = long long;

int main() {
	int n, m, ans = 0;
	cin >> n >> m;
	vector<int> h(n);
	rep(i, n) cin >> h[i];
	vector<queue<int>> q(n);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		q[a].push(b);
		q[b].push(a);
	}
	ans = n;
	rep(i, n) {
		int x = h[i];
		while (q[i].size()) {
			int t = q[i].front();
			q[i].pop();
			if (x > h[t]) continue;
			ans--;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> x(N);
  for (int i=0;i<N;i++) cin >> x[i];
  int sum = 0;
  for (int i=0;i<N;i++) {
    sum += 2*min(x[i],K-x[i]);
  }
  cout << sum << endl;
}

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

int L(int n){

}


 
int main() {
  int n;
  cin>>n;
  unsigned long long int L0=2;
  unsigned long long int L1=1;
  unsigned long long int ans=1;
  for (int i = 2; i <= n; i++)
  {
      if(i%2==0){
          L0=L0+L1;
          ans=L0;
      }else{
          L1=L1+L0;
          ans=L1;

      }
      
  }if(n==0){
      cout<<"2"<<endl;
  }else{
    cout<<ans<<endl;
  }
  
  
  
}

Measured memory_bytes: 256
import sys

n, k, *dislikes = sys.stdin.read().split()
n = int(n)
dislikes = set(dislikes)

def main():
    i = n
    while True:
        if set(str(i)) & dislikes:
            i += 1
            continue
        return i

if __name__ == '__main__':
    ans = main()
    print(ans)

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

int main(){
  long N,M;
  long cnt=0;
  cin >>N >>M;
  
  vector<long> a(N);
  for (long i=0; i<N; i++){
    cin >>a[i];
    cnt+=a[i];
  }
  
  sort(a.rbegin(),a.rend());
  
  double x;
  x=cnt/4.0/M;
  //cout <<x<<endl;
  bool flag=true;
  for(long i=0; i<M; i++){
    double f;
    f=(double)a[i];
    //printf("%f!",f);
    if (f<(x)){
      flag=false;
    }
    if (!flag) break;
  }
  
  if(flag)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  

}


Measured memory_bytes: 384
#include <stdio.h>

#define MAX_N 1000000
#define MAX_M 100

void ShellSort( int*, int );
void InsertionSort( int*, int, int );
void print( int*, int*, int, int );

int cnt;

int main( void ){
	int i, n;
	
	scanf("%d", &n );
	
	int a[MAX_N];
	
	for( i = 0; i < n; i++ ){
		scanf("%d", &a[i] );
	}
	
	ShellSort( a, n );
	
	return 0;
}

void ShellSort( int a[], int N ){
	int i, m, p;
	int b[MAX_M];
	cnt = 0;
	
	for( m = 1; m*3+1<N; m = m*3+1){}
	
	p = 0;
	for(; m > 0; m /= 3){
		b[p++] = m;
	}
	
	if( p > 100 ){
		p = 100;
	}
	
	for( i = 0; i < p; i++ ){
		InsertionSort( a, N, b[i] );
	}
	print(a, b, N, p);
}

void InsertionSort( int a[], int N, int b ){
	int i, j, v;
	
	for( i = b; i < N; i++ ){
		v = a[i];
		j = i - b;
		while( j >= 0 && a[j] > v ){
			a[j+b] = a[j];
			j -= b;
			cnt++;
		}
		a[j+b] = v;
	}
}

void print( int a[], int b[], int N, int m ){
	int i;
	
	printf("%d\n", m );
	for( i = 0; i < m; i++ ){
		if( i != m-1 ){
			printf("%d ", b[i] );
		}
		else{
			printf("%d\n", b[i] );
		}
	}
	printf("%d\n", cnt );
	for( i = 0; i < N; i++ ){
		printf("%d\n", a[i] );
	}
}



Measured memory_bytes: 5596
# def makelist(n, m):
# 	return [[0 for i in range(m)] for j in range(n)]

# a = int(input())
# b, c = map(int, input().split())
# s = input()



N, x = map(int, input().split())
a = list(map(int, input().split()))

ans = 0
for i in range(N):
	if a[i] > x:
		ans += a[i] - x
		a[i] = x

if a[0] + a[1] > x:
	tmp = a[0] + a[1] - x
	ans += tmp
	if a[1] >= tmp:
		a[1] -= tmp
	else:
		a[0] -= tmp - a[1]
		a[1] = 0

for i in range(1, N-1):
	sum2 = a[i] + a[i+1]
	if sum2 > x:
		tmp = sum2 - x
		ans += tmp
		if a[i+1] > tmp:
			a[i+1] -= tmp
		else:
			a[i] -= tmp - a[i+1]
			a[i+1] = 0

print(ans)


Measured memory_bytes: 14588
#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

string w;
int ctr[27];

int main() {
  cin >> w;
  for (auto c : w) {
    int i = (int)c - (int)'a';
    ctr[i]++;
  }
  bool ok = true;
  for (int i=0; i<27; i++) {
    if (ctr[i]%2 == 1) ok = false;
  }
  if (ok) cout << "Yes\n";
  else    cout << "No\n";
  return 0;
}



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

int main(void){
	int A, B, X;
	scanf("%d %d %d", &A, &B, &X);
	double a=A, b=B, x=X;
	double c, t;
	if(a * a * b / 2.0 > x) {
		c = 2 * x / (a * b);
		t = b / c;
	}else{
		c = 2 * b - 2 * x / (a * a);
		t = c / a;
	}
	printf("%f\n", atan(t) * 180 / M_PI);
	return 0;
}


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

using namespace std;

int main(){//21:27
    int n;
    long long k;
    cin >> n >> k;
    vector<long long> num(100000, 0);
    vector<int> vec(100000);
    int a, b;
    for(int i=0;i<n;++i){   
        cin >> a >> b;
        vec.push_back(a);
        num[a] += b;
    }
    sort(vec.begin(), vec.end());
    int l=-1;
    for(int m : vec){
        if(l==m)
            continue;
        l=m;
        k -= num[m];
        if(k<=0){
            cout << m;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

const int CMax = 202;

int H, W, S = 10, A[CMax][CMax], C[10][10], Sk[10];
long long ats;


int main() {
    scanf("%d %d", &H, &W);

    for (int i = 0; i < S; i++) {
        for (int j = 0; j < S; j++) {
            scanf("%d", &C[i][j]);
        }
    }

    for (int i = 0; i < S; i++){
        Sk[i] = C[i][1];
    }

    for (int k = 0; k < S; k++) {
        for (int i = 0; i < S; i++) {
            for (int j = 0; j < S; j++) {
                if (C[i][j] + Sk[j] < Sk[i]) Sk[i] = C[i][j] + Sk[j];
            }
        }
    }

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            scanf("%d", &A[i][j]);
            if (A[i][j] > -1) {
                ats += (long long)Sk[A[i][j]];
            }
        }
    }

    cout << ats << endl;
}



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

int main()
{
    int H, W;
    cin >> H >> W;

    vector<string> l(H);
    for (int i = 0; i < H; i++)
    {
        cin >> l.at(i);
    }

    for (int i = 0; i < W + 2; i++)
    {
        cout << '#';
    }
    cout << endl;

    for (int i = 0; i < H; i++)
    {
        cout << '#' + l.at(i) + '#' << endl;
    }

    for (int i = 0; i < W + 2; i++)
    {
        cout << '#';
    }
    cout << endl;

    return 0;
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    string S;
    cin >> S;
    ll N = (ll)S.size();

    if (N == 2) {
        if (S[0] == S[1]) {
            cout << 1 << " " << 2 << endl;
        }
        else {
            cout << -1 << " " << -1 << endl;
        }
        return;
    }

    ll left = -1, right = -1;
    for (ll i = 0; i < N - 3; i++) {
        if (S[i] == S[i + 1] || S[i] == S[i + 2] || S[i + 1] == S[i + 2]) {
            left = i + 1, right = i + 3;
            break;
        }
    }

    cout << left << " " << right << endl;
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

using namespace std;

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

typedef long long ll;
typedef unsigned long long ull;

int N, Y;

int main(void) {
  cin >> N >> Y;
  Y /= 1000;

  int c;
  rep(a, N + 1) rep(b, N + 1) {
    c = N - (a + b);
    if (c < 0 || c > N)
      continue;
    if (a * 10 + b * 5 + c != Y)
      continue;
    printf("%d %d %d\n", a, b, c);
    goto found;
  }
  printf("-1 -1 -1\n");
  return 0;

found:
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

S = list(input().rstrip())
K = int(input())

for i in range(len(S)):
    if S[i] == '1':
        if i+1 == K:
            print(1)
            exit()

    else:
        print(S[i])
        exit()

Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
vector<vector<int>> vt;
int n;
int a[200010];
vector<int> vt1;
multiset<int> st[200010];
int seg[800000];
int dap[200010];
int gap[200010];
int getidx(int x) {
	return lower_bound(vt1.begin(), vt1.end(), x) - vt1.begin();
}
int update(int pos, int val, int node, int x, int y) {
	if (pos < x || y < pos)return seg[node];
	if (x == y)return seg[node] = val;
	int mid = (x + y) / 2; 
	return seg[node] = max(update(pos, val, node * 2, x, mid), update(pos, val, node * 2 + 1, mid + 1, y));
}
int query(int lo, int hi, int node, int x, int y) {
	if (hi < x || y < lo)return 0;
	if (lo <= x && y <= hi)return seg[node];
	int mid = (x + y) / 2;
	return max(query(lo, hi, node * 2, x, mid), query(lo, hi, node * 2 + 1, mid + 1, y));
}
void dfs(int here, int par) {
	int idx = getidx(a[here]);
	if (idx == 0)dap[here] = 1;
	else dap[here] = query(0, idx - 1, 1, 0, vt.size())+1;
	st[idx].insert(dap[here]);
	auto it = st[idx].end();
	it--;
	update(idx, *it, 1, 0, vt.size());
	gap[here] = query(0, vt.size(), 1, 0, vt. size());
	for (int i	= 0; i < vt[here].size(); i++) {
		int next = vt[here][i];
		if (next == par)continue;
		dfs(next, here);
	}
	it = lower_bound(st[idx].begin(),st[idx].end(),dap[here]);
	st[idx].erase(it);
	if (st[idx].size()) {
		it = st[idx].end();
		it--;
		update(idx, *it, 1, 0, vt.size());
	}
	else update(idx, 0, 1, 0, vt.size());
}

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		vt1.push_back(a[i]);
	}
	sort(vt1.begin(), vt1.end());
	vt1.erase(unique(vt1.begin(), vt1.end()), vt1.end());
	vt.resize(n + 1);
	for (int i = 0; i < n - 1; i++) {
		int q, w;
		scanf("%d %d", &q, &w);		
		vt[q].push_back(w);
		vt[w].push_back(q);
	}
	dfs(1, 0);
	for (int i = 1; i <= n; i++)
		printf("%d\n", gap[i]);
}

Measured memory_bytes: 52204
#include<cmath>
#include<stdio.h>
using namespace std;
//scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);

//printf("Yes\n");
int main() {
  double r;
  scanf("%lf",&r);
  double L=2*r*3.141592653589793238462643383279;
  double S=r*r*3.141592653589793238462643383279;
  printf("%.6lf %.6lf\n",S,L);
}


Measured memory_bytes: 2748
a=Array.new(4).map{Array.new(3).map{Array.new(10,0)}}
gets
while gets
b,f,r,v=$_.split.map &:to_i
a[b-1][f-1][r-1]+=v
end
puts a.map{|b|b.map{|f|' '+f*' '}*$/}*("\n"+?#*20+"\n")

Measured memory_bytes: 6104
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
#define MAXN 100005
int Set[MAXN];
int Root(int x)
{return Set[x]==x?x:Set[x]=Root(Set[x]);}
int N,Q;
int fa[MAXN];
int Que[MAXN][2];
int marked[MAXN];
int main()
{
	char op[3];
	int id;
	long long ans;
	while(~scanf("%d%d",&N,&Q)&&N&&Q)
	{
		memset(Que,0,sizeof Que);
		memset(fa,0,sizeof fa);
		memset(Set,0,sizeof Set);
		memset(marked,0,sizeof marked);
		ans=0;
		Set[1]=1;fa[1]=1;
		for(int i=2;i<=N;i++)
		{
			scanf("%d",fa+i);
			Set[i]=fa[i];
		}
		for(int i=1;i<=Q;i++)
		{
			scanf("%s%d",op,&id);
			if(op[0]=='Q')Que[i][0]=1;
			else {Que[i][0]=2;Set[id]=id;marked[id]++;}
			Que[i][1]=id;
		}
		for(int i=Q;i>=1;i--)
		{
			if(Que[i][0]==1)
				ans+=1LL*Root(Que[i][1]);
			else
			{
				marked[Que[i][1]]--;
				if(!marked[Que[i][1]])
					Set[Que[i][1]]=fa[Que[i][1]];
			}
		}
		printf("%lld\n",ans);
	}
	return 0;
}

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

/*                          
---------------------------------------------------------------
Aditya Kumar mishra
---------------------------------------------------------------
*/

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define len(s) s.length()
#define forp(i, a, b) for (int i = a; i <= b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define ren(i, n) for (int i = n - 1; i >= 0; i--)
#define forn(i, a, b) for (int i = a; i >= b; i--)
#define on cout << endl
#define o2(a, b) cout << a << " " << b
#define os cout << " "
#define all(v) v.begin(), v.end()
#define mem(n, m) memset(n, m, sizeof(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define sii set<int>
#define us unordered_set<int>
#define um unordered_map<int, int>
#define sll set<long long>
#define vii vector<int>
#define vll vector<long long>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ret return 0
#define present(s, x) (s.find(x) != s.end())
#define cpresent(s, x) (find(all(s), x) != s.end())
#define ford(container, it) for (__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define fors(container, it, a, b) for (__typeof(container.begin()) it = a; it != b; it++)

#define boost ios_base::sync_with_stdio(0)
#define MOD 1000000007
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define inf 999999999999999999
#define siz 100001
#define SIZ 1000001
#define SIZE 200001

typedef long long ll;
typedef long double ldo;
typedef double db;
using namespace std;
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)

void c_p_c()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int main()
{
    c_p_c();
    ll n, d, cnt = 0;

    cin >> n >> d;
    for (int i = 0; i < n; i++)
    {
        ll a, b;
        cin >> a >> b;
        if (a * a + b * b <= d * d)
        {
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

void yes() {
  cout << "Yes" << endl;
  exit(0);
}

void no() {
  cout << ":(" << endl;
  exit(0);
}

int main() {
  ll n;
  cin >> n;
  FOR(i, 1, 100000) {
    ll x = floor(i * 1.08);
    if (x == n) {
      cout << i << endl;
      return 0;
    }
  }
  no();
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int count(int N)
{
        int cnt = 0;
        while (N % 2 == 0)
        {
                cnt++;
                N /= 2;
        }
        return cnt;
}

int main()
{
        string A, B="";
        
        cin >> A;
        for (int i = 0; i < A.size(); i+=2)
        {
                B += A[i];
        }

        cout << B << endl;
        return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int a = in.nextInt();
            int b = in.nextInt();
            System.out.println((a * b) % 2 == 0 ? "Even" : "Odd");
        }
    }
}


Measured memory_bytes: 22736
#include <bits/stdc++.h>
 
using namespace std;
 
int dp[2][3];
 
int main(){
    int n; cin >> n;
    int linha[5];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            scanf("%d", &linha[j]);
            if(i == 0) dp[0][j] = linha[j];
            else {
                for(int k = 0; k < 3; k++){
                    if(k == j) continue;
                    dp[1][j] = max(dp[1][j], linha[j] + dp[0][k]);
                }
            }
        }
        if(i){
            for(int j = 0; j < 3; j++){
                dp[0][j] = dp[1][j];
                dp[1][j] = 0;
            }
        }
    }
    int res = 0;
    for(int i = 0; i < 3; i++) res = max(res, dp[0][i]);
    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
//#include <cmath>
//#include <cstdlib>
using namespace std;
int main(){
	/*input*/
	int x1;
	int y1;
	int x2;
	int y2;
	cin >> x1 >> y1 >> x2 >> y2;
	/*calc*/
	/*[0]:x3,[1]:y3,[2]:x4,[2]:y4,*/
	int ans[4];
	int x = x2 - x1;
	int y = y2 - y1;
	ans[0] = x2 - y;
	ans[1] = y2 + x;
	ans[2] = x1 - y;
	ans[3] = y1 + x;
    /*output*/
	for(int i = 0; i < 4; i++)	cout<< " " << ans[i];
    return 0;
}


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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
constexpr int MOD = 1e9 + 7;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }
// -------------------------------------------------------------------

using P = pair<int, int>;
using vec = vector<int>;

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int k, a, b;
    cin >> k >> a >> b;

    int bis = 1;

    while (k--) {
        if (k > 0 and b > a + 2 and bis >= a) {
            bis += (b - a);
            k--;
        } else {
            bis++;
        }
    }
    print(bis);

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;



vector<long long> f(long long x){
    vector<long long> ans;
   for (long long a = 2; a * a <= x; ++a) {
        if (x % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (x% a == 0) {
            ++ex;
            x /= a;
        }

        // その結果を push
        for(int i = 0;i < ex;i++) ans.push_back(a);
       
    }
    if (x != 1) ans.push_back(x);
    
    return ans;
}

void ff(long long x){
    vector<long long> ans;
   for (long long a = 2; a * a <= x; ++a) {
        if (x % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (x% a == 0) {
            cout << " " << x << endl;
            ++ex;
            x /= a;
        }

        // その結果を push
        for(int i = 0;i < ex;i++) ans.push_back(a);
       
    }
    
}



long long g(long long x){
    long long y = 0,count = 0;
    if(x == 1) return 1;
    for(int i = 1;i < x;i++){
        y += i;
        
        if(y > x){
            break;
        }
        else{
            count++;
        }
    }

    return count;
}

int main(){
    long long n,ans = 0;
    cin >> n;
    /**/
    vector <long long > x = f(n);
    vector<long long > y(1000);

    int count = 0;
    y.at(0)++;
    for(int i = 1;i < x.size();i++){
        //cout << " " << x.at(i) << endl;
        if(x.at(i) == x.at(i - 1)){
            y.at(count)++;
        }
        else{
            count++;
            y.at(count)++;
        }
    }

    count = 0;

    while(y.at(count) != 0){
        //cout << y.at(count) << endl;
        
        long long x;

        ans += g(y.at(count));
        //cout << g(y.at(count)) << endl;
        count++;
    }

    if(n == 1) ans = 0;
    cout << ans << endl;

    

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 30;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

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

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n; cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<bool> f(1000005, true);
  sort(ALL(a));
  a.push_back(INF);

  int ans = 0;
  rep(i, n) {
    if(!f[a[i]]) continue;

    if(a[i] != a[i+1]) ++ans;
    for(int j = 1; a[i]*j <= 1000000; ++j) f[a[i]*j] = false;
  }

  cout << ans << endl;
}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6 + 5;
int a[N], pre[N], suf[N];
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	for(int i = 1; i <= n; i ++)
		cin >> a[i];
	for(int i = 1; i <= n; i ++)
		pre[i] = max(pre[i - 1], a[i]);
	for(int i = n; i >= 1; i --)
		suf[i] = max(suf[i + 1], a[i]);
	for(int i = 1; i <= n; i ++)
		cout << max(pre[i - 1], suf[i + 1]) << endl;
}


Measured memory_bytes: 10624
#include <bits/stdc++.h>
#include <vector>
 
typedef long long ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
const double PI=3.14159265358979323846;
 
using namespace std;
 
int main() {

	int q;
	cin >> q;

	deque<ll> d;

	int a, p;
	ll x;

	rep(i, q) {
		cin >> a >> p;

		switch(a)  {
			case 0:
				cin >> x;

				if (p == 0) d.push_front(x);
				else d.push_back(x);
				break;

			case 1:
				cout << d[p] << endl;

				break;

			case 2:
				if (p == 0) d.pop_front();
				else d.pop_back();
				break;
		}

	}
}


Measured memory_bytes: 6208
h, w = map(int, input().split())
s = [input() + '#' for _ in range(h)]
s.append('#' * w)

yoko = [[0] * w for _ in range(h)]
for i in range(h):
  if s[i][0] == '.':
    start = 0
  else:
    start = -1
  for j in range(1, w + 1):
    if s[i][j] == '#':
      if start != -1:
        for k in range(start, j):
          yoko[i][k] = j - start
        start = -1
    else:
      if start == -1:
        start = j

tate = [[0] * w for _ in range(h)]
for i in range(w):
  if s[0][i] == '.':
    start = 0
  else:
    start = -1
  for j in range(1, h + 1):
    if s[j][i] == '#':
      if start != -1:
        for k in range(start, j):
          tate[k][i] = j - start
        start = -1
    else:
      if start == -1:
        start = j
result = 0
for i in range(h):
  for j in range(w):
    t = yoko[i][j] + tate[i][j] - 1
    if t > result:
      result = t

print(result)


Measured memory_bytes: 129624
//  LINK ZADATKA: http://abc070.contest.atcoder.jp/tasks/abc070_a

#include <queue>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <fstream>
#include <cstring>
#include <string>
#include <climits>

using namespace std;

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;


#define FOR(k,a,b) for(int k=(a); k<=(b); ++k)
#define REP(k,a) for(int k=0; k<(a);++k)
#define SZ(a) int((a).size())
#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define INF 999999999
#define INFLONG 1000000000000000000
#define MOD 1000000007
#define MAX 100
#define ITERS 100
#define MAXM 200000
#define MAXN 1000000
#define _gcd __gcd
#define eps 1e-9

int main(){
	int n;
	scanf("%d", &n);
	
	if(n/100 == n%10) printf("Yes\n");
	else printf("No\n");
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
#Coding: Utf-8

N=int(input())

def check(s):
    if N<int(s):
        return 0
    if all(s.count(c)>0 for c in '753'):
        count=1
    else:
        count=0
    for c in '753':
        count+=check(s+c)
    return count

print(check('0'))

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k,a,b,t;
	cin>>k>>a>>b;
	if(a%k==0)
      t=k;
  else
    t=a%k;
  if((b-a)>=k-t)
    cout<<"OK";
  else
    cout<<"NG";

}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int a,b; cin >> a >> b;
  COUT( a*b - (a+b-1) );
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#define REG register 
using namespace std;

int D,p[50],c[50],G,minn=0x7f,n=0;
int f[1000];

int maxx(int x,int y){
    if ( x>y ) return x;
    else return y;
}

int main(){
    
    scanf("%d %d",&D,&G);
    for ( REG int i=1 ; i<=D ; i++ ) {
        scanf("%d %d",&p[i],&c[i]);
        n+=p[i];
    }
    
    for ( REG int i=1 ; i<=D ; i++ ) {
        for ( REG int j=n ; j>=0 ; j-- ) {
            for ( REG int k=0 ; k<=p[i] ; k++ ) {
                if ( j-k < 0 ) break;
                if ( k<p[i] ) f[j]=maxx(f[j],f[j-k]+k*100*i);
                else if ( k==p[i] ) f[j]=maxx(f[j],f[j-k]+k*100*i+c[i]);
            }
        }
    }
    
    for ( REG int i=1 ; i<=n ; i++ ) {
        if ( f[i]>=G ) {
            printf("%d",i);
            return 0;
        } 
    }
    
//    printf("%d",minn);
    
    return 0;
}

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

using namespace std;

int main(){

	long long int n, a, b, ans;

	cin>> n >> a >> b;

	ans = n / (a + b)*a;
	ans += min(n % (a + b), a);

	cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//using
using intl = long long;
using itnl = long long;//typo用
using uintl = unsigned long long;
using itn = int;//typo用
using ld = long double;
using namespace std;

//関数マクロ
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a) - 1; i >= (intl)(b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define debug(x) cout << #x << ":" << x << endl

//定数マクロ
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>

//定数
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld EPS = 1.0e-14;//-9
const ld PI = acos(-1);

//テンプレート関数
template<class T> inline bool chmin(T& a, T b) { if (a > b) {a = b; return true;} return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) {a = b; return true;} return false; }
//intl gcd(intl a, intl b){ if(!b)return a; return gcd(b, a % b); } //c++17からある
//intl lcm(intl a,intl b){ return a / gcd(a, b) * b; } //c++17からある

//自作テンプレート関数
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}//Yes,Noの出力を楽にするよう
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}//上の関数のYes,Noを任意の文字列でできるようにしたもの
intl fact(intl k){ intl a = 1; for(int i = 2; i <= k; i++){ a *= i; } return a; }//k!を求める関数,O(N)
intl digit10(intl a){ intl b = 0; do{ a /= 10; b++; }while(a); return b; }//aを10進数で表したときの桁数を求める関数,O(logN)


signed main(){
    cout << fixed << setprecision(10);
    string s;
    cin >> s;
    intl ans = 0;
    if((s[0] == 'R')&&(s[1] == 'R')&&(s[2] == 'R'))ans = 3;
    else if(((s[0] == 'R')&&(s[1] == 'R'))||((s[1] == 'R')&&(s[2] == 'R')))ans = 2;
    else if((s[0] == 'R')||(s[1] == 'R')||(s[2] == 'R'))ans = 1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
def main():
    n = int(input())
    alphabets = [None] + [chr(ord("a") + x) for x in range(26)]
    # 1~26:１桁
    # 27 ~ 702(26**2*"1"+26**1*"1"+ 0):2桁
    # 27 ~ 52番：aa ~ az(26+1~26)
    # 53 ~ 78番：ba ~ bz(26*"2"+"1~26")
    # 703 ~ 18278(26+26*26+26*26*26):３桁
    # 703 ~ 726: aaa ~ aaz(26**2*"1"+26*"1"+"1~26")

    #何桁か？
    cnt = 0
    m = n
    while m > 0:
        cnt += 1
        m -= 26 ** cnt
    #print(cnt)

    # 各桁がどの文字か？
    num = []
    for i in range(cnt):
        # 最初は、26で割り、次は
        y = n % (26 ** (i+1))
        #print("amari:", y, "nokori:", n)
        if y == 0:
          num += [26]
          n -= 26 ** (i+1)
        else:
          n -= y
          num += [y // (26**i)]

    #print(num)

    ans = ""
    for s in num[::-1]:
        ans += alphabets[s]
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9192
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int seisu = scan.nextInt();
		int[] array = new int[seisu];

		for(int i=0;i<seisu;i++) {
			array[i] = scan.nextInt();
		}

		int sum = 0;
		for(int i=0;i<seisu;i++) {

			sum += (array[i]-1);
		}

			System.out.println(sum);
		scan.close();

	}

}


Measured memory_bytes: 31960
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef int_fast64_t ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modfact(ll a){ll b=1;FOR(i,2,a)b=b*i%MOD;return b;}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}
ll modcomb(ll n, ll k){ll b=1;k=min(n-k,k);DOWN(i,n,n-k+1)b=b*i%MOD;return b*modpow(modfact(k),MOD-2)%MOD;}

template <typename Integer = int_fast64_t>
constexpr Integer extgcd(Integer a, Integer b, Integer &x, Integer &y) {
    Integer u = 0, v = 1, q = 0, tmp = 0;
    x = v = 1;
    y = u = 0;
    while (b) {
        q = a / b;
        x ^= u ^= x ^= u;
        u = u - q * x;
        y ^= v ^= y ^= v;
        v = v - q * y;
        a ^= b ^= a ^= b;
        b = b - q * a;
    }
    return a;
}

template <uint_fast64_t mod, typename Integer=int_fast64_t>
constexpr Integer modinv(Integer val) {
    int_fast64_t ret = 0, tmp = 0;
    extgcd<int_fast64_t>(
        static_cast<int_fast64_t>(val),
        static_cast<int_fast64_t>(mod), ret, tmp);
    return static_cast<Integer>(ret > 0 ? ret % mod : (mod - (-ret % mod)));
}

template <std::size_t n, std::uint_fast64_t mod> struct Fact {
    std::uint_fast64_t val[n+1];
    constexpr Fact() : val() {
        val[0] = 1;
        for (std::size_t i=1; i<=n; ++i)
            val[i] = val[i-1] * i % mod;
    }
};
 
template <std::size_t n, std::uint_fast64_t mod, std::uint_fast64_t f>
struct IFact {
    std::uint_fast64_t val[n+1];
    constexpr IFact() : val() {
        val[n] = f;
        for (std::size_t i=n; i; --i)
            val[i-1] = val[i]*i% mod;
    }
};
 
constexpr std::uint_fast64_t mod = MOD, max_size = 200001;
constexpr auto fact = Fact<max_size, mod>();
constexpr auto ifact = IFact<max_size, mod, modinv<mod>(fact.val[max_size])>();

ll comb(ll n, ll k) {
    return (fact.val[n]*ifact.val[k]%MOD)*ifact.val[n-k]%MOD;
}

int main() {
    ll H, W, A, B, ans = 0;
    cin >> H >> W >> A >> B;
    ll a = H-A-1;
    ll c = A-1;
    REP(i, W-B) {
        ans += comb(a+B+i,a)*comb(c+W-B-1-i,c);
        ans %= MOD;
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#define INF 1100000000

using namespace std;

void showBit(unsigned b)
{
  for (int j = 9; j >= 0; j--) {
    cout << ((b >> j) & 1);
  }
}

int main()
{
  int N;
  cin >> N;
  vector<unsigned> F(N);
  for (int i = 0; i < N; i++) {
    unsigned tmp = 0;
    for (int j = 0; j < 5; j++) {
      for (int k = 0; k < 2; k++) {
        tmp <<= 1;
        int f;
        cin >> f;
        tmp |= f;
      }
    }
    F[i] = tmp;
  }

  vector<vector<int>> P(N, vector<int>(11));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= 10; j++) {
      int p;
      cin >> p;
      P[i][j] = p;
    }
  }

  int ans = -INF;
  for (unsigned b = 1; b < (1 << 10); b++) {
    int x = 0;
    for (int j = 0; j < N; j++) {
      int cnt = 0;
      for (int k = 0; k < 10; k++) {
        cnt += ((b >> k) & (F[j] >> k) & 1);
      }
      x += P[j][cnt];
    }
    ans = max(x, ans);
  }
    cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256