akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <algorithm>
#define EPS 1e-10
using namespace std;

double add(double a,double b){
	if(fabs(a+b)<EPS*(fabs(a)+fabs(b)))return 0.0;
	return a+b;
}

class P{
public:
	double x,y;
	P(){}
	P(double xx,double yy){
		x=xx;
		y=yy;
	}
	P operator+(P p){
		return P(add(x,p.x),add(y,p.y));
	}
	P operator-(P p){
		return P(add(x,-p.x),add(y,-p.y));
	}
	P operator*(double d){
		return P(x*d,y*d);
	}
	P operator/(double d){
		return P(x/d,y/d);
	}
};

class Segment{
public:
	P p1,p2;
	Segment(){}
	Segment(P pp1,P pp2){
		p1=pp1;
		p2=pp2;
	}
};

class Circle{
public:
	P c;
	double r;
	Circle(){}
	Circle(P cc, double rr){
		c=cc;
		r=rr;
	}

};
typedef Segment Line;
typedef P Vector;
double norm(Vector p){
	return p.x*p.x+p.y*p.y;
}

double abs(Vector p){
	return sqrt(norm(p));
}

double dot(Vector a,Vector b){
	return add(a.x*b.x,a.y*b.y);
}

double cross(Vector a,Vector b){
	return add(a.x*b.y,-a.y*b.x);
}

P project(Segment s,P p){
	Vector base=s.p2-s.p1;
	double r=dot(p-s.p1,base)/norm(base);
	return s.p1+base*r;
}

P getCrossPoint(Circle c,Line l){
	Vector pr=project(l,c.c);
	Vector e=(l.p2-l.p1)/abs(l.p2-l.p1);
	double base=sqrt(c.r*c.r-norm(pr-c.c));
	return pr+e*base;
}

double getDistanceLP(Line l,P p){
	return abs(cross(l.p2-l.p1,p-l.p1)/abs(l.p2-l.p1));
}

double getDistanceSP(Segment s,P p){
	if(dot(s.p2-s.p1,p-s.p1)<0.0)return abs(p-s.p1);
	if(dot(s.p1-s.p2,p-s.p2)<0.0)return abs(p-s.p2);
	return getDistanceLP(s,p);
}

P p;
Vector v;


int main(void){
	Circle R=Circle(P(0.0,0.0),1.0);
	while(1){
		double d;
		scanf("%lf",&d);
		if(d<EPS)break;
		scanf("%lf %lf %lf %lf",&p.x,&p.y,&v.x,&v.y);
		double V=abs(v);
		double dist=0.0;
		while(dist<=d){
			P p2=p+v*20000.0;
			if(fabs(getDistanceSP(Segment(p,p2),P(0.0,0.0)))<EPS){
				dist+=abs(p);
				break;
			}
			P next=getCrossPoint(R,Line(p,p2));
			double a=atan2(next.y,next.x);
			double b=atan2(v.y,v.x);
			double nextdir=M_PI+a-(b-a);
			v.x=V*cos(nextdir);
			v.y=V*sin(nextdir);
			double bd=abs(next-p);
			dist+=bd;
			p=next;
		}
		if(dist>d)printf("impossible\n");
		else printf("%.9f\n",dist);
	}
	return 0;
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)     for(long long int i=a; i<n; i++)
#define loop(i,a,n)     for(long long int i=a; i>=n; i--) 

int main()
{
	ios_base :: sync_with_stdio(false),cin.tie(NULL);
	
	int a;
	cin>>a;
	long long int b[a], c=0;
	forr(i, 0, a)
		cin>>b[i];
	long long int mx=b[0];
	forr(i, 1, a)
	{
		if(b[i]<mx)
			c+=mx-b[i];
		mx=max(mx, b[i]);
	}
	cout<<c;
	
	return 0;
}

Measured memory_bytes: 5204
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
#define pii pair<ll,ll>
#define ve(x) vector<x>
#define f(a,b,c) for(ll a=b;a<c;a++)
#define foto(x,v) for(auto x:v)
#define read(t) ll t; cin>>t;
#define reads(t) string t; cin>>t;
#define readarr(arr,n) ll arr[n]; f(i,0,n) cin>>arr[i];
#define dbg(x) cout<<#x<<" = "<<x<<endl;
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define all(v) v.begin(),v.end()
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL);	cout.tie(NULL);
const ll M = 1e9+7 , INF = 1e16;


// 														MAIN
int32_t main()
{ 
    FASTIO
    read(n) 
    read(k)
    readarr(a,n)
    ld lo = 0 , hi = 1e10;
    while(abs(lo-hi)>1e-9)
    {
      ld mid = lo+hi;
      mid/=2.0;
      ll cuts = 0;
      f(i,0,n) cuts+= ceil(a[i]/mid);
      if(cuts>k+n) lo = mid;
      else hi = mid;

    }
    // cout<<setprecision(18)<<2.0*lo<<endl;
    cout<<(ll)round(ceil(2.0*lo)/2);
    // cout<<setprecision(18)<<round(lo)<<endl;
    
}



Measured memory_bytes: 5084
a,b,c,d = map(int,input().split())
if c<=a:
    if d<=a:
        print(0)
    elif d<=b:
        print(d-a)
    else:
        print(b-a)
elif c<=b:
    if d<=b:
        print(d-c)
    else:
        print(b-c)
else:
    print(0)


Measured memory_bytes: 9124
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = ni();

		int[] h = new int[n];

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

		int count = 1;

		for (int i = 1; i < n; i++) {
			boolean flg = true;
			for (int j = 0; j < i; j++) {
				if (h[i] < h[j]) {
					flg = false;
					break;
				}
			}
			if (flg) {
				count++;
			}
		}
		out(count);

	}

	/*
	 * 以下メソッド集
	 */
	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static int max(int a, int b) {
		return Math.max(a, b);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static int min(int a, int b) {
		return Math.min(a, b);
	}

	static long min(long a, long b) {
		return Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 200005;
struct Edge{
	int to,next;
}e[MAXN<<1];
bool safe[MAXN];
int dep[MAXN],n,x,y,cnt,head[MAXN];
inline void insert(int u,int v)
{
	e[++cnt].to=v,e[cnt].next=head[u],head[u]=cnt;
	e[++cnt].to=u,e[cnt].next=head[v],head[v]=cnt;
}
int u[MAXN],v[MAXN],pos[MAXN],out[MAXN],sz,fa[MAXN];
void dfs(int x)
{
	pos[x]=++sz;
	for(int i=head[x];i;i=e[i].next){
		int v=e[i].to;
		if(v==fa[x])continue;
		dep[v]=dep[x]+1;
		fa[v]=x;
		dfs(v);
	}
	out[x]=sz;
}
inline bool judge(int x,int y)
{
	if(pos[x]>pos[y])swap(x,y);
	if(pos[y]>=pos[x] && pos[y]<=out[x])return dep[y]-dep[x]>2;
	return fa[x]!=fa[y];
}
namespace Sigma{
	struct Edge{
		int to,next;
	}e[MAXN<<1];
	int head[MAXN],cnt,ans;
	inline void insert(int u,int v)
	{
		e[++cnt].to=v,e[cnt].next=head[u],head[u]=cnt;
		e[++cnt].to=u,e[cnt].next=head[v],head[v]=cnt;
	}
	int getans(int x,int fa,int step)
	{
		if(safe[x])return -1;
		int ret=dep[x];
		for(int i=head[x];i;i=e[i].next){
			int v=e[i].to;
			if(v==fa)continue;
			if(dep[x]==1 && dep[v]<=1)continue;
			if(step+1>=dep[v])continue;
			int val=getans(v,x,step+1);
			if(val==-1)return -1;
			else ret=max(ret,val);
		}
		return ret;
	}
}
int main()
{
	scanf("%d%d%d",&n,&x,&y);
	for(int i=1;i<n;++i){
		scanf("%d%d",u+i,v+i);
	}
	for(int i=1;i<n;++i){
		int u,v;
		scanf("%d%d",&u,&v);
		insert(u,v);
	}
	dfs(y);
	for(int i=1;i<n;++i){
		if(judge(u[i],v[i]))safe[u[i]]=safe[v[i]]=1;
		else Sigma::insert(u[i],v[i]);
	}
	int ans=Sigma::getans(x,0,0);
	cout<<(ans==-1?-1:ans*2)<<endl;
	return 0;
}


Measured memory_bytes: 20992
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, k;
bool bl[110];
int ans;

signed main() {
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		int d; cin >> d;
		for (int j = 0; j < d; j++) {
			int a; cin >> a;
			bl[a] = true;
		}
	}
	for (int i = 1; i <= n; i++)if (!bl[i])ans++;
	cout << ans << endl;
}

Measured memory_bytes: 3636
import java.io.*;
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    Integer a[]  = new Integer[n + 100];
    for (int i = 1; i <= n; i++) {
      a[i]  = sc.nextInt();
    }
    int index = 1;
    int num = 0;
    while(true){
      num++;

      if(a[index] == 2){
        System.out.println(num);
        return;
      }
     
      if(num > n){
        System.out.println(-1);
        return;
      }
      index = a[index];
    }

  }
}


Measured memory_bytes: 64128
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
typedef long long LL;
#define M(a,b) memset(a,b,sizeof(a))
#define pb push_back
const int maxn = 100000+5;
const LL mod = 1000000007;
int t[105];
int main()
{
    int n,m;
    scanf("%d",&n);
    int sum=0;
    for (int i=1;i<=n;++i) {
        scanf("%d",t+i);
        sum+=t[i];
    }
    scanf("%d",&m);
    for (int i=1;i<=m;++i) {
        int x,y;
        scanf("%d%d",&x,&y);
        printf("%d\n",sum+y-t[x]);
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
L = [0]*N
R = [0]*N
for i in range(N):
    l = i - A[i]
    r = i + A[i]
    if 0<l<N:
        L[l] += 1
    if 0<r<N:
        R[r] += 1
# print(L)
# print(R)
c = 0
for i in range(N):
    c += L[i]*R[i]
print(c)

Measured memory_bytes: 32292
N, M = map(int, input().split())
loved_by_everyone = [0] * M
for _ in range(N):
    like_list = list(map(int, input().split()))
    for like in like_list[1:]:
        loved_by_everyone[like-1] += 1

kinds = 0
for food in loved_by_everyone:
    kinds += 1 if food == N else 0
print(kinds)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ll N=2e5+5;
const ld pi=3.14159265359;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(a) (ll)a.size()

ll n,m,ans,dis[25][25];
char u[25][25];
queue<pll>q;
ll dx[4]={0,0,1,-1},dy[4]={1,-1,0,0};


ll f(ll x,ll y){
	ll tmp=0;
	memset(dis,-1,sizeof(dis));
	dis[x][y]=0;
	while(SZ(q))q.pop();
	q.push(mp(x,y));
	while(SZ(q)){
		x=q.front().X;y=q.front().Y;q.pop();
		REP(j,4){
			if(x+dx[j]>n||y+dy[j]>m||x+dx[j]<1||y+dy[j]<1)continue;
			if(u[x+dx[j]][y+dy[j]]=='#')continue;
			if(dis[x+dx[j]][y+dy[j]]!=-1)continue;
			dis[x+dx[j]][y+dy[j]]=dis[x][y]+1;
			q.push(mp(x+dx[j],y+dy[j]));
		}
	}
	REP1(i,n)REP1(j,m)tmp=max(tmp,dis[i][j]);
	return tmp;
}

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n>>m;
	REP1(i,n)REP1(j,m)cin>>u[i][j];
	REP1(i,n)REP1(j,m){
		if(u[i][j]=='.')ans=max(ans,f(i,j));
	}
	cout<<ans<<"\n";
	return 0;
}



Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }
        static void Solve()
        {
            (long N, long A) = Slice<long, long>();
            var Xi = Sarray();
            var dp = new long[50 + 1, 50 + 1, 50 * 50 + 50];//使った個数,Xi,合計値
            dp[0, 0, 0] = 1;
            for (var n = 1; n <= N; ++n)
            {
                for (var i = 1; i <= N; ++i)
                {
                    for (var w = 0; w <= A * N; ++w)
                    {
                        dp[n - 1, i, w] += dp[n - 1, i - 1, w];
                        if (0 != dp[n - 1, i - 1, w])//Xiを加える
                            dp[n, i, w + Xi[i - 1]] += dp[n - 1, i - 1, w];
                    }
                }
            }
            var ans = 0L;
            for (var n = 1; n <= N; ++n)
                ans += dp[n, N, A * n];
            WriteLine(ans);
        }
    }
}

Measured memory_bytes: 77872
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
using pll = pair<ll,ll>;
ll n;
ll ans=0;
vector<pll> vt;   //存value和index 
ll dp[2005][2005];
ll cal(ll a,ll b,ll cnt){
	if(a>b) return 0;
	if(dp[a][b]!=-1) return dp[a][b];
	return dp[a][b] = max(cal(a+1 , b , cnt+1) + vt[cnt].fi*abs(vt[cnt].se-a) , cal(a,b-1,cnt+1) + vt[cnt].fi*abs(vt[cnt].se -b));
}
int main(){
	//freopen("in.txt","r",stdin);
	cin>>n;
	ll t;
	for(ll i=0;i<n;i++){
		cin>>t;
		vt.emplace_back(t,i) ;
	}
	sort(vt.begin() , vt.end() , [](pll x,pll y){if(x.fi != y.fi) return x.fi>y.fi; return x.se>y.se;});  //可以直接用greater
	memset(dp,-1,sizeof(dp));
	cout<<cal(0,n-1,0)<<endl;
	return 0;
}

Measured memory_bytes: 35172
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

int main(void)
{
    long long int sum=0,range=0,a1,b1,a2,b2;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=0,money;
    //vector <int> v;
    //float f,g,h;
    //int c,d,big=0;
    string s;
    cin>>s;
    n=s.size();
    for(i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            sum++;
        }
    }
    cout<<sum;
    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n;
    cin >> n;
    vector <int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }   
    int ans = 0;
    for (int i = n - 1; i >= 0; --i) {
        a[i] += ans;
        int w = (a[i] + b[i] - 1) / b[i] * b[i] - a[i];
        ans += w;
    }   
    cout << ans << endl;
}

Measured memory_bytes: 1792
def abc155c_poll():
    cnt_dict = {}
    n = int(input())
    for i in range(n):
        s = input()
        if s not in cnt_dict.keys():
            cnt_dict[s] = 1
        else:
            cnt_dict[s] += 1

    max_val = max(cnt_dict.values())
    for k in sorted(cnt_dict):
        if cnt_dict[k] == max_val:
            print(k)

abc155c_poll()

Measured memory_bytes: 35408
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX= 100005 ;
const long long mod = 1.0e9+7;
ll ceil(ll a,ll b)
{
    if(a%b==0)
    {
        return a/b;
    }
    else
    {
        return a/b+1;
    }
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m,q,i,j;
    string s,t;
    cin>>s>>t;
    n=s.length();m=t.length();
    int pos=0,x;
    map<ll,vector<ll> > mp;
    for(i=0;i<n;i++)
    {
        mp[s[i]-'a'].push_back(i+1);
    }
    for(i=0;i<m;i++)
    {
        if(mp[t[i]-'a'].size()==0)
        {
            cout<<"-1"<<endl;
            return 0;
        }
        x=upper_bound(mp[t[i]-'a'].begin(),mp[t[i]-'a'].end(),pos%n)-mp[t[i]-'a'].begin();
        if(x==(mp[t[i]-'a'].size()))
        {
            pos=n*ceil(pos,n)+mp[t[i]-'a'][0];
        }
        else
            pos=n*(pos/n)+mp[t[i]-'a'][x];
        //cout<<pos<<endl;
    }
    cout<<pos<<endl;
    return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
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(void){
    int n;
    cin>>n;
    int p[n];
    for(int i=0;i<n;i++) cin>>p[i];
    int ans=0;
    for(int i=1;i<n-1;i++){
        if((p[i-1]<p[i] && p[i]<p[i+1]) || (p[i-1]>p[i] && p[i]>p[i+1])) ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
// AOJ Volume 0 Problem 0053

#include <stdio.h>

int flg_prime[1000001];

int main(void)
{
    int i;
    int j;
    int n;
    int sum;
    
    flg_prime[0] = flg_prime[1] = 1;
    for (i = 2; i <= 1000000; i++){
        if (flg_prime[i] == 0){
            j = i * 2;
            while (j <= 1000000){
                flg_prime[j] = 1;
                j += i;
            }
        }
    }

    while (1){
        scanf("%d", &n);
        if (n == 0){
            break;
        }
        
        sum = 0;
        i = 0;
        while (n > 0){
            if (flg_prime[i] == 0){
                sum += i;
                n--;
            }
            i++;
        }

        printf("%d\n", sum);
    }

    return (0);
}

Measured memory_bytes: 4308
#include <cstdio>
#include <algorithm>
int N, a[100001];
int main()
{
	scanf("%d", &N);
	for (int i = 1; i <= N; i++)
		scanf("%d", a + i);
	puts(std::count_if(a + 1, a + N + 1, [] (int x) { return x & 1; }) & 1 ? "NO" : "YES");
	return 0;
}


Measured memory_bytes: 512
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N = int(input())
    # N, M = map(int, input().split())
    # A = list(map(int, input().split()))



    ans = -(-N // 2)
    print(ans)

if __name__ == "__main__":
    main()

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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

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

    int k;
    cin >> k;

    int n = s.size();
    set<string > st;
    for(int i = 0; i < n; i++){
        string t;
        for(int j = i; j < min(n, i + k); j++){
            t += s[j];
            st.insert(t);
        }
    }

    while(--k) st.erase(st.begin());

    cout << *st.begin() << endl;
    return 0;
}



Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

ll fac[500001],finv[500001],inv[500001];
 
void table() {
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(ll i=2;i<500001;i++){
        fac[i]= fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}

int main(){
    table();
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    string s; cin>>s;
    vector<ll> X[26];
    rep(i,26){
        X[i].pb(0);
        X[i].pb(sz(s)+1);
    }
    rep(i,sz(s)){
        ll tmp=(ll)(s[i]-'a');
        X[tmp].pb(i+1);
    }
    rep(i,26) sort(all(X[i]));
    
    
    ll ans=INF;
    rep(i,26){
        ll tmp=0;
        rep(j,sz(X[i])-1){
            chmax(tmp,X[i][j+1]-X[i][j]-1);
        }
        
        chmin(ans,tmp);
    }
    
    cout<<ans<<endl;
}


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

const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

ll n, p;
ll g, k;

int main(){
    cin >> n >> p;
    rep(i,n) {
        ll x;
        cin >> x;
        if(x%2) k++;
        else g++;
    }
    if(k == 0 && p == 1) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = (1LL<<g)*(1LL<<k)/2;
    if(k == 0) ans *= 2;
    cout << ans << endl;
}
































Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> pii;
typedef std::pair<long long, long long> pll;

using namespace std;

const long long mod = 1000000007;

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

	int n, m;
	cin >> n >> m;
	int num = 1 << n;
	int* dp;
	dp = new int[num];
	memset(dp, -1, sizeof(int) * num);
	dp[0] = 0;
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		int c = 0;
		rep(j, b) {
			int t;
			cin >> t;
			--t;
			c |= 1 << t;
		}

		rep(j, num) {
			if (dp[j] == -1) {
				continue;
			}
			else {
				if (dp[j | c] == -1) {
					dp[j | c] = dp[j] + a;
				}
				else {
					dp[j | c] = min(dp[j | c], dp[j] + a);
				}
			}
		}
	}

	cout << dp[num-1] << "\n";

	return 0;
}


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

int main()
{
  string S, T;
  int a=0;
  cin>>S;
  cin>>T;
  if((S.size()+1)!=T.size())
    cout<<"No";
  else
  {
    for(int i=0; i<S.size(); i++)
    {
      if(S[i]!=T[i])
        break;
      a++;
    }
  }
  if(a==S.size())
	cout<<"Yes";
  else
	cout<<"No";
  return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <stdio.h>

int main(void)
{
	int i, j, n, m, max, tmp;
	char str[200][11];

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

	scanf("%d", &m);
	for(i = n; i < n+m; i++){
		scanf("%s", str[i]);
	}

	max = 0;
	for(i = 0; i < n+m; i++){
		tmp = 0;
		for(j = i; j < n; j++){
			if(!strcmp(str[i], str[j])){
				tmp++;
			}
		}
		for(j = n; j < n+m; j++){
			if(!strcmp(str[i], str[j])){
				tmp--;
			}
		}
		if(max < tmp){
			max = tmp;
		}
	}

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

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
main()
{
     int N,L,i;
     string S[100];
     cin>>N>>L;
     for(i=0;i<N;i++)
     {
                     cin>>S[i];



     }
     sort(S,S+N);
     for(i=0;i<N;i++){
                cout<<S[i];
     }




}

Measured memory_bytes: 3672
N=int(input())
from collections import defaultdict
d = defaultdict(list)
for i in range(N):
  s,p=input().split()
  d[s].append([int(p),i])
for k in sorted(list(d.keys())):
  for p,i in sorted(list(d[k]),key=lambda x:x[0])[::-1]:
    print(i+1)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int A, B, C, D; scanf("%d%d%d%d", &A, &B, &C, &D);
	int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
	
	int X = A * a + B * b + A / 10 * c + B / 20 * d;
	int Y = C * a + D * b + C / 10 * c + D / 20 * d;
	if(X > Y) printf("hiroshi\n");
	else if(X == Y) printf("even\n");
	else printf("kenjiro\n");
	return 0;
}



Measured memory_bytes: 3132
#include <iostream>

using namespace std;

int main()
{
    int A,B,C;
    scanf("%d%d%d", &A,&B,&C);
    if((C > A && C < B) || (C>B && C < A))
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code

int main(int argc, char const* argv[])
{
	int k,x;
	cin >> k >> x;
	for (int i = x-k+1; i < x+k; i++) {
		cout << i << " ";
	}
	cout << endl;
	return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int n;
  cin >> n;
  vector<queue<int>> v(n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n - 1; j++) {
      int a;
      cin >> a;
      a--;
      v[i].push(a);
    }
    v[i].push(-1);  // 最後まで辿り着いたか
  }

  vector<int> vs(n);     // i番目の人が今対戦したい人
  vector<bool> used(n);  // 既に対決したかどうか（疲れてるか）
  for (int i = 0; i < n; i++) {
    vs[i] = v[i].front();
    v[i].pop();
  }

  // 消しながら頑張る
  int days = 0, count = 0;
  bool changed = false;
  while (true) {
    // cout << days << endl;
    for (int i = 0; i < n; i++) {                                       // i番目の人について
      if (vs[i] != -1 && vs[vs[i]] == i && !used[i] && !used[vs[i]]) {  // 組める
        // 今日はもう戦ったことにする
        used[i] = used[vs[i]] = true;
        changed = true;
        count++;

        // 対戦したい相手を更新
        vs[vs[i]] = v[vs[i]].front();
        v[vs[i]].pop();
        vs[i] = v[i].front();
        v[i].pop();
      }
    }

    if (changed)
      changed = false;
    else {
      break;
    }

    days++;
    for (int i = 0; i < n; i++) used[i] = false;  // 疲れをリセット

    // return 0;
  }

  if (count == n * (n - 1) / 2)
    cout << days << endl;
  else
    cout << -1 << endl;
}


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

using namespace std;

int main(void){
	int N,Q;
	string S;
	cin >> N >> Q;
	int L,R;
	cin >> S;
	int i,j;
	int count[N+5] = {0};
	int tmp = 0;
	for(i=0;i<N;i++){
		count[i] = tmp;
		if(S[i]=='A' && S[i+1]=='C') tmp++;
	}
	for(i=0;i<Q;i++){
		cin >> L >> R;
		if(L == 1) cout << count[R-1] << endl;
		else cout << count[R-1]-count[L-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;
using pii = pair<int, int>;

ll f(ll sum, ll x){
  return sum + x * x;
}

int main(){
  int n, k; cin >> n >> k;
  int t[n], d[n];
  pii p[n];
  REP(i, n){
    cin >> t[i] >> d[i];
    p[i] = make_pair(d[i], t[i]);
  }

  sort(p, p+n, greater<pii>());

  ll sum = 0;
  map<int, int> mp;
  priority_queue<pii, vector<pii>, greater<pii>> pq;

  REP(i, k){
    sum += p[i].first;
    mp[p[i].second]++;
    pq.push(p[i]);
  }

  ll ans = f(sum, mp.size());

  for(int i=k; i<n; i++){
    if(mp[p[i].second]) continue;
    pii top = pq.top(); pq.pop();
    int dd = top.first, tt = top.second;
    while(!pq.empty() && mp[tt] == 1){
      top = pq.top(); pq.pop();
      dd = top.first; tt = top.second;
    }

    if(pq.empty()) break;

    sum -= dd; sum += p[i].first;
    mp[tt]--; mp[p[i].second]++;
    pq.push(p[i]);

    ans = max(ans, f(sum, mp.size()));
  }

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


Measured memory_bytes: 5492
#include <iostream>
#include <cstring>
#include <utility>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;


int main() {
    int N, M;
    cin >> N >> M;
    vector <int> s(N, -1);
    for (int i = 0; i < M; i++) {
      int j, k;
      cin >> j >> k;
      if (s[j-1] >= 0 && s[j-1] != k){
        cout << -1 << endl;
        return 0;
      }
      if (N > 1 && j == 1 && k == 0){
        cout << -1 << endl;
        return 0;
      }
      s[j-1] = k;
    }
    vector <int> ans(N, 0);
    if (N > 1) {
      ans[0] = 1;
    }
    for (int i = 0; i < N; i++) {
      if (s[i] >= 0 ) {
        ans[i] = s[i];
      }
    }
    int a = 0;
    for (int i = 0; i < N; i++) {
       a += ans[i] * pow(10, N -i -1);
    }
    cout << a << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main ()
{
	string s,c,r,i;
	s={"Sunny"};
	c={"Cloudy"};
	r={"Rainy"};
	cin>>i;
	if(i==s)
	{
		cout<<"Cloudy";
	}
	if(i==c)
	{
		cout<<"Rainy";
	}
	if(i==r)
	{
		cout<<"Sunny";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a[100005],b[100005];
ll ans;
ll binary(ll i){
	ll left=-1,right=n;
	while(right-left>1){
		ll mid=left+(right-left)/2;
		if(i>a[mid]){
			left=mid;
		}else{
			right=mid;
		}
	}
	return right;
}
int main(void){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		b[i]=a[i];
	}
	sort(a,a+n);
	for(int i=0;i<n;i++){
		ll k=binary(b[i]);
		//cout<<i<<" "<<k<<endl;
		if((i+1)%2!=(k+1)%2){
			ans++;
		}
	}
	cout<<ans/2<<endl;
	
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)

int main(void) {
  int N;
  string S;
	cin >> N;
	cin >> S;
  int ans = 0;
  int cur = 0;
  REP(i,N) {
    if (S.at(i) == 'I') cur++;
    else cur--;
    ans = max(ans, cur);
  }
  cout << ans << '\n';
}


Measured memory_bytes: 384
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

        public static void main(String[] args) {
            String w;
            boolean even = true;
            Scanner input = new Scanner(System.in);
            w=input.nextLine();
            Map<Character,Integer> frq = new HashMap<>();
            for(int i=0;i<w.length();i++){
                if(frq.containsKey(w.charAt(i))){
                    frq.put(w.charAt(i),frq.get(w.charAt(i))+1);
                }
                else{
                    frq.put(w.charAt(i),1);
                }
            }
            for (Map.Entry<Character, Integer> entry : frq.entrySet()) {
                if(entry.getValue()%2!=0){
                    even = false;
                    break;
                }
            }
            if(even==true && w.length()!=0&&w.length()!=1) {
                System.out.println("Yes");
            }
            else{
                System.out.println("No");
            }
        }

}

Measured memory_bytes: 27052
#include <bits/stdc++.h>
using namespace std;
int main(){
  string n;
  cin >> n;
  int s = 0;
  for(int i=0;i<n.size();i++){
    s += n[i]-'0';
  }
  if(stoi(n)%s==0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main()
{
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];

    set< vector<int> > S;
    int res = 0;
    while(1)
    {
        for(int i=0; i<3; i++)
        {
            if(a[0]%2 || a[1]%2 || a[2]%2)
            {
                cout << res << endl;
                return 0;
            }
        }

        if(S.find(a) == S.end())
        {
            S.insert(a);

            vector<int> b(3);
            b[0] = a[1]/2 + a[2]/2;
            b[1] = a[0]/2 + a[2]/2;
            b[2] = a[0]/2 + a[1]/2;

            a = b;
            res++;
        }
        else
        {
            cout << -1 << endl;
            return 0;
        }
    }

    return 0;
}


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

    
int main()
{
   int a[4],ans=1e9;
   for(int i=1;i<=3;i++)cin>>a[i];
   
   for(int i=1;i<=3;i++){ 
       for(int j=i+1;j<=3;j++){ 
           int sum=a[i]+a[j];
           ans=min(ans,sum);
       }}
       cout<<ans<<endl; 
   
   
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (a != b && a != c && b != c) {
		printf("%d", 3);
	} else if(a = b && a == c && b == c) {
		printf("%d", 1);
	} else{
		printf("%d", 2);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int a,b,c;
int ans = 1e9;
void taketake(vector <int> &take, int tak1,int tak2, int tak3, int gomi, int mp,int i){
    if(i==take.size()){
        if(tak1!=0&&tak2!=0&&tak3!=0) {ans=min(ans,abs(tak1-a)+abs(tak2-b)+abs(tak3-c)+mp-30);
        return ;}
        else return ;
    }
    taketake(take,tak1+take[i],tak2,tak3,gomi,mp+10,i+1);
    taketake(take,tak1,tak2+take[i],tak3,gomi,mp+10,i+1);
    taketake(take,tak1,tak2,tak3+take[i],gomi,mp+10,i+1);
    taketake(take,tak1,tak2,tak3,gomi+take[i],mp,i+1);
}
int main(void){
    int n;
    cin>>n>>a>>b>>c;
    vector <int> take(n);
    for (int i=0;i<n;i++){
        cin>>take[i];
    }
    taketake(take,0,0,0,0,0,0);
    cout<<ans<<endl;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> vec(n+1);
  rep(i, n) {
    int a;
    cin >> a;
    ++vec[a];
  }
  sort(vec.begin(), vec.end(), greater<int>());
  int ans = 0;
  for (int i = k; i <= n; ++i) {
    if (!vec[i]) break;
    ans += vec[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstring>
using namespace std;
const int N = 2e5 + 1000;
typedef long long ll;
ll f[N];
ll A[N], B[N];
ll ans[N];
ll find_f(ll x){
    return f[x]<0?x:f[x] = find_f(f[x]);
}
void merge_f(ll a, ll b){
    ll na = -f[a];
    ll nb = -f[b];
    if( na > nb ){
        swap(a,b);
        swap(na,nb);
    }
    f[a] = b;
    f[b] = -(na+nb);
}
ll cal_set(ll x){
    return x*(x-1)/2;
}
int main(){
    ll n,m;
    while(cin>>n>>m){
        ll connected = 0;
        ans[m+1] = 0;
        for(int i = 1 ;i<=n;i++){ f[i] = -1; }
        for(int i = 1;i<=m;i++){ cin>>A[i]>>B[i]; }
        for(int i = m;i>=1;i--){
            ll fa = find_f(A[i]);
            ll fb = find_f(B[i]);
            if( fa == fb ){ 
                ans[i] = connected;
                continue;
            }
            ll tmp1 = cal_set( - f[fa]) + cal_set( - f[fb]);
            ll tmp2 = cal_set( - (f[fa] + f[fb] ));
            connected = connected - tmp1 + tmp2;
            merge_f(fa, fb);
            ans[i] = connected;
        }
        ll tmp = cal_set(n);
        for(int i = 2;i<=m+1;i++){
            cout<<tmp - ans[i]<<endl;
            //cout<<ans[i]<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 6656
/*
    Author - Param Kothari
    Ah shit, here we go again
*/
 
/* Ordered Set Implementaton:

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;

typedef tree<
    int,
    null_type,
    less<int>,
    rb_tree_tag,
    tree_order_statistics_node_update>
ordered_set;
*/

#include <bits/stdc++.h>
 
using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair 
 
typedef long long ll;
typedef long double ld;

void solve(){
    int flag = 0, a = 0, b = 0, res = 0;
    cin >> a >> b;
    for(int i = 1; i <= 100000; i++){
        int res1 = i * 8;
        res1 = res1 / 100;
        int res2 = i / 10;
        if(res1 == a && res2 == b){
            flag = 1;
            res = i;
            break;
        }
    }
    if(flag == 1){
        cout << res << "\n";
    }
    else{
        cout << -1 << "\n";
    }
    return;
}
 
int main(){
    IOS;
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
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 main()
{
    ll k;cin >> k;
    ll sum = 0;
    for (ll a = 1; a <=k; a++)
    {
        for (ll b = 1; b <= k; b++)
        {
            for (ll c = 1; c <= k; c++)
            {
                sum += gcd(gcd(a,b),c);
            }
        }
    }
    cout << sum << endl;
    
}

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

#define pii  pair<int, int>
#define vi vector<int >
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define x first
#define y second
#define sz(x) (x).size()
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

#define ll long long
#define ld long double

const ld EPS = 10e-9;
const int INF = 1e9 + 5;
const long long INFLL = (ll)INF * (ll)INF;
const ll MOD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

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

template <typename T>
ostream& operator<<(ostream& os, const set<T>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it;
        if (it != *v.rbegin())
            os << ", ";
    }
    os << "}\n";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const unordered_set<T>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it;
        if (it != *v.rbegin())
            os << ", ";
    }
    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it.first << " : "
           << it.second;

        if( it != *v.rbegin())
            os  << ", ";
    }

    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const unordered_map<T, S>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it.first << " : "
           << it.second;

        if( it != *v.rbegin())
            os  << ", ";
    }

    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const pair<T, S>& v)
{
    os << "(";
    os << v.first << ", "
       << v.second << ")";
    os << "\n";
    return os;
}

#define DEBUG

#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define debug(...)
#endif


// __gcd(x, y)

ll solve(ll num, ll& limit, ll add) {
    if (limit <= 0)
        return 0;

    if(limit <= num)
    {
        limit -= num;
        return limit * add;
    }
    else
    {
        limit -= num;
        return num * add;
    }
}

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

    ll a, b, c, k;

    cin >> a >> b >> c >> k;

    ll tot = 0;

    if(a <= k)
    {
        tot += a;
        k -= a;
        if(b <= k)
        {
            k -= b;
            if(c >= k)
            {
                tot -= k;
            }
        }
    }
    else
    {
        tot = k;
    }
    cout << tot << endl;
    return 0;
}



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

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
    long long x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    long long n = x / d;
    long long ans = x - min(k, n) * d;
    cout << (k <= n || (k - n) % 2 == 0 ? abs(ans): abs(ans - d)) << '\n';
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define repm(i, a, n) for (ll i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define vd vector<double>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define reverse_v(a) reverse(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    (c) ? (cout << "Yes" << endl) : (cout << "No" << endl);
}

void Print(bool c)
{
    (c) ? (cout << "YES" << endl) : (cout << "NO" << endl);
}

//最小公倍数
template <typename T>
T gcd(T a, T b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

//最大公約数
template <typename T>
T lcm(T a, T b)
{
    return a * b / gcd(a, b);
}
//セカンドキー->ファーストキーの順ソート
bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

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

int eve(int x)
{
    if (x % 400 == 0)
        return 1;
    if (x % 100 == 0)
        return 0;
    if (x % 4 == 0)
        return 1;
    return 0;
}

int main(void)
{
    string s;
    cin >> s;
    ll ans = 0, b = 0;
    rep(i, 0, s.size())
    {
        if (s[i] == 'B')
            b++;
        else
            ans += b;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL;
const int maxn = 1e2 + 20;
int dp[maxn * maxn];
void work() {
    dp[0] = true;
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        int val;
        cin >> val;
        for (int i = 10000; i >= val; --i) {
            if (dp[i - val]) dp[i] = true;
        }
    }
    int ans = 0;
    for (int i = 10000; i >= 0; --i) {
        if (dp[i]) {
            ans = max(ans, i % 10 == 0 ? 0 : i);
        }
    }
    printf("%d\n", ans);
}

int main() {
#ifdef local
    freopen("data.txt", "r", stdin);
//    freopen("data.txt", "w", stdout);
#endif
    work();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int ans = 0;
    for (int i = 1; i < n-1; ++i) {
        if ((a[i] <= a[i+1] && a[i] >= a[i - 1]) || (a[i] >= a[i+1] && a[i] <= a[i - 1])) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 256
s1 = input()
s2 = ''
for c in s1:
    if ord('a') <= ord(c) <= ord('z'):
        c0 = chr(ord(c) - ord('a') + ord('A'))
    elif ord('A') <= ord(c) <= ord('Z'):
        c0 = chr(ord(c) - ord('A') + ord('a'))
    else:
        c0 = c
    s2 += c0
print(s2)


Measured memory_bytes: 5556