akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int&
#define I inline
#define W while
#define N 200000
using namespace std;
int n,sx,sy,h,w;char s1[N+5],s2[N+5];
int main()
{
	scanf("%d%d%d%d%d%s%s",&h,&w,&n,&sx,&sy,s1+1,s2+1);
	RI u=0,d=h+1,l=0,r=w+1;for(RI i=n;i&&d-u>1&&r-l>1;--i)
		s2[i]=='U'?d<=h&&++d:(s2[i]=='D'?u^1&&--u:(s2[i]=='L'?r<=w&&++r:l^1&&--l)),
		s1[i]=='U'?++u:(s1[i]=='D'?--d:(s1[i]=='L'?++l:--r));
	return puts(u<sx&&sx<d&&l<sy&&sy<r?"YES":"NO"),0;
}

Measured memory_bytes: 4036
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<long long,long long> pll;

int main() {
    fastIO;
    int n, x, ind;
    cin >> n >> x;
    int dist[n+1], prefix[n+1];
    dist[0] = 0, prefix[0] = 0;
    for(int i = 1; i < n+1; i++){
        cin >> dist[i];
    }
    for(int i = 1; i < n+1; i++){
        prefix[i] = dist[i] + prefix[i-1];
    }
    ind = upper_bound(prefix,prefix+n+1, x)-prefix;
    cout << ind << endl;
    return 0;
}



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

#define endl '\n'

using namespace std;

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	string s;
	cin >> s;
	if(s.size() < 3) {
		cout << "No" << endl;
		return 0;
	}
	string ss = "YAKI";
	for(int i=0; i<4; i++) {
		if(s[i] != ss[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
const ll MOD = 998244353;
 
int main() {
    // cout << fixed << setprecision(17) << endl;
    cout << std::fixed << setprecision(15);
    int64_t n;
    cin >> n;
    int64_t m = n / 2;
    double d = (double)(n - m) / (double)(n);
    cout << d << endl;
}


Measured memory_bytes: 256
# Generated by AtcoderGreedy on 2018-05-26
# ARC098 C
# Your code here

N = gets.chomp.to_i
S = gets.chomp

normal = Object.new
def normal.dir
  'E'
end
def normal.to_s_index(i)
  i
end

reverse = Object.new
def reverse.dir
  'W'
end

def reverse.to_s_index(i)
  N - i - 1
end

[normal, reverse].each do |world|
  def world.acc
    @acc ||=
      begin
        acc = []
        N.times do |i|
          s_i = to_s_index i
          acc << (acc.last || 0) +
                 (S[s_i] == dir ? 0 : 1)
        end
        acc
      end
  end
end

mins = (1...(N - 1)).map do |i|
  normal_acc = normal.acc[i - 1]
  reverse_acc = reverse.acc[N - i - 1]
  normal_acc + reverse_acc
end

mins << normal.acc[N - 1]
mins << reverse.acc[N - 1]

puts mins.min


Measured memory_bytes: 9740
r, c = map(int, input().split())
tabl = [list(map(int, input().split())) for i in range(r)]
for i in range(r):
    print(" ".join(map(str, tabl[i])) + " " + str(sum(tabl[i])))
ss = ""
for i in range(c):
    ans = 0
    for j in range(r):
        ans += tabl[j][i]
    ss += str(ans) + " "
print(ss+str(sum([int(i) for i in ss.split()])))

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

#define ll int64_t
using namespace std;
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
#define fo(i,n) for(int i=0;i<n;i++)
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main(){
    IOS
    ll a,b;
    cin>>a>>b;
    cout<<(a*b)<<endl;
}

Measured memory_bytes: 3616
#include <stdio.h>
  
int max(int a, int b) {
    return (a > b) ? a : b;
}

int main(int argc, char *argv[]) {
    int a, b, c;
    int k;

    scanf("%d%d%d", &a, &b, &c);
    scanf("%d", &k);

    printf("%d\n", a + b + c + (max(max(a, b), c) * ((1 << k) - 1)));

    return 0;
}

Measured memory_bytes: 128
n=int(input())
sum=0
a=[0]*n

b=list(map(int,input().split()))
a[0]=b[0]
a[n-1]=b[n-2]
sum=a[0]+a[n-1]
for i in range(n-2):
    sum=sum+min(b[i],b[i+1])
print(sum)

Measured memory_bytes: 9092
#include <bits/stdc++.h>
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main()
{
  int a, b;
  cin >> a >> b;
  string s;
  cin >> s;

  if (s[a] != '-') {
    cout << "No" << endl;
    return 0;
  }

  s.erase(a, 1);
  re(i, a+b) {
    if (s[i] == '-') {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#define rep(a,b,c) for (int a=b;a<=c;a++)
#define per(a,b,c) for (int a=b;a>=c;a--)
#define go(u) for (int o=ft[u],v;v=E[o].t;o=E[o].n)
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int,int> par;
const int N=400010;
int vis[N],ft[N],n,ans,sa,sb,tot,a[N],b[N],cnt[N];
map <int,int> mp;
map <int,int> :: iterator it;
struct edge{int t,n;}E[N<<2];
void dfs(int u){
	vis[u]=1;
	go(u) if (!vis[v]) dfs(v);
}
void add(int u,int v){
	E[++tot]=(edge){v,ft[u]},ft[u]=tot;
}
int main(){
//	freopen("t.txt","r",stdin);
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",a+i),sa^=a[i],mp[a[i]];
	rep(i,1,n) scanf("%d",b+i),sb^=b[i],mp[b[i]];
	mp[sa],mp[sb];
	int __=0; for (it=mp.begin();it!=mp.end();it++) it->se=++__;
	rep(i,1,n) a[i]=mp[a[i]],b[i]=mp[b[i]];
	sa=mp[sa],sb=mp[sb];
	add(sa,sb),add(sb,sa);
	rep(i,1,n) add(a[i],b[i]),add(b[i],a[i]),ans-=a[i]==b[i];
	ans+=n;
	rep(i,1,n) if (a[i]!=b[i]) --cnt[b[i]];
	if (cnt[sa]) ans--;
	rep(i,1,n) if (a[i]!=b[i]) ++cnt[a[i]];
	++cnt[sa],--cnt[sb];
	rep(i,1,n*2+3) if (cnt[i]) return puts("-1"),0;
	rep(i,1,__) if (!vis[i]){
		go(i) if (v!=i) goto cc;
		continue;
	cc:	++ans;
		dfs(i);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 14592
#include<bits/stdc++.h>
#include<math.h>
#include <stdio.h>
#include<vector>
#include<deque>
#include<stdlib.h>
#include <algorithm>
#include<set>
#include<map>
#include <limits>
#include<iomanip>
#include<string>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
#define d_2 100000
#define d9_7 1000000007
int main(void){
  ll a,b;
  cin>>a>>b;
  ll now=1;
  ll cnt=0;
  while(1){
    if(now<b){
    	now-=1;
      now+=a;
      cnt++;
    }else{
    	break;
    }
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SZ(n) ((int)(n).size())
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int main(){FIN;
  ll a,b,c; cin >> a >> b >> c;
  cout << min(b/a,c) << "\n";
}

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

//39
typedef long long ll;

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; ++i) {
		cin >> v[i];
	}
	vector<int> pref(n);
	vector<int> suff(n);
	pref[0] = v[0];
	suff[n - 1] = v[n - 1];
	for (int i = 1; i < n; ++i) {
		pref[i] = max(v[i],pref[i - 1]);
		suff[n - i - 1] = max(v[n - i - 1],suff[n - i]);
	}
	for (int i = 0; i < n; ++i) {
		if (i == 0) {
			cout << suff[i + 1];
		}else if (i == n - 1) {
			cout << pref[i - 1];
		}else {
			cout << max(pref[i - 1],suff[i + 1]);
		}
		cout << endl;
	}
	//cout << ans;
}


Measured memory_bytes: 5552
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;

#define FUTAGO(x) ((x) ? "Yay!" : ":(")

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (b == d - 1) {
		cout << 0 << endl;
	}
	else {
		cout << 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    string s;
    cin>>s;
    if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3])cout<<"Bad"<<endl;
    else cout<<"Good"<<endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# hello worldと表示する
import sys
import numpy
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b,c,d,e,f=MI()
wasser=[]
g=f//100
for i in range(int(f/a)+1):
    for j in range(int(f/a)+1):
        if a*i+b*j<=f//100:
            wasser.append(100*(a*i+b*j))
water=list(set(wasser))
water.sort()
#print(water)
sugar=[]
for x in water:
    sugar.append((min(f-x,e*x//100)))
#print(sugar)
sugmx=[]
for s in sugar:
    mx=0
    for i in range(s//c+1):
        for j in range(s//c+1):
            if mx<=c*i+d*j<=s:
                mx=c*i+d*j
    sugmx.append(mx)
#print(sugmx)
mix=-inf
for i in range(1,len(water)):
    u=sugmx[i]/water[i]
    #print(u)
    if u>=mix:
        mix=u
        ans1=sugmx[i]
        ans2=water[i]
print(ans2+ans1,ans1)

    

    



        
    

Measured memory_bytes: 12420
use std::vec::Vec;
use std::cmp::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let mut s: Vec<char> = read::<String>().chars().collect();
    s.sort();

    if s[0] == s[1] && s[2] == s[3] && s[0] != s[2] {
      println!("Yes");
    } else {
      println!("No");
    }
}


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

using ll = long long;
using P = pair<int, int>;

const int MAX = 1e5;
const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;
ll a[MAX];

ll solve(bool flag) {
  ll res = 0;
  ll sum = 0;
  for (int i = 0; i < N; i++) {
    sum += a[i];
    if (flag && sum <= 0) {
      res += abs(sum) + 1;
      sum = 1;
    }
    if (!flag && sum >= 0) {
      res += sum + 1;
      sum = -1;
    }
    flag = !flag;
  }

  return res;
}

int main() {
  // 入力
  cin >> N;
  for (int i = 0; i < N; i++) scanf("%lld", a + i);

  // 解答
  cout << min(solve(true), solve(false)) << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<map>
#define int long long
using namespace std;

signed main() {
	int a;
	while (cin >> a, a) {
		vector<vector<int>>b(a);
		int n = 0;
		for (int c = 0; c < a; c++) {
			vector<int>d(3);
			cin >> d[0] >> d[1] >> d[2];
			if (d[1] > n)n = d[1];
			if (d[0] > n)n = d[0];
			b[c] = d;
		}
		n++;
		vector<vector<int>>miti(n, vector<int>(n, 1000000));
		for (int e = 0; e < a; e++) {
			miti[b[e][0]][b[e][1]] = miti[b[e][1]][b[e][0]] = b[e][2];
		}
		for (int f = 0; f < n; f++) {
			for (int g = 0; g < n; g++) {
				for (int h = 0; h < n; h++) {
					if (g == h)miti[g][h] = 0;
					else miti[g][h] = (miti[g][h]<miti[g][f] + miti[f][h]) ? (miti[g][h]) : (miti[g][f] + miti[f][h]);
				}
			}
		}
		map<int, int>l;
		int o = 0;
		for (auto n : miti) {
			int s = 0;
			for (int m : n)s += m;
			l.insert(pair<int, int>(s, o));
			o++;
		}
		auto t = l.begin();
		cout << t->second << " " << t->first << endl;
	}
}

Measured memory_bytes: 3104
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();
            long m = in.nextLong();

            if (n == 1 || m == 1) {
                if (n == 1 && m == 1) {
                    out.print(1);
                    return;
                }
                if (n == 1) {
                    out.print(m - 2);
                    return;
                }
                if (m == 1) {
                    out.print(n - 2);
                    return;
                }
            }
            out.print((n - 2) * (m - 2));
        }

    }
}



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

int main() {
	int n,m;
	cin >> n >> m;
	double arr[n];
	double sum = 0;
	int count=0;
	for(int i=0;i<n;i++){
	    cin >> arr[i];
	    sum = sum + arr[i];
	}
   //cout << sum <<endl;
	sum = sum/(4*m);
	//cout << sum << endl;
	for(int i=0;i<n;i++){
	    if(arr[i]<sum){
	    }
      else{
        count++;
      }
	}
	if(count<m){
	    cout << "No" << endl;
	}
	else{
	    cout << "Yes" <<  endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define fast_io() ios::sync_with_stdio(false); cin.tie(nullptr)
#define fix(n) fixed << setprecision(n)

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;


int main(void){
    fast_io();
    
    string s,t;
    cin >> s >> t;
    rep(i,s.size()){
        if(s[i] != t[i]){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 2992
N = int(input())
inputs = [list(map(int, input().split())) for _ in range(N)]

dicts = {}
for i in range(N):
    dicts[i] = sum(inputs[i])

t = 0
a = 0
count = 0
for key, value in sorted(dicts.items(), key=lambda x: -x[1]):
    if count % 2 == 0:
        t += inputs[key][0]
    else:
        a += inputs[key][1]
    count += 1

print(t - a)


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

int main() {
    int N;
    cin >>N;
    vector<int> A(N, 0);
    for (int i=0; i<N; i++)
        cin >>A.at(i);
    int S=0;
    for (int i=0; i<N; i++) {
        int MINI=i;
        for (int j=i; j<N; j++)
            if (A.at(j)<A.at(MINI))
                MINI=j;
        if (i!=MINI) {
            S++;
            swap(A.at(i), A.at(MINI));
        }
    }
    for (int i=0; i<N-1; i++)
        cout <<A.at(i) <<' ';
    cout <<A.back() <<endl;
    cout <<S <<endl;
    return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod = 998244353;
const int MAXN = 100010, LOG=20;

ll n, m, k, u, v, x, y, t, a, b, ans=1;
ll A[MAXN];
ll cnt[8];
string S;

int f(char ch){
	if (ch=='R') return 0;
	if (ch=='G') return 1;
	return 2;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n>>S;
	cnt[0]=n;
	for (char ch:S){
		int x=f(ch);
		int tmp=0;
		for (int mask=1; mask<8; mask++) if (cnt[mask] && !(mask&(1<<x)) && ((mask|tmp)==mask)) tmp=mask;
		ans=ans*cnt[tmp]%mod;
		cnt[tmp]--;
		cnt[tmp|(1<<x)]++;
	}
	debug(ans)
	cout<<ans<<'\n';
	
	return 0;
}


Measured memory_bytes: 720
package main

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

func main() {
	s := getString()

	for i := len(s) - 1; i > 1; i-- {
		if s[0:i/2] == s[i/2:i] {
			fmt.Println(i)
			return
		}
	}
}

// -----------------------------------------

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int i,c=0;
	for(i=0;i<s.length()-1;i++)
	{
		if(s.at(i)==s.at(i+1))
		{
			c=1;
			break;
		}
	}
	if(c==0)
		cout<<"Good";
	else
		cout<<"Bad";
}

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

int main() {
    /* Input */
    int A, B;
    cin >> A >> B;
   
    /* Output */
    cout << A * B << endl;
    return 0;
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll a,b;
    cin>>a>>b;
    string s;
    cin>>s;
    //ll sum=a+b+1;
    bool f=0;
    ll cnt=0;
    for(int i=0;i<s.size();i++)
    {
        if((s[i]=='-' and i!=a))
        {
            f=1;
        }
        else if(s[i]>='0' and s[i]<='9')
        {
            cnt++;
        }
    }
    if(f || cnt!=(a+b))
    {
        cout<<"No"<<endl;
    }
    else{

        cout<<"Yes"<<endl;
    }
}


Measured memory_bytes: 3596
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val a, b = sc.nextLong()
    if ((a + b) % 2 == 0) {
      println((a + b) / 2)
    } else {
      println("IMPOSSIBLE")
    }
  }
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define SORT_ASC(c) sort((c).begin(), (c).end())
#define SORT_DESC(c) sort((c).begin(), (c).end(), greater<typeof((c).begin())>())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

void Main()
{
	int n;
	cin>>n;
	vector<int> h(n);
	REP(i, n) cin >> h[i];
	
    h[0]--;
    FOR(i,0,n-1){
        if(h[i] > h[i+1]){
            cout << "No" << endl;
            return;
        }
        if(h[i] != h[i+1]){
            h[i+1]--;
        }
    }
    cout << "Yes" << endl;
    
}
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}

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

from collections import Counter

A = []
for _ in range(N):
    A.append(input())

B = Counter(A)
MaxC = max(B.values())
Arg = list(B.values()).count(MaxC)
C = sorted(B.items(),key=lambda x:(x[1],x[0]))[::-1]
for i in range(Arg):
    print(C[Arg-i-1][0])

Measured memory_bytes: 63808
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
 
    int x, n;
    cin>>x>>n;
    vector<bool> mask(105, 1);
    for (int i=0; i<n; i++){
        int curr;
        cin>>curr;
        mask[curr]=0;
    }
    int val = 200;
    int ans = -1;
    for (int i=105; i>=0; i--){
        if (mask[i]==1){
            if (abs(i-x)<=val){
                val = abs(i-x);
                ans = i;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3612
import sys
sys.setrecursionlimit(10**6)
edges, vertices = map(int, input().split())
dp = [None for _ in range(edges)]

nodes = [[] for _ in range(edges)]

for i in range(vertices):
    start, end = map(int, input().split())
    nodes[end -1].append(start-1)

for i in range(edges):
    if not len(nodes[i]):
        dp[i] = 0
def find(arr):
    if not len(arr):
        return 0
    for x in arr:
        if dp[x] is None:
            dp[x] = find(nodes[x])
    return 1 + max(dp[x] for x in arr)

for i in range(edges):
    dp[i] = find(nodes[i])

print(max(dp))


Measured memory_bytes: 103576
#include<stdio.h>
#define N 1000

int main(void){
  int i,num,j;
  int n[N][8];
  int deci;
  int swp,max,min;
  int button;
  char hoge;

  for(i=0;i<N;i++)
    for(j=0;j<8;j++)
      n[i][j]=0;
  scanf("%d%c",&num,&hoge);
  for(i=0;i<num;i++){
    for(j=0;j<8;j++){
      scanf("%c",&n[i][j]);
      n[i][j]-='0';
    }
    scanf("%c",&hoge);
  }
  for(i=0;i<num;i++){
    while(1){
      button=0;
      for(j=0;j<7;j++){
        if(n[i][j]>n[i][j+1]){
          button=1;
          swp=n[i][j];
          n[i][j]=n[i][j+1];
          n[i][j+1]=swp;
        }
      }
      if(button==0) break;
    }
    min=0;
    for(j=7,deci=1;j>=0;j--,deci*=10){
      min+=n[i][j]*deci;
    }
    max=0;
    for(j=0,deci=1;j<=7;j++,deci*=10){
      max+=n[i][j]*deci;
    }
    printf("%d\n",max-min);
  }
  return 0;
}

Measured memory_bytes: 0
import bisect

N=int(input())
A=[]
for _ in range(3):
    lst=list(map(int,input().split()))
    lst.sort()
    A.append(lst)
cnt=0
for i in range(N):
    numl=bisect.bisect_left(A[0],A[1][i])
    numr=(N-bisect.bisect_right(A[2],A[1][i]))
    cnt+=numl*numr
print(cnt)

Measured memory_bytes: 22720
"use strict";
main(
  require("fs")
    .readFileSync("/dev/stdin", "UTF-8")
    .trim()
    .split("\n")
);

function main(input) {
  input = Number(input[0]);
  const height = input / 3;
  const width = input / 3;
  const line = input - height - width;

  console.log(height * width * line);
}


Measured memory_bytes: 7372
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        System.out.println(problem089a(n));
    }

    private static int problem089a(int n) {
        return n / 3;
    }
}

Measured memory_bytes: 21204
#include <stdio.h>
#include <math.h>
int main(){
    int a;
    int b;
    int c;
    double s = 0;
    int S = 0;
    scanf("%d %d %d", &a, &b, &c);
    s = (a + b + c) / 2.0;
    S = (int) pow((s * (s-a) * (s-b) * (s-c)) , 0.5);

    printf("%d\n", S);
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array);


int main(){

	IOS
	ll x;
	cin>>x;
	ll tmp=100;
	ll cnt=0;
	while(true){
		if(tmp>=x) {
			cout<<cnt<<endl;
			return 0;
		}
		tmp=tmp+(tmp)*(0.01);
		cnt++;
	}
}

Measured memory_bytes: 3636
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
int par[400002];
int rk[400002];
int sz[400002];
int sze[400002];
void init(int n){
	for(int i=0; i<n; i++){
		par[i]=i; rk[i]=0; sz[i]=1; sze[i]=0;
	}
}
int find(int x){
	if(par[x]==x){
		return x;
	}else{
		return par[x]=find(par[x]);
	}
}
 
void unite(int x, int y){
	x=find(x);
	y=find(y);
	if(x==y){
      return;
    }
	if(rk[x]<rk[y]){
		par[x]=y;
		sz[y]+=sz[x];
		sze[y]+=sze[x];
	}else{
		par[y]=x;
		sz[x]+=sz[y];
		sze[x]+=sze[y];
		if(rk[x]==rk[y]) rk[x]++;
	}
}
bool same(int x, int y){
	return find(x)==find(y);
}
int main()
{
	int n, h, w;
    cin>>n>>h>>w;
	int r[100010], c[100010];
	ll a[100010];
	vector<P> v;
    for(int i=0; i<n; i++){
		cin>>r[i]>>c[i]>>a[i];
		r[i]--; c[i]--;
		v.push_back({a[i], i});
	}
	sort(v.begin(), v.end(), greater<P>());
	init(h+w);
	ll ans=0;
	for(int i=0; i<n; i++){
		ll a1=v[i].first;
		int k=v[i].second;
		unite(r[k], c[k]+h);
		if(sze[find(r[k])]<=sz[find(r[k])]-1){
			sze[find(r[k])]++;
			ans+=a1;
		}
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 8816
#include <bits/stdc++.h>
using namespace std;
int main () {
    int N;
    cin >> N;
    int list[N];
    for(int i = 0; i < N; i++) cin >> list[i];

    map<int, int> res;
    for(int i = 0; i < N; i++) {
        res[list[i]]++;
    }
    cout << res.size() << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int inf=1<<30;
int maps[2][510][510];
bool visited[2][510][510];
int cnt[2][250010];
int r,w[2],h[2],sx[2],sy[2];
const int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
void calc(){
	for(int k=0;k<2;k++){
		int room=0,level=0;
		priority_queue<tuple<int,int,int>> pq;
		for(int i=0;i<=h[k];i++)	visited[k][i][0]=visited[k][i][w[k]+1]=true;
		for(int i=0;i<=w[k];i++)	visited[k][0][i]=visited[k][h[k]+1][i]=true;
		pq.push(make_tuple(-1,sx[k],sy[k]));
		while(!pq.empty()&&room<h[k]*w[k]){
			auto now=pq.top();	pq.pop();
			int l=-get<0>(now),x=get<1>(now),y=get<2>(now);
			if(visited[k][y][x])	continue;
			visited[k][y][x]=true;
			if(level<l)	level=l;
			room++;	cnt[k][room]=level;
			for(int i=0;i<4;i++){
				int ny=y+dy[i],nx=x+dx[i];
				if(visited[k][ny][nx])	continue;
				pq.push(make_tuple(-maps[k][ny][nx],nx,ny));
			}
		}
	}
}
int main(){
	while(true){
		cin>>r;
		if(r==0)	return 0;
		memset(maps,0,sizeof(maps));
		for(int k=0;k<2;k++){
			for(int i=1;i<100010;i++) cnt[k][i]=inf;
			cnt[k][0]=0;
			for(int i=0;i<510;i++){
				for(int j=0;j<510;j++)	visited[k][i][j]=false;
			}
		}
		for(int k=0;k<2;k++){
			cin>>w[k]>>h[k]>>sx[k]>>sy[k];
			for(int i=1;i<=h[k];i++){//区画の外側を壁で覆う
				for(int j=1;j<=w[k];j++)	cin>>maps[k][i][j];
			}
		}
		calc();
		for(int k=0;k<2;k++){
			int tmp=inf;
			for(int i=w[k]*h[k];i>=0;i--){
				tmp=min(tmp,cnt[k][i]);
				cnt[k][i]=tmp;
			}
		}
		int ans=inf;
		for(int i=0;i<=r;i++){
			if(i>h[0]*w[0]||r-i>h[1]*w[1])	continue;
			ans=min(ans,cnt[0][i]+cnt[1][r-i]);
		}
		cout<<ans<<endl;
	}
}

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

using namespace std;
long long n,w[110],v[110],W,dp[110][100100];
long long Rec(long long i,long long weight){
if(weight < 0)
    return -2e9;
if(i==n)
    return 0;
if(dp[i][weight]!=-1)
    return dp[i][weight];
long long Res=-2e9,Res1=-2e9;
Res=Rec(i+1,weight);
Res1=Rec(i+1,weight-w[i])+v[i];

return dp[i][weight]=max(Res,Res1);


}
int main()
{
    cin>>n>>W;
    for(long long i=0; i<n; i++)
        cin>>w[i]>>v[i];
    memset(dp,-1,sizeof(dp));
    cout<<Rec(0,W);

    return 0;
}


Measured memory_bytes: 86272
#include<stdio.h>
#include<iostream>
#include<stack>
#include<algorithm>
#define MAX 1400
using namespace std;
struct Rectangle { int height; int pos; };
int getLargestRectangle(int size, int buffer[]) {
stack<Rectangle> S;
int maxv = 0;
buffer[size] = 0;
for ( int i = 0; i <= size; i++ ) {
          Rectangle rect;
          rect.height = buffer[i];
          rect.pos = i;
          if ( S.empty() ) {
          S.push(rect);
          } else {
          if ( S.top().height < rect.height ) {
          S.push(rect);
          } else if ( S.top().height > rect.height ) {
          int target = i;
          while ( !S.empty() && S.top().height >= rect.height ) {
          Rectangle pre = S.top(); S.pop();
          int area = pre.height * (i - pre.pos);
          maxv = max(maxv, area);
          target = pre.pos;
          }
          rect.pos = target;
          S.push(rect);
          }
          }
          }
          return maxv;
          }
          int H, W;
          int buffer[MAX][MAX];
          int T[MAX][MAX];
          int getLargestRectangle() {
          for ( int j = 0; j < W; j++ ) {
                    for ( int i = 0; i < H; i++ ) {
                              if ( buffer[i][j] ) {
                              T[i][j] = 0;
                              } else {
                              T[i][j] = (i > 0) ? T[i - 1][j] + 1 : 1;
                              }
                              }
                              }
                              int maxv = 0;
                              for ( int i = 0; i < H; i++ ) {
                                        maxv = max(maxv, getLargestRectangle(W, T[i]));
                                        }

                                        return maxv;
                                        }
                                        int main() {
                                        scanf("%d %d", &H, &W);
                                        for ( int i = 0; i < H; i++ ) {
                                                  for ( int j = 0; j < W; j++ ) {
                                                            scanf("%d", &buffer[i][j]);
                                                            }
                                                            }
                                                            cout << getLargestRectangle() << endl;
                                                            return 0;  }


Measured memory_bytes: 18464
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
#define int long long

signed main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> a(n);
    vector<int> b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    vector<int> sa(n + 1, 0);
    vector<int> sb(m + 1, 0);
    rep(i, n) sa[i + 1] = sa[i] + a[i];
    rep(i, m) sb[i + 1] = sb[i] + b[i];
    int ans = 0;
    rep(i, n + 1) {
        int a_read = sa[i];
        if (a_read > k)
            break;
        if (k - a_read <= sb[0]) {
            chmax(ans, i);
            break;
        }
        auto itr = upper_bound(sb.begin(), sb.end(), k - a_read);
        chmax(ans, i + distance(sb.begin(), itr) - 1);
    }
    cout << ans << endl;
    return 0;
}

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

int main(void) {
	string S;
	cin >> S;
	map<char, int> mp{};
	for (int i = 0; i < S.length(); i++) {
		char key = S[i];
		mp[key]++;
	}
	if (mp.size() != 2) {
		cout << "No" << endl;
		exit(0);
	}
	for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
		char key = itr->first;
		int value = itr->second;
		// cout << key << ":" << value << endl;
		if (value != 2) {
			cout << "No" << endl;
			exit(0);
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<math.h>
#include<set>
#include<iomanip>
#include<stdio.h>
#include<deque>
#include<stack>
#include<map>
#include<queue>
#include<cstring>
#define M 1000000007
#define pb push_back
#define mp make_pair
#define int long long
using namespace std;
int prime_factors(int n)
{
	int o=1;
	for(int x=2;x*x<=n;x++)
	{
		if(n%x==0)
			o++;
		while(n%x==0)
			n/=x;
	}
	if(n>1)
		o++;
	return o;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b;cin>>a>>b;
	int g=__gcd(a,b);
	cout<<prime_factors(g)<<endl;
}

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

int main() {
    string s, t;
    cin >> s >> t;
    t.pop_back();
    if (s == t) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3572
#include <stdio.h>
int main(void)
{
	int n,l[201],i,j,tmp,ans=0;
	scanf("%d",&n);
	for(i=0; i<n*2; i++){
		scanf("%d",&l[i]);
	}
	for(i=0; i<n*2; i++){
		for(j=i+1; j<n*2; j++){
			if(l[i]>l[j]){
				tmp=l[i];
				l[i]=l[j];
				l[j]=tmp;
			}
		}
	}
	for(i=0; i<n*2; i+=2){
		ans+=l[i];
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/python
# -*- coding: utf-8 -*-

# 入力はstringで入る．
# intにしたければ int(input())
# floatで受け取ると 1.0 になる．

# 入力 : S
S = input()

if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <map>
using namespace std;

int main(){
	int n,m,k;
	cin >> n >> m >> k;
	
	vector<int> dark(m);
	map<int, int> rdark;
	for(int i=0; i<m; i++){
		cin >> dark[i];
		rdark[dark[i]] = i;
	}	
	vector<vector<int> > v(n+1, vector<int>(k));
	for(int i=1; i<=n; i++){
		for(int j=0; j<k; j++){
			cin >> v[i][j];
		}
	}
	
	vector<vector<int> > adj(1<<m);
	for(int i=1; i<(1<<m); i++){
		for(int j=0; j<k; j++){
			int next=0;
			for(int s=0; s<m; s++){
				if((i&(1<<s)) != 0 && rdark.count(v[dark[s]][j])!=0){
					next |= 1<<rdark[ v[dark[s]][j] ];
				}
			}
			adj[i].push_back(next);
		}
	}
	
	queue<pair<int, int> > search;
	search.push(make_pair(0, (1<<m)-1));
	vector<bool> used(1<<m, false);
	used[(1<<m)-1] = true;
	while(!search.empty()){
		int step = search.front().first;
		int node = search.front().second;
		search.pop();
		if(node==0){
			cout << step << endl;
			break;
		}
		for(int i=0; i<(int)adj[node].size(); i++){
			if(!used[adj[node][i]]){
				search.push(make_pair(step+1, adj[node][i]));
				used[adj[node][i]] = true;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 38552
#include<bits/stdc++.h>
using namespace std;
long long dp[3030],nw,ans,md[202020];
string s;
int main()
{
	cin>>s;
	md[s.size()-1]=1;
	for(int i=s.size()-2;i>=0;i--)
	{
		md[i]=md[i+1]*10%2019;
		md[i]%=2019;
	}
	dp[0]=1;
	for(int i=s.size()-1;i>=0;i--)
	{
		nw=(nw+(s[i]-'0')*md[i])%2019;
//		cout<<nw<<endl;
		ans+=dp[nw];
		dp[nw]++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5344
#define DBG 0 //submit 0
#define ll long long
#if DBG
    #include <algorithm>
    #include <array>
    #include <ctime>
    #include <cstdlib>
    #include <string>
    #include <vector>
    #include <unordered_map>
    #include <iostream>
    #include <cmath>
    #include <numeric>
#else
    #include <bits/stdc++.h>
#endif

using namespace std;


int main(){
    int i,N;
    char s[100006];
    bool flag = false;

    cin >> N;

    vector<ll>h(N);

    for(i=0;i<N;i++){
        cin >> h[i];
    }

    if(N==1){
        cout << "Yes" << endl;
    }else{
        for(i=N-1;i>0;i--){
            if(h[i-1] > h[i]){
                h[i-1]--;
                if(h[i-1] > h[i]){
                    flag = true;
                    break;
                }
            }
        }
        
        if(flag){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }
    
}


Measured memory_bytes: 1024
#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#include<bits/stdc++.h>
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define INF 1e10
#define ull unsigned long long int
using namespace std;

/* TYPE DEFINITIONS */
typedef     long long int   ll;
typedef     vector<ll>      vi;
typedef     pair<ll,ll>     pi;


/* Prime Checker!!! */
bool isPrime(ull n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ull i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 

/* MACROS */
#define  all(A)         (A).begin() , (A).end()
#define  rall(A)        (A).rbegin() , (A).rend()
#define  sz(A)          (int)(A).size()
#define  pb             push_back
#define  ppb            pop_back
#define  mp             make_pair
#define  ln(X)          (int)(X).length()
#define  square(X)      ((X)*(X))
#define  cube(X)        ((X)*(X)*(X))
#define  forn(i, n)  for (int i = 0; i < int(n); i++)
#define  forr(i, n)  for (int i = int(n - 1); i >= 0; i--)
#define  fora(i, a, b)  for (int i = int(a); i <= int(b); i++)
#define  forb(i, a, b)  for (int i = int(a); i >= int(b); i--)
#define  fore(it, a)    for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)  
void solve()
{    
    string s;
    int a;
    cin>>a>>s;
    if(a<3200)cout<<"red";
    else cout<<s;
}   


int main()
{
    FastIO;
    
    ll t=1;
    //cin>>t;
    //double start_time = clock();
    while(t--)
    {
        solve();
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main () {
    int a, b;

    cin >> a;
    cin >> b;

    if (a < b) {
        cout << "a < b" << endl;
    } else if (a > b) {
        cout  << "a > b" << endl;
    } else {
        cout << "a == b" << endl;
    }
}


Measured memory_bytes: 3092
N = int(input())
a = [int(i) for i in input().split()]
count = 0

def half(num, count):
    count += 1
    if num % 2 == 0:
        count = half(num//2, count)
    return count

for num in a:
    if num % 2 == 0:
        count += half(num//2, 0)

print(count)

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

public class Prime
{
    BitArray Sieve;
    // Sieve of Eratosthenes
    public void Init(int max)
    {
        Sieve = new BitArray(max + 1);
        var end = (int)(Math.Sqrt(max) + 0.1);
        Sieve.Set(1, true);
        for (int i = 2; i <= end; i++)
        {
            if (!Sieve.Get(i))
            {
                for (int j = i * 2; j <= max; j += i)
                {
                    Sieve.Set(j, true);
                }
            }
        }
    }

    public bool IsPrime(int n)
    {
        return !Sieve.Get(n);
    }

    public int[] GetPrimes(int n)
    {
        return Enumerable.Range(2, n - 1).Where(i => !Sieve.Get(i)).ToArray();
    }
}

public static class PrimeFactorize
{
    static List<long> Factorize(long n, IEnumerable<int> primes)
    {
        var factor = new List<long>();
        foreach (var p in primes)
        {
            while (n % p == 0)
            {
                factor.Add(p);
                n /= p;
            }
        }
        if (n > 1)
        {
            factor.Add(n);
        }
        return factor;
    }

    static Dictionary<long, int> FactorToDict(IEnumerable<long> factor)
    {
        var dict = new Dictionary<long, int>();

        foreach (var f in factor)
        {
            if (!dict.ContainsKey(f))
            {
                dict[f] = 0;
            }
            dict[f]++;
        }

        return dict;
    }

    // 要素を各個数で表す
    public static Dictionary<long, int> Factorize(long n)
    {
        var prime = new Prime();
        var max = (int)(Math.Sqrt(n) + 1);
        prime.Init(max);
        var primes = prime.GetPrimes(max);
        return FactorToDict(Factorize(n, primes));
    }
}

public static class Common
{
    // ユークリッドの互除法により最大公約数を得る
    public static long GCD(long m, long n)
    {
        if (m < n)
        {
            return GCD(n, m);
        }

        while (n != 0)
        {
            var t = n;
            n = m % n;
            m = t;
        }
        return m;
    }

    public static long LCM(long m, long n)
    {
        return m * n / (GCD(m, n));
    }
}

public class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var A = vals[0];
        var B = vals[1];

        var gcd = Common.GCD(A, B);
        var factors = PrimeFactorize.Factorize(gcd);

        Console.WriteLine(factors.Count + 1);
    }
}

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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll N, K, s=0;
  cin>>N>>K;
  vector<ll> a(N);
  rep(i,0,N){
    cin>>a[i];
    s+=a[i];
  }

  // 約数一覧
  set<ll> divisors;
  for (ll i=1; i*i<=s; i++) {
    if (s%i == 0) {
      divisors.insert(i);
      divisors.insert(s/i);
    }
  }

  ll ans = -1;
  for (auto d: divisors) {
    vector<ll> x(N);
    vector<ll> psum1(N+2, 0); // psum1[i]: i番目までのあまりの総和
    vector<ll> psum2(N+2, 0); // psum2[i]: i番目以降のあまりの総和
    rep(i,0,N){
      x[i] = a[i] % d;
    }
    sort(begin(x),end(x));

    rep(i,1,N+1){
      psum1[i] = psum1[i-1] + x[i-1];
    }
    for (int i=N; i>=1; i--){
      psum2[i] = psum2[i+1] + x[i-1];
    }
    rep(i,0,N+1){
      // [0 i]  を -1
      // [i+1 N+1]を1
      // if (d==7) {
      //   printf("psum1[%d]=%d\n", i,   psum1[i]);
      //   printf("psum2[%d]=%d\n", i+1, psum2[i+1]);
      //   printf("d*(%d) - psum2[%d]=%d\n", N-i, i+1, d*(N-i+1) - psum2[i+1]);
      //   cout<<endl;
      // }
      if (max(psum1[i], d*(N-i) - psum2[i+1]) <= K) {
        ans=max(ans,d);
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

int S(int x)
{
    int ans = 0;
    while (x)
    {
        ans += x % 10;
        x /= 10;
    }
    return ans;
}

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int ans = 1e9;
    for (int i = 1; i < n; i++)
    {
        ans = min(ans, S(i) + S(n - i));
    }
    cout << ans << '\n';
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(intl i=0;i<(intl)(n);i++)
#define Rep1(i,n) for(intl i=1;i<(intl)(n)+1;i++)
#define vec vector
#define fi first
#define se second
#define pub push_back
#define pob pop_back
#define SortA(v) sort(v.begin(), v.end())
#define SortD(v) sort(v.rbegin(), v.rend())
#define All(a) (a).begin(),(a).end()
using intl = int64_t;
using vi = vec<intl>;
using vvi = vec<vi>;
using pi = pair<intl,intl>;
using vpi = vec<pi>;
vec<intl> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<intl> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr intl INF = 9223372036854775807;


int main(){
  intl A,B,M;
  cin >>A>>B>>M;
  vi a(A),b(B);
  vi x(M),y(M),c(M);
  intl amin = INF, bmin = INF;
  Rep(i,A){
    cin >> a[i];
    amin = min(amin ,a[i]);
  }
  Rep(i,B){
    cin >>b[i];
    bmin = min(bmin , b[i]);
  }
  Rep(i,M){
    cin >> x[i]>>y[i]>>c[i];
  }
  
  intl mincost = INF;
  
  mincost = min(mincost, amin +bmin);
  
  Rep(i,M){
    mincost = min(mincost, a[x[i]-1]+b[y[i]-1]-c[i]);
  }
  
  cout <<mincost;
}

Measured memory_bytes: 4224