akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000007
#define N 500005
int main()
{
    int i,n,j,k,a,b,c;
    string str;
    in(n);
    llin(str);
    n=str.size();
    rep(i,n)
        str[i]-='0';
    int ans=0;
    rep(i,1000)
    {
        a=(i/100),b=(i/10)%10,c=(i%10);
        int ar[3]={a,b,c};
        j=0;
        rep(k,n)
            if(j<3 && str[k]==ar[j])j++;
        if(j==3)
            ans++;
    }
    out(ans);
}







Measured memory_bytes: 256
#include<stdio.h>
char c;
int f;
int nextInt();

int N, n, i, t;
int A[100001];
int main(){
	N=nextInt();
	for(i=1; i<=N; i++){
		A[i]=nextInt();
	}
	i=0;
	n=1;
	do{
		t = A[n];
		A[n] = 1;
		n = t;
		i++;
	}while(n!=1 && n!=2);
	if(n==2){
		printf("%d\n", i);
	}else{
		printf("-1\n");
	}
}

int nextInt(){
	f=0; c=getchar();
	while((c<'0')||('9'<c)){c=getchar();}
	while((c>='0')&&(c<='9')){f=f*10+(c-'0'); c=getchar();}
	return f;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int h, w;
	cin >> h >> w;
	string c[h];
	REP(i, h){
		cin >> c[i];
	}
	REP(i, h){
		cout << c[i] << endl;
		cout << c[i] << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// const ll INF = 1LL <<60;
const int INF = 10000;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始

int main(){
  ll h,w;
  cin>>h>>w;
  // 横長長方形
  ll ans = 1e9;
  ll a[3];
  for(int i = 1; i < h; i++){
    // 縦長二分割
    ll ww = w/2;
    a[0]=w*i;
    a[1]=ww*(h-i);
    a[2]=(w-ww)*(h-i);
    sort(a,a+3);
    if(a[0]==0) continue;
    // if(a[2]-a[0]==50000) cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<" case1 "<<i<<" "<<w<<endl;
    ans = min(ans,a[2]-a[0]);
    // 横長二分割
    int hh = (h-i)/2;
    a[0]=w*i;
    a[1]=w*hh;
    a[2]=w*(h-i-hh);
    sort(a,a+3);
    if(a[0]==0) continue;
    // if(a[2]-a[0]==50000) cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<" case2 "<<i<<endl;       
    ans = min(ans,a[2]-a[0]);
  }
  // 縦長分割
  for(int j = 1; j < w; j++){
    int ww = (w-j)/2;
    a[0]=h*j;
    a[1]=h*ww;
    a[2]=h*(w-j-ww);
    sort(a,a+3);
    if(a[0]==0) continue;
    // if(a[2]-a[0]==50000) cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<" case3 "<<j<<endl;    
    ans = min(ans,a[2]-a[0]);
    int hh = h/2;
    a[0]=h*j;
    a[1]=hh*(w-j);
    a[2]=(h-hh)*(w-j);
    sort(a,a+3);
    if(a[0]==0) continue;
    // if(a[2]-a[0]==50000) cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<" case4 "<<j<<endl;    
    ans = min(ans,a[2]-a[0]);    
  }
  cout<<ans<<endl;
  return 0;
}


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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 998244353;
const ll INF = (ll)1e15;

pll D[100005];
ll S[100005];

int main()
{
    ll N;
    cin >> N;
    ll max = 0;
    REP(i, N)
    {
        cin >> D[i].first;
        D[i].second = i;
        S[D[i].first]++;
        max = std::max(max, D[i].first);
    }
    if (D[0].first != 0)
    {
        cout << 0 << endl;
        return 0;
    }
    sort(D, D + N, [](pll a, pll b) { return a.first < b.first; });
    ll ans = 1;
    FOR(i, max + 1, 1)
    {
        if (S[i] == 0)
        {
            ans = 0;
            break;
        }
        if (S[0] != 1)
        {
            ans = 0;
            break;
        }
        ll p = 1;
        REP(j, S[i])
        {
            p = (p * S[i - 1]) % MOD;
        }
        ans = (ans * p) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
// At Corder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include <algorithm>
#include <iostream>
using namespace std;
#include <vector>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using p = pair<int, int>;//<key,value>

int main()
{
	double r;
	cin >> r;
	cout << 2 * 3.1415926535 * r << endl;

	return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 3784
N,K = map(int,input().split())
H = list(map(int,input().split()))
inf = float('inf')
H += [inf for _ in range(K+5)]
dp = [inf]*(N+K+5)
dp[0] = 0
dp[1] = abs(H[0]-H[1])
#dp[2] = abs(H[1]-H[0])
# for i in range(2,N):
#     dp[i] = min(dp[i-1]+abs(H[i-1]-H[i]), dp[i-2]+abs(H[i-2]-H[i]))
# print(dp[N-1])

for i in range(N):
    for j in range(K+1):
        dp[i+j] = min(dp[i+j],dp[i]+abs(H[i]-H[i+j])) # 配るdp,Hの配列外参照が微妙
print(dp[N-1])


Measured memory_bytes: 58080
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	char a, b; cin >> a >> b;
	if (a == b)cout << 'H' << endl;
	else cout << 'D' << endl;
	return 0;
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

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

  map<int, int> mp;
  mp[-1] = 3;
  ll ans = 1;
  int cnt = 0;
  for(int i=0;i<n;++i) {
    if(a[i] == 0) {
      if(cnt == 3) {
        cout << "0" << endl;
        return 0;
      }
      mp[-1]--;
      mp[0]++;
      cnt++;
    } else {
      ans *= mp[a[i]-1];
      ans %= MOD;
      mp[a[i]-1]--;
      mp[a[i]]++;
    }
  }
  if(cnt == 1) {
    ans *= 3;
    ans %= MOD;
  } else {
    ans *= 6;
    ans %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 5376
fun main(args: Array<String>) {
	val (h, w) = (readLine() ?: return).split(" ").map { it.toInt() }.toIntArray()
	val input = Array(h) { (readLine() ?: return).toCharArray().map { if (it == '#') 0 else 10000000 }.toIntArray() }
	for (r in 0 until h) for (c in 0 until w) if (input[r][c] > 0) {
		val v1 = if (r > 0) input[r - 1][c] else 10000000
		val v2 = if (c > 0) input[r][c - 1] else 10000000
		input[r][c] = Math.min(v1, v2) + 1
	}
	for (r in h - 1 downTo 0) for (c in w - 1 downTo 0) if (input[r][c] > 0) {
		val v1 = if (r < h - 1) input[r + 1][c] else 10000000
		val v2 = if (c < w - 1) input[r][c + 1] else 10000000
		input[r][c] = Math.min(input[r][c], (Math.min(v1, v2) + 1))
	}
	var max = 0
	for (r in 0 until h) for (c in 0 until w) max = Math.max(max, input[r][c])
	println(max)
}

Measured memory_bytes: 47264
#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/range/algorithm.hpp>
#define rep(i,n) for (int i=0; i< (n); ++i)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int pow(int a, int n){
  int b = 1;
  rep(i,n){
    b *= a;
  }
  return b;
}

int main() {

  string s;
  cin >> s;
  int n = s.length();
  vector<ll> a(6);
  vector<int> qnum(6);
  rep(i,n){
    if (s[n-1-i] == '?') qnum[i%6]++;
    else a[i%6] += (int)((s[n-1-i])-'0');
  }
  vector<ll> rem(13,0);
  ll r = (a[0]+a[1]*10+a[2]*100+a[3]*1000+a[4]*10000+a[5]*100000)%13;
  rem[r] = 1;

  //漸化式
  rep(i,6){
    rep(j,qnum[i]){
      vector<ll> temp(13,0);
      rep(k,13){
        rep(l,10){
          temp[(l*pow(10,i)+k)%13] += rem[k];
        }
      }
      rep(k,13){
        temp[k] %= MOD;
      }
      rem = temp;
      }
    }
  

  cout << rem[5] << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = false;
}  // namespace mydef
using namespace mydef;
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans

int N, a[202020];

void solve() {
    int total = 0;
    for (int i = 0; i < N; i++) {
        total ^= a[i];
    }

    for (int i = 0; i < N; i++) {
        cout << (total ^ a[i]) << " ";
    }
    cout << endl;
}

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

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    solve();
    return 0;
}


Measured memory_bytes: 5156
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int d[210][210],a[210][210];
string s[210];
vector<int> G[210];
int color[210];
bool dfs(int v, int c){
	color[v]= c;
	for(int i=0;i<G[v].size();i++){
		if(color[G[v][i]]==c) return false;
		if(color[G[v][i]]==0 && !(dfs(G[v][i],-c))) return false;
	}
	return true;
}
bool used[210];
int main(){
	int i,j,k,n;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> s[i];
		for(j=0;j<n;j++){
			d[i][j] = 1000000;
			d[i][i] = 0;
			a[i][j] = s[i][j] - '0';
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(a[i][j]==1){
				d[i][j] = 1;
			}
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			for(k=0;k<n;k++){
				d[j][k] = min(d[j][k],d[j][i] + d[i][k]);
			}
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(a[i][j]==1) G[i].push_back(j);
		}
	}
	for(i=0;i<n;i++) color[i] = 0;
	for(i=0;i<n;i++){
		if(color[i]==0){
			if(!dfs(i,1)){
				cout << -1 << endl;
				return 0;
			}
		}
	}
	for(i=0;i<n;i++) used[i] = true;
	int cnt = 0;
	for(i=0;i<n;i++){
		if(!used[i]) continue;
		used[i] = false;
		int mx = 0; vector<int> v;
		for(j=0;j<n;j++){
			if(d[i][j]==1000000) continue;
			used[j] = false;
			v.push_back(j);
		}
		for(j=0;j<n;j++){
			for(k=0;k<n;k++){
				mx = max(mx,d[j][k]);
			}
		}
		cnt += mx + 1;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 896
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;

struct Point {
	int x, y;
};

int R, C, N;
int border(Point p) {
	if (p.x == 0 || p.x == R || p.y == 0 || p.y == C) return 1;
	return 0;
}

int calc(Point p) {
	if (p.y == 0) {
		return p.x;
	}
	if (p.x == R) {
		return R + p.y;
	}
	if (p.y == C) {
		return R + C + (R - p.x);
	}
	return R + C + R + C - p.y;
}

int main()
{
	vector<tuple<int, int, int>> V;
	scanf("%d %d %d", &R, &C, &N);
	for (int i = 0; i < N; i++) {
		Point p, q;
		scanf("%d %d %d %d", &p.x, &p.y, &q.x, &q.y);
		if (!(border(p) && border(q))) continue;
		int at0 = calc(p);
		int at1 = calc(q);
		if (at0 > at1) swap(at0, at1);
		V.push_back(make_tuple(at0, 1, at1));
		V.push_back(make_tuple(at1, -1, at0));
	}

	int flag = 1;
	sort(ALL(V));
	stack<int> S;
	for (tuple<int, int, int>& p : V) {
		if (std::get<1>(p) == 1) {
			int t = std::get<2>(p);
			if (!S.empty() && t >= S.top()) {
				flag = 0;
				goto done;
			}
			S.push(t);
		}
		else {
			S.pop();
		}
	}

done:
	if (flag) printf("YES\n");
	else printf("NO\n");

	return 0;
}


Measured memory_bytes: 4852
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( stdin . lock ( ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        n: usize, m: usize,
        a: [chars; n],
        b: [chars; m]
    }
    let mut ok = false;
    for y in 0..a.len()-b.len()+1 {
        for x in 0..a[0].len()-b[0].len()+1 {
            let mut is_ok = true;
            for yd in 0..b.len() {
                for xd in 0..b[0].len() {
                    if a[y+yd][x+xd] != b[yd][xd] {
                        is_ok = false;
                    }
                }
            }
            if is_ok {
                ok = true;
            }
        }
    }
    println!("{}", if ok {"Yes"} else {"No"});
}

Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.IOException;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader read = new BufferedReader(
                new java.io.InputStreamReader(System.in));

       int w = Integer.parseInt(read.readLine());
       int n = Integer.parseInt(read.readLine());
       int [] var = new int [w];
for(int j=0;j<w;j++){
	var[j]=j+1;
}
//String x[] = new String[2];
       for(int i=0;i<n;i++){
    //	   System.out.println("A");
       String x[]= read.readLine().split(",");
       int str[] =new int[2];
       str[0]=Integer.parseInt(x[0]);
       str[1]=Integer.parseInt(x[1]);
    //   System.out.println("B");
       int tmp=var[str[0]-1];

       var[str[0]-1]=var[str[1]-1];
       var[str[1]-1]=tmp;
	  // System.out.println("Str"+str[0]+","+str[1]);

	//   System.out.println("var"+var[0]+","+var[1]);
       //System.out.println(z[2]);
       //System.out.println(x);
	// TODO ティツ?ェテ・ツ仰陛ァツ板淌ヲツ按静」ツ?陛」ツつ古」ツ?淌」ツδ。テ」ツつステ」ツδε」ツδ嘉」ツδサテ」ツつケテ」ツつソテ」ツδ?
      }
       for(int i=0;i<w;i++){
       System.out.println(var[i]);
       }
	}

}

Measured memory_bytes: 24252
import sys
from io import StringIO
import unittest
import os

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


# 実装を行う関数
def resolve(test_def_name=""):
    n = int(input())

    for i in range(10):
        if n > 1000:
            n -= 1000
            continue
        print(1000 - n)
        return

    # テストクラス


class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """1900"""
        output = """100"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """3000"""
        output = """0"""
        self.assertIO(test_input, output)

    # 自作テストパターンのひな形(利用時は「tes_t」のアンダーバーを削除すること
    def tes_t_1original_1(self):
        test_input = """データ"""
        output = """データ"""
        self.assertIO(test_input, output)


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main()


Measured memory_bytes: 70820
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }






int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> cnt(n + 1);
	for(int i = 2; i <= n; i++){
		int k = i;
		for(int j = 2; j * j <= i; j++){
			while(k % j == 0){
				cnt.at(j)++;
				k /= j;
			}
		}
		if(k > 1) cnt.at(k)++;
	}
	ll ans = 1;
	rep(i,n + 1){
		ans *= cnt.at(i) + 1;
		ans %= mod;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
n, p = map(int,input().split())
s = str(input())
ans = 0

if p == 2 or p == 5:
    for i in range(n):
        if int(s[i])%p == 0:
            ans += i+1
    print(ans)
    exit()

tmp = [0] * p
tmp[0] = 1
mod = 0
r = 1
for i in range(1,n+1):
    mod += (int(s[-i]) * r) % p
    mod %= p
    tmp[mod] += 1
    r *= 10
    r %= p

for i in tmp:
    ans += i*(i-1)//2

print(ans)

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

using namespace std;

#define mod 1000000007
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define ll long long

ll MX = 400000;

ll solve(ll n, int bs){

    ll sm = 0;
    while(n){
        sm = sm+(n%bs);
        n = n/bs;
    }

    return sm;

}

int main(){

    ll n,s;
    cin>>n>>s;
    ll i=2;
    for(i=2;i*i<=n;i++){
        if(solve(n,i)==s){
            cout<<i;
            return 0;
        }
    }

    for(;i>0;i--){
        ll a1 = i;
        ll a2 = s-i;
        if(a1>=0 && a2>=0){
            ll tmp = n-a2;
            if(tmp%a1==0){
                tmp = tmp/a1;
                if(tmp>a1 && tmp>a2){
                    cout<<tmp;
                    return 0;
                }
            }
        }
    }

    if(n==s){
        cout<<(n+1)<<endl;
        return 0;
    }

    cout<<-1<<endl;
	return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N = int(input())
A = list(map(int, input().split()))

a_sorted = sorted(A, key=lambda x: -x)

circle = [a_sorted[0]]
ans = 0
for idx, a in enumerate(a_sorted[1:]):
    ans += circle[idx]
    circle.extend([a, a])

print(ans)


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

int main() {
    int k;
    cin >> k;
    string s;
    cin >> s;

    int size = s.size();
    if (size <= k) {
        cout << s << endl;
    } else {
        for (int i = 0; i < k; i++) {
            cout << s[i];
        }
        cout << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define bit(i) (1<<(i))
#define set(mask,i) (mask |= (1<<(i)))
#define get(mask,i) (mask & (1<<(i)))
typedef long long ll;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const double PI = acos(-1);
const ll INF64 = (ll)1e15;
const int INF32 = (int)1e9;
const int64_t md = (int64_t)((int64_t)1e9 + 7);
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n, k;
	cin >> n >> k;
	int arr[n];
	for(int& el : arr) cin >> el;
	int dp[n];
	for(int& el : dp) el = INF32;
	dp[0] = 0;
	for(int i = 1; i < n; i++) {
		for(int kk = 1; kk <= k; kk++) {
			if(i-kk >= 0) dp[i] = min(dp[i], dp[i-kk]+abs(arr[i]-arr[i-kk]));
		}
	}
	cout << dp[n-1];

	return 0;
}

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

bool check_max(int n, vector<ll> a){
	ll ma = -1;
	for(int i=0; i<n; i++){
		ma = max(ma, a[i]);
	}
	if(ma <= n-1) return false;
	else return true;
}

/*
ll solve(int n, vector<ll> a){
	ll ans = 0;
	while(check_max(n, a)){
		ll ma = -1;
		int id = -1;
		for(int i=0; i<n; i++){
			if(ma < a[i]){
				ma = a[i];
				id = i;
			}
		}
		a[id] -= a.size();

		for(int i=0; i<n; i++){
			if(i != id){
				a[i]++;
			}
			//printf("%d ", a[i]);
		}
		//puts("");
		ans++;
	}
	return ans;
}
*/

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	//cout << solve(n, a) << endl;

	
	/*
	int n;
	n = 2;
	vector<ll> a;
	a.pb(1 + ((k+1)/2));
	a.pb(k/2);

	cout << n << endl;
	for(int i=0; i<n; i++){
		if(i != n-1) printf("%lld ", a[i]);
		else printf("%lld\n", a[i]);
	}
	*/

	int n;
	cin >> n;
	vector<ll> a;
	for(int i=0; i<n; i++){
		ll t;
		cin >> t;
		a.pb(t);
	}

	//cout << "exact:" << solve(n, a) << endl;

	ll ans = 0;
	ll cnt = 0;
	while(check_max(n, a)){
		/*
		cnt++;
		if(cnt > 10000){
			break;
		}
		*/
		sort(a.begin(), a.end(), greater<ll>());

		ll mi = INF; 
		for(int i=0; i<n; i++){
			mi = min(mi, a[i]);
		}
		ll sub = max(mi - (n-1), 0ll);
		for(int i=0; i<n; i++){
			a[i] -= sub;
		}
		ans += (long long)sub*(long long)n;
		//cout << "phase1:" << sub << endl;
		//cout << "ans1:" << ans << endl;

		/*
		for(int i=0; i<n; i++){
			printf("%lld ", a[i]);
		}
		puts("");
		*/

		for(int j=0; j<n-1; j++){
			ll m1 = (a[j] - a[j+1] + n)/(n+1);
			ll m2 = (a[j] - (n-1) + n - 1) / n;
			//cout << m1 << endl;
			//cout << m2 << endl;
			sub = max(m1, m2);
			if(sub == 0) continue;

			a[j] -= (long long)n*sub;
			if(a[j] < 0){
				a[j] += n;
				sub--;
			}
			for(int i=0; i<j; i++){
				a[i] += sub;
			}
			for(int i=j+1; i<n; i++){
				a[i] += sub;
			}
			ans += sub;
			//cout << "phase2:" << sub << endl;
			//cout << "ans2:" << ans << endl;
			break;
		}
		/*
		for(int i=0; i<n; i++){
			printf("%lld ", a[i]);
		}
		puts("");
		*/
		//cout << ans << endl;
	}
	cout << ans << endl;

	/*
	for(int i=0; i<20; i++){
		for(int j=0; j<20; j++){
			for(int k=0; k<20; k++){
				vector<int> a;
				a.pb(i);
				a.pb(j);
				a.pb(k);

				printf("%3lld ", solve(3, a));
			}
			puts("");
		}
		puts("\n");
	}
	*/



	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod ((long long)1e9 + 7)

long long pow_mod(long long a, long long b) {
  long long ret = 1;
  while (b > 0) {
    if (b & 1) ret = ret * a % mod;
    a = a * a % mod;
    b = b >> 1;
  }
  return ret;
}

long long comb(long long n, long long k) {
  long long ma = max(k, n - k);
  long long mi = min(k, n - k);
  long long ret = 1;
  for (long long i = ma + 1; i <= n; i++) {
    ret *= i;
    ret %= mod;
  }
  long long inv = 1;
  for (long long i = 2; i <= mi; i++) {
    inv *= i;
    inv %= mod;
  }
  ret *= pow_mod(inv, mod - 2);
  ret %= mod;
  return ret;
}

int main(void) {
  long long n, a, b;
  cin >> n >> a >> b;
  long long ans = pow_mod(2, n) - 1;
  ans %= mod;
  ans += mod;
  ans -= comb(n, a);
  ans %= mod;
  ans += mod;
  ans -= comb(n, b);
  ans %= mod;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void print_vector(vector<int> v){
  for(int i = 0; i < (int)v.size(); i++){
	  if (i == (int)v.size() - 1) cout << v[i];
	  else cout << v[i] << " ";  
	}
  cout << endl;	
}

//char grid[100][100];
void solve(){
   string a, b, c;
   cin >> a >> b >> c;
   bool ok =  (a[(int)a.length() - 1] == b[0] && b[(int)b.length() - 1] == c[0]);
   if(ok) cout << "YES" << endl;
   else cout << "NO" << endl;
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using vvint = vector<vint>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }


void solve(long long N, std::vector<long long> B){
    int sum = B[0];
    rep(i, N-2) {
        sum += min(B[i], B[i+1]);
    }
    sum += B.back();
    cout << sum << endl;
}

// Generated by atcoder-tools ver.1.1.6
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> B(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&B[i]);
    }
    solve(N, std::move(B));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
int read();
int M(int x) { return x >= mod ? x - mod : x; }
void Add(int &x, int y) { (x += y) >= mod ? x -= mod : x; }
int n, res;
int C[102][102];
struct DP {
    int x[102];
    int &operator[](int p) {
        return (p <= 50 && p >= -50) ? x[p + 50] : x[101];
    }
} f[102][102];
int main() {
    scanf("%d", &n), f[1][1][0] = f[1][1][1] = 1;
    if (n == 1) return puts("1"), 0;
    for (int i = C[0][0] = 1; i <= n; ++i)
        for (int j = C[i][0] = 1; j <= i; ++j)
            C[i][j] = M(C[i - 1][j] + C[i - 1][j - 1]);
    for (int i = 2; i <= n; ++i) {
        for (int j = i; j <= n; ++j)
            for (int x = j - n; x <= n - j; ++x)
                for (int t = 1; t <= j; ++t)
                    for (int p = 0; p <= t; ++p)
                        if (abs((x + p) * 2 - t) <= t)
                            Add(f[i][j][x],
                                1ll * f[i - 1][j - t][(x + p) * 2 - t] *
                                    C[j][t] % mod * C[t][p] % mod);
        Add(res, f[i][n][0]);
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 2944
#include<stdio.h>

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

	scanf("%d%d%d", &a, &b, &c);

	if (a < b && b < c)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}


	return 0;
}

Measured memory_bytes: 1008
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int a,b,c; cin>>a>>b>>c;
    if(c-(a+b)>1) c=(a+b)+1;
    cout<<c+b<<endl;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    int d;
    cin >> d;
    mp[d]++;
  }
  
  int m;
  cin >> m;
  
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    if (mp[t] == 0) {
      cout << "NO\n";
      return 0;
    }
    else mp[t]--;
  }
  
  cout << "YES\n";
}

Measured memory_bytes: 9600
N=int(input())
A=list(map(int,input().split()))
m,M=10**7,-10**7
for i,a in enumerate(A):
    if a<m:
        mi,m=i+1,a
    if a>M:
        Mi,M=i+1,a
if m*M<0:
    print(2*N-1)
    if abs(m)<abs(M):
        print(*[str(Mi)+' '+str(i) for i in range(1,N+1)],sep='\n')
        m=0
    else:
        print(*[str(mi)+' '+str(i) for i in range(1,N+1)],sep='\n')
else:
    print(N-1)
if m>=0:
    print(*[str(i)+' '+str(i+1) for i in range(1,N)],sep='\n')
else:
    print(*[str(i+1)+' '+str(i) for i in range(N-1,0,-1)],sep='\n')

Measured memory_bytes: 3064
n=int(input())
b=[int(a-(i+1))  for i,a in enumerate(list(map(int,input().split())))]
if n==1:
  print(0)
  exit(0)
bm=b[:]
bm.sort()
mid_1=bm[n//2]
mid_2=bm[(n//2)+1]
ans_1,ans_2=0,0
if n%2==1:
  for bb in b:
    ans_1+=abs(bb-mid_1)
  print(ans_1)
else:
  for bb in b:
    ans_1+=abs(bb-mid_1)
    ans_2+=abs(bb-mid_2)
  print(min(ans_1,ans_2))



Measured memory_bytes: 26180
#include <iostream>

int main () {
    std::string str_0;
    std::string str_1;
    std::string str_2;

    std::cin >> str_0 >> str_1 >> str_2;

    std::cout << str_0[0] << str_1[0] << str_2[0]  << std::endl;
    return 0;

}

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

int main() {
    int n;
    cin >> n;
    int a[100000];
    rep(i, n) {
        cin >> a[i];
    }
    sort(a, a + n);
    
    list<int> l1, l2;
    // l1
    l1.push_front(a[0]);
    int l = 1, r = n - 1;
    bool Max = true;
    while (true) {
        if (l - 1 >= r) break;
        if (Max) {
            l1.push_front(a[r--]);
        } else {
            l1.push_front(a[l++]);
        }
        if (l - 1 >= r) break;
        if (Max) {
            l1.push_back(a[r--]);
            Max = false;
        } else {
            l1.push_back(a[l++]);
            Max = true;
        }
    }
    // l2 
    l2.push_front(a[n-1]);
    l = 0; r = n - 2;
    Max = false;
    while (true) {
        if (l - 1 >= r) break;
        if (Max) {
            l2.push_front(a[r--]);
        } else {
            l2.push_front(a[l++]);
        }
        if (l - 1 >= r) break;
        if (Max) {
            l2.push_back(a[r--]);
            Max = false;
        } else {
            l2.push_back(a[l++]);
            Max = true;
        }
    }

    int a1[n], a2[n], idx = 0;
    for(auto& p : l1) a1[idx++] = p;
    idx = 0;
    for(auto& p : l2) a2[idx++] = p;

    ll ans = 0, ans2 = 0;
    
    REP(i, 1, n) {
        ans += abs(a1[i] - a1[i-1]);
    }
    REP(i, 1, n) {
        ans2 += abs(a2[i] - a2[i-1]);
    }


    cout << max(ans, ans2) << endl;
    return 0;
}

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

#define all(v)  begin(v), end(v)
#define endl    '\n';
#define int     long long
#define pii     pair<int, int>
#define sz(x)   (int) x.size()

void test_case() {
    int n; 
    cin >> n;
    vector<int> a(n+1);
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        if ((i & 1) && (a[i] & 1)) cnt += 1;
    }
    cout << cnt << endl;
}

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

    int t = 1;
    // cin >> t;

    while (t--) { 
        test_case();
    }
    return 0;
}


Measured memory_bytes: 3640
a, b, c = map(int, input().split())
if a == b == c:
    if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        print(-1)
    else:
        print(0)
else:
    cnt = 0
    while True:
        if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
            ab = a // 2 + b // 2
            bc = b // 2 + c // 2
            ac = a // 2 + c // 2
            a = bc
            b = ac
            c = ab
            cnt += 1
        else:
            print(cnt)
            exit()


Measured memory_bytes: 3060
import java.util.*;

public class Main {	
	public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
      String S = sc.next();
      int N = S.length(); long total =0;
      ArrayList<Long> list = new ArrayList<Long>();
	  for (int i =0; i<Math.pow(2,N-1); i++) {
        String bit = Integer.toBinaryString(i); //iをビットに変換
        while(bit.length() < N - 1) {
          bit = 0 + bit; //ビット桁を揃える
        }
        int count =0, pos =0;
        for (int j=0; j<bit.length(); j++) {
          if (bit.charAt(j) == '1' ) {
            list.add(Long.parseLong(S.substring(pos,j+1)));
            count++; pos = j+1;
          }
        }
        if (count == 0) {
          list.add(Long.parseLong(S));
        } else {
          list.add(Long.parseLong(S.substring(pos,N))); //最も右の数値をリストに格納
        }
      }
      for (int j =0; j<list.size(); j++) {
        total += list.get(j);
      }
	  System.out.println(total);
	}
}


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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353
#define Graph vector<vector<int>>

int main() {
    int A, B, C, K; cin >> A >> B >> C >> K;
    for(int i = 0; i < K; i++) {
        int M = max(max(A, B), C);
        if(M == A) A *= 2;
        else if(M == B) B *= 2;
        else C *= 2;
    }
    cout << A + B + C << endl;
}

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

int main () {
  int a, b, c;
  cin >> a >> b >> c;
  int sum = a+b+c;
  int nmax = max({a,b,c});
  
  cout << ( nmax == (sum-nmax) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3100
#include "bits/stdc++.h"
using namespace std;
#define endl "\n"
#define int long long

int32_t main()
{
      ios::sync_with_stdio(false);
      cin.tie(0); 
      int n;
      cin>>n;
      vector<vector<int> > v(n+1,vector<int> (3));

      for(int i = 0; i < n; i++) {
            for(int j = 0; j < 3; j++) {
                  cin>>v[i+1][j];
            }
      }

      vector<vector<int> > dp(n+1, vector<int> (3)); 
      dp[1][0] = v[1][0]; dp[1][2] = v[1][2]; dp[1][1] = v[1][1];
      for(int i = 2; i <=n; i++) {
            dp[i][0] = max(dp[i-1][1], dp[i-1][2])+ v[i][0];
            dp[i][1]= max(dp[i-1][0], dp[i-1][2]) + v[i][1];
            dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + v[i][2];
      }
      int ans = max(dp[n][0], max(dp[n][1], dp[n][2]));
      cout<<ans<<endl;
      
      return 0;
}

Measured memory_bytes: 11136
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

#define REP(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) REP(i,0,n)
struct point{
	double x,y;
	point(){}
	point(double x,double y):x(x),y(y){}
};

const double pi=3.1415926535897932;
const double rad=180/pi;

double get_angle(point a, point b, int d, int& D)
{
	double x = b.x - a.x;
	double y = b.y - a.y;
	double ret = atan2(x, y) * rad;
	D = (x < 0 ? (y < 0 ? (4) : (3)) : (y < 0 ? (1) : (2) )) -1;
	return (180-ret);
}

int main(void)
{
	int n;
	point p[100];
	bool used[100];
	while(cin >> n, n){
		int f = -1;
		rep(i,n){
			scanf("%lf,%lf", &p[i].x, &p[i].y);
			used[i] = false;
			if(f == -1 || p[i].x < p[f].x) f = i;
		}
		int t = f, d = 0;
		for(int l = 0;;l = 1){
			if(l && t == f) break;
			double mi;
			int tmp = -1,c = 100000000;
			int dd;
			rep(i,n){
				if(used[i])continue;
				if(t == i)continue;
				int D;
				double ang = get_angle(p[t], p[i], d, D);
				int cc = 0,ddd = d;
				while(D != ddd){
					ddd = (ddd + 1) % 4;
					cc++;
				}
				if(tmp < 0 || cc < c || (c == cc && ang < mi)){
					tmp = i;
					c = cc;
					mi = ang;
					dd = D;
				}
			}
			if(tmp < 0) break;
			t = tmp;
			d = dd;
			used[t] = true;
		}
		printf("%u\n",count(used, used+n, false));
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <set>
#include <utility>

int main() {

  int A;
  int B;
  int C;
  int D;
  int E;

  std::cin >> A >> B >> C >> D >> E;

  int a = 10 - A % 10;
  int b = 10 - B % 10;
  int c = 10 - C % 10;
  int d = 10 - D % 10;
  int e = 10 - E % 10;

  int zeroCount = 0;
  if (a == 10) {
    a = 1;
    zeroCount++;
  }

  if (b == 10) {
    b = 1;
    zeroCount++;
  }

  if (c == 10) {
    c = 1;
    zeroCount++;
  }

  if (d == 10) {
    d = 1;
    zeroCount++;
  }

  if (e == 10) {
    e = 1;
    zeroCount++;
  }

  std::multiset<std::pair<int, int>> mst{
      {a, A}, {b, B}, {c, C}, {d, D}, {e, E}};

  int count = 0;
  int tmp = 0;
  for (auto p : mst) {
    count++;
    if (count == 5) {
      if (p.second % 10 == 0) {
        tmp += p.first + p.second;
        break;
      }
      tmp += p.second;
      break;
    }
    tmp += p.first + p.second;
  }

  std::cout << tmp - zeroCount << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//g++ -std=c++11 

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7

int main(){
	ll N;
	cin >> N;
	vector<pair<ll,ll> >D(N);
	rep(i, N) {
		cin >> D[i].first >> D[i].second;
	}

	rep(i, N - 2) {
		if(D[i].first == D[i].second && 
				D[i+1].first == D[i+1].second &&
				D[i+2].first == D[i+2].second) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


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

class Edge{
public:
	int edge_dist;
	int cost;
	Edge() : edge_dist(0), cost(0) {}
	Edge(int _dist, int _cost) : edge_dist(_dist), cost(_cost) {}
};

bool operator==(const Edge &a, const Edge &b){
	return (a.cost == b.cost);
}
bool operator!=(const Edge &a, const Edge &b){
	return !(a == b);
}
bool operator<(const Edge &a, const Edge &b){
	return (a.cost < b.cost);
}
bool operator>=(const Edge &a, const Edge &b){
	return !(a < b);
}
bool operator>(const Edge &a, const Edge &b){
	return (a.cost > b.cost);
}
bool operator<=(const Edge &a, const Edge &b){
	return !(a > b);
}

int main(){
	
	int v, e, s, t, w, sum = 0;
	vector< int > vlist; //??¢?´¢?????? -> 1 / else -> 0
	vector< vector< Edge > > edge;
	vector< Edge > tree;
	priority_queue< Edge, vector< Edge >, greater< Edge > > priq;
	
	cin >> v >> e;
	
	vlist.resize(v);
	edge.resize(v);
	
	for(int i = 0; i < e; ++i){
		cin >> s >> t >> w;
		
		edge[s].push_back(Edge(t, w));
		edge[t].push_back(Edge(s, w));
	}
	
	vlist[0] = 1;
	for(vector< Edge >::iterator it = edge[0].begin(); it != edge[0].end(); ++it){
		priq.push(*it);
	}
	
	while(!priq.empty()){
		
		Edge ed = priq.top();
		priq.pop();
		
		if(vlist[ed.edge_dist])continue;
		
		tree.push_back(ed);
		vlist[ed.edge_dist] = 1;
		sum += ed.cost;
		
		for(vector< Edge >::iterator it = edge[ed.edge_dist].begin(); it != edge[ed.edge_dist].end(); ++it){
			if(vlist[(*it).edge_dist] == 0){
				priq.push(*it);
			}
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 5044
#include<iostream>
#include<math.h>
using namespace std;
#define INF 1000000
int min(int a,int b){
	if(a<b){
		return a;
	}else {
		return b;
	}
}
int main(){
	int e;
	while(cin>>e&&e!=0){
		int m=INF;
		int x;
		for(int z=0;z*z*z<=e;z++){
			for(int y=0;z*z*z+y*y<=e;y++){
				x=e-z*z*z-y*y;
				m=min(m,x+y+z);
			}
		}
		cout<<m<<endl;
	}	
	return 0;
}

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

int main() {
	int n,m,i,j,ans;
	cin >> n;
	if(n%2==0){
		cout << 0.5;
	}else{
		cout << double((n+1)/(2.0*n));
	}
	return 0;
}

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

#define rnm ios::sync_with_stdio(false)
#define pb push_back;
typedef long long ll;
typedef long double ldb;
const int inf=0x7fffffff;
char a[25];

int main(){
	rnm;
	cin>>a;
	int l=strlen(a);
	int ans1=0,ans2=0;
	for(int i=0;i<l;i++)
		ans2+=a[i]-'0';
	ans1+=a[0]-'0'-1;
	ans1+=(l-1)*9;
	int ans=max(ans1,ans2);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>

using namespace std;

int n;

bool isOdd(int x) {
    vector<int> digits;
    while (x) {
        digits.push_back(x % 10);
        x /= 10;
    }
    return digits.size() % 2;
}

int main() {
    scanf("%d", &n);
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += isOdd(i);
    }
    printf("%d\n", ans);
}

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

int main(void){
  int N, M;
  cin >> N >> M;
  vector<int> card(N, 1);
  int L_max = 0, R_min = N;
  for(int i = 0; i < M; i++){
    int L, R;
    cin >> L >> R;
    L_max = max(L, L_max);
    R_min = min(R, R_min);
  }
  if(R_min >= L_max)cout << R_min - L_max + 1;
  else cout << 0;
  return 0;
}

Measured memory_bytes: 640