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

int main()
{
    string s, t;
    cin >> s;
    cin >> t;
    int size = s.size();
    map<char, vector<int>> s_num;
    map<char, vector<int>> t_num;
    string ans = "Yes";

    for (auto i = 0; i < size; i++)
    {
        s_num[s[i]].push_back(i);
        t_num[t[i]].push_back(i);
    }

    for (auto itr = s_num.begin(); itr != s_num.end(); itr++)
    {
        if (itr->second.size() < 2)
        {
            continue;
        }

        char c = t[itr->second[0]];

        for (auto i = 0; i < itr->second.size(); i++)
        {
            if (c != t[itr->second[i]])
            {
                ans = "No";
            }
        }
    }

    for (auto itr = t_num.begin(); itr != t_num.end(); itr++)
    {
        if (itr->second.size() < 2)
        {
            continue;
        }

        char c = s[itr->second[0]];

        for (auto i = 0; i < itr->second.size(); i++)
        {
            if (c != s[itr->second[i]])
            {
                ans = "No";
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 2824
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

void main(){
    while(true) {
        auto n = readInt();
        if(n == 0) {
            return;
        }
        int[] a;
        foreach(i; iota(n)) {
            a ~= readInt();
        }
        int ans;
        foreach_reverse(i; iota(n)) {
            foreach(j; iota(i)) {
                if(a[j] > a[j+1]) {
                    swap(a[j], a[j+1]);
                    ++ans;
                }
            }
        }
        writeln(ans);
    }
}

Measured memory_bytes: 2440
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll ma=1e6+5;

ll n;

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


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int N, K;
	char S[51];
	scanf("%d %d", &N, &K);
	scanf("%s", S);
	S[K-1] += 'a' - 'A';
	printf("%s\n", S);
	fflush(stdout);
	return 0;
}

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

int main()
{
	int N;
	cin >> N;
	bool ok = true;
	int nt = 0, nx = 0, ny = 0;
	for (int i = 0; i < N; i++) {
		int x, y, t;
		cin >> t >> x >> y;
		if (abs(nx - x) + abs(ny - y) > t - nt || (t - nt - (abs(nx - x) + abs(ny - y))) % 2) {
			ok = false;
		}
		nt = t, nx = x, ny = y;
	}
	cout << (ok ? "Yes" : "No") << endl;
	return 0;
}


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

int dp[5010][5010];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	string s;
	cin >> n >> s;
	for(int i = n-1; i >= 0; i--){
		for(int j = n-1; j >= 0; j--){
			if(s[i] == s[j]) dp[i][j] = dp[i+1][j+1]+1;
		}
	}
	int ans = 0;
	rep(i, n)rep(j, n){
		if(i >= j) continue;
		int now = min(dp[i][j], j-i);
		ans = max(ans, now);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 98176
#include <stdio.h>
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;


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

	if (a == b)
		cout << "=" << endl;
	else if (a > b)
		cout << ">" << endl;
	else
		cout << "<" << endl;
}

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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/
int main(){
    //隣り合うカードが偶数の枚
    ll n,m;cin>>n>>m;
    ll ans=abs((n-2)*(m-2));
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
int read();
#define w edge[i].to
#define mk(a,b) ((ZT){a,b})
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define dwn(i,a,b) for(int i=(a);i>=(b);i--)
using namespace std;
const int maxn=200500;
struct Edge{
	int to,nt;
}edge[maxn];int tot,head[maxn];
void add(int a,int b){
	edge[++tot].to=b;
	edge[tot].nt=head[a];
	head[a]=tot;
}
struct ZT{
	int u,d;
};
ZT qu[maxn*2];int l,r;

struct Q{
	int u,d,c;
}q[maxn];
int n,m,cl[maxn],kz[maxn];
int main(){
	n=read(),m=read();
	rep(i,1,m){
		int a=read(),b=read();
		add(a,b);add(b,a);
	}
	memset(cl,0,sizeof(cl));
	memset(kz,0,sizeof(kz));
	int ci=read();
	rep(i,1,ci){
		q[i].u=read();
		q[i].d=read();
		q[i].c=read();
	}
	dwn(i,ci,1){
		int clr=q[i].c;
		//cout<<q[i].u<<' '<<q[i].d<<' '<<endl;//
		l=r=0;
		qu[r++]=mk(q[i].u,q[i].d+1);
		while(l<r){
			ZT no=qu[l++];
			//cout<<no.u<<' '<<cl[no.u]<<' '<<kz[no.u]<<endl;//
			//cout<<no.d<<endl;//
			if(cl[no.u]==0)cl[no.u]=clr;
			if(no.d<=kz[no.u])continue;
			kz[no.u]=no.d;
			if(no.d<=1)continue;
			for(int i=head[no.u];i;i=edge[i].nt)
			qu[r++]=mk(w,no.d-1);
		}
	}
	rep(i,1,n)
	printf("%d\n",cl[i]);
	return 0;
}
int read(){
	int s=0,k=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')k=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
	return s*k;
}

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

int main() {
    string a , b , c , d ;
    cin >> a >> b ;
    c = a ; d = b ;
    reverse( c.begin() , c.end() ) ;
    reverse( d.begin() , d.end() ) ;
    if( a == d && b == c ) cout << "YES" << endl ;
    else cout << "NO" << endl ;
    return 0 ;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>; // グラフ型

int main()
{
    int n; cin >> n;
    vector<ll> l(n); rep(i, n) cin >> l[i];
    int ans = 0;
    if(n < 3){
        cout << 0 << endl;
        return 0;
    }
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            for(int k=j+1; k<n; k++){
                if(l[i] == l[j] || l[i] == l[k] || l[k] == l[j]) continue;
                ll len = l[i] + l[j] + l[k];
                ll mx = max(l[i], max(l[j], l[k]) );
                ll rest = len - mx;

                if(mx < rest) ans++;
            }
        }
    }
    cout << ans << endl;    
}


/*
g++ b.cpp
./a.out

oj d https://atcoder.jp/contests/abc172/tasks/abc172_c
oj t
*/


Measured memory_bytes: 3628
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

vi v[N];
int p[N];
int main()
{
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= m; i ++)
	{
		int sz;
		cin >> sz;
		for(int j = 1; j <= sz; j ++)
		{
			int x;
			cin >> x;
			v[i].pb(x);
		}
	}
	for(int i = 1; i <= m; i ++)
		cin >> p[i];
	int ans = 0;
	for(int i = 0; i < (1 << n); i ++)
	{
		int flag = 0;
		for(int k = 1; k <= m; k ++)
		{
			int cnt = 0;
			for(auto it : v[k])
			{
				int x = it-1;
				if((1 << x) & i)
					cnt ++;
			}
			if(cnt % 2 != p[k])
				flag= 1;
		}
		if(!flag)
			ans ++;
	}
	cout << ans;





	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

int main() {
	int X,A;
	cin>>X>>A;
	int ans =10;
	if(X<A)ans = 0;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        n: usize,
        m: usize,
    }

    let mut shift = 0;

    for i in 0..m {
        let l = m - i;
        let r = m + 1 + i;
        if n % 2 == 0 && shift == 0 && i * 2 >= n - r + l - 1 {
            shift = 1;
        }
        println!("{} {}", l, r + shift);
    }
}


Measured memory_bytes: 2144
// 1_1_B
#include<stdio.h>

long get_gcd(long, long);

int main(){
    long x, y;
    scanf("%ld %ld", &x, &y);
    printf("%ld\n", get_gcd(x, y));
    return 0;
}

long get_gcd(long x, long y){
    long tmp;
    while(y > 0){
        tmp = x;
        x = y;
        y = tmp % y;
    }
    return x;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
const ll mod = 1000000007;



int main() {
int x;
  in(x);
  if((100<=x&&x<=105)||(200<=x&&x<=210)||(300<=x&&x<=315)||(400<=x&&x<=420)||(500<=x&&x<=525)||(600<=x&&x<=630)||(700<=x&&x<=735)||(800<=x&&x<=840)||(900<=x&&x<=945))out(1);
  else if((1000<=x&&x<=1050)||(1100<=x&&x<=1155)||(1200<=x&&x<=1260)||(1300<=x&&x<=1365)||(1400<=x&&x<=1470))out(1);
  else if((1500<=x&&x<=1575)||(1600<=x&&x<=1680)||(1700<=x&&x<=1785)||(1800<=x&&x<=1890)||(1900<=x&&x<=1995))out(1);
  else if(x>=2000) out(1);
  else out(0);
}


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

#define INF 2000

int n;
int cost[110][110], mincost[110];
bool used[110];

int prim(){
  
  for(int i = 0;i < n;i++){
    mincost[i] = INF;
    used[i] = false;
  }
  
  mincost[0] = 0;
  int ans = 0;
  
  while(true){
    
    int v = -1;
    
    for(int u = 0;u < n;u++){
      if(!used[u] && (v == -1 || mincost[u] < mincost[v])) v = u;
    }
    
    if(v == -1) break;
    used[v] = true;
    ans += mincost[v];
    
    for(int u = 0;u < n;u++){
      mincost[u] = min(mincost[u], cost[v][u]);
    }
  }
  
  return ans;
}

int main(){
  
  cin >> n;
  for(int i = 0;i < n;i++){
    for(int j = 0;j < n;j++){
      cin >> cost[i][j];
      if(cost[i][j] == -1) cost[i][j] = INF;
    }
  }
  
  cout << prim() << endl;
  
  return 0;
}


Measured memory_bytes: 3124
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define sz(a)       (ll)(a.size())
#define cr(P)       cout<<P<<"\n";return;
#define mem(a,val)  memset(a, val, sizeof(a))
#define fr(i,x,n)   for(ll i=x; i<n; i++)
#define frr(i,x,n)  for(ll i=n-1; i>=x; i--)
using namespace std;


const ll N   =  500005;
const ll mod = 1e9 + 7;



void solve(){

 ll x=0, y=0, c = 0, ans = 0;
 ll n, m, k;

 cin >> n;
 if(n >=1800 and n <=1999){
 	cout <<1 <<"\n";
 }
 else if(n >=1600 and n <=1799){
 	cout <<2 <<"\n";
 }
 else if(n >=1400 and n <=1599){
 	cout <<3 <<"\n";
 }
 else if(n >=1200 and n <=1399){
 	cout <<4 <<"\n";
 }
 else if(n >=1000 and n <=1199){
 	cout <<5 <<"\n";
 }
 else if(n >=800 and n <=999){
 	cout <<6 <<"\n";
 }
 else if(n >=600 and n <=799){
 	cout <<7 <<"\n";
 }
 else if(n >=400 and n <=599){
 	cout <<8 <<"\n";
 }
    
 
}

signed main(){
     
 ios_base::sync_with_stdio(false);   
 cin.tie(NULL);
 //int T;cin >> T;while (T--)
 solve();
 return 0;
}



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

using namespace std;

int main()
{

    priority_queue<int> q;

    string s;

    while(cin>>s)
    {
        if(s=="end")
        {
            break;
        }else if(s=="insert")
        {
            int a;
            cin>>a;
            q.push(a);
        }else
        {
            cout<<q.top()<<endl;q.pop();
        }
    }



    return 0;
}



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

using namespace std;

struct data
{
	int t[3][2];
};

int main()
{
	int n;
	cin >> n;
	vector<data> t(n);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < 3; j++)
			for (int k = 0; k < 2; k++)
			{
				int h, m;
				cin >> h >> m;
				t[i].t[j][k] = h * 60 + m;
			}
	int ans = 0;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			for (int k = 0; k < n; k++)
			{
				int cnt = 0;
				for (int l = 0; l < n; l++)
					if (t[l].t[0][0] <= t[i].t[0][0] && t[i].t[0][0] <= t[l].t[0][1] && t[l].t[1][0] <= t[j].t[1][0] && t[j].t[1][0] <= t[l].t[1][1] && t[l].t[2][0] <= t[k].t[2][0] && t[k].t[2][0] <= t[l].t[2][1])
						cnt++;
				ans = max(ans, cnt);
			}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3120
def elephant(s, ans, word):
    count = 0
    lens = len(s)
    for i in range(lens):
        if s[i] == word:
            count += 1
        else:
            ans[i-1] += (count+1)//2
            ans[i]   += count//2
            count = 0

s = list(input())
ans = [0]*len(s)
elephant(s, ans, "R")

s.reverse()
ans.reverse()
elephant(s, ans, "L")

ans.reverse()
print(" ".join(map(str, ans)))

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define PER(i,n) for (int i=(N-1);i>=0;--i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main() {
    int N, K;
    cin >> N >> K;

    string s;
    cin >> s;

    int initScore = 0;
    for(int i = 0; i < N - 1; i++) {
        if(s[i] == s[i + 1]) initScore++;
    }

    cout << min(initScore + 2 * K, N - 1) << endl;

    return 0;
}

Measured memory_bytes: 512
import sys
from collections import deque
def input(): return sys.stdin.readline().strip()
mod = 10**9+7

def main():
    N = int(input())
    ans = 0
    for n in range(1, N + 1):
        k = N // n
        ans += n * k * (k + 1) // 2
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 65840
#include <algorithm>
#include <iostream>
#include <string>
 
using namespace std;
 int i, n, a[10007], bar[10007], cnt=0, cnt8=0, mx=0,mn=0;
int main() {
  cin>>n;
  for(i=0;i<n;i++){
  	cin>>a[i];
  }
  for(i=0;i<n;i++){
        
        if(a[i]<=399){
            bar[0]=1;
        }
		else if(a[i]<=799){
            bar[1]=1;
        }
		else if(a[i]<=1199){
            bar[2]=1;
        }
		else if(a[i]<=1599){
            bar[3]=1;
        }
		else if(a[i]<=1999){
            bar[4]=1;
        }
		else if(a[i]<=2399){
            bar[5]=1;
        }
		else if(a[i]<=2799){
            bar[6]=1;
        }
		else if(a[i]<=3199){
            bar[7]=1;
        }
		else if(a[i]>=3200){
            bar[8]=1;
            cnt8++;
        }
        
    }
  	for(i=0;i<8;i++){
        if(bar[i]==1)cnt++;
    }
    mn=cnt;
    if(bar[8]==1){

        mx=cnt+cnt8;

    }else{
        mx=cnt;
    }
    
    if(mn==0) mn=1;
    if(n<=1){
        mn=1;
        mx=1;
    }
   cout<<mn<<" "<<mx;
  
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
# count on j
# 最初に入力したリスト

q = int(input())
m = list(map(int, input().split()))
# count on i
# 後に入力したリスト


def solve(i, m_count):
    if m_count == 0:
        return True
    if i >= n:
        return False
    res = solve(i + 1, m_count) or solve(i + 1, m_count - a[i])
    return res


for count in m:
    if sum(a) < count:
        print("no")
    elif solve(0, count):
        print("yes")
    else:
        print("no")



Measured memory_bytes: 5628
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main() {
	int a, b;
	int N,K,Q;
	vector<int>  player;

	cin >> N>>K>>Q;

	for (int i = 0; i < N; i++) {
		player.push_back(K - Q);
	}

	for (int i = 0; i < Q; i++) {
		cin >> a;

		player[a-1]++;
	}
	for (int i = 0; i < N; i++) {
		if (player[i] <= 0) {
			cout << "No" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
	}
	

}

Measured memory_bytes: 1144
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main() {
    long long N;
    cin >> N;
    long long A[N];
    for (long long i = 0; i < N ; ++i) cin >> A[i];

    long long odd = 0;
    
    for (long long i = 0; i < N ; ++i) {
        if (A[i] % 2 == 1) ++odd;
    }
    
    if (odd % 2 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int MAX = 110000;
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    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;
  }
};

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
mint COM(int n, int k){
    mint a = 1;
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    a *= fac[n] * (finv[k] * finv[n - k] % mod) % mod;
    return a;
}


int main(void){
  int n; cin >> n;
  int a[n];
  set<int> s;
  int dup;
  FOR(i,0,n) {
    cin >> a[i];
    if(s.count(a[i])>0) dup = a[i];
    s.insert(a[i]);
  }
  vector<int> indexdup;
  FOR(i,0,n){
    if(a[i]==dup) indexdup.PB(i);
  }

  int outrange = (n+1) - (indexdup[1]-indexdup[0]+1);
  
  COMinit();
  FOR(i,1,n+1){
    mint ans = 0;
    ans += COM(n+1,i);
    if(i-1<=outrange){
      ans -= COM(outrange,i-1);
    }
    cout << ans.x << endl;
  }
}

Measured memory_bytes: 8832
#include <iostream>
#include <stdio.h>

using namespace std;

int n,k;

int findTrackMax(int stackWeight[]){
	int max = 0;
	for(int i = 0; i < k; i++){
		if(max < stackWeight[i]){
			max = stackWeight[i];
		}
	}
	return max;
}

//?????§?????????p??§???????????????????????????
bool pileW(int w[],int p){

	int trial[k];	//???????????????k??°
	for(int i = 0; i < k; i++){
		trial[i] = 0;
	}
	int index_w = 0;
	int index_track = 0;
	int tmp = 0;

	if(k == 1){	//1??°?????´???
		for(int i = 0; i < n; i++){
			trial[0] += w[i];
		}
		return (trial[0] <= p);
	}

	while(true){	//?????????????????????
		if(tmp + w[index_w] <= p){
			tmp += w[index_w++];
		}else{	//?¬???????????????¢????????????????????§???????????¨???????????¨
			trial[index_track++] += tmp;	//??????
			tmp = 0;
		}

		if(index_track == k-1){	//?¬???????????????????????????????????????§?????¨???p??\??????????????§????????????
			for(int i = index_w; i < n; i++){	//?????????????????¨?????????????????????????????????
				trial[index_track] += w[i];
			}
			return (trial[index_track] <= p);	//????????????????????????????????????p??\???????????????
		}else if(index_w == n-1){	//?????????????????????????????????????????????
			return (w[index_w] <= p);	//???????????????????????§???????????\???????????????(???????????????????????????????????????????????°????????????)
		}
	}
}

int main(){

	scanf("%d %d",&n,&k);

	int w[n];
	int guessPMax[k];

	for(int i = 0; i < n; i++){
		scanf("%d",&w[i]);
	}

	for(int i = 0; i < k; i++){
		guessPMax[i] = 0;
	}


	int p_trial_number;	//?????????????????????(????????????????????????)
	if(n >= k){
		if(n%2 == 0 && k%2 == 0){
			p_trial_number = n/k;
		}else{
			p_trial_number = n/k + 1;
		}
	}else{	//??????????????°??????????????????????????°???????????§????????´???
		p_trial_number = 1;
	}

	//k*p > n??¨?????? p??????n/k????????§????????§
	int k_trial = 0,n_trial = 0;
	while(true){	//??????????????????????????????????????°??§????????§??????

		for(int i = 0; (i < p_trial_number && n_trial < n-1);i++){
			guessPMax[k_trial] += w[n_trial++];
		}
		k_trial++;
		//?????????????????????????????????????????¨??????
		if(k_trial == k-1){
			for(int i = n_trial;i < n;i++){
				guessPMax[k_trial] += w[i];
			}
			break;
		}else if(n_trial == n-1){	//???????????????
			guessPMax[k-1] += w[n_trial];	//????????????????????????????????????????????????
			break;
		}
	}

	int right = findTrackMax(guessPMax);	//???????????§?????????(?????????????????§?????????)

	int left = n/k;	//?????§?????????????£????????°???????n/k??§????????????

	if(left == right){
		//Do nothing
	}else if(right - left == 1){
		if(pileW(w,left)){
			right = left;
		}
	}else{
		int m;
		while(right - left > 1){
			if((left + right)%2 == 1){
				m = (left + right+1)/2;
			}else{
				m = (left + right)/2;
			}
			if(pileW(w,m)){
				right = m;
			}else{
				left = m;
			}
		}
	}
	printf("%d\n",right);
}

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

int main(){
    int k;
    scanf("%d",&k);
    long long *q=(long long*)malloc(sizeof(long long)*9);
    for(long long m=1;m<10;m++){
        *(q+m-1)=m;
    }
    int end=9;
    int head=0;
    long long l;
    for(int i=0;i<k;i++){
        l=*(q+head);
        head+=1;
    
        if(l%10!=0 && l%10!=9){
            long long *tmp=(long long*)calloc(3,sizeof(long long));
            bcopy(q,tmp,3);
            *(q+end)=10*l+l%10-1;
            *(q+end+1)=10*l+l%10;
            *(q+end+2)=10*l+l%10+1;
            end+=3;
        }
        else if(l%10==0){
            long long *tmp=(long long*)calloc(2,sizeof(long long));
            bcopy(q,tmp,2);
            *(q+end)=10*l;
            *(q+end+1)=10*l+1;
            end+=2;
        }
        else if(l%10==9){
            long long *tmp=(long long*)calloc(2,sizeof(long long));
            bcopy(q,tmp,2);
            *(q+end)=10*l+8;
            *(q+end+1)=10*l+9;
            end+=2;
        }
            
    }
    printf("%lld\n",l);
    return 0;
}

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

using namespace std;

char a[100];
int main(){
	int l;
	scanf("%s",&a);
	l=strlen(a);
	for(int i=0;i<l-1;i++){
		if(a[i]=='C'){
			for(int j=i+1;j<l;j++){
				if(a[j]=='F'){
					printf("Yes");
					return 0;
				}
			}
		}
	}
	printf("No");
	return 0;
}

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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    int sum = A + B + C;
    int mx = max({A, B, C});
    int dif = 3 * mx - sum;
    if(dif % 2) dif += 3;
    cout << dif / 2 << '\n';
    return 0;
}


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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  ll A, B;
  scanf("%lld %lld", &A, &B);

  if (B%A==0) {
cout << A+B << endl;
  } else{
cout << B-A << endl;
  }
}


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

int hills[10] ;
int tops[3] = {0,0,0} ;

int main()
{
	for( int i = 0 ; i < 10 ; i ++ )
	{
		cin >> hills[i] ;

		if( hills[i] >= tops[0] )
		{
			tops[2] = tops[1] ;
			tops[1] = tops[0] ;
			tops[0] = hills[i] ;
		}
		else if( hills[i] >= tops[1] )
		{
			tops[2] = tops[1] ;
			tops[1] = hills[i] ;
		}
		else if( hills[i] >= tops[2] )
		{
			tops[2] = hills[i] ;
		}
	}

	for( int i = 0 ; i < 3 ; i ++ )
	{
		cout << tops[i] << "\n" ;
	}

	return 0 ;
}

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

const long long INF = 1LL << 60;

long long min_2(long long a, long long b){
    if (a > b){
        return b;
    }else{
        return a;
    }
}

int main()
{    
    int N;
    long long W;
    cin >> N >> W;

    long long a,b;
    long long w[N],v[N];

    for (int i = 0; i < N; ++i) {
        cin >> a >> b;
        w[i]=a;
        v[i]=b;
    }

    long long M=0;
    
    for (int i = 0; i < N; ++i) {
        M+=v[i];
    }

    long long dp[M+1];

    for (int i = 0; i < M+1; ++i) {
        dp[i]=INF;
    }
    dp[0]=0;

    long long s=0;
    for (int i = 0; i < N; ++i) {

        s+=v[i];
        for (int j = min_2(s,M); j > v[i]-1; --j) {
            if (dp[j] > dp[j-v[i]]+w[i]){
                dp[j]=dp[j-v[i]]+w[i];
            }
            
        }
    }

    int m=0;
    for (int i = 0; i < M+1; ++i) {
        
        if (dp[i]<=W){
            m=i;
        }
    }

    cout << m << endl;
    return 0;
}

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

int main() {
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
  string S,T;
  int N;
  int M=0;
  int j;
  char t;
  cin>>S>>N;
  vector<int> a(N);
  vector<int> b(N);
  vector<char> c(N);
  vector<char> F1(N),F2(N);
  vector<char> B1(N),B2(N);
  int l=0,k=0,h=0;
  rep(i,N){
    cin>>a[i];
    if(a[i]==1)
      M++;
    else{
      cin>>j;
      if((M+j)%2==1){
        cin>>t;
        F1[l]=t;
        B1[l]=t;
        l++;
      }
      else{
        cin>>t;
        F2[k]=t;
        B2[k]=t;
        k++;
      }
    }
  }
    if(M%2==0){
      T=S;
      rep(i,l)
        cout<<F1[l-i-1];
      rep(i,S.size())
        cout<<T[i];
      rep(i,k)
        cout<<B2[i];
  }
    else{
      /*rep(i,S.size())
        T[i]=S[S.size()-i-1];*/
    rep(i,k)
        cout<<F2[k-i-1];
      rep(i,S.size())
        cout<<S[S.size()-i-1];
      rep(i,l)
        cout<<B1[i];
    }
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,ans;
  cin>>a>>b>>c>>d;

  if(a*b>c*d){
    ans=a*b;
  }
  else if(a*b==c*d){
    ans=a*b;
  }
  else{
    ans=c*d;
  }
  
  cout<<ans<<endl;
}


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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int p = in.ni(), q = in.ni(), r = in.ni();
        out.println(p+q+r-Math.max(p,Math.max(q,r)));
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 21204
import java.io.IOException;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();

		long answer;

		if(n==1 && a!=b){
			System.out.println(0);
		}else if(a>b){
			System.out.println(0);
		}else{
			Integer iB = b;
			BigInteger bigB = new BigInteger(iB.toString());
			Integer iA = a;
			BigInteger bigA = new BigInteger(iA.toString());
			Integer iN = n-2;
			BigInteger bigN = new BigInteger(iN.toString());

			BigInteger big = bigB.subtract(bigA);
			big = big.multiply(bigN);
			BigInteger one = new BigInteger("1");
			big = big.add(one);
			System.out.println(big);
		}
	}
}


Measured memory_bytes: 21972
import sys
L,R = map(int,input().split())
mod = 2019
if R - L >= 2019:
    print(0)
else:
    ans = 10**8
    for i in range(L,R):
        for j in range(i+1,R+1):
            if i * j % mod == 0:
                print(0)
                sys.exit()
            ans = min(ans,(i*j)%mod)
    print(ans)

Measured memory_bytes: 9164
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    long long a,b,c;
    cin >> a >> b >> c;
    if(c-a-b<=0) cout << "No" << endl;
    else{
        long long ans=(c-a-b)*(c-a-b);
        if(ans>4*a*b) cout << "Yes" << endl;
        else cout << "No" << endl;
    }



}


Measured memory_bytes: 256
//Har Har Mahadev
using namespace std;
#include <bits/stdc++.h>
#define booga cout << "booga" << endl
#define ll long long int
#define pb push_back
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " -> " << a << endl;
	err(++it, args...);
}

void testcase(){
	int k,x;
	cin >> k >> x;
	if(500 * k >= x)cout << "Yes";
	else cout << "No";
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	while(t--){
		testcase();
	}
	return 0;
}


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

int n;
const int N=212345;
vvi g(N);
vi dp(N);

void dfs(int u=1, int p=1) {
  trav(v, g[u]) {
    if (v==p) continue;
    dfs(v, u);
    dp[u] += dp[v] +1;
  }
}




int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  cin >> n;
  vi ans(n+1);
  rep(i,2,n+1) {
    int s;
    cin >> s;
    ++ans[s];
  }

  rep(i,1,n+1) cout << ans[i] << '\n';
}

Measured memory_bytes: 9780
#include<cstdio>
#include<vector>
#include<algorithm>


using namespace std;
using vi=vector<int>;
using ll=long long;
using vll=vector<ll>;


int highest_bit(ll x)
{
	int ret=0;

	for(;x>1;x>>=1,ret++);
	return ret;
}


ll calc(vll&s, int sn, int bit, int k)
{
	ll ret=0;
	ll mask=1LL<<bit;
	int p=0;

	if(bit<0) return 0LL;

	for(int i=0;i<sn;i++)
	{
		if(s[i]&mask)
		{
			swap(s[p++], s[i]);
		}
	}
	if(p>=k)
	{
		ret=mask|calc(s, p, bit-1, k);
	}
	else
	{
		ret=calc(s, sn, bit-1, k);
	}
	return ret;
}


int main(void)
{
	int n, k;

	while(scanf("%d%d", &n, &k)==2)
	{
		vi a(n);
		vll s(n*(n+1)/2);
		int p=0;
		ll s_max=0;

		for(int i=0;i<n;i++)
		{
			scanf("%d", &a[i]);
		}
		for(int i=0;i<n;i++)
		{
			s[p++]=a[i];
			for(int j=i+1;j<n;j++)
			{
				s[p]=s[p-1]+a[j];
				if(s_max<s[p]) s_max=s[p];
				p++;
			}
		}
		ll ans=calc(s, p, highest_bit(s_max), k);
		printf("%lld\n", ans);
	}

	return 0;
}


Measured memory_bytes: 4096
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    x, y, a, b, c = list(map(int, input().strip().split()))
    p = sorted(list(map(int, input().strip().split())), reverse=True)
    q = sorted(list(map(int, input().strip().split())), reverse=True)
    r = sorted(list(map(int, input().strip().split())), reverse=True)
    print(sum(sorted((p[:x]+q[:y]+r), reverse=True)[:x+y]))

if __name__ == '__main__':
    main()


Measured memory_bytes: 99368
import sys

n, k, *a = map(int, sys.stdin.read().split())
a.append(n + a[0])

def main():
    d = 0
    for i in range(k):
        d = max(d, a[i+1] - a[i])
    res = n - d
    print(res)

if __name__ == "__main__":
    main()

Measured memory_bytes: 25124
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <memory.h>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main() {
	int g[100][100];
	memset(g, 0, sizeof(g));
	rep(i, 9) rep(j, 4 + i % 2) {
		char c;
		cin >> c;
		g[i + 1][j * 2 + (i + 1) % 2 + 1] = c - '0';
	}
	int dx[] = {0, 1, 0, -1};
	int dy[] = {-1, 0, 1, 0};
	char c[] = "URDL";
	int x = 2, y = 0, v = 1;
	do {
		cout << c[v];
		int pv = (v - 1 + 4) % 4;
		int nv = (v + 1) % 4;
		int nnv = (v + 2) % 4;
		
		if (g[y + dy[v]][x + dx[v]] == 1) {
			v = pv;
		}
		else if (g[y + dy[v] * 2 + dy[nv]][x + dx[v] * 2 + dx[nv]] == 1) {
			x += dx[v] * 2;
			y += dy[v] * 2;
		}
		else if (g[y + dy[v] * 2 + dy[nv] * 2 + dy[nnv]][x + dx[v] * 2 + dx[nv] * 2 + dx[nnv]] == 1) {
			x += dx[v] * 2;
			x += dx[nv] * 2;
			y += dy[v] * 2;
			y += dy[nv] * 2;
			v = nv;
		}
		else {
			x += dx[nv] * 2;
			y += dy[nv] * 2;
			v = nnv;
		}
		if (x == 0 && y == 0) break;
		if (x == 2 && y == 0) break;
	} while(true);
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007; 
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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




int gcd(int a, int b){
    if(!b) return a;
    if(a % b) return gcd(b, a % b);
    return b;
}

long long lcm(int a, int b){
    long long g(gcd(a, b));
    return a / g * b;
}



int main(){
    int a, b;
    while(std::cin >> a >> b){
        std::cout << gcd(a, b) << " " << lcm(a, b) << "\n";
    }
    return 0;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

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

  auto total = a + b;
  ll md = n % total;
  ll ans = (n / total) * a + min(a, md);
  cout << ans << endl;
}

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

using namespace std;

int main(){
    int n, y, tmp, s;
    cin >> n >> y;
    for(int i=0; i*10000<=y && i<=n; i++){
        tmp=y-i*10000;
        for(int k=0; k*5000<=tmp&& k+i<=n; k++){
            if((tmp-k*5000)/1000==n-k-i){
                cout << i << " " << k << " " << (tmp-k*5000)/1000;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

struct node{
    int y, x, cost;
};

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

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

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

    int h, w;
    cin >> h >> w;

    vector<string> s(h);
    rep(i, h){
        cin >> s[i];
    }

    auto inside = [&](int y, int x){
        return 0 <= y && y < h && 0 <= x && x < w && s[y][x] == '.';
    };

    int ans = 0;
    rep(i, h){
        rep(j, w){
            if(s[i][j] == '.'){
                vector< vector<int> > cost(h, vector<int>(w, IINF));
                cost[i][j] = 0;
                queue<node> que;
                que.push({i, j, 0});
                while(!que.empty()){
                    node now = que.front();
                    que.pop();
                    if(cost[now.y][now.x] < now.cost){
                        continue;
                    }
                    rep(k, 4){
                        int ny = now.y + dy4[k];
                        int nx = now.x + dx4[k];
                        if(inside(ny, nx) && chmin(cost[ny][nx], now.cost + 1)){
                            que.push({ny, nx, now.cost + 1});
                        }
                    }
                }
                rep(k, h){
                    rep(l, w){
                        if(cost[k][l] < IINF){
                            chmax(ans, cost[k][l]);
                        }
                    }
                }
            }
        }
    }

    cout << ans << endl;

    cout << flush;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

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

    string ab_str = a + b;
    int ab = atoi(ab_str.c_str());

    for (int i = 1; i <= ab; i++) {
        if (i * i == ab) {
            puts("Yes");
            return 0;
        }
        if (i * i > ab) {
            puts("No");
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int s[505];
int main(){
	int a[505][3];
	int i,j,k;
	int n;
	cin>>n;
	for(i=0;i<n-1;i++){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	for(i=0;i<n-1;i++){
		for(j=0;j<=i;j++){
			if(s[j]<=a[i][1])s[j]=a[i][0]+a[i][1];
			else{
				s[j]=((s[j]-1)/a[i][2]+1)*a[i][2]+a[i][0];
			}
		}
	}
	for(i=0;i<n;i++){
		cout<<s[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    nodes = []

    for _ in range(N):
        X, L = map(int, input().split())
        end = X + L
        start = X - L
        nodes.append((end, start))

    nodes.sort()

    last_end = -999999999999999999
    ans = 0
    for node in nodes:
        end, start = node
        if last_end <= start:
            ans += 1
            last_end = end

    print(ans)


main()


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

using ll = int64_t;

int main() {
    int X, Y;
    std::cin >> X >> Y;

    for (int i = 0; i <= 200; ++i) {
        for (int j = 0; j <= 200; ++j) {
            if ((i + j) == X && ((i * 2 + j * 4) == Y)) {
                std::cout << "Yes" << std::endl;
                return 0;
            }
        }
    }

    std::cout << "No" << std::endl;

    return 0;
}


Measured memory_bytes: 3628