akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>  
using namespace std;  
#define INF 0x3f3f3f3f  
typedef long long ll;  
const int N = 310;  
#define FI first
#define SE second
typedef pair<int, int>pii;

char num[N];
bool vis[N];
int main()  
{  
 
 
   // ios::sync_with_stdio(0);
   int a , b, c;
   while (cin >> a >> b >> c)
   {
     a*= 10;
     a += b;
     a *= 10;
     a += c;
     printf("%s\n", a%4 == 0?"YES":"NO");
   }
   return 0;  

}  

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

int dp[11][156][21];	//dp[????????§????????°][????????§???????¨?][????????§????????§???] = ????????????

int main() {
	int i, j, k, l;
	int m, n, s;	//max, num, sum
	
	while (cin >> m >> n >> s) {
		if (!n) break;
		for (i = 0; i <= n; i++) for (j = 0; j <= s; j++) for (k = 0; k <= m; k++) dp[i][j][k] = 0;
		dp[0][0][0] = 1;
		for (i = 0; i < n; i++) {
			for (j = 0; j <= s; j++) {
				for (k = 0; k <= m; k++) {
					for (l = k + 1; j + l <= s && l <= m; l++) {
						dp[i + 1][j + l][l] += dp[i][j][k];
					}
				}
			}
		}
		
		int ans = 0;
		for (i = 0; i <= m; i++) ans += dp[n][s][i];
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
long  n,m,kq=0;
long f[2000][2000],a[2000][2000];
vector<long> c[100005];
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>m>>n;
    for (long i=1;i<=m;i++)
    {
       for (long j=1;j<=n;j++)
       {
           char v;
           cin>>v;
           if (v=='.') a[i][j]=0;
           else a[i][j]=1;
       }
    }
    f[1][1]=1;
    for (long i=1;i<=m;i++)
    {
        for (long j=1;j<=n;j++)
        {
            if (i==1 && j==1) continue;
            if (a[i][j]==1) f[i][j]=0;
            else
                f[i][j]=(f[i-1][j]+f[i][j-1]) % 1000000007;
        }
    }
    cout<<f[m][n];



}


Measured memory_bytes: 37120
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>

#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)

#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

typedef long long  ll;
#define rept(x, s, n) for (int x = s; x < n; x++)

#define Yes_RTN s_cout("Yes");return 0
#define No_RTN  s_cout("No");return 0
#define YES_RTN s_cout("YES");return 0
#define NO_RTN  s_cout("NO");return 0


int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);

int s_asorts(const void* a, const void* b);

//昇順
int s_asorts(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
	int i;
	rept(i, 0, n) {
		l_cin2(*(a + i), *(b + i));
	}
	return 0;
}
int i_cins(int n, int* a) {
	int i;
	for (i = 0; i < n; i++) {
		i_cin(*(a + i));
	}

	return 0;
}
int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}

long _max(long a, long b) {
	return a > b ? a : b;
}
long _min(long a, long b) {
	return a < b ? a : b;
}
int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}

#pragma endregion



int main(void) {
	int N, i,cnt=0;
	int p[51];

	i_cin(N);
	i_cins(N, p);

	for (i = 0; i < N; i++) {
		if (p[i] == i + 1)  continue;
		cnt++;
	}
	s_cout(cnt > 2 ? "NO" : "YES");
	return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
//Position this line where user code will be pasted.


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

    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];

    int c = 0;

    for(int i=1;i<n-1;i++){
        int p1, p2, p3;

        p1 = a[i-1];
        p2 = a[i];
        p3 = a[i+1];

        if(p2 <= p1 && p2 > p3) c++;
        else if(p2 <= p3 && p2 > p1) c++;
    }

    cout<<c<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int calc(string s, vi v){
    int ans=0;
    ans+=v[0];
    rep(i,3){
        if(s[i]=='+')ans+=v[i+1];
        else ans-=v[i+1];
    }
    return ans;
}

int main() {
    
    
    vi v(4);
    string S;
    cin>>S;
    rep(i,4)v[i]=S[i]-'0';
    for(int op=0;op<(1<<3);op++){
        string s="";
        int t=op;
        while(t>0){
            if(t%2==0)s+='-';
            else s+='+';
            t/=2;
        }
        while(s.size()!=3)s+='-';
        reverse(all(s));
        // cout<<s<<endl;
        if(calc(s,v)==7){
            cout<<v[0]<<s[0]<<v[1]<<s[1]<<v[2]<<s[2]<<v[3]<<"=7"<<endl;
            return 0;
        }
    }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#define pb push_back
using namespace std;
int h,x;
int a[1000002];
void maxheap(int i){
	 int l=2*i,t,m=i;
	 if (a[l]>a[i] && l<=h)
	    m=l;
	 if (a[l+1]>a[m] && (l+1)<=h)
        m=l+1;
     if (m!=i){
     	t=a[i]; a[i]=a[m]; a[m]=t;
	    maxheap(m);
	 }
	 	   
}
int main(){
	cin>>h;
	//a.pb(0);
	for (int i=1; i<=h; i++){
		cin>>a[i];
	} 
	for (int i=h/2; i>=1; i--)
	    maxheap(i);
	for (int i=1; i<=h; i++)
	    cout<<' '<<a[i];
    cout<<'\n';
    return 0;
}


Measured memory_bytes: 4960
void main(){
  import std.stdio, std.algorithm;
  
  long n, a, b, k; rd(n, a, b, k);

  const long mod=998244353;
  const int M=1_000_00*4;
  
  long powmod(long a, long x, long mod){
    if(x==0) return 1;
    else if(x==1) return a;
    else if(x&1) return a*powmod(a, x-1, mod)%mod;
    else return powmod(a*a%mod, x/2, mod);
  }  

  long[] genFact(int n, long mod){
    auto fact=new long[](n);
    fact[0]=fact[1]=1;
    foreach(i; 2..n) fact[i]=i*fact[i-1]%mod;
    return fact;
  }

  long[] genInv(long[] arr, long mod){
    auto inv=new long[](arr.length);
    foreach(i, elem; arr) inv[i]=powmod(arr[i], mod-2, mod);
    return inv;
  }

  auto fact=genFact(M, mod);
  auto invFact=genInv(fact, mod);

  long comb(long nn, long rr){
    if(nn<rr) return 0;
    long ret=fact[nn]%mod;
    (ret*=invFact[rr])%=mod;
    (ret*=invFact[nn-rr])%=mod;
    return ret;
  }

  long tot=0;
  for(long x=0; x<=n; x++)if(k-a*x>=0){
    if((k-a*x)%b==0){
      long y=(k-a*x)/b;
      if(y>n) continue;
      (tot+=comb(n, x)*comb(n, y)%mod)%=mod;
    }
  }
  writeln(tot);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}


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

    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846

    const int MOD=1e9+7;
    ll mod(ll x){
        return (x%MOD + MOD)%MOD;
    }
    ll mul(ll a , ll b){
        return mod(mod(a)*mod(b));
    }

    void solve(){
        int n,k;
        cin>>n>>k;
        vector<ll>pos;
        vector<ll>neg;
        for(int i=0;i<n;i++){
            int x;
            cin>>x;
            if(x>0)
                pos.push_back(x);
            else
                neg.push_back(x);
        }
        ll ans=1;
        if((int)pos.size()){
            if(k%2){
                sort(pos.begin(),pos.end());
                ans=mul(ans,pos.back());
                pos.pop_back();
                --k;
            }
            vector<ll>ok;
            sort(pos.begin(),pos.end(),greater<>());
            sort(neg.begin(),neg.end());
            for(int i=0;i+1<(int)pos.size();i+=2)
                ok.push_back(pos[i]*pos[i+1]);
            for(int i=0;i+1<(int)neg.size();i+=2)
                ok.push_back(neg[i]*neg[i+1]);
            if((int)pos.size()%2 && (int)neg.size()%2)
                ok.push_back(pos.back()*neg.back());
            sort(ok.begin(),ok.end(),greater<>());
            for(int i=0;i<(k/2);i++)
                ans=mul(ans,ok[i]);
            cout<<ans;
        }
        else{
            sort(neg.begin(),neg.end());
            if(k%2)
                reverse(neg.begin(),neg.end());
            for(int i=0;i<k;i++)
                ans=mul(ans,neg[i]);
            cout<<ans;
        }
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
        int t=1;
//        cin>>t;
        for(int i=1;i<=t;i++){
            solve();
        }
        return 0;
    }


Measured memory_bytes: 6556
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
using namespace std;

void solve(){
  int n; cin >> n;
  string s[n];
  map<string, int> m;
  for(int i = 0; i < n; i++){
    vector<char> v;
    for(int j = 0; j < 10; j++){
      char c; cin >> c;
      v.push_back(c);
    }
    sort(v.begin(), v.end());
    for(int j = 0; j < 10; j++) s[i] += v[j];
    m[s[i]]++;
  }
  unsigned long long int sum = 0;
  for(auto itr = m.begin(); itr != m.end(); itr++){
    for(int j = itr->second - 1; j > 0; j--) sum += j;
  }
  cout << sum << endl;
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 13568
#![allow(unused_imports)]

use std::io::*;
use std::str::*;

macro_rules! get{
    ($t:ty) => {
        {
            let cin = stdin();
            let mut cin = cin.lock();
            
            let token =
                cin.by_ref().bytes().map(|c| c.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect::<String>();
            token.parse::<$t>().ok()
        }
    }
}

macro_rules! input{
    ($($id:ident: $t:ty),*) => {
        $(
            let $id = get!($t).unwrap();
        )*;
    }
}

macro_rules! input_vec{
    ($id:ident: Vec<$t:ty>, $n:expr) => {
        let $id = (0..$n).map(|_| get!($t).unwrap()).collect::<Vec<$t>>();
    }
}




fn solve(n: i32, k: i32, q: i32, a: Vec<u32>){
    let mut ans = vec![k-q; n as usize];
    for i in a {
        ans[(i-1) as usize] += 1;
    }
    for i in ans {
        println!("{}", if i > 0 {"Yes"} else {"No"});
    }
}


fn main(){
    input!(n: i32, k: i32, q: i32);
    input_vec!(a: Vec<u32>, q);

    
    solve(n,k,q,a);
}




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

/**
* @brief インタフェース
*/
class IAizuPR
{
public:
    virtual std::string& executeEx() = 0;
};

/**
* @brief 文字列を操作する
*/
class AizuPR final : public IAizuPR
{
public:
    /**
    * @brief コンストラクタ
    */
    AizuPR(std::string& ss) :
        str(ss) ,
        bufCnt(0) {}

    /**
    * @brief デストラクタ
    */
    ~AizuPR() {}

public:
    /**
    * @fn std::string& executeEx()
    * @brief 文字列からHoshinoを検索し、Hoshinaへ変換する
    * @return std::string& 変換後の文字列
    */
    std::string& executeEx();

private:
    /**
    * @fn bool isFind(int& index)
    * @brief Hoshinoが含まれるか検索する
    * @param[out] index 開始位置
    * @return bool 含まれる場合はtrueを、そうでなければfalseを返す
    */
    bool isFind(int& index);

    /**
    * @fn void replace(int index)
    * @brief HoshinoをHoshinaに置き換える
    * @param[in] index 開始位置
    */
    void replace(int index);

private:
    //! "Hoshino"
    static const std::string Hoshino;

    //! "Hoshina"
    static const std::string Hoshina;

private:
    //! ターゲット文字列
    std::string str;

    //! バッファカウント
    int bufCnt;
};

/**
* @brief コントロール
*/
class Control
{
public:
    /**
    * @fn void executeEx()
    * @brief データセット回文字列を読み込み、HoshinoをHoshinaへ変換し、表示する
    */
    void executeEx();

};

const std::string AizuPR::Hoshino("Hoshino");
const std::string AizuPR::Hoshina("Hoshina");

std::string& AizuPR::executeEx()
{
    int tIdx = 0;
    std::string tStr(str);

    while (isFind(tIdx)) {
        replace(tIdx);
    }

    return str;
}

bool AizuPR::isFind(int& index)
{
    
    if (std::string::npos == (index = str.find(Hoshino, bufCnt))) {
        index = 0;
        return false;
    }

    bufCnt = index + Hoshina.length();

    return true;
}

void AizuPR::replace(int index)
{
    str.replace(index, Hoshino.length(), Hoshina);
}

void Control::executeEx()
{
    std::string in("");
    std::string out("");

    int size = 0;

    std::cin >> size;
    std::cin.ignore();

    for (int i = 0; i < size; i++) {
        std::getline(std::cin, in);

        IAizuPR* pAizuPR = new AizuPR(in);

        out = pAizuPR->executeEx();

        std::cout << out << std::endl;

        in.clear();

        out.clear();
        delete pAizuPR;
    }
}

/**
* @fn int main()
* @brief エントリポイント
*/
int main()
{
    Control().executeEx();
}



Measured memory_bytes: 3160
#include<stdio.h>
#include<stdlib.h>

int gcd(int a, int b){
    int r=1;
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}

int main(){
    int sum=0;
    int K;
    scanf("%d",&K);
    for(int i=1;i<=K;i++){
        for(int j=1;j<=K;j++){
            for(int k=1;k<=K;k++){
                sum+=gcd(k,gcd(i,j));
            }
        }
    }
    printf("%d",sum);
}


Measured memory_bytes: 1704
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <complex>
#include <iomanip>

using namespace std;

typedef complex<double> Point;
#define rep(i, n) for(int i=0; i<(n); ++i)
const double eps = 1e-8, inf = 1e8, pi = acos(-1.);

template<typename T> inline void chmin(T& t, T f){if(t > f)t = f;}

inline double cross(const Point& a, const Point& b){
    return imag(conj(a) * b);
}

inline double dot(const Point& a, const Point& b){
    return real(conj(a) * b);
}

int ccw(Point a, Point b, Point c){
    b -= a; c -= a;
    if(cross(b, c) > eps)return 1;
    if(cross(b, c) < -eps)return -1;
    if(dot(b, c) < 0)return 2;
    if(norm(b) < norm(c))return -2;
    return 0;
}

struct Line : vector<Point> {
    Line(const Point& a, const Point& b){
        push_back(a); push_back(b);
    }
};

Point proj(const Line& l, const Point& p){
    double t = dot(p - l[0], l[1] - l[0]) / norm(l[0] - l[1]);
    return l[0] + (l[1] - l[0]) * t;
}

inline bool interSP(const Line& s, const Point& p){
    return abs(s[0] - p) + abs(s[1] - p) - abs(s[1] - s[0]) < eps;
}

inline bool interSS(const Line& s, const Line& t){
    return ccw(s[0], s[1], t[0]) * ccw(s[0], s[1], t[1]) <= 0 &&
           ccw(t[0], t[1], s[0]) * ccw(t[0], t[1], s[1]) <= 0;
}

inline double distSP(const Line& s, const Point& p){
    const Point r = proj(s, p);
    return interSP(s, r)? abs(r - p): min(abs(s[0] - p), abs(s[1] - p));
}

inline double distSS(const Line& s, const Line& t){
    return interSS(s, t)? 0: min({distSP(s, t[0]), distSP(s, t[1]), distSP(t, s[0]), distSP(t, s[1])});
}

int N, M, L;

double solve(vector<vector<Line> >& pent){
    vector<vector<double> > dist(N, vector<double>(N));
    rep(i, N)rep(j, i){
        dist[i][j] = inf;
        for(auto s: pent[i])for(auto t: pent[j])chmin(dist[i][j], distSS(s, t));
        dist[j][i] = dist[i][j];
    }
    vector<double> mem(N, inf); mem[M] = 0.;
    priority_queue<pair<double, int> > q;
    for(q.emplace(0, M); !q.empty();){
        double d = -q.top().first; int v = q.top().second; q.pop();
        if(mem[v] + eps < d)continue;
        if(v == L)break;
        rep(i, N)if(d + dist[v][i] + eps < mem[i]){
            mem[i] = d + dist[v][i];
            q.emplace(-mem[i], i);
        }
    }
    return mem[L];
}

int main(){
    while(cin >> N >> M >> L, N|M|L){
        M--; L--;
        vector<vector<Line> > pent(N);
        rep(i, N){
            int x, y, a, r;
            cin >> x >> y >> a >> r;
            vector<Point> v;
            rep(j, 5)v.push_back(Point(x, y) + polar(1. * r, (a + 72 * j + 90) * pi / 180));
            rep(j, 5)pent[i].emplace_back(v[j], v[(j + 2) % 5]);
        }
        cout << fixed << setprecision(20) << solve(pent) << '\n';
    }
    return 0;
}

Measured memory_bytes: 1460
<?php
  	function getCost($p, $x){
  		return ($p-$x)**2;
	}
  
	$n = intval(fgets(STDIN));
	$tmp = explode(" ",trim(fgets(STDIN)));
	
	$min = min($tmp);
	$max = max($tmp);
	
	$minCost = -1;
	for($i=$min; $i<=$max; $i++){
      $cost = 0;
      for($j=0; $j<$n; $j++){
        $cost += getCost($i, $tmp[$j]);
      }
      if($minCost==-1 || $cost<$minCost){
        $minCost = $cost;
      }
    }

	echo $minCost."\n";

Measured memory_bytes: 4984
#!/usr/bin/env python3
import sys


def solve(H: int, W: int, N: int, a: "List[int]"):
    L = []
    for i, aa in enumerate(a):
        L = L + [i+1] * aa
    R = []
    for i in range(H):
        R.append(L[i*W:(i+1)*W])
    for i in range(H):
        if i % 2 == 0:
            K = R[i]
        else:
            K = list(reversed(R[i]))
        print(" ".join([str(s) for s in K]))
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(H, W, N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3808
"審判は君だ！"
while True:
    T, P, R = map(int, input().split())  # 参加チーム数T, 問題数P, レコード数review
    if T == 0 and P == 0 and R == 0:
        break

    submits = []

    scores = {}
    for i in range(1, T+1):
        scores[i] = [0, 0]
    for i in range(R):
        tid, pid, time, message = map(str, input().split())
        tid = int(tid)
        pid = int(pid)
        time = int(time)
        submits.append([tid, pid, time, message])
    # print(scores)
    # print(submits)
    for i in range(len(submits)):
        if submits[i][3] == 'CORRECT':
            wa_cnt = 0
            for j in range(0, i):
                if submits[j][0] == submits[i][0] and submits[j][1] == submits[i][1]:
                    wa_cnt += 1
            scores[submits[i][0]][0] += 1
            scores[submits[i][0]][1] += (1200*wa_cnt + submits[i][2])

    scores = sorted(scores.items(), key=lambda x: (x[1][0], -x[1][1], -x[0]), reverse=True)
    # print(scores)
    for score in scores:
        print(score[0], score[1][0], score[1][1])



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

int two_div(int n){
  int res=0;
  if(n%2!=0)return 0;
  while(n>=1){
    if(n%2==0)res++;
    else return res;
    n/=2;
  }
  return res;
}
void solve3(){
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>two_num(n);
  int chk[3]={0,0,0};
  for(int i=0; i<n; i++){
    cin >> a[i];
    two_num[i]=two_div(a[i]);
    if(two_num[i]==0)chk[0]++;
    else if(two_num[i]==1)chk[1]++;
    else chk[2]++;
  }
  bool f = false;
  if(chk[1]==0 && chk[0]<=chk[2]+1)f=true;
  if(chk[1]!=0 && chk[0]<=chk[2])f=true;
  if(f)cout << "Yes" << endl;
  else cout << "No" << endl;


}
int main(){
  solve3();
  return 0;
}


Measured memory_bytes: 3972
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i<n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(x.begin(), x.end(),0);
#define vint(v,n) vector<int> v(n); REP(i,n) scanf("%lld", &v[i]);
#define vstr(v,n) vector<string> v(n); REP(i,n) scanf("%lld", &v[i]);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
int k=0,n=0, m=0, l=0,a=0, b=0, c=0, d=0,e=0,ans=0,ans2=0,x=0,y=0;
string s,t,S;
signed main() {
    cin >> n;
    pair<pair<string,int>,int>Le[n];
    REP(i, n)
    {
        cin >> s >> a;
        Le[i] = make_pair(make_pair(s,-a), i);
    }
    sort(Le,Le+n);
    REP(i, n)
        cout << Le[i].second + 1<<endl;
}

Measured memory_bytes: 3620
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    if 10**(len(str(N))-1)==N:
        print(10)
    else:
        print(sum([int(i) for i in str(N)]))
        
if __name__ == '__main__':
    main()

Measured memory_bytes: 3444
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <iomanip>
#include <math.h>
#include <stdio.h>

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

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; }
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;
typedef long long int ll ;


#define INF 2000000000


bool equal(int n[], int m[], int k){
    for (int i = 0; i<k ; i++){
        if(n[i] != m[i]){
            return false;
        }
    }
    return true;
}
 
int main(){
    int n, a = 0, b = 0, count = 0;
    cin >> n;
    int p[n], q[n], temp[n];
    
    for(int i = 0; i<n; i++){
        cin >> p[i];
        temp[i] = p[i];
    }
    
    for(int i = 0; i<n; i++){
        cin >> q[i];
    }
    
    sort(temp, temp+n);
 
    do{
        count++;
        if(a != 0 && b != 0){
            break;
        }
        if (equal(temp, p, n) && a == 0){
            a = count;
        }
        if(equal(temp, q, n) && b == 0){
            b = count;
        }
    }while(next_permutation(temp, temp+n));
    
    cout << abs(a-b) << endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

func parent(i int) int { return i / 2 }
func left(i int) int   { return 2 * i }
func right(i int) int  { return 2*i + 1 }

func answer(reader io.Reader) string {
	sc := bufio.NewScanner(reader)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	H, _ := strconv.Atoi(sc.Text())

	A := make([]int, H+1)
	for i := 1; i <= H; i++ {
		sc.Scan()
		k, _ := strconv.Atoi(sc.Text())
		A[i] = k
	}

	var out bytes.Buffer
	for i := 1; i <= H; i++ {
		out.WriteString(fmt.Sprintf("node %d: key = %d, ", i, A[i]))
		if parent(i) >= 1 {
			out.WriteString(fmt.Sprintf("parent key = %d, ", A[parent(i)]))
		}
		if left(i) <= H {
			out.WriteString(fmt.Sprintf("left key = %d, ", A[left(i)]))
		}
		if right(i) <= H {
			out.WriteString(fmt.Sprintf("right key = %d, ", A[right(i)]))
		}
		out.WriteString("\n")
	}

	return strings.TrimRight(out.String(), "\n")
}

func main() {
	fmt.Println(answer(os.Stdin))
}



Measured memory_bytes: 1216
X = int(input().strip())

y = 1
if X <= 599:
    y = 8
elif X <= 799:
    y = 7
elif X <= 999:
    y = 6
elif X <= 1199:
    y = 5
elif X <= 1399:
    y = 4
elif X <= 1599:
    y = 3
elif X <= 1799:
    y = 2
print(y)

Measured memory_bytes: 9164
#include"bits/stdc++.h"
using namespace std;

int main(){
	int64_t N, A, B;
	cin >> N >> A >> B;
	if ((B - A) % 2 == 0) {
		cout << (B - A) / 2 << endl;
	}
	else {
		cout << min(N - B, A - 1) + 1 + (B - A - 1) / 2 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import heapq
w, h = map(int, input().split())
P = [int(input()) for _ in range(w)]
Q = [int(input()) for _ in range(h)]
heapq.heapify(P)
heapq.heapify(Q)
ans = 0
count_x, count_y = 0, 0
while P or Q:
  if not P:
    temp = heapq.heappop(Q)
    ans += temp * (w+1-count_x)
    count_y += 1
  elif not Q:
    temp = heapq.heappop(P)
    ans += temp * (h+1-count_y)
    count_x += 1
  else:
    tp, tq = P[0], Q[0]
    if tp < tq:
      temp = heapq.heappop(P)
      ans += temp * (h+1-count_y)
      count_x += 1
    else:
      temp = heapq.heappop(Q)
      ans += temp * (w+1-count_x)
      count_y += 1
print(ans)

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


/*
ll gcds(ll a,ll b){
    if(a<b){
        swap(a,b);
    }
    ll r=a%b;
    if(r==0){
        return b;
    }
    while(r>0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}


ll lcms(ll a,ll b){
    ll mmr=gcds(a,b);
    a=a/mmr;
    b=b/mmr;
    return a*b*mmr;
}
*/

int main(){
    int N;
    cin>>N;
    vector<string> S(N);
    for(int i=0;i<N;i++){
        cin>>S.at(i);
    }
    sort(S.begin(),S.end());
    vector<int> C(N);
    for(int i=0;i<N;i++){
        C.at(i)=1;
    }
    for(int i=1;i<N;i++){
        if(S.at(i-1)==S.at(i)){
            C.at(i)=C.at(i-1)+1;
        }
    }
    vector<int> cc(N);
    for(int i=0;i<N;i++){
        cc.at(i)=C.at(i);
    }
    sort(cc.begin(),cc.end());
    reverse(cc.begin(),cc.end());
    int maxi=cc.at(0);
    for(int i=0;i<N;i++){
        if(C.at(i)==maxi){
            cout<<S.at(i)<<endl;
        }
    }
}


Measured memory_bytes: 16384
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define pi(n,m) n.insert(n.begin(),m);
#define ee(n) n.erase(n.end()-1)
#define eb(n) n.erase(n.begin())
using namespace std;
//using bint=boost::multiprecision::cpp_int;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int n; cin>>n;
  vector<int> a(n);
  rep(i,1,101){
    rep(j,i,101){
      rep(k,j,101){
        int x=i*(i+j)+j*(j+k)+k*(k+i);
        if(x<=n){
          if(i==j && j==k) a[x-1]++;
          else if(i!=j && j!=k && k!=i) a[x-1]+=6;
          else a[x-1]+=3;
        }
      }
    }
  }
  rep(i,0,n) co(a[i]);
  
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

int main(){
    ios_base::sync_with_stdio(false);
	cout.precision(10);
	cout << fixed;

    int k, s;
    cin >> k >> s;
    ll sum = 0;
    for(int i=0; i<=k; i++){
        for(int j=0; j<=i; j++){
            int x = s-i-j;
            if(x < 0 || x > j) continue;
            int res = 6;
            if(i == j && j == x) res = 1;
            else if(i == j) res = 3;
            else if(j == x) res = 3;
            sum += res;
        }
    }
    cout << sum;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define MAXN 102

int n, ans;
char s[MAXN];

signed main(){
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> s[i];
    }
    for(int i = 0; i < n - 1; i++){
        map<char, int> mp;
        int cnt = 0;
        for(int j = 0; j <= i; j++){
            for(int k = i + 1; k < n; k++){
                if(s[j] == s[k]){
                    mp[s[j]] = 1;
                }
            }
        }
        for(int r = 0; r <= 25; r++){
            if(mp['a' + r] == 1){
                cnt++;
            }
        }
        if(ans < cnt){
            ans = cnt;
        }
    }
    cout << ans << endl;




    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <climits>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<long long int>
#define vc vector<char>
#define vs vector<string>
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(i = (a); i < (n); i++)
#define fi(i,a,n) for(i = (a); i <= (n); i++)
#define F first
#define S second
int main(){
    ll n,m,count;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>m>>count;

    ll a,b;
    cin>>a>>b;

    string s,t;
    cin>>s>>t;

    //Up
    ll t1 = a;
    for(ll i=0;i<count;i++){
        if(s[i]=='U'){
            t1--;
        }
        if(t1==0){
            cout<<"NO"<<endl;
            return 0;
        }
        if(t[i]=='D' && t1<n){
            t1++;
        }
    }

    ll t2 = a;
    for(ll i=0;i<count;i++){
        if(s[i]=='D'){
            t2++;
        }
        if(t2==(n+1)){
            cout<<"NO"<<endl;
            return 0;
        }
        if(t[i]=='U' && t2>1){
            t2--;
        }
    }

    //Left
    ll t3 = b;
    for(ll i=0;i<count;i++){
        if(s[i]=='L'){
            t3--;
        }
        if(t3==0){
            cout<<"NO"<<endl;
            return 0;
        }
        if(t[i]=='R' && t3<m){
            t3++;
        }
    }


    //Right
    ll t4 = b;
    for(ll i=0;i<count;i++){
        if(s[i]=='R'){
            t4++;
        }
        if(t4==(m+1)){
            cout<<"NO"<<endl;
            return 0;
        }
        if(t[i]=='L' && t4>1){
            t4--;
        }
    }

    cout<<"YES"<<endl;

}

Measured memory_bytes: 920
using System;
namespace AtCorder099_B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] inputN = Console.ReadLine().Split(' ');
            int a = int.Parse(inputN[0]);
            int b = int.Parse(inputN[1]);
            int n = (1 + b - a) * (b - a) / 2;
            Console.WriteLine(n-b);
        }
    }
}


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

using namespace std;

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

    int n;
    cin >> n;
    long long arr[n], ans = 1, big = 1e18;
    bool ok = true;

    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        if (!arr[i])
            ok = false;
    }

    if (!ok)
        return cout << "0\n", 0;

    for (long long x : arr)
        if (!x)
            return cout << "0\n", 0;
        else if (log10(ans) + log10(x) >= 18.5)
            return cout << "-1\n", 0;
        else
            ans *= x;

    if (ans > big)
        ans = -1;
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 4716
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  if(s[0]=='S' && s[1]=='S' && s[2]=='S')
    	cout<<0<<endl;
  if(s[0]=='S' && s[1]=='S' && s[2]=='R')
    	cout<<1<<endl;
  if(s[0]=='S' && s[1]=='R' && s[2]=='S')
    	cout<<1<<endl;
  if(s[0]=='S' && s[1]=='R' && s[2]=='R')
    	cout<<2<<endl;
  if(s[0]=='R' && s[1]=='S' && s[2]=='S')
    	cout<<1<<endl;
  if(s[0]=='R' && s[1]=='S' && s[2]=='R')
    	cout<<1<<endl;
  if(s[0]=='R' && s[1]=='R' && s[2]=='S')
    	cout<<2<<endl;
  if(s[0]=='R' && s[1]=='R' && s[2]=='R')
    	cout<<3<<endl;
  return 0;
  
}

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

int main() {
	int n;
	cin >> n;
	int64_t l[n + 1];
	l[0] = 2;
	l[1] = 1;
	for(int i = 2; i <= n; i++){
		l[i] = l[i - 1] + l[i - 2];
 	}
	cout << l[n] << endl;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N - 1; i >= 0; i--)
const ll INF = 1000000000;
//const ll MOD = 1000000007;
const ld PI = (acos(-1));
using Graph = vector<vector<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;}
typedef pair<int, int> P;
typedef pair<ll,ll> PLL;
double rad(double a) {return a * 180 / PI;}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

//dpTable
int dp[100050];

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    rep (i,N) cin >> A.at(i);
    ll moneynow = 1000;
    for (int i = 0; i < N - 1; i++) {
        ll kabu = 0;
        if (A.at(i) < A.at(i + 1)) {
            kabu = moneynow / A.at(i);
            moneynow += kabu * (A.at(i + 1) - A.at(i));
        }
    }
    cout << moneynow << endl;
    return 0;
}


Measured memory_bytes: 3604
//g++ -std=c++14 test.cpp -o test.out
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
using namespace std;

#define MOD 1000000007ll

string S;

long ans = 0;
 
void solve(){
	int dp[100001][13];//i桁の数のうち、13で割った余りがjであるような数の個数をdp[i][j]とする
	for(int j=0;j<100001;j++){
		for(int k=0;k<13;k++) dp[j][k] = 0;
	}
	dp[0][0] = 1;

	int power_10 = 1;
	for(int i=1;i<=S.size();i++){
		int digit = S.size()-i;
		if(S[digit]=='?'){
			for(int num=0;num<10;num++){//?を0から9までの数字に置き換えた場合を考える
				for(int g=0;g<13;g++){
					dp[i][(num*power_10+g)%13] = (dp[i][(num*power_10+g)%13]+dp[i-1][g])%MOD;
				}
			}
		}else{
			int num = S[digit] - 0x30;
			for(int g=0;g<13;g++){
				dp[i][(num*power_10+g)%13] = dp[i-1][g]%MOD;
			}
		}
		power_10*=10;
		power_10%=13;
	}
	ans = dp[S.size()][5];
}
 
int main(){
	cin>>S;

	solve();

	cout << ans;
	return 0;
}


Measured memory_bytes: 5504
#include<iostream>
#include<vector>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
while(1){
	int n,m,a,k=0,ans=0;
	vector<int> d,p;
	d.push_back(0);
	scanf("%d",&a);
if(a==0)break;
	scanf("%d%d",&n,&m);
	d.push_back(a);
	for(int i=1;i<n;i++){
		scanf("%d",&a);
		d.push_back(a);
	}
	for(int i=0;i<m;i++){
		scanf("%d",&a);
		p.push_back(a);
	}
	sort(d.begin(),d.end());
	sort(p.begin(),p.end());
	for(int i=0;i<m;i++){
		while(d[k+1]<p[i])k++;
		ans+=min(p[i]-d[k],d[k+1]-p[i]);
	}
	printf("%d\n",ans);
}
}

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

int main()
{
    int a, b;
    cin>>a>>b;
    if(a<b)
    {
        for(int i=0;i<b;++i)
        cout<<a;
    }
    else
    {
        for(int i=0;i<a;++i)
        cout<<b;
    }
	return 0;
}


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

int main() {
  int x,a,b;
  cin >> x >> a >> b;
  if(-a+b <=0){
    cout << "delicious" << endl;
  }
  else if(0 < -a+b  && -a+b <=x){
    cout << "safe" << endl;
  }
  else {
    cout << "dangerous" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
using namespace std;
int main(){
	int N; 
	cin >> N; 
	map<int, string> A; 
	cout << 0 << endl; 
	fflush(stdout);
	string ans; 
	cin >> ans; 
	if(ans == "Vacant"){
		return 0; 
	}
	A[0] = ans; A[N] = ans; 
	int L = 0; int R = N; 
	while(1){
		int M = (L + R) / 2; 
		cout << M << endl; 
		fflush(stdout);
		string response; 
		cin >> response; A[M] = response; 
		if(response == "Vacant"){
			return 0; 
		}
		else if(A[L] == A[M] && L % 2 == M % 2) L = M; 
		else if(A[L] == A[M] && L % 2 != M % 2) R = M; 
		else if(A[L] != A[M] && L % 2 == M % 2) R = M; 
		else if(A[L] != A[M] && L % 2 != M % 2) L = M; 
	}
}

Measured memory_bytes: 852
#include <stdio.h>

#define MAX 10000
#define NIL -1

typedef struct Node{
  int p;
  int l;
  int r;
}Node;

Node T[MAX];
int n;

void pre(int u){
  if(u==NIL)return;
  printf(" %d",u);
  pre(T[u].l);
  pre(T[u].r);
}

void mid(int u){
 if(u==NIL)return;
 mid(T[u].l);
 printf(" %d",u);
 mid(T[u].r);
}

void fina(int u){
  if(u==NIL)return;
  fina(T[u].l);
  fina(T[u].r);
  printf(" %d",u);
}

int main(){
  int i,v,l,r,root;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=NIL;
  }

  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l=l;
    T[v].r=r;
    if(l!=NIL)T[l].p=v;
    if(r!=NIL)T[r].p=v;    
  }

  for(i=0;i<n;i++){
    if(T[i].p==NIL)root=i;
  }

  printf("Preorder\n");
  pre(root);
  printf("\n");
  printf("Inorder\n");
  mid(root);
  printf("\n");
  printf("Postorder\n");
  fina(root);
  printf("\n");

  return 0;
}



Measured memory_bytes: 2052
fun main(args:Array<String>) {
    readLine()
    val al:List<Int> = readLine()!!.split(" ").map(String::toInt)
    var flag = true
    for (a in al) {
        if (a % 2 == 0) {
            if (!(a % 3 == 0) && !(a % 5 == 0)) {
                flag = false
            }
        }
    }
    if (flag) {
        println("APPROVED")
    }
    else {
        println("DENIED")
    }
}

Measured memory_bytes: 37988
a = gets().to_i
b = gets().to_i
c = gets().to_i
d = gets().to_i
e = gets().to_i

arr = [a, b, c, d, e]

mintime = 9999
arr.permutation(5).each {|a|
	t = 0
	(0 ... a.length).each {|i|
		t += a[i]
		t += 10 - a[i] % 10 if i < a.length - 1 if a[i] % 10 > 0
	}

	mintime = t if mintime > t
}

puts mintime


Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

#define MAX 10000
#define INFTY (1 << 29)

class DisjointSet {
  // DSL_1_A
  public:
    vector<int> rank, p;

    DisjointSet() {}
    DisjointSet(int size) {
      rank.resize(size, 0);
      p.resize(size, 0);
      for( int i = 0; i < size; i++ ) makeSet(i);
    }

    void makeSet(int x) {
      p[x] = x;
      rank[x] = 0;
    }

    bool same(int x, int y) {
      return findSet(x) == findSet(y);
    }

    void unite(int x, int y) {
      link(findSet(x), findSet(y));
    }

    void link(int x, int y) {
      if ( rank[x] > rank[y] ) {
        p[y] = x;
      } else {
        p[x] = y;
        if ( rank [x] == rank[y] )
          rank[y]++;
      }
    }

    int findSet(int x) {
      if ( x != p[x] )
        p[x] = findSet(p[x]);
      return p[x];
    }
};

class Edge {
  public:
  int source, target, cost;
  Edge(int source = 0, int target = 0, int cost = 0):
  source(source), target(target), cost(cost) {}
  bool operator < ( const Edge &e ) const {
    return cost < e.cost;
  }
};

int kruskal(int N, vector<Edge> edges) {
  int totalCost = 0;
  sort(edges.begin(), edges.end());

  DisjointSet dset = DisjointSet(N + 1);

  for ( int i = 0; i < N; i++ ) dset.makeSet(i);

  int source, target;
  for ( int i = 0; i < edges.size(); i++ ) {
    Edge e = edges[i];
    if ( !dset.same( e.source, e.target ) ) {
      //MST.push_back( e );
      totalCost += e.cost;
      dset.unite( e.source, e.target );
    }
  }
  return totalCost;
}


int main() {
  int N, M, cost;
  int source, target;

  cin >> N >> M;

  vector<Edge> edges;
  for ( int i = 0; i < M; i++ ) {
    cin >> source >> target >>  cost;
    edges.push_back(Edge(source, target, cost));
  }

  cout << kruskal(N, edges) << endl;

  return 0;
}


Measured memory_bytes: 5364
n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
cnt = 0

like = []
for i in range(m):
  like.append(0)

for i in range(n):
  for j in range(a[i][0]):
    like[a[i][j + 1] - 1] += 1
    
for i in range(m):
  if like[i] == n:
    cnt += 1
    
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

void solve() {
    ll n, k;
    cin >> n >> k;

    n = n%k;
    cout << min(n, abs(n-k)) << endl;;
}

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

    solve();
    return 0;
}
 


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int N = 1e5 + 100;

bool OK(vector<int> vec, int k) {
	for (int i = 0; i < vec.size(); i++) {
		int x = 0;
		for (int j = i; j < vec.size(); j++) {
			x ^= vec[j];
			if(j > i && vec[i] == vec[j] && x != k)
				return false;
		}
	}
	return true;
}

int n, k;

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	srand(time(0));
	cin >> n >> k;
	if(n <= 3) {
		vector<int> vec;
		for (int i = 0; i < (1 << n); i++)
			vec.push_back(i), vec.push_back(i);
		bool ok = false;
	
		int cnt = 0;
		do {
			cnt++;
			if(OK(vec, k)) {
				ok = true;
				break;
			}
			random_shuffle(vec.begin(), vec.end());
		} while(cnt < 1e6);
		if(ok) {
			for (int num: vec)
				cout << num << ' ';
		}
		else
			cout << -1;
		return 0;
	}
	if(k >= (1 << n)) {
		cout << -1;
		return 0;
	}
	vector<int> vec;
	for (int i = 0; i < (1 << n); i++)
		if(i != k)
			vec.push_back(i);
	vec.push_back(k);
	for (int i = (1 << n) - 1; ~i; i--)
		if(i != k)
			vec.push_back(i);
	vec.push_back(k);
	for (int num: vec)
		cout << num << ' ';
	return 0;
}

Measured memory_bytes: 2932
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<limits>
#include<iomanip>
#include<set>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 10000000000LL //long long int専用
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main() {
	VS a(3);
	VI c(3);
	bool flag = true;
	rep(i, 3) cin >> a[i];

	int turn = 0,memo;
	char ans;

	while (flag) {
		memo = a[turn][c[turn]] - 'a';
		//cout << turn << " ";
		if (c[turn] == a[turn].size()) {
			ans = (char)(turn + 65);
			flag = false;
		} else {
			c[turn]++;
			turn = memo;
		}
	}
	cout << ans << endl;
	return 0;

}

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

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


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


int main() {

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

    vector<vector<double>> dp(n+5, vector<double>(n+5, 0.0));
    dp[0][0] = 1;
    rep(i,n) dp[i+1][0] =  dp[i][0]*(1-p[i]);

    rep(j,n)rep(i,n){
        dp[i+1][j+1] += dp[i][j]*p[i];
        dp[i+1][j+1] += dp[i][j+1]*(1-p[i]);
    }

    double ans = 0.0;
    for(ll i = (n+1)/2; i <= n; i++){
        ans += dp[n][i];
    }
    cout << fixed;
    cout << setprecision(10) << ans << endl;
    
    // rep(i,n+1){
    //     rep(j,n+1){
    //         cout << dp[i][j] << "  ";
    //     }
    //     cout << endl;
    // }

    return 0;
}

Measured memory_bytes: 70912