akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main(){
    int n, d;
    string x, y = "";
    cin >> n >> x >> d;
    for(int i = 0; i < n; i++){
        if(d > 0){
            y += "1";
            if(x[i] == '0') d--;
        }else{
            y += x[i];
        }
    }
    for(int i = n-1; i >= 0; i--){
        if(d != 0 && x[i] == y[i])  d--, y[i] = (char)('1'-y[i]+'0');
    }
    cout << y << endl;
    return 0;
}


Measured memory_bytes: 3200
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<random>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define int long long
#define inf 1145141919
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int>P;
typedef pair<int, P> PP;
struct edge { int u, v, cost; };
int mod = 1000000007;
int dp[4][114514];
signed main() {
	string s; cin >> s;
	dp[0][0] = 1;
	rep(j, s.size()) {
			if (s[j] != '?') {
				rep(i, 4)dp[i][j + 1] += dp[i][j];
			}
			if (s[j] == 'A') {
				dp[1][j + 1] += dp[0][j];
			}
			if (s[j] == 'B') {
				dp[2][j + 1] += dp[1][j];
			}
			if (s[j] == 'C') {
				dp[3][j + 1] += dp[2][j];
			}
			if (s[j] == '?') {
				rep(i, 4)dp[i][j + 1] += 3 * dp[i][j];
				dp[1][j + 1] += dp[0][j];
				dp[2][j + 1] += dp[1][j];
				dp[3][j + 1] += dp[2][j];
			}
			rep(i, 4)dp[i][j + 1] %= mod;
	}
	cout << dp[3][s.size()] << endl;
}


Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> count(N);
  rep(i,N) count[i]=0;
  int a,b;
  rep(i,M){
    cin >> a >> b;
    count[a-1]++;
    count[b-1]++;
  }
  rep(i,N){
    cout << count[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

int dbl[100010][8] = {},n,cnt[100010] = {};

signed main(){
	string s;
	cin >> s;
	n = s.length();
	for(int i = 0;i < n;i++){
		dbl[i][0] = i + ((s[i] == 'R') ? 1 : -1);
	}
	for(int i = 1;i < 8;i++){
		for(int j = 0;j < n;j++){
			int pos = j;
			for(int k = 0;k < 10;k++) pos = dbl[pos][i - 1];
			dbl[j][i] = pos;
		}
	}
	for(int i = 0;i < n;i++){
		int pos = i;
		for(int j = 0;j < 8;j++){
			if((100ll >> j) & 1){
				pos = dbl[pos][j];
			}
		}
		cnt[pos]++;
	}
	for(int i = 0;i < n;i++) cout << (i ? " " : "") << cnt[i];
	cout << endl;
}

Measured memory_bytes: 7680
import Control.Applicative

type NumAtA = Int
type NumAtB = Int
type NumAtC = Int
type Numg = Int
type Cost = Int

buyA :: NumAtA -> Cost
buyA x = 1520 * div x 5 + 380 * mod x 5

buyB :: NumAtB -> Cost
buyB x = 1870 * div x 4 + 550 * mod x 4

buyC :: NumAtC -> Cost
buyC x = 2244 * div x 3 + 850 * mod x 3

minMaybe :: Maybe Int -> Maybe Int -> Maybe Int
minMaybe Nothing x = x
minMaybe x Nothing = x
minMaybe (Just x) (Just y) = Just $ min x y

solveC :: NumAtC -> Numg -> Maybe Cost
solveC c 0 = Just $ buyC c
solveC c g
    | g < 0 = Nothing
    | otherwise = solveC (succ c) (g - 500)

solveBC :: NumAtB -> NumAtC -> Numg -> Maybe Cost
solveBC b c g
    | g < 0 = Nothing
    | otherwise = minMaybe (solveBC (succ b) c (g - 300)) $ (+) <$> Just (buyB b) <*> solveC c g

solveABC :: NumAtA -> NumAtB -> NumAtC -> Numg -> Maybe Cost
solveABC a b c g
    | g < 0 = Nothing
    | otherwise = minMaybe (solveABC (succ a) b c (g - 200)) $ (+) <$> Just (buyA a) <*> solveBC b c g

solve :: Numg -> Cost
solve = maybe undefined id . solveABC 0 0 0

main :: IO ()
main = getContents
    >>= return . takeWhile (/= 0) . map read . lines
    >>= return . map solve
    >>= mapM_ print

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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N;
    cin >> N;

    unordered_set<string> dict;
    REP(i,N){
        string op, S;
        cin >> op >> S;
        if( op == "insert"){
            dict.insert(S);
        }else{
            if( dict.find(S) != dict.end() ){
                cout << "yes" << endl;
            }else{
                cout << "no" << endl;
            }
        }
    }

}



Measured memory_bytes: 31928
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

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

    char replace = s[k-1];
    for (int i = 0; i < n; i++) {
        if (replace != s[i]) {
            s[i] = '*';
        }
    }
    cout << s << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N,K,C; cin>>N>>K>>C;
	string S; cin>>S; S='@'+S;
	vector<int> L(N,INT_MAX), R(N,INT_MAX);
	int cur=0;
	for (int i=1; i<=N; i++) {
		if(S[i]=='o') {
			L[++cur]=i;
			if(cur>=K) break;
			i+=C;
		}
	}
	cur=K;
	for (int i=N; i>=1; i--) {
		if(S[i]=='o') {
			R[cur--]=i;
			if(cur<=0) break;
			i-=C;
		}
	}
	ll ret=0;
	for (int i=1; i<=K; i++)
		if(L[i]==R[i])
			cout<<L[i]<<"\n";
	return 0;
}

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

int p[100], dp[100][76];

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

  for(int i = 2; i <= n; i++){
    int x = i;
    for(int j = 2; j*j <= n; j++){
      int cnt = 0;
      while(x % j == 0){
        x /= j;
        cnt++;
      }
      p[j] += cnt;
    }
    if(x != 1){
      p[x]++;
    }
  }

  vector<int> nums;
  for(int i = 0; i < 100; i++){
    if(p[i]) nums.push_back(p[i]);
  }

  vector<int> d = {1, 3, 5, 15, 25, 75};
  dp[0][1] = 1;
  for(int i = 0; i < nums.size(); i++){
    for(auto d1 : d){
      for(auto d2 : d){
        if(d1*d2 <= 75 and nums[i]+1 >= d2){
          dp[i+1][d1*d2] += dp[i][d1];
        }
      }
    }
  }

  cout << dp[nums.size()][75] << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  if (s.length()>=4&&s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I') cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


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

#define INF 999999999

using namespace std;

// input
stack<int> S1;
stack<pair<int, int> > S2;

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

    int  total = 0;
    char c;

    for(int index = 0; cin >> c;index++){
        if (c == '/') {
            if (S1.size() == 0) {
                continue;
            }

            int left = S1.top(); S1.pop();
            int capa = index - left;

            total += capa;

            while(S2.size() != 0 && S2.top().first > left) {
                capa += S2.top().second;
                S2.pop();
            }
            
            S2.push(make_pair(left,capa));
        }
        else if (c == '\\') {
            S1.push(index);
        }
    }

    cout << total << "\n";

    vector<int> anss;

    cout << S2.size();

    while(true){
        if(S2.size() == 0)
            break;

        auto p = S2.top();
        S2.pop();

        anss.push_back(p.second);
    }

    reverse(anss.begin(),anss.end());


    for(auto ans:anss){
        cout << " " << ans;
    }
    cout << "\n";

}


Measured memory_bytes: 3228
#include <stdio.h>

int main(void)
{
	int w,n;
	int a,b;
	int work;
	int i;
	int result_value[30];
	
	scanf("%d", &w);
	scanf("%d", &n);
	
	for(i=0; i<30; i++)
	{
		result_value[i] = i+1;	
	}

	for(i=0; i<n; i++)
	{
		fscanf(stdin, "%d,%d", &a, &b);
		work = result_value[a-1];
		result_value[a-1] = result_value[b-1];
		result_value[b-1] = work;	
	}


	for(i=0; i<w; i++)
	{
		printf("%d\n", result_value[i]);
	}


	return 0;
}

Measured memory_bytes: 600
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, a, b = map(int, input().split())

    mi = a * (n - 1) + b
    ma = a + b * (n - 1)
    print(max(0, ma - mi + 1))


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 2940
#include"bits/stdc++.h"
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 1ll << 61;
const double eps = 0.000000000001;
typedef long long ll;
struct edge { int to; int cost;};

signed main() {
	int a, b, c; cin >> a >> b >> c;
	cout << max(0ll, c-a+b) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        #include<iostream>
        #include<cstdio>
        #include<vector>
        #include<queue>
        #include<map>
        #include<cstring>
        #include<string>
        #include <math.h>
        #include<algorithm>
        #include<functional>
       #define int long long
        #define inf  1000000007
        #define pa pair<int,int>
#define ll long long
        #define pal pair<ll,ll>
        #define ppa pair<int,pa>
        #define EPS (1e-10)
        #define equals(a,b) (fabs((a)-(b))<EPS)

        using namespace std;

        class Point{
        	public:
        	double x,y;
        	Point(double x=0,double y=0):x(x),y(y) {}
        	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
        	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
        	Point operator * (double a) {return Point(x*a,y*a);}
        	Point operator / (double a) {return Point(x/a,y/a);}
        	double absv() {return sqrt(norm());}
        	double norm() {return x*x+y*y;}
        	bool operator < (const Point &p) const{
        		return x != p.x ? x<p.x: y<p.y;
        	}
        	bool operator == (const Point &p) const{
        		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
        	}
        };
        typedef Point Vector;

        struct Segment{
        Point p1,p2;
        };

    double hen(Vector a){
    if(fabs(a.x)<EPS && a.y>0) return acos(0);
    else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0);
    else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0);
    else if(fabs(a.y)<EPS && a.x>0) return 0.0;
    else if(a.y>0) return acos(a.x/a.absv());
    else return 2*acos(0)+acos(-a.x/a.absv());

    }

        double dot(Vector a,Vector b){
        	return a.x*b.x+a.y*b.y;
        }
        double cross(Vector a,Vector b){
        	return a.x*b.y-a.y*b.x;
        }
        int dx[4] = {1, 0, -1, 0};
        int dy[4] = {0, 1, 0, -1};
        //----------------kokomade temple------------

int	gcd( int	a, int	b ){
	while( b ){
		int	m = a % b;
		a = b;
		b = m;
	}
	return	a;
}


signed main(){
int n,x;
cin>>n>>x;
	int ans=0;
	int t=n,s=x;
	
	
	/*
	while(n>0){
		t=min(s,t-s);
		int u=n/t;
		ans+= 3*u;
		n=n-u*t;
		
		
	}
	
	*/
	t=gcd(x,n);
	if(t==1){
	cout<<3*(n-1)<<endl;
	return 0;
	}
	else{
		cout<<3*(n/t-1)*t<<endl;
		return 0;
	}
        }


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

int cnt;

void selectionSort(int A[], int n){
  for(int i = 0; i < n; i++){
    int min = i;
    for(int j = i + 1; j < n; j++){
      if(A[j] < A[min]) min = j;
    }
    if(min != i){
      swap(A[i], A[min]);
      cnt++;
    }
  }
}

int main(void){
  int n, A[100];
  
  cin >> n;
  for(int i = 0; i < n; i++) cin >> A[i];

  selectionSort(A, n);

  for(int i = 0; i < n; i++){
    cout << A[i];
    if(i < n - 1) cout << " ";
  }
  cout << "\n" << cnt << endl;
  return 0;
}

Measured memory_bytes: 1164
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (true) {
            int n = sc.nextInt();
            if(n == 0) {
                break;
            }
            sc.nextLine();
            String str = sc.nextLine();


            String[] income = str.split(" ", 0);

            int sumIncome = 0;
            int aveIncome = 0;
            //        List<Integer> income = new ArrayList<>();

            for (int i = 0; i < income.length; i++) {
                sumIncome = sumIncome + Integer.parseInt(income[i]);
            }
            aveIncome = sumIncome / income.length;

            int count = 0;
            for (int i = 0; i < income.length; i++) {
                if (Integer.parseInt(income[i]) <= aveIncome) {
                    count++;
                }
            }
            System.out.println(count);
        }



    }

}



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

const int maxN=101;
const int maxW=1e5;

int n,w;
int wei[maxN];
int val[maxN];

long long dp[maxW+1];

int main(){
    cin>>n>>w;
    for(int i=1;i<=n;i++){
        cin>>wei[i]>>val[i];
    }

    for(int i=1;i<=n;i++){
        for(int j=w;j>=wei[i];j--){
            dp[j]=max(dp[j],dp[j-wei[i]]+val[i]);
        }
    }

    cout<<dp[w];
    

    return 0;
}

Measured memory_bytes: 1024
n, m = [int(x) for x in input().split()]
a = [[int(x) for x in input().split()] for y in range(n)]
b = [int(input()) for x in range(m)]
c = []

for i in range(n):
    c.append(sum([a[i][x] * b[x] for x in range(m)]))

for i in c:
    print(i)

Measured memory_bytes: 8132
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
int n;
int a[105],minn,minnum,maxx,maxnum,num[105];
int main()
{
	scanf("%d",&n);
	minn=1e9,maxx=0;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),minn=min(minn,a[i]),maxx=max(maxx,a[i]);
	for(int i=1;i<=n;i++) num[a[i]]++;
	if(num[minn]>2)
	{
		puts("Impossible");
		return 0;
	}
	if(num[minn]==1)
	{
		if(minn*2!=maxx)
		{
			puts("Impossible");
			return 0;
		}
	}
	else
	{
		if(minn*2-1!=maxx)
		{
			puts("Impossible");
			return 0;
		}
	}
	for(int i=minn+1;i<=maxx;i++)
	{
		if(num[i]<2)
		{
			puts("Impossible");
			return 0;
		}
	}
	puts("Possible");
	return 0;
}

Measured memory_bytes: 3736
from collections import Counter


def slv(A):
    S = 0
    C = Counter()
    C[0] += 1
    for a in A:
        S += a
        C[S] += 1

    c = 0
    for v in C.values():
        if v > 1:
            c += (v * (v - 1)) // 2

    return c


def main():
    N = int(input())
    A = list(map(int, input().split()))

    # import random
    # N = 2 * 100000
    # A = [random.randint(-1000000000, 1000000000) for _ in range(N)]

    print(slv(A))


if __name__ == '__main__':
    main()

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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0) 

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }
    
    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

bool iskai(int n) {
	string s = to_string(n);
	string t = s; reverse(all(t));
	return s == t;
}

int main() {
	int n = ri(), m = ri();
	int x[n+1], y[m+1];
	x[0] = ri(), y[0] = ri();
	FOR(i,n) x[i+1] = ri();
	FOR(i,m) y[i+1] = ri();
	SORT(x); SORT(y);
	cout << (x[n] < y[0] ? "No War" : "War") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;


int main() {
	ll n;
	cin >> n;
	ll ret = n + n;
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ll n1 = n / i;
			ll n2 = i;
			ll cur = n1 + n2 - 2;
			ret = min(ret, cur);
		}
	}
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//二項係数の計算
int nCr(int A, int B) {
    ll ans = 1;
    for (int i = 0; i < B; i++) {
        ans *= A - i;
    }
    for (int i = 0; i < B; i++) {
        ans /= i + 1;
    }
    return ans;
}
int main() {
    ll N;
    cin>>N;
    vector<ll>A(N);
    ll c=0;
    rep(i,N){
        cin>>A.at(i);
        c+=A.at(i);
    }
    ll ans=0;
    for(int i=N-1; 0<i; i--){
        c-=A.at(i);
        ans+=(c%1000000007)*(A.at(i)%1000000007);
        ans%=1000000007;
        }
    cout<<ans<<endl;
}

Measured memory_bytes: 4784
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
a = list(map(int, input().split()))
sm = sum(a)
t = 0
for i in range(N):
  if a[i] >= sm / (4 * M): t += 1
if t >= M: print("Yes")
else: print("No")

Measured memory_bytes: 38256
#include <stdio.h> 
int main()
{
    int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    scanf("%d",&k);
    printf("%d\n",a[k-1]);
    return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
 
public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    char c = in.readLine().toCharArray()[0];
    in.close();
    System.out.println((char)(c+1));
  }
}

Measured memory_bytes: 20436
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+3;
int n,a[maxn],b[maxn];
char s[maxn];
int solve(){
    int ret=0;
    for (int i=0;i<=n-1;i++) if ((i&(n-1))==i) ret^=b[i];
    return ret;
}
int main(){
    cin >> n >> s;
    for (int i=0;i<n;i++) a[i]=s[i]-'1';
    for (int i=0;i<n;i++) b[i]=a[i]%2;
    if (solve()){puts("1");return 0;}
    else {
        bool flag=0;
        for (int i=0;i<n;i++) flag|=(a[i]==1);
        if (flag) {puts("0");return 0;}
        for (int i=0;i<n;i++) b[i]=a[i]/2;
        if (solve()) puts("2"); else puts("0");
    }
    return 0;
}


Measured memory_bytes: 9088
N, K = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
if(N <= K):
  print(0)
else:
  h.sort(reverse=True)
  for i in range(K):
    h[i] = 0
  for i in range(N):
    ans += h[i]
  print(ans)

Measured memory_bytes: 26764
#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
  int n, k, a[1000];
  cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
  sort(a, a+n);
    int ans = 0;
  for(int i =0; i < k; i++){
    ans = ans+ a[i];}
  cout << ans << endl;
}

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


long long t,n,a[200001];

bool check(int b,long long x){
  int l=b,r=b+n,m;
  while(l<r){
    m=(l+r)/2;
    if(a[m]-a[b]>=x)r=m;
    else l=m+1;
  }
  int d=l;
  r=min(n+d,2*n);
  while(l<r){
    m=(l+r)/2;
    if(a[m]-a[d]>=x)r=m;
    else l=m+1;
  } 
  if(l<b+n&&a[b+n]-a[l]>=x)return 1;  
  return 0;
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++)
    cin>>a[i],t+=a[i],a[i]=t;
  for(int i=0;i<n;i++)a[i+n]=a[i]+t;
  long long ans=-1;
  for(int i=0;i<n;i++){
    long long l=0,r=1e18,m;
    while(l<r){
      m=(l+r)/2;
      if(check(i,m))l=m+1;
      else r=m;
    }
    ans=max(ans,l-1);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4640
#include <cstdio>

//#include <algorithm>

int main(){
	char s[100];
	scanf("%s",s);		
		char s2[4] = {'a','b','c'};
		int ans = 0;
		for(int i = 0;i < 3;i ++){
			for(int j = 0;j < 3;j++){
				if(s[i] == s2[j]) {
					s2[j] = 'z';
					ans++;
					continue;
				}
			}
		}
		
		if(ans == 3)printf("Yes");
		else printf("No");

	return 0;
} 

Measured memory_bytes: 128
while true
	e=gets.to_i
	break if e == 0

	m=1000000*3
	a=(e**(1.0/2.0)).round+1
	b=(e**(1.0/3.0)).round+1
	b.times{|z|
		a.times{|y|
			x=e-z**3-y**2
			next if x < 0
			ans = x+y+z
			m = ans < m ? ans : m
		}
	}
	puts m
end

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

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

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

	int H,W;
	int ch,cw;
	int dh,dw;
	int i,k;
	char tmp;
	const int INF=1e9;
	deque<pair<int,int>> deq;

	cin >> H >> W;
	cin >> ch >> cw;
	cin >> dh >> dw;
	ch--; cw--;
	dh--; dw--;

	vector<vector<int>> gv(H,vector<int>(W,0));
	vector<vector<int>> warp(H,vector<int>(W,INF));

	rep(i,H){
		rep(k,W){
			cin >> tmp;
			if(tmp=='#') gv[i][k]=1;
		}
	}

	deq.emplace_back(cw,ch);
	warp[ch][cw]=0;
	while(!deq.empty()){
		pair<int,int> data=deq.front();
		deq.pop_front();
		int x=data.first;
		int y=data.second;

		// normal move
		rep(dir,4){
			int ix=x+dx[dir];
			int iy=y+dy[dir];

			if(!(0<=ix && ix<W && 0<=iy && iy<H)) continue;
			if(gv[iy][ix]==1) continue;
			if(warp[iy][ix]<=warp[y][x]) continue;

			warp[iy][ix]=warp[y][x];
			deq.emplace_front(ix,iy);
		}

		// warp
		for(int dxx=-2;dxx<=2;dxx++){
			for(int dyy=-2;dyy<=2;dyy++){
				int ix=x+dxx;
				int iy=y+dyy;
				if(!(0<=ix && ix<W && 0<=iy && iy<H)) continue;
				if(gv[iy][ix]==1) continue;
				if(warp[iy][ix]<=warp[y][x]) continue;

				warp[iy][ix]=warp[y][x]+1;
				deq.emplace_back(ix,iy);
			}
		}
	}


	if(warp[dh][dw]==INF)
		cout << -1 << endl;
	else
		cout << warp[dh][dw] << endl;

	return 0;
}



Measured memory_bytes: 12116
#include <stdio.h>

int main(void) {
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if(x >= r && y >= r && (H - r) >= y && (W - r) >= x) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 584
using System;
class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
      	int a = int.Parse(input[0]);
      	int b = int.Parse(input[1]);
      	if(a <= 5){
          Console.WriteLine("0");
        }else if(a >=6 && a <= 12){
          Console.WriteLine(b/2);
        }else{
          Console.WriteLine(b);
        }

	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N, M;
  
  cin >> N >> M;
  
  vector<int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  
  int sum = 0;
  for(int i = 0; i < N; i++){
    sum += A.at(i);
  }
  
  int dead = sum;
  int ans = 0;
  
  for(int i = 0; i < N; i++){
    if(A.at(i) * 4 * M >= dead){
      ans++;
    }
  }
  
  if(ans >= M){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;

int main(){
  ll N;
  cin >> N;

  if(N % 2 == 0)
    cout << N << "\n";
  else
    cout << 2*N << "\n";
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans = min(a, b) + min(c, d);
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int n,m,h,w;
string s[60]={};
int cnt[60][60]={};
int a[60]={},b[60]={};
int map[60][60]={};

int main(){
    for(int i=0; i<60; i++){
        for(int j=0; j<60; j++){
            cnt[i][j]=0;
        }
    }
        
    cin>>h>>w;
    for(int i=0; i<h; i++)cin>>s[i];

    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(s[i][j]=='#')continue;
            for(int k=0; k<8; k++){
               int nx=j+dx[k],ny=i+dy[k];
               if(nx<0||nx>w||ny<0||ny>h)continue;
               if(s[ny][nx]=='#'){
                   cnt[i][j]++;
               }
           }
        }
    }

    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(s[i][j]=='#'){
                cout<<s[i][j];
            }else{
                cout<<cnt[i][j];
            }
        }
        cout<<endl;
    }
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        int n=Integer.parseInt(br.readLine());
        long arr[]=new long[n];
        String str[]=br.readLine().split(" ");
        for(int i=0;i<n;i++)
        arr[i]=Long.parseLong(str[i]);
        long sum=0;
        for(int i=1;i<n;i++)
        {
            if(arr[i-1]-arr[i]>0)
            {
                sum=sum+arr[i-1]-arr[i];
                arr[i]=arr[i-1];
            }
        }
        pw.println(sum);
        pw.flush();
        pw.close();
    }
}

Measured memory_bytes: 64400
import java.util.Scanner;

class Main{
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int std_list[] = new int[2];
		for (int i = 0; i < 2; i++) {
			int int_x = scanner.nextInt();
				std_list[i] = int_x;
		}
		System.out.printf("%d %d %f", std_list[0]/std_list[1], std_list[0]%std_list[1], (double)std_list[0]/std_list[1]);
	}
}


Measured memory_bytes: 26480
#include <stdio.h>
#include <cmath>

using namespace std;

int main()
{
    double d;
    scanf("%lf", &d);

    double ans = (int)d + 1 > d * sqrt(2.0) ? (int)d + 1 : d * sqrt(2.0);
    printf("%.12lf", ans);

    return 0;
}

Measured memory_bytes: 2728
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())


def isBingoYoko(ans):
    for bool_i_list in ans:
        for bj in bool_i_list:
            # print(bool_i_list)
            if bj==False:
                break
            else:
                pass
        else:
            print("Yes")
            exit(0)

def isBingoNaname(ans):
    if (ans[0][0] and ans[1][1] and ans[2][2]) or ((ans[0][2] and ans[1][1] and ans[2][0])):
        print("Yes")
        exit(0)
    else:
        pass

def main():
    A = [LI() for _ in range(3)]
    N = I()
    B = [I() for _ in range(N)]
    ans = [[False for _ in range(3)] for _ in range(3)]
    for b in B:
        for i in range(len(A)):
            if b in A[i]:
                j = A[i].index(b)
                ans[i][j] = True

    isBingoYoko(ans)
    isBingoYoko(list(numpy.array(ans).T))
    isBingoNaname(ans)
    print("No")

main()



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

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

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

const int INF = 1001001001;
const int MOD = 1000000007;
const long long INFL = (1LL << 60);
const double EPS = 1e-9;

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

  rep(i, s.size()) cout << 'x';
  cout << endl;
}

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


int main(){
    int W,H,x,y;
    cin >> W >> H >> x >>y;
    double area = (double)W*H/2.0;
    int c = 0;
    if(x == W/2.0 && y == H/2.0) c=1;
    cout << fixed << setprecision(9) << area << " ";
    cout << c <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 998244353;
const int INF = 2e18;

signed main() {
    int H, W;
    cin >> H >> W;
    int ans = (H / 2) * W;
    if (H == 1 || W == 1) {
        cout << 1 << endl;
        return 0;
    }
    if (H % 2 == 1) ans += W / 2 + (W % 2 == 1);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int N=9,S=100;
	vvi dp(N+1,vi(S+1));
	dp[0][0]=1;
	loop(x,0,10)for(int i=N-1;i>=0;i--)for(int j=S-x;j>=0;j--){
		dp[i+1][j+x]+=dp[i][j];
	}
	int n,s;
	while(cin>>n>>s,n+s){
		cout<<dp[n][s]<<endl;
	}
}

Measured memory_bytes: 3072
import java.util.*;
public class Main {
    public static void main(String[] args){
      // 入力
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      long result = 0L;
      int DIV = 1000000007;
      
      // 計算
      long pow10 = 1L;
      long pow9 = 1L;
      long pow8 = 1L;
      for(int i = 1; i <= N; i++){
        pow10 = (pow10 * 10) % DIV;
        pow9 = (pow9 * 9) % DIV;
        pow8 = (pow8 * 8) % DIV;
      }
      pow9 = (pow9 * 2) % DIV;
      result = pow10 - pow9;
      if(result < 0){
        result += DIV;
      }
      result = (result + pow8) % DIV;
      
      // 出力
      System.out.println(result);
    }
    

}

Measured memory_bytes: 35696
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
using namespace std;
typedef long long LL;
template<typename T>inline T chkmax(T A,T B){return A>B?A:B;}
template<typename T>inline T chkmin(T A,T B){return A<B?A:B;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
}
LL n,A,B,C,D;
inline bool solve()
{
	LL l1,l2,r1,r2;
	For(i,0,n)
	{
		l1=A-D*i,r1=A-C*i;
		l2=B-D*(n-i),r2=B-D*(n-i);
		if(l2<=r1&&l1<=r2)return 1;
		l1=A+C*i,r1=A+D*i;
		l2=B+C*(n-i),r2=B+D*(n-i);
		if(l2<=r1&&l1<=r2)return 1;
	}
	return 0;
}
int main()
{
	read(n),read(A),read(B),read(C),read(D);
	n-=1;
	if(solve())puts("YES");
	else puts("NO");
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
typedef long long ll;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    int AB = 0, A = 0, B = 0, ABcnt = 0;
    rep(i, N) {
        string s;
        cin >> s;
        rep(i, s.size() - 1) {
            if(s.substr(i, 2) == "AB")
                ABcnt++;
        }
        if(s[0] == 'B' && s[s.size() - 1] == 'A')
            AB++;
        else if(s[0] == 'B')
            B++;
        else if(s[s.size() - 1] == 'A')
            A++;
    }
    if(AB > 0) {
        ABcnt += AB - 1;
        if(A > 0) {
            ABcnt++;
            A--;
        }
        if(B > 0) {
            ABcnt++;
            B--;
        }
    }
    ABcnt += min(A, B);
    cout << ABcnt << endl;
    return 0;
}

Measured memory_bytes: 256
# AOJ 0168 Kannondou
# Python3 2018.6.18 bal4u

ans = [	0,  1,  2,  4,  7,  13,  24,  44,  81,  149, \
274,  504,  927,  1705,  3136,  5768,  10609,  19513,  35890,  66012, \
121415,  223317,  410744,  755476,  1389537,  2555757,  4700770,  8646064, \
15902591,  29249425, 53798080 ]

while True:
	n = int(input())
	if n == 0: break
	print((ans[n]-1)//3650 + 1)


Measured memory_bytes: 5596
N,M,Q=map(int,input().split())
a=[0]*Q
b=[0]*Q
c=[0]*Q
d=[0]*Q
for i in range(Q):
  a[i],b[i],c[i],d[i]=map(int,input().split())
import itertools
ans=0
for A in itertools.combinations_with_replacement(range(1,M+1),N):
  A_=list(A)
  s=0
  
  for i in range(Q):
    if A_[b[i]-1]-A_[a[i]-1]==c[i]:
      s+=d[i]
    ans=max(ans,s)
print(ans)  

Measured memory_bytes: 9228
program main
implicit none
integer :: i, j, k, n, m
integer , allocatable :: h(:)

read(*,*) n
allocate( h(n) )
read(*,*) h(1:n)
m = 0
do i = 1, n
   if( h(i) .ge. m ) then
      m = h(i)
   else
      if( m-h(i) .ge. 2 ) then
         write(*,*) 'No'
         stop
      end if
   end if
end do
write(*,*) 'Yes'

end program main

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, l, r;
  int sum = 0;
  
  cin >> N;
  
  for(int i = 0; i < N; i++) {
    cin >> l >> r;
    sum += r - l + 1;
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 100000000
typedef pair<int, int> P;
typedef pair<int, P> PP;



//initialization here
//


//
//initialization finish


// your function is here
//


//
// your function finished



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// your code is here
	//
	int x, a, b; cin >> x >> a >> b;

	Print((x - a) % b);
	
	
	//
	// your code finished


	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define ip pair<ll,ll>
#define ff first
#define ss second
#define MAX 100005
const ll MOD = 1000000007;

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

	ll a;
	cin>>a;
	if(a >= 30)

	cout<< "Yes" << "\n";		
	else
		cout<<"No\n";
}

Measured memory_bytes: 3648
n = int(input())
A = list(map(int, input().split()))
ans = [0] * n
for itr, val in enumerate(A[::-1]):
  idx = n - itr
  if sum([ans[(i + 1) * idx - 1] for i in range(n // idx)]) % 2 != val:
    ans[idx - 1] = int(not ans[idx - 1])

# print(ans)
    
p = sum(ans)
print(p)    

if p > 0:
  print(*[i + 1 for i, j in enumerate(ans) if j == 1])


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

const ll MOD = 1'000'000'007;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  int ans = 0;
  int x = 0;

  rep(i, n) {
    ans = (ans + (ll)a[i] * x) % MOD;
    x = (x + a[i]) % MOD;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4676
from collections import deque

S = input()
Q = int(input())

t = deque(S)
reverse = False
for _ in range(Q):
    query = input()
    if query[0] == '1':
        reverse = not reverse
    elif query[0] == '2':
        _, F, C = query.split()
        if F == '1':
            if reverse:
                t.append(C)
            else:
                t.appendleft(C)
        elif F == '2':
            if reverse:
                t.appendleft(C)
            else:
                t.append(C)
result = ''.join(t)
if reverse:
    result = result[::-1]
print(result)


Measured memory_bytes: 8564
import bisect
N,W = map(int,input().split())
dp = [0]*(10**3+1)+[10**12]*(10**5)
for i in range(N):
    w,v = map(int,input().split())
    for j in range(len(dp)-1,1000,-1):
        dp[j] = min(dp[j],dp[j-v]+w)
print(bisect.bisect_right(dp,W)-1001)

Measured memory_bytes: 42076
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

int main(){
    int n,m;cin >> n >> m;
    vector<P> req(m);
    for(int i = 0; i < m ; i++){
        int a,b;cin>>a>>b;
        a--;b--;
        req[i].first = b;
        req[i].second = a;
    }

    sort(req.begin(),req.end());
    int ans = 1;
    int prev = req[0].first;
    for(int i = 1; i < m ; i++){
        if(prev <= req[i].second){
            prev = req[i].first;
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD = ll(1e9)+7;

int main() {
    ll N;
    cin >> N;
    string S;
    cin >> S;
    ll num[26] ={};
    for(int i=0;i<N;i++){
        num[S[i] -'a']++;
    }
    ll ans =1;
    for(int i=0;i<26;i++){
        ans *= (num[i]+1);
        ans %=MOD;
    }
    cout << (ans+MOD-1)%MOD << endl;
    return 0;
}

Measured memory_bytes: 512
N = int(input())

min = float('inf')

for i in range(1, int(N**0.5)+1, 1):
    if N%i==0:
        A = i
        B = N//i
        keta = max(len(str(A)), len(str(B)))
        if keta<min:
            min = keta

print(keta)

Measured memory_bytes: 3060
#include <iostream>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define rng(a) a.begin(),a.end()
using ll = long long;

using namespace std;



int main() {
    int n;
    cin>>n;
    if(n<10) {
        cout<<n<<endl;
        return 0;
    }
    int a = n;
    int b = 0;
    while(a) {
        a /= 10;
        b++;
    }
    int mul = 1;
    int ans = 0;
    rrep(i,b) {
        if(i%2){
            if(i!=b) ans += 9*mul;
            else ans += n-mul+1;
        }
        mul *= 10;
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main() {
    ll A[6];
    rep(i,1){
        cin >> A[i];
    }
    // sort(A,A+3);
    cout << A[0]*(A[0]+1)/2 << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int totalValue = 0;
        int n = scan.nextInt();
        int w = scan.nextInt();
        int[] weights = new int[n];
        int[] values = new int[n];

        for (int i = 0; i < n; ++i) {
            weights[i] = scan.nextInt();
            values[i] = scan.nextInt();
            totalValue += values[i];
        }

        int ans = 0;
        long[][] dp = new long[n + 1][totalValue + 1];

        for (int i = 1; i <= totalValue; ++i) {
            dp[0][i] = Integer.MAX_VALUE;
        }

        for (int i = 1; i < n + 1; ++i) {
            for (int j = 0; j <= totalValue; ++j) {
                if (values[i - 1] <= j) {
                    dp[i][j] = Math.min(dp[i - 1][j - values[i - 1]] + weights[i - 1], dp[i - 1][j]);
                } else {
                    dp[i][j] = dp[i - 1][j];
                }

                if (dp[i][j] <= w) ans = Math.max(ans, j);
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 130456
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>

#include <vector>
#include <algorithm>

int main()
{
    int N;
    std::cin >> N;
    std::vector<int> D(N);
    for(int i = 0; i < N; i++){
        int d;
        std::cin >> d;
        D[i] = d;
    }
    
    sort(D.begin(), D.end());
    
    int ans = 0;
    ans = D[N/2] - D[N/2 - 1];
    std::cout << ans << std::endl;
    return 0;
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/


Measured memory_bytes: 640