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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007; // 998244353

#define CLR(a) memset((a), 0, sizeof(a))

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

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

struct mint {
    long long x;
    mint(long long x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
    	return *this;
    }
    mint& operator*=(const mint a) {
    	(x *= a.x) %= MOD;
    	return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
    	if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
    	return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

int main(void){
    string L; cin >> L;
    int N = L.size();
    mint dp[N+1][2];
    dp[0][0] = 1;
    REP(i,N){
        if(L[i] == '0'){
            dp[i+1][0] = dp[i][0];
            dp[i+1][1] = dp[i][1]*3;
        }
        else{
            dp[i+1][0] = dp[i][0]*2;
            dp[i+1][1] = dp[i][0] + dp[i][1]*3;
        }
    }
    mint ans = dp[N][0] + dp[N][1];
    cout << ans.x << endl;
    return 0;
}

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

int main(){
	uint64_t human;
	uint64_t num_human;
	cin >> num_human;
	uint64_t remainder = 10000000000000000;
	for(int i = 0;i < 5;i++){
		cin >> human;
		if(remainder > human){
			remainder = human;
		}
	}
	if(num_human % remainder == 0){
		cout << num_human / remainder + 4 << endl;
	}else{
		cout << num_human / remainder + 5 << endl;
	}
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: u32 = read();
    let b: u32 = read();
    let c: u32 = read();
    if a == 5 && c == 5 {
      println!("YES");
    } else if a == 5 && b == 5 {
      println!("YES");
    } else if b == 5 && c == 5 {
      println!("YES");
    } else {
      println!("NO");
    }
}

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

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define read()          freopen("fibsubseq.in","r",stdin)
#define write()         freopen("fibsubseq.out","w",stdout)
#define sf(n)           scanf("%d",&n)
#define sfd(n)          scanf("%lf",&n)
#define sl(x)           scanf("%I64d",&x)
#define sfl(n)          scanf("%lld", &n)
#define sfc(n)          scanf(" %c",&n)
#define sful(n)         scanf("%llu",&n)
#define ull             unsigned long long int
#define endll           prinf("\n"}
#define pf              printf
#define pi              acos(-1.0)
#define eps             1e-10
#define mem(a,b)        memset(a,b,sizeof(a))
#define pb              push_back
#define xx              first
#define yy              second
#define pii             pair<int, int>
#define pll             pair<ll, ll>
#define MP make_pair
#define ll              long long
#define uniq(a)      a.erase(unique(a.begin(), a.end()), a.end())

bool Check(unsigned int  N,int pos){return (bool)(N & (1LL<<pos));}
ll  Set(unsigned int N,int pos){    return N=N | (1LL<<pos);}
#define cnd tree[idx]
#define lnd tree[idx<<1]
#define rnd tree[(idx<<1)+1]
#define lndp (idx<<1),(b),((b+e)>>1)
#define rndp ((idx<<1)+1),(((b+e)>>1)+1),(e)
#define inf 1999999999
#define MX 100005
#define mod  1000000007
#define mod1 1000000009
#define var    int ii,i,j,n,k,m,z=0,c=0,t,x,y,l,r,mid
//int dx[8]={0,0,1,1,-1,-1,1,-1};  //8 direction
//int dy[8]={1,-1,1,-1,1,-1,0,0};
//int dx[4]={1,-1,0,0};  //4 direction
//int dy[4]={0,0,1,-1};

ll dp[100005];
vector<ll > v[100005];

ll dfs(ll x)
{
    ll &z = dp[x];
    if(z!=-1)return z;
    z=0;
    ll n=v[x].size(),i;
    for(i=0;i<n;i++)
    {
        z=max(z,1+dfs(v[x][i]));
    }
    return z;
}

int main()
{
    SPEED;
    ll var;
    mem(dp,-1);
    sfl(n);sfl(m);
    for(i=0;i<m;i++)
    {
        sfl(x);sfl(y);
        v[x].pb(y);
    }

    for(i=1;i<=n;i++)
    {
        z=max(z, dfs(i));
    }
    cout<<z<<endl;
}


Measured memory_bytes: 8576
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end


N,A,B=get_i
S=get_nsp
an=0
bn=0
n=0
S.each do|s|
    if s=="a"
        if n<A+B
            puts "Yes"
            n+=1
        else
            puts "No"
        end
        an+=1
    elsif s=="b"
        if n<A+B and bn<B
            puts "Yes"
            n+=1
        else
            puts "No"
        end
        bn+=1
    else
        puts "No"
    end
end

Measured memory_bytes: 9852
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
 
using namespace std;
int MOD = 1000000007;
#define N 200010
int par[2][N];
int rnk[2][N];

void init(int n,int num){
    for(int i=0;i<n;i++){
        par[num][i] = i;
        rnk[num][i] = 0;
    }
}
int find(int x,int num){
    if(par[num][x] == x) return x;
    else return par[num][x] = find(par[num][x],num);
}
void unite(int x,int y,int num){
    x = find(x,num);
    y = find(y,num);
    if(x == y) return;

    if(rnk[num][x] < rnk[num][y]) par[num][x] = y;
    else{
        par[num][y] = x;
        if(rnk[num][x] == rnk[num][y]) rnk[num][x]++;
    }
}
bool same(int x,int y,int num){
    return find(x,num) == find(y,num);
}
signed main(){
    int n,k,l;
    cin >> n >> k >> l;
    map<pair<int,int>,int> m;
    vector<pair<int,int>> oya(n);
    init(n,0);
    init(n,1);
    rep(i,k){
        int p,q;
        cin >> p >> q;
        unite(p-1,q-1,0);
    }
    rep(i,l){
        int p,q;
        cin >> p >> q;
        unite(p-1,q-1,1);
    }
    rep(i,n){
        oya[i] = MP(find(i,0),find(i,1));
        m[oya[i]]++;
    }
    rep(i,n)cout << m[oya[i]] << " ";
    cout << endl;



    return 0;   
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://ddcc2019-final.contest.atcoder.jp/tasks/ddcc2019_final_a
// rm -r -f test;oj dl http://arc065.contest.atcoder.jp/tasks/arc065_b

Measured memory_bytes: 21248
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define len(n) (int)n.length()
#define pb push_back
#define ll long long
#define make_pair mkp
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) (v).begin(), (v).end()
#ifdef DBGPRT
#define dbg(n) cerr << "//" << #n << ":" << n <<endl
#else
#define dbg(n) ;
#endif
typedef pair<ll, ll> LLARR;
#define INF 999999999
const double PI = 3.1415926535897932384626433832795;

int main()
{
	ios::sync_with_stdio(false);

	int n, m;
	cin >> n >> m;
	vector<string> ns;
	vector<string> ms;
	REP(i, n)
	{
		string s;
		cin >> s;
		ns.pb(s);
	}
	REP(i, m)
	{
		string s;
		cin >> s;
		ms.pb(s);
	}
	bool ok = false;
	REP(i, n-m+1)
	{
		REP(l, n-m+1)
		{
			ok = true;
			REP(j, m)
			{
				REP(k, m)
				{
					if (ms[j][k] != ns[i+j][l+k])
					{
						ok = false;
					}
				}
			}
			if (ok)
				break;
		}
		if (ok)
			break;
	}
	cout << (ok ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  double a, b, x;cin >> a >> b >> x;
  double t;
  // cout << t << endl;
  if(x <= (a*b/2)*a){
    t = atan2((a*b*b)/(2*x), 1.0);
    // cout << t << endl;
    t = t*(180.0/M_PI);
    cout << fixed << setprecision(10);
    cout << t << endl;
  }else{
    t = atan2((2/a)*(b - (x/(a*a))), 1.0);
    t = t*(180.0/M_PI);
    cout << fixed << setprecision(10);
    cout << t << endl;
  }
}

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

typedef long long ll;
const int N = 3e5;
const ll MOD = 1e9+7;

ll dmod(ll x){
	return x%MOD;
}

int n;
ll li[N+5];
ll cnt[4][65];

int main(){
	memset(cnt,0,sizeof(cnt));
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&li[i]);
		for(int j=0;j<60;j++){
			if((1ll<<j)&li[i]) cnt[1][j]++;
			else cnt[0][j]++;
		}
	}
	ll ans = 0ll;
	for(int i=0;i<60;i++){
		ans = dmod(ans + dmod(dmod(cnt[0][i] * cnt[1][i]) * dmod(1ll << i)));
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int H = scan.nextInt();
        int W = scan.nextInt();
        while(H!=0 && W !=0){
            int w = W;
            while(H != 0){
                while(w !=0){
                    System.out.print("#");
                    w--;
                }
                System.out.println("");
                H--;
                w = W;
            }
            H = scan.nextInt();
            W = scan.nextInt();
            System.out.println("");
        }
    }
}


Measured memory_bytes: 34672
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int a = Integer.parseInt(sc.next());
    int b = Integer.parseInt(sc.next());
    sc.close();

    for (int i = 1; i < 2000; i++) {
      if ((int) (i * 0.08) == a && (int) (i * 0.1) == b) {
        System.out.println(i);
        System.exit(0);
      }
    }

    System.out.println(-1);
  }
}

Measured memory_bytes: 24020
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

int cnt[400000];

int main() {
	SET(cnt, 0);
	int N, M;
	cin >> N >> M;
	int a, b;
	FOR (i, M) {
		cin >> a >> b;
		if (a == 1)
			cnt[b]++;
		if (b == N)
			cnt[a]++;
	}
	FOR (i, N)
		if (cnt[i] >= 2) {
			cout << "POSSIBLE" << endl;
			return 0;
		}
	cout << "IMPOSSIBLE" << endl;
	return 0;
}

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

#define rep(i,a,b) for(int i=a;i<b;i++)
#define NUM_MAX 105
#define INF INT_MAX/2

typedef long long int ll;

int main()
{
	while (1)
	{
		int n, m, s, g1, g2;
		cin >> n >> m >> s >> g1 >> g2;
		if (n == 0) return 0;

		ll d[NUM_MAX][NUM_MAX];
		rep(i, 0, n + 1) rep(j, 0, n + 1)
		{
			if (i == j)
				d[i][j] = 0;
			else
				d[i][j] = INF;
		}

		rep(i, 0, m)
		{
			int b1, b2, c;
			cin >> b1 >> b2 >> c;
			d[b1][b2] = c;
		}

		rep(k, 0, n + 1) rep(i, 0, n + 1) rep(j, 0, n + 1)
			d[i][j] = min(d[i][j], d[i][k] + d[k][j]);

		ll ans = INF;
		rep(i, 1, n + 1) ans = min(ans, d[s][i] + d[i][g1] + d[i][g2]);
		cout << ans << endl;
	}
}

Measured memory_bytes: 3164
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    a,b,c=map(int,input().split())
    YESNO(b-a==c-b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
n=int(input())
d={}
ans=0
for i in range(n):
    s=list(input())
    s="".join(sorted(s))
    if s in d:
        d[s]+=1
    else:
        d[s]=1
for i in d.values():
    ans+=i*(i-1)//2
# print(d)
print(ans)
            

Measured memory_bytes: 17808
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      String s = sc.next();
	  int[] arr = new int[]{1, 1, 1};
      for(int i = 0; i < s.length(); i++) {
      	char c = s.charAt(i);
        arr[c-'a']--;
        if(arr[c-'a'] < 0) {
        	System.out.println("No");
          	return;
        } 
      }
      System.out.println("Yes");
  }
}


Measured memory_bytes: 22740
import sys
S=input()
L=['dream','dreamer','erase','eraser']
T=[i[::-1] for i in L]
S=S[::-1]
while True:
    #print(S)
    if len(S)==0:
        print('YES')
        sys.exit()
    if S[:5]==T[0]:
        S=S[5:]
        continue
    if S[:5]==T[2]:
        S=S[5:]
        continue
    if S[:7]==T[1]:
        S=S[7:]
        continue
    if S[:6]==T[3]:
        S=S[6:]
        continue
    print('NO')
    sys.exit()


Measured memory_bytes: 134676
def main():
    c = input()
    a = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
    print(a[a.index(c)+1])
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define int long long
bool ex[13][1<<(12*2)];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    string s,t;
    cin>>s>>t;
    int k=t.size(),tmp=0;
    for(int j=0;j<k;j++){
      tmp*=4;
      if(t[j]=='A') tmp+=0;
      if(t[j]=='C') tmp+=1;
      if(t[j]=='G') tmp+=2;
      if(t[j]=='T') tmp+=3;
    }
    if(s=="insert") ex[k][tmp]=1;
    else cout<<(ex[k][tmp]?"yes":"no")<<endl;
  }
  return 0;
}

Measured memory_bytes: 4512
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  string s; cin >> s;
  for (int i = 0; i < LEN(s); i+=2) cout << s[i];
  cout << endl;

  return 0;
}



Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>

using namespace std;

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

	vector<int> d(k);
	vector<vector<int>> a(k, vector<int>(n));
	vector<int> cnt(n + 1);
	int ans = 0;

	for (int i = 0;i < k;i++) {
		cin >> d[i];
		for (int j = 0;j < d[i];j++) {
			cin >> a[i][j];
			cnt[a[i][j]]++;
		}
	}

	for (int i = 1;i <= n;i++) {
		if (cnt[i] == 0) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3640
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	int h, a;
	cin >> h >> a;

	cout << (h + a - 1) / a << endl;



	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX_i 50002

typedef struct process{
    char name[11];
    int time;
}pr;
void enqueue(pr x);
pr dequeue();
pr p[MAX_i];
int head,tail;

int main(void){
    int n,q,i,sum=0;
    pr x;
    
    scanf("%d %d",&n,&q);
    for(i=0;i<n;i++){
        scanf("%s %d",p[i].name,&p[i].time);
    }
    head=0;
    tail=n;
    while(head!=tail){
        x=dequeue();
        if(x.time<=q){
            sum+=x.time;
            printf("%s %d\n",x.name,sum);
        }else{
            sum+=q;
            x.time-=q;
            enqueue(x);
        }
    }
    return 0;
}

void enqueue(pr x){
    p[tail]=x;
    if(tail+1==MAX_i){
        tail=0;
    }else{
        tail++;
    }
}

pr dequeue(){
    if(head+1==MAX_i){
        head=0;
        return p[MAX_i-1];
    }else{
        head++;
        return p[head-1];
    }
}



Measured memory_bytes: 2480
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		int a = Integer.parseInt(in.readLine());
		String s = in.readLine();

		if (a >= 3200) {
			System.out.println(s);
		} else {
			System.out.println("red");
		}

	}
}


Measured memory_bytes: 20692
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define all(a)  (a).begin(),(a).end()

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

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

const ll INF = 1LL << 60;

int main(){
  int n,m; cin >> n >> m;
  vector<pii> x;
  rep(i, n){
    int a; cin >> a;
    x.pb(make_pair(a,1));
  }
  rep(i, m){
    int b,c; cin >> b >> c;
    x.pb(make_pair(c,b));
  }
  sort(all(x),greater<pii>());

  vi A;
  int i = 0;
  while(A.size() < n){
    int b = x[i].second;
    rep(j, b) if(A.size() < n) A.pb(x[i].first);
    i++;
  }
  ll ans = 0;
  rep(j, n) ans += A[j];

  std::cout << ans << '\n';
}


Measured memory_bytes: 2672
use std::io;


fn get_line() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line).ok();
    line
}

fn main() {
    let s=get_line();
    let v:Vec<_> = s.trim().split(' ').collect();
    let a:i32 = v[0].parse().unwrap();
    let b:i32 = v[1].parse().unwrap();
    println!("{} {}", a * b, a * 2 + b * 2);
}



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

using namespace std;

/** Interface */

inline int readChar();
template <class T = int> inline T readInt();
template <class T> inline void writeInt( T x, char end = 0 );
inline void writeChar( int x );
inline void writeWord( const char *s );

/** Read */

static const int buf_size = 4096;

inline int getChar() {
	static char buf[buf_size];
	static int len = 0, pos = 0;
	if (pos == len)
		pos = 0, len = fread(buf, 1, buf_size, stdin);
	if (pos == len)
		return -1;
	return buf[pos++];
}

inline int readChar() {
	int c = getChar();
	while (c <= 32)
		c = getChar();
	return c;
}

template <class T>
inline T readInt() {
	int s = 1, c = readChar();
	T x = 0;
	if (c == '-')
		s = -1, c = getChar();
	while ('0' <= c && c <= '9')
		x = x * 10 + c - '0', c = getChar();
	return s == 1 ? x : -x;
}

/** Write */

static int write_pos = 0;
static char write_buf[buf_size];

inline void writeChar( int x ) {
	if (write_pos == buf_size)
		fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
	write_buf[write_pos++] = x;
}

template <class T>
inline void writeInt( T x, char end ) {
	if (x < 0)
		writeChar('-'), x = -x;

	char s[24];
	int n = 0;
	while (x || !n)
		s[n++] = '0' + x % 10, x /= 10;
	while (n--)
		writeChar(s[n]);
	if (end)
		writeChar(end);
}

inline void writeWord( const char *s ) {
	while (*s)
		writeChar(*s++);
}

struct Flusher {
	~Flusher() {
		if (write_pos)
			fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
	}
} flusher;

typedef long long ll;
typedef unsigned long long ull;

int main() {
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll x, y;
    cin >> x >> y;
    if (x % y == 0) {
        cout << -1;
        return 0;
    }
    cout << x * (y + 1);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
int A[100];

void solve() {
	cin >> N;
	int absm = -1, at = 0;
	rep(i, 0, N) {
		cin >> A[i];
		if(absm < abs(A[i])) {
			absm = abs(A[i]);
			at = i;
		}
	}
	vector<pi> ans;
	if(A[at] < 0) {
		rep(i, 0, N) {
			if(A[i] > 0) {
				ans.pb(pi(i + 1, at + 1));
			}
		}
		rer(i, N, 1) {
			ans.pb(pi(i, i + 1));
		}
	}
	else if(A[at] > 0) {
		rep(i, 0, N) {
			if(A[i] < 0) {
				ans.pb(pi(i + 1, at + 1));
			}
		}
		rep(i, 0, N - 1) {
			ans.pb(pi(i + 2, i + 1));
		}
	}
	cout << sz(ans) << "\n";
	rep(i, 0, sz(ans)) {
		cout << ans[i].sec << " " << ans[i].fst << "\n";
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
#ifdef LOCAL
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
template<class T>bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if (b<a){a=b;return 1;}return 0;}
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
// clang-format on

void solve(long long N) {
  long double X = (long double)N / 1.08;
  ll ans = (ll)ceil(X);
  ll check = ans * 1.08;
  if (check != N) {
    cout << ":(" << endl;
    return;
  }
  cout << ans << endl;
};

int main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int M=400;
int n;
vi a,b,x,y,c;
ll dp[M][M],DP[M][M];

int main(){
	cin>>n;
	a=b=vi(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n;i++) cin>>b[i];
	for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(a[i]!=b[j]){
		bool B1=0,B2=0;
		for(int k=i;k<n;k++) B1|=a[k]==b[j];
		for(int k=j;k<n;k++) B2|=a[i]==b[k];
		if(B1&&B2){
			int d[M],cnt=0;
			fill(d,d+M,0);
			for(int k=i+1;k<n;k++) d[a[k]]=1;
			for(int k=j+1;k<n;k++) cnt+=d[b[k]];
			x.push_back(i);
			y.push_back(j);
			c.push_back(cnt);
		}
	}
	dp[M-1][M-1]++;
	for(int i=0;i<n/3;i++){
		for(int j=M-1;j>=0;j--) for(int k=M-1;k>=0;k--){
			if(j<M-1) (dp[j][k]+=dp[j+1][k])%=mod;
			if(k<M-1) (dp[j][k]+=dp[j][k+1])%=mod;
			if(j<M-1&&k<M-1) dp[j][k]=(dp[j][k]-dp[j+1][k+1]+mod)%mod;
		}
		for(int j=0;j<x.size();j++) DP[x[j]][y[j]]=dp[x[j]+1][y[j]+1]*max(0,c[j]-3*i);
		for(int j=0;j<M;j++) for(int k=0;k<M;k++) dp[j][k]=DP[j][k],DP[j][k]=0;
	}
	ll res=dp[0][0];
	for(int i=1;i<n;i++) if(i%3!=0) (res*=i)%=mod;
	cout<<res<<endl;
}

Measured memory_bytes: 3948
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))

int ar[100005];
int32_t main(){
	int n,c,k;
	cin>>n>>c>>k;
	for(int i=1;i<=n;i++){
		cin>>ar[i];
	}
	sort(ar+1,ar+n+1);
	int ans = 0;
	int cur_bus = 0;
	int earliest = 0;
	int cur_time = 0;
	int i=1;
	while(i<=n){
		cur_time = ar[i];
		int j = i+1;
		until((ar[j]-ar[i])>k || (j-i)>=c || j>n){
			j++;
		}
		i=j;
		ans++;
		//cout<<i;
	}
	cout<<ans;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(p,a,b)    for(int p=a;p<b;p++)
#define INF 0x3f3f3f3f
#define N 100007
 
 
int main() {
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("o2.txt", "w", stdout);
    #endif
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll n,i,ans=0;
    map<ll,ll> m;
 
    cin>>n;
    vector<ll>h(n+1);
    for(i=1 ; i<=n ; i++)
    {
        cin>>h[i];
        m[i+h[i]]++;
    }
 
    for(i=1 ; i<=n ; i++)ans+=m[i-h[i]];
    cout<<ans;
    return 0;
}

Measured memory_bytes: 27380
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	int a, b, c = 0, d = 0, e;
	cin >> a;
	for (int h = 1; h <= a; h++) {
		cin >> b;
		c = b + c;
		d = max(b, d);
	}
	if (d < c - d) {
		cout << "Yes" << "\n";
	}
	else {
		cout << "No" << "\n";
	}
	cin >> e;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 100000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
 
/*---------------------------------------------------*/

int main(){
  int ans;
  string s;
  cin>>s;
  ans=s.size();
  rep(i,s.size()-1){
    if(s[i]!=s[i+1]){
      ans=min(ans,max(i+1,(int)s.size()-i-1));
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 512
package main

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

var sc = bufio.NewScanner(os.Stdin)

func r() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func posNegZe(n int) int {
	if n > 0 {
		return 1
	} else if n == 0 {
		return 0
	}
	return -1
}

func main() {
	sc.Split(bufio.ScanWords)
	n := r()

	ans := 1
	for i, ah, ai, xh, xi := 1, r(), 0, 0, 0; i < n; i++ {
		ai = r()
		xi = posNegZe(ai - ah)
		if xh*xi < 0 {
			ans++
			xh = 0
		} else if xi != 0 {
			xh = xi
		}
		ah = ai
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
import sys
import math
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化

def main():
    x, y = list(map(int,sys.stdin.readline().split()))
    if y % 2 == 1:
        print("No")
    else:
        if 2 * x <= y and y <= 4 * x:
            print("Yes")
        else: print("No")
    return 0

if __name__ == "__main__":
    main()

Measured memory_bytes: 9740
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc =new Scanner(System.in);
		int n[]=new int[3];
		int t=0;
		int ans=0;
		for(int i=0;i<3;i++){
			n[i]=sc.nextInt();
		}
		for(int j=0;j<2;j++){
			for(int i=0;i<2-j;i++){
				if(n[i+1]-n[i]<0){
					t=n[i];
					n[i]=n[i+1];
					n[i+1]=t;
				}
			}
		}
		for(int i=0;i<2;i++){
			ans+=n[i+1]-n[i];
		}
		System.out.println(ans);
	}

}



Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n,k;
    cin >> n >> k;
    vi a(n+1,0);
    rep(i,n)cin >> a[i+1];
    vi sum = a;
    rep(i,n)sum[i+1] += sum[i];
    rep(i,n+1)sum[i] -= i%k, sum[i] %= k;
    int ans = 0;
    map<int,int> ma;
    //rep(i,n+1)cout << " " << sum[i] << endl;
    rep(i,n+1){
        if(i-k >= 0)ma[sum[i-k]]--;
        ans += ma[sum[i]];
        ma[sum[i]]++;
    }
    cout << ans << endl;
}


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

vector<int> djs(200001, -1);

int root(int a)
{
  return djs[a] < 0 ? a : djs[a] = root(djs[a]);
}

int unite(int a, int b)
{
  int root_a = root(a);
  int root_b = root(b);
  if (root_a == root_b) return 0;
  if (djs[root_a] > djs[root_b]) swap(root_a, root_b);
  djs[root_a] += djs[root_b];
  djs[root_b] = root_a;
  return -djs[root_a];
}

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

  int ans = 1;

  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    ans = max(ans, unite(a, b));
  }

  cout << ans << endl;
}


Measured memory_bytes: 3904
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin >> N;
  int x=1;
  int y=1;
  int z=1;
  int ans=0;
  int n=0;
  int bre=0;
  for(int i=1; i<N+1 ; i++)
  {
   ans=0;
    while(1)
    {
      while(1)
      {
        while(1)
        {
          n=(x*x)+(z*z)+(y*y)+(x*y)+(y*z)+(z*x);
          if(n==i)
          {
            ans++;
          }                     
          if(n>i)
          {        
          if(bre==0)
          {
            bre=x;
          }    
          break;
          }
          x++;
        }      
      x=1;
      y++;
      if(bre<=y)break;
      }    
    x=1;
    y=1;
    z++;
    if(bre<=z)break;
    }
    bre=0;
    z=1;
    cout << ans << endl;
  }    
}


Measured memory_bytes: 3492
#include<bits/stdc++.h>
#define N 200009
#define M 800009
using namespace std;

int n,rt,sta,tot,pnt[M],nxt[M]; bool bo[N];
int h[N],fa[N],dep[N],sz[N],son[N],anc[N],d[N];
struct graph{
	int fst[N];
	void add(int x,int y){
		pnt[++tot]=y; nxt[tot]=fst[x]; fst[x]=tot;
	}
}gr,gb;
void dfs(int x){
	int i,y; sz[x]=1;
	for (i=gb.fst[x]; i; i=nxt[i]){
		y=pnt[i];
		if (y!=fa[x]){
			fa[y]=x; dep[y]=dep[x]+1;
			dfs(y); sz[x]+=sz[y];
			if (sz[y]>sz[son[x]]) son[x]=y;
		}
	}
}
void dvd(int x,int tp){
	int i,y; anc[x]=tp;
	if (son[x]) dvd(son[x],tp);
	for (i=gb.fst[x]; i; i=nxt[i]){
		y=pnt[i];
		if (y!=fa[x] && y!=son[x]) dvd(y,y);
	}
}
int lca(int x,int y){
	for (; anc[x]!=anc[y]; x=fa[anc[x]])
		if (dep[anc[x]]<dep[anc[y]]) swap(x,y);
	return dep[x]<dep[y]?x:y;
}
int dist(int x,int y){
	return dep[x]+dep[y]-(dep[lca(x,y)]<<1);
}
int main(){
	scanf("%d%d%d",&n,&sta,&rt);
	int i,j,x,y;
	for (i=1; i<n; i++){
		scanf("%d%d",&x,&y);
		gr.add(x,y); gr.add(y,x);
	}
	for (i=1; i<n; i++){
		scanf("%d%d",&x,&y);
		gb.add(x,y); gb.add(y,x);
	}
	dfs(rt); dvd(rt,rt);
	for (i=1; i<=n; i++)
		for (j=gr.fst[i]; j; j=nxt[j])
			if (dist(i,pnt[j])>2) bo[i]=1;
	int head=0,tail=1,ans=0; h[1]=sta;
	memset(d,-1,sizeof(d)); d[sta]=0;
	while (head<tail){
		x=h[++head];
		if (bo[x]){ puts("-1"); return 0; }
		ans=max(ans,dep[x]<<1);
		for (i=gr.fst[x]; i; i=nxt[i]){
			y=pnt[i];
			if (d[y]==-1 && d[x]+1<dep[y]){
				d[y]=d[x]+1; h[++tail]=y;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 22144
N = int(input())

result = 0


for i in range(1, N+1):
    cnt = 0
    if i % 2 ==0:
        continue
    for x in range(1, N+1):
        if i % x == 0:
            cnt += 1
    #print(i)
    #print(cnt)
    if cnt == 8:
        result += 1
print(result)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 1
/*------------------------------------------------------------*/

int main(){
	string s;
	cin>>s;
	int l=0,r=s.length()-1;
	int ans=0;
	while(l<r){
		if(s[l]=='x'&&s[r]!='x')ans++,l++;
	    if(s[l]!='x'&&s[r]=='x')ans++,r--;
		if(s[l]!=s[r]&&s[l]!='x'&&s[r]!='x'){
			out(-1);
			return 0;
		}
		if(s[l]==s[r])l++,r--;
	}
	out(ans);
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;

template<typename T>
class Combination {
    private:
        T mod;
        vector<T> factorial, inv_factorial, inv;
    public:
        Combination(int max_number, T _mod):
        mod(_mod), factorial(max_number + 1), inv_factorial(max_number + 1), inv(max_number + 1) {
            factorial[0] = factorial[1] = 1;
            inv_factorial[0] = inv_factorial[1] = 1;
            inv[1] = 1;
            for (int i = 2; i <= max_number; i++) {
                factorial[i] = (factorial[i - 1] * i) % mod;
                inv[i] = mod - inv[mod % i] * (mod / i) % mod;
                inv_factorial[i] = inv_factorial[i - 1] * inv[i] % mod;
            }
        }
        T calc(int n, int k) {
            if (n < k) return 0;
            if (n < 0 || k < 0) return 0;
            return factorial[n] * (inv_factorial[k] * inv_factorial[n - k] % mod) % mod;
        }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll P;
    cin >> P;
    vector<int> A(P);
    for (int i = 0; i < P; ++i) cin >> A[i];
    Combination<ll> comb(P - 1, P);
    vector<ll> pow(P);
    vector<ll> ans(P, 0);
    for (ll i = 0; i < P; ++i) {
        if (A[i]) {
            // 1-(x-i)^(P-1)を展開
            ans[0] = (ans[0] + 1) % P;
            ll pow_num = 1;
            for (ll j = 0; j < P; ++j) {
                // x^jの係数
                ll coeff = comb.calc(P - 1, P - 1 - j);
                ll mul_num = ((coeff * pow_num) % P) * (j % 2 ? 1 : -1);
                ans[P - 1 - j] = (ans[P - 1 - j] + mul_num + P) % P;
                pow_num = (pow_num * i) % P;
            }
        }
    }
    for (int i = 0; i < ans.size(); ++i) cout << ans[i] << ' ';
    cout << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
	int N, K;
	cin >> N >> K;

	int cnt = 0;
	for(int i=1; i<=N; i+=2)
		cnt++;

	if(cnt >= K)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}


Measured memory_bytes: 256
// atcoder/abc079/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  string s;
  while (cin >> s) {
    for (int i = 0; i < (1 << 3); ++i) {
      ostringstream oss;
      oss << s[0];
      int x = s[0] - '0';
      for (int j = 0; j < 3; ++j) {
        if (i & (1 << j)) {
          x += s[j+1] - '0';
          oss << '+' << s[j+1];
        } else {
          x -= s[j+1] - '0';
          oss << '-' << s[j+1];
        }
      }
      if (x == 7) {
        cout << oss.str() << "=7" << endl;
        break;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
	int d,n,ans=0;
	cin>>n>>d;
	int x[n][d];
	for(int i=0;i<n;i++){
		for(int j=0;j<d;j++){
			cin>>x[i][j];
		}
	}
	for(int i=0;i<n-1;i++){
		for(int l=i+1;l<n;l++){
			int s=0;
			for(int j=0;j<d;j++){
				s+=(max(x[i][j],x[l][j])-min(x[i][j],x[l][j]))*(max(x[i][j],x[l][j])-min(x[i][j],x[l][j]));
			}
			int a=sqrt( (double)s );
			if(s==a*a){
				ans++;
			}
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

ll a,b,n;

int main(){

    cin >> a >> b >> n; 
    ll tmp = n;   
    
    if(b > n) tmp = n;
    else tmp = b-1;
    
    cout << floor(a*tmp/b) - a * floor(tmp/b) << endl;
    
    return 0;
}

Measured memory_bytes: 3776
n = int(input())
s = input()

r = s.count('R')
g = s.count('G')
b = s.count('B')

ans = r * g * b

for i in range(n):
    for d in range(1, n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans -= 1

print(ans)

Measured memory_bytes: 9224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    ll n; cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll res=1, odd=1;
    rep(i,n){
        res*=3;
        if(a[i]%2==0) odd*=2;
    }
    cout<<res-odd<<endl;
    return 0;
}

Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,z;
    char ca,cb,cc;
    cin>>a>>b;
    cout<<(long double)a/b<<endl;

    

    return 0;
}


Measured memory_bytes: 3804
/**
*    author:  yuya1234
*    created: 10.07.2020 15:13:49
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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

  int n;
  cin>>n;

  vector<int> v;
  int tmp;
  REP(i,n)
  {
    cin>>tmp;
    if(i%2==0)v.emplace_back(tmp);
    else
    {
      v.insert(v.begin(),tmp);
    }
  }

  if(n%2==0)
  {
    REP(i,n-1)cout<<v[i]<<" ";
    cout<<v[n-1]<<endl;
  }
  else
  {
    FORD(i,n-1,1)cout<<v[i]<<" ";
    cout<<v[0]<<endl;
  }
  

  return 0;
}

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

int main(){

    string S,T;
    cin>>S>>T;
    int X=-1;
    for(int i=0;i<S.size()-T.size()+1;i++){
        bool ans=true;
        for(int j=0;j<T.size();j++){
            if(S.at(i+j)!=T.at(j)&&S.at(i+j)!='?') ans=false;
        }
        if(ans) X=i;
    }
    if(X==-1) cout<<"UNRESTORABLE"<<endl;
    else{
        for(int i=0;i<S.size();i++){
            if(S.at(i)=='?') S.at(i)='a';
        }
        for(int i=X;i<X+T.size();i++){
            S.at(i)=T.at(i-X);
        }
        cout<<S<<endl;
    }
}
    


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define ppb pop_back
#define pii pair<int, int> 
#define pll pair<long , long>
#define all(a) a.begin(), a.end()
#define int long long
#define ll long long
#define mod 998244353
//#define int long long
#define loop(i,a,b) for(int i=a;i<b;i++)
#define bloop(i,a,b) for(int i=a;i>=b;i--)

int max(int a, int b) { return (a > b)? a : b; } 
using namespace std;

// ll funct(int a[], int n, int s)
// {
//     sort(a,a+n);
//     int sum=0,c=0;
//     while(sum<=s){
//         c+=1;
//         sum+=s;
//     }
//     return c;
// }

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   int t=1,ca=1;
   //cin>>t;
   while(ca<=t)
   {
      ca+=1;
      int n,m,flag=0;
      string s;
      cin>>s;
      n=s.length();
      for(int i=0,j=n-1;i<n/2;i++,j--)
      {
          if(s[i]!=s[j]) {flag++;break;}
      }
      for(int i=0,j=(n-1)/2-1;i<(n-1)/4;i++,j--)
      {
          if(s[i]!=s[j]) {flag++;break;}
      }
      for(int i=(n+3)/2-1,j=n-1;i<n/2;i++,j--)
      {
          if(s[i]!=s[j]) {flag++;break;}
      }
      if(flag>0) cout<<"No"<<endl;
      else cout<<"Yes"<<endl;
   }
    return 0;
}

Measured memory_bytes: 256
import itertools

N, M = map(int, input().split())
skss = []
for _ in range(M):
    k, *sks = map(int, input().split())
    skss.append(sks)
pMs = list(map(int, input().split()))

count = 0
for i in range(2 ** N):
    pMstmp = pMs[:]
    for j, b in enumerate(format(i, '0' + str(N) + 'b')):
        if b == '0':
            continue
        for k, sks in enumerate(skss):
            if j + 1 in sks:
                pMstmp[k] ^= 1
    if sum(pMstmp) == 0:
        count += 1

print(count)

Measured memory_bytes: 3064