akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#define pi 3.14159265358979323846264338
using namespace std;

int main() {
	int m, f, r;
	while (cin >> m >> f >> r) {
		if (m == -1 && f == -1 && f == -1) {
			break;
		}
		if (m == -1 || f == -1) {
			cout << "F" << endl;
		}
		else {
			if (m + f >= 80) {
				cout << "A" << endl;
			}
			else if (m + f >= 65) {
				cout << "B" << endl;
			}
			else if (m + f >= 50) {
				cout << "C" << endl;
			}
			else if (m + f >= 30) {
				if (r >= 50) {
					cout << "C" << endl;
				}
				else {
					cout << "D" << endl;
				}
			}
			else {
				cout << "F" << endl;
			}
		}
	}
	return 0;
}

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

int main(){
    string S(3,'a');
    string T(3,'a');
    cin >> S >> T;
    int i=0;
    if(S[0] == T[0]) { i++;}
    if(S[1] == T[1])  {i++;}
    if(S[2] == T[2])  {i++;}
    cout << i;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define LF '\n'
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() { cin.tie(nullptr); ios_base::sync_with_stdio(false); }
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
template<class Itr> void dump(Itr begin, Itr end) { for (;begin != end; ++begin) clog << *begin << LF; }

signed main()
{
  int N; cin >> N;
  vector<pii> a(N);

  for (int i = 0; i < N; i++) {
    int s, t;
    cin >> s >> t;
    a[i] = make_pair(s, t);
  }

  sort(ALL(a),
      [](const auto &l, const auto &r) { return l.second < r.second; }
  );

  int ans = 0;
  int now = 0;
  for (const auto &e : a) {
    if (e.first > now) {
      ++ans;
      now = e.second;
    }
  }

  cout << ans << LF;
  return 0;
}




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

using namespace std;
#define int long long
const int MOD = 1000000007;
template <typename Int, Int MOD, int N>
struct comb_util {
	std::array<Int, N + 1> fc, ifc;

	comb_util() {
		fc[0] = 1;
		for (int i = 1; i <= N; i++) fc[i] = fc[i - 1] * i % MOD;
		ifc[N] = inv(fc[N]);
		for (int i = N - 1; i >= 0; i--) ifc[i] = ifc[i + 1] * (i + 1) % MOD;
	}

	Int fact(Int n) { return fc[n]; }

	Int inv_fact(Int n) { return ifc[n]; }

	Int inv(Int n) { return pow(n, MOD - 2); }

	Int pow(Int n, Int a) {
		Int res = 1, exp = n;
		for (; a; a /= 2) {
			if (a & 1) res = res * exp % MOD;
			exp = exp * exp % MOD;
		}
		return res;
	}

	Int perm(Int n, Int r) {
		if (r < 0 || n < r)
			return 0;
		else
			return fc[n] * ifc[n - r] % MOD;
	}

	Int binom(Int n, Int r) {
		if (n < 0 || r < 0 || n < r) return 0;
		return fc[n] * ifc[r] % MOD * ifc[n - r] % MOD;
	}

	Int homo(Int n, Int r) {
		if (n < 0 || r < 0) return 0;
		return r == 0 ? 1 : binom(n + r - 1, r);
	}
};

using comb = comb_util<long long, 1000000007, 300000>;
comb cb;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int res = 0;
	for (int i = 0; i < N; i++) {
		int ans = A[N - 1] - A[i];
		res = (res + ans * cb.inv(N - 1 - i)) % MOD;
	}
	for (int i = 0; i < N - 2; i++) {
		res = (res + A[i] * (cb.inv(N - 2 - i + 1) - 1)) % MOD;
		//res = (res - A[i] * invsum[N - 2 - i]) % MOD;
		//res = (res + A[i] * (invsum[N - 2 - i] - 1)) % MOD;
	}
	for (int i = 1; i < N - 1; i++) {
		res = (res + A[i] * (1 - cb.inv(i + 1))) % MOD;
		//res = (res - A[i] * invsum[N - 2 - i]) % MOD;
		//res = (res + A[i] * (invsum[N - 2 - i] - 1)) % MOD;
	}

	for (int i = 1; i <= N - 1; i++) {
		res = (res * i) % MOD;
	}
	res += MOD;
	res %= MOD;
	cout << res << endl;
}

Measured memory_bytes: 5760
// Last Change: 03/24/2019 20:45:54.
//////////////////////////////////////////////////////////////////////////////
//どんなに長くても、条件を満たすsubstrの長さはkまでであることを利用する。
//(たとえk=5でaaaaaaaaaだとしても、a,aa,aaa,aaaa,aaaaaより、maxはaaaaaの5文字)
//(詳細はhttps://tanakataroh.hatenablog.jp/entry/2018/10/30/065609 で)
//そしてkはせいぜい5まで
//→ 長さkまでのsubstrを全て列挙し、ソートし、重複を消して答えを出力する。
//
// std::unique
//
// std::setもありらしい
//////////////////////////////////////////////////////////////////////////////
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

int main() {
  string s;
  int K;
  cin >> s >> K;

  int sSize = s.size();
  vector<string> ans;
  for (int i = 1; i <= K; ++i) {
    for (int j = 0; j < sSize - i + 1; ++j) {
      ans.push_back(s.substr(j, i));
    }
  }

  sort(ans.begin(), ans.end());
  unique(ans.begin(), ans.end());
  cout << ans[K - 1] << endl;

  //NS::LoopUntilZeroInpput();
}


Measured memory_bytes: 1660
/** "Ever tried.
         Ever failed.
               No matter.
                   Try Again.
                        Fail again.
                             Fail better.**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define bp  __builtin_popcount
#define pb push_back
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define sz(s) (int)(s.size())
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define setdp memset(dp,-1,sizeof(dp))
#define fr first
#define sc second
#define NumofDigits(n)   ((long long)log10(n)+1)
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const int maxn=1e5+5;
const  double EPS = 1e-9;
const int MOD = 1e9+7;
/*
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll fastpow(ll b, ll p)
{if(!p)return 1;ll ret = fastpow(b, p >> 1);ret *= ret;if(p&1)ret*= b;return ret;}
int dx[] = {- 1, 0, 0, 1, 0 };
int dy[] = { 0,- 1, 1, 0, 0 };*/
inline void File()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n,m,k;
    cin>>n>>m>>k;
    char arr[n][m];
    for(int i=0; i<n; i++)
        for(int j=0; j<m; j++)
            cin>>arr[i][j];
    int ans=0;
    for(int mski=0; mski<(1<<n); ++mski)
    {
        for(int mskj=0; mskj<(1<<m); ++mskj)
        {
            int blck=0;
            for(int i=0; i<n; i++)
                for(int j=0; j<m; j++)
                    if(mski&(1<<i) and mskj&(1<<j) and arr[i][j]=='#')
                         blck++;
            if(blck==k)
                ans++;
        }
    }
    cout<<ans;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int N;
    cin >> N;
    vector<int> p(N);

    for (int &iter : p)
        cin >> iter;
    
    sort(p.begin(), p.end());

    int sum = 0;
    for (int i = 0; i < p.size() - 1; i++)
        sum += p.at(i);

    sum += (p.back() / 2);
    cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {

        //solve_148_A();
        solve_148_B();
      
        return;
    }

    private static void solve_148_B() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        String T = sc.next();

        String[] SArray = S.split("");
        String[] TArray = T.split("");
        String[] outputArray = new String[N*2];

        for(int i=0; i<N; i++){
            outputArray[i*2] = SArray[i];
            outputArray[i*2+1] = TArray[i];
        }
        String out = String.join("",outputArray);

        System.out.println(out);
    }
}

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

int main()
{
    int n;
    cin >> n;
    vector<string> s(n);
    vector<int> p(n);
    for (int i = 0; i < n; i++)
    {
        cin >> s[i] >> p[i];
        
    }
    
    vector<int> ans(n);
    for (int i = 0; i < n; i++)
    {
        ans[i] = i + 1;
    }
    
    for (int i = 0; i < n - 1; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if (s[i] > s[j] )
            {
                string tmp = "";
                tmp = s[i];
                s[i] = s[j];
                s[j] = tmp;

                int tmp01 = 0;
                tmp01 = ans[i];
                ans[i] = ans[j];
                ans[j] = tmp01;

                int tmp02 = 0;
                    tmp02 = p[i];
                    p[i] = p[j];
                    p[j] = tmp02;
            }
        }
    }

    for (int i = 0; i < n - 1; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if (s[i] == s[j])
            {
                if (p[i] < p[j])
                {
                    int tmp = 0;
                    tmp = p[i];
                    p[i] = p[j];
                    p[j] = tmp;

                    int tmp01 = 0;
                    tmp01 = ans[i];
                    ans[i] = ans[j];
                    ans[j] = tmp01;
                }
            }
        }
        
    }
    

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

Measured memory_bytes: 256
mod = 1000000007

n = int(input())
A = list(map(int,input().split()))

d = {-1:3}
ans = 1
for a in A:
    if a not in d:
        d[a] = 1
    else:
        d[a] += 1
    if a-1 not in d:
        print(0)
        exit()
    ans = ans*d[a-1]%mod
    d[a-1] -= 1

#print(d)
print(ans)

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

int main()
{
  int N, N_;
  int sum = 0;
  
  cin >> N;
  N_ = N;
  while (true)
  {
    if (N_ == 0)
    {
      break;
    }
    sum += N_ % 10;
    N_ /= 10;
  }
  if (N % sum == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


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

void sum_three(int K, int S) {
	int ans = 0;
	for (int i = 0; i <= K; i++) {
		if (S - i >= 0) {
			for (int j = 0; j <= K; j++) {
				if (S - i - j >= 0) {
					if (S - i - j <= K) ans += 1;
					
				}
				else break;
			}
		}
		else break;
	}
	cout << ans << endl;
}

void route(int sx, int sy, int tx, int ty) {
	for (int i = 0; i < ty - sy; i++) cout << "U";
	for (int i = 0; i < tx - sx; i++) cout << "R";
	for (int i = 0; i < ty - sy; i++) cout << "D";
	for (int i = 0; i < tx - sx; i++) cout << "L";
	cout << "L";
	for (int i = 0; i <= ty - sy; i++) cout << "U";
	for (int i = 0; i <= tx - sx; i++) cout << "R";
	cout << "D";
	cout << "R";
	for (int i = 0; i <= ty - sy; i++) cout << "D";
	for (int i = 0; i <= tx - sx; i++) cout << "L";
	cout << "U";
}
int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	route(sx, sy, tx, ty);
	
}

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

struct SegmentTree{
    int leaves;
    vector<long long int> data;

    void init(int n){
        leaves = 1;
        while(leaves < n) leaves *= 2;// nearest power of 2 (leaf nodes)
        data.assign(2 * leaves, 0);// (0,) 1, ..., 2 * leaves - 1
    }

    // update i-th leaf (0-indexed) to x
    void update(int i, long long int x){
        i += leaves;
        data[i] = x;
        while(i >= 2){
            i /= 2;// move upward (to the parent node)
            data[i] = max(data[i*2], data[i*2 + 1]);// compare the children
        }
    }

    // maximum [a,b)
    long long int query(int a, int b, int k, int l, int r){// k-th node of the tree = [l,r)
        if(b <= l || r <= a) return 0;// no overlap
        if(a <= l && r <= b) return data[k];// completely inside
        // otherwise: recursive
        long long int vl = query(a, b, k*2    , l      , (l+r)/2);// left  child
        long long int vr = query(a, b, k*2 + 1, (l+r)/2, r      );// right child
        return max(vl, vr);
    }
};

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

    vector<int> x(n);
    vector<pair<int, int>> robot(n);
    for(int i=0; i<n; i++){
        cin >> robot[i].first >> robot[i].second;
        x[i] = robot[i].first;
    }
    sort(robot.begin(), robot.end());
    sort(x.begin(), x.end());
    /*
    for(int i=0; i<n; i++) cout << setw(3) << robot[i].first << " ";
    cout << endl;
    for(int i=0; i<n; i++) cout << setw(3) << robot[i].second << " ";
    cout << endl;
    */

    SegmentTree seg; 
    seg.init(n+1);

    vector<int> to(n);
    for(int i=n-1; i>=0; i--){
        seg.update(i, i);
        //cout << lower_bound(x.begin(), x.end(), robot[i].first + robot[i].second) - x.begin() << endl;
        int moved = lower_bound(x.begin(), x.end(), robot[i].first + robot[i].second) - x.begin() - 1;
        to[i] = seg.query(i, moved+1, 1, 0, seg.leaves);
        seg.update(i, to[i]);
        //cout << to[i] << " ";
    }

    vector<long long int> dp(n+1);
    dp[n] = 1;// (all robots left)
    for(int i=n-1; i>=0; i--){
        dp[i] = dp[i+1] + dp[to[i]+1];// (not moving i-th robot) + (moved i-th robot)
        dp[i] %= MOD;
    }
    cout << dp[0] << endl;
    return 0;
}

Measured memory_bytes: 9088
#include <iostream>
#include <cassert>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>

using namespace std;

typedef long long ll;

const int N = 100000 + 5;

int n;
char s[N];
vector<int> g;

int main() {
  scanf("%s", s+1);
  n = strlen(s+1);
  if (s[1] == '0' || s[n] == '1') {
    puts("-1");
    return 0;
  }
  for (int i = 1; i < n; i++) {
    if (s[i] != s[n-i]) {
      puts("-1");
      return 0;
    }
  }
  int rt = 1, k = 0, pt = 2;
  for (int i = 2; i < n; i++) {
    k++;
    if (s[i] == '1') {
      printf("%d %d\n", pt++, rt);
      rt = pt-1;
      while (--k) {
        printf("%d %d\n", rt, pt++);
      }
      k = 0;
    }
  }
  printf("%d %d\n", n, rt);
  return 0;
}


Measured memory_bytes: 1536
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int A = in.nextInt();
        int i = 10, res = 0, sign = 1;
        while (A >= i) {
            res += (i - 1) * sign;
            sign *= -1;
            i *= 10;
        }
        if (res <= 0) res += A;
        System.out.println(res);
    }
}

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 998244353
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    int N,M; cin>>N>>M;
    Graph G(N);
    vector<int> deg(N,0); //入り次数
    vector<int> dp(N,0); //sourceからの最長距離
    rep(i,M){
        int x,y; cin>>x>>y;
        x--; y--;
        G[x].push_back(y);
        deg[y]++;
    }

    queue<int> que;
    rep(v,N) if(deg[v]==0) que.push(v);

    while(!que.empty()){
        int v = que.front(); que.pop();
        for(auto nv : G[v]){
            deg[nv]--;
            if(deg[nv]==0){
                que.push(nv);
                chmax(dp[nv],dp[v]+1);
            }
        }
    }

    int res = 0;
    rep(v,N) chmax(res,dp[v]);
    cout<<res<<endl;
}

Measured memory_bytes: 9392
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define debug(x) cerr << #x " = " << (x) << endl;
#define P(x) cerr << #x << endl;    
#define int long long
typedef pair<int, int> pii;
const int mod = 1000000007;


int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(9);
    
    int a, b;
	cin >> a >> b;
	cout << max(0LL, a - 2 * b) << '\n';
    
    
    return 0;
}






Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
using ulong = unsigned long;
using ll = long long;
const int M = 1e9 + 7;
#pragma unused(M)

int main(){
    int n, x;
    cin >> n >> x;
    ll ans = 0, prev = 0;
    for(int i=0;i<n;i++){
        int a; cin >> a;
        if(prev + a > x){
            ll eat = prev + a - x;
            ans += eat;
            prev = a - eat;
        }else{
            prev = a;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
using namespace std;
int main() {
	int h, w;
	cin >> h >> w;
	vector<int> vec, vec1;
	string s[100];
	for (int i = 0; i < h; i++) {
		cin >> s[i];
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#') {
				vec.emplace_back(i);
				break;
			}
		}
	}
	for (int i = 0; i < w; i++) {
		for (int j = 0; j < vec.size(); j++) {
			if (s[vec[j]][i] == '#') {
				vec1.emplace_back(i);
				break;
			}
		}
	}
	for (int i = 0; i < vec.size(); i++) {
		for (int j = 0; j < vec1.size(); j++) {
			cout << s[vec[i]][vec1[j]];
		}
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 3516
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
    string s;
    cin >> s;
    int l = s.size();

    for(int i=0;i<l-1;i++){
      if(s[i]==s[i+1]){
        cout << i+1 << " " << i+2 <<endl;
        return 0;
      }
    }

    for(int i=0;i<l-2;i++){
      if(s[i]==s[i+2]){
        cout << i+1 << " " << i+3 <<endl;
        return 0;
      }
    }

    cout << -1 << " " << -1 <<endl;
  
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
long long a[200013],n,ans,j,h;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n;i++)
    {
        for(j;j<n;j++)
            if((h|a[j])!=h+a[j])
                break;
            else
                h=h+a[j],
        ans=ans+j-i+1;
        h-=a[i];
    }
    cout<<ans;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long ll;

int main(){
  ll n, m;
  cin >> n >> m;
  ll sum = 0;
  vector<ll> a(n);
  rep(i, n){
    cin >> a[i];
    sum += a[i];
  }
  sort(a.begin(), a.end());
  
  if (a[n-m] >= float(sum) / (4 * m))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		ArrayList<Integer> one = nextIntArray();
		int X = one.get(0);
		int Y = one.get(1);
		myout(X + (Y / 2));
	}
	//Method addition frame start



	//Method addition frame end
}


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

#define ll long long
#define ull unsigned ll

#define vi vector <int>
#define ii pair <int, int>
#define vii vector <ii>
#define INFLL 9e18
#define INF 2e9
#define EPS 1e-9
#define pb push_back
#define emp emplace_back
#define PI acos(-1.0)
#define endl "\n"
#define mp make_pair
#define DEBUG 0

int h, w;
char grid[1005][1005];
bool visited[1005][1005];

int dx[2] = {1, 0};
int dy[2] = {0, 1};
ll path[1005][1005];
const ll MOD = 1000000007;

bool valid(int row, int col){
    return (row >= 0 and row < h and col >= 0 and col < w and grid[row][col] == '.');
}

void bfs(int start_row, int start_col){
    visited[start_row][start_col] = true;
    queue <ii> q;
    q.push(mp(start_row, start_col));

    while (!q.empty()){
        int now1 = q.front().first;
        int now2 = q.front().second;
        q.pop();

        for (int dir = 0; dir < 2; dir++){
            int row = now1 + dx[dir];
            int col = now2 + dy[dir];

            if (valid(row, col) and visited[row][col] == false){
                visited[row][col] = true;
                q.push(mp(row, col));
            }
        }
    } 
}

int main ()

{
    //#define int ll
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //cout.tie(NULL);

    //freopen("output.txt", "r", stdin); 
    //freopen("input.txt", "w", stdout);
       
    cin >> h >> w;
    for (int i=0; i<h; i++){
        for (int j=0; j<w; j++){
            cin >> grid[i][j];
        }
    }

    for (int i=0; i<h; i++){
        if (valid(i, 0))
            path[i][0] = 1;
        else break;
    }

    for (int j=0; j<w; j++){
        if (valid(0, j))
            path[0][j] = 1;
        else break;
    }

    path[0][0] = 1;
    bfs(0, 0);
    for (int i=1; i<h; i++){
        for (int j=1; j<w; j++){
            if (valid(i, j)){
                //cout << "YES" << endl;
                if (valid(i-1, j)) path[i][j] += path[i-1][j];
                if (valid(i, j-1)) path[i][j] += path[i][j-1];
                if (path[i][j] >= MOD) path[i][j] -= MOD;
            }
        }
    }

    /*for (int i=0; i<h; i++){
        for (int j=0; j<w; j++){
            cout << path[i][j] << " ";
        }
        cout << endl;
    }*/

    cout << path[h-1][w-1] << endl;
    
    return 0;
}

Measured memory_bytes: 10112
#include<bits/stdc++.h>
#define ll long long
#define fo(i,x,y) for(int i=x;i<=y;i++)
#define fd(i,x,y) for(int i=x;i>=y;i--)
using namespace std;

const int maxn=200007;

int n,Brd;
ll L,R;
char a[maxn];
int Fail[maxn];
ll Ans[26];
int AllCnt[26],BrdCnt[26];

void Init(){
	scanf("%s",a+1);
	scanf("%lld%lld",&L,&R);
	n=strlen(a+1)/2;
	int j=0;
	fo(i,2,n){
		while (j && a[j+1]!=a[i]) j=Fail[j];
		if (a[j+1]==a[i]) j++;
		Fail[i]=j;
	}
	Brd=n-Fail[n];
	fo(i,1,n) AllCnt[a[i]-'a']++;
	fo(i,1,Brd) BrdCnt[a[i]-'a']++;
}

void Calc(ll N,int Sig){
	if (N<=n){
		fo(i,1,N) Ans[a[i]-'a']+=Sig;
		return;
	}else fo(k,0,25) Ans[k]+=Sig*AllCnt[k];
	ll iSnum=1,iTnum=1,Res=N-n,iS=1,iT=0;
	while (N>iSnum*n+iTnum*Brd){
		Res=N-iSnum*n-iTnum*Brd;
		fo(k,0,25) Ans[k]+=Sig*(AllCnt[k]*(iSnum-iS)+BrdCnt[k]*(iTnum-iT));
		ll i=iS,j=iT;
		iS=iSnum,iT=iTnum;
		iSnum+=i;
		iTnum+=j;
	}
	if (Res)
		Calc(Res,Sig);
}
void Solve(){
	Calc(R,1);
	Calc(L-1,-1);
}

void Print(){
	fo(i,0,25) printf("%lld ",Ans[i]);
}

int main(){
	Init();
	Solve();
	Print();
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define INF 2147483647
#define SYOU(x) setprecision(x)
using namespace std;
long long i[300000];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a=0,b=0,c=0,d=0,e=1,f=0;
  cin >>a>>b>>c;
  for(int n=0;n<c;n++){
    cin >>d;
    i[d]++,f++;
  }
  for(int n=1;n<=a;n++){
    if(f-i[n]>=b) cout <<"No\n";
    else cout <<"Yes\n";
  }
  return (0);
}


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

ll calc(ll n) {
  if(n <= 0) return 0;
  if(n % 4 == 0) {
    return n;
  }else if(n % 4 == 1) {
    return 1;
  }else if(n % 4 == 2) {
    return 1 ^ n;
  }else {
    return 0;
  }
}

int main() {
  ll a, b;
  cin >> a >> b;
  cout << (calc(b) ^ calc(a - 1)) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <set>
#include <vector>
#include <cmath>
#include <bitset>
#include <functional>
#include <limits>
#include <map>
using namespace std;

typedef long long ll;
#define rep1(i, n) for(ll i = 1; i <=(ll)(n); i++)
#define rep0(i, n) for(ll i = 0; i <=(ll)(n); i++)

ll pow(ll a, ll n) { //compute a^n with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}

ll pow(ll a, ll n, ll mod) { //compute a^n (mod mod) with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

const int MAX = 199;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//順列計算
ll PER(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[n - k] % MOD) % MOD;
}

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    vector<ll> c(n);
    rep0(i, n-1) cin >> a[i];
    rep0(i, n-1) cin >> b[i];
    rep0(i, n-1) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    ll sum_b[n+1];
    sum_b[0] = 0;
    rep0(i, n-1){
        int idx = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
        sum_b[i+1] = sum_b[i] + idx;
    }

    ll cnt = 0;
    rep0(i, n-1){
        auto idx = lower_bound(b.begin(), b.end(), c[i]) - b.begin();
        cnt += sum_b[idx];
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 6052
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

long N, Q;
string s;
vector<unsigned char> t, d;

bool simulate(int i, unsigned char dir) {
    for (int q = 0; q < Q; q++) {
        if (t[q] == s[i]) {
            if (d[q] == 'L') i--;
            else             i++;
        }
        if (dir == 'L' && i < 0) return true;
        if (dir == 'R' && i >= N) return true;
    }
    return false;
}

int main() {
    cin >> N >> Q >> s;
    t.resize(Q);
    d.resize(Q);
    for (int q = 0; q < Q; q++) cin >> t[q] >> d[q];

    // left
    long Lmin = -1;
    long Lmax = N;
    long L;
    while (true) {
        L = (Lmin + Lmax) / 2;
        if (simulate(L, 'L')) {
            Lmin = L;
            if (Lmax - Lmin == 1) break;
        } else {
            Lmax = L;
            if (Lmax - Lmin == 1) {
                L--;
                break;
            }
        }
    }

    // right
    long Rmin = -1;
    long Rmax = N;
    long R;
    while (true) {
        R = (Rmin + Rmax) / 2;
        if (simulate(R, 'R')) {
            Rmax = R;
            if (Rmax - Rmin == 1) break;
        } else {
            Rmin = R;
            if (Rmax - Rmin == 1) {
                R++;
                break;
            }
        }
    }

    cout << N - (L+1) - (N-R) << endl;

    return 0;
}


Measured memory_bytes: 1028
#include <bits/stdc++.h>
#include <boost/dynamic_bitset.hpp>
using namespace std;
using u32 = uint32_t;
using u64 = uint64_t;
using s64 = int64_t;

int main() {
	u32 N, K, C;
	cin >> N >> K >> C;
	
	boost::dynamic_bitset<> days(N);
	
	for(u64 i=0; i<N; i++) {
		char c;
		cin >> c;
		days[i] = (c == 'o');
	}
	
	vector<u64> R(K, N+1);
	for(s64 i=N-1, r=K-1; i>=0 && r>=0;) {
		if(days[i]) {
			R[r] = i;
			i -= C + 1;
			r--;
		} else {
			i--;
		}
	}
	
	for(u64 i=0, l=0; i<N && l<K;) {
		if(days[i]) {
			if(R[l] == i) cout << i + 1 << endl;
			i += C + 1;
			l++;
		} else {
			i++;
		}
	}
	return 0;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
#define ll          long double
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define sz(a)       (ll)(a.size())
#define cr(P)       cout<<P<<"\n";return;
#define mem(a,val)  memset(a, val, sizeof(a))
#define fr(i,x,n)   for(ll i=x; i<n; i++)
#define frr(i,x,n)  for(ll i=n-1; i>=x; i--)
using namespace std;


const ll N   =  500005;
const ll mod = 1e9 + 7;



void solve(){

 ll x=0, y=0, c = 1, last = 1;
 int n, m, k;
 cin >> n >> k;
 ll a[n];
 for (int i = 0; i < n; ++i){
 	cin >> a[i];
 	a[i] = log10(a[i]);
 }
 for (int i = 0; i < k; ++i){
 	c+=a[i];
 }
 last =c;
 for (int i = k; i < n; ++i){
  	c-=a[i-k];
  	c+=a[i];
  	if(c > last){
  		c("Yes");
  	}
  	else {
  		c("No");
  	}
  	last = c;
 }

 
    
 
}

signed main(){
     
 ios_base::sync_with_stdio(false);   
 cin.tie(NULL);
 //int T;cin >> T;while (T--)
 solve();
 return 0;
}



Measured memory_bytes: 6960
#include<string>
#include<iostream>
using namespace std;
int main()
{
int a=0,b=0,ab=0,o=0;
string ss;
while(cin >> ss){
if(ss[ss.length()-2]=='A')ab++;
else if(ss[ss.length()-1]=='B')b++;
else if(ss[ss.length()-1]=='A')a++;
else o++;
}
cout << a << "\n" << b << "\n";
cout << ab << "\n" << o << "\n";
return 0;
}

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

int  gcd(int m, int n);
int lcm(int m,int n);

//?????§??¬?´???°??¨????°???¬?????°????±???????
int main()
{
	int a[50],b[50];
	int set = 0;
	while( cin >> a[set] >> b[set]){
		set++;
	}
	for(int i = 0;i < set; i++){
		cout << gcd(a[i], b[i]) << " " << lcm(a[i], b[i]) << endl;

	}

	return 0;
}

int gcd(int m, int n)
{
	if(0 == m || 0 == n)
		return 0;
	while(m != n){
		if(m > n){
			m = m - n;
		}else {
			n = n - m;
		}
	}
	return m;
}

int lcm(int m,int n)
{
	if(0 == m || 0 == n)
		return 0;
	return ((m / gcd(m, n)) * n);
}

Measured memory_bytes: 3056
#include<stdio.h>
#define INF 100000000
int m[101][101];
int p[101];
int n;
/*void matrixChainOrder(void){
  int i,j,k,q,l;
  for(i=1;i<=n;i++) m[i][i] = 0;
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j = i+l-1;
      m[i][j] = INF;
      for(k=i;k<=j-1;k++){
	q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	m[i][j] = m[i][j] > q ? q : m[i][j];
      }
    }
  }
}*/
int main(){
  int i,j,k,q,l;
  for(i=0;i<101;i++)
    for(j=0;j<101;j++) m[i][j] = INF;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d%d",&p[i-1],&p[i]);
  }

  for(i=1;i<=n;i++) m[i][i] = 0;
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j = i+l-1;
      m[i][j] = INF;
      for(k=i;k<=j-1;k++){
  q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
  m[i][j] = m[i][j] > q ? q : m[i][j];
      }
    }
  }

  printf("%d\n",m[1][n]);
  return 0;
}



Measured memory_bytes: 2056
#include<stdio.h>
char S[1212]; int ck[256];
int main() {
	scanf("%s", S);
	for (int i = 0; S[i]; i++)ck[S[i]] = 1;
	puts(((!(ck['W'] ^ ck['E'])) && (!(ck['N'] ^ ck['S']))) ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class ABC
{

    public static void Main(string[] args)
    {
        string S = Console.ReadLine();
        int output = 0;
        int a = 0, b = 0;

        for (int i = 0; i < S.Length; i++)
        {
            //
            if (i % 2 == 0)
            {//a 10101010

                if (S[i] == '0') a++;//101010
                else b++;

            }
            else
            {


                if (S[i] == '0') b++;
                else a++;

            }

        }

        Console.WriteLine(Math.Min(a,b));

    }
}

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

int main()
{
    int N;

    cin >> N;

    int V[N + 1];
    int C[N + 1];

    for (int i = 1; i <= N; i++)
    {
        cin >> V[i];
    }
    for (int i = 1; i <= N; i++)
    {
        cin >> C[i];
    }

    int get[N + 1]; //X-Y
    int ans = 0;

    for (int i = 1; i <= N; i++)
    {
        get[i] = V[i] - C[i];
        if (get[i] > 0)
        {
            ans = ans + get[i];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
from collections import Counter

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

c = counter[0]
for i in range(1, N):
    for k, v in c.items():
        c[k] = min(counter[i][k], c[k])

c = sorted(c.items())
answer = ""
for k, v in c:
    answer += k * v

print(answer)


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

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

Measured memory_bytes: 256
def main():
    N, K = (int(i) for i in input().split())
    H = [int(i) for i in input().split()]
    ans = 0
    H.sort(reverse=True)
    if N <= K:
        return print(ans)
    for h in H[K:]:
        ans += h
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 26024
#include <bits/stdc++.h>
using namespace std;
int main(){
	char c[10];
	scanf("%s",c);
	if(c[0]=='S') printf("Cloudy\n");
	else if(c[0]=='C') printf("Rainy\n");
	else if(c[0]=='R') printf("Sunny\n");
}


Measured memory_bytes: 256
n = int(input())
ans = [0] * n

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            d = x * x + y * y + z * z + x * y + y * z + z * x
            if d <= n:
                ans[d - 1] += 1

for i in ans:
    print(i)


Measured memory_bytes: 9344
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode
import sys
sys.setrecursionlimit(10 ** 6)

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

n,m = MI()
ans = ( 1900*m + 100*(n-m) ) * (2)**m
print(ans)

Measured memory_bytes: 72360
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
long dp[210000][5],i,j,L,MOD=(long)1e9+7;
string S;
void mod_add(long &a,long b){
  a+=b;
  if(a>=MOD)a-=MOD;
}
int main(){
  cin>>S;
  dp[0][0]=1;
  L=S.size();
  for(i=0;i<L;++i){
    for(j=0;j<5;++j){
      if(S[i]!='?')mod_add(dp[i+1][j],dp[i][j]);
      else mod_add(dp[i+1][j],dp[i][j]*3%MOD);
    }
    if(S[i]=='A'||S[i]=='?')mod_add(dp[i+1][1],dp[i][0]);
    if(S[i]=='B'||S[i]=='?')mod_add(dp[i+1][2],dp[i][1]);
    if(S[i]=='C'||S[i]=='?')mod_add(dp[i+1][3],dp[i][2]);
  }
  cout<<dp[L][3]<<endl;
}


Measured memory_bytes: 4608
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
//#define pi acos(-1.0)
#define P(type,x) fprintf(stdout,"%"#type"\n",x)

int main(){
	int i, j, n, m, d,ans,f,k;
	char map[101][101];
	fscanf(stdin, "%d%d%d", &n, &m, &d), getchar();
	for (i = 0; i < n; i++) fscanf(stdin, "%s", map[i]), getchar();
	ans = 0;
	for (i = 0; i < n; i++) 
		for (j = 0; j <= m - d; j++) {
			f = 1;
			for (k = 0; k < d; k++)if (map[i][j + k] == '#') f = 0;
			if (f) ans++;
		}
	for (i = 0; i <= n-d; i++)
		for (j = 0; j < m; j++) {
			f = 1;
			for (k = 0; k < d; k++)if (map[i+k][j] == '#') f = 0;
			if (f) ans++;
		}
	P(d, ans);
	return 0;
}

Measured memory_bytes: 620
import * as fs from 'fs'

//in
// 5 7 9
//out
// win
const func = (inp: string) => {
    const [a1, a2, a3]: number[] = inp.split(' ').map(Number);

    if (a1 + a2 + a3 >= 22) {
        console.log('bust');
    } else {
        console.log('win');
    }
};

func(fs.readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 7372
#include <algorithm>
#include <climits>
#include <iostream>
#include <queue>
#include <vector>

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

using namespace std;

int main() {
    int N, C;
    cin >> N >> C;
    constexpr int time = 100000 * 2;

    vector<vector<bool>> used(C, vector<bool>(time, false));

    REP(i, N) {
        int start, stop;
        cin >> start >> stop;
        int c;
        cin >> c;
        c--;

        for (int j = start * 2 - 1; j < 2 * stop; j++) {
            used[c][j] = true;
        }
    }

    int max_channels = 0;
    REP(t, time) {
        int use = 0;
        REP(c, C) {
            if (used[c][t]) use++;
        }
        max_channels = max(max_channels, use);
    }

    cout << max_channels << endl;

    return 0;
}


Measured memory_bytes: 1024
import collections
def main():

    N, M = map(int, input().split())
    graph = collections.defaultdict(list)
    for _ in range(M):
        a, b = map(int, input().split())
        graph[a].append(b)
        graph[b].append(a)

    # print(graph)

    cur = [[1, 1 << 1]]
    for _ in range(N-1):
        temp = []
        for a, h in cur:
            for b in graph[a]:
                if (h >> b) % 2 == 0:
                    temp.append([b, h | (1 << b)])
        cur = temp
        # print(cur)
    return len(cur)

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 4596
n,m,l = map(int,input().split())
a = []
b = []
for i in range(n):
  tmp = list(int(x) for x in input().split())
  a.append(tmp)
  
for j in range(m):
  tmp = list(int(x) for x in input().split())
  b.append(tmp)
  
for i in range(n):
  for j in range(l):
    sum = 0
    for k in range(m):
      sum += a[i][k] * b[k][j]
    if j == l-1:
      print(sum,end ="")
    else:
      print(sum,end =" ")
  print()


Measured memory_bytes: 6576
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, u, v, m;
  cin >> n >> u >> v >> m;
  vector<int> r = {u, v};
  vector<vector<vector<int>>> A(2, vector<vector<int>>(n, vector<int>(n)));
  for (int i = 0; i < 2; i++){
    for (int j = 0; j < n; j++){
      for (int k = 0; k < n; k++){
        cin >> A[i][j][k];
      }
    }
  }
  vector<int> C(m);
  for (int i = 0; i < m; i++){
    cin >> C[i];
  }
  vector<int> ans(2);
  for (int i = 0; i < 2; i++){
    int tv = m + 1;
    int fv = 0;
    while (tv - fv > 1){
      int mid = (tv + fv) / 2;
      set<int> st;
      for (int j = 0; j < mid; j++){
        st.insert(C[j]);
      }
      vector<vector<bool>> M(n, vector<bool>(n, false));
      for (int j = 0; j < n; j++){
        for (int k = 0; k < n; k++){
          if (st.count(A[i][j][k])){
            M[j][k] = true;
          }
        }
      }
      int cnt = 0;
      for (int j = 0; j < n; j++){
        bool ok = true;
        for (int k = 0; k < n; k++){
          if (!M[j][k]){
            ok = false;
          }
        }
        if (ok){
          cnt++;
        }
      }
      if (n > 1){
        for (int k = 0; k < n; k++){
          bool ok = true;
          for (int j = 0; j < n; j++){
            if (!M[j][k]){
              ok = false;
            }
          }
          if (ok){
            cnt++;
          }
        }
        bool ok1 = true;
        for (int j = 0; j < n; j++){
          if (!M[j][j]){
            ok1 = false;
          }
        }
        if (ok1){
          cnt++;
        }
        bool ok2 = true;
        for (int j = 0; j < n; j++){
          if (!M[j][n - 1 - j]){
            ok2 = false;
          }
        }
        if (ok2){
          cnt++;
        }
      }
      if (cnt >= r[i]){
        tv = mid;
      } else {
        fv = mid;
      }
    }
    ans[i] = tv;
  }
  if (ans[0] < ans[1]){
    cout << "USAGI" << endl;
  } else if (ans[0] > ans[1]){
    cout << "NEKO" << endl;
  } else {
    cout << "DRAW" << endl;
  }
}


Measured memory_bytes: 5548
#include <cstdio>
#include <cstring>
#define max(a,b) ((a)>=(b)?(a):(b))
int BIT[100001],n,k;
int sum(int i) {
	int s=0;
	while(i>0) {
		s+=BIT[i];
		i-=i&-i;
	}
	return s;
}
void add(int i,int x) {
	while(i<=n) {
		BIT[i]+=x;
		i+=i&-i;
	}
}
int main() {
	while(scanf("%d %d",&n,&k),n|k) {
		memset(BIT,0,sizeof(BIT));
		for(int i=1;i<=n;i++) {
			int a;
			scanf("%d",&a);
			add(i,a);
		}
		int mx=-1000000000;
		for(int i=1;i<=(n-k+1);i++) {
			mx=max(mx,sum(i+k-1)-sum(i-1));
		}
		printf("%d\n",mx);
	}
}

Measured memory_bytes: 1420
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }

int main() {
  string S;
  cin >> S;
  int cnt = 0;
  for(int i = 0; i < (S.size() / 2) ; i++) {
    if (S[i] != S[S.size()-i-1]) cnt++;
    // cout << S[i] << " " << S[S.size() - i -1] << endl;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
import itertools

x = int(input())

num = []

for i in range(201):
    num.append(i ** 5)

for a5, b5 in itertools.permutations(num, 2):
    if a5 - b5 == x:
        print(num.index(a5), num.index(b5))
        break
    elif a5 + b5 == x:
        print(num.index(a5), num.index(b5) * (-1))
        break

Measured memory_bytes: 9196
import java.util.Scanner;

public class Main {
	static int list[] = new int[26];
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		try{
			while(scan.hasNext()){
				String str = scan.nextLine();
				char ch[] = str.toCharArray();
				for(int i = 0; i < ch.length; i++){
					/*if(ch[i] == '.'){
						scan.close();
					}*/
					CountingCharacters(ch[i]);
				}
			}
		}catch(IllegalStateException e){
			/*char alp = 97;
			for(int i = 0; i < list.length; i++){
				alp = Character.valueOf((char) (97 + i));
				System.out.println(alp + " : " + list[i]);
			}*/
		}
		scan.close();
		//char alp = 97;
		for(int i = 0; i < list.length; i++){
			//alp = Character.valueOf((char) (97 + i));
			System.out.println((char)('a' + i) + " : " + list[i]);
		}
	}

	public static void CountingCharacters(char Ch){
		Ch = Character.toLowerCase(Ch);
		//char alp = 97;
		for(int i = 0; i < list.length; i++){
			//a to z = 97 to 122
			if(Ch == 'a' + i){
				list[i]++;
			}
		}
	}
}

Measured memory_bytes: 26516
#include<cstdio>
const int N=3005,md=1e9+7;
int f[N][N],rg[N],pre[N],n,m;
char ss[N];
inline void upd(int&a){a+=a>>31&md;}
int main(){
	scanf("%d%d%s",&n,&m,ss+1);
	for(int i=1;i<=n;++i)pre[i]=pre[i-1]+ss[i]-48,rg[i]=i;
	for(int i=1;i<=m;++i){
		int l,r;
		scanf("%d%d",&l,&r);
		if(rg[l]<r)rg[l]=r;
	}
	for(int i=2;i<=n+1;++i)if(rg[i-1]>rg[i])rg[i]=rg[i-1];
	f[1][pre[rg[1]]]=1;
	for(int i=1;i<=n;++i)
	for(int _1=0;_1<=n;++_1)
	if(int d=f[i][_1]){
		int s1=pre[rg[i+1]]-pre[rg[i]],_0=rg[i]-i+1-_1;
		if(_1)upd(f[i+1][_1-1+s1]+=d-md);if(_0)upd(f[i+1][_1+s1]+=d-md);
	}
	printf("%d\n",f[n+1][0]);
	return 0;
}

Measured memory_bytes: 33792