akhauriyash/Code-Regression huggingface dataset:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

a,b= map(int, input().split())


# xが１０円から１００００円まで

ans = -1

for i in range(10,10001):
    a1 = int(i*0.08)
    b1 = int(i*0.1)
    #print(a1,b1)
    if (a1 == a and b1 == b):
        ans = i
        break
print(ans)


Measured memory_bytes: 9172
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int gcd(int a,int b) { return b ? gcd(b,a%b) : a;}
int lcm(int a,int b) { return a/gcd(a,b)*b;}
void printb(unsigned int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}
void putb(unsigned int v) {putchar('0'), putchar('b'), printb(v), putchar('\n');}
#define ALL(W) (W).begin(),(W).end()

signed main(){
  int X,Y,ans=0;
  cin >> X >> Y;
  while(X<=Y){
    X*=2;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <vector>
#include <string>
using namespace std;
int main(){

	long int n, k, r, s, p; cin >> n >> k >> r >> s >> p;
	string t; cin >> t;

	int sum = 0; char te[100100];
	for (long int i = 0; i < n; i++) {
		switch (t[i]) {
		case 'r':
			te[i] = 'p';; break;
		case 's':
			te[i] = 'r'; break;
		case 'p':
			te[i] = 's'; break;
		}
		if (i >= k && i >= n - k && te[i] == te[i - k]) { continue;}
		if (i >= k && te[i] == te[i - k]) {
			switch (t[i]) {
			case 'r':
				if (t[i + k] == 's') { te[i] = 's'; }
				else { te[i] = t[i]; }
				break;
			case 's':
				if (t[i + k] == 'p') { te[i] = 'p'; }
				else { te[i] = t[i]; }
				break;
			case 'p':
				if (t[i + k] == 'r') { te[i] = 'r'; }
				else { te[i] = t[i]; }
				break;			
			}
			continue;
		}

		switch (t[i]) {
		case 'r':
			sum += p; break;
		case 's':
			sum += r; break;
		case 'p':
			sum += s; break;
		}
		//cout << sum << endl;
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 512
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseFloat(x::SubString{String}) = parse(Float64, x)
parseFloat(x::Char) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    a=parseMap(split(readline()))
    num=Vector{Int}()
    for i in a
        push!(num,i+1,i,i-1)
    end
    sort!(num)
    ans=0
    cnt=1
    for i in 2:3n+1
        if i==3n+1 || num[i]!=num[i-1]
            ans=max(ans,cnt)
            cnt=1
        else
            cnt+=1
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 132832
using System;
using System.Text;
    class Program
    {
        static void Main(string[] args)
        {
            var inputS = new StringBuilder(Console.ReadLine());

            StringBuilder newS = inputS;
            newS = newS.Replace('1', '#');
            newS = newS.Replace('9', '$');
            newS = newS.Replace('#', '9');
            newS = newS.Replace('$', '1');

            Console.WriteLine(newS);
        }
    }

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

long long a, b, c, d;

int main() {
  cin >> a >> b >> c >> d;
  long long res = a * c;
  if (a <= 0 && 0 <= b) res = max(res, 0LL);
  if (c <= 0 && 0 <= d) res = max(res, 0LL);
  res = max(res, b * d);
  res = max(res, a * c);
  res = max(res, a * d);
  res = max(res, b * c);
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int a,b;
	
	cin>>a>>b;
	
	if(a<b){
		cout<<"a < b"<<endl;
	}
	else if(a>b){
		cout<<"a > b"<<endl;
	}
	else{
		cout<<"a == b"<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3092
#pragma comment(linker, "/STACK:640000000")
#include <bits/stdc++.h>

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define ll long long
#define bit __builtin_popcountll
#define sqr(x) (x) * (x)
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)

using namespace std;

typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);

const int maxn = (int)2e5 + 10;

int a[maxn];

int main() {
	#ifdef LOCAL
	freopen("a.in", "r", stdin);
	freopen("a.out", "w", stdout);
	#endif

	vector<pii> v;

	int n; scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		int x; scanf("%d", &x);
		v.pb(mp(x, i));
	}

	sort(all(v));

	int m = n / 2 - 1;

	for (int i = 0; i < n; i++) {
		if (i <= m) {
			a[v[i].second] = v[m + 1].first;
		} else {
			a[v[i].second] = v[m].first;
		}
	}

	for (int i = 0; i < n; i++) {
		printf("%d\n", a[i]);
	}

	return 0;
}

Measured memory_bytes: 4720
#include<stdio.h>
int main(){
	 long long w,h,x,y;
	double s;
	int t;
	while(~scanf("%lld%lld%lld%lld",&w,&h,&x,&y))
	{
		t=0;
		s=(double)w*(double)h/2;
		if(w%2==0&&h%2==0&&x==w/2&&y==h/2)
		t=1;
		printf("%.6lf %d\n",s,t);
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int sum,i;
    while(1){
        int name,price,kazu,head=0,sign=0,line[2000]={0};
    scanf("%d",&sum);
    if(sum == 0)
        break;
    for(i=0;i<head;i++){
        line[i]=0;
    }
    while(sum){
        scanf("%d %d %d",&name,&price,&kazu);
        for(i=0;i<head;i+=2){
            if(line[i] == name){
                line[i+1]+=price*kazu;
                sign=1;
            }
        }
        if(sign == 0){
            line[head]=name;
            line[head+1]=price*kazu;
            head+=2;
        }
        sum--;
        sign=0;
    }
        for(i=0;i<head;i+=2){
            if(line[i+1] >= 1000000){
                printf("%d\n",line[i]);
                sign=1;
            }
        }
        if(sign == 0)
            printf("NA\n");
        head=0;
    }
    return 0;
}

Measured memory_bytes: 616
using System;

namespace aizu
{
    class OnlineJudge
    {
        static void Main()
        {
            string input;
            while((input = Console.ReadLine()) != null) {
                int[] count = { 0, 0 };
                for(int i = 0; i < input.Length - 2; ++i) {
                    string word = input.Substring(i, 3);
                    if(word.CompareTo("JOI") == 0) {
                        ++count[0];
                        ++i;
                    }
                    else if(word.CompareTo("IOI") == 0) {
                        ++count[1];
                        ++i;
                    }
                }
                Console.WriteLine(count[0]);
                Console.WriteLine(count[1]);
            }
        }
    }
}

Measured memory_bytes: 6380
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;//例: VVI dp(10, vector<int>(10, INF);
typedef priority_queue<int, vector<int>, less<int> > QUE_int;
const int INF = 2 * pow(10, 9) + 1;//+1しないとREになるかも(out of rangeになるんかな?? )

vector<int> dx = { -1, 0, 1, 0, -1, -1, 1, 1 };
vector<int> dy = { 0, -1, 0, 1, -1, 1, -1, 1 };

ll max(ll a, ll b) { return (a > b) ? a : b; }
ll min(ll a, ll b) { return (a < b) ? a : b; }
ll chmax(ll &a, ll b){ return a = (a>b) ? a : b;}
ll chmin(ll &a, ll b){ return a = (a<b) ? a : b;}


////////////////////////////////////////////////////////////////
#define PI 3.14159265359
int main(void) {
	int N;
	cin >> N;
	vector<int> h(N+5, 0);
	for(int i=0; i<N; i++) cin >> h[i];

	vector<ll> dp(N+5, INF);
	dp[0] = 0;// dp[i]: 足場iに行くのにかかる最小コスト

	for(int i=0; i<=N; i++){
		//chmin(dp[i+1], dp[i]+abs(h[i+1]-h[i]));
		//chmin(dp[i+2], dp[i]+abs(h[i+2]-h[i]));
		dp[i+1] = min(dp[i+1], dp[i]+abs(h[i+1]-h[i]));//chmin(dp[i+1], dp[i]+abs(h[i+1]-h[i]));
		dp[i+2] = min(dp[i+2], dp[i]+abs(h[i+2]-h[i]));//chmin(dp[i+2], dp[i]+abs(h[i+2]-h[i]));
	}

	cout << dp[N-1] << endl;


}



Measured memory_bytes: 1408
while True:
    a, op, b = input().split()   
    a =int(a)                  
    b = int(b)              


    if op=="?": 
        break
    elif op=="+": print(a+b)
    elif op=="-": print(a-b)
    elif op=="*": print(a*b)
    else: print(a//b)
        


Measured memory_bytes: 5596
#include<iostream>
#include<string.h>
using namespace std;
int main(void){
	int roop = 0;
	int c[10000];
	cin >> c[roop];
	while(c[roop]){
		roop++;
		cin >> c[roop];
	}
	for(int i=0;i<roop;i++){
		cout << "Case " << i+1 << ": " << c[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3068
n = io.read("*n")
v1 = {}
v2 = {}
for i = 1, n do
	x = io.read("*n")
	if i % 2 == 1 then
		v1[x] = v1[x] and v1[x]+1 or 1
	else
		v2[x] = v2[x] and v2[x]+1 or 1
	end
end

v1[-1] = 0
v2[-1] = 0
s1 = {}
s2 = {}
for k, v in pairs(v1) do
	s1[#s1+1] = {k, v}
end
for k, v in pairs(v2) do
	s2[#s2+1] = {k, v}
end
table.sort(s1, function(a, b) return a[2] > b[2] end)
table.sort(s2, function(a, b) return a[2] > b[2] end)
-- print_r(s1)
-- print_r(s2)

if s1[1][1] ~= s2[1][1] then
	print(n - s1[1][2] - s2[1][2])
else
	print(n - math.max(s1[1][2]+s2[2][2], s1[2][2]+s2[1][2]))
end

Measured memory_bytes: 17368
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <iterator>
#include <numeric>
#include <cstdint>
#include <cmath>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )

using namespace std;

int main()
{
  uint64_t N, K;
  cin >> N >> K;
  
  vector<uint64_t> A(N);
  N_TIMES(n, N) { cin >> A[n]; --A[n]; }

  uint64_t pos = 0, loop_start = -1;
  set<uint64_t> visited;
  vector<uint64_t> B;
  while (true) {
    visited.insert(pos);
    B.push_back(pos);

    pos = A[pos];
    if (visited.find(pos) != visited.end()) {
      loop_start = pos;
      break;
    }
  }

  uint64_t length_straight = 0;
  N_TIMES(i, B.size()) {
    if (B[i] == loop_start) { break; }
    ++length_straight;
  }

  uint64_t length_loop = B.size() - length_straight;
  
  if (K < length_straight) {
    cout << (B[K] + 1) << endl;
  } else {
    uint64_t P = (K - length_straight) % length_loop;
    uint64_t Q = P + length_straight;
    cout << (B[Q] + 1) << endl;
  }

  return 0;
}

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

int64_t solve() {
    int64_t N, X, M;
    cin >> N >> X >> M;
    int64_t ans = 0;
    map<int64_t, int> mp;
    vector<int64_t> A(M + 1);
    int L = -1;
    rep(i, min(N, M)) {
        A[i] = X;
        if(mp.find(X) != mp.end()) L = i - mp[X];
        mp[X] = i;
        ans += X;
        X = X * X % M;
    }
    if(N <= M || L == -1) return ans;
    N -= M;
    int64_t roop = N / L;
    int64_t move = N % L;
    vector<int64_t> dp(L + 1);
    rep(i, L) dp[i + 1] = A[M - L + i];
    rep(i, L) dp[i + 1] += dp[i];
    ans += dp[L] * roop + dp[move];
    return ans;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << solve() << '\n';
}


Measured memory_bytes: 7296
import java.util.Arrays;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] a = new long[N];
		for (int i = 0; i < N; i++) {
			a[i] = sc.nextLong();
		}

		long count = 0;
		while (true) {
			long d = 0;
			for (int i = 0; i < N; i++) {
				d = a[i] / N;
				a[i]=a[i]%N;
				count += d;
				if (d == 0)
					continue;
				for (int j = 0; j < N; j++) {
					if(i==j)
							continue;
					a[j]+=d;
				}
			}

			Arrays.sort(a);
			if (a[N - 1] < N)
				break;

		}
		System.out.println(count);
	}

}

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

string s,t;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>s>>t;
	sort(s.begin(), s.end()); sort(t.rbegin(), t.rend());
	if(s < t)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>
#include <cmath>
#include <deque>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
using mpint = mp::cpp_int;  // 多倍長整数（任意精度）

/*
 * 定数
 */
const long double PI = (acos(-1));
const long double EPS = 1e-10;
const long long INF = 1e18;

/*
 * データ変換 
 */
/* char -> int */
int ctoi(char c) { return (int)(c - '0'); }

/*
 * 数学的な計算
 */
/* 階乗 */
int factorial(int n) {
  int ret = 1;
  for (int i = 1; i < n + 1; ++i) {
    ret = ret * i;
  }
  return ret;
}

/* 最大公約数 */
template <typename T>
T gcd(T x, T y) { return x % y == 0 ? y : gcd(y, x % y); }

/* 最小公倍数 */
template <typename T>
T lcm(T a, T b) { return a * b / gcd(a, b); }

/* n個の整数の最小公倍数 */
template <typename T>
T lcm_n(vector<T> &numbers) {
  T l;
  l = numbers[0];
  for (int i = 1; i < numbers.size(); ++i) {
    l = lcm(l, numbers[i]);
  }
  return l;
}

/*
 * DP向け
 */
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

/*
 * グラフ
 */
class Graph {
 public:
  vector<vector<int>> G;
  vector<int> Trans;
  vector<int> inDeg;
  int numV;

  Graph(int numV) {
    this->numV = numV;
    inDeg.assign(numV, 0);
    Trans.assign(numV, 0);
    G.assign(numV, vector<int>());
  }

  int topologicalSort(int v, vector<int> &dp) {
    if (dp[v] != -1) {
      return dp[v];
    }

    int res = 0;

    for (auto to : G[v]) {
      chmax(res, topologicalSort(to, dp) + 1);
    }

    return dp[v] = res;
  }
};

int main() {
  string S, T;
  cin >> S >> T;

  vector<int> sv(S.length());
  vector<int> tv(T.length());
  map<char, int> smap;
  map<char, int> tmap;

  for (int i = 0; i < S.length(); ++i) {
    if (smap.count(S[i]) == 0) {
      smap[S[i]] = smap.size();
    }

    sv[i] = smap[S[i]];
  }

  for (int i = 0; i < T.length(); ++i) {
    if (tmap.count(T[i]) == 0) {
      tmap[T[i]] = tmap.size();
    }

    tv[i] = tmap[T[i]];
  }

  cout << (sv == tv ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 5404
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

int main()
{
    int A,B,C;
    cin >> A >> B >> C;
    if(A+B>=C) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
N,M=map(int,input().split())
edge=[]
for i in range(M):
    a,b,c=map(int,input().split())
    edge.append([a-1,b-1,-c])
inf=10**30
dist=[inf]*N
dist[0]=0
for i in range(N+1):
    for x,y,z in edge:
        if dist[y]<= dist[x]+z:
            continue
        dist[y]=dist[x]+z
        if i==N and y==N-1:
            print('inf')
            sys.exit()
print(-dist[N-1])


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

constexpr int kNumContests = 26;

template<typename T>
vector<vector<T>> Make2DVector(int d1, int d2, T default_value) {
  return vector<vector<T>>(d1, vector<T>(d2, default_value));
}

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

  int num_days;
  cin >> num_days;
  vector<int64> costs(kNumContests);
  for (int i = 0; i < kNumContests; i++) {
    cin >> costs[i];
  }

  auto score_table = Make2DVector(num_days, kNumContests, 0LL);
  for (int d = 0; d < num_days; d++) {
    for (int c = 0; c < kNumContests; c++) {
      cin >> score_table[d][c];
    }
  }

  vector<int> ls(kNumContests, -1);
  for (int d = 0; d < num_days; d++) {
    int64 max_score = INT64_MIN;
    int max_c = -1;
    for (int c = 0; c < kNumContests; c++) {
      int64 score = score_table[d][c] + (d - ls[c]) * costs[c] * 26;
      if (max_score < score) {
        max_score = score;
        max_c = c;
      }
    }

    ls[max_c] = d;

    cout << (max_c + 1) << endl;
  }
}

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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<(b)?(a=b,1):0)
#define chmin(a,b) (a>(b)?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
const int INF = 1<<29;
const double EPS = 1e-8;
const double PI = acos(-1);
typedef pair<int,int> pii;
typedef long long ll;


char str[3][100001];
char ans[100001];

bool check(int pair[3], int dist, int same, int dif[3]) {
  // cout << "pair : "; REP(i,3) cout << pair[i] << ","; cout << endl;
  // cout << "dist : " << dist << endl;
  // cout << "same : " << same << endl;
  // cout << "dif : "; REP(i,3) cout << dif[i] << ","; cout << endl;
  int u[3];
  int sum = 0;
  REP(i,3) {
    // dist-x<=dif[i]-pair[i]
    // x >= dist  - (dif[i]-pair[i])
    u[i] = max(0, dist-(dif[i]-pair[i]));
    sum += u[i];
  }
  if (sum<=dist) return 1;
  REP(i,3) {
    int j = (i+1)%3;
    int k = (i+2)%3;
    if (u[j]==0 && u[k]==0) {
      int r = min(pair[i], min(dif[j]-pair[j]-dist, dif[k]-pair[k]-dist));
      if (sum-r <= dist) return 1;
    }
  }
  return 0;
}

int main() {
  int l,d;
  while(cin >> l >> d, l||d) {
    int pair[3] = {};
    int dist = 0;
    int same = 0;
    REP(i,3) scanf("%s",str[i]);
    REP(i,l) {
      char c[3] = {str[0][i],str[1][i],str[2][i]};
      if (c[0]==c[1]&&c[1]==c[2]) {
        same++;
      } else {
        bool ok = 0;
        REP(j,3) {
          if (c[(j+1)%3]==c[(j+2)%3]) {
            ok = 1;
            pair[j]++;
          }
        }
        if (!ok) {
          dist++;
        }
      }
    }

    bool ok = 0;
    int dif[3] = {d,d,d};
    REP(i,l) {
      char c[3] = {str[0][i],str[1][i],str[2][i]};
      char cand[4] = {'A',c[0],c[1],c[2]};
      sort(cand,cand+4);
      
      if (c[0]==c[1]&&c[1]==c[2]) {
        same--;
      } else {
        bool ok = 0;
        REP(j,3) {
          if (c[(j+1)%3]==c[(j+2)%3]) {
            ok = 1;
            pair[j]--;
          }
        }
        if (!ok) {
          dist--;
        }
      }

      ok = 0;
      REP(j,4) {
        REP(k,3) {
          if (c[k]!=cand[j]) {
            dif[k]--;
          }
        }

        if (check(pair,dist,same,dif)) {
          ans[i] = cand[j];
          ok = 1;
          break;
        }
        
        REP(k,3) {
          if (c[k]!=cand[j]) {
            dif[k]++;
          }
        }
        
      }
      if (!ok) break;
    }
    if (!ok) cout << -1 << endl;
    else {
      ans[l] = 0;
      cout << ans << endl;
    }
  }
}

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

int main(){
  int w,h,n;
  int out=0,in=0,sum=0;
  cin >> w >> h >>n;
  int str[n];
  for(int i=0; i<n; ++i)cin >> str[i];
  for(auto i: str){
    if(i){++in;}else{++out;}
    if(out<=w-2 && out==in)++sum;
    else if(out>=w && out<= w+h-3 && out-in==2)++sum;
    else if(out >= w+h-1 && out-in==4)++sum;
  }
  cout << sum << endl;
}



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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;

void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    int a; string s;
    cin >> a >> s;
    if(a >= 3200)
        cout << s;
    else cout << "red";
    return 0;
}


Measured memory_bytes: 256
<?php

function input() {
    return trim(fgets(STDIN));
}
function input_array() {
    return explode(' ', input());
}

list($n, $m) = array_map(function($numeric_string) {
    return (int)$numeric_string;
}, input_array());
for ($i = 0; $i < $n; $i++) {
    $prefectures[$i] = [];
}
for ($i = 0; $i < $m; $i++) {
    list($prefecture, $year) = input_array();
    $cities[$i] = ['prefecture' => $prefecture, 'year' => $year];
    $prefectures[$prefecture][] = ['city' => $i, 'year' => $year];
}

foreach ($prefectures as &$prefecture) {
    usort($prefecture, function($a, $b) {
        return $a['year'] <=> $b['year'];
    });
    array_values($prefecture);
    foreach ($prefecture as $key => $city) {
        $cities[$city['city']]['number'] = $key + 1;
    }
}

foreach ($cities as $city) {
    echo str_pad($city['prefecture'], 6, '0', STR_PAD_LEFT) . str_pad($city['number'], 6, '0', STR_PAD_LEFT) . "\n";
}

Measured memory_bytes: 133232
#include<stdio.h>
int main(){
  char s[127];
  int a,n,i,j;
  while(scanf("%s",s)!=EOF){
    for(i=0;i<10;i++){
      a=-1;
      for(j=n=0;s[j];j++){
	if('0'<=s[j]&&s[j]<='9'){
	  n*=10;
	  n+=s[j]-'0';
	}
	if(s[j]=='X'){
	  if(n==0&&i==0&&(('0'<=s[j+1]&&s[j+1]<='9')||s[j+1]=='X'))break;
	  n*=10;
	  n+=i;
	}
	if(s[j]=='+'){
	  a=n;
	  n=0;
	}
	if(s[j]=='='){
	  a+=n;
	  n=0;
	}
      }
      if(a==n)break;
    }
    if(i==10)printf("NA\n");
    else     printf("%d\n",i);
  }
  return 0;
}

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

const ll INF = 1e18;

ll dp[200005][4];

int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int k = 1+n%2;
  rep(i,n+1)rep(j,k+1) dp[i][j] = -INF;
  dp[0][0] = 0;
  rep(i,n) {
    rep(j,k+1) {
      chmax(dp[i+1][j+1], dp[i][j]);
      ll now = dp[i][j];
      if ((i+j)%2 == 0) now += a[i];
      chmax(dp[i+1][j], now);
    }
  }
  ll ans = dp[n][k];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 10380
#include <iostream>
#include <vector>
using namespace std;

int main()
{
    vector<vector<int>> ans;
    int H, W, N;
    cin >> W >> H >> N;
    for (int i = 0; i < H; i++)
    {
        vector<int> tmp;
        for (int j = 0; j < W; j++)
        {
            tmp.push_back(1);
        }
        ans.push_back(tmp);
    }

    for (int i = 0; i < N; i++)
    {
        int x, y, a;
        cin >> x >> y >> a;
        if (a == 1)
        {
            for (int j = 0; j < H; j++)
            {
                for (int k = 0; k < x; k++)
                {
                    ans[j][k] = 0;
                }
            }
        }
        else if (a == 2)
        {
            for (int j = 0; j < H; j++)
            {
                for (int k = x; k < W; k++)
                {
                    ans[j][k] = 0;
                }
            }
        }
        else if (a == 3)
        {
            for (int j = 0; j < y; j++)
            {
                for (int k = 0; k < W; k++)
                {
                    ans[j][k] = 0;
                }
            }
        }
        else
        {
            for (int j = y; j < H; j++)
            {
                for (int k = 0; k < W; k++)
                {
                    ans[j][k] = 0;
                }
            }
        }
    }

    int total = 0;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if (ans[i][j] == 1)
            {
                total++;
            }
        }
    }
    cout << total << endl;

    return 0;
}

Measured memory_bytes: 256
((input) => {
  const data = input.split('\n');
  const line1 = data[0].split(' ');
  const N = +line1[0];
  const D = +line1[1];
  const coords = data.slice(1, N + 1).map((line) => line.replace(/\s\s/g, ' ').split(' ').filter(Boolean).map(Number));
 
  console.log(
    coords.reduce((total, coord1, i) => (
      total + coords.slice(i + 1).reduce((count, coord2) => {
        const d = distance(coord1, coord2, D);
        const diff = Math.abs(Math.round(d) - d);
        return diff < 0.0001 ? count + 1 : count
      }, 0)
    ), 0)
  );
})(
  require("fs").readFileSync("/dev/stdin", "utf8")
);
 
function distance(coords1, coords2, D) {
  const diffs = Array(D).fill(null).map((_, i) => (
    coords1[i] - coords2[i]
  ));
  var max = Math.max.apply(null, diffs);

  if (max === 0) max = 1;
  
  var sum = 0;
  for (var i = 0; i < D; i += 1) {
    sum += Math.pow(diffs[i] / max, 2);
  }
  return Math.sqrt(sum) * max;
//  return Math.hypot.apply(null, Array(D).fill(null).map((_, i) => (
//    coords1[i] - coords2[i]
//)));
}


Measured memory_bytes: 7500
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = ll(1e9 + 7);
ll N, A, B, C, D;

ll dp[1010][1010];
ll fact[1010];
ll factinv[1010];
ll p[1010][1010];

ll modpow(ll x, ll y, ll m) {
	if(y == 0) return 1;
	ll res = modpow(x, y / 2, m);
	return res * res % m * (y & 1 ? x : 1) % m;
}

ll modinv(ll x, ll m) {
	return modpow(x, m - 2, m);
}

ll f(ll rem, ll g) {
	if(dp[rem][g] != -1) return dp[rem][g];
	if(rem == 0) return 1;
	if(g > B) return 0;
	if(g * C > rem) return 0;

	ll sum = 0;
	int r = rem;
	sum += f(r, g + 1);
	ll c = 1;
	for(int i = 1; i <= C; i++) {
		c = c * p[r][g] % MOD;
		r -= g;
	}
	for(int i = C; i <= D; i++) {
		sum = (sum + f(r, g + 1) * c  % MOD * factinv[i]) % MOD;

		c = c * p[r][g] % MOD;
		r -= g;
		if(r < 0) break;
	}
	return dp[rem][g] = sum;
}

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

	fact[0] = fact[1] = 1;
	for(int i = 2; i < 1010; i++) {
		fact[i] = fact[i - 1] * i % MOD;
	}
	for(int i = 0; i < 1010; i++) {
		factinv[i] = modinv(fact[i], MOD);
	}
	for(int i = 0; i <= 1000; i++) {
		for(int j = 0; j <= i; j++) {
			if(j == 0 || j == i)
				p[i][j] = 1;
			else
				p[i][j] = (p[i - 1][j - 1] + p[i - 1][j]) % MOD;
		}
	}

	cin >> N >> A >> B >> C >> D;
	memset(dp, -1, sizeof dp);
	cout << f(N, A) << endl;
}

Measured memory_bytes: 15232
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum = 0;
        int max = 0;
        for(int i = 0;i < n;i++){
            int price = sc.nextInt();
            sum += price;
            if(max < price)
            max = price;
        }
        System.out.println(sum-max/2);
    }
}

Measured memory_bytes: 23764
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	long long n = 0, e;
	string s; cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'p') {
			n++;
		}
	}
	cout << s.size() / 2 - n << endl;
	cin >> e;
}

Measured memory_bytes: 512
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        (wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

int n;
int m;
struct edge { int from, to, cost; };
struct edge2 { LL to, cost; };
typedef pair<int, int> PP;

vector<edge> e;
vector<edge2> G[4040];

int Par[100000];
int Rank[100000];

void init(int n) {
	for (int i = 0; i < n; i++) {
		Par[i] = i;
		Rank[i] = 0;
	}
}

int find(int x) {
	if (Par[x] == x) {
		return x;
	}
	else {
		return Par[x] = find(Par[x]);
	}
}

void unite(int  x, int y) {
	x = find(x);
	y = find(y);
	if (x == y) return;
	if (Rank[x] < Rank[y]) {
		Par[x] = y;
	}
	else {
		Par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}

// ソート時に比較するための関数 
bool comp(const edge& e1, const edge& e2) {
	return e1.cost < e2.cost;
}

LL kruskal() {
	init(n);
	sort(e.begin(), e.end(), comp);
	LL ans = 0;
	for (int i = 0; i < m; i++) {
		if (!same(e[i].from, e[i].to)) {
			unite(e[i].from, e[i].to);
			G[e[i].from].emplace_back(edge2{ e[i].to,e[i].cost });
			G[e[i].to].emplace_back(edge2{ e[i].from,e[i].cost });
			ans += e[i].cost;
		}
	}
	return ans;
}

LL ans[4040][4040];

int main() {
	cin >> n >> m;
	REP(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		e.emplace_back(edge{ a,b,c });
	}
	LL num = kruskal();
	REP(i, n) {
		stack<pair<int, int>> q;
		q.push(make_pair(i, -1));
		while (!q.empty()) {
			pair<int, int> cur = q.top();
			q.pop();
			REP(j, G[cur.first].size()) {
				if (G[cur.first][j].to != cur.second) {
					ans[i][G[cur.first][j].to] = max(ans[i][cur.first], G[cur.first][j].cost);
					q.push(make_pair(G[cur.first][j].to, cur.first));
				}
			}
		}
	}
	int q;
	cin >> q;
	REP(qqq, q) {
		int s, t;
		cin >> s >> t;
		s--, t--;
		cout << num - ans[s][t] << endl;
	}
}

Measured memory_bytes: 134508
N, Q = map(int, input().split())
S = input()
t= [0] * (N + 1)

for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)

for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])


Measured memory_bytes: 7748
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>

#include<stack>

using namespace std;

template < typename T > std::string to_string(const T& n)
{
	std::ostringstream stm;
	stm << n;
	return stm.str();
}

std::string ConvIntToStr(int checkNum)
{
	return to_string(checkNum);
}

int ConvStrToIntChar(const char c)
{
	if ('0' <= c && c <= '9') return (c - '0');
	return -1;
}

int ConvStrToInt(std::string checkStr)
{
	//const char *tmp = checkStr.c_str();
	//return ConvStrToIntChar(*tmp);
	return atoi(checkStr.c_str());
}


vector<string> SplitStr(const string& s, char delim) {
	vector<string> elems;
	stringstream ss(s);
	string item;
	while (getline(ss, item, delim))
	{
		if (!item.empty()) {
			elems.push_back(item);
		}
	}
	return elems;
}


string Calc(string a, string b, string kigou)
{
	if (kigou == "+")
	{
		return ConvIntToStr(ConvStrToInt(a) + ConvStrToInt(b));
	}
	if (kigou == "-")
	{
		return ConvIntToStr(ConvStrToInt(b) - ConvStrToInt(a));
	}
	if (kigou == "*")
	{
		return ConvIntToStr(ConvStrToInt(a) * ConvStrToInt(b));
	}
	return "";
}

int main() {

	string problem = "";
	getline(cin, problem);

	vector<string> vSplitStr = SplitStr(problem, ' ');

	stack<string> vStack;
	while (vStack.size() != 1)
	{

		for (int i = 0; i < vSplitStr.size(); ++i)
		{
			if (vSplitStr[i] == "+" || vSplitStr[i] == "-" || vSplitStr[i] == "*")
			{
				// いずれかの数式記号だった
				string a = vStack.top();
				vStack.pop();
				string b = vStack.top();
				vStack.pop();
				string tmp = Calc(a, b, vSplitStr[i]);
				vStack.push(tmp);
			}
			else
			{
				// 数値
				vStack.push(vSplitStr[i]);
			}
		}
	}

	cout << vStack.top() << endl;
	return 0;
}



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

int main() {
    char s[27];
    cin >> s;

    int p[256] = {};
    int k = strlen(s);
    for (int i = 0; i < k; i++) {
        if (p[s[i]]++ > 0) {
            cout << "no" << endl;
            quick_exit(0);
        }
    }
    cout << "yes" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ins insert
#define IOS ios::sync_with_stdio(false);
using namespace std;
int main()
{
	IOS
    int a,b,t;
    while(cin>>a>>b>>t)
    {
        cout << (t/a)*b<<endl;
    }
    return 0;
}



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


int main(){
    int x;
    cin >> x;
    int n = 200000;
    vector<int> seive(200001);
    for(int i=2; i*i<=n; i++){
        int cnt = 2;
        while(i*cnt <= n){
            seive[i*cnt]++;
            cnt++;
        }
    }
    vector<int> prime;
    for(int i=2; i<n; i++){
        if(seive[i]==0) prime.push_back(i);
    }
    auto itr = lower_bound(prime.begin(),prime.end(),x);
    cout << *itr << endl;
    return 0;
}

Measured memory_bytes: 4324
import std.stdio, std.conv, std.string, std.algorithm,
       std.math, std.array, std.container, std.typecons;

void main() {
  readln;
  string s = readln.chomp;
  int count=0;
  for(int i=0; i<s.length-2; i++) {
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') count++;
  }
  writeln(count);
}



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

int main(){

  int N,K,num,ini=3,j=2;
  cin >> N >> K;
  if(K>(N-1)*(N-2)/2){
    cout << "-1" << endl;
    return 0;
  }
  num = (N-1)+(N-1)*(N-2)/2-K;
  cout << num << endl;
  for(int i=2; i<=N; i++){
    cout << "1" << " " << i << endl;
  }
  num -= (N-1);
  for(int i=ini; i<=N; i++){
    if(num==0) break;
    cout << j << " " << i << endl;
    num--;
    if(i==N){
      j++;
      i = ini;
      ini++;
    }
  }
  return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
t = dict()
account,pena = 0,0
for i in range(m):
	s = input().split()
	if not s[0] in t.keys():
		t[s[0]] = s[1]
	else:
		if t[s[0]][-2::] == 'WA':
			t[s[0]] += s[1]
for j in t.values():
	if j[-2::] == 'AC':
		account += 1
		pena += j.count('WA')
print(account,pena)


Measured memory_bytes: 21988
h,n = map(int,input().split())
a=[0]*n
b=[0]*n

MAX_HP = 10**4
MAX_HP = h
for i in range(n):
  ta,tb = map(int,input().split())
  a[i] = ta
  b[i] = tb

INF = 10**9

dp = [[INF]*(h+1) for _ in range(n+1)]
dp[0][0] = 0

for i in range(n):
  for j in range(h+1):    
    dp[i+1][j] = min(dp[i+1][j], dp[i][j])
    dp[i+1][min(j+a[i],h)] = min(dp[i+1][min(j+a[i],h)], dp[i+1][j] + b[i])    

print(dp[-1][-1])  

Measured memory_bytes: 121452
<?php
$N = trim(fgets(STDIN));

$input = trim(fgets(STDIN));
$input = str_replace(array("\r\n","\r","\n"), '', $input);
$array = str_split($input);

$x = 0;
$max = 0;

for( $i = 0; $i < $N; $i++ ){
  if( $array[$i] == "I" ){
    $x++;
    if( $x > $max ){
      $max = $x;
    }
  }elseif( $array[$i] == "D" ){
    $x--;
  }
}

echo $max;

?>

Measured memory_bytes: 3576
input_line = input()
stack = []
area = 0
pond_area = 0
pond_areas = []

for i,s in enumerate(input_line):
    if s == '\\':
        stack.append(i)
        if pond_area: 
            pond_areas.append((l, pond_area))
            pond_area = 0
    elif stack and s == '/':
        l = stack.pop()
        area += i - l
        while True:
            if not pond_areas or pond_areas[-1][0] < l: break
            else: 
                pond_area += pond_areas.pop()[1]
        pond_area += i-l

if pond_area > 0: pond_areas.append((l, pond_area))

print(area)
print( " ".join([str(len(pond_areas))] + [str(a[1]) for a in pond_areas]) )


Measured memory_bytes: 6248
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#define int long long
typedef long long ll;
using namespace std;

signed main(){
    ll a, b, n, flag=1;
    cin >> n;
    for(b=0;b<500;b++){
        ll num = n + pow(b, 5);
        double dd = pow(num, 0.2);
        int d = dd;
        if(num==pow(d, 5)){
            a = (pow(num, 0.2));
            break;
        }
        num = n - pow(b, 5);
        
        if(num>0){
            dd = pow(num, 0.2);
            d = dd;
            if(num==pow(d, 5)){
                a = (pow(num, 0.2));
                flag = -1;
                break;
            }
        }
    }
    cout << a << " " << b*flag << endl;
    return 0;
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
#define MOD 1e9+7
typedef long long ll;
using namespace std;

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int l = 0;
	int r = 0;
	rep(i, n)
	{
		if (s[i] == '(')
		{
			l++;
		}
		else
		{
			if (l == 0)r++;
			else l--;
		}
	}
	string pre(r, '(');
	string suf(l, ')');
	string ans = pre + s + suf;
	co(ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using ll = unsigned long long int;
using namespace std;

int main() {
    fastIO;
    int n, a, b;
    cin >> n >> a >> b;

    int sum = 0;
    for (int i = 1; i <= n; i++) {
        int sub_sum = 0;
        int t = i;
        while (t > 0) {
            sub_sum += t % 10;
            t /= 10;
        }
        if (a <= sub_sum && sub_sum <= b)
            sum += i;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3608
from collections import deque
N,Q=map(int,input().split())
nondirtree=[[] for _ in range(N)]
dirtree=[[] for _ in range(N)]
rootflag=[0]*N
rootflag[0]=1
for i in range(N-1):
    a,b=map(int,input().split())
    nondirtree[a-1].append(b-1)
    nondirtree[b - 1].append(a - 1)
points=[list(map(int,input().split())) for _ in range(Q)]
#print(points)
v=0
d=deque()
d.append(v)
seen=[0]*N
seen[0]=1
score=[0]*N
ans=[0]*N
while len(d)!=0:
    v=d.popleft()
    for j in nondirtree[v]:
        if seen[j]==0:
            dirtree[v].append(j)
            seen[j]=1
            d.append(j)
    #print(d,seen,dirtree)
    #input(
#print(dirtree)
for i in range(Q):
    score[points[i][0]-1]=score[points[i][0]-1]+points[i][1]
#print(score)
v=0
d=deque()
d.append(v)
ans[0]=score[0]
while len(d)!=0:
    v=d.popleft()
    for j in dirtree[v]:
        ans[j]=ans[v]+score[j]
        d.append(j)
    #input()
    #print(ans)
print(*ans,sep=" ")


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

const int N = 2e3 + 7;

bool t[N][N];
int n, m, q;
int ps[N][N];
int of[N][N], am[N][N];
int main() {
	cin >> n >> m >> q;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++) {
			char c;
			cin >> c;
			t[i][j] = c - '0';
			ps[i][j] = ps[i - 1][j] + ps[i][j - 1] - ps[i - 1][j - 1] + t[i][j];
			of[i][j] = of[i - 1][j] + of[i][j - 1] - of[i - 1][j - 1] + (t[i][j] && t[i - 1][j]);
			am[i][j] = am[i - 1][j] + am[i][j - 1] - am[i - 1][j - 1] + (t[i][j] && t[i][j - 1]);
		}
	while (q--) {
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		int res =  ps[x2][y2] - ps[x2][y1 - 1] - ps[x1 - 1][y2] + ps[x1 - 1][y1 - 1];
			res -= of[x2][y2] - of[x2][y1 - 1] - of[x1][y2] + of[x1][y1 - 1];
			res -= am[x2][y2] - am[x2][y1] - am[x1 - 1][y2] + am[x1 - 1][y1];
		cout << res << endl;
	}

	return 0;
}


Measured memory_bytes: 52864
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;
const double PI = 3.14159265358979323846;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"

int main() {
	int D, T, S;
	cin >> D >> T >> S;
	if (T * S < D) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}

	return 0;
}

Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    int N; cin >> N;
    vector<int> A(N), B(N), C(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> B[i];
    for (int i = 0; i < N; i++) cin >> C[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    vector<long long> v(N);
    for (int i = 0; i < N; i++) {
        int b = B[i];
        auto it = upper_bound(C.begin(), C.end(), b);
        v[i] = C.end() - it;
    }
    vector<long long> cumsum(N+1);
    for (int i = N-1; i >= 0; i--) {
        cumsum[i] += cumsum[i+1] + v[i];
    }

    long long ans = 0;
    for (int i = 0; i < N; i++) {
        int a = A[i];
        auto it = upper_bound(B.begin(), B.end(), a) - B.begin();
        ans += cumsum[it];
    }

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

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

    solve();

    return 0;
}

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

using namespace std;

int main() {
    vector<int> x, y;
    int i = 0, n, m;
    
    while (1) {
        cin >> n >> m;
        x.push_back(n);
        y.push_back(m);
        
        if(x[i] == 0 && y[i] == 0) break;
        
        i++;
    }
    
    for(i = 0; i < x.size(); i++) {
        if(x[i] == 0 && y[i] == 0) break;
        
        if(x[i] > y[i]) cout << y[i] << " " << x[i] << endl;
        else cout << x[i] << " " << y[i] << endl;
    }
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
int a[5][105],n,b[5][105];

int main(){
	cin>>n;
	for(int i=1; i<=n; i++)cin>>a[1][i];
	for(int i=1; i<=n; i++)cin>>a[2][i];
	b[1][1]=a[1][1];
	
	for(int i=1; i<=2; i++){
		for(int j=1; j<=n; j++){
			if(i==1 and j==1)continue;
			b[i][j]=max(max(b[i][j],b[i-1][j]+a[i][j]),b[i][j-1]+a[i][j]);
		}
	}
	cout<<b[2][n]<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;

typedef unsigned long long ull;


int main(){
	int h,n;
	cin >> h >> n;
	
	int res = 0;
	while(h > 0){
		h -=n;
		res++;
	}
	cout << res <<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define N               100005
#define ff              first
#define ss              second
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define mii             map<ll,ll>
#define pq_max          priority_queue<ll>
#define pq_min          priority_queue<ll,vi,greater<ll> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            ll x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void fio(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

ll a[55][55], n, k;

vector<vi> multiply(vector<vi> &x1, vector<vi> x2){

    vector<vi> M(n+1, vi(n+1));

    for(ll x=1;x<=n;x++){
        for(ll y=1;y<=n;y++){
            for(ll z=1;z<=n;z++) M[x][y] = (M[x][y] + (x1[x][z] * x2[z][y]) % mod) % mod;
        }
    }

    return M;
}

vector<vi> pow(vector<vi> &x, ll p){

    if(p == 1) return x;

    if(p & 1) return multiply(x, pow(x, p-1));

    vector<vi> X = pow(x, p/2);

    return multiply(X, X);
}

ll f(){

    if(k == 1){
        ll res = 0;

        for(ll x=1;x<=n;x++){
            for(ll y=1;y<=n;y++) res = (res + a[x][y]) % mod;
        }

        return res;
    }

    vector<vi> A(n+1, vi(n+1));
    vector<vi> b(n+1, vi(n+1));
    for(ll x=1;x<=n;x++){
        for(ll y=1;y<=n;y++) b[x][y] = a[x][y];
    }

    A = pow(b, k);

    ll res = 0;
    for(ll x=1;x<=n;x++){
        for(ll y=1;y<=n;y++) res = (res + A[x][y]) % mod;
    }

    return res;
}

int main(){
    fio();

    cin>>n>>k;

    for(ll x=1;x<=n;x++){
        for(ll y=1;y<=n;y++) cin>>a[x][y];
    }

    cout<<f();

    return 0;
}

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

int main() {
int s, ans=0;
  cin>>s;
int i=0;
  while(i*500<=s){
   i++;
  }
  i--;
  int j=0;
  s=s-i*500;
  while(j*5<=s){
   j++;
  }
  j--;
  
  ans=i*1000+j*5;
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3588
N, M, *A = map(int, open(0).read().split())
A = [(A[i], A[i+1]) for i in range(0, M*2, 2)]
E = [[] for _ in range(N)]
for a, b in A:
    a -= 1; b -= 1
    E[a].append(b)
    E[b].append(a)

def search(d=2, v=0, g=N-1):
    if d == 0:
        if v == g:
            return True
        else:
            return False

    for to in E[v]:
        if search(d-1, to, g):
            return True
    return False

if search():
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 65420
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;

ull gcd(ull a, ull b){
	ull r;
	if(a>b) swap(a,b);
	while(b>0){
		r=a%b;
		a=b;
		b=r;
	}
	return a;
}

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

int main(){
	int n;
	cin >> n;
	ull t[n];
	for(int i=0; i<n; i++){
		cin >> t[i];
	}
	ull ans=t[0];
	for(int i=1; i<n; i++){
		ans=lcm(ans, t[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, O = 0;
  cin >> N;
  for(int i = 1; i <= N; i++) {
    if(i >= 1 && i <= 9) {O++;}
    if(i >= 100 && i <= 999) {O++;}
    if(i >= 10000 && i <= 99999) {O++;}
  }
  cout << O <<endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(int i = (int)(b); i < (int)(e); ++i)
#define RFOR(i, b, e) for(int i = (int)(e-1); i >= 0; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define PAIR pair<int,int>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;

using namespace std;

int main() {
	int n;
	cin >> n;
	REP(i, n / 7 + 1) {
		if ((n - 7 * i) % 4 == 0) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256