akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main()
{
    ll a,b,k;
    cin >> a >> b >> k;
    for(ll i = 0;i < k;i++)
    {
        if(i % 2 == 0)
        {
            if(a % 2 == 1)
            {
                a--;
            }
            a /= 2;
            b += a;
        }
        else
        {
            if(b % 2 == 1)
            {
                b--;
            }
            b /= 2;
            a += b;
        }
    }
    cout << a << " " << b << "\n";
    
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<par<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    string s;
    cin>>s;
    int k=s.length();
    int c=0;
    rep(i,k)if(s[i]=='o')c++;
    YES(c+15-k>=8);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  ll N,i,ans,sum=0,x;cin>>N;ll A[N];
  REP(i,N){cin>>A[i];sum+=A[i];}
  x=A[0];ans=abs(2*x-sum);
  FOR(i,1,N-1){x+=A[i];ans=min(ans,abs(2*x-sum));}
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1792
import sys

stdin = sys.stdin

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

r = ni()
if r < 1200:
    print("ABC")
elif 1200 <= r < 2800:
    print("ARC")
else:
    print('AGC')


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve(long long N, long long T, std::vector<long long> t){
    ll ans = 0;
    for(ll i = 1; i < N; ++i){
        ans = ans + min(T, t[i] - t[i-1]);
        
    }
    cout << ans + T << endl;
}

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


Measured memory_bytes: 1792
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def root(x):
        if x == par[x]:
            return x
        par[x] = root(par[x])
        return par[x]
    def unite(x,y):
        x = root(x)
        y = root(y)
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1

    n,m = LI()
    N = n+m
    par = [i for i in range(N)]
    rank = [0]*N
    for i in range(n):
        l = LI()
        for j in l[1:]:
            unite(j-1,i+m)
    r = set([root(i) for i in range(m,N)])
    if len(r) == 1:
        print("YES")
    else:
        print("NO")
    return


#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 64900
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

template <typename T>
using vec = vector<T>;

template <typename T>
using vec2 = vector<vector<T>>;

template <typename T>
using vec3 = vector<vector<vector<T>>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

    int n;
    cin >> n;
    vec<int> a(n);
    map<int, int> m;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        m[a[i]]++;
    }
    sort(a.begin(), a.end());

    int ans = 0;

    vec<bool> check(a.back() + 1, false);
    for (int i = 0; i < n; i++) {
        if (!check[a[i]]) {
            check[a[i]] = true;

            if (m[a[i]] == 1) {
                ans++;
            }

            for (Int j = 2;; j++) {
                Int mul = j * a[i];
                if (mul <= a.back()) {
                    check[mul] = true;
                } else {
                    break;
                }
            }
        }

        for (Int j = 1;; j++) {
            Int mul = j * a[i];
            if (mul <= a.back()) {
                check[mul] = true;
            } else {
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    ll r = 0;
    ll l = 1e10;
    while(l - r > 1){
        ll mid = (r + l) / 2; //midは最大の長さ
        ll sum = 0; //sumは必要分割数
        for(int i = 0; i < n; i++){
            sum += (a[i] - 1) / mid;
        }
        if(sum <= k) l = mid;
        else r = mid;
    }
    cout << l << endl;
}

Measured memory_bytes: 4820
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;

const ll MOD = 1e9+7;


signed main(){
    ll x1,x2,y1,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    rep(i,0,y2-y1) cout << "U";
    rep(i,0,x2-x1) cout << "R";
    rep(i,0,y2-y1) cout << "D";
    rep(i,0,x2-x1) cout << "L";

    cout << "L";
    rep(i,0,y2-y1+1) cout << "U";
    rep(i,0,x2-x1+1) cout << "R";
    cout << "DR";
    rep(i,0,y2-y1+1) cout << "D";
    rep(i,0,x2-x1+1) cout << "L";
    cout << "U" << endl;

    return 0;
}


Measured memory_bytes: 3592
#include <cstdio>

char buf[10];

int main(){
    int n;
    scanf("%d\n",&n);
    int count=0;
    for(int i=0;i<n&&count>=0;i++){
        scanf("%s",buf);
        if (buf[0]=='A') count++;
        else count--;
    }

    if (count==0) puts("YES");
    else puts("NO");


    return 0;
}


Measured memory_bytes: 2676
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<cmath>
#include<memory.h>
#include<cctype>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<list>
#include<stack>
#include<utility>
#include<iomanip>
#include<bitset>
#include<vector>
#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<cstring>
using namespace std;
typedef long long int ll;
typedef long double ld;
int dx[]={0,0,1,-1,1,1,-1,-1};
int dy[]={1,-1,0,0,1,-1,-1,1};
int main(){
	//freopen("a.txt","r",stdin);
	int x,t;
	scanf("%d%d",&x,&t);
	printf("%d\n",max(0,x-t));
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")

#pragma GCC optimize("O3")
//#pragma GCC target("avx,avx2,fma")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include <unordered_map>
#include <map>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007// prime modulo value 
#define C 1000000001
#define M 998244353
#define all(x) x.begin(),x.end()
using namespace std;
// From Geeksforgeeks
inline ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
// Power function took from geeksforgeeks
ll power(ll x, ll y)
{
	ll res = 1;

	x = x;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
double dist(ll x1, ll y1, ll x2, ll y2)
{
	double ans = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n, m;
	cin >> n >> m;
	unordered_map<ll, vector<ll>> mp;
	f(i, 0, n)
	{
		ll a, b;
		cin >> a >> b;
		mp[a].push_back(b);
	}
	ll ans = 0;
	priority_queue<ll> pq;
	f(i, 1, m + 1)
	{
		if (mp.find(i) != mp.end())
		{
			f(j, 0, mp[i].size())
				pq.push(mp[i][j]);
		}
		if (pq.empty() == false)
		{
			ans += pq.top();
			pq.pop();
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 8868
def insertion_sort(array):
    print_array(array)
    for i in range(1,len(array)):
        key = array[i]
        j = i - 1
        while j >= 0 and array[j] > key:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = key
        print_array(array)

def print_array(array):
     print(str(array)[1:-1].replace(', ', ' '))


def main():
    N = int(input())
    array = [int(s) for s in input().split(' ')]
    insertion_sort(array)

if __name__ == '__main__':
    main()

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

using namespace std;

//Author: Ezio Sam

int main()

{

	    int n, a, b, c=0;

    

    cin>>n;

    

    cin>>a>>b;

    

    for(int i=a;i<=b;i++) {

    	if(i%n==0) {

    		c=1 ; break;

    	}

    }

    if(c) cout<<"OK"<<endl ;

    else cout<<"NG"<<endl ;

    

}

Measured memory_bytes: 3632
N = int(input())
import collections
A = list(map(int,input().split()))
C = collections.Counter(A)
use = [0,0]
for i,val in C.items():
  if val >= 4:
    use.append(i)
  if val >= 2:
    use.append(i)

use.sort(reverse=True)
 
print(use[0] * use[1])


Measured memory_bytes: 18600
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
using R = double;
using Data = pair < ll, vector <ll>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 60;
struct edge { ll from; ll to; ll cost; };
typedef tuple<ll, ll, ll>T;
typedef pair<ll, ll>pll;
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2


int n;
int h[252521];
int a[252521];


const ll N = 1 << 18;
ll seg[2 * N];
void st(ll p, ll v) {
	p += N - 1;
	seg[p] = v;
	while (p>0) {
		p = (p - 1) / 2;
		seg[p] = max(seg[2 * p + 1], seg[2 * p + 2]);
	}
}
ll query(ll l, ll r, ll a, ll b, ll k) {
	if (r <= a || b <= l)return 0;
	if (l <= a && b <= r)return seg[k];
	int m = (a + b) / 2;
	return max(query(l, r, a, m, 2 * k + 1), query(l, r, m, b, 2 * k + 2));
}
ll get(int l, int r) {
	return query(l, r, 0, N, 0);
}

int main(){
	cin >> n;
	rep(i, 0, n)cin >> h[i];
	rep(i, 0, n)cin >> a[i];
	rep(i,0,n) {
		ll v = get(0,h[i]);
		st(h[i], v + a[i]);
	}
	cout << seg[0] << endl;
	
	return 0;
}

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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

#ifdef DEBUG
#define dump(...) dump_(#__VA_ARGS__, __VA_ARGS__);
#else
#define dump(...)
#endif

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// input
void input() {}
template <class Head, class... Tail>
void input(Head&& head, Tail&&... tail) {
  cin >> head;
  input(forward<Tail>(tail)...);
}

// ouls
void outs() {}
template <class Head, class... Tail>
void outs(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  outs(forward<Tail>(tail)...);
}

template <class T>
void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void outs(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// outl
void outl() {}
template <class Head, class... Tail>
void outl(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  outl(forward<Tail>(tail)...);
}

template <class T>
void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// outn
void outn() {}
template <class Head, class... Tail>
void outn(Head&& head, Tail&&... tail) {
  cout << head;
  outn(forward<Tail>(tail)...);
}

template <class T>
void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

// dump
template <class T>
void dump_(const char *s, T&& x) {
  clog << '{';
  while(*s != '\0') clog << *(s++);
  clog << ": " << x << '}' << "\n";
}

template <class Head, class... Tail>
void dump_(const char *s, Head&& head, Tail&&... tail) {
  clog << '{';
  while(*s != ',') clog << *(s++);
  clog << ": " << head << "}, ";
  for (++s; !isgraph(*s); ++s);
  dump_(s, forward<Tail>(tail)...);
}
// }}} End

bool solve(i64 n) {
  for (i64 i = 1; i * i <= n; ++i) {
    if (i * i == n) return true;
  }
  return false;
}

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  var(string, a, b);
  a += b;
  i64 num = stoi(a);
  outl((solve(num)) ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
n = int(input())
task = []

for i in range(n):
    task.append([int(j) for j in input().split()])

task.sort(key = lambda x:x[1])

ans = "Yes"
cur = 0
remaining = 0
for i in task:
    remaining += i[1] - cur - i[0]
    if remaining < 0:
        ans = "No"
        break
    cur = i[1]

print(ans)

Measured memory_bytes: 42460
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

class UnionFindPathCompression():
    def __init__(self, n):
        self.parents = list(range(n))
        self.rank = [1]*n
        self.group_size = [1]*n

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

    def union(self, x, y):
        #親を探す p = parentの意味
        px = self.find(x)
        py = self.find(y)

        if px == py:
            return
        else:
            if self.rank[px] < self.rank[py]:
                self.parents[px] = py
                self.group_size[py] += self.group_size[px]
            else:
                self.parents[py] = px
                self.group_size[px] += self.group_size[py]
                #ランクの更新
                if self.rank[px] == self.rank[py]:
                    self.rank[px] += 1
                
n,m,k = map(int,input().split())
ufpc = UnionFindPathCompression(n)
friends = [[] for i in range(n)]
ans = [-1]*n
for i in range(m):
    a, b = (int(x) for x in input().split())
    a, b = a-1, b-1
    friends[a].append(b)
    friends[b].append(a)
    ufpc.union(a,b)

for i in range(k):
    c, d = (int(x) for x in input().split())
    c, d = c-1, d-1
    if ufpc.find(c) == ufpc.find(d):
        ans[c] -= 1
        ans[d] -= 1

for i in range(n):
    ans[i] += ufpc.group_size[ufpc.find(i)]
    ans[i] -= len(friends[i])

print(*ans)

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define ll long long
#define ld long double
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)

#define xx first
#define yy second
#define mp make_pair
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define pdd pair<double,double>
#define ALL(v) (v).begin(), (v).end()

const ll MOD=1e9+7;
const ll inf=1e10;

#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;
#define put(x) cout<<#x<<" = "<<x<<endl;

ll power(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a);
        n>>=1;
        a=(a*a);
    }
    return ans;
}


ll powerMod(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%MOD;
        n/=2;
        a=(a*a)%MOD;
    }
    return ans;
}

ll powerMod1(ll a,ll n,ll mod){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%mod;
        n>>=1;
        a=(a*a)%mod;
    }
    return ans;
}

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

ll sumdigit(ll n){
    ll sum=0;
    while(n){
        sum+=n%10;
        n=n/10;
    }
    return sum;
}

ll countSetBit(ll a){
    return __builtin_popcount(a);
}
ll countBit(ll a){
    ll sum=0;
    while(a){
        sum++;
        a>>=1;
    }
    return sum;
}

ll length(ll a){
    ll ans=0;
    while(a){
        ans++;
        a=a/10;
    }
    return ans;
}

bool isVowel(char c){
	if(c=='a' or c=='e' or c=='i' or c=='o' or c=='u')
		return true;
	return false;
}

const int sz=1e5+10;


int main()
{
    fast;
    
    ll t;
    //~ cin>>t;
    t=1;
    while(t--){
        ll n;
        cin>>n;
        
		ll a[n][3];
		ll dp[n][3];
		for(int i=0;i<n;i++){
			cin>>a[i][0]>>a[i][1]>>a[i][2];
		}
		
		dp[0][0]=a[0][0];
		dp[0][1]=a[0][1];
		dp[0][2]=a[0][2];
		
		for(int i=1;i<n;i++){
			for(int j=0;j<3;j++){
				dp[i][j]=max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+a[i][j];
			}
		}
		cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});

	}
    return 0;
}


Measured memory_bytes: 4992
List = [0] * 101
while True :
    p, s = map(int, input().split(","))
    if p == 0 and s == 0 :
        break
    
    List[p] = s

Sorted_List = sorted(list(set(List)), reverse = True)

while True :
    try :
        q = int(input())
    except EOFError :
        break
    
    print(Sorted_List.index(List[q])+1)
    


Measured memory_bytes: 5600
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<endl
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    ll n; cin>>n;
    if(n%2 == 1){cout<<0<<endl; return 0;}

    vll divisor;
    for(ll now = 5; now<= n; now *= 5)divisor.push_back(now);
    ll ans = 0;
    for(auto x : divisor){
        ans += (n/x)/2;
    }
    cout<<ans<<endl; return 0;
}


Measured memory_bytes: 256
import sys
import math
import collections
import bisect
import copy
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    a = [ni() for _ in range(n)]
    ans = 0

    prev = -1
    for i, ai in enumerate(reversed(a)):
        if ai > n - i - 1:
            print(-1)
            exit(0)

        if i == 0:
            ans += ai
        else:
            if ai != prev - 1:
                if ai > prev - 1:
                    ans += ai
                else:
                    print(-1)
                    exit(0)
        prev = ai
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 17444
(defun solve (n as)
  (declare (ignore n))
  (let ((sorted-as (sort (copy-seq as) #'>)))
    (loop for a in as
          if (= a (first sorted-as))
          collect (second sorted-as)
          else
          collect (first sorted-as))))

#-swank
(let* ((n (read))
       (a (loop repeat n collect (read))))
  (format t "~{~A~%~}" (solve n a)))


Measured memory_bytes: 63332
n,m=map(int,input().split())
xy=[list(map(lambda x:int(x)-1,input().split())) for _ in [0]*m]

cnt=[1 for _ in [0]*n]
red=[False for _ in [0]*n]
red[0]=1

for x,y in xy:
    cnt[x]-=1
    cnt[y]+=1
    if red[x]==True:
        red[y]=True
    if cnt[x]==0:
        red[x]=False
print(red.count(True))

Measured memory_bytes: 30436
import heapq
N,K=map(int,input().split())
TD=[list(map(int,input().split())) for _ in range(N)]
TD.sort(key=lambda x:x[1], reverse=True)

NETA=set()
duplication=[]
heapq.heapify(duplication)
ans=0
for t,d in TD[:K]:
    if t in NETA:
        heapq.heappush(duplication,d)
    else:
        NETA.add(t)
    ans+=d

s=[-float("inf")]*(K+1)
cnt=len(NETA)
s[cnt]=ans
for t,d in TD[K:]:
    if t in NETA:
        continue
    else:
        if duplication:
            x=heapq.heappop(duplication)
            ans+=d-x
            NETA.add(t)
            cnt+=1
            s[cnt]=ans

for i in range(K+1):
    s[i]+=i*i
print(max(s))

Measured memory_bytes: 33540
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

ll dp[109][10];

void add(ll &x,ll y){
    x=(x+y)%MOD;
}

bool is(int bit,int i){
    return (bit&(1<<i));
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int H,W,K;
    cin>>H>>W>>K;
    
    dp[0][0]=1;
    rep(i,H)rep(j,W){
        rep(bit,pow(2,W-1)){
            bool f=false;
            rep(k,W-2)if(is(bit,k)&&is(bit,k+1)) f=true;
            if(f) continue;
            
            if(j>0&&is(bit,j-1)){
                add(dp[i+1][j-1],dp[i][j]);
            }else if(j<W-1&&is(bit,j)){
                add(dp[i+1][j+1],dp[i][j]);
            }else{
                add(dp[i+1][j],dp[i][j]);
            }
        }
    }
    cout1(dp[H][K-1])
}

Measured memory_bytes: 512
#include<iostream>


using namespace std;

int main() {


	int n;

	cin >> n;

	int a[100];

	for (int i = 0; i < n; i++) {


		cin >> a[i];
	}

	for (int i = 0; i < n; i++) {

		if (a[i] % 2 == 0) {

			if (a[i] % 3 != 0 && a[i] % 5 != 0) {
				cout << "DENIED" << endl;
				break;
			}

			
		}

		if (i == n - 1)cout << "APPROVED" << endl;
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define fst first
#define snd second
using ll = long long;
using I = pair<int, int>;

int main() {
  int N;
  while (cin >> N) {
    int ans = 0;
    for (int i = 0; i < N; i++) {
      ll a;
      cin >> a;
      while (a % 2 == 0) {
        ++ans;
        a /= 2;
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

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

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

    int n;
    cin >> n;

    vector<int> p(4), t(4);
    rep(i, 4){
        cin >> p[i];
    }
    rep(i, 4){
        cin >> t[i];
    }

    int dp[5][101];
    fill(dp[0], dp[5], IINF);
    dp[0][0] = 0;

    rep(i, 4){
        rep(j, n + 1){
            chmin(dp[i + 1][j], dp[i][j]);
            chmin(dp[i][min(j + t[i], n)], dp[i][j] + p[i]);
        }
    }

    cout << dp[4][n] << endl;

    return 0;
}


Measured memory_bytes: 3204
#include<bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
using namespace std;
const ll INF = 1e10;
int n,ans;
vector<int> a(100003),d(100003);
int main(){
  cin>>n;
  a[0]=0;a[n+1]=0;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    int b=abs(a[i]-a[i-1]);
    d[i-1]=b;
    ans+=b;
  }
  d[n]=abs(0-a[n]);
  ans+=abs(0-a[n]);
  
  for(int i=1;i<=n;i++){
    cout<<ans-d[i-1]-d[i]+abs(a[i+1]-a[i-1])<<endl;
  }
  return 0;
}



Measured memory_bytes: 2048
#include<iostream>
#include<stack>
using namespace std;
int main(){
  stack<int> chu;
  int i=0;
  int input;
  int hairetu[111];
  cin>>input;
  chu.push(input);
  while(cin>>input){
    if(input!=0){
      chu.push(input);
    }else{
      hairetu[i]=chu.top();
      chu.pop();
      i++;
    }
  }
  for(int j=0;j<=i-1;j++){
    cout<<hairetu[j]<<endl;
  }
  
}

Measured memory_bytes: 1200
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
s,t = [i.rstrip() for i in readline().split()]
a,b = [int(i) for i in readline().split()]
u = readline().rstrip()

if u == s:
    print(a-1, b)
else:
    print(a, b-1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pf push_front
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
const int MAX = 1e5+5;
int N, W, w[102], b[102];
ll pd[102][MAX];

ll solve() {
	REP(i, 1, N)
		REP(j, 1, W) {
			if(w[i] <= j)
				pd[i][j] = max(pd[i-1][j], pd[i-1][j-w[i]]+b[i]);
			else
				pd[i][j] = pd[i-1][j];
		}
	return pd[N][W];
}

int main(int argc, char ** argv) {
	scanf("%d%d", &N, &W);
	REP(i, 1, N) 
		scanf("%d%d", &w[i], &b[i]);
	printf("%lld\n", solve());
	return 0;
}


Measured memory_bytes: 78336
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;


int main()
{
   char s[1];
   cin>>s;
   if(s[0]<'a')cout<<"A"<<endl;
   else cout<<"a"<<endl;
   return 0;
}


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


int main() {
    int x,n;
    cin>>x>>n;
    vector<int> p(n);
    rep(i,n){
        int a;
        cin>>a;
        p.at(i)=a;

    }
    
 
    
    rep(i,100){
        int pura=1;//0にならなければそれが正解
        int mai=1;

        rep(k,n){
            if(p.at(k)==x+i){
                pura=0;
            }
            if(p.at(k)==x-i){
                mai=0;
            }
        }

        if(mai==1){
            cout<<x-i<<endl;
            break;
        }else if(pura==1){
            cout<<x+i<<endl;
            break;
    	}
    }
    
    

}


Measured memory_bytes: 3632
import sys

def inv(k):
    det = 1 / (k[0]*k[3] - k[1]*k[2])
    ret = [k[3] * det, -k[1] * det, -k[2] * det, k[0] * det]
    return ret

def dot(i, j):
    x = i[0] * j[0] + i[1] * j[1]
    y = i[2] * j[0] + i[3] * j[1]
    return [x,y]

def run():
    data = []
    for _data in sys.stdin:
        data.append(list(map(int, _data.split())))

    for _data in data:
        i = _data[:2] + _data[3:5]
        j = [_data[2],_data[5]]
        x, y = dot(inv(i), j)
        x, y = round(x, 3), round(y, 3)
        print('{0:.3f} {1:.3f}'.format(x,y))

if __name__ == '__main__':
    run()




Measured memory_bytes: 5636
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include<deque>
#include<stack>
#include <iterator>
using namespace std;




int main()
{
    
    long long n;
    cin >> n;
    if (n == 0) {
        cout << 0 << endl;
        return 0;
    }
    else {
        cout << ((n / 500) * 1000) + ((n % 500) / 5) * 5 << endl;;
    }


}


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

int main()
{
	int c = 0, cm = 0;
	char C;
	for (int i = 0; i < 3; ++i)
	{
		cin >> C;
		if (C == 'R')
			c++;
		else
		{
			cm = (c > cm) ? c : cm;
			c = 0;
		}
	}
	cm = (c > cm) ? c : cm;
	cout << cm << endl;
}


Measured memory_bytes: 3668
package main

import "fmt"

func main(){
  var s string
  
  fmt.Scanf("%s", &s)
  
  if s[2:3]==s[3:4] {
    if s[4:5]==s[5:6] {
    fmt.Println("Yes")
    } else {
      fmt.Println("No")
    }
  } else {
    fmt.Println("No")
  }
}

Measured memory_bytes: 512
s[9],c[9];main(n,m,i){for(;scanf("%d%d",&m,&n)*m;puts("")){int q[1024]={i=0},t=1,p=m;for(;n--;){*c=!scanf("%s",s);++i%3||strcat(c,"Fizz");i%5||strcat(c,"Buzz");*c||sprintf(c,"%d",i);for(strcmp(s,c)&&p>1&&(q[t]=p--);q[t=t%m+1];);}for(t=i=0;m--;q[++i]||(t=printf(" %d"+!t,i)));}}

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

#define debug(x) cerr<<#x<<'='<<x<<endl
#define set0(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();ll f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}

char str[305];
int dp[305][305][305];
void upd(int &a,int b){
	a =max(a,b);
}
int main() {
	cin>>(str+1);
	int n = strlen(str+1);
	int lim;
	cin>>lim;
	int ans = 0;
	for(int i=1;i<=n;i++){
		for(int j=n;j>=1;j--){
			for(int k=0;k<=lim;k++){
				upd(dp[i+1][j][k],dp[i][j][k]);
				upd(dp[i][j-1][k],dp[i][j][k]);
				if(str[i] == str[j]){
					upd(dp[i+1][j-1][k],dp[i][j][k]+1);
				}else{
					upd(dp[i+1][j-1][k+1],dp[i][j][k]+1);
				}
			}
		}
	}
	for(int i=0;i<=n+1;i++){
		for(int j=n+1;j>=0;j--){
			for(int k=0;k<=lim;k++){
				if(i == j+1)ans = max(ans,dp[i][j][k]*2);
				if(i-1 == j+1)ans = max(ans,dp[i][j][k]*2-1);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 110464
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int q = in.nextInt();

		// 子をキーにして親を記録 → 木なので根以外は必ず単一の親を持つ
		HashMap<Integer, Integer> map = new HashMap<>();
		for ( int i = 1; i < n; i++ ) {
			int a = in.nextInt();
			int b = in.nextInt();
			map.put(b, a);
		}

		long[] cnt = new long[n + 1];
		for ( int i = 1; i <= q; i++ ) {
			int p = in.nextInt();
			int x = in.nextInt();
			cnt[p] += x;
		}

		System.out.println( cnt[1] );
		for ( int i = 2; i <= n; i++ ) {
			// 子に親から降りてきたカウントを加算して表示
			cnt[i] += cnt[map.get(i)];
			System.out.println( cnt[i] );
		}
		in.close();
	}
}


Measured memory_bytes: 189724
from math import gcd
from collections import defaultdict

mxn = 10**6+1
spf = [i for i in range(mxn)]

for i in range(4,mxn,2):
  spf[i] = 2
i = 3
while i*i <= mxn:
  if spf[i] == i:
    for j in range(i*i,mxn,i):
      if spf[j] == j:
        spf[j] = i
  i += 1
ph = defaultdict(lambda:False)
pc = True
def getFactors(n):
  global pc
  while n != 1:
    temp = spf[n]
    if ph[temp] == True:
      pc = False
      break
    ph[temp] = True
    while n%temp == 0:
      n //= temp

n = int(input())
a = list(map(int,input().split()))
i,g = n-2,a[n-1]
while i >= 0:
  g = gcd(g,a[i])
  i -= 1
if g != 1:
  print("not coprime")
else:
  for i in a:
    if not pc:
      break
    getFactors(i)
  if not pc:
    print("setwise coprime")
  else:
    print("pairwise coprime")

Measured memory_bytes: 143264
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<stdbool.h>
#include<tgmath.h>
#include<sys/queue.h>
#include<time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define miin(a, b, c) min((a), min((b), (c)))
#define maax(a, b, c) max((a), max((b), (c)))
#define mod 1000000007
#define MAX 510000
const int MOD = 998244353;

int n, m, k;

long long fac[MAX], finv[MAX], inv[MAX], hoge[222222] = {}, huga = 0;

void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i=2; i<MAX; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

main(){
    COMinit();
    scanf("%d%d%d", &n, &m, &k);
    hoge[1] = m;
    for(int i=2; i<=n; i++){
        hoge[i] = (m-1)*hoge[i-1] % MOD;
    }
    for(int i=0; i<=k; i++){
        huga += hoge[n-i] * COM(n-1, i);
        huga %= MOD;
    }
    printf("%lld\n", huga);
}

Measured memory_bytes: 15228
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long x = scan.nextLong() * 2;
		long y = scan.nextLong();
		scan.close();
		long ans = 0;
		if (y > x) ans = x / 2 + (y - x) / 4;
		else ans = Math.min(x / 2, y / 2);
		System.out.println(ans);
		return;
	}
}

Measured memory_bytes: 21844
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		int A = Integer.parseInt(sc.get());
		int B = Integer.parseInt(sc.get());
		int C = Integer.parseInt(sc.get());
		int K = Integer.parseInt(sc.get());
		System.out.println(Math.min(A, K) - Math.max(K - (A + B), 0));
	}
}

class Main {
	public static void main(String... args) {
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		var reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
		System.out.flush();
	}
}

Measured memory_bytes: 32604
#include"bits/stdc++.h"
using namespace std;
int main(){
	string a;
	cin>>a;
	int flag=0;
	for(int i=0;i<a.length();i++){
//		cout<<i<<" "<<a[i]<<endl;
		if(i%2==0&&a[i]!='R'&&a[i]!='U'&&a[i]!='D'){
			cout<<"No"<<endl;
			flag=1;
			break;
		}
		if(i%2==1&&a[i]!='L'&&a[i]!='U'&&a[i]!='D'){
			cout<<"No"<<endl;
			flag=1;
			break;
		}
	}
	if(flag==0)cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 7;
    /*
    {
       Md: Saroar Zahan Sojib
       Green University of Bangladesh
       https://web.facebook.com/sojib.bdb
    }
   */
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin>>n;
    vector<int> vec;
    for (int i=0; i<=25; i++)
        for (int j=0; j<=14; j++)
            vec.push_back(4*i+7*j);
    vector<int>::iterator ik = find(vec.begin(), vec.end(), n);
    if (ik != vec.end())
	    cout <<"Yes"<<endl;
    else
	    cout << "No"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int main()
{
	string s;
	while(cin>>s)
	{
		int sum = 0;
		for(int i=0;i<s.size();++i)
		{
			if(s[i] == '1')
				sum++;
		}
		printf("%d\n",sum);
	}
}

Measured memory_bytes: 256
int isPrime(int x){
  int i;
  if(x<2) return 0;
  else if(x==2) return 1;
  if (x%2==0) return 0;
  for(i=3;i*i<=x;i+=2)
    {
      if(x%i==0) return 0;
    }
    return 1;
}

int main(void)
{
 int  z,n,i;
 int x[10000];
 
 scanf("%d",&n);
 z=0;
 for(i=0;i<n;i++)
 {
  scanf("%d", &x[i]);
  if(isPrime(x[i]))
  {
   z++;
  }
 }
 printf("%d\n",z);
 return 0;
}


Measured memory_bytes: 2092
import sys
#import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
#import heapq
#import math
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))


n = ri()
a = rl()
a=a+a
a.sort()

a.pop()
ans=0
for i in range(n-1):
    ans+=a[-i-1]
print(ans)

Measured memory_bytes: 31064
#include <iostream>
#include <string>
using namespace std;
int main() {
  int A[3][3];
  int flag[3][3];
  int N;
  int b;
  int hantei=0;
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> A[j][i];
      flag[j][i]=0;
    }
  }
  cin >> N;
  for(int k=0;k<N;k++){
    cin >> b;
  	for(int i=0;i<3;i++){
    	for(int j=0;j<3;j++){
      		
      		if(b==A[j][i]){
      			flag[j][i]=1;
              //	cout << "success"<<endl;
      		}
    	}
  	}
  }
  for(int j=0;j<3;j++){
      	if(flag[j][0]==1&&flag[j][1]==1&&flag[j][2]==1)hantei=1;
  }
   for(int i=0;i<3;i++){
      	if(flag[0][i]==1&&flag[1][i]==1&&flag[2][i]==1)hantei=1;
  }
  if(flag[0][0]==1&&flag[1][1]==1&&flag[2][2]==1){
    hantei=1;
    //cout << "success"<<endl;
  } 
  if(flag[0][2]==1&&flag[1][1]==1&&flag[2][0]==1)hantei=1;
  if(hantei==0)cout << "No"<<endl;
  else cout << "Yes" <<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <set>
 
using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back
 
typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    string a[112];
    for (int i = 0; i < h;i++){
        cin >> a[i];
    }

    for (int i = 0; i < w + 2;i++){
        cout << "#";
    }
    cout << endl;
    for (int i = 0; i < h;i++){
        cout << "#" << a[i] << "#" << endl;
    }
    for (int i = 0; i < w + 2;i++){
        cout << "#";
    }
    return 0;
}

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

int main(){
  int N,K,x=1;
  cin >> N >> K;
  
  for(int i=0 ; i < N; i++){
	if(x+K < x*2){
      x += K;
    }else{
      x *= 2;
    }
  }
  
  cout << x << endl;
}

Measured memory_bytes: 256
/* Be strong, be fearless, be beautiful :D
And believe that anything is possible :))
when you have the right people there
to support you :) */
//RTn_E
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define __Sync ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
#define __file freopen("input.txt", "r", stdin) ; freopen("output.txt", "w", stdout) ;
#define ll long long
#define ld long double
#define pb push_back
#define F first
#define S second
#define mk make_pair
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using mordered_set =  tree<T, null_type, greater<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll mod = 1e9 + 7;
const int maxn = 1e4 + 100;
const ll inf = 1e12;

//Main CODE :/\

int w[110] , v[110] , dp[110][maxn];
int main() {
    __Sync;
    int n , W;
    cin >> n >> W;
    for (int i = 1; i <= n; i++)
        cin >> v[i] >> w[i];
    dp[1][w[1]] = v[1];
    //cout << "i : " << 1 << " j : " << w[1] << " dp : " << dp[1][w[1]] << "\n";
    for (int i = 2; i <= n; i++){
        for (int j = 1; j <= W; j++){
            if (j < w[i]){
                dp[i][j] = dp[i - 1][j];
                //cout << "i : " << i << " j : " << j << " dp : " << dp[i][j] << "\n";
                continue;
            }
            dp[i][j] = max(dp[i - 1][j - w[i]] + v[i] , dp[i - 1][j]);
            //cout << "i : " << i << " j : " << j << " dp : " << dp[i][j] << "\n";
        }
    }
    int ans = -1;
    for (int i = W; i >= 1; i--)
        ans = max(ans , dp[n][i]);
    cout << ans << "\n";
    return 0;
}
//The_End
//Game Over :D



Measured memory_bytes: 7112
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional> // std::function<void(int)>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
template<int mod>
struct ModInt {
    int x;
 
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
 
    ModInt &operator+=(const ModInt &p) {
        if((x += p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p) {
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p) {
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }
 
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
 
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
 
    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return ModInt(u);
    }
 
    ModInt pow(int e){
        long long a = 1, p = x;
        while(e > 0) {
            if(e%2 == 0) {p = (p*p) % mod; e /= 2;}
            else {a = (a*p) % mod; e--;}
        }
        return ModInt(a);
    }
 
    friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a) {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};
 
using modint = ModInt<mod>;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin>>n>>s;
    unordered_map<char,int> D;
    for(auto c:s){
        D[c]++;
    }
    modint res=1;
    for(auto it:D){
        res*=it.second+1;
    }
    cout<<res-1<<endl;
}

Measured memory_bytes: 512
/*
 	安部NANA先輩大好き

 */
#include<bits/stdc++.h>

#define int long long int
#define rep(a,b,c) for(int a=b;a<c;a++)
#define repm(a,b,c) for(int a=(b-1);a>=c;a--)
#define pb push_back
#define str string
#define sf(a) scanfs("%d",&a)
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()

using namespace std;

const int INF = 1e9 + 9;
const int Mod = 1e9 + 7;
inline int replac(str s){double ans=0;rep(i,0,s.length()){ans+=(s[i]-'0')*pow(10,s.length()-i-1);}return (int)ans;}
typedef vector<int> vi;
typedef pair<int,int> pii;
vector<pii> vii;
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    int a=1,b=1;
    cin >> n ;
    rep(i,0,n){
        int x,y;
        cin >> x >> y;
        int q = max((x+a-1)/x,(y+b-1)/y);
        //cout << q << " ";
        a = q*x;
        b = q*y;
        //cout << a << " " << b << endl;
    }
    cout << a+b << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

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

int main() {
  ll a,b;
  cin >> a >> b;
  ll k=gcd(a,b);
  ll c=sqrt(k)+1;
  ll cnt=1;
  FOR(i,2,c){
    if(k%i==0){
      cnt++;
      while(k%i==0){
        k/=i;
      }
    }
  }
  if(k!=1){
    cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n; cin >> n;
    int INF = 100000;
    vector<int> dp(n+1, INF);
    dp[0] = 0;
    for(int i = 1; i < n+1; i++){
        dp[i] = 1 + dp[i-1];
        int power = 6;
        while(power <= i){
            dp[i] = min(dp[i], dp[i-power]+1);
            power *= 6;
        }
        power = 9;
        while(power <= i){
            dp[i] = min(dp[i], dp[i-power]+1);
            power *= 9;
        }
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 640