akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var input = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long N = input[0];
            long K = input[1];
            long ans = 0;
            long Kn = N / K;
            ans += Kn * Kn * Kn;

            if (K % 2 == 0)
            {
                long modK = 0;
                for (var i = 1; i <= N; i++)
                {
                    if (i % K == K / 2)  { modK++; }
                }
                ans += modK * modK * modK;
            }

            Console.WriteLine(ans);
            Console.Out.Flush();
        }
    }



    public class Calculation
    {

    }

    public class Graph
    {

    }
}
    

Measured memory_bytes: 13396
void main() {
  zip("CODEFESTIVAL2016", rs).count!(p => p[0] != p[1]).writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


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

const int maxn=1e5+10,maxk=4e3+10;
int n,k,b[maxk][maxk],w[maxk][maxk],ans;

int bb(int x,int y){
	return b[x][y]-b[x+k][y]-b[x][y+k]+b[x+k][y+k];
}
int ww(int x,int y){
	return w[x][y]-w[x+k][y]-w[x][y+k]+w[x+k][y+k];
}

int main(){
	cin>>n>>k;
	for(int i=1;i<=n;++i){
		int x,y;char c[2];
		cin>>x>>y>>c;
		x%=2*k;
		y%=2*k;
		if(c[0]=='B'){
			++b[x][y];
			++b[x+2*k][y];
			++b[x][y+2*k];
			++b[x+2*k][y+2*k];
		}
		else{
			++w[x][y];
			++w[x+2*k][y];
			++w[x][y+2*k];
			++w[x+2*k][y+2*k];
		}
	}
	for(int i=4*k-1;i>=0;--i)
		for(int j=4*k-1;j>=0;--j)
			b[i][j]+=b[i+1][j]+b[i][j+1]-b[i+1][j+1],
			w[i][j]+=w[i+1][j]+w[i][j+1]-w[i+1][j+1];
	for(int i=0;i<2*k;++i)
		for(int j=0;j<2*k;++j){
			int res=bb(i,j)+bb(i+k,j+k)+ww(i+k,j)+ww(i,j+k);
			if(res>ans)
				ans=res;
		}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 125696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define x first
#define y second
#define mp make_pair
#define pb push_back
template <typename TYPE> inline void chkmax(TYPE &x,TYPE y){x<y?x=y:0;}
template <typename TYPE> inline void chkmin(TYPE &x,TYPE y){y<x?x=y:0;}
template <typename TYPE> void readint(TYPE &x)
{
    x=0;int f=1;char c;
    for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
    for(;isdigit(c);c=getchar())x=x*10+c-'0';
    x*=f;
}
const int MAXN=3005,MOD=998244353;
int qmi(int x,int y)
{
	int ans=1;
	for(;y;y>>=1,x=1ll*x*x%MOD)
		if(y&1)ans=1ll*ans*x%MOD;
	return ans;
}

int a,b,c,d,f[MAXN][MAXN],p[MAXN][MAXN];
int pw[MAXN][MAXN],ipw[MAXN][MAXN];

int main()
{
	#ifdef LOCAL
	freopen("code.in","r",stdin);
//	freopen("code.out","w",stdout);
	#endif
	readint(a),readint(b),readint(c),readint(d);
	for(int i=1;i<=c+1;++i)
	{
		int invi=qmi(i,MOD-2);
		pw[i][0]=ipw[i][0]=1;
		for(int j=1;j<=d+1;++j)
			pw[i][j]=1ll*pw[i][j-1]*i%MOD,
			ipw[i][j]=1ll*ipw[i][j-1]*invi%MOD;
	}
	f[a][b]=1;
	p[a][b]=1ll*ipw[a+1][b+1]*b%MOD;
	for(int m=b+1;m<=d;++m)
	{
		f[a][m]=1ll*f[a][m-1]*a%MOD;
		p[a][m]=(p[a][m-1]+1ll*f[a][m]*ipw[a+1][m+1]%MOD*m)%MOD;
	}
	for(int n=a+1;n<=c;++n)
	{
		f[n][b]=1ll*f[n-1][b]*b%MOD;
		p[n][b]=1ll*f[n][b]*ipw[n+1][b+1]%MOD*b%MOD;
		for(int m=b+1;m<=d;++m)
		{
			f[n][m]=(1ll*f[n-1][m]*m%MOD
				+1ll*pw[n][m]*(p[n-1][m-1]-p[n-1][b-1]+MOD)%MOD)%MOD;
			p[n][m]=(p[n][m-1]+1ll*f[n][m]*ipw[n+1][m+1]%MOD*m)%MOD;
		}
	}
	printf("%d\n",f[c][d]);
	return 0;
}

Measured memory_bytes: 144580
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <algorithm>
#include <set>
#include <string>
#include <queue>
#include <functional>
using namespace std;
signed main(void)
{
	int n;
	int s[103];
	int dp[103][10];
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < 103; i++) {
		for (int j = 0; j < 10; j++) {
			dp[i][j] = -1;
		}
	}
	dp[0][0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < 10; j++) {
			if (dp[i - 1][j] != -1) {
				dp[i][j] = max(dp[i-1][j],dp[i][j]);
				dp[i][(dp[i - 1][j] + s[i]) % 10] = max(dp[i-1][j]+s[i], dp[i][(dp[i - 1][j] + s[i]) % 10]);
			}
		}
	}
	int ans = 0;
	for (int i = 1; i < 10; i++) {
		ans = max(ans, dp[n][i]);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::pair;

using std::vector;
using std::sort;

int H,W;
vector<vector<int>> min;

void search(int d,int x,int y,vector<vector<int>>& s){
    if(x<0||y<0||H<=x||W<=y){
        return;
    }
    if(s[x][y]==0){
        return;
    }
    if(0<min[x][y] && min[x][y]<=d){
        return;
    }
    min[x][y]=d;
    if(x==0&&y==0){
        return;
    }

    s[x][y]=0;

    search(d+1,x-1,y,s);
    search(d+1,x,y-1,s);
    search(d+1,x+1,y,s);
    search(d+1,x,y+1,s);

    s[x][y]=1;
}

int main(){
    cin >> H >> W;
    int white=0;
    vector<vector<int>> s(H,vector<int>(W));
    min=vector<vector<int>>(H,vector<int>(W,-1));
    for(int i=0;i<H;i++){
        string str;
        cin >> str;
        for(int j=0;j<W;j++){
            s[i][j]=(str[j]=='#')?0:1;
            white+=s[i][j];
        }
    }

    search(1,H-1,W-1,s);
    if(min[0][0]<0){
        cout << -1 << endl;
        return 0;
    }

    cout << (white-min[0][0]) << endl;
    return 0;
}



Measured memory_bytes: 384
n, m = gets.chomp.split(" ").map(&:to_i)

h = Hash.new(0)

m.times do
  a, b = gets.chomp.split(" ").map(&:to_i)
  h[a] += 1
  h[b] += 1
end

if h.values.all?{|x| x.even?} then
  puts "YES"
else
  puts "NO"
end


Measured memory_bytes: 8060
N = int(input())
ps = [0] * (N+1)
for i in range(2,N+1):
  x = i
  p = 2
  while x > 1 :
    while x % p == 0:
      ps[p] += 1
      x //= p
    p += 1
ans = 1
for c in ps:
  ans = (ans * (c+1)) % 1000000007
print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
 
int data[10][11]={{1,0,1,0,1,0,0,1,0,1,0},
                  {1,1,1,0,2,0,1,1,1,1,1},
                  {1,2,1,1,2,1,1,2,1,2,1},
                  {2,2,2,1,3,1,2,2,1,3,1},
                  {2,3,2,2,3,1,3,2,2,3,2},
                  {3,3,2,3,3,2,3,3,2,4,2},
                  {4,3,3,3,4,2,4,3,3,4,2},
                  {4,4,3,4,4,3,4,3,4,4,3},
                  {5,4,4,4,4,4,4,4,4,5,3},
                  {5,4,5,4,5,4,5,4,5,5,4}};
 
int main() {
    int n, k; cin >> n >> k;
    if(n<3){
      cout << 0 << endl;
      return 0;
    }
    n-=2; int cnt = n/11*5; n=(n-1)%11;
    if(n<10) cnt += data[n][k];
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int N;
	string S;
	cin >> N >> S;
	int cnt = 0;
	int ans = 0;
	rep(i, N) {
		if (S[i] == 'I') {
			cnt++;
		}
		else if (S[i] == 'D') {
			cnt--;
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
// skip until line 65
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

#define BR "\n"
#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a, b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it, cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it, cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)
#define MIN(V, T) V=min(V,T)

#define DumpArray(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;

/*
 * ***_bound(6)
 * 5 6 6 6 6 6 7 7 7
 *   ^lower    ^upper
 * void reverse(c.begin(), c.end())
 *
 * graph
 * seg tree
 * dp
 * brute force
 */
struct Comparator{
    int operator()(int l, int r) const {
        return r<l;
    }
};
struct Vec;
//set<int, Comparator> S;

// solution below
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;

int main() {
    ll N,M;
    vector<ll> Ans;
    cout.precision(10);
    cout<<fixed;
    cin >> N;
    Ans.resize(N,0);
    REP(i,N-1) {
        ll t;
        cin >>t;
        --t;
        Ans[t]++;
    }
    REP(i,N) {
        cout <<Ans[i]<<endl;
    }
}

struct Vec{
    double v[2];
    string to_s(){
        return "("+to_string(v[0])+","+to_string(v[1])+")";
    }
    double& operator[](int t){
        return v[t];
    }
    Vec operator+(Vec t) {
        return {v[0]+t[0],v[1]+t[1]};
    }
    Vec& operator+=(Vec t) {
        v[0]+=t[0];v[1]+=t[1];
        return *this;
    }
    Vec operator-(Vec t) {
        return {v[0]-t[0],v[1]-t[1]};
    }
    Vec& operator-=(Vec t) {
        v[0]-=t[0];v[1]-=t[1];
        return *this;
    }
    Vec operator*(double t) {
        return {v[0]*t,v[1]*t};
    }
    Vec& operator*=(double t) {
        v[0]*=t;v[1]*=t;
        return *this;
    }
    double operator*(Vec t) {
        return v[0]*t[0]+v[1]*t[1];
    }
    Vec operator-(){
        return {-v[0],-v[1]};
    }
    static Vec Z;
};
Vec Vec::Z={0,0};


Measured memory_bytes: 4844
import sys
input = sys.stdin.readline
ri = lambda: int(input())
#rl = lambda: [int(x) if x.isdecimal() else x for x in input().split()]
#rl = lambda: list(input().split()))
rl = lambda: map(int,input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7

S = input()
ans = 0
if S.count(S[0]) == 2:
    for i in range(1,4):
        if S[0] != S[i] and S.count(S[i]) == 2:
            ans = 1

yn(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, m, a[maxn], b[maxn], cnt, ans;
bool vis[maxn];
set<int> st;
vector<int> g[maxn];

void dfs(int p) {
	vis[p] = 1; b[++cnt] = p; st.insert(p);
	for (int i = 0; i < g[p].size(); ++i) {
		int e = g[p][i];
		if (!vis[e]) dfs(e);
	}
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	for (int i = 1; i <= m; ++i) {
		int l, r; scanf("%d%d", &l, &r);
		g[l].push_back(r); g[r].push_back(l);
	}
	for (int i = 1; i <= n; ++i)
		if (!vis[i]) {
			st.clear(); cnt = 0;
			dfs(i);
			for (int j = 1; j <= cnt; ++j)
				ans += st.count(a[b[j]]);
		}
	printf("%d", ans);
}

Measured memory_bytes: 13312
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

#define pb push_back
#define mk make_pair
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define sf(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pf(a) printf("%d\n",a);
#define pfl(a) printf("%lld\n",a);
#define TEST int test; cin >> test;while(test--)
#define ii pair<int,int>
#define iil pair<ll,ll>
#define loop(i,a,b) for(int i = a ; i < b ; i++)
#define INF 2147483647


int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const double pi = acos(-1.0);

map<ll,ll>mp;
void solve()
{

   int n ;
   cin >> n;
   int a[n+10];
   int mn = -1, c= 0;
   for(int i = 0 ; i < n ; i++)
   {
     cin >> a[i];

     if(a[i] >= mn)
     {
       c++;
       mn = a[i];
     }

   }
   cout << c << endl;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //TEST
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>

using namespace std;
#define ALL(x)			(x).begin(),(x).end()
#define REP(i, n)		for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)	for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF				(int)2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)		(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)		(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)	((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)		(!IsOdd((x)))						
#define M_PI			3.14159265358979323846
typedef long long		ll;
typedef pair<ll, string>	P;
typedef vector<ll>		VLL;
typedef vector<VLL>		VVLL;
typedef vector<VVLL>	VVVLL;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
// MODのべき乗
ll powMod(ll n, ll p) 
{
	ll res = 1;
	while (p) {
		if (p & 1) (res *= n) %= MOD;
		(n *= n) %= MOD;
		p >>= 1;
	}
	return res;
}

// MODの逆元
ll invMod(ll n) 
{
	return powMod(n, MOD - 2);
}

/* コンビネーション */
ll CombinationMod(ll n, ll r)
{
	if (n <= 0) {
		return 1;
	}
	
	ll sum = 1;
	ll maxR = min(n - r, r);
	for (ll j = 0; j < maxR; j++) {
		sum *= (n - j);
		sum %= MOD;
		sum *= invMod(maxR - j);
		sum %= MOD;
	}

	return sum;
}

int main()
{
	ll n, a, b;
	cin >> n >> a >> b;
	
	ll ans = powMod(2, n);
	ll ansA = CombinationMod(n, a);
	ll ansB = CombinationMod(n, b);

	ans -= 1;

	ans -= ansA;
	ans += MOD;
	ans %= MOD;

	ans -= ansB;
	ans += MOD;
	ans %= MOD;

	cout << ans << endl;
	return 0;
}


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

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    vector<ll> as(n, 0);
    ll max1 = -1;
    ll max2 = -1;
    for(int i = 0; i < n; ++i){
        ll a;
        cin >> a;
        as.at(i) = a;
        if(max1 == -1 || as.at(max1) < a){
            max2 = max1;
            max1 = i;
        }else if(max2 == -1 || as.at(max2) < a){
            max2 = i;
        }
    }
    for(int i = 0; i < n; ++i){
        if(i != max1){
            cout << as.at(max1) << endl;
        }else{
            cout << as.at(max2) << endl;
        }
    }
    return 0;
}


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

int p[200005];

int main(){
    int n; cin >> n;
    for(int i=0;i<n;i++) cin >> p[i];
    int minimum=100000000;
    int ans=0;
    for(int i=0;i<n;i++){
        if(p[i]<minimum){
            minimum=p[i];
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  vector<int>A(N);
  rep(i,N) cin >> A[i];
  sort(A.begin(),A.end());
  
  cout << A[N-1]-A[0] << endl;
  return 0;
  
}


Measured memory_bytes: 3612
/****************************************************************
# @Author:      iLovePKU_zbtxdy
# @DateTime:    2020-02-07 10:51:59
# @Description: Think twice. Code once. 
# @More: Once lots of AC, try Brute-force,dynamic programming
****************************************************************/
#include<bits/stdc++.h>
using namespace std;
#define close std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define eps 1e-8
typedef long long ll;
const int maxn = 1e6+10;
const int INF = 0x3f3f3f3f;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0);
ll mod = 1e9+7;
int n, a[maxn] , x;
ll ans;
int main()
{
    close;
    cin >> n >> x;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n-1; i++){
        int tmp = a[i] + a[i+1] - x;
        if(tmp < 0)tmp = 0;
        ans += tmp;
        a[i + 1] -= tmp;
        if(a[i + 1] < 0) a[i + 1] = 0;
    }
    cout << ans << endl;
    system("pause");
}
/***************************************************************************
*stuff you should look for
*int overflow, array bounds
*special cases (n=1?), set tle
*do smth instead of nothing and stay organized
***************************************************************************/

Measured memory_bytes: 888
x, y = map(int, input().split())
a = 0
for i in list(range(0, 51)):
    for m in list(range(0, 26)):
        if i * 2 + m * 4 == y and i + m == x:
            a += 1
if 50 < x:
    a = 0
if a == 1:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9172
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int a,b,c[13]={0,1,3,1,2,1,2,1,1,2,1,2,1};
	cin >> a >> b;
	if(c[a]==c[b]){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
#define all(i) i.begin(),i.end()
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll H,W;
  cin>>H>>W;
  char pic[H][W];
  rep(i,H){
    rep(j,W) cin>>pic[i][j];
  }
  for(int i=0;i<2*H;i++){
    for(int j=0;j<W;j++){
      cout<<pic[i/2][j];
    }
    cout<<endl;
  }
}

Measured memory_bytes: 3576
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Stack, Queue, PriorityQueue, Set}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N = in.next().toInt
  val A = new Array[Int](N+1)
  for (i <- 1 to N)
    A(i) = in.next().toInt

  //
  val hash = Map[Int, Long]()
  for (i <- 1 to N) {
    val now = A(i)
    if (!hash.contains(now))
      hash += (now -> 1)
    else
      hash(now) += 1
  }

  var ans = 0L
  for ((_, v) <- hash) {
    ans += (v * (v-1)) / 2
  }

  for (i <- 1 to N) {
    val now = A(i)
    val v = hash(now)

    var hoge = ans - (v * (v-1)) / 2
    if (v-2 >= 0)
      hoge += ((v-1)*(v-2)) / 2
    pw.println(hoge)
  }

  pw.flush()
}

object Sub {
  def print2DimArray[A](mat: Array[Array[A]]): Unit = {
    mat.foreach(lin => println(lin.toList))
  }
}

class InputReader(stream: InputStream) {
  private[this] val reader = new BufferedReader(new InputStreamReader(stream))
  private[this] var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


Measured memory_bytes: 76272
import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np

def main():
	s=input()
	ans="ABC"
	if s==ans:
		ans="ARC"
	print(ans)










if __name__ == "__main__":
	main()


Measured memory_bytes: 9120
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val as = List.fill(n)(sc.nextInt())
  val max = as.max
  val m = as.filter(_ != max).minBy( a =>
    if (max % 2 == 0) (max/2 - a).abs else (max/2 - a).abs.min((max/2 + 1 - a).abs)
  )
  println(s"$max $m")
}


Measured memory_bytes: 63348
n = input()

if n[0] < n[1]:
    x = int(n[0]) + 1
    temp_100 = x*100 + x*10 + x
    print(temp_100)
elif n[0] > n[1]:
    x = int(n[0]) 
    temp_100 = x*100 + x*10 + x
    print(temp_100)
else :
    if n[1] < n[2]:
        x = int(n[0]) + 1
        temp_100 = x*100 + x*10 + x
        print(temp_100)
    elif n[1] >= n[2]:
        x = int(n[0]) 
        temp_100 = x*100 + x*10 + x
        print(temp_100)



Measured memory_bytes: 3064
s=input()
a,b,c,d=s[0],s[1],s[2],s[3]
e=int(a)
o=['+','-']
p=[1,int(-1)]
x,y,z='','',''
ans,f,g,h=0,0,0,0
for i in range(2):
  f=int(b)*((-1)**i)
  x=o[i]
  for j in range(2):
    g=int(c)*((-1)**j)
    y=o[j]
    for k in range(2):
      h=int(d)*((-1)**k)
      z=o[k]
      ans=e+f+g+h
      #print(a+x+b+y+c+z+d+'='+str(ans),e+f+g+h)
      if ans==7:
        print(a+x+b+y+c+z+d+'=7')
        exit()
      ans=0

Measured memory_bytes: 3064
import java.util.Scanner;
import java.lang.Math;
import java.lang.StringBuilder;
import java.util.regex.Pattern;
import java.util.Arrays;


    public class Main {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            
            int n = sc.nextInt();
            int k = sc.nextInt();
            int[] A=new int[n];
            
        
            for(int i=0; i<n; i++){
                A[i] = sc.nextInt();
            }
            
            Arrays.sort(A);
            
            
            int min = 2147483647;
            for(int h=0; h<n-k+1; h++){
            min = Math.min(min,A[h+k-1] - A[h]);
            }
            System.out.println(min);
        }
    }

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


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

/*bool subseq(string s,string t){
    ll y=0;
    for(ll i=0;y<s.size()&& i<t.size();i++){
        if(s[y]==t[i]){
            y++;
        }
    }
        if(y==s.size())
            return true;
        else  return false;
}*/




int main(){
    ll n;
    string s;
    cin>>n;
    cin>>s;
    if(s.size()>n){
       s.erase(s.begin()+n,s.end());
       s=s+"...";
    }
    cout<<s;
}


Measured memory_bytes: 3632
import numpy as np
from scipy.sparse import lil_matrix, csr_matrix
from scipy.sparse.csgraph import shortest_path
M=49*50+1
n,m,s=map(int,input().split())
s=min(s,M-1)
G=lil_matrix((n*M,n*M))
for _ in range(m):
    a,b,silver,time=map(int,input().split())
    a-=1
    b-=1
    for i in range(silver,M):
        G[a*M+i,b*M+i-silver]=time
        G[b*M+i,a*M+i-silver]=time
for i in range(n):
    silver,time=map(int,input().split())
    for j in range(M-1):
        G[i*M+j,i*M+min(j+silver,M-1)]=time
G=G.tocsr()
G=shortest_path(G,method='D',indices=s)

for i in range(1,n):
    ans=np.min(G[i*M:i*M+M])
    print(int(ans))

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

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define X first
#define Y second

using namespace std;

int solve();

int main()
{
    #ifdef DEBUG
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif // DEBUG
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    solve();
    return 0;
}

void check(string s, string t, int n, int m)
{
    for (int y = 0; y < m; y++)
        if ((y * 1ll * n) % m == 0)
        {
            int x = (y * 1ll * n) / m;
            if (s[x] != t[y])
            {
                cout << -1 << endl;
                exit(0);
            }
        }
}

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

int solve()
{
    int n, m;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;
    check(s, t, n, m);
    check(t, s, m, n);
    ll g = gcd(n, m);
    ll ans = n * 1ll * m;
    ans /= g;
    cout << ans << endl;
    return 0;
}


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

int main() {
	int n, k, q, a;
	cin >> n >> k >> q;

	vector<int> p(n,0);
	for (int i = 0; i < q; i++) {
		cin >> a;
		p[a-1]++;
	}

	for (int i = 0; i < n; i++) {
		if (p[i]+k-q > 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 3752
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long ll;
const int mod= 1e+9+7;

int main() {
    int N; cin>>N;
    vector<ll>h(N);
    rep(i,N){
        cin>>h[i];
        h[i]--;
    }
    rep(i,N-1){
        if(h[i]>h[i+1]){
            h[i+1]++;
            if(h[i]>h[i+1] ||h[i-1]>h[i]){
                cout<<"No"<<endl;
                return 0;
            }
        }
    
    }
    cout<<"Yes"<<endl;


}


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

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long n = in.nextInt();
		
		long ans = 0;
		
		for(long i = 1; i <= n; i++)
			ans += i * (n - i + 1);
		
		for(int i = 1; i < n; i++)
		{
			int a = in.nextInt();
			int b = in.nextInt();
			int l = Math.min(a, b);
			int r = Math.max(a, b);
			ans -= l * (n - r + 1);
		}
		
		System.out.println(ans);

	}

}


Measured memory_bytes: 59832
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

  public static void main(String[] args) throws Exception {
    try (final var stdin = new InputStreamReader(System.in);
         final var br = new BufferedReader(stdin)) {
      final int[] s = Arrays.stream(br.readLine().split(" "))
        .mapToInt(Integer::parseInt)
        .toArray();

      final var n = s[0];
      final var x = s[1];
      final var t = s[2];

      System.out.println(n % x == 0 ? (n / x) * t : ((n / x) + 1) * t);
    }
  }
}


Measured memory_bytes: 34384
import random
from functools import lru_cache
import math

def solve():
    n = int(input())
    hmap = {'AC': 0, 'TLE': 0, 'WA': 0, 'RE': 0}
    
    for _ in range(n):
        s = input()
        hmap[s] += 1
    
    print('AC x', hmap.get('AC',0))
    print('WA x', hmap.get('WA',0))
    print('TLE x', hmap.get('TLE',0))
    print('RE x', hmap.get('RE',0))

t = 1
for _ in range(t):
    solve()



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

#define v vector
#define ll long long 
#define vpll vector<pair<long long,long long> > 
#define F first
#define S second
#define mp make_pair
#define ld long double
#define pb push_back
#define pii pair<int,int>
#define pci pair<char,int>
 
using namespace std; 



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m;
    cin>>n>>m;
    int first = 0;
    int second = 0;
    cin>>first>>second;
    for(int i = 0 ; i < m-1 ; i++)
    {
        int a,b;
        cin>>a>>b;
        if((a > second) || (first > b))
        {
            cout<<0;
            return  0;
        }
        else
        {
            first = max(a,first);
            second = min(b,second);
        }
    }
    cout<<second-first+1;
    return 0;
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int re = (100 * a) + (10 * b) + c;

    if (re % 4 == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 3600
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String data1 = sc.nextLine();
        String data2 = sc.nextLine();
        
        String[] array = data2.split(" ");
        int n = Integer.parseInt(data1);
        
        String result = "APPROVED";
        for(int i = 0; i < n; i++)
        {
            int buf = Integer.parseInt(array[i]);
            if(buf % 2 == 0)
            {
                if(buf % 3 != 0 && buf % 5 != 0)
                {
                    result = "DENIED";
                    break;
                }
            }
        }
        
        System.out.println(result);
    }
}


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

using namespace std;

using int64 = long long;
const int INF = 1 << 29;

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< typename T >
vector< T > dijkstra(WeightedGraph< T > &g, int s) {
  const auto INF = numeric_limits< T >::max();
  vector< T > dist(g.size(), INF);

  using Pi = pair< T, int >;
  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  dist[s] = 0;
  que.emplace(dist[s], s);
  while(!que.empty()) {
    T cost;
    int idx;
    tie(cost, idx) = que.top();
    que.pop();
    if(dist[idx] < cost) continue;
    for(auto &e : g[idx]) {
      auto next_cost = cost + e.cost;
      if(dist[e.to] <= next_cost) continue;
      dist[e.to] = next_cost;
      que.emplace(dist[e.to], e.to);
    }
  }
  return dist;
}


int main() {
  int A, B, D[10][10];
  cin >> A >> B;
  for(int i = 0; i < A; i++) {
    for(int j = 0; j < B; j++) {
      cin >> D[i][j];
    }
  }

  int F[101][101] = {{}};
  for(int a = 0; a <= 100; a++) {
    for(int b = 0; b <= 100; b++) {
      for(int c = 0; c < A; c++) {
        for(int d = 0; d < B; d++) {
          F[a][b] = max(F[a][b], D[c][d] - a * (c + 1) - b * (d + 1));
        }
      }
    }
  }

  for(int c = 1; c <= A; c++) {
    for(int d = 1; d <= B; d++) {
      WeightedGraph< int > g(202);
      for(int a = 0; a <= 99; a++) {
        g[a].emplace_back(a + 1, c);
        g[a + 102].emplace_back(a + 101, d);
      }
      for(int a = 0; a <= 100; a++) {
        for(int b = 0; b <= 100; b++) {
          g[a].emplace_back(b + 101, F[a][b]);
        }
      }
      if(dijkstra(g, 0)[101] != D[c - 1][d - 1]) {
        cout << "Impossible" << endl;
        return 0;
      }
    }
  }


  Edges< int > edges;
  for(int a = 0; a <= 99; a++) {
    edges.emplace_back(a, a + 1, -1);
    edges.emplace_back(a + 102, a + 101, -2);
  }
  for(int a = 0; a <= 100; a++) {
    for(int b = 0; b <= 100; b++) {
      edges.emplace_back(a, b + 101, F[a][b]);
    }
  }
  cout << "Possible" << endl;
  cout << 202 << " " << edges.size() << endl;
  for(auto &e : edges) {
    cout << e.src + 1 << " " << e.to + 1 << " ";
    if(e.cost == -1) cout << "X" << endl;
    else if(e.cost == -2) cout << "Y" << endl;
    else cout << e.cost << endl;
  }
  cout << 1 << " " << 102 << endl;
}



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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n;
    cin>>n;
    ll ans=n*(n+1)/2;
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int llu;
typedef long double ld;
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pair<int,int>>
#define pb push_back
#define pf push_front
#define mp map<ll,ll>
#define INF 1000000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
ll gcd(ll a,ll b)
{
    if(a==0)
    {
        return b;
    }
    else
    {
        return gcd(b%a,a);   
    }
}
ll lcm(ll a,ll b)
{
    return a*b/gcd(a,b);
}
int f(char c)
{
    return (int)c-48;
}
/**********************************************************************
***********************************************************************
*********************ACTUAL CODE BEGINS HERE***************************/
int h,w;
int c1,c2,d1,d2;
string s[1005];
int visited[1005][1005];
int check[1005][1005];
int x,y;
int ch(int i,int j)
{
   if(i>0&&i<=h&&j>0&&j<=w)
   {
       return 1;   
   }
   else
   {
       return 0;   
   }
}
queue<pair<int,int>> stk;
int count;
void path(int i,int j,int mark)
{   
    if(check[i+1][j]==0&&i+1<=h)
    {    
        check[i+1][j]=1;
        visited[i+1][j]=mark;
        path(i+1,j,mark);
    }
    if(check[i][j+1]==0&&j+1<=w)
    {   
        check[i][j+1]=1;
        visited[i][j+1]=mark;
        path(i,j+1,mark);
    }
    if(check[i][j-1]==0&&j-1>0)
    {   
        check[i][j-1]=1;
        visited[i][j-1]=mark;
        path(i,j-1,mark);
    }
    if(check[i-1][j]==0&&i-1>0)
    {   
        check[i-1][j]=1;
        visited[i-1][j]=mark;
        path(i-1,j,mark);
    }
    for(int a=i-2;a<=i+2;a++)
    {
        for(int b=j-2;b<=j+2;b++)
        {
            if(ch(a,b))
            {
                if(check[a][b]==0&&visited[a][b]==0)
                {    
                    stk.push({a,b});
                    visited[a][b]=mark+1;
                }
            }
        }
    }
} 
int main()
{   
    fast;
    cin>>h>>w;
    cin>>c1>>c2>>d1>>d2;
    visited[c1][c2]=2;
    for(int i=1;i<=h;i++)
    {
        cin>>s[i];
        s[i]='#'+s[i];
    }
    if(s[d1][d2]=='#')
    {
        //cout<<-1;
        //return 0;
    }
    stk.push({c1,c2});
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(s[i][j]=='#')
            {
                visited[i][j]=1;
                check[i][j]=1;
            }
        }
    }
    int mark=2;
    while(!stk.empty())
    {   
        int a,b;
        a=(stk.front()).first;
        b=(stk.front()).second;
        stk.pop();
        if(visited[a][b]!=0&&check[a][b]==0)
        {   
            //cout<<a<<" "<<b<<endl;
            check[a][b]=1;
            path(a,b,visited[a][b]);
        }
    }
    /*for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            cout<<visited[i][j]<<" ";
        }
        cout<<endl;
    }*/
    if(check[d1][d2]!=0)
    {
          cout<<visited[d1][d2]-visited[c1][c2];
    }
    else
    {
        cout<<-1;   
    }
    return 0;
}

Measured memory_bytes: 12564
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
const ll size=1e5+10;
struct node{
	ll c,t;
}a[size];
ll n,t,minc=1e18;
int main(){
	scanf("%lld%lld",&n,&t);
	for(ll i=1;i<=n;i++){
		scanf("%lld%lld",&a[i].c,&a[i].t);
		if(a[i].t>t) continue;
		minc=min(minc,a[i].c);
	}
	if(minc==1e18){
		printf("TLE");return 0;
	}
	else{
		printf("%lld",minc);return 0;
	}
}

Measured memory_bytes: 256
from itertools import combinations as C
while True:
    n = int(input())
    if n == 0: break
    d, dd, ddd = {}, {}, {}
    names = []
    for i in range(n):
        nmd = input().split()
        d[nmd[0]] = nmd[2:]
        names.append(nmd[0])
    for cc in list(C(d.items(), n-1)):
        t, tt = [], []
        for c in cc:
            t.append(c[0])
            tt += c[1]
        for name in names:
            if name not in t:
                dd[name] = tt
                break
    for k in d.keys():
        tmp = 0
        for v in d[k]:
            tmp += n-dd[k].count(v)
        ddd[k] = tmp
    ans = sorted(ddd.items(), key=lambda x: (x[1], x[0]))[0]
    print(ans[1], ans[0])

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

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

    int N; cin >> N;
    rep(i, N) {
        int A; cin >> A;
        if (A % 2) continue;
        if (A % 3 != 0 && A % 5 != 0) {cout << "DENIED" << endl; return 0;}
    }
    cout << "APPROVED" << endl;
    return 0;
}

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

int main() {
  int H, W;
  cin >>H>> W;

  vector<vector<char>> vec(H,vector<char>(W));

  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin>>vec.at(i).at(j);
    }
  }
  bool a=false;
  int x=0;
  int z=0;
  vector<vector<char>> ans(H);
  vector<vector<char>> lo(H);
  for(int i=0; i<H; i++){
    int a=0;
    for(int j=0; j<W; j++){
      if(vec.at(i).at(j)=='.')
      a++;
      
      if(a==W)
      x++;
      if(a!=W&&j==W-1){
        for(int k=0; k<W; k++){
          ans.at(i-x).push_back(vec.at(i).at(k));
        }
      }
    }
  }
  for(int i=0; i<W; i++){
    int a=0;
    for(int j=0; j<H-x; j++){
      if(ans.at(j).at(i)=='.')
      a++;

      if(a==H-x)
      z++;
      if(a!=H-x&&j==H-x-1){
        for(int k=0; k<H-x; k++)
        lo.at(k).push_back(ans.at(k).at(i));
      }
    }
  }
  for(int i=0; i<H-x; i++){
    for(int j=0; j<W-z; j++){
      cout<<lo.at(i).at(j);
      if(j==W-z-1)
      cout<<endl;
    }
  }
}


Measured memory_bytes: 3696
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << p.first << " " << p.second;
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll N, K;
  std::cin >> N >> K;

  print(N-K+1);

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
int main()
{
	int R[MAX], n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> R[i];
	int maxv = -2000000000;
	int minv = R[0];
	for (int i = 1; i < n; i++) {
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}
	cout << maxv << endl;
	return 0;







}

Measured memory_bytes: 3868
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int n;
  cin>>n;
  auto check=[](int x){
    string s=to_string(x);
    string t=s;
    reverse(t.begin(),t.end());
    if(t.size()>1&&t[0]==0) return;
    for(int i=0;i<(int)s.size();i++){
      if(s[i]!=t[i]) return;
    }
    cout<<x<<endl;
    exit(0);
  };
  for(int i=0;i<n;i++){
    check(n-i);
    check(n+i);
  }
  return 0;
}

Measured memory_bytes: 3284
#include <iostream>
using namespace std;
int main(){
    int n,a;
long long int sum=0;
    cin>>n;
    int max=-1000000,min=1000000;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a>max)max=a;
        if(a<min)min=a;
        sum+=a;
    }
    cout<<min<<" "<<max<<" "<<sum<<endl;
}

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

namespace ABC148A
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = int.Parse(Console.ReadLine());
            var b = int.Parse(Console.ReadLine());
            Console.WriteLine(6 - a - b);
            Console.ReadKey();
        }
    }
}


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

using namespace std;

#define mod 1000000007
#define ll long long int
#define mk make_pair
#define pb push_back
#define xx first
#define yy second
#define ar array

double pi=3.141592653589793238;
const int M = 1e9+7;
const int Nmax=5005;
const int MM = 1e7+1;
const int N=200010;

int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int T=1;
//cin>>T;
while(T--){
int x;
cin>>x;
int y;
if(x>=1800)y=1;
else if(x>=1600)y=2;
else if(x>=1400)y=3;
else if(x>=1200)y=4;
else if(x>=1000)y=5;
else if(x>=800)y=6;
else if(x>=600)y=7;
else y=8;
cout<<y;

}
return 0;
}


Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

main(){
	int n;
	cin >> n;
	int a[n],b[n],c[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	for(int i=0;i<n;i++){
		cin >> b[i];
	}
	for(int i=0;i<n;i++){
		c[i]=b[i]-a[i];
	}
	sort(c,c+n);
	long long int ans=0; 
	long long int total=0;
	for(int i=0;i<n;i++){
		if(c[i]>0){
			total+=c[i];
			ans++;
		}
	}

	for(int i=0;i<n;i++){
		if(c[i]<0 && total>0){
			total+=c[i];
			ans++;
		}
	}
	if(total>0){
		cout << "-1" <<endl;
	}else{
		cout << ans <<endl;
	}
}




Measured memory_bytes: 1408
#include <stdio.h>
#include <stdlib.h>
int main(void) {
	int vote[1000];
	int list[1000];
	int i,f;
	memset( vote,NULL,sizeof( vote ));
	int a = 0,b = 0,c = 0;
	scanf( "%d %d",&i,&f );
	for( a = 0;a < i;a++ ){
		scanf( "%d",&list[a] );
	}
	for( a = 0;a < f;a++ ){
		scanf( "%d",&c );
		for( b = 0;b < i;b++ ){
			if( list[b] <= c ){ vote[b]++; break; }
		}
	}
	b = 0,c = 0;
	for( a = 0;a < i;a++ ){
	    if( vote[a] > b ){
	    	b = vote[a];
	    	c = a + 1;
	    }
	}
	printf( "%d\n",c );
	return 0;
}

Measured memory_bytes: 604