akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>/*{{{*/
#include<cctype>
#include<cassert>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<vector>
using namespace std;
typedef long long lld;
typedef long double lf;
typedef unsigned long long uld;
typedef pair<int,int> pii;
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define ROF(i,a,b) for(int i=(a);i>=(b);--i)
namespace RA{
    int r(int p){return 1ll*rand()*rand()%p;}
    int r(int L,int R){return r(R-L+1)+L;}
}/*}}}*/
/******************heading******************/
const int N=2e5+5,M=2e6+5,INF=0x3f3f3f3f;

struct qxx{int nex,t,v;};
qxx e[M];
int hh[M],h[M],le=1;
void add_path(int f,int t,int v){e[++le]=(qxx){h[f],t,v},h[f]=le;}
void add_flow(int f,int t,int v){add_path(f,t,v),add_path(t,f,0);}
#define FORe(i,_u,_v,_w)     for(int  i= h[_u],_v,_w;_v=e[i].t,_w=e[i].v,i;i=e[i].nex)
#define FORflowe(i,_u,_v,_w) for(int &i=hh[_u],_v,_w;_v=e[i].t,_w=e[i].v,i;i=e[i].nex)

int s,t;
int n;
int dep[N];
queue<int> q;
bool bfs(){
    memset(dep,0,sizeof(dep));
    q.push(s),dep[s]=1;
    while(!q.empty()){
        int u=q.front();q.pop();
        FORe(i,u,v,w)if(w&&!dep[v])dep[v]=dep[u]+1,q.push(v);
    }
    return !!dep[t];
}
int dfs(int u,int flow){
    if(u==t)return flow;
    int rest=flow;
    FORflowe(i,u,v,w){
        if(!w||dep[v]!=dep[u]+1)continue;
        int k=dfs(v,min(w,rest));
        e[i].v-=k,e[i^1].v+=k,rest-=k;
        if(!rest)break;
    }
    return flow-rest;
}
int dinic(){
    int maxflow=0;
    while(bfs()){
        memcpy(hh,h,sizeof(h));
        for(int i;(i=dfs(s,INF));)maxflow+=i;
    }
    return maxflow;
}

vector<int> c[N];
vector<pii> g[N];
pii ans[N];
int p[N],vis[N],use[N],la;
void dfs(int u){
    vis[u]=1;
    for(pii v:g[u])if(!vis[v.fi]&&!use[v.se]){
        use[v.se]=1;
        ans[v.se]={u,v.fi};
        ++la;
        dfs(v.fi);
    }
}

int main(){
    scanf("%d",&n);
    s=0,t=n*2;
    FOR(i,1,n-1){
        int k,x;
        scanf("%d",&k);
        FOR(j,1,k){
            scanf("%d",&x);
            c[i].pb(x);
            if(x!=1)add_flow(x,i+n,1);//1是根结点
        }
    }
    FOR(i,2,n)add_flow(s,i,1);
    FOR(i,1,n-1)add_flow(i+n,t,1);
    int tot=dinic();
    if(tot<n-1)return puts("-1"),0;
    assert(tot==n-1);
    FOR(i,2,n){
        FORe(j,i,v,w)if((j&1)==0&&!w)p[v-n]=i;
    }
    //FOR(i,1,n-1)printf("p[%d]=%d\n",i,p[i]);
    FOR(i,1,n-1){
        for(int x:c[i]){
            if(x!=p[i])g[x].pb({p[i],i});//,g[p[i]].pb(x);
        }
    }
    dfs(1);
    if(la!=n-1)return puts("-1"),0;
    FOR(i,1,n-1)printf("%d %d\n",ans[i].fi,ans[i].se);
    return 0;
}



Measured memory_bytes: 46592
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
using namespace std;
int main() {
	int a, b, c, na, nb, nc;
	int ans = 0;
	cin >> a >> b >> c;
	for (int i = 0; i < 1000; i++) {
		if (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
			na = (b + c) / 2;
			nb = (a + c) / 2;
			nc = (b + a) / 2;
			ans++;
			if (na == a && nb == b && nc == c) {
				ans = -1;
				break;
			}
			a = na;
			b = nb;
			c = nc;
		}
		else {
			break;
		}
	}
		cout << ans << endl;
		return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

//aとbの最大公約数
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}

//aとbの最小公倍数
ll lcm(ll a, ll b){
    return a*(b/gcd(a,b));
}

int main(){
    int N;
    cin >> N;
    ll ans = 1;
    rep(i, N){
        ll T;
        cin >> T;
        ans = lcm(ans, T);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define AC ios::sync_with_stdio(0),cin.tie(0);

int main()
{
    AC
    int n,w;
    cin>>n>>w;
    vector<ll> dp(w+1,0);
    for(int i=0;i<n;i++)
    {
        int wei,val;
        cin>>wei>>val;
        for(int j=w;j>=wei;j--)
            dp[j]=max(dp[j],dp[j-wei]+val);
    }
    cout<<dp[w]<<'\n';
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 987654321
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;

double r;
int main() {
	cin >> r;
	cout <<  3.141592 * 2 * r;
}

Measured memory_bytes: 3260
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using ll = long long;
using namespace std;
int main(){
  string s;
  int ii,flg=0;
  cin >> s;
  for(ii=1;ii<4;ii++){
    if(s[ii-1] == s[ii]){
      flg = 1;
    }
  }
  if(flg == 1){
    cout <<"Bad"<< endl;
  }
  else{
    cout <<"Good"<< endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int w, h, n;
	cin >> w >> h >> n;
	vector<int> x(w, 1);
	vector<int> y(h, 1);
	for(int i = 0; i < n; i++) {
		int p, q, r;
		cin >> p >> q >> r;
		if(r == 1) {
			for(int j = 0; j < p; j++) {
				x[j] = 0;
			}
		} else if(r == 2) {
			for(int j = p; j < w; j++) {
				x[j] = 0;
			}
		} else if(r == 3) {
			for(int j = 0; j < q; j++) {
				y[j] = 0;
			}
		} else {
			for(int j = q; j < h; j++) {
				y[j] = 0;
			}
		}
	}
	int xn = 0, yn = 0;
	for(int i = 0; i < w; i++) {
		xn += x[i];
	}
	for(int i = 0; i < h; i++) {
		yn += y[i];
	}
	cout << xn * yn << endl;

	return 0;
}

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

int main(){

    int A, B;
    cin >> A >> B;

    int ans = -1e+6;

    ans = max( ans, A*B );
    ans = max( ans, A-B );
    ans = max( ans, A+B );

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
char s[N];
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> (s+1);
 	int n = strlen(s+1);
 	int ans = 0;
 	if(n&1)
 	{
 		int x = (n+1)/2;
 		int i = x - 1, j = x + 1;
 		while(i>=1&&j<=n)
 		{
 			if(s[i]!=s[j]) ans++;
 			i--; j++;
 		}
 	}
 	else
 	{
 		int i = n/2, j = i + 1;
 		while(i>=1&&j<=n)
 		{
 			if(s[i]!=s[j]) ans++;
			i--; j++;
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
/*Template by hemnath_d(Enlightened by chamow)*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vec vector<ll>
#define pll pair<ll,ll>
#define fastread ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fx first
#define sx second
#define inf 100000000000000
#define minf -100000000000000
#define maxi 100005
ll n,arr[maxi];
ll memo[maxi];
ll solve(ll pos)
{
	if(pos==n-1)
		return 0;
	if(pos==n-2)
		return abs(arr[n-1]-arr[n-2]);
	if(memo[pos]!=-1)
		return memo[pos];
	ll ans;
	ans=min(solve(pos+1)+abs(arr[pos+1]-arr[pos]),solve(pos+2)+abs(arr[pos+2]-arr[pos]));
	memo[pos]=ans;
	return ans;
}
int main()
{
    fastread;
    cin>>n;
    for(ll i=0;i<maxi;i++)
    	memo[i]=-1;
    for(ll i=0;i<n;i++)
    	cin>>arr[i];
    cout<<solve(0)<<endl;
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <string.h>
using namespace std;

#define HUNDRED 100
#define THOUSAND 10000
#define TENTHOUSAND 10000
#define HUNDREDTHOUSAND 100000

int main() {
	int n;
	int sn = 0;
	int temp;

	cin >> n;

	temp = n;

	while (temp > 0) {
		sn += (temp % 10);
		temp /= 10;
	}

	if((n % sn) == 0){
		cout << "Yes";
	}
	else{
		cout << "No";
	}

}


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

using namespace std;

constexpr int MOD = 1000000007;
constexpr int N = 100000;

long long x[N + 1];
long long f[N + 1];

/* O(Log(min(a, b))) - Extended Euclidean Algorithm.
   Returns a solution to a * x + b * y = gcd(a, b).
   Returns |x| <= |a / gcd(a, b)|, |y| <= |b / gcd(a, b)| and gcd(a, b). */
long long extended_gcd(long long a, long long b, long long &x, long long &y) {
	long long x1, y1, gcd;

	if (a == 0) {
		x = 0;
		y = 1;
		return b;
	}
 
	gcd = extended_gcd(b % a, a, x1, y1);
	x = y1 - (b / a) * x1;
	y = x1;
 
	return gcd;
}

/* O(Log(M)) - Returns the modular multiplicative inverse of a mod m, if it exists.
Returns x that satisfies a * x = 1 (mod m) if a and m are coprime. Returns 0 otherwise. */
long long modular_inverse(long long a, long long m) {
	long long x, y;

	if (extended_gcd((a % m + m) % m, m, x, y) != 1) {
		return 0;
	}

	return (x % m + m) % m;
}

int main() {
	long long ans;
	int n;

	f[0] = 1;

	for (long long i = 1; i <= N; i++) {
		f[i] = (f[i - 1] * i) % MOD;
	}

	scanf("%d", &n);

	for (int i = 1; i <= n; i++) {
		scanf("%lld", x + i);
	}

	ans = 0;

	for (int i = 1; i <= n - 1; i++) {
		ans = (ans + ((f[n - 1] * modular_inverse(i, MOD)) % MOD) * (x[n] - x[i])) % MOD;
	}

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

	return 0;
}

Measured memory_bytes: 1792
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <vector>
#include <unordered_map>
#include <stack>
#include <list>
#include <math.h>
#include <map>
#include <iomanip>
#include <functional>
#include <string>
#include <algorithm>
#include <queue>
#include <random>
#include <set>

using namespace std;

template<class T> ostream& operator<<(ostream& os, const vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) os << *i << (i == end(v) - 1 ? "" : " "); return os;
}
template<class T> istream& operator>>(istream& is, vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) is >> *i; return is;
}

#define MOD 1000000007
#define inf 2000000000



int main() {

#if defined(_DEBUG) 
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	long long x, y;
	cin >> x >> y;

	if (max(x,y) <= 1)
	{
		cout << "Brown";
		return 0;
	}

	if ((x - y + 3000000000000000000LL) % 3 == 0)
	{
		if (x != y)
		{
			cout << "Alice";
		}
		else
		{
			cout << "Brown";
		}
	}
	else
	{
		if ((max(x, y) - min(x, y)) != 1)
		{
			cout << "Alice";
		}
		else
		{
			cout << "Brown";
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  char m[52][52];
  int d[50][50],x[4]={0,0,1,-1},y[4]={1,-1,0,0},p[2500]={},q[2500]={},h,w,k=1,s,t,i,j;
  scanf("%d%d",&h,&w);d[0][0]=1;
  for(i=0;i<h;i++)scanf("%s",&m[i+1][j+1]);
  for(i=0;i<h*w;i++)for(j=0;j<4;j++){
    if(i>=k){printf("-1");return 0;}
    s=p[i]+x[j];t=q[i]+y[j];
    if(m[s+1][t+1]=='.'){d[s][t]=d[p[i]][q[i]]+1;p[k]=s;q[k]=t;k++;m[s+1][t+1]=0;}
    if(s==h-1&&t==w-1)i=j=h*w;
  }
  for(i=1;i<=h;i++)for(j=1;j<=w;j++)d[h-1][w-1]+=m[i][j]=='#';
  printf("%d",h*w-d[h-1][w-1]);
}


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

#define int long long
#define f first

#define s second
using namespace std;

template<typename T> using vc = vector<T>;
using pii=pair<int, int>;

void xmax(int & a, int b){
    a=max(a, b);
}
void xmin(int& a, int b){
    a=min(a, b);
}

void print(vc <int> & a, string s){
    cerr << s << " : ";
    for (int i=0; i<a.size(); i++){
        cerr <<a[i] << " ";
    }
    cerr << endl;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    #ifdef LOCAL_RUN
    freopen("input.txt", "r", stdin);
    int ttt;
    cin >> ttt;
    while(ttt--){
    #endif // LOCAL_RUN

    int n, k;
    cin >> n >> k;
    int anz = 0;
    while(n>0){
        n/=k;
        anz++;
    }
    cout << anz << "\n";
    #ifdef LOCAL_RUN
    }
    #endif // LOCAL_RUN
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;

int main() {
    int n;
    cin >> n;
    if (n >= 1800) printf("1");
    else if (n >= 1600) printf("2");
    else if (n >= 1400) printf("3");
    else if (n >= 1200) printf("4");
    else if (n >= 1000) printf("5");
    else if (n >= 800) printf("6");
    else if (n >= 600) printf("7");
    else if (n >= 400) printf("8");
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <queue>

using namespace std;

void Check(int i, int N, const vector<vector<int> >& graph, set<int>& v, int& ct)
{
	v.insert(i);
	if (v.size() == N)
	{
		++ct;
		v.erase(i);
		return;
	}
	auto& x = graph[i];
	for (auto& y : x)
	{
		if (v.find(y) == v.end())
		{
			Check(y, N, graph, v, ct);
		}
	}
	v.erase(i);
}
void ABC054C()
{
	int N, M;
	cin >> N >> M;
	vector<vector<int> > graph(N+1);
	for (int i = 0; i < M; ++i)
	{
		int a, b;
		cin >> a >> b;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	set<int> v;
	int ct = 0;
	Check(1, N, graph, v, ct);
	cout << ct << endl;
}

int main()
{
	ABC054C();
	return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  sort(h.rbegin(), h.rend());
  long long ans = 0;
  for (int i = k; i < n; i++) {
    ans += (long long) h[i];
  }
  cout << ans << '\n';
  return 0;
} 

Measured memory_bytes: 1024
// in the name of Allah

#include <bits/stdc++.h>

#define endl '\n'
#define ll long long
#define pb push_back
#define ld long double
#define sz(x) ((int) (x.size()))

#define max_n 123456
#define mod 1000000007
// #define mod 998244353
#define myPrime 97654321
#define inf 1e9
#define eps 1e-9

#define fr first
#define se second

using namespace std;

ll add(ll a, ll b) {
	a += b;
	if(a >= mod) return a - mod;
	return a;
}

ll mul(ll a, ll b) {
	a *= b;
	if(a >= mod) return a % mod;
	return a;
}

ll power(ll x, ll y) {
	if(y == 0) return 1;
	ll foo = power(x, y/2);
	foo = mul(foo, foo);
	if(y&1) return mul(x, foo);
	return foo;
}

ll n, m;

bool okay(ll g) {
	if(n <= m / g) return 1;
	return 0;
}

int main() {
	ll start_time = clock();
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	// cout << fixed << setprecision(12);
	cin >> n >> m;
	ll ans = 0;
	for(ll i=1; i*i <= m; i++) {
		if(m % i == 0) {
			if(okay(i)) ans = max(ans, i);
			if(okay(m/i)) ans = max(ans, m/i);
		}
	}
	cout << ans << endl;
	return 0;
}

// sorted or not
// mutiset vs set
// clear when it's multi-testcase

Measured memory_bytes: 256
use std::io::*;

fn main() {
    let mut s: String = String::new();
    stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let a: usize = itr.next().unwrap().parse().unwrap();
    let b: usize = itr.next().unwrap().parse().unwrap();
    if a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0 {
        println!("Possible");
    } else {
        println!("Impossible");
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
const int maxn=55;

struct node{
	int x,y;
}a[maxn];

map<int,int> NowToOriX,NowToOriY;//±àºÅ->ÕæÖµ 
map<int,int> OriToNowX,OriToNowY;//ÕæÖµ->±àºÅ 

int PreSum[maxn][maxn];//Ç°×ººÍ 
int mp[maxn][maxn];//ÀëÉ¢»¯

int n,k;
long long ans,dx,dy;

bool cmpx(node xx,node yy){
	return xx.x<yy.x;
}

bool cmpy(node xx,node yy){
	return xx.y<yy.y;
}

int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i].x,&a[i].y);
	}
	sort(a+1,a+n+1,cmpx);
	for(int i=1;i<=n;i++){
		NowToOriX[i]=a[i].x;
		OriToNowX[a[i].x]=i;
	}
	dx=a[n].x-a[1].x;
	sort(a+1,a+n+1,cmpy);
	for(int i=1;i<=n;i++){
		NowToOriY[i]=a[i].y;
		OriToNowY[a[i].y]=i;
	}
	dy=a[n].y-a[1].y;
	ans=dx*dy;
	for(int i=1;i<=n;i++){
		mp[OriToNowX[a[i].x]][OriToNowY[a[i].y]]=1;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			PreSum[i][j]=PreSum[i-1][j]+PreSum[i][j-1]-PreSum[i-1][j-1]+mp[i][j];
		}
	}
	for(int x1=1;x1<=n;x1++){
		for(int y1=1;y1<=n;y1++){
			for(int x2=x1;x2<=n;x2++){
				for(int y2=y1;y2<=n;y2++){
					int t=PreSum[x2][y2]-PreSum[x1-1][y2]-PreSum[x2][y1-1]+PreSum[x1-1][y1-1];
					if(t>=k){
						dx=NowToOriX[x2]-NowToOriX[x1];
						dy=NowToOriY[y2]-NowToOriY[y1];
						long long area=abs(dx*dy);
						ans=min(ans,area);
					}
				}
			}
		}
	}
	printf("%lld",ans);
	return 0;
}
 

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

public class AIDU0010
    {
        public static void Main(string[] args) {
            int N = 20;
            string[] input = new string[N];
            string[][] inputFr = new string[N][];
            double[] p = new double[6];
            double[] q = new double[4];
            double[,] O = new double[N, 2];
            double[] R = new double[N];
            double A = 1;

            N = int.Parse(Console.ReadLine());
            for (int i = 0; i < N; i++) {
                input[i] = Console.ReadLine();
                inputFr[i] = input[i].Split();
                for (int j = 0; j < 6; j++) {
                    p[j] = double.Parse(inputFr[i][j]);
                    if (j > 1)
                        q[j - 2] = p[j] - p[j % 2];
                }
                A = 2 * (-q[0] * q[3] + q[1] * q[2]);
                O[i, 0] = (q[1] * Abs(q[2], q[3])
                    - q[3] * Abs(q[0], q[1]))
                    / A;
                O[i, 1] = (-q[0] * Abs(q[2], q[3])
                    + q[2] * Abs(q[0], q[1]))
                    / A;

                R[i] = Math.Sqrt(Abs(O[i, 0], O[i, 1]));

                O[i, 0] += p[0];    O[i, 1] += p[1];
            }

            for (int i = 0; i < N; i++) {
                PrintRound(O[i,0],O[i,1],R[i]);
            }

        }

        public static double Abs(params double[] X) {
            return X[0] * X[0] + X[1] * X[1];
        }

        public static void PrintRound(params double[] G) {
            string S="";
            foreach (double d in G) {
                S =string.Concat(S,string.Format(" {0:F3}",d));
            }
            Console.WriteLine(S.Remove(0,1));
        }
    }

Measured memory_bytes: 9296
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處

int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    string T; cin >> T;
    int ans = 0;
    for (int i = 0; i < T.size(); ++i) {
        if (T[i] == '?')  T[i] = 'D';
    }
    cout << T << endl;
    return 0;
}


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

int main() {
  string S;
  cin >> S;
  
  int count1=0, count2=0;
  
  for (int i=0; i<S.size(); i+=2) {
    if (S.at(i) != '1') count1++;
  }
  for (int i=1; i<S.size(); i+=2) {
    if (S.at(i) != '0') count1++;
  }
  for (int i=0; i<S.size(); i+=2) {
    if (S.at(i) != '0') count2++;
  }
  for (int i=1; i<S.size(); i+=2) {
    if (S.at(i) != '1') count2++;
  }
  
  cout << min(count1,count2) << endl;
  
   
}

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

int main(){
  int n,t,a;
  cin >> n >> t >> a;
  double h[1010] = {0};
  double kion[1010] = {0};
  double saisyo = 1000000;
  int kekka;
  for(int i = 1;i <= n;i++){
   double cur;
    cin >> h[i];
    kion[i] = t - h[i]*0.006;
    cur = abs(kion[i] - a);
    if(saisyo > cur){
       saisyo = cur;
       kekka = i;
   } 
 }
  cout << kekka << endl;
}

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

namespace ABC154 {
    public class B {
        public static void Main() {
            var input = Console.ReadLine();
            var numbers = Console.ReadLine().Split(' ').Select(int.Parse);
            if (numbers.Count() == numbers.Distinct().Count()) Console.WriteLine("YES");
            else Console.WriteLine("NO");
        }
    }
}


Measured memory_bytes: 34912
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;
double eps = 1e-11;

int main() {
    int N;
    cin >> N;
    int a[N];
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    ll ans = 0;
    for (int i = 1; i < N; i++) {
        if (a[i] == a[i - 1]) {
            ans++;
            a[i] = -1;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    int one;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        if(a[i] == 1) one = i;
    }
    int ans = (n+k-3)/(k-1);
    cout << ans << endl;
}

Measured memory_bytes: 640
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse4")
#include<bits/stdc++.h>

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

using namespace std;

const ll MAX_N = 2e8;

int solve();

#define TASK ""

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

ll n;
ll m;
ll ans = 1e18;

string s;
string t;

int solve()
{
    cin >> n >> m;
    cin >> s;
    cin >> t;
    if (s[0] != t[0])
    {
        cout << -1 << endl;
        return 0;
    }
    ll k2 = m / __gcd(n, m);
    for (int i = k2; i < m; i += k2)
    {
        int j = (i * n) / m;
        if (j < n)
        {
            if (s[j] != t[i])
            {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    cout << (n * m) / __gcd(n, m) << endl;
    return 0;
}




Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <queue>
using namespace  std;

const int nIMPOS = -1;
struct StDist
{
  int m_nDist;
  int m_nFromMeTo;

  StDist(int nDist) : m_nDist(nDist), m_nFromMeTo(0)
  { }
};

void fnInput(vector<vector<int>>& rvvnAdjcy, vector<StDist>& rvoDist)
{
  int nxSiz;
  cin >> nxSiz;

  rvvnAdjcy.resize(nxSiz + 1, vector<int>(nxSiz + 1, 0));
  for (int i = 0; i < nxSiz; ++i)
  {
    int nx, nySiz;
    cin >> nx >> nySiz;
    for (int j = 0; j < nySiz; ++j)
    {
      int ny;
      cin >> ny;
      rvvnAdjcy[nx][ny] = 1;
    }
  }
  StDist oDist(nIMPOS);
  rvoDist.resize(nxSiz + 1, oDist);
}

void fnBreadthFirstSearch(const vector<vector<int>>& cnrvvnAdjcy, 
                          queue<int>& rqnBFSrch, vector<StDist>& rvoDist)
{
  while (rqnBFSrch.size())
  {
    int nx = rqnBFSrch.front(); rqnBFSrch.pop();
    if (rvoDist[nx].m_nDist == nIMPOS)  continue;
    if (rvoDist[nx].m_nFromMeTo)        continue; 

    rvoDist[nx].m_nFromMeTo = 1;
    for (int ny = 1; ny < cnrvvnAdjcy[nx].size(); ++ny)
      if (cnrvvnAdjcy[nx][ny])
      {
        int nDist = rvoDist[nx].m_nDist + 1;
        if (rvoDist[ny].m_nDist == nIMPOS)
          rvoDist[ny].m_nDist = nDist;
        else
          rvoDist[ny].m_nDist = min(rvoDist[ny].m_nDist, nDist);

        rqnBFSrch.push(ny);
      }
  }
}

void fnResult(const vector<StDist>& cnrvoDist)
{
  for (int i = 1; i < cnrvoDist.size(); ++i)
    cout << i <<  " " << cnrvoDist[i].m_nDist << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<vector<int>> vvnAdjcy;
  queue<int>  qnBFSrch;
  vector<StDist> voDist;

  fnInput(vvnAdjcy, voDist);

  voDist[1].m_nDist = 0;
  qnBFSrch.push(1);
  fnBreadthFirstSearch(vvnAdjcy, qnBFSrch, voDist);
  fnResult(voDist);

  return 0;
}

Measured memory_bytes: 3152
#ifdef __GNUG__
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG // ArrayOutofBounds
#else
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#endif
#define rep(i, N) for (int i = 0; i < N; i++) //制御変数iを用いてN回転
using namespace std;
using ll = long long;
//0:上 1:左 2:下 3:右
const int di[] = { -1, 0, 1, 0};
const int dj[] = { 0, -1, 0, 1};

int main() {
    int x;
    cin >> x;
    if (x==0) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
using namespace std;
using ll = long long;
const ll INF = +10010010000;

const int mod = 1e9+7;

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

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

struct combination{
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i<n;++i)fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i>=1;--i) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k){
    if(k<0 || k>n)return 0;
    return fact[n] * ifact[k] + ifact[n-k]; 
  }
};

int main(){
    int n;
    cin >> n;
    vector<vector<int>> d(n,vector<int>(30,0));
    vector<bool> chk(30,false);
    rep(i,n){
        string s;
        cin >> s;
        for(char ele : s){
            ++d[i][int(ele)-97];
            chk[int(ele)-97]=true;
        }
    }
    vector<char> ans;
    rep(j,30){
        int mini = 55;
        rep(i,n){
            if(chk[j])mini = min(mini,d[i][j]);
        }
        if(mini!=55)rep(p,mini)ans.push_back(j+97);
    }
    rep(i,ans.size()){
        cout<<ans[i];
    }
    cout << endl;
    return 0;
}


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

using namespace std;
const int MAXN = 1e5 + 3;
int ans[MAXN];

vector< pair<int, int> > graph[MAXN];

void dfs(int cur, int parent, int cost) {
  ans[cur] = cost;
  for (int i = 0; i < (int)graph[cur].size(); ++i) {
    pair<int, int> new_cur = graph[cur][i];
    if (new_cur.first != parent) dfs(new_cur.first, cur, cost ^ new_cur.second);
  }
}

int main() {
  int N;
  scanf("%d", &N);
  int u, v, w;
  for (int i = 0; i < N - 1; ++i) {
    scanf("%d %d %d", &u, &v, &w); --u; --v;
    graph[u].push_back(make_pair(v, w % 2));
    graph[v].push_back(make_pair(u, w % 2));
  }

  dfs(0, 0, 0);
  for (int i = 0; i < N; ++i) printf("%d\n", ans[i]);
  return 0;
}



Measured memory_bytes: 9984
#include<cstdio>
#include<cctype>
#include<queue>
#include<algorithm>
#include<cstring>
using namespace std;

#define REP(i, N) for(int i=0;i<(int)(N);++i)

int unit[20];
int need[20];

int nextInt() {int r = 0, ch; while( isspace(ch = getchar())); do {r = r * 10 + ch - '0';}while( isdigit( ch = getchar() ) ); return r;}

int best;
int N, U;
int tno;
int gain[20];
char visited[1 << 20];
void dfs(int mask, int one, int have) {
  if( best <= one ) return;
  if( have >= U ) {
    best = one;
    return;
  }
  if( have + gain[best - one - 1] < U ) return;

  for(int i = 0; i < N; i++)
    if ( visited[mask | (1 << i)] != tno && (mask | need[i]) == mask )
      {
        visited[mask | (1 << i)] = tno;
        dfs( mask | (1 << i), one + 1, have + unit[i] );
      }
}

int main() {
  for(tno = 1;; tno++) {
    N = nextInt();
    U = nextInt();
    if( N == 0 && U == 0 ) break;
    REP(i, N) need[i] = 0;

//     int all = 0;
    REP(i, N) {
      unit[i] = nextInt();
//       all += unit[i];
      gain[i] = unit[i];
      int K = nextInt();
      REP(k, K) {
        int x = nextInt();
        need[i] |= (1 << x);
      }
    }

    sort( gain, gain + N );
    reverse( gain, gain + N );
    for(int i = 1; i < N; i++)
      gain[i] += gain[i - 1];

//     if( all == U ) {
//       printf("%d\n", N);
//       continue;
//     }

    best = N;
    dfs(0, 0, 0);
    printf("%d\n", best);
  }
}

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

int main() {
    int X; cin >> X;
    int n = X / 100;
    int m = X % 100;
    int i = 0; bool ok = false;
    while (i < n) {
        if (m >= 5) m -= 5;
        else if (m >= 4) m -= 4;
        else if (m >= 3) m -= 3;
        else if (m >= 2) m -= 2;
        else if (m >= 1) m -= 1;

        if (m == 0) {
            ok = true;
            break;
        }
        i++;
    }
    if (ok) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    s = 0
    a = list(map(int,input().split()))
    for i in range(m):
        s += a[i] * b[i]
    if s + c > 0:
        ans += 1
print(ans)

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

class Main
{
	public static void main(String[] args)
    {
     	Scanner in = new Scanner(System.in);
      	int n = in.nextInt();
      	if(n % 1000 > 0) System.out.println(1000 - (n % 1000));
      	else System.out.println(0);
      	
    }
}

Measured memory_bytes: 35724
#include <iostream>

using namespace std;
int main()
{
	int a;
	int b;
	int c;
	
	cin >> a >> b >> c;
	
	if ((a + b + c) <= 21){
		printf("win");
	}
	
	else {
		printf("bust");
	}
	
	return (0);
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 3
#define N2 9

struct Puzzle {
  int f[N2];
  int space;
  string path;

  bool operator < ( const Puzzle &p ) const {
    for ( int i = 0; i < N2; i++ ) {
      if ( f[i] == p.f[i] ) continue;
      return f[i] > p.f[i];
    }
    return false;
  }
};

static const int dx[4] = {-1, 0, 1, 0};
static const int dy[4] = {0, -1, 0, 1};
static const char dir[4] = {'u', 'l', 'd', 'r'};

bool isTarget(Puzzle p) {
  for ( int i = 0; i < N2; i++ )
    if ( p.f[i] != (i + 1) ) return false;
  return true;
}

string bfs(Puzzle s) {
  queue<Puzzle> Q;
  map<Puzzle, bool> V;
  Puzzle u, v;
  s.path = "";
  Q.push(s);
  V[s] = true;

  while ( !Q.empty() ) {
    u = Q.front(); Q.pop();
    if ( isTarget(u) ) return u.path;
    int sx = u.space / N;
    int sy = u.space % N;
    for ( int r = 0; r < 4; r++ ) {
      int tx = sx + dx[r];
      int ty = sy + dy[r];
      if ( tx < 0 || ty < 0 || tx >= N || ty >= N ) continue;
      v = u;
      swap(v.f[u.space], v.f[tx * N + ty]);
      v.space = tx * N + ty;
      if ( !V[v] ) {
        V[v] = true;
        v.path += dir[r];
        Q.push(v);
      }
    }
  }

  return "unsolvable";
}

int main() {
  Puzzle in;

  for ( int i = 0; i < N2; i++ ) {
    cin >> in.f[i];
    if ( in.f[i] == 0 ) {
      in.f[i] = N2;
      in.space = i;
    }
  }
  string ans = bfs(in);
  cout << ans.size() << endl;

  return 0;
}


Measured memory_bytes: 30540
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <set>
#include <map>
 
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
 
int h, w, n, md;
bool g[51][51] = {};
 
void answer() {
    ll res = 0;
    ll base = 1;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (g[i][j]) res = (res+base) % md;
            base = 2*base % md;
        }
    }
    cout << "! " << res << endl;
}
 
using T = tuple<int, int, int, int>;
map<T, int> buf;
int que(int ax, int ay, int bx, int by) {
    bx--; by--;
    if (buf.count(T(ax, ay, bx, by))) return buf[T(ax, ay, bx, by)];
    cout << "? " << ay << " " << ax << " " << by << " " << bx << endl;
    int p;
    cin >> p;
    return buf[T(ax, ay, bx, by)] = p;
}
 
 
int dfs(int d, int u, int l, int r, int nm = -1) {
    if (nm == -1) {
        nm = que(l, d, r, u);
    }
    if (nm == 0) return 0;
    if ((u-d)*(r-l) == nm) {
        for (int y = d; y < u; y++) {
            for (int x = l; x < r; x++) {
                g[y][x] = true;
            }
        }
        return nm;
    }
    if (l+1 == r && d+1 == u) {
        g[d][l] = true;
        return 1;
    }
    int mdy = (d+u)/2;
    int mdx = (l+r)/2;
    if (u-d < r-l) {
        int buf = dfs(d, u, l, mdx);
        dfs(d, u, mdx, r, nm-buf);
    } else {
        int buf = dfs(d, mdy, l, r);
        dfs(mdy, u, l, r, nm-buf);
    }
    return nm;
}
 
int main() {
    ios::sync_with_stdio(0);
    cin >> h >> w >> n >> md;
//    for (int i = 0; i < h; i++) {
/*        for (int j = 0; j < w; j++) {
            g[i][j] = (que(j, i, j+1, i+1) != 0);
        }*/
//        dfs(i, 0, w);
//    }
    dfs(0, h, 0, w);
    answer();
    return 0;
}


Measured memory_bytes: 724
#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	S = input()
	Q = int(input())
	cnt = 0
	s_start = ""
	s_end = ""
	for i in range(Q):
		q = list(input().split())
		if q[0] == "1":
			cnt += 1
		else:
			if q[1] == "1":
				if cnt % 2 == 0:
					s_start += q[2]
				else:
					s_end += q[2]
			else:
				if cnt % 2 == 0:
					s_end += q[2]
				else:
					s_start += q[2]

	if cnt % 2 == 0:
		ans = s_start[::-1] + S + s_end

	else:
		ans = s_end[::-1] + S[::-1] + s_start

	print(ans)

if __name__ == '__main__':
	main()

Measured memory_bytes: 4724
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define vi vector<int>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())

void print(int a)
{
    if (a != 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

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

    if (n % 2 == 1 && m % 2 == 1)
        print(1);
    else
        print(0);
}


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

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static void Main() {
        var nw = ReadInts();
        int n = nw[0], W = nw[1];

        const int inf = int.MaxValue / 2;
        var dp = new int[10010]; // dp[??????] = ????°??????????
        for (int i = 0; i < dp.Length; i++)
            dp[i] = inf;
        dp[0] = 0;

        for (int i = 0; i < n; i++) {
            var vw = ReadInts();
            int v = vw[0], w = vw[1];

            for (int j = dp.Length - 1; j >= 0; j--) {
                if (j - v < 0) break;
                dp[j] = Math.Min(dp[j], dp[j - v] + w);
            }
        }

        for (int i = dp.Length - 1; i >= 0; i--) {
            if (dp[i] <= W) {
                Console.WriteLine(i);
                break;
            }
        }
    }
}

Measured memory_bytes: 9708
N = int(input())
Ss = input()

def isOK(k):
    strAs = ['' for _ in range(N)]
    strBs = ['' for _ in range(N)]
    for L in range(N-k+1):
        R = L+k-1
        ss = Ss[L:R+1]
        strAs[R] = ss
        strBs[L] = ss

    strCands = set()
    for iEn in range(N-1):
        if strAs[iEn] != '':
            strCands.add(strAs[iEn])
        if strBs[iEn+1] != '' and strBs[iEn+1] in strCands:
            return True

    return False


ng, ok = N//2 + 1, 0
while abs(ok-ng) > 1:
    mid = (ng+ok) // 2
    if isOK(mid):
        ok = mid
    else:
        ng = mid

print(ok)


Measured memory_bytes: 9544
const lines=readlines()
state=0
input()=lines[global state+=1]
int(s::String)=parse(Int32,s)
intSub(s::SubString{String})=parse(Int32,s)
floatSub(s::SubString{String})=parse(Float64,s)
intLine()=map(intSub,split(input()))
function main()
    N,T=intLine()
    a=10^9
    for i=1:N
        c,t=intLine()
        if t<=T;a=min(a,c);end
    end
    println(a<10^9 ? a : "TLE")
end
main()

Measured memory_bytes: 118404
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define all(v) v.begin(), v.end()
#define P pair<int, int>
const ll  MOD = 1000000007;

int main() {
	ll a, p;
	cin >> a >> p;
	cout << (3 * a + p) / 2;
	return 0;
}

Measured memory_bytes: 256
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


x,y,z,K = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ab = [(a[i]+b[j]) for i in range(x) for j in range(y)]
ab.sort(reverse=True)
c.sort(reverse=True)
abk = ab[:K]
ck = c[:K]
l = [(abk[i]+ck[j]) for i in range(min(len(abk),K)) for j in range(min(len(ck),K))]
l.sort(reverse=True)
write("\n".join(map(str, l[:K])))

Measured memory_bytes: 216232
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int x[] = new int[3];
		int ans = 0;
		
		x[0] = sc.nextInt();
		x[1] = sc.nextInt();
		x[2] = sc.nextInt();
		
		Arrays.sort(x);
 		
		ans = Integer.parseInt(String.valueOf(x[2])+String.valueOf(x[1])) + x[0];
		System.out.println(ans);			
		
		
		// 入力
		/*
		String S = sc.next();                
		String T = sc.next();                
		
		for (int i = 0; i < S.length(); i++) {
			if (!S.substring(i,i+1).equals(T.substring(i,i+1))) {
				if (S.indexOf(T.substring(i,i+1)) == -1) {
					S = S.replace(S.substring(i,i+1), T.substring(i,i+1));
				} else {
					String s = S.substring(0, S.length());
					StringBuilder sb = new StringBuilder("");
					for (int j = 0; j < s.length(); j++) {
						if (s.substring(j, j+1).equals(S.substring(i, i+1))) {
							sb.append(T.substring(i, i+1));
						} else if (s.substring(j, j+1).equals(T.substring(i, i+1))) {
							sb.append(S.substring(i, i+1));							
						} else {
							sb.append(s.substring(j, j+1)); 
						}
					}
					S = sb.toString();
				}
			}
		}
		if(S.equals(T)){
			System.out.println("Yes");			
		} else {
			System.out.println("No");			
		}
	*/
	}	
}


Measured memory_bytes: 21844
#include <stdio.h>

int main(void) {
    int n, count = 1;
    scanf("%d", &n);
    char s[n+1], t;
    scanf("%s", s);
    t = s[0];
    for(int i = 0; i < n; i++) {
        if(t != s[i]) {
            t = s[i];
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
ll N,M;
ll A[500010], B[500010];
ll v[710][710] = {};
vector<ll> tree[710];
bool is_visit[710] = {};
ll color[710] = {};

ll c0 = 0, c1 = 0;
bool is_odd = false;
void dfs(ll cur, ll d){
    if(color[cur] != -1 && d != color[cur]){
        is_odd = true;
        return;
    }
    if(is_visit[cur] == 1) return;
    color[cur] = d;
    is_visit[cur] = 1;
    if(d == 0){
        c0++;
    }else{
        c1++;
    }
    for(auto &e: tree[cur]){
        // if(is_visit[e] == 1) continue;
        if(d == 0){
            dfs(e, 1);
        }else{
            dfs(e, 0);
        }

    }


}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    rep(i,0,M){
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
        v[A[i]][B[i]] = 1;
        v[B[i]][A[i]] = 1;
    }
    ll cnt = 0;
    rep(i,0,N){
        rep(j,0,N){
            if(i != j && v[i][j] == 0){
                tree[i].push_back(j);
                cnt++;
            }
        }
    }
    // print(cnt);
    memset(color, -1, sizeof(color));
    vector<lpair> nibu;
    rep(i,0,N){
        if(is_visit[i] == 1) continue;
        // is_visit[i] = 1;
        c0 = 0, c1 = 0;
        is_odd = false;
        dfs(i, 0);
        // print(is_odd);
        if(is_odd){
            print(-1);
            return 0;
        }
        nibu.push_back(make_pair(c0,c1));
    }
    // printa(color, N);
    ll nn = nibu.size();
    // print(nn);
    // for(auto &e: nibu){
    //     print2(e.first, e.second);
    // }
    ll is_ok[710][710] = {};
    is_ok[0][0] = 1;
    rep(i,0,nn){
        rep(j,0,710){
            if(is_ok[i][j]){
                is_ok[i+1][j+nibu[i].first] = 1;
                is_ok[i+1][j+nibu[i].second] = 1;
            }

        }
    }
    ll ans = INF;
    rep(i,0,710){
        if(is_ok[nn][i] == 1){
            ans = min(ans, i*(i-1)/2 + (N-i) * (N-i-1) / 2);
        }
    }
    print(ans);





    
}

Measured memory_bytes: 15104
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author teiwa
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int result = (N - 2) * 180;
            out.println(result);
        }

    }
}



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

template <class T> struct Matrix {
  vector<vector<T>> value;
  T init;

  Matrix(vector<vector<T>> vec,T init_) :init(init_), value(vec) {}
  Matrix(int h, int w, T init_) : init(init_) , value(h, vector<T>(w,init_)) {}

  Matrix<T> operator*(Matrix<T>& left) {
      Matrix<T> res(value.size(),left[0].size(),init);
      for(int i = 0;i < value.size();i++){
          for(int k = 0;k < left.size();k++){
              for(int j = 0;j < left[0].size();j++){
                  res[i][j] = (res[i][j] + value[i][k] * left[k][j]);
              }
          }
      }
      return res;
  }

  vector<T>& operator[](int n){
      return value[n];
  }

  size_t size(){
      return value.size();
  }

  Matrix<T> operator^(long long n){
      Matrix<T> a = *this;
      Matrix<T> res(a.size(),a.size(),init);
      for(int i = 0;i < a.size();i++){
          res[i][i] = 1;
      }

      while(n > 0){
          if(n & 1) res = res * a;
          a = a * a;
          n >>= 1;
      }
      return res;
  }
};



int main(){
    int n;
    cin >> n;
    Matrix<int> a({{1,1},{1,0}},0);
    cout << (a ^ (n + 1))[1][0] << endl;
}



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

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

    long long sum = 0;
    long long count = 0;
    long long tmp = 0;
    
    REP(i,n){
        if(i%2==0){
            sum += a[i];
            if(sum<=0){
                count += abs(sum)+1;
                sum += abs(sum)+1;
            }
            
        }
        if(i%2==1){
            sum += a[i];
            if(sum>=0){
                count += abs(sum)+1;
                sum -= abs(sum)+1;
            }
        }
        // cout << a[i] << ' ';
    }
    // cout << endl;
    long long count2 = 0;
    sum = 0;
    REP(i,n){
        if(i%2==1){
            sum += a[i];
            if(sum<=0){
                count2 += abs(sum)+1;
                sum += abs(sum)+1;
            }
            
        }
        if(i%2==0){
            sum += a[i];
            if(sum>=0){
                count2 += abs(sum)+1;
                sum -= abs(sum)+1;
            }
        }
        // cout << a[i] << ' ';
    }

    // cout << count << endl;
    cout << min(count,count2) << endl;

}

Measured memory_bytes: 640