akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(){
    int n,i;
    int A[250];
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&A[i]);
    }
    for(i=1;i<=n;i++){
        printf("node %d: key = %d, ",i,A[i]);
        if(i!=1)printf("parent key = %d, ",A[i/2]);
        if(2*i<=n)printf("left key = %d, ",A[2*i]);
        if(2*i+1<=n)printf("right key = %d, \n",A[2*i+1]);
        else printf("\n");
    }
}



Measured memory_bytes: 2052
import java.util.*;
import java.io.*;

import static java.lang.System.in;

public class Main {
    static long mod = 998244353;
    public static void main(String[] args)throws IOException{
        Scanner sc = new Scanner(System.in);
        char[] s= sc.next().toCharArray();
        int n = s.length;
        int[] red = new int[n+1], blue = new int[n+1];
        for(int i=1;i<=n;i++){
            int curBlue = s[i-1]-'0';
            red[i]=red[i-1]+2-curBlue;
            blue[i]=blue[i-1]+curBlue;
        }
        int maxBlue = blue[n];
        // dp[i][j]: take i balls, among which j are blue (i-j are red);
        long[][] dp = new long[n*2+1][maxBlue+1];
        //long all = red[n]+blue[n];
        dp[0][0]=1;
        for(int i=1;i<=2*n;i++){
            for(int j=0;j<=Math.min(i,blue[Math.min(i,n)]);j++){
                if(red[Math.min(i,n)]<i-j) continue;
                dp[i][j] = dp[i-1][j];
                if(j>=1) dp[i][j] = (dp[i][j]+dp[i-1][j-1])%mod;
            }
        }
        System.out.println(dp[2*n][maxBlue]);
    }
}


Measured memory_bytes: 165452
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int t = sc.nextInt();
	int a = sc.nextInt();
    double h1 = 999;
    int answer = 0;
    for(int i = 0; i < n; i++){
      int h = sc.nextInt();
	  double b = t-h*0.006;
	  if(Math.abs(b-a) < h1){
	  	h1 = Math.abs(b-a);
		answer = i+1;
	  }
    }
    System.out.print(answer);
  }
}


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

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define LL long long
#define SZ(X) X.size()
#define pii pair<int,int>
#define ALL(X) X.begin(),X.end()

using namespace std;

LL gcd(LL a, LL b) {return b ? gcd(b, a % b) : a;}
LL lcm(LL a, LL b) {return a / gcd(a, b) * b;}
LL powmod(LL a, LL b, LL MOD) {LL ans = 1; while (b) {if (b % 2)ans = ans * a % MOD; a = a * a % MOD; b /= 2;} return ans;}
const int N = 2e5 + 11;
int n;
char a[N];
int main() {
	ios::sync_with_stdio(false);
	cin>>n>>a+1;
	if(n&1)return cout<<"No\n",0;
	int l=0;
	for(int i=n/2+1;i<=n;i++){
		if(a[i]!=a[++l]){
			return cout<<"No\n",0;
		}
	}
	cout<<"Yes\n";
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]

ans = "No"
for i in range(N-2):
    ok = (AB[i][0] == AB[i][1] and AB[i+1][0] == AB[i+1][1] and AB[i+2][0] == AB[i+2][1])
    if ok:
        ans = "Yes"
print(ans)

Measured memory_bytes: 9092
#include "bits/stdc++.h"
using namespace std;
using lint = long long;
#define low lower_bound
#define upp upper_bound
#define rep(i, n) for (lint i = 0; i < lint(n); ++i)
#define Rep(i, n) for (lint i = lint(n); i >= 0; --i)
#define all(vec) (vec).begin(), (vec).end()
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>

struct edge { int to; double cost; };
using P = pair<lint, lint>;
using D = pair<double, double>;
using DI = pair<double, int>;
//const lint mod = 998244353LL;
const lint mod = 1000000007LL;
const lint inf = 3LL * mod * mod;

template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

lint modpow(lint x, lint n, lint m) {
	lint ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (m <= ans) ans %= m;
		}
		x *= x;
		if (m <= x) x %= m;
		n >>= 1;
	}
	return ans;
}

lint fact[1000000];
void f_init(lint n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (lint i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

lint inver[1000000]; bool inve[100000];
lint inv(lint x) {
	if (x == 0) return 0;
	else if (inve[x]) return inver[x];
	else {
		inve[x] = true;
		return inver[x] = modpow(x, mod - 2, mod);
	}
}

lint comb(lint n, lint r) {
	if (n < r) return 0;
	if (n == r) return 1;
	lint ans = fact[n] * inv(fact[n - r]) % mod * inv(fact[r]) % mod;
	if (ans < 0) return ans + mod;
	return ans;
}

lint nck[1010][1010];
void comb(lint n) {
	rep(i, n + 1) {
		rep(j, i + 1) {
			if (j == 0 || i == j) nck[i][j] = 1;
			else nck[i][j] = nck[i - 1][j - 1] + nck[i - 1][j];
		}
	}
}

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

lint lcm(lint a, lint b) { return a / gcd(a, b) * b; }

bool pri(lint p) {
	for (lint i = 2; i * i <= p; i == 2 ? ++i : i += 2) if (p % i == 0) return false;
	return p > 1;
}

map<lint, lint> factring(lint n) {
	map<lint, lint>ans;
	for (lint i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++ans[i];
		}
	}
	if (n != 1) ++ans[n];
	return ans;
}

double dis(D a, D b) { return sqrt((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second)); }

lint n, m, sum, ans;
unordered_map<lint, lint>mp;
int main() {
	cin >> n >> m;
	mp[0] = 1;
	rep(i, n) {
		lint a;
		cin >> a;
		sum += a;
		sum %= m;
		++mp[sum];
	}
	for (P p : mp) {
		ans += p.second * (p.second - 1) / 2;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3596
#include <stdio.h>
int main(void)
{
int N,a,b,c;
scanf("%d",&N);
a=N/100;
N=N%100;
b=N/10;
N=N%10;
c=N;
if(a==7||b==7||c==7)
printf("Yes");
else
printf("No");
return 0;
}

Measured memory_bytes: 1712
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
int n, m;
struct edge { int to, cost; };
typedef pair<int, pair<int, int> > P;
typedef pair<int, int> pa;
vector<edge> g[N]; // 储存路径
int d[N][3]; // 储存最小花费
int dijkstra(int from, int to) {
    priority_queue<P, vector<P>, greater<P> > que; // 优先队列优化，优先找花费最少的点。
    memset(d, 0x3f, sizeof d);
    d[from][0] = 0; // 出发点
    que.push(P(0, pa(from, 0)));
    while(!que.empty()) {
        P p = que.top();
        que.pop();
        auto v = p.second;
        if(d[v.first][v.second] < p.first) continue;
        for(int i = 0; i < g[v.first].size(); i++) {
            edge e = g[v.first][i];
            if(d[e.to][(v.second + 1) % 3] > d[v.first][v.second] + 1) {
                d[e.to][(v.second + 1) % 3] = d[v.first][v.second] + 1;
                que.push(P(d[e.to][(v.second+1)%3], pa(e.to, (v.second + 1) % 3)));
            }
        }
    }
    // for(int i = 1; i <= n; i++) {
    //     for(int j = 0; j < 3; j++) {
    //         printf("d[%d][%d]:%d\n", i, j, d[i][j]);
    //     }
    // }
    int ret = d[to][0];
    if(ret == INF) return -1;
    // cout << ret << endl;
    return ret/3;
}
int main() {
    cin >> n >> m;
    for(int i = 0, u, v; i < m; i++) {
        cin >> u >> v;
        g[u].push_back(edge{v, 0});
    }
    int s, t;
    cin >> s >> t;
    cout << dijkstra(s, t) << '\n';
    return 0;
}

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

using namespace std;


int main() {
  int N, A[100000], B[100000];

  cin >> N;
  for(int i = 0; i < N; i++) cin >> A[i];
  for(int i = 0; i < N; i++) cin >> B[i];

  set< int > C(B, B + N);
  if(C.size() == N) {
    cout << "Yes" << endl;
    return (0);
  } else {
    vector< int > rev(N + 1);
    for(int i = 0; i < N; i++) rev[A[i]] = i;
    int p = 1;
    while(C.count(p)) p++;

    cout << "No" << endl;
    for(int i = 0; i < N; i++) {
      if(i) cout << " ";
      if(i == rev[p]) cout << 1;
      else cout << i + 1;
    }
    cout << endl;
    for(int i = 0; i < N; i++) {
      if(i) cout << " ";
      if(i == rev[p]) cout << 2;
      else cout << i + 1;
    }
    cout << endl;
  }
}


Measured memory_bytes: 8572
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

int main(void)
{
    std::cout << std::fixed << std::setprecision(11);
    double A, B, H, M;
    cin >> A >> B >> H >> M;
    double ans;

    double fixedH = H * 5;
    double rest = (5.0 / 60.0);
    if (M != 0)
    {
        rest *= M;
        fixedH += rest;
    }
    // cout << fixedH << endl;
    double kakudo;
    if (fixedH + M >= 60)
    {
        kakudo = 6 * abs(fixedH - M);
    }
    else
    {
        kakudo = 6 * abs((M + 60) - fixedH);
    }
    // cout << kakudo << endl;
    ans = sqrt(A * A + B * B - 2 * A * B * cos(kakudo * PI / 180));
    cout << ans << endl;
    return (0);
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }

  bool k = false;

  sort(vec.begin(), vec.end());

  for (int i = 0; i < N - 1; i++) {
    if (vec.at(i) == vec.at(i + 1)) {
      k = true;
    }
  }

  if (k) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
}

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

#define NDEBUG
#ifdef DEBUG
#include "cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))

#define INTSPACE 12


int N;
char _buf[300002];

int loadint() {
    if (fgets(_buf, INTSPACE+3, stdin)==NULL) return 0;
    return atoi(_buf);
}

int solve() {
    vi es(N+1,0), ws(N+1,0);
    rep(i,N){
        if (_buf[i] == 'E') {
            es[i+1] = es[i]+1;
            ws[i+1] = ws[i];
        } else {
            es[i+1] = es[i];
            ws[i+1] = ws[i]+1;
        }
    }
    int score = N;
#ifdef DEBUG
    cerr << es << ws << endl;
#endif
    rep(i,N){
        int eL = es[i]-es[0], eR = es[N]-es[i+1];
        int wL = ws[i]-ws[0], wR = ws[N]-ws[i+1];
#ifdef DEBUG
        printf("%d) %d+%d %d+%d, %d+%d=%d\n", i, eL,wL, eR,wR, eR,wL, eR+wL);
#endif
        score = min(score, eR+wL);
    }

    return score;
}


int main() {
    N = loadint();

    if (fgets(_buf, N+2, stdin)==NULL) return 0;
    _buf[N] = 0;

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()
struct revran {
  const i64 b, e;
  struct iter {
    i64 i;
    constexpr iter(const i64 i) noexcept: i(i) {}
    void operator++() noexcept { --i; }
    constexpr i64 operator*() const noexcept { return i; }
    constexpr bool operator!=(const iter x) const noexcept { return i != x.i; }
  };
  constexpr revran(const i64 e) noexcept: b(0), e(e) {}
  constexpr revran(const i64 b, const i64 e) noexcept: b(b), e(e) {}
  constexpr iter begin() const noexcept { return iter(e - 1); }
  constexpr iter end() const noexcept { return iter(b - 1); }
};

struct ran {
  const i64 b, e;
  struct iter {
    i64 i;
    constexpr iter(const i64 i) noexcept: i(i) {}
    void operator++() noexcept { ++i; }
    constexpr i64 operator*() const noexcept { return i; }
    constexpr bool operator!=(const iter x) const noexcept { return i != x.i; }
  };
  constexpr ran(const i64 e) noexcept: b(0), e(e) {}
  constexpr ran(const i64 b, const i64 e) noexcept: b(b), e(e) {}
  constexpr iter begin() const noexcept { return iter(b); }
  constexpr iter end() const noexcept { return iter(e); }
  constexpr revran rev() const noexcept { return revran(b, e); }
};

constexpr ran rin(const i64 e) noexcept { return ran(1, e + 1); }
constexpr ran rin(const i64 b, const i64 e) noexcept { return ran(b, e + 1); }

int main() {
  i64 w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << fixed << setprecision(10) << w * h / 2.0 << " " << (bool)((x * 2 == w) && (y * 2 == h)) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

int main() {
	char d[101][101];
	int w,h,k,x,y;
	while(cin >> h >> w) {
		if (w+h==0) break;
		for (y=0;y<h;y++) cin >> d[y];
		x=0; y=0; k=0;
		while(true) {
			if (d[y][x]=='.') { cout << x << " " << y << endl; break;}
			switch(d[y][x]) {
				case '<':  x--; break;
				case '>':  x++; break;
				case '^':  y--; break;
				case 'v':  y++; break;
			}
			k++;
			if (k>w*h) {cout << "LOOP" << endl; break;}
		}
	}
    return 0;
	}

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

int main(){
	int N,A;
  	cin >> N >> A;
  
  	if (N % 500 <= A){
    	cout << "Yes" << endl;
    }
  
  	else{
    	cout << "No" << endl;
    }
  return 0;
}


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

using ll=long long;
ll solve(vector<int> org,vector<int> tar){
    ll res=0;
    for(int i=0;i<org.size();i++){
        if(org[i]!=tar[i]){
            if(i+1==org.size()){
                return ll(1e10);
            }
            for(int j=i+1;j<org.size();j++){
                if(tar[i]==org[j]){
                    res+=j-i;
                    swap(org[i],org[j]);
                    break;
                }
                if(j+1==org.size()){
                    return ll(1e10);
                }
            }
        }
    }
    return res;
}

int main(){
    int n,m;
    cin>>n>>m;
    vector<int> b(n);
    for(int i=0;i<n;i++) cin>>b[i];
    vector<int> p(n);
    for(int i=0;i<m;i++) cin>>p[i];

    vector<int> runlen(n);
    int bit=0;
    int index=0;
    for(int i=0;i<m;i++){
        for(int j=0;j<p[i];j++){
            runlen[index++]=bit;
        }
        bit=!bit;
    }
    
    ll res=solve(b,runlen);
    bit=1;
    index=0;
    for(int i=0;i<m;i++){
        for(int j=0;j<p[i];j++){
            runlen[index++]=bit;
        }
        bit=!bit;
    }
    res=min(res,solve(b,runlen));
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3164
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String S  = keyboard.next();
		String[] hosi = S.split("");
		
		int count = 0;
		
		for(int i = 0; i < S.length(); i++) {
			if(hosi[i].equals("x")) {
				count++;
			}
		}
		
		String ans;
		if(count >= 8) {
			ans = "NO";
		}else {
			ans = "YES";
		}
		System.out.println(ans);
		keyboard.close();	
	}
}

Measured memory_bytes: 23636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long;

int main(){
    int N; cin >> N;
    vector<ll> A(N), B(N);
    ll sumA = 0;
    ll sumB = 0;

    for(int i=0;i<N;i++){
        cin >> A[i];
        sumA += A[i];
    }
    for(int i=0;i<N;i++){
        cin >> B[i];
        sumB += B[i];
    }

    if(sumA < sumB){
        cout << -1 << endl;
        return 0;
    }

    vector<ll> subst(N);
    ll sum_lost = 0;
    int cnt_lost = 0;
    for(int i=0;i<N;i++){
        if(A[i] >= B[i]){
            subst[i] = A[i] - B[i];
        }else{
            sum_lost += B[i] - A[i];
            cnt_lost++;
        }
    }

    sort(subst.begin(), subst.end(), greater<ll>());
    int cnt_add = 0;

    while(sum_lost > 0){
        sum_lost -= subst[cnt_add];
        cnt_add++;
    }

    cout << cnt_lost + cnt_add << endl;
    return 0;
}

Measured memory_bytes: 2560
import sys

input = sys.stdin.readline
N = int(input())
A = sorted(list(map(int, input().split())))
tmp = A[-1]
ans = 0
for i in A[:-1]:
    if abs(A[-1] // 2 - i) < tmp:
        tmp = abs(A[-1] // 2 - i)
        ans = i
    elif A[-1] % 2 != 0 and abs(A[-1] // 2 - i + 1) < tmp:
        tmp = abs(A[-1] // 2 - i + 1)
        ans = i
print(A[-1], ans)


Measured memory_bytes: 14040
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N;
vector<string> w;
//=============================
void input()
{
    cin >> N;
    w.resize(N);
    rep(i, N)
    {
        cin >> w[i];
    }
}
//=============================
//=============================
void solve()
{
    bool ans = true;
    char prev;
    set<string> ss;

    rep(i, N)
    {
        if (i == 0)
            ans = true;
        else
        {
            if (ss.find(w[i]) == ss.end())
            {
                if (w[i][0] != prev)
                {
                    ans = false;
                    break;
                }
            }
            else
            {
                ans = false;
                break;
            }
        }
        ss.insert(w[i]);
        prev = w[i][w[i].size() - 1];
    }

    cout << (ans ? "Yes" : "No") << endl;
}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
def middle_square(s, digit):
    s2 = str(s ** 2).zfill(digit * 2)
    return int(s2[digit // 2:digit * 3 // 2])

n = int(input())

for i in range(n):
    print('Case {}:'.format(i + 1))

    s = int(input())
    for _ in range(10):
        s = middle_square(s, digit=4)
        print(s)



Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;typedef long long ll;
#define int ll
#define N 100005
#define pb push_back
#define pv(x) cout<<#x<<": ";for(auto k:x){ cout<<k<<" "; }cout<<endl;
#define dbg(x) cout<<#x<<": "<<x<<endl;

int n,m,ni,mi;
// int num[N];
int ok=false;

void solve(){
	string s1,s2;
	cin >> s1;
	cin >> s2;
	bool flag=1;
	if(s1.size()+1!=s2.size()){
		flag=0;
	}
	for(int i=0;i<s1.size();i++){
		if(s1[i]!=s2[i]){
			flag=0;
		}
	}
	cout<<(flag?"Yes":"No")<<endl;
}

int32_t main(){cin.tie(0);ios_base::sync_with_stdio(NULL);
	int t=1;
	while(t--) solve();
	return 0;
}


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

int main()
{
    ll x;
    while(cin>>x)
    {
        ll dv=(x/500LL);
        dv=dv*1000LL;
        x=x%500;
        ll req=(x/5LL);
        dv += (req*5LL);
        cout<<dv<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <cstdlib>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}



using Graph = vector<vector<int>>;


int main() {
	string S="NO";
	ll A, V, B, W, T;
	cin >> A >> V >> B >> W >> T;
	if (abs(A - B) <= (V - W) * T)S = "YES";
	cout << S << endl;
	}

Measured memory_bytes: 3596
object Main {
  def main(args: Array[String]): Unit = {
    val s = io.StdIn.readLine().split("/")

    if (s(0).toInt < 2019) println("Heisei")
    else if (s(0).toInt > 2019) println("TBD")
    else if (s(1).toInt <= 4) println("Heisei")
    else println("TBD")
  }
}


Measured memory_bytes: 25384
#include<bits/stdc++.h>
using namespace std;
#define li long long
#define gc getchar()
#define pc putchar
li read(){
	li x = 0,y = 1;
	int c = gc;
	while(!isdigit(c)){
		if(c == '-') y = -1;
		c = gc;
	} 
	while(isdigit(c)){
		x = (x << 1) + (x << 3) + (c ^ '0');
		c = gc;
	}
	return x * y;
} 
void print(li x){
	if(x < 0){
		pc('-');
		x = -x;
	}
	if(x >= 10) print(x / 10);
	pc(x % 10 + '0');
}
int n,a[200010];
li b[200010];
map<li,int> m;
li as;
int main(){
	int i;
	n = read();
	for(i = 1;i <= n;++i){
		a[i] = read();
		b[i] = b[i - 1] + a[i];
	} 
	m[0] = 1;
	for(i = 1;i <= n;++i){
		as += m[b[i]];
		++m[b[i]];
	}
	print(as);
	return 0;
}

Measured memory_bytes: 15104
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_147a
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            if(input.Sum() <= 21)
            {
                Console.WriteLine("win");
            }
            else
            {
                Console.WriteLine("bust");
            }
            Console.Read();
        }
    }
}


Measured memory_bytes: 27868
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#define N 101
int main(void){
	int i,j,x,count=0;
	char s[N],str[N];

	for( ;fgets(s,sizeof(str),stdin)!=NULL; ){
		sscanf(s,"%s",&str);
		x=0;
		j=strlen(str)-1;
		i=0;
		while(j>i){
			if(str[i]!=str[j]){
				x++;
				break;
			}
			i++;
			j--;
			if(i>=j) break;
		}
		if(x==0) count++;
	}
	printf("%d\n",count);			
	return 0;
}

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

#define rep(i, n) FOR(i, 0, n)
#define FOR(i, x, n) for (int i = (x); i < (n); ++i)
#define all(v) (v).begin(), (v).end()

using ll = long long;

template<class T> bool chmax(T& a, T b){ if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b){ if (a > b) { a = b; return true; } return false; }

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

    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <math.h>

int main(){
	double x1,y1,x2,y2;
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	printf("%f\n",hypot(x1-x2,y1-y2));
	return 0;
}

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

signed main() {
    int N,W;
    cin >> N >> W;
    vector<int> w(N);
    vector<int> v(N);
    for(int i = 0;i < N;i++) {
        int A,B;
        cin >> A >> B;
        w.at(i) = A;
        v.at(i) = B;
    }
    int dp[110][100010];
    dp[0][0] = 0;
    for(int i = 1;i <= N;i++) {
        for(int j = 0;j <= W;j++) {
            if(j < w.at(i - 1)) {
                dp[i][j] = dp[i - 1][j];
            }
            else {
                dp[i][j] = max(dp[i - 1][j],dp[i - 1][j - w.at(i - 1)] + v.at(i - 1));
            }
        }
    }
    cout << dp[N][W] << endl;
}

Measured memory_bytes: 80128
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<algorithm>
#include<map>
#include<queue>
#include<functional>
using namespace std;


int main() {
	int N, K;
	long long ans = 0;

	cin >> N >> K;

	if (K == 0) {
		cout << (long long)N * N << endl;
		return 0;
	}
	for (int i = K + 1; i <= N; i++) {
		int x = N / i;
		int y = N % i;

		ans += (i - K) * x;
		ans += max(0, y - K + 1);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}


# 空白区切の入力値をBigDecimalの配列で返却する
require 'bigdecimal'
require 'bigdecimal/util'
def gets_d_list()
  gets.chomp.split(" ").map(&:to_d)
end
a, b = gets_d_list

puts (a*b).floor

Measured memory_bytes: 14696
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
constexpr int NIL = -2000000050;
struct Node { int key, l = NIL, r = NIL; };
vector<Node> T(1e6);
inline void insert(int z) {
	if(z == 0) return;
	int y = NIL;
	int x = 0;
	while(x != NIL) {
		y = x;
		x = (T[z].key < T[x].key ? T[x].l : T[x].r);
	}
	if(y == NIL) (T[0].key < T[y].key ? T[y].l : T[y].r) = z;
	else (T[z].key < T[y].key ? T[y].l : T[y].r) = z;
}
inline void inorder(int x) {
	if(x == NIL) return;
	inorder(T[x].l);
	cout << ' ' << T[x].key;
	inorder(T[x].r);
}
inline void preorder(int x) {
	if(x == NIL) return;
	cout << ' ' << T[x].key;
	preorder(T[x].l);
	preorder(T[x].r);
}
int main() {
	int n; cin >> n;
	string s;
	int x;
	rep(i, 0, n) {
		cin >> s;
		if(s == "insert") {
			cin >> x;
			T[i].key = x;
			insert(i);
		} else {
			inorder(0);
			P("");
			preorder(0);
			P("");
		}
	}
	return 0;
}

Measured memory_bytes: 14328
#include <stdio.h>

int main(void)
{
	int a[5],i,g=0;
	for(i=0;i<5;i++){
		scanf("%d",&a[i]);
		if(a[i]<40){
			a[i]=40;
		}
		g+=a[i];
	}
	g/=5;
	printf("%d\n",g);
	return 0;
}


Measured memory_bytes: 2100
#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>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
short dp[100][100][100][100];
int h, w;
string a[100];
int s[110][110];
int count(int l1, int r1, int l2, int r2){
	return s[r1+1][r2+1]-s[l1][r2+1]-s[r1+1][l2]+s[l1][l2];
}
int x, y;
short solve(int l1, int r1, int l2, int r2){
	if(dp[l1][r1][l2][r2]>=0) return dp[l1][r1][l2][r2];
	int ret=0;
	if(l1<x){
		int c=0;
		if(l1-(r1-x)>=0){
			int l3=max(l2, r2-y), r3=min(r2, w-1-(y-l2));
			if(l3<=r3){
				c=count(l1, l1, l3, r3);
			}
		}
		ret=max(ret, solve(l1+1, r1, l2, r2)+c);
	}
	if(l2<y){
		int c=0;
		if(l2-(r2-y)>=0){
			int l3=max(l1, r1-x), r3=min(r1, h-1-(x-l1));
			if(l3<=r3){
				c=count(l3, r3, l2, l2);
			}
		}
		ret=max(ret, solve(l1, r1, l2+1, r2)+c);
	}
	if(x<r1){
		int c=0;
		if(r1+(x-l1)<=h-1){
			int l3=max(l2, r2-y), r3=min(r2, w-1-(y-l2));
			if(l3<=r3){
				c=count(r1, r1, l3, r3);
			}
		}
		ret=max(ret, solve(l1, r1-1, l2, r2)+c);
	}
	if(y<r2){
		int c=0;
		if(r2+(y-l2)<=w-1){
			int l3=max(l1, r1-x), r3=min(r1, h-1-(x-l1));
			if(l3<=r3){
				c=count(l3, r3, r2, r2);
			}
		}
		ret=max(ret, solve(l1, r1, l2, r2-1)+c);
	}
	return dp[l1][r1][l2][r2]=ret;
}
int main()
{
	cin>>h>>w;
	for(int i=0; i<h; i++) cin>>a[i];
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(a[i][j]=='E') x=i, y=j;
			s[i+1][j+1]=s[i][j+1]+s[i+1][j]-s[i][j]+(a[i][j]=='o');
		}
	}
	for(int i=0; i<=x; i++){
		for(int j=x; j<h; j++){
			for(int k=0; k<=y; k++){
				for(int l=y; l<w; l++){
					dp[i][j][k][l]=-1;
				}
			}
		}
	}
	cout<<solve(0, h-1, 0, w-1)<<endl;
	return 0;
}

Measured memory_bytes: 192896
//...Bismillahir Rahmanir Rahim...
// Code by    Asad Bin Saber

#include <bits/stdc++.h>

using namespace std;

// typedefs...
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;

// constants...
const double PI = acos(-1);

// defines...
#define MP make_pair
#define PB push_back
#define fi first
#define se second
#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sl(a) scanf("%lld", &a)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)

ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
ll lcm(ll a, ll b)
{
    return (a/gcd(a, b)*b);
}
ll comb(ll a, ll b)
{
    ll x = max(a-b, b), ans=1;

    for(ll K=a, L=1; K>=x+1; K--, L++){
        ans *= K;
        ans /= L;
    }

    return ans;
}


void task()
{
    //code here...
    
    ll a, b, c, k, ans;
    
    cin >> a >> b >> c >> k;
    
    ans = min(a, k);
    k -= ans;
    
    if(k>0){
		a = min(b, k);
		k -= a;
	}
	
	if(k>0){
		a = min(k, c);
		k -= a;
		ans -= a;
	}
	
	cout << ans << "\n";
}
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    task();

    return 0;
}



Measured memory_bytes: 3552
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2020-02-22 18:58:22
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

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

    int x = s.length();
    for (int i = 0; i < x; i++)
        cout << "x";
    cout << endl;

    return 0;
}


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

using namespace std;

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

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  string s;
  int ans=0;
  cin>>ans;
  while(1){
    cin>>s;
    if(s=="=")break;
    cin>>n;
    if(s=="+")ans+=n;
    if(s=="-")ans-=n;
    if(s=="*")ans*=n;
    if(s=="/")ans/=n;
  }
  cout<<ans<<endl;
}

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

typedef long long ll;
#define pii pair<int ,int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005


int main()
{
    _FastIO;
    string s;
    string t;
    cin >> s;
    cin >> t;
    int n = t.size();
    while(n){
        if(t == s){
            cout << "Yes" << endl;
            return 0;
        }
        t += t[0];
        t.erase(t.begin());
        n--;
    }
    if(t == s){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
 
using namespace std;
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define ll long long

const int MOD = 1e9 + 7;

int main()
{
    string s;
    cin >> s;
    s[5] = ' ';
    s[13] = ' ';
    cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main()
{
  string s;
  cin >> s;
  if (s == "Sunny") cout << "Cloudy" << endl;
  if (s == "Cloudy") cout << "Rainy" << endl;
  if (s == "Rainy") cout << "Sunny" << endl;
  return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn.readInt
import scala.collection.mutable.ArrayBuffer

object Main {
  val c = Math.cos(Math.PI/3)
  val s = Math.sin(Math.PI/3)

  def getPoints(list:Array[(Double,Double)],i:Int):Array[(Double,Double)]  =
    if(i==0) list
    else {
      val b = new ArrayBuffer[(Double,Double)]
      for( k<-0 until list.length-1) {
        val i = list(k); val j = list(k+1)
        val p1 = ((i._1*2+j._1)/3,(i._2*2+j._2)/3)
        val p2 = ((i._1+j._1*2)/3,(i._2+j._2*2)/3)
        val (dx,dy) = (p2._1-p1._1,p2._2-p1._2)
        if(k==0) b+=i
        b+=(p1,(dx*c-dy*s+p1._1,dx*s+dy*c+p1._2),p2,j)
      }
      getPoints(b.toArray,i-1)
    }

  def main(args:Array[String]) = {
    val n = readInt
    val list = getPoints(Array((0D,0D),(100D,0D)),n)
    println(list.map(s=>s._1+" "+s._2).mkString("\n"))
  }
}

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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define trav(a, x) for (auto& a : x)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;
#define INF (1ll<<60)

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int N, M;
    cin >> N >> M;
    vector<PII> A(N);
    REP(i, N) {
        cin >> A[i].first;
        cin >> A[i].second;
    }
    sort(all(A));
    int sum = 0;
    int idx = 0;
    multiset<int> S;
    FOR(i, 1, M) {
        while (idx < N && A[idx].first <= i) {
            S.insert(A[idx].second);
            idx++;
        }
        if (S.empty()) continue;
        auto it = prev(S.end());
        sum += *it;
        S.erase(it);
    }
    cout << sum << endl;
}

Measured memory_bytes: 5632
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using ll = int64_t;
#define MAX_N 1010
#define MAX_M 100010
const long long mod = pow(10,9)+7;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecBvec vector<vector<bool>>
#define vecst vector<string>
#define veche vector<char>
#define vecd vector<double>
#define vecvec vector<vector<int>>
#define vecDvec vector<vector<double>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
#define ent cout<<endl
#define printvec(vec) for(int aqw=0;aqw<vec.size();aqw++){cout<<vec[aqw]<<" ";}ent;
#define rep1(n) for(ll i = 0; i < (n); ++i)
#define rep2(i, n) for(ll i = 0; i < (n); ++i)
#define rep3(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep4(i, a, b, c) for(ll i = (a); i < (b); i += (c))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define INF 1e+9
#define print(x) cout<<x<<endl;
using P = pair<int, int>;
#define PLL pair<ll, ll>;
#define MAX_V 10010
#define PI 3.141592653589793
#define vecP vector<P>
 //cout << setprecision(15) << std::fixed;

int main() {
    int n;
    cin >> n;
    print(n / 2 + n % 2);

}



Measured memory_bytes: 256
a, b = map(int, input().split())
a -= 1
b -= 1
ans = [["#" for _ in range(90)] for _ in range(40)] + [["." for _ in range(90)] for _ in range(40)]
pos = 0
for i in range(a):
    x = pos % 90
    y = (pos // 90) * 2
    ans[y][x] = "."
    pos += 2

pos = 0
for j in range(b):
    x = pos % 90
    y = 45 +  (pos // 90) * 2
    ans[y][x] = "#"
    pos += 2
    
print(80, 90)
for row in ans:
    print("".join(row))
    

Measured memory_bytes: 64148
#include <bits/stdc++.h>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define NMAX 52
using namespace std;
int N, x, y, i, j, guess, sol = -1, K;
char culori[3] = "BR";
string innput;
char s[201];
int intervalQuerry(int left, int right) {
    cout << '?' << ' ';
    for (int i = left; i <= right; ++i) cout << i << ' ';
    cout << endl;
    cin >> innput;
    return (innput == "Red");
}
int main() {
    cin >> N;
    if (N == 1) {
        cout << "? 1" << endl;
        cin >> innput;
        int x = (innput == "Red");
        cout << "! " << culori[x] << culori[1 - x];
        cout << endl;
        return 0;
    }
    s[2 * N + 1] = s[0] = '\0';
    int sign = intervalQuerry(1, N);
    int left = 1, right = N + 1;
    while (left <= right) {
        int mid = (left + right) / 2;
        if (right == left + 1) {
            s[left] = culori[sign];
            s[right + N - 1] = culori[1 - sign];
            break;
        }
        int res = intervalQuerry(mid, mid + N - 1);
        if (res == sign) {
            left = mid;
        }
        else {
            right = mid;
        }
    }
    for (int i = 1; i <= 2 * N; ++i) {
        if (i >= left && i < right + N) continue;
        cout << "? ";
        for (int j = right; j < right + N - 1; ++j) cout << j << ' ';
        cout << i << ' ';
        cout << endl;
        cin >> innput;
        x = (innput == "Red");
        s[i] = culori[x];
    }
    for (int i = right; i < right + N - 1; ++i) {
        cout << "? ";
        for (int j = 1; j < left; ++j) cout << j << ' ';
        for (int j = right + N; j <= 2 * N; ++j) cout << j << ' ';
        cout << i << ' ';
        cout << endl;
        cin >> innput;
        x = (innput == "Red");
        s[i] = culori[x];
    }
    cout << "! " << s + 1 << endl;
    return 0;
}


Measured memory_bytes: 724
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mod = 998244353;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<ll> vec){ //for debug
    ll n = vec.size();
    cout << "------------------------------------\n" ;
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
    cout << "------------------------------------\n" ;
}

void pr2d(vector<vector<ll>> vec){ // for debug
    ll h = vec.size();
    ll w = vec.at(0).size();
    cout << "------------------------------------\n" ;
    rep(i,h){
        rep(j,w){
            cout << vec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
    cout << "------------------------------------\n" ;
}

ll f(ll x, ll y){ //x以下の整数のうち、yで割り切れるものの数
    x -= x%y;
    return x/y;
}

ll lcm(ll x,ll y){
    return x*y/__gcd(x,y);
}

int main(){
    ll a,b,c,d; cin >> a >> b >> c >> d;
    ll e = lcm(c,d);
    cout << b-a+1-(f(b,c) + f(b,d) - f(b,e)) + (f(a-1,c) + f(a-1,d) - f(a-1,e)); 
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
import java.util.TreeMap;
import java.math.*;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
    int n = sc.nextInt();
    long sum = 0;
    TreeMap<Long,Long> counters = new TreeMap<>();
    counters.put((long)0,(long)1);
    long count = 0;

    for(int i = 0; i < n; i++){
      sum += sc.nextInt();
      if(counters.containsKey(sum)){
        long nowcount = counters.get(sum);
        count += nowcount;
        counters.remove(sum);
        counters.put(sum, nowcount + 1);
      }else{
        counters.put(sum, (long)1);
      }
    }

    System.out.println(count);
   
 
  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

Measured memory_bytes: 52128
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main()
{
   string a;
   cin >> a;
   long long sum = 0;
   for(int i = 0; i < a.length(); i++)
   {
        sum += a[i]-'0';
        sum %= 9;
   }
   if(sum % 9 == 0)
   {
       cout << "Yes" << endl;
   }
   else 
   cout << "No" << endl;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */

size_t task2()
{
    size_t n;
    cin >> n;
    vector<size_t> a(n);
    cin >> a;
    -- a;

    size_t out = 0;
    for(size_t i = 0; i < n; ++ i)
        out += a[a[i]] == i;

    return out >> 1;
}

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

    return EXIT_SUCCESS;
}


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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

const string MINUSINF = "-";

void chmax(string &a, string b) {
	if (a == MINUSINF
		|| a.size() < b.size()
		|| (a.size() == b.size() && a < b)
	) {
		a = b;
	}
}

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

	int n, m;
	cin >> n >> m;

	vector<int> a(m);
	for (auto &v : a) {
		cin >> v;
	}

	vector<ll> match = { 2,5,5,4,5,6,3,7,6 };
	vector<string> dp(11000, MINUSINF);
	dp[0] = "";
	for (int i = 0; i <= n; i++) {
		if (dp[i] == MINUSINF) {
			continue;
		}
		for (auto v : a) {
			chmax(dp[i + match[v - 1]], dp[i] + (char)('0' + v));
		}
	}

	cout << dp[n] << endl;
	return 0;
}


Measured memory_bytes: 43776
MOD = 998244353


def solve(lr, dp, n):
    acc_dp = [1] * n
    for i in range(1, n):
        val = 0
        for d in lr:
            a = i - d[0]
            if a < 0:
                continue
            b = i - d[1] - 1
            val += acc_dp[a] - (acc_dp[b] if b >= 0 else 0)
        dp[i] = val % MOD
        acc_dp[i] = (acc_dp[i - 1] + dp[i]) % MOD
    return dp[n - 1]


def main():
    f = open(0)
    n, k = [int(x) for x in f.readline().split()]
    lr = [[int(x) for x in f.readline().split()] for _ in range(k)]
    dp = [0] * n
    dp[0] = 1
    ans = solve(lr, dp, n)
    print(ans)

main()


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

int main(){
  long long a,b,n,x,ans;
  cin>>a>>b>>n;
  if(n<=b){
    if(n==b)
      x=n-1;
    else
    	x=n;
    
    ans=floor(a*x/b)-(a*floor(x/b));
  }
  else
  {
    x=b-1;
    long case1=floor(a*x/b)-(a*floor(x/b));
    
    x=n;
    long case2=floor(a*x/b)-(a*floor(x/b));
    ans=(case1>case2?case1:case2);
  }
  cout<<ans;

return 0;
}

Measured memory_bytes: 3636