akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=1e6;
int n,s[N+1],t[N+1];
int hea=1,tai,que[N+1];
int res;
void input(int x[])
{
	static char str[N+2];
	scanf("%s",str+1);
	for(int i=1;i<=n;++i) {
		x[i]=str[i]-'a';
	}
	return;
}
bool check0()
{
	for(int i=1;i<=n;++i) {
		if(s[i]!=t[i]) {
			return false;
		}
	}
	return true;
}
int main()
{
	scanf("%d",&n);
	input(s);
	input(t);
	if(check0()) {
		puts("0");
		return 0;
	}
	for(int spos=n,tpos=n;tpos;--tpos) {
		while((tpos>1)&&(t[tpos-1]==t[tpos])) {
			--tpos;
		}
		while(spos&&((spos>tpos)||(s[spos]!=t[tpos]))) {
			--spos;
		}
		if(!spos) {
			puts("-1");
			return 0;
		}
		while((hea<=tai)&&(que[hea]-(tai-hea+1)+1>tpos)) {
			++hea;
		}
		que[++tai]=spos;
		if(tpos!=1) {
			res=max(res,tai-hea+1);
		}
	}
	++res;
	printf("%d\n",res);
	return 0;
}


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

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int R;
    cin >> R;
    if(R<1200){
        cout << "ABC" << endl;
    }
    else if(R<2800){
        cout << "ARC" <<endl ;
    }else{
        cout << "AGC" << endl;
    }
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main()
{
 
    int a[100][100] = {0},b[100][100] = {0};
    long sum = 0;
 
    int n, m, l;
    cin >> n >> m >> l;
 
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> a[i][j];
        }
    }
 
    for(int i = 0; i < m; i++){
        for(int j = 0; j < l; j++){
            cin >> b[i][j];
        }
    }
 
    for(int i = 0; i < n; i++){
        for(int j = 0; j < l; j++){
            sum = 0;
            for(int k = 0; k < m; k++){
            sum += a[i][k] * b[k][j];
            }
            cout << sum;
            if(j < l - 1){
                cout << ' ';
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1248
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>
#include <set>

struct Coordinate {
	int x, y;
	std::vector<Coordinate> neighbors() const {
		return std::vector<Coordinate> {
			Coordinate{ x - 1, y },
				Coordinate{ x + 1, y },
				Coordinate{ x, y - 1 },
				Coordinate{ x, y + 1 },
				Coordinate{ x - 1, y - 1 },
				Coordinate{ x - 1, y + 1 },
				Coordinate{ x + 1, y - 1 },
				Coordinate{ x + 1, y + 1 }
		};
	}
};
int count(const std::vector<std::string>& state, const std::string& word, const Coordinate current, int position = 0, int used = 0) {
	if (current.x < 0 || state.size() <= current.x || current.y < 0 || state[current.x].size() <= current.y) return 0;
	if ((used & (1 << (current.x * 4 + current.y))) != 0) return 0;
	if (state[current.x][current.y] != word[position]) return 0;
	if (position + 1 == word.size()) return 1;
	used |= 1 << (current.x * 4 + current.y);
	int result = 0;
	for (const auto next : current.neighbors()) {
		result += count(state, word, next, position + 1, used);
	}
	return result;
}
int main() {
	int n; std::cin >> n;
	std::vector<std::pair<std::string, long long int>> words(n);
	for (auto& pair : words) std::cin >> pair.first >> pair.second;
	std::vector<std::string> state(4); for (auto& line : state) std::cin >> line;
	std::vector<int> pattern(n, 0);
	for (auto i = 0; i < words.size(); ++i) {
		for (auto x = 0; x < 4; ++x) for (auto y = 0; y < 4; ++y) {
			pattern[i] += count(state, words[i].first, Coordinate{ x, y });
		}
	}
	int t; std::cin >> t;
	std::vector<long long int> memo(t + 1, 0);
	for (auto i = 0; i < words.size(); ++i) {
		int pat = pattern[i];
		for (auto j = 0; pat >= (1 << j); ++j) {
			pat -= 1 << j;
			for (auto k = t; k >= (words[i].first.size() << j); --k) {
				memo[k] = std::max(memo[k], memo[k - (words[i].first.size() << j)] + (words[i].second << j));
			}
		}
		if (pat != 0) for (auto k = t; k >= pat * words[i].first.size(); --k) {
			memo[k] = std::max(memo[k], memo[k - pat * words[i].first.size()] + pat * words[i].second);
		}
	}
	std::cout << memo.back() << std::endl;
}



Measured memory_bytes: 3292
#include <bits/stdc++.h>
#define PI 3.14159265358979323
typedef long double LD;

using namespace std;

int main(){
    int a,b,h,m;
    cin >> a >> b >> h >> m;

    LD rad = PI*2*((LD)h/12.0 + ((LD)m/60.0) /12.0  - (LD)m/60.0 );
    LD rsq = (LD)(a*a + b*b) - (LD)(2*a*b)* cos(rad);

    printf("%20.20Lf\n",sqrt(rsq));

}

Measured memory_bytes: 4104
#include <stdio.h>
#include <inttypes.h>

int main(void)
{
    size_t n;
    scanf("%zu", &n);
    int_fast32_t max = INT_FAST32_MIN;
    int_fast32_t min = INT_FAST32_MAX;
    for (size_t i = 0; i < n; ++i) {
        int_fast32_t a;
        scanf("%" SCNdFAST32, &a);
        if (max < a) {
            max = a;
        }
        if (min > a) {
            min = a;
        }
    }
    printf("%" PRIdFAST32 "\n", max - min);
    return 0;
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define rrep(i,n) for(int i = n - 1; i >= 0; i--)
#define REP(i,k,n) for(int i = k; i < n; i++)

#define vi vector<int>
#define pb push_back
using namespace std;

int w,h;
const int pmax = 130000 * 2;
int main(){

    int p[pmax];
    rep(i,pmax) p[i] = 1;
    p[0] = p[1] = 0;
    for(int i = 2; i * i < pmax; i++) {
        if(p[i] != 0) {
            for(int j = i * 2; j <= pmax; j += i) {
                p[j] = 0;
            }
        }
    }
    REP(i,1,pmax) p[i] += p[i - 1];
    int n;
    while(cin >> n,n) {
        cout << p[2 * n] - p[n] << endl;
    }
    return 0;

}



Measured memory_bytes: 4104
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
bool chk(string s){
  if(s[0]!='A') return false;
  int C=0;
  for(int i=2;i<s.length()-1;i++){
    if(s[i]=='C'){
      C++;
    }
  }
  if(C!=1) return false;
  int upper=0;
  for(int i=0;i<s.length();i++){
    if(s[i]>='A' && s[i]<='Z'){
      upper++;
    }
  }
  if(upper!=2)return false;
  return true;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s; cin >> s;
    if(chk(s)) OUT("AC");
    else OUT("WA");

    return 0;
}



Measured memory_bytes: 256
import sys
input=sys.stdin.readline
from collections import deque

def main():
    mod=1000000007
    inv=lambda x: pow(x,mod-2,mod)    
    n=int(input())
    Fact=[1]
    for i in range(1,n+1):
        Fact.append(Fact[i-1]*i%mod)
    Finv=[0]*(n+1)
    Finv[-1]=inv(Fact[-1])
    for i in range(n-1,-1,-1):
        Finv[i]=Finv[i+1]*(i+1)%mod
    Edges=[[] for _ in range(n)]
    for _ in range(n-1):
        a,b=map(int,input().split())
        a-=1; b-=1
        Edges[a].append(b)
        Edges[b].append(a)
    Stack=[0]
    Par=[-1]*n
    Order=[]
    while Stack:
        v=Stack.pop()
        Order.append(v)
        for c in Edges[v]:
            if c!=Par[v]:
                Stack.append(c)
                Par[c]=v
    DP=[1]*n
    Size=[1]*n
    for v in Order[::-1]:
        DP[v]*=Fact[Size[v]-1]
        DP[v]%=mod
        p=Par[v]
        if p==-1:
            continue
        Size[p]+=Size[v]
        DP[p]*=DP[v]*Finv[Size[v]]
        DP[p]%=mod
    Ans=[0]*n
    que=deque()
    que.append((0,-1,1))
    while que:
        v,par,par_cnt=que.popleft()
        Left=[1]
        for to in Edges[v]:
            tmp=DP[to]*Finv[Size[to]]
            if to==par:
                tmp=par_cnt*Finv[n-Size[v]]
            Left.append(Left[-1]*tmp%mod)
        Right=[1]
        for to in reversed(Edges[v]):
            tmp=DP[to]*Finv[Size[to]]
            if to==par:
                tmp=par_cnt*Finv[n-Size[v]]
            Right.append(Right[-1]*tmp%mod)
        Ans[v]=Left[-1]*Fact[n-1]%mod
        m=len(Edges[v])
        for i,to in enumerate(Edges[v]):
            if to!=par:
                que.append((to,v,Left[i]*Right[m-i-1]*Fact[n-Size[to]-1]%mod))
    print(*Ans,sep="\n")
    
if __name__=='__main__':
    main()

Measured memory_bytes: 124704
#include<iostream>
#define MAX 10000
#define NIL -1
using namespace std;

struct Node {
  int parent = NIL, left = NIL, right = NIL;
};

Node nodes[MAX];

int getDegree(int u) {
  int d = 0;
  if (nodes[u].right != NIL) d++;
  if (nodes[u].left != NIL) d++;
  return d;
}

int getDepth(int u) {
  int d = 0;
  if (nodes[u].parent != NIL) {
    d = getDepth(nodes[u].parent) + 1;
  }
  return d;
}

int getHeight(int u) {
  int h1 = 0, h2 = 0;

  if (nodes[u].right != NIL) {
    h1 = getHeight(nodes[u].right) + 1;
  }

  if (nodes[u].left != NIL) {
    h2 = getHeight(nodes[u].left) + 1;
  }

  return max(h1, h2);
}

int getSiblings(int u) {
  int parent = nodes[u].parent;
  if (parent == NIL) return NIL;
  if (u == nodes[parent].left) return nodes[parent].right;
  if (u == nodes[parent].right) return nodes[parent].left;
  return NIL;
}

void print(int u) {
  Node n = nodes[u];
  int siblings = getSiblings(u);
  int degree = getDegree(u);
  int depth = getDepth(u);
  int height = getHeight(u);

  cout << "node " << u << ": ";
  cout << "parent = " << n.parent << ", ";
  cout << "sibling = " << siblings << ", ";
  cout << "degree = " << degree << ", ";
  cout << "depth = " << depth << ", ";
  cout << "height = " << height << ", ";
  if (n.parent == NIL) cout << "root";
  else if (height == 0) cout << "leaf";
  else cout << "internal node";
  cout << endl;
}

int main() {
  int n, i, p, l, r;
  cin >> n;

  for (i = 0; i < n; i++) {
    cin >> p >> l >> r;

    if (l != NIL) {
      nodes[l].parent = p;
      nodes[p].left = l;
    }

    if (r != NIL) {
      nodes[r].parent = p;
      nodes[p].right = r;
    }
  }

  for (i = 0; i < n; i++) print(i);

  return 0;
}



Measured memory_bytes: 3240
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

constexpr ll MOD = 1000000007;
vector<vector<int>> a(25, vector<int>(25));
ll dp[1<<23];

int main() {
	int n;
	cin >> n;
	rep (i, n) rep (j, n) cin >> a[i][j];

	dp[0] = 1;
	for (int S = 1; S < (1<<n); S++) {
		int cnt = __builtin_popcount(S);
		rep (j, n) {
			if (S & 1<<j) if (a[cnt-1][j]) {
				dp[S] += dp[S^(1<<j)];
				if (dp[S] > MOD) dp[S] -= MOD;
			}
		}
	}

	cout << dp[(1<<n) - 1] << endl;
	return 0;
}

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

namespace 競プロ_Csharp {
    class Program {
        static void Main(string[] args) {

            int[] a = NextInts();

            int divisorNum = 0;
            for (int i = a[0]; i <= a[1]; i++) {
                if (a[2] % i == 0) divisorNum++;
            }

            Println(divisorNum);

        }

        public static void Println (Object o) {
            Console.WriteLine(o);
        }

        public static string NextString() {
            return Console.ReadLine();
        }

        public static int NextInt () {
            return int.Parse(Console.ReadLine());
        }

        public static int[] NextInts () {
            string[] a = Console.ReadLine().Split();
            int[] b = new int[a.Length];
            for (int i = 0; i < a.Length; i++) {
                b[i] = int.Parse(a[i]);
            }
            return b;
        }

    }
}



Measured memory_bytes: 19964
#include <bits/stdc++.h>
#define rf(x) (x)=0;while(*p<48)p++;while(47<*p)(x)=((x)<<3)+((x)<<1)+(*p++&15);
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define befv(V) ((V)[(sz(V)-2)])
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define rb(x) ((x)&(-(x)))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MAXN = 100005;

vector<int> KV[16];
int dp[1<<15];

int B[16];
int A[MAXN];

int N, Ans;

int main() {
	ios::sync_with_stdio(false);

	cin >> N;
	for(int i = 1, a, b, c; i < N; i++) {
		cin >> a >> b >> c;
		a++; b++;
		A[a] ^= c;
		A[b] ^= c;
	}
	for(int i = 1; i <= N; i++) B[A[i]]++;

	Ans = B[0]; B[0] = 0;
	for(int i = 1; i <= 15; i++) {
		Ans += B[i]/2;
		B[i] &= 1;
	}

	for(int key = 1; key < (1<<15); key++) {
		int mxbit = 0, sum = 0;
		for(int i = 0; i < 15; i++) if(key & (1<<i)) {
			mxbit = i;
			sum ^= i+1;
		}
		if(sum) continue;
		KV[mxbit].eb(key);
	}

	int master = 0;
	for(int i = 0; i < 15; i++) B[i] = B[i+1];
	for(int i = 0; i < 15; i++) if(B[i]) master |= 1<<i;

	dp[0] = 1;
	for(int i = 0; i < 15; i++) if(master & (1<<i)) {
		for(int key = 0; key < (1<<i); key++) {
			int ret = dp[key];
			if(!ret) continue;
			if(key != (master & key)) continue;
			for(int v : KV[i]) {
				if((key & v) || v != (master & v)) continue;
				upmax(dp[key | v], ret + 1);
			}
		}
	}

	Ans += dp[master] - 1;

	cout << (N - Ans) << endl;
	return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Scanner cin = new Scanner();
            string S = Console.ReadLine();

            long ans = 0;
            int index = 0;
            for(int i = 0; i < S.Length; i++)
            {
                if(S[i] == 'W')
                {
                    ans += (long)(i - index);
                    index++;
                }
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }
    }

        class Scanner //標準入力
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int Int()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Int() + add;
            }
            return Array;
        }

        public long Long()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Long() + add;
            }
            return Array;
        }

        public double Double()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Double() + add;
            }
            return Array;
        }
    }
}



Measured memory_bytes: 11744
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    string s, t;
    cin >> s >> t;
    rep(i, s.size()){
        bool flag = true;
        rep(j, s.size()){
            if(s[(i + j) % s.size()] != t[j]){
                flag = false;
                break;
            }
        }
        if(flag){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
//AtCoder ABC063 C - Bugged
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
    ll N;
    cin>>N;
    vector<ll> stbl(N);
    ll ans=0;
    for(auto&& s:stbl){
        cin>>s;
        ans+=s;
    }
    sort(stbl.begin(),stbl.end());
    if (ans % 10==0){
        ll ans2=ans;
        for(const auto& s:stbl){
            if(s%10!=0){
                ans2-=s;
                break;
            }
        }
        ans=(ans==ans2?0:ans2);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#import <stdio.h>

int gcd(int a, int b) {
    int c = a % b;
    if (c) {
        return gcd(b, c);
    } else {
        return b;
    }
}

int main() {
    int A, B;
    scanf("%d %d", &A, &B);

    if (A > B) {
        printf("%d\n", gcd(A, B));
    } else {
        printf("%d\n", gcd(B, A));
    }

    return 0;
}



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

using namespace std;

#define int long long
#define endl '\n'
const int MOD = 1000000007;
const int INF = 1e14;

void solve() {
    int h, n;
    cin >> h >> n;

    vector<pair<int, int>> v;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;

        v.emplace_back(a, b);
    }
    vector<int> dp(h + 1, INF);
    dp[h] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = h; j >= 0; j--) {
            dp[max(j - v[i].first, 0ll)] = min(dp[max(j - v[i].first, 0ll)], dp[j] + v[i].second);
        }
    }
    cout << dp[0] << endl;
}

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

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 384
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("filed 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 main() {
    let n:usize = read();
    let mut v:Vec<usize> = (0..n).map(|_| read()).collect();
    v.sort();
    let mut sm:usize = v.iter().sum();
    let mut iter = v.iter().filter(|&&x| x % 10 != 0);
    if sm % 10 == 0 {
        sm = sm - iter.next().unwrap_or(&sm);
        println!("{}", sm);
    } else {
        println!("{}", sm);
    }
}

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

int main()
{
  int n;
  while (cin >> n) {
    if (n == 0)
      break;

    map<string, int> price;
    for (int i = 0; i < n; ++i) {
      string s;
      int p;
      cin >> s >> p;
      price[s] = p;
    }

    int m;
    cin >> m;
    map<string, vector<string> > alchemy;
    for (int i = 0; i < m; ++i) {
      string s;
      cin >> s;
      int k;
      cin >> k;
      for (int j = 0; j < k; ++j) {
	string q;
	cin >> q;
	alchemy[s].push_back(q);
      }
    }

    bool update = true;
    while (update) {
      update = false;
      for (map<string, vector<string> >::iterator it = alchemy.begin(); it != alchemy.end(); ++it) {
	int sum = 0;
	for (int i = 0; i < it->second.size(); ++i)
	  sum += price[it->second[i]];

	if (price[it->first] > sum) {
	  price[it->first] = sum;
	  update = true;
	  break;
	}
      }
    }

    string target;
    cin >> target;
    cout << price[target] << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main() {
  char str[25];
  scanf("%s", str);
  int len = 0;
  for (int i = 0; str[i] != '\0'; i++) {
    len++;
  }
  for (int i = len - 1; i >= 0; i--) {
    printf("%c", str[i]);
  }
  printf("\n");
  return 0;
}


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

#define mod 1000000007

#define rep(i, n) for(int i=0; i<n; ++i)

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
 
int main(void){
	
	int N, M, X;
	
	cin >> N >> M >> X;
	
	int A[M];
	
	rep(i, M)
		cin >> A[i];
		
	int ans = 0;	
	
	for(int i = X; i <= N; i++)
		for(int j = 0; j < M; j++)
			if(i == A[j])
				ans++;
	
	int count = 0;
	
	for(int i = X; i >= 0; i--)
		for(int j = 0; j < M; j++)
			if(i == A[j])
				count++;
			
	ans = min(ans, count);
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

const double PI = 3.14159265358979323846;
const int MAX = 1e7;
const int MOD = 1e9+7;


int main(int argc, char *args[]) {
	int n;
	cin >> n;
	char s[55];
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	int count = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'A' & s[i + 1] == 'B' & s[i + 2] == 'C') count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {

  std::string S; std::cin >> S;

  int ans = std::numeric_limits<int>::max();
  for(int i=0; i<S.size(); i++) {
    if ( i+3 > S.size() ) break;
    ans = std::min(ans, std::abs(std::stoi(S.substr(i,3))-753));
  }
  std::cout << ans << std::endl;
  return 0;
}

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

class Union_Find_size{
public:
	vector<int> Parent;

	//コンストラクタ
	Union_Find_size(int N){
		Parent=vector<int>(N,-1);
	}

	//木の根を求める
	int root(int x){
		//x（自分）が親ならxを返す
		if(Parent.at(x)<0)	return x;
		//経路圧縮しながら return する
		return Parent.at(x)=root(Parent.at(x));
	}

	//xの属する木の要素数を調べる
	int size(int x){
		return -Parent.at(root(x));
	}

	//xとyが同じ集合に属するかを判定する
	bool same(int x,int y){
		return root(x)==root(y);
	}

	//xとyの属する集合を併合する
	void unite(int x,int y){
		x=root(x);
		y=root(y);
		if(x==y)	return;

		if(size(x)<size(y))	swap(x,y);
		Parent.at(x)+=Parent.at(y);
		Parent.at(y)=x;
	}
};

int main(){
  int N,M,K;
  cin >> N >> M >> K;
  vector<int> A(M),B(M);
  for(int i=0;i<M;i++){
    cin >> A.at(i) >> B.at(i);
    A.at(i)--;
    B.at(i)--;
  }
  vector<int> C(K),D(K);
  for(int i=0;i<K;i++){
    cin >> C.at(i) >> D.at(i);
    C.at(i)--;
    D.at(i)--;
  }

  Union_Find_size Uni(N);
	for(int i=0;i<M;i++){
    if(!Uni.same(A.at(i),B.at(i))){
			Uni.unite(A.at(i),B.at(i));
		}
	}

  vector<vector<int>> graph(N);
  for(int i=0;i<K;i++){
    graph.at(C.at(i)).push_back(D.at(i));
    graph.at(D.at(i)).push_back(C.at(i));
  }

  vector<int> fri(N,1);
  for(int i=0;i<M;i++){
    fri.at(A.at(i))++;
    fri.at(B.at(i))++;
  }
  for(int i=0;i<N-1;i++){
    int ans=Uni.size(i)-fri.at(i);
    for(int j=0;j<graph.at(i).size();j++){
      if(Uni.same(i,graph.at(i).at(j))) ans--;
    }
    cout << ans << " ";
  }
  int ans=Uni.size(N-1)-fri.at(N-1);
  for(int j=0;j<graph.at(N-1).size();j++){
    if(Uni.same(N-1,graph.at(N-1).at(j))) ans--;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8320
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  lint n, k; cin >> n >> k;
  vector<lint> h(n);
  for(int i = 0; i < n; i++) cin >> h[i];
  sort(RALL(h));

  for(int i = 0; i < k and i < n; i++) {
    h[i] = 0;
  }

  lint sum = 0;
  for(int i = 0; i < n; i++) sum += h[i];
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
#define NIL -1
#define MAX 100000

typedef struct{
  int parent,left,right;
}Node;

Node T[MAX];
int n, D[MAX],H[MAX];

void setDepth(int u, int d){
  if(u==NIL)return;
  D[u] = d;
  setDepth(T[u].left,d+1);
  setDepth(T[u].right,d+1);
}

int setHeight(int u){
  int h1 = 0, h2 = 0,h;
  if(T[u].left != NIL)
    h1 = setHeight(T[u].left)+1;
  if(T[u].right != NIL)
    h2 = setHeight(T[u].right)+1;
  return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibling(int u){
  if(T[u].parent == NIL) return NIL;
  if(T[T[u].parent].left != u && T[T[u].parent].left != NIL)
    return T[T[u].parent].left;
  if(T[T[u].parent].right != u && T[T[u].parent].right != NIL)
    return T[T[u].parent].right;
  return NIL;
}

void print(int u){
  int deg = 0;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent);
  printf("sibling = %d, ",getSibling(u));
  if(T[u].left != NIL)deg++;
  if(T[u].right != NIL)deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);
  
  if(T[u].parent == NIL){
    printf("root\n");
  } else if (T[u].left == NIL && T[u].right == NIL){
    printf("leaf\n");
  } else {
    printf("internal node\n");
  }
}

int main(){
  int i,id, l, r, root = 0;
  scanf("%d",&n);

  for(i=0;i<n;i++) T[i].parent = NIL;

  for(i=0;i<n;i++){
    scanf("%d %d %d",&id,&l,&r);
    T[id].left = l;
    T[id].right = r;
    if(l!=NIL)T[l].parent = id;
    if(r!=NIL)T[r].parent = id;
  }

  for(i=0;i<n;i++) if(T[i].parent==NIL)root = i;

  setDepth(root,0);
  setHeight(root);

  for(i=0;i<n;i++) print(i);

  return 0;
}



Measured memory_bytes: 2052
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
#include <limits>
using namespace std;

int n,result = numeric_limits<int>::max();
vector<int> bamboo;
vector<int> num(3);

int Plus(int count)
{
	if (count > 1)
	{
		return (count - 1) * 10;
	}
	return 0;
}

void calc(vector<int> v)
{
	int ans = 0;
	int l1 = 0, l2 = 0, l3 = 0;
	int n1 = 0, n2 = 0, n3 = 0;
	for (int i = 0;i < v.size();i++)
	{
		if (v[i] == 1)
		{
			l1 += bamboo[i];
			n1++;
		}
		else if (v[i] == 2)
		{
			l2 += bamboo[i];
			n2++;
		}
		else if (v[i] == 3)
		{
			l3 += bamboo[i];
			n3++;
		}
	}
	ans += abs(l1 - num[0]) + abs(l2 - num[1]) + abs(l3 - num[2]);

	ans += Plus(n1) + Plus(n2) + Plus(n3);

	if (result > ans && n1 >= 1 && n2 >= 1 && n3 >= 1)
	{
		result = ans;
	}
}

void dfs(int depth, vector<int> v)
{
	if (depth == n) { calc(v); }
	else
	{
		for (int i = 0;i < 4;i++)
		{
			v[depth] = i;
			dfs(depth + 1, v);
		}
	}
}

int main()
{
	cin >> n >> num[0] >> num[1] >> num[2];
	bamboo.resize(n);
	for (int i = 0;i < n;i++)
	{
		cin >> bamboo[i];
	}

	dfs(0, bamboo);

	cout << result << endl;

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> Aue(N);
  vector<int> Asita(N);
  for (int i = 0;i<N;i++) {
    cin >> Aue.at(i);
  }
  for (int i = 0;i<N;i++) {
    cin >> Asita.at(i);
  }
  
  int ans = 0;
  for (int i=0;i<N;i++){
    int temp = 0;
    for (int j = 0;j<=i;j++) {
      temp += Aue.at(j);
    }
    for (int j = i;j<N;j++) {
      temp += Asita.at(j);
    }
    ans = max(ans,temp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = if n <= m then  List.range n `To m else []
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

module ModOp = struct
  let prime = 1_000_000_007
  let (-) a b = (a + prime - b) mod prime
  let (+) a b = (a + b) mod prime
  let ( * ) a b = (a * b) mod prime

  let rec pow x n =
    if n = 0 then 1
    else if n mod 2 = 0 then pow (x*x) (n/2)
    else x * pow (x*x) (n/2)
end

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'
let itoa n = Char.chr (n + Char.code '0')

let rec powerset = function
  | [] -> [[]]
  | hd::tl ->
    let pws =  powerset tl in
    pws @ ListL.map pws ~f:(fun pw -> hd::pw)

let permutations l =
  let rec interleave x = function
    | [] -> [[x]]
    | (hd::tl) as l ->
      (x::l) :: (interleave x tl |> ListL.map ~f:(fun l -> hd::l)) in
  let rec aux = function
    | [] -> [[]]
    | a::rest ->
      aux rest |> ListL.map ~f:(interleave a) |> List.concat in
  aux l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let (x,y, a,b,c)  = scan "%d %d %d %d %d" Tuple5.make
let ps = scan_list ~sep:' ' Int.of_string
let qs = scan_list ~sep:' ' Int.of_string
let rs = scan_list ~sep:' ' Int.of_string

let () =
  let qx = ListL.fold_left (List.take x (List.sort (fun x y -> Int.neg @@ Int.compare x y) ps))
      ~init:Heap.empty ~f:(fun h v -> Heap.add v h) in
  let qy = ListL.fold_left  (List.take y (List.sort (fun x y -> Int.neg @@ Int.compare x y) qs))
      ~init:Heap.empty ~f:(fun h v -> Heap.add v h) in
  let (qx, qy) = ListL.fold_left rs ~init:(qx,qy) ~f:(fun (qx,qy) v ->
      let x = Heap.find_min qx in
      let y = Heap.find_min qy in
      if min x y < v then
        if x < y then (Heap.del_min qx |>  Heap.add v, qy)
        else (qx, Heap.del_min qy |> Heap.add v)
      else (qx, qy)
    ) in
  Printf.printf "%d\n"  @@ (Heap.to_list qx |> List.sum)  + (Heap.to_list qy |> List.sum)


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

// headers {{{
using namespace std;
// using namespace rel_ops;
 
const double pi=acos(-1.0);
const double eps=1e-11;
const int INF=0x7FFFFFFF;
template<class T> inline bool checkmin(T &a,T b){return b<a?a=b,1:0;}
template<class T> inline bool checkmax(T &a,T b){return b>a?a=b,1:0;}
template<class T> inline T sqr(T x){return x*x;}
template<class T> inline bool bit(T a, int b) {return (a>>b)&1;}
inline int popcount(int n) { return __builtin_popcount(n); }
inline int popcount(long long n) { return __builtin_popcountll(n); }
typedef long long int64;
typedef unsigned long long uint64;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define eb(args...) emplace_back(args)
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ff first
#define ss second
#define sz(g) int(g.size())
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
#ifdef LOCAL
#define dout cerr 
void out() { dout << endl; }
template<typename A, typename... B> void out(A a, B... b) { dout << ' ' << a; out(b...); }
#define dbg(args...) dout << __LINE__ << ":(" << #args << ") -> ", out(args)
template<class T>void show(T a, int n){for(int i=0; i<n; ++i) cout<<a[i]<<' '; cout<<endl;}
template<class T>void show(T a, int r, int l){for(int i=0; i<r; ++i)show(a[i],l);cout<<endl;}
constexpr bool local = true;
#else
#define dbg(...)
#define dout if(true);else cerr
#define out(...)
#define show(...)
constexpr bool local = false;
#endif
// }}}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL); 
    int n;
    while (cin >> n) {
        VI s(n);
        rep(i, n) cin >> s[i];
        dbg(s);
        int a = 0;
        rep(i, n) a ^= s[i];
        rep(i, n) s[i] ^= a;
        rep(i, n) cout <<  s[i] << " \n"[i == n-1];

    }
    return 0;
}



Measured memory_bytes: 3988
package main

import "fmt"

func main() {
	var a, b int
	var op string
FOR:
	for {
		fmt.Scan(&a, &op, &b)
		switch op {
		case "+":
			fmt.Println(a + b)
		case "-":
			fmt.Println(a - b)
		case "*":
			fmt.Println(a * b)
		case "/":
			fmt.Println(a / b)
		case "?":
			break FOR
		default:
			break FOR
		}
	}
}



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

/*struct mint {
    ll x; // typedef long long ll;
    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 { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }*/

int main() {
    string s;
    int q;
    cin >> s;
    cin >> q;
    int current = 0;
    string c_h;
    string c_t;
    for (int i = 0; i < q; i++) {
        int t;
        cin >> t;
        if (t == 2) {
            int n;
            string c_;
            cin >> n >> c_;
            if (current % 2 == 0) {
                if (n == 1) {
                    c_h = c_ + c_h;
                }
                else {
                    c_t = c_t + c_;
                }
            }
            else {
                if (n == 2) {
                    c_h = c_ + c_h;
                }
                else {
                    c_t = c_t + c_;
                }
            }
        }
        else {
            current++;
        }
    }

    if (current % 2 == 1) {
        s = c_h + s + c_t;
        int s_si = s.size();
        string ch(s_si, 'a');
        int j = 0;
        for (int i = s_si - 1; i >= 0; i--) {
            ch[i] = s[j];
            j++;
        }
        s = ch;
        
    }
    else {
        s = c_h + s + c_t;
    }

    cout << s << endl;
	return 0;
}


Measured memory_bytes: 1692
from collections import defaultdict
Delta = [-1,0,1]
d = defaultdict(lambda:0)
def paint(d,x,y):
    for dx in Delta:
        for dy in Delta:
            d[(x+dx,y+dy)] += 1
H,W,N = map(int,input().split())
for i in range(N):
    a,b = map(int,input().split())
    paint(d,a,b)
ans = defaultdict(lambda:0)
for x,y in d.keys():
    if 2<=x<=H-1 and 2<=y<=W-1:
        ans[d[(x,y)]] += 1
ans0 = (H-2)*(W-2)
for i in range(10):
    ans0 -= ans[i]
ans[0] = ans0
for i in range(10):
    print(ans[i])

Measured memory_bytes: 166860
a=[map(int,raw_input().split()) for _ in xrange(3)]
for i in xrange(3):
    h=a[i][3]-a[i][0]
    if a[i][4]<a[i][1]:
        h-=1
        m=a[i][4]-a[i][1]+60
    else:
        m=a[i][4]-a[i][1]
    if a[i][5]<a[i][2]:
        m-=1
        s=a[i][5]-a[i][2]+60
    else:
        s=a[i][5]-a[i][2]
    print h,m,s

Measured memory_bytes: 6312
// template {{{
#![allow(clippy::many_single_char_names)]

#[allow(dead_code)]
mod ngtio {
    use ::std::collections::VecDeque;

    pub struct Buffer {
        buf: VecDeque<String>,
    }

    impl Buffer {
        pub fn new() -> Self {
            Self {
                buf: VecDeque::new(),
            }
        }

        fn load(&mut self) {
            while self.buf.is_empty() {
                let mut s = String::new();
                let length = ::std::io::stdin().read_line(&mut s).unwrap();
                if length == 0 {
                    break;
                }
                self.buf.extend(s.split_whitespace().map(|s| s.to_owned()));
            }
        }

        pub fn string(&mut self) -> String {
            self.load();
            self.buf
                .pop_front()
                .unwrap_or_else(|| panic!("入力が終了したのですが。"))
        }

        pub fn string_char_vec(&mut self) -> Vec<char> {
            let s = self.string();
            s.chars().collect::<Vec<_>>()
        }

        pub fn string_char_vec_trusted_len(&mut self, len: usize) -> Vec<char> {
            let s = self.string();
            let s = s.chars().collect::<Vec<_>>();
            assert_eq!(s.len(), len, "あら、思ったのと長さ違いますね……");
            s
        }

        pub fn char(&mut self) -> char {
            let string = self.string();
            let mut chars = string.chars();
            let res = chars.next().unwrap();
            assert!(
                chars.next().is_none(),
                "char で受け取りたいのも山々なのですが、さては 2 文字以上ありますね？"
            );
            res
        }

        pub fn read<T: ::std::str::FromStr>(&mut self) -> T
        where
            <T as ::std::str::FromStr>::Err: ::std::fmt::Debug,
        {
            self.string()
                .parse::<T>()
                .expect("Failed to parse the input.")
        }

        pub fn read_vec<T: ::std::str::FromStr>(&mut self, len: usize) -> Vec<T>
        where
            <T as ::std::str::FromStr>::Err: ::std::fmt::Debug,
        {
            (0..len).map(|_| self.read::<T>()).collect()
        }
    }

    macro_rules! define_primitive_reader {
        ($($ty:tt,)*) => {
            impl Buffer {
                $(
#[inline]
                    pub fn $ty(&mut self) -> $ty {
                        self.read::<$ty>()
                    }
                )*
            }
        }
    }

    define_primitive_reader! {
        u8, u16, u32, u64, usize,
        i8, i16, i32, i64, isize,
    }

    impl Default for Buffer {
        fn default() -> Self {
            Self::new()
        }
    }
}

#[allow(unused_imports)]
use std::{collections, iter, mem, ops};
// }}}

fn main() {
    let mut buf = ngtio::Buffer::new();
    let s = buf.string_char_vec();
    let s = if s.last().unwrap() == &'s' {
        s.iter()
            .copied()
            .chain(std::iter::once('e'))
            .chain(std::iter::once('s'))
            .collect::<String>()
    } else {
        s.iter()
            .copied()
            .chain(std::iter::once('s'))
            .collect::<String>()
    };
    println!("{}", &s);
}


Measured memory_bytes: 2148
#include <stdio.h>
int main(void)
{
    int W, H, x, y, r;
     
    scanf("%d %d %d %d %d",&W ,&H ,&x ,&y ,&r); 
    
    if(x+r<=W && x-r>=0 && y+r<=H && y-r>=0){
    	printf("Yes\n");
    }
    else{
    	printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 584
use text_io::*;
use std::collections::*;
use std::process::exit;

fn main() {
    let mut n:usize = read!();
    let mut ans:usize = 1111111111111;
    for i in 1..((n as f64).sqrt())as usize+1 {
        if n%i==0&&(i+n/i)-2<ans {
            ans = (i+n/i)-2;
        }
    }
    println!("{}",ans);
}

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

namespace ABC132A
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();

            var grouped = line.GroupBy(x => x);

            if (grouped.First().Count() == 2 && grouped.Skip(1).First().Count() == 2)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 13396
import itertools
N,M,K = map(int,input().split())
A = [0]+list(map(int,input().split()))
B = [0]+list(map(int,input().split()))
SA = list(itertools.accumulate(A))
SB = list(itertools.accumulate(B))
ans = 0
j = len(B)-1
for i in range(len(SA)):
    while(j>=0):
        if SA[i] + SB[j] <= K:
            ans = max(ans,i+j)
            break
        j-=1
print (ans)

Measured memory_bytes: 135276
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>

using namespace std;

int main(){
  int k, a, b;
  long long biscket = 1;
  bool exchange = false;
  cin >> k >> a >> b;

  if(b > a + 1){
    while(k != 0){
      if(exchange == true){
        biscket += b;
        exchange = false;

      } else if(biscket >= a && k > 1){
        biscket -= a;
        exchange = true;

      } else {
        biscket++;
      }
      k--;
    }
  } else {
    biscket += k;
  }

  cout << biscket << endl;

}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	var A, B int
	fmt.Sscanf(scanner.Text(), "%d %d", &A, &B)

	if A%2 == 1 && B%2 == 1 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
/*
 * ----------------------------------------------------------------------------
 (: Bismillahir Rahmanir Rahim :) 
 * File: /root/Programming/Atcoder/B_Golden_Coins.cpp
 * Project: /root/Programming/Atcoder
 * Created Date: Saturday, March 28th 2020, 6:08:55 pm
 * Author: Grim Firefly :)
 * Author Mail : GrimFirefly1@gmail.com
 * -----
 * Last Modified: Sat Mar 28 2020
 * Modified By: Grim Firefly :)
 * -----
 * ----------------------------------------------------------------------------
 */






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

//constant
#define PI acos(-1.0)

//typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned un;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef map<int, int> mii;
typedef map<char, char> mcc;
typedef map<char, int> mci;
typedef map<string, int> msi;
typedef map<ll, ll> mll;

//defined for loop


// defined for taking input
#define gl(x) getline(cin, x)
#define sf scanf
#define sfi(x) sf("%d", &x)
#define sfc(x) sf("%c", &x)
#define sfl(x) sf("%lld", &x)
#define sflu(x) sf("%llu", &x)
#define sfii(x, y) sf("%d %d", &x, &y)
#define sfll(x, y) sf("%lld %lld", &x, &y)
#define sfiii(x, y, z) sf("%d %d %d", &x, &y, &z)
#define sflll(x, y, z) sf("%lld %lld %lld", &x, &y, &z)

//defined for printing
#define pf printf
#define pfn pf("\n")
#define pfcas pf("Case %d: ", cas)
#define pfyes pf("YES")
#define pfno pf("NO")
#define pfi(x) pf("%d", x)
#define pfl(x) pf("%lld", x)

//Defined for loop
//increament
#define loopi(i, j, k) for (int i = j; i < k; i++)
#define loopl(i, j, k) for (ll i = j; i < k; i++)
#define loopc(i, j, k) for (char i = j; i < k; i++)
#define looplu(i, j, k) for (ull i = j; i < k; i++)
//decreament
#define loopri(i, j, k) for (int i = j; i > k; i--)
#define looprl(i, j, k) for (ll i = j; i > k; i--)
#define looprlu(i, j, k) for (ull i = j; i > k; i--)
#define looprc(i, j, k) for (char i = j; i > k; i--)
#define wa(t) while (t--)

//testcases
#define testc(t) for (char cas = 1; cas <= t; cas++)
#define testi(t) for (int cas = 1; cas <= t; cas++)
#define testl(t) for (ll cas = 1; cas <= t; cas++)

//some cmd
#define pb push_back
#define ppb pop_back
#define mp make_pair

//Main Function Start

int main()
{
    int x;
    sfi(x);
    int ans=(x/500)*1000;
    x%=500;
    ans+=x-(x%5);
    cout<<ans<<endl;
    return 0;
}

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

vector<ll> dickstra(int from) {
  const ll infl = 4e18;
  const int n = 1 << 16;

  vector<ll> dist(n, infl);
  using Elem = pair<ll, int>;
  priority_queue<Elem, vector<Elem>, greater<Elem>> o;
  dist[from] = 0;
  o.emplace(dist[from], from);
  while (!o.empty()) {
    int u;
    ll cdist;
    tie(cdist, u) = o.top();
    o.pop();
    //cerr << bitset<16>(u) << ' ' << cdist << '\n';
    if (cdist != dist[u])
      continue;
    for (int x = 0; x < 16; ++x) {
      for (int y = 0; y < 16; ++y) {
        for (int z = 0; z < y; ++z) {
          if (!(u & (1 << y)) || !(u & (1 << z))) {
            continue;
          }
          int v = u ^ (1 << y) ^ (1 << z);
          int yy = x ^ y, zz = x ^ z;
          int w = 1;
          if (v & (1 << yy)) {
            ++w;
          }
          if (v & (1 << zz)) {
            ++w;
          }
          v ^= (1 << yy) ^ (1 << zz);
          if (v & 1) {
            v ^= 1;
          }
          assert(v < n);

          ll ndist = dist[u] + w;
          if (ndist >= dist[v])
            continue;
          dist[v] = ndist;
          o.emplace(dist[v], v);

        }
      }
    }
  }
  return dist;
}

signed main() {
#ifdef LOCAL
  assert(freopen("f.in", "r", stdin));
#endif
  int n;
  cin >> n;
  vector<int> xx(n);
  for (int i = 0; i < n - 1; ++i) {
    int u, v, w;
    cin >> u >> v >> w;
    xx[u] ^= w;
    xx[v] ^= w;
  }
  int mask = 0;
  int res = 0;
  for (int x : xx) {
    if (x == 0) {
      continue;
    }
    if (mask & (1 << x)) {
      ++res;
    }
    mask ^= 1 << x;
  }
  //cerr << bitset<16>(mask) << '\n';
  res += dickstra(mask)[0];
  cout << res << '\n';
}


Measured memory_bytes: 1152