akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
	string S, T;
	int val;
	cin >> S >> T;
	S += T;
	val = atoi(S.c_str());
	int i;
	for ( i = 1; i * i <= val; i++ ) {
		if ( i * i == val ) {
			break;
		}
	}
	if ( i * i > val ) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
	}
	return ( 0 );
}


Measured memory_bytes: 256
import numpy as np
N = int(input())
XY =  np.array([list(map(int,input().split())) for _ in [0]*N])
th = np.arctan2(XY[:,1],XY[:,0])
XY = XY[th.argsort()]
ans = 0
for i in range(N):
    for j in range(i+1,i+N+1):
        r = np.linalg.norm(XY[i:j].sum(axis=0)+XY[:max(0,j-N)].sum(axis=0))
        ans = max(ans,r)
print(ans)

Measured memory_bytes: 12492
A,B,C=map(int, input().split())
K=int(input())
if A<=B and B<=C:
    print(A+B+C*(2**K))
elif C<=A and A<=B:
    print(A+C+B*(2**K))
elif B<=C and C<=A:
    print(B+C+A*(2**K))
elif A<=C and C<=B:
    print(A+C+B*(2**K))
elif B<=A and A<=C:
    print(B+A+C*(2**K))
elif C<=B and B<=A:
    print(C+B+A*(2**K))

Measured memory_bytes: 3064
# coding: utf-8

# In[3]:

import sys
input = sys.stdin.readline
R, G, B, N = map(int, input().split())


# In[14]:

cnt = 0
a, b, c = sorted([R, G, B], reverse=True)
#print(a, b, c)
#print(N//a)
for i in range(N//a+1):
    for j in range((N-a*i)//b+1):
        tmp = N-a*i-b*j
        if tmp%c == 0:
            #print('{}*{} + {}*{}'.format(a, i, b, j))
            cnt += 1
print(cnt)


# In[19]:

list(range(1//3 + 1))


# In[ ]:





Measured memory_bytes: 3060
#include <cstdio>
#include <cmath>
#include <cstring>
#include <map>
#include <algorithm>
#define N 200005
using namespace std; 
inline char get(){
	const int TOP=1000000;
	static char T[TOP],*x=T,*y=T;
	return x==y&&(y=(x=T)+fread(T,1,TOP,stdin),x==y)?EOF:*x++;
}
inline int read (){
	register int num;int sign=1;register char c;
	while (((c=get())<'0'||c>'9')&&c!='-');c=='-'?num=sign=0:num=c-48;
	while ((c=get())>='0'&&c<='9')num=(num<<3)+(num<<1)+(c-48);
	return sign?num:-num;
}
int n,ans;
int main(){
	n=read();
	while(n){ans+=n%10==2;n/=10;}
	printf("%d\n",ans);
} 

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI pair<int,int>
#define ff first
#define ss second
#define endl '\n'
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)

int okk(int n,int *a,int m){
    int ans=0;
    for(int i=0;i<n;i++){
        ans+=(a[i]-m)*(a[i]-m);
    }
    return ans;
}

int32_t main(){
	boost;

    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];

    int ans=1e9;
    for(int i=1;i<=100;i++)
        ans=min(ans,okk(n,a,i));
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()

using namespace std;

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/

int main() {
	int H, W; cin >> H >> W;
	int sum = 0;
	vector<string> S(H+2);
	S[0].resize(H + 2);
	S[H+1].resize(H + 2);
			S[0] = '0';
			S[H + 1] = '0';
	for (int i = 1;i < H+1;i++) {
		S[i].resize(W + 2);
		cin >> S[i];
	}
	for (int i = 1;i < H + 1;i++) {
		for (int j = W;j > 0;j--) {
			S[i][j] = S[i][j - 1];
		}
      S[i][0]='0';
      S[i][W+1]='0';
	}
	for (int i = 1;i < H + 1;i++) {
		for (int j = 1;j < W + 1;j++) {
			sum = 0;
			if (S[i][j] == '#') cout <<"#";
			else {
			for(int x=-1;x<=1;x++) {
            for(int y=-1;y<=1;y++) {
              if(i+x >= 1 && j+y >= 1 && i+x < H+1 && j+y < W+1) {
              if(S[i+x][j+y] == '#')
                sum++;
            }
          }
                }
                        cout<<sum;
			}
		}
		cout << endl;
	}
}


Measured memory_bytes: 256
/**
     **author : _KMS_
     **created : 14-03-2020
**/
#include<bits/stdc++.h>
using namespace std;
const long long M =1e5+100,MOD=2e9;
typedef long long ll;


int main() 
{ 
      
 ios::sync_with_stdio(false);
 cin.tie(0);
int n;
cin>>n;
for(int i=1;i<=9;i++)
{
      if(n%i==0&&n/i<=9){cout<<"Yes\n";return 0;}
}
cout<<"No\n";
	return 0; 
} 

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

int main() {
 
 int N, K;
  string S;
  cin >> N >> K >> S;
  
 if(S.at(K - 1) == 'A') {
   S.at(K - 1) = 'a';
 }
  else if(S.at(K - 1) == 'B') {
   S.at(K - 1) = 'b';
 }
  else {
    S.at(K - 1) = 'c';
  }
  cout << S << endl;
   
   
 }
   
  

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>
#include <map>

using namespace std;
typedef long long int ll;

int main(){

    ll N = 0;
    cin >> N;
    vector<ll > p(N + 1);
    for(ll i = 0; i < N; i++){
        cin >> p[i];
    }
    p[N] = -1;

    ll ans = 0;

    ll s = 1;
    for(ll i = 0; i < N; i++){
        if(p[i] == s){
            if(p[i + 1] == s + 1){
                i++;
                s++;
            }
            ans++;
        }
        s++;
    }

    cout << ans << endl;

} 

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;
int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	ini(n);
	if(n%2){
		out(n/2+1);
		return 0;
	}
	else{
		out(n/2);
		return 0;
	}
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/abc115/tasks/abc115_c

import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        ArrayList<Integer> h = new ArrayList<>();
        for (int i=0;i<N;i++){
            h.add(sc.nextInt());
        }
        sc.close();
        Collections.sort(h);
        int dif = Integer.MAX_VALUE;
        for (int i=0;i<N-K+1;i++){
            if (h.get(i+K-1)-h.get(i)<dif){
                dif = h.get(i+K-1)-h.get(i);
            }
        }
        System.out.println(dif);
    }
}

Measured memory_bytes: 60264
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=100005;
struct node{int p,o;}w[2*MAXN];int n;
bool cmp(node n1,node n2){return n1.p<n2.p;}
int main()
{
	n=read();int tot=0;
	for(int i=1;i<=n;i++)
	{
		int x=read(),y=read();
		w[++tot].p=x;w[tot].o=0;
		w[++tot].p=y;w[tot].o=1;
	}w[++tot].p=0;w[tot].o=0;w[++tot].p=0;w[tot].o=1;
	sort(w+1,w+1+tot,cmp);LL ans=0;
	int pres=0,sufs=0;
	for(int i=1;i<=tot;i++)sufs+=(w[i].o==0);
	for(int i=1;i<tot;i++)
	{
		int len=w[i+1].p-w[i].p;
		sufs-=(w[i].o==0);pres+=(w[i].o==1);
		ans+=2LL*len*min(pres,sufs);
	}pr2(ans);
	return 0;
}


Measured memory_bytes: 1792
s = input()
c = 1
for i in range(len(s)):
  if i % 2 == 0:
    if s[i] != "L":
      c *= 1
    else:
      c *= 0
  else:
    if s[i] != "R":
      c *= 1
    else:
      c *= 0
if c == 0:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 3060
#include<stdio.h>

int main(){
	long long int tc;
	scanf("%lld", &tc);
	long long int n[tc], tot=1;
	for(long long int i=0; i<tc; i++){
//		tot<1000000000000000000
		scanf("%lld", &n[i]);
		if(n[i]==0){
			tot=0;
			printf("%lld\n", tot);
			break;
		}
	}
	if(tot>0){
	for(long long int i=tc-1; i>=0; i--){
		if(tot>1000000000 && n[i]>1000000000){
			tot=0;
			  printf("-1\n");
			break;
		}
		else if(tot*n[i]>1000000000000000000){
			tot=0;
			printf("-1\n");
		}
		else{
			tot*=n[i];	
		}
	}
	}
	if(tot>0){
		printf("%lld\n", tot);
	}
	return 0;
}

Measured memory_bytes: 2428
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int n = 6;
ld a[n], b[n];

int read() {
  for (int i = 0; i < n; i++) {
    int x;
    if (scanf("%d", &x) < 1) {
      return false;
    }
    a[i] = (ld) x / 100;
  }
  for (int i = 0; i < n; i++) {
    int x;
    if (scanf("%d", &x) < 1) {
      return false;
    }
    b[i] = (ld) x / 100;
  }
  return true;
}

ld get(ld p) {
  ld res = 0;
  for (int i = 0; i < (1 << n); i++) {
    ld cur = 0;
    for (int j = 0; j < n; j++) {
      if (i & (1 << j)) {
        cur += p * a[j];
      } else {
        cur += (1 - p) * b[j];
      }
    }
    res = max(res, cur);
  }
  return res;
}

void solve() {
  ld l = 0, r = 1;
  for (int it = 0; it < 200; it++) {
    ld m0 = (2 * l + r) / 3, m1 = (l + 2 * r) / 3;
    if (get(m0) < get(m1)) {
      r = m1;
    } else {
      l = m0;
    }
  }
  printf("%.20f\n", (double) get(l));
}

int main() {
  precalc();
#ifdef LOCAL
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (true) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


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

typedef pair<int,int> pi;
typedef vector<int> vi;
 
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
 
template<typename T> void max_self(T &a, T b) { a = max(a,b); return;}
template<typename T> void min_self(T &a, T b) { a = min(a,b); return;}
 
const int nax = 1e5 + 5;
const int mod = 1e9 + 7;

int solve(int a,int b,int c){
	
	a = a % c;	
	if(b == 0) return 1;
	else if((b % 2) == 0) return solve((a * a) % c,b / 2,c) % c;
	else return (a * solve((a * a) % c,b / 2,c) % c) % c;
}

vector<int> adj[nax];
vector<int> in(nax,0);
vector<int> out(nax,0);
vector<int> dp(nax,0);
vector<int> vis(nax,false);

void dfs(int src){
	if(vis[src]) return;
	vis[src] = true;
	for(auto u : adj[src]){
		--in[u];
		dp[u] = max(dp[u],1 + dp[src]);
		if(in[u] == 0) dfs(u);
	}
	
	return;
}

signed main(){
	
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int n,m;
	cin >> n >> m;
		
	char mat[n][m];
	int dp[n][m];
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j){
			cin >> mat[i][j];
			dp[i][j] = 0;
		}
	}
		
	dp[0][0] = 1;
	for(int i = 1; i < n; ++i){
		if(mat[i][0] == '#') dp[i][0] = 0;
		else dp[i][0] = dp[i - 1][0];
	}
	
	for(int j = 1; j < m; ++j){
		if(mat[0][j] == '#') dp[0][j] = 0;
		else dp[0][j] = dp[0][j - 1];
	}
	
	for(int i = 1; i < n; ++i){
		for(int j = 1; j < m; ++j){
			if(mat[i][j] == '.') dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
			else dp[i][j] = 0;
		}
	}
	
	cout << dp[n - 1][m - 1];
	return 0;
}


Measured memory_bytes: 17396
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s=="hi"||s=="hihi"||s=="hihihi"||s=="hihihihi"||s=="hihihihihi"){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


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

using namespace std;

int main(void) {
    int N, M, C;
    vector<int> A(20), B(20);
    int calc;
    int res;
    
    // input
    cin >> N >> M >> C;
    for (int i = 0; i < M; i++) cin >> B[i];
    
    for (int i = 0; i < N; i++) {
        calc = 0;
        for (int j = 0; j < M; j++) {
            cin >> A[j];
            calc += A[j] * B[j];
        }
        if ( calc + C > 0) res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


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

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }


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

    // ifstream fin(".in");
    // ofstream fout(".in");

int n;
cin>>n;
set<string>s;
forn(i,n)
{
  string k;
  cin>>k;
  s.insert(k);
}
cout<<s.size();


    return 0;
  }


Measured memory_bytes: 19240
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;

int n, m;
char s[N], t[N];

bool esitmi(){
	for(int i = 1; i <= n; i++){
		if(s[i] != t[i])
			return 0;
	}
	return 1;
}

void dondur(){
	int tt = s[n];
	int t2 = s[1];
	for(int i = n; i >= 2; i--){
		s[i] = s[i - 1];
	}
	s[1] = tt;
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%s %s",s + 1, t + 1);
	n = strlen(s + 1);
	m = strlen(t + 1);
	for(int i = 1; i <= n + 2; i++){
		if(esitmi()){
			printf("Yes\n");
			return 0;
		}
		dondur();
		// printf("%s\n",s + 1);
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define p pair<int,int>
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
using namespace std;
int POW(int x,int y){return int(pow(double(x),double(y)));}


int main(){
	
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	a+=b;c+=d;
	if(a>c){
		cout<<"Left"<<endl;
	}else if(a<c){
		cout<<"Right"<<endl;
	}else{
		cout<<"Balanced"<<endl;
	}
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <string>
#define SIZE 200005
#define INF 1000000005LL

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

int dsum(int x){
	int cnt=0;
	int y=x;
	while(1){
		cnt += (y%10);
		y /= 10;
		if(y==0)break;
	}
	return cnt;
}

int main()
{
	int n;
	scanf("%d",&n);
	int minv=9999999;
	for(int i=1;i<n;i++){
		minv = min(minv,(dsum(i)+dsum(n-i)));
	}
	printf("%d\n",minv);
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main(){
    long long N, A, B, C, D, E;
    scanf("%lld %lld %lld %lld %lld %lld", &N, &A, &B, &C, &D, &E);
    long long tra[5];
    tra[0] = A; tra[1] = B; tra[2] = C;tra[3] = D;tra[4] = E;
    long long min=A;
    int nmin = 0;
    for(int i=1;i<5;i++){
        if(min>tra[i]){
            min = tra[i];
            nmin = i;
        }
    }
    if(N%min!=0){
        printf("%lld", N/min + 5);
    }
    else{
    printf("%lld", N/min + 4);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(int i=s;i<t;i++)
int isused[1<<17];
int main()
{
    int m,k;scanf("%d%d",&m,&k);
    if(k==0){
        rep(i,0,1<<m)printf("%d %d ",i,i);
        return 0;
    }
    if(m<2||k>=(1<<m)){printf("-1\n");return 0;}
    int co=0,nownum=0;
    while(co!=1<<m)
    {
        co+=4;int k1,k2,k3,k4;
        while(isused[nownum])nownum++;
        isused[nownum]=1,isused[k^nownum]=1;
        k2=nownum,k3=k^nownum;
        while(isused[nownum])nownum++;
        isused[nownum]=1,isused[k^nownum]=1;
        k1=nownum,k4=k^nownum;
        printf("%d %d %d %d %d %d %d %d ",k2,k4,k1,k2,k3,k1,k4,k3);
    }
}

Measured memory_bytes: 2304
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
string s;

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

	if (n >= 3200) {
		cout << s << endl;
	}
	else {
		cout << "red" << endl;
	}

	return 0;
}

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

int main()
{
    int N,M;
    int min=0,max=100010;
    cin >> N >> M;
    for(int i=0;i<M;i++){
        int mi,ma;
        cin >> mi >> ma;
        if(mi > min) min = mi;
        if(ma < max) max = ma;
    }
    if(min <= max){
        cout << max - min + 1 << endl;
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll n,m,l,r,d,fa[200001],ra[200001],diff_weight[200001];
ll find(ll x){
    if(fa[x]==x)return x;
    ll xx=find(fa[x]);
    diff_weight[x]+=diff_weight[fa[x]];
    return fa[x]=xx;
}
ll weight(ll x){
    find(x);
    return diff_weight[x];
}
bool uni(ll x,ll y,ll w){
    w+=weight(x),w-=weight(y);
    x=find(x);
    y=find(y);
    if(x==y)return false;
    if(ra[x]<ra[y]){swap(x,y);w=-w;}
    fa[y]=x;
    if(ra[x]==ra[y])ra[x]++;
    diff_weight[y]=w;
    return true;
}
int main(void){
    cin>>n>>m;
    for(int i=1;i<=n;i++)fa[i]=i;
    for(int i=0;i<m;i++){
        cin>>l>>r>>d;
        if(find(l)!=find(r))uni(l,r,d);
        else{
        if(weight(r)-weight(l)!=d){cout<<"No"<<endl;return 0;}
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 3584
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    # from collections import deque
    # from collections import Counter
    # import numpy as np
    # import math
    # import random
    input = stdin.readline

    k = int(input())

    s = input()[:-1]
    len_s = len(s)
    if len_s <= k:
        print(s)
        exit()
    print(s[:k] + '...')


Measured memory_bytes: 9164
#include <stdio.h>

int main(void) {
	int a,b,c,t = 0;
	scanf("%d%d%d",&a,&b,&c);
	while(t <= 3600){
		if(t+a >= c){
			t=c;break;
		}
		else{
			t+=(a+b);
			if(t > c) c+=60;
		}
	}
	if(t > 3600){
		printf("-1\n");
	}
	else{
		printf("%d\n",t);
	}
	return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s[]=new String[3];
		for(int i=0;i<3;i++)s[i]=sc.next();
		String str="";
		for(int i=0;i<3;i++)str+=s[i].charAt(0);
		System.out.println(str.toUpperCase());
	}
}
	

Measured memory_bytes: 22612
n,m = gets.split.map{|x| x.to_i}

g = []
n.times do
  g << gets
end

dx=[1,1,1,0,0,-1,-1,-1]
dy=[1,0,-1,1,-1,1,-1,0]

n.times do |x|
  m.times do |y|
    cnt = 0
    8.times do |k|
      cnt +=1 if x+dx[k] >= 0 && x+dx[k] < n && y+dy[k]>=0 && y+dy[k]<m && g[x+dx[k]][y+dy[k]]=='#'
    end
    print '#' if g[x][y] == '#'
    print cnt if g[x][y] != '#'
  end
  puts
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define pb push_back
#define rng(a) a.begin(),a.end()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (i64)(x).size()
#define bit(n) (1LL<<(n))
#define fi first
#define se second
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

i64 pow_mod(i64 n, i64 k, i64 m){
  i64 r = 1;
  for(;k;k>>=1){
    if(k&1) r=(r*n)%m;
    n=(n*n)%m;
  }
  return r;
}

struct uf{
  private:
    vi par, rank, size;
  public:
    uf(i64 n){ init(n); }
    void init(i64 n){
      par.resize(n);
      rank.resize(n,0);
      size.resize(n,1);
      rep(i,n) par[i] = i;
    }
    i64 root(i64 x){
      if(par[x] == x) return x;
      return par[x] = root(par[x]);
    }
    bool same(i64 x, i64 y){ return root(x) == root(y); }
    void unite(i64 x, i64 y){
      x = root(x), y = root(y);
      if(x==y) return;
      if(rank[x]==rank[y]) rank[x]++;
      if(rank[x]<rank[y]) swap(x,y);
      par[y] = x;
      size[x] += size[y];
    }
    i64 num(i64 x){ return size[root(x)]; }
};

void Main()
{
  i64 n,m,k;
  cin >> n >> m >> k;

  uf tree(n);
  vi cnt(n,1);

  i64 a,b;
  rep(i,m){
    cin >> a >> b; a--; b--;
    tree.unite(a,b);
    cnt[a]++; cnt[b]++;
  }
  rep(i,k){
    cin >> a >> b; a--; b--;
    if(tree.same(a,b)){
      cnt[a]++; cnt[b]++;
    }
  }
  rep(i,n){
    cout << tree.num(i) - cnt[i];
    if(i<n-1) cout << " ";
    else cout << endl;
  }
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}


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

int main() {
	ll n, k, q;
	cin >> n >> k >> q;
	vector<ll> score(n+5, 0);
	for(int i = 1; i <= q; ++i) {
		ll r1;
		cin >> r1;
		++score[r1];
	}
	for(int i = 1; i <= n; ++i) {
		if(q-score[i] < k) cout << "Yes\n";
		else cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
#include <numeric>
using namespace std;

#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))
#define LLONG_MAX numeric_limits<long long>::max()
#define INT_MAX numeric_limits<int>::max()

typedef long long       ll;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<vi>		vvi;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;

typedef struct edge_ {
	ll to;
	ll cost;
} edge;

constexpr double	PI = 3.14159265358979323846;
constexpr ll		INF = 1 << 15;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template<typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

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

template <typename T>
void say(vector<T>& vec, string pad = " ") {
	for (const T& elem : vec)
		cout << elem << pad;
}


/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/


int main()
{
	vs s(3);
	cin >> s;
	cout << s[0][0] << s[1][0] << s[2][0] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)


/*
https://maspypy.com/atcoder-%E5%8F%82%E5%8A%A0%E6%84%9F%E6%83%B3-2019-03-22abc-159


ans = sum_(i<=j){ f(i,j) }
  
    = f(1,1) +f(1,2) +f(1,3) +...
             +f(2,2) +f(2,3) +...
                     +f(3,3) +...

形式的べき級数で考えると


f(i,j-1) {i<j} について *(x^A[j] + 1) をやることで f(i,j) の分を足す
(x^A[j] + 1)を足すことで f(j,j) を足す

*/


int main(){
  ll ans = 0;
  ll mod = 998244353;
  ll N,S;
  cin >> N >> S;
  vector<ll> coefficient(3003,0);
  FOR(i,0,N){
    ll a;
    cin >> a;
    vector<ll> t = coefficient;
    FOR(j,a,S+1){
      (t[j] += coefficient[j-a]) %= mod;
    }
    t[a]++;
    t[0]++;
    coefficient = t;
    (ans += coefficient[S]) %= mod;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define m 1000000007
int main()
{
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	int x=1;
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		if(arr[i]==x)
		{
			x++;
			cnt++;
		}
	}
	if(!cnt)
		cout<<-1<<endl;
	else
		cout<<n-cnt<<endl;

}

Measured memory_bytes: 1024
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	N := readInt()
	M := readInt()
	G := make([]int, N+1)
	for i := 0; i < M; i++ {
		a := readInt()
		b := readInt()
		G[a]++
		G[b]++
	}

	for i := 1; i <= N; i++ {
		println(G[i])
	}
}


Measured memory_bytes: 640
/*
AUTHOR: Aman Raj
LANG: C++
*/

using namespace std;

typedef   long long  ll;
#include <bits/stdc++.h>


//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
#define fast  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
#define all(a) a.begin(),a.end()
#define mod 998244353
#define inf 1e9
//#define mod 3
#define flush fflush(stdout)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, ll, hash<ll> > ht;

// find_by_order()  // order_of_key
typedef tree<
    int,
    null_type,
    less<long long int>,
    rb_tree_tag,
    tree_order_statistics_node_update>
    ordered_set;






ll power1(ll a, ll b)//a raised to power b
   {  if(b<=0) return 1; if(b==1) return a;
       ll c=power1(a,b/2);
        c*=c;c=c%mod;if(b%2==1) c*=a;c=c%mod;
        return c;
   }
  /* ll mi(ll a,ll m)
   { ll c= power1(a,m-2,mod);

     return c;
   }
*/


  int main()
{    fast;
    ll a,b,c,k;cin>>a>>b>>c>>k;
     ll ans=0;
        ans=min(a,k);
        k=max(0ll,k-a);
        k=max(0ll,k-b);
        ans-=k;cout<<ans<<endl;
      return 0;
}


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

#define ll long long
#define vi vector<int>
#define pi pair<int, int>
  
using namespace std;                           

int n, a[10000001], mx, cnt;
 
int main (){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	for(int i = 0; i < n - 1; i++){
		if(a[i] >= a[i + 1]){
			cnt++;
		}
		if(a[i] < a[i + 1]){
			if(cnt > mx){
				mx = cnt;
			}
			cnt = 0;
		}
	}
	if(cnt > mx){
		mx = cnt;
	}
	cout << mx;
	return 0;
}

Measured memory_bytes: 640
# 正整数だけ存在する場合はどうなるだろうか
# absじゃないのが味噌で、最後のyは負数だとお得
# なのでそれまでにできるだけ負の方向にデカいyを作ってみる
# 1 2 4 4 5 8 みたいなとき 1を出発点として残りは全部引いていけるので、最後ではy=1-(2+4+4+5)=-14にできる んで最後に最大値から引くことで 8-(-14)が達成可能
# 負数だけの場合
# 上記を踏まえると唯一の負数は正数で育てることができるが、複数ある場合はどうなるだろうか
# -6 -4 -3 -1 -1 みたいなとき
# 一度でも正数が作れればいいので-1-(-6-4-3-1)=13か？

# -1 1 2 のとき
# 最小値だけで正数を達成することはできない なので最後の手番までにできるだけデカい負を作って最後に引くをする
# -4 -2 -1 3 4 のとき 負数で正を作ると-1-(-2-4)=5, [3 4 5]になってしまいなんか小さくなりそう
# 負数を育てると-4-3-4=-11, -1-(-11)=10, 10-(-2)=12ができそうで、こっちのほうがいい
# 正の数が最後の1つになるまで負を太らせ、あとは負たちを正から引くことであますことなくいただける

n = int(input())
a = sorted(list(map(int, input().split())))
if n == 2:
    print(a[1] - a[0])
    print(a[1], a[0])
    exit()
ans = []
tmp = 0
if a[0] >= 0:
    tmp = a[0]
    for i in range(1, n - 1):
        ans.append(f"{tmp} {a[i]}")
        tmp -= a[i]
    ans.append(f"{a[-1]} {tmp}")
    tmp = a[-1] - tmp
elif a[-1] <= 0:
    tmp = a[-1]
    for i in range(n - 2, -1, -1):
        ans.append(f"{tmp} {a[i]}")
        tmp -= a[i]
else:
    ok, ng = 0, n
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if a[mid] < 0:
            ok = mid
        else:
            ng = mid
    plus = a[ok + 1:]
    minus = a[:ok + 1]
    tmp = minus[0]
    idx = 0
    while idx < len(plus) - 1:
        ans.append(f"{tmp} {plus[idx]}")
        tmp -= plus[idx]
        idx += 1
    ans.append(f"{plus[idx]} {tmp}")
    tmp = plus[idx] - tmp
    for i in range(1, len(minus)):
        ans.append(f"{tmp} {minus[i]}")
        tmp -= minus[i]

print(tmp)
for av in ans:
    print(av)


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

int main() {
	// your code goes here
    int n;
    cin >> n;
    int a[n],b[n],c[n];
    int dp[n][3];
    for (int i = 0; i < n;i++) {
        for (int j = 0; j < 3;j++) {
            dp[i][j] = 0;
        }
    }
    for (int i = 0; i < n;i++) {
        cin >> a[i] >> b[i] >> c[i];
    }
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for (int i = 1; i < n;i++) {
        for (int j = 0; j < 3;j++) {
            if (j == 0)
                dp[i][j] = a[i] + max (dp[i - 1][1],dp[i - 1][2]);
            else if (j == 1) {
                dp[i][j] = b[i] + max (dp[i - 1][0],dp[i - 1][2]);
            }
            else 
                dp[i][j] = c[i] + max (dp[i - 1][1],dp[i - 1][0]);
            //cout << dp[i][j] << " ";
        }
        //cout << endl;
    }
    int ans = 0;
    for (int i = 0; i < 3;i++) {
        ans = max (ans,dp[n - 1][i]);
    }
    cout << ans << endl;
    
}


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

int main(){

    int n;
    int i,j;

    cin >> n;

    for(i = 0;i * 4 <= 100;i++){
        for(j = 0;i * 4 + j * 7 <= 100;j++){
            //cout << "i= "<< i << "j = " << j << endl;
            if((i*4 + j*7) == n){
                cout << "Yes";
                return 0;
            }
        }
        j = 0;
    }
    cout << "No";
    return 0;
}

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


#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
    if(n>0)ans.pb(1);if(n==2)ans.pb(2);
    for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
    return ans;
}
ll fact(ll n){
	
    ll res = 1; 
    for (ll i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
} 
  
int nCr(ll n, ll r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
 
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 


ll ston(string s) 
{ 
    stringstream geek(s); 
    ll x = 0; 
    geek >> x; 
    
  
    return x; 
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
bool bserch(vector<string> a, string s){
	
	ll l=0,r=a.sz-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==s)return true;
		if(a[mid]<s){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return false;
}

bool sortcol( const vector<int>& v1, 
               const vector<int>& v2 ) { 
 return v1[0] < v2[0]; 
} 

 ll degit(ll n)
 {
 	ll t=0;
 	while(n>0)
 	{
 		t++;
 		n/=10; 	}
 		return t;
 }
 

void solve()
{
	ll n,m,x,y;
	cin>>n>>m;
	vector<pair<ll,ll>> a(n);
	for(ll i=0;i<n;i++)
		cin>>a[i].ff>>a[i].ss;
	ll sum=0;
	sort(all(a));
	for(ll i=0;i<n;i++)
	{
		sum+=a[i].ss;
		if(sum>=m)
		{
			cout<<a[i].ff;
			return;
		}
		
		
	}
	
	return;
}

int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,a[500005],s;
ll ans,bin[500005];
int rui[500005];
ll dp[500005];
vector<int>pos[(1<<20)],val;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),s^=a[i];
	bin[0] = 1;
	for(int i=1;i<500005;i++) bin[i] = bin[i-1]*2LL%mod;
	if(s==0){
		int cnt = 0;
		int w = 0;
		for(int i=1;i<n;i++){
			w ^= a[i];
			rui[i] = w;
			if(w == 0) cnt++;
		}
		ans+=bin[cnt];
		for(int i=1;i<=n;i++){
			pos[rui[i]].pb(i);
			if(rui[i])val.pb(rui[i]);
		}
		SORT(val); ERASE(val);
		for(int x=0;x<val.size();x++){
			ll sum,nxt;
			for(int j=0;j<pos[val[x]].size();j++){
				if(j == 0){
					sum = 1;
					nxt = 0;
				}
				else{
					int a = pos[val[x]][j];
					int b = pos[val[x]][j-1];
					int num = POSL(pos[0],a)-POSU(pos[0],b);
					nxt += sum * num % mod;
					if(nxt >= mod) nxt-=mod;
					sum = (sum+nxt+1)%mod;
				}
			}
			ans+=sum;
		}
		cout<<(ans%mod+mod)%mod<<endl; //cout<<"N"<<endl;
	}
	else{
		int cnt = 0;
		int w = 0;
		for(int i=1;i<=n;i++){
			w ^= a[i];
			rui[i] = w;
		}
		dp[0] = 1;
		ll pres=0,pre0=1;
		for(int i=1;i<=n;i++){
			if(rui[i] != 0 && rui[i] != s) continue;
			if(rui[i] == 0){
				dp[i] = pres;
				pre0+=pres;
				if(pre0>=mod) pre0-=mod;
			}
			else{
				dp[i] = pre0;
				pres+=pre0;
				if(pres>=mod) pres-=mod;
			}
		}
		cout<<(dp[n]%mod+mod)%mod<<endl;
	}
}

Measured memory_bytes: 47472
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a[8],p[8],q[8];
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> p[i];
        a[i] = i+1;
    }
    for(int i = 0; i < n; i++){
        cin >> q[i];
    }
    int aa = 0, bb = 0, cnt = 0;
    do{
        cnt ++;
        int i = 0;
        while(p[i]==a[i] && i < n){
                i++;
        }
        if(i == n)
            aa = cnt;
        int j = 0;
        while(q[j]==a[j] && j < n){
                j++;
        }
        if(j == n)
            bb = cnt;
    }while(next_permutation(a,a+n));
            cout << abs(aa - bb) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}



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

  ll X ; cin >> X;

  ll ret = 0;
  rep(i,X+1){
    ret += i;
    if(ret >= X){ cout << i << endl; return 0;}
  }
  
  
  //cout << fixed << setprecision(16) << ans << endl;

  return 0;
}


Measured memory_bytes: 256
/*
    STARK_BOY
*/
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repe(i,a,b) for(ll i=a;i<=b;i++)
#define bac(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef long long ll;
typedef vector< ll > vi;
typedef vector<pair<ll,ll> > vpii;
typedef pair<ll,ll> pii;
#define all(c) c.begin(),c.end()
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define setbitc(x) __builtin_popcount(x)
#define init(x,a) memset(x,a,sizeof(x))
#define PI           3.14159265358979323846  /* pi */
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
#define N 1000005
//Variables Start
ll inf=1e18,MOD=1e9+7;
ll n,m,k,ar[N],br[N];
string s,s1;
//Variables End

int main()
{
    ios
    int ti=1;
    //cin>>ti;
    while(ti--)
    {
    	string s,t;
		cin>>s>>t;
		n=s.length(),m=t.length();
		vector< vi > dp(n+1, vi(m+1,0));

		rep(i,1,n+1)
		{
			rep(j,1,m+1)
			{
				if(s[i-1]==t[j-1])
				{
					dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
				}
				else
				{
					dp[i][j]=max(dp[i][j],max(dp[i][j-1],dp[i-1][j]));
				}
			}
		}
		string ans="";
		ll i=n,j=m;
		while(i>0 && j>0)
		{
			if(s[i-1]==t[j-1])
			{
				ans+=s[i-1];
				i--,j--;
			}
			else if(dp[i-1][j]>dp[i][j-1])
			{
				i--;
			}
			else
			{
				j--;
			}
		}
		reverse(all(ans));
		cout<<ans<<endl;
		//cout<<dp[n][m]<<endl;
    }
    return 0;
        
}

Measured memory_bytes: 70784
def f i,j;$m[i][j]||=f(i-1,j)+f(i,j-1);end
def g;gets.split.map &:to_i;end
while(a,b=g)[0]>0
$m=(0..a).map{[0]}
$m[0]+=[0]*b
$m[1][1]=1
g[0].times{i,j=g;$m[i][j]=0}
p f(a,b)
end

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

using namespace std;

int dp[100002][3];
int a[100002], b[100002], c[100002];
int n;

int solve(int i, int prev) {
	if(i == n) return 0;
	if(dp[i][prev] != -1) return dp[i][prev];

	if(prev == 0) dp[i][prev] = max(b[i] + solve(i+1, 1), c[i] + solve(i+1, 2));
	if(prev == 1) dp[i][prev] = max(a[i] + solve(i+1, 0), c[i] + solve(i+1, 2));
	if(prev == 2) dp[i][prev] = max(a[i] + solve(i+1, 0), b[i] + solve(i+1, 1));

	return dp[i][prev];
}

int main() {
	scanf("%d", &n);

	for(int i=0; i<n; i++)
		scanf("%d %d %d", &a[i], &b[i], &c[i]);

	memset(dp, -1, sizeof(dp));

	printf("%d\n", max(a[0] + solve(1, 0), max(b[0] + solve(1, 1), c[0] + solve(1, 2))));

	return 0;
}

Measured memory_bytes: 7296
import numpy as np
s=input()
A=np.array([0,0,0,0])
B=np.array([0,0,0,0])
C=np.array([0,0,0,0])
t=0
for c in s:
	if c=="A":
		A[0]+=1
	if c=="B":
		B+=A
	if c=='C':
		C+=B
	if c=='?':
		C[1]+=B[0]
		C[2]+=B[1]
		C[3]+=B[2]
		B[1]+=A[0]
		B[2]+=A[1]
		A[1]+=1
		t+=1
ans=0
for i in range(4):
	ans+=pow(3,t-i)*C[i]
print(int(ans%1000000007))

Measured memory_bytes: 20768
n = int(input())
t, a = list(map(int, input().split()))
h_list = list(map(int, input().split()))

def temp(x):
    y = abs(t - x*0.006 - a)
    return y
t_dif = list(map(temp, h_list))
t_min = min(t_dif)
t_index = int(t_dif.index(t_min))
print(t_index+1)

Measured memory_bytes: 9240
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repv(i,a,b) for(ll i=b-1;i>=a;i--)

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;}

ll n,k,m=1e9+7;
ll C[2005][2005];

ll bc(ll n,ll r)
{
    if(r>n) return 0;
    if(r==0 || r==n) return 1;
    if(C[n][r]!=0) return C[n][r]%m;
    C[n][r] = (bc(n-1,r)%m+bc(n-1,r-1)%m)%m;
    return C[n][r]%m;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>k;
    for(ll i=1;i<=k;i++)
    {
        ll p=bc(n-k+1,i)%m;
        ll q=bc(k-1,i-1)%m;
        cout<<(p*q)%m<<endl;
    }
}

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

#define db(x) cout<<x<<'\n'
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define repi(i,n) for(int i=0;i<(n);++i)
//#define repA(i,a,n) for(int i=a;i<=(n);++i)
//#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define ll long long int
#define endl '\n'
#define lld long long double
#define vi vector<int> 
#define vl vector<ll> 
#define vb vector<bool> 
#define vvi vector<vector<int>  >
#define err(t) cout<<"Error : "<<t<<endl;
#define all(v) v.begin(),v.end()
#define mp make_pair
#define M 100000
#define MD 1000000007 //998244353
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= (b); i++)
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define vec(a) vector<a >
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
//template <typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll binpow(ll a,ll b){	if(a==0) return 0; if(b==0) return 1;ll ans=1;while(b>0){if(b&1) ans=ans*a; a=a*a; b=b>>1;}	return ans;}
template <typename T> 
T Min(T a,T b){ return a<b?a:b; }
template <typename T>
T Max(T a,T b){ return a>b?a:b; }

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	// int n;cin>>n;
	// string s;cin>>s;
	
	//ll n;cin>>n; vl a(n); repi(i,n) cin>>a[i];
	ll n;cin>>n;//n--;
	
	//n=i;
	string ans="";
	while(n){
		int t=n%26;
		if(t==0){ n-=26;ans+='z';n/=26;}
		else ans+='a'-1+t,
		n/=26;
	}
	reverse(all(ans));
	db(ans);
	//}
	/*
	int test1;cin>>test1;while(test1--){ 
		
	 }
	 //*/
return 0;
}



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

using namespace std;

int main(int argc, const char *argv[]) {
  int N, max;
  int count = 1;
  cin >> N;
  vector<int> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }

  max = H[0];
  for (int i = 1; i < N; i++) {
    if(H[i] >= max){
      count++;
      max = H[i];
    }
  }
  cout << count << endl;

  return 0;
}


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

int main()
{
  int a,b;
  cin>>a>>b;
  if(a>b)
  {
      for(int i = 1; i<=a;i++)
      {
          cout<<b;
      }
      cout<<endl;
  }
  else if(b>a)
  {
      for(int i = 1; i<=b;i++)
      {
          cout<<a;
      }
      cout<<endl;

  }
  else if(a==b)
  {
      for(int i = 1; i<=a || i<=b;i++)
      {
          cout<<b;
      }
      cout<<endl;
  }

    return 0;
}



Measured memory_bytes: 3548
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

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

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

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

const double pi = M_PI;
const Int MOD = 1000000007;

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

    Int n, d;
    cin >> n >> d;

    bool ans = false;
    Int X = 10000, Y = 5000, Z = 1000;
    for (Int x = 0; x <= n; x++) {
        for (Int y = 0; y <= n; y++) {
            if (n < x + y) {
                break;
            }
            if (d < X * x + Y * y) {
                break;
            }

            Int ro = n - (x + y);
            for (Int z = 0; z <= ro; z++) {
                Int oto = X * x + Y * y + Z * z;
                if (x + y + z == n && d == oto) {
                    cout << x << ' ' << y << ' ' << z << endl;
                    return 0;
                }
            }
        }
    }

    if (!ans) {
        cout << "-1 -1 -1"s << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector <int> a(n);
    for(int i=0;i<n;++i) cin >> a[i];
    vector <int> v(n);
    for(int i=0;i<n;++i) v[a[i]-1]=i+1;
    for(int i=0;i<n;++i) cout << v[i] << endl;
    return 0;
}

Measured memory_bytes: 1664