akhauriyash/Code-Regression huggingface dataset:
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()
	x := readInt64()
	s := int64(11)

	if x <= 6 {
		println(1)
		return
	}
	if x < 11 {
		println(2)
		return
	}

	q := x / s
	m := x % s

	ans := q * 2
	if 0 < m && m <= 6 {
		ans++
	} else if 6 < m && m < 11 {
		ans += 2
	}
	println(ans)
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                //????????¨??????????????????
                string[] s = Console.ReadLine().Split(' ');
                int high = int.Parse(s[0]);
                int width = int.Parse(s[1]);


                //????????¨????????¨??????0???????????????????????????????????????
                if ((high == 0) && (width) == 0) break;


                for (int i = 0; i < high; i++)
                {
                    for (int j = 0; j < width; j++)
                    {
                        if ((i==0) || (i==high-1) || (j == 0) || (j == width-1))
                            Console.Write("#");
                        else
                            Console.Write(".");
                    }
                    Console.Write("\n");
                }

                Console.Write("\n");

            }
        }
    }
}

Measured memory_bytes: 5292
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <set>

using namespace std;

int main ( void )
{
	int n;
	
	cin >> n;
	
	for (int i = 0; i < n; ++i)
	{
		set<string> train;
		string in;

		cin >> in;

		for (int j = 1, jlen = in.size(); j < jlen; ++j)
		{
			string a, b, ra, rb;
			
			a = ra = in.substr(0, j);
			b = rb = in.substr(j);
			reverse(ra.begin(), ra.end());
			reverse(rb.begin(), rb.end());

			train.insert(a + rb);
			train.insert(rb + a);
			train.insert(b + ra);
			train.insert(ra + b);
			train.insert(ra + rb);
			train.insert(rb + ra);
			train.insert(b + a);
		}

		train.insert(in);
		reverse(in.begin(), in.end());
		train.insert(in);

		cout << train.size() << endl;
	}
}

Measured memory_bytes: 1296
S = input()
N = len(S)
MOD = 10 ** 9 + 7

dp = [0, 0, 0, 0]
dp[0] = 1

for s in S:
    factor = 3 if s == '?' else 1
    for j, c in zip([2, 1, 0], 'CBA'):
        dp[j + 1] = dp[j + 1] * factor % MOD
        if s == c or s == '?':
            dp[j + 1] += dp[j]
    if s == '?':
        dp[0] = (dp[0] * 3) % MOD

ans = dp[-1] % MOD

print(ans)

Measured memory_bytes: 3188
n, x = map(int, input().split())
a = list(map(int, input().split()))

ans = 0
for i in range(1, n):
    if a[i-1] + a[i] > x:
        ans += a[i-1] + a[i] - x
        if x >= a[i-1]:
            a[i] = x - a[i-1]
        else:
            a[i] = 0

print(ans)


Measured memory_bytes: 14132
#include <bits/stdc++.h>
#define ll long long
#define rw freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define mod 1000000007
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace std;
const int N=(int)2e5+10;
int main()
{
#ifdef ONLINE_JUDGE
    FAST;
#endif
    int n,st=-1,l;
    cin>>n>>l;
    vi v(n+2);
    lp(i,1,n)
    cin>>v[i];
    lp(i,1,n-1)
    {
        int sum=v[i]+v[i+1];
        if (sum>=l)
            st=i;
    }
    if (st==-1)
        f("Impossible");
    cout<<"Possible\n";
    lp(i,1,st-1)
    cout<<i<<"\n";
    lp2(i,n-1,st+1)
    cout<<i<<"\n";
    cout<<st;
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

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

	if (n % 2 != 0) {
		dunk(0);
		return 0;
	}

	n /= 2;

	const int five = 5;

	ll ans = 0;
	ll b = five;

	while (n >= b) {
		ans += n / b;
		b *= five;
	}

	dunk(ans);

	return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min};
use std::io::{stdin, stdout, BufWriter, Write};
#[derive(Default)]
struct Scanner {
    buffer: Vec<String>,
}
impl Scanner {
    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            stdin().read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn main() {
    let mut scan = Scanner::default();
    let out = &mut BufWriter::new(stdout());

    let n = scan.next::<i32>();
    let k = scan.next::<i64>();
    let mut a: Vec<i64> = (0..n).map(|_| scan.next()).collect();
    a.sort();
    let f: Vec<i64> = (0..n).map(|_| scan.next()).collect();

    let mut l: i64 = 0;
    let mut r: i64 = 1e12 as i64;

    while l < r {
        let mid: i64 = (l + r) >> 1;
        let mut b: Vec<i64> = Vec::new();
        for i in 0..n {
            b.push(mid / f[i as usize]);
        }
        b.sort();
        let mut req: i64 = 0;
        for i in 0..n {
            req += max(a[i as usize] - b[i as usize], 0 as i64);
        }
        if req > k {
            l = mid + 1;
        } else {
            r = mid;
        }
    }
    writeln!(out, "{}", l).ok();
}

Measured memory_bytes: 26044
#include<cstdio>
#include<algorithm>
using namespace std;
char p[80];
int n, K, chk[80], Loc[36], C[36], F[150], InvF[150], Mod = 1000000007;
int D[36][36], TD[36][36]; // 한 블럭의 크기, 블럭의 개수, 쓴거의 개수

int Pow(int a, int b) {
	int r = 1;
	while (b) {
		if (b & 1)r = 1ll * r*a%Mod;
		a = 1ll * a*a%Mod; b >>= 1;
	}
	return r;
}
int Comb(int n, int r) {
	return 1ll * F[n] * InvF[r] % Mod*InvF[n - r]%Mod;
}

int Do(int A, int B) { // R* : A, RBxx : B
	int i, c1 = 0, c2 = 0, j, k, ii, jj;
	if (!A && !B)return 1;
	for (i = 0; i < K; i++) {
		chk[i] = 0;
		if (p[i] == 'r' && c1 < B) {
			chk[i] = 1;
			c1++;
		}
		if (p[i] == 'b' && c2 < c1) {
			chk[i] = 1;
			c2++;
			Loc[c2] = i;
		}
	}
	if (c1 < B || c2 < B)return 0;
	c1 = 0;
	for (i = 0; i < K; i++) {
		if (p[i] == 'r' && !chk[i] && c1 < A) {
			chk[i] = 1;
			c1++;
		}
	}
	if (c1 < A)return 0;
	for (i = 1; i <= B; i++) {
		C[B-i+1] = 0;
		for (j = Loc[i]; j < K; j++)if (!chk[j])C[B-i+1]++;
	}
	for (i = 0; i < 36; i++)for (j = 0; j < 36; j++)D[i][j] = TD[i][j] = 0;
	D[0][0] = InvF[A];

	for (i = 0; i <= n / 2; i++) {
		for (j = 0; j < 36; j++) {
			for (k = 0; k < 36; k++) {
				if (!D[j][k])continue;
				for (ii = 0;; ii++) {
					int s = (ii*i + k);
					if (ii+j > B || s * 2 + A + B + (A + B - 1) > n || C[j+ii] < s)break;
					TD[j + ii][s] = (TD[j + ii][s] + 1ll * D[j][k] * InvF[ii]) % Mod;
				}
			}
		}
		for (j = 0; j < 36; j++)for (k = 0; k < 36; k++) {
			D[j][k] = TD[j][k];
			TD[j][k] = 0;
		}
	}
	int r = 0;
	for (i = 0; i < 36; i++) {
		int c = (A + B + A + B - 1 + i * 2);
		int t = c + B * 2 + 2;
		if (!D[B][i] || n-c < 0)continue;
		r = (r + 1ll * D[B][i] * F[A+B] % Mod * Comb(t + (n - c) - 1, (n - c)))%Mod;
	}
	return r;
}
int main() {
	int i, j, res = 0;
	F[0] = 1;
	for (i = 1; i <= 142; i++)F[i] = 1ll * F[i - 1] * i%Mod;
	for (i = 0; i <= 142; i++)InvF[i] = Pow(F[i], Mod - 2);
	scanf("%d%d", &n, &K);
	scanf("%s", p);
	for (i = 0; i <= (n+1)/2; i++) {
		for (j = 0; i + j <= (n + 1) / 2; j++) {
			res = (res + Do(i, j))%Mod;
		}
	}
	printf("%d\n", res);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	int h, w, n; cin >> h >> w >> n;
	cout << min((n+h-1)/h, (n+w-1)/w) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int>v(n, 0);
	deque<pair<int, int>>deq;
	deq.push_front(make_pair(1, 1));
	while (!deq.empty()) {
		auto mon = deq.front();
		deq.pop_front();
		if (v[mon.first] > 0) continue;
		v[mon.first] = 1;
		if (mon.first == 0) {
			cout << mon.second << endl;
			return 0;
		}
		deq.push_front(make_pair((mon.first * 10) % n, mon.second));
		deq.push_back(make_pair((mon.first + 1) % n, mon.second + 1));
	}
}


Measured memory_bytes: 1408
//written by libra9z
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <valarray>
#include <utility>
#include <numeric>
#include <memory>
#include <functional>
#include <stdexcept>
#include <typeinfo>
#include <limits>
#include <complex>
#include <locale>
using namespace std;
#define Debug(x) cerr << #x << " = " << x << endl
#define Debug22(x,y) cerr<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<endl;
#define Debug2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define Debug3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<")\n";
#define Debug_arr(v,n) for(int i=0;i<n;++i) cerr<<#v<<"["<<i<<"]"<<" = "<<v[i]<<endl;
#define SET(p,v) fill((__typeof(**p)*)p,(__typeof(**p)*)p+sizeof(p),v);
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define prl cerr << "called: " << __LINE__ << endl
#define all(s) s.begin(),s.end()
int n,a[15];
int main()
{
	cin>>n;
	int p=1;
	for (int i=0;i<n;++i)
	{
		cin>>a[i];
		p*=(1+!(a[i]&1));
	}
	int ans=(int)pow(3,n)-p;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int k,n,sum,a[55];
int main()
{
    fast;
    cin>>k>>n;
    for (int i=1;i<=k;i++)
       cin>>a[i];
    sort(a,a+k+1);
    for (int i=k;i>=k-n+1;i--)
      sum+=a[i];
    cout<<sum<<endl;
    return 0;
}

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

#define INF 2e9

#define REP(i,n) for(int i = 0; i < n;++i)
#define REPA(i,a,n) for(int i = a; i < n; ++i)
#define REPR(i,a) for(int i = a; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;

int gcd(int a, int b){ return b ? gcd(b, a % b) : a; }
template<typename A> void printsn(A a){ cout << a << endl; }
template<typename A, typename... B> void printsn(A a, B... b){ cout << a << ' '; printsn(b...); }

int main() {

    ll N, min = 1000000000001;

    cin >> N;

    double times = sqrt(N);

    for(ll i = 1; i < 1000001; i++){
        if(N % i == 0){
            if(min > i + (ll)(N / i) - 2){
                min = i + (ll)(N / i) - 2;
            }
        }
    }

    printsn(min);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    }    
  
  int main(){
   string s;
   cin>>s;
   bool isp=true;
   lint n=s.size();
   rep(i,n/2){
        if(s[i]!=s[n-i-1])isp=false;
   }
   rep(i,(n-1)/4){
       if(s[i]!=s[(n-1)/2-1-i])isp=false;
   }
   repp(i,(n+3)/2-1,n){
       if(s[i]!=s[n-i-1])isp=false;
   }
   if(isp)cout<<"Yes";
   else cout<<"No";
  }
  
  
     
  

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

set<int> si;
vector< pair<double, ll> > vdx[3], vd;
double t;
ll n;

int main(){
	REP(i, 3){
		REP(j, 8){
			cin >> n >> t;
			vdx[i].push_back(make_pair(t, n));
			vd.push_back(make_pair(t, n));
		}
		sort(ALL(vdx[i]));
	}
	sort(ALL(vd));
	REP(i, 3){
		REP(j, 2){
			cout << vdx[i][j].second << " " << vdx[i][j].first << endl;
			si.insert(vdx[i][j].second);
		}
	}
	int co = 0;
	REP(i, 24){
		if (si.find(vd[i].second) == si.end()){
			cout << vd[i].second << " " << vd[i].first << endl;
			co++;
		}
		if (co >= 2)break;
	}
}

Measured memory_bytes: 1300
def gcd(a, b)
  if b == 0 then
    a
  else
    gcd b, a % b
  end
end

while str = gets do
  arr = str.split(nil).map{|s| s.to_i }
  g = gcd arr[0], arr[1]
  l = arr[0] * arr[1] / g

  print g, " ", l, "\n"
end

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

using namespace std;
using ll = long long;

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

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

int main() {
	ll n,m;
	cin >> n ;

	map<int, int> um;

	REP(i,n) {
		cin >> m;
		if(um.count(m) > 0) {
			cout << "NO" <<  endl;
			return 0;
		} else {
			um.insert(make_pair(m, 1));
		}
	}

	cout << "YES" << endl;
}


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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni();
        int ans = 0;
        for (int i = 0; i*4 <= n; i++) {
            if((n-i*4)%7==0) ans++;
        }
        out.println(ans>0?"Yes":"No");
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 22484
def main():
    N, L = (int(i) for i in input().split())
    A = [int(i) for i in input().split()]

    ma = 0
    idx = -1
    for i in range(N-1):
        if ma < A[i] + A[i+1]:
            ma = A[i] + A[i+1]
            idx = i+1
    if ma < L:
        return print("Impossible")
    print("Possible")
    for i in range(1, idx):
        print(i)
    for i in range(idx, N)[::-1]:
        print(i)


if __name__ == '__main__':
    main()


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


int main(void) {
  int a;
  string s;
  cin >> a >> s;
  if(a >= 3200) cout << s << endl;
  else cout << "red" << endl;

  return 0;
}


Measured memory_bytes: 256
l = [[int(i) for i in input().split()] for x in range(3)]
total1 = 0
total2 = 0
for i in range(3):
    total1 += sum(l[i])
    total2 += l[i][i]
    
if total1 == total2 * 3:
    print('Yes')
else:
    print('No')


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int r;
    cin >> r;
    if (r < 1200) {
        cout << "ABC" << endl;
    } else if (r < 2800) {
        cout << "ARC" << endl;
    } else {
        cout << "AGC" << endl;
    }

}



Measured memory_bytes: 256
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in1(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in1(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    int N, M;
    in2(N, M);

    vi P(M), Y(M);
    rep(i, M)
    {
        in2(P[i], Y[i]);
    }

    vvi x(N + 1);

    rep(i, M)
    {
        x[P[i]].push_back(Y[i]);
    }

    rep(i, N + 1)
    {
        sort(all(x[i]));
    }


    rep(i, M)
    {
        auto itr = lower_bound(all(x[P[i]]), Y[i]);
        int dist = distance(x[P[i]].begin(), itr) + 1;
        std::cout << std::setfill('0') << std::right << std::setw(6) << P[i];
        std::cout << std::setfill('0') << std::right << std::setw(6) << dist;
        cout << endl;
    }

    return 0;
}


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

int avd(int x, int y){
    if (x > y)
        return(x - y);
    else
        return(y - x);
}

int main(void){
    // Your code here!
    int n;
    cin>> n;
    vector<int> x(n), y (n);
    for (int i = 0; i < n; i++)
        cin >> x.at(i);
    for (int i = 0; i < n; i++)
        cin >> y.at(i);
        
    double d = 0;
    for (int i = 0; i < n; i++)
        d += avd(x.at(i),y.at(i));
    cout << d << endl;
    
    d = 0;
    for (int i = 0; i < n; i++)
        d += avd(x.at(i),y.at(i)) * avd(x.at(i),y.at(i));
    d = sqrt(d);
    cout <<  fixed << setprecision(15) << d << endl;
    
    d = 0;
    for (int i = 0; i < n; i++)
        d += avd(x.at(i),y.at(i)) * avd(x.at(i),y.at(i)) * avd(x.at(i),y.at(i));
    d = pow(d,0.333333333333333333);
    cout <<  fixed << setprecision(15) << d << endl;
    
    d = avd(x.at(0),y.at(0));
    for (int i = 0; i < n; i++){
        if (d < avd(x.at(i),y.at(i)))
            d = avd(x.at(i),y.at(i));
    }
    cout << d << endl;
}



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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)

const static int MOD = 1000000000 + 7;
const static llong INF = 1LL << 60;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

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

    int n, m;
    cin >> n >> m;
    vector<int> number_of_input_edge(n, 0);
    vector<vector<int> > g(n), gi(n);
    rep(i, n - 1 + m) {
        int a, b;
        cin >> a >> b;
        g[a - 1].push_back(b - 1);
        gi[b - 1].push_back(a - 1);
        ++number_of_input_edge[b - 1];
    }

    int root = 0;
    rep(i, n) {
        if (number_of_input_edge[i] == 0) root = i;
    }

    vector<int> S;
    S.push_back(root);

    vector<int> sorted_g;
    while (S.size() != 0) {
        int v = S.back();
        S.pop_back();

        sorted_g.push_back(v);
        rep(i, g[v].size()) {
            --number_of_input_edge[g[v][i]];
            if (number_of_input_edge[g[v][i]] == 0) S.push_back(g[v][i]);
        }
    }

    map<int, int> vertex_rank;
    rep(i, sorted_g.size()) vertex_rank[sorted_g[i]] = i;

    rep(i, n) {
        int par;
        int dist = 1000000000;
        if (vertex_rank[i] == 0) {
            cout << 0 << endl;
            continue;
        }

        rep(j, gi[i].size()) {
            if (vertex_rank[gi[i][j]] > vertex_rank[i]) continue;

            if ((vertex_rank[i] - vertex_rank[gi[i][j]]) < dist) {
                par = gi[i][j];
                dist = vertex_rank[i] - vertex_rank[gi[i][j]];
            }
        }

        cout << par + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 17276
#include<iostream>
#include<string>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<cstdlib>
#include<queue>
#include<utility> //pair
using namespace std;

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

typedef long long ll;
typedef vector<vector<int>> Graph;

int main() {
	//入力;
	int a, b;

	cin >> a >> b;
	if ((a * b) % 2 == 0) cout << "No";
	else cout << "Yes";
	cout << endl;

	//小数点以下の桁数表示;
	//cout << fixed << setprecision(15);

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
char str[100][10000]={"kogakubu10gokan"};
 
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	int val=0;
	int at=0;
	
	for(int i=0;i<a;i++){
		int c;
		scanf("%d%s",&c,str[i+1]);
		if(c<=b&&val<c){
			val=c;
			at=i+1;
		}
	}
	//int ret=0;
	printf("%s\n",str[at]);
}

Measured memory_bytes: 1212
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	Info(int arg_to,int arg_cost,bool arg_must_cut){
		to = arg_to;
		cost = arg_cost;
		must_cut = arg_must_cut;
	}
	int to,cost;
	bool must_cut;
};

bool check[1000];
vector<Info> V[1000];

int dfs(int parent_id,int node_id){

	int ret = 0,tmp;

	for(int i = 0; i < V[node_id].size(); i++){
		if(V[node_id][i].to != parent_id){

			if(check[V[node_id][i].to]){
				ret += V[node_id][i].cost;
				V[node_id][i].must_cut = true;
			}else{
				tmp = dfs(node_id,V[node_id][i].to);
				if(V[node_id][i].cost <= tmp){
					ret += V[node_id][i].cost;
					V[node_id][i].must_cut = true;
				}else{
					ret += tmp;
				}
			}
		}
	}
	return ret;
}

int main(){

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


	int tmp;

	check[0] = false;
	for(int i = 1; i <= N-1; i++){
		scanf("%d",&tmp);
		check[i] = (tmp > 0);
	}

	int from,to,cost;

	for(int loop = 0; loop < N-1; loop++){
		scanf("%d %d %d",&from,&to,&cost);
		V[from].push_back(Info(to,cost,false));
		V[to].push_back(Info(from,cost,false));
	}

	dfs(-1,0);

	queue<int> Q;
	Q.push(0);

	int ans = 0;

	bool visited[N];
	visited[0] = true;
	for(int i = 1; i <= N-1; i++)visited[i] = false;

	while(!Q.empty()){

		for(int i = 0; i < V[Q.front()].size(); i++){
			if(V[Q.front()][i].must_cut){
				ans += V[Q.front()][i].cost;
			}else{
				if(visited[V[Q.front()][i].to] == false){
					visited[V[Q.front()][i].to] = true;
					Q.push(V[Q.front()][i].to);
				}
			}
		}
		Q.pop();
	}

	printf("%d\n",ans);

	return 0;

}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    int ans = n;
    for(int i = 0; i < n - 1; i++) {
        if(s[i] != s[i + 1]) {
            chmin(ans, max(i + 1, n - i - 1));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
n, m = map(int, input().split())
A = list(map(int, input().split()))

s = sum(A) / (4 * m)
cnt = 0
for a in reversed(sorted(A)):
    if a < s:
        break
    cnt += 1
    if cnt >= m:
        break

if cnt == m:
    print('Yes')
else:
    print('No')

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

int main() {
  int N;
  vector<int>a(100000);  
  cin >> N;
  string ans ="Yes";
  for(int i=0; i<N; i++) cin >> a.at(i);
  for(int i=1; i<N; i++){
    if(a[i-1]<=a[i]-1) a[i] -= 1;
    if(a[i]<a[i-1]){
      ans ="No";
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
x,y = gets.chomp.split(" ").map(&:to_f);

=begin
2*tsuru + 4*kame = y
tsuru + kame = x

100 = tsuru + kame
100 = 2*tsuru + 4*kame


100 - 200 = 2kame


tsuru = x - kame

2 * (x-kame) + 4 * kame = y

2x -2*kame + 4*kame = y

2x +2kame = y
2x-y = -2kame

y-2x = 2kame

=end

if (y - 2 * x) % 2 == 0 &&(y - 2 * x) >= 0 then
	# kame = (y - 2 * x) / 2
	
	if x - ((y - 2 * x) / 2) >= 0 then
		puts "Yes"
	else
		puts"No"
	end
	
else
	puts"No"
end


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

int n;
long long ans;
vector<long long> a, b[21], c;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=0; i<n; ++i){
		long long t;
		cin >> t;
		a.push_back(t);
		for(int j=0; j<20; ++j)
			b[j].push_back((t >> j) % 2 == 1 ? 1 : 0);
	}
	for(int i=0; i<20; ++i)
		b[i].push_back(1);
	for(int i=0; i<20; ++i)
		for(int j=1; j<n+1; ++j)
			b[i][j] += b[i][j-1];
//	for(int i=0; i<10; ++i)
//		for(int j=0; j<n; ++j)
//			cout << b[i][j] << (j == n-1 ? "\n" : " ");
	for(int i=0; i<n; ++i){
		long long t = n-i;
		for(int j=0; j<20; ++j)
			if((a[i] >> j) % 2 == 1)
				t = min(t, (long long)(upper_bound(b[j].begin(), b[j].end(), b[j][i])-b[j].begin())-i);
		c.push_back(t);
	}
//	for(int i=0; i<n; ++i)
//		cout << c[i] << (i == n-1 ? "\n" : " ");
	c[n-1] = 1;
	++ans;
	for(int i=n-2; i>=0; --i){
		c[i] = min(c[i], 1+c[i+1]);
		ans += c[i];
	}
	cout << ans << "\n";
}

Measured memory_bytes: 36120
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
 
  using namespace std;
   

//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ
  typedef long long ll;
  typedef long double lld;
//   typedef string str;
//   typedef unsigned long long ull;
  ll INF = INT_MAX;
  ll mod = 1000000007;
  lld PI = 3.141592653;

// const int N = 2e5 + 5;

// int a[N];
// int n,k;
  


  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
     
     int n;
     ll k;
     cin>>n;
     cin>>k;
     vector<int> a(n+1);
     for (int i = 1;i<=n;i++) cin>>a[i];
      map<int, int> been_here;
    int step = 1;
  int now = 1;
  now = a[now];
  been_here[1] = step;
  step++;

  while (!been_here[now]){
    been_here[now] = step;
    step++;
    now = a[now];
  }
  // for (int i = 1;i<=n;i++) cout<<been_here[i]<<" ";
  //   cout<<endl;
  ll before = been_here[now]-1;
  ll cycle = step - been_here[now];
  // cout<<cycle<<endl;
  if (k<=before+cycle){
    now = 1;
    while(k--){
      now = a[now];
    }
    cout<<now<<"\n";
    return 0;
  }
  int start = now;
  k-=before;
  // cout<<start<<endl;
  k%=cycle;
  while (k--){
    start = a[start];
  }
  cout<<start<<"\n";
   
}
  

Measured memory_bytes: 12720
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
//----------------------------------------------------------------

int MOD = 998244353;
// int MOD = 1000000007;

//----------------------------------------------------------------
signed main(){
   
    int n;
	string s;
	cin >> n >> s;
	if(n%2 == 1){
		cout << "No" << endl;
		return 0;
	}else{
		rep(i,n/2){
			if(s[i] != s[i+n/2]){
			cout << "No" << endl;
		return 0;
			}
		}
		cout << "Yes" << endl;
	}


	
	return 0;
}

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

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://nikkei2019-2-qual.contest.atcoder.jp/tasks/nikkei2019_2_qual_b
// rm -r -f test;oj dl https://abc145.contest.atcoder.jp/tasks/abc145_b

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long i=cc;i<n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
using ll = long long;
int main() {
    int n, x, y;
    cin >> n >> x >> y;
    vector<int> dist(n);
    rep(i, 1, n){
        rep(j, i+1, n+1){
            int d = min({abs(j-i), (abs(x-i)+ abs(y-j)+1),(abs(x-i)+ abs(y-j)+1)});
            dist[d]++;
        }
    }
    rep(i, 1, n) cout << dist[i] << endl;
}

Measured memory_bytes: 256
N = int(input())
a = input()
b = input()
c = input()

ans = 0

for i in range(N):
    alc = set()
    alc.add(a[i])
    alc.add(b[i])
    alc.add(c[i])
    r = len(alc)
    if r == 1:
        pass
    elif r == 2: 
        ans += 1
    elif r == 3:
        ans += 2
    else:
        raise Exception("nandeya")

print(ans)


Measured memory_bytes: 3060
//
//  main.cpp
//  project for C++
//
//  Created by 伊藤博隆 on 2020/04/17.
//  Copyright © 2020 伊藤博隆. All rights reserved.
//

#include <iostream>
#include<set>
#include<string>
#include <sstream>

using namespace std;
int A,B,C,X,Y;
int main(){
    cin >> A >> B >> C >> X >> Y ;
    if (X>=Y) {
         cout << min({A*X+B*Y, A*(X-Y)+2*C*Y, max(2*C*Y , 2*C*X)});
    }else{
   cout << min({A*X+B*Y, B*(Y-X)+2*C*X, max(2*C*Y , 2*C*X)});
    }
    return 0;
}




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


def solve(N: int, S: "List[str]"):
    return len(set(S))


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    N = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(N)]  # type: "List[str]"
    answer = solve(N, S)
    print(answer)


if __name__ == "__main__":
    main()


Measured memory_bytes: 68920
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;
 
#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int main() {
  string s;
  cin >> s;
  if((s[0] == s[1] && s[1] == s[2]) ||(s[1] == s[2] && s[2] == s[3]) )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int  a,s,d,f;
  cin>>a>>s>>d>>f;
  int total=0;
  if(a>=s)total+=s;
  else total+=a;
  if(d>=f)total+=f;
  else total+=d;
  cout<< total<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  char a;
  cin >> a;
  if (a == 'A') cout << 'T' << endl;
  else if (a == 'T') cout << 'A' << endl;
  else if (a == 'G') cout << 'C' << endl;
  else if (a == 'C') cout << 'G' << endl;

}

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

int main() {
  string ABCD;
  cin >> ABCD;
  
  rep(bit, (1 << 3)) {
    string ex_s = ABCD;
    int idx = 1;
    
    // insert op
    rep(i, 3) {
      string op = "-";
      if (bit >> i & 1) { op = "+"; }
      ex_s.insert(i+idx, op);
      idx++;
    }
    
    int sum = ex_s.at(0) - '0';
    int op_idx = 1;
    rep(i, 3) {
      if (ex_s.at(op_idx) == '+') { sum += ex_s.at(op_idx+1) - '0'; }
      if (ex_s.at(op_idx) == '-') { sum -= ex_s.at(op_idx+1) - '0'; }
      op_idx += 2;
    }
    if (sum == 7) {
      cout << ex_s << "=" << sum << endl; 
      return 0;
    }
  }
}

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

using namespace std;

typedef long long ll;

int main(){
	int n, m;
	cin >> n >> m;
	int food[m] = {0};
	for(int i = 0; i < n; i++){
		int k;
		cin >> k;
		int f;
		for(int j = 0; j < k; j++){
			cin >> f;
			f--;
			food[f]++;
		}
	}
	int ans = 0;
	for(int i = 0;  i < m; i++)if(food[i] == n)ans++;
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
 ll A,B,C,K;
  cin>>A>>B>>C>>K;
  if(K<=A) {
cout<<K<<endl;
    return 0;
  }
  else if(K>A+B) {
cout<<2*A+B-K<<endl;
  }
  else {
cout<<A<<endl;
  }
}


Measured memory_bytes: 3444
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <tuple>
#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)

typedef long long ll;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::pair<ll, ll> pll;

using namespace std;

struct compare {
    bool operator()(const std::string& first, const std::string& second) {
        return first.size() < second.size();
    }
};


int main() 
{
    int n; 
    cin >> n;
    v_int ans(26, 51);
    string alpha = "abcdefghijklmnopqrstuvwxyz";

    irep(i, n) {
        string tmp;
        cin >> tmp;
        v_int abc(26, 0);
        irep(j, tmp.size()) {
            abc[tmp[j] - 'a']++;
        }

        irep(j, 26) {
            ans[j] = min(ans[j], abc[j]);    
        }
    }

    irep(i, 26) {
        irep(j, ans[i]) {
            cout << alpha[i];
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
using System;


namespace ConsoleApplication8
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] input = Console.ReadLine().Split(' ');
            int r = int.Parse(input[0]);
            int c = int.Parse(input[1]);
            int yoko = 0;
            int abSum = 0;
            int[,] rc = new int[r + 1, c + 1];
            for (int tate = 0; tate < r; tate++)
            {
                String[] input2 = Console.ReadLine().Split(' ');
                int aSum = 0;
                for (yoko = 0; yoko < c; yoko++)
                {
                    int a = int.Parse(input2[yoko]);
                    rc[tate, yoko] = a;
                    aSum += a;
                    rc[r, yoko] += rc[tate, yoko];
                }
                rc[tate, c] = aSum;
                abSum += aSum;
            }
            rc[r, c] += abSum;
            for (int tate = 0; tate < r + 1; tate++)
            {
                for (yoko = 0; yoko < c + 1; yoko++)
                {
                    Console.Write(rc[tate, yoko]);
                    if (yoko < c)
                    {
                        Console.Write(" ");
                    }
                    
                }
                Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 9196
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

int main(){
    int n;
    cin>>n;
    if(n<1000)cout<<"ABC"<<endl;
    else cout<<"ABD"<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef pair<int,int> P;
const int INF=100000000;

int dis[1010][1010];
int dh[4]={1,0,-1,0},dw[4]={0,1,0,-1};
queue<P> que;
int main(){
	int H,W;
	int ans=0;
	cin>>H>>W;	
	
        for(int i=0;i<H;i++)
	{
		string s;
		cin>>s;
		for(int j=0;j<W;j++)
		{
			dis[i][j]=INF;
			if(s[j]=='#')
			{
				que.push(P(i,j));
				dis[i][j]=0;
			}
		}
	}
	
	while(que.size())
	{
		P p=que.front();
		que.pop();
		
		for(int i=0;i<4;i++)
		{
			int nh=p.first+dh[i],nw=p.second+dw[i];
			if(0<=nh && nh<H && 0<=nw && nw<W && dis[nh][nw]==INF)
			{
				que.push(P(nh,nw));
				dis[nh][nw]=dis[p.first][p.second]+1;
				ans=max(ans,dis[nh][nw]);
			}
		}	
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 12432
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <stdlib.h>
using namespace std;

int main()
{
	int N, X;
	cin >> N >> X;

	vector<int> L(N + 2);
	L[0] = 0;
	L[1] = 0;
	for (int i = 2; i <= N + 1; i++)
	{
		cin >> L[i];
	}

	int cnt = 0;
	int ans = 0;
	for (int i = 2; i <= L.size(); i++)
	{
		ans = ans + L[i - 1];

		if (ans > X)
		{
			break;
		}
		cnt++;

	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    int ans = 0;
    for(int i = 0; i < N; i++){
        if(i % 2 == 0 && A[i] % 2 == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
-- https://github.com/minoki/my-atcoder-solutions
import Data.Char (isSpace)
import Data.List (unfoldr, tails)
import Control.Monad (replicateM)
import qualified Data.ByteString.Char8 as BS
import qualified Data.Map.Strict as Map

main = do
  n <- readLn
  coords <- replicateM n $ do
    [x,y] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    return (x,y)
  let m = Map.fromListWith (+)
          [(c, 1) | (x,y):ts <- tails coords
                  , (x',y') <- ts
                  , let dx = x - x'
                        dy = y - y'
                        c | dx > 0 = (dx, dy)
                          | dx < 0 = (-dx, -dy)
                          | dy > 0 = (dx, dy)
                          | otherwise = (-dx, -dy)
                  ]
  let k | Map.null m = 0 -- n == 1
        | otherwise = maximum $ Map.elems m
  print $ n - k


Measured memory_bytes: 1148
#include<iostream>
#include<cstring> 
using namespace std;
int ans=-1,sum=-1;
string h;
int main()
{
	getline(cin,h);
	int len1=h.size();
	for(int i=0;i<len1;i++)
	{
		if(h[i]=='C')
			ans=i;
		if(h[i]=='F')
			sum=i;
	}
	if(sum>ans&&sum!=-1&&ans!=-1)
	{
		cout<<"Yes";
		return 0;
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>

using namespace std;

typedef long long ll;

struct High {
    ll x, y, h;
    High(ll x, ll y, ll h) : x(x), y(y), h(h) {}
};

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    ll n, m;
    cin >> n >> m;
    
    vector<ll> d;
    for (ll x = 1; x * x <= m; ++x) {
        if (m % x == 0) {
            d.push_back(x);
            d.push_back(m / x);
        }
    }
    
    sort(d.rbegin(), d.rend());
    for (int i = 0; i < d.size(); ++i) {
        if ((m / d[i]) >= n) {
            cout << d[i] << endl;
            return 0;
        }
    }
    
    return 0;
}


Measured memory_bytes: 256