akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}


int main(){
   lint N;
   lint count=0;
cin>>N;
lint L[N];
lint LL[N];
rep(i,N){
    cin>>L[i];
    count+=L[i];
    if(i!=(N-1))LL[i]=count;
}
lint ans=INF;
rep(i,N-1){
ans=min(ans,abs(count-2*LL[i]));
}
cout<<ans;

}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
{


if (a==1 && b==2)
    cout<<"3";
else if (a==2 && b==1)
    cout<<"3";

else if (a==2 && b==3)
    cout<<"1";

else if (a==3 && b==2)
    cout<<"1";

else if (a==1 && b==3)
    cout<<"2";
else if (a==3 && b==1)
    cout<<"2";
else cout<<"wrong";
}


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

typedef int Weight;
const Weight INF = 100000000;
struct Edge{
  int src, dst;
  Weight cost;
  Edge(int f, int t, Weight c) : src(f), dst(t), cost(c) {}
};
bool operator<(const Edge& a, const Edge& b){
  return a.cost < b.cost;
}
bool operator>(const Edge& a, const Edge& b){
  return b < a;
}

// 隣接リスト
typedef vector<Edge> Node;
typedef vector<Node> Graph;

// 隣接行列
typedef vector<Weight> Array;
typedef vector<Array> Matrix;

void add_edge(Graph& G, int src, int dst, Weight cost){
  //printf("add edge %d -> %d : %d", src, dst, cost);
  G[src].push_back(Edge(src, dst, cost));
}
bool BellmanFord(const Graph& G, vector<Weight>& dist, int start){
  vector<Edge> edges;
  REP(i, G.size()) REP(j, G[i].size()) edges.push_back(G[i][j]);
  int V = G.size(), E = edges.size();
  dist = vector<Weight>(V, INF);
  dist[start] = 0;
  REP(i, V){
    bool update = false;
    REP(j, E){
      Edge& e = edges[j];
      if(dist[e.src] != INF && dist[e.dst] > dist[e.src] + e.cost){
        dist[e.dst] = dist[e.src] + e.cost;
        update = true;
      }
    }
    if(!update) break;
    if(i == V - 1) return false; // 負閉路が存在
  }
  return true; // 負閉路は存在しない
}
int main(){
  int N, M;
  while(cin >> N >> M){
    Graph G(N);
    REP(i, M){
      int a, b, c; cin>>a>>b>>c;
      add_edge(G, a, b, -c);
    }
    vector<int> dist;
    BellmanFord(G, dist, 0);
    cout << -dist[N - 1] << endl;
  }
  return 0;
}

Measured memory_bytes: 1256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int sum = 0;
	for(int i = 0; i < N; i++){
      int a, b;
      cin >> a >> b;
  
      sum += b - a + 1;
  }
  cout << sum << endl;
  
}
   

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long k = sc.nextLong();

		long ans = 0;
		ans += Math.min(a, k);
		k -= Math.min(a, k);
		k -= Math.min(b, k);
		ans -= Math.min(c, k);
		k -= Math.min(c, k);
		System.out.println(ans);
	}

}


Measured memory_bytes: 35588
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<deque>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<tuple>
#include<utility>
#include<vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvi;

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define REP(i, n)  for(int i=0; i<(int)(n); i++)
#define REPS(i, n)  for(int i=1; i<=(int)(n); i++)
#define PER(i, n) for(int i=(int)(n)-1; i>= 0; i--)
#define PERS(i, n)  for(int i=(int)(n); i>0; i--)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define RFOR(i, c)  for(__typeof((c).rbegin()) i=(c).rbegin(); i!=(c).end(); i++)
#define ALL(container)  (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) (container).size()
#define FILL0(n)  setfill('0') << right << setw(n)
#define mp(a, b)  make_pair(a, b)
#define toLower(c)  c+0x20
#define toUpper(c)  c-0x20
#define pb  push_back
#define eb  emplace_back

const int INF = 1e9;
const long long LLINF = 1e18;
const ll MOD = 1000000007;
const int MSIZE = 100007;
const double Pi = 3.14159265358979323146;

ull a[51], p[51];

ull f(ull n, ull x){
  ull nn = (n==0?0:n-1);
  ull nx = (x==0?0:x-1);
  if(n==0LL){
    return (x<=0 ? 0 : 1);
  }
  else if(x<=1LL + a[n-1]){
    return f(nn, nx);
  }
  else{
    nx = (x>=2-a[n-1]?x-2-a[n-1]:0);
    return p[n-1] + 1LL + f(n-1, x-2-a[n-1]);
  }
}

int main(){
  ull n, x; cin >> n >> x;
  a[0]=1LL; p[0]=1LL;
  for(ull i=1; i<=n; i++){
    a[i] = a[i-1]*2LL+3LL;
    p[i] = p[i-1]*2LL+1LL;
  }
  cout << f(n, x) << endl;
}


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

int main() {
  int n,k;
  string s;
  cin >> n >> k >> s;
  if (s[k-1] == 'A') s[k-1] = 'a';
  else if(s[k-1] == 'B') s[k-1] = 'b';
  else s[k-1] = 'c';
  cout << s << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		Long X = sc.nextLong();

		int i = 0;
		int flag = 0;
		Long K = (long) 100;

		while(flag == 0) {
			if(K >= X) {
				flag = 1;
				i = i - 1;
			}
			K = (long)(1.01*K);
			i++;
		}

		System.out.println(i);
	}

}

Measured memory_bytes: 35836
N = int(input())
a = list(map(int, input().split()))
a_total, b_total = 0,0
for k in range(N):
    m = max(a)
    if k%2==0:
        a_total += m
    else:
        b_total += m
    a.remove(max(a))
print(a_total-b_total)

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

using namespace std;

const unsigned long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % MOD;
       base = base * base % MOD;
    }
    return tot;
}

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    // place into groups of (i, n - i)
    // proceed to connect all these groups

    int n; cin >> n;

    int target = n % 2 == 1 ? n : n + 1;

    vector<pair<int, int>> q;

    for(int i = 1; i <= n; ++i)
        for(int j = i + 1; j <= n; ++j)
            if(i + j != target)
                q.push_back(make_pair(i, j));

    cout << q.size() << "\n";
    for(auto i : q)
        cout << i.first << " " << i.second << "\n";

    return 0;

}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    vector<int> a(9);
    rep(i,9) cin >> a[i];
    int N;
    cin >> N;
    vector<int> b(N);
    rep(i,N) cin >> b[i];

    rep(i,N)
    {
        rep(j,9) if( b[i] == a[j] ) a[j] = 0;
        rep(j,3)
        {
            if( a[j * 3] + a[j * 3 + 1] + a[ j * 3 + 2] == 0 )
            {
                cout << "Yes" << endl;
                return 0;
            }
            if( a[j] + a[j+3] + a[j+6] == 0 )
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
        if( a[0] + a[4] + a[8] == 0 || a[2] + a[4] + a[6] == 0 )
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

c = {}

for i in range(n):
  if a[i] in c:
    c[a[i]] += 1
  else:
    c[a[i]] = 1
  
s = 0
for i in c:
  s += c[i]*(c[i]-1)//2
  
dic = {i: s-c[i]+1 for i in c}
  
for i in range(n):
  print(dic[a[i]])

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

int main() {
    int N; cin >> N;
    int a = 0; int b = 0;
    vector<int> v(N);
    for (int i = 0; i < N; i++) cin >> v[i];

    sort(v.begin(), v.end(), greater<int>());

    for (int i = 0; i < N; i++)
    {
        if(i%2==0) a+=v[i];
        else b+=v[i];
    }
    cout << a - b << endl;

}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    string s; cin >> s;
    int n = s.length();
    string t;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) t.push_back(s[i]);
    }
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 592
N, x = map(int, input().split())
A = list(map(int, input().split()))

result = 0
for i in range(N):
	result = result+max(0, A[i]-x)
	A[i] = min(x, A[i])

for i in range(N-1):
	if A[i]+A[i+1]<=x:
		continue
	result = result+A[i]+A[i+1]-x
	A[i+1] = A[i+1]-(A[i]+A[i+1]-x)

print(result)

Measured memory_bytes: 14148
#include<bits/stdc++.h>
using namespace std;
#define maxn 200005
#define mo 1000000007
#define LL long long
struct Edge{
	int next,to;
}edge[maxn*2];
int fi[maxn],size[maxn],n,se,Pow[maxn];LL inv,ans;
inline void add_edge(int u,int v){edge[++se].next=fi[u],edge[se].to=v,fi[u]=se;}
inline void add(int u,int v){add_edge(u,v),add_edge(v,u);}
LL power(LL a,int b){
	LL ans=1;
	while(b){
		if(b&1)ans=ans*a%mo;
		a=a*a%mo,b>>=1;
	}
	return ans;
}
void dfs(int x,int fa){
	size[x]=1;
	LL w=1,w1=0;
	for(int i=fi[x];i;i=edge[i].next){
		int v=edge[i].to;if(v==fa)continue;
		dfs(v,x),size[x]+=size[v];
		(w-=inv*Pow[size[v]])%=mo,w1++;
	}
	(w-=inv*Pow[n-size[x]])%=mo;
	(w+=inv*w1+mo)%=mo;
	ans+=w*500000004%mo;
}
int main(){
	int u,v;scanf("%d",&n);
	Pow[0]=1;
	for(int i=1;i<n;i++)scanf("%d%d",&u,&v),add(u,v),Pow[i]=2ll*Pow[i-1]%mo;
	inv=power(Pow[n-1],mo-2);
	dfs(1,0);
	printf("%d",ans%mo);
	return 0;
}

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

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

int main(void){

    int N,i,k,count=0,F=0,A[100000];
    scanf("%d",&N);
    if(1>N||100000<N){
        printf("Wrong number.\n");
        return 0;
    }
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
        if(A[i]<1||A[i]>1000000000){
            printf("Wrong number.\n");
            return 0;
        }
    }
    qsort(A,N,sizeof(int),compare);
/*
    printf("*************\n");
    for(i=0;i<N;i++){
        printf("%d\n",A[i]);
    }
    printf("*************\n");
*/
    k = A[0];
    for(i=1;i<N;i++){
        if(k!=A[i]){
            k = A[i];
            if(F%2==0){
                count++;
            }
            F = 0;
        }else if(k==A[i]){
            F++;
        }
/*
        printf("A[%d] = %d, F = %d, count = %d\n",i,A[i],F,count);
*/
    }
    if(F==0||F%2==0)count++;
    printf("%d\n",count);

return 0;
}

int compare(const void *a,const void *b){
    return *(int*)a - *(int*)b;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int P[10],Q[10];
int ansp,ansq,a=1,b=1;

void printVector1(const vector<int>& vec) {
  	int i=0;
    bool bl1=0;
    for (int value : vec) {
        if(value+1!=P[i]){
          a++;
          bl1=1;
          break;
        }
      	else i++;
    }
    if(!bl1)	ansp=a;
}

void printVector2(const vector<int>& vec) {
  	int i=0;
  	bool bl2=0;
    for (int value : vec) {
        if(value+1!=Q[i]){
          b++;
          bl2=1;
          break;
        }
  	    else i++;
    }
    if(!bl2)	ansq=b;
}


int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int N,ans;		cin>>N;
	FOR(i,0,N)	cin>>P[i];
	FOR(i,0,N)	cin>>Q[i];
	vector<int> nums(N);
	iota(nums.begin(), nums.end(), 0);
    do {
        printVector1(nums);
    } while (next_permutation(nums.begin(), nums.end()));
	do {
        printVector2(nums);
    } while (next_permutation(nums.begin(), nums.end()));

	cout<<abs(ansp-ansq)<<endl;

    return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

const int MAX = 1000001;

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

  int n;
  cin >> n;
  map<int, int> a;
  rep(i, 0, n) {
    int x;
    cin >> x;

    a[x]++;
  }

  vector<int> x(MAX, 0);
  for (auto aa : a) {
    for (int i = aa.first; i < MAX; i += aa.first) {
      x[i]++;
    }
  }

  int ans = 0;
  for (auto aa : a) {
    if (aa.second > 1)
      continue;
    if (x[aa.first] == 1)
      ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 16340
using System;




class A
{
    public static void Main()
    {
        while (true)
        {
            int n = int.Parse(Console.ReadLine());
            if (n == 0) break;

            int[] a = new int[n];

            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
            }

            long sum, Max=long.MinValue;

            for (int i = 0; i < n; i++)
            {
                sum = 0;
                for (int j = i; j < n; j++)
                {
                    sum += a[j];

                    if (sum > Max)
                    {
                        Max = sum;
                    }

                }
            }
            Console.WriteLine(Max);
        }

    }
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int R,B;
string S;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>x;
	cin>>S;
	FORR(c,S) {
		if(c=='R') R++;
		if(c=='B') B++;
		
	}
	if(R>B) {
		cout<<"Yes"<<endl;
	}
	else {
		cout<<"No"<<endl;
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
   int a[12];
   for(int b=0;b<12;b++)
    cin>>a[b];
   
   sort(a,a+12);
    
   if(a[0]==a[3]&&a[4]==a[7]&&a[8]==a[11])
    cout<<"yes"<<endl;
   
   else cout<<"no"<<endl;
   
   return 0;
    
   
    
    
}


Measured memory_bytes: 3160
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


class Program
{


    static void Main(string[] args)
    {
        Solve();
    }

    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();

        var s = sc.longarr;
        if (s[2] <= s[0] + s[1])
        {
            wr.wri("Yes");
        }
        else
        {
            wr.wri("No");
        }
    }

}
    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => strarr.Select(char.Parse).ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;

int main(){
    int N,K; cin>>N>>K;
    vector<int> A(N);
    rep(i,N) cin>>A[i];
    vector<bool> dp(K+10,false);//dp[i]=falseとは石がi個あると必ず負ける
    // bool dp[110000];
    rep1(i,K){
        rep(j,N){
            // if(i>=A[j]) dp[i] |= !dp[i-A[j]];
            if(i>=A[j])  dp[i] = dp[i] || (!dp[i-A[j]]);
        }
        // cout<<dp[i]<<i<<endl;
    }

    // cout<<dp[K]<<endl;
    if(dp[K])cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}



Measured memory_bytes: 3628
N = int(input().strip())
Q = [list(map(int, input().strip().split(' '))) for _ in range(N)]

now = [0,0,0]  # [t,x,y]
for t,x,y in Q:
  dt = t-now[0]
  dxy = abs(now[1]-x) + abs(now[2]-y)
  if dt >= dxy and dt%2 == dxy%2:
    now = [t,x,y]
  else:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 60632
s = gets.chomp

ans = 0
t = 0
for i in 0..s.size-1 do
  ss = s[i]
  if ['A','C','G','T'].include?(ss)
    t += 1
  else
    ans = [ans, t].max
    t = 0
  end 
  ans = [ans, t].max
end
puts ans

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    ll X;
    cin >> X;
    ll tmp = 100;
    int i = 0;
    for (; tmp < X; i++) {
        tmp = (1.01) * tmp;
    }
    cout << i << '\n';
}


Measured memory_bytes: 3620
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

int main(){
  string A;
  cin >> A;
  int cnt=0;
  for(int i=1; i<A.length(); i++){
    if(A[i]!=A[i-1]) cnt++;
  }

  cout << cnt << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
int d,n;
cin>>d>>n;
int ans;
if(n==100){
ans = (n+1)*pow(100,d);
}
else{
	ans= n*pow(100,d);
}
cout<< ans <<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	static Scanner sc;
	static int A,B,N;
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		A = sc.nextInt();
		B = sc.nextInt();
		N = A+B;
		if(B>=A) {
			System.out.println("Impossible");
		} else {
			int honest = getHonest();
			char[] ans = new char[N];
			for(int i=0; i<N; i++) {
				ans[i] = ask(honest, i) ? '1' : '0';
			}
			System.out.println("! " + String.valueOf(ans));
		}
		sc.close();
	}

	static int getHonest() {
		int need = B+1;
		LinkedList<Integer> list = new LinkedList<>();
		for(int i=0; i<N; i++) {
			if(list.isEmpty()) {
				list.push(i);
			} else {
				if(ask(list.peek(), i)) {
					list.push(i);
				} else {
					list.pop();
					need--;
				}
			}
			if(list.size()>=need)
				return list.pop();
		}
		
		return -1;
	}
	
	static boolean ask(int a, int b) {
		System.out.println("? "+a+" "+b);
		return sc.next().equals("Y");
	}
}


Measured memory_bytes: 41132
from collections import defaultdict
from itertools import combinations

N=int(input())
S=[input() for _ in range(N)]

c = defaultdict(int)

for i in range(N):
  if S[i][0] in {'M','A','R','C','H'}:
    c[S[i][0]] += 1

if len(c) < 3:
  print(0)
  exit()

if len(c)==3:
  ans=1
  for k in c.keys():
    ans *= c[k]
  print(ans)
  exit()

else:
  ans = 0
  l = len(c)
  keys = list(c.keys())
  for C in combinations(range(l),3):
    tmp = c[keys[C[0]]]*c[keys[C[1]]]*c[keys[C[2]]]
    ans += tmp
  print(ans)

Measured memory_bytes: 16472
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		String result = " == ";
		
		if (a < b) {
			result = " < ";
		} else if (a > b) {
			result = " > ";
		}
		
		System.out.println("a" + result + "b");
	}
}

Measured memory_bytes: 26332
N = int(input())

count = 0
if int(N)-N== 0:
    for i in range(1,int(N)):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)
else:
    for i in range(1,int(N)+1):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)


print(count)

Measured memory_bytes: 9164
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define LL long long
using namespace std;
const LL Maxn = 4010;
const LL Mod = 998244353;
LL n, K;
LL jc[Maxn], inv[Maxn];
LL C(LL x, LL y) { return jc[x]*inv[y]%Mod*inv[x-y]%Mod; }
void up(LL &x, LL y) { x = (x + y) % Mod; }
int main() {
	LL i, j, k;
	jc[0] = 1;
	for(i = 1; i <= 4000; i++) jc[i] = jc[i-1]*i%Mod;
	inv[0] = inv[1] = 1;
	for(i = 2; i <= 4000; i++) inv[i] = inv[Mod%i]*(Mod-Mod/i)%Mod;
	for(i = 2; i <= 4000; i++) inv[i] = inv[i-1]*inv[i]%Mod;
	scanf("%lld%lld", &K, &n);
	for(i = 2; i <= 2*K; i++){
		LL p = 0;
		for(j = 1; j <= K; j++){
			if(i-j < j) break;
			if(i-j <= K) p++;
		}
		LL ans = 0;
		for(j = 0; j <= p; j++){
			if(2*j > n) break;
			if(j&1) up(ans, (Mod-1)*C(p,j)%Mod*C(n-2*j+K-1,K-1));
			else up(ans, C(p,j)*C(n-2*j+K-1,K-1));
		}
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(x+r>W||x-r<0||y+r>H||y-r<0){
        printf("No\n");
    }else{
        printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 2096
import sys

line = sys.stdin.readline().strip()
N = int(line)

line = sys.stdin.readline().strip()
A = [int(x) for x in line.split()]

r = 0
while 1:
    if all(x % 2 == 0 for x in A):
        A = [x // 2 for x in A]
        r += 1
    else:
        break

print(r)


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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 1000000007;

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

  LL w,h,x,y;
  cin>>w>>h>>x>>y;
  cout << (w * h / 2.0) SP(w == x * 2 && h == y * 2 ? 1 : 0) << endl;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long

int main() {
    fastio;
    int a[5]; vector<int> b(5);

    for (int i = 0; i < 5; ++i) {
        cin >> a[i];
        b[i] = (a[i] % 10 == 0 ? a[i] % 10 : 10 - a[i] % 10);
    }

    int lo = max_element(b.begin(), b.end()) - b.begin();
    int ans = 0;
    for (int i = 0; i < 5; ++i) {
        if (i == lo) ans += a[lo];
        else 
            ans += a[i] + b[i];
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int w, h, x, y;
    cin >> w >> h >> x >> y;
    cout << setprecision(10) << fixed << 1.0 * w * h / 2 << ' ';
    cout << (2 * x == w && 2 * y == h);
}


Measured memory_bytes: 256
#include<stdio.h>
main()
{
    int a,b,c;
    scanf("%d %d", &a, &b);
    c=a*b;
    if(c%2==0)
    {
        printf("Even\n");
    }
    else
    {
        printf("Odd\n");
    }
    return 0;
}

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

// #define int ll
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

#define rep(i, n) for (int i = 0; i < n; i++)
#define dotc()    int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz(x)     (int)x.size()
#define eb        emplace_back
#define pb        push_back
#define mp        make_pair
#define all(x)    x.begin(), x.end()
#define rall(x)   x.rbegin(), x.rend()
#define fi        first
#define se        second

int inf(0x3fffffff);
int mod(1000000007);
double pi(acos(-1.0));

int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL
  freopen("io\\in.txt", "r", stdin);
  freopen("io\\out.txt", "w", stdout);
#endif

  int n;
  cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];
  sort(all(a));

  int cnt = 0;
  vector<bool> sieve(a.back() + 1);
  rep(i, n) {
    if (i && a[i - 1] == a[i]) {
      sieve[a[i]] = true;
      continue;
    }

    for (int j = a[i] * 2; j <= a.back(); j += a[i]) {
      sieve[j] = true;
    }
  }

  for (int i : a) if (!sieve[i]) cnt++;

  cout << cnt;

  return 0;
}


Measured memory_bytes: 4320
/*input

*/
#include <bits/stdc++.h>
#define up(i,a,b) for(int (i) = (a);(i)<=(b);++(i))
#define down(i,b,a) for(int (i) = (b);i>=(a);--i)
#define debug(x) cerr << (x) << '\n';
#define bits(x,i) ((x >> i) & 1)
#define mid ((l+r)/2)
#define pr pair<int,int>
#define pos(val) (lower_bound(divisor.begin(), divisor.end(), val) - divisor.begin())
using namespace std;
const int M = 100005;
const int K = 105;
const int mod = 1e9 + 7;
int dp[K][M];
int n,k;
int m;
set<int> divisorSet;
vector<int> divisor;
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n >> k;
	for(int i=1;i<=sqrt(n);++i) {
		divisorSet.insert(i);
		divisorSet.insert(n/i);
	}
	divisor.push_back(0);
	for(auto div : divisorSet){
		divisor.push_back(div);
	}
	m = divisor.size();
	for(int i=0;i<m;++i) dp[0][i] = 1;
	for(int i=1;i<=k;++i){
		for(int j=1;j<m;++j){
			dp[i][j] = (1LL * dp[i-1][pos(n/divisor[j])] * (divisor[j] - divisor[j-1])) % mod;
			dp[i][j] = (dp[i][j] + dp[i][j-1]) % mod;
			// cout << dp[i][j] << ' ';
		}
		// cout << '\n';
	}
	cout << dp[k][m-1];

}

Measured memory_bytes: 32056
#include<iostream>

using namespace std;

int main() {

	string s, t;

	cin >> s;
	cin >> t;

	int x = 0;

	for (int i = 0; i < 3; i++) {
		if (s[i] == t[i]) {
			x++;
		}
	}

	cout << x << endl;

	return 0;
}

Measured memory_bytes: 256
//#include <conio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>

using namespace std;

int main()
{
	string str;
	cin >> str;
	cout << str[0] << str.size() - 2 << str[str.size() - 1];
	//_getch();
	return 0;
}

Measured memory_bytes: 256
puts 9394,p=?+,0,1,9,?<,a=3,m=9,3,
[p,3,5-a+=1,9]+(-59..0).map{[p,a,a,a,p,a,3,6,[p,6,6,6]*-_1,?<,6,9,m+=1,p,a,m,a]},
[p,3,5-a+=1,9]+(-59..0).map{[p,a,a,a,p,a,3,6,[p,6,6,6]*-_1,?<,6,9,m+=1,p,a,m,a]},
(-59..0).map{|m|[p,2,2,2]+(1..59+m).map{[p,99+m-_1,99+_1,a,?<,3,a,a,p,a,2,2]}}

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

int A,B,C,D,L,R;

int main(){
    cin >> A >> B >> C >> D;
    if (A+B == C+D){
        cout << "Balanced" << endl;
    }
    else if (A+B > C+D){
        cout<<"Left" << endl;
    }
    else if (A+B<C+D){
        cout<<"Right"<<endl;
    }


}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
int main(){
	int W,H,x,y,r,w,h;
	std::cin >> W;
	std::cin >> H;
	std::cin >> x;
	std::cin >> y;
	std::cin >> r;	
	w=W-r;
	h=H-r;
	if(r<=x && x<=w && r<=y && y<=h)
		std::cout << "Yes" << std::endl;
	else
		std::cout << "No" << std::endl;
	return 0;
}

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

int main () {

    int N;
    scanf("%d", &N);

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

    int jump_cnt[N];
    jump_cnt[N-1] = 0;
    for (int i = N-2; i >= 0; i--) {
        if (H[i+1] <= H[i]) {
            jump_cnt[i] = jump_cnt[i+1] + 1;
        }
        else {
            jump_cnt[i] = 0;
        }
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        ans = max(ans, jump_cnt[i]);
    }

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

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int A, B;
	cin >> A >> B;
	cout << (A - 1) * (B - 1) << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

//Pasta
public class Main{

	int n, k, MOD = 10000;
	int[] a;
	int[][][] dp;

	int get(int v, int s, int c){
		if(a[v]!=-1&&a[v]!=s)return 0;
		if(v==n)return c==1?1:0;
		if(dp[v][s][c]!=-1)return dp[v][s][c];
		int res = 0;
		if(c==1){
			for(int j=0;j<3;j++){
				if(s==j)continue;
				res = (res+get(v+1, j, 1)+get(v+1, j, 2))%MOD;
			}
		}
		else res = get(v+1, s, 1);
		return dp[v][s][c] = res;
	}

	void run(){
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt(); k = sc.nextInt();
		a = new int[n+1];
		Arrays.fill(a, -1);
		while(k--!=0)a[sc.nextInt()]=sc.nextInt()-1;
		dp = new int[n+1][3][3];
		for(int[][]b:dp)for(int[]c:b)Arrays.fill(c, -1);
		int res = 0;
		for(int j=0;j<3;j++)for(int c=1;c<3;c++)res+=get(1, j, c);
		System.out.println(res%MOD);
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String[] wordin = new String[1200];
		String word = sc.nextLine();
		for(int i = 1; i <= word.length(); i++) {
		//大文字の場合小文字に変換
			if(Character.isUpperCase(word.charAt(i-1))){
				wordin[i-1] = word.substring(i-1, i).toLowerCase();
				System.out.print(wordin[i-1]);
			}
		//小文字の場合大文字に変換
			else {
				wordin[i-1] = word.substring(i-1, i).toUpperCase();
				System.out.print(wordin[i-1]);
			}
		}
		sc.close();
		System.out.println("");
	}
}


Measured memory_bytes: 26784
#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<map>

using namespace std;

#define rep(i,N) for(int i=0;i<N;i++) //0から


typedef long long ll;




ll binary_search(vector<ll> a, ll n, ll key){
    ll right = n, left = -1;
    ll md = (right + left) / 2;

    while(right - left > 1){
        if(a[md] <= key){
            right = md;
        }else{
            left = md;
        }
        md = (right + left) / 2;
    }
    if(left == -1) return -1; //無い場合
    return right;
}

vector<ll> prime;
void Prime(ll n){ //線形篩,素数列挙
    vector<ll> p(n,0);
    p[0]=1;
    p[1]=1;
    for(ll i=2;i<n;i++){
        if(p[i]==0){
            prime.push_back(i);
            p[i]=i;
        }
        ll k=prime.size();
        for(ll j=0;j<k && i*prime[j]<n && prime[j]<=p[i];j++){
            p[i*prime[j]]=prime[j];
        }
    }
}

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

#define MOD ((ll)1e+9 + 7)



//cout<<fixed<<setprecision(10);
int main(){
    ll n;
    cin>>n;
    vector<ll> h(n);
    rep(i,n){
        cin>>h[i];
    }
    ll tmp=h[0];
    bool s=true;
    rep(i,n-1){
        if(h[i]>h[i+1]) h[i+1]++;
        if(h[i]>h[i+1]){
            s=false;
        }
    }
    if(s){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }


    return 0;
}



Measured memory_bytes: 4048
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
#include <deque>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;
Graph G;
const int AMAX = 100000;
/*int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}

int n;
vll a;

ll solve(bool isp)
{
	ll sum = 0ll;
	ll ret = 0ll;

	for (int i = 0; i < n; i++)
	{
		sum += a[i];
		if (isp and sum <= 0)
		{
			ret += -sum + 1;
			sum = 1ll;
		}
		if (not isp and sum >= 0)
		{
			ret += sum + 1;
			sum = -1ll;
		}
		isp ^= 1;
	}
	return ret;
}

*/
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	/*string N,M;
	//int ans = 1;
	//ll ans = 10000000000000000000ll;
	cin >> N;
	bool ans = false;
	for (int i = 0; i < N.size(); i++)
	{
		if (N.at(i) == '7')
		{
			ans = true;
		}
	}
	if (ans)cout << "Yes" << endl;
		else cout << "No" << endl;*/
	int N;
	cin >> N;
	vector<int> data(N);
	ll sum = 0;
	for (int i = 0; i < N; i++)
	{
		data[i] = i+1;
		if ((data[i] % 3 == 0) && (data[i] % 5 == 0))
		{
			data[i] = 0;
		}
		else if(data[i]%3 == 0)
		{
			data[i] = 0;
		}
		else if (data[i] % 5 == 0)
		{
			data[i] = 0;
		}
		sum += data[i];
			 
	}
	cout << sum << endl;

	return 0;

	


}

Measured memory_bytes: 6980
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 200005
#define MAX_Q 200005
#define INF 10000000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
// clang-format on

int N, Q;
vector<int> G[MAX_N + 1];
int p[MAX_Q + 1], x[MAX_Q + 1];
int rnk[MAX_N];
ll cost[MAX_N + 1];

void dfs(int u, int c)
{
  cost[u] += c;
  for (int v : G[u]) {
    dfs(v, cost[u]);
  }
}

int main(void)
{
  scanf("%d%d", &N, &Q);

  REP(i, N) rnk[i] = INF;
  rnk[0] = 0;
  // 0-indexed なので 0 が根
  REP(i, N - 1)
  {
    int a, b;
    scanf("%d %d", &a, &b);
    // 0-indexed
    a--, b--;
    if (a < b) {
      G[a].push_back(b);
      rnk[b] = rnk[a] + 1;
    }
    else {
      G[b].push_back(a);
      rnk[a] = rnk[b] + 1;
    }
  }

  REP(i, Q)
  {
    int pp, xx;
    scanf("%d %d", &pp, &x[i]);
    pp--;
    p[i] = pp;
  }

  // REP(i, N) cout << rnk[i] << SLN(i, N);
  // REP(i, Q) cout << p[i] << ":" << x[i] << endl;
  // return 0;

  // あとはそれぞれ深さが根よりも深いものだけに足して行けば良い

  for (int i = 0; i < Q; i++) {
    cost[p[i]] += x[i];
  }

  dfs(0, 0);
  REP(i, N) printf("%lld%c", cost[i], (i == N - 1 ? '\n' : ' '));

  return 0;
}


Measured memory_bytes: 23552
while 1:
    n=int(input())
    if n==0:break
    a=[[0]*5for _ in range(n)]
    for i in range(n):
        a[i][:4]=map(int,input().split())
        a[i][4]=4*(sum(a[i][1:4:2]))+9*a[i][2]
    p,q,r,c=map(int,input().split())
    f=1
    for i in range(n):
        if a[i][1]<=p and a[i][2]<=q and a[i][3]<=r and a[i][4]<=c:print(a[i][0]);f=0
    if f:print('NA')

Measured memory_bytes: 7968
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,c,d,k;cin>>a>>b>>c>>d>>k;
  ll ans=max(0ll,60*(c-a)+d-b-k);
  print(ans);
  return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <stdio.h>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cfloat>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <iomanip>

using namespace std;

#define ll long long
#define rep(i, n) for (long double i = 0; i < n; i++)
// #define req(j, n) for (ll j = 1; j < (n+1); j++)
// #define rer(k, n) for (ll k = 1; k < (n+1); k++)


int main()
{
    ll a;
    float b;
    ll ans;
    cin >> a >> b;
    int c;
    c = floor(100 * b + 0.1);
    ans = a*c/100;
    cout << ans << endl;
}


Measured memory_bytes: 3708
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
//using P = pair<int,int>;
//pow(x,n)
//cout << fixed << setprecision(桁数);

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

    int a= n/100;
    int b=(n/10)%10;
    int c=(n%10);
    if(a==7 || b==7 || c==7) cout << "Yes" << endl;
    else cout << "No" << endl;
     
    
}


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

int main() {
    int N;
    cin >> N;
    int M = N;
    int ketawa = 0;
    while (M != 0) {
        ketawa += M%10;
        M/=10;
    }
    if(N%ketawa == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
} 


Measured memory_bytes: 256
from heapq import heappush,heappop

n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab = sorted(ab, key= lambda x:(x[0]))

hq = []
j = 0
ans = 0

for i in range(m):
  while j<n and ab[j][0] <= i+1:
    heappush(hq,-ab[j][1])
    j+=1
  if len(hq)>0:
    ans += -heappop(hq)
    
print(ans)    

Measured memory_bytes: 31900
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	
	//文字列から10進数に変換するときはparseIntを使います
	var n = parseInt(input[0], 10);
	var a = n%2;
	var b = (n-1)/2+1;
  //  console.log(b);
	if (a ==1){console.log(b/n);}else{console.log(0.5000000);}
	
	//出力
	
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    cout << (A+B+1)/2 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int ruiJ[1002][1002],ruiO[1002][1002],ruiI[1002][1002];
int main(){
    int H,W,N;
    cin>>H>>W>>N;
    string fie[1002];
    for(int i=0;i<H;i++)cin>>fie[i];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(j!=0){
                ruiJ[i][j]+=ruiJ[i][j-1];
                ruiO[i][j]+=ruiO[i][j-1];
                ruiI[i][j]+=ruiI[i][j-1];
            }
            if(fie[i][j]=='J')ruiJ[i][j]++;
            if(fie[i][j]=='O')ruiO[i][j]++;
            if(fie[i][j]=='I')ruiI[i][j]++;
        }
    }
    for(int i=0;i<N;i++){
        int a,b,c,d,ansJ=0,ansO=0,ansI=0;
        scanf("%d %d %d %d",&a,&b,&c,&d);
        a--,b--,c--,d--;
        for(int j=a;j<=c;j++){
            ansJ+=ruiJ[j][d];
            ansO+=ruiO[j][d];
            ansI+=ruiI[j][d];
            if(b!=0){
                ansJ-=ruiJ[j][b-1];
                ansO-=ruiO[j][b-1];
                ansI-=ruiI[j][b-1];
            }
        }
        printf("%d %d %d\n",ansJ,ansO,ansI);
    }
    return 0;
}

Measured memory_bytes: 13996
N=int(input())
sentence=[]
for _ in range(N):
    sentence.append( ''.join( sorted(input()) ))
sentence = sorted(sentence)

num_list = []
itr=0

while itr < N:
    num=1
    for tgt in range(itr+1, N):
        #print(itr, tgt)
        if sentence[itr]==sentence[tgt]:
            num += 1
            if tgt == N-1:
                num_list.append(num)
                itr=tgt
        else:
            num_list.append(num)
            itr = tgt
            break
    if itr==N-1:
        break

result = 0
if len(num_list)>0:
    for num in num_list:
        result += num*(num-1)//2
print(result)


Measured memory_bytes: 11536
#include <bits/stdc++.h>
////////////////////////////////////////////////////////////
#define all(x) (x).begin(), (x).end() 
const int inf = 1e9;
const long long INF=1e15;
#define endl '\n'
#define rep(i, n) for(int i=0;i<(n);++i)
#define repp(i, a, b) for(int i=(a);i<=(b);++i)
#define pb push_back
#define eb emplace_back
#define fastio ios::sync_with_stdio(false);cin.tie(0); //cout.tie(0);

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

int solve() {
	ll n,m,v,p;
	cin >>n>>m>>v>>p;
	vll a(n); rep(i,n)cin>>a[i];
	sort(all(a), greater<ll>());
	auto chk = [&](int x) {
		if(x < p) return true;
		if(a[x]+m < a[p-1]) return false;
		// p-1+n-x
		ll bsum = 0;
		for(int i=p-1;i<x;i++) bsum += max(0ll, a[x]+m-a[i]);
		if(bsum + (p-1+n-x)*m >= m*v) return true;
		return false;
	};
	int l =0, r=n;
	while(l!=r) {
		int mid=(l+r)/2;
		if(chk(mid) == false) r=mid;
		else l = mid+1;
	}
	cout << l;
}

int main() {
	fastio;
	solve();
}



Measured memory_bytes: 1024
N, K = map(int, input().split())
A = list(map(int, input().split()))
visited = [-1] * N
visited[0] = 0
next = A[0]
for i in range(1, K+1):
    present = next
    visited[present - 1] = i

    next = A[present - 1]
    if visited[next - 1] != -1:
        loopLength = visited[present - 1] - visited[next - 1] + 1
        rest = (K - i) % loopLength
        if rest > 0:
            present = visited.index(visited[next - 1] + rest - 1) + 1
        break

print(present)


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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;




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

	int x,a;cin>>x>>a;
	
	if(x <a){
		writeln(0);
	}else {
		writeln(10);
	}

}




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

using namespace std;

#define ll long long
#define forn(i, n) for (ll i = 0; i < (ll) n; ++i)
#define sz(a) static_cast<int>(a.size())

char buff[(int) 2e7 + 17];
const ll inf = (ll) 1e9 + 7ll;

const int maxn = (int) 1e4 + 17;

int n;
string s, t;

bool read() {
    if (scanf("%s", buff) != 1)
        return false;

    s = buff;
    scanf("%s", buff);
    t = buff;
    return true;
}

void solve() {
    if (!count(t.begin(), t.end(), '1')) {
        if (!count(s.begin(), s.end(), '1'))
            printf("0\n");
        else
            printf("-1\n");

        return ;
    }

    n = sz(s);
    int ans = inf;

    for (int sh = -n + 1; sh < n; ++sh) {
        vector<int> L(n), R(n);
        int last = -1;

        for (int i = n - 1; i >= 0; --i)
            if (t[i] == '1') {
                last = i - n;
                break;
            }

        for (int i = 0; i < n; ++i) {
            if (t[i] == '1')
                last = i;

            L[i] = last;
        }

        for (int i = 0; i < n; ++i)
            if (t[i] == '1') {
                last = i + n;
                break;
            }

        for (int i = n - 1; i >= 0; --i) {
            if (t[i] == '1')
                last = i;

            R[i] = last;
        }

        int res = 0;
        multiset< pair<int, int> > a, b;

        for (int i = 0; i < n; ++i)
            if (s[i] != t[(n + i + sh) % n]) {
                ++res;
                int lq = i;
                int rq = i + sh;

                if (sh < 0)
                    swap(lq, rq);

                if (lq > rq)
                    rq += n;

                if (lq < 0)
                    lq += n, rq += n;

                if (R[lq] > rq) {
                    int x = (n + i - L[lq % n]) % n;
                    int y = (n + R[rq % n] - i) % n;
                    a.insert(make_pair(x, y));
                    b.insert(make_pair(y, x));
                }
            }

        int lq, rq;

        if (sh <= 0)
            lq = sh, rq = 0;
        else
            lq = 0, rq = sh;

        if (!a.empty()) {
            int p = inf;

            for (int l = 0; l < n; ++l) {
                while (!a.empty() && a.begin()->first <= l) {
                    b.erase(b.find(make_pair(a.begin()->second, a.begin()->first)));
                    a.erase(a.begin());
                }

                int r = 0;

                if (!b.empty())
                    r = b.rbegin()->first;

                if (max(r, sh) - min(-l, sh) < p) {
                    p = max(r, sh) - min(-l, sh);
                    lq = min(-l, sh);
                    rq = max(r, sh);
                }
            }
        }

        ans = min(ans, res + 2 * (rq - lq) - abs(sh));
    }

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

int main() {
#if SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}


Measured memory_bytes: 436