akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

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

	LL A,B,C;
	cin >> A >> B >> C;
	if(A%2==1 && B%2==1 && C%2==1){
		cout << min({A*B,B*C,C*A}) << endl;
	}
	else cout << 0 << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    int d;
    d=a*b;
    if(d%2!=0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
/*
17/10/2017
*/
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int sol[5000]={};
ll rec(int n)
{
if(sol[n]!=0)
{
return sol[n];
}
//cout<<n<<endl;
if(n==0)
{
return sol[n]=1;
}
if(n<3)
{
return sol[n]=0;
}
int g=0;
for(int i=3;i<=n;i++)
{
int h=sol[n-i];
if(sol[n-i]==0)
{
h=rec(n-i);
sol[n-i]=h;
}
g=(g+h)%mod;
}
return sol[n]=g;
}
int main()
{
int n;
cin>>n;
//int dp[n+1];
//dp[0]=0;
//dp[1]=0;
//dp[2]=0;
//dp[3]=1;
//for(int i=4;i<=n;i++)
//{
//dp[i]=0;
//for(int j=3;i-j>=3;j++)
//{
//dp[i]+=dp[i-j];
//}
//}

cout<<rec(n);
}

Measured memory_bytes: 3636
sa = list(input())
sb = list(input())
sc = list(input())
s = [sa, sb, sc]
turn = 0

while True:
    if s[turn] != []:
        ch = s[turn].pop(0)
        if ch == "a":
            turn = 0
        elif ch == "b":
            turn = 1
        else:
            turn = 2
    else:
        break

if turn == 0:
    print("A")
elif turn == 1:
    print("B")
else:
    print("C")

Measured memory_bytes: 3064
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  int a,p; cin >> a >> p;
  cout << (a*3+p)/2 << endl;
  return 0;
}


Measured memory_bytes: 764
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"s=input()\n"
"n=len(s)\n"
"for i in range(n-1):\n"
"  if s[i]==s[i+1]:\n"
"    print(i+1,i+2)\n"
"    break\n"
"  elif i<n-2 and s[i]==s[i+2]:\n"
"    print(i+1,i+3)\n"
"    break\n"
"else:\n"
"  print(-1,-1)\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 6980
// Seek knowledge from the Cradle to the Grave !!
// https://www.linkedin.com/in/syed-mujtaba

#include <bits/stdc++.h>
using namespace std;
#define int             long long
#define ld              long double
#define ll              long long
#define pb              push_back
#define fi              first
#define se              second
#define MAXN            200064
#define mod             1000000009 // 998244353 // 1e9 + 7
#define MAX             8000000000000000064LL
#define MIN            -8000000000000000064LL
#define mt              make_tuple
#define eps             1e-6
#define endl            '\n'
#define test            int T_T; cin>>T_T; while(T_T--)
#define fast_io         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

void solve()
{

}


signed main()
{
	fast_io
	// test
	{
		string s;
		cin >> s;
		for(auto z : s)
		{
			if(z == '?')
				cout << "D";
			else cout << z;
		}
		cout << endl;
	}	
}

Measured memory_bytes: 3784
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<Pll> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define SORT(x) sort(all(x))
#define RSORT(x) sort(all(x),greater<ll>())
#define vec_max(V) *max_element(all(V))
#define vec_min(V) *min_element(all(V))
#define vec_sum(V) accumulate(all(V), 0LL)
#define print(X) cout << (X) << "\n"
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
static const int INF = 1e+9+7;

int main(){
  ll N;
  cin >> N;
  map<str,vll> mp;
  set<str> st;
  map<ll,ll> num;
  vll vec;

  rep(i,0,N){
    str s;
    ll n;
    cin >> s;
    cin >> n;
    mp[s].pb(n);
    st.insert(s);
    vec.pb(n);
  }

for(auto itr = st.begin(); itr != st.end(); ++itr) {
    RSORT(mp[*itr]);
    rep(i,0,sz(mp[*itr])){
      rep(j,0,N){
        if(mp[*itr][i] == vec[j]) print(j+1);
      }
    }
    }

  

  

 return 0;
}


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

class Dice{
public:
    int s[6];
    Dice(){}
    void move(char ch){
        int t;
        if(ch=='W'){
            t=s[0];s[0]=s[2];s[2]=s[5];s[5]=s[3];s[3]=t;
        }if(ch=='S'){
            t=s[0];s[0]=s[4];s[4]=s[5];s[5]=s[1];s[1]=t;
        }if(ch=='E'){
            t=s[0];s[0]=s[3];s[3]=s[5];s[5]=s[2];s[2]=t;
        }if(ch=='N'){
            t=s[0];s[0]=s[1];s[1]=s[5];s[5]=s[4];s[4]=t;
        }
    }
};


int main() {
    Dice cube;
    string go;
    for(int i=0;i<6;i++){
        cin>>cube.s[i];
    }
    cin>>go;
    for(int i=0;i<go.size();i++){
        cube.move(go[i]);
    }
    cout<<cube.s[0]<<endl;
}



Measured memory_bytes: 3212
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ll N;
	cin >> N;
	VLL P, Q;
	P.resize(N);
	for (ll n = 0; n < N; n++)cin >> P[n];
	Q.resize(N);
	for (ll n = 0; n < N; n++)cin >> Q[n];
	ll a, b;
	VLL V(N, 0);
	for (ll n = 0; n < N; n++)V[n] = n + 1;
	ll t = 0;
	do {
		if (P == V)a = t;
		if (Q == V)b = t;
		t++;
	} while (next_permutation(V.begin(), V.end()));
	cout << (ll)abs(b - a) << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int n,m,i,j,a[15];
string st;
char s[15];
bool check(int x)
{
	sprintf(s,"%d",x);
	st=s;
	for (i=1;i<=m;i++)
	{
		if ((int)st.find(a[i]+'0')!=-1)
		{
			return 0;
		}
	}
	return 1;
}
int main()
{
	cin>>n>>m;
	for (i=1;i<=m;i++) cin>>a[i];
	while (!check(n)) 
		n++;
	cout<<n;
	return 0;
}


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

int main(){
    
        string s;
        cin>>s;
        int ans=0;
        int maxx=0;
        for(int i=0;s[i];++i){
            int count=0;
            if(s[i]=='R'){
                for(int j=i;j<s[j];++j){
                    if(s[j]=='R')count++;
                    else break;
                }
                maxx = max(maxx,count);
            }
        }
        cout<<maxx;









    
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define MOD 1000000007
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

int main() {
	int n;
	scanf("%d", &n);
	vector<int> hum(n);
	REP(i,n){
		scanf("%d", &hum[i]);
	}
	int wal = 0;
	ll cou = 0;
	REP(i, n) {
		if ((hum[i] - wal) <= 1) {
			wal =  max(wal,hum[i]);
		}
		else {
			cou += (ll)(hum[i]-1) / (wal + 1);
			wal = max(wal, 1);
		}
	}
	printf("%lld\n", cou);
	return 0;
}

Measured memory_bytes: 768
H, W = map(int, raw_input().split())
A = list()
for _ in range(H):
    A.append(list(raw_input()))

B = list()
for h in range(H):
    B.append(list())
    for w in range(W):
        B[h].append('.')

i = 0
j = 0
ret = "Impossible"
while True:
    B[i][j] = '#'
    # down and right
    if i+1 < H and j+1 < W:
        if A[i][j+1] == "#" and A[i+1][j] == ".":
            # right
            j += 1
        elif A[i][j+1] == "." and A[i+1][j] == "#":
            # down
            i += 1
        else:
            break
    # right only
    elif i+1 == H and j+1 < W:
        if A[i][j+1] == "#":
            # right
            j += 1
        else:
            break
    # down only
    elif i+1 < H and j+1 == W:
        if A[i+1][j] == "#":
            # down
            i += 1
        else:
            break
    elif i+1 == H and j+1 == W:
        if A == B:
            ret = "Possible"
        break
print ret

Measured memory_bytes: 2696
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000
#define F first
#define S second
#define forn(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)

using namespace std;


int main(){
	int n,t;
	scanf("%d %d", &n, &t);
	ll sum = 0;
	ll beg = 0;
	ll end = 0;
	rep(i,n){
		int ti;
		scanf("%d", &ti);
		if(ti <= end) end = ti+t;
		else{
			sum += end-beg;
			beg = ti;
			end = ti+t;
		}
	}
	sum += end-beg;
	printf("%lld\n", sum);
	return 0;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,m;

    cin >> n >> m;
    vector<vector<bool>> sw(m,vector<bool>(n,false));
    rep(i,m){
      int x;
      cin >> x;
      rep(j,x){
        int y;
        cin >> y;
        sw[i][y-1] = true;
      }
    }
    VI p(n);
    rep(i,m){
      cin >> p[i];
    }
    ll ans = 0;
    rep(i,1<<n){
      bool flag = true;
      rep(j,m){
        int cnt = 0;
        rep(k,n){
          if(sw[j][k] && !!(i&(1<<k))){
            cnt++;
          }
        }
        if(cnt % 2 == p[j]) continue;
        else flag = false;
      }
      if(flag) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int N; cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++) cin >> a[i];
  int next=1;
  int i = 0;
  while(next != 2){
    if(i == N-1){
      cout << -1 << endl;
      return 0;
    }
    next = a[next-1];
    i += 1;
  }
  cout << i << endl;
  return 0;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 11

int main()
{
    for(int i = 0; i < 5; i++){
        int n; cin >> n;
        if(n == 0) cout << (i + 1) << endl;
    }
}

Measured memory_bytes: 3636
using System;
using System.Collections.Generic;

namespace JudgeStatusSummary
{
    internal class JudgeStatusSummary
    {
        private static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine() ?? throw new InvalidOperationException());
            var s = new string[n];

            var dict = new Dictionary<string, int> {{"AC", 0}, {"WA", 0}, {"TLE", 0}, {"RE", 0}};

            for (var i = 0; i < n; i++)
            {
                s[i] = Console.ReadLine();
                dict[s[i]]++;
            }

            Console.WriteLine("AC x " + dict["AC"]);
            Console.WriteLine("WA x " + dict["WA"]);
            Console.WriteLine("TLE x " + dict["TLE"]);
            Console.WriteLine("RE x " + dict["RE"]);
        }
    }
}

Measured memory_bytes: 31528
#include<cstdio>
int main()
{
	char a,b;
	scanf("%c %c",&a,&b);
	if(a=='H'){
		if(b=='H') printf("H\n");
		else printf("D\n");
	}
	if(a=='D'){
		if(b=='H') printf("D\n");
		else printf("H\n");
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

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

    int x,y;
    cin>>x>>y;
    if(y%2==1)
        cout<<"No",exit(0);
    y/=2;
    if(x<=y&&y<=2*x)
        cout<<"Yes";
    else
        cout<<"No";
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int x[n];
  for(int i=0;i<n;i++) scanf("%lld",x+i);
  set<int> s,u;
  for(int i=0;i<n;i++){
    if(s.count(0)){
      cout<<"No"<<endl;
      continue;
    }
    int k=x[i],c=0;
    while(s.count(k)&&!u.count(k)) k--,c++;
    if(u.count(k)){
      if((int)s.size()==(int)u.size()+c-1){
	s.insert(0);
	puts("Yes");
      }else{
	puts("No");
	for(int j=k;j<=x[i];j++) u.insert(j);
      }
      continue;
    }
    if(k==0){
      if((int)s.size()==c){
	s.insert(0);
	puts("Yes");
      }else{
	puts("No");
	for(int j=k;j<=x[i];j++) u.insert(j);
      }
      continue;
    }
    s.insert(k);
    puts("Yes");
    for(int j=x[i];j>k;j--) s.erase(j);
  }
  return 0;
}

Measured memory_bytes: 30488
n = int(input())
a = [int(i) for i in input().split(" ")]
ma = max(a)
b = [0 for i in range(ma)]
for i in a:
    b[i-1] += 1
c = [i*(i-1)//2 for i in b]
s = sum(c)
for i in a:
    if c[i-1] != 0:
        print(s-(b[i-1]-1))
    else:
        print(s)


Measured memory_bytes: 26140
#include <iostream>
#include <vector>
#include <unordered_map>
#include <cmath>
#include <stdlib.h>
#include <queue>
#include <set>
#include <algorithm>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
  ll n;
  cin >> n;
  string s;
  cin >> s;

  ll cnt = 0;
  for (auto i = 0; i < n - 2; i++)
  {
    if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
    {
      cnt++;
    }
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <list>
#include <string>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip> // setprecisionを使用するのに必要 cout << fixed << setprecision(15) << p でpを小数点以下15桁表示
using namespace std;
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)
typedef long long ll;
#define fin(ans) cout << (ans) << '\n'
/*

*/
int main()
{
    ll A,B,C,K;
    cin >> A >> B >> C >> K;
    ll ans;
    if(0 < K && K <= A){
        ans = K;
        fin(ans);
        return 0;
    }else if(A < K){
        ans = A;
        K -= A;
    }
    K -= B;
    if(0 < K && K <= C){
        ans -= K;
        fin(ans);
    }else{
        fin(ans);
    }
    return 0;
}

Measured memory_bytes: 3188
def directions(n, s):
    left = []
    right = []

    change = 0
    for p in s:
        if p == 'W':
            change += 1
        left.append(change)

    change = 0
    for p in s[::-1]:
        if p == 'E':
            change += 1
        right.append(change)
    right.reverse()

    return min(map(lambda x, y: x + y - 1, left, right))



if __name__ == '__main__':
    n = int(input())
    s = input()
    print(directions(n, s))

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

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	if(a==5&&b==5&&c==7||a==5&&b==7&&c==5||a==7&&b==5&&c==5){
		cout<<"YES"<<endl;
	}else {
		cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#ifdef debug
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

#define vec vector
#define ALL(x) (x).begin(), (x).end()

typedef unsigned int ui;
typedef long long ll;
typedef long double ld;
typedef pair< int, int > pii;
typedef pair< long long, long long > pll;

const int inf = 1e9;
const ll inf64 = 1e18;

int main() {

#ifdef debug
    freopen("input.txt", "r", stdin);
#endif

    int L = 100;

    int n, m;

    cin >> n >> m;

    vec< string > res(L, string(L, '#'));

    for(int i = L / 2;i < L;i++) {
        res[i] = string(L, '.');
    }

    n--;
    m--;

    for(int i = 0;i + 1 < L / 2;i += 2) {
        for(int j = 0;j < L;j += 2) {
            if(n > 0) {
                res[i][j] = '.';
                n--;
            }
        }
    }

    for(int i = L / 2 + 2;i < L;i += 2) {
        for(int j = 0;j < L;j += 2) {
            if(m > 0) {
                res[i][j] = '#';
                m--;
            }
        }
    }
    
    cout << L << " " << L << "\n";

    for(auto i : res) {
        cout << i << "\n";
    }

    return 0;
}


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

int main()
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if(a + b >= c) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
N=int(input())
s=[]
for i in range(N):
    s.append(input())
t=[]
M=int(input())
for i in range(M):
    t.append(input())

dct={}
for strings in s:
    dct.setdefault(strings,0)
    dct[strings]+=1
    
for strings in t:
    if strings in dct:
        dct[strings]-=1

if max(dct.values())>=1:
    print(max(dct.values()))
else:
    print("0")
    

Measured memory_bytes: 3064
N = input()
if N[-1] == "2" or N[-1] == "4" or N[-1] == "5" or N[-1] == "7" or N[-1] == "9":
    print('hon')
elif N[-1] == "0" or N[-1] == "1" or N[-1] == "6" or N[-1] == "8":
    print('pon')
elif N[-1] == '3':
    print('bon')

Measured memory_bytes: 9068
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int Max =-301;
        int Math = 0;
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        Math = A + B;
        Max = Math;
        Math = A - B;
        	if(Math > Max)
        		Max = Math;
        Math = A * B;
        	if(Math > Max)
        		Max = Math;
        System.out.println(Max);
        sc.close();
    }
}

Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  vector<int> a(n,0);
  vector<int> b(n,0);
  rep(i,n){
    cin >> a[i];
  }
  rep(i,n){
    cin >> b[i];
  }
  if(a==b){
    cout << 0 << endl;
    return 0;
  }
  int ans=0;
  int q=0;
  int re=0;
  while(1){
    if(a[q]<b[q])break;
    if(a[q]>b[q]){
      re=1;
      break;
    }
    q++;
  }
  if(re==0){
    while(a!=b){
      ans++;
      next_permutation(a.begin(),a.end());
    }
  }
  else{
    while(a!=b){
      ans++;
      next_permutation(b.begin(),b.end());
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

D, T, S = getNM()
if D <= T * S:
    print('Yes')
else:
    print('No')

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

using namespace std;

using ll = long long;

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

    int n, k, x, ans = 0;
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> x;
        ans += 2 * min(k - x, x);
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
    int a;
    string day;
    cin >> day;
    if(day == "SAT"){
        a = 1;
    }else if(day == "SUN"){
        a = 7;
    }else if(day == "MON"){
        a = 6;
    }else if(day == "TUE"){
        a = 5;
    }else if(day == "WED"){
        a = 4;
    }else if(day == "THU"){
        a = 3;
    }else if(day == "FRI"){
        a = 2;
    }
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
int main(){
	string s;
	cin>>s;
	bool h=true;
	if(s[0]!='A')h=false;
	int co=0;
	int n=s.size();
	loop(i,2,n-1)if(s[i]=='C')co++;
	if(co-1)h=false;
	rep(i,n)if(s[i]=='C'||s[i]=='A');
	else if(isupper(s[i]))h=false;
	if(h)cout<<"AC"<<endl;
	else cout<<"WA"<<endl;
}







Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
#if DEBUG
            ReadLine();
#endif
        }

        void Solve(ConsoleInput cin)
        {
            long n = cin.ReadLong;

            Console.WriteLine(n * (n - 1) / 2);
        }
    }

    class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;

        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 11220
n,m=map(int,input().split())
As=[input() for _ in range(n)]
Bs=[input() for _ in range(m)]

flag=False
for i in range(n-m+1):
  for j in range(n-m+1):
    if [a[j:j+m] for a in As[i:i+m]]==Bs:
      flag=True

if flag:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using namespace std;
int main(){
    long long n,a[200001];
    cin >> n;
    rep(i,n){
        cin >> a[i];
    }
    
    sort(a,a+n);
    rep(i,n-1){
        if(a[i] == a[i+1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 1792
MOD = 10 ** 9 + 7
n, a, b = map(int, input().split())

all = pow(2, n, MOD) - 1


def comb(n, k):
    nCk = 1
    MOD = 10 ** 9 + 7

    for i in range(n - k + 1, n + 1):
        nCk *= i
        nCk %= MOD

    for i in range(1, k + 1):
        nCk *= pow(i, MOD - 2, MOD)
        nCk %= MOD
    return nCk


A = comb(n, a)
B = comb(n, b)
print((all - A - B)%MOD)

Measured memory_bytes: 3064
n,k=gets.split(" ").map(&:to_i)
p = gets.split(" ").map(&:to_i)

ev = Array.new(n)
evbefore = Array.new(n)
evbefore[0]=p[0]
=begin
for i in 1..n-1
  evbefore[i]=evbefore[i-1]+p[i]
  puts evbefore[i]
end
=end
for i in 0..n-1
  ev[i]=(p[i]*(1.0+p[i]))/(2.0*p[i])
end

#puts ev

max=0
for i in 0..k-1
  max+=ev[i]
end
total = Array.new(n)
total[0]=max
for i in 0..n-k-1
  total[i+1]=total[i]-ev[i]+ev[i+k]
  if max<total[i+1]
    max=total[i+1]
  end
  #puts total[i+1]
  #puts max
end

puts max


Measured memory_bytes: 19596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


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

	string s;
	cin >> s;
	if(s=="ABC")cout << "ARC" << endl;
	else cout << "ABC" << endl;
    return 0;
}


Measured memory_bytes: 3612
n, k = map(int,input().split())
s = input() + '1'
l = []

i = 0
d = []
while i <= n:
    if s[i] == '0':
        d.append(i)

    else:
        if d != []:
            l.append(d)
            d = []
    i += 1

#print(l)

m = 0
nl = len(l)

for i in range(max(nl - k + 1, 1)):
    start = l[i - 1][-1] + 1 if i != 0 else 0
    goal = l[min(i + k, nl - 1)][0] - 1 if not i + k > nl - 1 else n - 1
    #print(start, goal)
    m = max(m, goal - start + 1)

print(m)


Measured memory_bytes: 10484
//https://atcoder.jp/contests/abc150/tasks/abc150_a
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
    ll K,X; cin>>K>>X;
    bool ans = K*500 >= X;
    cout<<(ans?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define MOD 1000000007


void solve()
{
  int H,W,K;
  cin>>H>>W>>K;
  vector<vector<char> > data (H,vector<char>(W,0));

  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      cin>>data[i][j];
    }
    
  }

  vector<vector<int> > cut(H,vector<int>(W,0));

  int total_count = 1;
  int L,R,U,B;
  for (int i = 0; i < H; i++)
  {
    int col_count = 0;
    int painted = 0;
    for (int j = 0; j < W; j++)
    {
      if(data[i][j] == '#')
      {
        for (int k = painted; k < W ; k++)
        {
          if((data[i][k] == '#')&&(k>j)) break;
          cut[i][k] = total_count;
          painted = k;
        }
        painted++;
        total_count++;
      }
    }
  }

  for (int i = 1; i < H; i++)
  {
    int sum = 0;
    for (int j = 0; j < W; j++)
    {
      sum += cut[i][j];
    }
    if(sum == 0)
    {
      for (int j = 0; j < W; j++)
      {
        cut[i][j] = cut[i-1][j];
      }
    }
  }

    for (int i = H - 1; i >= 0; i--)
  {
    int sum = 0;
    for (int j = 0; j < W; j++)
    {
      sum += cut[i][j];
    }
    if(sum == 0)
    {
      for (int j = 0; j < W; j++)
      {
        cut[i][j] = cut[i+1][j];
      }
    }
  }

  

  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      cout<<cut[i][j]<<" ";
    }
    cout<<endl; 
  }


}
 
int32_t main(int32_t argc, const char *argv[])
{
 
  solve();
 
  return 0;
}

Measured memory_bytes: 1536
// ABC 100 C: *3 or /2
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    int size; std::cin >> size;
    std::vector<int> sequence(size);
    for (int i=0; i<size; i++) {
        std::cin >> sequence.at(i);
    }

    int counter = 0;
    for (int i=0; i<sequence.size(); i++) {
        int num = sequence.at(i);
        while (true) {
            if (num % 2 != 0) {
                break;
            }
            num /= 2;
            counter++;
        }
    }

    std::cout << counter << "\n";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  cin >> n;

  int i = 0;

  for(i; i <= n; i++){
    if((int)(i * 1.08) == n){
      break;
    }
  }

  if(i == n + 1){
    cout << ":(" << endl;
  }
  else{
    cout << i << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n, m;
const int maxN = 305;
bool used[maxN];
int a[maxN][maxN];
int cnt[maxN];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> a[i][j];
        }
    }
    int best = n + 1;
    for (int it = 0; it < m; it++) {
        memset(cnt, 0, sizeof cnt);
        for (int i = 1; i <= n; i++) {
            for (int p = 1; p <= m; p++) {
                if (!used[a[i][p]]) {
                    cnt[a[i][p]]++;
                    break;
                }
            }
        }
        pair < int, int > mx = make_pair(-1, -1);
        for (int p = 1; p <= m; p++) {
            if (!used[p]) {
                mx = max(mx, {cnt[p], p});
            }
        }
        used[mx.second] = true;
        best = min(best, mx.first);
    }
    cout << best;
    return 0;
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

ll dp[101][100010];
ll w[101], v[101];

int main() {
    ll N, W;
    cin >> N >> W;
    rep(i, N) cin >> w[i] >> v[i];

    fill(dp[0], dp[101], 1e13);
    dp[0][0] = 0;
    for (int i=0; i<N; ++i) {
        for (int j=0; j<=100001; ++j) {
            if (j >= v[i]) {
                dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]] + w[i]);
            }
            else {
                dp[i+1][j] = dp[i][j];
            }
        }
    }

    int ans = 0;
    rep(i, N+1) rep(j, 100010) {
        if (dp[i][j] <= W) ans = max(ans, j);
    }

    cout << ans << endl;
    return 0;
}


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

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

  if (a == b && b == c) {
    cout << 1 << endl;
  } else if (a == b || b == c || a == c) {
    cout << 2 << endl;
  } else {
    cout << 3 << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;
class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   long ans = 0;
   for(int i=1; i<=N; i++){
     if(i%3==0 || i%5==0){
     }else{
     ans += i;
     }
   }
   System.out.print(ans);
 }
}


Measured memory_bytes: 35840
n = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]
A, B = map(int, input().split())
idxa = n.index(A)
idxb = n.index(B)

if idxa > idxb:
  print('Alice')
elif idxa == idxb:
  print('Draw')
else:
  print('Bob')

Measured memory_bytes: 3060
n, k = map(int, input().split())
xy = [list(map(int, input().split())) for i in range(n)]
xset = list(set([i[0] for i in xy]))
yset = list(set([i[1] for i in xy]))
xset.sort()
yset.sort()

W = len(xset)
H = len(yset)
ans = float('inf')
for ix in range(W):
    for jx in range(ix, W):
        for iy in range(H):
            for jy in range(iy, H):
                xmin = min(xset[ix], xset[jx])
                xmax = max(xset[ix], xset[jx])
                ymin = min(yset[iy], yset[jy])
                ymax = max(yset[iy], yset[jy])
                cnt = 0
                for x, y in xy:
                    if xmin<=x<=xmax and ymin<=y<=ymax:
                        cnt+=1
                if cnt>=k:
                    ans = min(ans, (xmax-xmin)*(ymax-ymin))
print(ans)


Measured memory_bytes: 74928
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <set>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define lamsort(v,p) sort(v.begin(),v.end(),[](p a, p b){return a.num < b.num;});
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define INF 1e8
typedef long long ll;
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s; cin >> s;
    int k; cin >> k;
    vector<int> v;
    int cnt = 1;
    REP(i,1,s.size()) {
        if(s[i]==s[i-1]) cnt++;
        else {
            v.push_back(cnt);
            cnt = 1;
        }
    }
    if(cnt) v.push_back(cnt);

    ll ans = 0;
    if((int)v.size()==1) {
        int a = v[0]/2;
        if(v[0]%2!=0){
            if(k%2==0) {
                ans += (ll)(k/2)*a;
                ans += (ll)(k/2)*(a+1);
            }
            else {
                ans += (ll)(k/2+1)*a;
                ans += (ll)(k/2)*(a+1);
            }
        }
        else ans = (ll)a*k;
    }
    else if(s[0]!=s[s.size()-1]) {
        rep(i,v.size()) {
            ans += v[i]/2;
        }
        ans = (ll)ans*k;
    }
    else {
        rep(i,v.size()) {
            ans += v[i]/2;
        }
        if(v[0]%2!=0 && v[v.size()-1]%2!=0) {
            ans++;
        }
        ans = (ll)ans*k;
        if(v[0]%2!=0 && v[v.size()-1]%2!=0) ans--;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using P=pair<int,int>;
using lint=long long;
using ll=long long;
const lint inf=1e18+7;
const int MOD=1000000007;
long long myPow(int x,int n,int rest){
    int res=1;
    int cur=x;
    while(n>0){
        if(n&1){
            res*=cur;
            res%=rest;
        }
        n/=2;cur*=cur;
        cur%=rest;
    }
    return res;
}
signed main(){
  int k;cin>>k;
  int res=1;
  int rest=0;
  if(k%2==0||k%5==0){
    cout<<-1<<"\n";
    return 0;
  }
  int cur=7;
  while(cur<k){
    cur*=10;
    cur+=7;++res;
  }
  rest=cur%k;
  while(rest!=0){
    int add=myPow(10,res,k)*7%k;
    ++res;
    rest+=add;rest%=k;
  }
  cout<<res<<"\n";
  return 0;
}


Measured memory_bytes: 3624
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int res = N / 2;
            out.println(N % 2 == 0 ? res : res + 1);
        }
    }
}

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

int main(){
    ll N,H,W,ans;
    cin >> N >> H >> W;
    ans = 0;
    ll A[N],B[N];
    for(int i=0;i<N;i++)
        cin >> A[i] >> B[i];
    for(int i=0;i<N;i++)
        if(H <= A[i] && W <= B[i])
            ans++;
    cout << ans << "\n";
    return 0;
}








Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }

int main() {
  int n, m; cin>>n>>m;
  long long ans = 0;
  vector<tuple<long long, long long, long long>> xyz;
  rep(i, n) {
    long long x, y, z; cin>>x>>y>>z;
    xyz.emplace_back(x, y, z);
  }
  rep(i, 2) rep(j, 2) rep(k, 2) {
    vector<long long> t(n);
    rep(l, n) {
      long long a, b, c;
      tie(a, b, c) = xyz[l];
      if (i==1) a = -a;
      if (j==1) b = -b;
      if (k==1) c = -c;
      t[l] = a+b+c;
    }
    sort(t.begin(), t.end(), greater<long long>());
    long long sum = 0;
    rep(l, m) sum += t[l];
    ans = max(ans, sum);
  }
  print(ans);

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

int main(void){
    ll N;
    ll d[MAX_N];
    ll answer;

    cin >> N;
    rep(i, N) cin >> d[i];

    sort(d, d + N);

    answer = d[N / 2] - d[N / 2 - 1];

    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include<bits/stdc++.h>
#include<unordered_map>
#include<vector>
#define ll long long
using namespace std;
int main(){
   ll n;
   cin>>n;
   unordered_map<string,ll>mp;
   for(ll i=0;i<n;i++)
   {
       string str;
       cin>>str;
       mp[str]++;
   }
   cout<<"AC"<<" "<<'x'<<" "<<mp["AC"]<<endl;
    cout<<"WA"<<" "<<'x'<<" "<<mp["WA"]<<endl;
    cout<<"TLE"<<" "<<'x'<<" "<<mp["TLE"]<<endl;
     cout<<"RE"<<" "<<'x'<<" "<<mp["RE"]<<endl;
   
   
   return 0;
    
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define __ <<' '<<
#define ___ <<' '
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define int long long

struct IoSetup {IoSetup() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout <<fixed<<setprecision(12);
    cerr <<fixed<<setprecision(12);
}}IoSetup;

using ll = long long;
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int SMOD = 1000000007;
constexpr int NMOD = 998244353;
constexpr int dx[]={1,0,-1,0,1,1,-1,-1};
constexpr int dy[]={0,1,0,-1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a<b?a=b,true:false);}
template<class T>bool chmin(T &a, const T &b){return(a>b?a=b,true:false);}
inline int qp(int a,ll b,int mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int a[200200];

signed main() {

    int n;
    cin >> n;
    vector<int> p;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        p.bash(a[i] + i);
    }

    sort(ALL(p));
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        ans += upper_bound(ALL(p), i - a[i]) - lower_bound(ALL(p), i - a[i]);
    }
    
    cout << ans  << endl;

  
    return 0;
}



Measured memory_bytes: 6604
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
mod = 998244353
if a[0] != 0:
  print(0)
  exit()
ans = 1
c = Counter(a)
cls = list(c.items())
cls.sort()
if cls[0][1] != 1:
  print(0)
  exit()
for i in range(1,len(cls)):
  if cls[i][0] != i:
    print(0)
    exit()
  ans = ans*cls[i-1][1]**cls[i][1]%mod
print(ans)

Measured memory_bytes: 64052