akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if (a - b >= 1) cout << 2 * a - 1 << endl;
    else if (a == b) cout << a + b << endl;
    else cout << 2 * b - 1 << endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/nomura2020/tasks/nomura2020_c

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

  VL as(N + 1);
  rep(i, N + 1) cin >> as[i];

  VL rev_acc(N + 1);
  repr(i, N + 1) { rev_acc[i] = as[i] + (i < N ? rev_acc[i + 1] : 0); }

  if (N == 0) {
    ll res = as[0] == 1 ? 1 : -1;
    drop(res);
  }

  ll prev_non_leaf_ct = 1 - as[0];
  ll res = 1;

  rep1(i, N) {
    ll ma = min(2 * prev_non_leaf_ct, rev_acc[i]);
    unless(as[i] <= ma) drop(-1);

    res += ma;
    prev_non_leaf_ct = ma - as[i];
  }

  cout << res << "\n";
}


Measured memory_bytes: 4712
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
if m>0:
    a=[int(input()) for i in range(m)]

dp=[None]*(n+1)
dp[0]=1
for i in range(m):
    dp[a[i]]=0
if dp[1]==None:
    dp[1]=1

for i in range(2,n+1):
    if dp[i]==None:
        dp[i]=(dp[i-2]+dp[i-1])%1000000007

print(dp[-1])

Measured memory_bytes: 77400
#include <bits/stdc++.h>
/* S.size() s.substr(l,r=s.size()-l) -> l文字目からr文字分
__gcd()　lower_bound(a+l,a+r,x)-a でindex
// 配列  -> min/max({}) 
// vector-> *min_element(a+l,a+r)  *忘れず lとrで[l,r) 
//reverse(a+l,a+r)   配列aの[l,r)を逆順に strはreverse(all(s))
//sort(a+l,a+r,greater <int>()) 配列aの[l,r)昇順sort,大きい順はgreater<type>()
//vectorならall(v)
clock()/CLOCKS_PER_SEC で秒数
vector v.push_back(x),v.pop_back()
q.push(x),front()で先頭を返す,pop()で削除, size(),empty()
<deque>(push/pop)_(front/back)/fornt/back/insert/
priority_queue 宣言は priority_queue< Type, vector<Type>, greater<Type>> Q1; 
// pq.push(x),top()で参照 pop()で削除   greaterで最小 lessで最大がtopに*/
using namespace std;
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define print(i) std::cout << (i) << '\n'
#define rrep(i,n) for(int (i)=(n)-1;(i)!=-1;(i)--)
#define vep(i,v) for(auto (i)=v.begin();(i)<(v.end());(i)++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
inline long long ceildiv(long long a, long long  b) { return (a+b-1)/b; }
typedef pair<long long,long long> P;
typedef pair<int,int> PI;
using Graph = std::vector<std::vector<int> >;
const long long inf = 10e17;
const long long mod = 1000000007;
//int |x|<=2*10**9     long |x|<= 9*10**18
//printf(".(小数点以下の桁数)lf(double時、float ならf)")
#define ll long long
int maze[1100][1100];
int x[4]={0,0,1,-1};
int y[4]={1,-1,0,0};
int main(){
int h,w;cin>>h>>w;
vector<PI> now,nex;
rep(i,h){
  string ss;cin>>ss;
  rep(j,w){
    if (ss[j]=='#'){
      now.push_back(PI(i,j));
      maze[i][j]=1;}
  }
}
int ans=0;
bool flag=true;
while (flag){
flag=false;

while(!now.empty()){
  PI p=now[now.size()-1];
  now.pop_back();
rep(k,4){
  
  int a=p.first+x[k],s=p.second+y[k];
  if (0<=a&&a<h && 0<=s&&s<w&& maze[a][s]!=1){
  maze[a][s]=1;flag=true;
  nex.push_back(PI(a,s));}
}}
now.clear();
ans++;swap(now,nex);
}
print(ans-1);
}

Measured memory_bytes: 19176
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

#include <cstdio>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrep1(i, s, n) for (int i = (s); i >= (n); i--)
#define print_array(ary, size) cout << ary[0]; rep1(i, 1, size - 1) cout << ' ' << ary[i]; cout << endl;
typedef long long ll;
typedef unsigned long long ull;



typedef struct Node {
	int key;
	Node* parent;
	Node* left;
	Node* right;
} Node;

class BST {
private:
	Node root;

	/* Preorder */
	void PreO(Node* node)
	{
		cout << ' ' << node->key;
		if (node->left != NULL) PreO(node->left);
		if (node->right != NULL) PreO(node->right);
	}
	/* Inorder */
	void InO(Node* node)
	{
		if (node->left != NULL) InO(node->left);
		cout << ' ' << node->key;
		if (node->right != NULL) InO(node->right);
	}
	/* Postorder */
	void PostO(Node* node)
	{
		if (node->left != NULL) PostO(node->left);
		if (node->right != NULL) PostO(node->right);
		cout << ' ' << node->key;
	}
	/* find */
	void findthis(Node* node, int key)
	{
		if (node->key == key) {
			cout << "yes" << endl;
		}
		else if (key < node->key) {
			if (node->left == NULL) {
				cout << "no" << endl;
			}
			else {
				findthis(node->left, key);
			}
		}
		else {
			if (node->right == NULL) {
				cout << "no" << endl;
			}
			else {
				findthis(node->right, key);
			}
		}
	}
public:
	/* Constructor */
	BST()
	{
		root.key = 2000000001;
		root.parent = NULL;
		root.left = NULL;
		root.right = NULL;
	}
	/* Destructor */
	~BST()
	{

	}
	/* insert */
	void insert(int key)
	{
		if (root.key == 2000000001) {
			root.key = key;
			return;
		}

		Node* add = new Node;
		Node* parent = &root;

		add->key = key;
		add->left = NULL;
		add->right = NULL;

		while (parent != NULL) {
			add->parent = parent;
			if (add->key < parent->key) parent = parent->left;
			else parent = parent->right;
		}

		if (add->key < add->parent->key) add->parent->left = add;
		else add->parent->right = add;
	}
	/* Preorder */
	void Preorder()
	{
		PreO(&root);
		cout << endl;
	}
	/* Inorder */
	void Inorder()
	{
		InO(&root);
		cout << endl;
	}
	/* Postorder */
	void Postorder()
	{
		PostO(&root);
		cout << endl;
	}
	/* find */
	void find(int key)
	{
		findthis(&root, key);
	}
};

int main()
{
	BST Tree;
	int n;
	string direction;
	int key;

	cin >> n;

	rep(i, n) {
		cin >> direction;
		if (direction == "insert") {
			cin >> key;
			Tree.insert(key);
		}
		else if (direction == "print") {
			Tree.Inorder();
			Tree.Preorder();
		} 
		else if (direction == "find") {
			cin >> key;
			Tree.find(key);
		}
	}

	return 0;
}


Measured memory_bytes: 21768
#pragma GCC optimize ("Ofast")

#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING

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


bool dislikes[10];


bool ok(int n) {
	while (n) {
		if (dislikes[n % 10]) return false;
		n /= 10;
	}
	return true;
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);

	int n, k;
	cin >> n >> k;

	for (int i = 0; i < k; ++i) {
		int in;
		cin >> in;
		dislikes[in] = true;
	}

	for (int i = n;; ++i) {
		if (ok(i)) {
			cout << i << '\n';
			break;
		}
	}
		

	return 0;
}

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

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

	string s,t,u;
	int a,b;
	cin >> s>>t;
	cin >> a>>b;
	cin >> u;
	if (u==s)
	{
		a--;
	} else {
		b--;
	}

	cout << a << " " << b<< "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

typedef vector<ll> vec;
typedef vector<vec> mat;

mat mul(mat &A,mat &B){
	mat C(A.size(),vec(B[0].size()));
	for(int i=0;i<A.size();i++){
		for(int k=0;k<B.size();k++){
			for(int j=0;j<B[0].size();j++){
				C[i][j]=(C[i][j]+(A[i][k]*B[k][j]%MOD))%MOD;
			}
		}
	}
	return C;
}

mat pow(mat A,ll n){
	mat B(A.size(),vec(A.size()));
	for(int i=0;i<A.size();i++){
		B[i][i]=1;
	}
	while(n>0){
		if(n&1)B=mul(B,A);
		A=mul(A,A);
		n>>=1;
	}
	return B;
}


int n,m,K;
ll p[10001];
ll nec[801];
ll res[30][801];
ll ans[2][801];

int main(void){
	scanf("%d%d%d",&n,&m,&K);
	mat B(n,vec(n));
	for(int i=0;i<m;i++){
		scanf("%d",&p[i]);
	}
	nec[0]++;
	for(int i=0;i<m;i++){
		int mo=p[i]%n;
		nec[mo]++;
	}
	for(int i=0;i<30;i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<n;k++){
				if(i>0)res[i][(j+k)%n]+=(res[i-1][j]*res[i-1][k])%MOD;
				if(i==0)res[i][j]=nec[j];
				if(res[i][(j+k)%n]>=MOD)res[i][(j+k)%n]%=MOD;
			}
		}
	}
	int prev=0,now=1;
	ans[0][0]=1;
	for(int i=0;i<30;i++){
		if(K>>i & 1){
			for(int j=0;j<n;j++){
				for(int k=0;k<n;k++){
					ans[now][(j+k)%n]+=(ans[prev][j]*res[i][k])%MOD;
					if(ans[now][(j+k)%n]>=MOD)ans[now][(j+k)%n]%=MOD;
				}
			}
			swap(now,prev);
			memset(ans[now],0,sizeof(ans[now]));
		}
	}
	for(int i=0;i<n;i++){
		printf("%lld\n",ans[prev][i]);
	}
	return 0;
}

Measured memory_bytes: 8248
# 問題：https://atcoder.jp/contests/abc142/tasks/abc142_c

n = int(input())
a = list(map(int, input().strip().split()))
appear_attendance_number = {}
for i in range(n):
    appear_attendance_number[a[i]-1] = i+1
res = []
for i in range(n):
    res.append(appear_attendance_number[i])
print(' '.join(map(str, res)))



Measured memory_bytes: 32864
#include <bits/stdc++.h>
 
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a, v) memset((a), v, sizeof(a))
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

const int N = 200005;
const int MOD = 998244353;

struct Node {
	ll val;
	int lazy;
};

int n, q;
ll pw10[N], preSum10[N];
Node segtree[N*4];

ll preSumQuery(int x, int y) {
	if (x == 0) return preSum10[y];
	ll ret = (preSum10[y] - preSum10[x-1]) % MOD;
	if (ret < 0) ret += MOD;
	return ret;
}

void propagate(int id, int L, int R) {
	if (segtree[id].lazy == 0) return;
	int mid = (L + R) >> 1;
	segtree[id<<1].val = (preSumQuery(n-mid, n-L) * segtree[id].lazy) % MOD;
	segtree[id<<1|1].val = (preSumQuery(n-R, n-(mid+1)) * segtree[id].lazy) % MOD;
	segtree[id<<1].lazy = segtree[id].lazy;
	segtree[id<<1|1].lazy = segtree[id].lazy;
	segtree[id].lazy = 0;
}

void update(int id, int L, int R, int x, int y, int dig) {
	if (x <= L && R <= y) {
		segtree[id].val = (preSumQuery(n-R, n-L) * dig) % MOD;
		segtree[id].lazy = dig;
		// printf("id = %d, L = %d, R = %d\n", id, L, R);
		// printf("%lld\n", segtree[id].val);
		return;
	}
	propagate(id, L, R);
	int mid = (L + R) >> 1;
	if (x <= mid) update(id<<1, L, mid, x, y, dig);
	if (y > mid) update(id<<1|1, mid + 1, R, x, y, dig);
	segtree[id].val = (segtree[id<<1].val + segtree[id<<1|1].val) % MOD;
	// printf("id = %d, L = %d, R = %d\n", id, L, R);
	// printf("%lld\n", segtree[id].val);
}

int main() {
	pw10[0] = preSum10[0] = 1;
	for (int i = 1; i < N; i++) {
		pw10[i] = (1ll*10*pw10[i-1]) % MOD;
		preSum10[i] = (pw10[i] + preSum10[i-1]) % MOD;
	}
	scanf("%d %d", &n, &q);
	for (int i = 1; i <= n; i++) update(1, 1, n, i, i, 1);
	while (q--) {
		int l, r, dig;
		scanf("%d %d %d", &l, &r, &dig);
		update(1, 1, n, l, r, dig);
		printf("%lld\n", segtree[1].val);
	}
	return 0;
}

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

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

	for (int i = 1; i <= 9; i++)
	{
		for (int j = 1; j <= 9; j++)
		{
			if (i * j == n)
			{
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;

	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    string S; cin >> S;

    cout << S[0] << S.size()-2 << S[S.size()-1] << endl;

    return 0;

}

Measured memory_bytes: 256
n = int(input())
A = 0
for i in range(1,n+1) :
    if i%2 == 0:
        continue
    C = 0
    for j in range(1,i+1) :
        if i % j == 0 :
            C = C + 1
    if C == 8 :
        A = A + 1



print(A)

Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
#define lint long long
#define low lower_bound
#define upp upper_bound
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define Rep(i, n) for (int i = int(n); i >= 0; --i)
#define all(vec) (vec).begin(), (vec).end()
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>

struct edge { int to; double cost; };
#define P pair<int, int>
#define D pair<double, double>
#define DI pair<double, int>
//const lint mod = 998244353LL;
const lint mod = 1000000007LL;
const lint inf = 3LL * mod * mod;

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

lint modpow(lint x, lint n, lint m) {
	lint ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (m <= ans) ans %= m;
		}
		x *= x;
		if (m <= x) x %= m;
		n >>= 1;
	}
	return ans;
}

lint fact[1000000];
void f_init(lint n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (lint i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

lint inver[1000000]; bool inve[100000];
lint inv(lint x) {
	if (x == 0) return 0;
	else if (inve[x]) return inver[x];
	else {
		inve[x] = true;
		return inver[x] = modpow(x, mod - 2, mod);
	}
}

lint comb(lint n, lint r) {
	if (n < r) return 0;
	if (n == r) return 1;
	lint ans = fact[n] * inv(fact[n - r]) % mod * inv(fact[r]) % mod;
	if (ans < 0) return ans + mod;
	return ans;
}

lint nck[1010][1010];
void comb(lint n) {
	rep(i, n + 1) {
		rep(j, i + 1) {
			if (j == 0 || i == j) nck[i][j] = 1;
			else nck[i][j] = nck[i - 1][j - 1] + nck[i - 1][j];
		}
	}
}

lint gcd(lint a, lint b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

bool pri(lint p) {
	for (lint i = 2; i * i <= p; i == 2 ? ++i : i += 2) if (p % i == 0) return false;
	return p > 1;
}

map<lint, lint> factring(lint n) {
	map<lint, lint>ans;
	for (lint i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++ans[i];
		}
	}
	if (n != 1) ++ans[n];
	return ans;
}

double dis(D a, D b) { return sqrt((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second)); }

int n, cnt;
int main() {
	cin >> n;
	rep(i, n) {
		string s;
		cin >> s;
		if (s == "E869120") ++cnt;
	}
	cout << cnt << endl;
}


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

int main () {
  int k, a, b;
  cin >> k >> a >> b;
  string ans = "NG";
  for (int i = a; i <= b; i++) {
    if (i%k==0) {
      ans = "OK";
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3564
//mangesh2102000

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long int 
#define ld long double
#define pb push_back
#define tr(c,it) for(auto it = (c).begin(); it != (c).end(); ++it)
#define F first
#define S second
#define mod 1000000007

int n;
int a[305];
ld dp[305][305][305];

ld solve1(int c1,int c2,int c3)
{
    if(c1 < 0 or c2 < 0 or c3 < 0)
        return 0;

    if(dp[c1][c2][c3]!=-1)
        return dp[c1][c2][c3];

    if(c1==0 and c2==0 and c3==0)
        return dp[c1][c2][c3] = 0;

    ld m1,m2,m3;

    m1 = (ld)c1/n;
    m2 = (ld)c2/n;
    m3 = (ld)c3/n;

    ld tmp = 1 + (m1*solve1(c1-1,c2,c3) + m2*solve1(c1+1,c2-1,c3) + m3*solve1(c1,c2+1,c3-1) );

    tmp /= (m1+m2+m3);
 
    return dp[c1][c2][c3] = tmp;
}

void solve(int t)
{
    cin >> n;
    int c1=0,c2=0,c3=0;
    for(int i=1;i<=n;i++)
    {
        cin >> a[i];
        if(a[i]==1)
            c1++;
        else if(a[i]==2)
            c2++;
        else
            c3++;
    }

    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            for(int k=0;k<=n;k++)
            {
                dp[i][j][k] = -1;
            }
        }
    }

    ld ans = solve1(c1,c2,c3);    
    cout << fixed << setprecision(15) << ans;
    //cout << "Case #" << t << ": ";
}   


int32_t main()
{
    IOS;
    int t;
    t=1;
    for(int i=1;i<=t;i++)
    {
        solve(i);
    }

    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> dp(100000 + 1, INT_MAX);
    vector<int> nine(1, 9);
    vector<int> six(1, 6);
    while (nine.back() < 100000)
    {
        nine.push_back(nine.back() * 9);
    }
    while (six.back() < 100000)
    {
        six.push_back(six.back() * 6);
    }

    for (int i = 0; i < 100000; i++)
    {
        if (i < 6)
        {
            dp[i] = i;
        }
        for (int j = 0; j < nine.size(); j++)
        {
            if (i + nine[j] < 100001)
            {
                dp[i + nine[j]] = min(dp[i + nine[j]], dp[i] + 1);
            }
        }
        for (int j = 0; j < six.size(); j++)
        {
            if (i + six[j] < 100001)
            {
                dp[i + six[j]] = min(dp[i + six[j]], dp[i] + 1);
            }
        }
    }
    cout << dp[N] << endl;
}


Measured memory_bytes: 640
#include <cstdio>

int main(){
  int a,b,c,ans = 0;

  scanf("%d%d%d",&a,&b,&c);
  for(int i = a ; i <= b ; i++){
    if(c % i == 0) ++ans;
  }
  printf("%d\n",ans);

  return 0;
}

Measured memory_bytes: 1024
n=int(input())
red=[tuple(map(int,input().split())) for _ in range(n)]
blue=[tuple(map(int,input().split())) for _ in range(n)]

from operator import itemgetter

red=sorted(red,key=itemgetter(1))
blue=sorted(blue,key=itemgetter(0))
red=red[::-1]
#print(red)
#print(blue)
seen=[0]*n
ans=0
for i in range(n):#blue
    for j in range(n):#red
        if seen[j]==0 and red[j][0]<blue[i][0] and red[j][1]<blue[i][1]:
            seen[j]=1
            ans+=1
            break

print(ans)


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

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

    int ans = 0;
    char c;
    while (isdigit(c = getchar())) {
        ans = (ans + c - '0') % 9;
    }
    std::cout << (ans ? "No" : "Yes");
}

Measured memory_bytes: 3652
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>>adj;
vector<bool>vis;
void dfs(int v)
{
 vis[v]=true;
 for(auto it : adj[v])
 {
  if(!vis[it])
   dfs(it);
 }
}
int main()
{
 int n,m;
 int ans=0;
 cin>>n>>m;
 adj.resize(n+1);
 vis.resize(n+1,false);
 set<int>s;
 for(int i=0;i<m;i++)
 {
  int a,b;
  cin>>a>>b;
  adj[a].push_back(b);
  adj[b].push_back(a);
 }
  for(int i=1;i<=n;i++)
  {
   if(!vis[i])
   {
    dfs(i);
    ans++;
   }
  }
cout<<ans-1;
}

Measured memory_bytes: 9332
#include <bits/stdc++.h>
using namespace std;
// For ordered_set
int main(){
    long long k,n;cin>>k>>n;
    vector<long long> v(n);
    for(auto &i : v) cin>>i;
    long long mx=k-v[n-1]+v[0];
    for(int i=1;i<n;i++){
        mx=max(mx,v[i]-v[i-1]);
    }
    cout<<k-mx<<"\n";
   return 0;
}

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

void isprime(int x){
  int t = sqrt(x) + 1;
  bool prime = true;
  for(int i = 2; i <= min(t, x - 1); i++){
    if(x % i == 0) prime = false;
  }
  if(prime == true);
}

void solve(){
  int x, y; cin >> x >> y;
  if(x < y) swap(x, y);
  while(x % y != 0){
    int t = x;
    x = y;
    y = t % y;
  }
  cout << y << endl;
  return;
}
int main(){
  solve();
  return 0;
}



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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> C(N - 1);
  vector<int> S(N - 1);
  vector<int> F(N - 1);
  for (int i = 0; i < N - 1; ++i) {
    cin >> C[i] >> S[i] >> F[i];
  }

  for (int i = 0; i < N; ++i) {
    if (i == N - 1) {
      cout << 0 << endl;
    } else {
      int sum = 0;
      for (int j = i; j < N - 1; ++j) {
	if (j == i) {
	  sum += C[j] + S[j];
	} else {
	  if (sum < S[j]) {
	    sum += (S[j] - sum) + C[j];
	  } else {
	    int dep = (sum % F[j] == 0? 0: F[j] - sum % F[j]);
	    sum += dep + C[j];
	  }
	}
      }
      cout << sum << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int a, b, k;
	scanf("%d %d %d", &a, &b, &k);
	for (int i = 0; i < k; i++) {
		if (i & 1) {
			if (b & 1)
				b--;
			a += (b / 2);
			b /= 2;
		}
		else {
			if (a & 1)
				a--;
			b += (a / 2);
			a /= 2;
		}
	}
	printf("%d %d\n", a, b);
	return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
n = int(input())
w = list(map(int, input().split()))
total = 0
cum = []
for wi in w:
    total += wi
    cum.append(total)
avrg = total / 2
abs_diff_cum = [abs(float(i) - avrg) for i in cum]

print(int(min(abs_diff_cum)*2))


Measured memory_bytes: 3060
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#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 REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
VI d[SIZE];
int main(){
    int h,w,n; R(h,w,n);
    REP(i,n){
        int x,y; R(x,y);
        d[y].PB(x);
    }
    FOR(i,1,w){
        sort(ALL(d[i]));
        d[i].PB(h+1);
    }
    int an=h;
    PII now{1,1};
    while(now.S<=w&&now.F<=h){
        int it=lower_bound(ALL(d[now.S]),now.F+1)-d[now.S].begin();
        an=min(an,d[now.S][it]-1);
        if(d[now.S][it]==now.F+1)break;
        now.F++;
        if(d[now.S][it]==now.F+1)break;
        if(!binary_search(ALL(d[now.S+1]),now.F))now.S++;
    }
    W(an);
    return 0;
}


Measured memory_bytes: 30080
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
 
  // 変数aで入力を受け取る
  cin >> a;
 
  if (a == 1) {
    cout << "1" << endl;
  }

  if (a == 2) {
    cout << "1" << endl;
  }

  if (a == 3) {
    cout << "1" << endl;
  }

  if (a == 4) {
    cout << "2" << endl;
  }

  if (a == 5) {
    cout << "1" << endl;
  }

  if (a == 6) {
    cout << "2" << endl;
  }

  if (a == 7) {
    cout << "1" << endl;
  }

  if (a == 8) {
    cout << "5" << endl;
  }

  if (a == 9) {
    cout << "2" << endl;
  }

  if (a == 10) {
    cout << "2" << endl;
  }

  if (a == 11) {
    cout << "1" << endl;
  }

  if (a == 12) {
    cout << "5" << endl;
  }

  if (a == 13) {
    cout << "1" << endl;
  }

  if (a == 14) {
    cout << "2" << endl;
  }

  if (a == 15) {
    cout << "1" << endl;
  }

  if (a == 16) {
    cout << "14" << endl;
  }

  if (a == 17) {
    cout << "1" << endl;
  }

  if (a == 18) {
    cout << "5" << endl;
  }

  if (a == 19) {
    cout << "1" << endl;
  }

  if (a == 20) {
    cout << "5" << endl;
  }

  if (a == 21) {
    cout << "2" << endl;
  }

  if (a == 22) {
    cout << "2" << endl;
  }

  if (a == 23) {
    cout << "1" << endl;
  }

  if (a == 24) {
    cout << "15" << endl;
  }

  if (a == 25) {
    cout << "2" << endl;
  }

  if (a == 26) {
    cout << "2" << endl;
  }

  if (a == 27) {
    cout << "5" << endl;
  }

  if (a == 28) {
    cout << "4" << endl;
  }

  if (a == 29) {
    cout << "1" << endl;
  }

  if (a == 30) {
    cout << "4" << endl;
  }

  if (a == 31) {
    cout << "1" << endl;
  }

  if (a == 32) {
    cout << "51" << endl;
  }
}

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

vector<pair<int, int>> conv(map<int, int> &mp) {
    vector<pair<int, int>> res;
    for (auto pr: mp) {
        res.push_back({pr.second, pr.first});
    }
    sort(res.begin(), res.end());
    return res;
}

int getSecondCnt(vector<pair<int, int>> &a) {
    int n = a.size();
    if (n == 1) {
        return 0;
    }
    return a[n-2].first;
}

int getFirstCnt(vector<pair<int, int>> &a) {
    return a.back().first;
}

int main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    map<int, int> mp0, mp1;
    for (int i = 0; i < n; i++) {
        int v;
        cin >> v;
        if (i%2 == 0) {
            mp0[v]++;
        } else {
            mp1[v]++;
        }
    }
    auto v0 = conv(mp0), v1 = conv(mp1);
    int ans = 0;
    if (v0.back().second == v1.back().second) {
        ans = min(n - getFirstCnt(v0) - getSecondCnt(v1), n - getSecondCnt(v0) - getFirstCnt(v1));
    } else {
        ans = n - getFirstCnt(v0) - getFirstCnt(v1);
    }
    cout << ans << endl;
}



Measured memory_bytes: 6140
N, T = gets.split.map(&:to_i)
ct = N.times.map { gets.split.map(&:to_i) }
ans = -1
(0..N - 1).each do |y|
  2.times do
    if ct[y][1] <= T
      if ans == -1
        ans = ct[y][0]
      elsif ans > ct[y][0]
        ans = ct[y][0]
      end
    end
  end
end
if ans == -1
  puts 'TLE'
else
  puts ans
end

Measured memory_bytes: 1788
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  ll N,a=0,b=0,c=0,d=0,e=0;
  cin>>N;
  
  for(int i=0;i<N;i++){
    string S;
    cin>>S;
    if(S[0]=='M') a++;
    if(S[0]=='A') b++;
    if(S[0]=='R') c++;
    if(S[0]=='C') d++;
    if(S[0]=='H') e++;
  }
  cout<<a*b*c+a*b*d+a*b*e+a*c*d+a*c*e+a*d*e+b*c*d+b*c*e+b*d*e+c*d*e;
return 0;}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int N, A, B;
  cin >> N >> A >> B;
  int Arank = 0, Brank = 0;
  string S;
  cin >> S;
  for(int i = 0; i < N; i++){
    switch(S[i]){
      case 'a':
        if(Arank + Brank < A + B){
          Arank++;
          cout << "Yes" << endl;
        }else cout << "No" << endl;
        break;
      case 'b':
        if(Arank + Brank < A + B && Brank < B){
          Brank++;
          cout << "Yes" << endl;
        }else cout << "No" << endl;
        break;
      default:
        cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 896
#include<cstdio>
#include<cstring> 
char s[1000001];
int b[28];
int main()
{
	gets(s);
	for(int i=0;i<strlen(s);i++)
	{
		if(b[s[i]-'a'+1]==0)
		{
			b[s[i]-'a'+1]=1;
		} 
	}
	for(int i=1;i<=26;i++)
	{
		if(b[i]==0)
		{
			printf("%c\n",i-1+'a');
			return 0;
		}
	}
	printf("None\n");
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
import sys

stdin = sys.stdin
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

    
def main():
    n = ni()
    ans = 0
    for x in range(1,n+1):
        nx = n//x
        ans += (nx+1)*nx*x//2
    print(ans)
    return


if __name__ == '__main__':
    main()

Measured memory_bytes: 62896
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define COMMAND_SIZE 12

typedef struct node{
	int key;
	struct node* prev;
	struct node* next;
}node_t;

node_t* head;

void insert(int key){
	node_t* new_node=(node_t*)malloc(sizeof(node_t));
	node_t* tmp;
	
	new_node->key=key;
	
	tmp=head->next;
	head->next=new_node;
	new_node->prev=head;
	
	new_node->next=tmp;
	tmp->prev=new_node;
	
}

void del(int key){
	node_t* n;
	node_t* tmp;
	
	for(n=head->next;n!=head;n=n->next){
		if(n->key==key){
			break;
		}
		else if(n->next==head){
			return;
		}
	}
	
	tmp=n->prev;
	tmp->next=n->next;
	n->next->prev=tmp;
	
	free(n);
	
	return;
}

void del_first(){
	node_t* tmp=head->next;
	head->next=tmp->next;
	tmp->next->prev=head;
	
	free(tmp);
}

void del_last(){
	node_t* tail=head->prev;
	
	tail->prev->next=head;
	head->prev=tail->prev;
	
	free(tail);
	return;
}

int main(void){
	int n;
	scanf("%d",&n);
	
	char command[COMMAND_SIZE];
	int num;
	
	node_t dummy;
	head=&dummy;
	head->prev=head;
	head->next=head;
	insert(-1);
	
		for(int i=0;i<n;i++){
		if(scanf("%s",command)==EOF){
			break;
		}
		
		if(strcmp(command,"deleteFirst")!=0 && strcmp(command,"deleteLast")!=0){
			scanf("%d",&num);
		}
		
		if(strcmp(command,"insert")==0){
			insert(num);
		}
		else if(strcmp(command,"delete")==0){
			del(num);
		}
		else if(strcmp(command,"deleteFirst")==0){
			del_first();
		}
		else if(strcmp(command,"deleteLast")==0){
			del_last();
		}else{
			printf("error:コマンド不一致\n");
			return -1;
		}
			
			
	}
	
	for(node_t* i=head->next;i->next!=head;i=i->next){
		printf("%d",i->key);
		
		if(i->next->next!=head){
			printf(" ");
		}else{
			printf("\n");
			break;
		}
	}
	
	return 0;
}



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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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

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

vector<int> N, A, B, C, D;
int t;
map<int, int> m;

int dfs(int n) {
  if (n == 0) {
    return 0;
  }
  if (n == 1) {
    return D[t];
  }
  if (m.find(n) != m.end()) {
    return m[n];
  }
  int ret = INF_LL;
  chmin(ret, (dfs(n / 5) + (n % 5) * D[t] + C[t]));
  chmin(ret, (dfs(n / 3) + (n % 3) * D[t] + B[t]));
  chmin(ret, (dfs(n / 2) + (n % 2) * D[t] + A[t]));
  chmin(ret, (dfs((n + 4) / 5) + (5 - n % 5) * D[t] + C[t]));
  chmin(ret, (dfs((n + 2) / 3) + (3 - n % 3) * D[t] + B[t]));
  chmin(ret, (dfs((n + 1) / 2) + (2 - n % 2) * D[t] + A[t]));
  if(1.0*n*D[t] < INF_LL) chmin(ret, n*D[t]);
  m[n] = ret;
  return ret;
}

signed main() {
  int T;
  cin >> T;
  rep(i, T) {
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    N.pb(n);
    A.pb(a);
    B.pb(b);
    C.pb(c);
    D.pb(d);
  }

  rep(i, T) {
    t = i;
    int ans = dfs(N[i]);
    cout << ans << endl;
    m.clear();
  }
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back
#define eb emplace_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using vpint = vector<pint>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    ll n = in();
    vector<pll> v(n);
    rep(i, n)
    {
        ll x = in(), l = in();
        v[i] = make_pair(x - l, x + l);
    }
    sort(ALL(v), [](auto lhs, auto rhs) {
        return lhs.second == rhs.second ? lhs.first < rhs.first : lhs.second < rhs.second;
    });

    ll cnt = 0;
    ll prev_right = -LINF;
    rep(i, n)
    {
        if (prev_right <= v[i].first)
        {
            ++cnt;
            prev_right = v[i].second;
        }
    }
    cout << cnt << endl;
}

signed main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1792
//#include <bits/stdc++.h>
#include <utility>
#include <math.h>
#include <string.h>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.txt", "r", stdin);
	#endif
	ios_base::sync_with_stdio(0), cin.tie(0);

	string s;
	cin >> s;
	int ans = 100000;
	for (int i = 0; i+3 <= s.length(); ++i)
	{
		int y = atoi(s.substr(i, 3).data());
		ans = min(ans, abs(y-753));
	}
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if((a==b&&a!=c)||(a==c&&a!=b)||(b==c&&a!=b))
	printf("Yes\n");
	else
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
import sys

n = int(sys.stdin.readline().strip())
for i in range(n):
    line = sys.stdin.readline()
    lengths = sorted(list(map(int, line.strip().split())))
    if lengths[0]**2 + lengths[1]**2 == lengths[2]**2:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 7604
// Template
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
#include <complex>
#define rep(i, x) for (int i = 0; i < (x); ++i)
#define rng(i, x, y) for (int i = (x); i < (y); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}
void solve();
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    solve();
    return 0;
}

// Main Code
int n;
vector<ll> x, y, p, ans, a;
vector<vector<ll>> tate, yoko;

void rec(int k) {
    if (k == n) {
        int b = 0, c = 0, cnt = 0;
        rep(i, n) {
            if (a[i] == 1) b += (1 << i);
            if (a[i] == 2) c += (1 << i);
            if (a[i]) ++cnt;
        }
        ll res = 0;
        rep(i, n) res += min(tate[b][i], yoko[c][i]);
        chmin(ans[cnt], res);
    } else {
        rep(i, 3) {
            a[k] = i;
            rec(k + 1);
        }
    }
}

void solve() {
    cin >> n;
    x = y = p = a = vector<ll>(n, -1);
    ans = vector<ll>(n + 1, INF);
    rep(i, n) cin >> x[i] >> y[i] >> p[i];
    
    tate = yoko = vector<vector<ll>>(1 << n, vector<ll>(n, INF));
    rep(bit, 1 << n) {
        vector<ll> T, Y;
        T.push_back(0);
        Y.push_back(0);
        rep(i, n) {
            if ((bit >> i) & 1) {
                T.push_back(x[i]);
                Y.push_back(y[i]);
            }
        }
        rep(i, n) {
            for (ll ta: T) chmin(tate[bit][i], p[i] * abs(x[i] - ta));
            for (ll yo: Y) chmin(yoko[bit][i], p[i] * abs(y[i] - yo));
        }
    }
    
    rec(0);
    rep(i, n + 1) cout << ans[i] << "\n";
    return;
}


Measured memory_bytes: 12916
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    string s;
    cin >> s;
    int mx = 0, cnt = 0;
    char cur = s[0];
    if (cur == 'R') cnt++;
    chmax (mx, cnt);
    repSE(i,1,s.size()) {
        if (s[i] == 'S') { cnt = 0; }
        else if (s[i] == 'R' && cur == 'R'){  cnt++; }
        else { cnt = 1; }
        chmax (mx, cnt);
        cur = s[i];
    }
    cout << mx << "\n";
    return 0;
}


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

#define wait() system("pause")

map<int, int> mp;

int main () {
	int n; cin>>n;
	for(int i=1; i<=n; i++) {
		int x; cin>>x;
		if(mp[x] == 0) mp[x] = 1;
		else mp[x] = 0;
	}
	int ret = 0;
	for(auto b : mp) ret += b.second;
	cout<<ret<<endl;
	//wait();
	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pb push_back
#define f first
#define s second
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define fo(i,a,b) for(long long i=a;i<b;i++)
#define all(c) (c).begin(),(c).end()
#define ll long long
const int M=1e9+7;
#define endl "\n"





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

   string st;
   cin>>st;

   ll len=st.size();

   vl v1,v2,v3;

   fo(i,0,len)
   {
   	if(st[i]=='R')
   		v1.pb(i);
   	else if(st[i]=='G')
   		v2.pb(i);
   	else
   		v3.pb(i);
   }


   ll l1=v1.size();
   ll l2=v2.size();
   ll l3=v3.size();


   ll ans=l1*l2*l3;
  // d1(ans);

   fo(i,0,l1)
   {
   	fo(j,0,l2)
   	{
   	   if((v1[i]+v2[j])%2)
   	   	continue;
   	   ll val=(v1[i]+v2[j])/2;
       auto it = lower_bound(all(v3),val);
       if(it!=v3.end())
       {
       	 if(*it==val)
       	 ans--;
       }
   	}
   }

   fo(i,0,l1)
   {
   	fo(j,0,l3)
   	{
   		if((v1[i]+v3[j])%2)
   	   	continue;
   	   ll val=(v1[i]+v3[j])/2;
       auto it = lower_bound(all(v2),val);
       if(it!=v2.end())
       {
       	 if(*it==val)
       	 ans--;
       }
   	}
   }

   fo(i,0,l2)
   {
   	fo(j,0,l3)
   	{
   		if((v2[i]+v3[j])%2)
   	   	continue;
   	   ll val=(v2[i]+v3[j])/2;
       auto it = lower_bound(all(v1),val);
       if(it!=v1.end())
       {
       	 if(*it==val)
       	 ans--;
       }
      
   	}
   }

   
   pfln(ans);
   
    return(0);
}

Measured memory_bytes: 3788
#include<cstdio>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
double EPS=1e-10;

double add(double a,double b){
    if(abs(a+b)<EPS*(abs(a)+abs(b))) return 0;
    return a+b;
}

//二次元ベクトル構造体
struct P{
    double x,y;
    P(){}
    P(double x, double y) : x(x),y(y){
    }
    P operator + (P p){
        return P(add(x,p.x),add(y,p.y));
    }
    P operator - (P p){
        return P(add(x,-p.x),add(y,-p.y));
    }
    P operator * (double d){
        return P(x*d,y*d);
    }
    double dot(P p){    //内積
        return add(x*p.x,y*p.y);
    }
    double det(P p){    //外積
        return add(x*p.y,-y*p.x);
    }
};

//辞書順で比較
bool cmp_x(const P& p,const P& q){
    if(p.x!=q.x) return p.x<q.x;
    return p.y < q.y;
}

vector<P> convex_hull(P* ps,int n){
    sort(ps,ps+n,cmp_x);
    int k=0;                //凸包の頂点数
    vector<P> qs(2*n);   //構築中の凸包
    //下側凸包の作成
    for(int i=0;i<n;i++){
        while(k>1 && (qs[k-1]-qs[k-2]).det(ps[i] - qs[k-1]) <= 0) k--;
        qs[k++] = ps[i];
    }
    //上側凸包の作成
    for(int i=n-2, t=k ;i>=0;i--){
        while(k>t && (qs[k-1]-qs[k-2]).det(ps[i] - qs[k-1]) <= 0) k--;
        qs[k++] = ps[i];
    }
    qs.resize(k-1);
    return qs;
}

double dist(P p, P q){
    return (p-q).dot(p-q);
}

int main(){
    double R=100000000000000.0,ans[100]={},pi,co,deg;
    vector<P> q;
    P p[100],pp[100];
    pi=atan(1)*4;
    int n,m,f;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%lf %lf",&p[i].x,&p[i].y);
        pp[i]=p[i];
    }
    q=convex_hull(pp,n);
    m=q.size();
    for(int i=0;i<n;i++){
        f=-1;
        for(int j=0;j<m;j++){
            if(p[i].x==q[j].x&&p[i].y==q[j].y){
                f=j+m;
            }
        }
        if(f!=-1){
            co=(q[(f-1)%m]-q[f%m]).dot(q[(f)%m]-q[(f+1)%m])/sqrt(dist(q[(f-1)%m],q[f%m])*dist(q[f%m],q[(f+1)%m]));
            ans[i]=acos(co)/(2*pi);
        }
        else{
            ans[i]=0.00000000000;
        }
        printf("%.7f\n",ans[i]);
    }
}

Measured memory_bytes: 512