akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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

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

template <class Abel> struct BIT {
    const Abel UNITY_SUM = 0;                       // to be set
    vector<Abel> dat;
    
    /* [1, n] */
    BIT(int n) : dat(n + 1, UNITY_SUM) { }
    void init(int n) { dat.assign(n + 1, UNITY_SUM); }
    
    /* a is 1-indexed */
    inline void add(int a, Abel x) {
        for (int i = a; i < (int)dat.size(); i += i & -i)
            dat[i] = dat[i] + x;
    }
    
    /* [1, a], a is 1-indexed */
    inline Abel sum(int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i)
            res = res + dat[i];
        return res;
    }
    
    /* [a, b), a and b are 1-indexed */
    inline Abel sum(int a, int b) {
        return sum(b - 1) - sum(a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat.size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;
    ll a = 0,b = 0;
    for(int i=1;i<=n;i++){
        if(k%2==0){
            if(i%k==(k/2)) a++;
        }
        if(i%k==0) b++;
    }
    ll ans=0;
    ans+=a*a*a;
    ans+=b*b*b;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            if (a == 0 & b == 0)
                break;
            for (int i = 0; i < a; i++) {
                for (int j = 0; j < b; j++) {
                    if (i % 2 == 0 && j % 2 == 0 || i % 2 == 1 && j % 2 == 1)
                        System.out.print("#");
                    else
                        System.out.print(".");
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 37348
#include<iostream>
using namespace std;
int main(){
int n,x;
int a=0;
while(1){
a=0;
cin >> n >> x;
if(n==0 && x==0)break;
for(int i=1; i<=n-2; i++){
for(int j=i+1; j<=n-1; j++){
for(int k=j+1; k<=n; k++){
if(i+j+k==x) a++;
}
}
}
cout << a <<endl;
}
return 0;
}


Measured memory_bytes: 3136
import sys
from heapq import heappush,heappop
input = sys.stdin.readline

n,m = map(int,input().split())
ab = []
for i in range(n):
    a,b = map(int,input().split())
    if a <= m:
        ab.append((a,b))
ab.sort()

stock = []
ans = 0
for i in range(1,m+1):
    while ab and ab[0][0] <= i:
        a,b = ab.pop(0)
        heappush(stock,-b)
    if stock:
        ans += -heappop(stock)

print(ans)

Measured memory_bytes: 17184
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int H , A;
    cin >> H >> A;
    if(H % A != 0){
        cout << (H / A)+1 << endl;
    }else{
        cout << (H / A) << endl;
    }
    return 0;
}

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

#define MAX 25

class Task {
public:
  int d, lim;
  Task(int d = 0, int lim = 0) : d(d), lim(lim) {}
  bool operator < ( const Task &t ) const {
    //if( lim == t.lim ) return d < t.d;
    return lim < t.lim;
  }
};

int main() {
  int n;
  Task T[MAX];
  bool success;
  int cur;

  while(cin >> n && n) {
    for(int i = 0; i < n; i++) {
      cin >> T[i].d >> T[i].lim;
    }
    sort(T, T+n);
    success = true;
    cur = 0;
    for(int i = 0; i < n && success; i++) {
      cur += T[i].d;
      if(T[i].lim < cur) success = false;
    }
    if(success) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 1152
/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL unsigned long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
void er(){
	cout<<-1<<endl;
	exit(0);
}
	int n;
	LL res[501][501],s[501],t[501],u[501],v[501];
	int zero[1001];
	bool mat[501][501],con[501][501],con1[1001];
int main(){
	fastio;
	cin>>n;
	rb(i,1,n) cin>>s[i];
	rb(i,1,n)cin>>t[i];
	rb(i,1,n) cin>>u[i];
	rb(i,1,n) cin>>v[i];
	LL base=1;
	rep(ID,64){
		memset(zero,0,sizeof(zero));
		memset(con1,0,sizeof(con1));
		memset(con,0,sizeof(con));
		memset(mat,0,sizeof(mat));
		rb(i,1,n)
			if((!s[i])&&(u[i]&1)){
				con1[i]=1;
				rb(j,1,n){
					con[i][j]=1;
					mat[i][j]=1;
				}
			}
			else
			if((s[i])&&(!(u[i]&1))){con1[i]=1;
				rb(j,1,n)
					{
						con[i][j]=1;
						mat[i][j]=0;
					}
			}
		rb(j,1,n)
		{
			if((!t[j])&&(v[j]&1)){con1[j+n]=1;
				rb(i,1,n){
					if(con[i][j]&&(!mat[i][j])){
						er();	
					}
					con[i][j]=1;
					mat[i][j]=1;
				}
			}
			else
			if(t[j]&&(!(v[j]&1))){con1[j+n]=1;
				rb(i,1,n){
					if(con[i][j]&&mat[i][j]){
						er();
					}
					con[i][j]=1;
					mat[i][j]=0;
				}
			}
		}
		rb(i,1,n){
			rb(j,1,n){
				if(!(mat[i][j]&1)){
					zero[i]++;
				}
				if(!(mat[j][i]&1)){
					zero[i+n]++;
				}
			}
			if(zero[i]==0&&(s[i]==0&&((u[i]&1)==0))){
				er();
			}
			if(zero[i+n]==0&&t[i]==0&&(v[i]&1)==0){
				er();
			}
		}
		rb(i,1,n){
			if(s[i]&&(u[i]&1)){
				rb(j,1,n){
					if(mat[i][j]) break;
					if(!con[i][j]){
						if(t[j]){
							mat[i][j]=1;
							break;				
						}
						else{
							if(zero[j+n]>1){
								zero[j+n]--;
								mat[i][j]=1;
								break;
							}
						}
					}
				}
				bool ok=0;
				rb(j,1,n){
					ok|=mat[i][j];
				}
				if(!ok){
					er();
				}
			}
		}
		rb(j,1,n){
			if(t[j]&&(v[j]&1)){
				rb(i,1,n){
					if(mat[i][j]) break;
					if(!con[i][j]){
						if(s[i]){
							mat[i][j]=1;
							break;
						}
						else{
							if(zero[i]>1){
								zero[i]--;
								mat[i][j]=1;
								break;
							}
						}
					}
				}
				
				bool ok=0;
				rb(i,1,n){
					ok|=mat[i][j];
				}
				if(!ok){
					er();
				}
			}
		}
		rb(i,1,n)
			u[i]>>=1,v[i]>>=1;
		rb(i,1,n)
			rb(j,1,n)
				res[i][j]+=base*mat[i][j];
		base<<=1;
	}
	rb(i,1,n){
		rb(j,1,n) cout<<res[i][j]<<" ";cout<<endl;
	} 
	return 0;
}
/*
3
1 999 3
45 29 18446744073709551615
0 1 99
1 1 1
1 1 1
999 18446744073709551615 99
45 1023 18446744073709551615
*/

Measured memory_bytes: 7896
#include <bits/stdc++.h>
#define PRECISION(x) cout << fixed << setprecision(x); 
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(i,n) for (int i = 0; i < n; ++i)
#define DO(X) while(X--)
#define DRI(X) int (X); cin >> X
#define DRII(X, Y) int X, Y; cin >> X >> Y
#define DRIII(X, Y, Z) int X, Y, Z; cin >> X >> Y >> Z
#define read(X) for(int &ele : (X)) cin >> ele
#define readI(X) for(int idx = 1; idx < SZ((X)); ++idx) cin >> (X)[idx]
#define debug(x) cerr << '>' << #x << ':' << x << endl
#define MP make_pair
#define PB push_back
#define F first
#define S second

using namespace std;
typedef long long LL;
const int INF = 1<<29;
inline int in() { int x; cin >> x; return x; }
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }

int main(){
	FAST_IO 
	unordered_map<int, bool> isP = {{1, false}, {2, false}, {3, false}};
	REP(rep, 2){
		isP[in()] = true;
	}
	for(auto ele : isP){
		if(ele.second == false) cout << ele.first << endl;
	}
	return 0;
}

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

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

    int n,k; cin>>n>>k; double ans=0; int a[n];
    for (int i = 1; i <= n; i++){
        if(i>=k){ans+=1; continue;}
        a[i-1]=ceil(log2((double)k/i));
        ans+=1.0/pow(2,a[i-1]);
    }
    cout<<setprecision(10)<<ans/n<<'\n';
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
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;
	}
};

// combination mod prime（mintが必要）
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
// nCkを求めて結果をansに格納したい場合、
// combination c(n);
// mint ans = c(n, k);
// cout << ans.x << endl;
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(all(a));
	mint ans = 0;
	combination c(n);
	rep(i, n) {
		mint now = 0;
		now += c(n-i-1, k-1);
		now *= a[i];
		ans -= now;
	}
	rep(i, n) {
		mint now = 0;
		now += c(n-i-1, k-1);
		now *= a[n-i-1];
		ans += now;
	}
	cout << ans.x << endl;
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1e9+7;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
const int biggg = 1000000000;
const long eps = .0000000001;


int main ()
{
  prep();
  long long n, k;
  cin >> n >> k;
  long long res = 0;
  for (long long i=k; i<=n+1; i++){
      long long minused = n-i;
      long long second = n*(n+1)/2-minused*(minused+1)/2;
      res += second-i*(i-1)/2+1;
      res %= mod;
  }
  cout << res;
  return 0;
}


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

using namespace std;

int main(){
  long long int A,B,C,K;
  cin >> A >> B >> C >> K;
  long long int answer=0;
  answer+=min(A,K);
  K-=min(A,K);
  if(K>0){
    K-=min(B,K);
    if(K>0){
      answer-=min(C,K);
    }
  }

  cout << answer << endl;
}


Measured memory_bytes: 3632
/**
 *     author: nayakashutosh9
 *     college: National Institute of Technology, Rourkela
 *	   "Winners Never Quit and Quitters Never Win".
**/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define mod 1000000007
#define inf 1e18
// const int N = 300005;

/*******************************************************************/


int N = 10000005;
vector<int> p(N, -1);
void pre() {
	p[0] = 0; p[1] = 1;
	for (int i = 2; i < N; i++) {
		if (p[i] == -1) {
			for (int j = i; j < N; j += i) p[j] = i;
		}
	}
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	// int t = 1, z = 1;
	// cin >> t;
	// cin.ignore();
	// while (t--) {

	// }
	pre();
	int n; cin >> n;
	unordered_map<int, int> m;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i == 1) {
			ans += 1; continue;
		}
		m.clear();
		int g = i, h = i;
		while (g != 1) {
			m[p[g]]++;
			g /= p[g];
		}
		for (auto x : m) {
			h *= (1 + x.second);
		}
		ans += h;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	string s,t; cin>>s>>t;
	vector<vector<int>>sc(26),tc(26);
	for(int i=0;i<s.size();++i){
		sc.at(s.at(i)-'a').emplace_back(i);
		tc.at(t.at(i)-'a').emplace_back(i);
	}
	string ans="Yes"s;
	for(int i=0;i<s.size();++i){
		int S=s.at(i)-'a',T=t.at(i)-'a';
		if(sc.at(S)==tc.at(T)){
			sc.at(S).clear();
			tc.at(T).clear();
			sc.at(S).emplace_back(i+1e5);
			tc.at(T).emplace_back(i+1e5);
			continue;
		}
		ans="No"s;
		break;
	}
	cout<<ans<<"\n"s;
}


Measured memory_bytes: 5840
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

ll x[100005];


int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    for (int i = 1; i <= n; ++i) cin >> x[i];
    ll res = 0;
    for (int i = 1; i < n; ++i) {
        res += min(b, a * (x[i + 1] - x[i]));
    }
    cout << res << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#define  N   101
using namespace std;

struct Dice{
	int num[6];
};

void move(struct Dice *dice, string str){
	int store[6];

	for(int i=0;i<str.length();i++){
		for(int j=0;j<6;j++){
			store[j] = (*dice).num[j];
		}
		switch(str[i]){
		case 'N':
			(*dice).num[0] = store[1];
			(*dice).num[1] = store[5];
			(*dice).num[5] = store[4];
			(*dice).num[4] = store[0];
			break;
		case 'E':
			(*dice).num[0] = store[3];
			(*dice).num[3] = store[5];
			(*dice).num[5] = store[2];
			(*dice).num[2] = store[0];
			break;
		case 'S':
			(*dice).num[0] = store[4];
			(*dice).num[4] = store[5];
			(*dice).num[5] = store[1];
			(*dice).num[1] = store[0];
			break;
		case 'W':
			(*dice).num[0] = store[2];
			(*dice).num[2] = store[5];
			(*dice).num[5] = store[3];
			(*dice).num[3] = store[0];
			break;
		}
	}
}

void spin(struct Dice *dice, int n){
	for(int i=0;i<n;i++){
		int temp = (*dice).num[1];
		(*dice).num[1] = (*dice).num[3];
		(*dice).num[3] = (*dice).num[4];
		(*dice).num[4] = (*dice).num[2];
		(*dice).num[2] = temp;
	}
}

int check(struct Dice *dice1, struct Dice *dice2){
	bool b = true;
	for(int i=0;i<6;i++)
		if((*dice1).num[i] != (*dice2).num[i])
			b = false;

	if(b)
		return 1;
	else
		return 0;
}

int main(){
	struct Dice dice[N];
	int x = 0, n;
	string str[6] = {" ", "N", "N", "N", "NE", "EE"};
	
	cin>>n;
	for(int j=0;j<n;j++){
		for(int i=0;i<6;i++){
			cin>>dice[j].num[i];
		}
	}
	for(int k=0;k<n-1;k++){
		for(int l=k+1;l<n;l++){
			for(int i=0;i<6;i++){
				move(&dice[l], str[i]);

				for(int j=1;j<5;j++){
					spin(&dice[l], 1);
					x += check(&dice[k], &dice[l]);
				}
			}
		}
	}

	if(x == 0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	
	return 0;
}

Measured memory_bytes: 1208
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace ABC086A
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }
        public void Solve(ConsoleInput cin)
        {
            var a = cin.ReadInt;
            var b = cin.ReadInt;
            WriteLine(a * b % 2 == 0 ? "Even" : "Odd");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separater = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separater = ' ')
        {
            this._separater = separater;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separater);
                for (int i = 0; i < tmp.Length; ++i)
                {
                    inputStream.Enqueue(tmp[i]);
                }
                return inputStream.Dequeue();
            }
        }

        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 11220
#include<iostream>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<set>
using namespace std;
#define ll long long

int gcd(int a, int b){
    
    if(b==0)
    return a;
    
    return gcd(b, a%b);
    
}
int main(){
double l;
cin>>l;
double a=3;

cout<<fixed<<setprecision(12)<<(l/a)*(l/a)*(l/a);


}

Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> d(N);
	for (int i = 0; i < N; i++) {
		cin >> d.at(i);
	}
	sort(d.begin(), d.end());
	cout << d.at(N/ 2) - d.at(N / 2-1) << endl;
		return 0;
}


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

int N, M;
typedef long long ll;
ll a, b, c, d;
vector<pair<ll, ll> > students;
vector<pair<ll, ll> > checks;
int main(){
    scanf("%d%d", &N, &M);
    for(int i=0;i<N;i++){
        scanf("%lld%lld", &a, &b);
        students.push_back(make_pair(a, b));
    }
    for(int j=0; j<M; j++){
        scanf("%lld%lld", &c, &d);
        checks.push_back(make_pair(c, d));
    }
    for(int i=0; i<N; i++){
        ll minl = 1e9;
        int minj = 0;
        for(int j=M-1; j>=0; j--){
            if(minl >= abs(students[i].first-checks[j].first)+abs(students[i].second-checks[j].second)) {
                minj = j+1;
                minl = abs(students[i].first-checks[j].first)+abs(students[i].second-checks[j].second);
            }
        }
        printf("%d\n", minj);
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
#include<memory>
using namespace std;
using ll=long long;

int main(){
    int n;
    cin>>n;
    vector<int> p(n);
    for(int i=0;i<n;i++) cin>>p[i];
    
    int res=0;
    int minv=n+1;
    for(int i=0;i<n;i++){
        if(p[i]<minv){
            minv=p[i];
            res++;
        }
    }
    
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

map<ll, int> prime_divisor(ll x){
    map<ll, int> res;
    for(ll i = 2; i * i <= x; ++i){
        while(x % i == 0){
            ++res[i];
            x /= i;
        }
    }
    if(x != 1)  ++res[x];
    return res;
}

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

    ll a, b;
    cin >> a >> b;
    map<ll, int> prime = prime_divisor(a);
    map<ll, int> primeb = prime_divisor(b);
    for(auto it : primeb){
        if(prime.find(it.first) != prime.end()) prime[it.first] = min(prime[it.first], it.second);
    }
    for(auto it = prime.begin(); it != prime.end();){
        if(primeb.find(it->first) == primeb.end())  it = prime.erase(it);
        else    ++it;
    }
    int ans = prime.size() + 1;
    cout << ans << endl;
}

Measured memory_bytes: 256
while True:
    n,x = map(int,input().split())
    if n == 0 and x == 0:
        exit ()
    
    count = 0

    for i in range(1,n+1):
        for j in range(2,n+1):
            if j <= i:
                pass
            else:
                for k in range(3,n+1):
                    if k <= j or k <= i:
                        pass
                    else:
                        if i+j+k == x:
                            count += 1
    print (count)



Measured memory_bytes: 5596
#include <cstdio>

int main() {
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a < b&&b < c) {
        printf("Yes\n");
        return 0;
    }
    else {
        printf("No\n");
        return 0;
    }
}


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

#define repeat(i, n) for (auto i = decltype(n)(); (i) < (n); (i)++)

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

    int n;
    cin >> n;

    vector<int64_t> a(n), b(n);
    repeat (i, n) {
        cin >> a[i];
    }
    repeat (i, n) {
        cin >> b[i];
    }

    int ans = 0;
    vector<int64_t> a2(n), b2(n);

    repeat (i, 29) {
        int64_t mask = (1 << (i + 1)) - 1,
                t = (1 << i);
        repeat (j, n) {
            a2[j] = a[j] & mask;
            b2[j] = b[j] & mask;
        }
        sort(b2.begin(), b2.end());

        int64_t cnt = 0;
        repeat (j, n) {
            cnt += lower_bound(b2.begin(), b2.end(), 2 * t - a2[j]) -
                    lower_bound(b2.begin(), b2.end(), t - a2[j]);

            cnt += lower_bound(b2.begin(), b2.end(), 4 * t - a2[j]) -
                    lower_bound(b2.begin(), b2.end(), 3 * t - a2[j]);
        }

        if (cnt & 1) ans |= (1 << i);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8576
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K = INT()
S = input()
if len(S) <= K:
    print(S)
else:
    print(S[:K] + "...")

Measured memory_bytes: 9980
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))

roop_count = [1] * N
roop_score = [0] * N
step_score = [[] for i in range(N)]

for i in range(N):
    start_p = i
    next_p = P[i] - 1
    roop_score[i] = C[i]
    step_score[i].append(roop_score[i])
    while start_p != next_p:
        p = next_p
        next_p = P[p] - 1
        roop_score[i] = roop_score[i] + C[p]
        roop_count[i] = roop_count[i] + 1
        step_score[i].append(roop_score[i])

max_score = [0] * N

for i in range(N):
    if K > roop_count[i] and roop_score[i] > 0:
        k = K // roop_count[i]
        e = K % roop_count[i]
        for j in range(e):
            step_score[i][j] = step_score[i][j] + roop_score[i]
        for j in range(roop_count[i]):
            step_score[i][j] = step_score[i][j] + roop_score[i] * (k - 1)
    if K >= roop_count[i]:
        max_score[i] = max(step_score[i])
    else:
        max_score[i] = max(step_score[i][:K])

print(max(max_score))

Measured memory_bytes: 280168
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
//increase stack size
#pragma comment(linker, "/STACK:16777216")

ll mxm() {return LLONG_MIN;}
template<typename... Args>
ll mxm(ll a, Args... args) { return max(a,mxm(args...)); }

ll mnm() {return LLONG_MAX;}
template<typename... Args>
ll mnm(ll a, Args... args) { return min(a,mnm(args...)); }

template<class T> ostream& operator<<(ostream& os,vector<T> V){
	os<<"[ ";for(auto v:V)os<<v<<" ";return os<<"]";
}
template<class L,class R> ostream& operator<<(ostream& os,pair<L,R> P){
	return os<<"("<<P.first<<","<<P.second<<")";
}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
template<typename Arg1>
void __f(const char* name,Arg1&& arg1){
	cout<<name<<" : "<<arg1<<endl;
}
template <typename Arg1,typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
	const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...) 1
#endif

#define ld long double
#define pll pair<ll,ll>
#define ii pair<int,int>
#define vll vector<ll>
#define vii vector<ii>
#define vi vector<int>
#define vpll vector<pll>
#define vld vector<ld>
#define vvld vector<vld>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvpll vector<vpll>
#define vvii vector<vii>
#define I insert
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x)	x.begin(),x.end()

const int mod=1e9+7;
// 128 bit: __int128
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,mod-2);}

struct compare{
	bool operator() (const int &a,const int &b) const{
		return a>b;
	}
};

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	ll a, b, n;
	cin >> a >> b >> n;
	ll x = min(b - 1, n);
	cout << (a * x) / b << endl;			
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#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()

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }

/*
参考にしたい
kshinya
https://atcoder.jp/contests/caddi2018/submissions/3853441
*/

ll n;

vector<ll> calc(vector<ll> &a) {
    vector<ll> sum(n);
    stack<ll> stack;
    ll cnt = 0;
    rep1(i,n-1){
        ll pre = a[i-1], cur = a[i];
        if (pre >= cur) {
            while (pre >= cur*4) {
                cur *= 4;
                stack.push(i);
            }
        } else {
            while (pre < cur) {
                if (stack.empty()) {
                    cnt += i*2;
                } else {
                    ll k = stack.top(); stack.pop();
                    cnt += (i-k)*2;
                }
                pre *= 4;
            }
        }
        sum[i] = cnt;
    }
    return sum;
}

int main(void){
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    if (n == 1) {
        cout << 0 << endl;
        return 0;
    }
    if (n == 2) {
        cout << ((a[0] <= a[1]) ? 0 : 1) << endl;
        return 0;
    }
    reverse(all(a));
    vector<ll> r = calc(a);
    reverse(all(r));

    reverse(all(a));
    rep(i,n) a[i] *= 2;
    vector<ll> l = calc(a);

    ll res_min = r[0];
    // debug(r[0]);
    rep1(i,n-1){
        ll res = l[i-1] + i + r[i];
        // debug(res);
        res_min = min(res_min, res);
    }
    cout << res_min << endl;

    return 0;
}


Measured memory_bytes: 4992
import collections
k = int(input())
n = 10**10

li = list(range(1,10))
num_li = li[:]
q = collections.deque(li)
count = 0

for i in range(1,n):
    num = str(q.popleft())
    go = int(num[-1])
    if go != 0:
        numa = num + str(go - 1)
        num_li.append(int(numa))
        q.append(int(numa))
        count += 1
    numa = num + str(go)
    num_li.append(int(numa))
    q.append(int(numa))
    count += 1
    if go != 9:
        numa = num + str(go + 1)
        num_li.append(int(numa))
        q.append(int(numa))
        count += 1

    if count > k+1:
        break

print(num_li[k-1])

Measured memory_bytes: 9844
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int l,r,d;
  	int count=0;
      cin>>l>>r>>d;
    for(int i=l;i<=r;i++)
      if(i%d==0)
        count++;
    cout<<count;
    return 0;
}

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

using namespace std;

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

node *root, *NIL;

void insert(int n) {
	node *y = NIL;						//今の親；とりあえずNIL
	node *x = root;						//今の位置,とりあえずroot
	node *z;							//挿入される節

//	z = (node *)malloc(sizeof(node));	//挿入節の領域確保
	z = new node;						//これでもいいじゃん

	z->key = n;							//keyは入力値
	z->left = NIL;						//left,rightは葉なのでNIL
	z->right = NIL;

	while (x != NIL) {					//なにも無い位置まで行く
		y = x;							//後で下に行くので親を自分にしておく
		if (z->key < x->key) {			//値が小さければ左に行く
			x = x->left;
		}
		else {
			x = x->right;
		}
	}

	z->parent = y;						//場所が分かったので親を設定						
	if (y == NIL) {						//親がなければｚは根
		root = z;
	}
	else {
		if (z->key < y->key) {			//親がいたら親のどっちに自分がいるか設定
			y->left = z;
		}
		else {
			y->right = z;
		}
	}
}

void inorder(node *x) {
	if (x==NIL) {
		return;
	}

	inorder(x->left);
	cout << " " << x->key;
	inorder(x->right);

}

void preorder(node *x) {
	if (x == NIL) {
		return;
	}

	cout << " " << x->key;

	preorder(x->left);
	preorder(x->right);

}

void pr() {
	inorder(root);
	cout << endl;
	preorder(root);
	cout << endl;

}

int main() {

	int m;
	cin >> m;
	string str;
	int n;
	for (int i = 0; i < m; i++) {
		cin >> str;
		if (str == "insert") {
			cin >> n;
			insert(n);
		}
		else {
			pr();
		}
	}
}


Measured memory_bytes: 26568
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  string s;
  cin>>s;
  int ans=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='*')break;
    if(s[i]=='(')ans++;
    else ans--;
  }
  cout<<ans<<endl;
  return 0;
}



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

int main()
{
  int N,K ;
  string S ;
  cin>>N>>K ;
  cin>>S ;
  
  switch(S[K-1]){
    case 'A': S[K-1]='a' ;
              break ;
    case 'B': S[K-1]='b' ;
              break ;
    case 'C': S[K-1]='c' ;
              break ;
  }
  
  cout<<S<<endl  ;
  
  return 0 ;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#define swap(a,b) ((a != b) && (a += b,b = a - b,a -= b))
using namespace std;

int gcd(int a,int b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(b,a%b);
}

int main()
{
    int ans;
    double min=99999999;

    int n,t,a,h;
    cin >> n;
    cin >> t >> a;

    for(int i=0;i<n;i++){
        cin >> h;
        double v=(a-(t-h*0.006));
        if(v<0)v=-v;
        if(min>v){min=v;ans=i;}
    }



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






Measured memory_bytes: 256
// なんかTLEなるんですが公開されているテストケースはすべて一瞬で計算してくれることを確認したので出します
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000

typedef long long ll;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

struct edge {
    int to;
    int cap;
    int rev;
    edge() {}
    edge(int t, int c, int r) : to(t), cap(c), rev(r) {}
};
const int MAX_V = 500;

vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from, int to, int cap) {
    G[from].push_back(edge(to, cap, G[to].size()));
    G[to].push_back(edge(from, 0, G[from].size()-1));
}

int dfs(int v, int t, int f) {
    if (v == t) return f;
    used[v] = true;
    for (int i = 0; i < G[v].size(); i++) {
        edge& e = G[v][i];
        if (!used[e.to] && e.cap > 0) {
            int d = dfs(e.to, t, min(f, e.cap));
            if (d > 0) {
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

int max_flow(int s, int t) {
    int flow = 0;
    for (;;) {
        for (int i = 0; i < MAX_V; i++) used[i] = false;
        int f = dfs(s, t, INF);
        if (f == 0) return flow;
        flow += f;
    }
}

int main(void) {
    int X, Y, E;
    cin >> X >> Y >> E;
    int s = X+Y, t = s+1;
    for (int i = 0; i < E; i++) {
        int x, y;
        cin >> x >> y;
        add_edge(x, y+X, 1);
    }
    for (int i = 0; i < X; i++) {
        add_edge(s, i, 1);
    }
    for (int i = 0; i < Y; i++) {
        add_edge(i+X, t, 1);
    }
    cout << max_flow(s, t) << endl;
    return 0;
}

Measured memory_bytes: 1520
#include<bits/stdc++.h>
using namespace std;
#define inf 5000
#define priMax 100
#define perMax 10
#define NMax 40

int Calc(int *a,int *b,int *c,int N,int Ma,int Mb){
    int ***sum;
    sum=new int**[N+1];
    for(int i=0;i<=N;i++)
        sum[i]=new int*[i*perMax+1];
    for(int i=0;i<=N;i++)
        for(int j=0;j<=i*perMax;j++)
            sum[i][j]=new int[i*perMax];
    for(int i=0;i<=N;i++)
        for(int j=0;j<=i*perMax;j++)
            for(int k=0;k<=i*perMax;k++)
                sum[i][j][k]=inf;

    sum[0][0][0]=0;
    for(int n=0;n<N;n++)
        for(int an=0;an<=n*perMax;an++)
            for(int bn=0;bn<=n*perMax;bn++){
                sum[n+1][an][bn] = min(sum[n][an][bn],sum[n+1][an][bn]);
                sum[n+1][an+a[n]][bn+b[n]] = min(sum[n][an][bn]+c[n],sum[n+1][an+a[n]][bn+b[n]]);
            }
    int res=inf;
    for(int an=0;an<=N*perMax;an++)
        for(int bn=0;bn<=N*perMax;bn++)
            if((an!=0||bn!=0)&&an*Mb==bn*Ma)res=min(sum[N][an][bn],res);
    if(res==inf) return -1;
    else return res;
}

int main(){
    int N,Ma,Mb;
    cin>>N;
    cin>>Ma;
    cin>>Mb;
    int a[N],b[N],c[N];
    for(int i=0;i<N;i++){
        cin>>a[i];
        cin>>b[i];
        cin>>c[i];
    }
    cout<<Calc(a,b,c,N,Ma,Mb)<<endl;
    return 0;
}

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


int main() {
  int n,k;
  int64_t cnt = 0;
  cin >> n >> k;
  if(k != 0) {
  for (int b = max(1,k); b < n+1; b++) {
    if (n%b < k) {
      cnt += (n/b) * (b-k);
    }
    else if (n%b >= k) {
      cnt += (n/b) * (b-k) + (n%b - k + 1);
    }
  }
  }
  else if (k == 0) {
    for (int b = max(1,k); b < n+1; b++) {
    if (n%b < k) {
      cnt += (n/b) * (b-k);
    }
    else if (n%b >= k) {
      cnt += (n/b) * (b-k) + (n%b - k);
    }
  }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
using namespace std;
typedef long long ll;
int main(){
	ll N,K,d,t;
	cin >> N >> K;
	vector<pair<ll, int>> P;
	for(ll i(0);i<N;++i){
		cin >> t >> d;
		P.push_back(make_pair(d,t));
	}
	sort(P.begin(),P.end());
	map<int,ll> M;
	ll sum(0), p(0), score, k(N-K);
	for(int i(N-1);i>=0;--i){
		if(i >= k){
			if(M.count(P[i].second) == 0) ++p;
			M[P[i].second]++;
			sum += P[i].first;
			score = sum + p*p;
		}else{
			if(M.count(P[i].second) == 0){
				M[P[i].second]++;
				while(k <= N-1 && M[P[k].second]==1) k++;
				if(k == N) break;
				sum = sum + P[i].first - P[k].first;
				M[P[k].second]--;
				k++;
				p = M.size();
				score = max(score, sum + p*p);
			}
		}
	}
	cout << score << endl;
	return 0;
}

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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
	int x(0), sgn(1); char ch(getchar());
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
	return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("E.in", "r", stdin);
	freopen ("E.out", "w", stdout);
#endif
}

const int N = 1e5 + 1e3;

int R, C, n;

inline bool on(int x, int y) {
	return !x || !y || x == R || y == C;
}

inline int get_val(int x, int y) {
	if (!x) return y;
	if (y == C) return C + x;
	if (x == R) return R + 2 * C - y;
	return 2 * (R + C) - x;
}

pair<int, int> p[N << 1];

int stk[N << 1], top;

int main() {

	File();

	R = read(); C = read(); n = read();
	for (int i = 1; i <= n; ++ i) {
		int xa = read(), ya = read(), xb = read(), yb = read();
		if (!on(xa, ya) || !on(xb, yb)) {
			-- i, -- n; continue;
		}
		p[i * 2 - 1] = make_pair(get_val(xa, ya), i);
		p[i * 2] = make_pair(get_val(xb, yb), i);
	}
	sort(p + 1, p + (n <<= 1) + 1);

	For (i, 1, n)
		if (stk[top] != p[i].second) stk[++ top] = p[i].second; else -- top;

	puts(top ? "NO" : "YES");

	return 0;

}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int h,w;
    cin >> h >> w;
    string c[h];
    rep(i, h){
        cin >> c[i];
        cout << c[i] << endl;
        cout << c[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
 
int main()
{
    int n, l[1000], r[1000], ans = 0;

    std::cin >> n;
    for(int i = 0;i < n;i++){
        std::cin >> l[i] >> r[i];

        ans += r[i] - l[i] + 1;
    }


    std::cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll dfs(int i,ll t,ll sum);
string s;

int main(){
  cin>>s;
  reverse(s.begin(),s.end());
  cout<<dfs(0,1,0)/2<<endl;
  return(0);
}

ll dfs(int i,ll t,ll sum){
  ll rec=0;
  if(i==s.size())return sum;
  rec+=dfs(i+1,1,sum+(s[i]-'0')*t);
  rec+=dfs(i+1,t*10,sum+(s[i]-'0')*t);
  return rec;
}


Measured memory_bytes: 256
S = input("")
a = 0
for i in range(len(S)):
    if i%2==1:
        if S[i] == 'L':
            a=a+1
        elif S[i] == 'U': 
            a = a+1
        elif S[i] == 'D':
            a = a+1
        else:
            a = 0
    elif i%2==0:
        if S[i] == 'R':
            a =a+1
        elif S[i] == 'U': 
            a = a+1
        elif S[i] == 'D':
            a = a+1
        else:
            a = 0
if len(S)==a:
    print("Yes")
else:
    print("No")

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

int main(){
  int h,w;
  cin >>h >>w;
  string board[50];
  rep(i,h) cin >>board[i];
  const int dx[8] = {1,0,-1,0,1,-1,-1,1};
  const int dy[8] = {0,1,0,-1,1,1,-1,-1};
  rep(i,h){
    rep(j,w){
      if(board[i][j]=='#') continue;
      int num = 0;
      rep(d,8){
        const int ni = i+dy[d];
        const int nj = j+dx[d];
        if(ni<0 || h<=ni) continue;
        if(nj<0 || w<=nj) continue;
        if(board[ni][nj]=='#') num++;
      }
      board[i][j] = char(num+'0');
    }
  }
  rep(i,h){
    cout << board[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
s = [ input() for _ in range(n) ]

d = {}
for ss in s:
    d[ss] = d.get(ss, 0) + 1

maxi = max(d.values())
t = list(set([ ss for ss in s if d[ss] == maxi]))
t.sort()
print("\n".join(t))

Measured memory_bytes: 45580
#include<iostream>

using namespace std;

int main() {

	int W, H, x, y, r ;

	cin >> W >> H >> x >> y >> r ;

	if (x>=0 && y>=0 && x + r > W && y + r > H  || x + r <= W && y + r > H || x + r > W && y + r <= H) {

		cout << "No" << endl;

	}
	
	else if (x >= 0 && y >= 0 && x + r <= W && y + r <= H ) {

		cout << "Yes" << endl;

	}
	else if (x < 0 && y < 0 && x - r > 0 && y - r > 0) {

		cout << "Yes" << endl;

	}
	else if (x < 0 && y < 0 && x - r <= 0 && y - r > 0 || x - r > 0 && y - r <= 0 || x - r <= W && y - r <= H) {

		cout << "No" << endl;

	}
	




	return 0;

}




Measured memory_bytes: 3100
#include<stdio.h>
#include<stdlib.h>

int asc(const void *a,const void *b){
    return *(int *)a-*(int *)b;
}

int main(){
    int N,i;
    scanf("%d",&N);
    int D[N];
    for(i=0;i<N;i++)scanf("%d",&D[i]);

    qsort(D,N,sizeof(int),asc);
    printf("%d\n",D[N/2]-D[N/2-1]);
    return 0;
}


Measured memory_bytes: 892
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cmath>
using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    s += 'R';
    vector<long> ans(n);
    char  current = 'R';
    int ch = 0;
    int lstch = 0;
    for (int i = 0; i < n+1; i++) {
        if (s[i] != current) {
            if (current == 'R') {
                ch = i - lstch;
                lstch = i;
                ans[i-1] += (ch+1)/2;
                ans[i] += ch/2;
                current = 'L';
            }
            else {
                ch = i - lstch;
                lstch = i;
                ans[i-ch] += (ch+1)/2;
                ans[i-ch-1] += ch/2;
                current = 'R';
            }
        }
    }
    for (int i = 0; i < n-1; i++) {
        cout << ans[i] << " ";
    }
    cout << ans[n-1] << endl;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n;
    cin>>n;
    ll flag=0;
    while(n>0)
    {
        if(n%10==7)
            flag=1;
        n/=10;
    }
    if(flag==1)
        cout<<"Yes";
    else
        cout<<"No";
}


Measured memory_bytes: 3584
function Main(input) {
  "use strict"
  const temp = input.split("\n")

	const nkq = temp.shift().split(" ");
  const n = parseInt(nkq[0]);
  const k = parseInt(nkq[1]);
  const q = parseInt(nkq[2]);
  const an = temp;
  
  const points = new Array(n + 1).fill(0);
  an.forEach(person => {
    points[person]++;
  });

  points.shift();
  points.forEach(point => {
    if(point > q - k) console.log("Yes");
    else console.log("No")
  })
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

struct edge {
	int from, to, cap;
	edge *rev;
	edge (int from, int to, int cap)
		: from(from), to(to), cap(cap) {}
	void flow(int u) {
		cap -= u, rev->cap += u;
	}
};

const int inf = 0x3f3f3f3f;
const int mx = 105;
int S, T;
vector<edge*> adj[mx];

void addedge(int u, int v, int c) {
	edge *e = new edge(u, v, c);
	edge *rev = new edge(v, u, 0);
	e->rev = rev, rev->rev = e;
	adj[u].push_back(e);
	adj[v].push_back(rev);
}

bool vis[mx], inq[mx];
int bt[mx], mf[mx];
edge *bte[mx];
bool augment(int &flow) {
	queue<int> q;
	fill(vis, vis + mx, 0);
	fill(inq, inq + mx, 0);
	fill(mf, mf + mx, 0);
	q.push(S);
	mf[S] = inf;
	while (!q.empty()) {
		int p = q.front(); q.pop();
		if (vis[p]) continue;
		vis[p] = true, inq[p] = false;
		for (edge *e : adj[p])
			if (!vis[e->to] && min(e->cap, mf[p]) > mf[e->to]) {
				if (!inq[e->to])
					inq[e->to] = true, q.push(e->to);
				bt[e->to] = p;
				bte[e->to] = e;
				mf[e->to] = min(e->cap, mf[p]);
			}
	}
	if (!vis[T]) return false;
	int p = T;
	flow = mf[T];
	while (p != S) {
		bte[p]->flow(flow);
		p = bt[p];
	}
	return true;
}

int maxflow() {
	int mflow = 0, flow;
	while (augment(flow))
		mflow += flow;
	return mflow;
}

int main() {
	int v, e; cin >> v >> e;
	S = 0, T = v - 1;
	for (int i = 0; i < e; i++) {
		int u, v, c; cin >> u >> v >> c;
		addedge(u, v, c);
	}
	cout << maxflow() << endl;
	return 0;
}


Measured memory_bytes: 3236