akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        long mod = (long)1e9+7;
        long[] digit = new long[61];
        for(int i = 0; i < n; i++){
            long a = sc.nextLong();
            for(int j = 0; j < 61; j++){
                if((a >> j) % 2 == 1){
                    digit[j]++;
                }
            }
        }
        long ans = 0;
        long now = 1;
        for(int j = 0; j < 61; j++){
            ans += now%mod * digit[j]%mod * (n-digit[j])%mod;
            ans %= mod;
            now *= 2L;
        }
        System.out.println(ans);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }
    
    public void close() throws Exception{
        this.reader.close();
        return;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 63176
#include <iostream>
#include <vector>
#include <string>
#define MOD 1000000007

using namespace std;
typedef long long ll;

int main(void) {
	int i;
	string s;
	cin >> s;
	vector<vector<ll>> d(s.size() + 1, vector<ll>(4, 0));
	d[0][0] = 1;
	for (i = 0; i < s.size(); i++) {
		switch (s[i]) {
		case 'A':
			d[i + 1][1] = d[i][0];
			break;
		case 'B':
			d[i + 1][2] = d[i][1];
			break;
		case 'C':
			d[i + 1][3] = d[i][2];
			break;
		case '?':
			d[i + 1][0] = d[i][0] << 1;
			d[i + 1][1] = d[i][0] + (d[i][1] << 1);
			d[i + 1][2] = d[i][1] + (d[i][2] << 1);
			d[i + 1][3] = d[i][2] + (d[i][3] << 1);
			break;
		}
		d[i + 1][0] += d[i][0];
		d[i + 1][1] += d[i][1];
		d[i + 1][2] += d[i][2];
		d[i + 1][3] += d[i][3];
		d[i + 1][0] %= MOD;
		d[i + 1][1] %= MOD;
		d[i + 1][2] %= MOD;
		d[i + 1][3] %= MOD;
	}
	cout << d[s.size()][3] << "\n";
	return 0;
}

Measured memory_bytes: 7424
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int count = 0;
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		char [ ] str = sc.next().toCharArray();
		
		/* debug
		System.out.println(N);
		for(int i = 0; i < str.length; i++) {
			System.out.println(str[i]);
		}
		*/
		
		for(int i = 0; i < N-2; i++) {
			//System.out.println(String.format("%c%c%c", str[i], str[i+1], str[i+2]));
			if(String.format("%c%c%c", str[i], str[i+1], str[i+2]).equals("ABC")) {
				count++;
			}
		}
		
		System.out.println(count);
		
		sc.close();
	}

}


Measured memory_bytes: 21844
using System;
using System.Linq;

    class Program
    {
        static void Main(string[] args)
        {
            var line = System.Console.ReadLine();
            line = System.Console.ReadLine();
            var nums = line.Split(new char[] { ' ' });
            int[] Ps = nums.Select(i => Convert.ToInt32(i)).ToArray();
            int count = 0;
            int min = 0;
            for (int i = 0; i < Ps.Length; i++)
            {
                if (i == 0) { count++; min = Ps[i];  continue; }
                bool countup = true;
                if (Math.Max(Ps[i], min) == Ps[i])
                { countup = false;}
                if (countup) { count++; }
               if (Ps[i] < min) { min = Ps[i]; }
                
            }
            Console.WriteLine(count);
        }
    }

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

int main(){
    string s;
    cin >> s;
    int ans = 1e9;
    for(int i = 0; i < s.size() - 2; i++){
        int tmp = stoi(s.substr(i, 3));
        ans = min(ans, abs(tmp - 753));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
s=[]
for i in range(n):
  if l[i][0]==l[i][1]:
    s.append(1)
  else:
    s.append(0)
g=[]
for i in range(n-2):
  g.append(s[i]*s[i+1]*s[i+2])
ok=0
for i in range(n-2):
  if g[i]==1:
    ok=1
    break
if ok==1:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 9156
#include<iostream>

using namespace std;

int main() {
	int x, b, max = 0;

	cin >> x;

	for (int i = 1; i <= x; i++) {
		b = i * i;
		for (int j = 1; j <= x; j++) {
			if (b > x) {
				break;
			}
			else if (b <= x && b > max) {
				max = b;
			}
			b *= i;
		}
	}

	cout << max << endl;

	return 0;
}

Measured memory_bytes: 256
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
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; }
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

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

    int n;
    cin>>n;
    vector<pair<int,int>> a(n+1);
    rep1(i,n) {int b;cin>>b; a[i]=make_pair(b,i);}

    sort(a.begin(),a.end());
    rep1(i,n){
      cout<<a[i].second<<" ";
    }
}

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

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

int X;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>X;
	int g=__gcd(X,360);
	cout<<360/g<<endl;
	
}


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


Measured memory_bytes: 3612
n, y=gets.split.map(&:to_i)

0.upto n do |i|
  0.upto n-i do |j|
    k=n-i-j
    next if k<0
    if 10000*i+5000*j+1000*k==y
      puts "#{i} #{j} #{k}"
      exit 0
    end
  end
end

puts "-1 -1 -1"

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

using namespace std;

int main()
{
    #ifdef LOCAL_EXEC
    #else
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #endif // LOCAL_EXEC
    long long int i;
    bool x=true;
    string s,t;
    cin>>s>>t;
    for(i=0;i<s.size();i++){
        if(s[i]!=t[i])
            x=false;
    }
    if(x==true)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	a--;
	ll k = c / gcd(c, d) * d;
	ll ans = 0;
	ans += b - (b / c + b / d - b / k);
	ans -= a - (a / c + a / d - a / k);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a,b,c;
    cin >> a >> b >> c;
    bool ok = false;
    REP(i,1,b+1) {
        if ((i*a)%b == c) {
            ok = true;
        }
    }
    if (ok)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    
}


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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

int main()
{
	for(int n;cin>>n && n;){
		vvi a(n,vi(4));
		rep(i,n) rep(j,4) cin>>a[i][j];
		sort(all(a),[](const vi& a,const vi& b){
			if(a[2]!=b[2]) return a[2]>b[2];
			if(a[3]!=b[3]) return a[3]<b[3];
			return a[0]<b[0];
		});
		
		map<int,int> f;
		vi res;
		for(int i=0;i<n && res.size()<26;i++)
			if(res.size()<10){
				if(f[a[i][1]]<3){
					res.push_back(a[i][0]);
					f[a[i][1]]++;
				}
			}
			else if(res.size()<20){
				if(f[a[i][1]]<2){
					res.push_back(a[i][0]);
					f[a[i][1]]++;
				}
			}
			else if(res.size()<26){
				if(f[a[i][1]]==0){
					res.push_back(a[i][0]);
					f[a[i][1]]++;
				}
			}
		for(int x:res) cout<<x<<endl;
	}
}

Measured memory_bytes: 1232
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }

int main(){
	ll t ; cin >> t ;
	while(t--){
		ll n ; cin >> n ;
		vector<pair<ll,pll>> a(0),b(0) ;
		ll ans = 0 ;
		for(int i=0;i<n;i++){
			ll k,l,r ;
			cin >> k >> l >> r ;
			if(l<r){
				b.push_back(make_pair(n-k-1,make_pair(l,r))) ;
			}else if(l>r){
				a.push_back(make_pair(k-1,make_pair(l,r))) ;				
			}else{
				ans += l ;
			}
		}
		sort(all(a)) ; reverse(all(a)) ;
		sort(all(b)) ; reverse(all(b)) ;
		vb usea(a.size(),true),useb(b.size(),true) ;
		priority_queue<pair<pll,ll>> pqa,pqb ;
		ll posa=0,posb=0 ;
		for(int i=(int)a.size()-1;i>=0;i--){
			while(posa<(int)a.size()&&a.at(posa).first>=i){
				pqa.push(make_pair(make_pair(a.at(posa).second.first-a.at(posa).second.second,-a.at(posa).second.second),posa)) ;
				posa++ ;
			}
			if(!pqa.empty()){
				ans += pqa.top().first.first-pqa.top().first.second ;
			}
			if(!pqa.empty()){
				usea.at(pqa.top().second) = false ;
				pqa.pop() ;
			}
		}
		for(int i=0;i<(int)a.size();i++) if(usea.at(i)) ans += a.at(i).second.second ;
		for(int i=(int)b.size()-1;i>=0;i--){
			while(posb<(int)b.size()&&b.at(posb).first>=i){
				pqb.push(make_pair(make_pair(b.at(posb).second.second-b.at(posb).second.first,-b.at(posb).second.first),posb)) ;
				posb++ ;
			}
			if(!pqb.empty()){ 
				ans += pqb.top().first.first-pqb.top().first.second ;
			}
			if(!pqb.empty()){
				useb.at(pqb.top().second) = false ;
				pqb.pop() ;
			}
		}
		for(int i=0;i<(int)b.size();i++) if(useb.at(i)) ans += b.at(i).second.first ;
		cout << ans << endl ;
	}
}

Measured memory_bytes: 13628
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#define N 100005
using namespace std;

int n, s, x[N];
long long p[N];

int main() {
#ifdef whyqx
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    cin >> n >> s;

    if (n == 0) return puts("0"), 0;

    for (int i = 1; i <= n; ++i)
        scanf("%d%lld", x + i, p + i);

    long long ans = 0;
    int l = 1, r = n;
    int t = p[1] >= p[n] ? x[n] : x[1];

    while (true) {
        if (s < x[l] || s > x[r]) break;
        if (p[l] >= p[r]) p[l] += p[r], --r, ans += abs(x[l] - t), t = x[l];
        else p[r] += p[l], ++l, ans += abs(x[r] - t), t = x[r];
    }

    if (x[r] < s) ans += s - min(x[l], t);
    else ans += max(x[r], t) - s;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408
grid = [list(map(int, input().split())) for i in range(3)]
b0_1 = set()
b1_2 = set()
a0_1 = set()
a1_2 = set()

for a in range(3):
    b0_1.add(grid[a][0] - grid[a][1])
    b1_2.add(grid[a][1] - grid[a][2])

for b in range(3):
    a0_1.add(grid[0][b] - grid[1][b])
    a1_2.add(grid[1][b] - grid[2][b])

if len(b0_1) == 1 and len(b1_2) == 1 and len(a0_1) == 1 and len(a1_2) == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;


int main() {
    char c;
    cin >> c;
    printf("%c",c+1);
}

Measured memory_bytes: 768
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main() {
	map <char, int> a;
	a.insert(map<char, int>::value_type('I', 1));
	a.insert(map<char, int>::value_type('V', 5));
	a.insert(map<char, int>::value_type('X', 10));
	a.insert(map<char, int>::value_type('L', 50));
	a.insert(map<char, int>::value_type('C', 100));
	a.insert(map<char, int>::value_type('D', 500));
	a.insert(map<char, int>::value_type('M', 1000));
	string c;
	while (cin >> c) {
		string d="";
		for (int i = c.length() - 1; i >= 0; i--)
			d += c[i];
		int sum = 0, e = 0;
		for (int i = 0; i < c.length(); i++) {
			if (a[d[i]] >= e) {
				sum += a[d[i]];
				e = a[d[i]];
			}
			else {
				sum -= a[d[i]];
			}
		}
		cout << sum << endl;
	}
}

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

const int M = 1000005;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<int> count(M);
  for (int x : a) {
    //重複を除く部分
    if (count[x] != 0) {
      count[x] = 2;
      continue;
    }
    //メイン部分
    for (int i = 0; i < M; i += x) count[i]++;
  }
  int ans = 0;
  for (int x : a) {
    if (count[x] == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}

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

#define MAXSTACKED 100
#define MAXOP 1000000

int g_cnt = 0;

void plus(int stack[]);
void minus(int stack[]);
void times(int stack[]);

int main(void)
{
    int stack[MAXSTACKED];

    char symbol[MAXOP];
    while (scanf("%s", symbol) != EOF) {
        if (symbol[0] == '+') {
            plus(stack);
        } else if (symbol[0] == '-') {
            minus(stack);
        } else if (symbol[0] == '*') {
            times(stack);
        } else {
            stack[g_cnt++] = atoi(symbol);
        }
/*        for (int i = 0; i < g_cnt; i++) {
            printf("%d ", stack[i]);
        }
        printf("\n");*/
    }

    printf("%d\n", stack[0]);

    return 0;
}

void plus(int stack[])
{
    int op1 = stack[--g_cnt];
    int op2 = stack[--g_cnt];
    stack[g_cnt++] = op1 + op2;
}

void minus(int stack[])
{
    int op2 = stack[--g_cnt];
    int op1 = stack[--g_cnt];
    stack[g_cnt++] = op1 - op2;
}

void times(int stack[])
{
    int op1 = stack[--g_cnt];
    int op2 = stack[--g_cnt];
    stack[g_cnt++] = op1 * op2;
}

Measured memory_bytes: 556
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
    int n, k; cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    sort(h.rbegin(), h.rend());
    for (int i = 0; i < k; i++) {
        if (i >= n) break;
        h[i] = 0;
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ans += h[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;

int main() {
    int N, M, A[300][300], ans = 999999, players[300];
    bool s[300];
    cin >> N >> M;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            cin >> A[i][j];
            A[i][j]--;
        }
    }

    for (int i = 0; i < M; i++) {
        s[i] = true;
        players[i] = 0;
    }

    for (int i = 0; i < M; i++) {
        for (int i = 0; i < M; i++) players[i] = 0;
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < M; k++) {
                if (!s[A[j][k]]) continue;
                players[A[j][k]]++;
                break;
            }
        }

//        for (int i = 0; i < M; i++) cout << players[i] << endl;
//        cout << endl;

        int mxS = 0;
        int mxV = -1;
        for (int j = 0; j < M; j++) {
            if (mxV < players[j]) {
                mxS = j;
                mxV = players[j];
            }
        }
        ans = min(ans, players[mxS]);
//        cout << "ans: " << ans << endl;
        s[mxS] = false; // スポーツを削除
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using u64 = uint_fast64_t;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln = '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////


template<typename T, typename Monoid>
struct SlidingWindowAggregation {
    Monoid merge;
    T unity;
    vector<pair<T, T>> front, back;

    SlidingWindowAggregation(Monoid f, T id) : merge(f), unity(id) {}

    bool empty() const {return front.empty() and back.empty();}

    int size() const {return front.size() + back.size();}

    T fold_all() const {
        T vf = front.empty() ? unity : front.back().second;
        T vb = back.empty() ? unity : back.back().second;
        return merge(vf,vb);
    }

    void emplace(const T &val) {
        if (back.empty()) {
            back.emplace_back(val,val);
        } else {
            back.emplace_back(val,merge(back.back().second,val));
        }
    }

    void pop() {
        assert(!empty());
        if (front.empty()) {
            front.emplace_back(back.back().first,back.back().first);
            back.pop_back();
            while (!back.empty()) {
                front.emplace_back(back.back().first,merge(back.back().first,front.back().second));
                back.pop_back();
            }
        }
        front.pop_back();
    }
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    auto f=[](ll a, ll b) {return (a^b);};
    auto g=[](ll a, ll b) {return a+b;};
    const ll id = 0;
    SlidingWindowAggregation L(f,id);
    SlidingWindowAggregation R(f,id);
    ll ans = 0;
    for (int l = 0, r = 0; l < N; l++) {
        if (r < l) r = l;
        while (r < N and f(L.fold_all(),A[r]) == g(R.fold_all(),A[r])) {
            L.emplace(A[r]);
            R.emplace(A[r]);
            r++;
        }
        ans += r-l;
        if (!L.empty()) {
            L.pop();
            R.pop();
        }
    }

    cout << ans << ln;
}


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

int main(){
  int n, m;
  cin >> n >> m;
  int a[n][m];
  int b[m], c[n];

  for(int i=0; i<n; i++){
    for(int j=0; j<m; j++){
      cin >> a[i][j];
    }
    c[i]=0;
  }

  for(int i=0; i<m; i++){
    cin >> b[i];
  }

  for(int i=0; i<n; i++){
    for(int j=0; j<m; j++){
      c[i] += a[i][j]*b[j];
    }
  }

  for(int i=0; i<n; i++){
    cout << c[i] << endl;
  }

  return 0;
}



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

using namespace std;

int main() {
    int n,k = 0;
    cin >> n >> k;

    int array[n] = {0};
    int a,d = 0;

    for(int i = 0 ; i < k ; i++){
        cin >> d;
        for(int j = 0; j < d ; j++){
            cin >> a;
            array[a - 1] ++;
        }
    }

    int counter = 0;

    for(int i = 0; i < n ; i++){
        if(array[i] == 0){
            counter ++;
        }
    }
    
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll k,a,b;cin>>k>>a>>b;
  if(b<a+2){
    cout<<k+1<<endl;
    return 0;
  }
  ll ans=0;
  if(k<a+1){
    cout<<k+1<<endl;
    return 0;
  }
  ans+=b;
  k-=a+1;
  for(;;){
    if(k<2)break;
    k-=2;
    ans=ans-a+b;
  }
  if(k==1)ans++;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>

using namespace std;


#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl

#define Tof(x) (x) ? Yes : No
#define TOF(x) (x) ? YES : NO
#define tof(x) (x) ? yes : no

using ll = long long;

constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;


/*vectorの要素を全部確認するやつだよ。普通に拡張for文したほうがいいよ。

for (vector<int>::iterator itr = ans.begin(); itr != ans.end(); ++itr) {
	cout << *itr << " ";
}

*/


/*for文でx,yを上下左右確認するやつだよ。正直使いづらいよ。

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


for (int i = 0; i < 4; i++) {
	int ny = y + dy[i];
	int nx = x + dx[i];
}

*/


/*繰り返し二乗法だよ。modもとってくれるよ。n^kをmodで割った余りでやってくれるよ。

ll POW_MOD(ll n, ll k, ll mod) {
	ll r = 1;

	for (; k > 0; k >>= 1) {
		if (k & 1) {
			r = (r * n) % mod;
		}
		n = (n * n) % mod;
	}
	return r;
}

*/


/*実行開始からの経過時間を表すよ。

while (clock() < 1900000) {  }

*/


/*まだ使えないテクニックのメモだよ。

for (int bit = 0; bit < (1<<n); ++bit)//bit全探索用のfor文だよ

*/


/*2重for文書くのめんどくなった時用だよ。

for (int i = 0; i < h; ++i) {
	for (int j = 0; j < w; ++j) {

	}
}

*/

bool ss(int n) {
	if (n == 0 || n == 1) { return false; }


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

	return true;

}

int main(){

	while (1) {
		int a, d, n; cin >> a >> d >> n;
		if (a == 0 && d == 0 && n == 0) { return 0; }

		int i = 1;

		if (ss(a)) { n--; }

		while (n) {
			a += d;
			if (ss(a)) { n--; }
		}

		cout << a << endl;

	}


	return 0;
}



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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  int n, r; scanf("%d%d", &n, &r);
  if (n < 10) {
    printf("%d", r+100*(10-n));
  } else {
    printf("%d", r);
  }
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3796
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mx 100000000
#define pb push_back
#define mp make_pair
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define all(v) (v).begin(),(v).end()


ll md=1e9+7;
ll __gcd(ll a, ll b) {if(b==0) return a; return __gcd(b, a%b);}
ll poww(ll a, ll b) {ll res=1;while(b) {if(b&1){res*=a;res%=md;}a*=a;a%=md;b>>=1;}return res;}
void ainp(int arr[], int n) {for(int i=0;i<n;i++) cin>>arr[i];}

const ll N=3e5+5;

void fun()
{ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}


signed main()
{  
fun();
int t;
//cin>>t;
t=1;
while(t--)
{
	int n;
	cin>>n;
	if(n>=30)
	Yes
	else
	No
}
}



Measured memory_bytes: 3596
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define INF 100000000000000000

int main(){
  long long n;
  cin >> n ;
  long long a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  long long ans = 0;
  long long l = 0,r = 0;
  while(r < n){
    while(r < n && a[l] == a[r]){
      r += 1;
    }
    ans += (r-l)/2;
    l = r;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < (int)n;i++)
#define repb(i, n) for(int i = (int)n;i >= 0;i--)
#define reps(i, m, n) for(int i = (int)m;i < (int)n;i++)
#define repsb(i, m, n) for(int i = (int)m;i >= (int)n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
using namespace std;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
int main(int argc, char const *argv[]) {
    int n,cnt=0,c=0;
    cin>>n;
    vector<int> v(n,0);
    rep(i,n){
      cin>>v[i];
    }
    vector<int> num(8,0);
    rep(i,v.size()){
        rep(j,num.size()){
            if(v[i]<(j+1)*400){
                num[j]++;
                break;
            }
        }
        if(v[i]>=3200)  cnt++;
    }
    //cout<<"cnt"<<cnt<<endl;
    rep(i,num.size()){
        if(num[i]>0)  c++;
    }
    if(c!=0)  cout<<c<<" "<<c+cnt<<endl;
    else  cout<<1<<" "<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln = '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll N,K; cin >> N >> K;
    vector<ll> p(N),C(N);
    rep(i,N) {
        cin >> p[i];
        --p[i];
    }
    rep(i,N) cin >> C[i];

    vector<vector<ll>> A(31, vector<ll>(N));
    auto B = A;
    auto pos = A;
    rep(i,N) {
        A[0][i] = C[p[i]];
        B[0][i] = C[p[i]];
        pos[0][i] = p[i];
    }
    rep(i,30) {
        rep(j,N) {
            pos[i+1][j] = pos[i][pos[i][j]];
            A[i+1][j] = A[i][j] + A[i][pos[i][j]];
            B[i+1][j] = max(B[i][j],A[i][j]+B[i][pos[i][j]]);
        }
    }
    ll ans = -1e18;
    vector<ll> tmp(N),cur(N);
    iota(all(cur),0);
    for (int bit = 30; bit >= 0; bit--) {
        if ((K>>bit)&1) {
            rep(i,N) {
                chmax(ans,tmp[i]+B[bit][cur[i]]);
                tmp[i] += A[bit][cur[i]];
                cur[i] = pos[bit][cur[i]];
            }
        }
    }

    cout << ans << ln;
}

Measured memory_bytes: 7140
import bisect
S=input()
T=input()

A=set(S)
B=set(T)

if B-A:print(-1)
else:
    d={}
    for b in B:
        d[b]=[i for i in range(len(S)) if S[i]==b]
    c=-1
    p=0
    for t in T:
        idx=bisect.bisect_right(d[t],c)
        if idx == len(d[t]):
            c=d[t][0]
            p+=1
        else:
            c=d[t][idx]
    print(len(S)*p+c+1)

Measured memory_bytes: 7284
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main () {
	int sizeA;
	cin >> sizeA;
	
	vector<int> argA(sizeA);
	for (uint i = 0; i < sizeA; ++i) {
		cin >> argA.at(i);
	}

	int ret = 30;
	for (int i = 0; i < sizeA; ++i) {
		for (int j = 0; j < 30; ++j) {
			uint bit = (1 << j);
			
			if (argA.at(i) & bit) {
				ret = min(ret, j);
				break;
			}
		}
	}

	cout << ret << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;main(){int r[6]={0},n,l,k;char c;for(cin>>n;n;n--){cin>>l>>c>>k;l>185?l=185:l;l<165?l=160:l;r[l/5-32]++;}for(int i=0;i<6;i++){for(cout<<i+1<<":";r[i];r[i]--)cout<<"*";cout<<endl;}}

Measured memory_bytes: 0
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
	int N;
    cin >> N;
  	int A[5];
    string ans = "Good";
  	A[0] = N/1000;
    A[1] = (N-A[0]*1000)/100;
    A[2] = (N-A[0]*1000-A[1]*100)/10;
  	A[3] = (N-A[0]*1000-A[1]*100-A[2]*10);
  	A[4] = 10;
  
  	for(int i = 0; i < 4; i++){
		cerr << A[i+1] << endl;
      	if(A[i+1] == A[i]) ans = "Bad";
    }
  	
  	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <utility>
#include <map>
#include <vector>
#include <climits>
#include <set>
#include <cmath>
#include <stdlib.h>

#define max_n 100001

using namespace std;

int main()
{
    int n; cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    int gcd = v[0];
    for (int i = 1; i < n; i++)
    {
        gcd = __gcd(gcd, v[i]);
    }
    if (gcd != 1) 
    {
        cout << "not coprime" << endl;
        return 0; 
    }
    set<int> s;
    for (int i = 0; i < n; i++)
    {
        vector<int> p_factors;
        for (int j = 2; j * j <= v[i]; j++)
        {
            if (v[i] % j == 0)
            {
                p_factors.push_back(j);
                while (v[i] % j == 0) v[i] /= j;
            }
        }
        if (v[i] != 1) p_factors.push_back(v[i]);
        for (auto p : p_factors)
        {
            if (s.find(p) != s.end())
            {
                cout << "setwise coprime" << endl;
                return 0; 
            }
            else s.insert(p);
        }
    }
    cout << "pairwise coprime" << endl;
    return 0;
}

Measured memory_bytes: 7276
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;

typedef long long ll;
#define READ(a) int a; cin >> a;
#define READARR(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define READMAT(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
#define pb(x) push_back(x)
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int a, b;
	cin >> a >> b;
	cout << max({a + b, a - b, a * b});
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>

int main()
{
	int H, W;
	std::vector<std::string> S;
	
	std::cin >> H >> W;
	S.resize(H);
	for (auto& s : S) {
		std::cin >> s;
	}

	std::vector<std::vector<int>> hlv;
	std::vector<std::vector<int*>> hlp;
	std::vector<std::vector<int>> vlv;
	std::vector<std::vector<int*>> vlp;
	hlv.resize(H);
	hlp.resize(H);
	vlv.resize(H);
	vlp.resize(H);
	for (int y = 0; y < H; ++ y) {
		hlv[y].resize(W);
		hlp[y].resize(W);
		vlv[y].resize(W);
		vlp[y].resize(W);
	}

	int* pos;
	for (int y = 0; y < H; ++y) {
		pos = NULL;
		for (int x = 0; x < W; ++x) {
			if (S[y][x] == '#') {
				pos = NULL;
				continue;
			}
			if (pos == NULL) {
				pos = &hlv[y][x];
			}
			hlp[y][x] = pos;
			++*pos;
		}
	}

	for (int x = 0; x < W; ++x) {
		pos = NULL;
		for (int y = 0; y < H; ++y) {
			if (S[y][x] == '#') {
				pos = NULL;
				continue;
			}
			if (pos == NULL) {
				pos = &vlv[y][x];
			}
			vlp[y][x] = pos;
			++*pos;
		}
	}

	int result = 0;
	for (int y = 0; y < H; ++y) {
		for (int x = 0; x < W; ++x) {
			if (S[y][x] != '#')
				result = std::max(result, *hlp[y][x] + *vlp[y][x]);
		}
	}
	
	std::cout << (result - 1) << "\n";
}


Measured memory_bytes: 98432
program main
integer ::a,b,c,d,e1=1,e2=1,i,j
integer,allocatable :: x(:),y(:)

read(*,*)a,b,c,d
allocate(x(a),y(b))
read(*,*)x(1:a)
read(*,*)y(1:b)
do i=c+1,d-1
	e1 = 1
    e2 = 1
	do j =1,a
    	if (x(j)>=i) then
        	e1=0
            exit
        end if
    end do
    do j =1,b
    	if (y(j)<i) then
        	e2=0
            exit
        end if
    end do
    if (e1==1 .and. e2==1) exit
end do
if(e1==1 .and. e2==1) then
	write(*,*)"No War"
else 
	write(*,*)"War"
end if
end program


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

using namespace std;

int main() {

	string s;
	cin >> s;

	long st, ed;
	for (long i = 0; i < s.size(); i++) {

		if (s[i] == 'A') { st = i; break; }
	}
	for (long i = 0; i < s.size(); i++) {
		if (s[s.size() - 1 - i] == 'Z') { ed = s.size() - 1 - i; break; }
	}
	cout << ed - st + 1 << endl;
}

Measured memory_bytes: 640
from math import gcd
N, K = map(int, input().split())
A = list(map(int, input().split()))

if K > max(A):
    print("IMPOSSIBLE")
    exit()

x = A[0]

for i in range(1, N):
    x = gcd(A[i], x)

if K%x == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 20380
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <array>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	long long n; cin >> n;
	long long ans = 0;

	for (long long a = 1; a <= n; a++) {
		long long lb = 1, hb = n / a;
		if (n % a == 0) hb--;

		ans += hb - lb + 1;
	}

	cout << ans;

	return 0;
}

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

#define ll long long
#define mtv(kit) cout<<#kit<<" - "<<kit<<"\n";
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map

void doit(){
	ll n,k,i;
	cin >> n >> k;
	vector< ll >v(n);
	for(i = 0; i < n; i++)cin>>v[i];
	rep(i,k,n){
		if(v[i] > v[i-k])cout << "Yes" << nl;
		else cout << "No" << nl;
	}
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    for(ll i = 1; i <= t; i++){
    	//cout <<"Case #"<<i<<':'<<nl;
        doit();
    }
}


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

int main(){
    int n, m; cin >> n >> m;
    if(n >= m){
        cout << 0 << endl;
    }
    else{
    vector<int> dist(m);
    for(int i = 0; i < m; i++){
        cin >> dist.at(i);
    }
    sort(dist.begin(), dist.end());
    vector<int> diff(m-1);
    int sum = 0;
    for(int i = 0; i < m-1; i++){
        diff.at(i) = dist.at(i + 1) - dist.at(i);
        sum += diff.at(i);
    }
    sort(diff.begin(), diff.end(), greater<int>());
    for(int i = 0; i < n - 1; i++){
        sum -= diff.at(i);
    }
    cout << sum << endl;
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    double a, b;
    cin >> a >> b;
    cout << a / b;
}


Measured memory_bytes: 256
# D
import numpy as np
n,w = map(int, input().split())
 
items = list(map(int, input().split()) for _ in [0]*n)
dp = np.zeros(w+1, dtype='int64')
 
for weight, value in items:
    dp[weight:] = np.maximum(dp[weight:], dp[:w-weight+1] + value)
print(dp.max())

Measured memory_bytes: 15524
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
const int inf = 1000000000; //10^9
const ll MOD = 1e9 + 7;
//加算代入演算子は+=！！！！！
//int 2^31 10^9まで
int calc_digit(ll n)
{
    int res = 0;
    while (n > 0)
    {
        res++;
        n /= 10;
    }
    return res;
}
int main()
{
    ll N;
    cin >> N;
    ll res = inf;
    for (ll a = 1; a * a <= N; ++a) {
        if (N % a != 0) {
            continue;
        }
        ll b = N / a;
        ll temp = max(calc_digit(a), calc_digit(b));
        res = min(res, temp);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include<iostream>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;


struct attend{
  long num;
  long seq;
};

bool comp(const attend &b, const attend &c){
  return b.seq < c.seq;
}
int main(){
  lll ii,jj,kk;
  lll n;
  vector<attend> a,trans;
  cin >> n;
  a.resize(n);

  for(ii=0;ii<n;ii++){
    a[ii].num = ii+1;
    cin >> a[ii].seq;
  }
  sort(a.begin(),a.end(),comp);

  for(ii=0;ii<n;ii++){
    cout << a[ii].num << " " ;
  }
  cout << endl;
  return 0;
}


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


int pcnt(int x) {
  return __builtin_popcount(x);
}

int f(int x) {
  if(x == 0) return 0;
  return f(x%pcnt(x))+1;
}

int main() {
  int n;
  string s;
  cin >> n >> s;
  int cnt1 = 0;
  vector<int> x(n);
  rep(i,n) x[i] = s[i]-'0';
  rep(i,n) cnt1 += x[i];
  vector<int> ans(n);
  rep(b,2) {
    int cnt2 = cnt1;
    if(b==0) cnt2++; else cnt2--;
    if(cnt2 <= 0) continue;
    int r0 = 0;
    rep(i,n) {
      r0 = (r0*2)%cnt2;
      r0 += x[i]; 
    }
    int k = 1;
    for(int i = n-1; i >= 0; i--) {
      if(x[i] == b) {
        int r = r0;
        if(b==0) r = (r+k)%cnt2;
        else r = (r-k+cnt2)%cnt2;
        ans[i] = f(r)+1;
      }
      k = (k*2)%cnt2;
    }
  }
  
  rep(i,n) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 5088
n = int(input())
G = [[] for _ in range(n)]
edge  = []
for _ in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    edge.append(b)

from collections import deque

q = deque()
color = [0]*n
q.append(0)
while q:
    cur = q.popleft()
    c = 1
    for nx in G[cur]:
        if color[cur] == c:
            c += 1
        color[nx] = c
        c += 1
        q.append(nx)

print(max(color))
for e in edge:
    print(color[e])

Measured memory_bytes: 91212
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
typedef long long int ll; 
typedef long double ld; 


int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
			
	ll n;
	cin>>n;
	
	ll arr[n];
	
	for(ll i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	
	ll ma = 1e18;
	ll mul = 1;
	sort(arr, arr + n);
	for(ll i=0;i<n;i++)
	{
		if(arr[i]!=0)
		if((ma/arr[i]) < mul)
		{
			mul = -1;
			break;
		}
		mul = mul*arr[i];
	}
	
	cout<<mul<<endl;
	
}



























Measured memory_bytes: 4440
#include <cstdio>

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

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

int main() {
    int A, B;
    cin >> A >> B;
    if (A == 1){
        A = 14;
    }
    if (B == 1){
        B = 14;
    }
    if (A > B){
        cout << "Alice" << endl;
    }
    else if (B > A){
        cout << "Bob" << endl;
    }
    else{
        cout << "Draw" << endl;
    }
}

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

using uli = unsigned long int;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define repa(a,i,x) for(int i=a;i<=x;i++)

int main(){
	int N,M;
	cin >> N >> M;
	int a[N];
	rep(i,N) 	cin >> a[i];
	
	uli all=0;
	rep(i,N) all+=a[i];
	uli chk=all/(4*M);
  	if(all%(4*M)!=0)chk++;
	int cnt=0;
	
	rep(i,N) if(a[i]>=chk) cnt++;
	
	if(cnt>=M) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int n,m;
	cin>>n;
	set<string> st;
	string s[n];
	rep(i,n){
		cin>>s[i];
		st.insert(s[i]);
	}
	cin>>m;
	string t[m];
	rep(i,m){
		cin>>t[i];
		st.insert(t[i]);
	}
	int ans=0,sum;
	for(set<string>::iterator ite=st.begin();ite!=st.end();ite++){
		string tmp=*ite;
		sum=0;
		rep(i,n)if(s[i]==tmp)sum++;
		rep(i,m)if(t[i]==tmp)sum--;
		ans=max(ans,sum);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256