akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

ld dist(pair<ld,ld> A,pair<ld,ld> B){
	return sqrt((A.fr-B.fr)*(A.fr-B.fr)+(A.sc-B.sc)*(A.sc-B.sc));
}
ld Area(pair<ld,ld> A,pair<ld,ld> B,pair<ld,ld> C){
	return abs((B.fr-A.fr)*(C.sc-A.sc)-(C.fr-A.fr)*(B.sc-A.sc))/2.0;
}

pair<ld,ld> f(pair<ld,ld> A,pair<ld,ld> B,pair<ld,ld> C){
	ld d1 = dist(A,B);
	ld d2 = dist(A,C);
	return pair<ld,ld>((B.fr*d2+C.fr*d1)/(d1+d2),(B.sc*d2+C.sc*d1)/(d1+d2));
}
pair<ld,ld> g(pair<ld,ld> A,pair<ld,ld> B,ld x,ld y){
	A.fr += (B.fr-A.fr)*y/x;
	A.sc += (B.sc-A.sc)*y/x;
	return A;
}

int main(){
	while(1){
		int x[3],y[3];
		rep(i,3)scanf("%d%d",&x[i],&y[i]);
		if(x[0] == x[1] && y[0] == y[1])break;
		pair<ld,ld> p[3];
		p[0] = pair<ld,ld>(x[0],y[0]);
		p[1] = pair<ld,ld>(x[1],y[1]);
		p[2] = pair<ld,ld>(x[2],y[2]);
		pair<ld,ld> I = f(p[1],p[0],f(p[0],p[1],p[2]));
		
		ld Ir = Area(p[0],p[1],p[2])*2.0/(dist(p[0],p[1])+dist(p[1],p[2])+dist(p[2],p[0]));
		
		//cout << I.fr << " " << I.sc << endl;
		//cout << Ir << endl;
		
		ld A[3];
		
		ld l=0,r=Ir;
		while(l+0.0000001<r){
			ld R0 = (l+r)/2.0;
			pair<ld,ld> q[1] = {g(p[0],I,Ir,R0)};
			ld R1_l=0,R1_r=Ir;
			while(R1_l+0.0000001<R1_r){
				ld R1 = (R1_l+R1_r)/2.0;
				if(dist(g(p[1],I,Ir,R1),q[0]) > R0+R1)R1_l = R1;
				else R1_r = R1;
			}
			ld R2_l=0,R2_r=Ir;
			while(R2_l+0.0000001<R2_r){
				ld R2 = (R2_l+R2_r)/2.0;
				if(dist(g(p[2],I,Ir,R2),q[0]) > R0+R2)R2_l = R2;
				else R2_r = R2;
			}
			//cout << R1_l << " " << R2_l << endl;
			if(dist(g(p[1],I,Ir,R1_l),g(p[2],I,Ir,R2_l)) < R1_l+R2_l){
				l=R0;
			}
			else r=R0;
			A[0] = R0;
			A[1] = R1_l;
			A[2] = R2_l;
		}
		cout.precision(20);
		cout << A[0] << " " << A[1] << " " << A[2] << endl;
	}
}

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

int main(){
    // input
    int A, B, ans;
    cin >> A >> B;

    //
    if( A < 10 && B < 10 ){
        ans = A*B;
    }else{
        ans = -1;
    }

    // output
    cout << ans << endl;
} 

Measured memory_bytes: 256
import numpy as np
N,M=map(int,input().split())
a=[int(input()) for i in range(M)]
a_a=np.ones( N+1 )
MOD=7+10**9
for i in range(M):
    a_a[a[i]]=0
c=np.zeros(N+1)
c[0]=1
for i in range(1,N+1):
    if i==1:
        c[i]=c[i-1]*a_a[i-1]
    else:
        c[i]=c[i-1]*a_a[i-1]%MOD+c[i-2]*a_a[i-2]%MOD
print(int(c[N])%MOD)

Measured memory_bytes: 17740
while True :
    a ,op, b = input().split()
    a = int(a)
    b = int(b)
    if op == "+" :
        print(a+b)
    elif op == "-" :
        print(a-b)
    elif op == "*" :
        print(a*b)
    elif op == "/" :
        print(a//b)
    elif op == "?" :
        break


Measured memory_bytes: 5596
def main2():
    S=list(input())
    K=int(input())
    N=len(S)

    P=sorted(S)
    l=[]
    a=[]
    k=0
    while len(l)<=5 and k<N:
        if P[k] not in a:
            a.append(P[k])
            for n in range(N):
                if S[n]==P[k]:
                    for i in range(1,6):
                        if n+i<=N:
                            tmp="".join(S[n:n+i])
                            if tmp not in l:
                                l.append(tmp)
        k+=1
    l.sort()
    print(l[K-1])

if __name__=="__main__":
    main2()

Measured memory_bytes: 9204
import sys
input = sys.stdin.readline #for input speed
sys.setrecursionlimit(10**6) #for deep recursion

N, Q = map(int, input().split())

v = [[] for i in range(N)]
score = [0]*N

def dfs(cur,par):
  for chi in v[cur]:
    if chi == par:
      continue
    score[chi] += score[cur]
    dfs(chi, cur)
      
for i in range(N-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  v[a].append(b)
  v[b].append(a)

for j in range(Q):
  p, x = map(int, input().split())
  score[p-1] += x

dfs(0,-1)
score_int=[str(a) for a in score]
output= ' '.join(score_int)
print(output)
  


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

int main()
{
    int h, w;
    while(1)
    {
        cin >> h >> w;
        if(h == 0 && w == 0) break;
        for(int i=0;i<h;i++)
        {
            for(int j=0;j<w;j++)
            {
                if(i == 0 || i == h - 1 || j == 0 || j == w - 1)
                {
                    cout << '#';
                } else {
                    cout << '.';
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3092
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class C
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		double[] x = new double[N];
		double[] y = new double[N];
		for(int i = 0; i < N; i++)
		{
			x[i] = GetDouble();
			y[i] = GetDouble();
		}

		double[,] cost = new double[N, N];
		for(int i = 0; i < N; i++)
		{
			for(int j = 0; j < N; j++)
			{
				double dx = x[j] - x[i];
				double dy = y[j] - y[i];
				cost[i, j] = Sqrt(dx * dx + dy * dy);
			}
		}

		double sum = 0.0;
		var perm = Enumerable.Range(0, N).ToArray();
		do
		{
			for(int i = 0; i < N - 1; i++)
				sum += cost[perm[i + 1], perm[i]];

		} while (nextPermutation(ref perm));

		double fact = 1.0;
		for(int i = 2; i <= N; i++)
			fact *= (double)i;

		double ans = sum / fact;
		WriteLine($"{ans:F9}");
	}

	private static bool nextPermutation(ref int[] array)
	{
		int len = array.Length;
		int i = len - 2;
		while((i >= 0) && (array[i] > array[i + 1]))
			i--;
		if(i < 0)
			return false;

		int pivot = array[i];
		int j = i + 1;
		while((j < len - 1) && (array[j + 1] > pivot))
			j++;
		
		int tmp = array[i];
		array[i] = array[j];
		array[j] = tmp;
		
		Array.Reverse(array, i + 1, len - i - 1);

		return true;
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 13268
s_ = input()
t = input()

for i, s_i in tuple(zip(range(len(s_)-len(t)+1), [s_[x:x+len(t)] for x in range(len(s_)-len(t)+1)]))[::-1]:
    if all((s_i_c == "?" or s_i_c == t[j]) for j, s_i_c in enumerate(s_i)):
        print((s_[:i] + t + s_[i+len(t):]).replace("?", "a"))
        exit()
print("UNRESTORABLE")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define N 5005
#define M 305
#define LL long long
using namespace std;
int n,m,A[M][N],son[N][2],f[N],st[N],top; LL B[N],S[N][N],ans;
void solve(int op,int t,int l,int r)
{
	if(l>r) return ;
	//l~t,t~r
	S[l][t]+=A[op][t],S[t+1][r+1]+=A[op][t];
	S[t+1][t]-=A[op][t],S[l][r+1]-=A[op][t];
	solve(op,son[t][0],l,t-1);
	solve(op,son[t][1],t+1,r);
}
int main()
{
	int i,j,p;
	scanf("%d %d",&n,&m);
	for(i=2;i<=n;i++)
		scanf("%lld",&B[i]),B[i]+=B[i-1];
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			scanf("%d",&A[j][i]);
	for(i=1;i<=m;i++){
		for(j=1;j<=n;j++) f[j]=son[j][0]=son[j][1]=0;
		top=0;
		for(j=1;j<=n;j++){
			p=0;
			while(top&&A[i][j]>=A[i][st[top]])
				f[p]=st[top],p=st[top--];
			f[p]=j,st[++top]=j;
		  }
		while(top>1) f[st[top]]=st[top-1],top--;
		p=0;
		for(j=1;j<=n;j++){
			if(!f[j]){ p=j; continue;}
			if(f[j]<j) son[f[j]][1]=j;
			else son[f[j]][0]=j;
		  }
		solve(i,p,1,n);
	  }
	for(i=1;i<=n;i++)
		for(j=1;j<=n;j++)
			S[i][j]+=S[i][j-1];
	for(i=1;i<=n;i++)
		for(j=1;j<=n;j++)
			S[i][j]+=S[i-1][j];
	for(i=1;i<=n;i++)
		for(j=i;j<=n;j++)
			ans=max(ans,S[i][j]-B[j]+B[i]);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 200960
using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;

namespace ConsoleApp2
{
    class Program {
        static void Main(string[] Args) {
            int N = int.Parse(ReadLine());
            WriteLine((N * 800) - (N / 15) * 200);

            ReadLine();
        }
    }
}


Measured memory_bytes: 11092
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

int main(){
  long long n,k;
  cin >> n >> k;
  long long ans = 1;
  for(int i = 0; i < n; i++){
    if(ans + k < ans * 2) ans += k;
    else ans *= 2;
  }
  cout << ans << endl;
  return 0;
}


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

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
int compare_int2(const void *a, const void *b)
{
    return *(int*)b - *(int*)a;
}

int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    int a[n],b[n];
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        b[i]=0;
    }
    qsort(a, n, sizeof(int), compare_int);
    int x=0,buf=a[0];
    for(int i=0;i<n;i++){
        if(buf!=a[i]){
            x++;
            buf=a[i];
        }
        b[x]++;
    }
    int res=0;
    if(x+1>k){
        qsort(b, n, sizeof(int), compare_int);
        for(int i=0;i<n-k;i++){
            res+=b[i];
        }
    }/*else if(x+1==k){
        res=0;
    }else if(x+1<k){
        qsort(b, n, sizeof(int), compare_int2);
        int i=0;
        while(1){
            if(b[i]>1){
                b[i]--;
                res++;
                x++;
            }else{
                i++;
            }
            if(x+1==k)
                break;
        }
    }*/
    printf("%d\n",res);
    return 0;
}


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

int main(){
    int h,w;
    for (;;) {
        scanf("%d %d",&h,&w);
        if (h==0 && w==0) break;
        for (int i=0;i<h;i++) {
            for (int j=0;j<w;j++) {
                if (j<w-1) printf("#");
                else printf("#\n");
            }
        }
        puts("");
    }
    return 0;
}



Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << "-1" << endl;return 0
#define MM <<" "<<
#define Endl endl

signed main(){
    string S,T;
    cin >> S >> T;
    int N=S.size(),M=T.size();
    int judge[26]={};
    REP(i,N){
        judge[S[i]-'a']++;
    }
    REP(i,M){
        if(judge[T[i]-'a']==0){
            GOODBYE;
        }
    }
    
    vector<int> G[26];
    REP(i,N){
        G[S[i]-'a'].push_back(i);
    }
    int Ans=0;
    int preit=-1;
    REP(i,M){
        int a=(int)(T[i]-'a');
        int pos=distance(G[a].begin(),lower_bound(G[a].begin(),G[a].end(),preit+1));
        //cout << T[i] MM pos << endl;
        if(pos==G[a].size()){
            Ans++;
            preit=G[a][0];
        }else{
            preit=G[a][pos];
        }
    }
    cout << Ans*N+preit+1 << endl;
    return 0;
}   


Measured memory_bytes: 1724
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-9;
const int inf=1e8;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int dp[41][410][410];
int main(){
	ll out=1,mod=1000000007;
	int n;
	cin>>n;
	loop(i,1,n+1)(out*=i)%=mod;
	cout<<out<<endl;
}











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

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

#define Canuc80k cin.tie(0); cout.tie(0);
#define FOR(i,a,b) for (int i=a;i<=b;i++)
#define FORD(i,a,b) for (int i=a;i>=b;i--)
#define I_AM ios_base::sync_with_stdio(0);
#define FORS(i,a,b,c) for (int i=a;i<=b;i+=c)
#define FORSD(i,a,b,c) for (int i=a;i>=b;i-=c)

const ll N = 1e3 + 5;
const ll M = 1e9 + 7;

int f[N][N];
string s1, s2;

int cal(int n, int m) { 
    if (n == 0) return m;
    if (m == 0) return n;
    if (f[n][m] != -1) return f[n][m];

    if (s1[n - 1] == s2[m - 1]) {
        f[n][m] = cal(n - 1, m - 1);
        return f[n][m];
    }

    int temp = INT_MAX;
    temp = min(temp, cal(n - 1, m) + 1);
    temp = min(temp, cal(n, m - 1) + 1);
    temp = min(temp, cal(n - 1, m - 1) + 1);

    f[n][m] = temp;
    return temp;
}

int main() {
    I_AM Canuc80k

    cin >> s1 >> s2;

    FOR (i, 0, s1.size()) 
        FOR (j, 0, s2.size()) 
            f[i][j] = -1;
        
    cal(s1.size(), s2.size());

    cout << max(0, f[s1.size()][s2.size()]) << endl;
}


Measured memory_bytes: 7276
#include <stdio.h>
#include <string.h>
char syt[90];
char* tt;
double stack[80],n;
int size;
void push(double n){stack[size++]=n;}
double pop(){return stack[--size];}
void ope(int i){
	double n=pop();
	switch(i){
	case 1:n=pop()+n;break;
	case 2:n=pop()-n;break;
	case 3:n=pop()*n;break;
	case 4:n=pop()/n;break;
	}
	push(n);
}
int main(void){
	while(fgets(syt,90,stdin)!=NULL){
		size=0;
		tt=strtok(syt," ");
		while(tt!=NULL){
			if(tt[0]=='+' && (tt[1]=='\0' || tt[1]=='\n'))ope(1);
			else if(tt[0]=='-' && (tt[1]=='\0' || tt[1]=='\n'))ope(2);
			else if(tt[0]=='*')ope(3);
			else if(tt[0]=='/')ope(4);
			else {
				sscanf(tt,"%lf",&n);
				push(n);
			}
			tt=strtok(NULL," ");
		}
		printf("%.6lf\n",pop());
	}
	return 0;
}

Measured memory_bytes: 664
import java.util.*;
import java.math.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ar = new int[n];
        int res = 0;
        for (int i = 0; i < n; i++) {
            ar[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            for (int j = i+1; j < n; j++) {
                if(i != j){
                    res += ar[i]*ar[j];
                }
            }
        }
        System.out.println(res);
    }
}

class io{
    public static void YesNo(boolean f) {
        System.out.println(f?"Yes":"No");
    }
    public static void YESNO(boolean f) {
        System.out.println(f?"YES":"NO");
    }
}

class Algo{
    public static boolean isOdd(int n){
        return n % 2 == 1;
    }
    public static boolean isEven(int n){
        return n % 2 == 0;
    }


}



Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
// #define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,d,x;
    cin>>n>>d>>x;
    int p[d][n];
    rep(i,d)rep(j,n)cin>>p[i][j];
    int ans=x;
    Rep(i,1,d){
        int dp[100010];
        fill_n(dp,100010,-inf);
        dp[0]=0;
        rep(j,n){
            REP(k,p[i-1][j],ans){
                dp[k]=max(dp[k],dp[k-p[i-1][j]]+p[i][j]);
            }
        }
        int tmp=ans;
        REP(j,0,ans){
            tmp=max(tmp,ans+dp[j]-j);
        }
        ans=tmp;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int k,t,i,a,m=0,res;
  cin >> k >> t;
  for(i=0;i<t;i++){
    cin >> a;
    m=max(a,m);
  }
  res=max(2*m-k-1,0);
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#define ll long long
#define fr(i, k, N) for (decltype(N + k) i = k; i < N; i++)
#define rep(i, N) for (decltype(N) i = 0; i < N; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
template <class X>
void pr(X test) { cout << test << endl; }
template <class X>
void prr(X test)
{
    for (auto it : test)
    {
        cout << it << " ";
    }
    cout << endl;
}
template <class X>
void prrr(X test)
{
    int f = 0;
    for (auto it : test)
    {
        cout << (f++ != 0 ? " " : "") << it;
    }
    cout << endl;
}
template <typename X>
istream &operator>>(istream &i, vector<X> &v)
{
    for (X &x : v)
        i >> x;
    return i;
}

vector<string> split(string s, char sep)
{
    vector<string> ret = {""};
    for (auto it : s)
    {
        if (it == sep)
            ret.push_back("");
        else
            ret.back().push_back(it);
    }
    return ret;
}

void solve();
int main()
{
    string s;
    cin >> s;
    for (auto it : s)
    {
        if (it == '7')
        {
            pr("Yes");
            return 0;
        }
    }
    pr("No");
}


Measured memory_bytes: 3168
package main

import(
	"fmt"
)


func main(){
	var a int
	var b int
	var c int 
	var x int

	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	fmt.Scan(&x)

	cnt := 0
	for i := 0; i <= a; i++ {
		for j := 0; j <= b; j++ {
			for k := 0; k <= c; k++ {
				if 500 * i + 100 * j + 50 * k == x {
					cnt = cnt + 1
				}
			}
		}
	}
	fmt.Println(cnt)
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

array<int64_t, 2> dfs(const vector<vector<bool>>& connected, vector<int64_t>& g,
                      int64_t v) {
    int64_t n = connected.size();

    array<int64_t, 2> ret{};
    ++ret[g[v]];
    for (auto u : irange(0L, n)) {
        if (connected[v][u] || u == v) {
            continue;
        }

        if (g[u] >= 0) {
            if (g[u] + g[v] != 1) {
                return {-1L, -1L};
            }
        } else {
            g[u] = (g[v] + 1) % 2;
            auto tmp = dfs(connected, g, u);
            if (tmp[0] < 0) {
                return {-1L, -1L};
            }
            ret[0] += tmp[0];
            ret[1] += tmp[1];
        }
    }

    return ret;
}

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

    vector<vector<bool>> connected(n, vector<bool>(n));
    for (auto _ : irange(0L, m)) {
        int64_t a, b;
        cin >> a >> b;
        --a;
        --b;
        connected[a][b] = true;
        connected[b][a] = true;
    }

    vector<int64_t> g(n, -1L);
    int64_t s = 0;
    vector<int64_t> p;
    for (auto i : irange(0L, n)) {
        if (g[i] < 0) {
            g[i] = 0;
            auto t = dfs(connected, g, i);
            if (t[0] < 0) {
                cout << -1 << endl;
                return 0;
            }
            if (t[0] > t[1]) {
                swap(t[0], t[1]);
            }
            s += t[0];
            p.push_back(t[1] - t[0]);
        }
    }

    bitset<701> bs;
    bs[s] = 1;
    for (auto pp : p) {
        bs |= (bs << pp);
    }

    for (auto i : irange(0L, n / 2 + 1) | reversed) {
        if (bs[i]) {
            cout << i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
void ins(string,string);
set<string> str;
int main(){
  int m,i,j,k,len;
  string in,stra,strb;
  cin >> m;
  for(i=0;i<m;i++){
    cin >> in;
    len=in.size();
    str.clear();
    for(j=0;j<len-1;j++){
      stra=in.substr(0,j+1);
      strb=in.substr(j+1,len-(j+1));
      ins(stra,strb);
    }
    cout << str.size() << endl;
  }
  return 0;
}
void ins(string a,string b){
  str.insert(a+b);
  str.insert(b+a);
  reverse(a.begin(),a.end());
  str.insert(a+b);
  str.insert(b+a);
  reverse(a.begin(),a.end());
  reverse(b.begin(),b.end());
  str.insert(a+b);
  str.insert(b+a);
  reverse(a.begin(),a.end());
  str.insert(a+b);
  str.insert(b+a);
}

Measured memory_bytes: 1292
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<queue>


#define rep(i,x) for(ll i=0;i<(int)(x);i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=((int)(x));i>0;i--)

#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 2e9

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

using namespace std;

int main()
{
    ll n;
    cin >> n;
    vector<ll> v(n);

    rep(i, n){
        cin >> v[i];
    }

    sort(all(v));
    v.push_back(-1);
    ll cnt = 1;
    ll ans = 0;
    rep(i, n){
        if(v[i]==v[i+1]){
            cnt++;
        }else{
            if(cnt % 2==1) ans++;
            cnt = 1;
        }
    }

    cout << ans;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long l; int n; cin >> l >> n;
  vector<long long> p(n + 1), a(n);
  for(int i = 0; i < n; i++){
    long long x; cin >> x; a[i] = x;
  }
  long long ans = 0;
  auto doTurns = [&](){
  	sort(a.begin(), a.end());
	p[0] = 0;
    for(int i = 0; i < n; i++) p[i + 1] = p[i] + a[i];
    for(int i = 0; i < n; i++){
      int can = min(i, n - 1 - i); // how many turns are possible
      long long now = a[i];
      now += 2 * (p[i] - p[i - can]);
      if(i + can + 1 < n) can++;
      now += 2 * (l * can - p[i + can + 1] + p[i + 1]);
      ans = max(ans, now);
    }
  };
  doTurns();
  for(int i = 0; i < n; i++) a[i] = l - a[i];
  doTurns();
  cout << ans << endl;
  return 0;
}
    


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

using pii = pair<int, int>;
#define X first
#define Y second

const int N = 100000;

int n, b[N], r;
pii a[N];

int main(){
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", &a[i].X);
        a[i].Y = i;
    }
    sort(a, a + n);
    for(int i = 0; i < n; i++) b[a[i].Y] = i & 1;
    for(int i = 0; i < n; i += 2) r += b[i];
    printf("%d\n", r);
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c; cin >> a >> b >> c;
if (a > b) swap(a, b);
if (a > c) swap(a, c);
if (b > c) swap(b, c);
cout << a << " " << b << " " << c << endl;
}


Measured memory_bytes: 3060
def digitSum(n):
    digitSum = 0
    while n > 0:
        digitSum += n%10
        n //= 10
    return digitSum

n = input()
length = len(n)

if digitSum(int(n)) == int(n[0]) + 9*(length - 1):
    print(digitSum(int(n)))
else:
    print(int(n[0]) + 9*(length - 1) - 1)

Measured memory_bytes: 3060
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let n = Int(readLine()!)!
    
    print(n % 2 == 0 ? n / 2: n / 2 + 1)
}

main()





Measured memory_bytes: 13216
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug: "<<x<<" "<<y<<endl;
using namespace std;
typedef long long ll;
const int maxn = 205;
const int mod = 1000000007;

int ans[maxn];
int n;

int main() {
#ifdef suiyuan2009
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  cin>>n;
  int m = 0;
  bool lr = 0, rr = 0;
  printf("?");
  for(int i=1;i<=n;i++)printf(" %d", i);
  printf("\n");
  fflush(stdout);
  string s;
  cin>>s;
  if(s[0]=='-')return 0;
  if(s[0]=='R')lr = 1;
  printf("?");
  for(int i=n+1;i<=n+n;i++)printf(" %d", i);
  printf("\n");
  fflush(stdout);
  cin>>s;
  if(s[0]=='-')return 0;
  if(s[0]=='R')rr = 1;
  int l = 1, r = n+1;
  while(l+1<r){
    int mid = (l+r)>>1;
    printf("?");
    for(int i=mid;i<mid+n;i++)printf(" %d", i);
    printf("\n");
    fflush(stdout);
    cin>>s;
    bool curr = 0;
    if(s[0]=='-')return 0;
    if(s[0]=='R')curr = 1;
    if(curr==lr){
      m = r;
      l = mid;
    } else {
      m = mid;
      r = mid;
    }
  }
  if(n==1){
    printf("! %c%c\n", lr?'R':'B',rr?'R':'B');
    fflush(stdout);
    return 0;
  }
  for(int i=1;i<=n+n;i++){
    if(i>=m&&i<m+n-1)continue;
    printf("?");
    for(int j=m;j<m+n-1;j++)printf(" %d",j);
    printf(" %d\n", i);
    fflush(stdout);
    string s;
    cin>>s;
    if(s[0]=='-')return 0;
    if(s[0]=='R')ans[i]=1;
    else ans[i]=0;
  }
  for(int i=m;i<m+n-1;i++){
    printf("?");
    for(int j=1;j<=n+n;j++){
      if(j>=m-1&&j<=m+n-1)continue;
      printf(" %d", j);
    }
    printf(" %d\n", i);
    fflush(stdout);
    string s;
    cin>>s;
    if(s[0]=='-')return 0;
    if(s[0]=='R')ans[i]=1;
    else ans[i]=0;
  }
  printf("! ");
  for(int i=1;i<=n+n;i++)printf("%c",ans[i]?'R':'B');
  printf("\n");
  fflush(stdout);
  return 0;
}

Measured memory_bytes: 724
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i,s,e) for(int i=s;i<e;i++)
#define endl '\n'
int main(){
    lli A;cin>>A;
    double B;cin>>B;
    lli res=(A*(lli)(B*100.0+0.5))/100;
    cout<<res<<endl;
}

Measured memory_bytes: 3708
import itertools as iter

def main(D,G,lst):
    res = 2**31 -1
    #全問解答するかしないかをBit全探索
    for i in range(2 ** D):
        count = 0
        s, count = calcBounus(D, lst, i)
        #Gに達している場合はresをセット
        if G <= s:
            res = min(res, count)
        #達していない場合、配点の大きい問題を解いていく
        else:
            for j in range(len(lst)):
                #ボーナスのために解答済みならスキップ
                if (i >> (D-j-1)) & 1:
                    continue
                else:
                    tar = lst[-1*(j+1)]
                    if tar[0] == 1:
                        continue
                    for k in range(tar[0]-1):
                        s += 100*(D-j)
                        count += 1
                        if G <= s:
                            res = min(res, count)
    return res

def calcBounus(D, lst, b):
    s = 0
    count = 0
    for i in range(D):
        if (b >> i) & 1:
            count += lst[i][0]
            s += lst[i][1]
            s += 100*(i+1)*lst[i][0]
    return [s,count]
    
D,G = map(int, input().split())
lst = list(list(map(int, input().split())) for _ in range(D))
print(main(D,G,lst))


Measured memory_bytes: 3188
#include<stdio.h>
int main(void){
	int a=-1;
	char s[11];
	scanf("%s",s);
	for(int i=0;i<9;i++){
		if(s[i]=='h'&&s[i+1]=='i'){
			a=1;
		}else if(s[i]=='i'&&a==1){
			if((s[i+1]=='h'&&s[i+2]=='i')||s[i+1]=='\0'){
			}else{
				a=0;break;
			}
		}else if(s[i]=='\0'){
			break;
		}else{
			a=0;break;
		}
	}
	if(a==1){
		printf("Yes");
	}else{
		printf("No");
	}
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N,K,Q;
  cin >> N >> K >> Q;
  vi A(Q),count(N);
  rep(i,Q) {
    cin >> A[i];
    count[--A[i]]++;
  }
  
  rep(i,N) {
    if(K>Q-count[i]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
int main()
{
	int t;
	cin>>t;
	ll sum=0,a,b,minb=INF,flag=0;
	while(t--){
        cin>>a>>b;
        sum+=b;
        if(b<a&&minb>b)
            minb=b;
        if(b!=a)
            flag=1;
	}

	if(flag==1)
        cout<<sum-minb<<endl;
    else
        cout<<0<<endl;
}


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

int main(void){
    int n,k;
    cin >> n >> k;
    int a[n];
    long long int ans = 1e18;
    
    for(int i = 0;i < n;i++)cin >> a[i];
    for(int i = 0;i < (1 << n);i++){
        long long int sum = 0,k2 = 0;
        long long int last = 0;
        for(itn j = 0;j < n;j++){
            if(i & (1 << j)){
                if(last < a[j])last = a[j];
                else {
                    sum += (last+1 - a[j]);
                    last++;
                }
                k2++;
            } else {
                if(last < a[j]){
                    k2++;
                    last = a[j];
                }
            }
        }
        if(k2 >= k)ans = min(ans,sum);
    }
    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;

int main() {
  string s;
  cin >> s;
  ll ans = 0;
  for (ll i = 0; i < s.length(); i++) {
    if (s[i] != s[s.length() - 1 - i]) ans++;
  }
  cout << ans / 2 << endl;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  string s;
  cin >> s;
  int n = sz(s);
  rrep(r, n) {
    if (r % 2 == 1) continue;
    bool ok = true;
    rep(l, r / 2) {
      int i = l;
      int j = i + r / 2;
      if (s[i] != s[j]) ok = false;
    }
    if (ok) {
      cout << r << endl;
      return;
    }
  }
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CGacha solver = new CGacha();
        solver.solve(1, in, out);
        out.close();
    }

    static class CGacha {
        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            int n = sc.nextInt();
            HashSet<String> set = new HashSet<>();
            for (int i = 0; i < n; i++)
                set.add(sc.next());
            pw.println(set.size());
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

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

    }
}



Measured memory_bytes: 71628
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            double x = sc.nextDouble();
            double h = sc.nextDouble();
            if (x == 0 && h == 0) {
                break;
            }
            System.out.printf("%.6f\n", ((x * Math.sqrt(Math.pow(x / 2, 2) + Math.pow(h, 2)))) / 2 * 4 + Math.pow(x, 2));
        }
    }
}

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

int main() {
	int N, Y;
	cin >> N >> Y;
	int A, B, C;
	for (int i = 0;i < 9;i ++) {
		if ((Y / 1000 - N - 9 * i) % 4 == 0) {
			int A = i + (Y / 1000 - N - 9 * i) / 36 * 4, B = (Y / 1000 - N - 9 * i) % 36 / 4, C = N - A - B;
			if (A >= 0 && B >= 0 && C >= 0) {
				cout << A << " " << B << " " << C;
			} else {
				cout << "-1 -1 -1";
			}
			return 0;
		}
	}
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

まず、全て1000円札だとY/1000枚になる
この1000円札を5000円札に変えるとお札の枚数が-4、10000円札に変えると-9される
よって、Y/1000に対して-4と-9の操作を繰り返すことでN枚にできるかという問題に置換することができる
ここで、この問題は4*9=36枚以上多い場合は必ず可能な方法があるので、後はそれを用いれば解ける

*/

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int MAX = 1000;
		Scanner sc = new Scanner(System.in);
		String input = "";
		String[] data_nx = new String[2]; // 入力されたn,xの値を一時的に格納するための配列
		int n = 0;
		int x = 0;
		int[] output = new int[MAX]; // 組み合わせの個数を出力するための配列
		int count_data = 0; // 入力されたデータ（n, x)の個数ををカウントするための変数
		int[] number = new int[3];
		boolean judge = true; // 入力されたデータ(n, x)が

		out: for (int i = 0; i < MAX; i++) {
			input = sc.nextLine();
			data_nx = input.split(" ");
			n = Integer.parseInt(data_nx[0]);
			x = Integer.parseInt(data_nx[1]);

			// 入力終了チェック
			if (n == 0 && x == 0) {
				break out;
			}

			// nが条件範囲内に収まっているかのチェック
			if (n < 3 && n > 100) {
				judge = false;
				break out;
			}

			// xが条件範囲内に収まっているかのチェック
			if (x < 0 && x > 300) {
				judge = false;
				break out;
			}

			count_data++;

			// ここから各データにおける合計が x となる組み合わせの数を求めるプログラム
			for (int j = 1; j <= (n - 2); j++) {
				number[0] = j;
				for (int k = j + 1; k <= n - 1; k++) {
					number[1] = k;
					for (int m = k + 1; m <= n; m++) {
						number[2] = m;

						if ((number[0] + number[1] + number[2]) == x) {
							output[i]++;
						}

					}

				}

			} // 各データにおける合計が x となる組み合わせの数を求めるプログラム ここまで!

		}

		if (judge == true) {
			for (int p = 0; p < count_data; p++) {
				System.out.println(output[p]);

			}
		}

	}

}



Measured memory_bytes: 27012
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void solve()
{
    int k;
    cin>>k;
    string s="ACL";
    while(k--){
        cout<<s;
    }
    cout<<endl;return;
}
int main()
{
    solve();
}

Measured memory_bytes: 3576
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    X = input()
    answer = 0
    cnt_s = 0
    for x in X:
        if x == "S":
            cnt_s += 1
            continue
        if cnt_s > 0:
            cnt_s -= 1
        else:
            answer += 1
    answer += cnt_s
    print(answer)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3500
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ a, b, c, d ] <- readInts
	putStrLn $ which "Yes" "No" $ abs ( a - c ) <= d || ( abs ( a - b ) <= d && abs ( b - c ) <= d )

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

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

    int count_S = 0;
    int ans = 0;
    for (char x : X)
    {
        if (x == 'S')
        {
            count_S++;
        }
        if (x == 'T')
        {
            if (count_S > 0)
            {
                ans++;
                count_S--;
            }
        }
    }
    cout << X.size() - 2 * ans << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include <numeric>
// #include<string>
#include<vector>
#include <algorithm>
#include <cmath>
// #include <functional>
#include <iomanip>

using namespace std;

int main()
{
    // Input
    long double l;
    cin >> l;

    long double ans = ((long double)l / (long double)3.0) * ((long double)l / (long double)3.0) * ((long double)l / (long double)3.0);

    std::cout<<std::fixed<<std::setprecision(10);
    // std::cout << std::setprecision(1000000000) << ans;

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
/*****And nothing else matters!******/

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

#define pi 3.1415926535
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define llu unsigned long long
#define setbits(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define tc int test_case; cin >> test_case; while(test_case--)
#define f(i,a,n) for(int i = a ; i < n ; i++)
#define rf(i,n,a) for(int i = n-1 ; i >= a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define sp(x) fixed << setprecision(10) << x
#define fast ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(x) cerr << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cerr<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = inf + 7;
const int N = 2e5 + 10;

int main()
{
    fast;
    int n;
    cin >> n;
    ll ans = 0;
    f(i,1,n+1)
    {
        f(j,1,n+1)
        {
            f(k,1,n+1)
               ans += __gcd(__gcd(i,j),k);
        }
    }
    cout << ans;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend();
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
const int N = 1e6 + 10;
const int A = 26;
struct Query {
	Query(int _c, int _x, int _sign) : c(_c), x(_x), sign(_sign) {};
	int c, x, sign;
};
int f[A][N];
int get(int c, int r) {
	int s = 0;
	while (r >= 0) {
		s += f[c][r];
		r &= r + 1;
		--r;
	}
	return s;
}
int get(int c, int l, int r) {
	return get(c, r) - get(c, l - 1);
}
void upd(int c, int pos) {
	while (pos < N) {
		f[c][pos]++;
		pos |= pos + 1;
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	vector<string> a(n);
	vector<vector<Query>> q(n);
	for (auto& e : a) {
		cin >> e;
		reverse(all(e));
	}
	sort(all(a));
	for (int i = 0; i < n; i++) {
		int len = sz(a[i]) - 1;
		string t = a[i].substr(0, len);
		int l = -1, r = n;
		while (l + 1 < r) {
			int mid = (l + r) / 2;
			if (a[mid].substr(0, len) < t)
				l = mid;
			else
				r = mid;
		}
		int frst = r;
		l = r, r = n;
		while (l + 1 < r) {
			int mid = (l + r) / 2;
			if (sz(a[mid]) < sz(a[i]) || a[mid].substr(0, len) != t)
				r = mid;
			else
				l = mid;
		}
		int cnt = 0;
		for (char c : a[i])
			if (c == a[i].back()) cnt++;
		q[r - 1].pb(Query(a[i].back() - 'a', cnt, 1));
		if (frst)
			q[frst - 1].pb(Query(a[i].back() - 'a', cnt, -1));
	}
	ll s = 0;
	for (int i = 0; i < n; i++) {
		vector<int> cnt(A);
		for (char c : a[i])
			cnt[c - 'a']++;
		for (int i = 0; i < A; i++)
			upd(i, cnt[i]);
		for (auto [c, x, sign] : q[i])
			s += sign * get(c, x, N - 1);
	}
	cout << s - n;
	return 0;
}

Measured memory_bytes: 23416
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef long long Int;


int main() {
    string S;
    cin >> S;
    int N;
    N = S.size();

    int ans = N;
    rep(i,N-1) {
        if (S[i] != S[i+1]) ans = min(ans, max(N-i-1, i+1));
    }

    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < N; X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair


using namespace std;

ll gcd(ll a, ll b){
    if(a < b) return gcd(b,a);

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

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

int main(){

    //Tiの最小公倍数をとればよい、10^18を扱うのでlong long intで。

    //追記、上の考察では不十分
    //適当な順番でlcmを求めてはTLEするので、ソートして大きい数から行うようにする
    //lcmの計算の順番もオーバーフローするため掛け算をまとめて行わないようにする。？

    int n;
    cin >> n;

    ll ans = 1;

    rep(i,n){
        ll tmp;
        cin >> tmp;
        ans = lcm(ans,tmp);
    }

    cout << ans << endl;

    return 0;
}

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

int main(int qtd, char* nome[])
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	bool A = false, B = false;
	string s;
	cin >> s;
	for(char c: s)
		if(c == 'A')
			A = true;
		else
			B = true;
		
	cout << (A&&B? "Yes\n": "No\n") << endl;
	
	return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int a[N];
long long f[N][3];
int main()
{
	int n; scanf("%d%d",&n,&a[1]);
	for(int i=2;i<=n;++i)
	{
		char op[2];
		scanf("%s%d",op,&a[i]);
		a[i]=(op[0]=='+'?a[i]:-a[i]);
	}
	f[1][0]=a[1],f[1][1]=f[1][2]=-1ll<<60;
	for(int i=2;i<=n;++i)
	{
		f[i][0]=max(f[i-1][0],max(f[i-1][1],f[i-1][2]))+a[i];
		f[i][1]=max(f[i-1][1],f[i-1][2])-a[i];
		f[i][2]=f[i-1][2]+a[i];
		if(a[i]<0)
		{
			f[i][1]=max(f[i][1],f[i-1][0]+a[i]);
			f[i][1]=max(f[i][1],f[i-1][1]+a[i]);
			f[i][1]=max(f[i][1],f[i-1][2]+a[i]);
			f[i][2]=max(f[i][2],f[i-1][1]-a[i]);
			f[i][2]=max(f[i][2],f[i-1][2]-a[i]);
		}
	}
		printf("%lld",max(f[n][0],max(f[n][1],f[n][2])));
}

Measured memory_bytes: 4736
#include <stdio.h>
const int MAX_V = 10000;
int main() {
int prime[MAX_V+1];
int i, k, v, max;
for(i = 2; i <= MAX_V; i++) {
prime[i] = 1;
}
for(i = 2; i*i <= MAX_V; i++) { 
  if(prime[i]) {
    for(k = 2 * i; k <= MAX_V; k += i) {
       prime[k] = 0;
   }
 }
}
while(1) {
scanf("%d",&v);
max=0;
if(v==0) break;
for(i=v;i>=1;i--){
	if(prime[i]==1 &&prime[i-2]==1){
		max=i;
		break;
	}
}
printf("%d %d\n",max-2,max);
}
return 0;
}
		

Measured memory_bytes: 1748