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

using namespace std;
typedef long long ll;

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

int main(){
  ll N;
  cin >> N;
  vector<pair<ll, ll>> str0, str1;
  string buf;
  REP(n, N){
    cin >> buf;
    ll vmin = 0;
    ll v = 0;
    for(char& c : buf){
      if(c == ')'){
	v -= 1;
	if(vmin > v) vmin = v;
      }else{
	v += 1;
      }
    }
    ll A = -vmin;
    ll B = v - vmin;
    if(v >= 0){
      str0.push_back(make_pair(A, B));
    }else{
      str1.push_back(make_pair(-B, A));
    }
  }
  sort(ALL(str0));
  sort(ALL(str1));

  string ret = "Yes";
  ll cur = 0;
  for(auto& v : str0){
    ll A = v.first;
    ll B = v.second;
    //cout << A << " " << B << endl;
    cur -= A;
    if(cur < 0) ret = "No";
    cur += B;
  }
  for(auto& v : str1){
    ll B = -v.first;
    ll A = v.second;
    //cout << A << " " << B << endl;
    cur -= A;
    if(cur < 0) ret = "No";
    cur += B;
  }
  if(cur != 0) ret = "No";

  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 18568
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String c = sc.next();
        
        if ( c.equals("a") || c.equals("i") || c.equals("u") || c.equals("e") || c.equals("o") ) {
            System.out.println("vowel");
        } else {
            System.out.println("consonant");
        }

        sc.close();
    }
}

Measured memory_bytes: 22868
#include <iostream>
#include <list>
#include <vector>

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> v(n,vector<int>(0));
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    v.at(a-1).push_back(b);
    v.at(b-1).push_back(a);
  }

  vector<int> r;
  r.push_back(1);
  for (int i = 0; i < n-1; ++i) {
    r.push_back(0);
  }

  int res = 1;
  list<int> next = {1};
  while (true) {
    list<int> new_next = {};
    for (list<int>::iterator itn = next.begin(); itn != next.end(); ++itn) {
      vector<int>vv = v.at((*itn)-1);
      for (int j = 0; j < vv.size(); ++j) {
        int t = vv.at(j);
        if (r.at(t-1) == 0) {
          r.at(t-1) = (*itn);
          new_next.push_back(t);
          res++;
        }
      }
    }
    
    if (new_next.size() == 0) {
      break;
    }
    next = new_next;
  }

  if (res == n) {
    cout << "Yes" << endl;
    for (int i = 1; i < n; ++i) {
      cout << r.at(i) << endl;
    }
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 15776
n, k, q = map(int, input().split())
## n人の参加者、kポイントを持ち、q回の正解がある
## kは最大で10億あるのでintでok
## n, qは最大で10000なのでリストを持つ
scores = [0] * n
for x in range(q):
  ac_person = int(input())
  scores[ac_person - 1] += 1
## 正解者にスコアを足していって、スコア + k - q > 0ならYesと出力
for x in range(n):
  if scores[x] + k - q > 0:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 4680
#define ONLINE_JUDGE
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
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;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

ll S;
ll W;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> S;
    cin >> W;
    solve();
}

// 1 <= S <= 100
// 1 <= W <= 100

// ll S, ll W
// 羊が狼に襲われるなら unsafe、襲われないなら safe を出力せよ。
void solve(){
    cout<<(S<=W?"unsafe":"safe")<<endl;
}


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

int main() {
  std::string s;
  std::cin >> s;

  size_t res = s.length();
  for (auto first = s.begin(); first < s.end(); ++first) {
    if (*first == 'A') break;
    --res;
  }

  for (auto last = s.end(); --last > s.begin();) {
    if (*last == 'Z') break;
    --res;
  }

  std::cout << res << std::endl;
}

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

int count(int n, int x)
{
  int ans = 0;
  for (int i=1; i<=n-2; i++)
    for (int j=i+1; j<=n-1; j++)
      for (int k=j+1; k<=n; k++)
        if (i+j+k==x) ++ans;
  return ans;
}

int main()
{
  while (1) {
    int n, x;
    cin >> n >> x;
    if (n == 0 && x == 0) break;
    cout << count(n, x) << endl;
  }
  return 0;
}



Measured memory_bytes: 3092
N = int(input())
Ps = list(map(int,input().split()))
cnt = 0
for i in range(1,N-1):
  if Ps[i-1] < Ps[i]<Ps[i+1] or Ps[i+1] < Ps[i]<Ps[i-1]:
    cnt+=1
print(cnt)

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

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

	if (a <= b * 2) {
		cout << "0" << endl;
	}
	else {
		cout << a - b * 2 << endl;
	}

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;

int main(){
  int L, R, d;
  cin >> L >> R >> d;
  int ans = R / d;
  ans -= (L-1)/d;
  cout << ans << endl;
  
  return 0;
}

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

void fnInput(int& rnTrgSu, int& rnTrgKin)
{
  cin >> rnTrgSu >> rnTrgKin;
}

int fnRcsSch(int nPos, int nTrgSu, int nTrgKin, vector<int>& rvnMoneyCnt)
{
  const vector<int> cnvnMoney{10000, 5000, 1000};

  if (nTrgSu == 0 && nTrgKin == 0)  return  1;
  if (nTrgKin <  0)                 return -1;
  if (nPos == rvnMoneyCnt.size())   return  0;

  if (nPos == rvnMoneyCnt.size() - 1)
  {
    rvnMoneyCnt[nPos] = nTrgSu;
    return fnRcsSch(nPos + 1, 0, nTrgKin - cnvnMoney[nPos] * nTrgSu, rvnMoneyCnt);
  }
  else
    for (int i = 0; i <= nTrgSu; i++)
    {
      rvnMoneyCnt[nPos] = i;
      for (int i = nPos + 1; i < rvnMoneyCnt.size(); i++)
        rvnMoneyCnt[i] = 0;

      int nRslt = fnRcsSch(nPos + 1, nTrgSu - i, nTrgKin - cnvnMoney[nPos] * i, rvnMoneyCnt);
      if      (nRslt ==  1)  return 1;
      else if (nRslt == -1)  break;
    }

  rvnMoneyCnt[nPos] = 0;
  return 0;
}

int fnExhSch(int nTrgSu, int nTrgKin)
{
  vector<int> vnMoneyCnt(3);

  if (fnRcsSch(0, nTrgSu, nTrgKin, vnMoneyCnt))
  {
    for (int i = 0; i < vnMoneyCnt.size(); i++)
    {
      if ( i )  cout << " ";
      cout << vnMoneyCnt[i];
    }
    cout << endl;
  }
  else
    cout << -1 << " " << -1 << " " << -1 << endl;
}

int main()
{
  int nTrgSu, nTrgKin;
  
  fnInput(nTrgSu, nTrgKin);
  fnExhSch(nTrgSu, nTrgKin);

  return 0;
}

Measured memory_bytes: 256
class Main{
  public static void main(String[] args){
    String w=new java.util.Scanner(System.in).next();
    int a=0;
    if(w.equals("SSS")){}
    else if(w.equals("SRR")||w.equals("RRS")){a=2;}
    else if(w.equals("RRR")){a=3;}
    else{a=1;}
    System.out.println(a);
  }
}


Measured memory_bytes: 35256
#include <iostream>
#include <algorithm>
#define MAX_N 200001
using namespace std;

int N, K;
int A[MAX_N] = {0};

int main(){
    cin >> N >> K;
    for(int i = 0; i < N; ++i){
        int a;
        cin >> a;
        A[a]++;
    }
    sort(A, A + MAX_N);
    reverse(A, A + MAX_N);

    int ans = 0;
    for(int i = K; i < MAX_N; ++i){
        if(A[i] == 0) break;
        ans += A[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define repe(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF 100000000

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

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    IO;

    ll N; cin >> N;

    vector<ll> x(N), y(N), h(N);

    vector<pair<ll, pair<ll, ll> > > pa;

    rep(i, N) {
        cin >> x[i] >> y[i] >> h[i];
        pair<ll,ll> a = make_pair(x[i], y[i]);
        pa.push_back(make_pair(h[i], a));
    }

    sort(all(pa));

    rep(i, 101) {
        rep(j, 101) {
            ll H = pa[N - 1].first + abs(pa[N - 1].second.first - i) + abs(pa[N - 1].second.second - j);
            ll jj = 0;
            rep(k, N) {
                if (max(H - abs(i - x[k]) - abs(j - y[k]), (ll)0) == h[k]) {
                    ++jj;
                }
            }
            if (jj == N) {
                cout << i << " " << j << " " << H << endl;
                return 0;
            }
        }
    }

}

Measured memory_bytes: 3188
import Control.Applicative

main :: IO ()
main = solve <$> readLn >>= print

solve :: Int -> Int
solve n = sum_mult n 1 - sum_mult n 3 - sum_mult n 5 + sum_mult n 15

sum_mult :: Int -> Int -> Int
sum_mult x y =
  let i = x `div` y in
  i * (i + 1) `div` 2 * y


Measured memory_bytes: 3880
#include<stdio.h>
#define swap(X, Y) {int Z; Z = Y;Y = X;X = Z;} 
int main(void)
{
	int i, a, b, c, div = 0;
	scanf("%d %d %d", &a, &b, &c);
	for(i = a; i <= b; i++)
	{
		if(c % i == 0)
		{
			div++;
		}
	}
	printf("%d\n", div);
	return 0;
} 


Measured memory_bytes: 2748
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while (true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
using namespace std;
// clang-format on

template<typename T> int LCS(const T &a, const T &b) {
  const int n = a.size(), m = b.size();
  vvi dp(n + 1, vi(m + 1));
  rep(i, n) rep(j, m) {
    if (a[i] == b[j]) cmax(dp[i + 1][j + 1], dp[i][j] + 1);
    cmax(dp[i + 1][j + 1], max(dp[i + 1][j], dp[i][j + 1]));
  }
  return dp.back().back();
}

main {
  int n;
  cin >> n;
  while (n--) {
    string x, y;
    cin >> x >> y;
    cout << LCS(x, y) << endl;
  }
}

Measured memory_bytes: 10780
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
        ae: [usize; 5],
    }

    let mut max = 0;

    for i in ae {
        let x = (n-1) / i + 5;
        max = std::cmp::max(max, x);
    }

    println!("{}", max);
}


Measured memory_bytes: 2148
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

# print("Yes")
# print("No")

# print("YES")
# print("NO")


N, K = map(int,input().split())

mm = N%K

print(min(mm,abs(mm-K)))





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

#define int long long

int N, M, sum = 0, T[10000], ans[10000];

signed main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> T[i];
        sum += T[i];
    }
    cin >> M;
    for (int i = 0; i < M; i++) {
        int P, X;
        cin >> P >> X;
        ans[i] = sum - T[P - 1] + X;
    }
    for (int i = 0; i < M; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}


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

using namespace std;
// typedef unsigned long long ull;


int main(int argc, char const *argv[]) {
    int N;
    string S;
    cin >> N >> S;

    int x = 0;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'I') {
            x += 1;
        } else {
            x -= 1;
        }
        ans = max(x, ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/*
g++ -std=c++11 -o2 -Wall AGC025A.cpp -o ./out/AGC025A.out
./out/AGC025A.out
*/

#include <bits/stdc++.h>
using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define tr(c, i) for (iter(c) != (c).begin(); i != (c).end(); ++i)
#define pb push_back
#define mp make_pair

typedef long long ll;

int main(){
//    freopen("./input/input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int d = log10(n) + 1;
    int ans = 0;
    if (d == 1) ans = n;
    else {
      for (int i = 0; i < d; ++i) {
        ans += (n % 10);
        n /= 10;
      }
      if (ans == 1) ans = 10;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 512
#include <iostream>
#include <string>

using namespace std;

int main(){
	int answer = 0;
	string s;
	while(getline(cin, s)){
		int i = 0, j = s.size() - 1;
		bool accept = true;
		while(accept && i < j){
			if(s[i] != s[j]){ accept = false; }
			++i; --j;
		}
		if(accept){ ++answer; }
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 1176
H, W, K = map(int, input().split())

s = [list(input()) for i in range(H)]
cur = 1
for h in range(H):
  for w in range(W):
    if(s[h][w] != "#"): continue
    l = w - 1
    r = w + 1
    u = h - 1
    d = h + 1
    while(0 <= l < W and s[h][l] == "."):
      l -= 1
    l += 1
    while(0 <= r < W and s[h][r] == "."):
      r += 1
    r -= 1
    while(0 <= u < H and all([x == "." for x in s[u][l:r+1]])):
      u -= 1
    u += 1
    while(0 <= d < H and all([x == "." for x in s[d][l:r+1]])):
      d += 1
    d -= 1
    for ah in range(u, d+1):
      for aw in range(l, r+1):
        s[ah][aw] = cur
    cur += 1
for h in range(H):
  print(" ".join(map(str, s[h])))

Measured memory_bytes: 7148
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e13;
const int mod = 1e9+7;
#define ll long long

signed main() {
    int n;
    cin >> n;
    vector<int> a(n);
    int ans = pow(3,n);
    int odd = 1;
    rep(i,n) {
        cin >> a[i];
        if(a[i]%2==0) odd*=2;        
    }
    cout << ans-odd << endl;
}



Measured memory_bytes: 4060
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define maxn 100005
using namespace std;
typedef long long ll;
int n;
int cnt[maxn];
int main()
{
	ll ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		cnt[x]++;
		ans+=x;
	}
	int _;
	scanf("%d",&_);
	while(_--)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		ans-=1ll*x*cnt[x];
		ans+=1ll*y*cnt[x];
		cnt[y]+=cnt[x];
		cnt[x]=0;
		printf("%lld\n",ans);
	}
}

Measured memory_bytes: 4204
L,R=map(int,input().split())
MOD=2019

if R-L>=MOD-1:
    print(0)
else:
    min_mod = 2019
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            m = (i*j) % MOD
            min_mod = min(m, min_mod)
    print(min_mod)


Measured memory_bytes: 2940
#include <iostream>
using namespace std;
int main(void){
    int a;
    cin>>a;
    
    int n[a];
    int i;
    int sum=0;
    int num1=0;
    int ans;
    int min=10001;
    for(i=0; i<a; i++){
        cin>>n[i];
        sum=sum+n[i];
    }
    for(i=0; i<a; i++){
        num1=num1+n[i];
        ans=num1-(sum-num1);
        if(ans<0){
            ans=ans*-1;
        }
        if(ans<min){
            min=ans;
        }
    }
    cout<<min;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	stack<int>s;
	for (string c; cin >> c;) {
		if (c == "+") {
			int a = s.top(); s.pop();
			int b = s.top(); s.pop();
			s.push(a + b);
		}
		else if (c == "*") {
			int a = s.top(); s.pop();
			int b = s.top(); s.pop();
			s.push(a * b);
		}
		else if (c == "-") {
			int a = s.top(); s.pop();
			int b = s.top(); s.pop();
			s.push(b - a);
		}
		else {
			s.push(stoi(c));
		}
	}
	cout << s.top() << endl;
	return 0;
}

Measured memory_bytes: 3168
class Integer
  def divisor_list
    return [1] if self == 1
    (1..Math.sqrt(self).to_i).select do |i|
      self%i == 0
    end.map {|e| [e, self/e]}.flatten.uniq.sort
  end
end
n=gets.to_i
puts n.divisor_list[n.divisor_list.size/2].to_s.size


Measured memory_bytes: 2040
import sys

input = sys.stdin.readline


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

    cnt = [0] * N
    for _ in range(M):
        a, b = map(int, input().split())
        cnt[a - 1] += 1
        cnt[b - 1] += 1

    ans = "YES"
    for c in cnt:
        if c % 2 != 0:
            ans = "NO"
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3828
import sys
def solve(stns, idx, mem):

    if idx >= len(stns) -1:
        return 0

    if idx in mem: 
        return mem[idx]

    if idx == len(stns) - 2: 
        # can take only one step
        # print(idx)  
        # final_step = solve(stns, idx + 1, mem) + abs(stns[idx] - stns[idx+1])
        final_step = abs(stns[idx] - stns[idx+1])
        mem[idx] = final_step
        return final_step
    else: 
        # step: i + 11
        step1 = solve(stns, idx + 1, mem) + abs(stns[idx] - stns[idx+1])
        # step: i + 2
        step2 = solve(stns, idx + 2, mem) + abs(stns[idx] - stns[idx+2])

        min_cost = min(step1, step2)
        mem[idx] = min_cost 

        return min_cost



def take_input():
    # n = input()
    # stns = [int(x) for x in input().split(' ')]



    reader = (s.rstrip() for s in sys.stdin)
    input = reader.__next__
    sys.setrecursionlimit(1000000)
    # do magic here
    n = int(input())
    stns = [int(x) for x in input().split()]
    mem = {}
    res = solve(stns, 0, mem)
    print(res)

take_input()

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

int main()
{

	int n,m;
	cin>>n>>m;
	int ar[n];
	float sum=0;
	for(int i=0;i<n;++i){
		cin>>ar[i];
		sum+=ar[i];
	}
	sort(ar,ar+n,greater<int>());
	float x= (sum/(4*m));
	int flag=0;
	for(int i=0;i<m;++i)
	{
		if(ar[i]<x)
		{
			flag=1;
			break;
		}
	}
	if(flag==1)
		cout<<"No\n";
	else
		cout<<"Yes\n";
}	

Measured memory_bytes: 256
#include<stdio.h>
int search(int A[],int n,int key){
    int l=0,r=n;
    int mid;
    while(l<r){
	mid=(l+r)/2;
	if(key<A[mid]) r=mid; 
	else if(key>A[mid]) l=mid+1;
	else return 1;
    }
    return 0;
}

int main(void){
    int n,A[100000],q,key,sum=0;
    int i;

    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&A[i]);
    scanf("%d",&q);
    for(i=0;i<q;i++){
	scanf("%d",&key);
	if(search(A,n,key)) sum++;
    }
    printf("%d\n",sum);

    return 0;
}

Measured memory_bytes: 988
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<random>
#include<map>
#include<queue>
using namespace std;


int main(){

  long long int n, m;
  cin >> n >> m;

  long long int ans = 0;
  if( n*2 <= m ){
    ans += n;
    m -= n*2;
    n -= n;
  }else{
    long long int tmp = m/2;
    n -= tmp;
    m -= tmp*2;
    ans += tmp;
  }
  ans += m / 4;

  cout << ans << endl;

  return 0;
}








// EOF


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

int main(int argc , char **argv)
{
	(void)argc;
	(void)argv;

	int A,B;
	cin >> A >> B;

	bool ans = false;
	if (A%3 == 0){
		ans = true;
	}else if (B%3 == 0){
		ans = true;
	}else if ((A+B)%3 == 0){
		ans = true;
	}

	if (ans == false){printf("Impossible\n");}else{printf("Possible\n");}

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef pair<int, int> pii;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

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; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }

class D {
	string s;
	int x, y;
	vector<vector<bool>> dpx, dpy;
	static const int offset{ 8001 };
	static const int MAX{ 2 * offset + 1 };

public:
	D()
	{
		cin >> s >> x >> y;

		dpx.resize(1, vector<bool>(MAX, 0));
		dpy.resize(1, vector<bool>(MAX, 0));

		dpx[0][offset] = 1;
		dpy[0][offset] = 1;

	}
	void solve()
	{

		bool xmove{ true };
		int d{ 0 };
		int nx{ 0 }, ny{ 0 };
		int i{ 0 };

		if (s[0] == 'F')
		{
			while (s[i] == 'F')
			{
				++i;
				++d;
			}
			nx++;
			dpx.emplace_back(vector<bool>(MAX, 0));
			dpx[1][d + offset] = 1;
			d = 0;
			xmove = false;
			++i;
		}

		for (; i < SZ(s); i++)
		{
			if (s[i] == 'F')
				++d;

			if (s[i] == 'T' || (i == SZ(s) - 1))
			{
				if (d)
				{
					if (xmove)
					{
						dpx.emplace_back(vector<bool>(MAX, 0));
						REP(i, MAX)
						{
							if (dpx[nx][i])
							{
								if (i - d >= 0 && i - d < MAX)
									dpx[nx + 1][i - d] = 1;
								if (i + d >= 0 && i + d < MAX)
									dpx[nx + 1][i + d] = 1;
							}
						}
						++nx;
					}

					else
					{
						dpy.emplace_back(vector<bool>(MAX, 0));
						REP(i, MAX)
						{
							if (dpy[ny][i])
							{
								if (i - d >= 0 && i - d < MAX)
									dpy[ny + 1][i - d] = 1;
								if (i + d >= 0 && i + d < MAX)
									dpy[ny + 1][i + d] = 1;
							}
						}
						++ny;
					}
				}

				xmove = !xmove;
				d = 0;
			}
		}

		//
		//REPC(i, nx)
		//{
		//	for (int j{ offset - 7 }; j < offset + 7; j++)
		//	{
		//		if (j == offset)
		//			cout << "   " <<  dpx[i][j] << "   ";
		//		else
		//			cout << dpx[i][j] << " ";
		//	}
		//	cout << endl;
		//}
		//
		
		if (dpx[nx][x + offset] && dpy[ny][y + offset])
			cout << "Yes";
		else
			cout << "No";
		cout << endl;

	}
};


int main()
{
	D solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 8320
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define ll long long
#define ull  unsigned long long
#define pb push_back
#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 255000;
int a[N], b[N];
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt",  "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    int m;
    cin >> m;
    for (int j = 1; j <= m; j++) cin >> b[j];
    sort(a + 1, a + n + 1);
    sort(b + 1, b + m + 1);
    int t = 1;
    for (int i = 1; i <= m; i++){
        while(t <= n && a[t] < b[i]) t++;
        if (t == n + 1 || a[t] != b[i]){
            cout << "NO";
            return 0;
        }
        t++;
    }
    cout << "YES";
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <bitset>
using namespace std;
typedef long long int lli;
int main(void)
{
    int N;
    string s;
    cin >> s;
    cout << s[0] << s[1] << s[2] << endl;
    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  200010

#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;
#define PI 3.14159265358979323846

using namespace std;
int MOD = 1000000007;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int ret = 0;
  int lens = s.size();
  vector<int> dp(lens);
  if( s[0] == 'R' ) {
     dp[0] = 1;
     ret = 1;
     }
  for(int i = 1 ; i < lens ; ++i ){
    if(  i > 0 && s[i] == 'R' ) {
      dp[i] = dp[i-1] + 1;
      ret = max(ret,dp[i]);
    }
    else {
      dp[i] = 0;
    }
  }
  cout << ret << endl;

  return 0;
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
string s,s1,ss,ss1;
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	getline(cin,s);
	getline(cin,s1);
	int len=s.size();
	int len1=s1.size();
	for(int i=0;i<len;i++)
	{
		if(s[i]!=' ')  ss+=s[i];
	}
	for(int i=0;i<len1;i++)
	{
		if(s1[i]!=' ')  ss1+=s1[i];
	}
	int len2=ss.size();
	int len3=ss1.size();
	if(len3>len2)
	{
		swap(ss,ss1);
		swap(len3,len2);
	}
	for(int i=0;i<len2;i++)
	{
		cout<<ss[i];
		if(i<len3)  cout<<ss1[i];
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr))
;
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;wahile(t--) 
const int maxx  = 3*1e5 , limit = 1e17 , MOD=1e9+7;
string binary(int n){bitset<32>b(n) ;string p =b.to_string();return p;}
int decimal(string s){int res = 0; for(int i = 0; i < s.size() ; i++ ){if(s[i] == '1')res = res + pow(2,s.size() - i -1);}    return res;}
bool isPrime(int n){if (n <= 1) return false; if (n <= 3) return true;if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; }
int pow (int x, int n,int mod) {if (n == 0) return 1; int res = pow (x, n / 2,mod);res = (res * res) % mod;if (n % 2) res = (res * x ) % mod;return res;}
int calcInverse(int a, int n = MOD){int t = 0, newt = 1;int r = n, newr = a;  while (newr != 0) {auto quotient = r /newr;tie(t, newt) = make_tuple(newt, t- quotient * newt);
tie(r, newr) = make_tuple(newr, r - quotient * newr);}if (r > 1)throw runtime_error("a is not invertible");if (t < 0)t += n;t=t%n;    return t;}
#define boost  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int32_t main(){
    boost;
    int n,k;cin>>n>>k;
    int a[n+1];
    for(int i =0 ; i < n;i++ )cin>>a[i];
    int dp[n+1];//memset(dp,0,sizeof(dp));
    dp[1] = abs(a[1]-a[0]);
    dp[0] = 0;
    for(int i=2;i<=n;i++)dp[i]=limit;
    for(int i = 2 ; i < n ; i++ ){
        
        for(int j = 1 ; j <=k ; j++){
            if(i-j>=0)
            dp[i] = min(dp[i-j]+abs(a[i]-a[i-j]) , dp[i]);
        }
                
    }
    // for(int i = 0; i < n ;i++ ){
    //     cout<<dp[i]<<" ";
    // }nl;
    cout<<dp[n-1]<<endl;
    
}   

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int a[10000];
int main(){
	int n;
	cin>>n;
	for (int i=1;i<=n;i++)cin>>a[i];
	bool flag=1;
	for (int i=1;i<=n;i++){
		if (a[i]%2==1)continue;
		if (a[i]%3==0)continue;
		if (a[i]%5==0)continue;
		flag=0;
		break;
	}
	if (flag){
		cout<<"APPROVED"<<endl;
	}else cout<<"DENIED"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}


int main(){
	ll n;
	cin>>n;
	map<ll, ll> cnt;
	rep(i, n){
		ll x;
		cin>>x;
		++cnt[x];
	}
	ll res = 0;
	for(auto x: cnt) res += x.snd%2;
	cout<<res<<endl;
	return 0;
}


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

int main() {
    int n,num;
    cin>>n;
    string word[n];
    bool ans=true;
    for(int i=0;i<n;i++){
        cin>>word[i];
    }
    for(int j=1;j<n;j++){
        num=word[j-1].size()-1;
        if(word[j][0]!=word[j-1][num]){
            ans=false;
            
        }
        for(int k=0;k<j;k++){
            if(word[j]==word[k]){
                ans=false;
            }
        }
    }
    if(ans==true){
        cout<<"Yes";
    }
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
void main() {
	auto N = ri;
	alias Pair = Tuple!(int, "index", int, "point");
	Pair[][string] m;
	foreach(i; 0..N) {
		auto ip = readln.split, S = ip[0], P = ip[1].to!int;
		m[S] ~= Pair(i+1, P);
	}
	foreach(i; m.keys.dup.sort().array) {
		auto arr = m[i].dup.sort!((i, j) => i.point > j.point).array;
		foreach(v; arr) writeln(v.index);
	}
}
// =======================111=1===========

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.ascii : toLower;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}

T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#define rep(i,k) for(int i =0; i<k; i++)
#define ll long long int

using namespace std;



int main() {
    int n;
    cin >> n;
    int a[n];
    bool check = true;
    for(int i = 0; i <n; i++){
        cin >> a[i];
        if(a[i]%2 == 0){
            if(a[i]%3==0 || a[i]%5==0){
                continue;
            }else{
                check = false;
            }
        }
    }
    
    if(check){
        cout << "APPROVED";
    }else{
        cout << "DENIED";
    }
    
}


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

#define ll long long 
#define debug if (debug_message)

#define file_io 0
#define debug_message 0

int i,t,j;
int n,nt,lens;
char s1[200005],s2[200005];

int main(){
	if (file_io){
		freopen(".in","r",stdin);
		freopen(".out","w",stdout);
	}
	
	scanf("%s\n%s",s1,s2);
	lens=strlen(s1);
	
	for (i=0; i<lens; ++i) {
		if (s1[i]!=s2[i]) ++n;
	}
	
	printf("%d\n",n);
	
	return 0;
}
/*

*/

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

int main() {
    int a, b;
    cin >> a >> b;
    
    if ((a + b) < 10) {
        cout << (a + b) << endl;
    }
    else {
        cout << "error" << endl;
    }
    
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<long long> sz(N),Msz(N);
  for (int i = 0; i < N; i++) cin >> sz[i];
  sort(sz.begin(), sz.end());
  
  for (int i = 0; i < N; i++) {
    if (i == 0) Msz[i] = sz[i];
    else Msz[i] = sz[i] + Msz[i-1];
  }
  
  long long ans = 1;
  for (int i = N-1; i >= 1; i--) {
    if (sz[i] > Msz[i-1] * 2) break;
    ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<sstream>
#include<climits>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main() {
  string str;
  cin >> str;

  str[3] = '8';

  cout << str << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  vector<ll>dp(20010,INF);
  dp[0]=0;
  ll h,n;
  cin>>h>>n;
  vl a(n),b(n);
  rep(i,n)cin>>a[i]>>b[i];
  rep(i,n){
    rep(j,20010){
      if(j>=a[i])dp[j]=min(dp[j],dp[j-a[i]]+b[i]);
    }
  }
  ll MIN=INF;
  for(ll i=h;i<dp.size();i++)MIN=min(MIN,dp[i]);
  cout<<MIN<<endl;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(void)
{
    string s;
    while(cin>>s)
    {
        int a[26]={0};
        for(int i=0;i<s.size();i++)
            a[s[i]-'a']++;
        int flag=0;
        for(int i=0;i<26;i++)
        {
            if(a[i]==0)
            {
                flag=1;
                printf("%c\n",i+'a');
                break;
            }
        }
        if(!flag)
            cout<<"None"<<endl;
    }
    return 0;
}


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

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

  int xa=max({a,b,c}),xb=min({a,b,c});
  cout << 10*xa+(a+b+c-xa-xb)+xb << endl;
  return 0;
}


Measured memory_bytes: 256
//Grading

#include<stdio.h>

int main()
{
    int m,f,imax;
    int i=0, j=0;
    int Sum[50]={0};
    char G[50]={};//{0}や{NULL}はだめ？    //https://teratail.com/questions/67582
    int r[50]={0};
    
    while(1){
        scanf("%d %d %d",&m, &f, &r[i]); //\nがトラブルの原因になってた。https://www.sejuku.net/blog/24965
        if(m==-1 && f==-1 && r[i]==-1){
            imax = i-1;
            break;
        }
        
        Sum[i] = m + f;
        if(m==-1 || f==-1){
            Sum[i] = 0;
        }
        i++;
    }

    for(j=0; j<=imax; j++){
        if(Sum[j] >= 80)                     G[j] = 'A'; 
        else if(80 > Sum[j] && Sum[j] >= 65) G[j] = 'B';
        else if(65 > Sum[j] && Sum[j] >= 50) G[j] = 'C';
        else if(50 > Sum[j] && Sum[j] >= 30){
            if(r[j] >= 50)                   G[j] = 'C';
            else                             G[j] = 'D'; //?
        }
        else if(30 > Sum[j] /*&& Sum[j] >= 0*/)  G[j] = 'F'; //> 0 はだめ
    
        printf("%c\n",G[j]);//%sではだめ
        //printf("%c %d \n",G[j], Sum[j] );
    }
    return 0;
}


Measured memory_bytes: 2756
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

const i64 timeLimit = 1900;

unsigned long xor128()
{
  static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
  unsigned long t = (x ^ (x << 11));
  x = y;
  y = z;
  z = w;
  return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

int main()
{
  i64 N;
  cin >> N;
  vector<i64> A(N), B(N);
  for (i64 i = 0; i < N; i++)
    cin >> A[i];
  for (i64 i = 0; i < N; i++)
    cin >> B[i];
  reverse(B.begin(), B.end());
  i64 cnt = 0;
  for (i64 i = 0; i < N; i++)
    if (A[i] == B[i])
      cnt++;
  chrono::system_clock::time_point start = chrono::system_clock::now();
  while (chrono::duration_cast<chrono::microseconds>(chrono::system_clock::now() - start).count() / 1000 < timeLimit)
  {
    i64 x = xor128() % N, y = xor128() % N;
    if (A[x] == B[y] || A[y] == B[x])
      continue;
    if (A[x] == B[x])
      cnt--;
    if (A[y] == B[y])
      cnt--;
    swap(B[x], B[y]);
    if (cnt == 0)
    {
      cout << "Yes" << endl;
      for (i64 i = 0; i < N; i++)
        cout << B[i] << " "[i + 1 == N];
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 6424
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

string S;

int main(void){
    
    cin >> S;
    for(int i = 0; i < S.size(); ++i){
        if(S[i] == '1') printf("9");
        else if(S[i] == '9') printf("1");
        else printf("%c", S[i]);
    }
    printf("\n");
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
       	int N = sc.nextInt();
        //String[] results = new String[N];
        int a=0,t=0,w=0,r=0;
      	for(int i=0;i<N;i++){
        	String temp=sc.next();
            if(temp.equals("AC")){
            	a++;
            }
            else if(temp.equals("WA")){
            	w++;
            }
          	else if(temp.equals("TLE")){
            	t++;
            }
          	else if(temp.equals("RE")){
            	r++;
            }
        }
      	
        System.out.println("AC"+ " x "+ a);
      	System.out.println("WA"+ " x "+ w);
      	System.out.println("TLE"+ " x "+ t);
      	System.out.println("RE"+ " x "+ r);
      
    }
}

Measured memory_bytes: 58784
#include <stdio.h>

int main()
{
	int L, N = 2, M, i = 4, rem = 0, sum = 0;
	scanf("%d", &L);

	while (L >= i)
		i <<= 1, N++;
	M = 2 * (N-1), i >>= 1;
	if (L != i) {
		rem = i = L - i;
		while (i)
			M += (i&1), i >>= 1;
	}
	printf("%d %d\n", N, M);

	for (i = 1; i < N; i++) {
		printf("%d %d 0\n", i, i+1);
		printf("%d %d %d\n", i, i+1, 1 << (N-1-i));
	}
	
	if (rem) {
		for (i = 0; i < N-1; i++)
			if (rem & (1<<i)) {
				sum += 1<<i;
				printf("1 %d %d\n", N-i, L-sum);
			}
	}

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define all(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

vector<pair<int,ll>> G[100005];
ll dist[100005];

void dfs(int s, int p, ll d){
    dist[s] = d;
    for (auto x:G[s]){
        int v = x.first;
        ll cost = x.second;
        if(v==p) continue;
        dfs(v,s,d+cost);
    }
}

int main(){
    int N; cin >> N;
    REP(i,N){
        int u, v; ll w;
        cin >> u >> v >> w;
        G[u-1].push_back(make_pair(v-1,w));
        G[v-1].push_back(make_pair(u-1,w));
    }
    dfs(0,-1,0);
    REP(i,N) cout << dist[i] % 2 << endl;
    return 0;
}

Measured memory_bytes: 10240
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

A,B,C=get_i.sort{|x,y| y<=>x}
dif1=A-C
dif2=A-B
if (dif1+dif2).even?
  puts (dif1+dif2)/2
else
  puts (dif1+dif2+1)/2+1
end

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
  string s, a, b;
  cin>>s;
  int aa=(s.length()-1)/2;
  int bb=(s.length()+3)/2;
  a=s.substr(0, aa);
  b=s.substr(bb-1, s.length());
  vector<string> hoge={s, a, b};
  string ans="Yes";
  for(int i=0; i<3; i++){
    string re=hoge.at(i);
    reverse(re.begin(), re.end());
    for(int j=0; j<hoge.at(i).length(); j++){
      if(hoge.at(i).at(j)!=re[j]){
        ans="No";
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
integer(16) N
integer(16) A,B,C,D,E
integer(16) t
integer(16) town(1:5)
read*,N,A,B,C,D,E
if(A==min(A,B,C,D,E))then
  t=5+(N-1)/A
  else
    if(B==min(B,C,D,E))then
      t=5+(N-1)/B
      else
      if(C==min(C,D,E))then
        t=5+(N-1)/C
        else
      if(D==min(D,E))then
        t=5+(N-1)/D
        else
        t=5+(N-1)/E
      end if
    end if
  endif
endif
print"(I0)",t
end

Measured memory_bytes: 256
a, b = map(int, input().split())
c = [list(map(int, input().split()))for _ in range(a)]
d = [list(map(int, input().split()))for _ in range(b)]
e = []
for i in range(a):
    f = 10 ** 9
    g = 0
    for j in range(b):
        if f > abs(c[i][0] - d[j][0]) + abs(c[i][1] - d[j][1]):
            f = abs(c[i][0] - d[j][0]) + abs(c[i][1] - d[j][1])
            g = j + 1
    e.append([g, f])
for i in range(a):
    print(e[i][0])


Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n, P[15], Q[15];
int a, b;
int input[15];
void next()
{
	int index1, index2;
	for(int i=n;i>=1;i--)      //第一步 
	{
		if(input[i-1]<input[i])
		{
			index1 = i-1;
			break;
		}
    } 
    for(int i=n;i>=index1;i--)   //第二步 
    {
    	if(input[i]>input[index1])
    	{
    		index2 = i;
    		break;
		}
	}
	int t = input[index1];        //第三步 
	input[index1] = input[index2];
	input[index2] = t;
	int i = index1+1, j = n;
	while(i<j)
	{
		int t = input[i];
		input[i] = input[j];
		input[j] = t;
		i++; j--;
	}
//	printf("index1=%d index2=%d\n", index1, index2);
}
int cmp(int a[])
{
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=input[i])
		    return 0;
	}
	return 1;
}
int main()
{
    scanf("%d", &n);
    for(int i=1;i<=n;i++)
    {
    	scanf("%d", &P[i]);
	}
	for(int i=1;i<=n;i++)
    {
    	scanf("%d", &Q[i]);
	}
	for(int i=1;i<=n;i++)
	{
		input[i] = i;
	}
	int i = 1;
	while(1)
	{
		if(a&&b) break;
		if(cmp(P))
		{
			a = i;
		}
		if(cmp(Q))
		{
			b = i;
		}
		i++;
		next();
	}
	if(a>=b) printf("%d\n", a-b);
	else printf("%d\n", b-a);
	return 0;
}

Measured memory_bytes: 128