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

#define INF 99999999
using namespace std;

void print_v(vector<int> v) {
    for (int i : v) {
        cout << i << " ";
    }
    cout << endl;
}
int mod = 1e9+7;
int main() {
    int n, m, a, b, ans = 0;
    cin >> n >> m;
    int h;
    vector<int> vh(n);
    vector<vector<int>> pass(n);
    for (int i = 0; i < n; ++i) {
        cin >> h;
        vh[i] = h;
    }
    for (int i = 0; i < m; ++i) {
        cin >> a >> b;
        pass[a-1].push_back(b-1);
        pass[b-1].push_back(a-1);
    }
    for (int i = 0; i < n; ++i) {
        bool flag = true;
        auto u = pass[i];
        for (auto j: u) {
            if(vh[i] <= vh[j]) {
                flag = false;
            }
        }
        if(flag){
            ++ans;
    }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))
#define MOD 1000000007
long long modinv(long long a, long long m = MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}



typedef long long ll;
ll fact[2000005];
ll pw[2000005];
long long comb(long long n, long long r){
    return (((fact[n] * modinv(fact[r])) % MOD) * modinv(fact[n-r])) % MOD;
}
int main(){
    fact[0] = 1;
    pw[0] = 1;
    for(int i=1; i< 2000003;i++) fact[i] = (fact[i-1] * i) % MOD;
    for(int i=1; i< 2000003;i++) pw[i] = (pw[i-1] * 25) % MOD;
    long long int k; string s; cin >> k >> s;
    ll sum = 0;
    ll ss = s.length();
    for(int i=ss; i<=ss+k;i++){
        sum = (sum + comb(ss+k, i) * pw[ss+k - i]) % MOD;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 36520
//write：Sakura
//id：
//problem：
//note：

#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

typedef long long ll;

ll n,x;

ll gcd(ll n,ll m){
	if(m==0)return n;
	else return gcd(m,n%m);
}

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%lld %lld",&n,&x);
	printf("%lld\n",3*n-3*gcd(n,x));
	return 0;
}


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

string s;
int ans = 0, tmp = 0;

int main(){
  cin >> s;

  for(int i = 0; i < s.size(); i++){
    if(s[i] == 'A' || s[i] == 'T'|| s[i] == 'C' || s[i] == 'G'){
      tmp++;
    }
    else{
      if(ans < tmp)
        ans = tmp;
      tmp = 0;
    }
    if(ans < tmp)
      ans = tmp;
  }

  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
using lint  =                           long long int;
using plint =                           pair<lint, lint>;
using pint  =                           pair<int, int>;
#define vli                             vector<lint>
#define pb                              push_back
#define ALL(x)                          begin(x),end(x)
#define inf                             (1LL<63)-1
#define MOD 1000000007
#define SZ(x)                           ((lint)(x).size())
#define                                 FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define                                 IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define                                 REP(i, n) FOR(i,0,n)
#define                                 IREP(i, n) IFOR(i,0,n)
#define                                 f_ip   ios_base::sync_with_stdio(false); cin.tie(NULL);
#define                                 debug(x) cerr << #x << " " << (x) << endl
struct fast_ios                         { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T>                    istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T>                    bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T>                    bool mmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }


/* -------
         |
    **   |
   -------      
   |
   ---------------------------------------------------------------------------------------------------------------------------------*/

void solve(){  
  int N;
  cin >> N;
  int ret = 0;
  vector<vector<pint>> xy(N);
  REP(i,N){
      int a;
      cin >> a;
      while(a--){
          int x,y;
          cin >> x >> y;
          xy[i].emplace_back(x-1,y); //converting to 0 based indexing;
      }
  }
  REP(S,(1<<N)){       //getting the ith position of the given mask;
      bool f = true;
      REP(i,N){
           int b = (S>>i) & 1;                     //S >> i to shift the current mask and with 00000....1 to isolate the first bit of the shifted mask;
           if (!b)  continue;
           for(auto p : xy[i]){   //queris of this honest person;
               if (((S >> p.first)& 1)^p.second) f=false;          //any discrepancy between the two is marked as 1; the original S mask is not disturbed;
           }
      }
      if(f)   mmax(ret,__builtin_popcount(S));
  }
  cout<<ret<<endl;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=10005,INF=1<<29;
int P,Q,R;
int expr(string &S,int &i);
int term(string &S,int &i);
int factor(string &S,int &i);
int number(string &S,int &i);
string T="012PQR";

int expr(string &S,int &i){
    int ret=term(S,i);
    
    while(i<S.size()&&(S[i]=='+'||S[i]=='*')){
        char c=S[i];
        i++;
        int to=term(S,i);
        
        if(c=='+') ret=max(ret,to);
        else if(c=='*') ret=min(ret,to);
    }
    
    return ret;
}

int term(string &S,int &i){
    int ret;
    if(S[i]=='-'){
        i++;
        ret=2-term(S,i);
    }else ret=factor(S,i);
    
    return ret;
}

int factor(string &S,int &i){
    bool ok=false;
    for(int j=0;j<6;j++) if(S[i]==T[j]) ok=true;
    
    if(ok) return number(S,i);
    
    i++;
    
    int ret=expr(S,i);
    
    i++;
    
    return ret;
}

int number(string &S,int &i){
    int ret;
    if(isdigit(S[i])) ret=int(S[i]-'0');
    else{
        if(S[i]=='P') ret=P;
        else if(S[i]=='Q') ret=Q;
        else ret=R;
    }
    
    i++;
    return ret;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        string S;cin>>S;
        if(S[0]=='.') break;
        
        int cnt=0;
        
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                for(int k=0;k<3;k++){
                    int ii=0;
                    P=i;
                    Q=j;
                    R=k;
                    
                    if(expr(S,ii)==2) cnt++;
                }
            }
        }
        
        cout<<cnt<<endl;
    }
}




Measured memory_bytes: 3088
/*  ex7_3
    Rikuta  */

#include <stdio.h>

int main(void)
{
    int height, width, flag;
    char **matrix_given;
    int **on_off_matrix;

    //与えられる行列の高さと幅の入力
    scanf("%d %d\n", &height, &width);

    //height*(width+1)の行列の動的確保．確保できなかったらエラー処理
    matrix_given = (char **)calloc(height, sizeof(char *));
    if (matrix_given==NULL)
    {
        exit(1);
    }
    for (int i = 0; i < height; i++)
    {
        matrix_given[i] = (char *)calloc(width+1, sizeof(char));
        if (matrix_given[i]==NULL)
        {
            exit(1);
        }
        
    }

    //height*(width+1)の行列の動的確保．確保できなかったらエラー処理
    on_off_matrix = (int **)calloc(height, sizeof(int *));
    if (on_off_matrix == NULL)
    {
        exit(1);
    }
    for (int i = 0; i < height; i++)
    {
        on_off_matrix[i] = (int *)calloc(width+1, sizeof(int));
        if (on_off_matrix[i] == NULL)
        {
            exit(1);
        }
    }
    for (int i = 0; i < height; i++)
    {
        for (int j = 0; j < width + 1; j++)
        {
            //改行込みで与えられた行列を受け取る
            scanf("%c", &matrix_given[i][j]);
        }
    }
    for (int i = 0; i < height; i++)
    {
        //フラグを立てる
        flag = 1;
        for (int j = 0; j < width; j++)
        {
            if (matrix_given[i][j] == '#')
            {
                //i行について着目したときに#が一個でもあればフラグを0とする
                flag = 0;
            }
        }
        //もしi行について#がいっこもなければ
        if (flag)
        {
            for (int j = 0; j < width + 1; j++)
            {
                //on_off_matrixのi行目を1にする
                on_off_matrix[i][j] = 1;
            }
        }
    }
    for (int i = 0; i < width; i++)
    {
        //フラグを立てる
        flag = 1;
        for (int j = 0; j < height; j++)
        {
            if (matrix_given[j][i] == '#')
            {
                //i列について着目したときに#が一個でもあればフラグを0にする
                flag = 0;
            }
        }
        //i列について，#がなければ
        if (flag)
        {
            for (int j = 0; j < height; j++)
            {
                //on_off_matrixのi列目を1にする
                on_off_matrix[j][i] = 1;
            }
        }
    }

    for (int i = 0; i < height; i++)
    {
        for (int j = 0; j < width + 1; j++)
        {
            if (!on_off_matrix[i][j])
            {
                //与えられた行列の要素に対応するon_off_matrixが0ならばそれを出力する．
                printf("%c", matrix_given[i][j]);
            }
        }
    }

    //メモリの開放
    for (int i = 0; i < height; i++)
    {
        free(matrix_given[i]);
        free(on_off_matrix[i]);
    }
    free(matrix_given);
    free(on_off_matrix);

    return 0;
}

Measured memory_bytes: 1696
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace AtCoder {
    class Program {
        static void Main(string[] args) {

            var input = new int[5];
            for (int i = 0; i < 5; i++) {
                input[i] = int.Parse(Console.ReadLine());
            }

            var d = input.Select(x => ((x + 9) / 10 * 10) - x).Max();
            var ans = input.Select(x => (x + 9) / 10 * 10).Sum() - d;

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13268
using System;
using System.Collections.Generic;
class Program
{

    static void Main()
    {
        string[] NXT = Console.ReadLine().Split(' ');
        int N = int.Parse(NXT[0]);
        int X = int.Parse(NXT[1]);
        int T = int.Parse(NXT[2]);
        int count = 0;
        int K = 0;

        while(true)
        {
            count += T;
            K += X;
            if(K>=N)
            {
                break;
            }
        }
        Console.WriteLine(count);

    }

}



Measured memory_bytes: 27308
#include <cstdio>

int main (int argc, char const* argv[])
{
	int a,b,c,d,l;
	scanf("%d%d%d%d%d",&l,&a,&b,&c,&d);
	
	a=(a-1)/c+1;
	b=(b-1)/d+1;
	
	if(a>b)l=l-a;
	else l=l-b;
	
	printf("%d\n",l);
	
	return 0;
}

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



int main(void){
    int n;
    cin >> n;
    for(ll i = 1; i <= n; ++i){
        int cnt = 0;
        for(ll x = 1; x * x <= i; ++x){
            ll a = x * x;
            for(ll y = 1;; ++y){
                ll b = a + y * y + x * y;
                if(b > i) break;
                for(ll z = 1;; ++z){
                    ll c = b + z * z + y * z + z * x;
                    if(c > i) break;
                    if(c == i) ++cnt;
                }
            }
        }
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 3620
import numpy as np
n, k = map(int, input().split())
a = list(map(int, input().split()))

m = np.sum(np.array(a) < 0) - 1

cs = list(np.abs(a))
result = []
for s, e in zip(range(0, n - k + 1), range(k - 1, n + 1)):
    if(s <= m and e > m):
        left = cs[s]
        right = cs[e]

        result.append(left * 2 + right)
        result.append(left + right * 2)
    elif s <= m:
        result.append(cs[s])
    else:
        result.append(cs[e])
print(min(result))


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

int N;
int M;
int s[7];
int c[7];

int ans[4] = {-8192,-1,-1,-1};

int main(){
    cin >> N >> M;
    for(int i = 1;i < M+1;i++){
        cin >> s[i] >> c[i];
    }

    // 重複していないかチェック
    for(int i = 1;i < M+1;i++){
        if(ans[s[i]] == -1 || ans[s[i]] == c[i]){
            ans[s[i]] = c[i];
        }else{
            cout << -1 << endl;
            exit(0);
        }
    }

    // 特殊なパターンを先に処理
    if(ans[1] == 0 and ans[2] == -1 and ans[3] == -1 && N == 1){
        cout << 0 << endl;
        exit(0);
    }

    if(N >= 2){
        if(ans[1] == 0){
            cout << -1 << endl;
            exit(0);
        }
    }

    if(N == 1){
        if(ans[1] == -1){
            ans[1] = 0;
        }

        cout << ans[1] << endl;
        exit(0);
    }
    if(N == 2){
        if(ans[1] == -1){
            ans[1] = 1;
        }
        if(ans[2] == -1){
            ans[2] = 0;
        }

        cout << ans[1] << ans[2] << endl;
        exit(0);
    }
    if(N == 3){
        if(ans[1] == -1){
            ans[1] = 1;
        }
        if(ans[2] == -1){
            ans[2] = 0;
        }
        if(ans[3] == -1){
            ans[3] = 0;
        }

        cout << ans[1] << ans[2] << ans[3] << endl;
        exit(0);
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    long long n, m, d;
    cin >> n >> m >> d;

    double retval;

    if(d == 0) {
        retval = (double)(m - 1) * 1 / n;
    } else {
        retval = (double)(2 * (n - d)) * (m - 1) / n / n;
    }

    printf("%.10f\n", retval);

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
const int offset=100000;
int n,a[100005],s[1000050];
long long bit[1000050];
int lowb(int x)
{
	return x&-x;
}
void add(int x)
{
	while(x<=2*offset)
	{
		bit[x]++;
		x+=lowb(x);
	}
}
long long cal(int x)
{
	long long ans=0;
	while(x>=1)
	{
		ans+=bit[x];
		x-=lowb(x);
	}
	return ans;
}
bool check(int x)
{
	memset(bit,0,sizeof(bit));
	for(int i=1;i<=n;i++)
		s[i]=s[i-1]+(a[i]>=x?1:-1);
	long long sum=0;
	for(int i=0;i<=n;i++)
	{
		sum+=cal(s[i]+offset);
		add(s[i]+offset);
	}
	return sum>=1ll*n*(n+1)/4;
}
int main()
{
	cin>>n;
	int l=0,r=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		r=max(r,a[i]);
	}
	while(l<=r)
	{
		int m=(l+r)/2;
		if(check(m))
			l=m+1;
		else
			r=m-1;
	}
	cout<<r<<endl;
	return 0;
}


Measured memory_bytes: 11008
//#pragma GCC optimize(2)
#include<cstdio>
#define L 1<<23
#define C (c=*A++)
#define ENS //__attribute__((optimize("-O2")))
#define NES //__attribute__((optimize("-O2"))) __inline__ __attribute__((always_inline))
#define N 1000001

int MAPLE,n,l[N],r[N],cnt,last,wt,ss[19];char fl[L],*A=fl,s[N],t[N];bool fg=true;
NES void read(int&x){char c;for(x=0;'0'>C||c>'9';);while('0'<=c&&c<='9')x=(x<<3)+(x<<1)+c-48,C;}NES void print(int x){if(!x)putchar(48);else{for(wt=0;x;ss[++wt]=x%10,x/=10);for(;wt;putchar(ss[wt--]+48));}}
ENS int main()
{int i,j;char c;
	for(fl[fread(fl,1,L,stdin)]=EOF,read(n);'a'>C||c>'z';);for(i=1;i<=n;s[i]=c,C,i++);while('a'>C||c>'z');for(i=1;i<=n;t[i]=c,C,i++);
	for(last=i=n,j=n+1;i;fg&=s[i]==t[i],i--)
		if(t[i]!=t[i-1])
		{if((--j)>i)j=i;
			for(;j&&s[j]!=t[i];j--);if(!j)return puts("-1"),0;
			l[++cnt]=j,r[cnt]=last,last=i-1;
		}if(fg)return puts("0"),0;for(l[0]=n+1,i=1;i<=cnt;i++)for(;l[i-MAPLE]<r[i]+MAPLE;MAPLE++);print(MAPLE);
}

Measured memory_bytes: 14080
#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <map>
// #include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a * b / gcd(a,b);
}

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    ll N, D;
    cin >> N >> D;

    cout << (N / (2*D+1)) + (N % (2*D+1) > 0) << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int n=0,a=0,flag=1;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a);
        if(a%2==0){
            if(a%3!=0 && a%5!=0){
                flag=0;
            }
        }
    }

    if(flag==1) printf("APPROVED");
    else printf("DENIED");
    return 0;
}


Measured memory_bytes: 1736
//From Naruto to Hokage
//#include <RJ>
#include<bits/stdc++.h>
using namespace std;

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    ll n,m,x;
    cin>>n>>m;
    // ll ans[n+1];
    ll dp[(1<<12)];
    // memset(dp,hell,sizeof(dp));
    rep(i,0,(1<<12)-1) dp[i]=hell;
    dp[0]=0;
    rep(i,1,m){
        ll cost,t,fk;
        cin>>cost>>t;
        ll curr=0;
        rep(j,1,t){
            cin>>fk;
            fk--;
            curr|=(1<<fk);
        }
        rep(j,0,(1<<n)-1){
            dp[j|curr]=min(dp[j|curr],dp[j]+cost);
        }
    }
    // rep(i,0,(1<<n))
    if(dp[(1<<n)-1]==hell) cout<<-1;
    else cout<<dp[(1<<n)-1];
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

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

using ll=long long;
const ll MOD=1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n),b(n),c(n-1);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=0;i<n;i++){
    cin >> b[i];
  }
  for(int i=0;i<n-1;i++){
    cin >> c[i];
  }
  int ans=0;
  for(int i=0;i<n;i++){
    ans +=b[i];
  }
  for(int i=0;i<n-1;i++){
    for(int j=1;j<n;j++){
      if(a[i]==j&&a[i+1]==j+1){
        ans +=c[j-1];
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    int ac=0,wa=0,tle=0,re=0;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        if(s=="AC")
            ac+=1;
        else if(s=="WA")
            wa+=1;
        else if(s=="RE")
            re+=1;
        else
            tle+=1;
    }
    cout<<"AC"<<" x "<<ac<<endl;
     cout<<"WA"<<" x "<<wa<<endl;
      cout<<"TLE"<<" x "<<tle<<endl;
       cout<<"RE"<<" x "<<re<<endl;

    return 0;
}


Measured memory_bytes: 3656
# include <bits/stdc++.h>
  typedef long long ll;
#define pii  pair<int,int>
#define vpii vector<pii>
#define vll  vector<ll>
#define vi  vector<int>
#define pb push_back
#define f  first
#define s  second
#define all v.begin(),v.end()
#define fio ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
typedef unsigned long long ulll;
 
using namespace std ;
int main () {

  string s,t,u;
  cin>>s>>t>>u;
  
  cout<<char(s[0]-32)<<char(t[0]-32)<<char(u[0]-32);
   
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
   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; }
    const int MAX =200002;
const int MOD =1000000007;

     signed main(){
        int n;
        cin>>n;
       string s[n],x="MARCH";
       for(int i=0;i<n;i++)cin>>s[i];
       int k[5]={},ans=0;
       for(int i=0;i<n;i++)for(int j=0;j<5;j++)if(s[i][0]==x[j])k[j]++;
       for(int i=0;i<5;i++)for(int j=i+1;j<5;j++)for(int ii=j+1;ii<5;ii++)ans+=k[i]*k[j]*k[ii];
       cout<<ans<<endl;

   }
     


 


 






    





      

        


Measured memory_bytes: 6700
// 2020-06-22 19:10:19
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = int_fast64_t;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  int n;
  ll a[3];
  cin >> n >> a[0] >> a[1] >> a[2];
  vector<vector<int> > q(n+10, vector<int>(2, 0));
  rep(i, n) {
    string s; cin >> s;
    if(s == "AB") {
      q[i][0] = 0, q[i][1] = 1;
    } else if(s == "AC") {
      q[i][0] = 0, q[i][1] = 2;
    } else {
      q[i][0] = 1, q[i][1] = 2;
    }
  }
  q[n][0] = 0, q[n][1] = 1;
  string ans = "";
  auto add = [&](int x) {
    ans += 'A' + x;
  };
  rep(i, n) {
    int l = q[i][0], r = q[i][1];
    int l2 = q[i+1][0], r2 = q[i+1][1];
    if(!a[l] && !a[r]) {
      cout << "No\n";
      return;
    } else if(!a[l]) {
      a[l]++; a[r]--; add(l);
    } else if(!a[r]) {
      a[l]--; a[r]++; add(r);
    } else if(l == l2 || l == r2) {
      a[l]++; a[r]--; add(l);
    } else {
      a[l]--; a[r]++; add(r);
    }
  }
  cout << "Yes\n";
  rep(i, n) {
    cout << ans[i] << "\n";
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 9028
class Combination:
    """
    SIZEが10^6程度以下の二項係数を何回も呼び出したいときに使う
    使い方:
    comb = Combination(SIZE, MOD)
    comb(10, 3) => 120
    """

    def __init__(self, N, MOD=10 ** 9 + 7):
        self.MOD = MOD
        self.fact, self.inv = self._make_factorial_list(N)

    def __call__(self, n, k):
        if k < 0 or k > n:
            return 0
        res = self.fact[n] * self.inv[k] % self.MOD
        res = res * self.inv[n - k] % self.MOD
        return res

    def _make_factorial_list(self, N):
        fact = [1] * (N + 1)
        inv = [1] * (N + 1)
        MOD = self.MOD
        for i in range(1, N + 1):
            fact[i] = (fact[i - 1] * i) % MOD
        inv[N] = pow(fact[N], MOD - 2, MOD)
        for i in range(N, 0, -1):
            inv[i - 1] = (inv[i] * i) % MOD
        return fact, inv


if __name__ == "__main__":
    H, W, A, B = map(int, input().split())
    mod = 10 ** 9 + 7

    comb = Combination(2 * 10 ** 5 + 10, mod)

    ans = 0
    x = H - A
    y = B + 1
    while x > 0 and y <= W:
        path1 = comb(x + y - 2, x - 1)
        path2 = comb(H - x + W - y, H - x)
        ans = (ans + path1*path2) % mod
        x -= 1
        y += 1

    print(ans)


Measured memory_bytes: 18804
import java.util.*;
import java.io.*;
class Main{
  public static void main(String args[])throws IOException{
    int a = 1-readI();
    pl(a+"");
  }

  static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
  public static String read(){
    try{
      return ctos((char)br.read());
    }catch(IOException e){
      e.printStackTrace();
      return "";
    }
  }
  public static char readC(){
    try{
      return (char)br.read();
    }catch(IOException e){
      e.printStackTrace();
      return (char)-1;
    }
  }
  public static String readL(){
    try{
      return br.readLine();
    }catch(IOException e){
      e.printStackTrace();
      return "";
    }
  }
  public static String readS(){
    StringBuilder sb = new StringBuilder();
    while(true){
      try{
        int k = br.read();
        if(k==-1||(char)k==' '||(char)k=='\n'){break;}
        sb.append((char)k);
      }catch(IOException e){
        e.printStackTrace();
      }
    }
    return sb.toString();
  }
  public static int readI(){
    return stoi(readS());
  }
  public static long readLong(){
    return stol(readS());
  }
  public static long stol(String s){
    return Long.parseLong(s);
  }
  public static String[] readSs(){
    return readL().split(" ");
  }
  public static int[] readIs(){
    return stoi(readSs());
  }
  public static int stoi(String s){
    return Integer.parseInt(s);
  }
  public static int[] stoi(String s[]){
    int a[]=new int[s.length];
    for(int i=0;i<s.length;i++){
      a[i]=stoi(s[i]);
    }
    return a;
  }
  public static String itos(int i){
    return String.valueOf(i);
  }
  public static String[] itos(int[] a){
    String s[]=new String[a.length];
    for(int i=0;i<a.length;i++){
      s[i]=itos(a[i]);
    }
    return s;
  }
  public static String ctos(char c){
    return String.valueOf(c);
  }
  public static String cstos(char[] c){
    return new String(c);
  }
  public static char stoc(String s){
    return s.charAt(0);
  }
  public static char[] stocs(String s){
    return s.toCharArray();
  }
}


Measured memory_bytes: 36456
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

long long gcd(long long a, long long b) { return b ? gcd(b, a%b) : a;}

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

    int x, y;
    cin >> x >> y;
    cout << gcd(x, y) << endl;
}



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

typedef long long ll;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

// bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
//     return arg1.first > arg2.first;
// }

// template<class T> void chmin(T& a, T b) {
//     if (a > b) {
//         a = b;
//     }
// }

// template<class T> void chmax(T& a, T b) {
//     if (a < b) {
//         a = b;
//     }
// }

int main(void) {
    int s;
    cin >> s;

    vector<int> vec;
    vec.push_back(s);
    int cnt = 1;
    while(1) {
        if(s%2==0) s /= 2;
        else s = 3*s+1;

        auto itr = lower_bound(vec.begin(), vec.end(), s);
        //cout << s << " " << *itr << endl;
        if(s==*itr) {
            cout << cnt+1 << endl;
            return 0;
        }
        else vec.push_back(s);
        sort(vec.begin(), vec.end());
        cnt++;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 60
#define M 1000000007
typedef long long LL;

LL read()
{
	char c;
	while((c = getchar()) < 48 || c > 57);
	LL x = c - 48;
	while((c = getchar()) > 47 && c < 58) x = x * 10 + c - 48;
	return x;
}

int main() 
{
	LL p2[N + 1], m2, x, sum = 0, y;
	int i, j, c1[N] = {0}, n;
		
	scanf("%d", &n);
	for(p2[j = 0] = 1, i = 1; i <= N; j = i++){
		p2[i] = p2[j] << 1;
	}
	for(i = 1; i <= n; i++){
		x = read();
		for(j = 0; x >= p2[j]; j++){
			if(x & p2[j]) c1[j]++;
		}
	}
	for(i = 0, m2 = 1, y = (LL)n; i < N; i++){
		x = (LL)c1[i];
		sum += x * (y - x) % M * m2 % M;
		m2 <<= 1;
		if(m2 >= M) m2 -= M;
	}
	printf("%lld\n", sum %= M);
	
	return 0;
}

Measured memory_bytes: 128
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.Queue;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//StringBuffer S = new StringBuffer(sc.next());
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)
	//Map<Integer, Integer> map = new HashMap<Integer, Integer>(N);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> dd=new ArrayDeque<>();//push後ろに入れる,poll(pop)後ろからとる,peek addは先頭に入るからバグ注意
	//ArrayList<Integer> cc = new ArrayList<>(N);
	//cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static long mod =1000000007;
	static long longINF=1000000000000000007L;
	static int INF=1000000007;

	
	public static void main(String[] args) {
		//StringBuffer str = new StringBuffer(sc.nextInt());
		//for(int i=0;i<N;i++) {}
		//int a[]=new int[N];for(int i=0;i<N;i++) {a[i]=sc.nextInt();}
		//String S=sc.next();
		
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		
		p(Math.min(C, B/A));
		
		
		
		
		
	}
		
		
		
		
		
	
	
	
	static long bi(int i) {
		long t=1;
		for(int a=1;a<=i;a++) {
			t*=a;
			t%=mod;
		}
		return t;
	}
	public static long modPow(long g,long N) {
		long T=1;
		for(int i=0;i<N;i++) {
			T*=g;
			T%=mod;
		}
		return T;
	}
	static void bit() {
		int n=3;
		String[] ar = {"a","b","c"};
		for(int i =0;i<(1<<n);i++) {
			String S="";
			for(int j=0;j<n;j++) {
				if((1&i>>j)==1) {
					S+=ar[j];
				}
			}
			p("S="+S);
		}
	}
	public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
	}
	
	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


Measured memory_bytes: 21844
S=input()
RL=[]
LR=[]
N=len(S)
for i in range(N-1):
    if S[i]=='R' and S[i+1]=='L':
        RL.append(i)
    elif S[i]=='L' and S[i+1]=='R':
        LR.append(i)
LR.append(N)
j=0
k=0
cnt=[0 for i in range(N)]
for i in range(N):
    if i>LR[k]:
        j+=1
        k+=1
    if abs(RL[j]-i)%2==0:
        cnt[RL[j]]+=1
    else:
        cnt[RL[j]+1]+=1
for i in range(N):
    print(cnt[i],end=' ')
print()


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

int ketacnt(long long x){
  int cnt=0;
  while(x>0){
    x=x/10;
    cnt++;
  }
  
  return cnt;
}

int main(){
  long long n;
  int ans=0;
  cin>>n;
  
  ans=ketacnt(n);
  
  for(long long i=1;i*i<=n;i++){
    if(n%i==0){
      const long long j=n/i;
      const int tmpmax=max(ketacnt(i),ketacnt(j));
      ans=min(ans,tmpmax);
    }
  }
  
  cout<<ans<<endl;
  
  return 0;
}


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

/*
問題文
2つの正整数 a, bが与えられます。
a, bの平均値を xとします。 xの小数点以下を切り上げて得られる整数を出力してください。

制約
a, bは整数である。
 1≤a, b≤100
*/
int main(){
  int a = 0;
  int b = 0;
  double x = 0.0;
  scanf("%d", &a);
  scanf("%d", &b);
  if(a < 1 || 100 < b){
    return 1;
  }
  x = ((double)a + (double)b) / 2.0;
  if((x - (int)x) == 0.0){
    cout << (int)x << endl;
  } else {
    cout << (int)x + 1 << endl;
  }
  return 0;
}

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

const long long mod = 1e9 + 7;

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

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

  long long ans = 0;
  for(int i = 0; i < 60; i++){
    long long bit = (1LL << i);
    long long zero_count = 0, one_count = 0;
    for(int j = 0; j < N; j++){
      if(A[j] & bit){
	one_count++;
      }else{
	zero_count++;
      }
    }
    ans += (bit % mod) * ((zero_count * one_count) % mod) % mod;
  }

  cout << (ans % mod) << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    string s;
    cin >> s;
    bool tuyo=true;
    int n=s.length();
    rep(i,n/2){
        if(s[i]!=s[n-i-1])tuyo=false;
    }
    rep(i,n/2){
        if(s[i]!=s[(n-1)/2-i-1])tuyo=false;
    }
    rep(i,n-(n+3)/2){
        if(s[i+(n+3)/2-1]!=s[n-i-1])tuyo=false;
    }
    if(tuyo)cout << "Yes";
    else cout << "No";


    
}

Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7; 
const int MINF = -1050000000;

int main() {
	string s;
	cin >> s;
	int x = s.size();
	int cnt = 0;
	if (x % 2 == 0) {
		rep(i, x / 2) {
			if (s[i] != s[x - 1 - i]) cnt++;
		}
	}

	else {
		rep(i, x / 2) {
			if (s[i] != s[x - 1 - i]) cnt++;
		}
	}
	cout << cnt << endl;
	
	return 0;
}


Measured memory_bytes: 256
/* template.cpp [[[ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)s)
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)s)
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
ll in(){ ll x; cin >> x; return x; }
vector<ll> in(size_t n){ vector<ll> v(n); each(x, v) cin >> x; return v; }
/* ]]] */

int n, m;
int p[200000], q[200000], c[200000];
vector<pair<int, int>> g[500000];
int d[500000];

int main(){
  cin >> n >> m;
  rep(i, m) cin >> p[i] >> q[i] >> c[i];
  rep(i, m) p[i]--, q[i]--, c[i]--;

  map<pair<int, int>, int> z;
  rep(i, n) z[{i, -1}] = -1;
  rep(i, m) z[{p[i], c[i]}] = -1;
  rep(i, m) z[{q[i], c[i]}] = -1;
  int idx = 0;
  each(x, z) x.sc = idx++;
  
  rep(i, m) g[z[{p[i], -1}]].emplace_back(z[{p[i], c[i]}], 1);
  rep(i, m) g[z[{p[i], c[i]}]].emplace_back(z[{p[i], -1}], 0);
  rep(i, m) g[z[{q[i], -1}]].emplace_back(z[{q[i], c[i]}], 1);
  rep(i, m) g[z[{q[i], c[i]}]].emplace_back(z[{q[i], -1}], 0);
  rep(i, m) g[z[{p[i], c[i]}]].emplace_back(z[{q[i], c[i]}], 0);
  rep(i, m) g[z[{q[i], c[i]}]].emplace_back(z[{p[i], c[i]}], 0);
  
  using S = pair<int, int>;
  priority_queue<S, vector<S>, greater<S>> pq;
  fill_n(d, 500000, inf);
  d[z[{0, -1}]] = 0;
  pq.emplace(0, z[{0, -1}]);
  while (pq.size()){
    int sm, v;
    tie(sm, v) = pq.top(), pq.pop();
    if (d[v] < sm) continue;
    each(e, g[v]){
      int u, cs;
      tie(u, cs) = e;
      if (d[u] > sm + cs){
        d[u] = sm + cs;
        pq.emplace(sm + cs, u);
      }
    }
  }

  int res = d[z[{n - 1, -1}]];
  cout << (res == inf ? -1 : res) << endl;
}


Measured memory_bytes: 67572
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 12 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
const int dm = 1 << 20;
char dn[dm], * di = dn;
inline void putint(int X) {
	if (X == 0) {
		*di++ = '0';
		*di++ = '\n';
		return;
	}
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

pair<int, int> E[200001];
int he[100001], kotae[100001], C;
char d[100001];
void sagasu(int P, int D) {
	if (!kotae[P]) kotae[P] = C;
	if (d[P] < D) {
		d[P] = D;
		for (int p = he[P]; p; p = E[p].second) {
			sagasu(E[p].first, D - 1);
		}
	}
}

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


	int N, M, Q;
	N = getint();
	M = getint();
	int k = 1;
	rep(i, M) {
		int a = getint(), b = getint();
		E[k] = mp(a, he[b]);
		he[b] = k++;
		E[k] = mp(b, he[a]);
		he[a] = k++;
	}
	Q = getint();
	int v[100000], d[100000], c[100000];
	rep(i, Q) {
		v[i] = getint();
		d[i] = getint();
		c[i] = getint();
	}
	for (int i = Q - 1; i >= 0; i--) {
		C = c[i];
		sagasu(v[i], d[i]);
	}
	rep1(i, N) putint(kotae[i]);

	fwrite_unlocked(dn, di - dn, 1, stdout);

	Would you please return 0;
}

Measured memory_bytes: 4736
import itertools

n, m = map(int, input().split())
ks = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
ans = 0

for i in itertools.product([0, 1], repeat=n):
    for j in range(m):
        s = 0
        for k in range(1, ks[j][0]+1):
            if i[ks[j][k]-1] == 1:
                s += 1
        if s % 2 != p[j]:
            break
    else:
        ans += 1
print(ans)

Measured memory_bytes: 40432
import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
from copy import copy, deepcopy
from operator import itemgetter

from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
#dequeを使うときはpython3を使う、pypyはダメ
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds

#mod = 10**9+7
#w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

#N = int(input())
N, M, Q = map(int, input().split())
L = [list(map(int, input().split())) for i in range(Q)]
#A = list(map(int, input().split()))
l=[1]*N

def next(i):
    if i==N-1:
        if l[i]==M:
            return True
        else:
            l[i]+=1
            return False
    x=next(i+1)
    if x:
        if l[i]==M:
            return True
        else:
            lp=l[i]+1
            for j in range(i,N):
                l[j]=lp
            return False
    else: return False

def score(l):
    sc=0
    for z in L:
        a,b,c,d=z[0],z[1],z[2],z[3]
        if l[b-1]-l[a-1]==c:
            sc+=d
    return sc

b=False
ans=0
while b==False:
    ans=max(ans,score(l))
    b=next(0)
print(ans)







Measured memory_bytes: 76692
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <numeric>
using namespace std;

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

const double PI = acos(-1.0);

void solve(long long N, long long K, std::vector<long long> p) {
    sort(p.begin(), p.end());
    cout << accumulate(p.begin(), p.begin() + K, 0) << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    long long K;
    scanf("%lld", &K);
    std::vector<long long> p(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &p[i]);
    }
    solve(N, K, std::move(p));
    return 0;
}


Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '[' << #x << " is: " << x << "] " <<"\n";
#define imod(a , n) (a % n + n ) % n ;
#define int long long
const double eps = 1e-9 , PI = acos(-1) ;
const int N = 105, oo = 1e9 , M = 1e5 + 5;
int dp[N][M];
int n , w , wt[N] , val[N];
int32_t main(){

    cin >> n >> w ;
    for(int x = 0 ; x < n ; x++)
        cin >> wt[x] >> val[x] ;
    for(int i = 0 ; i <= w ; i++)dp[n][i] = 0;
    for(int idx = n - 1 ; idx >= 0 ; idx--){
        for(int k = 0 ; k <= w ;k++ ){
            int ret = dp[idx + 1][k];
            if(k >= wt[idx]){
                ret = max(ret , dp[idx + 1][k - wt[idx]] + val[idx]);
            }
            dp[idx][k] = ret ;
        }
    }
    cout << dp[0][w];

    return 0;
}


Measured memory_bytes: 80128
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;

const int INF = 1e9 ;
const int maxN = 1e5 + 5;

int n,a,b;
int p[maxN];
int main()
{
	scanf("%d%d%d",&n,&a,&b);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&p[i]);
	}
	int c1 = 0,c2 = 0,c3 = 0;
	for(int i=1;i<=n;i++)
	{
		if(p[i]<=a)
		{
			c1 ++;
		}
		else if(p[i]>= a+1 && p[i]<=b)
		{
			c2 ++;
		}
		else if(p[i] > b)
		{
			c3++;
		}
	}
	int ans = min(min(c1,c2),c3);
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 256
/*****************************************************

@author: vichitr
Compiled On: 1st Sept 2019

*****************************************************/
#include<bits/stdc++.h>
#define MAX 9223372036854775807
#define endl "\n"
#define ll long long
#define int long long
#define double long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define ip pair<int, int>

#define loop(i,n) for(int i=0;i<n;i++)
#define loops(i,s,n) for(int i=s;i<=n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
using namespace std;

const ll MOD = 1009;
const ll SZ = 107;
const ll N = 5e5+7;

ll pwr(ll x, ll y)
{
    ll r = 1LL;
    while(y)
    {
        if(y&1)
            r = (r * x) % MOD;
        y >>= 1;
        x = (x * x) % MOD;
    }
    return r;
}

int inv(int x)
{
	return pwr(x, MOD-2ll);
}

int n, m; 

void solve()
{
	cin>>n;
	int a[n];
	loop(i, n) cin>>a[i];
	int ans = 0;
	int mx = a[0], k=0;
	for(int i=1;i<n;i++)
	{
		if(a[i]<=mx)
		{
			mx = a[i];
			k++;
		}
		else{
			mx = a[i];
			k = 0;
		}
		ans = max(ans, k);
	}
	cout<<ans;
}

signed main()
{
    fast;
    int t=1;
    // cin >>t;
    while(t--){
        solve();
        
    }
    return 0;
}

/*****************************


****************************/


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int d(int x){
    int s=0;
    do{
        s++;
        x/=10;
    }while(x>0);
    return s;
}
int main(){
    int n;cin>>n;
    int s=0;
    for(int i=1;i<=n;++i)
    if(d(i)%2==1)s++;
    cout<<s;
    return 0;
}

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

int main(){
  int n;
  long ts=1, as=1;
  cin >> n;
  for(int i=0; i<n; i++){
    long t, a, k;
    cin >> t >> a;
    k=max(ts%t==0 ? ts/t : ts/t+1, as%a==0 ? as/a : as/a+1);
    ts=k*t;
    as=k*a;
  }
  cout << ts+as;
  return 0;
}

Measured memory_bytes: 256