akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

#define io freopen("test.txt", "r", stdin);
#define fast ios_base::sync_with_stdio(0);cin.tie(0);


#define ull unsigned long long int
#define lli long long int
#define li long int
#define ld long double

#define cout(x) cout<<x<<" "
#define coutn(x) cout<<x<<endl
#define newline cout<<endl

#define sz(x) (int)x.size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define ar array

#define pii pair<int,int>
#define pll pair<lli,lli>
#define pps pair<pair<int,int>, string>

const int MOD=1000000007;
const lli INF=1e18;
const int MX=100001;
const int N=1000000;

vector<int> g[N];
bool vis[N];
int n,m,x,y,k;

void dfs(int u, int&s){
    vis[u]=true;
    s++;
    for(auto v:g[u]){
        if(!vis[v]){
            dfs(v,s);
        }
    }
}

int main(){
    fast
    
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>x>>y;
        g[x].pb(y);
        g[y].pb(x);
    }

    memset(&vis,false,n);

    int mx=INT_MIN;
    for(int i=1;i<=n;i++){
        if(!vis[i]){
            int sz=0;
            dfs(i,sz);
            mx=max(mx,sz);
        }
    }
    
    cout<<mx<<"\n";

    return 0;
}

Measured memory_bytes: 42916
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int tmp;
		
		if (x<=y) {
			tmp = x;
			x = y;
			y = tmp;
		}
		
		while (y > 0) {
			x = x % y;
			tmp = x;
			x = y;
			y = tmp;
		}
		
		System.out.println(x);
		
	}
}


Measured memory_bytes: 26228
#include <iostream>
#include <cstdio>
#include <string.h>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <numeric>
#include <stack>
#include <deque>
#include <queue>
#include <unordered_map>
#include <bitset>

#define f first
#define s second
#define pplipii pair<pair<long long, int>, pair<int, int> >
#define mp make_pair
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define pii pair<int, int>
using namespace std;

typedef long long ll;
#define MAX 200010
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.0000001
#define vvi vector<vector<ll>>
vector<int> v;
int main()
{
    //freopen("input.txt", "r", stdin);
    ll n, m;
    cin >> n >> m;
    if (n == 1 && m == 1) cout << 1;
    else if (n == 1) cout << m - 2;
    else if (m == 1) cout << n - 2;
    else cout << (n - 2) * (m - 2);
    return 0;
}


Measured memory_bytes: 256
import math
N, K = input().split()
N = int(N)
K = int(K)
def P(n, r):
  return math.factorial(n)//math.factorial(n-r)
def C(n, r):
  return P(n, r)//math.factorial(r)
for i in range(1,K+1):
  if N-K+1<i:
    print(0)
  else:
  	ans= (C(K-1,i-1)*C(N-K+1,i))%(10**9+7)
  	print(ans)
  


Measured memory_bytes: 3316
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		
		TreeSet<Integer> expo = new TreeSet<>();
		for(int i = 1; i <= x; i++) {
			for(int n = 2; n < 10; n++) {
				double result = Math.pow((double)i,(double)n);
				if(result > x) {
					break;
				}else {
					expo.add((int)result);
				}
			}
		}
		
		System.out.println(expo.last());
	}
}

Measured memory_bytes: 21844
# -*- coding: utf-8 -*-
a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())

if a < b:
    result = 'YES' if a + t * v >= b + t * w else 'NO'
else:
    result = 'YES' if a - t * v <= b - t * w else 'NO'

print(result)

Measured memory_bytes: 9188
#include<stdio.h>

int main(void)
{
  int a, b, c, d, n, i;
  while ( scanf("%d", &n) != EOF ) {
    for ( i = 0,a = 0; a < 10; a++)
      for ( b = 0; b < 10; b++)
	for ( c = 0; c < 10; c++)
	  for ( d = 0; d < 10; d++)
	    if (a + b + c + d == n)
	      i++;
    printf("%d\n", i);
  }

  return 0;
}

Measured memory_bytes: 596
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.NoSuchElementException;

public class Main {
	int T, P, R;
	int[] correct, penalty;
	int[][] wrong;

	private class T implements Comparable<T> {
		int correct, penalty, tid;

		public T(int correct, int penalty, int tid) {
			this.correct = correct;
			this.penalty = penalty;
			this.tid = tid;
		}

		public int compareTo(T t) {
			if (this.correct == t.correct) {

				if (this.penalty == t.penalty) {
					return this.tid - t.tid;
				}

				return this.penalty - t.penalty;
			}
			return t.correct - this.correct;
		}
	}

	public void solve() {
		while (true) {
			T = nextInt();
			P = nextInt();
			R = nextInt();

			if (T + P + R == 0)
				break;

			wrong = new int[T + 1][P + 1];
			penalty = new int[T + 1];
			correct = new int[T + 1];
			for (int i = 0; i < R; i++) {

				int tid = nextInt();
				int pid = nextInt();
				int time = nextInt();
				String message = next();

				if (message.equals("CORRECT")) {
					penalty[tid] += wrong[tid][pid] * 1200 + time;
					correct[tid]++;
				} else {
					wrong[tid][pid]++;
				}
			}
			ArrayList<T> list = new ArrayList<T>();
			for (int i = 1; i <= T; i++) {
				list.add(new T(correct[i], penalty[i], i));
			}

			Collections.sort(list);

			for (T t : list) {
				out.println(t.tid + " " + t.correct + " " + t.penalty);
			}
		}
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 41712
using System;
using System.Text;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using static System.Array;

namespace DigitsParades
{

    class Programk
    {
        static void Main(string[] args)
        {
            var AB = Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
            var A = AB[0];
            var B = AB[1];
            var ans = -1;
            for (double i = 1; i <= 100000; i++)
            {
                
                if (Floor(i * 0.08) == A && Floor(i * 0.1) == B)
                {
                    ans = (int)i;
                    break;
                }
            }
            
            Console.WriteLine(ans);
             //var NM = Console.ReadLine();
        }
    }

    #region スキャナー
    class Scanner
    {
        public Scanner()
        {
            _pos = 0;
            _line = new string[0];
        }

        const char Separator = ' ';
        private int _pos;
        private string[] _line;

        #region スペース区切りで取得

        public string Next()
        {
            if (_pos >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _pos = 0;
            }

            return _line[_pos++];
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public double NextDouble()
        {
            return double.Parse(Next());
        }

        #endregion

        #region 型変換

        private int[] ToIntArray(string[] array)
        {
            var result = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }

        private long[] ToLongArray(string[] array)
        {
            var result = new long[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = long.Parse(array[i]);
            }

            return result;
        }

        private double[] ToDoubleArray(string[] array)
        {
            var result = new double[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = double.Parse(array[i]);
            }

            return result;
        }

        #endregion

        #region 配列取得

        public string[] Array()
        {
            if (_pos >= _line.Length)
                _line = Console.ReadLine().Split(Separator);

            _pos = _line.Length;
            return _line;
        }

        public int[] IntArray()
        {
            return ToIntArray(Array());
        }

        public long[] LongArray()
        {
            return ToLongArray(Array());
        }

        public double[] DoubleArray()
        {
            return ToDoubleArray(Array());
        }

        #endregion
    }
    #endregion  

}


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

using namespace std;

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

    vector<vector<int>> dp(N, vector<int>(3, 0));

    // cout << "dp tabel:" << endl;
    // for(auto day : dp){
    //     for(int i : day)cout << setw(10) << i << " ";
    //     cout << endl;
    // }

    for(int i=0; i<N; i++){
        for(int j=0; j<3; j++){
            int activation;
            cin >> activation;
            if(i==0){
                dp.at(i).at(j) = activation;
                continue;
            }

            for(int k=0; k<3; k++){
                if(j==k)continue;
                dp.at(i).at(j) = max(dp.at(i).at(j), dp.at(i-1).at(k) + activation);
            }
        }
    }

    // cout << "dp tabel:" << endl;
    // for(auto day : dp){
    //     for(int i : day)cout << setw(10) << i << " ";
    //     cout << endl;
    // }

    int res = 0;
    for(int i=0; i<3; i++)res = max(res, dp.at(N-1).at(i));

    cout << res << endl;
}

Measured memory_bytes: 8792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include<vector>
using namespace std;
typedef long long ll;
//#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i =0;i<n;++i)
//#define mod (ll)(1e9+7)
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    ll ans = 0;
    int tmp;
    REP(i,N){
        cin >> tmp;
        ans += tmp-1;
    }
    cout << ans << endl;
    return 0;
}


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

bool compare_second(pair<string, int> a, pair<string, int> b){
  if(a.second != b.second){
    return a.second > b.second;
  }else{
    return a.first < b.first;
  }
}

void output(vector<pair<string,int>> p){
  int tmp = p[0].second;
  for(int i =0;i<p.size();i++){
    if(tmp!=p[i].second){
      break;
    }
    cout << p[i].first << endl;
  }
}

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

  string s;
  map<string,int> mp;
  vector<pair<string,int>> pairs;
  for(int i=0;i<N;i++){
    cin >> s;
    if(mp[s]==0){
      mp[s] = 1;
    }else{
      mp[s] += 1;
    }
  }
  for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
    pairs.push_back(*itr);
  }
  sort(pairs.begin(),pairs.end(),compare_second);
  output(pairs);
}

Measured memory_bytes: 32236
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#define _USE_MATH_DEFINES

#include<math.h>

#define min(a,b) (a)>(b)?(b):(a)
#define max(a,b) (a)>(b)?(a):(b)

using namespace std;

void call(int n)
{
	for (int i = 1; i <= n; i++)
	{
		int x = i;
		if (x % 3 == 0)
		{
			cout << " " << i;
		}
		else
		{
			while (true)
			{
				if (x % 10 == 3)
				{
					cout << " " << i;
					break;
				}
				x /= 10;
				if (!x)
				{
					break;
				}
			}
		}
	}
	cout << endl;
}

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

	call(n);

	return 0;
}

Measured memory_bytes: 3076
//yukicoder@cpp14
//author:luckYrat(twitter:@luckYrat_)
//競技プログラミングから逃げるな
//https://www.youtube.com/watch?v=z_B9iJ8r4ic

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
  long long a;cin>>a;
  for(long long i = 0; 200 > i; i++){
    for(long long j = 0; 200 > j; j++){
      if(i*i*i*i*i - j*j*j*j*j == a){
        cout << i << " " << j << endl;
        return 0;
      }else if(i*i*i*i*i + j*j*j*j*j == a){
        cout << i << " -" << j << endl;
        return 0;
      }
    }
  }
}

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	long long ans{};
	for (int i = 0; i < n; i++) ans += 1ll*(i + 1)*(n - i);
	for (int i = 0; i < n - 1; i++) {
		int x, y;
		cin >> x >> y;
		if (x > y) swap(x, y);
		ans -= 1ll*x*(n - y + 1);
	}
	cout << ans;
}

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

using namespace std;

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

    char a;
    std::cin >> a;
    if (a >= 'a' && a <= 'z') {
        std::cout << 'a' << '\n';
    } else {
        std::cout << 'A' << '\n';
    }


    return 0;
}


Measured memory_bytes: 3640
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "damage", long, "cost");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    long[string] dict;
    foreach (_; iota(n))
    {
        auto s = sread();
        if (s in dict)
            dict[s]++;
        else
            dict[s] = 1;
    }
    long max_times;
    foreach (key, value; dict)
    {
        if (value > max_times)
        {
            max_times = value;
        }
    }
    auto tmp = new string[](0);
    foreach (key, value; dict)
    {
        if (value == max_times)
            tmp ~= key;
    }
    tmp.sort();
    foreach (e; tmp)
    {
        e.writeln();
    }
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


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

ll dp[3005][6005];

int main(){
	ll n,t;
	cin >> n >> t;
	vector<pair<ll,ll>> p(n);
	rep(i,n){
		cin >> p[i].first >> p[i].second;
	}
	sort(p.begin(),p.end());
	dp[0][0] = 0;
	dp[0][p[0].first] = p[0].second;
	REP(i,n-1){
		rep(time, t){
			int a = p[i].first;
			int b = p[i].second;
			dp[i][time+a] = max(dp[i][time+a], dp[i-1][time] + b);
			dp[i][time] = max(dp[i][time], dp[i-1][time]);
		}
	}
	ll ans = 0;
	rep(i,n){
		rep(time, 6005){
			ans = max(ans, dp[i][time]);
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 141056
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int N = sc.nextInt(), K = sc.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		Arrays.sort(A);
		int ans = 0;
		for (int i = 0; i < K; i++) {
			ans += A[i];
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 38864
#include <iostream>
#include <vector>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    int mod = 1000000007;
    long long sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        sum += A[i];
        sum %= mod;
    }
 
    long ans = 0;
 
    //i について全探索する
    for (int i = 0; i < N; i++)
    {
        //A[i+1] ... A[N] の値を更新する
        sum -= A[i];
        if (sum < 0) sum += mod;
 
        ans += A[i] * sum;
        ans %= mod;
    }
  
  cout << ans << endl;
}

Measured memory_bytes: 3984
#include<bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = (a), i##_end_ = (b); i <= i##_end_; ++i)
#define drep(i, a, b) for(int i = (a), i##_end_ = (b); i >= i##_end_; --i)
#define clar(a, b) memset((a), (b), sizeof(a))
#define debug(...) fprintf(stderr, __VA_ARGS__)
typedef long long LL;
typedef long double LD;
int read() {
    char ch = getchar();
    int x = 0, flag = 1;
    for (;!isdigit(ch); ch = getchar()) if (ch == '-') flag *= -1;
    for (;isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    return x * flag;
}
void write(int x) {
    if (x < 0) putchar('-'), x = -x;
    if (x >= 10) write(x / 10);
    putchar(x % 10 + 48);
}

const int Maxn = 100009;
int n, h[Maxn], dp[Maxn];

void init() {
	n = read();
	rep (i, 1, n) h[i] = read();
}

void solve() {
	clar(dp, 0x3f), dp[1] = 0;
	rep (i, 2, n) {
		if (i - 1 >= 1) 
			dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
		if (i - 2 >= 1) 
			dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
	}

	cout << dp[n] << endl;
}

int main() {
//	freopen("a.in", "r", stdin);
//	freopen("a.out", "w", stdout);

	init();
	solve();

#ifdef Qrsikno
    debug("\nRunning time: %.3lf(s)\n", clock() * 1.0 / CLOCKS_PER_SEC);
#endif
    return 0;
}



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

#define INF (2 << 28)
#define fr first
#define sc second
using namespace std;

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

int n, T, S, a[3333], b[3333], mini = INF;
int dp[3001][3001];
bool used[3333];

int rec(int idx, int now, int g){

  if(idx == n) return 0;
  if(~dp[idx][now]) return dp[idx][now];
  
  int ret = 0;
  if(now + b[idx] <= g)
    ret = rec(idx + 1, now + b[idx], g) + a[idx];

  ret = max(ret, rec(idx + 1, now, g));
  if(g == S)
    ret = max(ret, rec(idx, S, T));
              
  return dp[idx][now] = ret;
}

int main(){
  
  cin >> n >> T >> S;
  for(int i = 0; i < n; i++){
    cin >> a[i] >> b[i];
    mini = min(mini, b[i]);
  }
  
  memset(dp, -1, sizeof(dp));
  cout << rec(0, 0, S) << endl;
 
}

Measured memory_bytes: 36608
def F(x):
    ex = x % 4
    if ex == 0:
        return 0 ^ x
    elif ex == 1:
        return 1
    elif ex == 2:
        return 1 ^ x
    elif ex == 3:
        return 0

a,b = [int(_) for _ in input().split()]
ans = F(a-1) ^ F(b)
print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n, d, x, y, ans = 0;
  cin >> n, cin >> d;
  for (int i = 0; i < n; i++){
    cin >> x, cin >> y;
    if(sqrt(x*x + y*y) <= d) ans++;
  }
    cout << ans << endl;  
 
  return 0;
} 

Measured memory_bytes: 3676
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll X, Y, Z;
    cin >> X >> Y >> Z;

    cout << (X - Z) / (Y + Z) << endl;
    
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

string s;

bool odd(int idx){
   return (s[idx] == 'R') or (s[idx] == 'U') or (s[idx] == 'D');
}

bool even(int idx){
   return (s[idx] == 'L') or (s[idx] == 'U') or (s[idx] == 'D');
}

int32_t main(){_

   cin >> s;

   int n = sz(s);
   for (int i = 0; i < n; ++i)
   {
      if(i % 2 == 1 and !even(i)){
         cout<<"No";
         exit(0);
      }      
      if(i % 2 == 0 and !odd(i)){
         cout<<"No";
         exit(0);
      }      
   }
   
   cout<<"Yes";

   return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
const int N = 2005;
char c[N][N];
int bo[N][N] , up[N][N] , le[N][N] , ri[N][N];
int n , m , res = 0;
int main(){
	cin >> n >> m;
	for(int i = 1; i <= n; i ++)
		for(int j = 1; j <= m; j ++)
			cin >> c[i][j];
	for(int i = 1; i <= n; i ++)
		for(int j = 1; j <= m; j ++)
			bo[i][j] = (bo[i - 1][j] + 1) * (c[i][j] == '.'),
			le[i][j] = (le[i][j - 1] + 1) * (c[i][j] == '.');
	for(int i = n; i >= 1; i --)
		for(int j = m; j >= 1; j --)
			up[i][j] = (up[i + 1][j] + 1) * (c[i][j] == '.'),
			ri[i][j] = (ri[i][j + 1] + 1) * (c[i][j] == '.');
	for(int i = 1; i <= n; i ++)
		for(int j = 1; j <= m; j ++)
			res = max(res , up[i][j] + bo[i][j] + le[i][j] + ri[i][j] - 3 * (c[i][j] == '.')); 
	cout << res << "\n";
}

Measured memory_bytes: 66944
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define F first
#define S second
#define bitcnt(v) __builtin_popcount(v)
#define all(v) v.begin(), v.end()

int mod = 1e9 + 7;

ll powMod(ll a, ll n){
	ll ans = 1LL;
	a %= mod;
	while(n > 0){
		if(n&1) ans = (ans * a) % mod;
		a = (a * a) % mod;
		n /= 2; 
	}
	return ans % mod;
}

void solution(){

	ll n; cin >> n;
	vector<vector<ll>> p;
	for(int i = 0 ; i < n; i++){
		ll x, y; cin >> x >> y;
		p.push_back({x,y});
	}
	vector<ll> sum(n), diff(n);
	for(int i = 0; i < n; i++){
		sum[i] = p[i][0] + p[i][1];
		diff[i] = p[i][0] - p[i][1];
	}
	ll mnd = *min_element(all(diff));
	ll mns = *min_element(all(sum));
	ll mxd = *max_element(all(diff));
	ll mxs = *max_element(all(sum));

	ll ans = max(mxd - mnd, mxs - mns);

	cout << ans << endl;


}	


int main(){ 
	fio;
	int t;
	t = 1;
	// cin >> t;
	for(int i = 1; i <= t; i++){
		// cout << "Case #" << i << ": ";
		solution();
	} 
	return 0;
}

Measured memory_bytes: 17380
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
using namespace std;
using ll = long long;
const ll mod =  1000000007;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP_FROM(i, j, n) for (int i = (j); i < (n); ++i)
#define all(x) (x).begin(),(x).end()

ll power(ll base, ll exponent, ll module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ ll root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
ll inverse(ll x){ return power(x, mod - 2, mod);}
ll gcd(ll a, ll b) {if(a < b) gcd(b, a);ll r;while(r=a%b) {a=b;b=r;}return b;}
struct combination{ vector<ll> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } ll C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

ll dp[500010] = {};

struct UnionFind {
  vector<int> par;

  UnionFind(int n) : par(n, -1) {}
  void init(int n) { par.assign(n, -1); }

  int root(int x) {
    if (par[x] < 0)
      return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y)
      return;
    if (par[x] > par[y])
      swap(x, y);
    par[x] += par[y];
    par[y] = x;
  }

  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
  int size(int x) { return -par[root(x)]; }
};


signed main() {
  ios::sync_with_stdio(false);
  ll m, k;
  cin >> m >> k;
  ll l = power(2, m, mod);
  if(m==0&&k==0){
    cout << "0 0" << endl;
    return 0;
  }
  if(m == 0) {
    cout << -1 << endl;
    return 0;
  }
  if(m==1 && k == 1) {
    cout << -1 << endl;
    return 0;
  }
  if(k>l-1) {
    cout << -1 << endl;
    return 0;
  }
  if(k == 0) {
    REP(i, l) {
      cout << i << " " << i << " ";
    }
    cout << endl;
    return 0;
  }
  REP(i, l) {
    if(i!=k) {
      cout << i << " ";
    }
  }
  cout << k << " ";
  REP(i, l) {
    ll j = l - i - 1;
    if(j!=k) {
      cout << j << " ";
    }
  }
  cout << k << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define x first
#define y second
#define pii pair<int , int>
#define mp make_pair
#define pb push_back
#define sz(a) (int)(a.size())
const int INF = 1000 * 1000 * 1000 + 7;
const ll LINF = INF * (ll)INF;
const int mod = INF;
const int MAX = 1 << 25;
int a[1024][1024];
int b[1024][1024];
int n, m;
void print()
{
	for(int i = 1; i < (1 << n); i++)
		for(int j = 1; j < (1 << m); j++)
			b[i][j] = (a[i - 1][j] ^ a[i][j - 1] ^ a[i - 1][j - 1]) ^ a[i][j];
	for(int i = 1; i < (1 << n); i++)
	{
		for(int j = 1; j < (1 << m); j++)
			cout << b[i][j];
		cout << endl;
	}
	cout << endl;
}
void solve(int n)
{
	for(int i = 1; i <= n; i++)
	{
		int pw2 = (1 << i) , pw22 = (1 << (i - 1));
		for(int j = 0; j < pw2; j++)
			for(int k = 0; k < pw2; k++)
				if(j >= pw22 && k >= pw22)
					a[j][k] = a[j - pw22][k - pw22] ^ 1;
				else if(j >= pw22)
					a[j][k] = a[j - pw22][k];
				else if(k >= pw22)
					a[j][k] = a[j][k - pw22];
	}
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin >> n >> m;
	solve(10);
	print();
}


Measured memory_bytes: 9472
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	long long  a[n+5];
	long long cnt1=0,cnt2=0,sum=0;
	for(int i=0;i<n;i++)
	cin>>a[i];
	sum=0;
	for(int i=0;i<n;i++)
	{
	 sum=sum+a[i];
		if(i%2==0)
		{
			if(sum<=0)
              {
              	
              	cnt1+=(1-sum);
              	sum=1;
              }

		}
		else 
		{
            if(sum>=0)
              {
              	
              	cnt1+=(sum+1);
              	sum=-1;
              }

		}
	}
	sum=0;
		for(int i=0;i<n;i++)
	{
		 sum=sum+a[i];
		if(i%2==1)
		{
			if(sum<=0)
              {
              	
              	cnt2+=(1-sum);
              	sum=1;
              }

		}
		else 
		{
            if(sum>=0)
              {
              	
              	cnt2+=(sum+1);
              	sum=-1;
              }

		}
	}
	cout<<min(cnt1,cnt2)<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

long long mod_inv(long long n)
{
    long long left=MOD-2;  // define MOD!
    long long num=n;
    long long ans=1;
    while(left!=0)
    {
        if(left%2==1)ans=(ans*num)%MOD;
        left/=2;
        num=(num*num)%MOD;
    }
    return ans;
}

int main()
{
  long long n,k;cin>>n>>k;
  vector<long long> a(n);
  long long i;
  for(i=0;i<n;i++)cin>>a.at(i);
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  long long ans=0;
  long long ans1=0;
  long long ans2=0;
  vector<long long> comb_k(n+1,0);
  comb_k.at(k)=1;
  for(i=k+1;i<=n;i++)
  {
    comb_k.at(i)=(comb_k.at(i-1)*((i)*mod_inv(i-k)%MOD))%MOD;
  }
  for(i=0;i<n;i++)
  {
    if(n-i<k)break;
    else if(n-i==k)ans1=(ans1+a.at(i)+MOD)%MOD;
    else
    {
      long long kans=ans1+(comb_k.at(n-i)-comb_k.at(n-i-1)+MOD)%MOD*a.at(i);
      if(kans>=0)ans1=kans%MOD;
      else ans1=(kans+(abs(kans)/MOD+1)*MOD)%MOD;
    }
  }
  reverse(a.begin(),a.end());
  for(i=0;i<n;i++)
  {
    if(n-i<k)break;
    else if(n-i==k)ans2=(ans2+a.at(i)+MOD)%MOD;
    else
    {
      long long kans=ans2+(comb_k.at(n-i)-comb_k.at(n-i-1)+MOD)%MOD*a.at(i);
      if(kans>=0)ans2=kans%MOD;
      else ans2=(kans+(abs(kans)/MOD+1)*MOD)%MOD;
    }
  }
  if(k!=1)cout<<(ans1-ans2+MOD)%MOD<<endl;
  if(k==1)cout<<0<<endl;
}


Measured memory_bytes: 1792
// AtCoder template
// sabaより胡蝶しのぶさんの方が可愛いのではないか？
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; ++i)

struct edge{
    int to_node;
    int cost;
};
vector<vector<edge>> graph(100000);
vector<int> ans(100000);
vector<bool> visited(100000,false);

void dfs(int now, int col){
    ans[now] = col;
    visited[now] = true;
    rep(i,graph[now].size()){
        int next = graph[now][i].to_node, cost = graph[now][i].cost;
        if(!visited[next]){
            if(cost%2) dfs(next, 1-col);
            else dfs(next, col);
        }
    }
}

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

    int n; cin >> n;
    int u,v,w;
    rep(i,n-1){
        cin >> u >> v >> w;
        --u; --v;
        graph[u].push_back(edge{v, w});
        graph[v].push_back(edge{u, w});
    }
    dfs(0,0);
    rep(i,n) cout << ans[i] << "\n";
}

Measured memory_bytes: 8448
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int a, b;
    cin >> a >> b;
    int maxi = max(a+b, a-b);
    cout << max(maxi,a*b);
    cout << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.util.Arrays; 
import java.util.ArrayList; 
import java.util.Collections; 
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.StringTokenizer;
import java.math.BigInteger;

public class Main {

    public static void main(String[] args) {
        try (PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {
            FastScanner in = new FastScanner(System.in);
            
            String x = in.next();
            String y = in.next();
            String w = in.next();
            String z = in.next();

            BigInteger a = new BigInteger(x);
            BigInteger b = new BigInteger(y);
            BigInteger c = new BigInteger(w);
            BigInteger d = new BigInteger(z);

            BigInteger one = a.multiply(c);
            BigInteger two = a.multiply(d);
            BigInteger three = b.multiply(c);
            BigInteger four = b.multiply(d);

            BigInteger biggerInteger1 = one.max(two);
            BigInteger biggerInteger2 = three.max(four);

            out.println(biggerInteger1.max(biggerInteger2));

        } finally {
            //out.close();
        }
        
           
    }
}

class FastScanner {
   private final BufferedReader br;
   private StringTokenizer st;
 
    FastScanner(InputStream InputStream) {
        br = new BufferedReader(new InputStreamReader(InputStream));
    }
    
    String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return st.nextToken();
    }
    
    int nextInt() {
        return Integer.parseInt(next());
    }
    
    long nextLong() {
        return Long.parseLong(next());
    }
    
    double nextDouble() {
        return Double.parseDouble(next());
    }


    
    ArrayList<Integer> nextIntList(int count) {
        ArrayList<Integer> array = new ArrayList<>();
        for (int n = 0; n < count; n++) {
            int number = nextInt();
            array.add(number);
        }
        return array;
    }
    
    int[] nextIntArray(int count) {
        int[] array = new int[count];
        for (int n = 0; n < count; n++) {
            array[n] = nextInt();
        }
        return array;
    }
}

Measured memory_bytes: 33392
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int main(){
  int r;
  cin >> r;
  if(r < 1200)cout << "ABC" << endl;
  else if(r <2800)cout << "ARC" << endl;
  else cout << "AGC" << endl;
}


Measured memory_bytes: 256
import java.util.*;
class Main {
	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        if (N % 2 == 0)
            System.out.println((N / 2));
        else
            System.out.println((N / 2) + 1);

        sc.close();
    }

}


Measured memory_bytes: 21716
s = str(input())
s = sorted(s)
d = [0] * 150
for i in range(len(s)):
    d[ord(s[i])] += 1
for i in range(97,122+1):
    if d[i] == 0:
        print(chr(i))
        break
    if i == 122:
        print("None")

Measured memory_bytes: 4404
// cities to vapori-
// corner cases // int vs ll // cin vs scanf // clear structures // statement // doublesz // math is your friend
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define REP(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
const int N = 2e5+20;

int a[N];

int main(){

	fastio;
	int k,n;
	cin >> k >> n;
	REP(i,0,n) cin >> a[i];
	a[n] = k + a[0];

	int ans = 1e9;
	for(int i = 0; i < n; ++i){
		ans = min(ans,k-(a[i+1]-a[i]));
	}
	cout << ans << endl;

	return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> T(N);
  for(int i=0;i<N;i++)
  {
    cin >> T.at(i);
  }
  
  int M;
  cin >> M;
  
  vector<int> P(M),X(M);
  for(int i=0;i<M;i++)
  {
    cin >> P.at(i) >> X.at(i);
  }
  
  int sum=0;
  
  for(int i=0;i<N;i++)
  {
      sum += T.at(i);
  }
  
  for(int i=0;i<M;i++)
  {
      cout << sum-T.at(P.at(i)-1)+X.at(i) <<endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
  if(b>a)swap(a,b);
  if(a%b==0)return b;
  return gcd(b,a%b);
}
int main(){
  ll t;cin>>t;
  for(ll i=0;i<t;i++){
    ll a,b,c,d;cin>>a>>b>>c>>d;
    if(a<b){
      cout<<"No"<<endl;
      continue;
    }
    if(b>d){
      cout<<"No"<<endl;
      continue;
    }
    if(b<=c+1){
      cout<<"Yes"<<endl;
      continue;
    }
    ll e=gcd(b,d);
    ll wa=a%b;
    if(c<wa){
      cout<<"No"<<endl;
      continue;
    }
    ll syo=(c-wa)/e;
    ll ki=wa+e*syo;
    ki+=e;
    if(ki>c&&ki<b){
      cout<<"No"<<endl;
      continue;
    }
    cout<<"Yes"<<endl;
  }
}
    
    
    
    

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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

ll n,m;
string s;
//Write From this Line

const int mod = 1e9+7;
int main()
{
	cin >> n ;
	vector<pair<int,int>> P(n);
	rep(i,n){
		cin >>P[i].first>>P[i].second; 
	}
	SORT(P);
	
	map<pair<int,int>,int> kasa;
	int ans =  n; 
	int M = 0 ;
	for(int i = 0 ; i < n ;  i ++ ) {
		for ( int  j = i + 1 ; j < n ; j ++){
			int x = P[j].first - P[i].first ;
			int y = P[j].second - P[i].second; 
			pair<int,int> xy = make_pair(x,y);
			kasa[xy] ++;
			chmax(M,kasa[xy]);
		}
	}
	cout << ans-M << endl;

}


Measured memory_bytes: 384
import sys
input = sys.stdin.readline
from itertools import product
INF = 10**9
MOD = 10**9 + 7

def main():
    n,c = map(int,input().split())
    D = [list(map(int,input().split())) for _ in range(c)]
    grid0 = []
    grid1 = []
    grid2 = []
    for i in range(n):
        g = [int(i)-1 for i in input().split()]
        for j in range(n):
            if  (i+j)%3 == 0:
                grid0.append(g[j])
            elif (i+j)%3 == 1:
                grid1.append(g[j])
            else:
                grid2.append(g[j])
        
    
    def drew(grid):
        ans = [[INF,-2] for _ in range(3)] 
        for i in range(c):
            t = 0
            for g in grid:
                t += D[g][i]
            if t < ans[0][0]:
                ans[2] = ans[1]
                ans[1] = ans[0]
                ans[0] = [t,i]
            elif t < ans[1][0]:
                ans[2] = ans[1]
                ans[1] = [t,i]
            elif t < ans[2][0]:
                ans[2] = [t,i]

        return ans
    
    a = drew(grid0)
    b = drew(grid1)
    c = drew(grid2)
    ans = INF 
    for x,y,z in product(a,b,c):
        if  x[1] != y[1] and y[1] != z[1] and z[1] != x[1]:
            ans = min(ans,x[0]+y[0]+z[0])
    
    print(ans)
   
if __name__=='__main__':
    main()


Measured memory_bytes: 5296
#include<bits/stdc++.h>
using namespace std;
int mod(int x)
{
    return(x>=0?x:(-x));
}
int main()
{
    int n;
    cin>>n;
    int h[n];
    int dp[n+1];
    h[0]=0;
    for(int i=1;i<=n;i++)
        cin>>h[i];
        dp[0]=0;
        dp[1]=0;
        dp[2]=mod(h[2]-h[1]);

    for(int i=3;i<=n;i++){
        int mn=INT_MAX;
        for(int j=1;j<=2 ;j++)
            mn=min(mn,dp[i-j]+mod(h[i-j]-h[i]));
        dp[i]=mn;
    }
        cout<<dp[n];

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define x first
#define y second
#define y1 WHO_DEFINE_Y1_IN_HEADER
#define all(v) v.begin(), v.end()
using namespace std;

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

int arr[101010];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, k, q; cin >> n >> k >> q;
	for(int i=1; i<=q; i++){
		int t; cin >> t;
		arr[t]++;
	}
	
	for(int i=1; i<=n; i++){
		if(k - q + arr[i] > 0) cout << "Yes\n";
		else cout << "No\n";
	}
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int cnt = 0;

            for (int i = 0; i < n; i++)
            {
                int input = int.Parse(Console.ReadLine());

                if (IsPrime(input)) cnt++;
            }

            Console.WriteLine(cnt);
        }

        static bool IsPrime(int x)
        {
            if (x < 2) return false;
            if (x == 2) return true;
            if (x % 2 == 0) return false;

            for (int i = 3; i * i <= x; i += 2)
            {
                if (x % i == 0) return false;
            }

            return true;
        }
    }
}

Measured memory_bytes: 9140
def main():
    _ = input()
    P = [int(x) for x in input().split()]
    # minを保持し続ければよい
    ans = 0
    min_val = P[0]
    for p in P:
        if p <= min_val:
            ans += 1
            min_val = p
    print(ans)


if __name__ == "__main__":
    main()


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

#define REP(i, N) for(int i = 0; i < N; ++i)
#define FOR(i, M, N) for(int i = M; i < N; ++i)

using namespace std;

int main() {
	vector<int> food;
	int N, M;
	cin >> N >> M;
	food.resize(M + 1);
	for (int i = 0; i < M; ++i)food[i] = 0;

	for (int i = 0; i < N; ++i) {
		int K;
		cin >> K;
		for (int j = 0; j < K; ++j) {
			int a;
			cin >> a;
			++food[a];
		}
	}
	int count = 0;
	for (int i = 0; i <= M; ++i) {
		if (food[i] == N)++count;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

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

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n,m;
	cin>>n>>m;
	vector<int> l(m),r(m);
	for(int i = 0; i < m; i++){
		cin>>l[i]>>r[i];
	}
	int left = 1,right = n;
	for(int i = 0; i < m; i++){
		left = max(left,l[i]);
		right = min(right,r[i]);
	}

	cout << max(0,right - left + 1) << endl;


	return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define forabr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;

const int INF = 1e9;
const int N = 15;
vector<pii> t[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int ans = 0;
    int N = 1 << n;
    forn(i, n) {
        int m, x, y;
        cin >> m;
        forn(j, m) {
            cin >> x >> y;
            x--;
            t[i].pb({x, y});
        }
    }
    forn(mask, N) {
        bool f = true;
        int cnt = 0;
        forn(i, n) {
            if (mask & (1 << i)) {
                cnt++;
                for (const pii &p : t[i]) {
                    if (((mask & (1 << p.fst)) != 0 && p.snd == 0) || ((mask & (1 << p.fst)) == 0 && p.snd != 0)) {
                        f = false;
                        break;
                    }
                }
            }
            if (!f) break;
        }
        if (f) {
            ans = max(ans, cnt);
        }
    }
    cout << ans << "\n";
    return 0;
}

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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

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

    int x;
    cin >> x;

    __int128_t y = 100;
    int cnt = 0;
    while (y < x) {
        y = (y * 101) / 100;
        cnt++;
    }

    cout << cnt;
}

Measured memory_bytes: 3628
import itertools, math

# input
n = int(input())
P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]

# main
R = list(itertools.permutations(P))
R.sort()
a = 0
b = 0

for i in range(len(R)):
  if list(R[i]) == P:
    a = i + 1
  if list(R[i]) == Q:
    b = i + 1
  if a != 0 and b != 0:
    break

# output
print(abs(b-a))


Measured memory_bytes: 8100
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>
#include <iostream>
#include <algorithm>
using namespace std;

int m[128], costs[128][128];
int calc(int s, int e){
	if(s==e) return 0;
	if(costs[s][e] == INT_MAX){
		if(e-s==1) return costs[s][e] = m[s-1] * m[s] * m[e];
		for(int i = s; i < e; i++){
			costs[s][e] = min(costs[s][e], calc(s, i) + calc(i+1, e) + m[s-1] * m[i] * m[e]);
		}
	}
	return costs[s][e];
}

int main() {
	int n;
	scanf("%d", &n);
	
	for(int i = 0; i < n; i++){
		scanf("%d %d", &m[i], &m[i+1]);
	}
	
	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= n; j++){
			costs[i][j] = INT_MAX;
		}
	}
	
	printf("%d\n", calc(1, n));
	
	return 0;
}

Measured memory_bytes: 1248
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
using namespace std;

int main() {
	int a, b, c, x, y,money=0;
	cin >> a >> b >> c >> x >> y;

	if (2 * c < a + b) {
		if (x < y) { money += (c*x * 2); if (2 * c < b) money += ((y - x)*c * 2);else money += ((y - x)*b); }
		else {money += (y*c * 2);if (2 * c <a) money += ((x - y)*c * 2);else money += ((x - y)*a);
		}
	}
	else {
		money += x * a;
		money += y * b;
	
	}

	cout << money << endl;

	return 0;
}

Measured memory_bytes: 256