akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define ff first
#define ss second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define ep emplace
#define MOD 1000000007LL
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define for1(i, n) for(int i = 1; i <= int(n); i++)
#define ford(i, n) for(int i = int(n) - 1; i >= 0; i--)
#define fore(i, a, b) for(int i = int(a); i <= int(b); i++)
#define debug(x) cerr << #x << " = " << x << endl

using namespace std;

typedef long long ll;

const ll oo = 1000000000000000000;
const int N = 100005;


int main(){

    int n, m;

    multiset<int> w;

    scanf("%d", &n);

    forn(i, n){
        int x;
        scanf("%d", &x);
        w.insert(x);
    }

    scanf("%d", &m);

    forn(i, m){
        int x;
        scanf("%d", &x);
        if(!w.count(x)) return printf("NO\n"), 0;
        w.erase(w.find(x));
    }

    printf("YES\n");



    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100
#define MAXW 100000
#define INF 2000000000


int w[MAXN], v[MAXN];
int n,C;
long long dp[MAXN+1][MAXW+1];


int main() {
	int i,j;
	scanf("%d %d",&n, &C);	
	for (i=0; i<n;i++) {
		scanf("%d %d",&w[i],&v[i]);
	}
	//for (i=0; i<=n;i++) {
		for (j=0; j<=C; j++) {
			dp[n][j]=0;
		}
	//}
	for (i=n-1; i>=0; i--) {
		for (j=0; j<=C; j++) {
			dp[i][j]=dp[i+1][j];
			if (j-w[i]>=0) {
				dp[i][j]=max(dp[i][j],dp[i+1][j-w[i]]+v[i]);
			}
		}
	}

	printf("%lld\n",dp[0][C]);
	return 0;
}

Measured memory_bytes: 82688
#include <iostream>
#include <string>
#include <vector>
#define REP(i,k,n) for(int(i)=(k);(i)<(n);++(i))
using namespace std;

const int N_MAX = 110;

int which_color(int r)
{
  // assert r >= 1
  if (r < 400) return 0;
  if (r < 800) return 1;
  if (r < 1200) return 2;
  if (r < 1600) return 3;
  if (r < 2000) return 4;
  if (r < 2400) return 5;
  if (r < 2800) return 6;
  if (r < 3200) return 7;
  else return 8;
}

int main()
{
  int N;
  int a[N_MAX];

  cin >> N;
  REP(i,0,N) cin >> a[i];

  // レートのクラスごとの人数
  int c[9] = {};
  REP(i,0,N) {
    int k = which_color(a[i]);
    c[k] += 1;
  }

  // 色 0-7 のうちでの種類数
  int x = 0;
  REP(i,0,8) {
    if (c[i] > 0) ++x;
  }

  // 最小値 x,
  // もし x = 0 の場合は 1 になる
  int mini = (x > 0) ? x : 1;
  // 最大値 x + c[8]
  int maxi = x + c[8];
  cout << mini << " " << maxi << endl;

  return 0;
}


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

int main(){
    long N;
    cin >> N;
    
    long M = N;
    
    long S = 0;
    
    while(true){
        S += N % 10;
        N /= 10;
        if(N == 0)  break;
    }
    
    if(M % S == 0)  cout << "Yes" << endl;
    else    cout << "No" << endl;
    
}



Measured memory_bytes: 256
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H, W):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


H, W = read_ints()
A = read_map(H, W)

from itertools import product
from collections import deque


# 開始地点
start = []
for i, a in enumerate(A):
    for j, aa in enumerate(a):
        if aa == '#':
            start.append((i, j))


# 探索の準備
mvx = (1, 0, -1, 0)
mvy = (0, 1, 0, -1)
visited = [[False for _ in range(W)] for _ in range(H)]

n_white = W*H
que = deque([(si, sj, 0) for si, sj in start])

for si, sj in start:
    visited[si][sj] = True

# 幅優先探索
while que:
    y, x, cost = que.popleft()
    # 白マスの数の管理
    n_white -= 1
    if n_white == 0:
        ans = cost
        break

    for dy, dx in zip(mvy, mvx):
        y_new, x_new = y + dy, x + dx
        # 探索に含めない条件
        if not (-1 < y_new < H) or not (-1 < x_new < W):
            continue
        if visited[y_new][x_new]:
            continue

        # 探索に追加してあげる
        que.append((y_new, x_new, cost + 1))
        visited[y_new][x_new] = True


print(cost)


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

int main()
{
    int a,b;
    cin>>a>>b;
    int a1=12.5*a,a2=12.5*(a+1);
    int b1=10*b,b2=10*(b+1);
    /*if(b1>a2||a1>b2)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    else*/
    int flag=1;
        int min_0=min(a1,b1);
        int max_0=max(a2,b2);
        for(int i=min_0;i<=max_0;i++)
        {
            if((int)(i*0.08)==a&&(int)(i*0.1)==b)
            {
                cout<<i<<endl;
                flag=0;
                break;;
            }
        }
    if(flag)
        cout<<-1;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    ll ans = 1e9;
    for (int i = -100; i <= 100; i++) {
        ll cost = 0;
        for (int j = 0; j < n; j++) {
            cost += pow(i - a[j], 2);
        }
        ans = min(ans, cost);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#define lint unsigned long long int
#define FOR(x, to) for(int x=0; x<(int)(to); x++)
#define DUMP(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) cout << "[" << loop_dump << "]:" << ar[loop_dump] << endl
#define DUMPL(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) { cout << ar[loop_dump]; if(loop_dump<(int)ar.size()-1) cout << ' '; } cout << endl;
#define COUT(x) cout << (x) << endl
#define ALL(ar) ar.begin(), ar.end()
#define LOOPD(i) cout << "ループ[" << i << "]回目---------------" << endl
using namespace std;

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

    int n;
    cin >> n;
    vector<int> c(n-1), s(n-1), f(n-1);
    for(int i=0; i<n-1; i++){
        cin >> c[i] >> s[i] >> f[i];
    }

    vector<int> ans(n, 0);
    for(int i=0; i<n-1; i++){
        // LOOPD(i);
        int calc = s[i] + c[i];
        for(int j=i+1; j<n-1; j++){
            if(calc < s[j]){
                calc = s[j];
            }
            // cout << "駅" << j << "に到着:電車待ち... calc=" << calc << endl;
            if((calc - s[j]) % f[j] != 0){
                calc += f[j] - ((calc - s[j]) % f[j]);
            }

            calc += c[j];
        }
        ans[i] = calc;
    }

    for(int i=0; i<n; i++){
        COUT(ans[i]);
    }
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=1e2+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
  }



int h,n;


void solve() {
    cin>>h>>n;
    vi a(n,0);
    int sum=0;
    rep(i,0,n) {
		  cin>>a[i];
		  sum+=a[i];
		}        
	if(sum>=h) {
		   cout<<"Yes\n";
		}	
    else 
       cout<<"No\n";         
       
               
}

    
int32_t main() {
	cool;
	int t=1;	

	//cin>>t;
	while(t--)
	  solve();

  return 0;	   
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    cin>>N>>M;
    vp war(M);
    rep(i,M) cin>>war[i].se>>war[i].fi; //{b, a}
    rep(i,M) {
        --war[i].fi; --war[i].se;
    }
    set<ll> rem;
    sort(war.begin(), war.end());
    rep(i,M){
        P p = war[i];
        if(rem.lower_bound(p.se) == rem.end()){
            rem.insert(p.fi - 1);
        }
    }
    cout<<rem.size()<<endl;
}


Measured memory_bytes: 1920
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>

using namespace std;

struct Sales{
	long long int sum;
	int id;
};


int main(){

	int checkTable[4001],index;
	long long int price,amount;
	Sales sales[4001];

	int n,id,count;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		for(int i = 1; i <= 4000; i++){
			sales[i].id = -1;
			sales[i].sum = 0;
			checkTable[i] = -1;	//?????´?????????????????????-1,?????´????????????sales??§?????????????????????
		}

		index = 0;

		for(int i = 1; i <= n; i++){
			scanf("%d %lld %lld",&id,&price,&amount);

			if(checkTable[id] == -1){	//????????´?????´???
				sales[index].id = id;
				sales[index].sum = price*amount;
				checkTable[id] = index;
				index++;
			}else{
				sales[checkTable[id]].sum += price*amount;
			}

		}

		count = 0;

		for(int i = 0; i < index; i++){
			if(sales[i].sum >= 1000000){
				printf("%d\n",sales[i].id);
				count++;
			}
		}
		if(count == 0)printf("NA\n");
	}

    return 0;
}

Measured memory_bytes: 2696
using System;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            var res = 0;

            var N = int.Parse(Console.ReadLine());

            var H = new int[N];

            var H_s = Console.ReadLine().Split(' ');

            for (int i = 0; i < N; i++)
            {
                H[i] = int.Parse(H_s[i]);
            }

            for (int i = 0; i < N; i++)
            {
                bool abelSee = true;
                for (int j = 0; j < i; j++)
                {
                    if (H[j] > H[i])
                    {
                        abelSee = false;
                    }
                }

                if (abelSee)
                {
                    res++;
                }
            }

            Console.WriteLine(res);
        }
    }
}


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

namespace ConsoleApp15
{
    class Class265
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            var XY = new Tuple<int, int, int>[N];
            var G = new List<Tuple<int, int, int>>();
            for(int i = 0; i < N; i++)
            {
                var r = Console.ReadLine().Split().Select(int.Parse).ToArray();
                XY[i] = Tuple.Create(r[0], r[1], i);
            }
            Array.Sort(XY, (a, b) => a.Item1.CompareTo(b.Item1));
            for(int i = 0;i<N-1;i++)
            {
                G.Add(Tuple.Create(XY[i].Item3, XY[i + 1].Item3, Math.Abs(XY[i].Item1 - XY[i + 1].Item1)));
            }
            Array.Sort(XY, (a, b) => a.Item2.CompareTo(b.Item2));
            for(int i = 0; i < N - 1; i++)
            {
                G.Add(Tuple.Create(XY[i].Item3, XY[i + 1].Item3, Math.Abs(XY[i].Item2 - XY[i + 1].Item2)));
            }
            Kruskal kruskal = new Kruskal(N, G.Count, G.ToArray());
            Console.WriteLine(kruskal.sum());
        }
    }
    public class Kruskal
    {
        struct edge { public int u, v, cost; }
        private int V;
        private int E;
        private edge[] es;
        public Kruskal(int vv, int ee, Tuple<int, int, int>[] edge)
        {
            V = vv;
            E = ee;
            es = new edge[E];
            for (int i = 0; i < E; i++)
            {
                es[i] = new edge { u = edge[i].Item1, v = edge[i].Item2, cost = edge[i].Item3 };
            }
        }
        public int sum()
        {
            Union_Find union = new Union_Find(V);
            Array.Sort(es, (x, y) => x.cost.CompareTo(y.cost));

            int res = 0;
            for (int i = 0; i < E; i++)
            {
                edge e = es[i];
                if (!union.IsSameGroup(e.u, e.v))
                {
                    union.Unite(e.u, e.v);
                    res += e.cost;
                }
            }
            return res;
        }
    }
    public class Union_Find
    {
        private int[] data;
        public Union_Find(int size)
        {
            data = new int[size];
            for (int i = 0; i < size; i++) data[i] = -1;
        }
        public bool Unite(int x, int y)
        {
            x = Root(x);
            y = Root(y);
            if (x != y)
            {
                if (data[y] < data[x])
                {
                    var tmp = y;
                    y = x;
                    x = tmp;
                }
                data[x] += data[y];
                data[y] = x;
            }
            return x != y;
        }
        public bool IsSameGroup(int x, int y) => Root(x) == Root(y);
        public int Root(int x) => data[x] < 0 ? x : data[x] = Root(data[x]);
        public int getMem(int x) => -data[Root(x)];
    }
}


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

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

    if ((a * b) % 2 != 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
   
}

Measured memory_bytes: 256
using System.Linq;
using System;

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var topps = new int[n];
        string[] line = Console.ReadLine().Trim().Split(' ');
        var kiji = int.Parse(line[0]);
        var topping = int.Parse(line[1]);
        var kijical = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
            topps[i] = int.Parse(Console.ReadLine().Trim());
        var ntops = topps.OrderByDescending(x => x).ToArray();
        var caltotal = kijical;
        var dolltotal = kiji;
        var ans = (double)caltotal / dolltotal;
        for (int i = 0; i < n; i++)
        {
            double chk = ntops[i] / topping;
            if (chk < ans) break;
            else
            {
                caltotal += ntops[i];
                dolltotal += topping;
                ans = caltotal / dolltotal;
            }
        }
        Console.WriteLine((int)ans);
    }
}

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

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

  cout << (n*(n-1))/2 + (m*(m-1))/2 << endl;

}

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

int main(void) {
    int t, x;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> t >> x;
    cout << fixed << setprecision(10) << t / (double)x << "\n";
    return 0;
}

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

void solve(){
    string s;
    cin>>s;
    int n=s.length();
    if(s[n-1]=='s') {
        for(int i=0;i<n;i++)
        cout<<s[i];
        cout<<"es";
    }
    else{
        cout<<s<<"s";
    }
}

int main(void){
    int t=1;//cin>>t;
    while(t--)
    solve();
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    int alice = 0;
    int bob=0;
    rep(i,n){
        if(i%2 == 0)alice+=a[i];
        else bob+=a[i];
    }
    cout << alice-bob << endl;
   return 0;
}

Measured memory_bytes: 256
#   ?????????????±±???????????????????????????????????¨ h ????????????????????????????????????????????????????????????????????????????????°??????

#   ?????????????±±???????????¶?????????????????????????????????
cardList = []
while 1:
    temp = input()
    if temp == "-":
        cardList += temp
        break
    if temp.isalpha:
        temp = "".join(temp).split()
    cardList += temp
#   print(cardList)
for i in range(len(cardList)):
    if cardList[i] == "-":
        break
    if cardList[i].isalpha():
        editCard = cardList[i]
        for j in range(i + 2, int(cardList[i + 1]) + i + 2):
            if cardList[j].isalpha() or cardList[j] == "-":
                break
            editCard = editCard + editCard
            editCard = editCard[int(cardList[j]):len(cardList[i]) + int(cardList[j])]
        print("{0}".format(editCard))

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

using namespace std;

const int SIZE = 3333;

int N;
double A[SIZE];
double dp[SIZE][SIZE];

void init(){
	for(int i=0;i<SIZE;i++){
		for(int j=0;j<SIZE;j++){
			dp[i][j]=-1.0;
		}
	}
}

double rec(int indx, int h){
	
	if(indx>N){
		if(h>(N/2)) return 1.0;
		else return 0.0;
	}
	if(dp[indx][h]!=-1.0) return dp[indx][h];
	double ret=0.0;
	ret+=(rec(indx+1,h+1)*A[indx]);
	ret+=(rec(indx+1,h)*(1.0-A[indx]));
	
	return dp[indx][h]=ret;
}

int main (){
	
	init();
	scanf("%d", &N);
	for(int i=1;i<=N;i++){
		scanf("%lf", &A[i]);
	}
	double ans=rec(1,0);
	printf("%.10lf\n", ans);
	
	return 0;
}


Measured memory_bytes: 87296
#include <bits/stdc++.h>
 
using namespace std;
 
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll,ll> ii; 
typedef pair <ii,int> iii;
 
const int inf = 0x3F3F3F3F;
const ull mod = 998244353;

void solve(){
	int a,b;
	cin >> a >> b;
	for(int i = 1; i <=3; i++){
		if(i!=a and i !=b)cout << i << endl;
	}
}

int main(){
	fastio;
	solve();
	return 0;
}


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

int main(){
    int n; cin>>n;
    vector<int> a(n);
    map<int,int> m;
    rep(i,n){cin>>a.at(i); m[a.at(i)]++;}
    int tmp=0;
    rep(i,100005){
        tmp+=max(m[i]-1,0);
    }
  	if(tmp%2==1) tmp++;
    cout<<n-tmp<<endl;
}

Measured memory_bytes: 5376
#include <iostream>
#include <vector>
#include <map>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
//#define int long long

using namespace std;

signed main() {
  IOS;
  int H,W,N,r,c,i=0,j,ans=0;
  string S,T;
  cin >> H >> W >> N;
  cin >> r >> c;
  cin >> S >> T;

  map<char,int> m={ {'L',0},{'R',1},{'U',2},{'D',3} };
//  map<char,char> opp={ {'L','R'},{'R','L'},{'U','D'},{'D','U'}};
//  map<char,int> limit = { {'L',W},{'R',W},{'U',H},{'D',H} };
//  int deldaR[4] = {0, 0, -1, 1};
//  int deldaC[4] = {-1, 1, 0, 0};
  map<char,int> scnt,tcnt;
  bool remain = true;
  for (i = 0; i < N; i++) {
    if (i > 0) {
      // t는 무한정 커질수 없다
      tcnt[T[i-1]]++;
      if (T[i-1] == 'L')
        tcnt[T[i-1]] = min(scnt['R'] + c-1, tcnt[T[i-1]]);
      else if (T[i-1] == 'R')
        tcnt[T[i-1]] = min(scnt['L'] + W-c, tcnt[T[i-1]]);
      else if (T[i-1] == 'U')
        tcnt[T[i-1]] = min(scnt['D'] + r-1, tcnt[T[i-1]]);
      else if (T[i-1] == 'D')
        tcnt[T[i-1]] = min(scnt['U'] + H-r, tcnt[T[i-1]]);
    }
    scnt[S[i]]++;

//    cout << "S: ";
//    for (auto s: scnt)
//      cout << s.first << ":" << s.second << " ";
//    cout << endl;
//    cout << "T: ";
//    for (auto s: tcnt)
//      cout << s.first << ":" << s.second << " ";
//    cout << endl;

    if ((scnt['L'] - tcnt['R'] >= c)
        or (scnt['R'] - tcnt['L'] > W-c)
        or (scnt['U'] - tcnt['D'] >= r)
        or (scnt['D'] - tcnt['U'] > H-r)) {
      remain = false;
      break;
    }
  }

  cout << (remain ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 920
#include<iostream>
#include<cstdio>
const int N=1e5+5;
int n,cnt,head[N],deg[N],dp[N]={};
struct Edge {
    int to,nxt;
}edge[N<<1];
void init() {
    for(int i=0;i<n;i++) head[i]=-1,deg[i]=0;cnt=0;
}
void addEdge(int from,int to) {
    edge[cnt].to=to;edge[cnt].nxt=head[from];head[from]=cnt++;deg[to]++;
}
void dfs(int u,int fa) {
    dp[u]=0;bool f=false;
    for(int i=head[u];~i;i=edge[i].nxt) {
        int v=edge[i].to;
        if(v==fa) continue;
        dfs(v,u);
        dp[u]+=(dp[v]?dp[v]:f),f=f||!dp[v];
    }
}
int main() {
    scanf("%d",&n);
    init();int u,v;
    for(int i=1;i<n;i++) scanf("%d%d",&u,&v),addEdge(u,v),addEdge(v,u);
    int rt=-1;
    for(int i=0;i<n;i++) if(deg[i]>2) rt=i;
    if(rt==-1) printf("1\n");
    else dfs(rt,-1),printf("%d\n",dp[rt]);
    return 0;
}


Measured memory_bytes: 6528
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 3e5 + 5;
bool solve(int a , int b , int c , int k) {
    if(k == 0)
        return b > a && c > b;
    bool yes = solve(a * 2 , b , c , k - 1);
    yes |= solve(a , b * 2 , c , k - 1);
    yes |= solve(a , b , c * 2 , k - 1);
    return yes;
}
int main() {
    abdelrahman010
    int a , b , c , k;
    cin >> a >> b >> c >> k;
    solve(a , b , c , k) ? cout << "Yes" : cout << "No";
    return 0;
}


Measured memory_bytes: 3608
x, y = (int(x) for x in input().split())
if x == y == 1: print(1000000)
else:
    ans = 0
    points = [300000, 200000, 100000]
    if x <= 3: ans += points[x-1]
    if y <= 3: ans += points[y-1]
    print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include <string.h>
#include<stdio.h>
#include <vector>
#include <math.h>


using namespace std;
typedef long long ll;

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


int main() {
	int n,a = 0,w = 0,t = 0,r = 0;
	cin >> n;
	rep(i, n) {
		string s;
		cin >> s;
		if (s == "AC") a++;
		else if (s == "WA") w++;
		else if (s == "TLE") t++;
		else r++;
	}
	cout << "AC x " << a << endl;
	cout << "WA x " << w << endl;
	cout << "TLE x " << t << endl;
	cout << "RE x " << r << endl;
	return 0;
}


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

int main(){
int N;
  cin>>N;
  
  vector<long>L(90);
  L[0]=2, L[1]=1;
  for(int i=2; i<=N; i++){
   L[i]=L[i-1]+L[i-2];
  }
  
  cout<<L[N];  
}


Measured memory_bytes: 256
#pragma GCC Optimize("Ofast")
#pragma GCC Optimize "trapv"
#pragma comment(linker, "/STACK: 2000000")

#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 

using namespace std;
//using namespace boost::multiprecision; 

#define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define TC int t; cin >> t; while(t--)
#define li long int
#define ll long long
#define ull unsigned long long 
#define Vec(x) vector <x>
#define Pai(x,y) pair <x,y>
#define Map(x,y) map <x,y>
#define UMap(x,y) unordered_map <x,y>
#define Set(x) set <x>
#define Sta(x) stack <x>
#define Qu(x) queue <x>https://discuss.codechef.com/t/bytelandian-gold-coins/76721
#define DQ(x) deque(x)
#define PriorQ(x)	priority_queue <x>
#define bg begin()
#define ed end()
#define sz size()
#define ct(x) count(x)
#define len length()
#define F first
#define S second
#define Makep make_pair
#define ins(x) insert(x)
#define ers(x) erase(x)
#define endl "\n";
#define MOD 1000000007
#define PI 2*acos(0.0)
#define clr() clear()
#define fori0(n) for(int i=0;i<n;i++)
#define foriab(a,b) for(int i=a;i<b;i++)
#define mem0(x) memset(x,0,sizeof(x))
#define mem1(x) memset(x,1,sizeof(x))
#define autoit(x) for(auto it=x.bg;it!=x.ed;it++)
#define count0(x) __builtin_popcount(x)
#define ret return 
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

const ll Inf=1e9+5;
const ll m = 1e9 + 7;

namespace funset{
bool checkvow(char x){
	return ((0x208222)>>(x&(0x1f)))&1;
	}
ll highpow2(ll x){
	return (x&~(x-1));
	}
bool chk2(ll x){
		return (x&(x-1));
	}	
}

const ll Mxn = 2 * 1e5;


using namespace funset;


ll strhash(string s){
	const ll p = 31;
	const ll m = 1e9 + 7;
	ll hashval = 0;
	ll powe = 1;
	for (char c: s){
		hashval = (hashval + (c - 'a' + 1) * powe) % m;
		powe = (powe * p) % m;
	}
	return hashval;
}

ll fact(ll n){
	if(n <= 1)
		return 1;
	return n*fact(n-1);
}


ll a[1000], dp[1000], n;

ll foo(ll a, ll b, ll x, ll y, ll n){
	ll t=min(a-x,n);
	a-=t;
	n-=t;
	t = min(b-y, n);
	b-=t;
	return a*b;
}

void solve(){
	ll x, y;
	char a;
	cin >> x >> a >> y;
	if(a=='-'){
		cout << x-y << endl;
		return;
	}
	cout << x+y << endl;
}

int main(){
	//sieve();
	auto beg=clock();
	FAST
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	
    solve();
	auto ted=clock();
	#ifndef ONLINE_JUDGE
	cout << (double)(ted-beg)/CLOCKS_PER_SEC << endl;
	#endif
	ret 0;
}

Measured memory_bytes: 3664
/*
    Author : Nishant Gupta 2.0
*/
#include<bits/stdc++.h>
using namespace std;

#define LL long long int
#define getcx getchar_unlocked
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define MAX 100005
#define LOG_MAX 20
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL (LL(1e18))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define in(x) scanf("%d", &x)
#define inl(x) scanf("%lld", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define inl2(x, y) scanf("%lld %lld", &x, &y)
#define MSV(A,a) memset(A, a, sizeof(A))
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define finish(x) {cout<<x<<'\n'; return;}
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const char en = '\n';

void solve() {
	string s, t;
	cin>>s;
	cin>>t;
	
	int n = s.length();
	int ans = 0;
	for(int i=0;i<n;i++) if(s[i] != t[i]) ans++;
	cout<<ans<<en;
}

int main() {
	int t = 1;
	
	//~cin>>t;
	while(t--) {
		solve();
	}
    return 0;
}


Measured memory_bytes: 3920
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int main () {
  int N;
  int d[110];
  cin >> N;
  for (auto i = 0; i < N; ++i) {
    cin >> d[i];
  }
  set<int> S;
  for (auto i = 0; i < N; ++i) {
    S.insert(d[i]);
  }
  cout << S.size() << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 
 unsigned long long A,B,K;
   
 cin >> A >> B >> K;
 
 if(A<=K){
   K = K-A;
   A = 0ULL;
 }else if(A>K){
      A = A - K;
      K = 0;
 }
 if(B<=K){
  B = 0ULL;
 }else if(B>K){
   B = B-K;
 }
 
 cout << A <<" "<< B << endl;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from heapq import heappush, heappop

N,M,S = map(int,readline().split())
ABC = [list(map(int,readline().split())) for _ in range(M)]
m = map(int,read().split())
CD = list(zip(m,m))

graph = [[] for _ in range(N)]
for u,v,a,b in ABC:
    graph[u-1].append((v-1,a,b))
    graph[v-1].append((u-1,a,b))

def f():
  INF = 10 ** 18
  arrive = [False]*N
  ans = []
  qq = 2500
  dist = [[INF] * qq for _ in range(N)]
  dist[0][min(qq-1,S)] = 0
  q = [(0,min(qq-1,S),0)]
  while q:
      st,ss,v = heappop(q) # 総時間、銀貨、今いる頂点
      if dist[v][ss] < st:
        continue
      if not arrive[v]:
        arrive[v] = True
        ans.append((v,st))
        if all(arrive):
          break
      c,d = CD[v]
      # 銀貨の購入
      if ss < qq-1:
          ns = min(ss + c, qq-1)
          nt = st + d
          if dist[v][ns] > nt:
              dist[v][ns] = nt
              heappush(q,(nt,ns,v))
      # 移動
      for nex,g,tt in graph[v]:
          if ss-g < 0:
              continue
          dt = st + tt
          if dist[nex][ss-g] <= dt:
              continue
          dist[nex][ss-g] = dt
          heappush(q,(dt,ss-g,nex))
  return ans

ab = f()
from operator import itemgetter
ab = sorted(ab,key=itemgetter(0))
for i in range(1,N):
  print(ab[i][1])

Measured memory_bytes: 24304
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;

int n, a[100005];

int main(){
	cin >> n;
	for(int i=1; i<=n; i++) cin >> a[i];
	int ret = 0;
	for(int i=1; i<=n; i++){
		if(a[a[i]] == i) ret++;
	}
	cout << ret/2 << endl;
}



Measured memory_bytes: 640
// In god we trust

#include <bits/stdc++.h>
#include <chrono>
#include <algorithm>


#define pb push_back
#define fi first
#define se second
#define Vi vector<int>
#define Vb vector<bool>
#define Pi pair<int, int>
#define MP make_pair
#define MT make_tuple
#define INF 1000000000
#define int long long

using namespace std;
using namespace std::chrono;


signed main(){
  int a[3][3];
  for (int i = 0 ;i < 3; i++)
    for (int j = 0; j < 3; j++)
      cin >> a[i][j];
  int n;
  cin >> n;
  int b[n];

  bool m[3][3] = {0};
  
  for (int i = 0; i < n; i++){
    cin >> b[i];
    for (int j = 0; j < 3; j++)
      for (int k = 0; k < 3; k++)
	if (a[j][k] == b[i])
	  m[j][k] = 1;
  }


  bool ans = false;
  for (int i = 0; i < 3; i++){
    bool bingo = true;
    for (int j = 0; j < 3; j++)
      if (!m[i][j])
	bingo = false;
    if (bingo)
      ans = true;
  }

  for (int i = 0; i < 3; i++){
    bool bingo = true;
    for (int j = 0; j < 3; j++)
      if (!m[j][i])
	bingo = false;
    if (bingo)
      ans = true;
  }

  bool bingo = (m[0][0] && m[1][1] && m[2][2]) || (m[0][2] && m[1][1] && m[2][0]);
  if (bingo)
    ans = true;

  if (ans)
    cout << "Yes";
  else
    cout << "No";
  cout << endl;
  

  
}


Measured memory_bytes: 256
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

# define INF 0x3f3f3f3f

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

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

  int N;
  cin >> N;

  int a[51] = {};
  pair<int, int> pat[110] = {};

  REP(i, N) {
    cin >> a[i];
  }
  int mi = a[0];
  int ma = a[0];
  int mii = 0;
  int mai = 0;
  REP(i, N) {
    if (mi > a[i]) {
      mi = a[i];
      mii = i;
    }
    if (ma < a[i]) {
      ma = a[i];
      mai = i;
    }
  }
  if (ma == mi) {
    cout << 0 << endl;
    return 0;
  }

  int p = 0;
  if (abs(ma) >= abs(mi)) {
    REP(i, N) {
      if (a[i] <= 0) {
        pat[p++] = make_pair(mai, i);
        a[i] += ma;
      }
    }
    REP(i, N - 1) {
      if (a[i] <= a[i + 1]) continue;
      pat[p++] = make_pair(i, i + 1);
      a[i + 1] += a[i];
    }
  } else {
    REP(i, N) {
      if (a[i] >= 0) {
        pat[p++] = make_pair(mii, i);
        a[i] += mi;
      }
    }
    REPR(i, N - 1) {
      if (a[i] <= a[i + 1]) continue;
      pat[p++] = make_pair(i + 1, i);
      a[i] += a[i + 1];
    }
  }
  cout << p << endl;
  REP(i, p) {
    cout << pat[i].first + 1 << " " << pat[i].second + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    a, b = nm()
    print(sum(range(1, b - a)) - a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9164
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;

class Main
{

	public static void main(String[] args) throws NumberFormatException, IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		ArrayList<Integer> lstInt = new ArrayList<Integer>();

		for (int i = 0; i < 10; ++i)
		{
			lstInt.add(Integer.parseInt(br.readLine()));
		}

		lstInt.sort(Comparator.reverseOrder());

		for (int i = 0; i < 3; ++i)
			System.out.println(lstInt.get(i));

	}

}

Measured memory_bytes: 24408
#include<stdio.h>
#include<string.h>
int main(){
  char s[7][4]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
  char t[4]; scanf("%s",t);
  for(int i=0; i<7; i++){
    if (strcmp(t,s[i])==0) printf("%d\n",7-i);
  }
  return 0;
}

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

int main () {
  int r, g, b, A;
  cin >> r >> g >> b >> A;
  A = 100*r + 10*g + b;
  if (A % 4 == 0) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

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

int main() {
	int n;
	cin >> n;
	vector<int> a(n + 1), b(n);
	rep(i, n + 1) cin >> a[i];
	rep(i, n) cin >> b[i];

	ll ans = 0;
	rep(i, n) {
		if (b[i] <= a[i]) {
			ans += b[i];
		}
		else {
			ans += a[i];
			b[i] -= a[i];
			if (b[i] > a[i + 1]) {
				ans += a[i + 1];
				a[i + 1] = 0;
			}
			else {
				ans += b[i];
				a[i + 1] -= b[i];
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
/*
 ***
 Question Name:
 ***
 Question Link:
 
 ***
 Idea: The critial thing is an O(n logn) Algorithm to count the maximum length of the increasing subsequence.
 */

#include <memory.h>
#include <iomanip>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>

#define REP(i,s,n) for(int (i)=s; (i)<(int)(n);(i)++)
#define RIT(it,c) for(__typeof(c.begin()) it = c.begin();it!=c.end();it++)
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)(x).size()
#define MSET(m,v) memset(m,v,sizeof(m))

using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<LL> vL;
typedef vector<bool> vb;
typedef unordered_set<int> ui;
typedef pair<LL,LL> pLL;

/* Here is an O(n logn) Algorithm to count the maximum increasing subsequence. Here for conveniece, we assume the elements of A are all non-negative */
int maxSubseq(vi A){
    set<ii> dp; // This set store pairs of (last number, length), we know the two input parameters are positively correlated
    dp.insert(ii(-1,0));
    for(auto k:A){
        auto pre = --dp.lower_bound(ii(k,0));
        int L = pre->second+1;
        ++pre;
        // Then we erase those subsequeces that the ending element is larger than k, but the sequence is shorter than the one we just found
        while(pre!=dp.end() && pre->second<=L) pre = dp.erase(pre);
        dp.insert(ii(k, L));
    }
    /* The last element in the set is the one we try to find */
    return (--dp.end())->second;
}


class FountainWalk{
    const LD pi = 3.141592653589793238L;
    LD edge = 100.;
    LD radius = 10.;
public:
    LD Solution(int x1, int y1, int x2, int y2, vector<ii> &fountains){
        bool rev = false;
        if((long)(x1-x2)*(long)(y1-y2) < 0) rev = true;
        sort(fountains.begin(), fountains.end());
        if(rev) reverse(fountains.begin(), fountains.end());
        vi Seq;
        for(auto pos:fountains) Seq.push_back(pos.second);
        int cnt = maxSubseq(Seq);
        LD ans = edge*(abs(x1-x2) + abs(y1-y2)) - (LD)cnt*radius*((LD)2. - pi/2.);
        if(cnt == min(abs(x1-x2)+1, abs(y1-y2)+1)) ans += radius*pi/2.;
        return ans;
    }
};

int main(){
    int x1,y1,x2,y2,N;
    cin>>x1>>y1>>x2>>y2>>N;
    int xm = min(x1, x2), xM = max(x1, x2), ym = min(y1, y2), yM = max(y1, y2);
    vector<ii> fountains;
    for(int i=0;i<N;++i){
        int x, y;
        cin>>x>>y;
        if(x>=xm && x<=xM && y>=ym && y<= yM) fountains.push_back(ii(x,y));
    }
    cout <<setprecision(31);
    cout<<FountainWalk().Solution(x1, y1, x2, y2, fountains)<<endl;
}

Measured memory_bytes: 12784
#include<stdio.h>

int main(void){
  int N,M,ans[120],sum,i;
  int T[120];
  int P[120];
  int X[120];
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&T[i]);
  }
  scanf("%d",&M);
  for(i=0;i<M;i++){
    scanf("%d %d",&P[i],&X[i]);
  }
  sum = 0;
  for(i=0;i<N;i++){
    sum+=T[i];
  }
  //printf("%d\n",sum);
  for(i=0;i<M;i++){
    ans[i]=sum-T[P[i]-1]+X[i];
    printf("%d\n",ans[i]);
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>

using namespace std;

double to_degree(double x) {
    return 180.0 * x / M_PI;
}

int main(void) {
    double a, b, x;
    cin >> a >> b >> x;

    if(x < a*a*b/2.0) {
        printf("%.10lf\n", to_degree(atan2(b, 2.0*x/a/b)));
    } else {
        double h = x/a/a;
        printf("%.10lf\n", to_degree(atan2(2*(b-h), a)));
    }
    return 0;
}


Measured memory_bytes: 256
n = int(input())
t = [int(i) for i in input().split()]
m = int(input())
p = []
x = []
for i in range(m):
  pi, xi = map(int, input().split())
  p.append(pi)
  x.append(xi)
t_sum = 0
for i in range(n):
  t_sum = t_sum + t[i]
for i in range(m):
  print(t_sum+x[i]-t[p[i]-1])

Measured memory_bytes: 3064
from collections import deque
k = int(input())
cnt = 0

q = deque()
for i in range(1, 10):
    q.append((str(i), i))
    cnt += 1
    if cnt == k:
        print(str(i))
        exit()

while q:
    lun, num = q.popleft()

    for i in range(num - 1, num + 2):
        if i < 0 or i >9:continue
        temp = lun + str(i)
        q.append((temp, i))
        cnt += 1
        if cnt == k:
            print(temp)
            exit()

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

int main() {
 int N;
  cin >> N ;
  int a = N/1000;
  int b = N/100 - a*10;
  int c = N/10 - a*100 - b*10;
  int d = N % 10;
  if(a == b && b == c){
  cout << "Yes" << endl;
  }
  else if(b == c && c == d){
  cout << "Yes" << endl;
 }
  else {
  cout << "No" << endl;
  }
}




Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace StartFinish
{
 

    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] xy = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                if (xy[0] == 0 && xy[1] == 0)
                {
                    break;
                }
                else
                {
                    if (xy[0] > xy[1])
                    {
                        Swap(ref xy[0], ref xy[1]);
                    }
                }
                Console.WriteLine("{0} {1}",xy[0],xy[1]);
            }
        }

        static void Swap(ref int x,ref int y)
        {
            int tmp = x;
            x = y;
            y = tmp;
        }


    }
}

Measured memory_bytes: 9676
/*input 
400
*/ 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
#define ld double
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=1e6+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e16;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
int32_t main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n;
    cin>>n;
    n=1999-n;
    cout<<(n/200)+1;
}


Measured memory_bytes: 3656
#include<iostream>
#include<algorithm>
using namespace std;
signed main()
{
  double a,b;
  cin>>a>>b;
  if(a<b){
    cout<<"a < b"<<endl;
  }
  if(a>b){
    cout<<"a > b"<<endl;
  }
  if(a==b){
    cout<<"a == b"<<endl;
  }
  return(0);
}



Measured memory_bytes: 3168
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = str(readline().rstrip().decode('utf-8'))
    al = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
    ans = []
    for i in range(len(s)):
        for j in range(len(al)):
            if s[i] == al[j]:
                ans.append(al[(j+n) % 26])
                break
    print("".join(ans))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 40560
#include <iostream>

using namespace std;

int A[100][100];
int B[100][100];
long long C[100][100];

int main() {
    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)
        for (int k = 0; k < m; ++k) C[i][j] += A[i][k] * B[k][j];
    for (int i = 0; i < n; ++i) {
        int j = 0;
        cout << C[i][j++];
        while (j < l) cout << ' ' << C[i][j++];
        cout << endl;
    }
    return 0;
}



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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (auto&& e : v) cin >> e;

  int ans = 1'000'000'000;

  for (int i = 0, j = i + k - 1; j < n; i++, j++) {
    if (v[i] <= 0 && v[j] <= 0) {
      ans = min(ans, -v[i]);
    } else if (v[i] >= 0 && v[j] >= 0) {
      ans = min(ans, v[j]);
    } else {
      ans = min(ans, v[j] - v[i] + min(-v[i], v[j]));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
//const int inf = 1e9; //1(1倍)e(指数)9(10^9)
//const ll MX = 1e18; //1(1倍)e(指数)18(10^18)
//const ll MOD = 1e9 + 7; //1000000007で割った余りを聞かれたら使う
//加算代入演算子は+=
//int 2^31 10^9まで
//intは10桁、long longは18桁、doubleは308桁、long double は4932桁
//10^10くらいまででdoubleは誤差が発生しちゃう。なるべく整数にすること
//doubleからlong longにキャストするときは、+0.5で切り捨ての誤差を調整
//__int128()で128bit対応の整数（多倍長整数）
//||は片方が成り立つとき
int main()
{
    int n; 
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);
    sort(a.begin(), a.end());
    int last = a.size() - 1;
    int ans = a[last] - a[0];
    cout << ans << endl; 
    return 0;
}

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

//AとBの和が25

//各位の和
int func(int x){
    if(x/10 == 0) return x;
    return func(x/10) + x%10;
}

int N;
int main()
{
    cin>>N;
    int mi= 1000000000;
    for (int A = 1; A <=(int)(N/2) ; A++)
    {
        int B = N-A;
        // cout << "A:" << A << endl;
        // cout << "B:" << B << endl;

        mi = min(mi, func(A) + func(B));
    }
    
    cout << mi << endl;
        
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	char a,b,c;
	cin>>a>>b>>c;
	int n=700;
	if(a=='o')n+=100;
	if(b=='o')n+=100;
	if(c=='o')n+=100;
	cout<<n<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    
using namespace std;
typedef long long ll;
    
int main()
{
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> A;
    for (int i = 0; i <= N; i++) {
        int tmp;
        cin >> tmp;
        A.push_back(tmp);
    }
    sort(A.begin(), A.end());

    int cost0 = 0;
    for (int i = X; 0 <= i; i--) {
        auto itr = find(A.begin(), A.end(), i);
        if (itr != A.end()) {
            cost0++;
        }
        // cout << i << " " << cost0 << "\n";
    }

    int costN = 0;
    for (int i = X; i <= N; i++) {
        auto itr = find(A.begin(), A.end(), i);
        if (itr != A.end()) {
            costN++;
        }
    }

    // cout << cost0 << " " << costN << "\n";

    if (cost0 < costN) {
        cout << cost0;
    } else {
        cout << costN;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		if(N<1200) System.out.println("ABC");
		else if(N<2800) System.out.println("ARC");
		else System.out.println("AGC");
	}
}

Measured memory_bytes: 21844
N = int(input())
w = []
duplication = 0
series = 1
for i in range(N):
    w.append(str(input()))
for i in range(1,N):
    if w[i-1][-1] != w[i][0]:
        series = 0
        break
for i in range(N-1):
    for j in range(i+1,N):
        if w[i] == w[j]:
            duplication = 1
            break
if duplication == 0 and series == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064