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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

std::string dir = "LRUD";
int dx[4] = {-1, 1, 0, 0}, dy[4] = {0, 0, -1, 1};

int H, W, N;
int sr, sc;
std::string S, T;

bool can(){
    for(int i=0;i<2;++i){
        int u = i ^ 1;

        for(int j=2;j<4;++j){
            int v = j ^ 1;
            int r = sr, c = sc;

            for(int k=0;k<N;++k){
                if(S[k] == dir[i]){
                    c += dx[i];

                    if(c <= 0 || c > W){
                        return true;
                    }
                }else if(S[k] == dir[j]){
                    r += dy[j];

                    if(r <= 0 || r > H){
                        return true;
                    }
                }

                if(T[k] == dir[u] && 1 <= c + dx[u] && c + dx[u] <= W){
                    c += dx[u];
                }

                if(T[k] == dir[v] && 1 <= r + dy[v] && r + dy[v] <= H){
                    r += dy[v];
                }
            }
        }
    }

    return false;
}

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

    std::cin >> H >> W >> N;
    std::cin >> sr >> sc;
    std::cin >> S >> T;

    if(can()){
        std::cout << "NO" << std::endl;
    }else{
        std::cout << "YES" << std::endl;
    }
}


Measured memory_bytes: 920
#include <iostream>
#include <math.h>
//#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>

using namespace std;
#define n_max 100000

#define rep(i,n) for(int i = 0; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

ll ans = 0;

int dp(ll max, ll num, int d, int cnt) {


    if(num <= max && cnt == 7) { ans++; }
        
    if(num > max) return 0;

    dp(max, num + 3*pow(10,d), d+1, cnt | 0x1);

    dp(max, num + 5*pow(10,d), d+1, cnt | 0x2);

    dp(max, num + 7*pow(10,d), d+1, cnt | 0x4);

    return 0;
}

int main() {

    ll n; cin >> n;
    
    dp(n, 0, 0, 0);

    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        if(a < b && b < c)System.out.println("Yes");
        else System.out.println("No");
    }
}


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

using namespace std;

int main() {
    int N; cin >> N;
    vector<int> num(100000, 0);
    for (int i = 0; i < N; i++) {
        int A; cin >> A; A--;
        num[A]++;
    }

    int cnt = 0; // 2 枚残る箇所
    for (int i = 0; i < 100000; i++) {
        if (num[i] > 2) { // 3 枚以上のところは減らす
            if (num[i]%2) num[i] = 1;
            else {num[i] = 2; cnt++;}
        } else if (num[i] == 2) cnt++;
    }

    if (cnt%2) cnt++; // 偶数枚しか減らせない
    int ans = 0;
    for (int i = 0; i < 100000; i++) {
        ans += num[i];
    }
    ans -= cnt; // 2 枚のところを減らす

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

Measured memory_bytes: 640
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<stdlib.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> pii;

int main()
{
  int e;

  while(1){
    cin>>e;
    if(e==0)break;
    int ans=INF;
    int x,y,z;
    for(z=0;z*z*z<=e;z++)
      for(y=0;z*z*z+y*y<=e;y++){
        x=e-z*z*z-y*y;
	ans=min(ans,x+y+z);
      }
    cout<<ans<<endl;
  }

}

Measured memory_bytes: 3084
n, m = gets.strip.split.map(&:to_i)
map = {}
m.times do
    a, b = gets.strip.split.map(&:to_i)
    map[a] = {} unless map.key?(a)
    map[b] = {} unless map.key?(b)
    if map[a].key?(b)
        map[a][b] += 1
    else
        map[a][b] = 1
    end
    if map[b].key?(a)
        map[b][a] += 1
    else
        map[b][a] = 1
    end
end

n.times do |i|
    puts map.key?(i + 1) ? map[i + 1].values.inject(:+) : 0
end

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

void minCost(ll ar[] , ll n){
    ll dp[n+1][n+1]={0};
    ll sum[n+1][n+1];
    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++){
            if(i==j){
                sum[i][j] = ar[i];
            }
            else{
                sum[i][j] = sum[i][j-1] + ar[j];
            }
        }
    }
    /*
    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++){
            cout<<sum[i][j]<<" ";
        }
        cout<<endl;
    }
    cout<<endl;
    */
    for(ll len=2;len<=n;len++){
        for(ll i=0;i<=n-len;i++){
            ll j=i+len-1;
            dp[i][j] = -1;
            for(ll k=i;k<=j-1;k++){
                if(dp[i][j]==-1){
                    dp[i][j] = dp[i][k] + dp[k+1][j] + sum[i][j];
                }
                else
                dp[i][j]=min(dp[i][j], dp[i][k] + dp[k+1][j] + sum[i][j]);
            }
        }
    }
    /*
    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++){
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }
    cout<<endl;
    */
    cout<<dp[0][n-1];
}


int main(){
    ll n;
    cin>>n;
    ll ar[n];
    for(ll i=0;i<n;i++){
        cin>>ar[i];
    }
    minCost(ar,n);
}


Measured memory_bytes: 6156
#!/usr/bin/env python3
# CGL_2_B: Segments/Lines - Intersection

from math import sqrt


class Segment:
    def __init__(self, p0, p1):
        self.end_points = (p0, p1)

    def intersect(self, other):
        p0, p1 = self.end_points
        p2, p3 = other.end_points

        if convex(p0, p2, p1, p3):
            return True
        else:
            if (p0 in other or p1 in other
                    or p2 in self or p3 in self):
                return True

        return False

    def __contains__(self, p):
        p0, p1 = self.end_points
        x0, y0 = p0
        x1, y1 = p1
        x, y = p
        v = (x1-x0, y1-y0)
        v0 = (x-x0, y-y0)
        v1 = (x-x1, y-y1)
        if dot(orthogonal(v0), v1) == 0:
            if abs(length(v0) + length(v1) - length(v)) < 1e-10:
                return True
        return False


def dot(v1, v2):
    x1, y1 = v1
    x2, y2 = v2
    return x1 * x2 + y1 * y2


def orthogonal(v):
    x, y = v
    return -y, x


def length(v):
    x, y = v
    return sqrt(x**2 + y**2)


def convex(p0, p1, p2, p3):
    ret = []
    for pa, pb, pc in zip([p0, p1, p2, p3],
                          [p1, p2, p3, p0],
                          [p2, p3, p0, p1]):
        xa, ya = pa
        xb, yb = pb
        xc, yc = pc
        v1 = (xb - xa, yb - ya)
        v2 = (xc - xb, yc - yb)
        ret.append(dot(orthogonal(v1), v2))

    return all([d > 0 for d in ret]) or all([d < 0 for d in ret])


def run():
    q = int(input())

    for _ in range(q):
        x0, y0, x1, y1, x2, y2, x3, y3 = [int(i) for i in input().split()]
        s1 = Segment((x0, y0), (x1, y1))
        s2 = Segment((x2, y2), (x3, y3))
        if s1.intersect(s2):
            print(1)
        else:
            print(0)


if __name__ == '__main__':
    run()



Measured memory_bytes: 5704
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<numeric>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;


//最大公約数
template<class T> T gcd(T a, T b)
{
	while (true)
	{
		T r;
		if (a%b == 0) return b;
		else
		{
			r = a % b;
			a = b;
			b = r;
		}
	}
}
//最小公倍数
template<class T> T lcm(T a, T b)
{
	return a / gcd(a, b)*b;
}
//文字0~9をint型0~9に変換
int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}
//a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD)
{
	if (b == 0) return 1;
	else if (b % 2 == 0)
	{
		long long int d = ModPower(a, b / 2, MOD);
		return (d*d) % MOD;
	}
	else
	{
		return (a*ModPower(a, b - 1, MOD)) % MOD;
	}
}
//nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD)
{
	if (n == 0 || r == 0) return 1;

	long long int Kn = 1, Kr = 1, Knr = 1;

	long long int temp = 1;
	for (long long int i = 1; i <= n; i++)
	{
		temp *= i;
		temp %= MOD;
		if (i == n) Kn = temp;
		if (i == r) Kr = temp;
		if (i == n - r) Knr = temp;
	}

	long long int x = ModPower(Kr, MOD - 2, MOD);
	long long int y = ModPower(Knr, MOD - 2, MOD);

	long long int ans;
	ans = Kn * x;
	ans %= MOD;
	ans *= y;
	ans %= MOD;

	return ans;
}
//int型10進数をord桁のstring型2進数に変換する
string binary(int x,int ord)
{
	int y;
	string ans = "";
	for (int i = 0; i < ord; i++)
	{
		y = x / pow(2, ord - 1 - i);
		y %= 2;
		if (y == 0) ans += "0";
		else ans += "1";
	}

	return ans;
}


/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/

const long long int mod = 1000000007;

int main()
{
	long long int N, B;
	cin >> N >> B;
	long long int R = N - B;

	long long int b, r;

	for (long long int i = 1; i <= B; i++)
	{
		if (R + 1 < i)
			cout << 0 << endl;
		else
		{
			b = ModCombi(B - 1, i - 1, mod);
			r = ModCombi(R + 1, i, mod);
			cout << (b*r) % mod << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define rev(s) (string((s).rbegin(), (s).rend()))
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

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

   int cnt=0;
   int ans=0;
    

   rep(i,n-1) {
       if (s[i]==s[i+1]) {
           ans++;
       }
       else {
           cnt++;
       }
   } 
   
   if (cnt/2 <= k) {
       ans+=(cnt/2)*2;
       if (k-cnt/2>=1 && cnt%2==1) {
           ans++;
       }
   }
   else {
       ans+=k*2;
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int main() {
	int n, m, in, inn;
	cin >> n >> m;
	bool ans = false;
	vector<bool> c(n, false), d(n, false);
	rep(i, m) {
		cin >> in >> inn;
		int a = min(in, inn) - 1;
		int b = max(in, inn) - 1;
		if (a == 0) c[b] = true;
		if (b == n - 1)d[a] = true;
	}
	ans = d[n - 1];
	rep(i, n) {
		if (c[i] && d[i])ans = true;
	}
	cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}

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

using namespace std;

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

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

typedef long long ll;
typedef pair<int, int> PII;
typedef priority_queue<int> PQI;
typedef priority_queue<PII> PQII;

const double EPS = 1e-10;
const int N = 1000;
int usd[N];

int main() {
  memset(usd, 0, sizeof(usd));
  int n, d;
  string x, res;
  scanf("%d ", &n);
  cin >> x;
  res = x;
  scanf("%d ", &d);
  int i=0, j=0;
  while (i<n && j<d) {
    if (x[i]=='0' && !usd[i]) {
      res[i] = '1'; 
      usd[i] = 1;
      j++;
    }
    i++;
  }

  i=n-1;
  while (i>=0 && j<d) {
    if (x[i]=='1' && !usd[i]) {
      res[i] = '0';
      usd[i] = 1;
      j++;
    }
    i--;
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 1240
s = list(input())
l = len(s)//2

def check(t,s):
  ans = 0
  for i in range(l):
    if s[i]!=t[i]:
      ans+=1
  print(ans)
      
if len(s)%2==0:
  t = list(reversed(s[l:]))
  check(t,s)
else:
  t = list(reversed(s[l+1:]))
  check(t,s)


Measured memory_bytes: 3060
#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 reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> v(n);
    rep(i, n) cin >> v[i];
    sort(all(v));
    double ans = (v[0] + v[1]) / 2.0;
    reps(i, 2, n) {
        ans = (ans + v[i]) / 2.0;
    }
    printf("%.10f\n", ans);
    return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $n);
fscanf(STDIN, "%d", $k);
fscanf(STDIN, "%d", $x);
fscanf(STDIN, "%d", $y);

$cost = 0;
if($n > $k){
    $cost = $x * $k + $y * ($n - $k);
}else{
    $cost = $x * $n;
}
print $cost;


Measured memory_bytes: 4604
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
const long double pi=acos(-1.0);
int n,x[N],y[N],Ans[N],a[N];
struct opt{int x,y,id;}Q[N];
bool cmp(opt a,opt b){
    return a.y==b.y?a.x<b.x:a.y<b.y;
}
struct bit{
    int Max[N];
    bit(){for (int i=0;i<N;i++) Max[i]=-1e9;}
    void change(int p,int v){
        for (p++;p<N;p+=p&-p) Max[p]=max(Max[p],v);
    }
    int query(int p){
        int ans=-1e9;
        for (p++;p;p-=p&-p) ans=max(ans,Max[p]);
        return ans;
    }
}T;
int main()
{
    int x0,y0,x1,y1;
    scanf("%d%d%d%d%d",&x0,&y0,&x1,&y1,&n);
    long double ans=100.0*(abs(x0-x1)+abs(y0-y1));
    for (int i=1;i<=n;i++) scanf("%d%d",&x[i],&y[i]);
    x[0]=x0;y[0]=y0;n++;x[n]=x1;y[n]=y1;
    if (y0>y1) for (int i=0;i<=n;i++) y[i]=-y[i];
    if (x0>x1) for (int i=0;i<=n;i++) x[i]=-x[i];
    for (int i=0;i<=n;i++) a[i]=x[i];
    sort(a,a+n+1);
    for (int i=0;i<=n;i++) x[i]=lower_bound(a,a+n+1,x[i])-a;
    for (int i=0;i<=n;i++) Q[i]=(opt){x[i],y[i],i};
    sort(Q,Q+n+1,cmp);
    for (int i=0;i<=n;i++){
        int id=Q[i].id;
        Ans[id]=(id?T.query(Q[i].x)+1:0);
        T.change(Q[i].x,Ans[id]);
    }
    Ans[n]--;
    if (Ans[n]<=min(abs(x0-x1),abs(y0-y1)))
        printf("%.15Lf\n",ans-Ans[n]*(20-5*pi));
    else
        printf("%.15Lf\n",ans-(Ans[n]-1)*(20-5*pi)+10*pi-20);
    return 0;
}

Measured memory_bytes: 6528
N, A, B = map(int, input().split())

total = 0
for i in range(N + 1):
    sum = 0
    tmp_i = i
    while (tmp_i > 0):
        sum += tmp_i % 10
        tmp_i = int(tmp_i / 10)
    if sum >= A and sum <= B:
        total += i
print(total)



Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int len;
    cin >> len;
    vector<int> arr(len);
    int o = 0, e = 0, four = 0;
    for(int i = 0; i < len; i++) {
        cin >> arr[i];
        if(arr[i] % 2 == 1)
            o += 1;
        else if(arr[i] % 4 == 0)
            four += 1;
        else
            e += 1;
    }
    bool ok = false;
    if(e == 0) {
        if(four >= o - 1)
            ok = true;
    } else {
        if(four >= o)
            ok = true;
    }
    if(ok)
        cout << "Yes";
    else
        cout << "No";
}

Measured memory_bytes: 3684
"""
AtCoder Educational DP Contest
https://atcoder.jp/contests/dp/tasks/dp_i

I - Coins

"""
import collections


def solve(ps):
    dp = collections.defaultdict(float)
    dp[0] = 1.0
    for p_i in ps:
        for head_count in reversed(range(N + 1)):
            dp[head_count] = p_i * dp[head_count - 1] + (1 - p_i) * dp[head_count]

    more_than_half = (N + 2) // 2
    res = sum(dp[head_count] for head_count in range(more_than_half, N + 1))
    return res
 

N = int(input())
ps = [float(s) for s in input().split()]
res = solve(ps)
print(res)


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

using namespace std;

int main(){
  int N, X;
  cin >> N >> X;
  
  int C = 0, L;
  int count = 1;
  for (int index = 0; index < N; index++) {
    cin >> L;
    C += L;
    if (C <= X) count++;
  }
  
  cout << count;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
typedef long long ll;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

int main(){
    int n,k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    vector<ll> sum(n,a[0]),best_sum(n,max(0LL,a[0]));
    for(int i=1;i<n;i++){
        sum[i]=sum[i-1]+a[i];
        best_sum[i]=best_sum[i-1]+max(0LL,a[i]);
    }
    ll ans = -1;
    for(int i=0;i+k<=n;i++){
        ll tmp=0LL;
        if(i==0){
            tmp = max(0LL,sum[k-1])+best_sum[n-1]-best_sum[k-1];
        }else{
            tmp = max(0LL,sum[i+k-1]-sum[i-1])+best_sum[n-1]-(best_sum[i+k-1]-best_sum[i-1]);
        }
        ans = max(ans,tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <string.h>
int main(){
  int j,i,n,m,best=0;
  char sn[101][11],tm[101][11];
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%s",sn[i]);
  scanf("%d",&m);
  for(i=0;i<m;i++)scanf("%s",tm[i]);
  for(i=0;i<n;i++){
    int scr=0;
    for(j=0;j<n;j++){
      if(strcmp(sn[i],sn[j])==0)scr++;
    }
    for(j=0;j<m;j++){
      if(strcmp(sn[i],tm[j])==0)scr--;
    }
    if(best<scr) best=scr;
  }
  printf("%d",best);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int data[101][101];

int prim( int n )
{
	vector<int> key( n, 9999999 );
	key[0] = 0;
	map<int,int> pq;
	bool inQueue[101];
	for( int i = 0;i < 101;i++ ) inQueue[i] = true;
	for( int i = 0;i < n;i++ ){
		pq.insert( pair<int,int>( i, key[i] ) );
	}

	while( !pq.empty() ){
		map<int,int>::iterator target = pq.begin();
		for( map<int,int>::iterator it = pq.begin();it != pq.end();it++ ){
			if( target->second > it->second ) target = it;
		}
		int u = target->first;
		pq.erase( target );
		inQueue[u] = false;

		for( int i = 0;i < n;i++ ){
			if( data[u][i] ){
				if( inQueue[i] ){
					int w = data[u][i];
					if( w < key[i] ){
						key[i] = w;
						pq[i] = w;
					}
				}
			}
		}
	}

	int answer = 0;
	for( int i = 0;i < n;i++ ){
		answer += key[i];
	}

	return answer;
}

int main(int argc, char const* argv[])
{
	int n,m;
	int a,b,cost;

	while( cin >> n >> m && n != 0 ){
		for( int i = 0;i < 101;i++ ){
			for( int j = 0;j < 101;j++ ){
				data[i][j] = 0;
			}
		}
		for( int i = 0;i < m;i++ ){
			cin >> a >> b >> cost;
			data[a][b] = cost;
			data[b][a] = cost;
		}

		int answer = prim( n );
		cout << answer << endl;
	}

	return 0;
}

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

int main() {
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);
  for (int i = 0; i < M; i++) {
    cin >> B.at(i);
  }
  vector<vector<int>> A(N, vector<int>(M));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      cin >> A.at(i).at(j);
    }
  }
  int answer = 0;
  for (int i = 0; i < N; i++) {
    int sum = 0;
    for (int j = 0; j < M; j++) {
      sum += A.at(i).at(j) * B.at(j);
    }
    sum += C;
    if (sum > 0) {
      answer++;
    }
  }
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 256
a[5],e,x;main(t){for(;e<5;)scanf("%d",&a[e++]);for(e=0;e<4;e++)for(x=e+1;x<5;x++)if(a[e]<a[x])t=a[e],a[e]=a[x],a[x]=t;for(e=0;e<5;)printf("%d",a[e++]),(e-5)?printf(" "):puts("");exit(0);}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/


int N, M;
//---------------------------------------------------------------------------------------------------
string solve() {
    map<int, int> cnt;

    cin >> N;
    rep(i, 0, N) {
        int x; cin >> x;
        cnt[x]++;
    }

    cin >> M;
    rep(i, 0, M) {
        int x; cin >> x;
        if (cnt[x] == 0) return "NO";
        cnt[x]--;
    }

    return "YES";
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cout << solve() << endl;
}

Measured memory_bytes: 9600
/*
   we need to know for each articulation point in graph the sizes of component when it extract's from the graph .
   so we can do that by tarjan then calculate the number of pairs
*/
#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>


#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);


using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-8;

int n,x,ans;


 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;
cin>>n;
forr(i,1,n)
{
    cin>>x;
    ans^=x;
}
if(ans==0)cout<<"Yes";
else cout<<"No";













return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N = int(input())
a = [int(i) for i in input().split()]

alice = 0
bob = 0

# ソート
a.sort(reverse=True)

while (len(a) > 0):
    alice += a.pop(0)
    if len(a) > 0:
        bob += a.pop(0)

print(alice - bob)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

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

    int h, w, n;
    cin >> h >> w >> n;

    vector<pair<int, int>> p;
    p.reserve(n * 9 + 1);
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        for (int i = max(a - 2, 1); i <= min(a, h - 2); i++) {
            for (int j = max(b - 2, 1); j <= min(b, w - 2); j++) {
                p.push_back({ i, j });
            }
        }
    }

    int m = (int)p.size();
    sort(p.begin(), p.end());
    p.push_back({ h + 1, 0 });

    int64_t r[10] = {};
    int k = 0;
    for (int i = 0; i < m; i++) {
        k++;
        if (p[i] != p[i + 1]) {
            r[k]++;
            k = 0;
        }
    }

    r[0] = (int64_t)(h - 2) * (w - 2);
    for (int i = 1; i < 10; i++) {
        r[0] -= r[i];
    }
    for (int i = 0; i < 10; i++) {
        cout << r[i] << endl;
    }

    return 0;
}

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


int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int N, K; cin >> N >> K;
  vector<int> t(N), d(N), ord(N);
  for (int i = 0; i < N; i++) {
    cin >> t.at(i) >> d.at(i);
    t.at(i)--;
  }
  iota(ord.begin(), ord.end(), 0);
  sort(ord.begin(), ord.end(),
       [&](int u, int v) { return d.at(u) > d.at(v); });
  vector<bool> top(N);
  vector<bool> seen(N);
  for (int i = 0; i < N; i++) {
    int j = ord.at(i);
    int tt = t.at(j);
    if (!seen.at(tt)) {
      seen.at(tt) = true;
      top.at(i) = true;
    }
  }
  ll sd = 0;
  ll st = 0;
  for (int i = 0; i < K; i++) {
    int j = ord.at(i);
    sd += d.at(j);
    if (top.at(i)) st++;
  }
  int k = K - 1;
  ll ans = sd + st * st;
  for (int i = K-1; i >= 0; i--) {
    if (top.at(i)) continue;
    k++;
    while (k < N && !top.at(k)) k++;
    if (k == N) break;
    sd += d.at(ord.at(k)) - d.at(ord.at(i));
    st++;
    ans = max(ans, sd + st * st);
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 1408
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int a, b, c, x, y;
	int ans, m, n;
	scanf("%d%d%d%d%d", &a, &b, &c, &x, &y);
	int t1 = (x >= y ? x : y);
	if ((a + b) <= 2 * c)
	{
		ans = x * a + y * b;
		printf("%d", ans);
	}
	if ((a + b) > 2 * c)
	{
		m = t1 * c * 2;
		if (x < y)
		{
			n = x * c * 2 + (y - x)*b;
		}
		else
			n = y * c * 2 + (x - y)*a;
		ans = (m <= n ? m : n);
		printf("%d", ans);
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>

int main(){
    char s[100001], tmp[8];
    char div[4][8] = {"dream", "dreamer", "erase", "eraser"};
    int ans = 1;
    scanf("%s", s);

    char *adr = s + strlen(s);
    for(int i = strlen(s) - 1; i >= 0;){
        int flag = 0;
        for(int j = 0; j < 4; j++){
            if(strncmp(adr - strlen(div[j]), div[j], strlen(div[j])) == 0){
                flag = 1;
                i -= strlen(div[j]);
                adr -= strlen(div[j]);
            }
        }
        if(!flag){
            ans = 0;
            break;
        }
    }
    printf((ans == 1) ? "YES\n" : "NO\n");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int n,a[101];
    cin>>n;
    for (int i=1; i<=n; i++) cin>>a[i];
    int ans=0;
    for (int i=1; i<=n; i+=2)
    {
        if (a[i]%2) ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3548
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<tuple>
#include<limits>//ex numeric_limits<int>::max()
#define lli long long int

using namespace std;

int main(void){
    int a,b;
    cin >> a >> b;
    if(a*b % 2==0)cout << "No"<<endl;
    else cout << "Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1000000007;
ll gyaku(ll n){
  ll i=mod-2;
  ll ret=1;
  ll now=n;
  while(i>0){
    if(i%2==1){
      ret*=now;
      ret%=mod;
    }
    now=now*now;
    now%=mod;
    i/=2;
  }
  return ret;
}
ll nck(ll n,ll k){
  if(k>n)return 0;
  if(2*k>n)k=n-k;
  ll ret=1;
  for(ll i=0;i<k;i++){
    ret*=n-i;
    ret%=mod;
    ret*=gyaku(i+1);
    ret%=mod;
  }
  return ret;
}
int main(){
  ll n;cin>>n;
  ll a[n+1];
  map<ll,ll> mp;
  ll num;
  for(ll i=0;i<n+1;i++){
    cin>>a[i];
    mp[a[i]]++;
    if(mp[a[i]]==2)num=a[i];
  }
  ll s=0,t=0;
  for(ll i=0;i<n+1;i++){
    if(a[i]==num)break;
    s++;
  }
  for(ll i=n;i>=0;i--){
    if(a[i]==num)break;
    t++;
  }
  ll d[n+2];
  ll now=1;
  for(ll i=0;i<n+1;i++){
    now*=n+1-i;
    now%=mod;
    now*=gyaku(i+1);
    now%=mod;
    d[i+1]=now;
  }
  ll d2[s+t+3];
  now=1;
  for(ll i=0;i<s+t+2;i++){
    now*=s+t+2-i;
    now%=mod;
    now*=gyaku(i+1);
    now%=mod;
    d2[i+1]=now;
  }
  ll d3[s+t+1];
  d3[0]=1;
  now=1;
  for(ll i=0;i<s+t;i++){
    now*=s+t-i;
    now%=mod;
    now*=gyaku(i+1);
    now%=mod;
    d3[i+1]=now;
  }
  ll d4[s+t+2];
  now=1;
  for(ll i=0;i<s+t+1;i++){
    now*=s+t+1-i;
    now%=mod;
    now*=gyaku(i+1);
    now%=mod;
    d4[i+1]=now;
  }
  for(ll i=1;i<=n+1;i++){
    if(i==1){
      cout<<n<<endl;
      continue;
    }
    ll b=d[i];
    if(i<s+t+2){
      b-=d2[i];
    b+=mod;
    b%=mod;
    b+=d3[i-2];
    b%=mod;
    b+=d4[i];
    b%=mod;
    }
    cout<<b<<endl;
  }
}

Measured memory_bytes: 11392
def is_prime(n):
    if n < 2:
        return False
    else:
        for p in range(2, n):
            if n % p == 0:
                return False
        else:
            return True


# input
N = int(input())

# check
prime_nums = []
append = prime_nums.append
for n in range(2, 55555):
    if is_prime(n) and n % 5 == 1:
        append(n)
        if len(prime_nums) == N:
            break

res = " ".join([str(num) for num in prime_nums])
print(res)
exit(0)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vb= vector<bool>;
using vl= vector<ll>;
using vs= vector<string>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

int main(){
  string s;
  cin >> s;
  rep(i,0,s.size()){
    cout << "x";
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <cstdio>

using namespace std;

int N;
int ppl[120];

int main(void) {

    cin >> N;

    for (int i = 0; i < N; ++i) {
        int b, f, r, v;
        cin >> b >> f >> r >> v;
        ppl[(b - 1) * 30 + (f - 1) * 10 + (r - 1)] += v;
    }

    for (int B = 0; B < 4; ++B) {
        for (int F = 0; F < 3; ++F) {
            for (int R = 0; R < 10; ++R) {
                printf(" %1d", ppl[B*30 + F*10 + R]);
            }
            printf("\n");
        }
        if (B != 3) {
            puts("####################");
        }
    }

    return 0;
}

Measured memory_bytes: 1160
import numpy as np

n=int(input())

def f(a,b):
    return (max(len(str(a)),len(str(b))))

ans=10*20
for i in range(int(np.sqrt(n))):
    if n%(i+1)==0:
        F=f(i+1,n//(i+1))
        if F<ans:
            ans=F
print(ans)


Measured memory_bytes: 12500
# Title: Christmas Eve Eve
# Link: https://abc115.contest.atcoder.jp/tasks/abc115_b

import sys


sys.setrecursionlimit(10 ** 6)

read_single_int = lambda: int(sys.stdin.readline().strip())


def solution(ps: list):
    max_price = max(ps)
    return sum(ps) - max_price//2


def main():
    n = read_single_int()
    ps = []
    for _ in range(n):
        ps.append(read_single_int())
    print(solution(ps))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double x = 0, y = 0;
		int dis = 0, dir = 90;
		String string;
		String[] strings;

		for(;;){
			string = sc.next();
			strings = string.split(",");
			if(string.equals("0,0")) break;

			dis = Integer.parseInt(strings[0]);

			x += dis * Math.cos(Math.toRadians(dir));
			y += dis * Math.sin(Math.toRadians(dir));

			dir += -Integer.parseInt(strings[1]);
		}

		System.out.printf("%d\n%d\n", (int)x, (int)y);
	}
}

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vst = vector<st>;
using vchar = vector<char>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  ll n;
  cin >> n;
  vll a(n);
  vin(a);

  map<ll, ll> count;
  vrep(i, a){
    if(count.count(i - 1)) count[i - 1]++;
    else count[i - 1] = 1;
    if(count.count(i)) count[i]++;
    else count[i] = 1;
    if(count.count(i + 1)) count[i + 1]++;
    else count[i + 1] = 1;
  }

  ll ans = 0;
  vrep(i, count) if(i.second > ans) ans = i.second;
  cout << ans << endl;
}

Measured memory_bytes: 6912
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#define pb push_back
#define ll long long
#define PI 3.14159265
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define eps 1e-7
const int mod=1e9+7;
const int maxn=1e5+5;
using namespace std;
int a[1000];
ll n,h;
struct node
{
    int a,b;
}st[maxn];
bool cmp(const node &a,const node &b)
{
    return a.a>b.a;
}
vector<int>s;
int main()
{
     std::ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>h;
    for(int i=0;i<n;i++)
    {
        cin>>st[i].a>>st[i].b;
    }
    sort(st,st+n,cmp);
    for(int i=1;i<n;i++)
    {
        if(st[i].b>st[0].a)
        {
            s.pb(st[i].b);
        }
    }
    int ans=0;
    sort(s.begin(),s.end());
    for(int i=s.size()-1;i>=0;i--)
    {
        h-=s[i];
        if(h>0)ans++;
        else 
        {
            ans++;
            if(st[0].b<=s[i])break;
            h-=st[0].b;
            ans++;
            for(int j=i;j<s.size();j++)
            {
                h+=s[j];
                if(h<=0)ans--;
                else
                {
                    cout<<ans<<endl;return 0;
                }
            }
        }
    }
    if(h>0)
    {
        h-=st[0].b;
        ans++;
        if(h>0)
        {
                if(h%st[0].a)
            {
                ans+=h/st[0].a+1;
            }
            else
            {
                ans+=h/st[0].a;
            }
        }
        else
        {
            for(int i=0;i<s.size();i++)
            {
                h+=s[i];
                if(h<=0)ans--;
                else break;
            }
        }

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


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

using namespace std;

int main(int argc, char const *argv[])
{
	int N;
	cin >> N;

	vector<int> a(N + 1);

	for (int i = 1; i < N; ++i)
	{
		int k;
		cin >> k;
		a[k]++;
	}

	for (int i = 1; i <= N; ++i)
	{
		cout << a[i] << "\n";
		//printf("%d\n", ans);
	}
	return 0;
}

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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

int n, t, a, h[100001], dif, ans;

int main(){
	dif = INF;
	cin >> n >> t >> a;
	for(int i=0;i<n;i++){
		cin >> h[i];
		if(dif > abs(t*1000-h[i]*6-a*1000)){
			dif = abs(t*1000-h[i]*6-a*1000);
			ans = i+1;
		}
	}

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

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

// ºÊ10rbgÌÅCÅºÊÌ0ÌÊu
int getmin(int bit)
{
	return __builtin_ctz(~bit);
}
// ºÊ10rbgÌÅCÅãÊÌ0ÌÊu
int getmax(int bit)
{
	return 31-__builtin_clz(~bit&1023);
}

int solve(int* c,int* z,int M,int sum,int bit)
{
	int depth=__builtin_popcount(bit);
	if(depth==M)
		return sum==0;
	
	// } è
	if(sum>0){
		int s=sum,b=bit;
		for(int i=depth;i<M;i++){
			int j=c[i]>0?getmin(b):getmax(b);
			b|=1<<j;
			s+=c[i]*j;
		}
		if(s>0)
			return 0;
	}
	if(sum<0){
		int s=sum,b=bit;
		for(int i=depth;i<M;i++){
			int j=c[i]>0?getmax(b):getmin(b);
			b|=1<<j;
			s+=c[i]*j;
		}
		if(s<0)
			return 0;
	}
	
	int res=0;
	for(int i=z[depth];i<10;i++){
		if(bit&1<<i) continue;
		res+=solve(c,z,M,sum+c[depth]*i,bit|1<<i);
	}
	return res;
}

int main()
{
	int d[9]={1};
	for(int i=1;i<9;i++)
		d[i]=d[i-1]*10;
	
	for(int N;scanf("%d ",&N),N;){
		string n[12];
		for(int i=0;i<N;i++){
			char buf[10]; fgets(buf,sizeof buf,stdin);
			n[i]=string(buf,strchr(buf,'\n'));
		}
		
		map<char,int> m;
		for(int i=0;i<N;i++)
			for(int j=0;j<n[i].size();j++)
				if(m.find(n[i][j])==m.end())
					m.insert(make_pair(n[i][j],m.size()));
		int M=m.size();
		
		int c[10]={},z[10]={}; // c:W, z:0ðèÄÄæ¢©Ç¤©
		for(int i=0;i<N;i++){
			if(n[i].size()>1)
				z[m[n[i][0]]]=1;
			reverse(n[i].begin(),n[i].end());
			for(int j=0;j<n[i].size();j++)
				c[m[n[i][j]]]+=i==N-1?-d[j]:d[j];
		}
		
		// WÌâÎlÌ~Å\[g
		for(int i=0;i<M;i++)
			for(int j=M-1;j>i;j--)
				if(abs(c[j-1])<abs(c[j])){
					swap(c[j-1],c[j]);
					swap(z[j-1],z[j]);
				}
		
		printf("%d\n",solve(c,z,M,0,0));
	}
	
	return 0;
}

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

using namespace std;

#define X first
#define Y second
#define eps  1e-5
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;

const int maxn = 1e5+7;
const int INF  = 1<<30;
const int mod  = 1e9+7;

void solve(){
    int n;
    string s;
    cin>>n>>s;
    if(n >= 3200){
        cout<<s<<'\n';
    }else{
        cout<<"red\n";
    }
    
    return;
}

int main()
{
#ifndef ONLINE_JUDGE
   // freopen("in.txt","r",stdin);
#endif
//    freopen("out.txt","w",stdout);
//    ios::sync_with_stdio(false);
    int t = 1;
    //scanf("%d",&t);
    while(t--){
    //    printf("Case %d: ",cas++);
        solve();
    }
#ifndef ONLINE_JUDGE
    //printf("%.10f\n",1.0*clock()/CLOCKS_PER_SEC);
#endif
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int num = 1, ans = 0;
    rep(i, n)
    {
        if (a[i] == num)
            num++;
        else
            ans++;
    }
    if (ans == n)
        ans = -1;
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int a, b, c; cin >> a >> b >> c;
  int res = min(b / a, c);
  cout << res << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long k;
    cin >> k;
    long long num=0;
    vector <long long> lunluns;
    for(int i = 1; i<10;i++){
        lunluns.push_back(i);
        k--;
        if(k==0){
            cout <<lunluns.back() <<endl;
            return 0;
        }
    }
    long long index = 0;
    while(true){
        long long tmp = lunluns[index];
        index++;
        int digit = tmp%10;
        if(digit==9){
            lunluns.push_back(tmp*10+digit-1);
            k--;
            if(k==0){
                cout <<lunluns.back() <<endl;
                return 0;
            }
            lunluns.push_back(tmp*10+digit);
            k--;
            if(k==0){
                cout <<lunluns.back() <<endl;
                return 0;
            }
        }else if(digit==0){
            lunluns.push_back(tmp*10+digit);
            k--;
            if(k==0){
                cout <<lunluns.back() <<endl;
                return 0;
            }
            lunluns.push_back(tmp*10+digit+1);
            k--;
            if(k==0){
                cout <<lunluns.back() <<endl;
                return 0;
            }

        }else{
            lunluns.push_back(tmp*10+digit-1);
            k--;
            if(k==0){
                cout <<lunluns.back() <<endl;
                return 0;
            }
            lunluns.push_back(tmp*10+digit);
            k--;
            if(k==0){
                cout <<lunluns.back() <<endl;
                return 0;
            }
            lunluns.push_back(tmp*10+digit+1);
            k--;
            if(k==0){
                cout <<lunluns.back() <<endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4320
import java.util.Scanner;

public class Main {

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

		int r = sc.nextInt();
		int g = sc.nextInt();
		int b = sc.nextInt();
		int n = sc.nextInt();
		
		int ans = 0;
		for (int i=0;i<=n;i++) {
			for (int j=0;j<=n;j++) {
				if (i*r+j*g<= n && (n-i*r-j*g)%b == 0) {
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;

int N;
P red[100], blue[100];
bool used[100];

int main(void){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> red[i].first >> red[i].second;
    }
    for(int i = 0; i < N; i++){
        cin >> blue[i].first >> blue[i].second;
    }

    sort(red, red + N, [](P p1, P p2){return p1.second > p2.second;});
    sort(blue, blue + N);

    int res = 0;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(not used[j] and red[i].first < blue[j].first and red[i].second < blue[j].second){
                used[j] = true;
                res++;
                break;
            }
        }
    }

    cout << res << '\n';

    return 0;
}

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

int main(){
    int n,m,c;
    cin>>n>>m>>c;
    int a[21][21];
    int b[21];
    rep(i,m)cin>>b[i];
    rep(i,n){
        rep(j,m){
            cin>>a[i][j];
        }
    }
    int ans=0;
    rep(i,n){
        int sum=0;
        rep(j,m){
            sum+=a[i][j]*b[j];
        }
        if(sum+c>0)ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t=0,ans=0;
	cin>>t;
	for(int i=1;i<=t;i++)
	{
		int a;
		cin>>a;
		if(a%2==1&&i%2==1)
		ans++;
	}
	cout<<ans;
	return 0;
}

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

#define int long long
//typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif



signed main() {
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    
    // first is plus
    int s=0;
    int ans=0;
    
    int t = 0;
    rep(i,N){
        s+=a[i];
        if(i%2==0){
            if(s<=0){ t+=abs(s)+1; s=1;}
        }else{
            if(s>=0) {t+= s+1; s=-1;}
        }
        dump(t);
    }
    ans = t;

    s=0;
    t = 0;
    rep(i,N){
        s+=a[i];
        if(i%2==1){
            if(s<=0){ t+=abs(s)+1; s=1;}
        }else{
            if(s>=0){ t+= s+1; s=-1;}
        }
    }

    ans = min(ans, t);
    
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 1024