akhauriyash/Code-Regression huggingface dataset:
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    // インタラクティブ問題では除去した方がいいかも
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n, k; cin >> n >> k;
    vector<ll> h(n);
    REP(i, n) cin >> h[i];

    // dp[i][j][k] := i個見て、j個取った。最後取ったのがH_k (kだけ1-indexed)
    vector<vector<vector<ll>>> dp(n+1, vector<vector<ll>>(n-k+1, vector<ll>(n+1, 1e15)));
    dp[0][0][0] = 0;
    REP(i, n) REP(j, n-k) {
        // h_(i+1)を取る
        RANGE(l, 0, i) {
            ll hk = l == 0 ? 0 : h[l-1];
            chmin(dp[i+1][j+1][i+1], dp[i][j][l] + max(0LL, h[i] - hk));
        }
        // h_(i+1)を取らない
        RANGE(l, 0, i) {
            chmin(dp[i+1][j][l], dp[i][j][l]);
        }
    }

    ll ans = LINF;
    REP(i, n+1) REP(l, n+1) {
        chmin(ans, dp[i][n-k][l]);
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 216832
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	string s[n+1];
	for(int i=1;i<=n;i++)
	   cin>>s[i];
	for(int i=2;i<=n;i++)
	{
		if(s[i][0]!=s[i-1][s[i-1].size()-1])
		{
			cout<<"No"<<endl;
			return 0;
		}
		for(int j=1;j<i;j++)
		   if(s[j]==s[i])
		    {
		    	cout<<"No"<<endl;
			    return 0;
		    }
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using CHY72;

namespace CHY72{
    
    public class PointXY<T>where T:IComparable {
        public T X , Y;
        public bool Flag = false;
        public PointXY(T _X,T _Y) {
            X = _X; Y = _Y;
        }
        public static bool operator ==(PointXY<T> P1, PointXY<T> P2) {
            return (P1.X.CompareTo( P2.X) == 0 && P1.Y.CompareTo (P2.Y) == 0);
        }
        public static bool operator !=(PointXY<T> P1, PointXY<T> P2) {return !(P1 ==P2);}
        public override int GetHashCode() {return X.GetHashCode() ^ Y.GetHashCode();}
        public override bool Equals(object obj) {
            if (obj == null || this.GetType() != obj.GetType()) {return false;}
            return (this == (PointXY<T>)obj);
        }         

    }
    
}    

public class Program {
    static bool ReadLine_1(ref int num1, bool Fin0 = true) {
        string str = Console.ReadLine();
        num1 = int.Parse(str);
        return (Fin0 && num1 == 0);
    }
    static int  ReadLine_1() {
        return  int.Parse(Console.ReadLine());
    }
    static bool ReadLine_2(ref int num1, ref int num2, char Spliter = ' ', bool Fin0 = true) {
        string str = Console.ReadLine();
        num1 = int.Parse(str.Split(Spliter)[0]);
        num2 = int.Parse(str.Split(Spliter)[1]);
        return (Fin0 && num1 == 0);
    }
    static int[] ReadLine72(char Spliter = ' ') {
        return Console.ReadLine().Split(Spliter).Select(s => int.Parse(s)).ToArray();
    }

    const int DefaultMax = 727272;

    static bool isPrime(int p) {
        if (p!= 2 && p % 2 == 0) return false;
        if (p == 1) return false;
        int SQp = (int)(Math.Sqrt(p));
        for (int i = 3; i <= SQp; i++) {
            if (p % i == 0) return false;
        }
        return true;
    } 

    static void Main(string[] args) {
        while (true) {
            var adn = ReadLine72();
            if (adn[0] == 0) return;
            for (int i = adn[0], n =0; true; i+= adn[1]) {
                if (isPrime(i)) { n++;}
                if (n == adn[2]) { Console.WriteLine(i); break; }
           }
            
        }

    }
}

Measured memory_bytes: 6004
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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



int main(void) {
	
	long long int n;

	cin >> n;
	vector<long long int>a(n + 1), b(n + 1), c(n + 1);
	vector<vector<long long int > > cost(n + 1, vector<long long int>(3, 0));
	FOR(i, 1, n) {
		cin >> a[i] >> b[i] >> c[i];
	}

	cost[1][0] = a[1];
	cost[1][1] = b[1];
	cost[1][2] = c[1];

	FOR(i, 2, n) {
		FOR(j, 0, 2) {
			switch (j) {
			case 0:
				cost[i][j] = a[i] + max(cost[i - 1][1], cost[i - 1][2]);
				break;
			case 1:
				cost[i][j] = b[i] + max(cost[i - 1][0], cost[i - 1][2]);
				break;
			case 2:
				cost[i][j] = c[i] + max(cost[i - 1][0], cost[i - 1][1]);
				break;
			}
		}
	}

	cout << max(cost[n][0], max(cost[n][1], cost[n][2])) << endl;


	return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define arrprint(v,n) rep(i,0,n-1)cout << v[i] << " ";cout << endl;
#define matprint(v,n,m) rep(i,0,n-1){rep(j,0,m-1){cout << v[i][j] << " ";}cout << endl;}
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
typedef long long ll;
typedef pair<int,int> P;

void sort2vectors(vector<int> &av, vector<int> &bv){
   int n = av.size();
   vector<int> p(n), av2(n), bv2(n);
   iota(p.begin(), p.end(), 0);
   sort(p.begin(), p.end(), [&](int a, int b) { return av[a] < av[b]; });
   for (int i = 0; i < n; i++) {
       av2[i] = av[p[i]];
       bv2[i] = bv[p[i]];
   }
   av = av2;
   bv = bv2;
}

int main(){
    int h,n;
    cin >> h >> n;
    vector<int> a(n),b(n);
    rep(i,0,n-1)cin >> a[i] >> b[i];
    vector<int> dp(h+1,INF);
    dp[0] = 0;
    sort2vectors(b,a);

    rep(i,1,h){
        rep(j,0,n-1){
            if(i-a[j]>=0){
                dp[i] = min(dp[i],dp[i-a[j]]+b[j]);
            }else{
                dp[i] = min(dp[i],b[j]);
            }
        }
    }
    int ans = dp[h];


    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

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

#define pb push_back

using namespace std;

vector<int> data,order;

int main()
{
  int n,l;
  bool possible=false;

  scanf("%d%d",&n,&l);
  data.resize(n);
  for(int c=0;c<n;c++)
  {
    scanf("%d",&data[c]);
    if (c>0&&data[c-1]+data[c]>=l)
    {
      possible=true;
      for(int c2=1;c2<=n-1;c2++)
      if (c2<c)order.pb(c2);
      else break;
      for(int c2=n-1;c2>=1;c2--)
      if (c2>c)order.pb(c2);
      else break;
      order.pb(c);
      break;
    }
  }
  if (possible)
  {
    printf("Possible\n");
    for(int c=0;c<order.size();c++)
    printf("%d\n",order[c]);
  }
  else
    printf("Impossible\n");
}


Measured memory_bytes: 1784
#include <bits/stdc++.h>
using namespace std;
char let[27];
char ex[10004];
int main()
{
    for(int i=0;i<26;i++)
    {
        let[i]='A'+i;
    }
    int c;
    cin>>c;
    cin>>ex;
    int s=strlen(ex);
    for(int i=0;i<s;i++)
    {
        char m = ex[i];
        char x=m+c;

        if(x>'Z')
        {
            int t=x-1-'Z'+'A';
            cout<<(char)t;
        }
        else
        {
            cout<<x;
        }

        //cout<<'m'+c;
    }
}


Measured memory_bytes: 256
from collections import defaultdict
N,K = list(map(int,input().split()))
ab= [list(map(int, input().split())) for i in range(N)]
count=defaultdict(int)
for a,b in ab:
    count[a]+=b
lst=sorted(count.items(), key=lambda x:x[0])
idx=0
for val,cnt in lst:
    idx+=cnt
    if idx >=K:
        break
print(val)

Measured memory_bytes: 37792
#include <stdio.h>
int main(void)
{
	int x = 1, y = 1, convert;
	while ((x != 0)||(y != 0))
	{
		scanf("%d %d", &x, &y);
		if ((x != 0) ||( y != 0))
		{
			if (x > y)
			{
				convert = x;
				x = y;
				y = convert;
			}
			printf("%d %d\n", x, y);
		}
	}
	return 0;
}


Measured memory_bytes: 2080
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
 
alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");
 
T lread(T = long)()
{
    return readln.chomp.to!T();
}
 
T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}
 
void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long a,b;
    scan(a,b);
    ((a - 1) * (b - 1)).writeln();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
static const ll INF=1000000000000000;
using P=pair<ll,ll>;
ll dp[1005][(1<<12)];
ll N,M;
int main(){
  cin>>N>>M;
  vector<P>A(M);
  for( ll i=0;i<M;i++){
  ll a,b;cin>>a>>b;ll sum=0;
    for(ll j=0;j<b;j++){
    ll c;cin>>c;sum+=pow(2,c-1);
    }P p(sum,a);A[i]=p;
  }for(ll i=0;i<=M;i++)
    for(ll j=0;j<(1<<N);j++)
      dp[i][j]=INF;
  dp[0][0]=0;
  for(ll i=1;i<=M;i++){
  ll c=A[i-1].first;
    ll a=A[i-1].second;
    for(ll j=0;j<(1<<N);j++)
      dp[i][j]=dp[i-1][j];
    for(ll j=0;j<(1<<N);j++){
    if(a+dp[i-1][j]<dp[i][c|j])
      dp[i][c|j]=a+dp[i-1][j];
     }
  }if(dp[M][(1<<N)-1]<INF)
    cout<<dp[M][(1<<N)-1]<<endl;
  else
    cout<<-1<<endl;
    
  return 0;
}

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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

//const i64 mod = 1'000'000'000ll + 7;
const i64 smod = 998244353ll;
//const i64 inf = 1'000'000'000'000'000'000ll + 7;
//const i64 inf = 1'000'000'007;

const long double eps = 1e-8;

const i64 MAXN = 3 * 100'000 + 5;

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    i64 a, v;
    i64 b, w;
    i64 t;

    cin >> a >> v >> b >> w >> t;
    if (v <= w || ((abs(a - b) > t * (v - w)))) {
        cout << "NO" << endl;
    }
    else {
         cout << "YES" << endl;

    }

    return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>

int N,M,R,r[8],cost[201][201];

int dfs(int now){
    int i,ret,rt,tmpcost,flag;
    flag = 0;
    ret = 1000000000;
    for(i=0;i<R;i++){
        if(r[i]>0){
            rt=r[i];
            r[i]=0;
            tmpcost = cost[now][rt] + dfs(rt);
            r[i]=rt;
            if(tmpcost<ret)ret=tmpcost;
            flag=1;
        }
    }
    return (flag?ret:0);
}

int main(){
    int a,b,c;
    int i,j,k;

    scanf("%d %d %d",&N,&M,&R);
    for(i=0;i<R;i++){
        scanf("%d",&r[i]);
    }

    for(i=1;i<=N;i++){
        for(j=1;j<=N;j++){
            cost[i][j]=100000000;
        }
        cost[0][i]=cost[i][0]=cost[i][i]=0;
    }

    for(i=0;i<M;i++){
        scanf("%d %d %d",&a,&b,&c);
        cost[a][b] = cost[b][a] = c;
    }

    /* ワーシャルフロイド */
    for(k=1;k<=N;k++){
        for(i=1;i<=N;i++){
            for(j=1;j<=N;j++){
                if(cost[i][j] > cost[i][k] + cost[k][j]){
                    cost[i][j] = cost[i][k] + cost[k][j];
                }
            }
        }
    }

    printf("%d\n",dfs(0));
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <set>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <cstring>
using namespace std;

int r[300010], c[300010];
map< pair<int, int>, int > mp;

vector<int> br, bc;

int main() {
    int h, w, m;
    int mr = 0, mc = 0;
    scanf("%d%d%d", &h, &w, &m);
    for(int i = 1; i <= m; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        r[x]++;
        c[y]++;
        mr = max(mr, r[x]);
        mc = max(mc, c[y]);
        mp[ make_pair(x, y) ] = 1;
    }
    for(int i = 1; i <= h; i++) {
        if(mr == r[i]) br.push_back(i);
    }
    for(int i = 1; i <= w; i++) {
        if(mc == c[i]) bc.push_back(i);
    }
    int nr = br.size(), nc = bc.size();
    if(1ll * nr * nc > m) {
        printf("%d\n", mr + mc);
        return 0;
    }
    for(int i = 0; i < nr; i++) {
        for(int j = 0; j < nc; j++) {
            if(mp[ make_pair(br[i], bc[j]) ] == 0) {
                printf("%d\n", mr + mc);
                return 0;
            }
        }
    }
    printf("%d\n", mr + mc - 1);

    return 0;
}


Measured memory_bytes: 28468
#include<stdio.h>

int main(){
    int ans,num,a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    
    c = c - b;
    ans = b * 2;
    num = c - a;

    if(num>=1){
        ans=ans+a+1;
    }else if(num==0){
        ans=ans+a;
    }else if(num<=-1){
        ans=ans+c;
    }

    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
N = int(input())
A = list(map(int,input().split()))
color = set([])
select = 0
for i in range(N):
  if A[i] <= 399:
    color.add(0)
  elif A[i] <= 799:
    color.add(1)
  elif A[i] <= 1199:
    color.add(2)
  elif A[i] <= 1599:
    color.add(3)
  elif A[i] <= 1999:
    color.add(4)
  elif A[i] <= 2399:
    color.add(5)
  elif A[i] <= 2799:
    color.add(6)
  elif A[i] <= 3199:
    color.add(7)  
  else:
    select += 1

if select == N:
  print(1,select)
  exit()
MIN = len(color)
MAX = MIN + select
print(MIN,MAX)

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

using namespace std;

int main(){
    string s;
    int q;
    cin >> s;
    cin.ignore();
    cin >> q;
    cin.ignore();

    string frnt, bck; // それぞれ、最終的に前に追加されるものと後に追加されるもの

    bool direction = false; // false 正方向 true 反転方向
    for(int i = 0; i < q; i++){
        int cmd;
        cin >> cmd;
        if(cmd == 1){
            direction = !direction;
            cin.ignore();
            continue;
        }
        int f;
        char c;
        cin >> f >> c;
        cin.ignore();
        if(!direction){
            if(f ==1){
                frnt += c;
            } else {
                bck += c;
            }
        } else {
            if(f ==1){
                bck += c;
            } else {
                frnt += c;
            }
        }
    }

    if(!direction){
        reverse(frnt.begin(), frnt.end());
        string ans = frnt + s + bck;
        cout << ans << endl;
        return 0;
    } else {
        reverse(s.begin(), s.end());
        reverse(bck.begin(), bck.end());
        string ans = bck + s + frnt;
        cout << ans << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 1348
#include<bits/stdc++.h>
#define mem(dp,a) memset(dp,a,sizeof(dp))
#define pb(x) push_back(x)
#define m_p(x,y) make_pair(x,y)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,b,a) for (ll i=b-1;i>=a;i--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define pi 3.141592653589793238462
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
typedef long double ld;
ll ESP=1e18;
ll INF=1e9+7;

int main()
{
 hs;
 string s,t;
 cin>>s>>t;
 ll n=s.length();
 if(t.length()<n)
    cout<<"No"<<"\n";
 else
 {
  bool ff=0;
  rep(i,0,n)
  {
   if(s[i]!=t[i])
    ff=1;
  }
  if(!ff)
    cout<<"Yes";
  else
    cout<<"No";
  cout<<"\n";
 }
 return 0;

}


Measured memory_bytes: 3656
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
#ifdef DEBUG
template<typename T>
class Vec : public vector<T>{
public:
    Vec(){}
    Vec(int n):vector<T>(n){}
    Vec(int n, T a):vector<T>(n,a){}
    T& operator[](long long n){
        if(n < 0 or n >= this->size())throw out_of_range("Vec");
        return this->at(n);
    }
    const T& operator[](long long n)const{
        if(n < 0 or n >= this->size())throw out_of_range("Vec");
        return this->at(n);
    }
};
#define vector Vec
template<typename T>
ostream &operator<<(ostream &os, set<T> st) {
    for(auto x : st) cerr << x << ' ';
    return os;
}
template<typename T, typename S>
ostream &operator<<(ostream &os, map<T, S> mp) {
    for(auto x : mp) cerr << x << ' ';
    return os;
}
#endif
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int>a(n);
    map<int,vector<int>>mp;
    rep(i,n){
        cin >> a[i];
        a[i]--;
    }
    vector<int>s(m+1);
    rep(i,n-1){
        mp[a[i+1]].push_back(i);
        if(a[i] < a[i+1]){
            s[a[i]+1]++;
            s[a[i+1]]--;
        }else if(a[i+1] < a[i]){
            s[a[i]+1]++;
            s[m]--;
            s[0]++;
            s[a[i+1]]--;
        }
    }
    rep(i,m)s[i+1] += s[i];
    ll ans = 0;
    rep(i,n-1){
        ans += min(a[i+1] + 1,(a[i+1]-a[i]+m)%m);
    }
    ll pre = ans;
    show(ans);
    for(int  x = 1; x < m; x++){
        ll temp = pre;
        for(int i : mp[x - 1]){
            temp += (a[i+1] - a[i] + m) % m - 1;
        }
        temp -= s[x - 1];
        ans = min(ans, temp);
        pre = temp;
    }
    cout << ans << endl;
}

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

int main(){
    int n ; cin >> n ;
    int cnt = 0 ;
    for(int i=0;i<n;i++){
        int a ; cin >> a ;
        bool ok = true ;
        if(a==1) ok = false ;
        else if(a>2){
            for(int i=2;i*i<=a;i++) 
            if(a%i==0){
                ok = false ;
                break ;
            }
        }
        if(ok) cnt++ ;
    }
    cout << cnt << endl ;
}


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

int main(){
    int n;
    cin >> n;
    ll pro = 1;
    bool boo = false;
    for(int i=0; i<n; i++){
        ll proo = pro;
        ll a;
        cin >> a;
        if(a == 0){
            cout << 0 << endl;
            return 0;
        }
        if(pro>1000000000000000000/a){
            boo = true;
        }
        pro *= a;
        
    }
    if(boo){
        cout << -1 << endl;
        return 0;
    }
    if(pro > 1000000000000000000){
        cout << -1 << endl;
        return 0;
    }
    cout << pro << endl;
}

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

int main(){
    ll n,a,b,c,d,e;
    scanf("%lld%lld%lld%lld%lld%lld", &n,&a,&b,&c,&d,&e);

    ll minN = min({a,b,c,d,e});

    cout << 5 + (n-1) / minN << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int n, i;
	long int sum = 0;
	scanf("%d", &n);

	for (i = 1;i <= n;i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			sum = sum + i;
		}
	}
	printf("%ld", sum);
	return 0;
}

Measured memory_bytes: 1704
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<ll, ll> pl;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int n;
  cin >> n;
  dump(n/3);
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public void main(Scanner sc) {
        int n = sc.nextInt();
        int pt = 0;
        int px = 0;
        int py = 0;

        boolean flg = true;
        for (int i = 1; i <= n; i++) {
            int t = sc.nextInt();
            int x = sc.nextInt();
            int y = sc.nextInt();

            int dt = t - pt;
            int dl = Math.abs(x - px) + Math.abs(y - py);
            if (dt < dl) {
                flg = false;
                break;
            }

            if (dt % 2 != dl % 2) {
                flg = false;
                break;
            }

            pt = t;
            px = x;
            py = y;
        }

        System.out.println(flg ? "Yes" : "No");
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


Measured memory_bytes: 86284
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#define in(N) cin >> N
#define in2(N,M) in(N) >> M
#define in3(N,M,K) in2(N,M) >> K
#define in4(N,M,K,L) in3(N,M,K) >> L
#define out(ans) cout << ans << endl
#define out2(a,b) cout << a << " " << b << endl
#define out3(a,b,c) cout << a << " " << b << " " << c << endl
#define outf(ans) cout << fixed << setprecision(6) << ans << endl
#define rep(i,n) for(int i=0; i<n; i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	int A,B,C,tmp;
	in3(A,B,C);
	tmp = A; A = B; B = tmp;
	tmp = A; A = C; C = tmp;
	out3(A,B,C);
	return 0;
}

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

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> H(N);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    sort(H.begin(), H.end());
    int ans = H[N - 1] - H[0];
    for (int i = 0; i <= N - K; i++) {
        ans = min(ans, H[i + K - 1] - H[i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>



int main()
{
	int a ,b ;


	while( 1 )
	{
		scanf( "%d %d" ,&a ,&b ) ;


		if( ( a | b ) == 0 )
		{
			return 0 ;
		}


		char c = 'A' ;

		int ans = a + b ;


		for( int i = 1 ; i <= 4 ; ++i )
		{
			scanf( "%d %d" ,&a ,&b ) ;



			if( ans < a + b )
			{
				ans = a + b ;

				c = i + 'A' ;
			}
		}



		printf( "%c %d\n" ,c ,ans ) ;
	}
}

Measured memory_bytes: 2736
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define forn(i,n)for(ll i=0;i<(n);i++)
#define forn_rev(i,n)for(ll i=(n)-1;i>=0;i--)
#define for1n(i,n) for(ll i=1;i<=(n);i++)
#define ARRAY_SIZE(a) sizeof(a)/sizeof(*a)
#define MOD 1000000007
#define MAXN 1000005

using namespace std;




int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    ll T=1;
    //cin>>T;
    while(T--)
    {
        ll N;
        cin>>N;
        ll d=100,t=0;
        while(d<N){
            d+=d/100;
            t++;
        }
        cout<<t;










    }



    return 0;
}

/*


struct data{

    ll count,index;

};

vector<ll> arr(10000);
vector<data> tmax(4*MAXN);



auto combine(data a,data b){
    //ultra based combine function for easier understanding
    data res=0;
    if(a>0) res.count++;
    if(b>0) res.count++
    return res;
}



void build(ll v,ll tl,ll tr)
{
    if(tl==tr)
    {

        tmax[v]=arr[tl];
        //leaf nodes
    }
    else
    {
        //store in array. Thus childs are 2*v and 2*v+1
        ll tm=(tl+tr)/2;//mid point
        build(2*v,tl,tm);//recurse to left sub tree
        build(2*v+1,tm+1,tr);//recurse to right tree
        tmax[v]=combine(tmax[2*v],tmax[2*v+1]);
    }
}

auto getmax(ll v,ll tl,ll tr,ll l,ll r)
{
    if(r<tl || l>tr)
        return -1;//check if outside range
    if(l<=tl && tr<=r)
        return tmax[v];//in range then return that value

    ll tm=(tl+tr)/2;
    //recurse to left and right subtree
    ll left=getmax(2*v,tl,tm,l,r),right=getmax(2*v+1,tm+1,tr,l,r);
    return combine(left,right);
}

ll update(ll v,ll tl,ll tr,ll l,ll tr,ll val){
    if(l>r) return;
    if(l==tl && tr==r){
        if(tmax[v]>=0)
            tmax[v]+=val;//update tree leaves here
        else return -1;

    }
    else{
        ll tm=(tl+tr)/2;
        if(tl>=m)
        ll right=update(2*v+1,tm+1,tr,val);//recurse to right subtree
        if(right==-1) return -1;
        update(2*v,tl,tm,val);//recurse to left subtree

        tmax[v]=combine(tmax[2*v],tmax[2*v+1]);//combine

    }

}
void pointupdate(ll v,ll tl,ll tr,ll pos,ll val){

    if(tl==tr){
        tmax[v]=make_data(val);//update tree leaves here

    }
    else{
        ll tm=(tl+tr)/2;
        if(pos<=tm) update(2*v,tl,tm,val);//recurse to left subtree
        else update(2*v+1,tm+1,tr,val);//recurse to right subtree

        tmax[v]=combine(tmax[2*v],tmax[2*v+1]);//combine

    }

}


*/





Measured memory_bytes: 3608
/*
    Author - Param Kothari
    Ah shit, here we go again
*/
 
/* Ordered Set Implementaton:

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;

typedef tree<
    int,
    null_type,
    less<int>,
    rb_tree_tag,
    tree_order_statistics_node_update>
ordered_set;
*/

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

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair 
 
typedef long long ll;
typedef long double ld;

void solve(){
    int n, x, y;
    cin >> n >> x >> y;
    int a[2003][2003] = {0};
    for(int i = 1; i <= n; i++){
        for(int j = i + 1; j <= n; j++){
            a[i][j] = abs(i - j);
          	a[j][i] = a[i][j];
        }
    }
    for(int i = 1; i <= x; i++){
        for(int j = y; j <= n; j++){
            a[i][j] = abs(i - j) - y + x + 1; 
            a[j][i] = a[i][j];
        }
    }
  	for(int i = 1; i <= x; i++){
    	for(int j = x + 1; j < y; j++){
        	a[i][j] = min(j - i, 1 + x - i + y - j);
          	a[j][i] = a[i][j];
    	}
    }
  	for(int i = x + 1; i < y; i++){
    	for(int j = y; j <= n; j++){
    		a[i][j] = min(j - i, i -x + 1 + j - y);
          	a[j][i] = a[i][j];
        }
    }
    for(int i = x; i <= y; i++){
    	for(int j = i + 1; j <= y; j++){
     		a[i][j] = min(j - i, i - x + 1 + y - j);
          	a[j][i] = a[i][j];
        }
    }
    ll count[2003] = {0};
    for(int i = 1; i <= n; i++){
        for(int j = i + 1; j <= n; j++){
            count[a[i][j]]++;
          	if(a[i][j] == 2){
              //cout << i << " " << j << "\n";
            }
        }
    }
    for(int i = 1; i < n; i++){
        cout << count[i] << "\n";
    }
    return;
}
 
int main(){
    IOS;
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}





void _main() {
        int n; cin >> n;
        if (n % 2 == 0) cout << n;
        else cout << 2 * n;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────────────────

int main() {
	int n; cin >> n;
	vector<vector<ii>> a(n);
	for (int i = 0; i < n; ++i) {
		int num; cin >> num;
		for (int j = 0; j < num; ++j) {
			int p, f; cin >> p >> f;
			a[i].push_back({ p - 1, f + 1 });
		}
	}
	int ans = 0;
	for (int i = 1; i < (1 << n); ++i) {
		map<int, int> check;
		bool flag = true;
		int cnt = 0;
		for (int j = 0; j < n; ++j) {
			if (i & (1 << j)) {
				check[j] = 2;
				cnt++;
			}
			else check[j] = 1;
		}

		for (int j = 0; j < n; ++j) {
			if (i & (1 << j)) {
				for (int k = 0; k < a[j].size(); ++k) {
					if (check[a[j][k].first] == 0) continue;
					if (a[j][k].second != check[a[j][k].first]) flag = false;
				}
			}
		}
		if (flag) ans = max(ans, cnt);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
m,f,r = gets.split.map(&:to_i)

while true
  exit if m == -1 &&  f == -1 &&  r == -1

  if m == -1 ||  f == -1
    puts "F"
  elsif m+f >= 80
    puts "A"
  elsif m+f >= 65 && m+f < 80
    puts "B"
  elsif m+f >= 50 && m+f < 65
    puts "C"
  elsif m+f >= 30 && m+f < 50 && r >= 50
    puts "C"
  elsif m+f >= 30 && m+f < 50
    puts "D"
  elsif m+f < 30
    puts "F"
  end
  m,f,r = gets.split.map(&:to_i)
end


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

int main(){
	int month, day,daynum,k;
	int num[13] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	string youbi[7] = { "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday" };

	while (1){
		daynum = 0;
		cin >> month >> day;
		if (month == 0) break;
		for (int i = 1; i < month; i++){
			daynum += num[i];
		}
		daynum = daynum + day - 1;
		k = daynum % 7;
		cout << youbi[k] << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
from sys import stdin
def main():
  _readline, _range = stdin.readline, range
  h, w = map(int, _readline().split())
  s = [_readline().rstrip() + '#' for _ in _range(h)]
  s.append('#' * w)
  yoko = [[0] * w for _ in _range(h)]
  for i in _range(h):
    start = -1
    si = s[i]
    yokoi = yoko[i]
    for j in _range(w + 1):
      if si[j] == '#':
        if start != -1:
          t = j - start
          for k in _range(start, j):
            yokoi[k] = t
          start = -1
      else:
        if start == -1:
          start = j
  result = 0
  for i in _range(w):
    start = -1
    for j in _range(h + 1):
      if s[j][i] == '#':
        if start != -1:
          t = yoko_max + j - start - 1
          if t > result:
            result = t
          start = -1
      else:
        yji = yoko[j][i]
        if start == -1:
          start = j
          yoko_max = yji
        else:
          if yji > yoko_max:
            yoko_max = yji
  print(result)
main()

Measured memory_bytes: 40820
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vpint> vvpint;
typedef vector<vpll> vvpll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<string>> vvstring;
typedef vector<vector<bool>> vvbool;

typedef vector<vector<vector<ll>>> vvvll;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================





int main() {

	////==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	////==================================
	

	ll N;
	cin >> N;
	vll D(N);
	for (int i = 0; i < N; i++)
	{
		cin >> D[i];
	}
	ll M;
	cin >> M;
	vll T(M);
	for (int i = 0; i < M; i++)
	{
		cin >> T[i];
	}

	sort(D.begin(), D.end());
	sort(T.begin(), T.end());


	int t_i = 0;
	for (int i = 0; i < D.size(); i++)
	{
		if (D[i] == T[t_i])
		{
			t_i++;
		}

		if (t_i == M)
		{
			cout << "YES" << endl;
			return 0;
		}
	}

	cout << "NO" << endl;




}





Measured memory_bytes: 3456
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int students[1001];


int main(void){

    int m, n, t;
    for (; ;) {
        scanf("%d %d", &n, &m);
        if (n == 0 && m == 0) break;
        fill(students, students+n, 0);
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                scanf("%d", &t);
                students[j]+=t;
            }
        }
        sort(students, students+n);
        printf("%d\n", students[n-1]);
    }


    return 0;
}



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

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

int main(){
  long long n,c,d,e,f,g,h;
  cin>>n;
  c=modpow(10, n, 1000000007);
  d=modpow(9, n, 1000000007);
  e=modpow(8, n, 1000000007);
  f=(2*d) % 1000000007;
    if(c<f){
  g=c-f+1000000007;}
  else
  g=c-f;
  g=g % 1000000007;
  h=(g+e) % 1000000007;
  cout<<h<<endl;
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
   int n;
   cin>>n;
   if(n%10==3)cout<<"bon"<<endl;
   else if(n%10==0||n%10==1||n%10==6||n%10==8)cout<<"pon"<<endl;
   else cout<<"hon"<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
using ll = long long;

int main(){
	ll array[100001];
	for(ll i=0;i<100001;i++){
		array[i] = i*i;
	}
	ll n;
	cin >> n;
	for(int i=100000;i>=0;i--){
		if(n >= array[i]){
			cout << array[i] << endl;
			return 0;
		}
	}
	
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 
#define PI 3.141592653589793238

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;
typedef gp_hash_table<long int,long int> HashTable;

int main(){
   IOS;
 /*    #ifndef ONLINE_JUDGE
         freopen("in.txt",  "r",  stdin);
         freopen("out.txt", "w", stdout);
     #endif */
   
   long int n,m;
   cin>>n>>m;

   vector<long int> v(n);
   for(long int i = 0; i < n; i++)
      cin>>v[i];

   sort(v.rbegin(),v.rend());

   long int item = v[m - 1];
   long int val = 4*m;
   long int sum = accumulate(v.begin(),v.end(),0LL);
   long int desired = (sum + val - 1) / val;

   if(item < desired)
    cout<<"No";
  else
    cout<<"Yes";
   return 0;
}

Measured memory_bytes: 3660
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

auto prime_factorize(Int n) {
    vector<pair<Int, Int>> ret;

    for (Int i = 2; i * i <= n; i++) {
        if (n % i != 0) {
            continue;
        }

        Int count = 0;
        while (n % i == 0) {
            count++;
            n /= i;
        }
        ret.push_back({i, count});
    }

    if (n != 1) {
        ret.push_back({n, 1});
    }

    return ret;
}

Int Gcd(Int a, Int b) {
    if (b == 0) {
        return a;
    } else {
        return Gcd(b, a % b);
    }
}

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

    Int g = Gcd(a, b);
    auto gp = prime_factorize(g);
    cout << gp.size() + 1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main(){
    char s[4];
    scanf("%s", s);
    if(s[0] != s[1] || s[1] != s[2] || s[0] != s[2]){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define Decimal fixed << setprecision(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}
constexpr int INF = 1 << 30 - 1;
constexpr long long LLINF = 1LL << 60;
constexpr long long MOD = 1000000007;

typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  int A, B, T;
  cin >> A >> B >> T;
  cout << (T / A) * B << endl;
  return 0;
}


Measured memory_bytes: 256
#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>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
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++)
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

char d[6][3][3];
int c[6][3][3];
void solve() {
	while (true) {
		rep(i, 6) {
			rep(j, 3) {
				rep(k, 3) {
					cin >> d[i][j][k];
					if (d[i][j][k] == '#')return;
					if (d[i][j][k] == '*')c[i][j][k] = 1;
					else c[i][j][k] = 0;
				}
			}
		}
		int ans = mod;
		if (c[0][2][0] + c[0][2][1] + c[0][2][2] && c[2][2][0] + c[2][2][1] + c[2][2][2]) {
			ans = 0;
		}
		if (c[0][0][0] + c[0][1][0] + c[0][2][0] && c[2][0][2] + c[2][1][2] + c[2][2][2]) {
			ans = min(ans, 1);
		}
		if (c[0][0][2] + c[0][1][2] + c[0][2][2] && c[2][0][0] + c[2][1][0] + c[2][2][0]) {
			ans = min(ans, 1);
		}
		if (c[0][0][0] + c[0][0][1] + c[0][0][2] && c[2][0][0] + c[2][0][1] + c[2][0][2]) {
			ans = min(ans, 2);
		}
		if (c[1][2][0] + c[1][2][1] + c[1][2][2] && c[3][2][0] + c[3][2][1] + c[3][2][2]) {
			ans = min(ans, 3);
		}
		if (c[1][2][0] + c[1][1][0] + c[1][0][0] && c[3][0][2] + c[3][1][2] + c[3][2][2]) {
			ans = min(ans, 2);
		}
		if (c[1][0][2] + c[1][1][2] + c[1][2][2] && c[3][0][0] + c[3][1][0] + c[3][2][0]) {
			ans = min(ans, 2);
		}
		if (c[1][0][0] + c[1][0][1] + c[1][0][2] && c[3][0][0] + c[3][0][1] + c[3][0][2]) {
			ans = min(ans, 3);
		}
		if (c[4][2][0] + c[4][2][1] + c[4][2][2] && c[5][0][0] + c[5][0][1] + c[5][0][2]) {
			ans = min(ans, 1);
		}
		if (c[4][0][0] + c[4][0][1] + c[4][0][2] && c[5][2][0] + c[5][2][1] + c[5][2][2]) {
			ans = min(ans, 1);
		}
		if (c[4][0][0] + c[4][1][0] + c[4][2][0] && c[5][0][0] + c[5][1][0] + c[5][2][0]) {
			ans = min(ans, 2);
		}
		if (c[4][0][2] + c[4][1][2] + c[4][2][2] && c[5][0][2] + c[5][1][2] + c[5][2][2]) {
			ans = min(ans, 2);
		}
		cout << ans << endl;
	}

}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 3020
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

bool check(LL a, LL b, LL c){
    if(a%2==1 || b%2==1 || c%2==1){
        return true;
    }
    return false;
}

void Main()
{
    LL a,b,c;cin>>a>>b>>c;

    if(check(a,b,c)){
        cout<<0<<endl;
        return;
    }

    if(a==b && b==c && c==a){
        cout<<-1<<endl;
        return;
    }

    int result = 0;
    while(!check(a,b,c)){

        if(a==b && b==c && c==a){
            cout<<-1<<endl;
            return;
        }

        LL new_a = b/2 + c/2;
        LL new_b = a/2 + c/2;
        LL new_c = a/2 + b/2;
        a = new_a;
        b = new_b;
        c = new_c;
        result++;
    }
    cout<<result<<endl;

	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 256