akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


int main(void)
{
    int h,w;
    cin >> h >> w;
    h;
    w;
    vector<vector<char>> a(h+2,vector<char>(w+2,'#'));

    FOR(i,1,h+1){
        FOR(j,1,w+1){
            cin >> a[i][j];
        }
    }

    vector<pair<int,int>> bww;
    
    FOR(i,1,h+1){
        FOR(j,1,w+1){
            if(a[i][j] == '#' && 
            (a[i][j+1] == '.' || a[i][j-1] == '.' || 
            a[i+1][j] == '.' || a[i-1][j] == '.')){
                bww.push_back(pair<int,int>(i,j));
            }
        }
    }

    int cnt = 0;
    while(bww.size() != 0){
        vector<pair<int,int>> nbww;
        vector<pair<int,int>> wtb;
        REP(i,bww.size()){
            int cy = bww[i].first;
            int cx = bww[i].second;
            if(a[cy][cx+1] == '.'){
                a[cy][cx+1] = '#';
                wtb.push_back(pair<int,int>(cy,cx+1));
            }
            if(a[cy][cx-1] == '.'){
                a[cy][cx-1] = '#';
                wtb.push_back(pair<int,int>(cy,cx-1));
            }
            if(a[cy+1][cx] == '.'){
                a[cy+1][cx] = '#';
                wtb.push_back(pair<int,int>(cy+1,cx));

            }
            if(a[cy-1][cx] == '.'){
               a[cy-1][cx] = '#';
               wtb.push_back(pair<int,int>(cy-1,cx));
            }                        
        }
        REP(i,wtb.size()){
            int cy = wtb[i].first;
            int cx = wtb[i].second;
            if(a[cy+1][cx] == '.' || a[cy-1][cx] == '.'
            ||a[cy][cx+1] == '.' || a[cy][cx-1] == '.'){
                nbww.push_back(pair<int,int>(cy,cx));
            }
        }
        bww = nbww;
        cnt ++;
    }

    cout << cnt << endl;

    return 0;
}

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

unsigned long long calc_func(const std::vector<unsigned long long>& a, unsigned long long x)
{
  unsigned long long result = 0;
  for (const auto& ai : a) {
    result += x ^ ai;
  }
  return result;
}

int main()
{
  int n;
  unsigned long long k;
  std::cin >> n >> k;
  std::vector<unsigned long long> a(n);
  for (int i = 0; i < n; i++) {
    std::cin >> a.at(i);
  }
  int nshift = 0;
  unsigned long long tmp = k;
  while (1 < tmp) {
    tmp = tmp >> 1;
    nshift++;
  }
  unsigned long long memo = 0;
  for (unsigned long long bit = 1LL << nshift; 1 <= bit; bit = bit >> 1) {
    if (k < (memo | bit)) {
      continue;
    }
    if (calc_func(a, memo) < calc_func(a, memo | bit)) {
      memo = memo | bit;
    }
  }
  std::cout << calc_func(a, memo) << '\n';
  return 0;
}


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

const ll mod=1e9+7;
ll mu(ll a,ll b){
  return (ll)a*b%mod;
}
ll ad(ll a,ll b){
  if((a+=b)>=mod)a-=mod;
  return a;
}
ll pw(ll a,ll b,ll c=1LL){
  for(;b;b>>=1,a=mu(a,a))if(b&1)c=mu(c,a);
  return c;
}
ll dv(ll a,ll b){
  return mu(a,pw(b,mod-2));
}

void comb(ll *c, ll n){
  c[0] = 1;
  rep1(i,n){
    c[i] = mu(c[i - 1], mu(n + 1 - i, dv(1,i)));
  }

}

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

  int n,m;
  cin >> n >> m;
  int a[n],b[m];
  multiset<int> as,bs;
  rep(i,n){
    cin >> a[i];
    as.insert(a[i]);
  }
  sort(a,a+n);
  rep(j,m){
    cin >> b[j];
    bs.insert(b[j]);
  }
  sort(b,b+m);
  int ans=1;
  for(int i=n*m; i>0; i--){
    int ac=as.count(i);
    int bc=bs.count(i);
    if(ac>1 || bc>1) ans=0;
    if(ac==1 && bc==1) continue;
    else if(ac==0 && bc==1){
      int t=a+n - lower_bound(a,a+n,i);
      ans = mu(ans, t);
    }
    else if(ac==1 && bc==0){
      int t=b+m - lower_bound(b,b+m,i);
      ans = mu(ans,t);
    }
    else{
      int t=mu(b+m - lower_bound(b,b+m,i) , (a+n - lower_bound(a,a+n,i)));
      //      cout << t << endl;
      t = ad(t,-n*m+i);
      //cout << t << endl;
      ans = mu(ans,t);
    }
    //    cout << ans << endl;
  }
  cout << ans << endl;

  return 0;
    

}


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

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end(), greater<ll>());

    priority_queue<ll> pq;
    ll ans = 0;
    pq.push(a[0]);
    for(int i = 1; i < n; i++)
    {
        ll t = pq.top();
        pq.pop();
        ans += t;
        //cout << t << " " << a[i] << endl;
        rep(j,2) pq.push(a[i]);
        
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 6928
#include <iostream>

using namespace std;

int main()
{
    int a , b , c;
    int max = 0;
    int x = 0;
    cin >> a >> b >> c;
    max = a;
    x = max * 10 + b + c;
    if (max <= b){
        max = b;
        x = max * 10 + a + c;
    }
    if (max <= c){
        max = c;
        x = max * 10 + b + a;
    }
    cout << x;
    return 0;
}


Measured memory_bytes: 3644
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {

		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();

		while (in.hasNext()) {
			int x = in.nextInt();
			if (x != 0) stack.addLast(x);
			else out.println(stack.pollLast());
			out.flush();
		}
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Measured memory_bytes: 26272
import java.util.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a * n < b) {
            System.out.println(a * n);
        } else {
            System.out.println(b);
        }
	}
}


Measured memory_bytes: 23636
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string S;
    cin >> S;
    vll A(S.size()+1);
    A[0] = 0;
    ll now = 0;
    bool now_left_counts = true;
    int left_num = 0;
    int right_num = 0;
    ll ans = 0;
    rep(i, S.size()) {
        if (now_left_counts == true) {
            if (S[i] == '<') {
                left_num++;
            }
            else {
                right_num++;
                now_left_counts = false;
            }
        }
        else {
            if (S[i] == '>') {
                right_num++;
            }
            else {
                ll x = max(left_num, right_num);
                ll y = max(0, min(left_num, right_num) - 1);
                ans += x*(x + 1) / 2;
                ans += y*(y + 1) / 2;
                right_num = 0;
                left_num = 1;
                now_left_counts = true;
                
            }
        }
    }
    ll x = max(left_num, right_num);
    ll y = min(left_num, right_num) - 1;
    ans += x*(x + 1) / 2;
    ans += y*(y + 1) / 2;

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

Measured memory_bytes: 4764
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))

//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g,i;}E;
typedef struct graph{
	int vcnt,ecnt;
	E  e[200010];//適宜変える(ecnt)
	int id[100010];//適宜変える(vcnt)
}G;
G g;

int esort(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}
void readgraph(){
	//適宜変える
	ll n;
	scanf("%lld",&n);
	rep(i,0,n-1){
		ll x,y;
		scanf("%lld%lld",&x,&y);
		x--,y--;
		g.e[2*i].s=x;
		g.e[2*i].g=y;
		g.e[2*i].i=i;
		g.e[2*i+1].s=y;
		g.e[2*i+1].g=x;
		g.e[2*i+1].i=i;
	}
	g.vcnt=n;
	g.ecnt=2*n-2;
	qsort(g.e,g.ecnt,sizeof(E),esort);

	int p=0;
	rep(i,0,g.vcnt){
		while(p<g.ecnt&&g.e[p].s<i)p++;
		g.id[i]=p;
	}
	g.id[g.vcnt]=g.ecnt;//番兵
}

int ans[100010];
int dfs(int v,int pre,int c){
	int cnt=0;
	rep(i,g.id[v],g.id[v+1]){
		if(g.e[i].g!=pre){
			ans[g.e[i].i]=(c<=cnt)+cnt++;
			dfs(g.e[i].g,v,ans[g.e[i].i]);
		}
	}
}

int main(){
	readgraph();
	dfs(0,-1,1000000);
	int cnt=0;
	rep(i,0,g.ecnt/2)cnt=max(cnt,ans[i]);
	printf("%d\n",cnt+1);
	rep(i,0,g.ecnt/2)printf("%d\n",ans[i]+1);
}

Measured memory_bytes: 10704
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

int main()
{
	int c[3][3];
	for (auto i = 0; i < 3; ++i)
	{
		for (auto j = 0; j < 3; ++j)
		{
			cin >> c[i][j];
		}
	}

	auto result = "Yes";
	for (auto i = 0; i < 2; ++i)
	{
		int diff[3];
		for (auto j = 0; j < 3; ++j)
		{
			diff[j] = c[i + 1][j] - c[i][j];
		}

		if (diff[0] != diff[1]
			|| diff[1] != diff[2])
		{
			result = "No";
			break;
		}
	}

	cout << result << endl;

	return 0;
}


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

int main(){
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    set<int> Water;
    for(int i=0;i<=31;++i)
        for(int j=0;j<=31;++j){
            if((i*a+j*b)*100<f)
                Water.insert(i*a+j*b);
        }
    set<int>Suger;
    for(int i=0;i<=1000;++i)
        for(int j =0;j<=1000;++j){
            if(i*c+j*d<f)
            Suger.insert(i*c+j*d);
    }
    double rat =0;
    int fuck1=a*100,fuck2=0;
    for(set<int>::iterator beg1 = Water.begin();beg1 !=Water.end();++beg1)
    for(set<int>::iterator beg2 = Suger.begin();beg2 !=Suger.end();++beg2){
        if((*beg1)*100 + *beg2<=f&&(*beg1)*e >=*beg2)
            if(*beg2/(*beg2 +(*beg1)*100.0)>rat){
                rat = *beg2/(*beg2 +(*beg1)*100.0);
                fuck1 = 100*(*beg1)+*beg2;
                fuck2 = *beg2;
            if(rat == e/(100.0+e))
                break;
            }
    }
    cout<<fuck1<<" "<<fuck2<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1000000007;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL N;
	cin >> N;
	LL ans = 0;
	for (LL p = 2; p * p <= N; p++) {
		if (N % p != 0)continue;
		LL t = 0;
		while (N % p == 0) {
			N /= p;
			t++;
		}
		LL s = 0, e = t+1;
		while (e - s > 1) {
			LL m = (e + s) / 2;
			if (m * (m + 1) / 2 <= t)s = m;
			else e = m;
		}
		ans += s;
	}
	if (N != 1)ans++;
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3664
//shara's here
//私は大きな男の子
//SPEEEEEEEEEED IS KEEEEEEEEEEY
#include <bits/stdc++.h>
using namespace std;
//fold
typedef double w;
typedef string s;
typedef long long ll;
typedef long double ld;
const ll INF = 1e18 + 10;
const ll MINF = -(1e18 + 10);
#if defined(BANYANYA)
#include "/home/xsharawi/Desktop/cpp/debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define pb push_back
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
//endfold
int main(){
	ll t;
	cin>>t;
	ll ar[t],cnt=0;
	for(ll i=0;i<t;i++)cin>>ar[i];
	set<ll>ss;
	for(ll i=0;i<t;i++)ss.insert(ar[i]);
	if(ss.size()==t)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/


Measured memory_bytes: 11136
N = int(input())
listT = [0]
listX = [0]
listY = [0]

for i in range(N):
    A,B,C = map(int,input().split())
    listT.append(A)
    listX.append(B)
    listY.append(C)

'''
for j in range(N+1):
    print(listT[j])
    print(listX[j])
    print(listY[j])
'''

flag = 'Yes'

for j in range(1,N+1):
    m = listT[j]-listT[j-1] -listX[j]-listY[j] +listX[j-1]+listY[j-1]
#    print('m',m)

    if m%2==0 and m>=0:

        continue
    else:
        flag = 'No'

print(flag)




Measured memory_bytes: 11764
/*  ex5_3
    potter0723sw  */

#include <stdio.h>
#include <stdlib.h>

int main(void){
    int height, width, i, j, rowblack[100]={0}, colblack[100]={0};
    char cell[100][100];
    scanf("%d %d", &height, &width);

    for(i=0; i < height; i++){//マスの入力を受け取る
        for(j=0; j < width; j++){
            scanf(" %c", &cell[i][j]);
        }
    }

    for(i=0; i < height; i++){//黒マスのある行や列を記憶
        for(j=0; j < width; j++){
            if(cell[i][j] == '#'){
                rowblack[i] = 1;
                colblack[j] = 1;
            }
        }
    }

    for(i=0; i < height; i++){//同じ行にも列にも黒マスのあるマスのみ出力
        if(rowblack[i]==1){
            for(j=0; j < width; j++){
                if(colblack[j] == 1){
                    printf("%c", cell[i][j]);
                }
            }
        }
    printf("\n");
    }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) cin >> a[i];
  vl k(1e6 + 1, 0), cnt(1e6 + 1, 0);
  ll ans = 0;
  sort(all(a));
  rep(i, n) cnt[a[i]]++;
  rep(i, n) {
    if(k[a[i]] == 0 && cnt[a[i]] == 1) ans++;
    if(k[a[i]] == 0)
      for(ll j = a[i]; j <= 1e6; j += a[i]) k[j]++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 20268
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {

    	Scanner sc = new Scanner(System.in);
    	// プレイヤー人数の取得、手札の数、色の種類の数、色の種類の設定
    	int playersNum = sc.nextInt();
    	int cardNum = 9;
    	int colorNum = 3;
    	int[] numType = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    	char[] colorType = {'R', 'B', 'G'};
    	int pair = 3;

    	// 人数分の勝利条件を満たしているか判定
    	// 勝利条件：judg > 3
    	for(int i = 0; i < playersNum; i++) {
    		int judg = 0;
    		// プレイヤーiの手札の数字を配列に追加
    		int[] number = new int[cardNum];
    		for(int j = 0; j < cardNum; j++) {
    			number[j] = sc.nextInt();
    		}
    		// プレイヤーiの手札の色を配列に追加
    		char[] color = new char[cardNum];
    		for(int j = 0; j < cardNum; j++) {
    			color[j] = sc.next().charAt(0);
    		}

    		// 勝利条件を満たしているか判定
    		for(int j = 0; j < colorNum; j++) {
    			// 同一色の数字をリストに入れる
    			ArrayList<Integer> sameColor = new ArrayList<Integer>();
    			for(int k = 0; k < cardNum; k++) {
    				if(colorType[j] == color[k]) {
    					sameColor.add(number[k]);
    				}
    			}

    			// 同一色内で同じ数字をカウント
    			for(int k = 0; k < numType.length; k++) {
    				int count = 0;
    				for(int l = 0; l < sameColor.size(); l++) {
    					if(numType[k] == sameColor.get(l)) {
    						count++;
    						if(count == pair) {
    							judg++;
    							for(int m = 0; m < pair; m++) {
    								sameColor.remove(sameColor.indexOf(numType[k]));
    							}
    							break;
    						}
    					}
    				}
    			}

    			// 同一色内で連番数字をカウント
    			Collections.sort(sameColor);
    			while(sameColor.size() != 0) {
    				int a = sameColor.get(0);
    				int count = 0;
    				int count0 = 0;
    				for(int l = 0; l < sameColor.size(); l++) {
    					if(a == sameColor.get(l)) {
    						count++;
    						a++;
    					}
    					if(count == pair) {
    						count0++;
    						judg++;
    						for(int m = 0; m < pair; m++) {
    							a--;
								sameColor.remove(sameColor.indexOf(a));
							}
    						break;
    					}
    				}
    				if(count0 == 0) break;
    			}

    		}

    		// 勝利条件を満たしていれば1を出力、elseは0を出力
    		if(judg >= 3) {
    			System.out.println(1);
    		}else {
    			System.out.println(0);
    		}
    	}
    }
}


Measured memory_bytes: 28592
x = input()
if int(x) < 100:
    print(0)
    exit(0)
if 0 <= int(x[-2]+x[-1]) <= 5:
    print(1)
    exit(0)
elif 6 <= int(x[-2]+x[-1]) <= 10 and 2 <= int(x)//100:
    print(1)
elif 11 <= int(x[-2]+x[-1]) <= 15 and 3 <= int(x)//100:
    print(1)
elif 16 <= int(x[-2]+x[-1]) <= 20 and 4 <= int(x)//100:
    print(1)
elif 21 <= int(x[-2]+x[-1]) <= 25 and 5 <= int(x)//100:
    print(1)
elif 26 <= int(x[-2]+x[-1]) <= 30 and 6 <= int(x)//100:
    print(1)
elif 31 <= int(x[-2]+x[-1]) <= 35 and 7 <= int(x)//100:
    print(1)
elif 36 <= int(x[-2]+x[-1]) <= 40 and 8 <= int(x)//100:
    print(1)
elif 41 <= int(x[-2]+x[-1]) <= 45 and 9 <= int(x)//100:
    print(1)
elif 46 <= int(x[-2]+x[-1]) <= 50 and 10 <= int(x)//100:
    print(1)
elif 51 <= int(x[-2]+x[-1]) <= 55 and 11 <= int(x)//100:
    print(1)
elif 56 <= int(x[-2]+x[-1]) <= 60 and 12 <= int(x)//100:
    print(1)
elif 61 <= int(x[-2]+x[-1]) <= 65 and 13 <= int(x)//100:
    print(1)
elif 66 <= int(x[-2]+x[-1]) <= 70 and 14 <= int(x)//100:
    print(1)
elif 71 <= int(x[-2]+x[-1]) <= 75 and 15 <= int(x)//100:
    print(1)
elif 76 <= int(x[-2]+x[-1]) <= 80 and 16 <= int(x)//100:
    print(1)
elif 81 <= int(x[-2]+x[-1]) <= 85 and 17 <= int(x)//100:
    print(1)
elif 86 <= int(x[-2]+x[-1]) <= 90 and 18 <= int(x)//100:
    print(1)
elif 91 <= int(x[-2]+x[-1]) <= 95 and 19 <= int(x)//100:
    print(1)
elif 96 <= int(x[-2]+x[-1]) <= 99 and 20 <= int(x)//100:
    print(1)
else:
    print(0)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define jam(t) cout<<"Case #"<<t<<": "
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}



void solve(){
    ll s,w;
    cin >> s >> w;
    if(w>=s){
        g("unsafe");
    }
    else{
        g("safe");
    }
}
int main()
{
#ifndef ONLINE_JUDGE
input_from_file
#endif
 
    FASTIO
    cin.tie(NULL);
    fflush(stdout);
    ll t = 1;
    //cin >> t;
    for(ll tcase = 1;tcase <= t;tcase++){
        solve();
        
    }
return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
const ll INF=1e18+7;
const ll MOD=1e9+7;


int main(){
		ios::sync_with_stdio(false);
		cin.tie(0);
		ll a,b;
		cin>>a>>b;
		cout<<a*b - a - b + 1<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
	unsigned int a, b;
	cin >> a;
	cin >> b;

	int x = -1;
	if (a <= b && b <= 100) {
		for (int i = 1; i <= 1008; i++) {
			double y = (i * 0.08);
			double z = (i* 0.10);
			if (a == (int)floor(y) && b == (int)floor(z)) {
				x = i;
				break;
			}
		}
	}
	//int x = 100 * a / 108;
	//int y = 100 * b / 110;

	cout << x << endl;
}


Measured memory_bytes: 256
/*
Author : Hocky Yudhiono
Min 26 Jan 2020 07:02:39  WIB

1. You can sort the query if offline!
2. Don't bring the dp remaining state when dfsing on DP on Tree.
3. Try to reverse (Think from the back) if you stuck.
4. Be careful when submitting Div. 2 D-F, dont waste it on stupid WAs.
5. Try to reduce a problem
*/

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <cstdio>
#include <limits>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
//If the time limit is strict, try not to use long double

#define popf pop_front
#define pf push_front
#define popb pop_back
#define mp make_pair
#define pb push_back
#define remove erase
#define fi first
#define se second

//Remember to undefine if the problem is interactive
#define endl '\n'
#define DEBUG(X) cout << ">>> DEBUG(" << __LINE__ << ") " << #X << " = " << (X) << endl

const double eps = 1e-9;
const int INFMEM = 63;
const int INF = 1061109567;
const LL LINF = 4557430888798830399LL;
const double DINF = numeric_limits<double>::infinity();
const LL MOD = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1};
const int dy[8] = {0,1,0,-1,1,-1,1,-1};
const double PI = 3.141592653589793;

inline void open(string a){
    freopen((a+".in").c_str(),"r",stdin);
    freopen((a+".out").c_str(),"w",stdout);
}

inline void fasterios(){
    //Do not use if interactive
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}

LL n,m; 

int main(){
    cin >> n >> m;
    LL sum = 0;
    for(int i = 1;i <= m;i++){
        LL tmp; cin >> tmp;
        sum += tmp;
    }
    if(sum >= n) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 384
def isp(s):
    if s==s[::-1]:
        return(True)
    else:
        return(False)
s=input()
n=len(s)

if isp(s) and isp(s[:(n-1)//2]) and isp(s[(n+1)//2]):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include<stdio.h>

int main(){
	int a[10],i,j,temp;
	for(i=0;i<10;i++) scanf("%d",&a[i]);
	for(i=9;i>=0;i--){
		for(j=0;j<=i;j++){
			if(a[j] <a[j+1]){
				temp = a[j];
				a[j] = a[j+1];
				a[j+1] = temp;
			}
		}
	}
	for(i=0;i<3;i++) printf("%d\n",a[i]);
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

int main(){
    int x,y;
    while(true){
        cin >> x >> y;
        if(x==0 && y==0) break;
        cout << min(x,y) << " " << max(x,y) << endl;
    }
    
    return 0;
}


Measured memory_bytes: 2968
s = input()
output = 'Yes'
for i in range(len(s)):
    if i % 2 == 0 and s[i] == 'L':
        output = 'No'
        break
    elif i % 2 != 0 and s[i] == 'R':
        output = 'No'
        break

print(output)


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

long long gcd(long long a, long long b) {

   	if(a < b) {
       swap(a, b);
   	}

	long long r = a % b;
	while(r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

    int N;
    cin >> N;

    ll mod = pow(10, 9) + 7;

    map<ll, map<ll, ll> > x;
    map<ll, map<ll, bool> > c;

    vector<pair<ll, ll> > ab(N);

    ll a = 0;
    ll b = 0;
    ll k = 0;

    for(int i = 0; i < N; i++) {
        ll A, B;
        cin >> A >> B;

        if(A == 0 && B == 0) {
            k++;
        } else if(A == 0) {
            a++;
        } else if(B == 0) {
            b++;
        } else {
            if(A < 0) {
                A = -A;
                B = -B;
            }

            ll y = gcd(A, B);
            A /= y;
            B /= y;

            x[A][B]++;
        }

        ab[i] = make_pair(A, B);
    }

    ll ans = modpow(2, a, mod) + modpow(2, b, mod) - 1LL;
    ans %= mod;

    for(int i = 0; i < N; i++) {
        ll A = ab[i].first;
        ll B = ab[i].second;

        if(A == 0 || B == 0) continue;

        if(c[A][B]) continue;
        c[A][B] = true;
        c[-B][A] = true;
        c[B][-A] = true;

        ll f = modpow(2, x[A][B], mod);
        f %= mod;
        ll b = modpow(2, x[-B][A], mod) % mod + modpow(2, x[B][-A], mod) % mod - 1LL;
        b %= mod;

        ans *= (f + b - 1LL) % mod;
        ans %= mod;
    }

    ans += k;
    ans %= mod;
    ans--;

    if(ans < 0) ans += mod;

    cout << ans << endl;
}

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

string ir,str;

string convert(string s,char alp){
  string res="";
  int n=s.size();
  if(alp=='J'){
    if(n==1) return s;
    res+=s.back();
    res+=s.substr(0,n-1);
  }else if(alp=='C'){
    if(n==1) return s;
    res+=s.substr(1,n-1);
    res+=s[0];
  }else if(alp=='E'){
    if(n==1) return s;
    else if(n%2){
      res+=s.substr(n/2+1,n/2);
      res+=s[n/2];
      res+=s.substr(0,n/2);
    }else{
      res+=s.substr(n/2,n/2);
      res+=s.substr(0,n/2);
    }
  }else if(alp=='A'){
    res=s;
    reverse(res.begin(),res.end());
  }else if(alp=='M'){
    res=s;
    for(int i=0;i<n;i++){
      if(res[i]>='0'&&res[i]<='9'){
        if(res[i]=='9') res[i]='0';
        else res[i]++;
      }
    }
  }else{
    res=s;
    for(int i=0;i<n;i++){
      if(res[i]>='0'&&res[i]<='9'){
        if(res[i]=='0') res[i]='9';
        else res[i]--;
      }
    }
  }
  return res;
}

void solve(){
  cin>>ir;
  cin>>str;

  for(int i=ir.size()-1;i>=0;i--){
    str=convert(str,ir[i]);
  }
  cout<<str<<endl;
}

int main(){
  int T;
  cin>>T;
  for(int i=0;i<T;i++) solve();

  return 0;
}



Measured memory_bytes: 3216
#include<stdio.h>

int main()
{
	int m,f,r;
	while(scanf("%d %d %d",&m,&f,&r)!=EOF)
	{
		if(m==-1&&f==-1&&r==-1)break;
		else
		{
			if(m==-1||f==-1)printf("F\n");
			else if(m+f>=80)printf("A\n");
			else if(m+f>=65&&m+f<80)printf("B\n");
			else if(m+f>=50&&m+f<65)printf("C\n");
			else if(m+f>=30&&m+f<50)
			{
				if(r>=50)printf("C\n");
				else printf("D\n");
			}
			else printf("F\n");
		}
	}
	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  
  if (a * b % 2 == 0) {
      cout <<"Even"<< endl;
    }
    else {
      cout <<"Odd"<< endl;
    }
  }

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

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

    vector<vector<int>> a(n, vector<int>(3)), dp(n, vector<int>(3, 0));
    for (int i = 0; i < n; i++)
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    
    dp[0][0] = a[0][0];
    dp[0][1] = a[0][1];
    dp[0][2] = a[0][2];

    for (int i = 1; i < n; i++){
        dp[i][0] = a[i][0] + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = a[i][1] + max(dp[i - 1][0], dp[i - 1][2]);
        dp[i][2] = a[i][2] + max(dp[i - 1][1], dp[i - 1][0]);
    }

    cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]}) << '\n';

    return 0;
}


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

int main() {
	int x,a,b;
	cin>>x>>a>>b;
	if(b - a <= 0)
	    cout<<"delicious\n";
	else if(b-a <= x)
	    cout<<"safe\n";
	else
	    cout<<"dangerous\n";
	return 0;
}


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

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;

int cntDigit(int i){
	int ret = 0;
	while(i > 0){
		ret++;
		i /= 10;
	}
	return ret;
}

signed main(){
	int n; cin >> n;
	string s; cin >> s;
	map<char, int> cnt;
	int v = 0;
	for(int i = 0; i < n; i++){
		if(isalpha(s[i])){
			if(cnt.find(s[i]) == cnt.end())cnt[s[i]] = 0;
			cnt[s[i]] ++;
		}
		if(isdigit(s[i])){
			int j = 0;
			while(i+j < n && isdigit(s[i+j]))j++;
			v += stoi(s.substr(i,j).c_str());
		}

	}
//	cerr << cnt.size() << endl;
	map<int, int> num;
	for(auto e : cnt){
		if(num.find(e.second) == num.end())num[e.second] = 0;
		num[e.second]++;
	}
//	cerr << num.size() << endl;
	int ans = 0;
	ans += (cnt.size() + (v != 0)) -1;
	ans += cntDigit(v);
	ans += cnt.size();
	for(auto e : num){
		if(e.first == 1)continue;
		if(e.second > 1)ans += cntDigit(e.first) + 3;
		else ans += cntDigit(e.first) + 1;
	}
	cout << ans << endl;
	



	return 0;
}




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


namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            char c1 = sc.chararr[0];
            char c2 = sc.chararr[1];
            char c3 = sc.chararr[2];

            wr.wri($"{c1}{c2}{c3}");
        }


    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define F first
#define S second
#define int long long
#define mod 1000000007
#define mmod 998244353
#define all(v) v.begin(), v.end()
#define INF LLONG_MAX/3
using namespace std;
int mypow(int a, int b, int c) {
	if (b == 0)return 1;
	if (b % 2)return mypow(a, b - 1, c)*a%c;
	int z = mypow(a, b / 2, c);
	return z * z%c;
}
int a, cnt = 0;
string ans;
int k(int z) {
	int x = 0;
	while (z) {
		x++;
		z /= 10;
	}
	return x;
}
void mutu(int x, int y) {
	if (y == 0) {
		cnt++;
		if (a == cnt)ans = (char)(x + '0');
		return;
	}
	for (int i = max((int)0, x - 1); i <= min(x + 1, (int)9); i++) {
		mutu(i, y - 1);
		if (a == cnt) {
			ans = (char)(x + '0') + ans;
			return;
		}
	}
}
signed main() {
	cin >> a;
	for (int j = 0; j <= 10; j++) {
		for (int i = 1; i <= 9; i++) {
			mutu(i, j);
			if (a == cnt) {
				cout << ans << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	long long int a,m,n,f=0;
  cin>>a>>m>>n;
  for(int i=m;i<=n;i++)
  {
    if(i%a==0)
    {
      f=1;
      i=n+1;
    }
  }
  if(f==0)
    cout<<"NG"<<endl;
  else
    cout<<"OK"<<endl;
}

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

int main(){
    string S;
    cin>>S;
    vector<string> t={"dream","dreamer","erase","eraser"};
    reverse(S.begin(),S.end());
    rep(i,0,4) reverse(t[i].begin(),t[i].end());
    int c=0;
    bool flag=false;
    while(c!=S.size()){
        flag=false;
        rep(i,0,4){
                if(S.substr(c,t[i].size())==t[i]) {
                    c+=t[i].size();
                    flag=true;
                    break;
                }
        }
        if(!flag){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 512
package main

import (
	"fmt"
	"regexp"
)

// https://atcoder.jp/contests/abc049/tasks/arc065_a
// 白昼夢

func main() {
	var s string
	fmt.Scan(&s)

	divide := `^(dream|dreamer|erase|eraser)*$`

	if regexp.MustCompile(divide).Match([]byte(s)) {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}


Measured memory_bytes: 2904
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[][] a = new int[m][n];
		int[] b = new int [m];
		int [] calc = new int[n];
		for(int i = 0;i < n;i++ ) {
			for(int j = 0;j < m;j++) {
				int c = sc.nextInt();
				a[j][i] = c;
			}
		}
		for(int i = 0;i < m;i++) {
			int c = sc.nextInt();
			b[i] = c;
		}
		for(int i = 0;i < n;i++) {
			for(int j = 0;j < m;j++) {
				calc[i] = calc[i] + (a[j][i] * b[j]);
			}
			System.out.println(calc[i]);
		}
	}
}





Measured memory_bytes: 39860
#include "bits/stdc++.h"
using namespace std;

const int MOD = 1000000007;
const int abmax = 2020;

long long Inv(long long a) {
        long long res = 1;
        long long n = MOD - 2;
        while (n > 0) {
                if (n & 1) res = res * a % MOD;
                a = a * a % MOD;
                n >>= 1;
        }
        return res;
}

const int N = 8080;
long long fact[N];
long long invfact[N];
void init() {
        fact[0] = 1;
        for (int i = 1; i < N; i ++) fact[i] = (fact[i - 1] * i) % MOD;
        invfact[N - 1] = Inv(fact[N - 1]);
        for (int i = N - 2; i >= 0; i --) invfact[i] = (invfact[i + 1] * (i + 1)) % MOD;
}
long long C(long long n, long long r) {
        if (n < 0 || r < 0 || n < r) return 0;
        return fact[n] * invfact[n - r] % MOD * invfact[r] % MOD;
}

long long dp[4040][4040];
long long num[4040][4040];

int main() {
        init();
        int n;
        scanf("%d", &n);
        vector<int> a(n), b(n);
        for (int i = 0; i < n; i ++) scanf("%d%d", &a[i], &b[i]);
        for (int i = 0; i < n; i ++) { 
                dp[abmax - a[i]][abmax - b[i]] ++;
                num[abmax + a[i]][abmax + b[i]] ++;
        }
        long long ans = 0;
        for (int i = 0; i < abmax * 2 - 1; i ++) {
                for (int j = 0; j < abmax * 2 - 1; j ++) {
                        if (num[i][j] > 0) (ans += num[i][j] * dp[i][j]) %= MOD;
                        (dp[i + 1][j] += dp[i][j]) %= MOD;
                        (dp[i][j + 1] += dp[i][j]) %= MOD;
                }
        }
        for (int i = 0; i < n; i ++) ans = (((ans -  C(2 * (a[i] + b[i]), 2 * a[i])) % MOD) + MOD) % MOD;
        printf("%lld\n", (ans * Inv(2)) % MOD);
        return 0;
}



Measured memory_bytes: 193536
#include<bits/stdc++.h>
using namespace std;
#define  ll long long
ll a[200000];
ll d[200000];

int main()
{
    ll n;
    ll sum=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    for(int i=0;i<n-1;i++)
    {
        d[i]=a[i+1]-a[i];
    }
    d[n-1]=a[0]-a[n-1];
    if(sum%(n*(n+1)/2)==0)
    {
        ll k=sum/(n*(n+1)/2);
        for(int i=0;i<n;i++)
        {
            if((k-(d[i]))%n||k-d[i]<0)
            {
                cout<<"NO"<<endl;
                return 0;
            }
        }
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 1792
import sys
rline = sys.stdin.readline


def solve():
    K = int(input())
    lst = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    print(lst[K - 1])


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3060
#include<stdio.h>
#define MAX 100001
#define max2(a,b) a<b?b:a
#define max3(a,b,c) max2((max2(a,b)),c)
#define max4(a,b,c,d) max3((max2(a,b)),c,d)

int main(){
	int i,j;
	int n,m;
	char s[101];
	n = 0;
	scanf("%s",s);
	for(i=0;s[i]!='\0';i++){
		if(n==0&&s[i]=='C')n++;
		if(n==1&&s[i]=='F')n++;
	}
	if(n==2)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 128
input_num = int(input())
input_color = input()
r_num = 0
b_num = 0
for color in input_color:
    if color == "R":
        r_num += 1
    if color == "B":
        b_num += 1
if r_num > b_num:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
from collections import deque
from copy import deepcopy
n=int(input())
a=sorted([int(input()) for _ in range(n)])
c=deepcopy(a)

a=deque(a)
b=deque([a.popleft()])

i=0
while a:
    if (i//2)%2==0:
        if i%2==0:
            deque.append(b,a.pop())
        else:
            deque.appendleft(b,a.pop())
    else:
        if i%2==0:
            deque.append(b,a.popleft())
        else:
            deque.appendleft(b,a.popleft())
    
    i+=1
ans=0
for i in range(1,n):
    ans+=abs(b[i]-b[i-1])

c=deque(c)
b=deque([c.pop()])

i=0
while c:
    if (i//2)%2==0:
        if i%2==0:
            deque.append(b,c.popleft())
        else:
            deque.appendleft(b,c.popleft())
    else:
        if i%2==0:
            deque.append(b,c.pop())
        else:
            deque.appendleft(b,c.pop())
    
    i+=1
cnt=0
for i in range(1,n):
    cnt+=abs(b[i]-b[i-1])
ans=max(ans,cnt)

print(ans)

Measured memory_bytes: 87540
use std::collections::HashMap;

fn main() {
  let nkl: Vec<usize> = read_vec();
  let (n, k, l) = (nkl[0], nkl[1], nkl[2]);
  let pqs: Vec<(usize, usize)> = read_tuples(k);
  let rss: Vec<(usize, usize)> = read_tuples(l);

  let mut groad: Vec<Vec<usize>> = vec![vec![]; n+1];
  for (p, q) in pqs {
    groad[p].push(q);
    groad[q].push(p);
  }
  
  let mut gtrain: Vec<Vec<usize>> = vec![vec![]; n+1];
  for (r, s) in rss {
    gtrain[r].push(s);
    gtrain[s].push(r);
  }
  
  let mut ufroad = vec![0; n+1];
  let mut p = 1;
  for i in 1 .. n+1 {
    if ufroad[i] != 0 {continue;}
    dfs(i, p, &groad, &mut ufroad);
    p += 1;
  }
  
  let mut uftrain = vec![0; n+1];
  let mut p = 1;
  for i in 1 .. n+1 {
    if uftrain[i] != 0 {continue;}
    dfs(i, p, &gtrain, &mut uftrain);
    p += 1;
  }
  
  let mut map = HashMap::new();
  for pq in ufroad.iter().zip(uftrain.iter()) {
    let counter = map.entry(pq).or_insert(0);
    *counter += 1;
  }
  
  let mut ans: Vec<usize> = vec![];
  for i in 1 .. n+1 {
    ans.push(*map.get(&(&ufroad[i],&uftrain[i])).unwrap());
  }
  
  print_vec(&ans, " ");
}

fn dfs(s: usize, p: usize, g: &Vec<Vec<usize>>, mut uf: &mut Vec<usize>) {
  if uf[s] != 0 {return}
  uf[s] = p;
  for next in g[s].clone() {dfs(next, p, &g, &mut uf)}
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  buf.trim().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
}

fn read_tuple<T1: std::str::FromStr, T2: std::str::FromStr>() -> (T1, T2) {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  let mut it = buf.trim().split_whitespace();
  let x = it.next().unwrap().parse::<T1>().ok().unwrap();
  let y = it.next().unwrap().parse::<T2>().ok().unwrap();
  (x, y)
}

fn read_tuples<T1: std::str::FromStr, T2: std::str::FromStr>(n: usize) -> Vec<(T1, T2)> {
  let mut vec: Vec<(T1, T2)> = vec![];
  for _ in 0 .. n {
    vec.push(read_tuple());
  }
  vec
}

fn print_vec<T: std::string::ToString>(vec: &[T], sep: &str) {
  let out = vec.iter().map(|e| e.to_string()).collect::<Vec<_>>().as_slice().join(sep);
  println!("{}", out);
}

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

using namespace std;
long long v[100], viz[100];
long long combinari (int n, int k)
{
    memset (viz, 0, sizeof(viz));
    long long r = 1;
    long long unde = 2;
    if (k>n)
        return 0;
    if (k>n/2)
        k = n-k;
    for (long long i = n; i>=n-k+1; --i)
    {
        for (long long j = 2; j<=k; ++j)
        {
            if (viz[j] == 0 && r%j == 0)
            {
                viz[j] = 1;
                r/=j;
            }
        }
        r*=i;
    }
    for (long long j = 2; j<=k; ++j)
        {
            if (viz[j] == 0 && r%j == 0)
            {
                viz[j] = 1;
                r/=j;
            }
        }
    return r;
}
int main()
{
    long long n, a, b, suma=0;
    double medie;
    //cout << combinari(5, 2) << " " << combinari(3, 2) << " " << combinari(100, 100) << " " << combinari(101, 102);
    cin >> n >> a >> b;
    for (int i = 0; i<n; ++i)
        cin >> v[i];
    sort (v, v+n);
    int j = n-1;
    for (int i = 1; i<=a; ++i)
    {
        suma+=v[j];
        --j;
    }
    medie = 1.0*suma/a;
    cout << fixed << setprecision(6) << medie;
    cout << '\n';
    if (v[n-a] == v[n-1])
    {
        int cate = a;
        int j = n-a;
        --j;
        while (j>=0 && v[j]==v[j+1])
        {
            ++cate;
            --j;
        }
        long long raspuns = 0;
        for (int i = a; i<=b; ++i)
            raspuns += combinari (cate, i);
        cout << raspuns << '\n';
        return 0;
    }
    j = n-a;
    int trebuieee;
    int cate = 1;
    int copie = j+1;
    while (copie < n && v[j] == v[copie])
    {
        ++copie;
        ++cate;
    }
    trebuieee = cate;
    copie = j-1;
    while (copie>=0 && v[j] == v[copie])
    {
        --copie;
        ++cate;
    }
    cout << combinari(cate, trebuieee);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[300001],s[2],sum[300001];
int n,l,r,mid;
bool pd(int x)
{
	int k=0;
	for (int i=2;i<=n;i+=2)
	{
		if (sum[i-1]-k>=x)k=min(k,sum[i]);
	}
	return sum[n]-k>=x;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)scanf("%d",&a[i]),s[i&1]+=a[i];
	if (n%2==0)
	{
		printf("%d %d\n",max(s[0],s[1]),min(s[0],s[1]));
		return 0;
	}
	for (int i=1;i<=n;i++)sum[i]=sum[i-1]+a[i]*(i&1?1:-1);
	l=0,r=s[0]+s[1];
	while (r>l)
	{
		mid=(l+r+1)>>1;
		if (pd(mid))l=mid;else r=mid-1;
	}
	printf("%d %d\n",s[0]+l,s[1]-l);
} 

Measured memory_bytes: 6172
import math


def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    n = int(input().rstrip())
    max_count = 0
    ans = 1
    for i in range(1, n+1):
        num = i
        count = 0
        while(num % 2 == 0):
            count += 1
            num = int(num / 2)
        if count > max_count:
            max_count = count
            ans = i
        # print(i, count)
    print(ans)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9028
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<ll>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    int n;
    cin >> n;
    vi x1(n), y1(n), x2(n), y2(n);
    rep(i, n) {
        cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
    }

    vvi xs(2);

    auto compress = [&](vi& x1, vi& x2, int i) {
        rep(i_, x1.size()) {
            xs[i].push_back(x1[i_]);
            xs[i].push_back(x2[i_]);
        }
        sort(all(xs[i]));
        xs[i].erase(unique(all(xs[i])), xs[i].end());
        rep(i_, x1.size()) {
            x1[i_] = lower_bound(all(xs[i]), x1[i_])-xs[i].begin();
            x2[i_] = lower_bound(all(xs[i]), x2[i_])-xs[i].begin();
        }
    };

    compress(x1, x2, 0);
    compress(y1, y2, 1);

    int h, w;
    h = xs[1].size();
    w = xs[0].size();

    vvi bb(h, vi(w));

    rep(i, n) {
        for(int j=y1[i]; j<y2[i]; ++j) {
            bb[j][x1[i]] += 1;
            bb[j][x2[i]] += -1;
        }
    }

    ll ans = 0;
    rep(i, h) {
        rep(j, w) {
            if(j) bb[i][j] += bb[i][j-1];
            if(bb[i][j]) {
                ans += (xs[1][i+1]-xs[1][i]) * (xs[0][j+1]-xs[0][j]);
            }
        }
    }

    cout << ans << endl;
}


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

int main(){
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    int ans = 0;
    
    if (W >= x + r){
        ans = ans + 1;
    }
    if (H >= y + r){
        ans = ans + 1;
    }
    if (0 <= x - r) {
        ans = ans + 1;
    }
    if (0 <= y - r){
        ans = ans + 1;
    }


    if (ans == 4){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


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

int main(){
    int a, b, c; cin >> a >> b >> c;
    int o1, o2, o3; // 大きい順に格納
    o1 = max(a, max(b, c));
    o3 = min(a, min(b, c));
    if((o1==a && o3==b) || (o3==a && o1==b)) o2 = c;
    if((o1==b && o3==c) || (o3==b && o1==c)) o2 = a;
    if((o1==a && o3==c) || (o3==a && o1==c)) o2 = b;

    int ans = 0;
    ans = o1-o2; o2 += ans; o3 += ans;  // 二番目に大きい数を一番目に大きい数に合わせる。
    if(o1%2 != o3%2){
        ans++; o1++; o2++;  // o1とo3の偶奇が異なったらo1とo2に1を足す
    }
    ans += (o1 - o3) / 2;  // o3をo1に合わせに行く

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

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

ans = 0
for i in range(1, N+1, 2):
  d = make_divisors(i)
  if len(d) == 8:
    ans += 1
print(ans)

Measured memory_bytes: 3064