akhauriyash/Code-Regression huggingface dataset:
import re
import sys
s = input()
l = re.split('(..)', s)[1::2]

judge = [c=="hi" for c in l]
if len(l) == 0:
  print("No")
  sys.exit()
if len(s) %2 != 0:
  print("No")
  sys.exit()
  
if all(judge):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3188
#include<cstdio>
#define MAXN 100010
#define ll long long
#define max(a,b) (a>b?a:b)
#define INF 0x3f3f3f3f3f3f3f3f
using namespace std;

int n;
ll c,x[MAXN],v[MAXN];
ll k[5][MAXN],ma[5][MAXN];

int main()
{
	scanf("%d%lld",&n,&c);
	for(register int i=1;i<=n;i++)
		scanf("%lld%lld",&x[i],&v[i]);
	x[n+1]=c;  x[0]=0LL;
	long long sum=0LL,ans=-1e18;
	for(register int i=1;i<=n;i++)
	{
		sum=sum-(x[i]-x[i-1])+v[i];
		ans=max(ans,sum);
	}
	sum=0LL;
	for(register int i=n;i>=1;i--)
	{
		sum=sum-(x[i+1]-x[i])+v[i];
		ans=max(ans,sum);
	}
	for(register int i=1;i<=n;i++)
	{
		k[1][i]=k[1][i-1]+v[i]+2*x[i-1]-2*x[i];
		k[2][i]=k[2][i-1]+v[i]+x[i-1]-x[i];
	}
	for(register int i=n;i>=1;i--)
	{
		k[3][i]=k[3][i+1]+v[i]+2*(c-x[i+1])-2*(c-x[i]);
		k[4][i]=k[4][i+1]+v[i]+(c-x[i+1])-(c-x[i]);
	}
	//  1: 顺 - 先到i    v[1]+v[2]+...+v[i] - 2x[i] 
	//  2: 顺 - 后到i    v[1]+v[2]+...+v[i] - x[i]
	//  3: 逆 - 先到i    v[n]+v[n-1]+...+v[i] - 2(c-x[i])
	//  4: 逆 - 后到i    v[n]+v[n-1]+...+v[i] - (c-x[i])
	
	//  1: 逆 - 后到 i~n 的最大值
	//  2: 逆 - 先到 i~n 的最大值
	//  3: 顺 - 后到 1~i 的最大值
	//  4: 顺 - 先到 1~i 的最大值
	for(register int i=n;i>=1;i--)
	{
		ma[1][i]=max(ma[1][i+1],k[4][i]);
		ma[2][i]=max(ma[2][i+1],k[3][i]);
	}
	for(register int i=1;i<=n;i++)
	{
		ma[3][i]=max(ma[3][i-1],k[2][i]);
		ma[4][i]=max(ma[4][i-1],k[1][i]);
	}
	for(register int i=1;i<=n;i++)
	{
		sum=k[1][i]+ma[1][i+1];//先顺到 i 再逆到 j  (i<j)
		ans=max(sum,ans);
		sum=k[3][i]+ma[3][i-1];//先逆到 i 再顺到 j  (i>j)
		ans=max(sum,ans);
		sum=k[2][i]+ma[2][i+1];//后顺到 i 先逆到 j  (i<j)
		ans=max(sum,ans);
		sum=k[4][i]+ma[4][i-1];//后逆到 i 先顺到 j  (i>j)
		ans=max(sum,ans);
	}
	if(ans<0LL)  puts("0");
	else  printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 8704
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main(){
    string s;
    cin >> s;
    long long int ans = 0;
    //int j=0;
    int length = s.size();
    for(int i=0;i<length;i++){
        //cout << "again" << endl;
        for(int j=i;j<length;j++){
            //cout << j << endl;
            if(j == i){
                ans += (s[i]-48)*pow(10,length-j-1)*pow(2,i);
                //cout << "ans" << endl;
            }
            else if(j != i){
                ans += (s[i]-48)*pow(10,length-j-1)*pow(2,j-1);
            }
        }
    }
    cout << ans << endl;


    return 0;

}

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


int N;
long long ans = 1;

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N; i++){ans *= i + 1;ans %= 1000000007;}
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from functools import reduce, lru_cache
import collections, heapq, itertools, bisect
import math, fractions
import sys, copy

sys.setrecursionlimit(1000000)

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline().rstrip())
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline().rstrip())
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]

class ModInt:
    def __init__(self, x, MOD=1000000007):
        self.x = x % MOD
        self.MOD = MOD
    def __str__(self): return str(self.x)
    def __add__(self, other): return ModInt(self.x + other.x) if isinstance(other, ModInt) else ModInt(self.x + other)
    def __sub__(self, other): return ModInt(self.x - other.x) if isinstance(other, ModInt) else ModInt(self.x - other)
    def __mul__(self, other): return ModInt(self.x * other.x) if isinstance(other, ModInt) else ModInt(self.x * other)
    def __truediv__(self, other): return ModInt(self.x * other.inverse()) if isinstance(other, ModInt) else ModInt(self.x * pow(other, self.MOD - 2, self.MOD))
    def __pow__(self, other): return ModInt(pow(self.x, other.x, self.MOD)) if isinstance(other, ModInt) else ModInt(pow(self.x, other, self.MOD))
    def __rsub__(self, other): return ModInt(other.x - self.x) if isinstance(other, ModInt) else ModInt(other - self.x)
    def __rtruediv__(self, other): return ModInt(other.x * other.inverse()) if isinstance(other, ModInt) else ModInt(other * pow(self.x, self.MOD - 2, self.MOD))
    def __rpow__(self, other): return ModInt(pow(other.x, self.x, self.MOD)) if isinstance(other, ModInt) else ModInt(pow(other, self.x, self.MOD))

    __repr__ = __str__
    __radd__ = __add__
    __rmul__ = __mul__

    def inverse(self): return pow(self.x, self.MOD - 2, self.MOD)

dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    L = S()

    ans = ModInt(0, MOD)
    bit_count = 0

    for i, bit in enumerate(L):
        if bit == '0':
            continue

        d = len(L) - (i + 1)
        ans += pow(2, bit_count, MOD) * pow(3, d, MOD)

        bit_count += 1


    ans += pow(2, bit_count, MOD)

    print(ans)


if __name__ == '__main__':
    main()

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

struct WF{
  int v;
  vector<vector<int> > d;
  const int INF = 1LL<<60; 
  WF(int n):
    v(n),
    d(n,vector<int>(n))
  {
    for(int i=0;i<v;i++){
	 for(int j=0;j<v;j++){
	   if(i==j)d[i][j]=0;
	   else d[i][j]=INF;
	 }
    }
  }

  void add(int s,int t,int cost){
    d[s][t]=min(d[s][t],cost);
  }

  void wf(){
    for(int k=0;k<v;k++){
	 for(int i=0;i<v;i++){
	   for(int j=0;j<v;j++){
		if(d[i][k]!=INF&&d[k][j]!=INF)
		  d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	   }
	 }
    }
  }

  int get(int i,int j){
    return d[i][j];
  }
};

signed main(){
  int n,m;
  cin>>n>>m;
  WF d(n);
  int a[1111],b[1111],c[1111];
  for(int i=0;i<m;i++){
    cin>>a[i]>>b[i]>>c[i];
    a[i]--,b[i]--;
    d.add(a[i],b[i],c[i]);
    d.add(b[i],a[i],c[i]);
  }
  d.wf();
  int ans=0;
  for(int i=0;i<m;i++){
    if(d.get(a[i],b[i])!=c[i])ans++;
  }
  cout<<ans<<endl;
  return 0;
}


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





int main(){
  int n,m;
  cin>>n>>m;
  int a[1010]={};
  int count=0;
  int b;
  for(int i=0;i<m;i++){
    cin>>a[i]>>b;
    if(a[i]>=n){count++;}
  }
  sort(a,a+m);
  reverse(a,a+m);
  int ans=0;
  for(int i=count;i<m-1;i++){
    ans+=n-a[i];
  }
  cout<<ans<<endl;
  
  
    
  return 0;
}



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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 1000010
#define rep(i,n) for (int i = 0; i < (n); ++i)
const ll mod = 1e9+7;

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() {
    string s;
    cin >> s;

    int len = s.size();

    cout << s[0] << len-2  << s[len-1];
}



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

int main(){
	string s,t;
	cin>>s;
	cin>>t;
	vector<vector<int>>dp(s.size()+1,vector<int>(t.size() + 1,0));

	for(int i = 1; i <= s.size(); ++i){
		for(int j = 1; j <= t.size(); ++j){
			if(s[i-1] == t[j-1]){
				dp[i][j] = dp[i-1][j-1] + 1;
			}
			else {
				dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
	int row = dp.size() - 1;
	int col = dp[0].size() - 1;

	string build = "";

	while(row > 0 && col > 0){
		if((dp[row][col] != dp[row][col-1]) && (dp[row][col] != dp[row-1][col])){
			build += s[row-1];
			row--;
			col--;
		}
		else if(dp[row][col] == dp[row][col-1]){
			col--;
		}
		else if(dp[row][col] == dp[row-1][col]){
			row--;
		}
	}
	reverse(build.begin(),build.end());
	cout<<build<<endl;
}

Measured memory_bytes: 38568
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

typedef pair<int,pair<int,int> > P;

vector<int> uni;
int find(int at){
    if(at==uni[at]) return at;
    else return uni[at]=find(uni[at]);
}
void unite(int a,int b){
    uni[find(a)]=find(b);
}
int main(){
    for(;;){
        int N,M;
        scanf("%d\n%d\n",&N,&M);
        if(N==0) break;
        uni=vector<int>(N);
        for(int i=0;i<N;i++) uni[i]=i;
        vector<P> ros;
        int a,b,dis;
        for(int i=0;i<M;i++){
            scanf("%d,%d,%d\n",&a,&b,&dis);
            dis=dis/100-1;
            ros.push_back(make_pair(dis,make_pair(a,b)));
        }
        sort(ros.begin(),ros.end());
        int ret=0;
        for(int i=0;i<M;i++){
            dis=ros[i].first,a=ros[i].second.first,b=ros[i].second.second;
            if(find(a)!=find(b)){
                unite(a,b);
                ret+=dis;
            }
        }
        printf("%d\n",ret);
    }
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void){
  int n;
  scanf("%d",&n);
  for(int i=1;i<=9;i++){
     for(int j=1;j<=9;j++){
       if(n==i*j){
         printf("Yes\n");
         return 0;
       }
  	}
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] temp = line.split(" ");

		int totalNumOfDice = Integer.parseInt(temp[0]);
		int selectNumOfDice = Integer.parseInt(temp[1]);

		line = sc.nextLine();
		temp = line.split(" ");
		double[] dices = new double[temp.length];
		for (int i = 0; i < temp.length; i++) {
			dices[i] = Integer.parseInt(temp[i]);
		}

		double[] kitaichiArray = new double[temp.length];
		for (int i = 0; i < temp.length; i++) {

			kitaichiArray[i] = (dices[i] + 1) / 2;

		}



		double maxSumKitaichi = 0;
		for (int i = 0; i < selectNumOfDice; i++) {
			maxSumKitaichi += kitaichiArray[i];
		}
		double currentSumKitaichi = maxSumKitaichi;
		for (int start = 1; start <= totalNumOfDice - selectNumOfDice; start++) {
			currentSumKitaichi += kitaichiArray[start + (selectNumOfDice - 1)];
			currentSumKitaichi -= kitaichiArray[start - 1];

			maxSumKitaichi = Math.max(currentSumKitaichi, maxSumKitaichi);
		}

		System.out.println(maxSumKitaichi);

		sc.close();
	}

}

Measured memory_bytes: 49052
N,M = map(int,input().split())
table = []
for i in range(M):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    table.append((a,b))
table = sorted(table,key=lambda x:x[1])
cur_r = table[0][1]
ans = 1
for i in range(1,M):
    l,r = table[i]
    if cur_r <= l:
        ans += 1
        cur_r = r

print(ans)

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

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int w = 0;
    int b = 0;
    for(int i = 0; i < n; i += 2){
        if(s[i] == '0'){
            b++;
        }
        else{
            w++;
        }
    }
    for(int i = 1; i < n; i += 2){
        if(s[i] == '1'){
            b++;
        }
        else{
            w++;
        }
    }
    cout << min(b, w) << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    ll a,b,k;
    cin>>a>>b>>k;
    ll ans1;
    ll ans2;
    if(a-k<0){
        ans1=0;
        if(b-(k-a)<0){
            //cout<<"koko"<<endl;
            ans2=0;
        }
        else ans2=b-(k-a);
    }
    else{
        ans1=a-k;
        ans2=b;
    }
    cout<<ans1<<" "<<ans2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
#define   ull unsigned long long 
const int MAX=2e5+9;
const long long mod=1e9+7;
using namespace std;
vector<int>adj[MAX];
int dp[MAX][4];
ll pre[MAX][101];
int main(){
	int n ;
	cin>>n;
	int arr[n+1];
	int tot=0;
	for(int i=0;i<n;i++)
		cin>>arr[i];
	for(int i=0;i<n;i++){
		if(i%2)
			tot-=arr[i];
		else
			tot+=arr[i];
	}
	vector<int>ans;
	ans.push_back(tot);
	for(int i=0;i<n;i++){
		ans.push_back(2*arr[(i)%n]-ans[i]);
	}

	for(int i=0;i<ans.size()-1;i++)
		cout<<ans[i]<<" ";

}

Measured memory_bytes: 8184
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int[] h = new int[N];
    for (int i = 0; i < N; i++) h[i] = scanner.nextInt();

    int[] dp = new int[N];
    dp[1] = Math.abs(h[1] - h[0]);
    for (int i = 2; i < N; i++) {
      int c1 = dp[i - 2] + Math.abs(h[i] - h[i - 2]);
      int c2 = dp[i - 1] + Math.abs(h[i] - h[i - 1]);
      dp[i] = Math.min(c1, c2);
    }
    System.out.println(dp[N - 1]);
  }
}


Measured memory_bytes: 50112
#!/usr/bin/env python3
def gcd(a,b):
    if a > b: a,b = b,a
    while a != 0:
        a,b = b%a,a
    return (b)
if __name__ == "__main__":
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    a,b = map(int,input().split())
    print(a*b//gcd(a,b))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,s;
	s=0;
	cin>>n;
	vector<int> d(n);
	for(int i=0 ;n>i;i++){
		cin>>d.at(i);
	}
	for(int i=0;n>i;i++){
		for(int j=0;n>j;j++){
			if(i==j){
				continue;
			}
			if(d.at(i)==d.at(j)){
				d.at(j)=0;
			}
		}
	}
	for(int i=0;n>i;i++){
		if(d.at(i)!=0){
			s++;
		}
	}
	cout<<s<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define llong long long
#define mkpr make_pair
#define x first
#define y second
#define iter iterator
#define riter reversed_iterator
#define y1 Lorem_ipsum_
#define tm dolor_sit_amet_
using namespace std;

inline int read()
{
	int x = 0,f = 1; char ch = getchar();
	for(;!isdigit(ch);ch=getchar()) {if(ch=='-') f = -1;}
	for(; isdigit(ch);ch=getchar()) {x = x*10+ch-48;}
	return x*f;
}

const int mxN = 531441;
int pw[mxN+3];
char a[mxN+3];
int son[mxN*4+3][3];
int val[mxN*4+3],ans[mxN+3];
int p[3] = {0,1,2}; int pw3[15];
int n,m,siz,rt;

int build(int dep,int x)
{
	if(dep==n+1) {return 0;}
	int u = ++siz;
	son[u][p[0]] = build(dep+1,x);
	son[u][p[1]] = build(dep+1,x+pw3[dep]);
	son[u][p[2]] = build(dep+1,x+2*pw3[dep]);
	if(dep==n) {val[u] = x;}
	return u;
}
void modify(int dep,int u)
{
	if(dep==n+1) {return;}
	int tson[3];
	for(int i=0; i<3; i++) {tson[i] = son[u][p[i]];}
	for(int i=0; i<3; i++) {son[u][p[i]] = tson[(i+2)%3];}
	modify(dep+1,son[u][0]);
}
void getans(int dep,int u,int x)
{
	if(dep==n) {ans[val[u]] = x; return;}
	getans(dep+1,son[u][p[0]],x);
	getans(dep+1,son[u][p[1]],x+pw3[dep]);
	getans(dep+1,son[u][p[2]],x+2*pw3[dep]);
}

int main()
{
	scanf("%d%s",&n,a+1); m = strlen(a+1);
	pw3[0] = 1ll; for(int i=1; i<=n; i++) pw3[i] = pw3[i-1]*3;
	rt = build(0,0);
	for(int k=1; k<=m; k++)
	{
		if(a[k]=='S')
		{
			swap(p[1],p[2]);
		}
		else
		{
			modify(0,rt);
		}
	}
	getans(0,rt,0);
	for(int i=0; i<pw3[n]; i++) printf("%d ",ans[i]); puts("");
	return 0;
}

Measured memory_bytes: 18744
from math import factorial
n,a,b = (int(i) for i in input().split())
v = [int(i) for i in input().split()]
v = sorted(v)[::-1]
print(1.0*sum(v[:a])/a)
x,v2,num = v[a-1],v[:a][::-1],0
for i in v2:
	if i==x: num+=1
	else: break
y = v.count(x)
if num==a:
	answer,y2 = 0,factorial(y)
	for i in range(a,min(y,b)+1):
		answer += y2//(factorial(y-i)*factorial(i))
	print(answer)
else:
	print(factorial(y)//(factorial(y-num)*factorial(num)))

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
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;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

vector<ll> enum_div(ll n){
    vector<ll> ret;
    for(ll i = 1 ; i*i <= n ; ++i){
        if(n%i == 0){
            ret.push_back(i);
            if(i != 1 && i*i != n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}

ll f(ll a,ll b){
    ll anum=0;
    ll bnum=0;
    // cout<<a<<" "<<b<<" "<<endl;;
    while(a>0){
        a/=10;
        anum++;
    }
    while(b>0){
        b/=10;
        bnum++;
    }
    // cout<<anum<<" "<<bnum<<endl;
    return max(anum,bnum);
}

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

    ll n;
    ll ans=LLINF;
    cin>>n;
    vll yakusu=enum_div(n);
    // for(auto i:yakusu)cout<<i<<" ";
    for(int i=0;i<yakusu.size();i++){
        ans=min(ans,f(yakusu[i],n/yakusu[i]));
    }
    fin(ans);
    
//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int mod = 1e9 + 7;
int main()
{
	int n;
	string s;
	cin >> n;
	cin >> s;
	int answer = 0;
	for (int i = 0; i < n-2; ++i)
	{
		if (s[i]=='A')
		{
			if (s[i+1]=='B' && s[i+2]=='C')
			{
				answer++;
			}
		}
	}
	cout << answer;
	return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scanner()
	d := make(map[rune]struct{})
	for _, v := range s {
		d[v] = struct{}{}
	}
	if len(d) == 3 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1772
#include <stdio.h>
int main(void){
  int n,i,dis,judge;
  int t[100000],x[100000],y[100000];
  
  scanf("%d",&n);
  t[0]=0; x[0]=0; y[0]=0; judge=0;
  for(i=1;i<=n;i++){
    scanf("%d %d %d",&t[i],&x[i],&y[i]);
    if(t[i]-t[i-1] < x[i]-x[i-1]+y[i]-y[i-1]){
	  judge=1;
	}
	if(t[i]-t[i-1] > x[i]-x[i-1]+y[i]-y[i-1]){
	  if((x[i]-x[i-1]+y[i]-y[i-1])%2 ==1){
	    if((t[i]-t[i-1])%2 == 1){
		}
		if((t[i]-t[i-1])%2 == 0){
		judge=1;
		}
	  }
	  
	  if((x[i]-x[i-1]+y[i]-y[i-1])%2 ==0){
    	if((t[i]-t[i-1])%2 == 1){
          judge=1;
		}
		if((t[i]-t[i-1])%2 == 0){
        }
	  }
	}
  }
  if(judge == 0){
    printf("Yes");
  }
  if(judge == 1){
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 1280
#include<iostream>
using namespace std;
 
class Dice{
		int _num[6];
		
	public:
        void set(int num[6]){
            for(int i = 0; i < 6; i++) _num[i] = num[i];
        }
		int Get(int n){
			return _num[n];
		}
		void N(){
			swap(_num[0],_num[4]);
			swap(_num[0],_num[5]);
			swap(_num[0],_num[1]);
		}
		void S(){
			swap(_num[0],_num[1]);
			swap(_num[0],_num[5]);
			swap(_num[0],_num[4]);			
		}
		void W(){
			swap(_num[0],_num[3]);
			swap(_num[0],_num[5]);
			swap(_num[0],_num[2]);			
		}
		void E(){
			swap(_num[0],_num[2]);
			swap(_num[0],_num[5]);
			swap(_num[0],_num[3]);			
		}
		void SetTop(int n){
			if(_num[2] == n) W();
			else if(_num[3] == n) E();
			else{
				for(int i = 0; i < 4; i++){
					if(_num[0] == n) break;
				S();
				}
			}
		}
		void SetFront(int n){
			for(int i = 0; i < 4; i++){
				if(_num[1] == n) break;
				S(); W(); N();
			}
		}

		bool Same(Dice other){
			other.SetTop(this->Get(0));
			other.SetFront(this->Get(1));
			
			bool same = true;
			for(int i = 0; i < 6; i++){
				if(other.Get(i) != this->Get(i)){
					same = false;
					break;
				}
			}
			return same;
		}
};
 
int main(){
	int n;
	cin >> n;
	
	Dice dice[n];
	for(int k = 0; k < n; k++){
		int num[6];
		for(int l = 0; l < 6; l++){
				cin >> num[l];
		}
		dice[k].set(num);
	}
	
	for(int p = 0; p < n; p++){
		for(int q = p + 1; q < n; q++){
			if(dice[p].Same(dice[q])){
				cout << "No" << endl;
				return 0;
			}
		}
	}

	cout << "Yes" << endl;
}

Measured memory_bytes: 1156
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

k, n = map(int, input().split())
a = list( map(int, input().split()))
a.append(a[0]+k)

max_diff = 0
for i in range(len(a)-1):
    max_diff = max(max_diff, a[i+1]-a[i])

print(k-max_diff)

Measured memory_bytes: 25876
//main関数

#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vvvi = vector<vvi>;
using ll = long long; //long longをllだけにした
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll =vector<vvll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using mii = map<int,int>;
using mllll=map<ll,ll>;

ll h;

ll j=0;

int main(){
    cin>>h;
    ll i=1;
    for(i=1;i<=h;i*=2){
    }
    cout<<i-1<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int n,k;
bool dislike[10];
inline bool check(int x){ 
        for (;x;x/=10) if (dislike[x%10]) return 0;
        return 1;
}
int main(){
        scanf("%d%d",&n,&k);
        for (int i=1,x;i<=k;++i) scanf("%d",&x),dislike[x]=1;
        for (int i=n;i<=99999;++i) if (check(i)) return printf("%d\n",i),0;
        return 0;
}                 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
const int N=100005;
typedef long long ll;
vector<int> v[N];
int vis[N];
queue<int> q;

int main() {
    int x,y,n,cnt1=0,cnt2=0;
	scanf("%d",&n);
	for(int i=1;i<n;++i) {
        scanf("%d%d",&x,&y);
        v[x].pb(y);
        v[y].pb(x);
	}
	q.push(1);q.push(n);
	vis[1]=1,vis[n]=n;
	while(!q.empty()) {
        int x=q.front();q.pop();
        int sz=v[x].size();
        for(int i=0;i<sz;++i) {
            int t=v[x][i];
            if(!vis[t]) {
                vis[t]=vis[x];
                q.push(t);
            }
        }
	}
	for(int i=1;i<=n;++i) {
        if(vis[i]==1) ++cnt1;
        else if(vis[i]==n) ++cnt2;
	}
	if(cnt1>cnt2) puts("Fennec");
	else puts("Snuke");
	return 0;
}


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

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

    int N;
    cin >> N;
    string s;
    cin >> s;
    
    rep(i,s.size()){
        if(s[i] + N <= 'Z'){
            s[i] = (char) s[i] + N;
        }else{
            int diff = 'Z' - s[i];
            diff = N - diff - 1;
            s[i] = (char)'A' + diff;
        }
    }
    
    cout << s << endl;

    return 0;
}

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

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define w(t) int t;cin>>t;while(t--)
#define mod 1000000007



int main(){
	
		fast
		ll n;
		cin>>n;
		int times=0;
		for(int i=1;i<=n;i++)
		{
			times+=(((n-1)/i));

		}
		cout<<times;


	return 0;
}





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

int main(){
    int n;
    std::cin >> n;
    std::vector<int> v(n);
    for (int i = 0; i < n; i++){
        std::cin >> v[i];
    }
    int q;
    std::cin >> q;
    while(q--){
        int b, e, k;
        std::cin >> b >> e >> k;
        int cnt = 0;
        for (int i = b; i < e; i++){
            if (k == v[i]) cnt++;
        }
        std::cout << cnt << std::endl;
    }
}


Measured memory_bytes: 3108
<?php
while (($line = trim(fgets(STDIN))) != 0) {
	$n = intval($line);
	$mul5  = 0;
	$mul2  = 0;

	for ($i = 1; $i <= $n; $i++) {
		$target = $i;
		while ($target % 2 == 0) {
			$mul2++;
			$target /= 2;
		}
		while ($target % 5 == 0) {
			$mul5++;
			$target /=5;
		}
	}

	echo min($mul5, $mul2) . "\n";
}

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

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

  if (N == 0) {
    cout << "0\n";
    return 0;
  }
  vector<int> ans;
  while (N != 0) {
    if (abs(N) % 2 == 1) {
      ans.push_back(1);
      N -= 1;
    } else
      ans.push_back(0);
    N /= -2;
  }
  reverse(begin(ans), end(ans));
  for (const auto& v:ans) cout << v;
  cout << "\n";
  return 0;
}


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

d = []
A = []
for i in range(K):
    d_pre = int(input())
    A_pre = [int(x) for x in input().split()]
    d.append(d_pre)
    A.extend(A_pre)

A_unique = list(set(A))

ans = 0

for i in range(1, N+1):
    if i in A_unique:
        pass
    else:
        ans += 1

print(ans)

Measured memory_bytes: 9200
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<sstream>
#include<vector>
using namespace std;
typedef long long LL;
#define inf 0x3f3f3f3f
const int M = 500005;
int main()
{
    LL  ans=100;
    LL m,sum=0;
    cin>>m;
    while(1)
    {
        if(ans>=m)break;
        ans+=ans*0.01;
        sum++;
    }
    cout<<sum<<endl;
    //system("pause");
    return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int r[100005];
int X,K,Q,T,A,s,l,k,t,x,f;
int main()
{
  f = -1;
  cin >> X >> K;
  FOR(i,0,K) cin >> r[i];
  s = 0; // 下限
  l = X; // 上限
  t = 0;
  k = 0;
  x = 0;
  for(cin>>Q;Q--;) {
    cin >> T >> A;
    while(k < K && T >= r[k]){
      int d = f * (r[k] - t); // 変化量
      x += d; // 全体の変化量
      s = min(X, max(0, s + d));
      l = min(X, max(0, l + d));
      t = r[k];
      k++;
      f *= -1;
    }
    int xx = min(l, max(s, A + x)) + f * (T - t);
    cout << min(X, max(0, xx)) << endl;
  }
  return 0;
}


Measured memory_bytes: 1536
def f(start, goal, steps):
  res = set([start])
  for s in steps:
    next_res = set()
    for r in res:
      next_res.add(r + s)
      next_res.add(r - s)
    res = next_res
  return goal in res

s = input()
x, y = map(int, input().split())

ss = s.split("T")
xmove = [i.count("F") for i in ss[::2]]
xfirst = xmove[0] # xの１回目はプラス方向固定のため切り出す
xmove = xmove[1:] # ２回目以降でリスト再作成
ymove = [i.count("F") for i in ss[1::2]]

if f(xfirst, x, xmove) and f(0, y, ymove):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3604
package main

import "fmt"
var N, W, w,v int
var A [][]int
var dp [][]int

func max(a, b int) int {
	if a > b { return a }
	return b
}

func min(a, b int) int {
	if a < b { return a }
	return b
}

func abs(a int) int {
	if a < 0 { return -a }
	return a
}

func main() {
	_,e := fmt.Scanf("%d%d", &N, &W)
	if e != nil { return }
	A = make([][]int, 0)
	for i:=0; i<N; i++ {
		_,e = fmt.Scanf("%d%d", &w, &v)
		A = append(A,[]int{w,v})
	}
	dp = make([][]int, N+1)
	dp[0] = make([]int, W+1)
	for i:=1; i<=N; i++ {
		dp[i] = make([]int, W+1)
		for j:=1; j<=W; j++ {
			if A[i-1][0] > j {
				dp[i][j] = dp[i-1][j]
			} else {
				dp[i][j] = max(dp[i-1][j], dp[i-1][j-A[i-1][0]] + A[i-1][1])
			}
		}
	}
	fmt.Println(dp[N][W])
}


Measured memory_bytes: 83072
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        s: String
    }
    if n % 2 == 1 {
        println!("No");
        return;
    }
    let (s1, s2) = s.split_at(n/2);
    println!("{}",
        if s1 == s2 {
            "Yes"
        } else {
            "No"
        }
    )
}


Measured memory_bytes: 2136
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto s = read!string;
    auto t = read!string;

    auto rs = s.dup;
    rs.reverse();
    writeln(rs == t ? "YES" : "NO");
}


Measured memory_bytes: 256
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    s = sum(A)
    t = sum(a * a for a in A)
    print((s ** 2 - t) * pow(2, MOD - 2, MOD) % MOD)
resolve()

Measured memory_bytes: 94200
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#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()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	int n;
	cin>>n;
	string s;
	getline(cin,s);
	while(n--){
		getline(cin,s);
		bool h=false;
		rep(i,26){
			string tmp;
			rep(j,26){
				tmp=s;
				rep(k,tmp.size())if(isalpha(tmp[k]))tmp[k]=(i*(tmp[k]-'a')+j)%26+'a';
				rep(k,tmp.size()-3){
					string a=tmp.substr(k,4);
					if(a=="this"||a=="that"){h=true;break;}
				}
				if(h)break;
			}
			if(h){s=tmp;break;}
		}
		cout<<s<<endl;;
	}
}

Measured memory_bytes: 1220
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<20;
void solve() {
    string ans;
    int K;
    R(K);
    while(K--)ans+="ACL";
    W(ans);
}
void input() {
    
}
int main(){
#define MULTITEST 0
#if MULTITEST    
    CASET
#endif
    {
        input();
        solve();
    }
    return 0;
}


Measured memory_bytes: 3680
#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
const int MOD = 1000000007;

int main()
{
  int A,B;
  char s;
  cin >> s;
  set<char> d;
  d.insert('a');
  d.insert('i');
  d.insert('u');
  d.insert('e');
  d.insert('o');
  cout << (d.count(s)==0 ? "consonant" : "vowel") << endl;
  return 0;
}



Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        m: usize,
        v: [[usize1; m]; n]
    }
    let mut idx = vec![0; n];
    let mut cs = vec![0; m];
    let mut off = vec![false; m];
    for i in 0..n {
        cs[v[i][0]] += 1;
    }
    let mut s = 0;
    for i in 1..m {
        if cs[i] > cs[s] {
            s = i;
        }
    }
    let mut ans = cs[s];
    for _ in 0..m - 1 {
        off[s] = true;
        for i in 0..n {
            cs[v[i][idx[i]]] -= 1;
            while off[v[i][idx[i]]] {
                idx[i] += 1;
            }
            cs[v[i][idx[i]]] += 1;
        }
        for i in 0..m {
            if cs[i] > cs[s] {
                s = i;
            }
        }
        ans = min(ans, cs[s]);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#define ll long long
using namespace std;
#define N 100009
#define mod 1000000007

int main(){
    ll n,m;
    cin>>n>>m;
    bool color[n+1];
    for (ll i=1; i<=n; i++) color[i]=false;
    ll wa_count[n+1];
    for (ll i=1; i<=n; i++) wa_count[i]=0;
    ll ac_count=0;

    for (ll i=1; i<=m; i++){
        ll p;
        string q;
        cin>>p>>q;
        if (color[p]==true) continue;

        if (q=="WA") wa_count[p]++;
        else{
            ac_count++;
            color[p]=true;
        }
    }
    
    ll wa=0;
    for (ll i=1; i<=n; i++){
        if (color[i]==true) wa+=wa_count[i];
    }
    cout<<ac_count<<" "<<wa<<endl;
}

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

typedef long long int llint;

int a[3001];

int main()
{
  int mm = 0;
  int n;
  cin>> n;
  for(int i = 0; i < n; i++) {
    cin>> a[i];
    mm += a[i] - 1;
  }

  
  cout<< mm <<endl;

  return 0;
}


Measured memory_bytes: 256
s = input()
ok = False
string = 'keyence'
j = 0
ok = False
for i in range(len(s)):
    for j in range(len(s)):
        if s[0:i]+s[j:len(s)] == string:
            ok = True
if string in s:
    ok = True

print('YES' if ok else 'NO')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MAX 1000005
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define tr(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
 
 
ll n, m, i, j, k, t, l, r, a, b, tmp, ans, start, end, qmax, cnt, curr, flag, mn, mx, y,  x;
ll arr[MAX], useless[MAX], curr_idx;
string s;
vector<ll>  v;
priority_queue<ll> pq;
 
int main()
{
    
	// ios_base::sync_with_stdio(false);cin.tie(NULL);
	#ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
	#endif
    	cin>>n;
    	tmp = (n*360)/(__gcd(n,360ll));
    	cout<<tmp/n;

    return 0;	
}

Measured memory_bytes: 3636
#include <stdio.h>

#define N 500

int main() {
	static int cc[N], ss[N], ff[N];
	int n, i, x;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d%d%d", &cc[i], &ss[i], &ff[i]);
	for (x = 0; x < n; x++) {
		int t;

		t = 0;
		for (i = x; i < n - 1; i++) {
			if (t < ss[i])
				t = ss[i];
			t = (t + ff[i] - 1) / ff[i] * ff[i] + cc[i];
		}
		printf("%d\n", t);
	}
	return 0;
}


Measured memory_bytes: 128
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N = ii()
A = li()

A_f = A[:N//2]
A_l = A[N//2:]

for i in reversed(range(N//2)):
    ind = i+1
    ind += i+1
    while(ind-1 < N):
        A[i] += A[ind-1]
        ind += i+1
    A[i] %= 2

#table += A_l

ans = ''
print(sum(A))
for i in range(N):
    if A[i]%2 == 1:
        ans += str(i+1) + ' '

if ans != '':
    print(ans[:-1])

Measured memory_bytes: 10004
#include <iostream>

int main(){
   int N;
   std::cin >> N;
   int W;
   int S[N];
   int sum = 0;
   for(int i=0; i<N; ++i){
      std::cin >> W;
      sum += W;
      S[i] = sum;
   }

   int ans = sum;
   for(int i=0; i<N-1; ++i){
      ans = std::min(ans,abs(2*S[i]-sum));
   }
   std::cout << ans << std::endl;
   return 0;
}


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

class Progaram
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var k = int.Parse(Console.ReadLine());
        var x = int.Parse(Console.ReadLine());
        var y = int.Parse(Console.ReadLine());
        Console.WriteLine((n > k) ? k * x + (n - k) * y : n * x);
    }
}


Measured memory_bytes: 11092
#include <iostream>

using namespace std;

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
//repマクロ定義
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
//allマクロ定義
#define all(v) v.begin(),v.end()
using namespace std;

int main(){
  int s;
  cin >> s;
  int a=s;
  int n4=0,ans=0;
  if(s==1){ puts("4"); return 0; }
  if(s==2){ puts("4"); return 0; }
  while(true){
    if(s==4) n4++;
    if(n4==2) break;
    s = (s%2==0) ? s/2 : 3*s+1;
    ans++;
  }
  cout << ans+1 << endl;
}

Measured memory_bytes: 256
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = 0
cnt2 = 0
for i, ai in enumerate(a):
    for j in range(i, n):
        if ai > a[j]:
            cnt += 1
    if i > 0:
        for j in range(i):
            if ai > a[j]:
                cnt2 += 1

if k % 2 == 0:
    mul = (1 + k) * (k // 2)
else:
    mul = (1 + k) * (k // 2) + (k // 2 + 1)
mul2 = 0
if k > 1:
    k -= 1
    if k % 2 == 0:
        mul2 = (1 + k) * (k // 2)
    else:
        mul2 = (1 + k) * (k // 2) + (k // 2 + 1)
print(((cnt * mul) + (cnt2 * mul2)) % 1000000007)


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

using namespace std;

int main() {

    string a, b;
    cin >> a >> b;
    if (b.substr(0, b.length() - 1) == a) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }
    return 0;
}


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

int main(){
  int n, m;	cin >> n >> m;
  map<int, string> mp;
  rep(i,3)mp[i+1] = "-1";
  rep(i,m){
    int s;
    string c;
    cin >> s >> c;
    if(mp[s]!="-1" && mp[s]!=c){
      cout << -1 << endl;
      return 0;
    }
    mp[s] = c;
  }
  string ans;
  int cnt = 1;
  for(int i=n; i>0; i--){
    if(n!=1 && i==n && mp[cnt]=="0"){
      cout << -1 << endl;
      return 0;
    }
    if(mp[cnt]=="-1"){
      if(n!=1 && i==n) ans += "1";
      else ans += "0";
    }
    else		  	ans += mp[cnt];
    cnt++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>                                                             
#include <climits>
using namespace std;
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a>b?b:a
int main()
{
    int n, a, max = INT_MIN, min = INT_MAX;
    long sum = 0;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> a;
        max = MAX(max,a);
        min = MIN(min,a);
        sum += a;
    }
    cout << min << " " << max << " " << sum << endl;
    return 0;
 
}



Measured memory_bytes: 3120
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, a, b; cin >> n >> a >> b;
	cout << min(n*a, b) << endl;
	return 0;
}

Measured memory_bytes: 256
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)

	var n, k int
	fmt.Sscan(getNextLine(scanner), &n, &k)
	s := getNextLine(scanner)
	fmt.Println(s[0:k-1] + string('a'+s[k-1]-'A') + s[k:])
}


Measured memory_bytes: 640
N,M=map(int,input().split())
MOD=int(1e9)+7
if abs(N-M)>1:
    print(0)
else:
    fn=1;fm=1;
    for i in range(2,N+1):
        fn=(fn*i)%MOD
    for i in range(2,M+1):
        fm=(fm*i)%MOD
    if abs(N-M)==0:
        print((fn*fm*2)%MOD)
    else:
        print((fn*fm)%MOD)

Measured memory_bytes: 3064