akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <math.h>
using namespace std;

int main() {

	int N;
	long long int K;
	vector<int> A;
	vector<int> next;
	vector<int> seen;
	int res;

	int roopLength = -1;
	int roopStartKaisuu;

	cin >> N >> K;

	next.resize(N);

	for(int i=0; i<N; i++){
		int tmp;
		cin >> tmp;
		A.push_back(tmp);
		seen.push_back(-1);
	}


	int i=0, count = 0;
	while(1){
		count++;
		if(seen[A[i]-1] == -1){
			seen[A[i]-1] = count;
		}else{
			roopStartKaisuu = seen[A[i]-1];
			roopLength = count - seen[A[i]-1];
			break;
		}
		i = A[i]-1;
		
	}

	long long int kaisuu;

	if(K > roopStartKaisuu){
		kaisuu = (K - roopStartKaisuu) % roopLength + roopStartKaisuu;
	}else{
		kaisuu = K;
	}

	int now = 1;
	for(int i=0; i<kaisuu; i++){
		now = A[now-1];
	}

	res = now;

	cout << res;
    
}

Measured memory_bytes: 5852
# coding: utf-8
# Your code here!

A, B, C = map(int, input().rstrip().split(' '))

if A > B:
    if A > C and C > B:
        print('Yes')
    else:
        print('No')
else:
    if A < C and C < B:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3316
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 310, S = N * N, mod = 998244353;

ll a[N];
ll ways[N][S];

int main() {
	fast_cin();
	int n; cin >> n;
	ll sum = 0;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
		sum += a[i];
	}
	ways[0][0] = 1;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j <= sum; ++j) {
			if (!ways[i][j]) {
				continue;
			}
			ways[i + 1][j] += ways[i][j];
			ways[i + 1][j] %= mod;
			ways[i + 1][j + a[i + 1]] += ways[i][j];
			ways[i + 1][j + a[i + 1]] %= mod;
		}
	}
	ll p3 = 1;
	for (int i = 0; i < n; ++i) {
		p3 = (3 * p3) % mod;
	}
	ll ans = p3;
	if (sum % 2 == 0) {
		ans += 3 * ways[n][sum / 2];
		ans %= mod;
	}
	memset(ways, 0, sizeof(ways));
	ways[0][0] = 1;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j <= sum; ++j) {
			if (!ways[i][j]) {
				continue;
			}
			ways[i + 1][j] += 2 * ways[i][j];
			ways[i + 1][j] %= mod;
			ways[i + 1][j + a[i + 1]] += ways[i][j];
			ways[i + 1][j + a[i + 1]] %= mod;
		}
	}
	for (int j = sum; 2 * j >= sum; --j) {
		ans -= 3 * ways[n][j];
		ans %= mod;
		ans += mod;
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 232960
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    string s;
    cin >> s;
    int ans = 0;

    rep(i, 3) {
        if(s[i] == '1') {
            ans++;
        }
    }
    
    cout << ans;

    cout << endl;
    return 0;
}

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

int main() {
    string o, e;
    cin >> o >> e;
    int ol = o.length();
    int el = e.length();
    int oc = 0, ec = 0;
    string ans = "";
    
    rep(i, (ol + el)) {
        if ((i % 2 == 0) && (oc < ol)) {
            ans += o[oc++];
        }
        
        if ((i % 2 == 1) && (ec < el)) {
            ans += e[ec++];
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int n = sc.nextInt();
                int[] a = new int[n];
                long yono = 0;
                long pct = 0;
                for(int i = 0 ; i < n; i++){
                        a[i] = sc.nextInt();
                        yono += a[i];
                }
                yono -= a[n - 1];
                pct += a[n - 1];
                long ebishu = Math.abs(yono - pct);
                for(int i = n - 2 ; i > 0 ; i--){
                        yono -= a[i];
                        pct += a[i];
                        ebishu = Math.min(ebishu , Math.abs(yono - pct));
                }
                System.out.println(ebishu);
        }
}
//TLEかWAになりそうな予感、祈ります

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

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

	int a, b, k;
	cin >> a >> b >> k;
	int	len;
	int i;
	i = 0;
	while (i < k && a <= b)
	{
		cout << a++ << endl;
		i++;
	}
	a = max(a, b - k + 1);
	while (a <= b)
		cout << a++ << endl;
}


Measured memory_bytes: 256
from itertools import accumulate

n, k = map(int, input().split())
k2 = k * 2
req_b = [[0] * k for _ in range(k)]
req_w = [[0] * k for _ in range(k)]
bc, wc = 0, 0
for i in range(n):
    x, y, c = input().split()
    x, y = int(x), int(y)
    rx, ry = x % k2, y % k2
    b = c == 'B'
    if rx >= k:
        rx -= k
        if ry >= k:
            ry -= k
        else:
            b = not b
    elif ry >= k:
        ry -= k
        b = not b
    if b:
        req_b[rx][ry] += 1
        bc += 1
    else:
        req_w[rx][ry] += 1
        wc += 1

req_b = [list(accumulate(req)) for req in req_b]
req_w = [list(accumulate(req)) for req in req_w]
req_b = [list(accumulate(req)) for req in zip(*req_b)]
req_w = [list(accumulate(req)) for req in zip(*req_w)]

ans = 0
kb, kw = req_b[-1], req_w[-1]
for dx_b, dx_w in zip(req_b, req_w):
    dxk_b = dx_b[-1]
    dxk_w = dx_w[-1]
    for b1, w1, kyb, kyw in zip(dx_b, dx_w, kb, kw):
        b = bc - kyb - dxk_b + b1 * 2
        w = wc - kyw - dxk_w + w1 * 2
        a = b + wc - w
        ans = max(ans, a, n - a)
print(ans)


Measured memory_bytes: 101976
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	int x,y;
	cin>>x>>y;
	vec(A)
	pb(A,4)pb(A,6)pb(A,9)pb(A,11)
	if(x==2||y==2){
		ce("No")
	}else{
		int ans=0;
		fz(A.size()){
			if(x==A.at(z)){
				ans++;
			}
			if(y==A.at(z)){
				ans++;
			}
		}
		if(ans==2||ans==0){
			ce("Yes")
		}else{
			ce("No")
		}
	}
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define P pair<ll,ll>
#define fs first
#define sc second

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

int main(){
	int x,n; cin >> x >> n;
	vector<bool> ex(101, true);
	int p;
	Rep(n){
		cin >> p;
		ex[p] = false;
	}
	int m = x;
	int ans = 0;
	for(int i=1; i<x*2+2; i++){
		if(i <= 100){
			if(ex[i]){
				if(abs(x-i) < m){
					m = abs(x-i);
					ans = i;
				}
			}
		}else{
			if(abs(x-i) < m){
					m = abs(x-i);
					ans = i;
				}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)
int Min(int a, int b, int c) {
	if (a <= b) { return std::min(a, c); }
	else return std::min(b, c);
}
int main(void) {
	int a, b;
	cin >> a >> b;
	cout << a - b + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
vector<int> G[10001];
int res[101][101];
bool used[10001];
vector<int> vs;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

void dfs(int v){
	used[v]=true;
	vs.push_back(v);
	for(int i=0;i<G[v].size();i++){
		int nv=G[v][i];
		if(!used[nv] && G[nv].size()<=3){
			dfs(nv);
		}
	}
}

int main(void){
	scanf("%d",&n);
	for(int i=0;i<2*n*n-2*n;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		u--;
		v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	memset(used,false,sizeof(used));
	int top;
	for(int i=0;i<n*n;i++){
		if(!used[i] && G[i].size()==2){
			dfs(i);
		}
	}
	int x=0,y=0,dir=0;
	queue<int> que[101];
	for(int i=0;i<vs.size();i++){
		res[y][x]=vs[i];
		if(y==0 && x>0 && x<n-1){
			que[x].push(vs[i]);
		}
		x+=dx[dir];
		y+=dy[dir];
		if(x==n-1 && y==0)dir++;
		if(x==n-1 && y==n-1)dir++;
		if(x==0 && y==n-1)dir++;
	}
	for(int i=0;i<n-1;i++){
		for(int j=1;j<n-1;j++){
			int v=que[j].front();
			que[j].pop();
			res[i][j]=v;
			for(int k=0;k<G[v].size();k++){
				int nv=G[v][k];
				if(!used[nv]){
					used[nv]=true;
					que[j].push(nv);
				}
			}
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			printf("%d%c",res[i][j]+1,j+1==n?'\n':' ');
		}
	}
	return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N=in();
	int sum = 0;
	REP(i,N){
		int v = in();
		sum += v-1;
	}
	
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
n=2
l=[input() for i in range(n)]

N = int(l[0])
W = l[1].split(" ")

min_diff = 99999999

for i in range(0,N):
    sum_under = 0
    sum_over = 0
    for j in range(0,N):
        if j <= i:
            sum_under += int(W[j])
        else:
            sum_over += int(W[j])
    diff = abs(sum_over - sum_under)
    if min_diff > diff:
        min_diff = diff
print(min_diff)

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
int main(){
  char s[100000];
  int i,a;
  scanf("%s",s);
  a=strlen(s);
  if(s[0]!='d'&&s[0]!='e'){
    printf("NO\n");
    return 0;
  }
  for(i=1;i<a;i++){
    switch(s[i]){
      case 'd': if(s[i-1]=='m' || s[i-1]=='r'&& s[i-2]=='e' &&(s[i-3]=='m' ||s[i-3]=='s')
                  || s[i-1]=='e'){
                    // printf("d");
                    break;
                  }
                  else{
                     printf("NO\n"); return 0;
                  }
      case 'r': if(s[i-1]=='d' || s[i-1]=='e'){
                  // printf("r");
                  break;
                }
                else{
                  printf("NO\n"); return 0;
                }
      case 'e': if(s[i-1]=='m'||s[i-1]=='r'&&(s[i-2]=='d'||s[i-2]=='e'&&(s[i-3]=='m'||s[i-3]=='s'))
                  || (s[i-1]=='e'&&s[i-2]=='s') ||s[i-1]=='s'){
                    // printf("e");
                    break;

                  }
                  else{
                    printf("NO\n"); return 0;
                  }
      case 'a': if(s[i-1]=='e' &&s[i-2]=='r' ||s[i-1]=='r'&&s[i-2]=='e'){
                  // printf("a");
                  break;
                }
                else{
                  printf("NO\n"); return 0;
                }
      case 'm': if(s[i-1]=='a'&&s[i-2]=='e'){
                  // printf("m");
                  break;
                }
                else{
                  printf("NO\n"); return 0;
                }
      case 's':if(s[i-1]=='a' &&s[i-2]=='r'){
                // printf("s");
                break;
              }
              else{
                printf("NO\n"); return 0;
              }
      default: printf("*NO\n"); return 0;
    }
  }
  if(s[a-1]=='m' || s[a-1]=='r'&& s[a-2]=='e' &&(s[a-3]=='m' ||s[a-3]=='s')|| s[a-1]=='e'){
    printf("YES\n");
  }
  else{
    printf("NO\n");
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	priority_queue<int>q;
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++){
		int a;
		scanf("%d",&a);
		q.push(a);
	}
	for(int i=1;i<=m;i++){
		int temp=q.top();
		q.pop();
		temp/=2;
		q.push(temp);
	}
	long long ans=0;
	while(!q.empty()){
		int temp=q.top();
		q.pop();
		ans+=temp;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 892
#include <stdio.h>

int Check(int array[], int size){
  int i, cnt = 0;
  for(i = 0; i < size; i++){
    if(array[i] != 0) cnt++;
    if(cnt >= 2) return 2;
  }
  if(cnt == 1) return 1;
  else return 0;
}

void solve(int n, int p){
  int i;
  int hand[n], bowl;
  bowl = p;
  
  for(i = 0; i < n; i++){
    hand[i] = 0;
  }
  i = 0;
  while(1){
    if(bowl == 1){
      bowl--;
      hand[i]++;
      if(Check(hand, n) == 1){
	printf("%d\n", i);
	return;
      }
    }
    else if(bowl == 0){
      bowl = hand[i];
      hand[i] = 0;
    }
    else{
      bowl--;
      hand[i]++;
    }

    i = (i + 1) % n;
  }
}

int main(void){
  int n, p;
  while(1){
    scanf("%d %d", &n, &p);
    if( n == 0 && p == 0)
      return 0;
    else 
      solve(n, p);
  }
}


Measured memory_bytes: 596
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}

	return i
}
func main() {
	sc.Split(bufio.ScanWords)
	x := nextInt()
	var a5, b5 int

	// 100= (10^(9+buf) ) ^(1/5)   ,buf=1
	for i := -200; i <= 200; i++ {
		for j := -200; j <= 200; j++ {
			a5 = i * i * i * i * i
			b5 = j * j * j * j * j
			if a5-b5 == x {
				fmt.Println(i, j)
				return
			}
		}
	}

}


Measured memory_bytes: 1756
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef long double lld;

vector<ll> a;
const int maxn = 3001;
pair<bool, pair<ll, ll>> dp[maxn][maxn][2];

pair<ll, ll> solve(int x, int y, bool first) {
	if(x > y) {
		return make_pair(0, 0);
	}


	if(x == y) {
		if (first) {
			return make_pair(a[x], 0);	
		} else {
			return make_pair(0, a[x]);
		}
	}
	if(dp[x][y][first].first) return dp[x][y][first].second;

	// a[x]
	pair<ll, ll> ans;
	auto u = solve(x + 1, y, !first);
	auto v = solve(x, y - 1, !first);
	if(first) {
		ll ud = a[x] + u.first - u.second;
		ll vd = a[y] + v.first - v.second;
		if(ud > vd) { ans.first = a[x] + u.first; ans.second = u.second;}
		else { ans.first = a[y] + v.first; ans.second = v.second;}
	} else {
		ll ud = u.first - (u.second + a[x]);
		ll vd = v.first - (v.second + a[y]);
		if(ud < vd) {ans.first = u.first; ans.second = u.second + a[x];}
		else {ans.first = v.first; ans.second = v.second + a[y];}
	}
	dp[x][y][first].first = true; dp[x][y][first].second = ans;
	return ans;
}

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

	int n; cin >> n;

	a.resize(n, 0);
	for(int i = 0; i < n; i++) cin >> a[i];

	auto ans = solve(0, n - 1, true);
	cout << ans.first - ans.second << endl;
}

Measured memory_bytes: 422400
#include <cstdio>

int a[] = {0, 1, 2, 3, 5, 7, 8, 9};

int b;

long long retans(int bef){
  if(bef < 8){
    return a[bef];
  }else{
    long long ans = a[bef % 8];
    ans += retans(bef / 8) * 10;
    return ans;
  }
}

int main(){
  for(;;){
    scanf("%d", &b);
    if(b == 0){
      break;
    }else{
      long long pri = retans(b);
      printf("%lld\n", pri);
    }
  }
}

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

int main() {
	int N; cin >> N;
	int P=2;
	while(P*(P-1)/2<N) ++P;
	if(P*(P-1)/2>N){
	    cout << "No" << endl;
	    return 0;
	}
	cout << "Yes" << endl;
	cout << P << endl;
	vector<vector<int>> V(P, vector<int>(P-1, 0));
	int now=1;
	for(int i=0; i+1<P; ++i){
	    for(int j=i; j+1<P; ++j){
	        V[i][j]=V[j+1][i]=now;
	        ++now;
	    }
	}
	for(int i=0; i<P; ++i){
	    cout << P-1;
	    for(int j=0; j+1<P; ++j) cout << ' ' << V[i][j];
	    cout << endl;
	}
	return 0;
}


Measured memory_bytes: 2176
### The code is worked in dp, with a 2D matrix technique.

s = input()
t = input()

dp = [[0 for i in range(len(s)+1)] for j in range(len(t)+1)]
s = "0"+s
t = "0"+t

q = []

for i in range(1, len(t)):
    for j in range(1, len(s)):
        if s[j] == t[i]:
            dp[i][j] = 1 + dp[i-1][j-1]
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])

i = len(t)-1
j = len(s)-1

while i != 0 and j != 0:
    if dp[i][j] != dp[i-1][j] and  dp[i][j] != dp[i][j-1]:
        q.append(t[i])
        i -= 1
        j -= 1
    elif dp[i][j] != dp[i-1][j] and  dp[i][j] == dp[i][j-1]:
        j -= 1
    elif dp[i][j] == dp[i-1][j] and  dp[i][j] != dp[i][j-1]:
        i -= 1
    else:
        i -= 1

print(''.join(q[::-1]))




Measured memory_bytes: 153308
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	string s;
	cin >> s;
	int sum = 700;
	for (int i = 0; i < 3; i++) {
		if (s[i] == 'o') sum += 100;
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
int main()
{
	int n,l;
	cin>>n>>l;
	int dp[n];
	dp[0] = l;
	int sum = dp[0];
	for(int i=1;i<n;i++){
		dp[i] = dp[i-1]+1;
		sum+=dp[i];
	}	
	if(dp[0]>=0){
		cout<<sum-dp[0]<<"\n";
		return 0;
	}
	else{
		if(dp[n-1]>0){
			cout<<sum<<"\n";
			return 0;
		}
		else{
			cout<<sum-dp[n-1]<<"\n";
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
using System;


namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y;
            String[] a = Console.ReadLine().Split( " ".ToCharArray());
            x = int.Parse(a[0]);
            y = int.Parse(a[1]);

            if(x < y){
                Console.WriteLine("a < b");
            }
            else if(x == y){
                    Console.WriteLine("a == b");
            }
            else if (x > y)
            {
                Console.WriteLine("a > b");
            }
            else { 
                }
            }
     }
}

Measured memory_bytes: 5280
#include<iostream>
using namespace std;
int main() {
	int N, D, X,A[100],w=1,g=0,y=0;
	cin >> N >> D >> X;
	for (int i = 0;i < N;i++) {
		cin >> A[i];
		while (w <= D) {
			w = w + A[i];
			g++;
		}
		y = y + g;
		g = 0;
		w = 1;
	}
	cout << y+X;
	
}

Measured memory_bytes: 256
/* Your prologue will be the story. */
/* Copyright by HenryLi */
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<vector>
#include<set>
#include<sstream>
#include<stack>
#include<ctime>
#include<cmath>
#include<cctype>
#include<climits>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<complex>
using namespace std;
template <class _T> inline void read(_T &_x) {
	int _t; bool _flag=false;
	while((_t=getchar())!='-'&&(_t<'0'||_t>'9')) ;
	if(_t=='-') _flag=true,_t=getchar(); _x=_t-'0';
	while((_t=getchar())>='0'&&_t<='9') _x=_x*10+_t-'0';
	if(_flag) _x=-_x;
}
typedef long long LL;
const int maxn = 200010;
const int INF = 0x3f3f3f3f;
int n, a[maxn], d[maxn];
int main() {
	//freopen("B.in","r",stdin);
	//freopen("B.out","w",stdout);
	read(n);
	int res = 0;
	for (int i = 1; i <= n; ++i) {
		read(a[i]);
		d[a[i]] = d[a[i] - 1] + 1;
		res = max(res, d[a[i]]);
	}
	cout << n - res << endl;
	return 0;
}



Measured memory_bytes: 1792
import sys
n = int(input())
a = list(map(int, input().split()))
ans = [0] * (n+1)
ans_index = set([])
for i in reversed(range(1, n + 1)):
    sum_i = sum(ans[i * 2:n + 1:i])
    if a[i-1] == (sum_i + 1) % 2:
        ans[i] = 1
        ans_index.add(i)
    elif a[i-1] == sum_i % 2:
        ans[i] = 0
    else:
        print(-1)
        sys.exit()
print(sum(ans))
if ans_index:
    print(*ans_index)


Measured memory_bytes: 17124
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 10000000007
#define V(type) vector<(type)> 
#define all(c) ((c).begin(),(c).end())
#define I(var) cin>>(var)
#define O(var) cout<<(var)
#define ON(var) cout<<var<<"\n"
#define F(i,n) for(ll i = 0 ; i < n ;i++)
#define mfor(i,init,n,b) for(ll i = (init) ; i < (n) ; i+= (b))
#define cfor(i,c) for(auto i = (c).begin() ; i!= (c).end(); i++)

/*##################################################################################*/

/*
int prime[10000000] = {0} ;
void calculateprime()
{
    //calculating primes
    prime[0] = prime[1] = 1 ;
    for(int i = 2 ; (ll)i*i <= 10000000 ; i++)
    {
        if(prime[i] == 0)
        {
            for(ll j = i*i ; j <= 10000000 ; j += i )
            {
                prime[j] = 1 ;
            }
        }
    }
}
*/

/*
ll fib(int n) 
{ 
  ll a = 0, b = 1, c, i; 
  if( n == 0) 
    return a; 
  for (i = 2; i <= n; i++) 
  { 
    c = (a + b); 
    a = b; 
    b = c; 
  } 
  return b; 
}
*/

/*
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
*/

/*
ll findgrouplcm(ll arr[], ll n) 
{ 
    ll ans = arr[0]; 
  
    for (ll i = 1; i < n; i++) 
        ans = (arr[i] * (ans/(gcd(arr[i], ans))));
  
    return ans; 
}
*/

ll powerwithmod(ll x, unsigned ll y, ll p)  
{  
    ll res = 1;    
  
    x = x % p; 
   
    if (x == 0) return 0;
  
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p;  
   
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}


void solve(ll x){
    bool ok = false;
    for(int i = -200 ; i <= 200 ; i++){
        for(int j = -200 ; j <= 200 ; j++){
            if((powerwithmod(i,5,mod))-powerwithmod(j,5,mod) == x ){
                cout<<i<<" "<<j;
                ok = true;
                break;
            }
        }
        if(ok)  break;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t = 1;
    //cin>>t;
    while(t--)
    {
        ll x;
        I(x);
        solve(x);
    }
    return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
struct node
{
	int x,y,d;
}Q[N * N];
int H,W;
bool in[N][N];
bool judge(int x,int y)
{
	return (x > 0&&x <= H&&y > 0&&y <= W);
}

int main()
{
	cin>>H>>W;
	char c;
	int l = 0,r = 0;
	for (int i = 1;i <= H; ++i)
	{
		getchar();
		for (int j = 1;j <= W; ++j)
		{
			c = getchar();
			if (c == '#') 
			{
				in[i][j] = 1;
				Q[++r].x = i;
				Q[r].y = j;
				Q[r].d = 0;
			 } 
			else in[i][j] = 0;
		}	
	}	
	int ans = 0;
	while (l < r)
	{
		int x1 = Q[++l].x,y1 = Q[l].y,d1 = Q[l].d;
		for (int i = -1;i <= 1; ++i)
			for (int j = -1;j <= 1; ++j)
				if (!(i * j))
				{
					int x2 = x1 + i,y2 = y1 + j;
					if (judge(x2,y2))
						if (!in[x2][y2])
						{
							in[x2][y2] = 1;
							Q[++r].x = x2; Q[r].y = y2;
							Q[r].d = d1 + 1;
							ans = max(ans,Q[r].d);
						}
						
				}
		}
	cout<<ans;
 } 

Measured memory_bytes: 12928
#include <iostream>
#include <iomanip>
 int main() {
  int a, b;
  std::cin >> a >> b; 
  std::cout << a/b <<std::endl;
  std::cout << a%b <<std::endl;
  double f;
  f = 1.0 * a/b;
  std::cout << std::fixed << f <<std::endl;




 return 0;


}


Measured memory_bytes: 3252
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<vector<int>>())

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
typedef std::pair<int, int> pii;
typedef std::pair<int, double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;

#define PI 3.14159265358979323846264338327950L
const int mod = 1e9+7;








struct BIT{
public:
    int size;
    vector<long long> values;
    BIT(int n){
        size = n;
        values.assign(size+1,0);
    }
    
    void increment(int index, int val){
        index++;
        while(index <= size){
            values[index] += val;
            index += index&(-index);
        }
    }
    
    long long sum(int l, int r){
        return sum(r)-sum(l);
    }
    
    long long sum(int index){
        long long ret = 0LL;
        while(index){
            ret += values[index];
            index ^= index&(-index);
        }
        return ret;
    }
};




void solve(){


    int n,q;
    cin >> n >> q;
    BIT bit(n);
    vi a(n);
    rep(i,n) cin >> a[i];
    
    rep(i,n){
        bit.increment(i,a[i]);
    }
    rep(i,q){
        int t;
        cin >> t;
        if (t==0){
            int p,x;
            cin >> p >> x;
            bit.increment(p,x);
        }
        else{
            int l,r;
            cin >> l >> r;
            cout << bit.sum(l,r) << endl;
        }
    }

}




int main() {
    int T;
    //cin >> T;
    T = 1;
    while (T--) {
        solve();
        cout << endl;
    }
}




Measured memory_bytes: 10172
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toStr(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INF = INT_MAX/10;

bool check(string s) {
	REP(i, s.size()) {
		if(s[i] != s[s.size()-i-1]) {
			return false;
		}
	}
	return true;
}

int main() {
	vi p(10000+1, 0);
	REP(i, 10000) {
		if(check(toStr(i))) {
			p[i] = 1;
		}
	}

	int n;
	cin >> n;
	if(p[n]) {
		cout << n << endl;
		return 0;
	} else {
		int count = 1;
		while(true) {
			if(p[n-count]) {
				cout << n-count << endl;
				return 0;
			}
			if(p[n+count]) {
				cout << n+count << endl;
				return 0;
			}
			count++;
		}
	}

	return 0;
}

Measured memory_bytes: 1252
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int main()
{
	int N;
	int a;
	long long ans = 0;
	cin >> N;

	vector<int> A;
	map<int, bool> table;
	
	for (int i = 0; i < N; i++)
	{
		cin >> a;

		if (table.find(a) != table.end())
		{
			A.push_back(a);
			table.erase(table.find(a));
		}
		else
		{
			table[a] = true;
		}
	}

	sort(A.begin(), A.end());

	if (A.size() >= 2)
		ans = (long long)A[A.size() - 1] * A[A.size() - 2];
	else
		ans = 0;

	cout << ans << endl;

	return 0;
}


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

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define fr(i,k,n) for (ll i = k; i < n; ++i)
#define fri(i,k,n) for (int i = k; i >= n; --i)
#define INF (int)1e9
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(arr) arr.begin(),arr.end()

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

void solve(){
  int n;
  cin>>n;
  ll ans=0;
  fr(i,1,n){
    ans=(ans+ ((n-1LL)/i));
  }
  cout<<ans<<endl;
  return;
}

int main()
{
  boost();
  
  int tc=1;
  //cin>>tc;
  while(tc--)
    solve();
  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int h1, m1, h2, m2, K;
    cin >> h1 >> m1 >> h2 >> m2 >> K;
    int ans = h2*60+m2 - h1*60-m1 - K;
    cout << max(0, ans) << endl;
}

Measured memory_bytes: 3640
fun main(){
    val s = readLine()!!.toString().toCharArray()
    val t = readLine()!!.toString().toCharArray()

    if(s.size + 1 == t.size){
        for( i in 0 .. s.size -1) {
            if(s[i] != t[i]){
                println("No")
                return
            }
        }
    }else{
        println("No")
    }
    println("Yes")
}

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

int main(){
    int n;
  long long d;
    cin >> n >> d;
    vector<long long> x(n),y(n);
    int cnt=0;
    for (int i=0;i<n;++i){
        cin >> x[i] >> y[i];
        if (x[i]*x[i]+y[i]*y[i]<=d*d){
            cnt++;
        }
    }
    cout << cnt <<endl;
}


Measured memory_bytes: 6428
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

int main(){
  
  int h1,m1,h2,m2,k;
  cin>>h1>>m1>>h2>>m2>>k;
  int dis;
  dis=60*(h2-h1);
  dis+=m2-m1;
  dis-=k;
  if(dis<0){
    cout<<0<<endl;
  }
  else
    cout<<dis<<endl;
}

Measured memory_bytes: 3596
// amigos y no más
// dile a la jardinera que traigo flores
 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
 
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define MOD 998244353LL
#define LIM 262150
 
using namespace std;
 
typedef long long ll ;
 
string cad1,cad2;
int cont=0;
int main() {
	fastio;
	cin>>cad1;
	cad2 = string(cad1.rbegin() , cad1.rend());
	for(int i=0; i<cad1.size()/2 ; i++ ){
		if(cad1[i]!=cad2[i]) cont++;
	}
	cout<<cont<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define sz(v) (int)v.size()
#define pb push_back

using namespace std;
int n;

bool judge(int t,int x,int y){
    if(t < x + y || (t-(x+y)) % 2) return false;
    return true;
}

int main(){
    cin >> n;
    int t,x,y;
    bool ans = true;
    rep(i,n){
        cin >> t >> x >> y;
        ans = ans && judge(t,x,y);
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
// #include "ext/pb_ds/assoc_container.hpp"
// #include "ext/pb_ds/tree_policy.hpp"
// #define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
//using namespace __gnu_pbds;
#define int long long int
#define pb push_back
#define vec vector<int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define foo(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair
#define deb(x) cout << #x << " --> " << x << endl;
#define deb1a(v) cout << #v << "--->" << endl; for (auto it : v)  cout << it << " "; cout << endl;
#define deb2a(v) cout << #v << "--->" << endl;for (auto it:v){for(auto it1 : it){cout << it1 << " ";}cout<< endl;}
#define deb3a(v) cout << #v << "-->" << endl; for(auto it:v){cout << it.fi << " " << it.se << endl;}
#define mod 1000000007
#define so(v) sort(v.begin(),v.end())
#define fi first
#define se second
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
int power(int x, unsigned int y, int p){ int res = 1;x = x % p;while (y > 0)  { if (y & 1)res = (res*x) % p;y = y>>1;  x = (x*x)% p;} return res;}
int mI(int a, int m)  {return power(a, m - 2, m);}
vector<int> v;






int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b, n;
    cin >> a >> b >> n;
    int x = min(b-1, n);
    int ans = (a * x) / b - a * (x / b);
    // fo(x,a+1){
    //     ans = max(ans, (a * x) / b - a * (x / b));
    // }
    cout << ans;
}


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

int main() {
  
  string S;
  cin >> S;
  
  if (S == "Sunny") {
    cout << "Cloudy" << endl;
  }
  if (S == "Cloudy") {
    cout << "Rainy" << endl;
  }
  if (S == "Rainy") {
    cout << "Sunny" << endl;
  }
  
  
return 0;
}

Measured memory_bytes: 3512
def count(N, x, w, d):
    cnt = 0
    for i in range(N):
        if x >= w[i]:
            cnt += (x - w[i]) // d[i] + 1
    return cnt


def main():
    N, K = map(int, input().split())
    w = [0] * N
    d = [0] * N
    for i in range(N):
        w[i], d[i] = map(int, input().split())
    lo = 0
    hi = max(w) + max(d) * (K-1)
    while lo < hi:
        mid = (lo + hi) // 2
        if count(N, mid, w, d) < K:
            lo = mid + 1
        else:
            hi = mid
    print(lo)


if __name__ == "__main__":
    main()


Measured memory_bytes: 47032
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;

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

	int a[100];
	for(int i=0;i<N;i++){
		scanf("%d",&a[i]);
	}
	int min = a[0];
	int max = a[0];
	for(int i=1;i<N;i++){
		if(min > a[i]) min = a[i];
		if(max < a[i]) max = a[i];
	}

	printf("%d\n",max - min);


	return 0;
}


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

namespace ABC110A
{
    class Program
    {
        static void Main(string[] args)
        {
            int E, S, s, A, B, C;

            var word = Console.ReadLine().Split(' ');
            A = int.Parse(word[0]);
            B = int.Parse(word[1]);
            C = int.Parse(word[2]);

            if (A < B && C < B)
            {
                s = A + B * 10 + C;
                Console.WriteLine(s);
            }
            else if(C > B && C > A)
            {
                S = C * 10 + A + B;
                Console.WriteLine(S);
            }
            else if (A > B && A > C)
            {
                E = A * 10 + B + C;
                Console.WriteLine(E);
            }
            else 
            {
                s = A + B * 10 + C;
                Console.WriteLine(s);                
            }
            
            Console.ReadKey();

        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main(){
    while(1){
        string s;
        cin >> s;
        if(s == "0") break;
        int ans = 0;
        for(int i = 0; i < s.length(); i++){
            ans += s[i] - '0';
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3204
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i=0; i<n; i++) {
      int a=0;
      int b=0;
      boolean is_ok = true;
      for(int j=0; j<10; j++) {
	int ball = sc.nextInt();
        if(ball-a <= ball-b && ball-a > 0) {
          a = ball;
	}	
	else if(ball-b > 0) {
          b = ball;
	}
	else {
          is_ok = false;   
	}
      }
      if(is_ok) {
	System.out.println("YES");
      }
      else {
	System.out.println("NO");
      }
    }    
  }
}

Measured memory_bytes: 26184
using System;

namespace Project
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			string s1 = Console.ReadLine();
			string[] sar1 = s1.Split(' ');
			int r = int.Parse(sar1[0]);
			int c = int.Parse(sar1[1]);
			int[,] a = new int[r + 1, c + 1];
			for (int i = 0; i < r; i++)
			{
				string s2 = Console.ReadLine();
				string[] sar2 = s2.Split(' ');
				for (int j = 0; j < c; j++)
				{
					a[i, j] = int.Parse(sar2[j]);
					a[i, c] += a[i,j];
				}
			}
			for (int i = 0; i < c; i++)
			{
				for (int j = 0; j < r; j++)
				{
					a[r, i] += a[j, i];
				}
				a[r, c] += a[r, i];
			}
			for (int i = 0; i < r +1; i++)
			{
				for (int j = 0; j < c + 1; j++)
				{
					Console.Write(a[i,j]);
					if (j == c) { break; }
					Console.Write(" ");
				}
				Console.Write("\n");
			}
		}
	}
}

Measured memory_bytes: 9200
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            

            for (int i = 0; true; ++i )
            {
                String[] Array = Console.ReadLine().Split(' ');
                int x = int.Parse(Array[0]);
                int y = int.Parse(Array[1]);
                if (x == 0 && y == 0)
                {
                    break;
                }
                if (x > y)
                {
                    int temp = x;
                    x = y;
                    y = temp;
                    Console.WriteLine("{0} {1}", x, y);
                }
                else
                {
                    Console.WriteLine("{0} {1}", x, y);
                }
            }

            }
        }
    }

Measured memory_bytes: 5856
//package  com.company;

import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       int tc=sc.nextInt();
       int ac=0,wa=0,tle=0,re=0;
       while(tc>0){
           //System.out.println(tc);
           String s=sc.next();
           //System.out.println(s);
           if(s.equals("AC"))ac+=1;
           else if(s.equals("WA"))wa+=1;
           else if (s.equals("TLE"))tle+=1;
           else re+=1;
           tc--;
           //System.out.println("adsf");
       }
        System.out.println("AC x "+ac);
        System.out.println("WA x "+wa);
        System.out.println("TLE x "+tle);
        System.out.println("RE x "+re);
    }
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }
struct INF { template<class T> operator T() { return numeric_limits<T>::max() / 2; } } INF;

const ll mod = 1e9+7;

int main(){

    int s;
    cin >> s;

    V<ll> dp(s+10);
    dp[0] = 1;

    Rep(i,s) {
        for(int j = i-3; j >= 0; j--) {
            dp[i] += dp[j];
            dp[i] %= mod;
        }
    }

    int ans = dp[s];
    cout << ans << endl;
}

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

const int MAX = 50;
const int NIL = -1;

struct Node {
  int parent;
  int left;
  int right;
};

vector<int> PRE, IN, POST;
int pos;

int find_root_idx(int A[], int n, int r) {
  int root_idx {NIL};
  for (root_idx = 0; root_idx < n; root_idx++) {
    if (A[root_idx] == r) {
      break;
    }
  }
  return root_idx;
}

void reconstruction(int left, int right) {
  if (left >= right) return;
  int root = PRE[pos++];
  int mid = distance(IN.begin(), find(IN.begin(), IN.end(), root));
  reconstruction(left, mid);
  reconstruction(mid + 1, right);
  POST.push_back(root);
}


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

  for (int i = 0; i < n; i++) {
    cin >> k;
    PRE.push_back(k);
  }
  for (int i = 0; i < n; i++) {
    cin >> k;
    IN.push_back(k);
  }

  reconstruction(0, PRE.size());
  for (int i = 0; i < n; i++) {
    if (i) cout << " ";
    cout << POST.at(i);
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 3152
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int n, m;
    int ac[100001]; INITA(ac, 0, 100000, 0);
    int wa[100001]; INITA(wa, 0, 100000, 0);
    cin >> n >> m;
    REP(i, m) {
        int p;
        string s;
        cin >> p >> s;
        if ((s == "WA") && (ac[p] == 0)) {
            wa[p]++;
        } else if ((s == "AC") && (ac[p] == 0)) {
            ac[p] = 1;
        }
    }
    int num_ac = 0;
    int num_wa = 0;
    FOR(i, 1, n) {
        if (ac[i] == 1) {
            num_ac++;
            num_wa += wa[i];
        }
    }
    cout << num_ac << " " << num_wa << endl;
    return 0;
}

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

long long M[1 << 20];

long long solve(long long L, long long N, vector<long long>X) {
	for (int i = 1; i <= N; i++) M[i] = X[i - 1];
	for (int i = N + 1; i < 3 * (N + 1); i++) M[i] = L + M[i - (N + 1)];

	long long S = X[N - 1], maxn = S;
	long long P1 = N + 1, P2 = N * 2 + 1, S1 = N * 2 + 2, S2 = N * 2 + 1;
	for (int i = 1; i <= N - 1; i++) {
		P1 -= 1; P2 -= 2; S1 -= 2; S2 -= 1;
		long long v1 = M[P2] - M[P1];
		long long v2 = M[S2] - M[S1];
		long long v3 = M[S2 + 1] - M[S2];
		S += v1 * 2;
		S -= v2 * 2;
		S -= v3 * 1;
		maxn = max(maxn, S);
	}
	return maxn;
}

long long L, N; vector<long long>X;

int main() {
	cin >> L >> N; X.resize(N, 0);
	for (int i = 1; i <= N; i++) cin >> X[i - 1];

	long long v1 = solve(L, N, X);
	for (int i = 1; i <= N; i++) X[i - 1] = L - X[i - 1];
	reverse(X.begin(), X.end());
	long long v2 = solve(L, N, X);
	cout << max(v1, v2) << endl;
	return 0;
}

Measured memory_bytes: 9472
fun main() {
    val (n, d) = readLongs()
    var s = 0
    repeat(n.toInt()) {
        val (x, y) = readLongs()
        if (x * x + y * y <= d * d) s++
    }
    println(s)
}

private fun readInt() = readLine()!!.toInt()
private fun readInts() = readLine()!!.split(" ").map { it.toInt() }
private fun readLongs() = readLine()!!.split(" ").map { it.toLong() }


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

int main(){

	string s, t;
    cin >> s;
    cin >> t;
    
    int len_s = s.size();
    int len_t = t.size();
    if(s == t.substr(0,len_s) && len_t - len_s == 1){
    	cout << "Yes";
    }else{
    	cout << "No";
    }
}

Measured memory_bytes: 3588