akhauriyash/Code-Regression huggingface dataset:
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("-Ofast","-funroll-all-loops","-ffast-math")
//~ #pragma GCC target ("avx2")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <random>
#include <cmath>
#include <chrono>
#include <cstring>
#include <string>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
using LL = long long;
#define eps 1e-8
#define fi first
#define se second
#define eb emplace_back
#define SZ(a) int(a.size())
#define ALL(x) (x).begin(),(x).end()
#define trav(a,x) for (auto& a: x)
#define LOG(FMT...) fprintf(stderr, FMT)
#define close std::ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define FOR(i, x, y) for (LL i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (LL i = (x), _##i = (y); i > _##i; --i)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define CASET int ___T; cin>>___T; for(int __CS=1;__CS<=___T;__CS++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
mt19937 dlsrand(random_device{}());
mt19937 mrand(std::chrono::system_clock::now().time_since_epoch().count()); 
int rnd(int x) { return mrand() % x;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
LL bin(LL x, LL n, LL MOD) {LL ret = MOD != 1;for (x %= MOD; n; n >>= 1, x = x * x % MOD)if (n & 1) ret = ret * x % MOD;return ret;}
const double PI = acos(-1.0);
constexpr int maxn = 1e6+10;
constexpr int INF = 0x3f3f3f3f;
constexpr int mod = 1e9+7;
constexpr int Erica = 998244353;
constexpr ll linf = 0x3f3f3f3f3f3f3f3f;
constexpr ull base=2333, P_1=19260811, P_2=999998639;
inline LL get_inv(LL x, LL p) { return bin(x, p - 2, p); }
template<class T>inline void umin(T &x, T y) {x = x > y ? y : x;}
template<class T>inline void umax(T &x, T y) {x = x < y ? y : x;}
template<class T>inline void dec(T &x, T y) {x -= y; if(x < 0) x += mod;}
template<class T>inline void add(T &x, T y) {x += y; if(x >= mod) x -= mod;}
int x[10], t;
int main()
{
    for(int i = 1; i <= 5; i++){
        cin >> t;
        x[t] = 1;
    }
    for(int i = 0; i <= 5; i++){
        if(x[i] == 0) {
            cout << i << endl;
            return 0;
        }
    }
    
}

Measured memory_bytes: 3160
#include <stdio.h>
int main(void){
	int H,N,A,i,total=0;
	
	scanf("%d %d",&H,&N);
	
	for(i=0;i<N;i++){
		scanf("%d",&A);
		total += A;
	}
 
	if(H<=total){
		printf("Yes");
	}else{
		printf("No");
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
#define ll long long
#define cpp boost::multiprecision::cpp_int
#define dequeue deque
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
const double PI = 3.1415926535897932384626433832795;
struct edge {
	int to;
	ll cost;
};
void reverse(string* s) {
	reverse((*s).begin(), (*s).end());
}
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
void COME_LET_THE_GAMES_BEGIN() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
}
int main() {
	COME_LET_THE_GAMES_BEGIN();
	string a;
	cin >> a;
	rep(i, 4) {
		a[i] -= '0';
	}
	for (int i = 0; i < (1 << 3); i++) {
		int x = a[0];
		string s = "";
		rep(j, 3) {
			if (i & (1 << j)) {
				x += a[j + 1];
				s += "+";
			}
			else {
				x -= a[j + 1];
				s += "-";
			}
		}
		if (x == 7) {
			s += "=";
			rep(j, 4) {
				cout << (char)('0' + a[j]) << s[j];
			}
			cout << 7 << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s, t, u;
  cin >> s >> t >> u;

  s = s[0] + ('A' - 'a');
  t = t[0] + ('A' - 'a');
  u = u[0] + ('A' - 'a');

  cout << s << t << u << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int n, m, i, j;
    cin >> n >> m;
    int h[n + 1], status[n + 1];
    for (int i = 1; i <= n; i++)
    {
        cin >> h[i];
        status[i] = -1;
    }
    while (m--)
    {
        cin >> i >> j;
        if (h[i] > h[j])
        {
            if (status[i] == -1 || status[i] == 1)
                status[i] = 1;
            if (status[j] == -1 || status[j] == 1)
                status[j] = 0;
        }
        else if (h[i] == h[j])
        {
            if (status[i] == -1 || status[i] == 1)
                status[i] = 0;
            if (status[j] == -1 || status[j] == 1)
                status[j] = 0;
        }
        else
        {
            if (status[i] == -1 || status[i] == 1)
                status[i] = 0;
            if (status[j] == -1 || status[j] == 1)
                status[j] = 1;
        }
    }
    int count = 0;
    for (int i = 1; i <= n; i++)
    {
        if (status[i] == 1 || status[i] == -1)
            count++;
    }
    cout
        << count << endl;
    return 0;
}

Measured memory_bytes: 4372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> ii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef vector <ii> vii;
typedef vector <vii> vvii;
#define endl '\n'
#define PB push_back
#define MP make_pair
#define fr first
#define sc second
#define OO (1000000000)         // ToDo
#define EPS (1e-9)              // ToDo
#define MOD (1000000007)        // ToDo
#define all(v) ((v).begin()),((v).end())
#define WT(x) cout<< #x <<" = "<<"\""<< (x) <<"\""<<endl
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
void read_file(bool outToFile = true){
#ifdef LOCAL_TEST
    freopen("in", "rt", stdin);
    if(outToFile)
    freopen("out", "wt", stdout);
#endif
}
//
ll K;
//
int main()
{
    read_file();
    while(scanf("%lld", &K) != -1)
    {
        ll n = 50;
        ll q = K/n;
        ll r = K%n;
        ll a = q + n - 1;
        
        printf("%lld\n", n);
        for(int i=0; i<r; i++)
            printf("%lld ", a + n - r + 1);
        for(int i=0; i<n-r; i++)
            printf("%lld ", a - r);
printf("\n");
    }
}


Measured memory_bytes: 256
N = int(input())
S = list(input())

##アルファベットリスト
al=[chr(ord('A') + i) for i in range(26)]

out=[]
for i in range(len(S)):
    num = al.index(S[i])
    if num>=26-N:
        num=num-26
    out.append(al[num+N])

out=''.join(out)

print(out)


Measured memory_bytes: 39280
/**
 * Title:
 * Url:
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
    int n; cin >> n;
    if(n%2==0) {
        cout << n/2 << endl;
    } else {
        cout << n/2+1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#import sys
#input=sys.stdin.buffer.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
S,T = input().split()
A,B = map(int,input().split())
U = input()
if S == U:
    print(A-1,B)
else:
    print(A,B-1)

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

int main() {
    string s;
    cin >> s;
    int ca,cb;
    for(int i=0;i<3;i++){
        char ch = s[i];
        if(ch=='A'){
            ca++;
        }
    }
    if(ca>0&&ca<=2){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 100010;
multiset<int> lp,rp;
multiset<int>::iterator t1,t2;
int n,l[N],r[N],v,lt,rt,p,cur;
signed main() {
  scanf("%lld",&n);
  for (int i = 1 ; i <= n ; ++ i)
    scanf("%lld%lld",&l[i],&r[i]);
  lp.clear(), rp.clear();
  lp.insert(l[1]), rp.insert(l[1]);
  for (int i = 2 ; i <= n ; ++ i) {
    t1 = lp.end(), -- t1;
    t2 = rp.begin();
    lt -= r[i] - l[i];
    rt += r[i-1] - l[i-1];
    p = l[i];
    if (p < *t1 + lt)
      v += *t1 + lt - p, rp.insert(*t1 + lt - rt), lp.erase(t1), lp.insert(p - lt), lp.insert(p - lt);
    else if (p > *t2 + rt)
      v += p - *t2 - rt, lp.insert(*t2 + rt - lt), rp.erase(t2), rp.insert(p - rt), rp.insert(p - rt);
    else lp.insert(p - lt), rp.insert(p - rt);
  }
  printf("%lld\n",v);
  return 0;
}

Measured memory_bytes: 11136
import fractions
def lcm(a,b):
    return a * b // fractions.gcd(a, b)

a,b,c,d=map(int,input().split())
ans=0
ans += b- (b//c + b//d - b//lcm(c,d))
a-=1
ans -= a- (a//c + a//d - a//lcm(c,d))
print(ans)



Measured memory_bytes: 5048
N, K = map(int, input().split())
A = [int(a) for a in input().split()]

cnt = 0
cnt2 = 0
for i, a1 in enumerate(A):
    for j, a2 in enumerate(A):
        if a2 < a1:
            cnt += 1
            if j > i:
                cnt2 += 1

ans = cnt2 * K + (K * (K - 1)) // 2 * cnt
print(ans % ((10 ** 9) + 7))

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

int main()
{
    int n, x, br = 3;
    cin >> n >> x;
    if (x == 1 || x == n * 2 - 1)
    {
        cout << "No";
        return 0;
    }
    cout << "Yes" << endl;
    for (int i = 0; i < n * 2 - 1; i++)
    {
        if (i == (n * 2 - 1) / 2 - 1)
        {
            cout << n * 2 - 1 << endl;
        }
        else if (i == (n * 2 - 1) / 2 - 2 && x != 2)
        {
            cout << 2 << endl;
        }
        else if (i == (n * 2 - 1) / 2)
        {
            cout << x << endl;
        }
        else if (i == (n * 2 - 1) / 2 + 1)
        {
            cout << 1 << endl;
        }
        else
        {
            if (br == x) br++;
            cout << br << endl;
            br++;
        }
    }
    return 0;
}


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

int main()
{
	int a, b, c, d, x, y, i;
	cin>>a>>b>>c>>d;
	x=c-a;
	y=d-b;
	for(i=0; i<y; i++)
	{
		cout<<'U';
	}
	for(i=0; i<x; i++)
	{
		cout<<'R';
	}
	for(i=0; i<y; i++)
	{
		cout<<'D';
	}
	for(i=0; i<x; i++)
	{
		cout<<'L';
	}
	//end of loop 1//
	
	cout<<'L';
	
	for(i=0; i<y+1; i++)
	{
		cout<<'U';
	}
	for(i=0; i<x+1; i++)
	{
		cout<<'R';
	}
	
	cout<<'D'<<'R';
	
	for(i=0; i<y+1; i++)
	{
		cout<<'D';
	}
	for(i=0; i<x+1; i++)
	{
		cout<<'L';
	}
	cout<<'U';
	
	return 0;
}

Measured memory_bytes: 256
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();

        final List<Integer> tmp = IntStream.rangeClosed(1, n)
                .boxed()
                .collect(Collectors.toList());

        int index = 1;
        for (int i = 0; i < n; i++) {
            final int p = scanner.nextInt();
            final int pIndex = tmp.indexOf(p);
            if (pIndex != i) {
                index += kaizyou(n - i) * (pIndex - i);
            }
            tmp.remove(pIndex);
        }

        final List<Integer> hoge = IntStream.rangeClosed(1, n)
                .boxed()
                .collect(Collectors.toList());

        int fuga = 1;
        for (int i = 0; i < n; i++) {
            final int p = scanner.nextInt();
            final int pIndex = hoge.indexOf(p);
            if (pIndex != i) {
                fuga += kaizyou(n - i) * (pIndex - i);
            }
            hoge.remove(pIndex);
        }

        System.out.println(Math.abs(fuga - index));
    }

    private static int kaizyou(final int i) {
        int result = 1;
        for (int j = 2; j < i; j++) {
            result *= j;
        }

        return result;
    }
}


Measured memory_bytes: 28500
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
#define ff first
#define ss second
#define pb push_back
#define pii pair<int,int>
 
ll const lim = 3e5;
ll const mod = 1e9+7;

ll n, m, t, ans, mxw, mxh;
ll fql[lim+5], fqr[lim+5];

void solve() {
	cin >> n >> m >> t ;
	vector < pair<ll, ll> > arr ;
	map < pair<ll, ll> ,ll> mp ;
	for(int i=1;i<=t;i++) {
		ll w, h ; cin >> w >> h ;
		arr.pb({w, h}) ;
		fql[w] += 1;
		fqr[h] += 1;
		mxw = max(mxw, fql[w]) ;
		mxh = max(mxh, fqr[h]) ;
		mp[{w, h}] = 1;
	}

	ans = mxw + mxh ;
	vector <ll> row, col ;
	for(int i=0;i<=n;i++) if(fql[i] == mxw) row.pb(i) ;
	for(int i=0;i<=m;i++) if(fqr[i] == mxh) col.pb(i) ;

	bool flag = true ;
 	for(auto x : row) {
 		for(auto y : col) {
 			if(!mp.count({x,y})) {
 				flag = false;
 				break;
 			}
 		}
 		if(!flag) break;
 	}
 	if(flag) ans -= 1;
	cout<<ans<<endl;
}
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
 
    int t = 1, no = 0;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 40084
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD =   1000000007;

/// Lib
///
int main(){
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int n; cin >> n;
    vector<int> a(n+1);
    vector<int> b(n);
    ll ans = 0;
    for(int i = 0; i < n + 1; ++i){
        cin >> a[i];
        ans += a[i];
    }
    for(int i = 0; i < n; ++i){
        cin >> b[i];
    }

    for(int i = 0; i < n; ++i){
        if(a[i] < b[i]){
            ll res = b[i] - a[i];
            a[i] = 0;
            if(res > a[i+1]){
                a[i+1] = 0;
            }
            else{
                a[i+1] -= res;
            }
        }
        else{
            a[i] -= b[i];
        }
    }
    for(int i = 0; i < n + 1; ++i){
        ans -= a[i];
    }

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


Measured memory_bytes: 1024
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

constexpr int MAX_N = 1010;
constexpr double INF=  1e12;

using P = std::pair<double, int>;

int xs, ys, xt, yt;
int N;
int x[MAX_N], y[MAX_N], r[MAX_N];
double cost[MAX_N][MAX_N];
std::priority_queue<P, std::vector<P>, std::greater<P> > pque;
double d[MAX_N];

double sqr( double x )
{ return x*x; }

int main()
{
  scanf( "%d%d%d%d%d", &xs, &ys, &xt, &yt, &N );
  rep( i, N )
    scanf( "%d%d%d", x+i+1, y+i+1, r+i+1 );

  ++N;

  x[0] = xs;
  y[0] = ys;
  x[N] = xt;
  y[N] = yt;

  ++N;

  rep( i, N ) rep( j, i )
    cost[i][j] = cost[j][i] = std::max<double>( 0, sqrt( sqr(x[j]-x[i])+sqr(y[j]-y[i]) )-r[i]-r[j] );
  
  std::fill( d, d+N, INF );

  pque.push( P( 0, 0 ) );
  d[0] = 0;

  while( !pque.empty() )
  {
    P p = pque.top();
    pque.pop();

    int v = p.second;
    double dist = p.first;

    if( d[v] < dist )
      continue;

    rep( i, N ) if( i != v )
    {
      if( d[i] > d[v]+cost[v][i] )
      {
        d[i] = d[v]+cost[v][i];
        pque.push( P( d[i], i ) );
      }
    }
  }

  printf( "%.10f\n", d[N-1] );

  return 0;
}

Measured memory_bytes: 13680
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	
	priority_queue<int> qa, qb, qc;
	priority_queue<int,vector<int>,greater<int>> temp;
	
	
	for(int i = 0; i < a; i++){
		int x;
		cin >> x;
		qa.push(x);
	}
	
	for(int i = 0; i < b; i++){
		int x;
		cin >> x;
		qb.push(x);
	}
	for(int i = 0; i < c; i++){
		int x;
		cin >> x;
		temp.push(x);
	}
	
		
	
	while((int)qa.size() < x && temp.size()){
		int p = temp.top();
		temp.pop();
		qa.push(p);
	}
	
	while((int)qb.size() < y && temp.size()){
		int p = temp.top();
		temp.pop();
		qb.push(p);
	}
	
	while(temp.size()){
		int p = temp.top();
		temp.pop();
		qc.push(p);
	}
	
	
	priority_queue<int,vector<int>,greater<int>> ra, rb;
	while(!qa.empty()){
		int p = qa.top();
		ra.push(p);
		qa.pop();
	}
	while(!qb.empty()){
		int p = qb.top();
		rb.push(p);
		qb.pop();
	}
	
	while((int)ra.size() > x)
		ra.pop();
	while((int)rb.size() > y)
		rb.pop();
	
	
	int ans = 0;
	
	while(qc.size()){
		int aa = ra.top();
		int bb = rb.top();
		int mini = min(aa,bb);
		int cc = qc.top();
		qc.pop();
		
		if(cc < mini)
			break;
		
		if(aa < bb){
			ra.pop();
			ra.push(cc);
		}
		else{
			rb.pop();
			rb.push(cc);
		}
	}
	
	while(qa.size())
		qa.pop();
	
	while(qb.size())
		qb.pop();
	
	
	while(ra.size()){
		int p = ra.top();
		qa.push(p);
		ra.pop();
	}
	
	while(rb.size()){
		int p = rb.top();
		qb.push(p);
		rb.pop();
	}
	
	ans = 0;
	int cnt = 0;
	
	while(qa.size() && cnt < x){
		ans += qa.top();
		qa.pop();
		cnt++;
	}
	cnt = 0;
	while(qb.size() && cnt < y){
		ans += qb.top();
		qb.pop();
		cnt++;
	}
	
	cout << ans << endl;
	
	
	
	

	return 0;
}



Measured memory_bytes: 5748
#include<stdio.h>
long long int b[10000000];
int main()
{
    long long int m,n,T,i,j,sum=0,x,k,cnt=0;
    scanf("%lld %lld",&m,&n);
    for(i=0; i<m; i++)
    {
        scanf("%lld",&T);
        long long int a[T+5],c[T+5];
        for(j=0; j<T; j++)
        {
            scanf("%lld",&a[j]);
            if(a[j]>n)
                scanf("%lld",&a[j]);
        }
        for(j=0; j<T; j++)
        {
            x=1;
            for(k=j+1; k<T; k++)
            {
                if(a[j]==a[k])
                {
                    x++;
                    a[j]=-1;
                }
            }
            if(a[j]!=-1)
            {
                b[a[j]]+=x;
                if(b[a[j]]==m)
                {
                    cnt++;
                }
            }
        }
    }
    printf("%lld\n",cnt);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
int T, X, Y;

void solve() {
	cin >> N;
	T = 0; X = 0; Y = 0;
	while(N--) {
		int t, x, y; cin >> t >> x >> y;
		int d = abs(x - X) + abs(y - Y);
		if(t - T < d || (t - T) % 2 != d % 2) {
			cout << "No\n"; return;
		}
	}
	cout << "Yes\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 256
from collections import defaultdict

N = int(input())
S = input()

dd = defaultdict(int)
rList = [0]
gList = [0]
bList = [0]
for i in range(N):
    if S[i] == "R":
        rList.append(rList[-1] + 1)
        gList.append(gList[-1])
        bList.append(bList[-1])
    elif S[i] == "G":
        rList.append(rList[-1])
        gList.append(gList[-1] + 1)
        bList.append(bList[-1])
    else:
        rList.append(rList[-1])
        gList.append(gList[-1])
        bList.append(bList[-1] + 1)

ans = 0
for i in range(N):
    for j in range(i, N):
        if S[i] == S[j]:
            continue
        tl = ["R", "G", "B"]
        tl.remove(S[i])
        tl.remove(S[j])
        target = tl[0]
        if target == "R":
            ans += rList[-1] - rList[j + 1]
        elif target == "G":
            ans += gList[-1] - gList[j + 1]
        else:
            ans += bList[-1] - bList[j + 1]

        diff = abs(i - j)
        if j + diff <= N - 1 and S[j + diff] == target:
            ans -= 1

print(ans)


Measured memory_bytes: 69092
#include<bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    int num[32] = {
        1, 1, 1, 2, 1, 2,
        1, 5, 2, 2, 1, 5,
        1, 2, 1, 14, 1, 5,
        1, 5, 2, 2, 1, 15,
        2, 2, 5, 4, 1, 4,
        1, 51};
    int K;
    cin>>K;
    cout<<num[K-1]<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    ll k;
    cin >> k;
    int n = s.size();
    s += "#";
    vector<ll> len, C;
    {
        int l = 1;
        REP(i, 0, n) {
            if (s[i] != s[i + 1]) {
                len.push_back(l);
                C.push_back(s[i]);
                l = 0;
            }
            l++;
        }
    }
    if (k == 1) {
        ll ans = 0;
        REP(i, 0, len.size()) {
            ans += len[i] / 2;
        }
        cout << ans << endl;
    } else {
        if (len.size() == 1) {
            ll ans = len[0] * k / 2;
            cout << ans << endl;
        } else {
            if (C[0] == C.back()) {
                ll tmp = len[0] + len.back();
                ll ans = 0;
                REP(i, 1, len.size() - 1) {
                    ans += len[i] / 2;
                }
                cout << len[0] / 2 + len.back() / 2 + ans * k + tmp / 2 * (k - 1) << endl;
            } else {
                ll ans = 0;
                REP(i, 0, len.size()) {
                    ans += len[i] / 2;
                }
                cout << ans * k << endl;
            }
        }
    }

    return 0;
}


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



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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



int main(void){

	int a, b, c; cin >> a >> b >> c;

	bool ans = false;
	if(a+b == c) ans = true;
	else if(b+c == a) ans = true;
	else if(a+c == b) ans = true;

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

	return 0;

}


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

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

  int R; cin >> R;
  if (R < 1200) cout << "ABC\n";
  else if (R < 2800) cout << "ARC\n";
  else cout << "AGC\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define FOR(i,a,b) for(ll i=a; i<= b; ++i)
#define all(v) (v).begin(), (v).end()
#define ff first
#define ss second
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define vi vector<int>
#define pb push_back
#define MOD 1000000007
typedef long long ll;


int main(){
    optimize();
    ll T=1;
    //cin>>T;
    while(T--)
    {
        ll ans = 0;
        FOR(i,0,4)
        {
            int x;
            cin>>x;
            if(x==0)
            {
                ans = i+1;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define MOD 1000000007
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LLI long long int
#define LI long int 
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//               When something is important enough, you do it even if the odds are not in your favor.
LLI cost[100004];
int main(){   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      LI n,i,j,k;cin>>n>>k;
      LI arr[n];fo(i,0,n) cin>>arr[i];
      //cost[n-2]=abs(arr[n-1]-arr[n-2]);
      rfo(i,n-2,-1){
        LLI mn=INT_MAX;
        fo(j,1,k+1){
          if(i+j>n-1) break;
          mn=min(mn,abs(arr[i]-arr[i+j])+cost[i+j]);
        }
        cost[i]=mn;
      }
      cout<<cost[0];
    }
    return 0;
}

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

#define select(_1, _2, x, ...) x

#define repn(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (int i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define rrep(i, ...) select(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define umax(m, x) (m = max(m, x));
#define umin(m, x) (m = min(m, x));

#define rng(v) v.begin(), v.end()
#define rrng(v) v.rbegin(), v.rend()

#define debug(x) cerr << #x << " = " << x << endl

using namespace std;

using ll = long long int;

using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;

using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;

const int INF = 1e9;
const ll LINF = 1e18;

inline void yn(bool f) { cout << (f ? "Yes" : "No") << endl; }


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

    vi sn(n, 0);
    rep(i, k) {
        int d;
        cin >> d;
        rep(j, d)  {
            int a;
            cin >> a;
            sn[a - 1]++;
        }
    }

    int ans = 0;
    rep(i, n) {
        if (sn[i] == 0)
            ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3628
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    private static int N;
    private static Edge[] E;
    private static int K;
    private static Query[] Q;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        E = new Edge[N-1];
        for (int i = 0; i < N-1; i++) {
            E[i] = new Edge(sc.nextInt(), sc.nextInt(), sc.nextInt());
        }
        int q = sc.nextInt();
        K = sc.nextInt();
        Q = new Query[q];
        for (int i = 0; i < q; i++) {
            Q[i] = new Query(sc.nextInt(), sc.nextInt());
        }

        for (long ans : solve()) {
            System.out.println( ans );
        }
    }

    private static long[] solve() {
        List[] nodeEdges = new List[N+1];
        for (int i = 0; i < N+1; i++) {
            nodeEdges[i] = new ArrayList();
        }

        for (Edge edge : E) {
            nodeEdges[edge.a].add( edge );
            nodeEdges[edge.b].add( edge );
        }

        long[] fromK = caclFromK(nodeEdges);

        long[] ans = new long[Q.length];
        for (int i = 0; i < Q.length; i++) {
            Query q = Q[i];
            ans[i] = fromK[q.x] + fromK[q.y];
        }
        return ans;
    }

    private static long[] caclFromK(List[] nodeEdges) {
        long[] fromK = new long[N+1];
        boolean[] done = new boolean[N+1];
        dfs(K, 0, fromK, done, nodeEdges);
        return fromK;
    }

    private static void dfs(int node, long cost, long[] fromK, boolean[] done, List[] nodeEdges) {
        fromK[node] = cost;
        done[node] = true;
        for (Object o : nodeEdges[node]) {
            Edge edge = (Edge) o;
            int next = edge.next(node);
            if( !done[next] ) {
                dfs(next, cost + edge.c, fromK, done, nodeEdges);
            }
        }
    }

    private static class Edge {
        private final int a;
        private final int b;
        private final int c;

        public Edge(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        public int next(int from) {
            if(from == a ) return b;
            else if( from == b ) return a;
            else throw new IllegalArgumentException("wtf");
        }
    }

    private static class Query {
        private final int x;
        private final int y;

        public Query(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
}

Measured memory_bytes: 174796
s=list(input())
n=len(s)


now=s[0]
cnt=0
for i in range(1,n):
    if s[i]==now:
        cnt+=1
        if s[i]=='0':
            s[i]='1'
            now='1'
        else:
            s[i]='0'
            now='0'
    else:
        now=s[i]

print(cnt)



Measured memory_bytes: 3956
#include<stdio.h>
int main(void) {
	int x, y, z,i,ans = 0;
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	scanf("%d%d", &x, &y);
		printf("%d ", x / y);
		printf("%d ", x%y);
		printf("%f\n",(double)x / y);
	
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

int gcd(int a, int b){return (a % b)? gcd(b, a % b) : b;}
int lcm(int a, int b){return a * b / gcd(a, b);}

void solve_A(){
    int s, w;
    cin >> s >> w;

    cout << (w<s? "safe":"unsafe") << endl;
}

int main(void){
    solve_A();
    
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define pi 3.141592653589793
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
#define fast ios_base::sync_with_stdio(0)
#define sz size()
#define cu cout<<
#define en endl
#define sp " "
#include<cstdio>
#include<cstring>
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
const int inf = (int)1e9 + 5;
const ll linf = (ll)1e16 + 5;
const ll modd = (ll)1e9 + 7;
const int mod = 10000007;
/*#define N 20000009
bool prime[N];
vector<ll> prm;
void seive ()
{

    memset(prime, true, sizeof(prime));

    for( ll i=2; i*i<=N; i++)
    {
        if (prime[i] == true)
        {
            prm.pb(i);
            for (ll j=i*i; j<=N; j += i)
                pe[j] = false;
        }
    }
}*/
void pr (int f)
{
    if(f==1)
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
/*bool isprime(ll n)
{
    if(n<2) return 0;
    if(n==2) return 1;
    else
    {
        for(int i=2; i*i<=n; i++)
            if(n%i==0) return 0;
    }
    return 1;
}*/
map<int , int >mp;
set<int  > st;
multiset<string> :: iterator it;
deque <char> q ;
int vis [10000000];
pair<int,int> a[2020];
int cnt[2];
int main()
{
    fast ;
    ll a,b;
  cin >> a >>b;
  cout << (a*b)<<endl;
    return 0;
}




Measured memory_bytes: 3644
s = input()
for i in range(1, len(s)):
    if s[i] == s[i - 1]:
        print(i, i + 1)
        exit()
    if i > 1 and s[i] == s[i - 2]:
        print(i - 1, i + 1)
        exit()
print(-1, -1)


Measured memory_bytes: 70028
#include <stdio.h>

int main()
{
    int input[3000][2];
    int input_save;
    
    for (int i = 0; i < 3000; i++){

        scanf("%d %d", &input[i][0], &input[i][1]);

        if ((input[i][0] == 0) && (input[i][1] == 0)) {
            break;
        }
        else {
            /* NOP */
        }

    }

    for (int j = 0; j < 3000; j++) {
        if ((input[j][0] == 0) && (input[j][1] == 0)) {
            break;
        }
        else if(input[j][0] > input [j][1]) {
            input_save = input[j][0];
            input[j][0] = input[j][1];
            input[j][1] = input_save;
        }
        else {
            /* NOP */
        }

        printf("%d %d\n", input[j][0], input[j][1]);
        
    }
}


Measured memory_bytes: 2088
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    X, K, D = map(int, input().split())

    d, m = divmod(X, D)
    if abs(d) >= K:
        print(abs(abs(X) - (K * D)))
    else:
        if (K - d) % 2:
            print(D - m)
        else:
            print(m)


main()


Measured memory_bytes: 8968
import sys
import math
import itertools
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]
#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)

b = ns()

if b =='A':
    print('T')
elif b == 'T':
    print('A')
elif b =='G':
    print('C')
else:
    print('G')

Measured memory_bytes: 3064
def isPalindrome(string):
  m = len(string)//2
  judge = True
  for i in range (m):
    if string[i] != string[len(string) - i - 1]:
      judge = False
      break
  return judge

s = input()
n = len(s)
former = (n-1)//2
latter = (n+3)//2-1
t = s[:former]
u = s[latter:]

if isPalindrome(s) and isPalindrome(t) and isPalindrome(u):
  print("Yes")
else:
  print("No")



Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct number{
	int n;
	struct number *up;
	struct number *down;
};

int insert(struct number**,struct number*);

int main(){
	char *q;
	char *buf = (char *)malloc(sizeof(char)*2200000);
	int N,temp,flag=1;
	fgets(buf,10,stdin);
	q = strtok(buf," ");
	N = atoi(q);
	fgets(buf,11*N,stdin);
	struct number *top = NULL;
	for(int i=0;i<N;i++){
		struct number *data = (struct number *)malloc(sizeof(struct number));
		if( i==0 ){
			q = strtok(buf," ");
		}else{
			q = strtok(NULL," ");
		}
		data->n = atoi(q);
		data->up = NULL;
		data->down = NULL;
		flag = insert(&top,data);
		if( flag==0 ) break;
	}
	if( flag ) printf("YES");
	else printf("NO");
	return 0;
}

int insert( struct number **top,struct number *data){
	if( *top == NULL ){
		*top = data;
		return 1;
	}
	struct number *t = *top;
	while(1){
		if( (t->n) == (data->n) ){
			return 0;
		}else if( (t->n) > (data->n) ){
			if( t->down == NULL ){
				t->down = data;
				return 1;
			}else{
				t = t->down;
			}
		}else if( (t->n) < (data->n) ){
			if( t->up == NULL ){
				t->up = data;
				return 1;
			}else{
				t = t->up;
			}
		}
	}
	return 0;
}


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

struct node{
  node* right;
  node* left;
  int key,pri;
};

node* rightRotato(node* t) {
    node* s = t->left;
    t->left = s->right;
    s->right = t;
    return s;
}

node* leftRotato(node* t) {
    node* s = t->right;
    t->right = s->left;
    s->left = t;
    return s;
}

node* insert(node* t, int key, int pri) {
    if(t == NULL) {
        node* t = new node;
        t->left=NULL; t->right = NULL;
        t->key = key; t->pri = pri;
        return t;
    }
    if(key == t->key) return t;

    if(key < t->key) {
        t->left = insert(t->left, key, pri);
        if(t->pri < t->left->pri) t = rightRotato(t);
    }
    else {
        t->right = insert(t->right, key, pri);
        if(t->pri < t->right->pri) t = leftRotato(t);
    }
    return t;
}
node* erase(node* t, int key){
    if(t == NULL) return NULL;

    if(key == t->key) {
        if(t->left == NULL && t->right == NULL) return NULL;
        else if(t->left == NULL) t = leftRotato(t);
        else if(t->right == NULL) t = rightRotato(t);
        else {
            if(t->left->pri > t->right->pri) t = rightRotato(t);
            else t = leftRotato(t);
        }
        return erase(t,key);
    }
    if(key < t->key) t->left = erase(t->left, key);
    else t->right = erase(t->right, key);
    return t;
}

void find(node* t, int key) {
    while(t != NULL && key != t->key) {
        if(key < t->key) t = t->left;
        else t = t->right;
    }
    if(t == NULL) cout << "no" << endl;
    else cout << "yes" << endl;
}

void inorder(node* t) {
    if(t==NULL) return;
    inorder(t->left);
    cout << " " << t->key;
    inorder(t->right);
}

void preorder(node* t) {
    if(t == NULL) return;
    cout << " " << t->key;
    preorder(t->left);
    preorder(t->right);
}
int main() {
    node* root=NULL;
    int n,key,pri;
    string s;

    cin >> n;
    for(int i=0; i<n; i++) {
        cin >> s;
        if(s == "insert") {
            cin >> key >> pri;
            root = insert(root, key, pri);
        }
        else if(s == "delete") {
            cin >> key;
            root = erase(root, key);
        }
        else if(s == "find") {
            cin >> key;
            find(root, key);
        }
        else {
            inorder(root);
            cout << endl;
            preorder(root);
            cout << endl;
        }
    }
    return 0;
}



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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i,k,n) for(int i = k; i < n; i++)
//#define sum(start, end) accumulate(start, end, 0)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef string str;

using namespace std;
template <class T = ll> T in() { T _in; cin >> _in; return (_in); }


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

    string s = in<string>();
    s[3] = '8';
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>

using namespace std;

string a;
bool check;

int dfs(int i,int n)
{
	if (i == n && check == false)
	{
		printf("YES\n");
		check = true;
		return 0;
	}

	if (a[i] == 'd')
		{
			if (a[i+1] == 'r' && a[i+2] == 'e' && a[i+3] == 'a' && a[i+4] == 'm')
			{
				if (a[i+5] == 'e'  && a[i+6] == 'r')
				{
					if(dfs(i+7,n) != 1 && check == false)
					{
						dfs(i+5,n);
					}
				}else if(!check)
				{
					dfs(i+5,n);
				}

			}else if(!check)
			{
				printf("NO\n");
				check = true;
				return 1;
			}

		}else if (a[i] == 'e')
		{
			if (a[i+1] == 'r' && a[i+2] == 'a' && a[i+3] == 's' && a[i+4] == 'e')
			{
				if (a[i+5] == 'r' && check == false)
				{
					dfs(i+6,n);
				}else if(!check)
				{
					dfs(i+5,n);
				}
			}else if(!check)
			{
				printf("NO\n");
				check = true;
				return 1;
			}
		}


		return 0;
}


int main()
{

	cin >> a;

	int n = a.size();
	a[n] = 'q';

	check = false;

	dfs(0,n);

	return 0;
}
	

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

long long gcd(long x, long y)
{    if (y == 0)
        return x;
    return gcd(y, x % y);}
long long lcm(long x, long y){ return x * y / gcd(x, y);}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}


int main()
{
    ll N;
    cin>>N;

    for(ll h=1;h<=3500;h++){
        for(ll n=1;n<=3500;n++){

            ll a=N*h*n;
            ll b=4*h*n - N*n - N*h;

            if(b!=0 && a%b==0 && a/b>0){
                cout<<h<<" "<<n<<" "<<a/b<<endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;

bool check(int i, int j, vector<vector<char>> s){
	int H = s.size();
	int W = s[0].size();
	if(i<0 || i>=H || j<0 || j>=W){return false;}
	if(s[i][j] != '#'){return false;}
	else{return true;}
}
void Main()
{
	int H, W;
  	cin >> H >> W;
  	vector<vector<char>> s(H, vector<char>(W));
  	rep(i,H){
    	rep(j,W){
          	cin >> s[i][j];
        }
    }
  	
  	rep(i,H){
    	rep(j,W){
          	if(s[i][j] == '#'){
              	//cout << i << ", " << j << ": ";
                //cout << check(i+1,j,s) << ", " << check(i,j+1,s) << ", " << check(i-1,j,s) << ", " << check(i,j-1,s) << endl;
              	// 1つでもtrueがあればOK
              	if(!check(i+1,j,s) && !check(i,j+1,s) && !check(i-1,j,s) && !check(i,j-1,s)){
                	puts("No");
                  	return;
                }  
            }
        }
    }
  	puts("Yes");
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n, m;
	while(scanf("%d %d", &n, &m))
	 {
	 	bool ok = true, go = false;
	 	if(n == 0 && m == 0)
	 	{
	 		break;
		 }
		 for(int i = 0; i < n; i++)
		 {
		 	if(ok)
		 	{
		 		go = true;
		 		for(int j = 0;j< m;j++)
		 		{
		 			if(go)
		 			{
		 				printf("#");
		 				go = false;
					 }
					 else
					 {
					 	printf(".");
					 	go = true;
					 }
				 }
				 printf("\n");
				 ok = false;
			 }
			 else
			 {
			 	go = true;
			 	for(int j = 0;j<m;j++)
			 	{
			 		if(go)
			 		{
			 			printf(".");
			 			go = false;
					 }
					 else
					 {
					 	printf("#");
					 	go =true;
					 }
				 }
				 printf("\n");
				 ok = true;
			 }
		 }
		 printf("\n");
	 } 
	 return 0;
 } 


Measured memory_bytes: 2696
#include <iostream>

using namespace std;

int main()
{
    int A,B,C;
    cin>> A>>B>>C;
    if(A!=B&&A!=C){
        cout<<A;
    }
    else if(B!=A&& B!=C){
        cout<<B;
    }
    else{
        cout<<C;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = sc.next().toCharArray();
		HashMap<Character, TreeSet<Integer>> map = new HashMap<>();
		for (int i = 0; i < 10; i++) {
		    map.put((char)(i + '0'), new TreeSet<Integer>());
		}
		for (int i = 0; i < arr.length; i++) {
		    map.get(arr[i]).add(i);
		}
		int count = 0;
		for (int i = 0; i < 10; i++) {
		    TreeSet<Integer> setX = map.get((char)(i + '0'));
		    if (setX.size() == 0) {
		        continue;
		    }
		    Integer x = setX.first();
		    for (int j = 0; j < 10; j++) {
		        TreeSet<Integer> setY = map.get((char)(j + '0'));
		        if (setY.size() == 0) {
		            continue;
		        }
		        Integer y = setY.last();
		        if (x >= y) {
		            continue;
		        }
		        for (int k = 0; k < 10; k++) {
		            Integer z = map.get((char)(k + '0')).higher(x);
		            if (z != null && z < y) {
		                count++;
		            }
		        }
		    }
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 25012
<?php

//1行目の空白までのデータをもらって$n1に入れる
fscanf(STDIN, '%d',$n);
//2行目をもらってきて、文字列から空白のスペースを取り除く
$line=trim(fgets(STDIN));
//空白を境目にして、文字列から配列を作る
$line=explode(' ',$line);
//配列の要素を一つずつint型にキャストする
$A=array_map(function ($val) {
  return (int)$val;
},$line);
//昇順に並び替える
sort($A);
//$Aの合計値
$sum=array_sum($A);

//3行目の空白までのデータをもらって$n2に入れる
fscanf(STDIN,'%d',$q);
//探索済みの配列を格納するための変数
//4行目の文字列を配列にして格納
$line=explode(' ',trim(fgets(STDIN)));
$arr=array();
// v($line);
foreach($line as $l) {
  $l = (int)$l;
  //Aの合計値より大きければ不可能
  if($l > $sum) {
    echo "no\n";
    $arr[$l] = false;

    //既に探索済み
  }elseif(isset($arr[$l])) {
    echo $arr[$l] ? "yes\n" : "no\n";

  }else {
    $bool = cal(0,$l);
    $arr[$l]=$bool;
    echo $bool ? "yes\n" : "no\n";
  }
  }

  function cal($i, $l){
    global $n, $A;
    if($l === 0) {
      return true;
    }elseif($i === $n) {
      return false;
    }elseif(cal($i + 1,$l)) {
      return true;
    }elseif(cal($i+1,$l-$A[$i])) {
      return true;
    }
    return false;
  }



Measured memory_bytes: 9408
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<chrono>
#define MAX_N 100
#define MAX_K 100000
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int num=6,sum=0;
int main(){

    int data[num],num_data[num];

    REP(i,num){
        data[i]=100+i;
    }

    REP(i,num){
        num_data[i]=1000000;
    }

    cin>>sum;
    int dp[num+1][sum+1];
    memset(dp,-1,sizeof(dp));

    dp[0][0]=0;

    REP(i,num){
        REP(j,sum+1){
            if(dp[i][j]>=0){                                    //dp[i][j]の時点で存在するのでわざわざさらに追加する必要はないのでnum_da[i]を入れる，つまりi番目の数字は一個も使わないということ
                dp[i+1][j]=num_data[i];
            }else if(j<data[i] || dp[i+1][j-data[i]]<=0){       //j<data[i]は考えればわかる．dp[i+1][j-data[i]]がないってことはdata[i]を加算しても意味がないということ
                dp[i+1][j]=-1;
            }else{
                dp[i+1][j]=dp[i+1][j-data[i]]-1;                //それ以外の場合は要するにi番目の数を入れた場合ということ，だから-1することで残りの個数を減らす
            }
        }
    }

    if(dp[num][sum]>=0){                //dp[num][sum]はnum個までの数字を使って和がsumとなるような時にnum番目の数字が余ってる数が0以上ということは余ってるか余ってないかはさておき作れてるってこと
        cout<<1;
    }else{
        cout<<0;
    }
}

Measured memory_bytes: 2944