akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()
#define fs first
#define sd second
#define couts(x) cout << (x) << (" ")
#define coutn(x) cout << (x) << ("\n")
#define endl "\n"

template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T1, typename T2> std::istream &operator>>(std::istream &is, std::pair<T1,T2> &p){is >> p.first >> p.second; return is; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::deque<T> &vec){ os << "deque["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> std::ostream &operator<<(std::ostream &os, const std::pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }

template<class T> using V = vector<T>;
template<class T> using V2 = V<V<T>>;
template<class T> using V3 = V<V2<T>>;

void solve(){
  string s; cin >> s;
  FOR(i,0,(int)s.size()) if(s[i]=='7'){couts("Yes"); return;}
  couts("No");
}


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


Measured memory_bytes: 3624
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val d = sc.nextInt
  val x = sc.nextInt
  val A: Array[Int] = Array.fill(n)(sc.nextInt)

  var cnt = x
  A.foreach({ i =>
    cnt = cnt + 1 + ((d - 1) / i)
  })

  println(cnt)
 }

Measured memory_bytes: 27584
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdlib>

using namespace std;

int main()
{
    int i;
    int ia, ib;
    char ca, cb;
    scanf("%d%d", &ia, &ib);

    ca = ia + 0x30;
    cb = ib + 0x30;
    
    char *s1 = new char[ib + 1];
    char *s2 = new char[ia + 1];

    for (i = 0; i < ib; i++) {
        s1[i] = ca;
    }
    s1[i] = 0;

    for (i = 0; i < ia; i++) {
        s2[i] = cb;
    }
    s2[i] = 0;

    if (strcmp(s1, s2) <= 0) {
        cout << s1 << endl;
    } else {
        cout << s2 << endl;
    }

    return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  ll N, A, B; cin >> N >> A >> B;
  if (N == 1) {
    cout << (A == B ? 1 : 0) << endl;
  }
  else if (A <= B && N >= 2) {
    cout << (N - 2) * (B - A) + 1 << endl;
  } else {
    cout << 0 << endl;
  }
}


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

int main() {
	int n,a[100], b, c, d, ans;
	cin >> n ;
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);
	cout << a[n-1]-a[0] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f40;
const long long mod=1e9+7;
const long double PI = acos(0);
// }}} End Header
class UnionFind{
	public:
	vector<int> r;

	UnionFind(int N){
		r = vector<int>(N, -1);
	}

	int root(int x){
		if(r[x] < 0) return x;
		return r[x] = root(r[x]);
	}

	bool unit(int x, int y){
		x = root(x);
		y = root(y);
		if(x == y) return false;
		if(r[x] > r[y]) swap(x, y);
		r[x] += r[y];
		r[y] = x;
		return true;
	}

	int size(int x){
		return -r[root(x)];
	}

};
int main() {
	int N, M;
	cin >> N >> M;
	UnionFind UF(N);
	for(int i = 0; i<M; i++){
		int A, B;
		cin >> A >> B;
		A-=1; B-=1;
		UF.unit(A, B);
	}
	int ans = 0;
	rep(i, N){
		ans = max(ans, UF.size(i));
	}

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

Measured memory_bytes: 4032
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

constexpr int INFI = 1145141919;

struct student{
    int num;
    int Ai;
};

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

    int N;
    std::cin >> N;

    std::vector<student> A;
    for(int i=0; i<N; i++){
        int buf;
        std::cin >> buf;
        student tmp = {i, buf};
        A.push_back(tmp);
    }

    std::sort(A.begin(), A.end(), 
        [](const student& x, const student& y) { return x.Ai < y.Ai;});

    for(int i=0; i<N; i++){
        std::cout << A.at(i).num+1 << ' ';
    }

    return 0;
}


Measured memory_bytes: 1780
main(){
	float D,px,py,vx,vy,a,l;
	for(;scanf("%f%f%f%f%f",&D,&px,&py,&vx,&vy),D;){
		a=hypot(px,py);
		l=px*vx+py*vy<0?a:2-a;
		printf(fabs(px*vy-py*vx)||D<l?"impossible\n":"%f\n",l);
	}
	exit(0);
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
string str;
int cou;
int main(void){
    // Your code here!
    cin >> str;
    for (int i = 0; i < 26; i++) {
        int x = 0;
        for (int j = 0; j < str.length(); j++) {
            if (str[j] - 'a' == i) x++;
        }
        if (x % 2 == 1) cou++;
    }
    cout << (cou == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int e,y,z,m,ans=100000000;

	
	while(1){
		scanf("%d",&e);
		ans=100000000;
		if(e==0)
			break;
		
		else{
			for(y=0; y<=1000; y++){
				for(z=0; z<=100; z++){
					m=e-y*y-z*z*z+y+z;
					if(ans>m && e-y*y-z*z*z>=0)
						ans=m;
				}
			}
		
		printf("%d\n",ans);
	}
	}
	return 0;
}



Measured memory_bytes: 2604
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
        aa: [usize; n],
    }

    let mut count = 0;

    for a in aa.into_iter().step_by(2) {
        if a % 2 == 1 {
            count += 1;
        }
    }

    println!("{}", count);
}


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


using namespace std;
#define _rep(n, a, b) for (ll n = (a); n <= (b); ++n)
#define _rev(n, a, b) for (ll n = (a); n >= (b); --n)
#define _for(n, a, b) for (ll n = (a); n < (b); ++n)
#define _rof(n, a, b) for (ll n = (a); n > (b); --n)
#define oo 0x3f3f3f3f3f3f
#define ll long long
#define db double
#define eps 1e-6
#define bin(x) cout << bitset<10>(x) << endl;
#define what_is(x) cerr << #x << " is " << x << endl
#define met(a, b) memset(a, b, sizeof(a))
#define mp(a, b) make_pair(a, b)
#define all(x) x.begin(), x.end()
#define pii pair<ll, ll>
#define pdd pair<db, db>
#define pi acos(-1.0)
const ll maxn = 1e6 + 10;
ll dp[maxn][2];
signed main(){
	string s;
	cin >> s;
	dp[0][1] = 1;
	_for(i, 0, s.size()){
		int x = s[i] - '0';
		dp[i+1][0] = min(dp[i][0] + x, dp[i][1] + 10 - x);
		dp[i+1][1] = min(dp[i][0] + x + 1, dp[i][1] + 10 - x  - 1);
	}
	cout << min(dp[s.size()][0], dp[s.size()][1] + 1) << endl;
}

Measured memory_bytes: 17028
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))

load()

A = load_list()
mn = A[0]

cnt = 0
for i in range(len(A)):
    if A[i] <= mn:
        cnt += 1
        mn = A[i]

print(cnt)

Measured memory_bytes: 25096
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 0xcccccccccccccccLL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}



//head



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int ma = 0;
  int now = 0;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    if(a == b) {
      now++;
    }
    else now = 0;
    chmax(ma, now);
  }
  if(ma >= 3) {
    cout << "Yes\n";
  }
  else cout << "No\n";
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;int f,Q,T,F;char S[1<<20],*x=S+(1<<18),*y;main(){for(cin>>x>>Q,y=strlen(x)+x;Q--&&cin>>T;)if(T&1)f^=1;else cin>>F,cin>>*(F-1^f?y++:--x);if(f)reverse(x,y);cout<<x;}

Measured memory_bytes: 896
#include <stdio.h>
int main()
{
	int a, b, c, i, k;;
	scanf("%d %d %d", &a, &b, &c);
		k = 0;
	for (i = a;i <= b; i++) {
		if (c%i == 0) k++;
	}
	printf("%d\n", k);
		return 0;
}



Measured memory_bytes: 2716
#include <bits/stdc++.h>
using namespace std;
#define ll long long int

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i <= n - 1; i++) cin >> v[i];
    int maior = 0;
    int ind = 0;
    for (int i = 0; i <= n - 1; i++) {
        if (v[i] > maior) {
            maior = v[i];
            ind = i;
        }
    }
    int tot = 0;
    for (int i = 0; i <= n - 1; i++) {
        if (i != ind) tot += v[i];
    }
    if (maior < tot) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long x = Long.parseLong(sc.next());
		int amari = (int) (x % 11);
		long ans = x / 11 * 2;

		if (amari >= 1 && amari <= 6) {
			ans += 1;
		} else if (amari >= 7 && amari <= 10) {
			ans += 2;
		}

		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 21460
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//




int main() {


    ll N; cin >> N;
    ll cnt[N+1]; rep(i,N+1) cnt[i] = 0;

    for (int i = 2; i <= N; ++i) {
        int n = i;
        for (int j = 2; j*j <= n; ++j) {
            while(n % j == 0) {
                n /= j;
                ++cnt[j];
            }
        }
        if (n != 1) {
            ++cnt[n];
        }
    }

    ll ans = 1;
    rep(i,N+1) {
        ans *= cnt[i] + 1;
        ans %= MOD;
    }
    out(ans);



    return 0;
}









Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1000005;
const int MAXM= 15000005;
int l;
int n,m;
struct edge
{
	int u,v,val;
}e[N];

int cnt;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin>>l;
  int n=0,k=l;
  for(int i=25;;i--)
  {
  	if((1<<i)<=l)
  	{
  	  n=i+1;
		break;	
	}
  }
  for(int i=1;i<n;i++)
  {
  	e[cnt].u=i;
  	e[cnt].v=i+1;
  	e[cnt++].val=0;
  	
  	e[cnt].u=i;
  	e[cnt].v=i+1;
  	e[cnt++].val=1<<i-1;
  }
  int res=l-(1<<(n-1));
  int now=1<<(n-1);
  for(int i=n-1;i>=1;i--)
  {
  	if(res>=(1<<i-1))
  	{
  	 res-=1<<i-1;
  	 e[cnt].u=i;
  	 e[cnt].v=n;
  	 e[cnt++].val=now;
  	 now+= 1<<i-1; 
	}
  }
    cout<<n<<" "<<cnt<<endl;
  	for(int i=0;i<cnt;i++)
  	cout<<e[i].u<<" "<<e[i].v<<" "<<e[i].val<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	char c[3][3];
	
	scanf("%s",c[0]);
	scanf("%s",c[1]);
	scanf("%s",c[2]);
	
	printf("%c%c%c",c[0][0],c[1][1],c[2][2]);
	
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
	static class Shop implements Comparable<Shop> {
		long A;
		int B;

		Shop(long A, int B) {
			this.A = A;
			this.B = B;
		}

		@Override
		public int compareTo(Shop o) {
			if (this.A < o.A) {
				return -1;
			} else if (this.A > o.A) {
				return 1;
			} else
				return 0;
		}
	}

	int N, M;
	long[] A;
	int[] B;
	Queue<Shop> shops;

	Main() {
		Scanner in = new Scanner(System.in);
		N = in.nextInt();
		M = in.nextInt();
		A = new long[N];
		B = new int[N];
		for (int i = 0; i < N; ++i) {
			A[i] = in.nextLong();
			B[i] = in.nextInt();
		}
		in.close();
		this.shops = new PriorityQueue<>(N);
		for (int i = 0; i < N; ++i) {
			this.shops.add(new Shop(A[i], B[i]));
		}
	}

	long calc() {
		long result = 0;
		int remain = M;
		while (remain > 0) {
			Shop shop = this.shops.poll();
			result += Math.min(remain, shop.B) * shop.A;
			remain -= shop.B;
		}
		return result;
	}

	public static void main(String[] args) {
		Main ins = new Main();
		System.out.println(ins.calc());
	}

}


Measured memory_bytes: 64460
from itertools import product
INF = 1 << 30
while True:
    n, m, s, g1, g2 = map(int, raw_input().split())
    if n | m | s | g1 | g2 == 0:
        break
    G = [[INF] * (n + 1) for _ in xrange(n + 1)]
    for i in xrange(n + 1):
        G[i][i] = 0
    for _ in xrange(m):
        b1, b2, c = map(int, raw_input().split())
        G[b1][b2] = c
    for k, i, j in product(xrange(n + 1), repeat = 3):
        G[i][j] = min(G[i][j], G[i][k] + G[k][j])
    print min(G[s][i] + G[i][g1] + G[i][g2] for i in xrange(n + 1))

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

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


#define pb push_back
#define ff first
#define ss second
#define INF int(3e9)
#define BIG_INF ll(9e18)
#define SIZE 100001
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define len(v) int((v).size())
#define BACK(v) ll((v).back())
#define sqr(x) (x) * (x)
#define cube(x) (x) * (x) * (x)
#define filein freopen("input.txt", "r", stdin)
#define fileout freopen("output.txt", "w", stdout);


ll binpow(ll a, ll b, ll MOD = BIG_INF)
{
    ll res = 1;

    while(b)
    {
        if(b & 1)
            res *= a;
        a *= a;
        b >>= 1;
        a %= MOD;
        res %= MOD;
    }

    return res % MOD;
}

const ll mod = 1e9 + 7;

int T = 1;
int n, m;
int a[SIZE];



void solve()
{

    int x, t;
    cin >> n >> x >> t;

    ll ans = 0;
    while(n > 0)
    {
        ans += t;
        n -= x;
    }


    cout << ans;


    return;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
//    filein;fileout;

//    cin >> T;

    while(T--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3656
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

#include <bits/stdc++.h>
 
using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair
#define debug_vec(x, n) cout << (#x) << ": "; for(int i = 0; i < n; i++) cout << x[i] << (i == n - 1 ? "\n" : " ");

#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it){}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << "\n";
    err(++it, args...);
}

typedef long long ll;
typedef long double ld;

void solve(){
    string s;
    cin >> s;
    cout << (s == "ABC" ? "ARC\n" : "ABC\n");
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define ll long long 
#define pb push_back
using namespace std;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
	int n, d;
	cin >> n >> d;
	int ans = 0;
	while(n--){
		ll x, y;
		cin >> x >> y;
		if(sqrt((x*x)+(y*y)) <= d)
			ans++;
	}
	cout << ans << "\n";
	return 0;
}



Measured memory_bytes: 3700
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;

vector<VI>G;
VI dp;

int dfs(int p) {
	VI tmp;

	REP(i, G[p].size()) {
		tmp.push_back(dfs(G[p][i]));
	}
	rSORT(tmp);
	int ans = 0;
	REP(i, tmp.size()) {
		ans = max(ans, tmp[i] + i + 1);
	}
	//dp[p] = ans;

	//cout << p << " " << ans << endl;


	return ans;
}

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

	int N;
	cin >> N;
	G.resize(N);
	dp.resize(N);
	REP(i, N - 1) {
		int a;cin >> a;
		a--;
		G[a].push_back(i + 1);
	}

	cout << dfs(0) << endl;

	return 0;
}



Measured memory_bytes: 15872
while(True):
    count=0
    var=input()
    var=var.split()
    n=int(var[0])
    x=int(var[1])
    if(n==0 and x==0):
        break
    else:
        for i in range(1,n+1):
            for k in range(i+1,n+1):
                for m in range(k+1,n+1):
                    s=0
                    s=i+k+m
                    if(s==x):
                        count+=1
        print(count)


Measured memory_bytes: 5596
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn = 2e5 + 5, MAXc=5e3+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

const int C = 2005;

ll a[MAXn], b[MAXn], fac[4 * MAXc], dp[MAXc][MAXc];

void add(ll &x, ll y){
    x += y;
    if (x >= MOD) x -= MOD;
}

ll mypw(ll x, ll k){
    if (!k) return 1;
    ll a = mypw(x, k / 2);
    if (k & 1)return a * a % MOD * x % MOD;
    else return a * a % MOD;
}

ll c(ll x, ll y){
    return fac[x] * mypw(fac[y], MOD - 2) % MOD * mypw(fac[x - y], MOD - 2) % MOD;
}

int main()
{
    IOS();
    fac[0] = 1;
    for(int i = 1;i < 4 * MAXc;i ++)
        fac[i] = fac[i - 1] * i % MOD;
    int n;
    cin >> n;
    for(int i = 1;i <= n;i ++)
        cin >> a[i] >> b[i], dp[C - a[i]][C - b[i]]++;
    for (int i = 1;i <= 2 * C;i ++)
        for(int j = 1;j <= 2 * C;j ++)
            add(dp[i][j], dp[i][j - 1]), add(dp[i][j], dp[i - 1][j]);
    ll tt = 0;
    for (int i = 1;i <= n;i ++)
        add(tt, dp[C + a[i]][C + b[i]]);
    debug(tt);
    for (int i = 1;i <= n;i ++)
        tt = (tt - c(a[i] + a[i] + b[i] + b[i], a[i] + a[i])) % MOD;
    debug((tt + MOD) % MOD);
    cout << (tt * mypw(2, MOD - 2) % MOD + MOD) % MOD << endl;
}


Measured memory_bytes: 162176
import java.util.Scanner;
import java.util.Deque;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Long> array = new ArrayList<Long>();
		Deque<String> outArray = new ArrayDeque<String>();
		int outCount = 0;
		int q = sc.nextInt();
		for (int i = 0; i < q; i++) {
			switch (sc.nextByte()) {
				case 0:
					array.add(sc.nextLong());
					break;
				case 1:
					outArray.addLast((array.get(sc.nextInt())).toString());
					break;
				case 2:
					array.remove(array.size() - 1);
					break;
			}
		}
		for (String out:outArray) {
			System.out.println(out);
		}
	}
}



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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> wall(H);
    rep(i, H) cin >> wall[i];

    int dx[4] = {1, -1, 0, 0};
    int dy[4] = {0, 0, -1, 1};

    rep(i, H) {
        rep(j, W) {
            if (wall[i][j] == '#') {
                bool ok = false;
                rep(k, 4) {
                    int ni = i + dy[k];
                    int nj = j + dx[k];
                    if (0 <= ni && ni < H && 0 <= nj && nj < W && wall[ni][nj] == '#') ok = true;
                }

                if (!ok) {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }

    cout << "Yes" << endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vll l(n), r(n), lsum(n + 1), rsum(n + 1);
  for (int i = 0; i < n; i++)
    cin >> l[i] >> r[i];
  sort(l.begin(), l.end());
  sort(r.begin(), r.end());
  reverse(l.begin(), l.end());

  ll ans = 0;
  for (int i = 0; i < n; i++)
    lsum[i + 1] += lsum[i] + l[i];
  for (int i = 0; i < n; i++)
    rsum[i + 1] += rsum[i] + r[i];
  ans = max(ans, 0LL);
  for (int i = 0; i < (n + 1) / 2; i++) {
    ans = max(ans, 2 * (lsum[i + 1] - rsum[i + 1]));
    ans = max(ans, 2 * (lsum[i + 1] - rsum[i]));
    if (i < n / 2) {
      ans = max(ans, 2 * (lsum[i] - rsum[i + 1]));
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3456
#include <stdio.h>

char str[1005];
char p[1005];

int main(void){
	int q, a, b;
	char op[10], *x, *y, c;
	
	scanf("%s%d", str, &q);
	while (q--) {
		scanf("%s%d%d", op, &a, &b);
		if (op[2] == 'i'){
			b++, c = *(str+b), *(str+b) = 0, puts(str+a), *(str+b) = c;
		}else if (op[2] == 'v'){
			x = str+a, y = str+b;
			while (x < y) {
				c = *x, *x = *y, *y = c;
				x++, y--;
			}
		}else{
			scanf("%s", p);
			x = str+a, y = p;
			while (*y) *x++ = *y++;
		}
	}
	return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 N; cin >> N;
    i64 two, odd, four;
    two = 0, odd = 0, four = 0;
    REP(i, N) {
        i64 a; cin >> a;
        if (a % 4 == 0) four++;
        else if (a % 2 == 0) two++;
        else odd++;
    }

    if (two == 0 && four >= odd - 1) {
        cout << "Yes" << endl;
        return 0;
    }

    if (four >= odd) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
long long r,g,b,n,ans;
int main()
{
	cin>>r>>g>>b>>n;
	for(long long i=0;i<=n;i++)
	{
		for(long long j=0;j<=n;j++)
		{
			long long tmp=n-(i*r)-(j*g);
			if(tmp%b==0&&tmp>=0)
			{
				ans++; 
			}
		}
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <tuple>
#include <map>
#include <ctime>
#include <cstdlib>
#include <random>
using namespace std;

#define int long long

signed main(){
	int ans = 0;
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		if(i % 15 == 0);
		else if(i % 5 == 0);
		else if(i % 3 == 0);
		else ans += i;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
import math
import queue
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=qb
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
def dq():
	return queue.deque()
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1

n = readInt()
neven = 0
nodd = 0
for i in readInts():
	if i%2==0:
		neven+=1
	else:
		nodd+=1

if nodd%2==1:
	if neven==0:
		print("YES")
		exit()
	else:
		print("NO")
		exit()
else:
	print("YES")

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

int main(){
    int H, W;
    cin >> H >> W;
    vector<vector<char>> grid(H+2, vector<char>(W+2, '#'));
    for (int i = 0; i < H; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < W; j++) {
            grid[i+1][j+1] = s[j]; 
        }
    }
    vector<vector<int>> l(H+2, vector<int>(W+2, 0));
    vector<vector<int>> r(H+2, vector<int>(W+2, 0));
    vector<vector<int>> u(H+2, vector<int>(W+2, 0));
    vector<vector<int>> d(H+2, vector<int>(W+2, 0));
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            if (grid[i][j] == '.' && grid[i][j-1] == '.') l[i][j] = l[i][j-1]+1; 
        }
    }
    for (int i = 1; i <= H; i++) {
        for (int j = W; j >= 1; j--) {
            if (grid[i][j] == '.' && grid[i][j+1] == '.') r[i][j] = r[i][j+1]+1; 
        }
    }
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            if (grid[i][j] == '.' && grid[i-1][j] == '.') u[i][j] = u[i-1][j]+1; 
        }
    }
    for (int i = H; i >= 1; i--) {
        for (int j = 1; j <= W; j++) {
            if (grid[i][j] == '.' && grid[i+1][j] == '.') d[i][j] = d[i+1][j]+1; 
        }
    }
    int ans = 0;
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            ans = max(ans, l[i][j] + r[i][j] + u[i][j] + d[i][j] + 1); 
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 67072
#include<cstdio>
using namespace std;
char ch,a,b,sum=-1;
int main(){
	a=getchar();
	ch=getchar();
	while(1){
		b=ch;
		++sum;
		ch=getchar();
		if(ch=='\n'){
			printf("%c%d%c\n",a,sum,b);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  int ans = 0;
  for (int i = a;i <= b;i++){
    string s = to_string(i);
    for (int j = 0; j<= s.length()/2-1;j++){
      if (s[j] != s[s.length()-j-1]){
        break;
      }
      if (j == (s.length()/2 -1)){
        ans += 1;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>

using namespace std;


string getStr(string str, int start, int end){
    string out = "";
    for(int i=start; i<end; i++){
        out += str.at(i);
    }
    return out;
}


int main(){
    string s;
    cin >> s;
    int n = s.length();

    long sum = 0;
    for(int bit = 0; bit < (1<<(n-1)); bit++){
        int bufi = 0;
        for(int i=0; i<n; i++){
            if(bit & (1<<i)){
                string buf = getStr(s, bufi, i+1);
                sum += atol(buf.c_str());
                bufi = i+1;
            }
        }
        sum += atol(getStr(s, bufi, n).c_str());
    }

    cout << sum << endl;
    return 0;
}

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

int main() {
	int N, T;
	cin >> N >> T;
	int c[1000];
	int t[1000];
	int cost=1001;
	for (int i = 0; i < N; i++) {
		cin >> c[i] >> t[i];
		if ((t[i] <= T) && (c[i] <= cost))cost = c[i];
	}
	if (cost == 1001)cout << "TLE";
	else cout << cost;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi >
#define vvvi vector<vvi >
#define pii pair<int,int>
#define INF (int)1e9
#define MOD (int)1e9+7
typedef long long llong;
using namespace std;

int main(){
	int n;
	cin>>n;
	
	vector<int> a(n);
	REP(i,n) cin>>a[i];
	
	vector<int> ans(n);
	int now=0;
	for(int i=n-1;i>=0;i-=2){
		ans[now++]=a[i];
	}
	for(int i=n%2;i<n;i+=2){
		ans[now++]=a[i];
	}
	
	REP(i,n){
		cout<<ans[i]<<endl;
	}
}

Measured memory_bytes: 3712
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let a: Vec<i64> = (0..n).map(|_| input()).collect();

    let mut v = vec![0i64; n + 1];
    for i in 1..n + 1 {
        v[i] = 2 * a[i - 1] - v[i - 1];
    }
    let u = (v[n] - v[0]) / 2;

    for i in 0..n {
        print!("{} ", if i % 2 == 0 { v[i] + u } else { v[i] - u });
    }
}


Measured memory_bytes: 7420
#include<bits/stdc++.h>
using namespace std;
const int INF=100000000;

vector<int> G[2001];
int ans[2000]; //ans[k]=i→jの最短距離がkとなるような組の数
int d[2001];
int n,x,y; 

void bfs(int i){
    fill(begin(d),end(d),INF);
    queue<int> que;
    que.push(i);
    d[i]=0;
    while(!que.empty()){
        int p=que.front(); que.pop();
        for(int v:G[p]){
            if(d[v]==INF){
                que.push(v);
                d[v]=d[p]+1;
            }
        }
    }
    for(int j=1;j<=n;j++){
        ans[d[j]]++;
    }
}

int main(){
    cin >> n >> x >> y;
    for(int i=1;i<=n-1;i++){
        G[i].push_back(i+1);
        G[i+1].push_back(i);
    }
    G[x].push_back(y);
    G[y].push_back(x);
    for(int i=1;i<=n;i++){
        bfs(i);
    }
    for(int k=1;k<=n-1;k++){
        cout << ans[k]/2 << endl; //2回数えているので割る
    }    
}

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


int main() {
  int min;
  int max;
  int count;

  cin >> min >> max;

 for(int a = 1; a <=9; a++){
   for(int b = 0; b <=9; b++){
     for(int c = 0; c <=9; c++){
       int x = 10001 * a + 1010 * b + 100 * c;
       if(x >= min && x <= max){
         count += 1;
       }
     }
   }
 }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int n;
ll d;

ll loc[100005];
ll val[100005];

ll prefixDiff[100005];
ll maxPrefixDiff[100005];

ll suffixDiff[100005];
ll maxSuffixDiff[100005];

void init() {
    ll curr = 0;
    for(int i = 0; i < n; i++) {
        curr += val[i];
        prefixDiff[i+1] = curr - loc[i];
    }
    for(int i = 1; i <= n; i++) {
        maxPrefixDiff[i] = max(prefixDiff[i], maxPrefixDiff[i-1]);
    }
    curr = 0;
    for(int i = 0; i < n; i++) {
        curr += val[n-1-i];
        suffixDiff[i+1] = curr - (d - loc[n-1-i]);
    }
    for(int i = 1; i <= n; i++) {
        maxSuffixDiff[i] = max(suffixDiff[i], maxSuffixDiff[i-1]);
    }
}

int main() {
    scanf("%d%lld", &n, &d);
    for(int i = 0; i < n; i++) {
        scanf("%lld %lld", &loc[i], &val[i]);
    }
    init();
    ll ret = 0;
    {
        ll curr = 0;
        for(int i = 0; i < n; i++) {
            curr += val[i];
            ret = max(ret, curr - loc[i]);
        }
    }
    {
        ll curr = 0;
        for(int i = 0; i < n; i++) {
            curr += val[n-1-i];
            ret = max(ret, curr - (d - loc[n-1-i]));
        }
    }
    {
        // right, then left
        ll curr = 0;
        for(int i = 0; i < n; i++) {
            curr += val[i];
            ret = max(ret, curr - 2 * loc[i] + maxSuffixDiff[n-1-i]);
        }
    }
    {
        // left, then right
        ll curr = 0;
        for(int i = 0; i < n; i++) {
            curr += val[n-1-i];
            ret = max(ret, curr - 2 * (d - loc[n-1-i]) + maxPrefixDiff[n-1-i]);
        }
    }
    printf("%lld\n", ret);
}


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

constexpr int inf = 0x3f3f3f3f;

auto chmin = [](auto&& l, auto r) { return r < exchange(l, r < l ? r : l); };
auto chmax = [](auto&& l, auto r) { return exchange(l, l < r ? r : l) < r; };

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for (auto&& e : s) {
    cin >> e;
  }
  vector<vector<int>> g(h * w, vector<int>(h * w, inf));
  for (int v = 0; v < h * w; ++v) {
    g[v][v] = 0;
  }
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (s[i][j] == '#') {
        continue;
      }
      for (int di = -1; di <= 1; ++di) {
        for (int dj = -1; dj <= 1; ++dj) {
          if (abs(di) + abs(dj) == 1) {
            int ni = i + di, nj = j + dj;
            if (ni < 0 or ni >= h or nj < 0 or nj >= w or s[ni][nj] == '#') {
              continue;
            }
            g[i * w + j][ni * w + nj] = 1;
            g[ni * w + nj][i * w + j] = 1;
          }
        }
      }
    }
  }
  for (int k = 0; k < h * w; ++k) {
    for (int i = 0; i < h * w; ++i) {
      for (int j = 0; j < h * w; ++j) {
        chmin(g[i][j], g[i][k] + g[k][j]);
      }
    }
  }
  int res = -1;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      for (int ni = 0; ni < h; ++ni) {
        for (int nj = 0; nj < w; ++nj) {
          if (s[i][j] == '.' and s[ni][nj] == '.') {
            chmax(res, g[i * w + j][ni * w + nj]);
          }
        }
      }
    }
  }
  cout << res << '\n';
}


Measured memory_bytes: 896
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<cstdlib>



using namespace std;

int a,b;
long long int ans;

int main(){
    cin >> a >> b;
    for(long long int i=max(a,b);;i+=max(a,b)){
        if(i % a == 0 && i % b == 0){
            ans = i;
            break;
        }
    }
    cout << ans << endl;




    return 0;
}

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

vector<Int> zalgorithm(string s){
  Int n=s.size();
  vector<Int> a(n,0);
  a[0]=n;
  Int i=1,j=0;
  while(i<n){
    while(i+j<n&&s[j]==s[i+j]) j++;
    a[i]=j;
    if(j==0){
      i++;
      continue;
    }
    Int k=1;
    while(i+k<n&&k+a[k]<j) a[i+k]=a[k],k++;
    i+=k;
    j-=k;
  }
  return a;
}

//INSERT ABOVE HERE
using vint = vector<Int>;
void print(const vint &v){
  for(Int i=0;i<(Int)v.size();i++){
    if(i) cout<<" ";
    cout<<v[i];
  }
  cout<<endl;
}

vint add(const vint &a,const vint &b){
  vint c(26,0);
  for(Int i=0;i<26;i++) c[i]=a[i]+b[i];
  return c;
}
vint sub(const vint &a,const vint &b){
  vint c(26,0);
  for(Int i=0;i<26;i++) c[i]=a[i]-b[i];
  return c;
}

signed main(){
  string s;
  cin>>s;
  Int l,r;
  cin>>l>>r;
  l--;
  
  Int n=s.size(),k=n/2+1;
  vector<Int> z=zalgorithm(s);
  while(k<n&&k+z[k]<n) k++;
  
  vector<Int> x;
  x.emplace_back(n);
  x.emplace_back(k*2);
  for(Int i=0;x.back()<=r;i++)
    x.emplace_back(Int(x[i]+x[i+1]));

  vector<vint> a(n+1,vint(26,0));
  for(Int i=0;i<n;i++)
    for(Int j=0;j<26;j++)
      a[i+1][j]=a[i][j]+(s[i]=='a'+j);
  
  using P = pair<Int, Int>;
  map<P, vint> dp;
  function<vint(Int, Int)> dfs=
    [&](Int l,Int r){
      if(dp.count(P(l,r))) return dp[P(l,r)];
      vint &res=dp[P(l,r)];
      if(r<=n) return res=sub(a[r],a[l]);
      Int p=0;
      while(r>x[p]) p++;
      Int y=x[p]/2;
      if(y<=l) return res=dfs(l-y,r-y);
      return res=add(dfs(l,y),dfs(0,r-y));
    };
  
  print(dfs(l,r));
  return 0;
}


Measured memory_bytes: 50496
#include<stdio.h>
int main(){
int a,n,m;
scanf("%d%d", &n, &m);
  a=0;
  if(n>1){
  a+=n*(n-1)/2;
  }
  if(m>1){
  a+=m*(m-1)/2;
  }

printf("%d\n",a);
return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
typedef long long ll;

const int MAXN = 1000*1000 + 7;
const int SS = 1<<20;
const int MOD = 1000*1000*1000 + 7;

int ile_dziel[MAXN];
int n;

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

	int T;
	//cin >> T;
	T = 1;
	while(T--)
	{
		string s;
		cin >> n;
		for(int i=1; i<=n; i++)
		{
			for(int j=i; j<=n; j+=i)
				ile_dziel[j]++;
		}
		long long res = 0;
		for(int c=1; c<=n; c++)
		{
			res += ile_dziel[ n-c ];
		}
		cout << res << '\n';
	}
	return 0;
}


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

int main() {
	int N, M, C;
	cin >> N >> M >> C;
	vector<int> B(M);
	for (int i = 0; i < M; i++)
		cin >> B.at(i);
	int ans = 0;
	for (int i = 0; i < N; i++) {
		vector<int> A(M);
		for (int j = 0; j < M; j++)
			cin >> A.at(j);
		long temp = C;
		for (int j = 0; j < M; j++)
			temp += A.at(j) * B.at(j);
		if (temp > 0) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
long long int lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
using ll =long long int;
#define ci(a) cin>>a
#define co(a) cout<<a<<endl
#define gcd(a,b) __gcd(a,b)
#define vec vector<ll>
#define for(i,a,b) for(int i=a;i<b;i++)
#define sort(a,b) sort(a.begin(),b.end())
//gcd 最大公約数
//lcm 最小公倍数
//double 少数（変数）
//string 文字列（変数）
//sqrt 平方根
//ceil 天井関数
//floor 床関数
//abs 絶対値
//pow 累乗
//cbrt  立方根
//hypot 平方和の平方根
 
int main() {
  ll a;
  string s;
  ci(a>>s);
  if(a<3200)
    s="red";
  co(s);
}


Measured memory_bytes: 256