akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stdio.h>//printf("%.*f\n",*********);
#include<vector>//s.erase(n),vector
#include<algorithm>//next_permutation
#include<set>
#include<string>//char('a'=32+'A')
                //to_string,string,substr
#include<sstream>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>//min,max
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)//start==1
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)//end==1
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define Yay(ans) if(ans)cout<<"Yay!"<<rt;else cout<<":("<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(a,n) rep(i,n)cin>>a[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//昇順
#define reve(s) reverse(s.begin(),s.end())//反転
#define please return
#define AC 0
#define rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626//pi
#define nine 1000000000//10^9

using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int KETA(int n) { //Sum of Each Digit
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

unsigned ND(unsigned num) {//Number of Digits
	return std::to_string(num).length();//outmax=10
}

bool KIBN(string s) {
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i])return false;
	}
	return true;
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */


int main(void) {
	rapid_pleaseAC_fast;

	vint a(2);
	vcin(a, 2);
	int ans = 0;
	rep(i, 2) {
		if (a[i] == 3) {
			ans += 100000;
		}
		if (a[i] == 2) {
			ans += 200000;
		}
		if (a[i] == 1) {
			ans += 300000;
		}
	}
	if (a[0] == 1 && a[1] == 1) {
		ans += 400000;
	}
	cout << ans << rt;

	please AC;
}
//参考：---

Measured memory_bytes: 256
def main():
    N = int(input())
    S = input()

    l = [0]*N
    r = [0]*N
    for i in range(1, N):
        l[i] = l[i-1] + (S[i-1]=="W")
    for i in range(N-1)[::-1]:
        r[i] = r[i+1] + (S[i+1]=="E")

    
    ans = 10**6
    for a, b, in zip(l, r):
        ans = min(a+b, ans)
    print(ans)
    

if __name__ == "__main__":
    main()

Measured memory_bytes: 27040
using System;

class Program
{
	static void Main(string[] args)
	{
        int n;
        int sum = 0;

        n = int.Parse(Console.ReadLine());
		int[] a = new int[n];
        int[] b = new int[n];

        for (int i = 0;i < n;i++){

            string[] s = Console.ReadLine().Split(' ');
            a[i] = int.Parse(s[0]);
            b[i] = int.Parse(s[1]);
            sum += b[i] - a[i] + 1;

        }

        Console.WriteLine(sum);

	}
}

Measured memory_bytes: 13140
words = ("dream", "erase", "eraser", "dreamer")

s = input()

while len(s) > 0:
    match = False
    for w in words:
        if s.endswith(w):
            s = s[:-len(w)]
            match = True
            break
    if match is False:
        print("NO")
        exit()
print("YES")


Measured memory_bytes: 3188
object Main extends App {
  val Array(n, k) = io.StdIn.readLine().split(' ').map(_.toInt)
  val k2 = k*2
  val end = k2-1
  // 0 ≦ x,y ≦ 2K に圧縮
  val squares = Array.fill(k2)(Array.fill(k2)(0))
  for (i <- 1 to n) {
    val Array(x, y, color) = io.StdIn.readLine().split(' ')
    // 'W'はY方向にKずらした'B'と同値
    squares(x.toInt % k2)((y.toInt + (if (color == "B") 0 else k)) % k2) += 1
  }
  // 計算量削減のために累積和を事前算出
  for {
    i <- 0 to end
    j <- 1 to end
  } squares(i)(j) += squares(i)(j-1)
  for {
    j <- 0 to end
    i <- 1 to end
  } squares(i)(j) += squares(i-1)(j)
  var max = 0
  for {
    i <- 0 to k-1
    j <- 0 to k-1
  } {
    // ex) k = 2
    //      ■ □ □ ■ 
    //  j+k □ ■ ■ □
    //      □ ■ ■ □
    //    j ■ □ □ ■
    //      i   i+k
    val cnt =
      (squares(i)(j)) +
      (squares(end)(j) - squares(i+k)(j)) +
      (squares(i+k)(j+k) - squares(i+k)(j) - squares(i)(j+k) + squares(i)(j)) +
      (squares(i)(end) - squares(i)(j+k)) +
      (squares(end)(end) - squares(end)(j+k) - squares(i+k)(end) + squares(i+k)(j+k))
    max = Math.max(Math.max(cnt, n - cnt), max)
  }
  print(max)
}


Measured memory_bytes: 85656
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        int a=scanner.nextInt();
        int b=scanner.nextInt();
        System.out.println((n-a)%b);
    }
}


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

int main() {
  int N, T;
  cin >> N >> T;
  int t, pt = -T, X = 0;
  for (int i = 0; i < N; i++) {
    cin >> t;
    if (t < pt + T) {
      X += t - pt;
    } else {
      X += T;
    }
    pt = t;
  }
  cout << X << endl;
}

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

int main(){
	int a,b,k; cin>>a>>b>>k;
	int n=b-a+1;
	if(2*k>=n){
		for(int i=a; i<=b; i++) cout<<i<<endl;
	}else{
		for(int i=a; i<a+k; i++) cout<<i<<endl;
		for(int i=b-k+1; i<=b; i++) cout<<i<<endl;
	}
}

Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_temp>
using smaller_queue = priority_queue<Q_temp, vector<Q_temp>, greater<Q_temp>>;

const ll MOD = (ll)(1e9 + 7);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << setiosflags(ios::fixed);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << (a != c) << endl;
  return 0;
}


Measured memory_bytes: 256
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

map<ll,ll> prime;//素因数分解でそれぞれの素数がいくつ出てきたかを保存するmap

//O(√n)
//整列済み(mapはkeyで自動で整列される)
void prime_factorize(ll n){
    if(n<=1) return;
    ll l=sqrt(n);
    FOR(i,2,l){
        if(n%i==0){
        prime_factorize(i);prime_factorize(ll(n/i));return;
        }
    }
    //mapでは存在しないkeyの場合も自動で構築される
    prime[n]++;return;
}

signed main(){
    //入力の高速化用のコード
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    ll n;cin >> n;
    prime_factorize(n);
    vector<ll> num(100);
    REP(i,100){
        num[i]=i+1;
        if(i>0)num[i]+=num[i-1];
    }
    ll ans=0;
    for(auto i=prime.begin();i!=prime.end();i++){
        //cout << i->F << " " << i->S << endl;
        ans+=(ll(upper_bound(ALL(num),i->S)-num.begin()));
    }
    cout << ans << endl;
}

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

int main(){
  int n ; cin >> n ;
  int ans = 0 ;
  int dw = n+1 ;
  for(int i=0;i<n;i++){
    int x ;
    cin >> x ;
    if(dw>=x){
      ans++ ;
      dw = x ;
    }
  }
  cout << ans << endl ;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int bingo[3][3] = {{0,0,0},{0,0,0},{0,0,0}};
	int n;
	int b;
	for(int i =0; i<3; i++){
		if(scanf("%d%d%d*c", &bingo[i][0], &bingo[i][1], &bingo[i][2])==EOF){return 0;}
	}
	if(scanf("%d*c", &n)==EOF){return 0;}
	
	for(int j = 0; j<n; j++){
		if(scanf("%d*c", &b)==EOF){return 0;}
		for(int x = 0; x <3; x++){
			for(int y = 0; y <3; y++){
				if(bingo[x][y]==b){bingo[x][y]=0;break;}
			}
		}
	}

	//result
	for(int i = 0; i <3; i++){
		if(bingo[0][i]==0 && bingo[1][i]==0 && bingo[2][i]==0){printf("Yes\n");return 0;}
		if(bingo[i][0]==0 && bingo[i][1]==0 && bingo[i][2]==0){printf("Yes\n");return 0;}
	}
	if(bingo[0][0]==0 && bingo[1][1]==0 && bingo[2][2]==0){printf("Yes\n");return 0;}
	if(bingo[2][0]==0 && bingo[1][1]==0 && bingo[0][2]==0){printf("Yes\n");return 0;}
	
	printf("No\n");
	return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>

using namespace std;

using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
const int inf = 1e+9;

const ll mod = 1000000007;




int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	while(true) {
		c -= b;
		if (c <= 0) {
			cout << "Yes" << endl;
			return 0;
		}
		a -= d;
		if (a <= 0) {
			cout << "No" << endl;
			return 0;
		}
	}


	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
using namespace std;
int main() {
	int x;
	cin >> x;
	if (x%100>x/100*5) {
		cout << '0' << endl;
		return 0;
	}
	else {
		cout << '1' << endl;
		return 0;
	}
}

Measured memory_bytes: 256
<?php

$bool = true;
$prev = array();
$current = array();
$keys = array();
while (true) {
    $line = trim(fgets(STDIN));
    if ($line === '') {
        if ($bool) {
            $bool = false;
            continue;
        }
        break;
    }

    sscanf($line, '%d,%d', $n, $m);
    if (!in_array($n, $keys)) {
        $keys[] = $n;
    }

    if ($bool) {
        $prev[$n] = empty($prev[$n]) ? 1 : $prev[$n] + 1;
    } else {
        $current[$n] = empty($current[$n]) ? 1 : $current[$n] + 1;
    }
}

sort($keys);
foreach ($keys as $key) {
    if (isset($prev[$key], $current[$key])) {
        printf("%d %d\n", $key, $prev[$key] + $current[$key]);
    }
}

Measured memory_bytes: 6656
#include <iostream>
#include <vector>
#define llint long long
#define mod 1000000007

using namespace std;

llint n, m;
vector<int> G[20];
llint num[20][1<<15];
llint dp[1<<15];

int main(void)
{
	cin >> n >> m;
	llint u, v;
	for(int i = 0; i < m; i++){
		cin >> u >> v;
		u--, v--;
		G[u].push_back(v);
	}
	
	int S = 1<<n;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < S; j++){
			for(int k = 0; k < G[i].size(); k++){
				if(j & (1<<G[i][k])) num[i][j]++;
			}
		}
	}
	
	dp[0] = 1;
	for(int i = 0; i < S; i++){
		int T = (S-1)-i;
		for(int j = T; j >= 1; j=(j-1)&T){
			if((j&3) == 3) continue;
			llint tmp = dp[i];
			for(int k = 0; k < n; k++){
				if(j & (1<<k)) continue;
				if(i & (1<<k)){
					tmp *= (1<<num[k][j]), tmp %= mod;
					continue;
				}
				tmp *= (1<<num[k][j]) - 1, tmp %= mod;
			}
			dp[i|j] += tmp, dp[i|j] %= mod;
		}
	}
	cout << dp[S-1] << endl;
	
	return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> s(m);
  vector<char> c(m);
  rep(i,m) cin >> s.at(i) >> c.at(i);
  
  int st = 0;
  if (n >= 2) st = pow(10,n-1);
  int ed = pow(10,n);
  int ans = -1;
  for (int i = st; i < ed; i++) {
    string x = to_string(i);
    bool t = true;
    rep(j,m) {
      if (x.at(s.at(j)-1) != c.at(j)) t = false;
    }
    if (t) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
//第8回シンデレラガール総選挙は是非本田未央ちゃんに投票をお願いします！
//ファンのことも他のアイドルの子たちのことも本当に大事にしてて、今まで周りに色んなものを与えてくれました。
//今度は私たちが未央ちゃんにお返しをする番です。みんなでガラスの靴を履かせてあげましょう！
// #本田未央を一番星に #本田未央を令和のシンデレラガールに #第8回シンデレラガール総選挙
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
string s;
int num[200100];
int main()
{
	int n,out=200100;cin>>n;cin>>s;
	num[0]=0;
	rep(i,n){
		num[i+1]=num[i]+(s[i]=='#');
	}
	rep(i,n+1){
		out=min(out,num[i]+(n-i)-(num[n]-num[i]));
	}
	cout<<out<<endl;
}


Measured memory_bytes: 1412
#include <bits/stdc++.h>
using namespace std;
int main () {
  int n, k;
  cin >> n >> k;
  int ans = 1;
  for (int i = 0; i < n; i ++) {
    if (ans * 2 < ans + k) {
      ans *= 2;
    }
    else {
      ans += k;
    }
  }
  cout << ans << endl;
}

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

int main() {
	int n, b, f, r, v;
	int count[5][4][11] = { 0 };

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		count[b][f][r] += v;
	}

	for (int i = 1; i <= 4; i++)
		for (int j = 1; j <= 3; j++) {
			for (int k = 1; k <= 10; k++) {
				cout << ' ' << count[i][j][k];
			}
			cout << "\n";
			if (j == 3 && i != 4)
				cout << "####################\n";
		}

	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int ans[10005];

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= 100; ++i) {
        for (int j = 1; j <= 100; ++j) {
            for (int k = 1; k <= 100; ++k) {
                int tmp = i * i + j * j + k * k + i * j + j * k + k * i;
                if ( tmp <= n) {
                    ++ans[tmp];
                }
            }
        }
    }
    for (int i = 1; i <= n; ++i) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3580
//
// Created by chuta on 2020/09/19.
//

#include <bits/stdc++.h>
//#include <atcoder/all>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main() {
    //CFS;
    int n;
    cin >> n;
    ll ans = 0;
    repl(i, 1, n) {
        ans += (n-1)/i;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string sm[51];
    string sn[51];
    int m,n;
    int x = 0;
    cin >> m >> n;
    for(int i=0;i<m;i++){
        cin >> sm[i];
    }
    for(int i=0;i<n;i++){
        cin >> sn[i];
    }
    for(int i=0;i<m-n+1;i++){
        for(int j=0;j<m-n+1;j++){
            if(sn[0] == sm[i].substr(j,n)){
                x += 1;
                if(x >= n) {
                    cout << "Yes" << endl;
                    return 0;
                }
                //cout << i << j << endl ;
                for(int k=1;k<n;k++){
                    if(sn[k] == sm[k+i].substr(j,n)){
                        x += 1;
                        //cout << k << endl;
                    }
                    else if(sn[k] != sm[k+i].substr(j,n)){
                        //cout << "hazure"<< endl;
                        k = 1;
                        x = 0;
                        break;
                    }
                    if(x >= n) {
                        cout << "Yes" << endl;
                        return 0;
                    }
                }
            }
        }
    }
    //cout << "x=" <<x << endl;
    if(x == 0){
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;

long long euclidean_gcd(long long a, long long b) {
    while(1) {
        if(a < b) swap(a, b);
        if(!b) break;
        a %= b;
    }
    return a;
}

int main() {
    long long N;
    cin >> N;
    long long A[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    long long L[N];
    long long R[N];
    L[0] = A[0];
    R[N - 1] = A[N - 1];
    for(int i = 1; i < N; i++){
        L[i] = euclidean_gcd(L[i - 1],A[i]);
    }
    for(int i = N - 2; i >= 0; i--){
        R[i] = euclidean_gcd(R[i + 1],A[i]);
    }
    long long M = 0;
    for(int i = 0; i < N; i++){
        if(i == 0){
            M = max(M,R[1]);
            continue;
        }
        if(i == N - 1){
            M = max(M,L[N - 2]);
            continue;
        }
        M = max(M,euclidean_gcd(L[i - 1],R[i + 1]));
    }
    cout << M << endl;
}

Measured memory_bytes: 2560
s = input()
n = len(s)

ans = [0 for _ in range(n)]
cnt = 0
for i in range(n):
    if s[i] == 'R':
        cnt += 1
    else:
        ans[i] += cnt // 2
        ans[i-1] += (cnt + 1) // 2
        cnt = 0
cnt = 0
s_inv = ''.join(reversed(s))
for i in range(n):
    if s_inv[i] == 'L':
        cnt += 1
    else:
        ans[n-i-1] += cnt // 2
        ans[n-i] += (cnt + 1) // 2
        cnt = 0
print(' '.join(map(str, ans)))


Measured memory_bytes: 59700
import sys
s = str(input())

for i in range(len(s)//2):
    if s[i] != s[-1-i]:
        print("No")
        sys.exit()

a = int((len(s)-1)/2)
b = int(((len(s)+3)/2)-1)
s1 = s[:a]
s2 = s[b:]

for i in range(len(s1)//2):
    if s1[i] != s1[-1-i] or s2[i] != s2[-1-i]:
        print("No")
        sys.exit()

print("Yes")

Measured memory_bytes: 9148
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <iterator>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

typedef signed long long int slli;

int main()
{
  slli a, b;
  char op;
  std::cin >> a >> op >> b;
  
  std::cout << ((op == '+') ? a + b : a - b) << std::endl;
  
  return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
    int n,d,t,k;
    float f;
    scanf("%d %d",&n,&d);
    t=d*2+1;
    f=((float) n)/t;
    k=f;
    if(k<f)
    {
        k++;
    }
    printf("%d",k);
}


Measured memory_bytes: 128
// ABC058
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;
typedef long long ll;

const ll INF = 1e10;
const ll MOD = 1e9+7;



int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(b - a == c - b) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, unsigned long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

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

  ll h1,m1,h2,m2,k;
  std::cin>>h1>>m1>>h2>>m2>>k;

  std::cout<<h2*60+m2-h1*60-m1-k<<"\n"; 

  return 0;
}

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

const int _ = 1e5 + 7;
int N , nxt[_] , du[_] , pre; set < int > in;
set < pair < int , int > > mxdu;
void erase(int t){in.erase(t); mxdu.erase(make_pair(du[t] , t));}

int main(){
	cin >> N; for(int i = 1 ; i <= N ; ++i){cin >> nxt[i]; ++du[nxt[i]];}
	if(N == 2){puts("-1"); return 0;}
	for(int i = 1 ; i <= N ; ++i){in.insert(i); mxdu.insert(make_pair(du[i] , i));}
	for(int i = 1 ; i <= N - 3 ; ++i){
		if((--mxdu.end())->first == N - i) erase(pre = (--mxdu.end())->second);
		else{
			auto t = in.begin(); if(nxt[pre] == *t) ++t;
			erase(pre = *t); --du[nxt[pre]];
			if(in.find(nxt[pre]) != in.end()){
				mxdu.erase(make_pair(du[nxt[pre]] + 1 , nxt[pre]));
				mxdu.insert(make_pair(du[nxt[pre]] , nxt[pre]));
			}
		}
		printf("%d " , pre);
	}
	int arr[3]; auto t = in.begin(); for(int i = 0 ; i < 3 ; ++i , ++t) arr[i] = *t;
	do{
		if(nxt[pre] != arr[0] && nxt[arr[0]] != arr[1] && nxt[arr[1]] != arr[2]){
			for(int i = 0 ; i < 3 ; ++i) printf("%d " , arr[i]);
			return 0;
		}
	}while(next_permutation(arr , arr + 3));
	return 0;
}


Measured memory_bytes: 11008
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
using namespace std;
#define mod 1000000007;

int main (void){
	long long int n,a[100001],i,costo=0,coste=0,sumo[100001],sume[100001];
	sumo[0]=0;
	sume[0]=0;
	cin >> n;
	for(i=1;i<=n;i++) {
		cin >> a[i];
		sumo[i]=sumo[i-1]+a[i];
		sume[i]=sume[i-1]+a[i];
		if(i%2==1){
			if(sume[i]>=0) {
				coste+=sume[i]+1;
				sume[i]=-1;
			}
			if(sumo[i]<=0) {
				costo+=1-sumo[i];
				sumo[i]=1;
			}
		} else {
			if(sumo[i]>=0) {
				costo+=sumo[i]+1;
				sumo[i]=-1;
			}
			if(sume[i]<=0) {
				coste+=1-sume[i];
				sume[i]=1;
			}
		}
	}
	if(costo>=coste) cout << coste << endl;
	else cout << costo << endl;
	return 0;
}

Measured memory_bytes: 2560
n=int(input())
arr=list(map(str,input().split()))
count=0
if arr.count('P')!=0:
  count+=1
if arr.count('Y')!=0:
  count+=1
if arr.count('W')!=0:
  count+=1
if arr.count('G')!=0:
  count+=1
if count==3:
  print('Three')
if count==4:
  print('Four')

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

int main() {
  int N, L;
  cin >> N >> L;
  
  int ans = (L + (L + N - 1)) * N / 2;
  if (L > 0) {
    ans -= L;
  } else if (L + N - 1 < 0) {
    ans -= L + N - 1;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define N 100005

typedef struct pro {
  char name[10];
  int time;
} Pro;

Pro P[N];
int head,tail,n;

void enqueue(Pro p){
  P[tail] = p;
  tail = (tail + 1) % N;
}

Pro dequeue(){
  Pro p = P[head];
  head = (head + 1) % N;
  return p;
}

int min(int k,int l){return k < l ? k : l;}

int main(){
  int pt = 0,t;
  int i,q;
  Pro p;
  scanf("%d %d",&n,&q);

  for(i=1;i<=n;i++){
    scanf("%s",P[i].name);
    scanf("%d",&P[i].time);
  }
  head = 1;
  tail = n+1;

  while(head != tail){
    p = dequeue();
    t = min(q,p.time);
    p.time -= t;
    pt += t;
    if(p.time > 0) enqueue(p);
    else{
      printf("%s %d\n",p.name,pt);
    }
  }

  return 0;
}
    
  
  



Measured memory_bytes: 3264
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

#include <bits/stdc++.h>

using namespace std;

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

	int n;
	cin >> n;
	vector<int> tako(n);
	rep(i, n) cin >> tako[i];
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			ans += tako[i] * tako[j];
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define pi pair<int, int>
#define MAXN 200005
using namespace std;
using namespace __gnu_pbds;

ll n, m, dp[1005][1005], vis[1005][1005], ch, dh, cw, dw;
char s[1005][1005];
ll r[] = {1, -1, 0, 0, -2, -2, -2, -2, -2, -1, -1, -1, -1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0};
ll c[] = {0, 0, 1, -1, -2, -1, 0, 1, 2, -2, -1, 1, 2, -2, -1, 1, 2, -2, -1, 0, 1, 2, -2, 2};

bool check(ll x, ll y)
{
    if (x == 0 || y == 0 || x == n + 1 || y == m + 1)
        return 0;
    else
        return 1;
}

void bfs(ll x1, ll y1)
{
    deque<pi> q;
    q.push_back(mp(x1, y1));
    while (!q.empty())
    {
        pi p = q.front();
        q.pop_front();
        int x = p.ff, y = p.ss;
        vis[x][y] = 1;
        for (ll i = 0; i < 24; i++)
        {
            if (check(x + r[i], y + c[i]) && s[x + r[i]][y + c[i]] == '.' && !vis[x + r[i]][y + c[i]])
            {
                if (i < 4)
                {
                    dp[x + r[i]][y + c[i]] = min(dp[x + r[i]][y + c[i]], dp[x][y]);
                    q.push_front(mp(x + r[i], y + c[i]));
                }
                else
                {
                    dp[x + r[i]][y + c[i]] = min(dp[x + r[i]][y + c[i]], dp[x][y] + 1);
                    q.push_back(mp(x + r[i], y + c[i]));
                }
            }
        }
    }
}

void solve()
{
    cin >> n >> m;
    cin >> ch >> cw;
    cin >> dh >> dw;
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = 1; j <= m; j++)
        {
            dp[i][j] = INT_MAX;
            cin >> s[i][j];
        }
    }
    dp[ch][cw] = 0;
    bfs(ch, cw);
    // for (ll i = 1; i <= n; i++)
    // {
    //     for (ll j = 1; j <= m; j++)
    //         cout << dp[i][j] << " ";
    //     cout << endl;
    // }
    if (dp[dh][dw] == INT_MAX)
        cout << -1 << endl;
    else
        cout << dp[dh][dw] << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
}


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

int main(){
  int d;
  cin>>d;
  if(d==22){
    cout<<"Christmas Eve Eve Eve"<<endl;
  }
  else if(d==23){
    cout<<"Christmas Eve Eve"<<endl;
  }
  else if(d==24){
    cout<<"Christmas Eve"<<endl;
  }
  else{
    cout<<"Christmas"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>

using namespace std;

int main()
{
    set<string> s;
    string t;
    int n;
    
    cin >> n;
    for (int i = 0;i < n;i++){
        cin >> t;
        s.insert(t);
    }
    cout << s.size() << endl;
}


Measured memory_bytes: 19060
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000000
#define MAX 200001

const ll MOD = 1000000007;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

using mint = Fp<MOD>;

int main(){
    vector<int> cnt(4,0);
    rep(i,3){
        int a,b;
        cin >> a >> b;
        a--;b--;
        cnt[a]++;cnt[b]++;
    }   
    int flag = 1;
    rep(i,4){
        if(cnt[i] <= 2) continue;
        flag = 0;
    }
    if(flag) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;

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

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
  lint lcm(lint a,lint b){
      return a/__gcd(a,b)*b;
  }

  int main(){
        lint N;
        char s;
        cin>>s;
        s+=1;
        cout<<s;
        
  }
  

Measured memory_bytes: 256
var
	N,B,C:int64;
	A:Longint;
begin
	read(N);
	if N mod 2=0 then begin
		writeln(N,' ',N,' ',N div 2);
		exit;
	end else if N mod 3=0 then begin
		writeln(N*2,' ',N*2,' ',N div 3);
		exit;
	end;
	for A:=3*N div 4 downto 1 do begin
		B:=2*N*A div(4*A-N);
		while 4*A*B>N*(A+B)do begin
			if N*A*B mod(4*A*B-N*(A+B))=0 then begin
				writeln(A,' ',B,' ',N*A*B div(4*A*B-N*(A+B)));
				exit;
			end;
			dec(B);
		end;
	end;
end.

Measured memory_bytes: 128
use std::io::stdin;

fn main() {
    let mut x = String::new();
    stdin().read_line(&mut x).unwrap();
    let x: Vec<isize> = x.trim().split_whitespace().flat_map(str::parse).collect();
    let (n, l) = (x[0], x[1]);

    let mut tastes: Vec<(isize, isize)> = (1..n+1)
        .map(|i| l + i - 1)
        .map(|i| (if i < 0 { -i } else { i }, i))
        .collect();
    tastes.sort();
    println!("{}", tastes.into_iter().skip(1).map(|(_, i)| i).sum::<isize>());
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (decltype(end) i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (decltype(end) i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (decltype(beg) i = beg; end <= i; i--)
#define REP(n)              for (decltype(n) repeat_index = 0; repeat_index < n; repeat_index++)

#include <atcoder/all>

using namespace std;

bool bmap[51][51];

int idx(int i, int j, int n)
{
	return j * n + i;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int64_t kBig = 10000;

	int n, m; cin >> n >> m;
	int s = n * m;
	int t = n * m + 1;
	atcoder::mcf_graph<int, int64_t> mcf(n * m + 2);
	FOR_LT(i, 0, n) {
		FOR_LT(j, 0, m) {
			int k = idx(i, j, n);
			int64_t cost = kBig * (m - j - 1 + n - i - 1);
			mcf.add_edge(k, t, 1, cost);
		}
	}

	int64_t maxv = 0;
	int cc = 0;
	FOR_LT(i, 0, n) {
		FOR_LT(j, 0, m) {
			char c; cin >> c;
			if (c == 'o') {
				mcf.add_edge(s, idx(i, j, n), 1, 0);
				int64_t cost = kBig * (m - j - 1 + n - i - 1);
				maxv += cost;
				cc++;
			}
			if (c == '#') {
				bmap[i][j] = true;
			}
		}
	}

	FOR_LT(i, 0, n) {
		FOR_LT(j, 0, m) {
			if (bmap[i][j]) continue;
			if (i + 1 < n && !bmap[i + 1][j]) {
				mcf.add_edge(idx(i, j, n), idx(i + 1, j, n), kBig, kBig - 1);
			}
			if (j + 1 < m && !bmap[i][j + 1]) {
				mcf.add_edge(idx(i, j, n), idx(i, j + 1, n), kBig, kBig - 1);
			}
		}
	}
	auto ans = mcf.flow(s, t, cc);
	cout << maxv - ans.second << endl;

	/*
	auto es = mcf.edges();
	int fmap[51][51] = {};
	for (auto& e : es) {
		if (e.to == t && e.flow == 1) {
			fmap[e.from % n][e.from / n] = 1;
		}
	}

	FOR_LT(i, 0, n) {
		FOR_LT(j, 0, m) {
			if (bmap[i][j]) {
				cout << "#";
			}
			else if (fmap[i][j]) {
				cout << "o";
			}
			else {
				cout << ".";
			}
		}
		cout << endl;
	}

	*/
	return 0;
}

Measured memory_bytes: 4332
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1000000007;
const int nmax=1000010;
ll fac[nmax],finv[nmax],inv[nmax];

void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<nmax;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;
  }
}
ll com(int n,int k){
  if(n<k||n<0||k<0){
    return 0;
  }
  return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}

int main(){
  COMinit();
  ll n,m;
  cin >> n >> m;
  vector<ll> a;
  ll num=m;
  ll ans=1;
  for(int i=2;i<=m;i++){
    int cnt=0;
    if(num%i==0){
      while(num%i==0){
        cnt++;
        num/=i;
      }
      ans*=com(cnt+n-1,cnt);
      ans%=mod;
    }
    if(num==1){
      break;
    }
  }
  cout << ans << endl;
}

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



int main(){
   int n;
   cin >> n;
   vector<int> x(n);
   rep(i,n) cin >> x[i];
   vector<int> y = x;
   int a,b;
   sort(y.begin(),y.end());
   a = y[n/2-1];
   b = y[n/2];
   rep(i,n){
       if(x[i]<=a) cout << b << endl;
       else cout << a << endl;
   }
}

Measured memory_bytes: 3712
n = int(input())
s = list(map(int, input().split()))

s.sort()

a = [s[-1]]
b = s[:-1]

for i in range(n):
    a2 = []
    b2 = []
    for x in a:
        while b:
            y = b.pop()
            if x>y:
                a2.append(y)
                break
            else:
                b2.append(y)
    a = a + a2
    b = b + b2
    a.sort()
    a.reverse()
    b.sort()
    if len(a)!=2**(i+1):
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 120768
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
a, b, c  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

li = sorted([a, b, c])
print(sum(li[:2]))


Measured memory_bytes: 3316
#include <stdio.h>
int main()
{
int a, b, c, i;
int syou, amari, kosuu = 0;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
for (i = a; i <= b; i++)
{
syou = c /i;
amari = c - i * syou;
if (amari == 0)
kosuu++;
}
printf("%d\n", kosuu);
return 0;
}

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

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

  int ans = 0;
  int z;
  for (int x=0; x<=K; x++) {
    for (int y=0; y<=K; y++) {
      z = S - x - y;
      if (z <= K && z >= 0) ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

const int maxN = 100011;

int n, m, i, x, y, ans;
int p[maxN];
vector<int> list[maxN];
bool us[maxN];
vector<int> aux;

void dfs(int node) {
    us[node] = true;
    aux.pb(node);
    aux.pb(p[node]);
    for (auto e : list[node])
        if (!us[e])
            dfs(e);
}

int main()
{
   // freopen("test.in","r",stdin);
    
    cin >> n >> m;
    for (i = 1; i <= n; i++) cin >> p[i];
    for (i = 1; i <= m; i++) {
        cin >> x >> y;
        list[x].pb(y);
        list[y].pb(x);
    }

    for (i = 1; i <= n; i++) {
        if (us[i]) continue;
        aux.clear();
        dfs(i);

        int bef = aux.size();

        sort(aux.begin(), aux.end());
        aux.resize(unique(aux.begin(), aux.end()) - aux.begin());
        int aft = aux.size();
    

        ans += bef - aft;
    }

    cout << ans;




    return 0;
}


Measured memory_bytes: 10360
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000000000000ll
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
//#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a, b, c;
  cin >> a >> b >> c;
  REP(i,b){if(i*a%b==c){
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <limits>
#include <numeric>
#include <type_traits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <climits>

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

ll gcd(ll a, ll b) { //gcdを返す
	if(a == 0){
		return b;
	} else if (b == 0){
		return a;
	} else {
	  if(a < b) return gcd(b, a);
	  ll r;
	  while ((r=a%b)) {
	    a = b;
	    b = r;
	  }
	  return b;
	}
}
ll ketasum(ll n) { //桁の数字全ての和を返す 例: 112 -> 4
	ll sum=0;
	if (n<0) return 0;
	while (n>0) {
		sum += n%10;
		n /= 10;
	}
	return sum;
}

typedef pair<ll, ll> pair_t;

bool comp(const pair_t &a, const pair_t &b) {
        return a.first < b.first;
}

void sort2vectors(vector<ll> &av, vector<ll> &bv)
{ // ふたつの配列をまとめてそーと A[2,1] B[3,4] -> 1,4 2,3
        ll n = av.size();
        vector<pair_t> p(n);
        vector<ll> av2(n), bv2(n);
        for (ll i = 0; i < n; i++)
                p[i] = make_pair(av[i], bv[i]);
        sort(p.begin(), p.end(), comp);
        for (ll i = 0; i < n; i++) {
                av2[i] = p[i].first;
                bv2[i] = p[i].second;
        }
        av = av2;
        bv = bv2;
}
ll facctorialMethod(ll k){ //階乗
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}


int main(){
	ll N;
	cin >> N;
	vl a(N);
	REP(i, N){
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	cout << a[N-1] - a[0] << endl;
}

Measured memory_bytes: 256
list = []
while True:
    try:
        list = input().strip().split()
        if list[1] == "?":
            break
        a, op, b = int(list[0]), list[1], int(list[2])
        if op == "+":
            print(a + b)
        elif op == "-":
            print(a - b)
        elif op == "*":
            print(a * b)
        elif op == "/":
            print(a // b)
    except:
        break



Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    int A, B, C; cin >> A >> B >> C;
    int K; cin >> K;
    bool flag = false;
    while (K) {
        if (A < B && B < C) {
            flag = true;
            break;
        }
        if (A >= B) {
            B*=2;
            K--;
        }
        else if (B >= C) {
            C*=2;
            K--;
        }
    }
    if (A < B && B < C) flag = true;
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3624