akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=150;
//ここまでテンプレ
int main(){
	int H,W;
	cin>>H>>W;
	string S[SIZE];
	for(int i=0;i<H;i++)
		cin>>S[i];
	int tate[SIZE]={},yoko[SIZE]={};
	for(int i=0;i<H;i++)
		for(int j=0;j<W;j++)
			if(S[i][j]=='#')
				tate[i]++;
	for(int j=0;j<W;j++)
		for(int i=0;i<H;i++)
			if(S[i][j]=='#')
				yoko[j]++;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++)
			if(tate[i] && yoko[j])
				cout<<S[i][j];
		if(tate[i])
			cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
s = list(input())
t = list(input())

l_s = len(s)
l_t = len(t)

change = l_t
for i in range(l_s - l_t + 1):
    change_temp = 0
    for j in range(l_t):
        if s[i+j] != t[j]:
            change_temp += 1

    change = min(change, change_temp)

print(change)

Measured memory_bytes: 8940
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

int main(){ 
    int N;
    cin >> N;
    vector<string> S(N);
    map<string, long long> Smap;
    for(int i = 0; i < N; ++i){
        string tmp;
        cin >> tmp;
        sort(tmp.begin(), tmp.end());
        S[i] = tmp;
        ++Smap[tmp];
    }
    long long ans = 0;
    for(auto i : Smap){
        long long tmp = i.second-1;
        ans += tmp*(tmp+1)/2;
    }

    
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 16640
#include <bits/stdc++.h> 
using namespace std; 
int main() 
{int m=0;
string str;
cin>>str;
string cpy=str;
reverse(str.begin(),str.end());
for(int i=0;i<str.length();i++)
{
	if(cpy[i]!=str[i])
	{
		str[i]=cpy[i];
		cpy[str.length()-i-1]=str[i];
		m++;
	}
}
cout<<m;
return 0;
}

Measured memory_bytes: 256
while True:
    (H, W) = [int(x) for x in input().split()]

    if H == W == 0:
        break

    for row in range(H):
        if row % 2 == 0:
            for w in range(W):
                if w % 2 == 0:
                    print("#", end="")
                else:
                    print(".", end="")

            else:
                print()
        else:
            for w in range(W):
                if w % 2 == 0:
                    print(".",end="")
                else:
                    print("#",end="")

            print()
    print()

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

int main()
{
	int n;
	cin >> n;
	int q;
	cin >> q;
	atcoder::dsu d(n);
	while(q--)
	{
		int t,u,v;
		cin >> t >> u >> v;
		if(t)
		{
			cout<<d.same(u,v)<<endl;
		}
		else
		{
			d.merge(u,v);
		}
	}
}


Measured memory_bytes: 4020
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    private static final int MOD = 998244353;

    static class Solver {
        long[] factorial;
        long[] facInverse;
        long[] inverse;

        void solve(int n, int m, int k) {
            init(n);
            int sum = 0;
            for (int i = 0; i <= k; i++) {
                final long edge = ncr(n - 1, i);
                sum = (int) ((sum + (edge * (m * modpow(m - 1, n - 1 - i, MOD) % MOD)) % MOD) % MOD);
            }
            System.out.println(sum);
        }

        void init(int n) {
            final int MAX = n + 2;
            factorial = new long[MAX];
            facInverse = new long[MAX];
            inverse = new long[MAX];
            factorial[0] = factorial[1] = 1;
            facInverse[0] = facInverse[1] = 1;
            inverse[1] = 1;
            for (int i = 2; i < MAX; i++) {
                factorial[i] = factorial[i - 1] * i % MOD;
                final long inv = inverse[i] = MOD - inverse[MOD % i] * (MOD / i) % MOD;
                facInverse[i] = facInverse[i - 1] * inv % MOD;
            }
        }

        long ncr(int n, int r) {
            if (n < r) { return 0; }
            if (n < 0 || r < 0) { return 0; }
            return factorial[n] * (facInverse[r] * facInverse[n - r] % MOD) % MOD;
        }

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

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int n = in.nextInt();
        final int m = in.nextInt();
        final int k = in.nextInt();
        in.nextLine();
        new Solver().solve(n, m, k);
    }
}


Measured memory_bytes: 40452
import java.util.Scanner;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a <= 5) {
            System.out.println(0);
        } else if (a >= 6 && a <= 12) {
            System.out.println(b/2);
        } else {
            System.out.println(b);
        }
    }

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main () {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if (a+b>c+d) {
    cout<<"Left"<<endl;
  }
  else if (a+b<c+d){
    cout<<"Right"<<endl;
  }
  else {
    cout<<"Balanced"<<endl;
  }
}

Measured memory_bytes: 3596
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#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 pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(void) {
	int A, B;
	cin>>A>>B;
	if(A + B >= 10) cout<<"error"<<endl;
	else cout<<A+B<<endl;
}



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

int main() {
  int N, W[100], sum = 0, before = 0, min;
  cin >> N;
  for (int i=0;i<N;i++) {
    cin >> W[i];
    sum += W[i];
  }
  min = sum;

  for(int i=0;i<=N-2;i++) {
    before += W[i];
    if (min > abs(sum - 2 * before))
      min = abs(sum - 2 * before);
  }

  cout << min << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Would
#define you
#define please
#define mp make_pair
#define pb push_back
#define INF 1000000000000
#define modulo 1000000007
#define ii pair<int,int>
#define int long long int
using namespace std;
map<int,int> performans;
int res(int n){
	if(n==1) return 1;
	int a=res(n/2);
	return 2*a+1;
}
int32_t main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//freopen("q.gir","r",stdin);
	//freopen("q.cik","w",stdout);
	int n;
	cin >> n;
	cout << res(n);
	Would you please return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,x = LI()
    l = [4*2**i-3 for i in range(n+1)]
    s = [2*2**i-1 for i in range(n+1)]
    ans = 0
    while x:
        if x == l[n]:
            ans += s[n]
            break
        if x <= l[n-1]+1:
            n -= 1
            x -= 1
        elif x < l[n]:
            ans += 1+s[n-1]
            x -= 2+l[n-1]
            n -= 1
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int a,b,c,d; cin>>a>>b>>c>>d;
    cout<<min(a,b)+min(c,d)<<endl;
}

Measured memory_bytes: 3600
s = list(input())

if len(set(s)) == 1:
    print(0)
elif len(set(s)) == len(s):
    print((len(s) + 1) // 2)
else:
    ans = 10010001001
    for i in range(ord('a'), ord('z') + 1):
        tmp = 0
        tmp2 = 0
        for c in s:
            if c == chr(i):
                tmp = 0
            else:
                tmp += 1
            tmp2 = max(tmp, tmp2)
        ans = min(ans, tmp2)

    print(ans)


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

using namespace std ;

int main()
{
	int N,K ;
	int i ;
	cin >> N >> K ;
	string S ;
	cin >> S ;
	int happy = 0 ;
	
	for (i=0;i<N-1;i++){
		if (S[i+1]==S[i])
			happy ++ ;
	}
	
	while(K--){
		if ( happy >= N-1 )
		break ;
		if ( happy == N-2)
			happy ++ ;
		else 
			happy += 2 ;
	} 
	cout << happy ;
	return 0 ;
}

Measured memory_bytes: 512
def main():
    from itertools import combinations_with_replacement
    import sys
    input = sys.stdin.buffer.readline
    N, M, Q = (int(i) for i in input().split())
    T = [[int(i) for i in input().split()] for j in range(Q)]
    ans = 0
    for C in combinations_with_replacement(range(1, M+1), N):
        A = sorted(C)
        cur = 0
        for a, b, c, d in T:
            if A[b-1] - A[a-1] == c:
                cur += d
        ans = max(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9192
#include <iostream>
#include <cstdio>

using namespace std;

int main() {
  int n, count;
  while(!feof(stdin)) {
    scanf("%d",&n);
    if(feof(stdin))break;
    count=0;
    if(n == EOF) break;
    for(int i=0;i<10;i++) {
      for(int j=0;j<10;j++) {
	for(int k=0;k<10;k++) {
	  if(i+j+k>=n-9 && i+j+k<=n)count++;
	}
      }
    }
    printf("%d\n", count);
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string S;
    cin >> S;
    int N = S.size();
 
    const int64_t MOD = 1e9+7;
 
    // dp[i][j] : i文字目までを見た時に作れる数で、13で割った余りがjであるものの個数（を、MODで割った余り）
    static int64_t dp[100001][13] = {0};
    // 初期状態。dp[0][0]に「数字を1文字も付け足していないもの」1通りを追加
    dp[0][0] = 1;
 
    for(int i=0; i<N; i++){
        // 13通りの遷移元を全て回る
        for(int j=0; j<13; j++){
            // Sのi+1文字目を確認するが、0-indexedなのでS[i]として見る
            if(S[i] == '?'){
                // ?なら10通り遷移
                for(int b=0; b<=9; b++){
                    int j2 = (10*j+b) % 13;
                    dp[i+1][j2] = (dp[i+1][j2] + dp[i][j]) % MOD;
                }
            }else{
                // 数字ならその数だけ遷移
                int b = S[i] - '0';
                int j2 = (10*j+b) % 13;
                dp[i+1][j2] = (dp[i+1][j2] + dp[i][j]) % MOD;
            }
            // dpの計算の途中で随時、MOD=1e9+7で割った余りを取る
        }
    }
 
    // これが答え
    cout << dp[N][5] << endl;
    return 0;
}

Measured memory_bytes: 10624
#include <cstdio>
#include <iostream>

using namespace std;
int main(){
  int N;
  int tmp;
  int i;
  int count;
  cin >> N;
  if(N % 2 == 1){
  	N++;
  }
  for(i=1;i<N/2;i++){
  	if(i<N-1){
    	++count;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
using System;
class c
{
    static void Main()
    {
        var inp = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int ans = 0;
        for (int i = 0; i <= 3000; i++)
        {
            for (int j = 0; j <= 3000; j++)
            {
                int remain = inp[3] - inp[0] * i - inp[1] * j;
                if (remain % inp[2] == 0 && remain >= 0) ans++;
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.next());
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(scanner.next());
        }
        Arrays.sort(A);
        long ans = 0;
        for (int i = 0; i < N; i++) {
            for (int j = i + 1; j < N; j++) {
                int sum = A[i] + A[j];
                int index = binarySearch(A, j + 1, N, sum);
                if (index == N || A[index] == sum) {
                    index--;
                }
                ans += index - j;
            }
        }

        System.out.println(ans);
    }


    static int binarySearch(int[] A, int l, int r, int val) {
        if (A[r - 1] < val) {
            return r;
        }
        int left = l - 1, right = r;
        while (right - left > 1) {
            int mid = (left + right) >>> 1;
            if (A[mid] < val) {
                left = mid;
            } else {
                right = mid;
            }
        }
        return left;
    }
}


Measured memory_bytes: 29996
#include<bits/stdc++.h>
using namespace std;
#define N 25
#define M 1000000007
#define ll long long
#define inf 1000000000000000000
ll n, arr[N][N], dp[1 << 21];


int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++) for(int j = 1;j <= n; j++) cin >>arr[i][j];
    dp[0] = 1;
    for(int i = 0; i < (1 << n); i++)
    {
        int cn = __builtin_popcount(i);
        for(int j = 0; j < n; j++)
        {
            if(arr[cn + 1][j + 1] && !((i >> j) & 1))
            {
                dp[i | (1 << j)] = (dp[i | (1 << j)] + dp[i]) % M;
            }
        }
    }
    cout << dp[(1 << n) - 1] << endl;
}





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

using namespace std;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long

#define for(i,a,b) for (i=a; i<b; i++)
#define forb(i,a,b) for (i=a; i>b; i--)
#define all(S) S.begin(),S.end()
#define sort(S) sort(all(S))

const int inf = 1e9+7;
const ll INF = 1e18;

ll gcd(ll a, ll b)
{
    if (a<b)
        swap(a,b);
    if (b==0)
        return a;
    return gcd(b,a%b);
}

ll p(ll n)
{
    ll ans = 1;
    int i;
    for (i,0,n)
        ans=(ans*2)%inf;
    return ans;
}

int main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
    ll n,i,x,y,c=0,a=0,b=0;
    cin >> n;
    vector <pair <ll,ll> > V;
    multiset <pair<ll,ll> > M;
    for (i,0,n)
    {
        cin >> x >> y;
        if (x==y && x==0)
        {
            c++;
            continue;
        }
        if (x==0)
        {
            a++;
            continue;
        }
        if (y==0)
        {
            b++;
            continue;
        }
        if (y<0)
        {
            x*=-1;
            y*=-1;
        }
        ll g = gcd(abs(x),abs(y));
        x/=g; y/=g;
        V.pb(mp(x,y));
        M.insert(mp(x,y));
    }
    sort(V);
    if (V.size()+a+b==0)
    {
        cout << c << endl;
        return 0;
    }
    ll ans = 1;
    ans=(p(a)+p(b)-1)%inf;
    i=0;
    while (i<V.size())
    {
        while (i<V.size()-1 && V[i]==V[i+1])
            i++;
        x=V[i].f; y=V[i].s;
        //cout << x << " " << y << endl;
        int k = M.count(mp(-y,x)) + M.count(mp(y,-x));
        //cout << k << endl;
        if (k==0 || x>0)
            ans=(ans*(p(k)+p(M.count(V[i]))-1))%inf;
        //cout << ans << endl;
        i++;
    }
    cout << (ans+c-1+inf)%inf << endl;
    return 0;
}


Measured memory_bytes: 18796
import java.util.Scanner;

//AtCoder Beginner Contest 124
//A	Buttons
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();

		int ans = 0;
		if (A > B) {
			ans += A;
			A--;
		} else {
			ans += B;
			B--;
		}
		if (A > B) {
			ans += A;
			A--;
		} else {
			ans += B;
			B--;
		}

		System.out.print(ans);
	}
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
vector<vector<ll>> d(205,vector<ll>(205,1e9));
void warshall_floyd(ll n) {
    for (ll i = 0; i < n; i++)      
        for (ll j = 0; j < n; j++) 
            for (ll k = 0; k < n; k++) 
                chmin(d[i][j], d[i][k] + d[k][j]);
}
int main(){
    ll n,m,r; cin>>n>>m>>r;
    vector<ll> city(r);
    rep(i,r){
        cin>>city[i];
        city[i]--;
    }
    rep(i,m){
        ll a,b,c; cin>>a>>b>>c;
        a--; b--;
        d[a][b]=c; d[b][a]=c;
    }
    rep(i,n) d[i][i]=0;
    warshall_floyd(n);
    warshall_floyd(n);
    warshall_floyd(n);
    ll res=1e10;
    vector<ll> v(r,0);
    rep(i,r) v[i]=i;
    do{
        ll tmp=0;
        rep(i,r-1) tmp+=d[ city[v[i]] ][ city[v[i+1]] ];
        chmin(res,tmp);
    }while(next_permutation(v.begin(),v.end()));
    cout<<res<<endl;
    return 0;
}

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

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

signed main() {
	int n;
	cin >> n;
	int a[200005];
	double sum = 0, be = 0;
	rep(i, n) {
		cin >> a[i];
		sum += a[i];
	}
	rep(i, n) {
		be += a[i];
		if (sum / 2 <= be) {
            int ans1=abs((sum - be) - be);
            be-=a[i];
            int ans2=abs((sum - be) - be);
			cout << min(ans1,ans2)<< endl;
			return 0;
		}
	}

	return 0;
}


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

int main(){
	vector<vector<int>> a(3,vector<int>(3));
	vector<int> x(3);
	vector<int> y(3);
	rep(i, 3){
		rep(j, 3) cin >> a.at(i).at(j);
	}

	x.at(0) = 0;
	rep(i, 3) y.at(i) = a.at(0).at(i) - x.at(0);
	for(int i = 0; i < 3; i++) x.at(i) = a.at(i).at(0)-y.at(0);

	bool res = true;
	rep(i, 3){
		rep(j, 3){
			if(a.at(i).at(j) != x.at(i)+y.at(j))
				res = false;
		}
	}
	if(res) cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

int main(){
  int n;
  cin >> n;
  ll a[n], b[n];
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  ll p = 0;
  rep(i,n) {
    if(a[i] > b[i]) p += 2*(a[i]-b[i]);
    else p -= (b[i]-a[i])/2*2;
  }
  if(p <= 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
long long m=1000000000+7;
int main(){
    long long n;
    cin>>n;
    long long a=1,b=1,c=1;
    for(int i=0;i<n;i++){
        a=(a*10)%m;
        b=(b*8)%m;
        c=(c*9)%m;
    }
    long long ans=(a-2*c+b)%m;
    if(ans<0) ans+=m;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3604
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

string s;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> s;
    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
        cout << "Bad\n";
    }
    else {
        cout << "Good\n";
    }
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define ff first
#define setp(a) setprecision(a)<<fixed
#define ss second
#define fori(v) for(ll i=0; i<v; i++)
#define forj(v) for(ll j=0; j<v; j++)
#define fork(v) for(ll k=0; k<v; k++)
#define forl(v) for(ll l=0; l<v; l++)
#define fort(v) for(ll t=0; t<v; t++)
#define forz(v) for(ll z=0; z<v; z++)
#define forx(v) for(ll x=0; x<v; x++)
#define fory(v) for(ll y=0; y<v; y++)
#define ll long long 
#define MAX 3020
#define pb(a) push_back(a)
const ll INF = 0x3f3f3f3f;
const ll inf =  2*pow(10,9);
ll modulo = pow(10,9) + 7;


void display(vector<ll> a){
	for(auto f : a)
		cout<<f<<' ';
	cout<<endl<<endl;
}

void deal(){
	ll n;
	string a;
	cin>>n>>a;
	vector<ll> dp(n+1,0);
	dp[0] = 1;
	fori(n-1){
		vector<ll> dpn(n+1, 0);
		if(a[i] == '>'){
			for(ll j = i; j>-1; j--)
				dpn[j] = (dpn[j+1] + dp[j]) % modulo;
		}
		else{
			for(ll j =1; j<=i+1; j++){
				dpn[j] = dpn[j-1] + dp[j-1];
				dpn[j]%=modulo;
			}
		}
		dp = dpn;
//		display(dpn);
	}
	for(ll i= 1; i<n+1; i++)
		dp[0]+=dp[i], dp[0]%=modulo;
	cout<<dp[0];
}

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









Measured memory_bytes: 256
/*
Author : Harsh AKA Codula
*/
#include<iostream>

using namespace std;

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
#define deb(x) cout<<"["<<#x<<"="<<x<<"]"<<"\n";
#define FOR(a,b) for(ll i=a;i<b;++i)
#define read(x) for(auto& i:x)cin>>i
#define pb push_back

class MAIN
{
	public:
		void run()
		{
			ll t=1;//cin>>t;
			while(t--)
			{
				ll a1,a2,a3;
				cin>>a1>>a2>>a3;
				cout<<((a1+a2+a3)>=22?"bust":"win");
				cout<<"\n";
			}
		}	
};

int main()
{
	fast;
	MAIN solution;
	solution.run();
	return 0;
}

Measured memory_bytes: 3644
import java.util.Scanner;

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

        int N = sc.nextInt();

        System.out.println(solve(N) ? "Yes" : "No");

        sc.close();
    }

    static boolean solve(int N) {
        return N / 100 == N % 10;
    }
}

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

int main() {
  const static char c[2] = {'b','w'};
  while(1) {
    vector<string> s(3);
    for(int i = 0; i < 3; ++i) {
      cin >> s[i];
      if(s[i] == "0") return 0;
    }
    for(int i = 0; i < 2; ++i) {
      if(s[0][0] == c[i] && s[1][1] == c[i] && s[2][2] == c[i] ||
         s[0][2] == c[i] && s[1][1] == c[i] && s[2][0] == c[i] ||
         s[0][0] == c[i] && s[1][0] == c[i] && s[2][0] == c[i] ||
         s[0][1] == c[i] && s[1][1] == c[i] && s[2][1] == c[i] ||
         s[0][2] == c[i] && s[1][2] == c[i] && s[2][2] == c[i] ||
         s[0][0] == c[i] && s[0][1] == c[i] && s[0][2] == c[i] ||
         s[1][0] == c[i] && s[1][1] == c[i] && s[1][2] == c[i] ||
         s[2][0] == c[i] && s[2][1] == c[i] && s[2][2] == c[i] ) {
        cout << c[i] << endl;
        break;
      }
      if(i+1 == 2) cout << "NA" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
// DONT USE MEMSET, USE VECTORS

int main(){
	fastread;
	string s;
	cin>>s;
	string ans ="";
	for(char c:s){
		if(c == 'B'){
			if(ans.size()) ans.pop_back();
			continue;
		}
		ans += c;
	}
	cout<<ans<<endl;
	return 0;
}


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

//#define int long long
//using ll = boost::multiprecision::cpp_int;
using ll = long long;
const int INF = 1<<29;
//const ll INF = 1<<29;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var)  std::cout<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for(int i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(int i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define pb push_back
inline bool isnatural(double a) { return a>=0 && ceil(a)==floor(a); }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

class Cake{
public:
	ll x;
	ll y;
	ll z;
};

signed main() {
	ll N,M;
	cin >> N >> M;

	vector<Cake> a(N,Cake());
	rep(i,N){
		cin >> a[i].x;
		cin >> a[i].y;
		cin >> a[i].z;
	}

	ll maxval=-100000000000;
	for(int i=-1;i<=1;i+=2){
		for(int j=-1;j<=1;j+=2){
			for(int k=-1;k<=1;k+=2){
				nth_element(a.begin(), a.begin() + M-1, a.end(), [&](const Cake &x, const Cake &y) {
					ll xscore=x.x*i + x.y*j + x.z*k;
					ll yscore=y.x*i + y.y*j + y.z*k;
					return xscore > yscore;
				});
				ll t=0;
				rep(m,M){
					Cake x=*(a.begin()+m);
					ll xscore=x.x*i + x.y*j + x.z*k;
					t+=xscore;
				}
				chmax(maxval,t);
			}
		}
	}

	p(maxval);

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int N, K;
    int cnt = 0;

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

	int h[N];

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

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

	return 0;
}

Measured memory_bytes: 512
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();;
		int d = sc.nextInt();;
	    int ab=a*b;
	    int cd=c*d;
	    if(ab>cd) {
	        System.out.println(ab);
	    }else System.out.println(cd);
	}
}

Measured memory_bytes: 22100
#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>;

int main() {

  double a;
  int b;
  cin >> a >> b;
  int amin, amax, bmin, bmax;
  amin = (int)(ceil(a * 12.5));
  amax = (int)(floor((a+1) * 12.5))-1;
  bmin = (b * 10);
  bmax = ((b+1) * 10)-1;
  // cout << amin << amax << bmin << bmax << endl;
  int lowlim = max(amin, bmin);
  int highlim = min(amax, bmax);
  if(lowlim <= highlim) cout << lowlim << endl;
  else cout << "-1" << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Comparator;
import java.util.Scanner;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int m = scanner.nextInt();

        final Stream<Long> cards = IntStream.range(0, n)
                .mapToObj(i -> scanner.nextLong());

        final Stream<Long> operations = IntStream.range(0, m)
                .mapToObj(i -> new Operation(scanner.nextInt(), scanner.nextInt()))
                .sorted(Comparator.comparingLong(operation -> -operation.value))
                .flatMap(operation -> IntStream.range(0, operation.number).mapToObj(i -> operation.value))
                .limit(n);

        final long answer = Stream.concat(cards, operations)
                .sorted(Comparator.reverseOrder())
                .limit(n)
                .mapToLong(Long::longValue)
                .sum();

        System.out.println(answer);
    }

    private static class Operation {
        final int number;
        final long value;

        Operation(final int number, final int value) {
            this.number = number;
            this.value = value;
        }
    }
}


Measured memory_bytes: 107980
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
#define rep(i,n) for (int i = 1; i <= (n); ++i)
using namespace std;
#define PI 3.14159265358979
typedef long long int ll;

const int pi=3.1415;
ll absc(ll a,ll b){return (a-b>0?a-b:b-a);
}
ll mini(ll a,ll b){return (a>b?b:a);}
ll gcd(ll a,ll b){
	if(a<b)swap(a,b);
	return (a%b?gcd(a%b,b):b);
}
int main()
{
    ll a,b,c;
    string s,t;
    cin>>a;
    cout<<a*2*PI;
}


Measured memory_bytes: 3820
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x): x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

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

    var(i64, I, O, T, J, L, S, Z);

    i64 ans = 0;
    if (I && J && L) {
        chmax(ans, 6 + (I-1)/2*4 + (L-1)/2*4 + (J-1)/2*4);
    }
    chmax(ans, I/2*4 + J/2*4 + L/2*4);

    ans += O*2;

    print(ans / 2);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int x;
    cin >> x;
    if(x==3){
        cout <<"YES"<<endl;
    } else if(x==5){
        cout <<"YES"<<endl;

    } else if(x==7){
        cout <<"YES"<<endl;

    }else{
        cout <<"NO"<<endl;

    }
    return 0;
}

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

typedef long long ll ;
typedef long double ld ;

#define f first
#define s second
#define pll pair<ll,ll>
#define pub push_back
#define sortt(vv) sort(vv.begin(),vv.end())
#define mp make_pair

const ll maxn = 1010 ;
const ll INF = 1e9 + 10 ;

ll n , m , dp[maxn][maxn] , mod = 1e9 +7 ;
char a[maxn][maxn] ;

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

 cin >> n >> m ;
 for(int i = 1 ; i <= n ; i ++){
   string s1;
   cin >> s1 ;
   for(int j = 1 ; j <= m ; j ++)a[i][j] = s1[j-1] ;
 }
 dp[1][1] = 1;
 for(int i = 1 ; i <= n ; i ++){
    for(int j = 1 ; j <= m ; j ++){
        if(a[i][j] == '#'){dp[i][j] = INF ;continue ;}
        if(a[i-1][j] != '#' && i-1 > 0)dp[i][j] = (dp[i][j] + dp[i-1][j])%mod ;
        if(a[i][j-1] != '#' && j-1 > 0)dp[i][j] = (dp[i][j] + dp[i][j-1])%mod ;
    }
 }
 cout << dp[n][m]%mod ;
    return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;
using pll=pair<ll,ll>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

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() {
	int sx,sy,tx,ty;
	cin >> sx >> sy >> tx >> ty;
	rep(i, tx - sx) cout << "R";
	rep(i, ty - sy) cout << "U";
	rep(i, tx - sx) cout << "L";
	rep(i, ty - sy) cout << "D";
	cout << "D";
	rep(i, tx - sx + 1) cout << "R";
	rep(i, ty - sy + 1) cout << "U";
	cout << "L";
	cout << "U";
	rep(i, tx - sx + 1) cout << "L";
	rep(i, ty - sy + 1) cout << "D";
	cout << "R";
	cout << endl;


  return 0;
}


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


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    int n,c=0;
    string s;
    cin>>n>>s;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='R')
         c++;
    }
    if(c>n-c)
     cout<<"Yes";
    else
    cout<<"No";}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int z;
  cin>>z;
  if(z>=195) cout<<5<<endl;
  else if(z>=189) cout<<4<<endl;
  else if(z>=165) cout<<3<<endl;
  else if(z>=135) cout<<2<<endl;
  else if(z>=105) cout<<1<<endl;
  else cout<<0<<endl;
}

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

int main(){
    string s;
    cin >> s;
    
    int cnt[4];
    for(int i = 0; i < 4; i++){
        cnt[i] = 0;
    }
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'N'){
            cnt[0]++;
        } else if(s[i] == 'W'){
            cnt[1]++;
        } else if(s[i] == 'S'){
            cnt[2]++;
        } else cnt[3]++;
    }
    
    if(cnt[0]>0 && cnt[2]>0 && cnt[1]>0 && cnt[3]>0)
        cout <<"Yes"<<endl;
    else if(cnt[0]>0 && cnt[2]>0 && cnt[1]==0 &&cnt[3]==0)
        cout <<"Yes"<<endl;
    else if(cnt[1]>0 && cnt[3]>0 && cnt[0]==0 && cnt[2]==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    
}

Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;
import std.bitmanip;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readM(T)(size_t r,size_t c,ref T[][]t){t=new T[][](r);foreach(ref v;t)readA(c,v);}

void main()
{
  int n; readV(n);
  int[][] a; readM(n, n, a);

  auto dp = new long[](1<<n);
  foreach (i; 1..1<<n) {
    if (i.popcnt == 1) continue;

    auto r = 0L;
    foreach (j; 0..n)
      foreach (k; j+1..n)
        if (i.bitTest(j) && i.bitTest(k))
          r += a[j][k];
      
    for (auto j = i; ; j = (j-1)&i) {
      r = max(r, dp[j]+dp[i^j]);
      if (j == 0) break;
    }
    dp[i] = r;
  }

  writeln(dp[$-1]);
}

pragma(inline) {
  pure bool bitTest(T)(T n, size_t i) { return (n & (T(1) << i)) != 0; }
  pure T bitSet(T)(T n, size_t i) { return n | (T(1) << i); }
  pure T bitReset(T)(T n, size_t i) { return n & ~(T(1) << i); }
  pure T bitComp(T)(T n, size_t i) { return n ^ (T(1) << i); }

  pure T bitSet(T)(T n, size_t s, size_t e) { return n | ((T(1) << e) - 1) & ~((T(1) << s) - 1); }
  pure T bitReset(T)(T n, size_t s, size_t e) { return n & (~((T(1) << e) - 1) | ((T(1) << s) - 1)); }
  pure T bitComp(T)(T n, size_t s, size_t e) { return n ^ ((T(1) << e) - 1) & ~((T(1) << s) - 1); }

  import core.bitop;
  pure int bsf(T)(T n) { return core.bitop.bsf(ulong(n)); }
  pure int bsr(T)(T n) { return core.bitop.bsr(ulong(n)); }
  pure int popcnt(T)(T n) { return core.bitop.popcnt(ulong(n)); }
}


Measured memory_bytes: 2684
#include<iostream>
using namespace std;
int main(){
    int i,j,x,k;
    cin >> x;
    k=1;
    for(i=2;i*i<=x;i++)
    {
        for(j=i*i;j<=x;j*=i)
            if(j>k)
            	k=j;
    }
   
    cout << k << endl;
    return 0;
}


Measured memory_bytes: 256
/*
Author: Babin Dutta
*/
 
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define inf 1e18
#define mm 998244353
 
ll power(ll x, ll y, ll p)
{
    ll res = 1;  
    x = x % p;  
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; 
        x = (x*x) % p;  
    }
    return res;
}
ll modInverse(ll A,ll M)
{
    return power(A,M-2,M);
}

const int N = 2e5+10;
int a[N];

vector<int> v[1000001];
 
void func(){
	for(int i=1;i<=1000000;i++){
		for(int j=i;j<=1000000;j += i) v[j].pb(i);
	}
}

void solve(){
	int n; cin>>n;
	map<int,int> mp;
	int c = 0;
	f(i,n){
		cin>>a[i];
		mp[a[i]]++;
		if(a[i] == 1) c++;
	}
	func();
	int ans = 0;
	f(i,n){
		int f = 1;
		int y = a[i];
		for(int x : v[y]){
			if(x == y){
				if(mp[x] > 1){
					f=0;
					break;
				}
			}
			else{
				if(mp.count(x)){
					f=0;
					break;
				}
			}
		}
		if(f){
			ans++;
		}
	}
	cout<<ans<<endl;
}
 
int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

Measured memory_bytes: 127860
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
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 main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll n,m,x;
cin>>n>>m>>x;
ll a;
ll left=0,right=0;
rep(i,m){
    cin>>a;
    if(a>x){
        right++;
    }
    else{
        left++;
    }
}

cout<<min(left,right)<<endl;
//system("pause");
return 0;
}

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

int main() {
    int n; cin >> n;
    map<ll, ll> mp;
    mp[0]++;
    
    ll a, sum = 0;
    for (int i = 0; i < n; i++) {
        scanf("%lld", &a);
        sum += a;
        mp[sum]++;
    }
    
    ll ans = 0;
    for (auto& m : mp) {
        if (m.second >= 2)
            ans += (m.second*(m.second-1)/2);
    }

    cout << ans << endl;
}


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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  string s;int a;
  cin>>s;
  cin>>a;
  for(int i=0;i<s.size();i+=a)
    cout<<s[i];
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

// 普通に計算して通ってしまったが、恐らく想定の解き方ではない

func main() {
	N := nextInt()
	Ln := make([]int, N)
	for i := range Ln {
		Ln[i] = nextInt()
	}
	sort.Ints(Ln)
	var ans int
	for i := 0; i < N-2; i++ {
		for j := i + 1; j < N-1; j++ {
			// cnt := sort.Search(len(Ln), func(k int) bool {
			// 	a, b, c := Ln[i], Ln[j], Ln[k]
			// 	return b < c+a && c < a+b && k > j
			// })
			cnt := sort.SearchInts(Ln, Ln[i]+Ln[j])
			// fmt.Println(cnt)
			ans += cnt - (j + 1)
			// for k := j + 1; k < N; k++ {
			// 	a, b, c := Ln[i], Ln[j], Ln[k]
			// 	if c-b < a {
			// 		ans++
			// 	}
			// 	if a+b < c {
			// 		break
			// 	}
			// }
		}
	}
	fmt.Println(ans)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 1920
from itertools import product
A = {}
B = {}
N = int(input())

for n in range(1, N + 1):
    A[n] = input().split()

for n in range(1, N + 1):
    B[n] = [int(m) for m in input().split()]


ans = -10**10

for C in product(('1', '0'), repeat=10):
    if C != tuple('0' * 10):
        D = {v: 0 for v in range(1, N + 1)}
        E = 0
        for u in range(0, 10):
            for v in range(1, N + 1):
                if C[u] == A[v][u] == '1':
                    D[v] += 1

        for v in D:
            E += B[v][D[v]]

        if E > ans:
            ans = E

print(ans)


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

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

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

  int n;
  cin >> n;
  vector<vector<long long>> res(n, vector<long long>(2));
  for (int i = 0; i < n; i++) {
    int t, a;
    cin >> t >> a;
    res[i][0] = t;
    res[i][1] = a;
  }

  for (int i = 0; i < n - 1; i++) {
    long long a = (res[i][0] + res[i+1][0] - 1) / res[i+1][0];
    long long b = (res[i][1] + res[i+1][1] - 1) / res[i+1][1];
    long long m = max(a, b);
    res[i+1][0] *= m;
    res[i+1][1] *= m;
  }
  cout << res[n-1][0] + res[n-1][1] << '\n';
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

struct Vertex
{
  double x, y, z;
  Vertex(){}
  Vertex(double a, double b, double c){
    x = a; y = b; z = c;
  }
};

#define Vector Vertex

double distanc(Vertex p1, Vertex p2)
{
  return pow(SQ((p2.x-p1.x)) + SQ((p2.y-p1.y)) + SQ((p2.z-p1.z)), 0.5);
}

double length(Vector v)
{
  return pow(SQ(v.x) + SQ(v.y) + SQ(v.z), 0.5);
}

Vector cross(Vector vl, Vector vr)
{
  return Vector(vl.y*vr.z - vl.z*vr.y, vl.z*vr.x - vl.x*vr.z, vl.x*vr.y - vl.y*vr.x);
}

double dot(Vertex a, Vertex b)
{
  return a.x*b.x + a.y*b.y + a.z*b.z;
}

double norm(Vertex a)
{
  return sqrt(dot(a, a));
}

double dis(Vertex p, Vertex a, Vertex b)
{
  Vector ab(b.x-a.x, b.y-a.y, b.z-a.z);
  Vector ap(p.x-a.x, p.y-a.y, p.z-a.z);
  double d = length(cross(ab, ap));
  double l = distanc(a, b);
  //  cout << endl << d << " " << l << endl;  
  double h = d / l;
  return h;
}

int main()
{
  int N, Q;
  Vertex jm[64];
  int r[64];
  ll l[64];

  cin >> N >> Q;
  rep(i, N){
    int x, y, z;
    cin >> x >> y >> z >> r[i] >> l[i];
    jm[i] = Vertex(x,y,z);
  }

  rep(i, Q){
    ll res = 0;    
    double x, y, z;
    cin >> x >> y >> z;
    Vertex a(x, y, z);
    cin >> x >> y >> z;
    Vertex b(x, y, z);
    rep(j, N){
      if(r[j] + EPS >= dis(jm[j], a, b)){
	Vertex u(jm[j].x-a.x,jm[j].y-a.y,jm[j].z-a.z);
	Vertex v(b.x-a.x,b.y-a.y,b.z-a.z);
	double t1 = dot(u, v) / (norm(u) * norm(v));
	u = Vertex(jm[j].x-b.x,jm[j].y-b.y,jm[j].z-b.z);
	v = Vertex(a.x-b.x,a.y-b.y,a.z-b.z);
	double t2 = dot(u, v) / (norm(u) * norm(v));
	if(t1 >= 0 && t2 >= 0)
	  res += l[j];
      }
    }
    cout << res << endl;
  }

  return 0;
}

Measured memory_bytes: 1296