akhauriyash/Code-Regression huggingface dataset:
// Problem : A - Not
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
 
#define endl "\n"
#define int long long
#define FAST {ios_base::sync_with_stdio(false);cin.tie(NULL);}
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
#define rep(n) for(int i=0;i<(n);i++)
#define rrep(n) for(int i=(n)-1;i>=0;i--)
#define mem(a,b) memset((a),(b),sizeof (a))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define INF (long long) 1e18
#define MOD 1000000007


void solve(){
      int a,b,c,d;
      cin>>a>>b>>c>>d;
      int maxm = a*c;
      maxm = max(maxm,a*d);
      maxm = max(maxm,b*d);
      maxm = max(maxm,b*c);
      cout<<maxm<<endl;
      
}

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




Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
  constexpr int t = 5;
  ll n; cin >> n;
  vector<ll> v(t);
  REP(i, t) cin >> v[i];

  ll m = *min_element(v.begin(), v.end());

  ll d = n / m + (n % m != 0);

  cout << 5 + d-1 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define ssort(a) sort(a.begin(), a.end())
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


#define MAX_V 300000

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

int V;
vector<edge> G[MAX_V];
ll d[MAX_V];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+MAX_V, INFll);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    cin >> V;
    int E;
    cin >> E;
    int s;
    cin >> s;
    if(s>=2504){
      s=2504;
    }
    for (int i=0; i<E; ++i) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        //有向グラフ
        a--; b--;
        rep(j, 2505){
          if(j-c>=0){
            edge e = {b+50*(j-c), d};
            G[a+50*j].push_back(e);
            edge e2 = {a+50*(j-c), d};
            G[b+50*j].push_back(e2);
          }
        }
    }
    rep(i, V){
      int nc, nd;
      cin >> nc >> nd;
      rep(j, 2505){
        if(j+nc<=2504){
          edge e3 = {i+50*(j+nc), nd};
          G[i+50*j].push_back(e3);
        } else {
          edge e4 = {i+50*2504, nd};
          G[i+50*j].push_back(e4);
        }
      }
    }
    dijkstra(50*s);
    repo(i, V-1){
      ll ans=INFll;
      rep(j,2505){
        ans=min(d[i+50*j], ans);
      }
      cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 25176
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

typedef long long ll;

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

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

const ll MOD = 1e9 + 7;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
ll gcd (ll a , ll b) {
   if (b == 0) return a;
   return gcd(b, a % b);
}
ll lcm (ll a, ll b) {
   return gcd(a, b) * (a / gcd(a, b)) * (b / gcd(a, b));
}

int main() {
   ll A, B, C, D;
   cin >> A >> B >> C >> D;

   ll tmp1 = A - 1;
   tmp1 -= (A - 1) / C + (A - 1) / D - (A - 1) / lcm(C, D);
   ll tmp2 = B;
   tmp2 -= B / C + B / D - B / lcm(C, D);
   if (tmp2 < tmp1) cout << 0 << endl;
   else cout << tmp2 - tmp1 << endl;

   return 0;
}


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

char conv[128];

int main() {
  int n;
  while(cin >> n && n) {
    for(int i = 0; i < 128; ++i) conv[i] = i;
    for(int i = 0; i < n; ++i) {
      char a, b;
      cin >> a >> b;
      conv[a] = b;
    }
    int m;
    cin >> m;
    while(m--) {
      char c;
      cin >> c;
      cout << conv[c];
    }
    cout << endl;
  }
}

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


int main() {

    int n;
    string s;
    map<string,int>mp;
    cin>>n;
    while(n--) {
        cin>>s;
        mp[s]++;
    }
    string testCases[4] = {"AC", "WA", "TLE","RE"};
    for(int i=0;i<4;i++) {
        cout<<testCases[i]<<" x "<<mp[testCases[i]]<<endl;
    }

    return 0;
}




Measured memory_bytes: 3592
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    int N;
    cin >> N;
    long min = pow(10, 9);
    long max = 1;
    for (int i = 0; i < N; ++i) {
        long tmp;
        cin >> tmp;
        min = std::min(min, tmp);
        max = std::max(max, tmp);
    }
    cout << max - min << endl;
}

Measured memory_bytes: 3616
N = int(input())
FLG=1

n = [int(x) for x in input().split()]

for i in range(N):
  if n[i]%2 == 0:
    # print(n[i]%2)
    if n[i]%3 != 0:
      if n[i]%5 != 0:
        FLG=0
   
if FLG == 0:
  ans = "DENIED"
else:
  ans = "APPROVED"

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 998244353;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
const int biggg = 2000000000;
const long long bigggest = 1000000000000000000LL;
const double eps = .0000000001; 

int main ()
{
  prep();
  long long n, a, b;
  cin >> n >> a >> b;
  long long mod = n%(a+b);
  cout << (n/(a+b))*a+min(mod, a);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define maxii 200005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
 vector<int> vi[maxii];
 vector<int>::iterator child;
typedef vector<lln> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


int arr[maxii];
int arr2[maxii];


int main()
{
   string a;
   getline(cin,a);
   int len=a.length() ;
   cout<<a[0];
   for(int i=1;i<len;i++)
   {
       if(a[i]>='A' && a[i]<='Z' && a[i-1]==' ')
       {
           cout<<a[i];
       }
   }
}






Measured memory_bytes: 8284
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define MOD 998244353
//#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)


//階乗,二項係数
//*
ll fact[2000010];
ll invfact[2000010];
void makefact(int n,ll m){
	n=min(n,m-1);
	fact[0]=1;
	rep(i,0,n)fact[i+1]=fact[i]*(i+1)%m;
	invfact[n]=invp(fact[n],m);
	for(int i=n;i>0;i--)invfact[i-1]=invfact[i]*i%m;
}
ll choose(int n,int r,int m){return n<0||r<0||n-r<0?0:fact[n]*invfact[r]%m*invfact[n-r]%m;}
//*/

int main(){
	ll n,m;
	scanf("%lld%lld",&n,&m);
	makefact(2000005,MOD);
	ll ans=0;
	rep(i,m,m*3/2+1){
		//和がiになるようn個に振り分け
		ll aa=choose(i+n-1,n-1,MOD);
		//m以上は使えない
		ll bb=n*choose(i-m+n-1,n-1,MOD);
		//m未満しかないときは好きにできる
		ll cc=(aa-bb)%MOD*choose(n,m*3-i*2,MOD);
		//mが1つある(⇔i-mをn-1個に振り分け)
		ll dd=n*choose(i-m+n-2,n-2,MOD);
		//mを避けて好きに割り振れる
		ll ee=dd%MOD*choose(n-1,m*3-i*2,MOD);
		//足す
		ans=(ans+cc+ee)%MOD;
	}
	printf("%lld",(ans+MOD)%MOD);
}

Measured memory_bytes: 31360
#include<bits/stdc++.h>
using namespace std;
int a[4][4],c[4][4],b[105];
int i,j,k,t;

bool is_h(){
	for(i=1;i<=3;i++)
	if(c[i][1]==true&&c[i][2]==true&&c[i][3]==true)
	return true;
	
	return false;
}

bool is_l(){
	for(i=1;i<=3;i++)
	if(c[1][i]==true&&c[2][i]==true&&c[3][i]==true)
	return true;
	
	return false;
}

bool is_d(){
	if((c[1][1]==true&&c[2][2]==true&&c[3][3]==true)||(c[1][3]==true&&c[2][2]==true&&c[3][1]==true))
	return true;
	
	return false;
}

int main(){
	for(i=1;i<=3;i++)
	for(j=1;j<=3;j++)
	cin>>a[i][j];
	
	cin>>t;
	for(k=1;k<=t;k++){
		cin>>b[k];
		for(i=1;i<=3;i++)
		for(j=1;j<=3;j++)
		if(a[i][j]==b[k])
		c[i][j]=true;	
	}
	
	if(is_h()||is_l()||is_d())
	cout<<"Yes";
	else
	cout<<"No";
	
	return 0;
}

Measured memory_bytes: 256
from heapq import heappush, heappop

INF = float('inf')

n = int(input())
dn = {v: [] for v in range(n)}
for _ in range(n - 1):
    a, b, c = map(int, input().split())
    dn[a - 1] += [(b - 1, c)]
    dn[b - 1] += [(a - 1, c)]

q, k = map(int, input().split())
xy = [map(int, input().split()) for _ in range(q)]

dd = [INF] * n
queue = []
heappush(queue, (0, k - 1))
while queue:
    d, v = heappop(queue)
    for neighbor, c in dn[v]:
        dtmp = d + c
        if dtmp < dd[neighbor]:
            dd[neighbor] = dtmp
            heappush(queue, (dtmp, neighbor))


for x, y in xy:
    print(dd[x - 1] + dd[y - 1])


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

static const int N = 1000;

int lcs(string X, string Y) {
    int c[N+1][N+1];
    int m = X.size();
    int n = Y.size();
    int maxl = 0;
    X = ' ' + X; // X[0]に空白を挿入
    Y = ' ' + Y; // Y[0]に空白を挿入
    for (int i = 0; i <= m; i++) c[i][0] = 0;
    for (int j = 1; j <= n; j++) c[0][j] = 0;

    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= n; j++) {
            if (X[i] == Y[j]) {
                c[i][j] = c[i-1][j-1] + 1;
            } else {
                c[i][j] = max(c[i-1][j], c[i][j-1]);
            }
            maxl = max(maxl, c[i][j]);
        }
    }

    return maxl;
}

int main() {
    string s1, s2;
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s1 >> s2;
        cout << lcs(s1, s2) << endl;
    }
    return 0;
}


Measured memory_bytes: 7120
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0,1,0,-1 };
const ll dy[4] = { -1, 0, 1,0 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////
struct edge { int to, cost; };
using Graph = vector<vector<int>>;
ll dist[100100][3];
int main() {
	int N, M; cin >> N >> M;
	Graph G;
	G.assign(N, vector<int>());
	int s, t;
	for (int i = 0; i < M; ++i) {
		int u, v; cin >> u >> v;
		--u, --v;
		G[u].push_back(v);
	}
	cin >> s >> t;
	--s, --t;
	memset(dist, -1, sizeof(dist));
	dist[s][0] = 0;
	queue<pii>que;
	que.push({ s,0 });
	while (!que.empty()) {
		pii cur = que.front();
		que.pop();
		int v = cur.first;
		int parity = cur.second;
		for (auto nv : G[v]) {
			int np = (parity + 1) % 3;
			if (dist[nv][np] == -1) {
				dist[nv][np] = dist[v][parity] + 1;
				que.push({ nv,np });
			}
		}
	}
	if (dist[t][0] == -1) {
		cout << -1 << endl;
	}
	else {
		cout << dist[t][0] / 3 << endl;
	}
	return 0;
}

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

using namespace __gnu_pbds;
using namespace std;

using ll = long long;
using ld = long double;

#define mp make_pair

typedef tree<
        pair<int, int>,
        null_type,
        less<pair<int, int>>,
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;


int p = 1000000007;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}


mt19937 rnd(time(0));

/*
const int N = 1200000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/



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

    int n;
    cin>>n;

    vector<pair<pair<int, int>, int>> a(n);

    for (int i = 0; i<n; i++)
    {
        cin>>a[i].first.first>>a[i].first.second;
        a[i].second = i;
    }

    sort(a.begin(), a.end());

    vector<int> maxx(n), minn(n);
    minn[0] = a[0].first.second;
    for (int i = 1; i<n; i++)
    {
        minn[i] = min(minn[i-1], a[i].first.second);
    }

    maxx[n-1] = a[n-1].first.second;
    for (int i = n-2; i>=0; i--)
    {
        maxx[i] = max(maxx[i+1], a[i].first.second);
    }

    vector<int> breaks;
    breaks.push_back(0);
    for (int i = 0; i<n-1; i++) if (minn[i]>maxx[i+1]) breaks.push_back(i+1);
    breaks.push_back(n);

    vector<int> answer(n);

    for (int i = 0; i+1<breaks.size(); i++)
    {
        for (int j = breaks[i]; j<breaks[i+1]; j++) answer[a[j].second] = breaks[i+1] - breaks[i];
    }

    for (int i = 0; i<n; i++) cout<<answer[i]<<endl;


}



Measured memory_bytes: 7948
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
ll mod=1000000007;
typedef pair<int, int> P;

int main()
{
    int n;
    cin >> n;
    int cnt=0;
    for(int i=1; i<=n; i++){
        string s;
        s=to_string(i);
        if(s.size()%2==1) cnt++;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template <class c
#define ris return *this
#define dor > debug& operator<<
#define eni(x)                                                                 \
    sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(   \
              c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
    ~debug() { cerr << endl; }
    eni(!=) cerr << boolalpha << i;
    ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
    sim dor(const c&) { ris; }
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
template <typename T>
using indexed_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define sz(v) (int)(v.size())
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define mem(a, s) memset(a, s, sizeof(a))
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define repr(i, a, b) for (int i = a; i >= b; --i)
#define MAX 8000000000000000064LL
#define MIN -8000000000000000064LL
typedef vector<int> vi;
typedef stack<int> sti;
typedef queue<int> qi;
typedef pair<int, int> pii;
typedef set<int> si;
typedef map<int, int> mii;
typedef vector<pii> vpi;
int _x[] = {0, 0, -1, 1, -1, 1, -1, 1};
int _y[] = {-1, 1, 0, 0, 1, -1, -1, 1};
void solve();

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    // cin >> t;
    rep(i, 1, t) { solve(); }
    return 0;
}

void solve() {
    int s;
    cin >> s;
    if (s <= 2) {
        cout << 0;
        return;
    }
    int dp[2005] = {0};
    dp[0] = 1;
    rep(i, 0, s - 1) {
        rep(j, i + 3, s) { dp[j] = (dp[j] + dp[i]) % mod; }
    }
    cout << dp[s];
}


Measured memory_bytes: 3640
<?php
list($n) = ints();
$a = ints();
for ($i = 0; $i < $n; ++$i) $cnt[$a[$i]] = true;
$k = count($cnt);
echo ($n - $k) % 2 ? $k - 1 : $k;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


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

#define ll long long

using namespace std;

ll n, k, res = 0;
int main(){
    cin >> n >> k;
    for(ll i = k + 1; i <= n; ++i){
        res += max(n%i - k + 1, 0LL);
        if(!k) res--;
        res += n/i * (i - k);
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,e)for(int i=0;i<e;i++)
#define PI acos(-1)
using namespace std;

int main(){
    int i, j;
    string str;
    int m;
    while(1){
        cin >> str;
        if(!str.compare("-"))break;
        cin >> m;
        rep(i,m){
            int h;
            cin >> h;
            string s = str.substr(0,h);
            str.erase(0,h);
            str+=s;
        }
        cout << str << endl;
    }
    return 0;
}


Measured memory_bytes: 3236
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <functional>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define MAX_DWORD				(0xFFFFFFFF)
#define	MAX_SDWORD				((SDWORD)0x7FFFFFFF)
#define	MIN_SDWORD				((SDWORD)0x80000000)
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define	MIN_QWORD				((QWORD)0x0000000000000000)
#define	MAX_SQWORD				((SQWORD)0x7FFFFFFFFFFFFFFF)
#define	MIN_SQWORD				((SQWORD)0x8000000000000000)
#define M_PI					3.14159265358979323846
#define deg_to_rad(deg)			(((deg)/180)*M_PI)
#define rad_to_deg(rad)			((rad*180)/M_PI)
#define prique(T)				priority_queue<T, vector<T>, greater<T>>

typedef long					SDWORD;
typedef long long				SQWORD;
typedef unsigned long			DWORD;
typedef unsigned long long int	QWORD;
typedef pair<int, int> P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
#define N_MAX	(200 * 1000)
#define K_MAX	(10)
#define M_MAX	(10)
#define H_MAX	(1000)
#define W_MAX	(1000)

int main()
{
	int A, B, C;
	cin >> A >> B >> C;

	int res = A - B;
	if (C < res) {
		cout << 0;
	} else {
		cout << C - res;
	}
	cout << endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    ll a;
    double b;
    cin >> a >> b;
    ll c = 100*b + 0.05;
    cout << a*c/100 << endl; 
    return 0;
}

Measured memory_bytes: 3740
s = str(input()) + '0'
ans = [0] * (len(s))

cnt = 0
for i in range(len(s)):
    ans[i] = cnt
    if s[i] == '<':
        cnt += 1
    else:
        cnt = 0

cnt = 0
for i in range(len(s))[::-1]:
    ans[i] = max(cnt,ans[i])
    if s[i-1] == '>':
        cnt += 1
    else:
        cnt = 0

print(sum(ans))


Measured memory_bytes: 48240
//“ In order to be irreplaceable, one must always be different”
#include <bits/stdc++.h>
using namespace std;
# define ll long long
#define endl "\n"
# define pi 3.14159265359
#define mod 1000000007
# define str string
# define vll vector<ll>
# define vstr vector<str>
# define vchar vector<char>
# define pb push_back
# define mll map<ll,ll>
#define mchar map<char, ll>
# define mstr map<str,ll>
# define vp vector< pair<ll,ll> >
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
# define f(x,y) for(int x=0;x<y;x++)
# define r(x,y) for(int x=y;x>=0;x--)
# define loop(x,y,z) for(int x=y;x<z;x++)
ll power(ll a , ll b){ll res=1;for(ll i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}
ll gcd(ll a, ll b){
    if(b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a, b);
}
void print(vll a){
    for(int i=0;i<a.size();i++){
        cout<<a[i]<<' ';
    }
    cout<<endl;
}
vll inp(int n){
    vll a;
    ll x;
    f(i,n){
        cin>>x;
        a.pb(x);
    }
    return a;
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
   ll x,y,a,b;
   cin>>x>>y>>a>>b;
   ll c=0,c1=0;
   while(x>0){
       x-=b;
       c++;
   }
   while(a>0){
       a-=y;
       c1++;
   }
   if(c1>c){
       cout<<"No";
   }
   else{
       cout<<"Yes";
   }
    return 0;
}

Measured memory_bytes: 3652
import heapq
import sys
sys.setrecursionlimit(10**6)

N,u,v = map(int, input().split())

es = [[] for _ in range(N+1)]

for i in range(N-1):
    a,b = map(int, input().split())
    es[a].append(b)
    es[b].append(a)

INF = float("inf")
from_u = [INF] * (N+1)
from_u[u] = -1
from_v = [INF] * (N+1)
from_v[v] = -1

def solve(prev, curr, distances):
    distances[curr] = distances[prev] + 1
    for next in es[curr]:
        if distances[next] == INF:
            solve(curr, next, distances)

solve(u,u,from_u)
solve(v,v,from_v)



ans = 0
for i in range(1,N+1):
    if from_u[i] < from_v[i]:
        # 追い詰めた段階で高橋君が自ら青木君のマスに戻ってくるので、最後の端っこまで追い詰めなくていいから-1
        ans = max(ans, from_v[i]-1)

print(ans)

Measured memory_bytes: 101596
ns = input().rstrip()
n = int(ns)
k = len(ns)
if k == 1:
    ans = n
else:
    ans = 0
    for i in range(0, k - 1, 2):
        ans += 9 * (10 ** i)
    if k % 2 == 1 and k > 2:
        ans += n - (10 ** (k - 1)) + 1
print(ans)


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

const int MOD = 1000000007;
const int INF = 1e9;

int main(){
  int n;
  const int max_n = 1e5;
  string s[max_n + 1];

  cin >> n;
  for(int i = 0; i < n; i++) cin >> s[i];

  int ac = 0;
  int wa = 0;
  int tle = 0;
  int re = 0;
  for(int i = 0; i < n; i++){
    if(s[i] == "AC") ac ++;
    else if(s[i] == "WA") wa ++;
    else if(s[i] == "TLE") tle ++;
    else if(s[i] == "RE") re ++;
  }
  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: 6752
#include <bits/stdc++.h>
#include <stdlib.h>
#include <iostream>
using namespace std;

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long m) {
    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;
}

const int MOD = 1000000007;


long long COM2(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    if(2 * k > n) return COM2(n, n-k);

    long long ret = 1;
    for(int i = 0;i < k;i++){

        ret = (ret * (n-i) % MOD) * modinv(i+1, MOD) % MOD;

    }
    return ret;
}


int main() {
    long long n;
    long long a;
    long long b;
    cin >> n >> a >> b;

    long long ans = 0;
    ans = modpow(2, n, MOD) - 1;
    // // if(ans < 0) ans += MOD;
    // cout << ans << endl;

    ans = ans - COM2(n, a);
    while(ans < 0) ans = ans + MOD;
    // cout << ans << endl;

    ans = ans - COM2(n, b);
    while(ans < 0) ans = ans + MOD;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
using namespace std;
using ll = long long;
const ll INF = 100100100100100;
const ll mod = 1000000007;

int main()
{
	ll X, Y;
	cin >> X >> Y;
	ll cnt = 0;
	while (X <= Y) {
		X *= 2;
		cnt++;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256
import math
import collections
n = int(input())

ans = 0

a = []
while n % 2 == 0:
    a.append(2)
    n //= 2
f = 3
while f * f <= n:
    if n % f == 0:
        a.append(f)
        n //= f
    else:
        f += 2
if n != 1:
    a.append(n)

if a == []:
    print(0)
else:
    c = collections.Counter(a)
    for i in c.values():
        m = 1
        while 2*(i+1)>(m+1)*(m+2):
            m += 1
        ans += m
    print(ans)

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

int main()
{
	int x, g = 0;
  	cin >> x;
  
  	while (x >= 500) {
      x -= 500;
      g += 1000;
    }
  	while (x >= 5) {
      x -= 5;
      g += 5;
    }
  	cout << g << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl a[5];
    intl k;
    cin(i,a);
    cin >> k;
    sort(a,a + 5);
    fp(a[4] - a[0] > k,":(","Yay!");
    return 0;
}

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

using namespace std;

void chmin(long long &a, long long b) { if (a > b) a = b; }

const auto INF = 1ull << 60u;

vector<long long> a, b, c;
long long dp[51][510][510];

int main() {
    int N;
    long long ma, mb;
    cin >> N >> ma >> mb;

    a.resize(N);
    b.resize(N);
    c.resize(N);
    for (int i = 0; i < N; ++i) {
        cin >> a[i] >> b[i] >> c[i];
    }

    for (int i = 0; i < 51; ++i) {
        for (int j = 0; j < 510; ++j) {
            for (int k = 0; k < 510; ++k) {
                dp[i][j][k] = INF;
            }
        }
    }

    dp[0][0][0] = 0;
    for (int i = 0; i < N; ++i) {
        for (int wa = 0; wa < 500; ++wa) {
            for (int wb = 0; wb < 500; ++wb) {
                if (dp[i][wa][wb] >= INF) continue;
                chmin(dp[i + 1][wa][wb], dp[i][wa][wb]);
                chmin(dp[i + 1][wa + a[i]][wb + b[i]], dp[i][wa][wb] + c[i]);
            }
        }
    }

    long long ans = INF;
    for (int wa = 1; wa < 500; ++wa) {
        for (int wb = 1; wb < 500; ++wb) {
            if (wa * mb != wb * ma) continue;
            chmin(ans, dp[N][wa][wb]);
        }
    }

    if (ans < INF) {
        cout << ans << endl;
    } else {
        cout << -1 << endl;
    }
    return 0;
}



Measured memory_bytes: 103936
#include <stdio.h>
#include <math.h>

int main(void){
	int X, rX, flag = 0;
	scanf("%d", &X);
	rX = (int)sqrt(X);
	for (int i = X; i < 100200; i++) {
		for (int j = 2; j <= rX; j++) {
			if (i % j == 0) {
				flag = 1;
				break;
			}
		}
		if (flag == 0) {
			printf("%d", i);
			return 0;
		}
		flag = 0;
	}
}

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

int main() {
  char b;
  cin >> b;
  
  if (b == 'A') cout << 'T' << endl;
  if (b == 'T') cout << 'A' << endl;
  if (b == 'C') cout << 'G' << endl;
  if (b == 'G') cout << 'C' << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef map<ll, int> mlli;

int main() {FIN
	
	ll i, m = 0, n, p = 1, d = 0;
	string num;
	mlli md;
	cin >> num;
	n = (int)num.size();
	
	mlli::iterator it;
	for (i = n - 1; i >= 0; i--) {
		d = (d + ((num[i] - '0') * p) % 2019) % 2019;
		it = md.find(d);
		if (it != md.end())
			m += it->second;
		p = (p * 10) % 2019;
		md[d]++;
	}
	it = md.find(0);
	if (it != md.end())
		m += it->second;
	
	cout << m << "\n";
	
	return 0;
}


Measured memory_bytes: 3820
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
const int MAX=510000;
const int MOD=998244353;
ll fan[MAX],inv[MAX],finv[MAX];
void COMinit(){
  fan[0]=fan[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(ll i=2;i<MAX;i++){
    fan[i]=fan[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}
ll COM(ll a,ll k){
  if(a<0||k<0)return 0;
  if(a<k)return 0;
  return fan[a]*(finv[a-k]*finv[k]%MOD)%MOD;
}
int main(){
ll N,A,B,K;
cin>>N>>A>>B>>K;
COMinit();
ll ans=0;
for(ll i=0;i<=N;i++){
  ll j=(K-i*A)/B;
  if(i*A+j*B!=K)continue;
  ans+=(COM(N,i)*COM(N,j))%MOD;
  ans%=MOD;
}
  while(ans<0){
    ans+=MOD;
  }
  cout<<ans%MOD<<endl;
}

Measured memory_bytes: 12160
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()
#define pb push_back

#define error(x) cout << #x << " = " << x << endl

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;

const int N = 1e7 + 20, mod = 998244353;
int n, fac[N], inv[N], ans;

inline int pw (int a, int b)
{
	int res = 1;
	while (b)
	{
		if (b & 1) res = 1ll * res * a % mod;
		a = 1ll * a * a % mod;
		b >>= 1;
	}

	return res;
}

inline int C (int n, int k)
{
	return 1ll * fac[n] * inv[k] % mod * inv[n - k] %mod;
}

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

	fac[0] = inv[0] = 1;
	for (int i = 1; i < N; i++)
	{
		fac[i] = 1ll * fac[i - 1] * i % mod;
		inv[i] = pw(fac[i], mod - 2);
	}

	cin >> n;

	n /= 2;

	ans = pw(3, 2 * n);

	for (int i = n + 1; i <= 2 * n; i++)
	{
		int res = C(2 * n, i);
		res = 2 * res % mod;

		res = 1ll * res * pw(2, 2 * n - i) % mod;

		ans = (ans + mod - res) % mod;

	}
	
	cout << ans << '\n';
}


Measured memory_bytes: 78464
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
using namespace std;

void solve(){
    int n;
    cin>>n;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    ll ans=0;
    for(ll i=0;i<60;++i){
      ll one=0,zero=0;
      rep(j,n){
        if(a[j]&1)++one;
        else ++zero;
        a[j]>>=1LL;
      }
      ll calc=0;
      calc=(zero*one)%mod;
      rep(j,i){
        calc<<=1LL;
        calc%=mod;
      }
      calc%=mod;
      ans+=calc;
      ans%=mod;
    }
    cout<<ans<<"\n";
}
 
int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 2560
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int n) { return n & 1; }
constexpr bool even(const int n) { return ~n & 1; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first >> p.second; return is; }
using namespace std;
// clang-format on

template<typename T> class RangeUpdateSegTree {
  int size = 1;
  std::vector<pair<size_t, T>> tree; // 1-indexed
  size_t time = 1;

public:
  RangeUpdateSegTree(const int n = 0) {
    while (size < n) size *= 2;
    tree.resize(size * 2);
  }

  RangeUpdateSegTree(const int n, const T &x) {
    while (size < n) size *= 2;
    tree.assign(size * 2, {0, x});
  }

  template<typename InputIterator> RangeUpdateSegTree(InputIterator first, InputIterator last) {
    int n = std::distance(first, last);
    while (size < n) size *= 2;
    tree.resize(size * 2);

    auto result = tree.begin();
    while (first != last) {
      result->second = *first;
      ++result, ++first;
    }
  }

  // [l, r)
  void update(int l, int r, const T &x) {
    for (l += size, r += size; l < r; l /= 2, r /= 2) {
      if (l & 1) tree[l++] = {time, x};
      if (r & 1) tree[--r] = {time, x};
    }
    time++;
  }

  const T operator[](int i) const {
    pair<size_t, T> p = tree[i += size];
    while (i /= 2) p = max(p, tree[i]);
    return p.second;
  }
};

main {
  int n, q;
  cin >> n >> q;
  RangeUpdateSegTree<int> rast(n, 2147483647);
  while (q--) {
    int a;
    cin >> a;
    if (a) {
      int i;
      cin >> i;
      cout << rast[i] << endl;
    } else {
      int s, t, x;
      cin >> s >> t >> x;
      rast.update(s, t + 1, x);
    }
  }
}



Measured memory_bytes: 7080
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int x = 0;
  
  for (int i = 0; i < N; i++) {
    int l_i, r_i;
    cin >> l_i >> r_i;
    
    x += r_i - l_i + 1;
  }
  
  cout << x << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
const double PI=acos(-1);
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; }

int main(){
	string s; cin>>s;
	ll sum=0;
	rep(i,0,s.size()){
		int a=s[i] -'0';
		sum+=a;
	}
	if(sum%9==0){
		cout<<"Yes"<<endl;

	}else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 3696
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
  
        static void Main(string[] args)
        {
            int[] NT = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int keiro = NT[0];
            int time = NT[1];
            int[] abc = new int[keiro];
            List<int> list = new List<int>();
            for(int i = 0; i < keiro; i++)
            {
                abc = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                if(abc[1] <= time)
                {
                    list.Add(abc[0]);
                }
            }
            if (list.Count >= 1)
                Console.WriteLine(list.Min());
            else
                Console.WriteLine("TLE");
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pii = pair<int, int>;
 
template <typename T> T inf;
template <> constexpr int inf<int> = 1e9;
template <> constexpr ll inf<ll> = 1e18;

int main() {
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    int x = inf<int> / (h * w);
    vector<vector<int>> a(H, vector<int>(W, x));
    for(int i = h - 1; i < H; i += h) {
        for(int j = w - 1; j < W; j += w) {
            a[i][j] = -x * (h * w - 1) - 1;
        }
    }
    ll sum = 0;
    for(int i = 0; i < H; ++i) {
        for(int j = 0; j < W; ++j) {
            sum += a[i][j];
        }
    }
    if(sum > 0) {
        cout << "Yes" << endl;
        for(int i = 0; i < H; ++i) {
            for(int j = 0; j < W; ++j) {
                cout << a[i][j] << " \n"[j + 1 == W];
            }
        }
    } else {
        cout << "No" << endl;
    }
}


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

typedef long long ll;

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define REPR(i, n) for(int (i)=(n-1);(i)>=0;i--)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);i++)
#define FORR(i,m,n) for(int (i)=(m-1);(i)>=(n);i--)
#define PRINT(x) {cout<<(x)<<"\n";}
#define INF 99999999

int main(){
    int D;
    cin >> D;
    if(D==25) PRINT("Christmas")
    else if(D==24) PRINT("Christmas Eve")
    else if(D==23) PRINT("Christmas Eve Eve")
    else if(D==22) PRINT("Christmas Eve Eve Eve")
}

Measured memory_bytes: 256
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#include<bits/stdc++.h>
using namespace std;
int qq,n,k;
string s;
int main()
{
	scanf("%d", &k);
	cin>>s;
	if(s.size()<=k) cout<<s;
	else
	{
		for(int i=0;i<k;++i) cout<<s[i];
		cout<<"...";
	}
	return 0;
}


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

using namespace std;
int main() {
	int n;
	cin >> n;
	map<int, int> odd, eve;
	for (int i = 0; i < n / 2; i++) {
		int hoge;
		cin >> hoge;
		odd[hoge]++;
		cin >> hoge;
		eve[hoge]++;
	}
	if (odd.size() == 1 && eve.size() == 1) {
		if (odd == eve) {
			cout << n / 2 << endl;
			return 0;
		}
		cout << "0" << endl;
		return 0;
	}
	vector<pair<int, int>> od, ev;
	for (auto e : odd) {
		od.push_back(e);
	}
	for (auto e : eve) {
		ev.push_back(e);
	}
	sort(od.begin(), od.end(), [](auto const& l, auto const& r) {
		if (l.second == r.second) {
			return l.first > r.first;
		}
		else {
			return l.second > r.second;
		}});
	sort(ev.begin(), ev.end(), [](auto const& l, auto const& r) {
		if (l.second == r.second) {
			return l.first > r.first;
		}
		else {
			return l.second > r.second;
		}});
	

	if (ev[0].first == od[0].first) {
		if (ev[0].second == od[0].second) {
			if (ev[1].second > od[1].second) {
				cout << n - od[0].second - ev[1].second << endl;
			}
			else {
				cout << n - ev[0].second - od[1].second << endl;
			}
			return 0;
		}
		if (ev[0].second > od[0].second) {
			cout << n - ev[0].second - od[1].second << endl;
			return 0;
		}
		else {
			cout << n - od[0].second - ev[1].second << endl;
			return 0;
		}
	}
	else {
		cout << n - od[0].second - ev[0].second << endl;
		return 0;
	}

	return 0;
}

Measured memory_bytes: 6136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> int_pair;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 1e9+1, sizeof(mat))
const int N=100000;
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a[N],n;
	cin>>n;
	CLR(a);
	FOR(i,0,n){
		cin>>a[i];
	}
	sort(a,a+n);
	int ans=0,w=a[0],k=1;
	FOR(i,1,n){
		if(a[i]!=w){
			if(k&1)ans++;
			k=1;
			w=a[i];
		}else{
			k++;
		}
	}
	if(k&1)ans++;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <set>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
using namespace std;
int a[3];
int main()
{
    for(int i=0;i<3;i++){
        cin>>a[i];
    }
    sort(a,a+3);
    cout<<a[2]-a[0]<<endl;
    return 0;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int L;
constexpr int N = 20;
int M;
std::vector<P> G[21];

void f(int i, int l){
    if(i == N){
        return;
    }

    if(l & 1){
        G[i].emplace_back(N, l - 1);
        M += 1;
    }

    if(l >= 2){
        G[i].emplace_back(i + 1, 0);
        G[i].emplace_back(i + 1, l / 2);
        M += 2;
        f(i + 1, l / 2);
    }
}

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

    std::cin >> L;

    f(1, L);

    printf("%d %d\n", N, M);

    for(int i=1;i<=N;++i){
        for(auto &p : G[i]){
            int j, w;
            std::tie(j, w) = p;

            printf("%d %d %d\n", i, j, w);
        }
    }
}


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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b && b==c)
    cout << 1 << endl;
    else if(a==b || b==c || c==a)
    cout << 2 << endl;
    else
    cout << 3 << endl;
}

Measured memory_bytes: 256