akhauriyash/Code-Regression huggingface dataset:
/*
 *  *s.rbegin()=*(--s.end())
 *   sort(v.rbegin(),v.rend()) = negative of v[i] , sort(v.begin(),v.end())
 *   sort(v.begin()+l_index,v.begin()+r_index+1);
 * 
 *   for(auto &it:v)cin>>it; 
 *   n + n/2 + n/3 + n/4 + n/5 + ........n/n =>n*log(n)
 *   n + n/3 + n/5 + n/7 + n/11+.............=>n*log(log(n))
 *   1 , 3 , 5 , 7 , 9 , 11 , 13 , 15 .......=>gcd( a[i] , a[i+1] , a[i+2] )=1;
 *   2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 ......=>upto 1e6 max diff a[i], a[i+1] ~ 150
 *   Every even integer greater than 2 can be expressed as the sum of two primes.[1]  : https://en.wikipedia.org/wiki/Goldbach%27s_conjecture
 *   printf("%03d\n",k);
 *   scanf("%d/%d/%d",&d,&m,&y);   
 */

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.rbegin(),a.rend())
#define lb(a,b) lower_bound(a.begin(),a.end(),b)
#define ub(a,b) upper_bound(a.begin(),a.end(),b)
#define MOD ((int)(1e9+7))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double
#define sqrt sqrtl
#define cbrt cbrtl
typedef vector<int> vi;
typedef vector<float> vf;
typedef pair<float,int> fi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<fi> vfi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<string> vs;
vector<int>dx={0,1,0,-1},dy={1,0,-1,0};
long long  gcd(long long  a,long long b)
{
     while (a&&b)a>b?a%=b:b%=a;
     return a+b;
}
const int N=1e5;
map<pair<int,int>,int>M;
vvi G(N+1);
vb B(N+1);
vi C(N+1);
int n;
void dfs(int I,int clr)
{
	B[I]=true;C[I]=clr;
	for(int i=0;i<(int)G[I].size();i++)
	{
		if(!B[ G[I][i] ])
		{
			dfs(G[I][i],clr^M[{I,G[I][i]}]);
		}
	}
}
int32_t main()
{
	IOS
	cin>>n;
	for(int i=1;i<=n-1;i++)
	{
		int u,v,w;cin>>u>>v>>w;
		M[{u,v}]=(w&1);M[{v,u}]=w&1;
		G[u].pb(v);
		G[v].pb(u);
	}
	dfs(1,0);
	for(int i=1;i<=n;i++)
	cout<<C[i]<<" ";
	cout<<endl;
}
		


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

int main() {
  int NMAX = 100;
  int N ;
  cin >> N;
  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  int val;
  int rec = 0;
  for(int i = 0; i < vec.size(); i++){
    if(i == 0){
      val = vec.at(i);
      rec++;
    }
    if(val != vec.at(i)){
      val = vec.at(i);
      rec++;
    }
  }
  cout << rec << endl;
}


Measured memory_bytes: 256
n=int(input())
l=list(map(int,input().split()))
x=10**9+7
if max(l)==min(l):
    print(0)
else:
        
    for i in range(min(l),max(l)+1):
        te=0
        
        for j in l:
            te=te+(abs(j-i))**2
        #print(i,te)
        x=min(x,te)
    print(x)        

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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define F first
#define S second
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class T>
bool chmax(T &a, const T &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  vector<int> x(5);

  rep(i, 0, 5) {
    cin >> x[i];
    if (x[i] == 0) {
      cout << i + 1 << '\n';
      return 0;
    }
  }
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

void main_()
{
    ll N;
    cin >> N;
    vector<ll> hs;
    hs.reserve(N);
    copy_n(istream_iterator<ll>(cin), N, back_inserter(hs));

    vector<ll> dp(N);
    dp[0] = 0;
    dp[1] = abs(hs[0] - hs[1]);
    for (ll i = 2; i < N; ++i) {
        auto c1 = dp[i - 2] + abs(hs[i] - hs[i - 2]);
        auto c2 = dp[i - 1] + abs(hs[i] - hs[i - 1]);
        dp[i] = min(c1, c2);
    }

    cout << dp[N - 1] << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

// 0~k-1のすべての組み合わせに対して処理を行う
void combination(int k, std::function<void(std::vector<int>)> f) {
  for (int i = 0; i < (1 << k); i++) {
    std::vector<int> nums;
    for (int j = 0; j < k; j++) {
      if ((1 << j) & i) nums.push_back(j);
    }
    f(nums);
  }
}

// 整数xに対して単調増加の関数f(x)について、k>=f(x)を満たす最大のxを求める
bool upper_bound_f(long k, long &x, long l_x, long r_x, function<long(long)> f) {
  long l_val = f(l_x);
  long r_val = f(r_x);
  if (l_val >= k || r_val < k) return false;
  while (r_x - l_x > 1) {
    x = (l_x + r_x) / 2;
    long val = f(x);
    if (val <= k) {
      l_x = x;
      l_val = val;
    } else {
      r_x = x;
      r_val = val;
    }
  }
  return true;
}

int main() {
  int H, W, K;
  cin >> H >> W >> K;

  long map[H][W];
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      char ch;
      cin >> ch;
      map[i][j] = ch == '1';
    }
  }

  long table[H + 1][W + 1];
  for (int i = 0; i < H + 1; i++) { table[i][0] = 0; }
  for (int i = 0; i < W + 1; i++) { table[0][i] = 0; }

  for (int i = 0; i < H; i++) {
    long rsum = 0;
    for (int j = 0; j < W; j++) {
      rsum += map[i][j];
      table[i + 1][j + 1] = rsum + table[i][j + 1];
    }
  }

  // (y1+1,x1+1)~(y2,x2)の範囲の和
  const function<long(int, int, int, int)> partsum = [&](int y1, int x1, int y2, int x2) -> long {
    return table[y2][x2] + table[y1][x1] - table[y1][x2] - table[y2][x1];
  };

  int min = H + W;
  combination(H - 1, [&](std::vector<int> nums) {
    nums.push_back(H - 1);
    // for (int i = 0; i < nums.size(); i++) { cout << nums[i] + 1 << ' '; }

    int cnt = 0;
    int r = 1;
    while (true) {
      int l = r - 1;
      for (; r <= W; r++) {
        long max = 0;
        int st = 0;
        for (int i = 0; i < nums.size(); i++) {
          int ed = nums[i] + 1;

          long res = partsum(st, l, ed, r);
          if (res > max) max = res;

          // cout << "  y:" << st << "-" << ed << " x:" << l << "-" << r << " : " << res << endl;
          st = ed;
        }
        // cout << "    " << max << endl;
        if (max > K) break;
      }
      // cout << " (" << l << "," << r - 1 << ")";
      if (r == W + 1) break;
      if (r - l == 1) break;
      cnt++;
    }
    if (r == W + 1) {
      // cout << " : " << cnt << endl;
      int total = cnt + nums.size() - 1;
      if (total < min) min = total;
    } else {
      // cout << " : NG" << endl;
    }
  });
  cout << min << endl;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define SIZE 100000

int W[SIZE];	//size : n
int n, k;

int Count(int P) {
	int cnt = 0, pos = 0;
	int insP = P, add = 0;
	for (int i = 0; i < k; i++) {
		add = 0;
		while (add <= insP && pos < n) {
			add += W[pos];
			pos++;
			cnt++;
		}
		if (add > insP) {
			cnt--;
			pos--;
		}
		else if (pos == n) {
			break;
		}
	}
	return cnt;

}

int BinarySearch(int right, int left) {
	int right0 = right, left0 = left;
	int mid;
	if (Count(right0) == Count(left0))return right0;
	while (1) {
		if (left0 - right0 == 1) return left0;
		mid = (right0 + left0) / 2;
		if (Count(mid) == n) {
			left0 = mid;
		}
		else right0 = mid;
	}
}

int main() {
	int right, left = 0;
	int P;
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &W[i]);
	}

	right = W[1];
	for (int i = 0; i < n; i++) {
		left += W[i];
	}

	P = BinarySearch(right, left);

	printf("%d\n", P);


	return 0;
}


Measured memory_bytes: 2240
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
using namespace std;
//#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100;
//ここまでテンプレ
int main(){
	char grid[150][150]={};
	int A,B;
	cin>>A>>B;
	for(int i=0;i<SIZE;i++){
		for(int j=0;j<SIZE;j++){
			if(i<SIZE/2)
				grid[i][j]='.';
			else
				grid[i][j]='#';
		}
	}
	int w=1;
	for(int i=SIZE/2+1;i<SIZE;i++){
		for(int j=0;j<SIZE;j++){
			if(w==A)
				break;
			if(i%2 && j%2){
				w++;
				grid[i][j]='.';
			}
		}
	}
	int b=1;
	for(int i=0;i<SIZE/2;i++){
		for(int j=0;j<SIZE;j++){
			if(b==B)
				break;
			if(i%2 && j%2){
				b++;
				grid[i][j]='#';
			}
		}
	}
	cout<<100<<" "<<100<<endl;
	for(int i=0;i<SIZE;i++){
		for(int j=0;j<SIZE;j++){
			cout<<grid[i][j];
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    Boolean bool = true;

    for (int i = 0; i < S.length(); i++) {

      // 奇数
      if (i % 2 == 0) {
        if (!((S.charAt(i) == 'R') || (S.charAt(i) == 'U') || (S.charAt(i) == 'D'))) {
          bool = false;
        }
      }

      // 偶数
      if (i % 2 == 1) {
        if (!((S.charAt(i) == 'L') || (S.charAt(i) == 'U') || (S.charAt(i) == 'D'))) {
          bool = false;
        }
      }
    }

    if (bool == true) {
      System.out.print("Yes");
    } else {
      System.out.print("No");
    }

    sc.close();
  }
}


Measured memory_bytes: 23764
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define maxn 100005
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int inf = 0x3f3f3f3f;
ll x[maxn];
int n,m,par[maxn],hei[maxn];
struct edge{
	int u,v,w;
	ll y;
	bool operator < (const edge &e)const
	{
		return w < e.w;
	}
}el[maxn];
void ini(){
	for(int i=1;i<=n;i++){
		par[i] = i;
		hei[i] = 1;
	}
}
int fin(int u){
	if(par[u] == u) return u;
	return par[u] = fin(par[u]);
}
ll uni(int u,int v){
	u = fin(u),v = fin(v);
	if(u == v){
		return x[u];
	}else{
		if(hei[u] < hei[v]){
			par[u] = v;
			x[v] += x[u];
			x[u] = 0;
			return x[v];
		}else{
			par[v] = u;
			x[u] += x[v];
			x[v] = 0;
			if(hei[u] == hei[v]) hei[u]++;
			return x[u];
		}
	}
}
vector <P> adj[maxn];//to,cst.
bool vis[maxn];
void dfs(int u,int lim){
	vis[u] = true;
	for(int i=0;i<(int)adj[u].size();i++){
		P e = adj[u][i];
		if(vis[e.first] || e.second > lim) continue;
		dfs(e.first,lim);
	}
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%lld",&x[i]);
	for(int i=1;i<=m;i++){
		scanf("%d%d%d",&el[i].u,&el[i].v,&el[i].w);
		adj[el[i].u].push_back(mp(el[i].v,el[i].w));
		adj[el[i].v].push_back(mp(el[i].u,el[i].w));
	}
	sort(el + 1,el + m + 1);
	ini();
	for(int i=1;i<=m;i++) el[i].y = uni(el[i].u,el[i].v);
	int ans = 0;
	for(int i=m;i>=1;i--){
		if(vis[el[i].u]) continue;
		if(el[i].y >= (ll)el[i].w){
			dfs(el[i].u,el[i].w);
			if(!vis[el[i].v]) dfs(el[i].v,el[i].w);
		}else ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 14336
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <algorithm>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>

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

using namespace std;

using ll = long long;
using std::swap;

vector<long long int> v;
vector<long long int> w;



int main() {
	int N, M, ANS = 0,day;
	cin >> N >> M;
	rep(i, 0, M) {
		cin >> day;
		ANS += day;
	}
	ANS = N - ANS;
	if (ANS < 0)ANS = -1;
	cout << ANS << '\n';
	return 0;
}

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

int main() {
  int N ;
  cin >> N ;
  if ( N == 1 ) {
    cout << "Hello World" << endl;
  }
  if ( N == 2){
    int a, b ;
    cin >> a >> b;
    cout << a+b << endl;
  }
}

Measured memory_bytes: 3596
#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
using namespace std;

// _________コーディングはここから！！___________

int n, m, k, i;
constexpr int N = 200010;
int a[N], b[N];
constexpr int sz = 4500000;
char reader[sz];
char *pos = reader;
int nn, now, ans;
int kk;
main() {
    reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
    while('0' <= *pos) n = n * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) m = m * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) k = k * 10 + *pos++ - '0';
    nn = n;
    pos++;
    rep(i, n) {
        while('0' <= *pos) a[i + 1] = a[i + 1] * 10 + *pos++ - '0';
        pos++;
        a[i + 1] += a[i];
        if(a[i + 1] > k) {
            nn = i;
            ++i;
            for(; i < n; ++i) {
                while('0' <= *pos) pos++;
                pos++;
            }
            break;
        }
    }
    while(*pos and *pos <= 32) pos++;
    rep(i, m) {
        while('0' <= *pos) b[i + 1] = b[i + 1] * 10 + *pos++ - '0';
        pos++;
        b[i + 1] += b[i];
        if(b[i + 1] > k) {
            m = i;
            break;
        }
    }
    now = ans = nn;
    for(i = 1; i <= m; i++) {
        kk = k - b[i];
        while(a[now] > kk) now--;
        ans = max(ans, i + now);
    }
    pos = reader;
    i = 0;
    do {
        *pos++ = ans % 10 + '0';
        ans /= 10;
        i++;
    } while(ans);
    reverse(reader, reader + i);
    fwrite(reader, sizeof(char), sizeof(char) * i, stdout);
}


Measured memory_bytes: 7712
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan,sqrt
import cmath as cma
import copy as cp
import sys
import re
import bisect as bs
sys.setrecursionlimit(10**7)
EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf
MOD = 10**9 + 7

def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def adj(n): return [[] for _ in range(n)]

def meguru(ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng)//2
        if isOK(mid): ok = mid
        else: ng = mid
    return ok

def isOK(num): return bcum[num] <= tb

n,m,k = imap()
a,b = iarr(),iarr()
acum,bcum = np.array(a).cumsum(),np.array(b).cumsum()

anss = []
for i in range(n+1):
    ans = 0 if i==n else i + 1
    ta = 0 if i==n else acum[i]
    if ta > k: continue
    else: tb = k - ta
    #ok,ng = -1,m
    #ans += meguru(ok,ng) + 1 # OKなければansは-1+1で不変
    ans += bs.bisect_right(bcum, tb)
    anss.append(ans)
ans = max(anss) if anss else 0
print(ans)


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

#define MAX 100000

int parent(int i) {return i / 2;}
int left(int i) {return 2*i;}
int right(int i){return 2*i + 1;}

int main(){
    int i, h, A[MAX];
    scanf("%d", &h);

    for(i = 1; i <= h; i++){
        scanf("%d", &A[i]);
    }

    for(i = 1; i <= h; i++){
        printf("node %d: ", i);
        printf("key = %d, ", A[i]);
        if(parent(i) >= 1) printf("parent key = %d, ", A[parent(i)]);
        if(left(i) <= h) printf("left key = %d, ", A[left(i)]);
        if(right(i) <= h) printf("right key = %d, ", A[right(i)]);
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>  
#include <memory>
using namespace std;  
#define INF 0x3f3f3f3f  
typedef long long ll;  
const int N =  10005;  
const int M = 1001;
#define FI first
#define SE second
typedef pair<int, int>pii;
int mod = 1000000007;
char s[N];
int rec[101];
int main()  
{  

   // ios::sync_with_stdio(0);
    int a, b, c, d;
    while (~scanf("%d%d%d%d", &a, &b, &c, &d))
    {
      for (int i = a; i <= b-1; i++)
         rec[i]++;
            int ans = 0;

      for (int i = c; i <= d-1; i++)
      {
         rec[i]++;
         if (rec[i] == 2)
            ans++;
      }
      printf("%d\n", ans);

    }
   return 0;
}  

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

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

    ll cnt = 0;
    REP(i,0,A+1) {
        REP(j,0,B+1) {
            REP(k,0,C+1) {
                if(500*i+100*j+50*k == X) ++cnt;
            }
        }
    }
    PR(cnt);

    return 0;
}

/*



*/

Measured memory_bytes: 3612
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

A, B, C = map(int, input().split())
if A == B and B != C:
    print("Yes")
elif B == C and B != A:
    print("Yes")
elif C == A and C != B:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9468
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
	int N;
	string S;

	cin >> N >> S;

	int ans = 0;
	int pos = S.find("ABC");
	while (pos != string::npos) {
		ans++;
		pos = S.find("ABC", pos + 3);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int k;
	string st;
	cin >> k;
	cin >> st;
	if (st.length() <= k){
		cout << st << endl;
	}
	else{
		string s = "";
		for (int i = 0; i < k; i++) s += st[i];
		s += "...";
		cout << s << endl;
	}
	return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <iomanip>
#include <ios>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
using namespace std;
typedef long long unsigned int ll;
 
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
int main() {
 
	int a,b = 0;
	string s,r,h,k;
			
 
	cin >> a;
	
	string abc = "ABC";
	string abd = "ABD";
 
	if(a<=999){
		s = abc;
		b = a;
	}
	else{
		s = abd;
		b = a - 999;
	}
 
	cout << s << endl;
    return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int N = nextInt();
  int M = nextInt();
  int X = nextInt();

  int left = 0, right = 0;
  REP(i, M) {
    int a = nextInt();
    if (a < X) left++;
    if (a > X) right++;
  }
  cout << min(left, right) << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

def get_par(x):
  if x == par_list[x]:
    return x
  else:
    par_list[x] = get_par(par_list[x])
    return par_list[x]

N,M=map(int,input().split())
par_list = list(range(N))
for i in range(M):
  Xi,Yi,Zi=map(int,input().split())
  par_Xi = get_par(Xi-1)
  par_Yi = get_par(Yi-1)
  if par_Xi != par_Yi:
    par_list[par_Yi] = par_Xi
    
set_uf = set()
for par in par_list:
  set_uf.add(get_par(par))
  
print(len(set_uf))


Measured memory_bytes: 13164
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    int ans,maxCnt=-1;

    for(int i=1;i<=N;i++){
        int k=i,cnt=0;
        while(k%2==0){
            k/=2; cnt++;
        }
        if(cnt>maxCnt){
            ans=i; maxCnt=cnt;
        }
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

a = input()
b = input()
c = input()

temp = a[0]
a = a[1:]

ans = "A"
while True:
    if temp == "a":
        if len(a) == 0:
            ans = "A"
            break
        else:
            temp = a[0]
            a = a[1:]
    elif temp == "b":
        if len(b) == 0:
            ans = "B"
            break
        else:
            temp = b[0]
            b = b[1:]
    else:
        if len(c) == 0:
            ans = "C"
            break
        else:
            temp = c[0]
            c = c[1:]

print(ans)



Measured memory_bytes: 9060
<?php

	$suffixList = [
		0 => 'pon',
		1 => 'pon',
		2 => 'hon',
		3 => 'bon',
		4 => 'hon',
		5 => 'hon',
		6 => 'pon',
		7 => 'hon',
		8 => 'pon',
		9 => 'hon',
	];

	fscanf(STDIN, "%d", $input);
	echo($suffixList[$input % 10]);

?>


Measured memory_bytes: 16172
from collections import deque
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    w,h,x,y,r=list(map(int,input().split()))
    if min(x,y)-r<0 or x+r>w or y+r>h:
        print("No")
    else:
        print("Yes")
    

main()



Measured memory_bytes: 6000
#include<iostream>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    int num=n%10;
    if(num==3)
        printf("bon");
    else if(num==0||num==1||num==6||num==8)
        printf("pon");
    else
        printf("hon");
    return 0;
}


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

using namespace std;

const int N = 3005;

char s[N], t[N];
int n, m, f[N][N];

int main() {
  scanf("%s %s", s + 1, t + 1);
  n = strlen(s + 1), m = strlen(t + 1);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (s[i] == t[j]) {
        f[i][j] = 1 + f[i - 1][j - 1];
      } else {
        f[i][j] = max(f[i - 1][j], f[i][j - 1]);
      }
    }
  }
  string res = "";
  for (int i = n, j = m; i and j;) {
    if (s[i] == t[j]) {
      res += s[i];
      --i, --j;
    } else {
      if (f[i][j] == f[i - 1][j]) --i;
      else --j;
    }
  }
  reverse(res.begin(), res.end());
  cout << res << '\n';
  return 0;
}



Measured memory_bytes: 35456
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;

}
int lvl[N];
int used[N];
vector<int> g[N];
int par[N];
void dfs(int v, int p){
	queue<int> q;
	q.push(v);
	used[v] = 1;
	while(!q.empty()){
		int x = q.front();
		q.pop();
		for(int to : g[x]){
			if(!used[to]){
				used[to] = 1;
				lvl[to] = lvl[x] + 1;
				par[to] = x;
				q.push(to);
			}
		}
	}
}
void solve()
{
	int n, m;
	cin >> n >> m;
	rep(i, m){
		int l, r;
		cin >> l >> r;
		g[l].pb(r);
		g[r].pb(l);
	}
	dfs(1, 1);
	for(int i = 2; i <= n; ++i){
		if(!used[i]){
			cout << "No";
			return;
		}
	}
	cout << "Yes\n";
	for(int i = 2; i <= n; ++i) cout << par[i] << '\n';
}


 // a b c a b c a b c a b c
 
int main()
{
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
    // Red;
  	// precalc();
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

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

long long cnt(long long n) {
  string m = to_string(n);
  int k = m.size();
  if (k == 1) return n + 1;
  long long tot = 0;
  tot += pow(10, (k - 1) / 2) * (m[0] - '1');
  tot += pow(10, k / 2) * 2 - 1 - 9 * pow(10, (k - 2) / 2) * (k & 1 ^ 1);
  while (k >= 2) {
    k -= 2;
    if (k == 0) {
      tot += m[1] >= m[0];
      break;
    } else if (k == 1) {
      tot += m[1] - '0' - (m[2] < m[0]) + 1;
      break;
    } else {
      string l = m.substr(1, k);
      n = stoi(l) - (m[k+1] < m[0]);
      m = to_string(n);
      while (m.size() < k) m = '0' + m;
      tot += (m[0] - '0') * pow(10, (k - 1) / 2); 
    }
  }
  return tot;
}

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

  long long a, b;
  cin >> a >> b;

  cout << cnt(b) - cnt(a - 1) << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define hh putchar(10)
#define gc getchar()
#define ll long long
using namespace std;
#define mtm(a) memset(a,0x3f3f3f3f,sizeof a)
#define mt1(a) memset(a,-1,sizeof a)
#define mt0(a) memset(a,0,sizeof a)
#define fup(i,a,b) for(int i=a,i##e=b;i<=i##e;++i)
#define debug(a) cout<<#a<<'='<<a<<endl

class FIO
{
public:
    template<typename T>FIO& operator >>(T& x){_R(x);return *this;}
    template<typename T>FIO& operator <<(T x){_W(x);return *this;}
private:
    int f,c,a[24],i;
    template<typename T> inline void _R(T& x) {
        for(f=0;(c=getchar())<48;c==45&&(f=1));
        for(x=c^48;(c=getchar())>47;x=(x<<3)+(x<<1)+(c^48));
        if(f)x=-x;
    }
    template<typename T> inline void _W(T x) {
        if(sizeof(x)==1){putchar(x);return;}
        if(x<0)putchar(45),x=-x;
        if(x>99) {
            for(i=0;x;x/=10)a[i++]=x%10;
            while(i--)putchar(a[i]+48);
        } else if (x>9)putchar(x/10+48),putchar(x%10+48);
        else putchar(x+48);
    }
}io;

int main()
{
    int n;
    io>>n;
    ll ans=0;
    for(int i=1;i<=n;++i)
    {
        if(i%3==0||i%5==0)continue;
        ans+=i;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3636
#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 L;
//ワーシャルフロイド
//頂点数（と隣接行列）を引いて全点間最短距離を返す
//O(V^3)
ll cost[310][310];
ll dddd[310][310];
ll cccc[310][310];
void waasharuhuroido(ll n){
	rep(i,0,n)rep(j,0,n)if(i!=j){
		if(cost[i][j]&&cost[i][j]<=L){
			dddd[i][j]=cost[i][j];
		}else{
			dddd[i][j]=cccc[i][j]=INF;
		}
	}
	rep(_,0,3)rep(k,0,n)rep(i,0,n)rep(j,0,n){
		ll tempc=cccc[i][k]+cccc[k][j];
		ll tempd=dddd[i][k]+dddd[k][j];
		if(!(tempc==0&&tempd<=L)){
			tempc++;
			tempd=dddd[k][j];
		}
		
		if(cccc[i][j]>tempc||(cccc[i][j]==tempc&&dddd[i][j]>tempd)){
			cccc[i][j]=tempc;
			dddd[i][j]=tempd;
		}
//		rep(i,0,n){rep(j,0,n)printf("(%2d,%2d) ",cccc[i][j]==INF?99:cccc[i][j],dddd[i][j]==INF?99:dddd[i][j]);puts("");}puts("");
	}
}

int main(){
	ll n,m;
	scanf("%lld%lld%lld",&n,&m,&L);
	rep(i,0,m){
		ll x,y,z;
		scanf("%lld%lld%lld",&x,&y,&z);
		x--,y--;
		cost[x][y]=cost[y][x]=z;
	}
	waasharuhuroido(n);
	ll q;
	scanf("%lld",&q);
	while(q--){
		ll x,y;
		scanf("%lld%lld",&x,&y);
		x--,y--;
		ll ans=cccc[x][y];
		printf("%lld\n",ans==INF?-1:ans);
	}
}


Measured memory_bytes: 2688
#include <stdio.h>
int main(void)
{
    int x, y;
    while (0 <= x && y <= 10000)
    {
        scanf("%d %d", &x, &y);
        if ( x == 0 && y == 0 ) break;
        {
            if(x > y)
            {
                printf("%d %d\n", y, x);
            }
            else
            {
                printf("%d %d\n", x, y);
            }
        }
    }
}


Measured memory_bytes: 1916
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_C() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S; cin >> S;
    int N = S.size();
    int K; cin >> K;

    set<string> st;
    for(int l=0; l<N; l++) {
        int cnt = 0;
        for(int r=l; r<N; r++) {
            if (cnt >= K) break;
            string t = S.substr(l, r - l + 1);
            st.insert(t);
            cnt++;
        }
    }

    vs v;
    for (string s : st) v.push_back(s);
    sort(v.begin(), v.end());


    string ans = v[K-1];

    cout << ans << endl;

    return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define UNIQUE(c) sort(ALL(c)), c.erase(unique(ALL(c)), c.end())

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N; cin >> N;
  string S; cin >> S;
  map<pair<string, string>, ll> mp;
  REP(bit, 1 << N) {
    string red = "", blue = "";
    REP(i, N) {
      if (bit >> i & 1) {
        red.push_back(S[i + N]);
      } else {
        blue.push_back(S[i + N]);
      }
    }
    mp[make_pair(red, blue)]++;
  }

  ll ans = 0;
  REP(bit, 1 << N) {
    string red = "", blue = "";
    REP(i, N) {
      if (bit >> i & 1) {
        red.push_back(S[i]);
      } else {
        blue.push_back(S[i]);
      }
    }
    reverse(ALL(red));
    reverse(ALL(blue));
    ans += mp[make_pair(blue, red)];
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
  int K, N;
  cin >> K >> N;
  
  int A[N], max_i = 0, max = 0;
  for(int i = 0; i < N; i++ ){
    cin >> A[i];
  }

  for(int i = 0; i < N - 1; i++ ){
    if(max < A[i + 1] - A[i]){
      max = A[i + 1] - A[i];
      max_i = i;
    }
  }

  if(max < K -  A[N - 1] + A[0]){
      max = K -  A[N - 1] + A[0];
      max_i = N - 1;
  }

  if(max_i == N -1 ){
    cout << A[max_i] - A[0];
  }else{
    cout << K - A[max_i + 1] + A[max_i];
  }

  
}


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

int main() {
  int N;
  cin>>N;
  vector<int64_t> p(N);
  for(int i=0;i<N;i++){
    cin>>p[i];
  }
  sort(p.begin(), p.end());
reverse(p.begin(), p.end());

  int64_t Z=0;
  for(int i=1;i<N;i++){
    Z+=p[i/2];
  }
  cout<<Z<<endl;
}



Measured memory_bytes: 4844
def main():
    import sys
    input = sys.stdin.readline

    n,m=map(int,input().split())
    CARD=[0]*(n+1)
    for i in range(m):
        L,R=map(int,input().split())
        CARD[L-1]+=1
        CARD[R]-=1
    ans=0
    for i in range(n):
        if CARD[i]==m:ans+=1
        CARD[i+1]=CARD[i+1]+CARD[i]

    print(ans)

if __name__=='__main__':
    main()


Measured memory_bytes: 6980
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define __builtin_popcount __builtin_popcountll

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 (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
    os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const map<S, T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;

int main(int argc, char *argv[]){
    ios::sync_with_stdio(false);
    string s;
    while(cin >> n >> m){
        vector<vi> g(n);
        vi in(n);
        REP(i, n - 1 + m) {
            int u, v;
            cin >> u >> v; u--; v--;
            g[u].push_back(v);
            in[v] ++;
        }
        vi ans(n, -1);
        queue<int> q;
        REP(i, n) if (in[i] == 0) q.push(i);
        while(!q.empty()) {
            int u = q.front(); q.pop();
            for (int v : g[u]) {
                if (-- in[v] == 0) {
                    ans[v] = u;
                    q.push(v);
                }
            }
        }
        REP(i, n) cout << ans[i] + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll a,b;
  	ci(a>>b);
  if(a==1||b==1){
    if(a<b) co("Alice")
      else if(a>b) co("Bob")
        else co("Draw")
        }
  else {
    if(a<b) co("Bob")
      else if(a>b) co("Alice")
        else co("Draw")
        }
}

Measured memory_bytes: 256
///////////////////////////////////////////
//                                       //
//      Gagan_Sharma : DTU               // 
//                                       //                   
///////////////////////////////////////////
#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 int     long long
// #define mp      make_pair
#define eb      emplace_back
#define pb      push_back
#define ss      second
#define ff      first
#define IOS     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod     998244353
#define MOD     (1000*1000*1000+7)
#define MN      LLONG_MIN
#define MX      LLONG_MAX
#define v1d     vector<int>
#define v2d     vector<vector<int>>
#define vip     vector<pair<int,int> >
#define v1s     vector<string>
#define pa      pair<int,int>
#define print(v) for(auto i:v)cout<<i<<" ";cout<<"\n";
#define endl    '\n'
#define input(b,n) for(int i=0;i<n;i++)cin>>b[i+1];
#define Sort(v) sort(v.begin(),v.end())
#define RSort(v)   sort(v.rbegin(),v.rend())
#define all(v)  v.begin(),v.end()
#define mxpq priority_queue <int>
#define mnpq priority_queue<int,vector<int>,greater<int>>
int gcd(int a,int b){return b?gcd(b,a%b):a;}
//string s = bitset<64>(a).to_string();

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define fbo find_by_order // iterator to the kth element
#define ook order_of_key  //number of items that are strictly smaller than our item k
#define T pair<int,pa>
// #define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>

void read(int n=12){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<setprecision(n)<<fixed;
    #ifndef ONLINE_JUDGE
         freopen("input.txt",  "r",  stdin);
         freopen("output.txt", "w", stdout);
    #endif
}

void solve(){
    int n;cin>>n;
    int sum = 0;
    for(int i=1;i<=n;i++){
        if(i % 3 == 0 || i % 5 == 0)continue;
        sum += i;
    }
    cout<<sum;
}
 
int32_t main(){
    // read();
    int t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
    


    return 0;
}                                                                                         


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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);

    ll A, B;
    cin >> A >> B;
    cout << A*B << endl;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
typedef long long ll;
const ll mod=1e9+7;
const ll inf=0x3f3f3f3f;
const int N=2e5+5;
using namespace std;

int main()
{
    ll n,x,t;
    cin>>n>>x>>t;
    cout<<1ll*(n+x-1)/x*t;
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include<bits/stdc++.h>
#include<vector>
#include<string>
#define ll long long
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vi vector<ll>
#define el printf("\n")
#define s second
#define pb(x) push_back(x)
#define f first
using namespace std;
int main(){
       ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout.precision(30);
        IOS;

  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  if(abs(c-a)<=d)
    cout <<"Yes";
  else
  {
    if(abs(a-b)<=d && abs(b-c)<=d)
    	cout << "Yes";
    else
       cout <<"No";

  }



        return 0;
    }


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int n = sc.nextInt();
        int[][] info = new int[15][10];
        for(int i=0; i<n; i++) {
            int b = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            int v = sc.nextInt();

            // b 1: 1-3 2:5-7 3:9-12 4:13-15
            // b 1: 1=0+f-1 2:4+f-1 3:8+f-1 4:12+f-1
            switch(b) {
                case 1:
                    info[0+(f-1)][r-1] += v;
                    break;
                case 2:
                    info[4+(f-1)][r-1] += v;
                    break;
                case 3:
                    info[8+(f-1)][r-1] += v;
                    break;
                case 4:
                    info[12+(f-1)][r-1] += v;
                    break;
            }
        }

        for(int i=0; i<15; i++) {
            if(i == 3 || i == 7 || i == 11) {
                System.out.println("####################");
                continue;
            }
            for(int j=0; j<10; j++) {
                if(j == 9) {
                    System.out.println(" " + info[i][j]);
                } else {
                    System.out.print(" " + info[i][j]);
                }
            }
        }
    }
}



Measured memory_bytes: 30004
def sumA(n):
	return n*(n+1)//2

n, k = map(int, input().split())
p = list(map(int, input().split()))
s = [0 for i in range(k)]
ans = 0
mm = 0
j = 0

for i in range(n):
  if j < k:
    s[j] = sumA(p[i])/p[i]
    mm+=s[j]
  else:
    mm-=s[j%k]
    mm+= sumA(p[i])/p[i]
    if ans < mm:
      ans = mm
    s[j%k] = sumA(p[i])/p[i]
  j+=1
  
print(max(mm, ans))
                  




Measured memory_bytes: 25060
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
//コピペするとこ



//-------------------------------------------------


int main()
{
  int n, m ;
  cin >> n >> m ;
  vector<int> vec(m,0) ;
  int ans = 0 ;
  REP(i,n){
    int k ;
    cin >> k ;
    REP(j,k){
      int kk ;
      cin >> kk ;
      vec.at(kk-1)++ ;
    }
  }
  REP(i,m){
    if(vec.at(i)==n){
      ans++ ;
    }
  }
  
  cout <<ans <<endl ;

  return 0 ;
}



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

int main() {
  int h, n;
  cin >> h >> n;
  int count = 0, b;
  for(int i = 0; i < n; i++) {
    cin >> b;
    count += b;
  }
  if(h > count) {
    cout << "No";
  } else {
    cout << "Yes";
  }
}

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

#define ll long long
#define dd double
#define scl(n)    scanf("%lld",&n)
#define scd(n)    scanf("%lf",&n)
#define ptl(n)    printf("%lld",n)
#define ptd(n)    printf("%lf",n)
#define nline     printf("\n")
#define vld       vector<ll>
#define vbd       vector<bool>
#define eb        emplace_back
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define pi        2*acos(0.0)

using namespace std;

int main()
{
    ll n,ans=-1;
    scl(n);
    ll i=1;
    while(ans<0)
    {
        ans=i*1000-n;
        i++;
    }
    ptl(ans);
    return 0;
}


Measured memory_bytes: 3820
#include<iostream>
#include<vector>
#include<set>
#include<utility>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
vector<set<pair<int,int>>> e;
vector<int> ans;
void dfs(int now, int prv, int c )
{
    ans[now]=c;
    for(auto nxt:e[now])if(nxt.first!=prv)
    {
        if(nxt.second%2)
        {
            dfs(nxt.first,now,!c);
        }
        else
        {
            dfs(nxt.first, now, c);
        } 
    }
}
main()
{
    long long n;cin>>n;
    e.resize(n+1);
    rep(i,n-1)
    {
        int u,v,w;cin>>u>>v>>w;
        e[u].emplace(v,w);
        e[v].emplace(u,w);
    }
    ans.resize(n+1);
    dfs(1,-1,0);
    for(int i=1;i<=n;i++)printf( "%d\n",ans[i]);
    return 0;
}

Measured memory_bytes: 16128