akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    if(81<n){
        cout << "No" << endl;
        return 0;
    } 
    
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(n==i*j){
                cout << "Yes" << endl;
                return 0;
            } 
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
/* 実行時間1s制限の場合
  10^6 1,000,000   : 余裕をもって間に合う
  10^7 10,000,000  : おそらく間に合う
  10^8 100,000,000 : 非常にシンプルな処理でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
vector<pair<ll,int>> factorize(ll n) {            // a,bの公約数 = GCD(a, b)の約数
    vector<pair<ll,int>> res;
    for (ll i = 2; i*i <= n; i++) { // √nまで探せばよい
        if (n%i) continue;
        res.emplace_back(i, 0);     // 割り切れたら
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1); // この時点で1でなかったら、残りは素数.
    return res;
}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}         // Least Commont Multiple オーバーフローしないように先に割る
ll ceil(ll a, ll b) {return (a+b-1)/b;}

const ll INF = LONG_MAX;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll f(ll h)
{
    if (h == 1) return 1;
    return 2*f(h/2) + 1;
}

int main(int argc, char* argv[])
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    // std::ifstream in(argv[1]);
    //std::cin.rdbuf(in.rdbuf());
    //std::ifstream in(string(argv[0]) + ".txt");
    std::ifstream in("in.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int a, b, c;
    cin >> a >> b >> c;

    if ( (a + b) == c) {cout << "Yes"; return 0;}
    if ( (b + c) == a) {cout << "Yes"; return 0;}
    if ( (c + a) == b) {cout << "Yes"; return 0;}

    cout << "No";

    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
    - sort
      - sort(a.begin(), cb.end(), greater<pair<int, int>>());
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
using namespace std;

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

const long long INF = 1LL << 60;
int main()
{
	map<string, int> mp,mps;
	int N, M;
	cin >> N;
	for (int i = 0;i < N;i++) {
		string sa;
		cin >> sa;
		mp[sa]++;
	}
	cin >> M;
	for (int i = 0;i < M;i++) {
		string sb;
		cin >> sb;
		mp[sb]--;
	}

	int res = 0;
	map <string, int>::iterator itr;
	for (itr = mp.begin(); itr != mp.end(); ++itr) {
		res = max(res, itr->second);
	}

	cout << res << endl;
}

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

const int N = 100010;
vector<int> v[N];
int n,m,x,y;
int q[N*2],head,tail;
bool pd[N];
void find(int x,int y){
//	cout<<x<<endl;
	int t;
	for(int i = 0;i<v[x].size();i++){
		t = v[x][i];
		if(!pd[t]){
			pd[t]=true;
			if(y==0)q[++tail] = t;
			else q[--head] = t;
			find(t,y);
			break;
		}
	}
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i =0;i<m;i++){
		scanf("%d%d",&x,&y);
		v[x].push_back(y);
		v[y].push_back(x);
	}
	head = N;tail = N;
	q[head]  =1;
	pd[1]=true;
	find(1,0);
	find(1,1);
	printf("%d\n",tail-head+1);
	for(int i  =head;i<=tail;i++) printf("%d ",q[i]);puts("");
	return 0;
}

Measured memory_bytes: 6784
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int d[20], nd, dp[20][2];

int f(int k, bool a)
{
    if (k == nd) return 0;
    if (dp[k][a] != -1) return dp[k][a];
    int sol = 0;
    for (int i = 0; i <= (a ? 9 : d[k]); ++i)
        sol = max(sol, i + f(k + 1, a || (i < d[k])));
    return dp[k][a] = sol;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    while (n)
        d[nd] = n % 10, n /= 10, nd++;

    reverse(d, d + nd);
    memset(dp, -1, sizeof dp);
    cout << f(0, false);
}


Measured memory_bytes: 256
x=int(input())
items = [100,101,102,103,104,105]
list = [1]
if x == 100 or x == 101 or x == 102 or x == 103 or x == 104 or x == 105:
    print(1)
elif x <100:
    print(0)
else:
    for i in range(99):
        list.append(0)
    for i in range(6):
        list.append(1)
    for i in range(94):
        list.append(0)
    for i in range(200,x+1):
        for item in items:
            if list[i-item] == 1:
                list.append(1)
                break
        else:
            list.append(0)

    print(list[x])


Measured memory_bytes: 3860
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int n;
string s;
string dp[3003];
string suf[3003];
int pos[6003];
vector<int>a,b;
int main(){
	cin>>n>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='a')pos[i]=a.size(),a.push_back(i);
		else pos[i]=b.size(),b.push_back(i);
	}
	dp[n]="";
	for(int i=n-1;i>=0;i--){
		if(a[i]<b[i]){
			//ab
			int mx=-inf;
			for(int j=a[i];j<=b[i];j++){
				mx=max(mx,pos[j]);
			}
			dp[i]=max(dp[i],"ab"+dp[mx+1]);
		}else{
			//ba
			int tmp=i;
			while(tmp<n-1&&b[tmp+1]<a[tmp])tmp++;
			for(int j=b[i];j<s.size();j++)if(i<=pos[j]&&pos[j]<=tmp)dp[i].push_back(s[j]);
			dp[i]+=dp[tmp+1];
		}
		dp[i]=max(dp[i],dp[i+1]);
	}
	cout<<*max_element(dp,dp+n)<<endl;
	return 0;
}

Measured memory_bytes: 14592
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;

struct Nbase {
    int n;
    int sz = 1;
    long long max = 1e18;

    Nbase(int k = 2){
        n = k;
        while(max != 0){
            max /= n;
            sz++;
        }
    };

    //繰り返し二乗法
    long long EX(long long x,long long n){
        if(n == 0) return 1;
        else if(n%2 == 1) return EX(x,n-1)*x;
        else return EX(x*x,n/2);
    }

    inline vector<int> to_n(long long num){
        vector<int> ret(sz);
        long long subtraction = EX(n,sz-1);
        for(int i = sz-1; i >= 0; i--){
            long long quotient = num/subtraction;
            ret[i] = quotient;
            num -= ret[i]*subtraction;
            subtraction /= n;
        }
        return ret;
    }

    long long re_n(vector<int>& vec){
        long long ret = 0;
        vec.resize(sz);
        for(int i = 0; i < sz; i++){
            ret += vec[i]*EX(n,i);
        }
        return ret;
    }

    void supress(const vector<int>& lim,vector<int>& at){
        bool upper = true;
        for(int i = sz; i >= 0; i--){
            if(upper && lim[i] > 0) upper = false;
            if(lim[i] > at[i]) break;
            else if(upper || lim[i] < at[i]) at[i] = lim[i];
        }
    }
};

int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    Nbase base = 2;
    vector<int> xnum(base.sz,0);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        vector<int> num = base.to_n(a[i]);
        for(int i = 0; i < num.size(); i++){
            xnum[i] += num[i];
        }
    }
    for(int i = 0; i < xnum.size(); i++){
        if(xnum[i] <= n/2) xnum[i] = 1;
        else xnum[i] = 0;
    }
    vector<int> knum = base.to_n(k);
    base.supress(knum,xnum);
    ll x = base.re_n(xnum);
    ll ans = 0;
    for(int i = 0; i < n; i++) ans += x^a[i];
    cout << ans << endl;
    return 0;
}

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

int dp[(unsigned int)1e5];
int h[(unsigned int)1e5];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> h[i];
  dp[0] = 0;
  dp[1] = abs(h[1] - h[0]);
  for (int i = 2; i < n; i++) {
    dp[i] = INT_MAX;
    for (int j = 1; j <= 2; j++)
      dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
  }
  cout << dp[n - 1] << endl;
  return 0;
}

Measured memory_bytes: 1024
//   xx  x6
//   yy
//
//   z   x3
//   z
//
// xxz   x1
// yyz
//
// xxaa  x3
// yybb
//
//  xz   x2
//  xz
//
//  xaa  x2
//  xbb

import java.util.*;

public class Main {
  private static final int MOD = 1_000_000_007;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    char[][] d = new char[2][N];
    for (int i = 0; i < 2; i++) {
      String s = sc.next();
      for (int j = 0; j < N; j++) {
        d[i][j] = s.charAt(j);
      }
    }
    // 0: x  1: xx
    //    x     yy
    int prev;
    int j = d[0][0] == d[1][0] ? 1 : 2;
    long ans = d[0][0] == d[1][0] ? 3 : 6;
    while (j < N) {
      if (d[0][j] == d[1][j]) {
        ans *= d[0][j-1] == d[1][j-1] ? 2 : 1;
        j++;
      } else {
        ans *= d[0][j-1] == d[1][j-1] ? 2 : 3;
        j += 2;
      }
      ans %= MOD;
    }
    System.out.println(ans);
  }
}

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

int main(){
  int a,b;
  cin>>a>>b;
  vector<string> c(a);
  for(int i=0;i<a;i++){
     cin>>c.at(i);
  }
  sort(c.begin(),c.end());
  for(int i=0;i<a;i++){
    if(i==a-1)
      cout<<c.at(i)<<endl;
    else
      cout<<c.at(i);
  }
}

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

int main(){
  int r, c;
  vector<int> col_sum;
  cin >> r >> c;
  //col_sumの容量を列の数に設定
  col_sum.reserve(c);
  //col_sumの初期化 すべて初期値0s
  for(int i=0; i<col_sum.capacity(); i++){
    col_sum.push_back(0);
  }
  for(int i=0; i<r; i++){
    int i_sum = 0;
    for(int j=0; j<c; j++){
      int num;
      cin >> num;
      cout << num << ' ';
      i_sum += num;
      col_sum.at(j) = col_sum.at(j) + num;
    }
    cout << i_sum << endl;
  }
  for(int i=0; i<c; i++){
    cout << col_sum.at(i) << ' ';
  }
  cout << accumulate(col_sum.begin(), col_sum.end(), 0) << endl;
  return 0;
}



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

using namespace std;

vector<long> t[111111], s[111111], r[111111];
int m;
int f(int u, int v) {
	int n = t[v].size();
	s[v].resize(n + 1);
	r[v].resize(n);
	s[v][0] = r[v][n - 1] = 1;
	for (int i = n; i--;) {
		s[v][i + 1] = t[v][i] == u ? 1 : f(v, t[v][i]);
		if (i) r[v][i - 1] = (r[v][i] * s[v][i + 1]) % m;
	}
	for (int i = 0; i < n; i++) {
		(s[v][i + 1] *= s[v][i]) %= m;
		(s[v][i] *= r[v][i]) %= m;
	}
	return (s[v][n] + 1) % m;
}
void g(int u, int v, int a) {
	int n = t[v].size();
	(s[v][n] *= a) %= m;
	while (n--) if (t[v][n] != u)
		g(v, t[v][n], (s[v][n] * a + 1) % m);
}
int main() {
	int n;
	cin >> n >> m;
	for (int i = 1; i < n; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		t[x].push_back(y);
		t[y].push_back(x);
	}
	if (n < 2) {
		cout << 1 << endl;
		return 0;
	}
	f(0, 1), g(0, 1, 1);
	for (int i = 1; i <= n; i++)
		cout << s[i][t[i].size()] << '\n';
	cout << flush;
	return 0;
}


Measured memory_bytes: 26496
#include <bits/stdc++.h>
using namespace std;
int main(){
long long N;
cin>>N;
for(long long w = 1; w <= 3500; ++w){
 	for(long long h = 1; h <= 3500; ++h){
		int left = 1; 
		int right = 3500;
		while(left <= right){
			long long n = left + (right - left) / 2;
			if((long long)(4 * h * w * n) == (long long)(N * ((w * h) + (w * n) + (h * n)))){
				cout<<h<<" "<<n<<" "<<w<<endl;
				return 0;
			}
			else if((long long)(4 * h * w * n) < (long long)(N * ((w * h) + (w * n) + (h * n)))){
				left = n + 1;
			}
			else {
				right = n - 1;
			}	
		}
	}
}
return 0;
}

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

int main()
{
	string s; cin >> s;
	vector<int> AtoZ(s.size());

	int ans, bottom = 200001, upper = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s.at(i) == 'A') bottom = min(bottom,i);
		if (s.at(i) == 'Z') upper = max(upper, i);
		ans = upper - bottom + 1;
	}
	cout << ans << endl;
}


Measured memory_bytes: 1412
package main

import (
	"fmt"
	"io"
	"os"
)

func run(input io.Reader, output io.Writer) int {
	var ai [3][3]int
	for i := 0; i < 3; i++ {
		for j := 0; j < 3; j++ {
			fmt.Scanf("%d", &ai[i][j])
		}
	}
	var n int
	fmt.Scanf("%d\n", &n)
	bi := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d\n", &bi[i])
	}

	var ri [][3]int
	for i := 0; i < 3; i++ {
		ri = append(ri, ai[i])
	}

	var tmp [3]int
	for j := 0; j < 3; j++ {
		for i := 0; i < 3; i++ {
			tmp[i] = ai[i][j]
		}
		ri = append(ri, tmp)
	}

	tmp[0] = ai[0][0]
	tmp[1] = ai[1][1]
	tmp[2] = ai[2][2]
	ri = append(ri, tmp)

	tmp[0] = ai[0][2]
	tmp[1] = ai[1][1]
	tmp[2] = ai[2][0]
	ri = append(ri, tmp)

	for _, r := range ri {
		sum := 0
		for i := 0; i < 3; i++ {
			found := false
			for _, b := range bi {
				if b == r[i] {
					found = true
					break
				}
			}

			if found {
				sum += 1
			} else {
				break
			}
		}

		if sum >= 3 {
			fmt.Println("Yes")
			return 0
		}
	}

	fmt.Println("No")

	return 0
}

func main() {
	os.Exit(run(os.Stdin, os.Stdout))
}


Measured memory_bytes: 512
#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>;
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; }
const ll INF = 1LL << 60;

int main() {

    string S;

    cin >> S;

    int ssize = S.size();

    //cout << S[ssize-1] << endl;

    if(S[ssize-1] == 's'){
        S += "es";
    }
    else{
        S += "s";
    }

    cout << S << endl;

}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()


int main(){
    ll n, k;
    cin >> n >> k;
    vector<bool> has(n, false);

    REP(i, k){
        ll di;
        cin >> di;
        REP(j, di){
            ll ai;
            cin >> ai;
            ai--;
            has.at(ai) = true;
        }
    }

    ll ans = 0;
    REP(i, n){
        if(!has.at(i)){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << x << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int a, b;
  cin >> a >> b;
  cout << (a <= 9 && b <= 9 ? a * b : -1) << endl;
  return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	N := getStdinInt()
	fInit(N)
	for i := 1; i <= N; i++ {
		fmt.Printf("%d\n", f(i))
	}
}

var fAns []int

func fInit(max int) {
	fAns = make([]int, max+1)
	nsqrt := int(math.Sqrt(float64(max)))
	for x := 1; x < nsqrt; x++ {
		for y := 1; y < nsqrt; y++ {
			for z := 1; z < nsqrt; z++ {
				ans := x*x + y*y + z*z + x*y + y*z + z*x
				if ans <= max {
					fAns[ans]++
				}
			}
		}
	}
}

func f(n int) int {
	return fAns[n]
}

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10)

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt2() (int, int) {
	list := getStdinIntArr()
	return list[0], list[1]
}
func getStdinInt3() (int, int, int) {
	list := getStdinIntArr()
	return list[0], list[1], list[2]
}
func getStdinInt4() (int, int, int, int) {
	list := getStdinIntArr()
	return list[0], list[1], list[2], list[3]
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinInt64_2() (int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1]
}
func getStdinInt64_3() (int64, int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1], list[2]
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}
func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}
func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, _ := sc.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll inf=1000000000000000000;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
int main(){
    int n,k;cin>>n>>k;
    cout<<n-k+1<<endl;
}


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

using namespace std;

const long long MAX = 2e5 + 10;

typedef long long int ll;

ll a[MAX]={0};

int main()
{	
	ll n,k; cin>>n>>k;

	for(int i=0;i<n;i++) {
		ll x,b; cin>>x>>b;
		a[x] += b;
	}

	for(int i=1;i<=MAX;i++) a[i] += a[i-1];

	ll l=1,r=MAX;
	ll ans = MAX;
	while(l <= r) {
		int m = (l+r)/2;

		if(a[m] >= k) {
			ans = m; r = m-1;
		}
		else l=m+1;
	}
	cout<<ans;	
}

Measured memory_bytes: 1792
N, T = map(int, input().split())

def main():
    c_min = 9999
    for i in range(N):
        c, t = map(int, input().split())
        if c < c_min and t <= T:
            c_min = c
    if c_min != 9999:
        return c_min 
    else:
        return 'TLE'

if __name__ == '__main__':
    print(main())


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

using namespace std;

int main()
{

    char arr[3][3];
    for(int i =0;i<3;i++)
    {
        for(int j =0;j<3;++j)
        {
            cin >> arr[i][j];
        }
    }

    cout << arr[0][0] << arr[1][1]<<arr[2][2];
}


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

int main(){
  int N,K;cin>>N>>K;
  ll h[N];
  ll dp[1100000];
  rep(i,N) cin>>h[i];
  
  rep(i,100010) dp[i]=M;
  
  dp[0]=0;
  for(int i=0;i<N;i++){
    for(int j=1;j<=K;j++){
      dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]));
    }
  }
  cout<<dp[N-1]<<endl;
}

Measured memory_bytes: 5120
package main

import (
	"fmt"
)

func main() {
	var N, m int
	fmt.Scan(&N)
	goalList := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&goalList[i])
	}
	flowerList := make([]int, N)
	//終端に0をつけたリストを作成
	tmpList := make([]int, N+1)

	for {
		for i := 0; i < N; i++ {
			if flowerList[i] < goalList[i] {
				flowerList[i] = flowerList[i] + 1
				tmpList[i] = 1
			} else {
				tmpList[i] = 0
			}
		}
		for k := 0; k < N+1; k++ {
			if tmpList[k] == 1 && tmpList[k+1] == 0 {
				m++
			}
		}

		if !Contains(tmpList, 1) {
			fmt.Println(m)
			break
		}
	}

}

func Contains(a []int, x int) bool {
	for _, n := range a {
		if x == n {
			return true
		}
	}
	return false
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n, t;
    cin >> n >> t;

    vl a(n);
    rep(i, n) {
        cin >> a[i];
    }

    vl v(n);
    v[n-1] = -INF;
    for(ll i = n-1; i >= 1; i--) {
        v[i-1] = max(a[i], v[i]);
    }

    ll u = -INF;
    rep(i, n-1) {
        chmax(u, v[i] - a[i]);
    }

    ll ans = 0;
    rep(i, n-1) {
        if(u == v[i] - a[i]) {
            ans++;
        }
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
    using namespace std;
    #define int long long
    #define sync ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define MOD  1000000007 
    int powm(int base,int exp,int mod=MOD) {int ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
    int32_t main()
    {
    	int n;
    	cin>>n;
    	double a[n];
    	for(int i=0;i<n;i++)
    		cin>>a[i];
    	sort(a,a+n);
    	double ans=(a[0]+a[1])/2;
    	for(int i=2;i<n;i++)
    		ans=(ans+a[i])/2;
    	cout<<ans;
    }	

Measured memory_bytes: 256
#include<iostream>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define me(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
const int N=500005;
int main()
{
	int n,m;
	cin>>n>>m;
	if(n<10)cout<<m+100*(10-n);
	else cout<<m;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc=new Scanner(System.in);

		int max=sc.nextInt();
		int tubun_cnt=0;

		int array[] = new int[max];

		for(int i=0;i<max;i++) {
			array[i] = sc.nextInt();
		}
		sc.close();

		while(true) {

			for(int i=0;i<max;i++) {
				if(array[i]%2==0) {

				}
				else {
					/*for(int j=0;j<max;j++) {
						System.out.print(array[j]+" ");
					}
					System.out.println();*/

					System.out.println(tubun_cnt);
					return;

				}
			}
			for(int i=0;i<max;i++) {
				array[i]/=2;

			}
			tubun_cnt++;
			/*for(int j=0;j<max;j++) {
			System.out.print(array[j]+" ");
			}
			System.out.println();*/
		}

	}
}


Measured memory_bytes: 25044
#include<iostream>
#include<string.h>
using namespace std;

int main() {
    int x,i;
    string y;
    cin>>x>>y;
    for(i=0;i<y.size();i++){
        y[i]=y[i]+x;
        if(y[i]>90){
            y[i]=y[i]-26;
        }
    }
    cout<<y;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { printf("ERROR%d!\n",num); }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};

struct P
{
  int a;
  int b;
  int c;
  int d;
};

vector<P> vec;
int N, M, Q;

void DFS(vector<P> &vec, vector<int> &memo, int &maxn, int cur){
  if(cur==N){
    int cnt = 0;
    rep(i,Q){
      int a = vec[i].a-1;
      int b = vec[i].b-1;
      int c = vec[i].c;
      int d = vec[i].d;
      if(memo[b]-memo[a]==c) cnt+=d;
    }
    maxn = max(maxn,cnt);
  }else{
    bool ok = 0;
    for(int num = 1; num <= M; num++){
        if(cur!=0){
          if(num>=memo[cur-1]){ 
            memo[cur] = num; ok = 1;
          }
        }else{
          memo[cur] = num;
          ok = 1;
        }
        if(ok) DFS(vec, memo, maxn, cur+1);
    }
  }
}

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

    cin >> N >> M >> Q;

    vec.resize(Q);
    rep(i,Q){
      cin >> vec[i].a >> vec[i].b >> vec[i].c >> vec[i].d;
    }

    vector<int> memo;
    memo.resize(N);
    int maxn = 0;
    DFS(vec, memo, maxn, 0);

    cout << maxn << endl;
}

Measured memory_bytes: 3616
#include<iostream>
using namespace std;
main(){for(;;){int i,n,m,hito = 0,temp,me[1000],ban[1000];cin>>n>>m;
		if(n==0){break;}
		for(i=0;i<n;i++){cin>>ban[i];}
		for(i=0;i<m;i++){cin>>me[i];}
		for(i=0;i<m;i++){hito+=me[i];
		if(hito>=n){i++;break;}temp=hito;hito+=ban[temp];
		if(hito>=n){i++;break;}}
		cout<<i<<endl;}}

Measured memory_bytes: 0
//file_name:ABC62_A.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int a[2];
    scanf("%d%d",&a[0],&a[1]);

    rep(i,2){
        if(a[i]==2){
            a[i]=28;
        }else if(a[i]==4||a[i]==6||a[i]==9||a[i]==11){
            a[i]=30;
        }else{
            a[i]=31;
        }
    }
    
    if(a[0]==a[1])yn;
    //cout << ans << endl;
    return 0;
}



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

int main()
{
    int Z;
    //-----------
    int n;
    //vector<string> strs;
    string instr;
    int tmpcount[26] = {0};
    int count[26] = {0};
    int init = 0;

    cin >> n;

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

        //個数のカウント
        for (int j = 0; j < instr.size(); j++)
        {
            //cout << instr[j] << endl;
            tmpcount[(int)instr[j] - 97] += 1;
        }

        //countに反映
        if (init == 0) //初回だけコピー
        {
            for (int j = 0; j < 26; j++)
            {
                count[j] = tmpcount[j]; //そのまま代入する
                tmpcount[j] = 0;        //tmpの初期化
            }
            init = 1;
        }
        else //初回以降は比較．個数が異なれば，少ない方を代入する
        {
            for (int j = 0; j < 26; j++)
            {
                if (count[j] != tmpcount[j])
                    count[j] = min(count[j], tmpcount[j]);

                tmpcount[j] = 0; //tmpの初期化
            }
        }
        //ここでループ
    }

    //出力のパート
    for (int i = 0; i < 26; i++)
    {
        if (count[i] != 0)
        {
            for (int j = 0; j < count[i]; j++)
            {
                cout << (char)(97 + i);
            }
        }
    }

    cout << endl;

    //cout << "Hello,World" << endl;

    //-----------
    cin >> Z;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		// 入居者管理用配列
		int dorm[][][] = new int[4][3][10];
		// 全ての部屋人数に0を設定
		for(int b=0; b<4; b++) {
			for(int f=0; f<3; f++) {
				for(int r=0; r<10; r++) {
					dorm[b][f][r] = 0;
				}
			}
		}

		// 情報入力
		for(int i=0; i<n; i++){
			int building = sc.nextInt();
			int floor = sc.nextInt();
			int room = sc.nextInt();
			int count = sc.nextInt();

			// 指定部屋の人数を増減
			dorm[building-1][floor-1][room-1] += count;
		}

		sc.close();

		// 出力
		for(int b=0; b<4; b++) {
			for(int f=0; f<3; f++) {
				for(int r=0; r<10; r++) {
					System.out.print(" " + dorm[b][f][r]);
				}
				System.out.println("");
			}
			if(b!=3) System.out.println("####################");
		}

	}

}


Measured memory_bytes: 29824
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <numeric>
#include <map>   
#include <stdio.h>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define PB push_back
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807
#define sortR(a,b) sort(a, b, greater<int>())

using namespace std;

long long GCD(long long a, long long b) {
	if (a < b)
		swap(a, b);
	if (b == 0) return a;
	else return GCD(b, a % b);
}
bool sosuu_check(int num) {
	int i;
	for (i = 2; i <= sqrt(num); ++i) {
		if (num%i == 0)
			return false;
	}
	return (num < 2) ? false : true;
}



int main() {
	ll N, M, P, Y, i;
	vector<pair <int, long>> vec1, vec2;
	map<int, map<long, int>> mp;
	cin >> N >> M;
	REP(i, M) {
		cin >> P >> Y;
		vec1.push_back(make_pair(P, Y));
		vec2.push_back(make_pair(P, Y));
	}
	sort(vec1.begin(),vec1.end(),[](const pair<int, int>& x, const pair<int, int>& y) {return x.second < y.second; });
	REP(i, M) {
		if (mp.find(vec1[i].first) != mp.end()){
			mp[vec1[i].first][vec1[i].second] = mp[vec1[i].first][vec1[i].second] = (int)mp[vec1[i].first].size()-1;
		}
		else {
			mp[vec1[i].first][vec1[i].second] = 0;
		}
	}
	REP(i, M) {
		printf("%06d%06d\n", vec2[i].first, mp[vec2[i].first][vec2[i].second] + 1);
	}
}

Measured memory_bytes: 20196
#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
using namespace std;
map<string,int> hashh;
int n,ans;
char s[23];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%s",s);
		if (hashh.find(s)==hashh.end())
		{
			hashh.insert(pair<string, int>(s,1));
			ans++;
		}
	}
	printf("%d",ans);
	return 0;
}

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

using namespace std;

constexpr int MAX_N = 200'000 + 1;

vector<int> roads[MAX_N];
vector<int> railways[MAX_N];

vector<bool> visitedRoads(MAX_N);
vector<bool> visitedRailways(MAX_N);

vector<int> sol(MAX_N);
vector<int> component(MAX_N);

int N, K, L;
int nrCompsRoads;

vector<int> actualComponent;

void dfs1(int node){
    visitedRoads[node] = true;
    component[node] = nrCompsRoads;
    
    for (int son: roads[node])
        if (!visitedRoads[son])
            dfs1(son);
}

void dfs2(int node){
    visitedRailways[node] = true;
    actualComponent.push_back(node);
    
    for (int son: railways[node])
        if (!visitedRailways[son])
            dfs2(son);
}

int main()
{   
    //ifstream cin("data.in");
    
    ios_base::sync_with_stdio(false);
    
    cin >> N >> K >> L;
    
    for (int i = 1; i <= K; i++){
        int a, b;
        cin >> a >> b;
        
        roads[a].push_back(b);
        roads[b].push_back(a);
    }
    
    for (int i = 1; i <= L; i++){
        int a, b;
        cin >> a >> b;
        
        railways[a].push_back(b);
        railways[b].push_back(a);
    }
    
    for (int i = 1; i <= N; i++)
        if (!visitedRoads[i]){
            nrCompsRoads++;
            dfs1(i);
        }
        
    for (int i = 1; i <= N; i++)
        if (!visitedRailways[i]){
            actualComponent.clear();
            dfs2(i);
            
            map<int,int> cnt;
            
            for (int node: actualComponent)
                ++cnt[component[node]];
        
            for (int node: actualComponent)
                sol[node] = cnt[component[node]];
        }
        
    for (int i = 1; i <= N; i++)
        cout << sol[i] << " ";
        
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 19960
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(void){
	int n;

	cin >> n;

	vector<int> a(n + 2);

	a[0] = a[n + 1] = 0;


	long long int sum = 0;

	
	for (int i = 1; i < n + 1; i++){
		cin >> a[i];
		sum += abs(a[i] - a[i - 1]);
	}

	sum += abs(a[n + 1] - a[n]);



	for (int i = 1; i < n + 1; i++){
		long long int t = sum;
		t = t - abs(a[i] - a[i - 1]) - abs(a[i+1] - a[i]) + abs(a[i+1] - a[i-1]);
		cout << t << endl;
	}
}

Measured memory_bytes: 1664
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#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--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main() {
    ll h, w;
    cin >> h >> w;
    if (h == 1 || w == 1) {
        cout << 1 << endl;
    } else {
        cout << ll(ceil((h * w) / (double) 2)) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vb= vector<bool>;
using vl= vector<ll>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

int main(){
  string at;
  char c;
  cin >> at >> c;
  cout << "A" << c << "C";
  
  return 0;
}


Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long n = Long.parseLong(scanner.next());
        scanner.nextLine();
        HashSet<String> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            set.add(scanner.nextLine());
        }
        System.out.println(set.size());
    }
}

Measured memory_bytes: 71760
// abc122_d
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define MOD (1000000007)
#define COUT(x) cout << x << endl

int dp[101][4][4][4];

int main() {
#ifdef LOCAL
    std::ifstream in("../arg.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;

    REP(s1, 4) REP(s2, 4) REP(s3, 4){
        if ((s1==0 && s2==1 && s3==2) || (s1==0 && s2==2 && s3==1) || (s1==1 && s2==0 && s3==2)) continue;
        dp[3][s1][s2][s3] = 1;
    }

    REPN(i, 3, N){
        REP(s1, 4) REP(s2, 4) REP(s3, 4){

            int x = dp[i][s1][s2][s3];

            if ((s1 == 0)  ||
                (s1 == 1 && s2 != 2 && s3 != 2) ||
                (s1 == 2 && s2 != 1) ||
                (s1 == 3 && !(s2 == 1 && s3 == 2)))
            {
                dp[i+1][0][s1][s2] = (dp[i+1][0][s1][s2] + x) % MOD;
            }

            if (!(s1 == 0 && s2 == 2)) {
                dp[i+1][1][s1][s2] = (dp[i+1][1][s1][s2] + x) % MOD;
            }

            dp[i+1][2][s1][s2] = (dp[i+1][2][s1][s2] + x) % MOD;
            dp[i+1][3][s1][s2] = (dp[i+1][3][s1][s2] + x) % MOD;
        }
    }

    int ans = 0;
    REP(s1, 4) REP(s2, 4) REP(s3, 4) {ans = (ans + dp[N][s1][s2][s3])%MOD;}
    COUT(ans);

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>

using namespace std;
struct Node{
    int key;
    Node *prev;
    Node *next;
};

Node *nil;

void init(){
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void insert(int key){
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil; 
}

Node* search(int key){
    Node *x = nil->next;
    while( x != nil && x->key != key){
        x = x->next;
    }
    return x;
    
}

void deleteNode(Node *t){
    if(t == nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst(){
    deleteNode(nil->next);
}

void deleteLast(){
    deleteNode(nil->prev);
}

void deleteKey(int key){
    deleteNode(search(key));
}

void printList(){
    Node *x = nil->next;
    int i = 1;
    while(1){
        if( x == nil) break;
        if( i == 0) printf(" ");
        printf("%d",x->key);
        i = 0;
        x = x->next;
    }
    printf("\n");
}
int main(){
    int n,key;
    char order[20];
    init();
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%s %d",order,&key);
        if(order[0] == 'i'){
            insert(key);
        } 
        else if(order[0] == 'd'){
            if(strlen(order) > 6){
                if(order[6] == 'F') deleteFirst();
                else if(order[6] == 'L') deleteLast();
            }
            else{
                deleteKey(key);
            }
        }
    }
    printList();
    return 0;
    
}


Measured memory_bytes: 34380
#include <iostream>
using namespace std; 
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a>b) swap(a,b);
    if(b>c) swap(b,c);
    if(a>b) swap(a,b);
     
    cout << a << " " << b << " "  << c << endl;
}


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <queue>

#define rep(i,n) for (int i=0; i < (n); ++i)
using ll = long long ;
using namespace std;
const int INF = 1001001001;
const int MOD = 1e9+7;

int main() {

    string s ;
    cin >> s  ;

    if(s[s.size()-1]=='s'){
       cout << s << "es" <<  endl ;
    }else{
       cout << s << 's' <<  endl ;
    }

    return 0 ;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define int ll
#define Endl endl

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


const int MAX_N=200010;
int n,dat[4*MAX_N-1]; ///////////
int Seg_init(int n_){
    n=1;
    while(n<n_)n*=2;
    for(int i=0;i<2*n-1;++i)dat[i]=0;
    return n;
}
void Seg_update(int k,int a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
        k=(k-1)/2;
        dat[k]=gcd(dat[2*k+1],dat[2*k+2]);
    }
}
int Seg_query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l)return 0;
    if(a<=l&&r<=b)return dat[k];
    int vl=Seg_query(a,b,2*k+1,l,(l+r)/2);
    int vr=Seg_query(a,b,2*k+2,(l+r)/2,r);
    return gcd(vl,vr);
}


signed main(){
    int N;
    int A[214514];
    cin >> N;
    REP(i,N){cin >> A[i];}
    int m = Seg_init(N);
    REP(i,N){
        Seg_update(i,A[i]);
    }
    
    //REP(i,3*N){cout << i << " ";}cout << endl;
    //REP(i,3*N){cout <<dat[i] << " ";}cout << endl;
    
    //cout << Seg_query(0,1,0,0,m) << endl; //////////////
    
    int Ans=max(Seg_query(1,N,0,0,m),Seg_query(0,N-1,0,0,m)); ///////////////////
    for(int i=1;i<N-1;i++){
        int l=Seg_query(0,i,0,0,m); ///////////
        int r=Seg_query(i+1,N,0,0,m); //////////////
        //cout << l<< " " << r << " ";
        l=gcd(l,r);
        Ans=max(Ans,l);
    }
    cout << Ans << endl;
    return 0;
}


Measured memory_bytes: 5120
def main():
    n, m, x = map(int, input().split())
    a = list(map(int, input().split()))
    right = list(filter(lambda y: y<x, a))
    left = list(filter(lambda y: y>x, a))
    print(min(len(right), len(left)))

if __name__ == "__main__":
    main()

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string S;
	cin >> S;
	sort(ALL(S));
	if (S[0]=='a' && S[1]=='b' && S[2]=='c' ){
		cout << "Yes" <<endl;
	}
	else{
		cout << "No" <<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import itertools
N,M,Q = map(int,input().split())
lis = []
for i in range(Q):
    lis.append(list(map(int,input().split())))

#lis = np.array(lis)
#lis = sorted(lis,reverse=True, key=lambda x:x[3])
pool = [0 for _ in range(M)]
for i in range(M):
    pool[i] = i+1
max = 0
for i in itertools.combinations_with_replacement(pool,N):
    #print(i)
    sum = 0
    for j in range(Q):
        if i[lis[j][1]-1] - i[lis[j][0]-1] == lis[j][2]:
            sum += lis[j][3]

    if sum>= max:
        #print(i)
        max = sum


print(max)

Measured memory_bytes: 9224
import Data.List

main = do
  getLine
  li <- getLine
  let ls = map read $ words li
  print $ compute ls

compute :: [Int] -> Int
compute ls = length
  [ ()
  | (a:ls1) <- tails ls
  , (b:ls2) <- tails ls1
  , a /= b
  , c <- ls2
  , a /= c, b /= c
  , a + b > c, b + c > a, c + a > b
  ]


Measured memory_bytes: 4632
#include <bits/stdc++.h>
typedef long long ll;
#define MOD 1000000007
using namespace std;

int main() {
    int a,b; cin >> a >> b;
    if(a>0) cout << "Positive" << endl;
    else if(b>=0) cout << "Zero" << endl;
    else if((b-a+1)%2 == 0) cout << "Positive" << endl;
    else cout << "Negative" << endl;
}

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

typedef pair <int, int> pii;

const int MAXN = 200005;
const int MOD = 1000000007;

int N;
pii p[MAXN];  
pii speed[MAXN];
int left[MAXN], right[MAXN];
int maks[MAXN];
int dp[MAXN];

void load() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++)
    scanf("%d%d", &p[i].first, &p[i].second);
}

inline int add(int x, int y) {
  x += y;
  if (x >= MOD) 
    x -= MOD;
  else if (x < 0)
    x += MOD;
  return x;
}

int solve() {
  sort(p + 1, p + N + 1);
  
  for (int i = 1; i <= N; i++)
    speed[i] = pii(p[i].second, i);
   
  sort(speed + 1, speed + N + 1);
  
  int pref_max = 0;
  for (int i = 1; i <= N; i++) {
    pref_max = max(pref_max, speed[i].second);    
    right[speed[i].second] = pref_max;
  }
  
  int suff_min = MAXN;
  for (int i = N; i; i--) {
    suff_min = min(suff_min, speed[i].second);
    left[speed[i].second] = suff_min;
  }
  
  for (int i = 1; i <= N; i++)
    maks[right[i]] = max(maks[right[i]], left[i]);
  
  int mx = 0;
  dp[0] = 1;
  for (int i = 1; i <= N + 1; i++) {
    dp[i] = add(add(dp[i - 1], dp[i - 1]), mx ? -dp[mx - 1] : 0);
    mx = max(mx, maks[i]);
  }
    
  return add(dp[N + 1], -dp[N]);
}

int main() {
  load();
  printf("%d\n", solve());
  return 0;
}

Measured memory_bytes: 6400
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
const int loose = 0;
const int tight = 1;

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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll n,r;
	cin >> n >> r;

	if (n >= 10) cout << r << en;
	else cout << r+100*(10-n) << en;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int x, a, b;
	int xa, xb;
	scanf("%d %d %d", &x, &a, &b);
	if (x < a)
	{
		xa = a - x;
	}
	else
	{
		xa = x - a;
	}
	if (x < b)
	{
		xb = b - x;
	}
	else
	{
		xb = x - b;
	}
	if (xa < xb)
	{
		printf("A\n");
	}
	else
	{
		printf("B\n");
	}
	return 0;
}

Measured memory_bytes: 128