akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
#include<string.h>
#include<sstream>
#include<limits.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long int ll;
typedef vector<int> vi;

//最大公約数
int gcd(int a,int b){
    return b ? gcd(b,a%b):a;
}

//最小公倍数
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

//素数判定
bool isPrime(int x){
    if(x<2)return 0;
    else if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i+=2){
        if(x%i==0)return 0;
    }
    return 1;
}

//桁ごとの足し算
int digsum(int n){
    int res=0;
    while(n>0){
        res+=n%10;
        n/=10;
    }
    return res;
}

//約数列挙
vector<int> enum_div(int n){
    vector<int> ret;
    for(int i=1;i*i<=n;++i){
        if(n%i==0){
            ret.push_back(i);
            if(i*i !=n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}

//累乗の計算とあまり,0で累乗そのまま出力
long long modpow(long long a,long long n,long long mod){
    if(mod==0)mod=__LONG_LONG_MAX__;
    long long res=1;
    while(n>0){
        if(n & 1)res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}

int N;
int main(){
    cin>>N;
    for(int i=1;i<=N;++i){
        int ans=0;
        int x=1;
        int y=1;
        int z=1;
        while(1){
            int result=x*x + y*y + z*z + x*y + y*z + z*x;
            if(result == i)ans++;
            else if(result>i) break;
            x++;
            y++;
            z++;
        }
        x=1;
        y=1;
        z=1;
        while(1){
            while(1){
                int result=x*x + y*y + z*z + x*y + y*z + z*x;
                if(result == i && x!=z)ans+=3;
                else if(result>i) break;
                z++;
            }
            z=1;
            int result=x*x + y*y + z*z + x*y + y*z + z*x;
            if(result>i) break;
            x++;
            y++;
        }
        x=1;
        y=2;
        z=3;
        while(1){
            while(1){
                while(1){
                    int result=x*x + y*y + z*z + x*y + y*z + z*x;
                    if(result == i)ans+=6;
                    else if(result>i) break;
                    z++;
                }
                y++;
                z=y+1;
                int result=x*x + y*y + z*z + x*y + y*z + z*x;
                if(result>i) break;
            }
            x++;
            y=x+1;
            z=y+1;
            int result=x*x + y*y + z*z + x*y + y*z + z*x;
            if(result>i) break;
        }
        cout<<ans<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 3532
#include<bits/stdc++.h>
#include<iostream>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<int,ll>Pil;
typedef pair<int,Pil>Piil;
typedef pair<P1,ll> P2;
typedef pair<string,string> Ps;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	int x,y,sx,sy,cost;
};

int main() {

	int x;
	cin>>x;
	if(x>=30)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
bool custom1 (pair<int, int> a, pair<int, int> b) {
  return (a.first < b.first);
}
bool custom2(pair<int, int> a, pair<int, int> b) {
  return (a.second < b.second);
}

const int MAX = 200005;
const long long MOD = 1000000007;
const long long MODMOD = 998244353;

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

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

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

int main() {
  ll n;
  cin >> n;
  ll ans = 0LL;
  for(ll i=1;i<=sqrt(n);i++) {
    if(n % i == 0 && n / i > i + 1) ans += n / i - 1;
  }
  cout << ans << endl;
}  



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[4];
int main()
{
	int n,i;
	char b[10];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",b);
		if(strcmp(b,"AC")==0)
		a[0]++;
		if(strcmp(b,"WA")==0)
		a[1]++;
		if(strcmp(b,"TLE")==0)
		a[2]++;
		if(strcmp(b,"RE")==0)
		a[3]++;
	}
	printf("AC x %d\n",a[0]);
	printf("WA x %d\n",a[1]);
	printf("TLE x %d\n",a[2]);
	printf("RE x %d\n",a[3]);
	return 0;
} 

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

int main(){
  int n;
  string s;
  int x;
  int y;
  cin>>n>>s;
  
  for (int i;i<s.size();i++){
    x=s[i]-'A'+26+n;
    if (x>=26){
      y=x % 26;
      char ans ='A'+y;
      cout<<ans;
    }
  }
}
      

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

void mark(vector<int>& ans, vector<vector<int>>& graph, set<int> rooms) {
  set<int> next_rooms;
  for (auto room : rooms) {
    auto vec = graph.at(room);
    for (int v : vec) {
      if (ans.at(v) == 0 && v != 1) {
        ans.at(v) = room;
        next_rooms.insert(v);
      }
    }
  }
  if (next_rooms.size() > 0) mark(ans, graph, next_rooms);
}

int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> graph(N + 1, vector<int>(0));
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    graph.at(a).push_back(b);
    graph.at(b).push_back(a);
  }

  vector<int> ans_vec(N + 1, 0);

  set<int> first_rooms;
  first_rooms.insert(1);
  mark(ans_vec, graph, first_rooms);

  ans_vec.erase(ans_vec.begin());
  ans_vec.erase(ans_vec.begin());
  for (auto a : ans_vec) {
    if (a == 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  for (auto a : ans_vec) {
    cout << a << endl;
  }
}


Measured memory_bytes: 41704
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  ll n, k;
  cin >> n >> k;
  cout << min(n % k, abs(n % k - k)) << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt, sum int

func main() {
	reader.Split(bufio.ScanWords)
	N, _ := strconv.Atoi(read())
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i], _ = strconv.Atoi(read())
	}
	for i := N - 1; 0 <= i; i-- {
		if i%2 == 0 {
			sum += A[i]
		} else {
			sum -= A[i]
		}
	}
	t := sum
	fmt.Printf("%d ", sum)
	for i := 0; i < N-1; i++ {
		ans = 2*A[i] - t
		t = ans
		if i == N-2 {
			fmt.Printf("%d\n", ans)
		} else {
			fmt.Printf("%d ", ans)
		}
	}
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; 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
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy []int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i] > a[j] }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


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

int main() {
	string S;
	cin >> S;
	
	string Q = S;
	reverse(Q.begin(), Q.end());
	string W = S.substr(0, (S.size() - 1) / 2);
	string E = S.substr((S.size() + 3) / 2 - 1, S.size());

	if (Q == S && W == E) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define N 1001
char x[N],y[N];
void LCSLength()
{
  int m,n,i,j,c[N][N];
  m = strlen(x);
  n = strlen(y);
  for(i=1; i<=m; i++) c[i][0] = 0;
  for(j=1; j<=n; j++) c[0][j] = 0;
  for(i=1; i<=m; i++) {
    for(j=1; j<=n; j++) {
      if(x[i-1] == y[j-1]) c[i][j] = c[i-1][j-1] + 1;
      else if(c[i-1][j] >= c[i][j-1]) c[i][j] = c[i-1][j];
      else c[i][j] = c[i][j-1];
    }
  }
  printf("%d\n",c[m][n]);
}

int main()
{
  int n,i;
  scanf("%d",&n);
  for(i=0; i<n; i++) {
    scanf("%s%s",x,y);
    LCSLength();
  }
  return 0;
}

Measured memory_bytes: 4512
#include <stdio.h>

int main(void)
{
  int i,sum;
  char num[1001];
  for(;;){
    scanf("%s", &num);
    if(num[0] == '0') break;
    sum = 0;
    for(i=0;num[i]!='\0';i++)
      sum += num[i] - '0';
    printf("%d\n", sum);
  }
  return 0;
}



Measured memory_bytes: 2044
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int64_t N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  int64_t Y = B - A;
  rep(i, N + 1) {
    int64_t minY = C * (N - 1 - i) - D * i;
    int64_t maxY = -C * i + D * (N - 1 - i);
    if (minY <= Y && Y <= maxY) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 3648
<?php
/**
 * 標準出力　1行
 */
// 標準入力からの入力値を変数に代入します
$single_line_input = fgets(STDIN);
// 取得した入力値を半角スペースで分解します
$array = explode(" ", $single_line_input );
// 単一行の入力の場合はこれだけで各入力値が配列の要素として使えます


$num_sheep = $array[0];
$num_wolf = $array[1];

if((int)$num_wolf >= (int)$num_sheep){
    print('unsafe');
}else{
    print('safe');
}

Measured memory_bytes: 16116
#define TEST_MODE true

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;             \
                                   c > 0 ? i < b : i > b; \
                                   i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long

#ifdef LOCAL_ENV

#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << endl
#else
const bool test = false;
#define dump(x) 
#endif

#else
const bool test = false;
#define dump(x) 
#endif

int dx[] = { 1, 0, -1, 0 };
int dy[] = { 0, 1, 0, -1 };
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }

//.....................
const int MAX = (int)2e5 + 5;

vector<string> split(const string &str, char sep)
{
	vector<string> v;
	stringstream ss(str);
	string buffer;
	while (getline(ss, buffer, sep))
	{
		v.push_back(buffer);
	}
	return v;
}

template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
	return accumulate(begin, end, 0ll);
}

template<typename T>
T gcd(T a, T b)
{
	T c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}

class Solver {
public:
	int R;

	void solve() {
		cin >> R;
		string res = "AGC";
		if (R < 2800) res = "ARC";
		if (R < 1200) res = "ABC";
		cout << res << endl;
	}

};

signed main()
{
	srand((unsigned int)time(NULL));
	cout << fixed << setprecision(20);
	auto ptr = new Solver();
	ptr->solve();
	delete ptr;
	//while (true) {
	//	if (cin.eof() == true) break;
	//	auto ptr = new Solver();
	//	ptr->solve();
	//	delete ptr;
	//}
	return 0;
}

// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;

// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;

// #define cin mycin
// #define cout mycout
// #define endl '\n'

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		String[] s = saori.nextHayami().split("");
		int r = 0;
		int b = 0;
		for(int i = 0;i < s.length;i++){
			if(s[i].equals("R")){
				r++;
			} else {
				b++;
			}
		}
		if(r > b){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 19668
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
#define SIZE 200005
#define INF 1000000000000000LL
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
int main()
{
  int a,b;
  scanf("%d%d",&a,&b);
  if(b%a==0)printf("%d",a+b);
  else printf("%d",b-a);
  return 0;
}

Measured memory_bytes: 128
def downA(C):
    C[C.index("#")]="A"

def downB(C):
    for i in range(n,0,-1):
        if C[i]=="#" and C[i-1]!="A" and C[i+1]!="A":
            C[i]="B"
            return
    C[C.index("#")]="B"

def downC(C):
    if set(C[1:-1])==set(['#']):
        C[n/2+1]="C"
        return
    for i in range(1,n+1):
        if C[i]!="#":
            if C[i+1]=="#":
                C[i+1]="C"
                return
            elif C[i-1]=="#":
                C[i-1]="C"
                return

def getDist(p):
    l,r=0,0
    while C[p+l-1]=="#":l-=1
    if C[p+l-1]=="X":l=-100000
    while C[p+r+1]=="#":r+=1
    if C[p+r+1]=="X":r=100000
    return min(-1*l,r)

def downD(C):
    if set(C[1:-1])==set(["#"]):
        C[1]="D"
        return
    md=-1
    for i in range(1,n+1):
        if C[i]!="#":continue
        d=getDist(i)
        if (d>md):
            md=d
            mi=i
    C[mi]="D"

while True:
    n,m=map(int,raw_input().split())
    if n==m==0:break
    C=["X"]+["#"]*n+["X"]
    for i in range(m):
        p=raw_input()
        if p=="A":downA(C)
        elif p=="B":downB(C)
        elif p=="C":downC(C)
        elif p=="D":downD(C)
    print "".join(C[1:-1])

Measured memory_bytes: 4336
h,w,a,b=map(int,input().split())
mod=10**9+7
f=[1]
for i in range(h+w):
  f.append(f[i]*(i+1)%mod)
def comb(a,b,mod):
  return f[a] * pow(f[b], mod-2, mod) * pow(f[a-b], mod-2, mod) % mod
ans=0
for i in range(b,w):
  ans+= comb(h-a+i-1, i, mod) * comb(a+w-i-2, a-1, mod) % mod
print(ans%mod)

Measured memory_bytes: 11028
#include<stdio.h>
int main(void)
{
	double n;
	int s,x[20],i;
	while(1){
		scanf("%lf",&n);
		if(n<0) break;
		s=((int)16*n);
		if(n*16-((double)s)!=0){
			printf("NA\n");
			continue;
		}
		for(i=0;i<12;i++) x[i]=0;
		for(i=0;i<12;i++){
			if(s%2==1) x[i]=1;
			else x[i]=0;
			s/=2;
			// printf("%d\n",s);
		}
		// printf("%d\n",cnt);
		if(s==0){
			for(i=11;i>=4;i--) printf("%d",x[i]);
			printf(".");
			for(i=3;i>=0;i--) printf("%d",x[i]);
			printf("\n");
		}
		else printf("NA\n");
	}
	return 0;
}

Measured memory_bytes: 2692
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,a,b,c,d,pay,payback,x,y,z,w,f,g,h,j,counter=0;

signed main(){
  while(cin >> n && n!=0){
    cin >> a >> b >> c >> d;
    pay=0,f=0,g=0,h=0,j=0;
    if(counter!=0) cout << endl;
    counter++;
    /*for(int i=0;i<a;i++){
      if(pay>=n) break;
      pay+=10;
      f++;
    }
    for(int i=0;i<b;i++){
      if(pay>=n) break;
      pay+=50;
      g++;
    }
    for(int i=0;i<c;i++){
      if(pay>=n) break;
      pay+=100;
      h++;
    }
    for(int i=0;i<d;i++){
      if(pay>=n) break;
      pay+=500;
      j++;
    }*/
    pay=a*10+b*50+c*100+d*500;
    payback=pay-n;
    //cout << payback << endl;
    x=payback/500;
    payback-=x*500;
    y=payback/100;
    payback-=y*100;
    z=payback/50;
    payback-=z*50;
    w=payback/10;
    //payback-=w*10;
    if(a-w>0) cout << "10" << " " << a-w << endl;
    if(b-z>0) cout << "50" << " " << b-z << endl;
    if(c-y>0) cout << "100" << " " << c-y << endl;
    if(d-x>0) cout << "500" << " " << d-x << endl;

  }
  return 0;
}



Measured memory_bytes: 3004
#include <bits/stdc++.h>
#pragma once
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////

char b[26];
signed main(){
  string s,t;cin>>s>>t;
  rep(i,26)b[i] = '#';
  rep(i,s.length()){
    if(b[s[i]-'a'] == '#'){
      b[s[i]-'a'] = t[i];
    }else if(b[s[i]-'a'] != t[i]){
      cout << "No" << endl;return 0;
    }
  }
  rep(i,26)b[i] = '#';
  rep(i,s.length()){
    if(b[t[i]-'a'] == '#'){
      b[t[i]-'a'] = s[i];
    }else if(b[t[i]-'a'] != s[i]){
      cout << "No" << endl;return 0;
    }
  }

  cout << "Yes" << endl;
}


Measured memory_bytes: 776
using System;
class program
{
    static void Main(string[] args)
    {
        args = Console.ReadLine().Split(' ');
        int a = int.Parse(args[0]);
        int b = int.Parse(args[1]);

        if (a == 1)
        {
            a = 14;
        }
        if (b == 1)
        {
            b = 14;
        }

        if (a > b)
        {
            Console.WriteLine("Alice");
        }
        else if (a < b)
        {
            Console.WriteLine("Bob");
        }
        else
        {
            Console.WriteLine("Draw");
        }
    }
}

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

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

  if (A >= K) {
    cout << A - K << " " << B << endl;
  } else if (A < K && B >= K - A) {
    cout << 0 << " " << B - (K - A) << endl;
  } else if (A < K && B < K - A) {
    cout << 0 << " " << 0 << endl;
  }
}


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

int main() {
  // input
  string S, T;
  cin >> S >> T;
  
  // judge
  for (int i = 0; i < S.size(); i++) {
    if (S == T) {
      cout << "Yes" << endl;
      return 0;
    }
    S.insert(0, S.substr(S.size() - 1));
    S.pop_back();
  }
  
  // NO
  cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	k = min(k, 300);
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	for(int j = 0; j < k; j++){
		vector<int> b(n + 1);
		int sum = 0;
		for(int i = 0; i < n; i++){
			int l = max(i - a[i], 0);
			b[l]++;
			int r = min(i + a[i] + 1, n);
			b[r]--;
		}
		for(int i = 1; i < n; i++) b[i] += b[i - 1];
		a = b;
	}
	for(int i = 0; i < n; i++) cout << a[i] << ' ';
	return 0;
}


Measured memory_bytes: 5576
#include<iostream>
using namespace std;
#define MAX 500000
int cnt = 0;
int L[MAX / 2+1], R[MAX / 2+1];
int A[MAX];
void merge(int A[], int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;
	for (int i = 0; i < n1; i++)L[i] = A[left + i];
	for (int i = 0; i < n2; i++)R[i] = A[mid + i];
	L[n1] = R[n2] = 1000000001;
	int i = 0, j = 0;
	for (int k = left; k < right; k++) {
		cnt++;
		if (L[i] <= R[j]) {
			A[k] = L[i++];
		}
		else {
			A[k] = R[j++];
		}
	}
	return;
}
void mergeSort(int A[], int left, int right) {
	if (left + 1 < right) {
		int mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}
int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++)cin >> A[i];
	//for (int i = 0; i < n; i++) {
	//	if (i)cout << " ";
	//	cout << A[i];
	//}
	mergeSort(A, 0, n);
	for (int i = 0; i < n; i++) {
		if (i)cout << " ";
		cout << A[i];
	}
	cout << endl << cnt << endl;
	return 0;
}

Measured memory_bytes: 5064
#include <iostream>
#include <vector>

using namespace std;
int dsum(int n) {
    int ans = 0;
    while (n != 0) {
        ans += n % 10;
        n /= 10;
    }
    return ans;
}

int n;

int main(){
    cin >> n;

    int ans = 1000000;
    for (int a = 1; a <= n - 1; ++a) {
        int b = n - a;
        ans = min(ans, dsum(a) + dsum(b));
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

static void print_array(int array[], int array_len)
{
    for (int i = 0; i < array_len; i++)
    {
        printf("%d", array[i]);
        if (i != array_len - 1)
            printf(" ");
    }
    printf("\n");
}

static void swap(int *a, int *b)
{
    int tmp = *a;
    *a = *b;
    *b = tmp;
}

int main(void)
{
    int N;
    int A[100];

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

    /* 出力 */
    print_array(A, N);

    /* 挿入ソート */
    for (int i = 1; i < N; i++)
    {
        for (int j = i - 1; j >= 0; j--)
            if (A[j] > A[j + 1])
                swap(&A[j], &A[j + 1]);
        print_array(A, N);
    }
    return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

#define chmax(x,y) do{ x = max(x,y); }while(0);

signed main() {
  string s;
  cin >> s;
  ll n = s.size();

  vector<ll> dp1(2*n, -1); // dp1[i]: i番目まで見て最後が1文字の時の最大分割数
  vector<ll> dp2(2*n, -1); // dp2[i]: i番目まで見て最後が2文字の時の最大分割数

  dp1[0] = 1;
  if (n >= 2)
    dp2[1] = 1;
  rep(i,n) {
    // dp1[i] からの遷移
    if (dp1[i] != -1 && i+1 < n && s[i] != s[i+1]) {
      chmax(dp1[i+1], dp1[i]+1);
    }
    if (dp1[i] != -1 && i+2 < n) {
      chmax(dp2[i+2], dp1[i]+1);
    }
    // dp2[i] からの遷移
    if (dp2[i] != -1 && i+1 < n) {
      chmax(dp1[i+1], dp2[i]+1);
    }
    if (dp2[i] != -1 && i+2 < n && (s[i] != s[i+2] || s[i-1] != s[i+1])) {
      chmax(dp2[i+2], dp2[i]+1);
    }
  }
  cout << max(dp1[n-1],dp2[n-1]) << endl;
  return 0;
}


Measured memory_bytes: 6788
import java.util.Scanner

object Main {

  def main(args: Array[String]): Unit ={

    val sc = new Scanner(System.in)

    val s = sc.next

    val stack =
      s.foldLeft( Seq.empty[Char] ){(stack, ch) =>
        ch match{
          case '0' if stack.headOption.contains('1') => stack.tail
          case '0'                                   => ch +: stack
          case '1' if stack.headOption.contains('0') => stack.tail
          case '1'                                   => ch +: stack
        }
      }

    val res = s.length - stack.length
    println(res)
  }
}

Measured memory_bytes: 32692
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
/*
time:
wa:
反省:
考察:
*/
int main() {
    int N;
    cin >> N;
    int a, b;
    cin >> a >> b;
    int p[110];
    int ans;
    int q1 = 0;
    int q2 = 0;
    int q3 = 0;
    for(int i = 0; i < N; i++) {
        cin >> p[i];
    }
    for(int i = 0; i < N; i++){
        if(p[i] <= a) q1++;
        else if(a+1 <= p[i] && p[i] <= b) q2++;
        else q3++;
    }
    ans = min(min(q1, q2),q3);
    cout << ans << endl;
    return 0;
}

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

#include <math.h>
#include <stdlib.h>


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

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_MAX	2,147,483,647 = 2*1.0e9

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int N, C;
    cin >> N >> C;

    vector<vector<int>> D(C, vector<int>(C));
    // D[i][j]はiをjに変えたときの違和感
    for(int i = 0; i < C; i++){
        for(int j = 0; j < C; j++){
            cin >> D[i][j];
        }
    }

    vector<vector<int>> orgC(3, vector<int>(C,0));

    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            int col; cin >> col;
            col--;
            orgC[(i+j)%3][col]++;
        }
    }

    ll ans = 1e9;
    for(int c0 = 0; c0 < C; c0++){
        for(int c1 = 0; c1 < C; c1++){
            for(int c2 = 0; c2 < C; c2++){
                if(c0 == c1 || c1 == c2 || c2 == c0) continue;
                //あまりが0になる要素での違和感
                ll count = 0;
                for(int i = 0; i < C; i++){
                    int a = orgC[0][i];
                    count += ll(a) * D[i][c0];
                }

                for(int i = 0; i < C; i++){
                    int a = orgC[1][i];
                    count += ll(a) * D[i][c1];
                }

                for(int i = 0; i < C; i++){
                    int a = orgC[2][i];
                    count += ll(a) * D[i][c2];
                }

                ans = min(ans, count);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
	int N;
	cin >> N;
	int odd=0;
	int four=0;
	for(int i=0; i<N; i++){
		long long a;
		cin >> a;
		if(a%2==1){odd++;}
		if(a%4==0){four++;}
	}
	
	if(odd<=four){cout<<"Yes"<<endl;}
	else if(odd+four==N && odd==four+1){cout<<"Yes"<<endl;}
	else{cout<<"No"<<endl;}
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N, M = map(int, input().split())

    s, t = set(), set()
    for _ in range(M):
        a, b = map(int, input().split())
        if a == 1:
            s.add(b)
        if b == 1:
            s.add(a)
        if a == N:
            t.add(b)
        if b == N:
            t.add(a)

    for a in s:
        if a in t:
            print("POSSIBLE")
            return
    print("IMPOSSIBLE")


if __name__ == '__main__':
    main()


Measured memory_bytes: 19748
#include <iostream>
#include <string>
using namespace std;
int n, q, l[100000], r[100000], cnt[100001];
string s;
int main() {
  cin >> n >> q >> s;
  for (int i = 0; i < q; i++) {
    cin >> l[i] >> r[i];
  }
  for (int i = 0; i < (n - 1); i++) {
    cnt[i + 1] = cnt[i];
    if (s[i] == 'A' && s[i + 1] == 'C') {
      cnt[i + 1]++;
    }
  }
  cnt[n] = cnt[n - 1];
  for (int i = 0; i < q; i++) {
    cout << cnt[r[i] - 1] - cnt[l[i] - 1] << '\n';
  }
  return 0;
}

Measured memory_bytes: 2176
N,M,Q=map(int,input().split())
G=[[0]*N for _ in range(N)]
for _ in range(M):
    l,r=map(int,input().split())
    G[l-1][r-1]+=1
#print(G)
for i in range(N):
    for j in range(i,N-1):
        G[i][j+1]+=G[i][j]
for i in range(N):
    for j in range(i,0,-1):
        G[j-1][i]+=G[j][i]
#print(G)
for _ in range(Q):
    p,q=map(int,input().split())
    print(G[p-1][q-1])


Measured memory_bytes: 9332
h,w,a,b = map(int, input().split())

mod = 10**9+7 #出力の制限
N = h+w
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

ans = 0
for j in range(b,w):
  ans += cmb(h-a-1+j, j, mod) * cmb(a-1+w-j-1, a-1, mod)
print(ans%mod)


Measured memory_bytes: 27024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    int x, y;
    cin >> x >> y;

    int r = 0;
    if (x <= 3) r += 4 - x;
    if (y <= 3) r += 4 - y;
    if (x == 1 && y == 1) r += 4;

    cout << r * 100000 << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int num = s.length();
        List<String> list = new ArrayList<>();
        
        for(int i = 0; i < num; i++){
            //文字列が空なら、何もしない。
            if(list.size() == 0 && s.charAt(i) == 'B')continue;
            
            //0,1なら文字列を追加し、Bなら削除する
            if(s.charAt(i) == '0')list.add("0");
            if(s.charAt(i) == '1')list.add("1");
            if(s.charAt(i) == 'B')list.remove(list.size() -1);
        }
        
        for(int i = 0; i < list.size(); i++)System.out.print(list.get(i));
    }
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define LINY "YES\n"
#define Liny "Yes\n"
#define LINN "NO\n"
#define Linn "No\n"
#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"

ll min(ll x,ll y){return (x<y ? x:y);}
ll max(ll x,ll y){return (x>y ? x:y);}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}


int main(){
  ull H,W; cin>>H>>W;
  int a = H%2;
  int b = W%2;
  ull r;
  if(H==1 || W==1){
    r = 1;
  }else if(a==0){
    r = H/2*W;
  }else if(b==0){
    r = W/2*H;
  }else{
    if(H>W) swap(H,W);
    r = (H+1)/2*W - (W-1)/2;
  }
  
  cout << r << "\n";
}


Measured memory_bytes: 256
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    a = collections.Counter(a)
    cnt = 0
    for k, v in a.items():
        if k < v:
            cnt += (abs(k - v))
        elif k > v:
            cnt += v
    print(cnt)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 64416
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val D, N = sc.nextInt()

    val num = math.pow(100, D).toLong

    if (N == 100) println(num * N + num)
    else println(num * N)
  }
}


Measured memory_bytes: 25520
import bisect



def cumsum(inlist):
    s = 0
    outlist = []
    for i in inlist:
        s += i
        outlist.append(s)
    return outlist

n = int(input())
a_list = sorted([ int(v) for v in input().split() ])
b_list = sorted([ int(v) for v in input().split() ])
c_list = sorted([ int(v) for v in input().split() ])
a_b_list = [ bisect.bisect_right(a_list,i-1) for i in b_list]
b_c_list = [ bisect.bisect_right(b_list,i-1) for i in c_list]
a_b_cumsum_list = cumsum(a_b_list)
a_b_c_list = [ a_b_cumsum_list[i-1] for i in b_c_list if i != 0]
print(sum(a_b_c_list))


Measured memory_bytes: 118892
import java.io.IOException;
import java.io.*;

public class Main {
	
	public static int[] source = new int[10];	
	static int b1 = 0;
	static int b2 = 0;
	static int b3 = 0;
	
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		for (int i=0; i<10; i++){
			source[i] = Integer.parseInt(in.readLine());
		}
		sort();
		System.out.println(b1);
		System.out.println(b2);
		System.out.println(b3);
	}
		
	public static void sort(){
		for(int i=0; i<10; i++){
			if(b1 < source[i]){
				b3 = b2;
				b2 = b1;
				b1 = source[i];
			}else if(b2 < source[i]){
				b3 = b2;
				b2 = source[i];
			}else if(b3 < source[i]){
				b3 = source[i];
			}
		}
	}
	
}

Measured memory_bytes: 16864
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main() {
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int minv = a * x + b * y;
	minv = min(minv, c * 2 * max(x, y));
	int sel;
	if (x > y)sel = a;
	else sel = b;
	minv = min(minv, c * 2 * min(x, y) + sel * (max(x, y) - min(x, y)));
	cout << minv << endl;
	return 0;
}

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

int main() {
  int N,K,h;
  cin >> N>>K;
  int ans;
  ans=0;
  for(int i = 0 ; i < N ; i++ ){
    cin >> h ;
    if(h >= K){
      ans+=1;
    }
  }  
  cout<<ans<<endl;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
int main(){
	char  s1[12], s2[12], s3[12]; cin >> s1 >> s2 >> s3;
	printf("%c%c%c\n", toupper(s1[0]), toupper(s2[0]), toupper(s3[0]));
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

int const MOD = 1e9 + 7;

int main() {
  int N, K; cin >> N >> K;
  ll ans = 0;
  REP(k, K, N + 2) {
    ans += (ll)(N - k + 1 + N) * k / 2 - (ll)(k - 1) * k / 2 + 1;
    ans %= MOD;
  }
  cout << ans << endl;
}


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

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

	string s;
	cin >> s;

	map<char, int> cnt;
	for(int i = 0; i < s.size(); i += 2) {
		assert(isalpha(s[i]));
		++cnt[s[i]];
		assert(cnt[s[i]] <= 9);
	}

	int ans = 0;
	vector<int> num(10, 0);
	for(const auto &e : cnt) {
		++num[e.second];
	}

	ans = 0;
	if(num[1] > 0) {
		ans += num[1] + num[1] - 1;
	}
	for(int i = 2; i <= 9; ++i) {
		if(num[i] > 0 && ans > 0) ++ans;
		if(num[i] == 1) {
			ans += 3;
		}
		else if(num[i] >= 2) {
			ans += 4 + num[i] + num[i] - 1;
		}
	}

	cout << ans << endl;

	return 0;
}

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

int main()
{
    int N, K, R, S, P;
    string T;
    cin >> N >> K >> R >> S >> P >> T;
    int res = 0;
    vector<bool> skip(N, false);
    for (int i = 0; i < N; i++)
    {
        char Ti = T.at(i);
        bool win = true;
        if (i - K >= 0 && Ti == T.at(i - K))
        {
            if (!skip.at(i - K))
            {
                win = false;
                skip.at(i) = true;
            }
        }
        if (win)
        {
            if (Ti == 'r')
                res += P;
            else if (Ti == 's')
                res += R;
            else
                res += S;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#define N 1005
using namespace std;
int flag[N][N],girl[N],used[N],n,k,m,a[N],b[N],c[N],d[N];
bool found(int x)
{
	for(int i=1;i<=n;i++)
		if(flag[x][i]&&!used[i])
		{
			used[i]=1;
			if(girl[i]==0||found(girl[i]))
			{
				girl[i]=x;
				return 1;
			}
		}
	return 0;
}
int main()
{
	scanf("%d",&n);
	memset(flag,false,sizeof(flag));
	memset(girl,0,sizeof(girl));
	for(int i=1;i<=n;i++)
		scanf("%d%d",&a[i],&b[i]);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&c[i],&d[i]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(a[i]<=c[j]&&b[i]<=d[j])
				flag[i][j]=true;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		memset(used,0,sizeof(used));
		if(found(i))ans++;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 4224
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif

//改造
typedef long long int ll;
using namespace std;


//ここから編集する

int main() {
    vector<int> v;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        int tmp;
        cin >> tmp;
        v.push_back(tmp);
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    ll hen[2] = {-114,-514};
    for(int i = 0; i < n-1; i++){
        if(v[i] == v[i + 1]){
            if(hen[0] < 0){
                hen[0] = v[i];
                i++;
            }else{
                hen[1] = v[i];
                break;
            }
        }
    }
    ll ans = hen[0] * hen[1];
    if(hen[1] < 0) ans = 0;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 892
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		int M = stdIn.nextInt();
		int N = stdIn.nextInt();
		int max = 0;
		for(int i = 0; i < M; ++i)
		{
			int count = 0;
			for(int j = 0; j < N; ++j)
			{
				int a = stdIn.nextInt();
				if(a == 1)
				{
					++count;
				}
			}
			if(count > max)
			{
				max = count;
			}
		}
		System.out.println(max);
	}
}

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

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 / gcd(a, b) * b;
}

int main() {
  int a,b;
  cin >> a >> b;
  cout<<lcm(a,b)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

enum PosiNega {
  POSITIVE = 0,
  NEGATIVE = 1
};

ll solve(int N, ll *a, PosiNega odd_posinega) {
  ll ans = 0;
  ll sum = 0;
  PosiNega posi_nega = odd_posinega;
  rep(i, 0, N) {
    sum += a[i];
    if (POSITIVE == posi_nega) {
      if (0 >= sum) {
        ans += 1-sum;
        sum = 1;
      }
      posi_nega = NEGATIVE;
    } else {
      if (0 <= sum) {
        ans += 1+sum;
        sum = -1;
      }
      posi_nega = POSITIVE;
    }
  }
  return ans;
}

void _main() {
  int N;
  cin >> N;

  ll a[N];
  rep(i, 0, N) cin >> a[i];

  ll ans  = solve(N, a, POSITIVE);
  ll _ans = solve(N, a, NEGATIVE);
  chmin(ans, _ans);

  cout << ans << "\n";
}

Measured memory_bytes: 1024
N,M=map(int,input().split())
A=list(map(int,input().split()))

A.sort()

OK=0
NG=max(A)*2+1

import bisect

while NG-OK>1: #N*N個の中で,mid以上の個数がM個以上あればOK
    mid=(OK+NG)//2

    score=0

    for a in A:
        x=bisect.bisect_left(A,mid-a)
        score+=N-x
        if score>=M:
            OK=mid
            break
    else:
        NG=mid
        
from itertools import accumulate
S=list(accumulate(A))

ANS=0
ups=0
for a in A:
    x=bisect.bisect_right(A,OK-a)
    if x!=0:
        ANS+=(N-x)*a+(S[-1]-S[x-1])
    else:
        ANS+=(N-x)*a+S[-1]
        
    #print(x,ANS)
    ups+=N-x
#print(ANS)
ANS+=(M-ups)*OK
print(ANS)
    
    


Measured memory_bytes: 14268
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> P(N, 0);
    for(int i=0; i<N;++i){
        cin >> P[i];
    }
    int ans = 0;
    for (int i = 0; i < N; ++i)
    {
        if(P[i] != i+1){
            ++ans;
        }
    }

    if( ans >=3 ){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }

    return 0;
}

Measured memory_bytes: 256