akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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;
}

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   int N;
   cin >> N;
   int H[N];
   for (int i = 0; i < N; i++) cin >> H[i];
   for (int i = N - 1; i > 0; i--) {
      if (H[i - 1] <= H[i]) continue;
      else if (H[i - 1] == H[i] + 1) H[i - 1]--;
      else {
         cout << "No" << endl;
         return 0;
      }
   }
   cout << "Yes" << endl;
   return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1000000007;
signed main(){
  int N;
  cin>>N;
  int ans=0,cnt=0;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    ans=(ans+a*cnt%mod)%mod;
    cnt=(cnt+a)%mod;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void primeFactors(ll n,vector<ll>&fac) 
{ 
    ll p=1;
    while (n%(2*1ll) == 0) 
    { 
        p*=2;
        fac.push_back(p);
        n = n/2; 
    } 
    for (int i = 3; i <= sqrt(n); i = i+2) 
    { 
        p=1;
        while (n%i == 0) 
        { 
            p*=i;
            fac.push_back(p); 
            n = n/i; 
        } 
    } 
    if (n > 2) 
        fac.push_back(n); 
} 
int main() {
    ll n;
    cin>>n;
    vector<ll>fac;
    fac.reserve(10000000);
    primeFactors(n,fac);
    sort(fac.begin(),fac.end());
    ll ans=0;
    ll i=0;
    // for(auto it :fac)
    // cout<<it<<" ";
    // cout<<"\n";
    while(n>1 && i<fac.size())
    {
        if(n%fac[i]==0)
        {
            n=n/fac[i];
            ans++;
        }
        i++;
    }
    cout<<ans<<"\n";
	return 0;
}

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

int main() {
    int H, W;
    while(cin >> H >> W, H) {
        vector<vector<int>> tatami(H, vector<int>(W, -1));

        auto cond_check = [&](int y, int x) {
            return y == 0 || x == 0
            || tatami[y - 1][x - 1] == tatami[y - 1][x] || tatami[y][x - 1] == tatami[y][x]
            || tatami[y - 1][x - 1] == tatami[y][x - 1] || tatami[y - 1][x] == tatami[y][x];
        };

        long long id = 0;
        function<int(int, int)> solve = [&](int y, int x) {
            if(y == H - 1 && x == W - 1 && tatami[y][x] != -1) return 1;
            if(x >= W) return solve(y + 1, 0);
            if(tatami[y][x] != -1) return solve(y, x + 1);
            if(!cond_check(y, x)) return 0;

            int res = 0;
            if(y + 1 < H) { // put vert
                tatami[y][x] = tatami[y + 1][x] = id++;
                res += solve(y, x + 1);
                tatami[y][x] = tatami[y + 1][x] = -1;
            }
            if(x + 1 < W && tatami[y][x + 1] == -1) { // put hori
                tatami[y][x] = tatami[y][x + 1] = id++;
                res += solve(y, x + 1);
                tatami[y][x] = tatami[y][x + 1] = -1;
            }

            return res;
        };

        cout << solve(0, 0) << endl;
    }
}



Measured memory_bytes: 3136
#include <string>
#include <algorithm>
#include <vector> 
#include <math.h>
#include <iostream>
#include <cmath>
#include <random>
using namespace std;
long long mod = 1000000000 + 7;


int main()
{
	long long h, n, ain;
	vector<long long> a;
	cin >> h >>n;
	
	for (int i = 0; i < n; i++) {
		cin >> ain;
		a.push_back(ain);
	}

	
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		sum = sum + a[i];
	}
	if (sum >= h) {
		cout << "Yes"<< endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;

}


Measured memory_bytes: 1400
#include<stdio.h>
#include<string.h>
int main()
{
    char a[20],b[20],c[20];
    scanf("%s %s %s",a,b,c);
    int la,lb,lc;
    la=strlen(a);
    lb=strlen(b);
    lc=strlen(c);
    if(a[la-1]==b[0]&&b[lb-1]==c[0]) printf("YES\n");
    else printf("NO\n");
}

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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+123;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};       ///first 4 for adjacent
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};
ll dx8[]= {+1, +1, -1, -1, +2, +2, -2, -2};    ///knights move
ll dy8[]= {+2, -2, +2, -2, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define MP make_pair
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ a%=MOD;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=MOD;--b;}a*=a;a%=MOD;b/=2;}return pr;}
ll modinverse(ll a){return powmod(a,MOD-2);}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///



void _case()
{
    ll n,m,i,x,ans=0;
    cin>>n>>m;
    map<ll,ll> ac,wa;
    string a;
    while(m--){
        cin>>x>>a;
        ///cout<<x sp<<a el;
        if(ac[x]) continue;
        if(a=="AC") ac[x]++;
        else wa[x]++;
    }
    x=0;
    /*for(auto i:ac) cout<<i.F<<' ';
    cout<<'\n';*/
    for(auto i:ac) if(i.S) x++;
    for(auto i:wa){
        if(ac[i.F]) ans+=i.S;
    }
    cout<<x sp<<ans el;
}

main()
{
    fastio();
    _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 11316
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
//typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){int i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin>>N;
  vector<ll> A(1<<N),nx;
  cin>>A;
  while((int)A.size()>1){
    for(int i=0;i<(int)A.size();i+=2){
      if(A[i]==A[i+1]){nx.push_back(A[i]);}
      else{nx.push_back(max(A[i],A[i+1])-min(A[i],A[i+1]));}
    }
    swap(A,nx);
    nx.clear();
  }
  cout<<A<<endl;

  return 0;
}


Measured memory_bytes: 3448
n = int(input())

for i in range( 2**n ):
    if i == 0:
        print("{}:".format(i))
        continue
    else:
        print("{}: ".format(i), end="")
    l = []
    for j in range(n):
        if i & (1<<j) != 0:
            l.append(j)
    print(*l)



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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, a;
    cin >> n >> a;
    cout << n*n - a << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
void func() {
    int N, K;
    cin >> N >> K;
    int a;
    for (int i = 0; i < N; ++i) {
        cin >> a;
    }
    cout << (N - K ) / (K - 1) + ((N - K) % (K - 1) == 0 ? 1 : 2) << endl;
}

int main() {
    func();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int N;
  long long ans = -9223372036854775807;
  scanf("%d",&N);

  int F[N][10];
  long long P[N][11];

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

  for(int i = 0;i < N;i++){
    for(int j = 0;j < 11;j++){
      scanf("%lld",&P[i][j]);
    }
  }

  for(int i = 1;i < 1024;i++){
    int date = 0;
    int sample = i;
    int count[N];
    long long point = 0;

    for(int i = 0;i < N;i++){
      count[i] = 0;
    }
    while(date < 10){
      if(sample%2 != 0){   //date no hiniti eigyousuru
        for(int j = 0;j < N;j++){
          if(F[j][date] == 1) count[j]++;
        }
      }
      sample /= 2;
      date++;
    }

    for(int j = 0;j < N;j++){
      point += P[j][count[j]];
    }
    if(ans < point){
      ans = point;
    }
  }

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

  return 0;
}

Measured memory_bytes: 128
//
// Created by yamunaku on 2019/08/17.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 998244353
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

vector<ll> fact;

void buildFact(int n){
    fact=vector<ll>(n+1,1);
    for(int i=1;i<=n;i++){
        fact[i]=fact[i-1]*i%MOD;
    }
}

int main(){
    int n;
    cin >> n;
    buildFact(n);
    string s;
    cin >> s;
    ll ans=1;
    ll r1=0,b1=0,g1=0;
    ll r2=0,b2=0,g2=0;
    rep(i,3*n){
        if(s[i]=='R'){
            if(r2>0){
                r2--;
            }else if(b1>0){
                ans=ans*b1%MOD;
                b1--;
                g2++;
            }else if(g1>0){
                ans=ans*g1%MOD;
                g1--;
                b2++;
            }else{
                r1++;
            }
        }else if(s[i]=='G'){
            if(g2>0){
                g2--;
            }else if(b1>0){
                ans=ans*b1%MOD;
                b1--;
                r2++;
            }else if(r1>0){
                ans=ans*r1%MOD;
                r1--;
                b2++;
            }else{
                g1++;
            }
        }else{
            if(b2>0){
                b2--;
            }else if(r1>0){
                ans=ans*r1%MOD;
                r1--;
                g2++;
            }else if(g1>0){
                ans=ans*g1%MOD;
                g1--;
                r2++;
            }else{
                b1++;
            }
        }
    }
    r1=0,b1=0,g1=0;
    r2=0,b2=0,g2=0;
    per(i,3*n){
        if(s[i]=='R'){
            if(r2>0){
                r2--;
            }else if(b1>0){
                ans=ans*b1%MOD;
                b1--;
                g2++;
            }else if(g1>0){
                ans=ans*g1%MOD;
                g1--;
                b2++;
            }else{
                r1++;
            }
        }else if(s[i]=='G'){
            if(g2>0){
                g2--;
            }else if(b1>0){
                ans=ans*b1%MOD;
                b1--;
                r2++;
            }else if(r1>0){
                ans=ans*r1%MOD;
                r1--;
                b2++;
            }else{
                g1++;
            }
        }else{
            if(b2>0){
                b2--;
            }else if(r1>0){
                ans=ans*r1%MOD;
                r1--;
                g2++;
            }else if(g1>0){
                ans=ans*g1%MOD;
                g1--;
                r2++;
            }else{
                b1++;
            }
        }
    }
    cout << ans*fact[n]%MOD << endl;
    return 0;
}


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

using namespace std;

int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    int resp = 0;
    vector<int> switchs[n];
    int parity[m];
    for(int i = 0; i < m; i++){
        int qtd;
        scanf("%d", &qtd);
        for(int j = 0; j < qtd; j++){
            int aux;
            scanf("%d", &aux);
            aux--;
            switchs[aux].push_back(i);
        }
    }
    for(int i = 0; i < m; i++){
        scanf("%d", &parity[i]);
    }
    for(int i = 0; i < (1 << n); i++){
        int curr[m];
        memset(curr, 0, sizeof curr);
        for(int j = 0; j < n; j++){
            if(i & (1 << j)){
                for(int k = 0; k < switchs[j].size(); k++){
                    curr[switchs[j][k]]++;
                }
            }
        }
        resp++;
        for(int i = 0; i < m; i++)
            if(curr[i]%2 != parity[i]%2){
                resp--;
                break;
            }
    }
    printf("%d\n", resp);
    return 0;
}

Measured memory_bytes: 256
const SIZE: usize = 61;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n = sc.read();
    let a: Vec<usize> = sc.vec(n);
    let all = a.iter().cloned().fold(0, |xor, a| xor ^ a);

    let mut a = a.into_iter().map(|a| a & !all).collect::<Vec<_>>();
    let mut rank = 0;
    for j in (0..SIZE).rev() {
        match (rank..n).find(|&i| (a[i] >> j) & 1 == 1) {
            Some(i) => {
                assert_eq!((a[i] >> j) & 1, 1);
                a.swap(i, rank);
                for t in 0..n {
                    if t == rank {
                        continue;
                    }
                    if (a[t] >> j) & 1 == 1 {
                        a[t] ^= a[rank];
                    }
                }
                rank += 1;
            }
            None => {}
        }
    }

    let x = a.iter().fold(0, |xor, &a| xor ^ a);
    println!("{}", all + x * 2);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 6396
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    if (t.length() - s.length() == 1 && t.indexOf(s) == 0) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

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

priority_queue<int>q;

int main() {
  int n, m; cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    int x; cin >> x;
    q.push(x);
  }
  for (int i = 1; i <= m; i++) {
    int x = q.top(); q.pop();
    q.push(x >> 1);
  }
  long long ans = 0;
  while (q.size())
    ans += q.top(), q.pop();
  cout << ans << endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  for (int i = 0; i < n; i++) cin >> s[i];
  sort(s.begin(), s.end());
  for (int i = 0; i < n; i++) cout << s[i];
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
import numpy as np

n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int,input().split())) for _ in range(n)]

a_np = np.array(a)
b_np = np.array(b)

a_b = a_np * b_np 
a_b = np.sum(a_b,axis = 1) + c

count = 0
for i in range(n):
  if a_b[i] > 0:
    count += 1
print(count)

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
  int n,m;
  cin >> n>> m;
  vector<int> a(n);
  rep(i,n){cin >> a[i];}

  UnionFind p(n);

  rep(i,m){
    int x,y;
    cin >> x>> y;
    p.unite(x-1,y-1);
  }

  int count=0;
  rep(i,n){
    if(p.same(i,a[i]-1))count++;
  }
  
  cout << count << endl;
}

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

int main()
{
    ll a, b, v, w, t;
    cin >> a >> v;
    cin >> b >> w;
    cin >> t;
    if(v - w <= 0) cout << "NO" << endl;
    else {
        if(abs(b - a) <= (v - w) * t) {
            cout << "YES" << endl;
        }
        else cout << "NO" << endl;
    }
    return 0;
}


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

int main() {
    string S;
    cin >> S;
    int str_len = S.size();
    int bit_len = str_len - 1;
    long all_sum = 0;
    for (long i = 0; i < (1 << bit_len); i++) {
        long tmp = S.at(0) - '0';
        for (long j = 0; j < bit_len; j++) {
            if ((i >> (bit_len - (j + 1))) & 1) {
                all_sum += tmp;
                tmp = S.at(j + 1) - '0';
                
            }
            else {
                tmp *= 10;
                tmp += S.at(j + 1) - '0';
            }
        }
      all_sum += tmp;
    }
    cout << all_sum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...

    int a,b,c;
    int count=0;
    
    scanf("%d %d %d",&a,&b,&c);
    for(int i=0;i<=(b-a);i++)
    {
        if(c % (a + i) == 0)count++;
    }
    printf("%d\n",count);
    
    return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;

int get(int a, int b) {
	cout << "? " << a << " " << b << "\n";
	string ans;
	cin >> ans;
	if (ans == "Y")
		return 1;
	else
		return 0;
}

int main() {
	int a, b;
	cin >> a >> b;
	if (a <= b) {
		cout << "Impossible\n";
		cout.flush();
		return 0;
	}
	int n = a + b;
	vector<int> st;
	for (int i = 0; i < n; ++i) {
		if (st.empty()) {
			st.push_back(i);
		}
		else {
			int x = st.back();
			if (get(i, x))
				st.push_back(i);
			else
				st.pop_back();
		}
	}
	int k = st[0];
	string s;
	for (int i = 0; i < n; ++i) {
		if (get(k, i))
			s += "1";
		else
			s += "0";
	}
	cout << "! " << s << "\n";
	cout.flush();
	return 0;
}




Measured memory_bytes: 844
n = int(input())
s = input()

a = [chr(i) for i in range(65, 65+26)]
c = []
for i in range(len(s)):
    j = 0
    while s[i] != a[j]:
        j+=1
    b = (j+n)%26
    c.append(a[b])
d = c[0]
for i in range(len(c)-1):
    d += c[i+1]
print(d)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int ct[1000];
int main(){
    int n;
    scanf("%d",&n);

    for (int i = 2; i <= n; i++){
        int cur = i;
        for (int j = 2; j <= cur; j++){
            while (cur%j == 0){
                cur/=j;
                ct[j]++;
            }
        }
    }
    long long ans = 1;
    for (int i = 2; i <= n; i++){
        //printf("%d ",ct[i]);
        ans *= (ct[i]+1);
        ans %= 1000000007;
    }
    printf("%lld",ans);
}


Measured memory_bytes: 256
n = int(input())
if 400<=n<=599:
    print(8)
elif 600<=n<=799:
    print(7)
elif 800<=n<=999:
    print(6)
elif 1000<=n<=1199:
    print(5)
elif 1200<=n<=1399:
    print(4)
elif 1400<=n<=1599:
    print(3)
elif 1600<=n<=1799:
    print(2)
elif 1800<=n<=1999:
    print(1)

Measured memory_bytes: 9204
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

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

	bool b = 0;
	for (int i = 1; i <= 9; i++) {
		if (N % i == 0) {
			int n = N / i;
			if (n < 10) {
				b = 1;
				break;
			}
		}
	}

	cout << (b ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3604
def digit_transform(N):
    if N == 0:  return "0"
    ans = ""
    while(N != 0):
        if N % -2 == 0:
            ans = "0" + ans
        else:
            ans = "1" + ans
            N -= 1
        N /= -2
    return ans

print(int(digit_transform(int(input()))))

Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int room[4][3][10];

int main()
{
    int n; cin >> n;
    for(int i = 0; i < n; i++){
        int b,f,r,v; cin >> b >> f >> r >> v;
        b--;
        f--;
        r--;
        room[b][f][r] += v;
    }
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 10; k++){
                cout << ' ' <<  room[i][j][k];
            }
            cout << endl;
        }
        
        if(i < 3 ) cout << "####################" << endl;
    }
}


Measured memory_bytes: 3100
N,M,C = map(int,input().split())
B = input().split()
total = 0
for i in range(N):
    ans = 0
    A = input().split()
    for j in range(M):
        ans += int(A[j])*int(B[j])
    if (ans + C) > 0:
        total += 1
print(total)

Measured memory_bytes: 3060
N, M = map(int,input().split())
flags = [1] + [0]*(N-1)
balls = [1]*N 
for i in range(M):
  x, y = map(int,input().split())
  balls[x-1] -= 1
  balls[y-1] += 1 
  if flags[x-1]: 
    flags[y-1] = 1
    if balls[x-1]==0:
      flags[x-1] = 0
print(sum(flags))

Measured memory_bytes: 4596
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int answer = 10000;
    for (int i = 1; i < n; i++) {
      int a = i;
      int b = n - i;
      int sum1 = 0;
      int sum2 = 0;
      while(a > 0) {
        sum1 += a % 10;
        a /= 10;
      }
      while(b > 0) {
        sum2 += b % 10;
        b /= 10;
      }
      if (sum1 + sum2 < answer) {
        answer = sum1 + sum2;
      }
    }
    System.out.println(answer);
  }
}

Measured memory_bytes: 35736
#include <stdio.h>
int main() {char T[20];int N,pnt,ot,base;scanf("%d",&N); {while (N--) {pnt=ot=base=0;while (1) {scanf("%s",&T);if (T[0]=='O') ot++; else if (T[1]=='O') pnt+=base+1,base=0; else base++,pnt+=((base&4)?1:0),base-=((base==4)?1:0);if (ot==3) {printf("%d\n",pnt);break;}}}} return 0;}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String a = input.readLine( );
		String b = input.readLine( );
		int a1;
		int b1;

		if(a.length() > b.length()){
			System.out.println("GREATER");
		}else if(b.length() > a.length()){
			System.out.println("LESS");
		}else{
			while(a.length()>0 && b.length()>0){
				a1 = Integer.parseInt(a.substring(0, 1));
				b1 = Integer.parseInt(b.substring(0, 1));
				if(a1>b1){
					System.out.println("GREATER");
					break;
				}else if(b1>a1){
					System.out.println("LESS");
					break;
				}
				a = a.substring(1);
				b = b.substring(1);
			}
			if(a.length()==0){
				System.out.println("EQUAL");
			}
		}
	}
}


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

int main() {
    int N, K, res = 0;
    cin >> N >> K;
    int l[N];

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

    sort(l, l + N, greater<int>());

    for (int j = 0; j < K; j++) {
        res += l[j];
    }

    cout << res << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<vector>
using namespace std;
using ll=long long;

int main(){
	int x,c,ans=0;
	cin>>x;
	c=x;
	if(c==1){
		cout<<"1"<<endl;
		return 0;
	}
	for(int i=2;i*i<=x;i++){
		c=i*i;
		while(c<=x){
			c*=i;
		}
		ans=max(ans,c/i);
	}

	cout<<ans<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

const ll mod = 998244353;
const int N = 1e4 + 5, M = 1e5 + 5;
const ll INF = 1e18;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;

#define pi acos(-1)


int main()
{
	int n;
	int flag = 1;
	cin >> n;
	while(n)
	{
		if(n % 10 == 7)
		{
			puts("Yes");
			flag = 0;
			return 0;
		}
		n /= 10;
	}
	puts("No");
	return 0;
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


bool solve(vector<int>a, vector<int>b) {
	bool win = false;
	for (int i = 0; i < 2; ++i) {
		if (a[i] >= 5)continue;
		for (int j = 0; j < 2; ++j) {
			if (b[j] >= 5)continue;
			vector<int>nextb(b);
			nextb[j] += a[i];
			if (nextb[0] >= 5 && nextb[1] >= 5)return true;
			else {
				win |= !solve(nextb, a);
			}
		}
	}
	return win;
}
int main() {
	int l1, r1, l2, r2; cin >> l1 >> r1 >> l2 >> r2;
	vector<int>a{ l1,r1 };
	vector<int>b{ l2,r2 };
	bool win = solve(a, b);
	if (!win)cout << "NAKAJIMA" << endl;
	else cout << "ISONO" << endl;
	return 0;
}

Measured memory_bytes: 3152
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int year = Integer.parseInt(s.substring(0, 4));
        int month = Integer.parseInt(s.substring(5, 7));
        String ans = year < 2020 && month < 5 ? "Heisei" : "TBD";
        System.out.println(ans);
    }
}


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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int x = c-a;
  int y = d-b;
  int e,f,g,h;
  f = d + x;
  e = c - y;
  g = e - x;
  h = f - y;
  cout << e << " " << f << " " << g << " " << h << endl;
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


int n;
struct S {
	int w, s, v;

	bool operator<(const S &a)const {
		return w + s < a.w + a.s;
	}
}blocks[1000];


long long dp[20001];


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

	cin >> n;
	rep(i,n) {
		cin >> blocks[i].w >> blocks[i].s >> blocks[i].v;
	}
	sort(blocks, blocks + n);
	

	for (int i = n - 1; i >= 0; i--) {
		rep(cap, 20001){
			int nc = min(cap - blocks[i].w, blocks[i].s);
			if (nc < 0)continue;
			dp[nc] = max(dp[nc], dp[cap] + blocks[i].v);
		}
	}

	cout << *max_element(dp, dp + 20001) << endl;


	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;
//typedef pair<ll, ll> P;
//typedef pair<double, P> T;

const ll mod = 1000000007;
const ll INF = 100000010000;

ll N, P[10], Q[10];

ll ans;

ll pow_mod(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2 == 1)
	{
		return x * pow_mod(x, y - 1) % mod;
	}
	else
	{
		ll half = pow_mod(x, y / 2);
		return half * half % mod;
	}
}

ll div_mod(ll x)
{
	return pow_mod(x, mod - 2);
}

/*ll sum_bit(ll i)
{
	ll s = 0;
	while (i > 0)
	{
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add_bit(ll i, ll x)
{
	while (i <= 2 * N + 10)
	{
		bit[i] += x;
		i += i & -i;
	}
}*/

void init()
{
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> P[i];
	}
	for (int i = 0; i < N; i++)
	{
		cin >> Q[i];
	}
}

void output()
{
	cout << ans << endl;
}



void solve()
{
	vector<ll> vec;
	for (int i = 1; i <= N; i++)
	{
		vec.push_back(i);
	}
	
	ll cnt = 0, t = 0;
	ll a[3];
	while (cnt < 2)
	{
		bool jud = true;
		for (int i = 0; i < N; i++)
		{
			if (vec[i] != P[i]) jud = false;
		}
		if (jud)
		{
			a[cnt] = t;
			cnt++;
		}

		jud = true;
		for (int i = 0; i < N; i++)
		{
			if (vec[i] != Q[i]) jud = false;
		}
		if (jud)
		{
			a[cnt] = t;
			cnt++;
		}

		next_permutation(vec.begin(), vec.end());

		t++;
	}
	ans = a[1] - a[0];
}

int main()
{
	init();
	
	solve();

	

	output();
	ll N;
	cin >> N;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const ll INF = 4e18;
const ll MOD = 1e9+7;

int main(){
//  ios::sync_with_stdio(false);
//  cin.tie(0);
int n, a,b;
cin >> n >> a >> b;
cout << min(a,b) << " " << -min(0, n-a-b) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <set>

using namespace std;

int main()
{
    int no_of_numbers;
    scanf("%d", &no_of_numbers);

    set <int> number;
    for(int i = 1; i <= no_of_numbers; i++)
    {
        int number_i;
        scanf("%d", &number_i);

        if(number.count(number_i) == 1)
            number.erase(number_i);
        else
            number.insert(number_i);
    }

    printf("%u\n", number.size());
    return 0;
}

Measured memory_bytes: 4864
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO.Pipes;

namespace cswork
{
    class Program
    {
        public Program() { }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        void Omame()
        {
            cin = new Scanner();
            string s = cin.next();

            if (!s[0].Equals('A'))
            {
                Console.WriteLine("WA");
                return;
            }

            string tmp = s.Substring(2, s.Length - 3);
            if (tmp.Length - tmp.Replace("C", "").Length != 1)
            {
                Console.WriteLine("WA");
                return;
            }

            int p = tmp.IndexOf("C");
            s = s.Remove(p + 2, 1);
            s = s.Substring(1);

            if (!s.Equals(s.ToLower()))
            {
                Console.WriteLine("WA");
                return;
            }

            Console.WriteLine("AC");
        }


        static void Main(string[] args)
        {
            new Program().Omame();
        }

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();

            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next();
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }
    }
}

Measured memory_bytes: 13408
#include<stdio.h>

int main()
{
    int a,b,c,d;
    scanf("%d %d %d",&a,&b,&c);
    if(1<=a && a<=9 && 1<=b && b<=9 && 1<=c && c<=9)
    {
       d=100*a+10*b+c;
       if(d%4==0) printf("\nYES");
        else printf("\nNO");
    }

    return 0;
}


Measured memory_bytes: 1700
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int A, B, M; cin >> A >> B >> M;
    vector<int> as(A), bs(B);
    for (auto &ai : as) cin >> ai;
    for (auto &bi : bs) cin >> bi;
    vector<int> xs(M), ys(M), cs(M);
    for (int i = 0; i < M; ++i) cin >> xs[i] >> ys[i] >> cs[i];
    // 割引券を使わない場合
    int ans = *min_element(as.begin(), as.end())
        + *min_element(bs.begin(), bs.end());
    // 割引券を使う場合
    for (int i = 0; i < M; ++i)
    {
        int price = as[xs[i] - 1] + bs[ys[i] - 1] - cs[i];
        ans = min(ans, price);
    }
    cout << ans << endl;
}


Measured memory_bytes: 2304
n = int(raw_input())

a = []
b = []
c = []

for _ in range(n):
    ai, bi, ci = [int(i) for i in raw_input().split()]
    a.append(ai)
    b.append(bi)
    c.append(ci)


def vacation_planning(a,b,c):
    n = len(a)
    fa = [0] * n 
    fb = [0] * n
    fc = [0] * n

    fa[0] = a[0]
    fb[0] = b[0]
    fc[0] = c[0]

    for i in range(1, n):
        fa[i] = a[i] + max(fb[i-1], fc[i-1])
        fb[i] = b[i] + max(fa[i-1], fc[i-1])
        fc[i] = c[i] + max(fa[i-1], fb[i-1])

    return max(fa[-1], fb[-1], fc[-1])

print(vacation_planning(a,b,c))

Measured memory_bytes: 47132
m, n = map(int, input().split())
A = [list(map(int, input().split())) for i in range(m)]
b = [int(input()) for i in range(n)]
for i in range(m):
    ans = 0
    for j in range(n):
        ans += A[i][j] * b[j]
    print(ans)


Measured memory_bytes: 6020
S = input()

odd = ["R", "U", "D"]
even = ["L", "U", "D"]

flag = "Yes"

for i in range(len(S)):
    if i % 2:
        if S[i] not in even:
            flag = "No"
            break
    else:
        if S[i] not in odd:
            flag = "No"
            break
print(flag)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define C getchar()
int main()
{
  char k=C;
  cout<<k;
  C;C;C;C;
  k=C;
  cout<<k;
  C;C;C;C;
  k=C;
  cout<<k;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int64_t i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define COUTDOUBLE(d,i) cout << setprecision((i)) << (d) << endl;
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}
#define MREP(i,m) for(auto i=(m).begin(); i != (m).end(); ++i) // auto key = i->first;auto value = i->second;

using namespace std;
typedef int64_t I;
typedef pair<I,I> P;
typedef vector<I> V;

I MOD = pow(10,9)+7;
I MAX = LONG_MAX;
I MIN = LONG_MIN;

// 最大公約数
I gcd(I a, I b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
I lcm(I a, I b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}

int main(){
  I n,m;
  cin >> n >> m;
  vector<P> ab(n);
  REP(i,n){
    cin >> ab.at(i).first >> ab.at(i).second;
  }
  SORT(ab);
  I t=0;
  I now=0;
  REP(i,n){
    I a = ab.at(i).first;
    I b = ab.at(i).second;
    if (now + b < m){
      t += a * b;
      now += b;
    }else{
      t += a * (m-now);
      break;
    }
  }
  cout << t << endl;
  return 0;
}



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

int main() {
  int a=0;
  string s;
  cin >> s;
  if(s[0]=='1') a++;
  if(s[1]=='1') a++;
  if(s[2]=='1') a++;
  cout << a << endl;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;

public class Main {

    private final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    private final PrintWriter out = new PrintWriter(System.out);

    public void solve() throws IOException {
        String[] vals = in.readLine().split(" ");
        out.println(new BigDecimal(vals[0]).multiply(new BigDecimal(vals[1])).toBigInteger());
    }

    private void go() throws IOException {
        solve();
        in.close();
        out.close();
    }

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

Measured memory_bytes: 33540
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int use[35][100010];

int main(void)
{
    int N,C;
    cin >> N >> C;
    REP(i, N){
        int s,t,c;
        cin >> s >> t >> c;
        c--;
        Rep(j, s, t+1){
            use[c][j] = 1;
        }
    }
    int ans = 0;
    REP(i, 100010){
        int tmp = 0;
        REP(j, C){
            if(use[j][i]==1)tmp++;
        }
        chmax(ans, tmp);
    }
    pr(ans);
}

Measured memory_bytes: 12544
#include <cctype>
#include <string>
#include <iostream>
using namespace std;
int main (){
    string  a, b;
    int ans = 0, flag;
    char c;
    cin >> a;
    while (1){
        flag = 0;
        cin >> b;
        if (b == "END_OF_TEXT")break;
        if (b.size() == (a.size() + 1) || b.size() == a.size()){
            for (int i = 0; i < a.size(); i++){
                c = tolower(b[i]);
                if (a[i] == c){
                    flag += 1;
                }
            }
        }
        if (flag == b.size()){
            ans += 1;
        }
    }
    cout << ans << endl;

}


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

int main() {
  int N;
  cin>>N;
  
  vector<int> moti(N);
  for(int i=0;i<N;i++){
   cin>>moti.at(i);
  }
  sort(moti.begin(),moti.end());
  reverse(moti.begin(),moti.end());
   
  int dan=1;
    
    //同じ半径を除外する
  for(int i=1;i<N;i++){
    
    if(moti.at(i)==moti.at(i-1)){
      dan+=0;     
    }else{
      dan+=1;
    }
  }
  cout<<dan<<endl;
}
  

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;


struct UnionFind {
	VI par;
	UnionFind(int N) :par(N) {
		REP(i,N)par[i] = i;
	}
	int root(int x) {
		if (par[x] == x)return x;
		return par[x] = root(par[x]);
	}
	void unite(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		if (rx == ry)return;
		par[rx] = ry;
	}
	bool same(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

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

	int N, M; cin >> N >> M;
	VS A(N), B(M);
	REP(i, N)cin >> A[i];
	REP(i, M)cin >> B[i];

	eREP(i, N - M) {
		eREP(j, N - M) {

			bool F = 1;
			FOR(a, 0, M) {
				FOR(b, 0, M) {
					if (A[a+i][b+j] != B[a][b])F = false;
				}
			}



			if (F) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 256
while True:
    n, m = map(int, input().split())
    if n == 0 and m == 0:
        break
    h = [0]
    for i in range(n):
        h.append(int(input()) + h[i])
    w = [0]
    for i in range(m):
        w.append(int(input()) + w[i])

    hDict = {}
    for i in range(n + 1):
        for j in range(i, n + 1):
            if i == j:
                continue
            else:
                diff = abs(h[i] - h[j])
                if diff in hDict:
                    hDict[diff] += 1
                else:
                    hDict[diff] = 1
    wDict = {}
    for i in range(m + 1):
        for j in range(i, m + 1):
            if i == j:
                continue
            else:
                diff = abs(w[i] - w[j])
                if diff in wDict:
                    wDict[diff] += 1
                else:
                    wDict[diff] = 1

    ans = 0
    for diff in hDict.keys():
        if diff in wDict:
            ans += hDict[diff] * wDict[diff]
    print(ans)


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

int main(){
    long long k,t;
    cin >> k >> t;
    long long total=0;
    long long a[t];
    for(int i=0;i<t;i++){
        cin >> a[i];
        total+=a[i];
    }
    sort(a,a+t);
    total-=a[t-1];
    cout << max(0LL,a[t-1]-total-1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> height(n);
  rep(i,n) cin >> height.at(i);
  vector<int> tenbou(n,1);
  
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    if (height.at(a-1) > height.at(b-1)) {
      tenbou.at(b-1) = 0;
    } else if (height.at(a-1) < height.at(b-1)) {
      tenbou.at(a-1) = 0;
    } else {
      tenbou.at(a-1) = 0;
      tenbou.at(b-1) = 0;
    }
  }
  
  int count = 0;
  rep(i,n) {
    if (tenbou.at(i) == 0) continue;
    count++;
  }
  cout << count;
}


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

static const int mod = 1000000007;

static vector<int> f, g;

int fast_power(int a, int b) {
  long long p = 1, q = a;
  while (b) {
    if (b & 1)
      p = p * q % mod;
    q = q * q % mod;
    b >>= 1;
  }
  return p;
}

void factorial(int n) {
  f.push_back(1);
  g.push_back(1);
  for (int i = 1; i <= n; i++) {
    f.push_back(1LL * f[i - 1] * i % mod);
    g.push_back(fast_power(f[i], mod - 2));
  }
}

long long h(int r, int c) {
  if (r > c) swap(r, c);

  long long res = 0;
  for (int i = 1; i <= r + 1; i++)
    res = (res + 1LL * f[c + i] * g[i] % mod * g[c] % mod) % mod;
  return res;
}

int main() {
  int r1, c1, r2, c2;
  scanf("%d %d %d %d", &r1, &c1, &r2, &c2);

  factorial(r2 + c2 + 1);
  int ans = (h(r2, c2) - h(r2, c1 - 1) - h(r1 - 1, c2) + h(r1 - 1, c1 - 1) + mod * 2) % mod;
  printf("%d\n", ans);

  return 0;
}

Measured memory_bytes: 16084