akhauriyash/Code-Regression huggingface dataset:
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>

//#include <bits/stdc++.h>
using namespace std;
using LL = int;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourd; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, q, last, cnt, sum, ans, dp[10000], a[2000000], b[2000000];
string str, ss;
bool f[1100][1100];
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
vector<Edge>vec[200000];
vector<LL>v;
map<string, vector<LL>>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	cin >> m;
	cnt = 0;
	rep(i, m) {
		cin >> b[i];
		if (cnt < n) {
			for (int j = cnt; j < n; j++, cnt++) {
				if (b[i] < a[j]) {
					v.push_back(b[i]);
					break;
				}
				else {
					if (b[i] != a[j])
						v.push_back(a[j]);
					else {
						cnt++;
						break;
					}
				}
				if(cnt==n-1)
					v.push_back(b[i]);
			}
		}
		else {
			v.push_back(b[i]);
		}
	}
	for (int i = cnt; i < n; i++)
		v.push_back(a[i]);
	rep(i, v.size()) {
		cout << v[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 11224
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.*;
import java.lang.Math.*;
import java.math.*;
/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main
{
    static int n;
    public static void main(String[] args) throws Exception
    {
       // InputStream inputStream = new FileInputStream (new File("kitchen.in"));
       // OutputStream outputStream = new FileOutputStream(new File("kitchen.out"));
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        static long INF = Long.MAX_VALUE;
        static int N = (int) 1e5;
        static Long dp[][] = new Long[100][100];

        public void solve(int testNumber, InputReader in, PrintWriter out) 
        {
            Long x;
            String s;
            s = in.next();
            int l = 0;
            long ans = 0;
            int r = s.length() - 1;
            while(l < r)
            {
                if(s.charAt(l) == 'x' && s.charAt(r) == 'x')
                {
                    l++;
                    r--;
                }
                else
                if(s.charAt(l) == 'x')
                {
                    l++;
                    ans++;
                }
                else
                if(s.charAt(r) == 'x')
                {
                    ans++;
                    r--;

                }
                else
                if(s.charAt(l) != s.charAt(r))
                {
                    out.println(-1);
                    out.close();
                    return;
                }
                else
                {
                    l++;
                    r--;
                }

            }
            out.println(ans);
            out.close();
        }
    }







    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public Long nextInt() {
            return Long.parseLong(next());
        }

        public float nextFloat() {
            return Float.parseFloat(next());
        }
    }
}

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    for(int i = 0; i < n; i++)
    {
        cout << s[i];
        cout << t[i];
    }

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

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

  int n;
  string s;
  cin >> n >> s;
  vector<int> E(n), W(n);
  E[0] = (s[0]=='E' ? 1 : 0);
  W[0] = (s[0]=='W' ? 1 : 0);

  for(int i = 1; i < n; ++i) {
    if(s[i]=='E') {
      E[i] = E[i-1]+1;
      W[i] = W[i-1];
    }
    if(s[i]=='W') {
      E[i] = E[i-1];
      W[i] = W[i-1]+1;
    }
  }

  int ans = 1e9;
  rep(i, n) {
    int tmp;
    if(i == 0) tmp = E[n-1]-E[0];
    else if(i == n-1) tmp = W[n-2];
    else tmp = W[i-1] + (E[n-1]-E[i]);

    ans = min(ans, tmp);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 2964
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

Int F[2048][2048];

int main() {
  int N = in();
  Int X = lin();
  vector<Int> A;
  for (int i = 0; i < N; ++i) {
    A.push_back(lin());
    F[i][0] = A[i];
  }

  for (int i = 0; i < N; ++i) {
    for (int j = 1; j < N; ++j) {
      F[i][j] = min(F[i][j - 1], A[(i - j + N) % N]);
    }
  }

  Int res = INFLL;
  for (int k = 0; k < N; ++k) {
    Int am = k * X;
    for (int i = 0; i < N; ++i) {
      am += F[i][k];
    }
    chmin(res, am);
  }

  printf("%lld\n", res);

  return 0;
}


Measured memory_bytes: 33024
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
#define lli long long int
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;

int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    IOS;
    int n,k;
    cin >> n >> k;

    vi arr(n,0);
    for(int i=0;i<n;i++){
    	cin >> arr[i];
    }
    vector<bool> dp(k+1,false);

    for(int stones=0;stones<=k;stones++){
    	for(int x:arr){
    		if(stones>=x and !dp[stones-x]){
    			dp[stones] = true;
    		}
    	}
    } 
    if(dp[k]){
    	cout << "First" << "\n";
    }
    else{
    	cout << "Second" << "\n";	
    }

    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<iomanip>
#include<vector>
using namespace std;
using ll=long long;

int main(){
	const int M=1e5;
	int n,k,h[M],ans=1e9;
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>h[i];
	sort(h,h+n);
	for(int i=0;i<=n-k;i++)ans=min(ans,h[i+k-1]-h[i]);
	cout<<ans<<endl;
}

Measured memory_bytes: 640
#pragma GCC optimize("O2,unroll-loops")
#pragma GCC target("avx,popcnt")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
const int maxn = 1<<17, mod = 1e9 + 7, i2 = (mod+1)/2;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	map<char, int> cnt;
	for(char i = 'a'; i <= 'z'; i++) cnt[i] = 1<<30;
	int n;
	string s;
	cin >> n;
	while(n--) {
		map<int, int> ttt;
	for(char i = 'a'; i <= 'z'; i++) ttt[i] = 0;
		cin >> s;
		for(auto i : s) ttt[i]++;
		for(auto i : ttt) cnt[i.first] = min(cnt[i.first], i.second);
	}
	for(char i = 'a'; i <= 'z'; i++) if(cnt[i] != 1<<30) {
		while(cnt[i]--) cout << i;
	}
	cout << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
    using namespace std;
     
    int main() {
	int cards[4][13];
	for(int i=0; i<4; i++){
		for(int j=0; j<13 ;j++){
			cards[i][j]=0;
		}
	}
	int n;
	cin >> n ;
	for(int h=0; h<n ;h++){
		int num ;
		char mar ;
		cin>> mar >> num ;
		if(mar == 'S'){
			cards[0][num-1]=1;
		}
		if(mar == 'H'){
			cards[1][num-1]=1;
		}
		if(mar == 'C'){
			cards[2][num-1]=1;
		}
		if(mar == 'D'){
			cards[3][num-1]=1;
		}
	}
	for (int i=0; i<4 ; i++){
		for (int j=0 ; j<13 ; j++){
			if(cards[i][j] == 0){
				if(i == 0){cout<< "S " <<j+1 <<endl;}
				if(i == 1){cout<< "H " <<j+1 <<endl;}
				if(i == 2){cout<< "C " <<j+1 <<endl;}
				if(i == 3){cout<< "D " <<j+1 <<endl;}
			}
		}
	}
    return 0;
    }

Measured memory_bytes: 1160
#include <stdio.h>

main(){
  int n, i, j, k, l, f;
  int data[5][5];
  int ans, temp[2], count;

  scanf("%d", &n);

  for(i=0;i<n;i++){
    for(j=0;j<5;j++){
      for(k=0;k<5;k++){
        scanf("%d", &data[j][k]);
      }
    }
    ans=-1;

    for(j=0;j<5;j++){
      temp[0]=0;
      for(k=0;k<5;k++){
        if(data[j][k]==1){
          temp[1]=0;
          for(l=0;k+l<5;l++){
            if(data[j][k+l]==0) break;
            else if(data[j][k+l]==1) temp[1]++;
          }
          if(temp[0]<temp[1]) temp[0]=temp[1];
          k=k+l-1;
        }
      }
      if(ans<temp[0]) ans=temp[0];
    }
    for(j=0;j<4;j++){
      temp[0]=0;
      for(k=0;k<5;k++){
        if(data[j][k]==1 && data[j+1][k]==1){
          temp[1]=0;
          for(l=0;k+l<5;l++){
            if(data[j][k+l]==0 || data[j+1][k+l]==0) break;
            else if(data[j][k+l]==1 && data[j+1][k+l]==1) temp[1]+=2;
          }
          if(temp[0]<temp[1]) temp[0]=temp[1];
        }
      }
      if(ans<temp[0]) ans=temp[0];
    }
    for(j=0;j<3;j++){
      temp[0]=0;
      for(k=0;k<5;k++){
        if(data[j][k]==1 && data[j+1][k]==1 && data[j+2][k]==1){
          temp[1]=0;
          for(l=0;k+l<5;l++){
            if(data[j][k+l]==0 || data[j+1][k+l]==0 || data[j+2][k+l]==0) break;
            else if(data[j][k+l]==1 && data[j+1][k+l]==1 && data[j+2][k+l]==1) temp[1]+=3\
;
          }
          if(temp[0]<temp[1]) temp[0]=temp[1];
        }
      }
      if(ans<temp[0]) ans=temp[0];
    }
    for(j=0;j<2;j++){
      temp[0]=0;
      for(k=0;k<5;k++){
        if(data[j][k]==1 && data[j+1][k]==1 && data[j+2][k]==1 && data[j+3][k]==1){
          temp[1]=0;
          for(l=0;k+l<5;l++){
            if(data[j][k+l]==0 || data[j+1][k+l]==0 || data[j+2][k+l]==0 || data[j+3][k+l\
]==0) break;
            else if(data[j][k+l]==1 && data[j+1][k+l]==1 && data[j+2][k+l]==1 && data[j+3\
][k+l]==1) temp[1]+=4;
          }
          if(temp[0]<temp[1]) temp[0]=temp[1];
        }
      }
      if(ans<temp[0]) ans=temp[0];
    }
    for(j=0;j<1;j++){
      temp[0]=0;
      for(k=0;k<5;k++){
        if(data[j][k]==1 && data[j+1][k]==1 && data[j+2][k]==1 && data[j+3][k]==1 && data\
[j+4][k]==1){
          temp[1]=0;
          for(l=0;k+l<5;l++){
            if(data[j][k+l]==0 || data[j+1][k+l]==0 || data[j+2][k+l]==0 || data[j+3][k+l\
]==0 || data[j+4][k+l]==0) break;
            else if(data[j][k+l]==1 && data[j+1][k+l]==1 && data[j+2][k+l]==1 && data[j+3\
][k+l]==1 && data[j+4][k+l]==1) temp[1]+=5;
          }
          if(temp[0]<temp[1]) temp[0]=temp[1];
        }
      }
      if(ans<temp[0]) ans=temp[0];
    }
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 0
from collections import deque
n,k = map(int,input().split())
a = [int(input())-k for i in range(n)]
rui = [0]*(n+1)
for i in range(n):
    rui[i+1] = rui[i] + a[i]
import bisect
def press(a):
    n = len(a)
    b = set(a)
    b = list(b)
    b.sort()
    c = [0] * n
    for i in range(n):
        c[i] = bisect.bisect_left(b,a[i])
    return b,c
b,c = press(rui)
class BIT:
    def __init__(self, node_size):
        self._node = node_size+1
        self.bit = [0]*self._node

    def add(self, index, add_val):
        while index < self._node:
            self.bit[index] += add_val
            index += index & -index

    def sum(self, index):
        res = 0
        while index > 0:
            res += self.bit[index]
            index -= index & -index
        return res
bit = BIT(n+2)
ans = 0
for i in c:
    ans += bit.sum(i+1)
    bit.add(i+1,1)
print(ans)

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

using namespace std ;

const int MAX = 1e7 + 2 ;

int lastvis[MAX] , cnt[MAX] ;
bool prime[MAX] ;
long long divcnt[MAX] ;
int n ;

void sieve()
{
	divcnt[1] = 1ll ;
	for(int i = 2 ; i <= n ; ++i)
		prime[i] = 1 , divcnt[i] = 1ll ;
	for(int i = 2 ; i <= n ; ++i)
	{
		if(prime[i])
		{
			divcnt[i] = 2ll ;
			lastvis[i] = i ;
			cnt[i] = 1 ;
			for(int j = i+i ; j <= n ; j += i)
			{
				prime[j] = 0 ;
				if(lastvis[j/i] != i)
					cnt[j] = 1ll ;
				else
					cnt[j] = cnt[j/i] + 1ll ;
				divcnt[j] *= (cnt[j] + 1ll) ;
				lastvis[j] = i ;
			}
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	sieve() ;
	long long ans = 0ll ;
	for(int i = 1 ; i <= n ; ++i)
		ans += i * divcnt[i] ;
	return cout<<ans<<"\n" , 0 ;
}		

Measured memory_bytes: 169660
Signal.trap(:INT){
  exit(0)
}

base_arr = Array.new(50000, true)
base_arr[0] = false #
base_arr[1] = false # how to write cooler these.

# make prime array
i = 2
50000.times do
	if base_arr[i] == true
 		for j in (2..50000) do
 			if i*j < 50000
				base_arr[i*j] = false
			else
		 		break 
			end
		end
	end
	i += 1
end

def prime_dec(x, base_arr) 
	#if x is not prime number, x can devide less than root x
	prime_arr = [1]
	#tmp = Math.sqrt(x).to_i
	50000.times do |i|
		#make prime deconposition
		if base_arr[i] == true
			tmp = Math.sqrt(x).to_i
			tmp.times do |j|
				break if x == 1
		
				if (x % i) == 0
					prime_arr.push i
					x /= i
					redo
				end
			end
		end
	end
	prime_arr.push x
	return prime_arr
end
while str = gets
	nums = str.split(" ")
	num0 = nums[0].to_i
	num1 = nums[1].to_i

	arr0 = prime_dec(num0, base_arr)
	arr1 = prime_dec(num1, base_arr)

	gcd = 1
	gcd_arr = arr0 && arr1
	gcd_arr.size.times do |i|
	 gcd *= gcd_arr[i]
	end
	puts "#{num0.gcd(num1)} #{num0.lcm(num1)}"
end

Measured memory_bytes: 6532
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

const int mod = 1000000007;
struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a){
        if((x+=a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a){
        if((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if(!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if(t&1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main(){
    int n; 
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> cnt(n+1);
    cnt[0] = 3;
    mint ans = 1;
    rep(i,n){
        ans *= mint(cnt[a[i]]);
        cnt[a[i]]--;
        cnt[a[i]+1]++;
    } 
    cout << ans.x << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<long long,long long>
#define vl vector<long long>
#define vll vector<pll>
#define vi vector<int>
#define vii vector<pii>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define tcase int tt; cin>>tt; while(tt--)
#define tcase2 int tt; cin>>tt; for(int qq=1;qq<=tt;qq++)
using namespace std;
typedef long long int ll;
typedef  unsigned long long int ull;
typedef long double ld;
const int MAX = 1000010;
const int MOD2 = 998244353;
const int MOD = 1000000007; 
const int INF = 1e8;    
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-7;
// Extra
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()   
#define trav(a, x) for(auto& a : x)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr<< *it << " = " << a << endl;
	err(++it, args...);
}
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main()
{
    sws
    int x;
    cin>>x;
    int base=360;
    for(auto i:{2,3,5})
    {
        if(x%i==0)
        {
            while(x%i==0 and base%i==0)
            {
                x/=i;
                base/=i;
            }
        }
    }
    cout<<base<<endl;
    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int n, ans = -1;
    double min = 100000, t, a, h[1000];
    cin >> n >> t >> a;

    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
        if (min > fabs(a-(t - h[i] * 0.006)))
        {
            min = fabs(a-(t - h[i] * 0.006));
            ans = i + 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int gcd( int x, int y, int &t)
{
	t = 0;
	int a = 0;

	if( x < y ) swap( x,y );

	while( y != 0 ){
		a = x % y; x = y; y = a;t++;
	}

	return x;
}

int main(int argc, char const* argv[])
{
	int x,y;

	while( cin >> x >> y && x != 0 )
	{
		int t;
		int a = gcd ( x, y ,t );

		cout << a << " " << t << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 100005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
using namespace std;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

ll sum(ll n) {
    return (n * (n+1))/2;
}

    
void test_case() {

    ll n,k;

    cin>>n >> k;


    ll ans = 0;
    

    for(int i=k; i<=n+1; i++) {


      ans += sum(n) - sum(n - i) - sum(i - 1) + 1;
		ans %= mod;

    }

   // ans ++;

    ans = ans % mod;


    cout<<ans<<endl;

    




    

}


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(20);

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


    int t = 1;
    // cin >> t;
    while (t--)
    {
        test_case();
    }
}

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

using namespace std;

typedef long long ll;

int main() {
  int n;
  cin>>n;
  string s;
  cin>>s;
  int ans = 0;
  for (int i = 1; i < n; i++) {
    int cnt = 0;
    for (char c = 'a'; c <= 'z'; c++) {
      bool left = false, right = false;
      for (int j = 0; j < i; j ++) {
        if (s[j]==c) left = true;
      }
      for (int j = i; j < n; j++) {
        if (s[j]==c) right = true;
      }
      if (left && right) cnt++;
    }
    ans = max(ans,cnt);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

signed main() {
	char c;
	cin >> c;
	cout << (char)(c + 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(C: str):
    print(chr(ord(C) + 1))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    C = next(tokens)  # type: str
    solve(C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#!usr/bin/env pypy3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)


def main():
    K = I()
    q = deque()
    for i in range(1, 10):
        q.append(i)
    for _ in range(K):
        x = q.popleft()
        if x % 10 != 0:
            q.append(10 * x + x % 10 - 1)
        q.append(10 * x + x % 10)
        if x % 10 != 9:
            q.append(10 * x + x % 10 + 1)
    print(x)


main()


Measured memory_bytes: 18832
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn read_n<T: FromStr>(n: usize) -> Vec<T> {
  read_n_logic::<T>(n, vec![])
}

fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
  match n {
    0 => a,
    _ => {
      a.push(read::<T>());
      read_n_logic(n - 1, a)
    }
  }
}

fn main() {
  let n = read::<usize>();
  let mut v = read_n::<f32>(n);

  v.sort_by(|x, y| x.partial_cmp(y).unwrap());
  let answer = v[1..].iter().fold(v[0], |acc, &x| (acc + x) / 2f32);
  println!("{}", answer);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=1000000007;


int main() {
  ll l,r;
  cin >> l >> r;
  int a=l%2019;
  int b=r%2019;
  int min=2019;
  if(l/2019<r/2019 || l%2019==0 || r%2019==0){
    cout << 0 << endl;
    return 0;
  }
  else {
    for(int i=a;i<b;i++){
      for(int j=i+1;j<b+1;j++){
        if(((i%2019)*(j%2019))%2019<min)
        min=((i%2019)*(j%2019))%2019;
      }
    }
  }
  cout << min << endl;
}


Measured memory_bytes: 3644
"use strict";
function Main(input) {
    let lines = input.split("\n");
    let Ln = lines.shift().split(/\s/).map((v) => v - 0);
    let N = Ln[0], M = Ln[1];
    let D = [];
    for (let n = 0; n < N; n++) {
        let An = lines.shift().split(/\s/).map((v) => v - 0);
        D.push([An[0], An[1]]);
    }
    let yen = 0, i = 0;
    D.sort(function(a, b) { return a[0] - b[0]; });
    while (M > 0) {
        if (M < D[i][1]) yen += (M * D[i][0]);
        else yen += (D[i][1] * D[i][0]);
        M -= D[i][1];
        i += 1;
    }
    console.log(yen);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 52164
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int x = sc.nextInt();
        int ans = 0;
        for (int i = 0; i <= a; i++) {
            for (int j = 0; j <= b; j++) {
                for (int k = 0; k <= c; k++) {
                    int total = (i * 500) + (j * 100) + (k * 50);
                    if(total == x) ans++;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35552
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int x, n;
	cin >> x >> n;
	set<int> st;
	rep(i, n) {
		int a;
		cin >> a;
		st.insert(a);
	}
	int dif = inf; int ans = -1;
	rep(i, 102) {
		if (!st.count(i)) {
			if (chmin(dif, abs(i - x))) {
				ans = i;
			}
		}
	}
	cout << ans << '\n';
}

Measured memory_bytes: 3652
#include <stdio.h>
int main (void){
int H[300],W[300],i=0,j,n=0,k,l;
H[0]=1;
W[0]=1;
while(H[i]!=0 && W[i]!=0){
	i++;
	n++;
	scanf("%d %d",&H[i],&W[i]);
}
for(j=1;j<n;j++){
	for(k=1;k<=W[j];k++){
		printf("#");
	}
	printf("\n");//?????????

	for(k=1;k<=(H[j]-2);k++){
		printf("#");
		for(l=1;l<=(W[j]-2);l++){
			printf("." );
		}
		printf("#\n");
	}//??????
	for(k=1;k<=W[j];k++){
		printf("#");
		}//?????????
	printf("\n\n");
	}

return 0;
}

Measured memory_bytes: 1656
#include <iostream>
#include <string>
#include <vector>

using namespace std;

using ll = long long;

template <class T>
using grid = vector<vector<T>>;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

int f(int x) {
  int result = 0;
  FOR(i, 1, x) {
    if (x % i == 0) result++;
  }
  return result;
}

int main() {
  int input(n);
  int ans = 0;
  FOR(i, 1, n) {
    if (i % 2 == 1 && f(i) == 8) {
      ans++;
    }
  }
  print(ans);
}


Measured memory_bytes: 256
#include <stdio.h>

int     main(void)
{
	int     i=1;
	int     x;

	do{
	  scanf("%d",&x);
	  
	  if(x == 0)
	    break;
	  else
	    printf("Case %d: %d\n",i,x);
	  
	  i++;
	}while(x > 0);
	  
	return(0);
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int N, X, Y;

int dist(int a, int b){
	return min(min(abs(b-a), abs(X-a)+1+abs(b-Y)),abs(Y-a)+1+abs(b-X));
}
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	cin >> N >> X >> Y;
	vector<int> ans(N-1, 0);
	for (int i = 0; i < N-1; i++)
	{
		for (int j = i+1; j < N; j++)
		{
			int tmp = dist(i+1, j+1);
			ans[tmp-1]++;
		}
	}
	for (int i = 0; i < N-1; i++)
	{
		cout << ans[i] <<endl;
	}
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			int [] data = new int[n];
			for(int i = 0; i < n; i++){
				data[i] = sc.nextInt();
			}
			
			int [] count = new int[3];
			for(int i = 0; i < n; i++){
				if(data[i] % 4 == 0){
					count[0]++;
				}
				else if(data[i] % 2 == 0){
					count[1]++;
				}
				else{
					count[2]++;
				}
			}
			
			if(count[2] <= count[0]){
				System.out.println("Yes");
			}
			else if((count[2] - 1) == count[0] && count[1] == 0){
				System.out.println("Yes");
			}
			else{
				System.out.println("No");
			}
		}
	}


	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}

}


Measured memory_bytes: 51164
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <bitset>
typedef long long lint;
const int N=2e5+5;
std::bitset <N> vld1,vld2;

namespace utils{
	template <class T> inline void apn(T &x,const T y){x>y?x=y:0;}
	template <class T> inline void apx(T &x,const T y){x<y?x=y:0;}
	inline int nxi(){
		int x=0;
		char c;
		while(((c=getchar())>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=getchar());
		while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

int main(){
	const int n=nxi();
	for(int i=nxi(); i; --i){
		const int a=nxi(),b=nxi();
		if(a==1||b==1) vld1[a+b-1]=1;
		if(a==n||b==n) vld2[a+b-n]=1;
	}
	vld1&=vld2;
	puts(vld1.count()?"POSSIBLE":"IMPOSSIBLE");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;

struct t {
	int r, s1, s2;
	t(void) { r = 0, s1 = 0, s2 = 0; }
	void up(int x) {
		if (s1 < x)swap(s1, x);
		s2 = max(s2, x);
	}
	void mn(int x) {
		if (s1 == x) {
			s1 = s2;
			s2 = 0;
		}
	}
};
int N, cs[100005], ans;
VI G[100005];
map<int, t>dp[100005];
t dfs(int v, int p, int f) {
	if (dp[v].count(p))return dp[v][p];
	t res;
	if (p == -1 || f) {
		REP(i, G[v].size()) {
			int u = G[v][i];
			if (u == p)continue;
			t x = dfs(u, v, f);
			x.r -= 2;
			x.s1--;
			if (x.r>0) {
				res.r += x.r;
				res.up(-x.r + x.s1);
			}
			else res.up(x.s1);
		}
		res.r += cs[v];
		res.s1 += res.r;
		res.s2 += res.r;
	}
	else {
		res = dfs(v, -1, 0);
		t x = dfs(p, v, 0);
		x.r -= 2;
		x.s1--;
		if (x.r > 0) {
			res.r -= x.r;
			res.mn(res.r + x.s1);
			res.s1 -= x.r;
		}
		else res.mn(res.r + x.s1);
	}

	return dp[v][p] = res;
}

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

	cin >> N;
	int ma = -LLINF;
	REP(i, N) {
		cin >> cs[i];
		ma = max(ma, cs[i]);
	}
	if (ma <= 0) {
		cout << ma << endl;
		return 0;
	}
	REP(i, N - 1) {
		int a, b;
		cin >> a >> b;
		G[--a].push_back(--b);
		G[b].push_back(a);
	}
	dfs(0, -1, 1);
	REP(i, N)ans = max(ans, dfs(i, -1, 0).s1);
	cout << ans << endl;
	
	return 0;
}




Measured memory_bytes: 54732
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <algorithm>
#include <numeric>

int main(){
  int N;
  std::vector<int> p;
  std::cin >> N;
  std::copy_n(std::istream_iterator<int>(std::cin), N, std::back_inserter(p));
  std::sort(p.begin(),p.end());

  int result = std::accumulate(p.begin(), p.end()-1, 0);
  result += *(p.end()-1) / 2;
  std::cout<< result << std::endl;
  
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    int c[n], s[n], f[n];
    rep(i, n-1){
        cin >> c[i] >> s[i] >> f[i];
    }
    c[n-1] = 0;
    s[n-1] = 0;
    f[n-1] = 1;
    
    rep(i, n-1){
        int ss = s[i];
        for (int j = i; j < n-1; j++) {
            int t = ss + c[j];
            int tt = t - t%f[j+1] + f[j+1];
            if(t%f[j+1]==0) tt -= f[j+1];

            // printf("%d %d\n", ss, tt);

            ss = max(tt, s[j+1]);
        }
        cout << ss << endl;
    }
    cout << 0 << endl;
    return 0;
}

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

int main() {
    string s, t; cin >> s >> t;
    int cnt = 0;
    for (int i = 0; i < 3; i++) cnt += s[i] == t[i];
    cout << cnt << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a1(n), a2(n), s(n);
  for (int i = 0; i < n; i++) {
    cin >> a1.at(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> a2.at(i);
  }
  s.at(0) = a1.at(0) + accumulate(a2.begin(), a2.end(), 0);
  for (int i = 1; i < n; i++) {
    s.at(i) = s.at(i - 1) + a1.at(i) - a2.at(i - 1);
  }
  cout << *max_element(s.begin(), s.end()) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int main() {
	char c; cin >> c;
	if (c >= 'A' && c <= 'Z') cout << "A" << endl;
	else cout << "a" << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main() {
	string S, T;
	cin>>S>>T;
	
	for(int i=0, n=S.size(); i<n; ++i) {
		//rotate(S.begin(),S.begin()+i, S.end());

		for(int j=0; j<S.size(); ++j) {
			swap(S[j], S[S.size()-1]);
		}
		if(S==T) {
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;

	return 0;
}


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

int main(){
    int N; cin >> N;
    int cnt[100001] = {0};
    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        cnt[a]++;
        ans += a;
    }
    int Q; cin >> Q;
    for (int i = 0; i < Q; i++)
    {
        int b,c; cin >> b >> c;
        ans += (c-b)*cnt[b];
        cnt[c] += cnt[b];
        cnt[b] = 0;
        cout << ans << endl;   
    }
    
}	


Measured memory_bytes: 3980
import java.util.Scanner;

public class Main {

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

        final int N = sc.nextInt();
        final int K = sc.nextInt();
        final String S = sc.next();

        System.out.println(S.substring(0, K-1) + String.valueOf(S.charAt(K-1)).toLowerCase() + S.substring(K));
    }
}


Measured memory_bytes: 39148
def output(S,T,i,j):
  op = ""
  for k in S[:j-i]:
    if k == "?":
      op += "a"
    else:
      op += k
  op += T
  if j-i+len(T) < len(S):
    for k in S[j-i+len(T):]:
      if k == "?":
        op += "a"
      else:
        op += k
  return op


S = input()
T = input()
SS = len(S)
TT = len(T)
cand = []
if TT > SS:
  print("UNRESTORABLE")
else:
  for i,t in enumerate(T):
    for j,s in enumerate(S):
      c = 0
      if ((t == s) or (s == "?")) and (i <= j) and (TT - i <= SS - j):
        for ss, tt in zip(S[j-i:], T):
          if ss != tt and ss != "?":
            break
          else:
            c += 1
        if c == TT:
          cand.append(output(S,T,i,j))
  cand.sort()
  cand.append("UNRESTORABLE")
  print(cand[0])

Measured memory_bytes: 39408
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    long long h, w;
    cin >> h >> w;

    if (h == 1 || w == 1) {
        cout << 1 << '\n';
        return 0;
    }

    long long res = w * (h / 2);
    if (h & 0x1) {
        res += (w + 1) / 2;
    }

    cout << res << '\n';

    return 0;
}

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

vector<int> forintinput(int n) {
	vector<int> x(100000);
	for(int i = 0;i < n;i++) cin >> x[i];
	return x;
}
int main(){
	int a;
	string s;
	cin >> a >> s;
	if(a >= 3200){
		cout << s << endl;
	}else{
		cout << "red" << endl;
	}
}

Measured memory_bytes: 3600
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

struct UnionFind
{
  int n;
  std::vector<int> par,size;
  UnionFind(int sz) : n(sz), par(sz,0), size(sz,1) {
    std::iota(par.begin(),par.end(),0);
  }
  int find(int x) {
    if(par[x]==x) return x;
    return par[x] = find(par[x]);
  }
  void unite(int x, int y) {
    x=find(x);y=find(y);
    if(x==y) return;
    if(size[x]<size[y]) std::swap(x,y);
    size[x]+=size[y];
    par[y]=x;
  }
};


signed main() {
	int h,w;
	std::cin >> h >> w;
	std::vector<std::string> g(h);
	rep(i,h) std::cin >> g[i];
	UnionFind uf(h*w);
	rep(i,h) {
		rep(j,w) {
			for(int x=-1;x<=1;x++) {
				for(int y=-1;y<=1;y++) {
					if(x*y==0) {
						if(i+x>=0 && i+x<h) {
							if(j+y>=0 && j+y<w) {
								if(g[i][j] != g[i+x][j+y]) {
									uf.unite(i*w+j,(i+x)*w+j+y);
								}
							}
						}
					}
				}
			}
		}
	}
	std::map<int,int> white;
	std::map<int,int> black;
	rep(i,h*w) {
		if(g[i/w][i%w]=='.') {
			white[uf.find(i)]++;
		} else {
			black[uf.find(i)]++;
		}
	}
	int sum = 0;
	for(auto i:white) {
		sum+=i.second*black[i.first];
	}
	print(sum);
	return 0;
}


Measured memory_bytes: 11392
package main

import "fmt"

func main() {
	var a, b, c, x, ans int
	fmt.Scan(&a, &b, &c, &x)

	for i := 0; i <= a; i++ {
		for j := 0; j <= b; j++ {
			for k := 0; k <= c; k++ {
				if 500*i+100*j+50*k == x {
					ans++
				}
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

typedef unsigned long long ull;
typedef pair<int,int> pii;

int t;

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

ull number_times_divided_by_two(ull a){
    ull cnt=0;
    while(a%2==0){
        a/=2;
        cnt++;
    }
    return cnt;
}

void solve(){
    ull n, m;
    cin>>n>>m;
    vector<ull> a(n);
    map<int,bool> mark;
    for(int i=0;i<(int)n;i++){
        cin>>a[i];
        a[i]/=2;
        mark[number_times_divided_by_two(a[i])]=true;
    }
    if(mark.size()>1){cout<<0<<endl;return;}
    ull LCM=1;
    for(auto it:a){
        LCM=lcm(LCM,it);
    }
    cout<<(m/LCM+1)/2<<endl;
}

int main()
{
    //freopen("IN.txt","r",stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

struct open {
  int x, y, id;
  open(int x, int y, int id) : x(x), y(y), id(id) {}
};

const int N = 100005;

int p[N];
vector < pair < int, pair <int, int> > > adj;

int fs(int u) {
  return (p[u] == u ? u : p[u] = fs(p[u]));
}

inline bool cmp(const open &a, const open &b) {
  if (a.x != b.x) {
    return a.x < b.x;
  }
  return a.y < b.y;
}

inline bool cmp2(const open &a, const open &b) {
  if (a.y != b.y) {
    return a.y < b.y;
  }
  return a.x < b.x;
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < N; i++) p[i] = i;
  vector <open> vec;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    vec.push_back(open(x, y, i));
  }
  sort(vec.begin(), vec.end(), cmp);
  for (int i = 0; i < vec.size(); i++) {
    if (i > 0) {
      int d = min(abs(vec[i].x - vec[i - 1].x), abs(vec[i].y - vec[i - 1].y));
      adj.push_back({d, {vec[i - 1].id, vec[i].id}});
    }
    if (i < n - 1) {
      int d = min(abs(vec[i].x - vec[i + 1].x), abs(vec[i].y - vec[i + 1].y));
      adj.push_back({d, {vec[i + 1].id, vec[i].id}});
    }
  }
  sort(vec.begin(), vec.end(), cmp2);
  for (int i = 0; i < vec.size(); i++) {
    if (i > 0) {
      int d = min(abs(vec[i].x - vec[i - 1].x), abs(vec[i].y - vec[i - 1].y));
      adj.push_back({d, {vec[i - 1].id, vec[i].id}});
    }
    if (i < n - 1) {
      int d = min(abs(vec[i].x - vec[i + 1].x), abs(vec[i].y - vec[i + 1].y));
      adj.push_back({d, {vec[i + 1].id, vec[i].id}});
    }
  }
  sort(adj.begin(), adj.end());
  long long ans = 0;
  for (int i = 0; i < adj.size(); i++) {
    int x = fs(adj[i].second.first);
    int y = fs(adj[i].second.second);
    if (x != y) {
      p[y] = x;
      ans += adj[i].first;
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 10096
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  while(cin>>n,n!=0){
    vector<pair<string,string> >pcc;
    vector<string> vc;
    for(int i=0;i<n;i++){
      string a,b;
      cin>>a>>b;
      pcc.push_back(make_pair(a,b));
    }
    int m;
    cin>>m;
    for(int i=0;i<m;i++){
      string a;
      cin>>a;
      for(int j=0;j<n;j++){
	if(a==pcc[j].first){
	  a=pcc[j].second;
	  break;
	}
      }
      vc.push_back(a);
    }
    for(int k=0;k<m;k++)
      cout<<vc[k];
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 4508
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;
 
 
 
int main(){
    string s; cin >> s;
    ll len = s.size();
    ll bcnt = 0;
    rep(i,len){
        if(s[i] == 'B') bcnt++;
    }
    ll ans = 0;
    rep(i,len){
        if(s[i] == 'B'){
            ans += len - bcnt - i;
            bcnt--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for ((i)=1;(i)<=(n);(i)++)
using namespace std;
int n,m,i,j,k,q,mod,px[1000005],py[1000005],pz[1000005],g,z;
int ipw[2][1000005];
int gcd(int x,int y){
	return y?gcd(y,x%y):x;
}
struct dsu{
	int fa[1000005];
	void init(int l,int r){
		int i;
		for(i=l;i<=r;i++){
			fa[i]=i;
		}
	}
	int fnd(int x){
		if(fa[x]==x) return x;
		return fa[x]=fnd(fa[x]);
	}
	bool merge(int x,int y){
		if(fnd(x)==fnd(y)) return 0;
		return fa[fnd(x)]=fnd(y),1;
	}
}f;
int id(int x,int y,int z)
{
	return x*6-5+y*3+z;
}
void solve(int x,int y,int s){
	int j,k;
	for(j=0;j<2;j++){
		for(k=0;k<3;k++){
			int tmp=(z+s+(3-k)*g)%mod;
			if(ipw[j][tmp]&&f.fnd(id(y,0,0))==f.fnd(id(x,j,k))){
				puts("YES");return;
			}
		}
	}
	puts("NO");
}
int main(){
	cin>>n>>m>>q>>mod;g=mod;
	f.init(1,6*n);
	rep(i,m){
		cin>>px[i]>>py[i]>>pz[i];
		g=gcd(g,abs(pz[i]-pz[1]));
	}
	mod=gcd(mod,g*3);
	z=pz[1]%g;
	rep(i,m){
		int x=px[i],y=py[i],v=(pz[i]-z)/g%3;
		for(j=0;j<2;j++){
			for(k=0;k<3;k++){
				f.merge(id(x,j,k),id(y,!j,(k+k+v)%3));
				f.merge(id(y,j,k),id(x,!j,(k+k+v)%3));
			}
		}
	}
	int x=z;
	for(i=0;i<mod;i++){
		ipw[i&1][x]=1;
		x=2*x%mod;
	}
	while(q--){
		int x,y,s;
		cin>>x>>y>>s;
		solve(x,y,s);
	}
	return 0;
}

Measured memory_bytes: 12996