akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int dp[100001];
bool vis[100001];
void dfs(int node,vector<int> adj[])
{
    vis[node]=true;
    for(int i=0;i<adj[node].size();i++)
    {
        if(vis[adj[node][i]]==false)
            dfs(adj[node][i],adj);
        dp[node]=max(dp[node],1+dp[adj[node][i]]);
    }


}
int main()
{
int n,m;
cin>>n>>m;
vector<int> adj[n];
for(int i=0;i<m;i++)
{
    int a,b;
    cin>>a>>b;
    adj[a-1].push_back(b-1);
}

memset(dp,0,sizeof(dp));

memset(vis,0,sizeof(vis));
for(int i=0;i<n;i++)
{
    if(!vis[i])
        dfs(i,adj);

}
 int ans = 0;
    for (int i = 0; i <= n; i++) {
        ans = max(ans, dp[i]);
    }
    cout<<ans;




}


Measured memory_bytes: 8192
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;

template <class T> using V = vector<T>;

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

const long long INF = 1LL << 60;

using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;



#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);



ll Sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}



const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}


#define comuse Comuse()

ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll perm(int n,int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] % MOD) % MOD;
}


ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}

ll modpow(ll a,ll n,ll mod){
  ll ans=1;
  while(n>0){
    if(n&1){
      ans=ans*a%mod;
    }

    a=a*a%mod;
    
    n>>=1;
  }

  return ans;
}

void Solve();


const int MAX_N = 131072;
//segment tree 
int NN;
int seg[MAX_N*2-1];
void seguse(){
  for(int i=0;i<2*NN-1;i++){
    seg[i]=INT_MAX;
  }
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}




/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
//segtreeの葉の先頭の添え字はn-1
void Solve(){
  //vll segtree(524287);
  //ll N=262144;
  ll n;
    cin>>n;
  vll A(n);
  FOR(i,0,n){
    cin>>A[i];
  }
  ll now=1000000;
  ll ans=0;
  FOR(i,0,n){
    if(A[i]<now){
      ans++;
      now=A[i];
    }
  }
  cout<<ans<<"\n";
}

Measured memory_bytes: 1792
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use itertools::Itertools;
use std::process::exit;
use std::cmp::*;
use num::*;
use num::integer::Roots;

fn main() {
    input! {
    aa:String,
    }
    let a=aa.chars().map(|a|a.to_digit(10).unwrap()).collect_vec();
    let b:u32=a.iter().sum();
    if a.len()==1 {println!("{}",aa);exit(0)}
    for i in 1..a.len() {
        if a[i]!=0 {println!("{}",b);exit(0)}
    }
    println!("10")
}

Measured memory_bytes: 2128
<?php
# 数値の入力
fscanf(STDIN, "%s", $data1);
$anser = 'Sunny';
if($data1=='Sunny'){
    $anser = 'Cloudy';
}elseif($data1=='Cloudy'){
    $anser = 'Rainy';
}else{
}

echo $anser;
?>

Measured memory_bytes: 3700
import itertools
import numpy as np
n,m,x = map(int,input().split())
c = []
total = [0] * m
ans = float('inf')
finish = False
for i in range(n):
    c.append(list(map(int,input().split())))
for i in range(1,n+1):
    for comb in itertools.combinations(c,i):
        su = np.array(comb).sum(axis=0)
        if sum(su[1:] >= x) == m:
            ans = min(ans,su[0])
if ans != float('inf'):
    print(ans)
else:
    print(-1)

Measured memory_bytes: 27276
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	int n; cin >> n;
	vector<int> h(n);

	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}

	int ans = 1;
	for (int i = 1; i < n; i++) {
		int tmp = h[i];
		bool f = true;
		for (int j = i-1; j >= 0;j--) {
			if (tmp < h[j]) {
				f = false;
			}
		}

		if (f) {
			ans++;
		}

	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vb = vector<bool>;
using vs = vector<string>;
using vp = vector<pii>;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(), (x).end()
#define each(a, x) for (auto&& a : (x))
#define _overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) rep2(_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, n) rep4(i, a, n, 1)
#define rep4(i, a, n, s) for (ll i = (a); i < (n); i += (s))
#define rep(...) _overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
template<typename T> inline void print(const T& x) {cout << x << "\n";}
template<typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template<typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
struct Init {Init() {cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10);}} init;

const int MAX = 666999;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int x, y; cin >> x >> y;
    if ((x + y) % 3 != 0) {
        print(0);
        return 0;
    }
    int d = (x + y) / 3;
    x -= d; y -= d;
    COMinit();
    int ans = COM(x + y, max(x, y));
    print(ans);
}

Measured memory_bytes: 19240
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

struct vertex{
    int X;
    int Y;
};

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

int	lcm(int a, int	b){
    return (a*b)/gcd(a,b);
}

int isPrim(int a){
    if(a==1){
        return 0;
    }
    for(int i=2;i<=(a+1)/2;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}

int main(int argc, const char * argv[])
{
    //std::ios::sync_with_stdio(false);
    //scanf("%s",S);
    //scanf("%d",&N);
    //getline(cin, target);
    //cin >> x >> y;
    //????????????

    int K;
    cin >> K;
    
    string I[100];
    string N[100];
    for(int i=0;i<K;i++){
        cin >> I[i];
    }
    for(int i=0;i<K;i++){
        cin >> N[i];
    }
    
    int iRyoku=0;
    int nRyoku=0;
    

    for(int i=0;i<K;i++){
        if(iRyoku==0 && I[i]=="kougekida" && nRyoku==0 && N[i]=="kougekida"){
            ;
        }else if(iRyoku==0 && I[i]=="kougekida"){
            cout << "Nakajima-kun" << endl;
            return 0;
        }else if(nRyoku==0 && N[i]=="kougekida"){
            cout << "Isono-kun" << endl;
            return 0;
        }
        
        
        if(iRyoku==nRyoku && I[i]=="kougekida" && N[i]=="kougekida"){
            iRyoku=0;
            nRyoku=0;
        }else if(iRyoku>0 && I[i]=="kougekida" && nRyoku>0 && N[i]=="kougekida"){
            if(iRyoku>nRyoku){
                cout << "Isono-kun" << endl;
                return 0;
            }else if(iRyoku<nRyoku){
                cout << "Nakajima-kun" << endl;
                return 0;
            }
        }
        
        
        if(I[i]=="tameru" && N[i]=="kougekida"){
            cout << "Nakajima-kun" << endl;
            return 0;
        }else if(N[i]=="tameru" && I[i]=="kougekida"){
            cout << "Isono-kun" << endl;
            return 0;
        }
        if(I[i]=="tameru"){
            if(iRyoku<5){
                iRyoku++;
            }
        }
        if(N[i]=="tameru"){
            if(nRyoku<5){
                nRyoku++;
            }
        }
        
        if(I[i]=="mamoru" && N[i]=="kougekida" && nRyoku==5){
            cout << "Nakajima-kun" << endl;
            return 0;
        }else if(N[i]=="mamoru" && I[i]=="kougekida" && iRyoku==5){
            cout << "Isono-kun" << endl;
            return 0;
        }
        if(I[i]=="mamoru" && N[i]=="kougekida" && nRyoku<5){
            nRyoku=0;
        }else if(N[i]=="mamoru" && I[i]=="kougekida" && iRyoku<5){
            iRyoku=0;
        }
        
        
    }




    cout << "Hikiwake-kun" << endl;

    //???????????§
    //cout << "ans" << endl;????????????
    //printf("%.0f\n",ans);//?°???°?????\?????¨?????????
    //printf("%.7f",p);
    //printf("%f\n",pow(2,ans.size()));
    
    return 0;
}

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

int main(){
  vector<vector<int>> A(3,vector<int>(3));
  
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>A[i][j];
    }}
  
  int N;
  cin>>N;
  vector<int> b(N);
  for(int i=0;i<N;i++){
    cin>>b[i];
  }
  vector<vector<int>> c(3,vector<int>(3,0));
  
  for(int i=0;i<N;i++){
    for(int j=0;j<3;j++){for(int k=0;k<3;k++){
      if(b[i]==A[j][k]){c[j][k]=1;}
    }}}
    
    if(c[0][0]&&c[1][1]&&c[2][2]){cout<<"Yes"<<endl;}
    else if(c[0][2]&&c[1][1]&&c[2][0]){cout<<"Yes"<<endl;}
    else if(c[0][0]&&c[1][0]&&c[2][0]){cout<<"Yes"<<endl;}
    else if(c[0][1]&&c[1][1]&&c[2][1]){cout<<"Yes"<<endl;}
    else if(c[0][2]&&c[1][2]&&c[2][2]){cout<<"Yes"<<endl;}
    else if(c[0][0]&&c[0][1]&&c[0][2]){cout<<"Yes"<<endl;}
    else if(c[1][0]&&c[1][1]&&c[1][2]){cout<<"Yes"<<endl;}
    else if(c[2][0]&&c[2][1]&&c[2][2]){cout<<"Yes"<<endl;}
    else{cout<<"No";}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	ll n; cin >> n;
	ll ans = 0;
	for( ll a = 1; a <= n; ++a ){
		ll b = n/a;
		ll c = n - a*b;
		if( c == 0 ){
			b -= 1;
		}
		ans += b;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3596
//package CodeFestival2017QualA;

import java.io.*;
import java.util.*;


public class Main{
	public static void main(String[] args) throws Exception{ new Main(new Reader()); }
	public Main(Reader rr) throws IOException{
		int n=rr.ni(), m=rr.ni(), k=rr.ni();
		int on=0;
		boolean yes=false;
		here:
		for(int i=0; i<=n; i++){
			on=i*m;
			for(int j=0; j<=m; j++){
				if(on==k){
					yes=true;
					break here;
				}
				on+=(n-i*2);
			}
		}
		System.out.println(yes?"Yes":"No");
	}
	class pointer{
		int parent;
		ArrayList<Integer> children;
		pointer(int parent){
			this.parent=parent;
		}
	}
	static class Reader{
		private DataInputStream din;
		private byte[] buffer=new byte[1024];
		private int bufP, bytR;
		public Reader() throws IOException{
			din=new DataInputStream(System.in);
			bufP=bytR=0;
		}
		public Reader(String file) throws IOException{
			din=new DataInputStream(new FileInputStream(file));
			bufP=bytR=0;
		}
		private String rl() throws IOException{
			byte[] buf=new byte[1024];
			int cnt=0, c;
			while((c=read())!=-1){
				if(c=='\n') break;
				buf[cnt++]=(byte)c;
			}
			return new String(buf, 0, cnt);
		}
		private int ni() throws IOException{
			int num=0;
			byte c=read();
			while(c<=' ') c=read();
			boolean neg=(c=='-');
			if(neg) c=read();
			do{
				num=num*10+c-'0';
			} while((c=read())>='0'&&c<='9');
			if(neg) return -num;
			return num;
		}
		private long nl() throws IOException{
			long num=0;
			byte c=read();
			while(c<=' ') c=read();
			boolean neg=(c=='-');
			if(neg) c=read();
			do{
				num=num*10+c-'0';
			} while((c=read())>='0'&&c<='9');
			if(neg) return -num;
			return num;
		}
		private double nd() throws IOException{ return Double.parseDouble(ns()); }
		private char nc() throws IOException{ return (char)next(); }
		private String ns() throws IOException{
			int c=next();
			StringBuilder sb=new StringBuilder();
			while(!(isChar(c))){
				sb.appendCodePoint(c);
				c=read();
			}
			return sb.toString();
		}
		private char[] ns(int n) throws IOException{
			char[] buf=new char[n];
			int c=next(), r=0;
			while(r<n&&!(isChar(c))){
				buf[r++]=(char)c;
				c=next();
			}
			return n==r?buf:Arrays.copyOf(buf, r);
		}
		private char[][] nm(int n, int m) throws IOException{
			char[][] map=new char[n][];
			for(int i=0; i<n; i++) map[i]=ns(m);
			return map;
		}
		private int[] na(int n) throws IOException{
			int[] a=new int[n];
			for(int i=0; i<n; i++) a[i]=ni();
			return a;
		}
		private boolean isChar(int c) throws IOException{ return !(c>=33&&c<=126); }
		private int next() throws IOException{ int c; while((c=read())!=-1&&isChar(c)); return c; }
		private byte read() throws IOException{
			if(bufP==bytR){
				bytR=din.read(buffer, bufP=0, 1024);
				if(bytR==-1) buffer[0]=-1;
			}
			return buffer[bufP++];
		}
		public void close() throws IOException{
			if(din==null) return;
			din.close();
		}
	}
}


Measured memory_bytes: 22484
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define ll long long
#define LIM 100000
using namespace std;
ll v[LIM];
int main() {
  ll a, b;
  string op;
  cin >> a >> op >> b;
  if (op == "+") {
    cout << a + b << endl;
  } else {
    cout << a - b << endl;
  }
  return 0;
}


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

int main(){
    int H,W;
    while (1){
        int i,t;
        cin >> H >> W;
        if (H==0 && W==0) break;

        for (i=1; i<=H; i+=1){
            for (t=1; t<=W; t+=1){
                if (i%2 != 0){
                    if (t%2 != 0){cout << '#';} 
                    else{cout << '.';}
                } else{
                    if (t%2 != 0){cout << '.';} 
                    else{cout << '#';
                    }
                }
            }
            cout << "\n";
        }
        cout << "\n"; 
    }

    return 0;
}


Measured memory_bytes: 3068
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main(int argc, char const *argv[])
{
    string S;
    cin >> S;
    int cnt[3] = {};
    for (char c : S)
    {
        cnt[c - 'a']++;
    }

    int i = 0;
    int d;
    while (i < 3)
    {
        int j = i + 1;
        while (j < 3)
        {
            d = abs(cnt[i] - cnt[j]);
            if (d > 1)
            {
                cout << "NO" << endl;
                return 0;
            }
            j++;
            
        }
        i++;
        
    }
    
    cout << "YES" << endl;
    
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define go(u) for(int i = head[u], v = e[i].to; i; i=e[i].lst, v=e[i].to)
#define rep(i, a, b) for(int i = a; i <= b; ++i)
#define pb push_back
#define re(x) memset(x, 0, sizeof x)
inline int gi() {
    int x = 0,f = 1;
    char ch = getchar();
    while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getchar();}
    while(isdigit(ch)) { x = (x << 3) + (x << 1) + ch - 48; ch = getchar();}
    return x * f;
}
template <typename T> inline bool Max(T &a, T b){return a < b ? a = b, 1 : 0;}
template <typename T> inline bool Min(T &a, T b){return a > b ? a = b, 1 : 0;}
const int N = 1e5 + 7;
int n, m, edc;
LL ans, cnt[3];
int col[N], q[N], head[N];
struct edge {
	int lst, to, c;
}e[N << 1];
void Add(int a, int b, int c) {
	e[++edc] = (edge){ head[a], b, c}, head[a] = edc;
	e[++edc] = (edge){ head[b], a, -c}, head[b] = edc;
}
void bfs(int st) {
	re(cnt);
	int type = 0, gg = 0, hd, tl;
	q[hd = tl = 1] = st;
	for(; hd <= tl; ++hd) {
		int u = q[hd];
		++cnt[col[u]];
		go(u) {
			++gg;
			if(col[v] != -1) {
				if((col[u] + e[i].c + 3) % 3 != col[v]) type = 1;
				continue;
			}
			col[v] = (col[u] + e[i].c + 3) % 3;
			q[++tl] = v;
		}
	}
	if(type == 1) { ans += (LL) tl * tl; return;}
	if(!cnt[0] || !cnt[1] || !cnt[2]) { ans += gg / 2; return;}
	ans += cnt[0] * cnt[1] + cnt[1] * cnt[2] + cnt[2] * cnt[0];
}
int main() {
#ifdef fwat
#endif
	n = gi(), m = gi();
	memset(col, -1, sizeof col);
	rep(i, 1, m) {
		int x = gi(), y = gi();
		Add(x, y, 1);
	}
	rep(i, 1, n) if(col[i] == -1) {
		col[i] = 0;
		bfs(i);
	}
	printf("%lld\n", ans);
	return 0;
}

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

using namespace std;

#define ll long long 
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353
#define inf LLONG_MAX

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

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

    ll test=1;
    // cin>>test;
    while(test--)
    {
        ld x,y;
        cin>>x>>y;

        ld t=(y-2*x)/2;

        if(t<0 || t>x || floor(t)!=t)
        {
            cout<<"No";
            continue;
        }

        cout<<"Yes";
    }
}

Measured memory_bytes: 3800
#include<stdio.h>

int fib(int);
int f[45];

int main()
{
  int a,n;

  scanf("%d",&n);

  a = fib(n);
  printf("%d\n",a);

  return 0;
}

int fib(int n){

  int a;

  if(a = f[n])
    return a;
  
  if(n==0 || n==1){
    a = 1;
  }
  else
    a = fib(n-1)+fib(n-2);

  f[n] = a;
  return a;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define END(a) {cout << (a) << "\n"; return 0;}
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(1); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    int a, b; cin >> a >> b;
    if (a > 9 || b > 9) {
        cout << "-1\n";
        return 0;
    }
    cout << a * b << "\n";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int result = 700;
		
		char[] c = s.toCharArray();
		
		for(int i = 0; i < 3; i ++) {
			if(c[i] == 'o') {
				result += 100;
			}
		}
		System.out.println(result);
	}
}


	

Measured memory_bytes: 23764
from collections import*
from copy import*
n,m=map(int,input().split())

grid=[list("#"*(m+2))]+[list("#"+input()+"#")for i in range(n)]+[list("#"*(m+2))]
#print(grid)

start=[]
for i in range(1,n+1):
    for j in range(1,m+1):
        start.append((i,j))

ans=0
for s in start:
    G=deepcopy(grid)
    if G[s[0]][s[1]]!="#":
        G[s[0]][s[1]]=0
    else:
        continue
    Q=deque([s])
    while Q:
        y,x=Q.pop()
        for my,mx in (-1,0),(1,0),(0,-1),(0,1):
            if G[y+my][x+mx]==".":
                G[y+my][x+mx]=G[y][x]+1
                Q.appendleft((y+my,x+mx))
    
    x=max( max([0]+[j for j in i  if type(j)==int]) for i in G)
    if x>ans:
        ans=x
print(ans)

Measured memory_bytes: 57052
import java.util.Scanner;

public class Main {
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   
   int k = sc.nextInt();
   int x = sc.nextInt();
   
   String res = "";
   
   if(500 * k >= x){
     res = "Yes";
   }else{
     res = "No";
   }
   
   System.out.println(res);
   }
}

Measured memory_bytes: 21588
/* eslint-disable @typescript-eslint/camelcase */
{
  const main = (
    input: string
  ): void | string | number | string[] | number[] => {
    const r = _reader(input)
    const [N] = r.nn()

    const xs: number[] = []
    const ys: number[] = []

    for (let i = 0; i < N; i++) {
      const [x, y] = r.nn()

      xs.push(x)
      ys.push(y)
    }

    const [_a, _b, res] = solvCircle(xs, ys)

    return res
  }
  const distance = (x1, y1, x2, y2) => {
    const dx = x2 - x1
    const dy = y2 - y1

    return Math.sqrt(dx * dx + dy * dy)
  }

  const LOOP_MAX = 100
  const CONVRGV = 0.1 ** 9

  const solvCircle = (pt_x: number[], pt_y: number[]) => {
    let mv_rate = 0.5 // 移動係数
    let max_dist = 0.0 // 中心点から最遠点までの距離
    let xsv = 0.0 // 中心点のx座標
    let ysv = 0.0 // 中心点のy座標
    let cx = 0.0 // 仮中心点のx座標
    let cy = 0.0 // 仮中心点のy座標
    let k = 0
    let cvgflg = false

    while (!cvgflg) {
      for (let i = 0; i < LOOP_MAX; i++) {
        // 最遠点を求める
        max_dist = 0.0

        for (let i = 0; i < pt_x.length; i++) {
          let dist = distance(cx, cy, pt_x[i], pt_y[i])

          if (dist > max_dist) {
            max_dist = dist
            k = i
          }
        }

        // 仮の中心点を計算
        cx += (pt_x[k] - xsv) * mv_rate
        cy += (pt_y[k] - ysv) * mv_rate

        // 移動距離が境界値を下回っていればループを抜ける
        if (distance(cx, cy, xsv, ysv) <= CONVRGV) {
          cx = xsv
          cy = ysv
          cvgflg = true
          break
        }

        xsv = cx
        ysv = cy
      }

      mv_rate /= 2.0
    }

    return [cx, cy, max_dist]
  }

  const _reader = (str: string, i = 0) => {
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')
    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map(v => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  const _getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')
  const _res = main(_getInput())

  if (typeof _res === 'number' || typeof _res === 'string') console.log(_res)
  if (typeof _res === 'object') console.log(_res.join(' '))
}


Measured memory_bytes: 11724
x = list(map(int,input().split()))
if x[0] == 0:
    print(1)
if x[1] == 0:
    print(2)
if x[2] == 0:
    print(3)
if x[3] == 0:
    print(4)
if x[4] == 0:
    print(5)

Measured memory_bytes: 61536
package main

import (
	"fmt"
)

func main() {
	var n int
	var hit bool
	fmt.Scan(&n)

	for i := 0; i <= n/4 && !hit; i++ {
		for j := 0; j <= n/7; j++ {
			if 4 * i + j * 7 == n {
				hit = true
				break
			}
		}
	}

	if hit {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

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

typedef signed long long ll;
const int MX = 1e5 + 5;

int main() {
	ll N, sq, ans = -1;
	cin >> N;
	sq = sqrt(N);
	for(ll i = 1; i <= sq; i++) {
		if (N % i == 0) {
			ll M = N / i;
			if(ans == -1) ans = i - 1 + M - 1;
			else ans = min(ans, i - 1 + M - 1);
		}
	}
	cout << ans << endl;
}

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

int N, Q;
int const INF = INT_MAX;
struct LazySegmentTree {
private:
    int n;
    vector<int> node, lazy;
    vector<bool> lazyFlag;

public:
    LazySegmentTree(vector<int> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1, INF);
        lazyFlag.resize(2*n-1, false);

        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }

    void lazy_evaluate(int k, int l, int r) {
        if(lazyFlag[k]) {
            node[k] = lazy[k];
            if(r - l > 1) {
                lazy[2*k+1] = lazy[k];
                lazy[2*k+2] = lazy[k];
                lazyFlag[2*k+1] = true;
                lazyFlag[2*k+2] = true;
            }
            lazyFlag[k] = false;
        }
    }

    void update(int a, int b, int x, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        lazy_evaluate(k, l, r);
        if(r <= a || b <= l) return;
        if(a <= l && r <= b) {
            lazy[k] = x;
            lazyFlag[k] = true;
            lazy_evaluate(k, l, r);
        }
        else {
            update(a, b, x, 2*k+1, l, (l+r)/2);
            update(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = min(node[k*2+1], node[k*2+2]);
        }
    }

    int find(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        lazy_evaluate(k, l, r);
        if(r <= a || b <= l) return INF;
        if(a <= l && r <= b) return node[k];
        int vl = find(a, b, 2*k+1, l, (l+r)/2);
        int vr = find(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
    }
};

int main() {
    cin >> N >> Q;
    LazySegmentTree seg( vector<int>(N, INF) );
    for(int i=0; i<Q; i++) {
        int query; cin >> query;
        if(query == 0) {
            int s, t, x; cin >> s >> t >> x;
            seg.update(s, t+1, x);
        }
        else {
            int i; cin >> i;
            cout << seg.find(i, i+1) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 5224
#include <iostream>
#include <map>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <deque>
#define mp make_pair
using namespace std;
int n,p,a[55],o,e;
long long pe[55][55];
int main(){
	for (int i=0;i<=50;i++){
		pe[i][0]=1;
		pe[i][i]=1; 
		for (int j=1;j<i;j++) pe[i][j]=pe[i-1][j]+pe[i-1][j-1];
	}
	cin>>n>>p;
	for (int i=0;i<n;i++) cin>>a[i];
	for (int i=0;i<n;i++) if (a[i]%2==0) e++; else o++;
	long long sum=0,sum2=1;
	if (p==0){
		int s=0;
		while (s<=o){
			sum+=pe[o][s];
			s+=2;
		}
		s=1;
		while (s<=e){
			sum2+=pe[e][s];
			s++;
		}
		sum*=sum2;
	}else{
		if (o==0){
			cout<<0;
			return 0;
		}
		int s=0;
		while (s<=o){
			sum+=pe[o][s]; 
			s+=2;
		}
		s=1;
		while (s<=e){
			sum2+=pe[e][s];
			s++;
		}
		sum*=sum2;
	}
	cout<<sum<<endl;
	return 0;
}

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

int main() {
    int N; cin >> N;
    vector<vector<int> > tree(N + 1);
    for (int i = 0; i < N - 1; i++) {
        int a, b; cin >> a >> b;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    vector<int> cs(N);
    for (int i = 0; i < N; i++) {
        cin >> cs[i];
    }
    sort(cs.begin(), cs.end(), greater<int>());

    vector<pair<int, int> > vande(N + 1);
    int v = 1; 
    int e = tree[1].size();
    for (int i = 1; i <= N; i++) {
        if (e < tree[i].size()) {
            v = i; e = tree[i].size();
        }
    }
    
    priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > q;
    vector<int> ans(N + 1);
    vector<bool> added(N + 1, false);
    added[v] = true;
    q.push({e, v});
    int waiwai = - cs[0];
    for (int i = 1; i <= N; i++) {
        int v = q.top().second;
        q.pop();
        ans[v] = cs[i-1];
        waiwai += cs[i-1];
        for (int a:tree[v]) {
            if (!added[a]) {
                added[a] = true;
                q.push({tree[a].size(), a});
            }
        }
    }
    cout << waiwai << endl;
    for (int i = 1; i <= N; i++) {
        printf("%d ", ans[i]);
    }
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x,n,a;
	pair<int,int>mi;
	mi.first=10000;mi.second=10000;
	set<int>s;
	cin>>x>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		s.insert(a);
	}
	for(int i=-100;i<200;i++){
		if(i>=0){
			if(s.count(i)) continue;
			if(mi.first>abs(i-x)){
				mi.first=abs(i-x);
				mi.second=i;
			}
		}else{
			if(mi.first>abs(i-x)){
				mi.first=abs(i-x);
				mi.second=i;
			}
		}
	}
	cout<<mi.second<<endl;
	return 0;
}


Measured memory_bytes: 3668
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
         try(Scanner sc = new Scanner (System.in)){
         int n = sc.nextInt();
         int [] a =new int[n];
            for(int i=0;i<a.length;i++){
                a[i]= sc.nextInt();
            }
            String delimiter = "";
            for(int i=a.length-1;i>=0;i--){
                System.out.print(delimiter);
                System.out.print(a[i]);
                delimiter = " ";
            }
        System.out.print("\n");
        sc.close();
        }    
    }
    
}
    


Measured memory_bytes: 26280
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
const ll Mod=1000000007;
const ll INF=999999999999999999;
const ll NN=(ll)(1e6+5);
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {
       ll n;
       cin>>n;
       vector <ll> v(n);
       ll gcd=-1;
       for(auto &u:v)
        cin>>u,gcd=(gcd==-1?u:hcf(gcd,u));
       if(gcd!=1)
        cout<<"not coprime";
       else
       {
           vector <set<ll>> sieve(NN);
           ll i,j;
           for(i=2;i<NN;i++)
           {
               if(!sieve[i].size())
               {
                   for(j=i;j<NN;j+=i)
                    sieve[j].insert(i);
               }
           }
           map<ll,ll> mp;
           for(i=0;i<n;i++)
           {
               for(auto u:sieve[v[i]])
                mp[u]++;
           }
           ll f=0;
           for(auto u:mp)
            if(u.ss>1)
            {
                f=1;
                break;
            }
           if(f)
            cout<<"setwise coprime";
           else
            cout<<"pairwise coprime";  
       }  
   }
}

Measured memory_bytes: 196632
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#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 srep2(j,s,t) for (int j = s; j < t; ++j)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

int main() {
  int N;
  cin >> N;
  float xf[N];
  bool isJPY[N];
  rep(i,N){
    float x;
    string u;
    cin >> x >> u;
    if(u == "JPY") {
      xf[i] = (int)x;
    } else {
      xf[i] = x * 380000;
    } 
  }
  float ans = 0;
  rep(i,N) {
    ans += xf[i];
  }
  cout << ans << endl;

  return 0;
}

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

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

using namespace std;

int h, w;
char a[100][101];
int ex, ey;
int c[101][101];
int dp[100][100][100][100];

int box(int x, int y, int z, int w){
	return c[z][w] - c[z][y] - c[x][w] + c[x][y];
}

int main(){
	cin >> h >> w;
	rep(i, h){
		cin >> a[i];
		rep(j, w){
			if(a[i][j] == 'E'){
				ex = i;
				ey = j;
			}
			else if(a[i][j] == 'o'){
				c[i + 1][j + 1] = 1;
			}
		}
	}

	rep(i, h + 1){
		for(int j = 1; j <= w; ++j){
			c[i][j] += c[i][j - 1];
		}
	}
	for(int i = 1; i <= h; ++i){
		rep(j, w + 1){
			c[i][j] += c[i - 1][j];
		}
	}

	int ans = 0;
	rep(i, ex + 1){
		rep(j, h - ex){
			rep(k, ey + 1){
				rep(l, w - ey){
					ans = max(dp[i][j][k][l], ans);

					if(l < w - k && j < h - i){
						int p = max(ex - i, j);
						int q = min(ex + j + 1, h - i);
						int r = max(ey - k, l);
						int s = min(ey + l + 1, w - k);

						if(r <= s && p <= q){
							if(j < p){
								dp[i + 1][j][k][l] = max(dp[i + 1][j][k][l], box(p - 1, r, p, s) + dp[i][j][k][l]);
							}
							if(q < h - i){
								dp[i][j + 1][k][l] = max(dp[i][j + 1][k][l], box(q, r, q + 1, s) + dp[i][j][k][l]);
							}
							if(l < r){
								dp[i][j][k + 1][l] = max(dp[i][j][k + 1][l], box(p, r - 1, q, r) + dp[i][j][k][l]);
							}
							if(s < w - k){
								dp[i][j][k][l + 1] = max(dp[i][j][k][l + 1], box(p, s, q, s + 1) + dp[i][j][k][l]);
							}
						}
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

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

  string answer = "APPROVED";
  
  for (int i = 1; i <= N; i++)  {  
    int Ai;
    cin >> Ai;
    
    if(Ai % 2 == 0) {
      if(Ai % 3 != 0) {
        if(Ai % 5 != 0){
          answer = "DENIED";
        }
      }
    }
  }
  
  cout << answer << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <array>
#include <algorithm>
#include <set>
#include <iomanip>
#include <cstdio>
#include <queue>

using namespace std;

#define int long long

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

    signed n;
    
    set<int> s;

    cin >> n;

    for (int i = 0; i < n; ++i)
    {
        int in;
        cin >> in;

        s.insert(in);
    }
   
    cout << s.size() << endl;
}

Measured memory_bytes: 256
using System;
using System.Text;

namespace aizu
{
    class OnlineJudge
    {
        static void Main()
        {
            int count;
            while((count = int.Parse(Console.ReadLine())) != 0) {
                string input = Console.ReadLine();
                for(int i=0; i < count; ++i) {
                    input = Convert(input);
                }
                Console.WriteLine(input);
            }
        }
        static string Convert(string input)
        {
            StringBuilder result = new StringBuilder();
            for(int i=input.Length - 1; i >= 0; --i) {
                int count = 1;
                result.Insert(0, input[i]);
                while(i > 0 && input[i] == input[i - 1]) {
                    ++count;
                    --i;
                }
                result.Insert(0, count);
            }
            return result.ToString();
        }
    }
}

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

int main(){
    int a,b;cin>>a>>b;
 
    b=b+a*3;
    cout<<b/2;
}

Measured memory_bytes: 3548
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography.X509Certificates;


    public class Program
    {
        public static void Main(string[] args)
        {
            new A().test();
        }
    }

    public class A
    {
        public void test()
        {
            // 普通の数値
            var zero = CommonRead.ReadInt();

            if (zero == 0)
            {
                Console.WriteLine(1);
            }
            else
            {
                Console.WriteLine(0);
            }

        }
    }


    static class CommonRead
    {
        public static string ReadStr()
        {
            return Console.ReadLine();
        }
        public static string[] ReadStrA()
        {
            return ReadStr().Split(' ');
        }
        public static List<string> ReadStrL()
        {
            return ReadStrA().ToList();
        }
        public static int ReadInt()
        {
            return Convert.ToInt32(ReadStr());
        }
        public static int[] ReadIntA()
        {
            return ReadStrA().Select(s => Convert.ToInt32(s)).ToArray();
        }
        public static List<int> ReadIntL()
        {
            return ReadStrA().Select(s => Convert.ToInt32(s)).ToList();
        }
        public static long ReadLong()
        {
            return Convert.ToInt64(ReadStr());
        }
        public static long[] ReadLongA()
        {
            return ReadStrA().Select(s => Convert.ToInt64(s)).ToArray();
        }
        public static List<long> ReadLongL()
        {
            return ReadStrA().Select(s => Convert.ToInt64(s)).ToList();
        }

        public static decimal ReadDecimal()
        {
            return Convert.ToDecimal(ReadStr());
        }
        public static decimal[] ReadDecimalA()
        {
            return ReadStrA().Select(s => Convert.ToDecimal(s)).ToArray();
        }
        public static List<decimal> ReadDecimalL()
        {
            return ReadStrA().Select(s => Convert.ToDecimal(s)).ToList();
        }

        public static double ReadDouble()
        {
            return Convert.ToDouble(ReadStr());
        }
        public static double[] ReadDoubleA()
        {
            return ReadStrA().Select(s => Convert.ToDouble(s)).ToArray();
        }
        public static List<double> ReadDoubleL()
        {
            return ReadStrA().Select(s => Convert.ToDouble(s)).ToList();
        }


}

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

using namespace std;

typedef long long ll;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

ll calc(ll x){
	ll ret = 1;
	while(x > 0){
		int bc = __builtin_popcount(x);
		x %= bc;
		ret++;
	}

	return ret;
}

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

	int n;
	cin >> n;

	string s;
	cin >> s;

	ll cnt = 0;
	rep(i, n) if(s[i] == '1') cnt++;
	ll pos = cnt + 1;
	ll neg = cnt - 1;
	
	vector<ll> dpos(n, 0);
	vector<ll> dneg(n, 0);
	ll posall = 0;
	ll negall = 0;

	dpos[n-1] = 1ll;
	dneg[n-1] = 1ll;
	for(int i = n - 1; i >= 0; i--){
		if(s[i] == '1'){
			posall += dpos[i];
			posall %= pos;
			if(neg > 0){
				negall += dneg[i];
				negall %= neg;
			}
			
		}
		if(i > 0) {
			dpos[i-1] = dpos[i] * 2;
			dpos[i-1] %= pos;
		}
		if(neg > 0){
			if(i > 0){
				dneg[i-1] = dneg[i] * 2;
				dneg[i-1] %= neg;
			}	
		}
	}

	rep(i, n){
		ll x;
		if(s[i] == '1'){
			if(neg == 0){
				cout << 0 << "\n";
				continue;
			}
			
			// neg
			x = negall + neg - dneg[i];
			x %= neg;
		}else{
			// pos
			x = posall + dpos[i];
			x %= pos;
		}

		cout << calc(x) << "\n";
	}
}


Measured memory_bytes: 6728
def judge(S,A,B):
  a = list(S)
  front = a[0:A]
  back = a[A+1:A+B+1]
  lst = ["0","1","2","3","4","5","6","7","8","9"]
  for i in range(A):
    if front[i] not in lst:
      print("No")
      return
            
  for j in range(B):
    if back[j] not in lst:
      print("No")
      return
            
  if a[A]!="-":
    print("No")
    return
  
  print("Yes")
  
A,B = map(int,input().split())
S = input()
judge(S,A,B)

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

int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  
  if(A+B > C+D){
    cout << "Left" << endl;}
  
  if(A+B == C+D){
    cout << "Balanced" << endl;}
  
  if(A+B < C+D){
    cout << "Right" << endl;}
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;

/*int P[10010];
void init(int n){
    for(int i=0;i<n;++i)P[i]=i;
}
int root(int a) {
    if(P[a]==a)return a;
    return (P[a]=root(P[a]));
}
bool is_same_set(int a,int b){
    return root(a) == root(b);//代表元を求める
}
void unite(int a,int b){
    P[root(a)]=root(b);
}//対set,グラフ？
//セグメント木？？？
*/

double dot_product(xy_t a, xy_t b) { return (conj(a)*b).real(); }//内積
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }//外積
xy_t projection(xy_t p, xy_t b) { return b*dot_product(p,b)/norm(b); }//投影
//対図形

#define mod 1000000007
/*ll f[2001];
//int n,k とかしておく

ll pw(ll x, ll y){//euclidの互除法より
    ll a= 1;
    while(y){
        if(y&1){//奇数なら
            a = a*x%mod;
        }
        x = x*x%mod;
        y /= 2;
    }
    return a;
}

ll modinv(ll x){//逆元を求める
    return pw(x, mod - 2 );
}

ll comb(int n,int r){
    if(n<r){
        return 0;
    }
    return f[n] * modinv(f[r])%mod*modinv(f[n-r])%mod;
}//対combination//ただしfは用意してね
*/

struct BIT{
    vector<int> dat;
    int sz;
    BIT(int n){
        for(sz=1;sz<n;sz *= 2);
        dat.resize(++sz);
    }
    int q(int n){
        int ret = 0;
        for(int i=n;i>0;i-=i&-i)ret +=dat[i];//和の計算　iから最後の１のbit(i&-i 多分＆はビット積)を減算
        for(int i=n;i<sz;i+=i&-i) dat[i]++;//値の加算　iから最後mの１のbitを加算
        return ret;
    }
};

int main(){
    int m,k;
    cin >> m>>k;
    if(m==0){
        if(k==0){
            cout<<0<<" "<<0<<endl;
            return 0;
        }else{
            cout<<-1<<endl;
            return 0;
        }
    }else if(m==1){
        if(k!=0){
            cout<<-1<<endl;
            return 0;
        }
    }else{
        if(k>=pow(2,m)){
            cout<<-1<<endl;
            return 0;
        }
    }
    if(k==0){
        rep(i,pow(2,m)){
            if(i==pow(2,m)-1){
                cout<<i<<" "<<i;
                continue;
            }
            cout<<i<<" "<<i<<" ";
            
        }
        cout<<endl;
        return 0;
    }else{
        rep(i,pow(2,m)){
            if(k==i)continue;
            cout<<i<<" ";
        }
        cout<<k<<" ";
        rep(i,pow(2,m)){
            if(pow(2,m)-i-1==k)continue;
            cout<<pow(2,m)-i-1<<" ";
        }
        cout<<k<<endl;
        return 0;
    }
}

Measured memory_bytes: 1920
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=10007
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,k=map(int,input().split())
h=list(map(int,input().split()))

dp=[float('inf')]*n
dp[0]=0
for i in range(n):
    for j in range(k):
        # nex=i+j+1
        if i+j+1<n:
            dp[i+j+1]=min(dp[i+j+1],dp[i]+abs(h[i]-h[i+j+1]))
    # print(dp)
print(dp[-1])

Measured memory_bytes: 81012