akhauriyash/Code-Regression huggingface dataset:
#ifndef DEBUG
#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 999999999999971;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

Int Ceil(Int a, Int b) {
    if (a % b == 0) {
        return a / b;
    } else {
        return Floor(a, b) + 1;
    }
}

Int digits(Int n) {
    return (Int)to_string(n).size();
}

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

    Int A, B, M;
    cin >> A >> B >> M;
    vector<Int> a(A), b(B), x(M), y(M), c(M);
    Int ami = (Int)1 << 35, bmi = (Int)1 << 35;
    for (Int i = 0; i < A; i++) {
        cin >> a[i];
        ami = min(ami, a[i]);
    }
    for (Int i = 0; i < B; i++) {
        cin >> b[i];
        bmi = min(bmi, b[i]);
    }
    for (Int i = 0; i < M; i++) {
        cin >> x[i] >> y[i] >> c[i];
        x[i]--;
        y[i]--;
    }

    Int ans = ami + bmi;
    for (Int i = 0; i < M; i++) {
        Int tem = a[x[i]] + b[y[i]] - c[i];
        ans = min(ans, tem);
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
  int A[3];
  cin >> A[0] >> A[1] >> A[2];

  if (22 <= A[0] + A[1] + A[2]) {
    cout << "bust" << endl;
  } else {
    cout << "win" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
A = []
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))

k = int(input())

ans = "Yay!"
for i in range(len(A)):
    for j in range(i+1, len(A)):
        p, q = A[i], A[j]
        d = q - p
        if d > k:
            ans = ":("

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>

using namespace std;

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

  for (int i = 0; i <= 25; i++){
    for (int j = 0; j <= 14; j++){
      int tmp = i * 4 + j * 7;
      if(tmp == N) ans++;
    }
  }

  if(ans > 0){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}



Measured memory_bytes: 256
fun main(args: Array<String>) {
    val abk = readLine()!!.split(" ").map {
        it.toInt()
    }
    if(abk.get(1) - abk.get(0) < abk.get(2)) {
        for (i in abk.get(0)..abk.get(1)) {
            println(i)
        }
        return
    }
    if(abk.get(1) - abk.get(0) < abk.get(2)*2) {
         for (i in abk.get(0)..abk.get(1)) {
            println(i)
        }
        return
    }
    for(i in abk.get(0)..abk.get(0)+abk.get(2)-1) {
        println(i)
    }
    for(i in abk.get(1)-abk.get(2)+1..abk.get(1)) {
        println(i)
    }
}

Measured memory_bytes: 37900
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
const int MAXN = 12 + 5;
const int MAXM = 12 + 5;
const int inf = 0x3f3f3f3f;

#define bit(x,i) (((x)>>(i))&1)

int a[MAXN][MAXM], c[MAXN];
int b[MAXM];

int main(void)
{
	int n,m,x;
	scanf("%d%d%d",&n,&m,&x);
	for(int i=1; i<=n; ++i)
	{
		scanf("%d",&c[i]);
		for(int j=1; j<=m; ++j) scanf("%d",&a[i][j]);
	}
	
	for(int i=1; i<=n; ++i)
		for(int j=1; j<=m; ++j)
			b[j] += a[i][j];
	for(int i=1; i<=m; ++i)
		if(b[i]<x){ printf("-1"); return 0;}
	
	int all = (1<<n)-1;
	int ans = inf;
	for(int mask=0; mask<=all; ++mask)
	{
		for(int i=1; i<=m; ++i) b[i]=0;
		
		int tot = 0;
		for(int i=1; i<=n; ++i)
		{
			if(!bit(mask,i-1)) continue;
			for(int j=1; j<=m; ++j)
				b[j] += a[i][j];
			tot += c[i];
		}
		
		bool flag=1;
		for(int i=1; i<=m; ++i)
			if(b[i]<x){ flag=0; break;}
		if(!flag) continue;
		
		if(ans>tot) ans=tot;
	}
	printf("%d",ans);
	return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define int long long
#define vi vector<int> 
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >  
#define N 200001
#define mod 1000000007
#define ll long long

int n,m;
vector<string> v(1000);
int dp[1000][1000];
int rec(int i,int j)
{
    if(i>=n or j>=m)
        return 0;
    if(i==n-1 and j==m-1)
        return 1;
    if(v[i][j] == '#')
        return 0;
    if(dp[i][j] == -1)
    {
        int ans = rec(i+1,j);
        ans = ans + rec(i,j+1);
        if(ans>=mod)
            ans-=mod;
        dp[i][j] = ans;
        return ans;
    }
    else
        return dp[i][j];

}

int32_t main()
{
    IOS;
 
    memset(dp,-1,sizeof(dp));
   
    cin>>n>>m;
    for(int i = 0;i < n;i++)
        cin>>v[i];
    cout<<rec(0,0);
    return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  int a[n], b[n], c[n - 1];
  REP(i, n) cin >> a[i];
  REP(i, n) cin >> b[i];
  REP(i, n - 1) cin >> c[i];
  int sum = 0;
  REP(i, n) {
    sum += b[a[i] - 1];
    if (i != 0 && a[i -1] + 1 == a[i]) {
      sum += c[a[i] - 2];
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int[] n = new int[3];
        n[0] = sc.nextInt();
        n[1] = sc.nextInt();
        n[2] = sc.nextInt();
        Arrays.sort(n);
        System.out.println(n[0] + " " + n[1] + " " + n[2]);
    }
}


Measured memory_bytes: 26296
#include <iostream>

using namespace std;

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

    int hap[n][3];
    for (int i = 0; i < n; ++i) {
        std::cin >> hap[i][0] >> hap[i][1] >> hap[i][2];
    }

    int dp[n][3];
    dp[0][0] = hap[0][0];
    dp[0][1] = hap[0][1];
    dp[0][2] = hap[0][2];

    for (int i = 1; i < n; ++i) {
        for (int j = 0; j < 3; ++j) {
            dp[i][j] = max(hap[i][j] + dp[i - 1][(j + 1) % 3], hap[i][j] + dp[i - 1][(j + 2) % 3]);
        }
    }

    std::cout << max(max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]);

    return 0;
}

Measured memory_bytes: 2560
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        String target = sc.next();
        str += str;
        if (str.indexOf(target) != -1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}



Measured memory_bytes: 26340
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#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 ll long long int
#define pb push_back
#define mp make_pair
#define ld long double
#define sz(a) (ll)(a).size()

typedef tree<pair<ll,ll> ,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//K-th smallest
//cout << k << "kth smallest: " << *A.find_by_order(k-1) << endl;
//NO OF ELEMENTS < X
//cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;

const int MAXN = 100005;

ll dp[MAXN], n, h[100005], ninf = -1e18;    // Minimum cost to reach from i to N

ll rec(ll index)
{
	if(index == n - 1) return 0;
	if(index == n - 2) return dp[index] = abs(h[n - 1] - h[n - 2]);
	if(dp[index] != -1) return dp[index];
	return dp[index] = min(abs(h[index] - h[index + 1]) + rec(index + 1), abs(h[index] - h[index + 2]) + rec(index + 2));
}

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

 	cin >> n;
 	for(int i=0;i<n;i++) cin >> h[i];
 	memset(dp, -1, sizeof(dp));	
 	cout << rec(0) << endl;
    return 0;
}

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

		// 文字列の入力
		String[] a = sc.next().split("");
        String[] b = sc.next().split("");
        String[] c = sc.next().split("");
        boolean isShiritori = 
          a[a.length - 1].equals(b[0]) &&
          b[b.length - 1].equals(c[0]);
        
        String ans = isShiritori ? "YES" : "NO";     
    
		// 出力
		System.out.println(ans);
	}
}


Measured memory_bytes: 23764
from sys import stdin, stdout
import math
import bisect
import queue

a, b, c, d = map(int, stdin.readline().strip().split())

while True:
    c -= b
    if c <= 0:
        stdout.writelines('Yes\n')
        break
    a -= d
    if a <= 0:
        stdout.writelines('No\n')
        break


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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
#define INF 1000000

int main()
{
  int n;cin>>n;
  vector<string> s(n);
  vector<int> sz(n);
  int i,j;
  rep(i,n)cin>>s[i];
  rep(i,n)sz[i]=s[i].size();
  int countl=0;
  int countr=0;
  rep(i,n)
  {
    rep(j,sz[i])
    {
      if(s[i][j]=='(')countl++;
      if(s[i][j]==')')countr++;
    }
  }
  if(countl!=countr)
  {
    cout<<"No"<<endl;
  }
  else
  {
    vector<int> inmin(n,0);
    vector<int> last(n);
    vector<pair<int,int>> p_up(0);
    vector<pair<int,int>> p_down(0);
    rep(i,n)
    {
      int now=0;
      rep(j,sz[i])
      {
        if(s[i][j]=='(')now++;
        if(s[i][j]==')')now--;
        inmin[i]=min(inmin[i],now);
      }
      last[i]=now;
      if(last[i]>=0)
      {
        p_up.emplace_back(make_pair(inmin[i],last[i]));
      }
      else
      {
        int now=0;
        inmin[i]=0;
        for(j=sz[i]-1;j>=0;j--)
        {
          if(s[i][j]==')')now++;
          if(s[i][j]=='(')now--;
          inmin[i]=min(inmin[i],now);
        }
        last[i]=now;
        p_down.emplace_back(make_pair(inmin[i],last[i]));
      }  
    }
    sort(all(p_up));
    sort(all(p_down));
    reverse(all(p_up));
    reverse(all(p_down));
    bool ok=true;
    int nowh=0;
    rep(i,(int)p_up.size())
    {
      if(nowh+p_up[i].first<0)
      {
        ok=false;
      }
      nowh+=p_up[i].second;
    }
    nowh=0;
    rep(i,(int)p_down.size())
    {
      if(nowh+p_down[i].first<0)
      {
        ok=false;
      }
      nowh+=p_down[i].second;
    }
    if(ok)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  
}

Measured memory_bytes: 54124
s = input()

def plus(p,n):
	if n==0:
		return eval(p)
	else:
		# nはsを上位の桁から数えて箇所に+を入れるか入れないか場合分けをしている
		return plus(p[:n] + '+' + p[n:], n-1) + plus(p,n-1)
  
print(plus(s,len(s)-1))  


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define maxn 100005
using namespace std;
int gcd(int a,int b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}
int n;
int main()
{

    while(cin>>n)
    {
        int a1,a2;
        cin>>a1>>a2;
        int ans=gcd(a1,a2);
        for(int i=2;i<n;i++)
        {
            int a;
            cin>>a;
            ans=gcd(ans,a);
        }
        cout<<ans<<"\n";
    }


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define time_taken_start int begtime = clock();
#define time_taken_end int endtime = clock(); \
cerr << "\n\n" << "Time elapsed: " << \
(endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
return 0;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 100000000000000007
#define eps 0.000000000001
#define pi acosl(-1)
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vpl vector<pll>
#define vll vector<ll>
#define mseti multiset <ll>
#define msetd multiset <ll,greater<ll>>
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound 
#define stp fixed<<setprecision(20)
#define endl '\n'
ll p[1000009];
ll c[1000009];
void solve()
{
    p[1]=1;
    for(ll i=2;i<=1000000;i++)
    {
        if(p[i]==0)
        {
            for(ll j=i;j<=1000000;j+=i)
            {
                if(p[j]==0)
                    p[j]=i;
            }
        }
    }
    ll n;
    cin>>n;
    ll x;
    cin>>x;
    ll g=x;
    while(x>1)
    {
        c[p[x]]++;
        ll q=p[x];
        while((x%q)==0)
        {
            x/=q;
        }
    }
    for(ll i=1;i<n;i++)
    {
        cin>>x;
        g=__gcd(x,g);
        while(x>1)
        {
            c[p[x]]++;
            ll q=p[x];
            while((x%q)==0)
            {
                x/=q;
            }
        }
    }
    ll flag=1;
    for(ll i=2;i<=1000000;i++)
    {
        if(c[i]>1)
        {
            flag=0;
            break;
        }
    }
    if(flag)
    {
        cout<<"pairwise coprime";
        return;
    }
    if(g==1)
    {
        cout<<"setwise coprime";
        return;
    }
    cout<<"not coprime";
}
int main()
{
    FAST
    #ifdef ayk_16
    freopen("input.txt","rt",stdin);
    freopen("output.txt","wt",stdout);
    #endif
    time_taken_start
    ll t=1;
    //cin>>t;
    for(ll i=0;i<t;i++)
    {
        //cout<<"Case #"<<i+1<<": ";
        solve();
    }
    time_taken_end
}

Measured memory_bytes: 19264
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//オーバーフローに注意 long long　にする
//'1'+=16;      で大文字Aに
//'大文字'+=32;  で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);


 
int main() {
 
  string s;
  cin >> s;
  
  int n = s.size();
  int ans = 50000;
  
  rep(i, n-2) {
  string t = s.substr(i,3);
  int x = stoi(t);
  ans = min(ans, abs(x-753));
  }

  cout << ans << endl;
  
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class DLamp {
public:
	void solve(istream& in, ostream& out) {
        int h,w;
        in >> h >> w;
        vector<vector<char>> s(h,vector<char> (w));
        rep(i,h){
            rep(j,w){
                cin >> s[i][j];
            }
        }
        vector<vector<int>> r(h,vector<int> (w)),l(h,vector<int> (w)),u(h,vector<int> (w)),d(h,vector<int> (w));
        rep(i,h) rep(j,w){
            r[i][j] = 0; l[i][j] = 0; u[i][j] = 0; d[i][j] = 0;
        }

        rep(i,h) rep(j,w) {
            if(s[i][j] == '.'){
                if(j != 0) l[i][j] = l[i][j-1] + 1;
                if(j == 0) l[i][j] = 1;
            }
        }
        for(int i=0;i<h;i++){
            for(int j=w-1;j>=0;j--){
                if(s[i][j] =='.'){
                    if(j != w-1) r[i][j] = r[i][j+1] + 1;
                    else r[i][j] = 1;
                }
            }
        }
        for(int i=0;i<w;i++) {
            for (int j = 0; j < h; j++) {
                if (s[j][i] == '.') {
                    if (j != 0) u[j][i] = u[j - 1][i] + 1;
                    else u[j][i] = 1;
                }
            }
        }
        for(int i=0;i<w;i++){
            for(int j=h-1;j>=0;j--){
                if(s[j][i] == '.'){
                    if(j != h-1) d[j][i] = d[j+1][i] + 1;
                    else d[j][i] = 1;
                }
            }
        }
      
        int ans = 0,check;
        rep(i,h){
            rep(j,w){
                check = l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3;
                ans = max(ans,check);
              }
        }
        out << ans << endl;
	}
};

int main() {
	DLamp solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

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

int main(){
	
	int d[5];
	for(int i=0;i<5;i++)cin>>d[i];
	sort(d, d+5, greater<int>());
	for(int i=0;i<5;i++)cout<<d[i]<<(i==4?"\n":" ");
	
	return 0;
}


Measured memory_bytes: 1176
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int digitSum(int N) {
    int ret = 0;
    for(; N>0; N/=10) {
        ret += (N % 10);
    }
    return ret;
}

double snuke(int N) {
    return 1.0 * N / digitSum(N);
}

int nines(int d) {
    int ret = 1;
    for(int i=0; i<d; i++) ret *= 10;
    return ret - 1;
}
 
signed main() {
    // experiment
    /*
    double mi = INF;
    for(int i=100010; i>=1; i--) {
        double s = snuke(i);
        if(s <= mi) {
            if(i < 80000) cout << i << endl;
        }
        mi = min(mi, s);
    }
    */

    vector<int> nums;
    int K; cin >> K;
    for(int i=1; i<10; i++) {
        nums.push_back(i);
    }
    for(int i=0, stage=1; ; i++, stage++) {
        int lb = i, ub = i*10 + 10;
        for(int k=lb; k<ub; k++) {
            int A = k, B = nines(stage);
            int num = stoll(to_string(A) + to_string(B));

            if(num > 1e16) goto get_ans;
            if(num != 9) nums.push_back(num);
        }
    }

    get_ans:
    int M = nums.size();
    vector<int> ans;
    for(int i=0; i<M; i++) {
        double snuke_N = snuke(nums[i]);
        bool ok = true;
        for(int j=i+1; j<M; j++) {
            double snuke_C = snuke(nums[j]);
            if(snuke_N > snuke_C) {
                ok = false;
                break;
            }
        }

        if(ok) ans.push_back(nums[i]);
    }

    for(int i=0; i<K; i++) {
        cout << ans[i] << endl;
    }
    fprintf(stderr, "nums size = %zu, ans size = %zu\n", nums.size(), ans.size());
    return 0;
}

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

int main() {
  int H, W;
  std::cin >> H >> W;
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      std::string s;
      std::cin >> s;
      if (s == "snuke") {
	std::cout << (char)('A' + j) << (i + 1) << std::endl;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var H = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();

        int count = 0;
        int maxCount = 0;

        if(N == 1)
        {
            Console.WriteLine(0);
            return;
        }

        for(var i = 0; i < N - 1; i++)
        {
            if(H[i] >= H[i + 1])
            {
                count++;

                if(i == N - 2)
                {
                    if(maxCount < count)
                    {
                        maxCount = count;
                    }
                }
            }
            else
            {
                if(maxCount < count)
                {
                    maxCount = count;
                }

                count = 0;
            }
        }

        Console.WriteLine(maxCount);
    }
}


Measured memory_bytes: 31452
#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 mp make_pair
#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};
const int mod = 1000000007;
const int max_n = 200005;
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;
    rep(i,n){
        string s,t;cin >>s >>t;
        vvl dp(s.size()+1,vl(t.size()+1,0));
        rep(j,s.size()){
            rep(k,t.size()){
                if(s[j]==t[k]){
                    dp[j+1][k+1]=dp[j][k]+1;
                }
                else{
                    dp[j+1][k+1]=max(dp[j][k+1],dp[j+1][k]);
                }
            }
        }
        cout << dp[s.size()][t.size()] <<endl;
    }
}


Measured memory_bytes: 10760
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input1 = sc.nextInt();
		int input2 = sc.nextInt();
		sc.close();

		if (input1 > 9 || input2 > 9) {
			System.out.println(-1);
		}else {
			System.out.println(input1*input2);
		}
	}

}

Measured memory_bytes: 22996
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int d[] = new int[k];
		String dStr[] = new String[k];
		for (int i = 0; i < k; i++) {
			d[i] = sc.nextInt();
			dStr[i] = String.valueOf(d[i]);
		}
		String nStr = "";
		int result = 0;
		for (int i = n; i < 100000; i++) {
			nStr = String.valueOf(i);
			for (int j = 0; j < k; j++) {
				result = nStr.indexOf(dStr[j]);
				if (result == -1) {
					if (j == k - 1) {
						System.out.println(i);
						return;
					}
					continue;
				}
				break;
			}
		}
	}
}

Measured memory_bytes: 24400
/*********************
*  Author: xuziyuan  * 
*********************/

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,dist[100010];
deque <int> q;

int main()
{
	cin>>n;
	rep(i,100005) dist[i]=1e9;
	dist[1]=1;
	q.pb(1);
	while(!q.empty())
	{
		int t=q.front();
		q.pop_front();
		if(dist[(t+1)%n]>dist[t]+1)
		{
			dist[(t+1)%n]=dist[t]+1;
			q.pb((t+1)%n);
		}
		if(dist[t*10%n]>dist[t])
		{
			dist[t*10%n]=dist[t];
			q.push_front(t*10%n);
		}
	}
	cout<<dist[0]<<endl;
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <string.h>
#include<algorithm>
using namespace std;

int main()
{
	int N, d[50],SUM = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> d[i];
	}
	for (int i = 0; i < N; i++) {
		for (int l = i; l < N - 1; l++) {
			SUM += d[i] * d[l + 1];
		}
	}
	cout << SUM << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Main main = new Main();
		main.solveB();
	}

	private void solveB() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int output = 1;
		for (int i = 0; i < N; i++) {
			if (output < K) {
				output *= 2;
			} else {
				output += K;
			}
		}
		System.out.println(output);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i = 0; i < n; i++)
typedef long long ll;
// Welcome to my source code!

int main() {
    int a, b;
    cin >> a >> b;
    if (a <= 9 && b <= 9) cout << a*b << endl;
    else cout << -1 << endl;
}

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


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

    int N;
    cin >> N;
    int A[N] = {};
    int B[N] = {};
    int C[N] = {};
    for (int i=0; i<N; i++){
        cin >> A[i];
    }
    for (int i=0; i<N; i++){
        cin >> B[i];
    }
    for (int i=0; i<N-1; i++){
        cin >> C[i];
    }
    
    int pre_A = -1;
    int ans = 0;
    for (int i=0; i<N; i++){
        ans += B[A[i]-1];
        if (A[i]-pre_A == 1){
            ans += C[A[i]-2];
        }
        pre_A = A[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    unsigned long long a, b, c;
    cin >> a >> b >> c;
    if (a == b && a == c) {
        cout << (a % 2 == 0 ? -1 : 0) << endl;
    }
    else {
        unsigned long long count = 0;
        while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
            ++count;
            unsigned long long tmp_a = (b + c) / 2;
            unsigned long long tmp_b = (a + c) / 2;
            unsigned long long tmp_c = (a + b) / 2;
            a = tmp_a;
            b = tmp_b;
            c = tmp_c;
        }
        cout << count << endl;
    }
    return EXIT_SUCCESS;
}

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

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
// #define int long long

using namespace std;

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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...) 42
#define dump(x) 42
#define debug(x) 42
#endif

typedef long long ll;

const ll MOD = 1e9 + 7;

void solve(int N, vector<string>& S) {
    int answer = 0;
    for (const string& s : S) {
        string::size_type pos = s.find("AB");
        while (pos != string::npos) {
            answer++;
            pos = s.find("AB", pos + 2);
        }
    }

    int countOfHeadBTailA = 0, countOfHeadB = 0, countOfTailA = 0;

    for (const string& s : S) {
        if (s.front() == 'B' && s.back() == 'A') countOfHeadBTailA++;
        else if (s.front() == 'B') countOfHeadB++;
        else if (s.back() == 'A') countOfTailA++;
    }

    if (countOfHeadBTailA > 0) {
        answer += countOfHeadBTailA - 1;
        countOfHeadBTailA = 0;
        if (countOfTailA > 0) {
            answer++;
            countOfTailA--;
        }
        if (countOfHeadB > 0) {
            answer++;
            countOfHeadB--;
        }
    }
    answer += min(countOfHeadB, countOfTailA);
    countOfHeadB = countOfTailA = 0;

    cout << answer << '\n';

    return;
}

signed main() {
    int N;
    cin >> N;
    vector<string> S(N);
    REP(i,0,N) cin >> S[i];
    
    solve(N, S);
    
    return 0;
}



Measured memory_bytes: 768
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
from math import sqrt, ceil, floor
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

s = LS()
if "7" in s:
    print("Yes")
    exit()
print("No")


Measured memory_bytes: 72524
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
char s0[] = "AKIHABARA", s[55];
int main()
{
    scanf("%s", s);
    int len = strlen(s), ok = 1, i , j;
    for(i = 0, j = 0; i < len && j < 9;) {
        if(s0[j] == s[i]) { i++; j++; }
        else if(s0[j] == 'A') { j++; }
        else { ok = 0; break; }
    }
    if(i < len) ok = 0;
    else if(j < 9) {
        while(j < 9 && s0[j] == 'A') j++;
        if(j < 9) ok = 0;
    }
    if(ok) printf("YES\n");
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define printx(x) printf("%lld\n",x);
#define printxy(x,y) cout << x << y <<endl;
#define printxyz(x,y,z) cout << x << y << z <<endl;
#define deba(a) cout << #a << a << endl;
#define debab(a,b) cout << #a << a << #b << b << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	ll n;
	cin >> n;
	string s;
	cin >> s;
	ll i = 0, j = n - 1, cnt1 = 0;
	while (i < j)
	{
		while (s[i] == 'R')
			i++;
		while (s[j] == 'W')
			j--;
		if (s[j] == 'R' and s[i] == 'W' and i < j)
		{
			cnt1++;
			i++;
			j--;
		}
	}
	// deba(cnt1);
	ll cntw = 0, cntr = 0;
	rep(i, 0, n)
	{
		if (s[i] == 'W')
			cntw++;
		else
			cntr++;
	}
	// deba(cntr);
	// deba(cntw);
	cout << min(min(cntr, cntw), cnt1);
	return 0;
}

Measured memory_bytes: 3748
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (PrintWriter out = new PrintWriter(System.out); Scanner sc = new Scanner(System.in);) {
			Task task = new Task();
			task.solve(sc, out);
			out.flush();

		} catch (Exception e) {
			// DO NOT USE
			

		}
	}

	static class Task {
		public void solve(Scanner sc, PrintWriter out) {
			// TODO
			int a = nint(sc) + 1;
			int b = nint(sc);

			out.print(a - b);
		}
	}

	// method
	static int nint(Scanner sc) {
		return Integer.parseInt(sc.next());
	}

	static long nlong(Scanner sc) {
		return Long.parseLong(sc.next());
	}

	static double ndouble(Scanner sc) {
		return Double.parseDouble(sc.next());
	}

	static String nstr(Scanner sc) {
		return sc.next();
	}

	static long[] longLine(Scanner sc, int size) {
		long[] lLine = new long[size];
		for (int i = 0; i < size; i++) {
			lLine[i] = nlong(sc);
		}
		return lLine;
	}

	static int[] intLine(Scanner sc, int size) {
		int[] iLine = new int[size];
		for (int i = 0; i < size; i++) {
			iLine[i] = nint(sc);
		}
		return iLine;
	}

	static String[] strLine(Scanner sc, int size) {
		String[] strLine = new String[size];
		for (int i = 0; i < size; i++) {
			strLine[i] = nstr(sc);
		}
		return strLine;
	}

	static long maxFromList(List<Long> longList) {
		return longList.stream().max(Comparator.naturalOrder()).get();
	}

	static long minFromList(List<Long> longList) {
		return longList.stream().min(Comparator.naturalOrder()).get();
	}

	public static int sumDigits(int n) {
		int sum = 0;
		while (n != 0) {
			sum += n % 10;
			n /= 10;
		}
		return sum;
	}

	public static long sumDigits(long n) {
		long sum = 0;
		while (n != 0) {
			sum += n % 10;
			n /= 10;
		}
		return sum;
	}

	static List<Integer> getIntegerList(Scanner sc, int size) {
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < size; i++) {
			list.add(nint(sc));
		}
		return list;
	}

	static List<Long> getLongList(Scanner sc, int size) {
		List<Long> list = new ArrayList<>();
		for (int i = 0; i < size; i++) {
			list.add(nlong(sc));
		}
		return list;
	}
}

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

#define print cout <<
#define printl(s) cout << s << endl;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;

const ll modseed = pow(10,9) + 7;

template <typename T>
vector<T> getValues(int num){
    vector<T> values(num);
    for(int i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

ll calculateMod(ll n, ll expo, ll modSeed){
  ll ret = 1;
  rep(i, expo){
    ret *= n;
    ret = ret%modSeed;
  }
  return ret;
}

int main(){
    ll N;
    cin >> N;
    ll ans = calculateMod(10,N, modseed);
    ans -= calculateMod(9, N, modseed)*2;
    ans += calculateMod(8,N,modseed);
    ans %= modseed;
    ans=(ans+modseed)%modseed;
    printl(ans);
}


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

int main(void) {
ll a,b,n;
cin >> a >> b >> n;
ll z;
if (n >= b) z = b-1;
else z = n;
cout << a*z/b << endl;


return 0;
}





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

int main() 
{
	int N, A[100], R[9] = {0},ans = 0;

	cin >> N;

	for (int n = 0; n < N; n++) {
		cin >> A[n];
		if (A[n] <= 399)R[0]++;
		else if (A[n] <= 799)R[1]++;
		else if (A[n] <= 1199)R[2]++;
		else if (A[n] <= 1599)R[3]++;
		else if (A[n] <= 1999)R[4]++;
		else if (A[n] <= 2399)R[5]++;
		else if (A[n] <= 2799)R[6]++;
		else if (A[n] <= 3199)R[7]++;
		else R[8]++;
	}

	for (int n = 0; n < 8; n++) {
		if (R[n] != 0)ans++;
	}

	int ansm = ans;
	if (ans == 0)ans = 1;

	cout << ans << " " << ansm + R[8] << endl;

	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <sstream>

using namespace std;

typedef long long li;
typedef pair<int, int> pii;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)

double eps = 1e-5;
const int INF = 2e9 + 7;
const li LINF = 9e18 + 7;


int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

	int n;
	cin >> n;

	vector<li> a(n), b(n);
	forn(i, n)
		cin >> a[i];
	forn(i, n)
		cin >> b[i];
	
	forn(i, n) {
		if (a[i] <= b[i])
			continue;

		li need = a[i] - b[i];
		forn(j, n) {
			if (need == 0)
				break;

			li d = (max(0ll, (b[j] - a[j])) >> 1);

			d = min(d, need);

			need -= d;
			a[j] += (d << 1);

		}

		if (need != 0) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
Int INF = 1e18;
double EPS = 0.00000001;
//Int mod = 998244353;

int main() {
    Int n;
    cin >> n;
    vector<bool> a(n + 1);
    for (Int i = 1; i <= n; i++) {
        Int x;
        cin >> x;
        a[i] = (x == 1);
    }
    vector<bool> b(n + 1, false);
    vector<bool> res(n + 1, false);
    for (Int i = n; i >= 1; i--) {
        if (a[i] != b[i]) {
            res[i] = true;
            for (Int j = 1; j * j <= i; j++) {
                if (i % j == 0) {
                    if (j * j == i) {
                        b[j] = !b[j];
                    }
                    else {
                        b[j] = !b[j];
                        b[i / j] = !b[i / j];
                    }
                }
            }
        }
    }
   // else {
        Int cnt = 0;
        for (Int i = 1; i <= n; i++) {
            if (res[i]) cnt++;
        }
        dump(cnt);
        if (cnt == 0) {
            return 0;
        }
        for (Int i = 1; i <= n; i++) {
            if (res[i]) cout << i << " ";
        }
        cout << endl;
    //}
    return 0;
}

Measured memory_bytes: 1152
#include <string>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <math.h>
 
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
 
	int x,y,z;
	cin >> x >> y;
    z = x*y;
  
    if(z%2==0){
      cout << "Even" << "\n";
    }else{
      cout << "Odd" << "\n";
    }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    lint A, B;
    cin >> A >> B;
    lint D = gcd(A, B);
    int ans = 1;
    for(lint i = 2; i * i <= D; i++){
        if(D % i){
            continue;
        }
        ans++;
        while(D % i == 0){
            D /= i;
        }
    }
    if(D > 1){
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void func()
{
	int n;
	cin>>n;
	int a[n+1],b[n+1],c[n+1];
	int dp1[n+1],dp2[n+1],dp3[n+1];
	for(int i=1;i<=n;i++)
	cin>>a[i]>>b[i]>>c[i];
	dp1[0]=dp2[0]=dp3[0]=0;
	for(int i=1;i<=n;i++)
	{
		dp1[i]=a[i]+max(dp2[i-1],dp3[i-1]);
		dp2[i]=b[i]+max(dp1[i-1],dp3[i-1]);
		dp3[i]=c[i]+max(dp1[i-1],dp2[i-1]);
	}
	int dp=max(dp1[n],max(dp2[n],dp3[n]));
	cout<<dp;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    func();
	return 0;
}


Measured memory_bytes: 2560
// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

LL bin(LL a, LL b, LL p) {
	LL res = 1;
	for (a%=p; b; b>>=1, a=a*a%p)
		if (b & 1)
			res = res * a % p;
	return res;
}


const double pi = 3.141592653;
int main(int argc, char const *argv[]) {
    // code
    double r;
    cin >> r;
    cout << r * 2 * pi << endl;
    return 0;
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
#define ll long long
char str[200002];

int main()
{
    int n,i,j,cnt=0;
    cin>>n>>str;
    for(i=0,j=n-1;i<=j;)
    {
        if(str[i]=='R')i++;
        if(str[j]=='W')j--;
        if(i<=j && str[i]=='W' && str[j]=='R')
        {
            cnt++,i++,j--;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3828
#include<bits/stdc++.h>
#define EM 1000000
using namespace std;
using LL = long long;
using P = pair<LL, LL>;
LL LINF = 1e18;
int INF = 1e9;
LL mod = 1e9+7;
using vint = vector<int>;
using vLL = vector<LL>;
using vvint = vector<vector<int>>;
using vvLL = vector<vector<LL>>;
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 main(){
    int N;
    cin >> N;
    vector<vector<int>> a(N, vector<int>(N-1));
    vector<int>    cur(N, 0), used(N, 0);
    vector<int> p, p2;
    for(int i = 0;i < N;i++){
        for(int j = 0;j < N-1;j++){
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    int ans = 0;
    bool ff = true;
    for(int i = 0;i < N;i++)    p.push_back(i);
    while(true){
        bool f = false;
        for(auto i : p){
            if(cur[i] >= N-1)   continue;
            int ne = a[i][cur[i]];
            if(used[i])    continue;
            if(cur[ne] < N-1 && a[ne][cur[ne]] == i && !used[ne]) {
                cur[i]++;
                cur[ne]++;
                used[i] = 1;
                used[ne] = 1;
                f = true;
                p2.push_back(ne);
                p2.push_back(i);
            }
        }
        for(int i = 0;i < N;i++)    used[i] = 0;
        if(!f)  break;
        p = p2;
        p2.clear();
        ans++;
    }
    for(int i = 0;i < N;i++)    if(cur[i] != N-1)   ff = false;
    if(ff)  cout << ans << endl;
    else    cout << -1 << endl;
}

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

int main() {
  int n, m;
  string s;
  cin >> n >> m >> s;
  int mvcnt[n+1], to = n, nextto = n;
  mvcnt[n] = 0;
  for (int i=0; i<n; i++)
    mvcnt[i] = -1;
  for (int i=n-1; i>=0; i--) {
    if (to-i > m) {
      if (to == nextto) {
        cout << -1 << endl;
        return 0;
      }
      to = nextto;
    }
    if (s[i] == '1')
      continue;
    nextto = i;
    mvcnt[i] = mvcnt[to]+1;
  }
  int cnt = mvcnt[0]-1, grid = 0;
  for (int i=1; i<=n; i++) {
    if (mvcnt[i] == cnt) {
      cout << i-grid << ' ';
      grid = i;
      cnt--;
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 1024
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = [inp() for _ in range(5)]
print((n+min(a)-1)//min(a) + 4)


Measured memory_bytes: 63980
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int A, B, N;
  cin >> A >> B;
  
  for (int i = A; A <= B; A++) {
    if (A % 10 == A / 10000 && A % 100 /10 == A /1000 % 10) N = N + 1;
  }
  
  cout << N << endl;
}

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

using namespace std;
typedef long long ll;
#define MOD 1000000007

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

  ll a, b;
  cin >> a >> b;

  if (a < b)
  {
    for (auto i = 0; i < b; i++)
    {
      cout << a;
    }
    cout << endl;
  }
  else
  {
    for (auto i = 0; i < a; i++)
    {
      cout << b;
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a =int(input())
print(l[a-1])





Measured memory_bytes: 2940