akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int dp[3000][3000];
int go(int i, int j)
{
    if (i==s1.size() || j==s2.size())
        return 0;
    if (dp[i][j]!=-1)
        return dp[i][j];
    dp[i][j]=0;
    if (s1[i]==s2[j])
        return dp[i][j]=1+go(i+1, j+1);
    else
        return dp[i][j]=max(go(i, j+1), go(i+1, j));
}
void build(int i, int j)
{
    if (i==s1.size() || j==s2.size())
        return;
    if (s1[i]==s2[j])
    {
        cout << s1[i];
        build(i+1, j+1);
    }
    else
        if (dp[i][j]==dp[i+1][j])
            build(i+1, j);
        else if (dp[i][j]==dp[i][j+1])
            build(i, j+1);
}
int main()
{
    cin >> s1 >> s2;
    memset(dp, -1, sizeof dp);
    int n=go(0, 0);
    int a, b;
    for (int i=0 ; i<s1.size() ; i++)
        for (int j=0 ; j<s2.size() ; j++)
            if (dp[i][j]==n)
            {
                a=i, b=j;
                break;
            }
    build(a, b);
    return 0;
}


Measured memory_bytes: 35712
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    x,y=MI()
    if (y-2*x)%2==0 and (y-2*x)//2>=0 and x-(y-2*x)//2>=0:print("Yes")
    else:print("No")

main()

Measured memory_bytes: 9144
import java.util.*;

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

        int price = 700;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'o') {
                price += 100;
            }
        }
        System.out.println(price);
    }
}


Measured memory_bytes: 23124
A, B, C, D = [int(s) for s in input()]


def exec(x, y, op):
    if op == '+':
        return x + y
    else:
        return x - y

for op1 in ['+', '-']:
    for op2 in ['+', '-']:
        for op3 in ['+', '-']:
            if exec(exec(exec(A, B, op1), C, op2), D, op3) == 7:
                print('{A}{op1}{B}{op2}{C}{op3}{D}=7'.format(
                    A=A,
                    B=B,
                    C=C,
                    D=D,
                    op1=op1,
                    op2=op2,
                    op3=op3
                ))
                exit()


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

int main(){
    int A, B, C, N;
    B = 10000;
    cin >> N;

    vector<int> W(N);

    for(int i = 0; i < N; i++){
        cin >> W.at(i);
    }

for(int t = 0; t < N; t++){
    int sum1 = 0;
    int sum2 = 0;
    for(int i = 0; i < t; i++){
        sum1+=W[i];
    }
    for(int i = t; i < N; i++){
        sum2+=W[i];
    }
    B = min(abs(sum1-sum2), B);
}
    cout << B << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define REP(var,init,cnt) for(int (var)=(init); (var)<(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define TF(flag) (flag)?1:0
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

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

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ================================================

// Template End ======================================================

int main(void){
  int a,b; cin>>a>>b;
  a=(a==1?14:a),b=(b==1?14:b);
  if(a>b) cout<<"Alice";
  else if(a<b) cout<<"Bob";
  else cout<<"Draw";
}














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

int main(int argc, char *argv[])
{
	int sec;
	char buf[100];

	scanf("%s", buf);

	sec = atoi(buf);

	printf("%d:%d:%d\n", sec / 3600, (sec%3600)/60 , sec%60);

	return 0;
}

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

public class Main{
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split(" ");
			int n = Integer.parseInt(chr[0]);
			int a = Integer.parseInt(chr[1]);
			int b = Integer.parseInt(chr[2]);

			 System.out.println(Math.min(n*a, b));
		}
	}
}

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

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define F first
#define S second
#define INF ll(1e18)
#define MOD 1000000007
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 100005

struct Maths
{
	vector<ll> fact,ifact,inv,pow2;
	ll add(ll a,ll b)
	{
		a+=b;a%=MOD;
		if(a<0) a+=MOD;
		return a;
	}
	ll mult(ll a, ll b)
	{
		a%=MOD; b%=MOD;
		ll ans=(a*b)%MOD;
		if(ans<0) ans+=MOD;
		return ans;
	}
	ll pw(ll a, ll b)
	{
		ll r=1;
		while(b){
			if(b&1) r=mult(r,a);
			a=mult(a,a);
			b>>=1;
		}
		return r;
	}
	ll choose(ll a, ll b)
	{
		if(a<0 || b<0) return 0;
		if(a<b) return 0;
		if(b==0) return 1;
		if(a==b) return 1;
		return mult(fact[a],mult(ifact[b],ifact[a-b]));
	}
	ll inverse(ll a)
	{
		return pw(a,MOD-2);
	}
	void init(ll _n)
	{
		fact.clear(); ifact.clear(); inv.clear(); pow2.clear();
		fact.resize(_n+1); ifact.resize(_n+1); inv.resize(_n+1); pow2.resize(_n+1);
		pow2[0]=1; ifact[0]=1; fact[0]=1;
		for(int i=1;i<=_n;i++){
			pow2[i]=add(pow2[i-1],pow2[i-1]);
			fact[i]=mult(fact[i-1],i);
		}
		ifact[_n] = inverse(fact[_n]);
		for(int i=_n-1;i>=1;i--){
		    ifact[i] = mult(ifact[i + 1], i + 1);
		}
		for(int i=1;i<=_n;i++){
		    inv[i] = mult(fact[i-1],ifact[i]);
		}
	}
	
	void getpf(vector<ii>& pf, ll n)
	{
		for(ll i=2; i*i<=n; i++)
		{
			int cnt=0;
			while(n%i==0){
				n/=i; cnt++;
			}
			if(cnt>0) pf.pb({i,cnt});
		}
		if(n>1) pf.pb({n,1});
	}
};

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	Maths ma; ma.init(100001);
	
	int n,k; cin>>n>>k;
	ll a[n];
	vector<ii> uniq;
	
	forn(i,0,n){
		cin>>a[i];
	}
	
	sort(a,a+n);
	
	ll Max=0,Min=0;
	
	forn(i,0,n){
		Max=ma.add(Max,ma.mult(a[i],ma.choose(i,k-1)));
		Min=ma.add(Min,ma.mult(a[i],ma.choose(n-i-1,k-1)));
	}
	
	cout<<ma.add(Max,-Min)<<'\n';
	
	return 0;
}


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


using namespace std;
using ll = long long;

#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define trav(a, x) for(auto& a: x)

char arr[26];

int main () {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    
    arr[0] = 'z';
    int i = 1;
    for (char c = 'a'; c < 'z'; ++c){
        arr[i] = c;
        ++i;
    }

    ll n; cin>> n;
    string ans = "";
    while (n) {
        if (n%26 == 0) {
            ans += arr[0];
            n /= 26;
            n--;
        }else {
            ans += arr[n%26];
            n /= 26;
        }
    }

    reverse(all(ans));
    cout << ans << '\n';
    

    

    return 0;
}



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

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

        int a=0;
        int b=0;
        if(s[0]=='A'){
            a=1;
        }else if(s[0]=='B'){
            b=1;
        }

        if(s[1]=='A'){
            a=1;
        }else if(s[1]=='B'){
            b=1;
        }

        if(s[2]=='A'){
            a=1;
        }else if(s[2]=='B'){
            b=1;
        }

        if(a==1&&b==1){
            cout<<"Yes";
        }else{
            cout<<"No";
        }
        return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
//////////////////////////////////////////////////
int main(){
    int N;
    vector<int> a;
    int x;
    int ans = 0;

    SCD2(N,x);
    REP(i,N){
        int y; SCD(y);
        a.PB(y);
    }

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

    REP(i,N-1){
        if (a[i] <= x){
            ans++;
            x -= a[i];
        }else{
            PRINTD(ans);
            return 0;
        }
    }

    if (a[N-1] == x) ans++;

    PRINTD(ans);
}

Measured memory_bytes: 256
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";var r=n(1);n(2)(r.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,n){"use strict";var r=n(3),i=n(5);t.exports=function(t){var e=new r(t);i(e)}},function(t,e,n){"use strict";var r=n(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new r(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,n){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,n){"use strict";t.exports=function(t){var e=t.inr();"SUN"!=e?"MON"!=e?"TUE"!=e?"WED"!=e?"THU"!=e?"FRI"!=e?"SAT"!=e||console.log(1):console.log(2):console.log(3):console.log(4):console.log(5):console.log(6):console.log(7)}}]);


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


//double dp[3000][3000];


double coins(int n, vector<double>& p){
    /*
    if(i < k || k < 0) return 0;
    if(i==1 && k==1) return p[0];
    if(i==1 && k==0) return(1-p[0]);
    
    if(dp[i][k] != 0) return dp[i][k];
    
    else{
        dp[i][k] = (p[i-1]*coins(i-1,k-1,p) + (1-p[i-1])*coins(i-1,k,p));
        return dp[i][k];
    } */
    
    double dp[n+1][n+1] = {};
    dp[1][0] = 1-p[0];
    dp[1][1] = p[0];
    
    for(int i = 2;i <= n; i++){
        dp[i][0] = (1-p[i-1])*dp[i-1][0];
        for(int j = 1; j <= i; j++){
            dp[i][j] = p[i-1]*dp[i-1][j-1] + (1-p[i-1])*dp[i-1][j];
        }
    }
    
    double sum = 0;
    for(int i = n/2 + 1 ; i <=n; i++) sum += dp[n][i];
    
    return sum;
}




int main(){
    int n; cin >> n;
    vector<double> p(n);
    for(int i = 0; i < n; i++) cin >> p[i];

    cout << fixed << setprecision(10) << coins(n,p);
    return 0;
}

Measured memory_bytes: 74104
// E - Red and Green Apples
#include <bits/stdc++.h>
using namespace std;
int in(){int x;cin>>x;return x;}

int main(){
	int X,Y,A,B,C; cin>>X>>Y>>A>>B>>C;
	int N = X + Y;
	priority_queue<int> P,Q,R,T;
	while(A--) P.push(in());
	while(B--) Q.push(in());
	while(X--){ T.push(P.top()); P.pop(); }
	while(Y--){ T.push(Q.top()); Q.pop(); }
	while(C--) T.push(in());
	long long ans = 0;
	while(N--){ ans += T.top(); T.pop(); }
	cout<< ans <<endl;
}

Measured memory_bytes: 3188
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,w = LI()
    aa = sorted([LI() for _ in range(n)])
    u = sum(map(lambda x: x[1], aa))
    r = [inf] * (u+1)
    r[0] = 0
    mx = 0
    for a,b in aa:
        mx += b
        for i in range(min(mx, u-b),-1,-1):
            if r[i+b] > a + r[i]:
                r[i+b] = a + r[i]

    for i in range(u,0,-1):
        if r[i] <= w:
            return i

    return 0


print(main())


Measured memory_bytes: 8108
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*



*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, q ;
  cin >> n >> q ;
  vint num(n,0) ;
  vint seen(n,0) ;
  stack<int> S ;
  vint ans(n,0) ;
  vector<queue<int>> gra(n) ;
  
  REP(i,n-1){
    int a, b ;
    cin >> a >> b ;
    gra[a-1].push(b-1) ;
    gra[b-1].push(a-1) ;
  }
  REP(i,q){
    int c, d ;
    cin >> c >> d ;
    num[c-1] += d ;
  }
  
  S.push(0) ;
  seen[0] = 1 ;
  ans[0] = num[0] ;
  
  while(!S.empty()){
    int k = S.top() ;
    
    while(1){
      if(gra[k].empty()){
        S.pop() ;
        break ;
      }
      int l = gra[k].front() ;
      if(seen[l]==1){
        gra[k].pop() ;
        continue ;
      }
      else{
        S.push(l) ;
        gra[k].pop() ;
        seen[l] = 1 ;
        ans[l] = num[l] + ans[k] ;
        break ;
      }
    }
  }
  
  REP(i,n-1){
    cout << ans[i] <<" " ;
  }
  cout << ans[n-1] <<endl ;
    
      
    
    
  
  
  return 0 ;
}

Measured memory_bytes: 139804
#!/usr/local/bin/python3

from sys import stdin
import sys


A, B, C, D = list(map(int, stdin.readline().rstrip().split()))

while A > 0 and C > 0:
    C -= B
    if C <= 0:
        print('Yes')
        sys.exit()

    A -= D
    if A <= 0:
        print('No')
        sys.exit()



Measured memory_bytes: 9108
#include<stdio.h>
#include<stdlib.h>
#define N 101
#define E 200001
int main(){
  int i,j,min,p,q,l,n;
  int a[N][N],d1[N],d2[N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    d1[i]=0;
    d2[i]=E;
    for(j=0;j<n;j++){
      a[i][j]=-1;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&p,&q);
    for(j=0;j<q;j++){
      scanf("%d",&l);
      scanf("%d",&a[p][l]);
    }
  }
  d2[0]=0;
  while(1){
    min=E;
    for(i=0;i<n;i++){
      if(d1[i]!=1&&d2[i]<min){
        min=d2[i];
        p=i;
      }
    }
    if(min==E){
      break;
    }
    for(i=0;i<n;i++){
      if(a[p][i]!=-1&&d1[i]!=1&&d2[p]+a[p][i]<d2[i])
      d2[i]=d2[p]+a[p][i];
    }
d1[p]=1;
}
for(i=0;i<n;i++){
printf("%d %d\n",i,d2[i]);
}
return 0;
}



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

using namespace std;

const int INF=1e9+5;

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

    vector<int>dp(n,INF);
    dp[0]=0;
    for(int i=0;i<n;i++)
    {
         for(int j:{i+1,i+2})
         {
             if(j<n)
                 dp[j]=min(dp[j],dp[i]+(abs(h[i]-h[j])));

         }
    }

    cout<<dp[n-1]<<"\n";
    return 0;
}


Measured memory_bytes: 3968
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;

#define mp make_pair
#define pb push_back
#define x first
#define y second

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

char s[25];

int main()
{
	scanf("%s",s);int n=strlen(s);
	for (int i=0;i<n-3&&i<1;i++)
		if (s[i]=='Y'&&s[i+1]=='A'&&s[i+2]=='K'&&s[i+3]=='I') {puts("Yes");return 0;}
	puts("No");
	return 0;
}


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

using namespace std;

typedef long long	ll;

const int N = 310;
int a[N];
ll dp[N][N * N];
const ll mod = 998244353LL;
ll dp2[N][N * N * 2 + 10];
const int start = N * N;
int n;
int tot;

ll solve1(int i, int sum){
	if(i == n){
		return sum >= (tot + 1) / 2;
	}
	
	ll &ans = dp[i][sum];
	
	if(ans != -1LL){
		return ans;
	}
	
	ans = (solve1(i + 1, sum + a[i]) + 2LL * solve1(i + 1, sum)) % mod;
	
	return ans;
}

ll solve2(int i, int sum){
	if(i == n){
		return sum == start;
	}
	
	ll &ans = dp2[i][sum];
	
	if(ans != -1LL){
		return ans;
	}
	
	ans = (solve2(i + 1, sum - a[i]) + solve2(i + 1, sum + a[i])) % mod;
	
	return ans;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	memset(dp, -1LL, sizeof dp);
	memset(dp2, -1LL, sizeof dp2);
	
	cin >> n;
	
	ll pot = 1LL;
	
	for(int i = 0 ; i < n ; i++){
		cin >> a[i];
		tot += a[i];
		pot = (3LL * pot) % mod;
	}
	
	ll a = solve1(0, 0);
	//cout << "a = " << a << " " << tot << endl;
	a = (a - 1LL + mod) % mod;
	
	ll b = solve2(0, start);
	
	a = (3LL * a) % mod;
	b = (3LL * b) % mod;
	
	a = (a + 3LL) % mod;
	
	cout << ((pot - (a - b)) % mod + mod) % mod << endl;
	
	return 0;
}

Measured memory_bytes: 698624
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
--import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import GHC.ST
-- import System.IO.Unsafe

-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
-- templete

f s = fromMaybe "NG" $ "OK" <$ foldM (\x d -> mfilter (<=150) (Just $ x+d)) 0 s

main = do
    n <- getInt
    unless (n==0) $ map snd . sort . concat . map (\[m,a,b] -> [(a,m), (b,-m)]) <$> replicateM n getInts >>= putStrLn . f >> main


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

int main(){
  int N, X, T;
  cin >> N >> X >> T;
  
  if(N % X == 0){
    cout << T * (N / X) << endl;
  }else{
    cout << T * ((N / X) + 1) << endl;
  }
}

Measured memory_bytes: 3616
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 998244353;
const ll MAX = 200001;

ll mod(ll a){
  return a % MOD;
}

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

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

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}
int main(){
  ll n,m,t; cin >> n >> m >> t; ll minmoney = INT_MAX;
  vvl table(n,vl(m+1));
  
  rep(i,n){
    rep(j,m+1){
      cin >> table[i][j];
    }
  }
  
   for (int bit = 0; bit < (1<<n); ++bit) {
        vector<ll> S;
     	vector<ll> manabi(m,0);
        for (int i = 0; i < n; ++i) {
            if (bit & (1<<i)) { // 列挙に i が含まれるか
                S.push_back(i);
            }
        }

     	ll moneysum = 0;
        for (ll x: S){
          
          for(ll i=0; i < m; i++){
            manabi[i] += table[x][i+1];
          }
          moneysum += table[x][0];
        }
     
     bool flag = true;
     for(ll i=0; i < m; i++){
         if(manabi[i] < t){
           flag = false;
           break;
         }
     }
     
     if(flag) minmoney = min(moneysum,minmoney);
   }
  
  if(minmoney == INT_MAX) cout << -1 << endl;
  else cout << minmoney << endl;
  
  
}
     
     

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
using namespace std;

int main(void){
    int a, b;
    cin >>a >> b;
    int x = (a-2*b);
    if(x > 0)
        cout << x << endl;
    else
        cout << 0 << endl;
}

Measured memory_bytes: 256
a,b,k = map(int,input().split())
li = []
x = 0
while a + x <= b and b - x >= a and x <= k-1 :
    li.append(a+x)
    li.append(b-x)
    x += 1
se = set(li)
li = list(se)
li.sort()
for i in li :
    print(i)

Measured memory_bytes: 3064
N,M=map(int,input().split())
sc = [list(map(int, input().split())) for _ in range(M)]
a=str(0)*N#各桁に0を入力
A=[a[i] for i in range(len(a))]
x=0
#print(sc)
b=[]#出現した桁を格納
c=[]#出現した桁の数を格納
for i in range(M):
    if (sc[i][0] == 1) and (sc[i][1]==0) and (N!=1):#2桁以上で先頭に0ある時
        x=-1#ERRORループを抜ける
        break
    else:
        if (sc[i][0]) in b:#左から何桁目の情報が既にある場合、既に登録されているその桁の値と新たに登録しようとしてるその桁の値が異なるとき弾く
            if sc[i][1]!=int(c[b.index(sc[i][0])]):#同じ桁に違う数が入る時
                #print(c[b.index(sc[i][0])])
                x=-1#ERROR
                break
        else:#該当する桁に数がない時
            A[sc[i][0]-1]=str(sc[i][1])#桁に値を入力
            b.append(sc[i][0])#桁の入力
            c.append(sc[i][1])#数の入力
if x==-1:#error
    print(-1)      
elif b==[] and (N!=1):#Nが1でなく桁の宣言がない時
    if N==2:
        print(10)
    elif N==3:
        print(100)
elif (1 not in b) and(N!=1):#1番上の位の宣言がない時
    A[0]=str(1)
    a="".join(A)
    print(a)
elif  (1 not in b) and (2 not in b) and (N==3):
    A[0]=str(1)
    A[1]=str(0)
    a="".join(A)
    print(a)

else:
    a="".join(A)
    print(a)


Measured memory_bytes: 3188
const mod = BigInt(10**9 + 7)

const pow = (x, n) => {
  let r = 1n

  for (let i=0; i<n; i++)
    r = r * x % mod

  return r
}

const main = (input) => {
  const n = BigInt(input.trim())

  let a = pow(10n, n)
  let bc = pow(9n, n)
  let d = pow(8n, n)

  const ans = (a-bc-bc+d) % mod
  return console.log(`${(ans + mod) % mod}`)
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 35044
n,k=map(int,input().split())
X=list(map(int,input().split()))
ans=10**9
for i in range(n-k+1):
  l=X[i]
  r=X[i+k-1]
  route1=abs(l)+r-l
  route2=abs(r)+r-l
  tmp=min(route1,route2)
  ans=min(ans,tmp)
print(ans)

Measured memory_bytes: 14224
#include	<iostream>
#include	<cstdio>
#include	<algorithm>

using namespace std;

short inkmap[10][10] = { 0 };

void drawSmall(int, int);
void drawMedium(int, int);
void drawLarge(int, int);
void sch(short *, short *);

int main(void) {
	short mx = 0, buff[3], c = 0;
	
	while( scanf("%d,%d,%d", &buff[0], &buff[1], &buff[2]) != EOF ) {
		switch(buff[2]) {
		case 1:
			drawSmall(buff[0], buff[1]);		break;
		case 2:
			drawMedium(buff[0], buff[1]);		break;
		case 3:
			drawLarge(buff[0], buff[1]);		break;
		}
	}
	sch(&c, &mx);
	cout << c << endl << mx << endl;
}

void drawSmall(int x, int y) {
	const short vX[5] = { 0, -1, 0, 1, 0 };
	const short vY[5] = { -1, 0, 0, 0, 1 };
	int nX, nY;
	for(int i = 0; i < 5; i++) {
		nX = x + vX[i], nY = y + vY[i];
		if( ( 0 <= nX && nX < 10 ) && ( 0 <= nY && nY < 10 ) )
		inkmap[nX][nY]++;
	}
}
void drawMedium(int x, int y) {
	const short vX[9] = { -1, 0, 1, -1, 0, 1, -1, 0, 1 };
	const short vY[9] = { -1, -1, -1, 0, 0, 0, 1, 1, 1 };
	int nX, nY;
	for(int i = 0; i < 9; i++) {
		nX = x + vX[i], nY = y + vY[i];
		if( ( 0 <= nX && nX < 10 ) && ( 0 <= nY && nY < 10 ) )
		inkmap[nX][nY]++;
	}
}
void drawLarge(int x, int y) {
	const short vX[13] = { 0, -1, 0, 1, -2, -1, 0, 1, 2, -1, 0, 1, 0 };
	const short vY[13] = { -2, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 2 };
	int nX, nY;
	for(int i = 0; i < 13; i++) {
		nX = x + vX[i], nY = y + vY[i];
		if( ( 0 <= nX && nX < 10 ) && ( 0 <= nY && nY < 10 ) )
		inkmap[nX][nY]++;
	}
}
void sch(short *c, short *m) {
	for(int i = 0; i < 10; i++) {
		for(int j = 0; j < 10; j++) {
			if(inkmap[i][j] == 0) {
				(*c)++;
			}
			else {
				*m = max(*m, inkmap[i][j]);
			}
		}
	}
}

Measured memory_bytes: 1208
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define link(x) for(edge *j=h[x];j;j=j->next)
#define inc(i,l,r) for(int i=l;i<=r;i++)
#define dec(i,r,l) for(int i=r;i>=l;i--)
const int MAXN=3e5+10;
const double eps=1e-8;
const int mod=1e9+9;
#define ll long long
using namespace std;
struct edge{int t,v;edge*next;}e[MAXN<<1],*h[MAXN],*o=e;
void add(int x,int y,int vul){o->t=y;o->v=vul;o->next=h[x];h[x]=o++;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    return x*f;
}



int k,a,b;
int main(){
    k=read();a=read();b=read();
    int x=b/k*k;
    if(x>=a)puts("OK");
    else puts("NG");
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm/reverse.hpp>
using namespace std;
int main() {
    string S, T; cin >> S >> T;
    boost::sort(S);
    boost::sort(T); boost::reverse(T);
    if (S < T) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;
 
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; }
 
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

signed main()
{
  int n,k; cin>>n>>k;
  vi v(n);
  rep(i,n) cin>>v[i];
  
  int ans=0;
  for(int l=0; l<=k; l++){
    for(int r=0; r<=k-l; r++){
      if(l+r>n)continue;
      int d=min(k-r-l,r+l);
      int now=0;
      vi s;
      rep(i,l){
        now+=v[i];
        s.push_back(v[i]);
      }
      for(int i=n-1; i>=n-r; i--){
        now+=v[i];
        s.push_back(v[i]);
      }
      sort(s.begin(),s.end());
      rep(i,d){
        if(s[i]>=0)break;
        now-=s[i];
      }
      chmax(ans,now);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define SORT(i) sort((i).begin(),(i).end())
#define INF 2000000000
constexpr ll mod = 1000000007;

int main() {
	string a, b;
	cin >> a >> b;
	reverse(b.begin(), b.end());
	if (a == b) {
		cout << "YES" << "\n";
	}
	else {
		cout << "NO" << "\n";
	}

	return 0;
}

Measured memory_bytes: 256
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def change_color(t):
    if t == '0':
        return '1'
    return '0'


def solve(inputs):
    tiles = list(inputs[0])
    tiles = [x == "1" for x in tiles]

    diff_num_1 = 0
    diff_num_2 = 0
    state_1 = True
    state_2 = False

    for t in tiles:
        if t != state_1:
            diff_num_1 += 1
        if t != state_2:
            diff_num_2 += 1

        state_1 = not state_1
        state_2 = not state_2
    return min(diff_num_1, diff_num_2)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


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

int main() {
    int k, A, B;    cin >> k >> A >> B;
    int a = ceil(1.0 * A / k), b = float(1.0 * B / k);
    puts(a <= b ? "OK" : "NG");
    return 0;
}

Measured memory_bytes: 3436
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;scanf("%d",&N);
    int S[N];
    for(int i=0;i<N;i++)scanf("%d",&S[i]);
    int Q;scanf("%d",&Q);
    int ans=0;
    for(int i=0;i<Q;i++){
        int t;scanf("%d",&t);
        int left=0,right=N;
        while(right-left>1){
            int middle=(left+right)/2;
            if(S[middle]<=t)left=middle;
            else right=middle;
        }
        if(S[left]==t)ans++;
    }
    printf("%d\n",ans);
    return 0;
}


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

int main(){
  int k,s;cin>>k>>s;
  int n=0;
  for(int i=0;i<=k;i++){
    for(int j=0;j<=k;j++){
      // for(int l=0;l<=k;l++){
      //   if(i+j+l==s)n++;
      // }
      int z=s-i-j;
      if(0<=z&&z<=k){
        n++;
      }
    }
  }
  cout<<n<<endl;
  return 0;
}


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

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b - 1); i >= (int)(a); --i)
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(a) ((int)(a).size())
#define BIT(x, i) (((x) >> (i)) & 1)
#define SQ(x) ((x) * (x))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int tanku[] = {5,7,5,7,7};

int main() {
    int n;
    while (cin >> n, n) {
        vs S(n);
        REP(i, n) cin >> S[i];
        REP(start, n) {
            int idx = 0;
            int l = 0;
            FOR(i, start, n) {
                l += S[i].length();
                if (l > tanku[idx]) {
                    idx = 0;
                    l = 0;
                    break;
                } else if (l == tanku[idx]) {
                    idx++;
                    l = 0;
                    if (idx == 5) {
                        cout << start+1 << endl;
                        goto END;
                    }
                }
            }
        }
END: {}
    }
}

Measured memory_bytes: 3144
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		long b = sc.nextInt();
		long gcd = gcd(a,b);
		System.out.println(a*b/gcd);
		sc.close();
	}
	static long gcd (long a, long b) {
		if(b > a) return gcd(b,a);
		if(b == 0) return a;
		return gcd(b, a%b);
	}
}

Measured memory_bytes: 22612
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define LL long long
using namespace std;
const int maxn=(int)2e5+10;
int n,a[maxn],loc[maxn];
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        loc[a[i]]=i;
    }
    int cnt=1,r=0;
    for(int i=1;i<=n;i++){
        r=loc[i];int j;
        for(j=i+1;loc[j]>r&&j<=n;j++){r=loc[j];}
        cnt=max(cnt,j-i);i=j-1;
    }
    cout<<n-cnt;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#define MAX 100

int main(){

	int n,P[MAX][MAX],Num,Count,X,i,j;

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

	for( i = 0; i < n; i++){
		scanf("%d %d",&Num,&Count);
			for( j = 0; j < Count; j++){
				scanf("%d",&X);
				P[Num-1][X-1] = 1;
		}
	}

	for( i = 0; i < n; i++){
		for( j = 0; j < n; j++){
			if(j == n-1) printf("%d",P[i][j]);
			else printf("%d ",P[i][j]);
		}
		printf("\n");	
	}

	return 0;
}


Measured memory_bytes: 2112
function Main (input) {
  input = input.split("\n");
  input = input[0];
  if (input == "a") {input = "b";}
  else if (input == "b") {input = "c";}
  else if (input == "c") {input = "d";}
  else if (input == "d") {input = "e";}
  else if (input == "e") {input = "f";}
  else if (input == "f") {input = "g";}
  else if (input == "g") {input = "h";}
  else if (input == "h") {input = "i";}
  else if (input == "i") {input = "j";}
  else if (input == "j") {input = "k";}
  else if (input == "k") {input = "l";}
  else if (input == "l") {input = "m";}
  else if (input == "m") {input = "n";}
  else if (input == "n") {input = "o";}
  else if (input == "o") {input = "p";}
  else if (input == "p") {input = "q";}
  else if (input == "q") {input = "r";}
  else if (input == "r") {input = "s";}
  else if (input == "s") {input = "t";}
  else if (input == "t") {input = "u";}
  else if (input == "u") {input = "v";}
  else if (input == "v") {input = "w";}
  else if (input == "w") {input = "x";}
  else if (input == "x") {input = "y";}
  else if (input == "y") {input = "z";}
  //else if (input == "z") {input = "a";}
  console.log(input);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

void print_ans(bool flag){
    if(flag){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }   
}

int main(){
    string s;
    cin >> s;
    bool ans = true;
    for(int i = 1; i <= s.size(); i++){
        if(i % 2 == 1){
            ans &= (s[i-1] == 'R' || s[i-1] == 'U' || s[i-1] == 'D');
        } else {
            ans &= (s[i-1] == 'L' || s[i-1] == 'U' || s[i-1] == 'D');
        }
    }
    print_ans(ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
} 


int main(){
    ll n;cin >> n;ll d;cin >> d;
    ll ans=0;
    rep(i,n){
        long double a,b;cin >> a >> b;
        long double l=a*a+b*b;
        if(sqrt(l)<=d)ans++;
        //cout << sqrt(l) <<endl;
    }
    cout << ans <<endl;

}

Measured memory_bytes: 3808
a=[list(map(int,input().split())) for i in range(3)]
n=int(input())
b=list(int(input()) for i in range(n))
ans="No"

for i in range(n):
  for j in range(3):
    for k in range(3):      
    	if b[i]==a[j][k]:
      		a[j][k]=-1
for i in range(3):
  if a[i]==[-1,-1,-1]:
    ans="Yes"
    break
for i in range(3):
  if a[0][0]==a[1][1]==a[2][2]==-1:
    ans="Yes"
    break
if a[2][0]==a[1][1]==a[0][2]==-1:
  ans="Yes"
if a[0][0]==a[1][0]==a[2][0]==-1 or a[0][1]==a[1][1]==a[2][1]==-1 or a[0][2]==a[1][2]==a[2][2]==-1:
	ans="Yes"
print(ans)  

Measured memory_bytes: 3064
program main
	implicit none
    integer::a,b
    read(*,*)a
    b=mod(a,10)
    if(b==3)then
    	write(*,*)'bon'
    else if(b==0 .or. b==1 .or. b==6 .or. b==8)then
    	write(*,*)'pon'
    else
    	write(*,*)'hon'
    end if
    stop
end program main

Measured memory_bytes: 2772
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
	string number;
	getline(cin,number);
	long long int count=0;
	for(long unsigned int i=0;i<number.size();i++)
		count+=int(number[i])-48;
	if(count%9==0)cout<<"Yes";
	else{cout<<"No";}
	return 0;
}

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

const int64_t MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
ull gcd(ull m, ull n) {
  ull temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

ull lcm(ull m, ull n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(ull a, ull b) {

	ull prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

//   sort(v.begin(), v.end(), greater<int>());

signed main() {
  int n, m;
  cin >> n >> m;
  
  vector<int> x(m);
  for(int i=0;i<m;i++){
    cin >> x[i];
  }
  if(n>=m){
    cout << "0" << endl;
    return 0;
  }
  sort(x.begin(), x.end());
  vector<int> diff(m-1);
  for(int i=0;i<m-1;i++){
    diff[i] = x[i+1]-x[i];
  }
  sort(diff.begin(),diff.end(), greater<int>());
  
  int total = 0;
  for(int i=0;i<n-1;i++){
    total += diff[i];
  }
  cout << x[m-1]-x[0]-total << endl;
  return 0;
}



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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<ll,ll> pii;
const int MD = 1e9+7; typedef vector<ll> VL;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI a(n);
	rep(i, n) cin >>a[i];
	ll ans =0;
	for(auto x: a){
		for(;x%2==0 && x>0;x /=2) ans++;
	}
	cout << ans <<endl;
	return 0;
}


Measured memory_bytes: 256
#define ll long long
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mp make_pair
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<utility>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<assert.h>
#include<stack>
ll z = 1000000007 ;
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
ll power(ll a ,ll b){if(b <= 0) return 1 ; ll c = power(a , b/2) ; if(b%2 == 0) return ((c*c)%z) ; else return ((((c*c)%z)*a)%z) ;}
ll inverse(ll a ,ll n){return power(a , n-2) ;}
ll max(ll a , ll b){if(a > b) return a ; return b ;}
using namespace std ;


//ios_base::sync_with_stdio(0);
//cin.tie(0); cout.tie(0);

 
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	
	ll n , k ;
	cin >> n >> k ;
	ll cnt = max(0 , n-k) ;
	ll ans = 0 ;
	ll arr[n] ;
	fo(i , n)
	{
		cin >> arr[i] ;
	}
	sort(arr , arr + n) ;
	fo(i , cnt)
	{
		ans += arr[i] ;
	}
	cout << ans << endl ;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<algorithm>
using namespace std;
#define inf 1<<29
int t,n;
long long  dis[305][305];
long long  d[305][305];
void init()
{
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
       dis[i][j]=d[i][j];
}
bool panduan()
{
      for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
       if(dis[i][j]!=d[i][j]) return false;
       return true;
}
long long  sum()
{
    long long  s=0,fond;
    for(int i=1;i<=n;i++)
        for(int j=i+1;j<=n;j++)
        {
            fond=1;
            for(int k=1;k<=n;k++){
                    if(k==i||k==j) continue;
            if(dis[i][j]==dis[i][k]+dis[k][j])
                 fond=0;
            }
            if(fond) s+=dis[i][j];
        }

    return s;
}
int main()
{
        cin>>n;
     for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++)
            cin>>d[i][j];
        init();
        for(int k=1;k<=n;k++)
             for(int i=1;i<=n;i++)
              for(int j=1;j<=n;j++)
                if(d[i][j]>d[i][k]+d[k][j])
                 d[i][j]=d[i][k]+d[k][j];
        int t=panduan();
        if(!t) cout<<"-1"<<endl;
      else cout<<sum()<<endl;
            return 0;
}


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

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

using namespace std;

int main(){
	int a,b; cin>>a>>b;
	if((a-b)%2==0) cout<<(a+b)/2<<endl;
	else           cout<<"IMPOSSIBLE"<<endl;

	return 0;
}


Measured memory_bytes: 256