akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pt;

bool cmp(pt a, pt b) {
  if (a.second == b.second) return a.first > b.first;
  return a.second > b.second;
}


int main() {

  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);

  vector<pt> reds;
  vector<pt> blues;

  int N; cin >> N;
  for (int i = 0; i < N; i++) {
    int a,b; cin >> a >> b;
    reds.push_back(make_pair(a,b));
  }
  for (int i = 0; i < N; i++) {
    int c,d; cin >> c >> d;
    blues.push_back(make_pair(c,d));
  }

  sort(reds.begin(), reds.end(), cmp);
  sort(blues.begin(), blues.end());
    
  int ans = 0;
  vector<bool> used(N);
  for (int i = 0; i < N; i++) {
    pt B = blues[i];
    for (int j = 0; j < N; j++) {
      pt R = reds[j];
      if (R.first < B.first && R.second < B.second && !used[j]) {
	used[j] = true;
	ans++;
	break;
      }
    }
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

int n;
string s;
cin >> n >> s;

vi sl(n+1), sr(n+1);
rep(i,n) {
    if(s[i] == '#') sl[i+1] = sl[i] + 1;
    else sl[i+1] = sl[i];
}
drep(i,n) {
    if(s[i] == '.') sr[i] = sr[i+1] + 1;
    else sr[i] = sr[i+1];
}
int ans = INF;
rep(i,n+1) {
    chmin(ans, sl[i] + sr[i]);
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 2196
// inputに入力データ全体が入る
// @ts-ignore
const main = (input: string) => {
  const [h, w] = input.split(' ').map(v=>Number(v));

  if (h === 1 || w === 1) {
    console.log(1);
    return;
  }
  console.log(Math.round(h*w/2));
}

// *この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
aparts = {
    '1': [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
    '2': [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
    '3': [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
    '4': [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
}

# n = 3
# arr = [
#     '1 1 3 8',
#     '3 2 2 7',
#     '4 3 8 1 ']
n = int(input())
for i in range(n):
    # b, f, r, v = arr[i].split()
    b, f, r, v = input().split()
    aparts[b][int(f)-1][int(r)-1] += int(v)

for key, values in aparts.items():
    for value in values:
        print(' '+' '.join(list(map(str, value))))
    if key != '4':
        print(f'{"#"*20}')



Measured memory_bytes: 5632
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  string S, T;
  cin >> S >> T;
  if (S.size() + 1 != T.size()) {
    cout << "No" << endl;
    return 0;
  }
  REP(i, 0, S.size()) {
    if (S[i] != T[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define NN 1000007
bool is_prime[NN];
std::vector<int>primes;
int gcd(int a, int b){	
	return !a?b: gcd(b % a, a);
}
void sieve() {
	for (int x = 2; x < NN; x++) {
		if (!is_prime[x]) {
			primes.push_back(x);
			for (int z = x + x; z < NN; z += x) {
				is_prime[z] = 1;
			}
		}
	}
}
std::set<int> factors(int number){
	std::set<int>fa;
	int q = 0;
	int f = primes[q];
	while (f * f <= number) {
		while (number % f == 0) {
			fa.insert(f);
			number /= f;
		}
		f = primes[++q];
	}
	if (number != 1)fa.insert(number);

	return fa;
}
int main() {
	sieve();
	int num; std::cin >> num;
	std::vector<int>arr;
	for (int x = 0; x < num; x++) {
		int l; std::cin >> l;
		arr.push_back(l);
	}
	std::map<int, int>mp;
	for (auto x : arr) {
		std::set<int>st = factors(x);
		for (auto z : st) mp[z]++;
	}
	bool tr = true;
	for (auto x : mp) {
		if (x.second > 1) { tr = false; break; }
	}
	if (tr) {
		std::cout << "pairwise coprime";
		return 0;
	}
	int secondPlane = arr[0];
	for (int x = 1; x < num; x++) {
		secondPlane = gcd(secondPlane, arr[x]);
	}
	if (secondPlane == 1)std::cout << "setwise coprime";
	else {
		std::cout << "not coprime";
	}


}



Measured memory_bytes: 12032
n,goukei = map(int, input().split())
flg = 0
xmax = goukei // 10000
for x in range(0,xmax+1):
  if flg == 1:
    break
  ymax = (goukei-x*10000) // 5000
  for y in range(0, ymax+1):
    ztmp = goukei - (x*10000)- (y*5000)
    if ztmp % 1000 == 0:
      z = ztmp // 1000
      sumxyz = x+y+z
      if sumxyz == n:
        flg = 1
        xx = x
        yy = y
        zz = z
        break
if flg == 0:
  print(-1,-1,-1)
else:
  print(xx,yy,zz)

Measured memory_bytes: 40684
#include <iostream>

using namespace std;

const int MAX = 1000000;
const int MOD = 1000000007;

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;
}

int main(){
    long long X, Y;
    cin >> X >> Y;
    if((2*X-Y)%3 != 0 || (2*Y-X)%3 != 0){
        cout << 0 << endl;
        return 0;
    }
    long long p, q, ans;
    p = (2*X-Y)/3;
    q = (2*Y-X)/3;

    COMinit();
    ans = COM(p+q, q);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 23680
B,W = map(int,input().split())
A,V = map(int,input().split())
T = int(input())
if A < B:
    if A-V*T >= B-W*T:
        print('YES')
    else:
        print('NO')
elif A > B:
    if A+V*T <= B+W*T:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 9180
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

const int mod = 1e9 + 7;
const int MX = 5001;
int n, way[MX];
vector<vi> e;

vector<vi> rec(int c, int p){
	vector<vi> dp(2, vi(2));
	dp[0][1] = 1;
	
	for(int i : e[c]) if(i != p){
		vector<vi> dp2 = rec(i, c);
		
		vector<vi> next(2, vi(dp[0].size() + dp2[0].size() - 1));
		rep(a, 2) rep(b, 2) rep(j, dp[0].size()) rep(k, dp2[0].size()){
			
			ll x = (ll)dp[a][j] * dp2[b][k] % mod;
			//ふさぐ
			(next[(a + b + 1) % 2][j] += x * way[k] % mod) %= mod;
			
			//ふさがない
			(next[(a + b) % 2][j + k] += x) %= mod;
		}
		
		dp = next;
	}
	return dp;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	for(int i = 2; i < MX; i += 2){
		way[i] = 1;
		for(int j = i - 1; j > 0; j -= 2) way[i] = way[i] * (ll)j % mod;
	}
	
	cin >> n;
	e.resize(n);
	rep(i, n - 1){
		int a, b; cin >> a >> b; a--; b--;
		e[a].pb(b);
		e[b].pb(a);
	}
	vector<vi> dp = rec(0, 0);
	ll ans = 0;
	rep(i, 2) rep(j, dp[0].size()){
		ans += (ll)(i ? -1 : 1) * dp[i][j] * way[j] % mod;
	}
	ans = (mod + ans % mod) % mod;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1920
#include <iostream>

using namespace std;

#define MAX 1000000

int main(){
  int n;
  bool p[MAX];
  p[0] = p[1] = false;
  for(int i=2;i<MAX;i++)p[i] = true;
  for(int i=2; i<MAX;i++){
	if(p[i]){
	  for(int j=i+i;j<MAX;j=j+i){
		p[j] = false;
	  }
	}
  }
  
  while(cin >> n){
	int cnt = 0;
	for(int i = 0;i<=n;i++){
	  if(p[i]) cnt++;
	}
	cout << cnt << endl;
  }
  
  return 0;
}

Measured memory_bytes: 2132
#include <iostream>
#include <algorithm>
#include <set>
#define int long long
using namespace std;
void print(int p) {
	if (p < 100000) {
		cout << '0';
		if (p < 10000) {
			cout << '0';
			if (p < 1000) {
				cout << '0';
				if (p < 100) {
					cout << '0';
					if (p < 10) {
						cout << '0';
					}
				}
			}
		}
	}
	cout << p; return;
}
int n, m;
set<pair<int,int>> s[114514];//y,i
set<int>s1;
int p[114514], ans[114514];
signed main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int y; cin >> p[i] >> y;
		s[p[i]].insert(make_pair(y, i));
		s1.insert(p[i]);
	}
	for (auto i = s1.begin(); i != s1.end(); i++) {
		int cnt = 1;
		for (auto j = s[*i].begin(); j != s[*i].end(); j++) {
			ans[(*j).second] = cnt++;
		}
	}
	for (int i = 0; i < m; i++) {
		print(p[i]);
		print(ans[i]);
		cout << endl;
	}
}

Measured memory_bytes: 19712
#include <iostream>

int main()
{
	// 数字Nを読み込む。
	int N = 0;
	std::cin >> N;

	// 計算する。計算方法を変える。任意のn∈[1, N]についてN以下のnの倍数を調べ、等差数列の和を調べる。
	long long answer = 0;

	for (int index = 1; index <= N; ++index)
	{
		long long n = N / index;
		answer += n * (n + 1) * index / 2;
	}

	// 答えを出力する。
	std::cout << answer << std::endl;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define INF 0x3f3f3f3f
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define MAXN 100009
int dp[MAXN], h[MAXN];

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int n, k;
    cin >> n >> k;
    rep(i, 1, n + 1)
        cin >> h[i];
    dp[1] = 0;
    rep(i, 2, k + 1){
        int menor = INF;
        rep(j, 1, i)
            menor = min(menor, dp[i - j] + abs(h[i] - h[i - j]));
        dp[i] = menor;
    }
    rep (i, k + 1, n + 1){
        int menor = INF;
        rep(j, 1, k + 1)
            menor = min(menor, dp[i - j] + abs(h[i] - h[i - j]));
        dp[i] = menor;
    }
   
    cout << dp[n] << '\n';
    return 0;   
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC omodtimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<long long ,long long> ii; 	
typedef complex<long double> com;
 
const ll mod = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string temp;
	cin >> temp;
	deque <char> s;
	for (int z=0;z<temp.size();z++){
		s.push_back(temp[z]);
	}
	ll q;
	cin >> q;
	bool start = true;
	for (int z=0;z<q;z++){
		ll t;
		cin >> t;
		if (t == 1) start = !start;
		else {
			ll f;
			cin >> f;
			char c; cin >> c;
			if (f == 1 && start) s.push_front(c);
			if (f == 1 && !start) s.push_back(c);
			if (f == 2 && start) s.push_back(c);
			if (f == 2 && !start) s.push_front(c);
		} 
	}
	string ans = "";
	for (char tt : s){
		ans += tt;
	}
	if (start) cout << ans << endl;
	else {
		reverse(ans.begin(),ans.end());
		cout << ans << endl;
	}
}


Measured memory_bytes: 1368
n, m = gets.chomp.split(" ").map(&:to_i)
e1 = []
e2 = []

m.times do
    a, b = gets.chomp.split.map(&:to_i)
    e1 << b if a == 1
    e1 << a if b == 1
    e2 << b if a == n
    e2 << a if b == n
end

e1.sort!
e2.sort!
i = 0
j = 0

while i < e1.size && j < e2.size
    if e1[i] == e2[j]
        puts "POSSIBLE"
        exit
    end

    if e1[i] < e2[j]
        i += 1
    else
        j += 1
    end
end

puts "IMPOSSIBLE"


Measured memory_bytes: 4600
#include <bits/stdc++.h>
#define REP(i, a, b) for (int i = (a); i < (b); ++i)

using namespace std;
using ll = long long;

static const int M = 2000;

bool ab[100000];
bool ac[100000];
bool bc[100000];

bool match (char x, char y) {
  return (x == '?' || y == '?' || x == y);
}

/**
 * main
 */
int main () {
  string a; cin >> a;
  string b; cin >> b;
  string c; cin >> c;

  int la = int(a.length());
  int lb = int(b.length());
  int lc = int(c.length());

  REP(i, 0, la)
    REP(j, 0,lb)
      if (!match(a[i], b[j]))
        ab[i - j + 50000] = true;

  REP(i, 0, la)
    REP(j, 0,lc)
      if (!match(a[i], c[j]))
        ac[i - j + 50000] = true;

  REP(i, 0, lb)
    REP(j, 0,lc)
      if (!match(b[i], c[j]))
        bc[i - j + 50000] = true;

  int ans = 3 * M;

  for (int i = -2 * M; i <= 2 * M; i++) {
    for (int j = -2 * M; j <= 2 * M; j++) {
      if (!(ab[i + 50000] || ac[j + 50000] || bc[j - i + 50000])) {
        int L = min(0, min(i, j));
        int R = max(la, max(lb + i, lc + j));

        ans = min(ans, R - L);
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define INF 10000000000

ll a, b, c, n, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF;
string s;

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

    cin >> s >> n;
    vector<string> substring;
    rep(i, min((ll)s.length(), n)){
        rep(j, s.length() - i){
            substring.push_back(s.substr(j, i + 1));
        }
    }

    sort(all(substring));
    unique(all(substring));
    cout << substring[n - 1] << endl;
}


Measured memory_bytes: 1660
import sys

n = int(input())

div_max = 0
div = 1

for i in range(1,n+1):
    cnt = 0
    num = i
    while num%2==0:
        num = num/2
        cnt += 1
    
    if div_max < cnt:
        div_max = cnt
        div = i

print("{}".format(div))

Measured memory_bytes: 3060
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

int main(int argc, char* argv[])
{
    while( 1 ) {
        int h,w;
        scanf("%d%d", &h, &w);
        if(h==0 && w==0) break;
        int i,j;
        for(i=0; i<h; i++) {
            for(j=0; j<w; j++) {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2580
import math
a,b,x=map(int,input().split())
v = a * b
x = x / a
if x < v/2:
    c = x * 2 / b
    print(math.degrees(math.atan(b/c)))
else:
    rest = v - x
    c = rest * 2 / a
    print(math.degrees(math.atan(c/a)))

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

public class Main{

	
	static int MOD=(int)1e9+7;
	static int n;
	static int []memo;
	static boolean [][]a;
	static int dp(int idx,int msk) {
		if(idx==n)
			return 1;
		if(memo[msk]!=-1)
			return memo[msk];
		int ans=0;
		for(int i=0;i<n;i++)
			if(a[idx][i] && ((msk & (1<<i)) ==0))
			{
				ans=ans+dp(idx+1,msk|1<<i);
				if(ans>=MOD)
					ans-=MOD;
			}
		return memo[msk]=ans;
	}
	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner();
		PrintWriter out=new PrintWriter(System.out);
		n=sc.nextInt();
		a=new boolean[n][n];
		memo=new int [1<<n];
		Arrays.fill(memo, -1);
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++)
				a[i][j]=sc.nextInt()==1;
		out.println(dp(0, 0));
			
		out.close();
	}
	
	static class Scanner
	{
		BufferedReader br;
		StringTokenizer st;
		Scanner(){
			br=new BufferedReader(new InputStreamReader(System.in));
		}
		Scanner(String fileName) throws FileNotFoundException{
			br=new BufferedReader(new FileReader(fileName));
		}
		String next() throws IOException {
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		String nextLine() throws IOException {
			return br.readLine();
		}
		int nextInt() throws IOException{
			return Integer.parseInt(next());
		}
		long nextLong()  throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}
		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
	}
}


Measured memory_bytes: 31572
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>



int main() {
	ll a, b;
	cin >> a >> b;
	if (a > b)swap(a, b);
	REP(i, b)cout << a;
	cout <<endl;
}


Measured memory_bytes: 256
N = int(input())
red = []
blue = []
memo = [0]*N
ans = 0

for i in range(N):
  a,b = map(int, input().split())
  red.append((a,b))
  
for i in range(N):
  c,d = map(int, input().split())
  blue.append((c,d))
  
blue.sort()
red.sort(key=lambda x:x[1],reverse=True)

for i in range(N):
  bx,by = blue[i]
  for j in range(N):
    rx,ry = red[j]
    if memo[j] == 0 and rx<=bx and ry<=by:
      memo[j] = 1
      ans += 1
      break
print(ans)

Measured memory_bytes: 3064
import math
def countYakusu(n):
  count = 0
  for i in range(n):
    if n % (i+1) == 0:
      count = count + 1
#      print(n,i+1)
#  if count == 8: print(n)
  return count == 8

N = int(input())
count = 0
for i in range(math.ceil(N/2)):
  count = count + countYakusu(i*2+1)
#  print(i*2+1)
print(count)


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

using  namespace  std;

#define PI              acos(-1.0)
#define lcm(a,b)        (a * (b / __gcd(a,b)))
#define en '\n'

#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif

typedef long long int           ll;
typedef unsigned long long int  llu;


int main(void)
{
    //READ_IN

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

  int n; cin >> n;

  string s;

  cin >> s;

    bool bol = false;

  for(int i=0;i<s.size()-1;i++)
  {
      string s1,s2;

      for(int j=0;j<=i;j++)
      {
          s1.push_back(s[j]);
      }
      for(int j=i+1;j<s.size();j++)
      {
          s2.push_back(s[j]);
      }

     if(s1==s2)
     {
         bol = true;
         break;
     }
  }
  if(bol)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const ll maxn = 2e5 + 100;
ll arr[maxn], pre[maxn];

int main(){
    int n;
    while (~scanf("%d", &n)) {
        pre[0] = 0;
        for (int i = 1; i <= n; i++) {
            scanf("%d", &arr[i]);
            pre[i] = (pre[i - 1] + arr[i]) % mod;
        }
        ll ans = 0;
        for (int i = 1; i < n; i++) {
            ans = (ans + arr[i] * ((pre[n] - pre[i] + mod) % mod) % mod) % mod;
        }
        printf("%lld\n", ans);
    }


    return 0;
}

Measured memory_bytes: 6928
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char[] c = s.toCharArray();
        int tmp = 0;
        int ans = 0;
        for (int i = 0; i < c.length; i++) {
            if (c[i] == 'A' || c[i] == 'C' || c[i] == 'G' || c[i] == 'T') {
                tmp++;
            } else {
                if (ans > tmp) {
                    tmp = 0;
                } else {
                    ans = tmp;
                    tmp = 0;
                }
            }
        }
        if (tmp > ans) {
            System.out.println(tmp);
        } else {
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
using namespace std;

int N, C, K;
int main() {
    while (cin >> N >> C >> K) {
        vector<int> A(N); for (int i = 0; i < N; ++i) cin >> A[i];
        sort(A.begin(), A.end());
        long long prev = A[0];
        int num = 1;
        int res = 0;
        for (int i = 1; i < N; ++i) {
            if (A[i] - prev > K || num >= C) {
                ++res;
                prev = A[i];
                num = 1;
            }
            else ++num;
        }
        if (num) ++res;
        cout << res << endl;
    }
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t1,t2,a1,a2,b1,b2;
int main()
{
    scanf("%lld%lld%lld%lld%lld%lld",&t1,&t2,&a1,&a2,&b1,&b2);
    ll p=(a1-b1)*t1,q=(a2-b2)*t2;
    if(p>0) p*=-1,q*=-1;
    if(p+q<0){cout<<0;return 0;}
    if(p+q==0){cout<<"infinity";return 0;}
    ll k=-p/(p+q);
    k*=2;
    if(-p%(p+q)) k++;
    printf("%lld\n",k);
}


Measured memory_bytes: 256
using System;

namespace ITP1_9
{
    class Program
    {
        static void Main()
        {
            var w = Console.ReadLine();
            int c = 0;
            for(;;)
            {
                var t = Console.ReadLine();
                if (t == "END_OF_TEXT") break;
                foreach(var u in t.ToLower().Split())
                    if (w == u) c++;
            }
            Console.Write("{0}\n", c);
        }
    }
}

Measured memory_bytes: 9236
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, M = LI()
    G = [[] for _ in range(N)]
    for _ in range(M):
        a, b = LI_()
        G[a].append(b)
        G[b].append(a)

    ans = [0]
    visited = [False] * N
    def dfs(c, depth):
        visited[c] = True
        if depth == N - 1:
            ans[0] += 1
        else:
            for n in G[c]:
                if not visited[n]:
                    dfs(n, depth + 1)
                    visited[n] = False

    dfs(0, 0)

    print(ans[0])

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10052
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(void)
{
	string a, b, c; cin >> a >> b >> c;
	char aa = toupper(a[0]);
	char bb = toupper(b[0]);
	char cc = toupper(c[0]);
	cout << aa << bb << cc << endl;
}


Measured memory_bytes: 256
#include<iostream>
int main()
{
  int n;
  int q;
  int s[10000]={0};
  int t[500]={0};
  int cnt=0;
  int i,j;
	
  std::cin>>n;
  for(i=0;i<n;i++){
    std::cin>>s[i];
  }
	
  std::cin>>q;
  for(i=0;i<q;i++){
    std::cin>>t[i];
  }

  for(i=0;i<q;i++){
    for(j=0;j<n;j++){
      if(s[j]==t[i]){
	cnt++;
	break;
      }
    }
  }
  std::cout<<cnt<<'\n';
  return 0;
}



Measured memory_bytes: 3136
#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 main(){
    int d;
    cin >> d;
    if(d == 25) cout << "Christmas" << endl;
    if(d == 24) cout << "Christmas Eve" << endl;
    if(d == 23) cout << "Christmas Eve Eve" << endl;
    if(d == 22) cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 3540
n = int(input())
A = input().split()

A = [int(i) for i in A]
A.sort()
re = A[0]

for i in range(1,n):
	if re > 1000000000000000000:
		re = -1
		break
	if re == 0:
		break
	re = re*A[i]

if re > 1000000000000000000:
	re = -1
print(re)

Measured memory_bytes: 21656
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,to=b;i<to;++i)
using namespace std;
typedef long long ll;

int uf0[200005];
int uf1[200005];

int fnd(int *uf, int x){
	if(uf[x]<0)return x;
	return uf[x]=fnd(uf,uf[x]);
}

void join(int *uf, int x, int y){
	x=fnd(uf,x);y=fnd(uf,y);
	if(x==y)return;
	if(uf[x]>uf[y])swap(x,y);
	uf[x]+=uf[y];
	uf[y]=x;
}

int n,m0,m1;
map<pair<int,int>,int> c;

int main(){
	scanf("%d%d%d",&n,&m0,&m1);
	memset(uf0,-1,sizeof(uf0));
	memset(uf1,-1,sizeof(uf1));
	while(m0--){
		int x,y;
		scanf("%d%d",&x,&y);x--;y--;
		join(uf0,x,y);
	}
	while(m1--){
		int x,y;
		scanf("%d%d",&x,&y);x--;y--;
		join(uf1,x,y);
	}
	fore(i,0,n)c[mp(fnd(uf0,i),fnd(uf1,i))]++;
	fore(i,0,n){
		if(i)putchar(' ');
		printf("%d",c[mp(fnd(uf0,i),fnd(uf1,i))]);
	}
	puts("");
	return 0;
}



Measured memory_bytes: 13696
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   
int a[212345];
int main(){
    std::ios::sync_with_stdio(false);
	int n,i;
	cin>>n;
	f(i,1,n+1){
		cin>>a[i];
	}     
	if(n%2){
		for(i=n;i>0;i-=2){
			cout<<a[i]<<" ";
		}
		for(i=2;i<=n;i+=2){
			cout<<a[i]<<" ";
		}
		return 0;
	}
	else{
		for(i=n;i>0;i-=2){
			cout<<a[i]<<" ";
		}
		for(i=1;i<=n;i+=2){
			cout<<a[i]<<" ";
		}
		return 0;
	}
    
}



Measured memory_bytes: 2944
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/numeric/interval.hpp>
#include <boost/numeric/interval/io.hpp>
#include <boost/any.hpp>
using namespace::std;
namespace mp = boost::multiprecision;
typedef mp::number<mp::cpp_dec_float<32,int64_t>> cfloat;
typedef mp::cpp_int cint;
typedef long long lint;
typedef long long ll;
typedef long double ldouble;
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<double> dvec;
typedef vector<vector<double>> dmat;
typedef vector<vector<vector<double>>> dmat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
typedef vector<vector<vector<string>>> smat3;
typedef vector<pair<lint,lint>> pvec;
typedef vector<vector<pair<lint,lint>>> pmat;
typedef vector<vector<vector<pair<lint,lint>>>> pmat3;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
#define irep(i) for(lint i = 0;; i++)
#define irep1(i) for(lint i = 1;; i++)
#define irep2(i) for(lint i = 2;; i++)
#define rrep(i, n) for(lint i = (lint)(n-1); i >-1; i--)
#define rrepi(i,a,b) for(lint i = (lint)(b-1); i >a-1; i--)
#define repi(i,a,b) for(lint i=lint(a);i<lint(b);i++)
#define rep2(i,a,b,c) for(lint i=lint(a);i>lint(b);i+=c)
#define all(x) (x).begin(),(x).end()
#define PI 3.141592653589793
#define cout (cout<<fixed<<setprecision(15))
#define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5))
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<"\n";}while(0)
#define output2(v) for(auto i:v)output(i);
#define input(a,n) lint n;cin>>n;vector<lint>a(n);rep(i,n)cin>>a[i];
#define sum(v) accumulate(all(v),0LL)
#define INF (1LL<<60)
#define IINF (1<<30)
#define LINF 9223372036854775807
#define MOD 1000000007
vector<lint> dx={-1,1,0,0,1,1,-1,-1};
vector<lint> dy={0,0,-1,1,1,-1,1,-1};
inline lint gcd(lint a,lint b){return b?gcd(b,a%b):a;}
inline lint lcm(lint a,lint b){return a*b/gcd(a,b);}
int main(){
    lint n,q;
    cin>>n>>q;
    vec a(n),b(n),p(q),x(q);
    rep(i,n-1)cin>>a[i]>>b[i];
    rep(i,n-1)a[i]--;
    rep(i,n-1)b[i]--;
    rep(i,q)cin>>p[i]>>x[i];
    rep(i,q)p[i]--;
    mat v(n,vec{});
    rep(i,n-1){
        v[a[i]].push_back(b[i]);
        v[b[i]].push_back(a[i]);
    }
    vec cnt(n,0);
    rep(i,q)cnt[p[i]]+=x[i];
    stack<pair<lint,lint>> s;
    s.push(make_pair(-1,0));
    while(!s.empty()){
        auto d=s.top();
        if(d.first!=-1)cnt[d.second]+=cnt[d.first];
        s.pop();
        for(lint to:v[d.second]){
            if(to==d.first)continue;
            else s.push(make_pair(d.second,to));
        }
    }
    output(cnt);
}

Measured memory_bytes: 25840
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "-1") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n, m;
  cin >> n >> m;
  vll a(m);
  rep(i, m){
    cin >> a[i];
  }
  ll s = accumulate(ALL(a), 0ll);
  if(n-s < 0){
    Pr(0);
  }
  print(n-s);
}


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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && b == c){
        cout << 1 << endl;
    }
    else if (a == b || b == c || c == a){
        cout << 2 << endl;
    }
    else{
        cout << 3 << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define N 10000
main(){
  int i,j,n,c[N],count=0,yaku;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d",&c[i]);
  }
  for(i = 0; i < n; i++){
    yaku = 0;
    if(c[i] == 2)count++;
    else if(c[i]%2 == 0)continue;
    else if(c[i]%2 != 0){
      for(j = 3; j <= sqrt(c[i]); j += 2){
	if(c[i]%j == 0){
	  yaku = 1;
	  break;
	}
      }
      if(yaku == 0)count++;
    }
  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 628
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using P = pair<int,int>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvd = vector<vector<double>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int INF =1001001001;

int main()
{
   int n;
   cin >> n;
   vector<double> p(n);
   rep(i,n) cin >> p[i];

   //dp[i][j] i番目までで　j枚表になる確率
   vvd dp(n+1,vector<double>(n+1,0.0));
   dp[0][0] = 1.0;

   for(int i = 0; i < n ; i++)
   {
      for(int j = 0; j <=i; j++)
      {
         //i番目が裏(jはそのまま)
         dp[i+1][j] += dp[i][j] * (1.0-p[i]);
         //i番目が表(jも増える)
         dp[i+1][j+1] += dp[i][j] *p[i];
      }
   }
   // rep(i,n+1)
   // {
   //    rep(j,n+1) cout << dp[i][j] << " ";
   //    cout << endl;
   // }

   double ans = 0.0;
   //半分以上の確率をタス
   for(int i = n/2+1; i <= n; i++) ans += dp[n][i];
   printf("%.10lf\n",ans);
}


Measured memory_bytes: 70656
# -*- coding: utf-8 -*-
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys

def s():
    return raw_input().strip()
def n():
    return int(raw_input())
def d():
    return float(raw_input())

def ls():
    return raw_input().strip().split()
def ln():
    return map(int, raw_input().strip().split())
def ld():
    return map(float, raw_input().strip().split())

def fs():
    return [raw_input().strip() for i in xrange(input())]
def fn():
    return [int(raw_input().strip()) for i in xrange(input())]
def fd():
    return [float(raw_input().strip()) for i in xrange(input())]

a, b = ln()

if a == 0 or b == 0 or a < 0 < b:
    print 'Zero'
elif 0 < a:
    print 'Positive'
elif b < 0:
    diff = (b - a) + 1
    if diff % 2 == 0:
        print 'Positive'
    else:
        print 'Negative'


Measured memory_bytes: 4768
import sys

# S = input()
# N, M = map(int, input().split())
# nums = list(map(int, input().split()))
# nums_2d = [list(map(int, input().split())) for _ in range(N)]


def main():
    S = input()

    if S[2] == S[3] and S[4]==S[5]:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define inf (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outpossible(bool_val) cout << (bool_val ? "possible" : "impossible") << endl;
#define outpossible(bool_val) cout << (bool_val ? "possible" : "impossible") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    string a, x, c;
    cin >> a >> x >> c;

    cout << "A" << x[0] << "C" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<deque>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define lld long long

int main(){
    deque<char> deq;
    string str;
    cin >> str;
    for(int i=0;i<str.size();i++){
        deq.push_back(str[i]);
    }
    int now_front = 0;
    int Q,T,F;
    char C;
    cin >> Q;
    for(int i=0;i<Q;i++){
        cin >> T;
        if(T == 1) {
            now_front = (now_front+1)%2;
        } else if(T == 2) {
            cin >> F >> C;
            if(F == 1){
                if(now_front == 0) deq.push_front(C);
                else deq.push_back(C);
            } else {
                if(now_front == 0) deq.push_back(C);
                else deq.push_front(C);
            }
        }
    }
    if(now_front == 0){
        while(deq.size() != 0){
            cout << deq.front();
            deq.pop_front();
        }
    } else if(now_front == 1){
        while(deq.size() != 0){
            cout << deq.back();
            deq.pop_back();
        }
    }
    cout << endl;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define dame {cout<< "No" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N; cin>>N;
    vector<ll> A(N);
    rep(i,N) cin>>A[i];
    SORT(A);
    vector<P> ans;
    ll ct=0;
    ans.emplace_back(A[N-1],A[0]);
    ll now=A[N-1]-A[0];
    reps(i,1,N-1){
        if(A[i]>=0) break;
        ans.emplace_back(now,A[i]);
        ++ct;
        now=now-A[i];
    }
    swap(ans[ct].first,ans[ct].second);
    now=-now;
    repr(i,N-2,1){
        if(A[i]<0) break;
        ans.emplace_back(now,A[i]);
        ++ct;
        now=now-A[i];
    }
    swap(ans[ct].first,ans[ct].second);
    now=-now;

    cout<< now <<"\n";

    for(auto x: ans){
        cout<< x.first <<" "<< x.second <<"\n";
    }

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


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

int main()
{
	int A, B;
	cin >> A >> B;

	int ans = 0, i = 0;
	string str;
	bool bCheck = true;

	while (bCheck) {
		if (A + i > B)
		{
			bCheck = false;
		}
		str = to_string(A + i);
		if (str[0] == str[4] && str[1] == str[3])
		{
			break;
		}
		i++;
	}

	while (bCheck) {
		if (A + i > B)
		{
			break;
		}
		ans++;
		str = to_string(A + i);
		if (str[0] == str[4] && str[1] == str[3] && str[1] == '9' && str[2] == '9')
		{
			i += 11;
		}
		else if (str[0] == str[4] && str[1] == str[3] && str[2] == '9')
		{
			i += 110;
		}
		else if (str[0] == str[4] && str[1] == str[3])
		{
			i += 100;
		}
	}

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

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    string h = "hi", s;
    cin >> s;
    string target = "";
    rep(i, 5) {
        target += h;
        if (s.compare(target) == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const long long INF = 1LL << 60;
using namespace std;

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;
}

int main()
{
  ll a, b, k;
  cin >> a >> b >> k;
  if (a >= k)
  {
    cout << a - k << " " << b << endl;
  }
  else
  {
    cout << 0 << " " << max(0LL, b - (k - a)) << endl;
  }
  return 0;
}


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

typedef long long ll;
const ll MOD = 1000000007;

bool prime(ll x) {
    ll i;
    if (x == 1) {
        return false;
    } else {
        for (i = 2; i <= sqrt(x); i++) {
            if (x % i == 0) {
                return false;
            }
        }
        return true;
    }
}

int main() {
    ll n;
    ll cnt = 0;
    ll ans = 1;
    cin >> n;

    if (n == 1) {
        cout << 1 << endl;
        return 0;
    }

    for (int i = 2; i <= n; i++) {
        if (prime(i)) {
            ll k = 1;
            cnt = 0;
            while (pow(i, k) <= n) {
                cnt += n / pow(i, k);
                k++;
            }
            ans  = (ans * (cnt+1)) % MOD;
        }
    }
    cout << ans % MOD << endl;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(){
   int n, c=0; cin>>n;
   int ar[n];
   for (int i=0; i<n; i++){
        cin>>ar[i];
        if (ar[i]%2==1 && (i+1)%2==1) c++;
   }
   cout<<c;
}

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

ll dp[3001][3001][3];//dp[i][j]：縦i横jの時の組み合わせk =
const ll MOD = 998244353;



int main()
{
	
	ll a,b,c,d;
	cin >> a >> b >> c >> d;
	for(int i = 1;i<=a;i++)
	{
		for(int j = 1;j<=b;j++)
		{
			dp[i][j][0] = 1;
		}
	}
	for(int i = 1;i<=c;i++)
	{
		for(int j = 1;j<=d;j++)
		{
			if(i<=a&&j<=b)continue;
			else if(i== a&&j>b)
			{
				//cout<<i<<j<<endl;
				(dp[i][j][1] += dp[i][j-1][1]*i)%=MOD;
				(dp[i][j][1] += dp[i][j-1][0]*i)%=MOD;
			}
			else if(j==b&&i>a)
			{
				//cout<<i<<j<<endl;
				//(dp[i][j][1] += dp[i-1][j][1]*j)%=MOD;
				//(dp[i][j][1] += dp[i-1][j][0]*j)%=MOD;
				(dp[i][j][0] += dp[i-1][j][0]*(j-1))%=MOD;
				(dp[i][j][1] += dp[i-1][j][0])%=MOD;
				(dp[i][j][1] += dp[i-1][j][1]*(j-1))%=MOD;
				(dp[i][j][2] += dp[i-1][j][1])%=MOD;
				(dp[i][j][2] += dp[i-1][j][2]*j)%=MOD;

			}
			else if(i>a&&j>b)
			{
				(dp[i][j][1] += dp[i][j-1][0]*i)%=MOD;
				(dp[i][j][1] += dp[i][j-1][1]*i)%=MOD;
				(dp[i][j][1] += dp[i][j-1][2]*i)%=MOD;

				(dp[i][j][0] += dp[i-1][j][0]*(j-1))%=MOD;
				//(dp[i][j][1] += dp[i-1][j][0])%=MOD;
				//(dp[i][j][1] += dp[i-1][j][1]*(j-1))%=MOD;
				(dp[i][j][2] += dp[i-1][j][1])%=MOD;
				(dp[i][j][2] += dp[i-1][j][2]*j)%=MOD;
			}
		}
	}
	/*
	for(int i =1;i<=c;i++)
	{
		for(int j = 1;j<=d;j++)
		{
			cout<<'[';
			for(int k = 0;k<3;k++)
			{
				if(k)cout<<' ';
				cout<<dp[i][j][k];
			}
			cout<<']';
		}
		cout<<endl;
	}
	*/
	cout<<(dp[c][d][0]+dp[c][d][1]+dp[c][d][2])%MOD<<endl;
}



Measured memory_bytes: 214592