akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int mx=0,tmp=1e9,sum=0;
	for (int i=0;i<n;i++){
		int a;
		cin>>a;
		if (tmp>=a) sum++,tmp=a;
		else{
			if (sum>=mx) mx=sum;
			tmp=1e9;
			sum=0;
			if (tmp>=a) sum++,tmp=a;
		}
	}
	cout<<max(sum,mx)-1<<endl;
	return 0;
}

Measured memory_bytes: 256
S = input()
N=len(S)
count_101 =0
count_100 =0
count_011 =0
count_010 =0

for i in range(0,N,2):
    if S[i]=='1':
        count_101 +=1
    else:
        count_010 +=1
for i in range(1,N,2):
    if S[i]=='1':
        count_011 +=1
    else:
        count_100 +=1

if (count_101 + count_100) >= (count_011 + count_010):
    print(N-(count_101 + count_100))
else:
    print(N-(count_011 + count_010))
    

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

    #define ll long long
    #define ff first
    #define ss second
    #define pb push_back
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define MOD 1000000007
    #define pll pair<ll,ll>
constexpr ll INF = 1999999999999999997; 
    #define fastio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
    int main() {
        fastio;
        int n;
        cin>>n;
        string s;
        cin>>s;
           n=n%26;
           string t="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        for(auto j:s)
        {
            int x=j-'A';
            x=(x+n)%26;
            cout<<t[x];
        }
    }

Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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; }

struct UnionFind {
    vector<int> par;

    UnionFind(int n) {
        par.resize(n);
        rep(i, n) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        par[x] = root(par[x]);
        return par[x];
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[ry] = rx;
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

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

    UnionFind uf(n);
    vector<vector<int>> v(m);

    rep(i, n) {
        int k; cin >> k;
        rep(j, k) {
            int l; cin >> l; l--;
            v[l].push_back(i);
        }
    }

    rep(i, m) {
        rep(j, v[i].size()) {
            uf.unite(v[i][0], v[i][j]);
        }
    }

    bool ok = true;
    rep(i, n) {
        if (!uf.same(0, i)) ok = false;
    }
    cout << (ok ? "YES" : "NO") << endl;
}


Measured memory_bytes: 4608
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  cin>>h>>w;
  char ans[h+2][w+2];
  memset(ans,'#',sizeof(ans));
  for(int i=1;i<=h;i++){
    string s;
    cin>>s;
    for(int j=1;j<=w;j++){
      ans[i][j]=s.at(j-1);
    }
  }
  for(int i=0;i<h+2;i++){
    for(int j=0;j<w+2;j++){
      cout<<ans[i][j];
    }
    cout<<endl;
  }
}

Measured memory_bytes: 256
n = input().split()
array = []
for s in n:
    if s == "+" or s == "-" or s == "*":
        b = array.pop()
        a = array.pop()
        if   s == "+":
            array.append(a + b)
        elif s == "-":
            array.append(a - b)
        else:
            array.append(a * b)
    else:
        array.append(int(s))
print(array[0])

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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef unsigned long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

////////////////////////////////////////////////////////////////////

const int N = 1e5 + 2;

void DFS(int mask, int a, int b, int x) {
	if (__builtin_popcount(mask) == 1) {
		cout << (mask & a) + x << ends << (mask & b) + x << ends;
		return;
	}
	int d = __builtin_ctz(mask & (a ^ b));	
	mask ^= (1 << d);
	int l = mask & -mask;
	DFS(mask, a, a ^ l, x + ((a >> d) & 1) * (1 << d));
	DFS(mask, a ^ l, b, x + ((b >> d) & 1) * (1 << d));
}

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n, a, b; cin >> n >> a >> b;
	if (!__builtin_parity(a ^ b)) die("NO");
	cout << "YES" << endl;
	DFS((1 << n) - 1, a, b, 0);
	cout << endl;

	return 0;
}


Measured memory_bytes: 1024
using System;
class c
{
    static void Main()
    {
        var s = Console.ReadLine();
        var ans = new int[2];
        for (int i = 0; i < s.Length; i++)
        {
            if (i % 2 == 0)
            {
                if (s[i] == '0') ans[0]++;
                else ans[1]++;
            }
            else
            {
                if (s[i] == '1') ans[0]++;
                else ans[1]++;
            }
        }
        Console.WriteLine(Math.Min(ans[0], ans[1]));
    }
}

Measured memory_bytes: 13116
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
ll rui(ll abc,ll bed){
	//aのb乗を計算する
	if(bed==0){return 1;}
	else{
		ll ced = rui(abc,bed/2);
		ced *= ced;
		ced %= mod;
		if(bed%2==1){ced*=abc; ced%=mod;}
		return ced;
	}
}

ll i,j,k,ii,jj;
ll n,m,sum,num;
ll a,b,c,d,e,ans;
ll x[500005],y[500005];

bool ok[500005];
string s,t;

int main(){
	cin>>n>>m>>k;
	for(i=0;i<=n;i++){
		for(j=0;j<=m;j++){
			if(i*m+j*n-2*i*j==k){
				p("Yes");
				return 0;
			}
		}
	}
	p("No");
	return 0;
}

Measured memory_bytes: 4992
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class MainClass {
  public static void Main (string[] args) {
		// 入力
   	var N = int.Parse(Console.ReadLine());
    
    //処理
   
    //出力
    Console.WriteLine(0.5*N*(N+1));
  }
}


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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

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

bool isPrime(int n){
	for(int i = 2; i*i <= n; ++i){
		if(n % i == 0) return false;
	}
	return true;
}

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int n; cin >> n;

	vi primeTbl;
	for(int i = 2; i <= 55555; i++){
		if(primeTbl.size() == n) break;
		if(isPrime(i) && i % 5 == 1) primeTbl.push_back(i);
	}

	rep(i, n){
		cout << primeTbl[i];
		if(i != n-1) cout << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    rep(i, N) cin >> P[i];
    vector<int> A = P;
    sort(A.begin(), A.end());
    int cnt = 0;
    rep(i, N) {
        if (A[i] != P[i]) cnt++;
    }
    bool bl = (cnt == 0 || cnt == 2);
    puts(bl ? "YES" : "NO");
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
 
#define REP(i,s,N) for (int i=s;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main(){
	ll H, W, A, B;
	cin >> H >> W >> A >> B;
	ll ans[H][W]={0};
	
	REP(j,0,W){
		REP(i,0,H){
			if(j>=A&&j<W&&i>=0&&i<B){
				ans[i][j] = 1;
			}else if(j>=0&&j<A&&i>=B&&i<H){
				ans[i][j] = 1;
			}else{
				ans[i][j] = 0;
			}
		}
	}
	
	REP(i,0,H){
		REP(j,0,W){
			cout << ans[i][j];
			if(j==W-1) cout << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 9088
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        solveForN(in.next());
    }

    private static void solveForN(String n) {
        String s = "0" + n;
        char[] ch = s.toCharArray();
        int[] a = new int[ch.length];
        for (int i = 0; i < ch.length; i++) {
            a[i] = ch[i] - '0';
        }

        int ans = 0;
        // 下から見るんかーい
        for (int i = a.length - 1; i > 0; i--) {
            if (a[i] == 5 && a[i - 1] >= 5) {
                a[i - 1]++;
                a[i] -= 10;
            } else if (a[i] > 5) {
                a[i - 1]++;
                a[i] -= 10;
            }
            ans += Math.abs(a[i]);
        }
        ans += Math.abs(a[0]);

        // out.println(Arrays.toString(a));

        out.println(ans);
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 45652
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;(i)<(n);i++)
typedef long long ll;
using namespace std;
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;}
int f(int x){
    int res = 0;
    while(x%2==0){
        res++;
        x/=2;
    }
    return res;
}
int main (){
    int n,m; cin >> n >> m;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n) a[i]/=2;
    int t = f(a[0]);
    rep(i,n){
        if(f(a[i])!=t){
            cout << 0 << endl;
            return 0;
        }
        a[i] >>= t;
    }
    m >>= t;
    ll LCM = 1;
    rep(i,n){
        LCM = lcm(LCM,a[i]);
        if(LCM>m){
            cout << 0 << endl;
            return 0;
        }
    }m/=LCM;
    cout << (m-1)/2 + 1 << endl;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod ((int)1e9+7)
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a,ll b) {
   ll res=1;
   while(b){
      if(b%2==1) res=(res*a)%mod;
      a=(a*a)%mod;
      b>>=1;
   }
   return res;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)1e5+5;
const int M = (int)1e3+5;
const int Q = 301;
const int logN = 19;

bool dp[N];
void solve() {
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    REP(i,0,n-1) {
        cin>>a[i];
    }
    REP(i,1,k) {
        for(auto it:a) {
            if(it>i) break;
            if(!dp[i-it]) {
                dp[i] = true;
                break;
            }
        }
    }
    if(dp[k]) cout<<"First";
    else cout<<"Second";
}
int main() {
    //freopen("output.txt","r",stdin);
    //freopen("output.txt","w",stdout);

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

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  int x=-1;
  for(int i=0;i<100*a;i++){
    if(i*8/100==a&&i*10/100==b){
      x=i;
      break;
    }
  }
  cout<<x<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
const int MAX = 150;
char map[MAX][MAX];
int state[MAX][MAX];
int dirx[4]={1,0,-1,0},diry[4]={0,1,0,-1};//4个?找方向
int H,W;
void dfs(int x,int y)
{
    if(state[x][y]) return;
    state[x][y]=1;
    for(int i=0;i<4;i++)
    {
        int dx=x+dirx[i];
        int dy=y+diry[i];
        if(dx>=0&&dx<H&&dy>=0&&dy<W&&map[dx][dy]==map[x][y])
          dfs(dx,dy);
    }
}
int solve()
{
    int res=0;
    for(int i=0;i<H;i++)
    for(int j=0;j<W;j++)
    {
        if(!state[i][j])
        {
            res++;
            dfs(i,j);
        }
    }
    return res;
}
int main()
{
    while(scanf("%d%d",&H,&W)&&H!=0&&W!=0)
    {
        memset(state,0,sizeof(state));
        for(int i=0;i<H;i++)
            scanf("%s",map[i]);
        printf("%d\n",solve());
    }

    return 0;
}

Measured memory_bytes: 1604
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0,  1, -1,  1, -1 };
static const int dy[] = { 0, -1, 0, 1 , 1,  1, -1, -1 };
  
  
int a, b, n;
VI pm;
  
int main() {
    pm.reserve(100000);
    pm.push_back( 2 );
    for ( int i = 3; i < 9000000; i += 2 ) {
        bool can_add = true;
        for ( int j = 0; j < pm.size() && pm[ j ] * pm[ j ] <= i; j++ ) {
            if ( !( i % pm[ j ] ) ) {
                can_add = false;
                break;
            }
        }
        if ( can_add ) {
            pm.push_back( i );
        }
    }
    while ( ~scanf( "%d %d %d", &a, &b, &n ) && a && b && n ) {
        while ( n ) {
            n -= binary_search( pm.begin(), pm.end(), a );
            if ( !n ) {
                printf( "%d\n", a );
                break;
            }
            a += b;
        }
    }
    return 0;
}

Measured memory_bytes: 3940
n = int(input())
arr = list(map(int, input().split()))

i = 0
j = n-1
sumL =0
sumR = 0
while(i <= j):
    if(sumL < sumR):
        sumL += arr[i]
        i +=1
    else:
        sumR += arr[j]
        j -=1

print(abs(sumL - sumR))


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

vector<vector<int>> adj;
vector<int> visited;
vector<int> ans;
vector<int> deg;
int v;

void topologicalOrder() {
  queue<int> q;
  for (int i = 0; i < v; i++) {
    if (deg[i] == 0) q.push(i);
  }
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    ans.push_back(x);
    for (auto y : adj[x]) {
      if (visited[y] == 0) {
        deg[y]--;
        if (deg[y] == 0) {
          visited[y] = 1;
          q.push(y);
        }
      }
    }
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  int e;
  cin >> v >> e;
  adj.resize(v);
  visited.resize(v);
  deg.resize(v);
  for (int i = 0; i < e; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    deg[b]++;
  }
  topologicalOrder();
  for (auto i : ans) {
    cout << i << endl;
  }
  return 0;
}


Measured memory_bytes: 3788
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#include<functional>

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< int,  int> P;



int main(void) {
	int a, b, c;

	cin >> a >> b >> c;

	if (a + b >= c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

char s[3010], t[3010];
int a, b, d[3010][3010], opt[3010][3010];

void update(int i, int j, int x, int o){
    if(d[i][j] <= x) d[i][j] = x, opt[i][j] = o;
}

int main(){
    scanf("%s%s", s + 1, t + 1); a = strlen(s + 1), b = strlen(t + 1);
    for(int i = 1; i <= a; i++) for(int j = 1; j <= b; j++){
        update(i, j, d[i - 1][j], 1);
        update(i, j, d[i][j - 1], 2);
        if(s[i] == t[j]) update(i, j, 1 + d[i - 1][j - 1], 3);
    }
    stack<char> st;
    int i = a, j = b;
    while(i && j){
        if(opt[i][j] == 1) i--;
        else if(opt[i][j] == 2) j--;
        else{ st.push(s[i]); i--; j--; }
    }
    while(!st.empty()){ printf("%c", st.top()); st.pop(); }
    return 0;
}

Measured memory_bytes: 70912
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A = 0 , B = 0 , C = 0;
  char a[3];
  cin >> a;
  for (int i=0;i<3;i++){
    if (a[i]=='a')
      A = 1;
    else if (a[i]=='b')
      B = 1;
    else if (a[i]=='c')
      C = 1;
  }
  if (A + B + C == 3)
    cout << "Yes" << "\n";
  else
    cout << "No" << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;
int main( void )
{
	int n;
	while ( cin >> n && n )
	{
		vector < vector<int> > ms( n, vector<int>(n,0) );
		int x = n/2;
		int y = n/2+1;
		int cnt = 1;

		while ( cnt <= n * n )
		{
			x = x<0?n-1:x;
			y = y<0?n-1:y;
			x = x>=n?0:x;
			y = y>=n?0:y;

			if ( ms[y][x] != 0 )
			{
				x--;
				y++;
				continue;
			}

			ms[y][x] = cnt;

			x++;
			y++;
			cnt++;
		}

		for ( int i = 0; i < n; i++ )
		{
			for ( int j = 0; j < n; j++ )
				cout << setw( 4 ) << ms[i][j];
			cout << endl;
		}

	}
	return 0;
}

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

#define MOD 1000000007

int main()
{
  int n, m, x;
  cin >> n >> m >> x;

  vi c(n);
  vector<vi> a(n, vi(m));

  rep(i, n)
  {
    cin >> c[i];
    rep(j, m)
    {
      cin >> a[i][j];
    }
  }

  int ans = -1;
  int _to = pow(2, n);
  for (int i = 1; i < _to; i++)
  {
    int _ans = 0;
    vi skill(m);
    rep(j, n)
    {
      // 買う
      if (i & (1 << j))
      {
        _ans += c[j];
        rep(k, m)
        {
          skill[k] += a[j][k];
        }
      }
    }
    bool isSkillClear = true;
    rep(j, m)
    {
      if (skill[j] < x)
      {
        isSkillClear = false;
      }
    }
    if (!isSkillClear)
    {
      continue;
    }

    if (ans == -1 || _ans < ans)
    {
      ans = _ans;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 4080
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#define printjudge(cond) {if(cond) printf("Yes\n"); else printf("No\n");}
#define printans(ans) {printf("%d\n",(ans));}
#define intscan(x) {scanf("%d", &x);}
#define Ntimes(N) for(int i=0; i<N; i++)
#define min(x,y) (((x)<(y)) ? (x) : (y))
#define max(x,y) (((x)>(y)) ? (x) : (y))
typedef int* intarray;
typedef char* string;

int main(){
    int N, M, K, A, ans = 0;
    intscan(N);
    intscan(M);
    int* like = new int[M];
    Ntimes(M) like[i] = 0;
    for(int j=0; j<N; j++){
        intscan(K);
        Ntimes(K){
            intscan(A);
            like[A-1]++;
        }
    }
    Ntimes(M) ans += (like[i]==N);
    printans(ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector< vector<int> > VVI;
typedef vector< vector<int> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound

int main(){
  ll N,P;
  cin>>N>>P;
  ll ans=1;
  map<ll,int> M;
  rep(q,50){
    rep(i,sqrt(P)){
      if(P%(i+2)==0){
        M[i+2]++;
        P/=(i+2);
        break;
      }
    }
  }
  M[P]++;
  auto itr=M.begin();
  rep(i,M.size()){
    rep(j,itr->second/N) ans*=itr->first;
    itr++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
const main = (inputs) => {
  var S = inputs[0].split("");
  var ans = true;
  var tmp = "";
  S.forEach(v=>{
    if(v==tmp) ans = false;
    tmp = v;
  })
  console.log(ans?"Good":"Bad");
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));


Measured memory_bytes: 21956
class Mss
  def max(list)
    max = -100_000
    max_minus = -100_000
    next_val = 0
    list.each do |input|
      next_val = [input + next_val, 0].max
      max_minus = [input, max_minus].max
      max = [max, next_val].max
    end
    max_minus < 0 ? max_minus : max
  end
end

inputs = STDIN.read.split("\n").map { |e| e.chomp.to_i }

loop do
  n = inputs.shift
  break if n == 0

  list = Array.new(n) { inputs.shift }
  puts Mss.new.max(list)
end

Measured memory_bytes: 8884
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,a[100],ans=0;
  cin >> n;
  for(int i=0; i<n; i++) {
      cin >> a[i];
  }
  for(int i=0; i<n-1; i++) {
      for(int j=n-1; j>i; j--) {
          if(a[j]<a[j-1]) {
              swap(a[j],a[j-1]);
              ans++;
          }
      }
  }
  for(int i=0; i<n-1; i++) {
      cout << a[i] << " ";
  }
  cout << a[n-1] << endl;
  cout << ans << endl;
}


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

using namespace std;

int main(){

  int N, M;
  cin >> N >> M;

  int total = 0;
  for(int i = 0; i < M; i++){
    int a;
    cin >> a;
    total += a;
  }

  if(total > N){
    cout << -1 << endl;
  }
  else{
    cout << N - total << endl;
  }

  return 0;

}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define be begin()
#define en end()
#define le length()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (__typeof(n) i = 0; i < n; i++)
#define repo(i, n) for (__typeof(n) i = 1; i <= n; i++)
#define eps 1e-6
#define pi 3.141592653589793
#define c(a) cout << a << "\n";
#define a(a)         \
    for (auto i : a) \
        cout << i << " ";
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MOD = 1e9 + 7;
const int INF = 1e9;
int main()
{
    ll n, k;
    cin >>
        n >> k;
    if ((1 + (2 * (k-1))) <= n)
        c("YES") else c("NO")
}

Measured memory_bytes: 256
#include<cstdio>

int main(void){
double p,q;
int a;
int res[12];
scanf("%lf",&p);
while(p!=-1){

q=1<<8;
if(p>q){
printf("NA\n");
scanf("%lf",&p);
continue;
}

for(a=0;a<12;a++){
q/=2.0;
if(p>=q){
res[a]=1;
p-=q;
}
else res[a]=0;
}
if(p!=0.0){
printf("NA\n");
scanf("%lf",&p);
continue;
}

for(a=0;a<8;a++){
printf("%d",res[a]);
}
printf(".");
for(a=8;a<12;a++){
printf("%d",res[a]);
}
printf("\n");
scanf("%lf",&p);
}
return 0;
}

Measured memory_bytes: 1080
#include<iostream>
#include<math.h>
#include<string.h>
using namespace std;

int seiyaku_check(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	
	int a,b,c;
	int p,q,r;
	cin >> a >> b >> c;

	seiyaku_check(a,1,100);
	seiyaku_check(b,1,100);
	seiyaku_check(c,1,100);
	
	p = a+b;
	q = b+c;
	r = c+a;
	
	if(p==q==r)cout << p << endl;
	else if(p<=q && p<=r) cout << p << endl;
	else if(q<=p && q<=r) cout << q << endl;
	else if(r<=p && r<=p) cout << r << endl;

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

void solve(ll n, ll m){
	int cnt=0;
	for(ll pp=0;pp*pp<=n*n+m*m;pp++){
		for(ll qq=0;pp*pp+qq*qq<=n*n+m*m;qq++){
			if(pp==0&&qq==0)continue;
			rep(i,4-(pp==0?3:(qq==0?1:0))){
				ll p=dx[i]*pp;
				ll q=dy[i]*qq;
				if((m*p+n*q)%(p*p+q*q)==0&&(n*p-m*q)%(p*p+q*q)==0){
					ll x=(n*q+m*p)/(p*p+q*q);
					ll y=(m*p-q*n)/(p*p+q*q);
					cnt++;
					//puta(p,q,x,y,m,n);
				}
			}
		}
	}
	//puta(cnt);
	cout<<(cnt==8?"P":"C")<<endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m,q;
	cin>>q;
	while(q--){
		cin>>m>>n;
		solve(n,m);
	}
}



Measured memory_bytes: 3196
#include <stdio.h>
#include <stdlib.h>

int compar(const void *a, const void *b)
{
  int *pa = (int *)a;
  int *pb = (int *)b;
  if (pa[0] > pb[0])
    return 1;
  if (pa[0] == pb[0]) {
    if (pa[1] > pb[1]) return 1;
    if (pa[1] == pb[1]) return 0;
  }
  return -1;
}

int main()
{
  int i, j, n, t, len=1;
  fscanf(stdin, "%d", &n);
  int pp[n][2];
  for (i=0; i<n; i++)
    fscanf(stdin, "%d %d", &pp[i][0], &pp[i][1]);
  
  qsort(pp, n, sizeof(int)*2, compar);
  
  for (i=0; i<n; i++)
    fprintf(stdout, "%d %d\n", pp[i][0], pp[i][1]);

  return 0;
}



Measured memory_bytes: 2976
n = input()
s = list()
for i in xrange(1, 2**10):
    s.append(i)
time_table = list()
benefit = list()
for _ in xrange(n):
    time_table.append("".join(raw_input().split()))
for _ in xrange(n):
    benefit.append(list(map(int, raw_input().split())))

op = [[None for i in xrange(n)] for j in xrange(2**10-1)]
for i in xrange(n):
    for j in xrange(2**10-1):
        op[j][i] = sum(map(int, list(bin(s[j] & int(time_table[i],2))[2:])))

print max([sum([benefit[i][op[j][i]] for i in xrange(n)]) for j in xrange(2**10-1)])


Measured memory_bytes: 3588
#include <stdio.h>
#include <stdlib.h>
int main(void){
  int N;
  int T,A;
  int H[100010];
  int i;
  scanf("%d",&N);
  scanf("%d %d",&T,&A);
  int ans;
  int all;
  int S[100010];
  for(i=1;i<=N;i++){
    scanf("%d",&H[i]);
    S[i]=T*1000-H[i]*0.006*1000;
    if(abs(A*1000-ans)>abs(A*1000-S[i])){
      ans=S[i];
      all=i;
    }
  }
  printf("%d\n",all);
  return 0;
}


Measured memory_bytes: 1732
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define PP(m) REP(i, m.size()) cout << m[i] << endl;


struct Ma {
  int h,r;

  bool operator<( const Ma& right ) const {
    return h == right.h ? r < right.r : h < right.h;
  }
};

int main() {
  int n, m;
  while (cin >> n && n) {

    vector<Ma> ich(n);
    REP(i, n) cin >> ich[i].h >> ich[i].r;
    cin >> m;
    vector<Ma> jir(m);
    REP(i, m) cin >> jir[i].h >> jir[i].r;

    vector<Ma> mas(n+m);
    REP(i, n) mas[i] = ich[i];
    REP(i, m) mas[i+n] = jir[i];

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

    vector<int> dp(n+m, 1);

    int result = 0;
    REP(i, n+m) {
      REP(j, n+m) {
        if (mas[i].h < mas[j].h && mas[i].r < mas[j].r) {
          dp[j] = max(dp[j], dp[i]+1);
        }
        if (result < dp[j]) {
          result = dp[j];
        }
      }
    }

    cout << result << endl;
  }

  return 0;
}

Measured memory_bytes: 1216
A, B, C = map(int, input().split())
cnt = 0
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    A,B,C = B//2+C//2, A//2+C//2, A//2+B//2
    cnt += 1
    if cnt >= 10 * 7:
        print(-1)
        break
else:
    print(cnt)


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

using ll = long long;

int main() {
    int k; cin >> k;
    vector<ll> a(k);
    for(int i = 0; i < k; ++i) {
        cin >> a[i];
    }
    reverse(begin(a), end(a));

    if(a[0] != 2) {
        cout << -1 << endl;
        return 0;
    }

    ll l = 2, r = 3;
    for(int i = 1; i < k; ++i) {
        const ll nl = (l + a[i] - 1) / a[i] * a[i];
        const ll nr = r / a[i] * a[i] + a[i] - 1;
        if(nl <= nr) {
            l = nl, r = nr;
        } else {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << l << ' ' << r << endl;
}


Measured memory_bytes: 1024
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#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 <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
#define two(X) (1<<(X))
#define twoL(X) (((int64)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)
const double pi=acos(-1.0);
const double eps=1e-11;
template<class T> inline void ckmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void ckmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
#define SIZE(A) ((int)A.size())
#define LENGTH(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,a) for(int i=0;i<(a);++i)
#define ALL(A) A.begin(),A.end()

const int oo=1000000000;

int n,m;
int f[1<<15][16][16];
int g[16][16];

int main()
{
#ifdef _MSC_VER
	freopen("input.txt","r",stdin);
#endif
	std::ios::sync_with_stdio(false);
	while (cin>>n>>m)
	{
		memset(g,255,sizeof(g));
		REP(i,m)
		{
			int x,y,z;
			cin>>x>>y>>z;
			--x;
			--y;
			g[x][y]=g[y][x]=z;
		}
		REP(set,two(n))
		{
			REP(x,n) REP(y,n) f[set][x][y]=oo;
			if (!contain(set,0)) continue;
			if (contain(set,n-1) && set!=two(n)-1) continue;
			REP(x,n) f[set][x][x]=0;
			for (int set1=set-1;set1>0;set1=((set1-1)&set))
			{
				if (!contain(set1,0)) continue;
				int set2=(set^set1);
				int base=0;
				REP(x,n) if (contain(set1,x)) REP(y,n) if (contain(set2,y) && g[x][y]>=0) base+=g[x][y];
				REP(x,n) if (contain(set1,x)) REP(y,n) if (contain(set1,y)) REP(z,n) if (contain(set2,z) && g[y][z]>=0)
				{
					ckmin(f[set][x][z],base+f[set1][x][y]-g[y][z]);
				}
			}
		}
		printf("%d\n",f[two(n)-1][0][n-1]);
#ifndef _MSC_VER
		break;
#endif
	}
	return 0;
}


Measured memory_bytes: 33152
#include <iostream>
typedef long long ll;
#define mod 998244353
using namespace std;
ll power(int n, int m){
    ll ans = 1LL;
    for(int i=0;i<m;i++){
        ans *= n;
        ans %= mod;
    }
    return ans;
}
int main(void)
{
    int n; cin >> n;
    int d[100001];
    for(int i=0;i<100001;i++) d[i] = 0;
    bool flag = false;
    int size = 0;
    for(int i=0;i<n;i++){
        int x; cin >> x;
        if(i==0&&x!=0) flag = true;
        if(d[x]==0) size++;
        d[x]++;
    }
    ll ans = 1;
    if(d[0]!=1) flag = true;
    else{
        for(int i=0;i<size-2;i++){
            if(d[i+1]==0||d[i+2]==0){
                flag = true; break;
            }
            ans *= power(d[i+1],d[i+2]);
            ans %= mod;
        }
    }
    if(flag) cout << 0 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
const ll M=1000000007;
//------------------------------------------//
ll f(ll n){
    return n*n*n*n*n;
}
int main(){
    ll X;cin>>X;
    for(int a=-120;a<=120;a++){
        for(int b=-120;b<=120;b++){
            if(X==f(a)-f(b)){
                cout<<a<<' '<<b<<endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3628
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    t,x = map(int, sys.stdin.readline().split())
    print(float(t/x))

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

int main()
{
	string s; int k;
	cin >> k >>s;
	int n = s.size();
	if (n <= k) {
		cout << s; return 0;
	}
	else {
		s = s.substr(0,k);
		s = s + "...";
		cout << s;
	}
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
using namespace std; typedef long long ll;const ll INF = 1e18;
typedef pair<ll,ll> P; const int xx[4]={1,-1,0,0}, yy[4]={0,0,1,-1}; struct tp{ll x1,y1,x2,y2;};

int main() {
  ll n,a,b; cin>>n>>a>>b;
  ll p=n/(a+b), an; an=p*a; n-=p*(a+b);
  if (n <= a) an+=n;
  else an+=a;
  cout<<an<<endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))


def is_possible(C):
    res = 0
    for x in A:
        if x+C - N >= 0:
            res += (x+ C - N)//(N+1) + 1
    #print(res,C)
    return int(res <= C)

l = 0  # impossible
r = 10**30  # possible

while r - l > 1:
    M = (l+r)//2
    if is_possible(M)>0:
        r = M
    else:
        l = M
for i in range(10**5,-1,-1):
    if is_possible(r -i):
        print(r-i)
        break

Measured memory_bytes: 74144
#include <iostream>
#include <string>
#include <set>

int main()
{
	std::string str;
	std::cin >> str;
		
	std::set<char> s;
	bool isdup = false;
	for( int i = 0; i < str.size(); i++ ) {
		auto r = s.insert( str[ i ] );
		if( r.second ) {
			isdup = true;
		}
		else {
			isdup = false;
			break;
		}
	}

	std::cout << ( isdup ? "yes" : "no" ) << std::endl;
	return 0;
}


Measured memory_bytes: 256
input_line=input().split()
days=int(input_line[0])
home_kinds=int(input_line[1])
required_days=input().split()
total_homework=0

for i in range(home_kinds):
    total_homework=total_homework+int(required_days[i])

if days >=total_homework:
    print(days-total_homework)
else:
    print(-1)

Measured memory_bytes: 9532
package main

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

func main() {
	var n, highest, views int
	var text string
	fmt.Scan(&n)

	reader := bufio.NewReader(os.Stdin)
	text, _ = reader.ReadString('\n')
	text = strings.TrimSuffix(text, "\n")

	numbers := strings.Split(text, " ")
	
	highest, _ = strconv.Atoi(numbers[0])
	views = 1

	for i := 1; i < len(numbers); i++ {
		num, _ := strconv.Atoi(numbers[i])

		if highest <= num {
			highest = num
			views += 1
		}
	}

	fmt.Println(views)
}


Measured memory_bytes: 640
#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() {
  ll n, k;
  cin >> n >> k;

  if (abs(n % k) < abs(n % k - k)) {
    cout << abs(n % k) << endl;
  } else {
    cout << abs(n % k - k) << endl;
  }

  return 0;
}


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

int main(void){
int n,t;
cin >> n >> t;
int min = 1001;
for(int i=0;i<n ;i++){
int ci,ti;
cin >> ci >>ti;
if(ci < min && ti <= t){
min = ci;
}
}
if(min==1001){
cout << "TLE" << endl;
}else{
cout << min << endl;
}
return 0;
}


Measured memory_bytes: 256
//AnkitCode99 here....
#include<bits/stdc++.h>
#define endl "\n"
typedef long long int ll;
#define MOD 1000000007
#define mp make_pair
#define pll pair<ll,ll>
#define pb push_back
//max xor btw range of two numbers..
#define max_XOR(a,b) (1 << int(log2(a ^ b) + 1)) - 1
#define vl vector<ll>
#define inf ll(1e18)
#define all(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,b) for(long long int i=a;i<b;i++)
#define nrep(i,a,b) for(long long int i=a;i>=b;i--)
#define ceil(a,b) a/b+((a%b ==0 )?0:1)
using namespace std;

const ll sz=100005;
const ll szz=1000006;

ll n;
ll ar[sz],cache[sz];

// TOP - DOWN Approach

ll dp(ll idx)
{
    if(idx>n)
        return ll(1e9);

    if(idx==n)
        return 0;

    if(cache[idx]!=-1)
        return cache[idx];
    
    cache[idx]=min(abs(ar[idx]-ar[idx+1])+dp(idx+1),abs(ar[idx]-ar[idx+2])+dp(idx+2));
    return cache[idx];
}

int main()
{
    fast;
    
    cin>>n;
    memset(cache,-1,sizeof cache);
    rep(i,1,n+1)
    {
        cin>>ar[i];
    }    
    
    cout<<dp(1)<<endl;

    // rep(i,1,n+1)
    //     cout<<cache[i]<<" ";
}//Goodbye...

Measured memory_bytes: 3328
parseInt(x) = parse(Int128, x)
parseFloat(x) = parse(BigFloat, x)
#parseFloat(x) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function main()
  D,T,S = parseMap(split(readline()))
  if D/S <= T
    println("Yes")
  else
    println("No")
  end

end
main()


Measured memory_bytes: 189484
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()
#define MP make_pair

int main() {
	int n,x[110],y[110],h[110],t;
	cin >> n;
	REP(i, n) cin >> x[i] >> y[i] >> h[i];
	t = h[0];
	FOR(k, t, t + 220) {
		REP(i, 101) {
			REP(j, 101) {
				bool a = true;
				REP(l, n) if (h[l] != 0 && max(i, x[l]) - min(i, x[l]) + max(j, y[l]) - min(j, y[l]) != k - h[l]) a = false;
				if (a) {
					cout << i << " " << j << " " << k << endl;
					return 0;
				}
			}
		}
	}
}

Measured memory_bytes: 256
s = '.'+input()+'.'
t = input()
def onazi(a):
  for i in range(len(t)):
    if a[i] == '?':
      continue
    if a[i] != t[i]:
      return 0
  return 1
cnt=0
for i in range(len(s)-len(t),0,-1):
  if onazi(s[i:i+len(t)])==1:
    cnt+=1
    s = s[:i]+t+s[i+len(t):]
    break
if cnt==0:
  print('UNRESTORABLE')
  exit(0)
g = ''
for i in s[1:-1]:
  if i == '?':
    g+='a'
  else:
    g+=i
print(g)

Measured memory_bytes: 8984
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();

    let mut ans = 0;
    for i in 1..100000 {
        if 100 * i <= n && n <= 105 * i {
            ans = 1;
            break;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
c;
int main(i)
{
  char s[99];
  for(;;printf("%d\n",c-1))
    {
      fgets(s,999,stdin); 
      if(strstr(s,"END OF INPUT"))
	exit(0);
      for(c=i=0;s[i]!='\0';c++)
	if(s[i++]==' ')
	  printf("%d",c),c=-1;
      
    }
  
}

Measured memory_bytes: 0
N = int(input())
f = [0] * ((10**5) + 1)

M = 10 ** 2

for i in range(1, M + 1):
    for j in range(1, M + 1):
        for k in range(1, M + 1):
            f[i*i + j*j + k*k + i*j + j*k + i*k] += 1

for i in range(N):
    print(f[i+1])

Measured memory_bytes: 10004
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

// a g c t 0 1 2 3
ll dp[101][5][5][5][5];
bool isBad[5][5][5][5];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n;
    cin >> n;
    if(n == 3){ cout << 61 << endl; return 0;}
    FOR(i,0,4) {
      isBad[i][0][1][2] = true;
      isBad[0][1][2][i] = true;
      isBad[i][1][0][2] = true;
      isBad[1][0][2][i] = true;
      isBad[i][0][2][1] = true;
      isBad[0][2][1][i] = true;
      isBad[0][i][1][2] = true;
      isBad[0][1][i][2] = true;
    }


    F0R(a,4)
      F0R(b,4)
        F0R(c,4)
          F0R(d,4){
            if(!isBad[a][b][c][d])
              dp[4][a][b][c][d] = 1;
          }

  FOR(i,5,n+1){
    F0R(a,4)
      F0R(b,4)
        F0R(c,4)
          F0R(d,4){
            if(isBad[a][b][c][d]) continue;
            ll sum = 0;
            F0R(j,4)
              sum += dp[i-1][j][a][b][c];
            dp[i][a][b][c][d] = sum%MOD;
          }
  }
  ll ans = 0;
  F0R(a,4)
    F0R(b,4)
      F0R(c,4)
        F0R(d,4){
          if(isBad[a][b][c][d]) continue;
          ans += dp[n][a][b][c][d];
          ans %= MOD;
        }

  cout << ans<< endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 768
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
  int a, b, c, k;
  scanf("%d %d %d %d", &a, &b, &c, &k);
  if (k <= a) printf("%d\n", k);
  else if (a < k && k <= a+b) printf("%d\n", a);
  else if (a+b < k) printf("%d\n", 2*a+b-k);
  return 0;
}

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

#define all(v)			((v).begin()), ((v).end())
#define sz(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
typedef long long ll;
typedef pair<int,int> pi;
vector<vector<int>> v(100009);
bool vis[100009];
long long n;
int dfs(long long a,bool n3,bool n5,bool n7)
{
    if(a>n)
        return 0;
    int x=0;
    if(n3&&n5&&n7)
        x++;
    x+=dfs(a*10+3,1,n5,n7);
    x+=dfs(a*10+5,n3,1,n7);
    x+=dfs(a*10+7,n3,n5,1);
    return x;
}
int main() {
#ifndef ONLINE_JUDGE
	//freopen("test.txt", "rt", stdin);
#endif
    cin>>n;
    cout<<dfs(0,0,0,0);

}


Measured memory_bytes: 2560