akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define cerr cout
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
typedef long long ll; typedef pair <int, int> ii; typedef vector <int> vi; const int inf = 1e9 + 7;
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

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

	int n; cin >> n;
	int s = n*(n+1)/2;
	vector<ii> a, e;
	if (n % 2 == 0) {
		FOR (i, 1, n/2) {
			a.emplace_back(i, n+1-i);
		}
		
		FOR (i, 0, sz(a) - 1) {
			int j = (i + 1) % sz(a);
			e.emplace_back(a[i].F, a[j].F);
			e.emplace_back(a[i].F, a[j].S);
			e.emplace_back(a[i].S, a[j].F);
			e.emplace_back(a[i].S, a[j].S);
		}
	} else {
		FOR (i, 1, n/2) {
			a.emplace_back(i, n - i);
		}
		FOR (i, 0, sz(a) - 2) {
			int j = i + 1;
			e.emplace_back(a[i].F, a[j].F);
			e.emplace_back(a[i].F, a[j].S);
			e.emplace_back(a[i].S, a[j].F);
			e.emplace_back(a[i].S, a[j].S);
		}
		e.emplace_back(a.back().F, n);
		e.emplace_back(a.back().S, n);
		e.emplace_back(a[0].F, n);
		e.emplace_back(a[0].S, n);
	}
	for (auto &it: e) if (it.S < it.F) swap(it.S, it.F);
	sort(all(e)); e.erase(unique(all(e)), e.end());
	cout <<sz(e)<<"\n";
	for (auto it: e) {
		cout << it.F << " "<<it.S <<"\n";
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n,m;
    cin>>n>>m;
    ll s=0;
    for(int i=0;i<m;i++)
    {
        ll a;
        cin>>a;
        s+=a;
    }
    if(s>=n)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
n = int(raw_input())
i = 0
while (i < n):
    x1,y1,x2,y2,x3,y3=map(float,raw_input().split())
    m1,m2=(x1+x2) / 2, (y1+y2) / 2
    n1,n2=(x1+x3) / 2, (y1+y3) / 2

    if y1==y2:
        a = 1
        b = 0
        c = m1
    elif x1==x2:
        a = 0
        b = 1
        c = m2
    else:
        a = (x2-x1) / (y2-y1)
        b = 1
        c = m2+a*m1

    if y1==y3:
        d = 1
        e = 0
        f = n1
    elif x1==x3:
        d = 0
        e = 1
        f = n2
    else:
        d = (x3-x1) / (y3-y1)
        e = 1
        f = n2+d*n1

    if a*d-b*c==0:
        print "not exist answer"
    else:
        x = (float((c*e-b*f)) / (a*e-b*d))+0
        y = (float((a*f-c*d)) / (a*e-b*d))+0
        print ('%.3f' % round(x,3)), ('%.3f' % round(y,3)), ('%.3f' % round(((((x - x1)**2+(y-y1)**2)**0.5)),3))
    i += 1

Measured memory_bytes: 4792
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
using namespace std;

int main(){
    long long N;
    cin >> N;
    vector<long long> A(N);
    long long sign = 0;
    long long sum = 0;
    long long min = 1000000000;
    for(int i = 0 ; i < N ; i++){
        cin >> A[i];
        if(A[i] < 0){
            sign++;
        }
        sum += abs(A[i]);
        if(min > abs(A[i])){
            min = abs(A[i]);
        }
    }
    // long long min = *std::min_element(A.begin(), A.end());

    // cout << sum << endl;


    long long ans = 0;
    if(sign % 2 == 0){
        cout << sum << endl;
    }
    else if(sign % 2 == 1){
        cout << sum - 2 * abs(min) << endl;
    }

    return 0;
} 

Measured memory_bytes: 1024
def examA():
    H, W = LI()
    A = [SI() for _ in range(H)]
    cur = 0
    for i in range(H):
        for j in range(W):
            if A[i][j]=="#":
                cur +=1
    if cur==H+W-1:
        ans = "Possible"
    else:
        ans = "Impossible"
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()


Measured memory_bytes: 3544
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
using namespace std;

signed main(){
    int a,b,c,d,e,f,g; cin>>a>>b>>c>>d>>e>>f>>g;
    if (a == 1 && d == 1 && e == 1)cout << 3 + b << endl;
    else if (a < 2 && d < 2 && e < 2)cout << b << endl;
    else if ((a % 2 == 1 && d % 2 == 1 && e % 2 == 1) || (a % 2 == 0 && d % 2 == 0 && e % 2 == 0))cout << a + b + d + e << endl;
    else cout << a + b + d + e - 1 << endl;
    getchar(); getchar(); return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a,b;
  cin>>a>>b;
  if(a<10&&b<10){
    cout<<a*b<<endl;
    return 0;
  }
  cout<<-1<<endl;
  return 0;
  
      
                        
                        
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
const int N=3000;
double p[N],dp[N][N];
int main()
{
	int n;scanf("%d",&n);
	for (register int i=1;i<=n;++i) scanf("%lf",&p[i]);
	dp[0][0]=1;
	for (register int i=1;i<=n;++i)
	  for (register int j=0;j<=i;++j)
	  {
	  	  dp[i][j]=dp[i-1][j]*(1-p[i]);
	  	  if (j) dp[i][j]+=dp[i-1][j-1]*p[i];
	  }
	double ans=0;
	for (register int i=n/2+1;i<=n;++i) ans+=dp[n][i];
	printf("%0.11lf\n",ans);
	return 0;
}

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

int main(){
    int n, k;
    cin >> n >> k;
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        int h; cin >> h;
        sum += (h >= k) ? 1 : 0;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt();
        long b = sc.nextInt();
        System.out.println(lcm(a, b));
    }

    private static long lcm(long a, long b) {
        return a * b / gcb(a, b);
    }

    private static long gcb(long a, long b) {
        if (a < b) return gcb(b, a);
        if (b == 0) return a;
        return gcb(b, a%b);
    }
}

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

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


ll ymdToNum(int y,int m,int d){
    ll ret=0;
    ret+=(int)((y-1)/3) * (20*10*3-10);
    ret+=((y-1)%3)*(20*10-5);
    
    if(y%3==0)
        ret+=(m-1)*20;
    else
        ret+=(m-1)*20-(int)((m-1)/2);
    
    ret+=d-1;
    
    return ret;
}


int main(){
    int n;
    cin>>n;
    rep(i,n){
        int y,m,d;
        cin>>y>>m>>d;
        ll a = ymdToNum(y,m,d);
        cout<<ymdToNum(1000,1,1)-a<<endl;
    }
}

Measured memory_bytes: 1156
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC079_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine();
            var A = int.Parse(input[0].ToString());
            var B = int.Parse(input[1].ToString());
            var C = int.Parse(input[2].ToString());
            var D = int.Parse(input[3].ToString());

            string formulaStr;
            int check7;

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    for (int k = 0; k < 2; k++)
                    {
                        check7 = 0;
                        if (i == 1)
                        {
                            check7 = A + B;
                            formulaStr = A + "+" + B;
                        }
                        else
                        {
                            check7 = A - B;
                            formulaStr = A + "-" + B;
                        }

                        if (j == 1)
                        {
                            check7 += C;
                            formulaStr += "+" + C;
                        }
                        else
                        {
                            check7 -= C;
                            formulaStr += "-" + C;
                        }

                        if (k == 1)
                        {
                            check7 += D;
                            formulaStr += "+" + D;
                        }
                        else
                        {
                            check7 -= D;
                            formulaStr += "-" + D;
                        }

                        if (check7 == 7)
                        {
                            Console.WriteLine(formulaStr + "=7");
                            return;
                        }
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 11092
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
abcde = [a, b, c, d, e]
mini = (10, 0)
for i, x in enumerate(abcde):
  if x % 10 != 0 and mini[0] > x % 10:
    mini = (x % 10, i)
ans = 0
for i, x in enumerate(abcde):
  if mini[1] == i:
    ans += x
  else:
    if x % 10 == 0:
      ans += x
    else:
      ans += (x // 10 + 1) * 10
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <stack>
#include <cmath>
#include <algorithm>
using namespace std;

class node{
public:
  int p = -1;
  vector<int> s;
};

void func(vector<int>& d, int id, int num, vector<node>& t){
  d[id] = num;
  for(int i = 0; i < t[id].s.size(); i++){
    func(d, t[id].s[i], num + 1, t);
  }
  return;
}

void solve(){
  int n; cin >> n;
  vector<node> t(n);
  for(int i = 0; i < n; i++){
    int id, k; cin >> id >> k;
    for(int j = 0; j < k; j++){
      int x; cin >> x;
      t[id].s.push_back(x);
      t[x].p = id;
    }
  }
  vector<int> d(n);
  for(int i = 0; i < n; i++){
    if(t[i].p == -1){
      func(d, i, 0, t);
      break;
    }
  }
  for(int i = 0; i < n; i++){
    cout << "node " << i << ": parent = " << t[i].p << ", depth = " << d[i];
    if(t[i].p == -1) cout << ", root, [";
    else if(t[i].s.size() == 0) cout << ", leaf, [";
    else cout << ", internal node, [";
    if(t[i].s.size() > 0){
      for(int j = 0; j < t[i].s.size() - 1; j++){
        cout << t[i].s[j] << ", ";
      }
      cout << t[i].s[t[i].s.size() - 1];
    }
    cout << "]\n";
  }
  return;
}

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



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

int main(){
long long int n;
  cin >> n;
  cout << (long long int)(sqrt(n))*(long long int)(sqrt(n)) << endl;
  

	return 0;
}


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

using namespace std;
#define ll long long

ll n, b[105];
int main()
{
    cin >> n;
    n--;
    for(int i = 0;i < n;i++) cin >> b[i];
    ll res = b[0] + b[n - 1];
    for(int i = 1;i < n;i++)
        res += min(b[i], b[i - 1]);
    cout << res;
    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

n, m = inpl()
A = [input() for i in range(n)]
B = [input() for i in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        A1 = [a[j:j+m] for a in A[i:i+m]]
        if A1 == B:
            print('Yes')
            exit()
print('No')

Measured memory_bytes: 4080
#include<iostream>
#include<algorithm>
#include<cstdio>
#define abs(x) ((x)>0 ?(x) :-(x))
int n, m, sum=0;
int d, k, b = 1;
int l[100005];
int main() {
	scanf("%d %d", &n, &m);
	l[0] = 0;
	for (int i = 1;i < n;i++) {
		scanf("%d", &k);
		l[i] = k + l[i-1];
	}
	for (int i = 1;i <= m;i++) {
		scanf("%d", &d);
		sum += abs(l[b + d -1] - l[b -1]);
		sum %= 100000;
		b +=d;
	}
	printf("%d\n", sum);
	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  if ((A % 3 == 1 && B % 3 == 1) || (A % 3 == 2 && B % 3 == 2)) {
    cout << "Impossible" << endl;
  }
  else {
    cout << "Possible" << endl;
  }
}

Measured memory_bytes: 256
n, m = map(int, input().split())
mod = 10**9+7
facs = [1] * (max(n,m)+1)
nfac = 1
for i in range(1, max(n,m)+1):
    nfac = nfac * i % mod
    facs[i] = nfac
if abs(n - m) <= 1:
    print((2 if n==m else 1) * (facs[n] * facs[m]) % mod)
else:
    print(0)

Measured memory_bytes: 12644
#include<stdio.h>
#include<stdlib.h>
int main(){
  int i,count[26]={0};
  char now;

//  printf("%c\n",now);

  while( scanf("%c",&now)!=EOF){
//    printf("flag %c\n",now);
    if(now=='a'|| now=='A')count[0]++;
    else if(now=='b'|| now=='B')count[1]++;
    else if(now=='c'|| now=='C')count[2]++;
    else if(now=='d'|| now=='D')count[3]++;
    else if(now=='e'|| now=='E')count[4]++;
    else if(now=='f'|| now=='F')count[5]++;
    else if(now=='g'|| now=='G')count[6]++;
    else if(now=='h'||now=='H')count[7]++;
    else if(now=='i'||now=='I')count[8]++;
    else if(now=='j'||now=='J')count[9]++;
    else if(now=='k'||now=='K')count[10]++;
    else if(now=='l'||now=='L')count[11]++;
    else if(now=='m'||now=='M')count[12]++;
    else if(now=='n'||now=='N')count[13]++;
    else if(now=='o'||now=='O')count[14]++;
    else if(now=='p'||now=='P')count[15]++;
    else if(now=='q'||now=='Q')count[16]++;
    else if(now=='r'||now=='R')count[17]++;
    else if(now=='s'||now=='S')count[18]++;
    else if(now=='t'||now=='T')count[19]++;
    else if(now=='u'||now=='U')count[20]++;
    else if(now=='v'||now=='V')count[21]++;
    else if(now=='w'||now=='W')count[22]++;
    else if(now=='x'||now=='X')count[23]++;
    else if(now=='y'||now=='Y')count[24]++;
    else if(now=='z'||now=='Z')count[25]++;
//    printf("flag2 %c\n",now);
//    printf("flag3 %c\n",now);
  }

  printf("a : %d\n",count[0]);
  printf("b : %d\n",count[1]);
  printf("c : %d\n",count[2]);
  printf("d : %d\n",count[3]);
  printf("e : %d\n",count[4]);
  printf("f : %d\n",count[5]);
  printf("g : %d\n",count[6]);
  printf("h : %d\n",count[7]);
  printf("i : %d\n",count[8]);
  printf("j : %d\n",count[9]);
  printf("k : %d\n",count[10]);
  printf("l : %d\n",count[11]);
  printf("m : %d\n",count[12]);
  printf("n : %d\n",count[13]);
  printf("o : %d\n",count[14]);
  printf("p : %d\n",count[15]);
  printf("q : %d\n",count[16]);
  printf("r : %d\n",count[17]);
  printf("s : %d\n",count[18]);
  printf("t : %d\n",count[19]);
  printf("u : %d\n",count[20]);
  printf("v : %d\n",count[21]);
  printf("w : %d\n",count[22]);
  printf("x : %d\n",count[23]);
  printf("y : %d\n",count[24]);
  printf("z : %d\n",count[25]);


  return 0;
}

Measured memory_bytes: 1780
#include <iostream>
using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main()
{
	ll W, a, b; cin >> W >> a >> b;
	if (b - (a + W) > 0) {
		cout << b - (a + W) << endl;
	}
	else if (a - (b + W) > 0) {
		cout << a - (b + W) << endl;
	}
	else {
		cout << 0 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vb vector<bool>
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
using namespace std;
using namespace __gnu_pbds; 
ll mi(ll n,ll m){ll pw=n%m;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans%mod;}
ll pw(ll a,ll n){ll pw=a;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw;pw = pw*pw;ex>>=1;}return ans;}
ll pwm(ll a,ll n){ll pw=a%mod;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw%mod;pw = pw*pw%mod;ex>>=1;}return ans%mod;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
template<typename T> using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//st.order_of_key(num)->number of elements < num
//st.find_by_order(i)->iterator of ith element in sorted order starting from zero
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mkp make_pair
//#define int long long int
//Binary_Search->dp->greedy
//auto check = [&](ll x){};
void solve(){
	ll n,m;
	cin>>n>>m;
	ll sum=0;
	for(int i=0;i<m;i++){
		ll x;
		cin>>x;
		sum+=x;
	}
	if(sum>n) cout<<"-1";
	else cout<<n-sum<<endl;
	
	
}
int main(){
int t=1;
//scanf("%d",&t);
while(t--){
	solve();
}
return 0;
}    
 

Measured memory_bytes: 3636
from itertools import permutations

N, M = map(int, input().split())
E = [set() for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    E[a-1].add(b-1)
    E[b-1].add(a-1)

ans = 0
for p in permutations([i for i in range(1, N)]):
    i = 0
    for j in p:
        if j not in E[i]:
            break
        i = j
    else:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    char arr[26];
    char st='a';
    arr[0]='z';
    for(int i=1;i<26;i++) {
        arr[i]=(char)(st+i-1);
    }
    ll n;
    cin>>n;
    ll num=n;
    string s="";
    while(num) {
        int a=num%26;
        s+=arr[a];
        num/=26;
        if(a==0)
        num--;
    }
    reverse(s.begin(),s.end());
    cout<<s;
    
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A1(N);
  vector<int> A2(N);
  for (int i = 0; i < N; i++) cin >> A1.at(i);
  for (int i = 0; i < N; i++) cin >> A2.at(i);
  int A2sum = 0;
  for (int i = 0; i < N; i++) A2sum += A2.at(i);
  int temp = A1.at(0) + A2sum;
  int ans = temp;
  for (int i = 0; i < N - 1; i++){
    temp = temp + A1.at(i + 1) - A2.at(i);
    ans = max(ans, temp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3604
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<new>
using namespace std;

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

class Tree {
private:
	Node mother;
	Node* root;
	void In_rec(Node*);
	void Pre_rec(Node*);
	bool Find_rec(Node*, int);
	void In();
	void Pre();
	void Delete_rec(Node*);
public:
	Tree();
	void Insert(Node*);
	void Print();
	void Find(int);
	void Delete(int);
};

Tree::Tree()
	:mother({ -2000000001, &mother, &mother, &mother }),
	root(&this->mother)
{}

void Tree::Insert(Node* z)
{
	Node* y{ &this->mother }, *x{ this->root };
	z->parent = z->left = z->right = &mother;
	while (x != &this->mother)
	{
		y = x;
		if (z->key < x->key)
			x = x->left;
		else
			x = x->right;
	}
	z->parent = y;

	if (y == &this->mother)
	{
		this->mother.right = this->root = z;
	}
	else if (z->key < y->key)
		y->left = z;
	else
		y->right = z;
	return;
}

void Tree::In()
{
	In_rec(this->root);
	printf("\n");
	return;
}

void Tree::In_rec(Node* n)
{
	if (n != &this->mother)
	{
		In_rec(n->left);
		printf(" %d", n->key);
		In_rec(n->right);
	}
	return;
}

void Tree::Pre()
{
	Pre_rec(this->root);
	printf("\n");
	return;
}

void Tree::Pre_rec(Node* n)
{
	if (n != &this->mother)
	{
		printf(" %d", n->key);
		Pre_rec(n->left);
		Pre_rec(n->right);
	}
	return;
}

void Tree::Print()
{
	this->In();
	this->Pre();
}

void Tree::Find(int k)
{
	if (this->Find_rec(this->root, k))
		printf("yes\n");
	else
		printf("no\n");
}

bool Tree::Find_rec(Node* n, int k)
{
	if (n == &this->mother)
		return false;
	else if (n->key == k)
		return true;
	else if (k < n->key)
		return Find_rec(n->left, k);
	else
		return Find_rec(n->right, k);
}

void Tree::Delete(int k)
{
	Node* x = this->root;
	while (x->key != k)
	{
		if (k < x->key)
			x = x->left;
		else
			x = x->right;
	}

	this->Delete_rec(x);
}

void Tree::Delete_rec(Node* n)
{
	if (n->left == &this->mother && n->right == &this->mother)
		if (n->parent->right == n)
			n->parent->right = &this->mother;
		else
			n->parent->left = &this->mother;
	else if (n->left != &this->mother && n->right != &this->mother)
	{
		Node* x{ n->right };
		while (x->left != &this->mother)
			x = x->left;
		n->key = x->key;
		this->Delete_rec(x);
	}
	else
	{
		Node** x{ &n->parent->left }, **y = { &n->left };
		if (n->parent->right == n)
			x = &n->parent->right;
		if (n->right != &this->mother)
			y = &n->right;
		*x = *y;
		(*y)->parent = n->parent;
	}
}

int main()
{
	int n, tmpkey;
	char tmp[16];
	Tree tree;
	scanf("%d", &n);
	Node* node = new Node[n];

	for (int i = 0; i < n; i++)
	{
		scanf("%s", tmp);
		if (tmp[0] == 'i')
		{
			scanf("%d", &node[i].key);
			tree.Insert(node + i);
		}
		else if (tmp[0] == 'p')
			tree.Print();
		else if (tmp[0] == 'f')
		{
			scanf("%d", &tmpkey);
			tree.Find(tmpkey);
		}
		else
		{
			scanf("%d", &tmpkey);
			tree.Delete(tmpkey);
		}
	}

	delete[] node;
	return 0;
}


Measured memory_bytes: 14672
# -*- coding: utf-8 -*-
def main():
    N,M = map(int, input().split())
    H = list(map(int, input().split()))
    ans = []
    for _ in range(N):
        ans.append(1)
    for i in range(M):
        A,B = map(int, input().split())
        if H[A-1] < H[B-1]:
            ans[A-1] = 0
        elif H[A-1] > H[B-1]:
            ans[B-1] = 0
        else:
            ans[B-1] = 0
            ans[A-1] = 0
    print(sum(ans))

if __name__ == '__main__':
    main()

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

using namespace std;

int main(void) {
    int a[5], k;
    for (int i = 0; i < 5; i++) {
        cin >> a[i];
    }
    cin >> k;

    if (a[4] - a[0] > k) {
        cout << ":(" << endl;
        return 0;
    }

    cout << "Yay!" << endl;
}

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

#define pb(a) push_back((a))
#define mp(a, b) make_pair((a), (b))
#define REP(a, b) for (ll i = (a); i < (b); i++)
#define REP2(a, b) for (ll j = (a); j < (b); j++)
#define REPE(a, b, c, d) \
	REP(a, b)            \
	for (ll j = (c); j < (d); j++)
#define REPV(a, b, c) for (ll(a) = b; (a) < (c); (a)++)
#define IREP(a, b) for (ll i = (a); i >= (b); i--)
#define IREP2(a, b) for (ll j = (a); j >= (b); j--)
#define IREPV(a, b, c) for (ll(a) = b; (a) >= (c); (a)--)
#define all(v) (v).begin(), (v).end()
#define Trvs(c) for (auto &it : c)
#define INF INT_MAX
#define sz(x) x.size()
#define flash                         \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);
#define F first
#define S second
#define MOD 1000000007

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;

auto cmp = [](pair<ll, pair<ll, ll>> a, pair<ll, pair<ll, ll>> b) {
	if (a.F == b.F)
		return a.S.F > b.S.F;
	return a.F > b.F;
};
//decltype(cmp)

bool check(vll arr, ll n)
{
	REP(0, n)
	{
		if (arr[i] < n)
		{
			return false;
		}
	}
	return true;
}
void solve()
{
	ll n, k;
	cin >> n >> k;
	vll a(n+1);
	REP(0, n)
	{
		cin >> a[i];
	}
	vll arr(n + 1, 0);
	while (!check(a, n) and k > 0)
	{
		k--;
		REP(0,n+1)arr[i] =0;
		REP(0, n)
		{
			ll temp = a[i];
			ll l = max(ll(0), i - temp);
			ll r = min(n, i + temp + 1);
			arr[l] += 1;
			arr[r] -= 1;
			// cout<<l<<" lr "<<r<<endl;
		}
		REP(1, n + 1)
		arr[i] += arr[i - 1];
		// REP(0,n)cout<<arr[i]<<" ";
		// cout<<endl;
		swap(arr,a);
	}
	
	REP(0, n)
	cout << a[i] << " ";
}

int main()
{
	flash


	// ll t;
	// cin >> t;
	// while (t--)
		solve();
	cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
	return 0;
}

Measured memory_bytes: 7960
N = int(input())

nums = range(1, N+1, 2)

res = 0
for n in nums:
    i = 1
    for x in range(1,n):
        if (n // (x)) * (x) == n:
            i = i + 1
    if i == 8:
        res += 1

print(res)

Measured memory_bytes: 38640
N, Y= map(int, input().split())

Y //= 1000

for x in range(N + 1):
    for y in range(N-x+1):
        z = N - (x + y)
        yen = x * 10 + y * 5 + z
        if Y == yen:
            print(x, y, z)
            exit()

print(-1, -1, -1)

Measured memory_bytes: 9144
#include <bits/stdc++.h>
using namespace std;
#define int long long int
// #include "Template.cpp"
#define endl "\n"

void solve()
{
    int x; cin >> x;
    if(x >= 1800) {
        cout << 1 << endl;
    }
    else if(x >= 1600) cout << 2 << endl;
    else if(x >= 1400) cout << 3 << endl;
    else if(x >= 1200) cout << 4 << endl;
    else if(x >= 1000) cout << 5 << endl;
    else if(x >= 800) cout << 6 << endl;
    else if(x >= 600) cout << 7 << endl;
    else cout << 8 << endl;
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3652
N = int(input())
A = [int(input()) for i in range(N)]

ans = 0
part_sum = 0
for i in range(N):
    if A[i] == 0 or i == N-1:
        part_sum += A[i]
        ans += (part_sum // 2)
        part_sum = 0
    else:
        part_sum += A[i]

print(ans)






Measured memory_bytes: 7072
#include <iostream>
#include <vector>
#define int long long
using namespace std;

int mod = 1000000007;
int powmod(int a, int n, int mod) {
	if (n == 0) return 1;
	if (n % 2 == 0) return powmod((a * a) % mod, n / 2, mod);
	return (a * powmod(a, n - 1, mod)) % mod;
}

int n, m;
int fact[200001];
int factInv[200001];

int comb(int n, int k) {
	return fact[n] * factInv[k] % mod * factInv[n - k] % mod;
}

signed main() {
	int i;
	
	cin >> n >> m;
	
	fact[0] = 1; factInv[0] = 1;
	for (i = 1; i < 200001; i++) {
		fact[i] = (i * fact[i - 1]) % mod;
		factInv[i] = powmod(fact[i], mod - 2, mod);
	}
	
	int t = m;
	int ans = 1;
	for (i = 2; i * i <= t; i++) {
		int cnt = 0;
		while (t % i == 0) {
			t /= i;
			cnt++;
		}
		ans *= comb(n - 1 + cnt, cnt);
		ans %= mod;
	}
	if (t > 1) {
		ans *= comb(n, n - 1);
		ans %= mod;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(int i = (j); i < (n); ++i)

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

	int n; cin >> n;
	vector<ll> a(n);
	rep(i, 0, n) cin >> a[i];
	sort(a.begin(), a.end());

	ll s = 0;
	int t = 0;
	rep(i, 0, n - 1) {
		s += a[i];
		if (s * 2 < a[i + 1]) t = i + 1;
	}
	cout << n - t << endl;
	return 0;
}


Measured memory_bytes: 3972
#include <stdio.h>
int N;
int main()
{
//	freopen("data.in","r",stdin);
//	freopen("yyt.out","w",stdout);
	scanf("%d",&N);
	if((N/1000==N%1000/100&&N%1000/100==N%100/10)||(N%1000/100==N%100/10&&N%100/10==N%10))
		printf("Yes");
	else 
		printf("No");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;

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

vector<int> prime;

void PF(int n){
	int baro=2;
	while(n>=baro*baro){
		if(n%baro==0){
			n/=baro;
			prime.push_back(baro);
		}
		else{
			baro++;
		}
	}
	prime.push_back(n);
}

signed main(){
	int a,b;
	cin>>a>>b;
	if(a<b){
		swap(a,b);
	}
	int sai=gcd(a,b);
	PF(sai);
	
	int ans=1,onaji;
	onaji=0;
	
	if(sai==1){
		cout<<sai<<endl;
		return 0;
	}
	
	rep(i,prime.size()){
		if(prime[i]!=onaji){
			ans++;
			onaji=prime[i];
		}
	}
	
	cout<<ans<<endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc101c()
}

// 最小に揃えるしかない？
// 1回の操作につき、k-1個最小のものを増やせる -> (n-1)/(k-1)の切り上げ // Aは同じ要素はないため。最小要素数も1個
fun abc101c() {
    val (n, k) = readLine()!!.split(" ").map { it.toInt() }
    val aList = readLine()!!.split(" ").map { it.toInt() }

    val answer = Math.ceil((n - 1).toDouble() / (k - 1)).toInt()

    println(answer)
}


Measured memory_bytes: 49792
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <ctime>
#include <map>
#include <stack>
#include <sstream>
#include <set>
#include <cmath>
#include <functional>

using namespace std;

const int MAX_V = 101;
const int INF = 1000000000;
vector <pair<int, int>> adj[MAX_V];
int V, E, K;
int dist[MAX_V];

void dijkstra(int s)
{
	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> que;
	fill(dist, dist + MAX_V, INF);
	dist[s] = 0;
	que.push(make_pair(s, 0));

	while (!que.empty())
	{
		pair <int, int> p = que.top();
		que.pop();
		int from = p.first;

		if (dist[from] < p.second)
		{
			continue;
		}


		for (auto it : adj[from])
		{
			int to = it.first;
			int cost = it.second;

			if (dist[to] > dist[from] + cost)
			{
				dist[to] = dist[from] + cost;
				que.push(make_pair(to, dist[to]));
			}
		}
	}
}

int main(void)
{
	int n, m;
	int a, b, c;
	int count = 0;

	cin >> n >> m;

	for (int i = 0; i < m; i++)
	{
		cin >> a >> b >> c;
		adj[a].push_back(make_pair(b, c));
		adj[b].push_back(make_pair(a, c));
	}

	for (int i = 1; i <= n ; i++)
	{
		if (adj[i].size() != 0)
		{
			dijkstra(i);
			for (auto iter : adj[i])
			{
				if (iter.second > dist[iter.first])
				{
					count++;
				}
			}
		}
	}

	cout << count/2 << endl;

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7;
ll GCD(ll x, ll y) {if (x % y == 0) return y;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x * y / GCD(x, y);}

int main(){
  int m, d; cin >> m >> d;
  int count=0;
  for(int i=1; i<=m; i++) {
    for(int j=1; j<=d; j++) {
      int d1 = j % 10;
      int d10 = j / 10;

      if(d1>1 && d10>1 && d1*d10==i) count++;
    }
  }
  cout << count << endl;
}


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

int main() {
	int n;
	cin >> n;
	int a[n], b[n];
	for (auto &i : a) {
		cin >> i;
	}
	for (auto &i : b) {
		cin >> i;
	}
	auto check = [&](int64_t s) {
		//集合s内の要素のみを使ってaをbにできるか判定
		int64_t dist[51][51];
		for (int i = 0; i <= 50; i++) {
			for (int j = 0; j <= 50; j++) {
				dist[i][j] = 1ll << 60;
			}
		}
		for (int i = 50; i; i--) {
			if ((s >> i) & 1) {
				for (int j = 0; j <= 50; j++) {
					dist[j][j % i] = 1;
				}
			}
		}
		for (int i = 0; i <= 50; i++) {
			dist[i][i] = 0;
		}
		for (int k = 0; k <= 50; k++) {
			for (int i = 0; i <= 50; i++) {
				for (int j = 0; j <= 50; j++) {
					dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
				}
			}
		}
		for (int i = 0; i < n; i++) {
			if (dist[a[i]][b[i]] == (1ll << 60)) {
				return false;
			}
		}
		return true;
	};
	int64_t ans = (1ll << 51) - 1;
	if (!check(ans)) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = 50; 0 <= i; i--) {
		if (check(ans - (1ll << i))) {
			ans -= (1ll << i);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<lli> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

void solve()
{

    string a, b;
    cin>>a>>b;
    string t = "";
    for(int i = 0; i < (lli)b.size() - 1; i ++) {
        t += b[i];
    }
    if(a.size() + 1 == b.size() and t == a) {
        cout<<"Yes";
    }
    else {
        cout<<"No";
    }
    cout<<"\n";
    return ;
}

/*
*/

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

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


Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
int n,maxx=-100000,a=0;
string s; 
int main()
{
	cin>>n;
	cin>>s;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='I') a++;
		else  if(s[i]=='D') a--;
		if(a>maxx) 
			maxx=a;
	}
	if(maxx<0) maxx=0;
	cout<<maxx;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define  maxn 100005
using namespace std;
typedef long long ll;
struct Node{
    int to,next;
}q[maxn<<1];
int head[maxn],cnt=0;
int n,k,siz[maxn];
int fa[maxn];
const int mod=1e9+7;
void add_edge(int from,int to){
    q[cnt].next=head[from];
    q[cnt].to=to;
    head[from]=cnt++;
}
void dfs(int x,int f){
    fa[x]=f;
    for(int i=head[x];i!=-1;i=q[i].next){
        int to=q[i].to;
        if(to==f) continue;
        siz[x]++;
        dfs(to,x);
    }
}
int main()
{
    scanf("%d%d",&n,&k);
    memset(head,-1,sizeof(head));
    cnt=0;
    for(int i=1;i<n;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        add_edge(x,y);
        add_edge(y,x);
    }
    dfs(1,0);
    ll res=1;
    for(int i=1;i<=n;i++){
        int tmp=0;
        if(fa[i]) tmp=1;
        for(int j=1;j<=siz[i];j++){
            res=(res*(k-j-tmp))%mod;
        }
    }
    res=res*k%mod;
    if(res<=0) puts("0");
    else printf("%d\n",res);
    return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <math.h>
#include <vector>
#include<map>
#include<queue>
#include <algorithm>
using namespace std;
#define int long long

const int maxn = 1e5+5;
int n,m;
vector<int>e[10];
int vis[10];
int ans = 0;
bool check()
{
	for(int i=1;i<=n;i++)
		if(!vis[i]) return false;
	return true;
}
void dfs(int s)
{
	if(check())
	{
		ans++;
		return ;
	}
	for(int i=0;i<e[s].size();i++)
	{
		if(!vis[e[s][i]])
		{
			vis[e[s][i]]=1;
			dfs(e[s][i]);
			vis[e[s][i]]=0;
		}
	}
}
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=0,u,v;i<m;i++)
	{
		cin>>u>>v;
		e[u].push_back(v);
		e[v].push_back(u);
	}
	memset(vis,0,sizeof(vis));
	vis[1]=1;
	dfs(1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    long long int k, a, b;
    scanf("%lld %lld %lld", &k, &a, &b);
    long long int ans;
    if(b-a<=2)ans=k+1;
    else ans=a+(k-(a-1))/2*(b-a)+(k-(a-1))%2;
    
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1736
#include  <iostream>
#include  <stdio.h>
using namespace std;
#include  <iomanip>
/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/

void quickSortIndex(int value[ ],int index[], int left_i, int right_i);
void quickSwap(int x[ ], int i, int j);
void quickSortIndex(int value[ ],int index[], int left_i, int right_i)
{
    int li, ri;
    int pivot;
    li = left_i;
    ri = right_i;
    pivot = value[index[(left_i + right_i) / 2]]; /* 基準値を配列の中央付近にとる */
    while (1) {
        while (value[index[li]] < pivot)       /* pivot より大きい値が */
            li++;                   /* 出るまで i を増加させる */
        while (pivot < value[index[ri]])       /* pivot より小さい値が */
            ri--;                   /*  出るまで j を減少させる */
        if (li >= ri)                /* i >= j なら */
            break;                 /* 無限ループから抜ける */
        quickSwap(index, li, ri);
        li++;                       /* 次のデータ */
        ri--;
    }
    if (left_i < li - 1)              /* 基準値の左に 2 以上要素があれば */
        quickSortIndex(value, index, left_i, li - 1);    /* 左の配列を Q ソートする */
    if (ri + 1 <  right_i)            /* 基準値の右に 2 以上要素があれば */
        quickSortIndex(value, index,ri + 1, right_i);    /* 右の配列を Q ソートする */
}
/* 配列の要素を交換する */
void quickSwap(int x[ ], int i, int j)
{
    int temp;
    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

int main(){

    int N;
    int M;
    
    cin >> N;
    cin >> M;

    int A[N];
    int B[N];
    int index[N];
    for( int ni = 0 ; ni < N ; ni++ ){
        cin >> A[ni];
        cin >> B[ni];
        index[ni] = ni;
    }
    quickSortIndex(A,index,0,N-1);

    int count = 0;
    int cost = 0;
    int cost_2 = 0;
    int ii = -1;
    int abi;
    int standerd = 100000000;
    int bi;
    int plus;
    while(count < M)
    {
        ii = ii + 1;
        abi = index[ii];
        bi = 0;
        while(count < M && bi < B[abi]){
            count = count + 1;
            cost  = cost + A[abi];
            //cout << cost << endl;
            //cout << cost_2 << endl;
            if(cost >= standerd)
            {
                plus = cost / standerd;
                cost_2 = cost_2 + plus;
                cost = cost - standerd * plus;
            }
            bi = bi + 1;
        }
    }
    if(cost_2 > 0){
        cout << cost_2;
        cout.fill('0');
        cout << setw(8);
    }
    cout << cost;
}

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

int main(){
  int N, T;
  cin >> N >> T;

  int min_cost = 10000000;
  for(int i=0;i<N;i++){
    int c, t;
    cin >> c >> t;

    if(t > T){
      continue;
    }

    if(c < min_cost){
      min_cost = c;
    }
  }

  if(min_cost < 10000000){
    cout << min_cost << endl;
  }
  else{
    cout << "TLE" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
N, K = list(map(int, input().split()))
pt = list(map(int, input().split()))
T = input()

pc_hand = [0]*N
my_hand = [0]*N

for i in range(N):
    if T[i] == 'r':
        pc_hand[i] = 0
    elif T[i] == 's':
        pc_hand[i] = 1
    else:
        pc_hand[i] = 2

point = 0

for i in range(N):
    if i >= K and T[i] == T[i - K] and (my_hand[i - K] + 1) % 3 == pc_hand[i - K]:
        my_hand[i] = pc_hand[i]
    else:
        my_hand[i] = (pc_hand[i] - 1) % 3
        point += pt[my_hand[i]]

print(point)

Measured memory_bytes: 10812
#include <cstdio>
using namespace std;

int main(){
	int a[28];
	int b[30] = {};
	for (int i = 0; i < 28; i++){
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < 30; i++){
		for (int j = 0; j < 28; j++){
			if (i + 1 == a[j]){
				b[i] = 1;
			}
		}
	}
	for (int i = 0; i < 30; i++){
		if (b[i] == 0){
			printf("%d\n", i + 1);
		}
	}

	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    map<int,int> ma;
    rep(i,n) {
        int a;
        cin >> a;
        ma[a]++;
        ma[a-1]++;
        ma[a+1]++;
    }
    int ans = 0;
    for(auto p : ma) chmax(ans,p.second);
    cout << ans << endl;
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    int64 ans = 0;
    vector<int64> b(n-1);
    REP(i,n-1){
        cin >> b[i];
    }
    ans += b[0] + b[n-2];
    REP(i,n-2){
        ans += min(b[i], b[i+1]);
    }
    ANS(ans);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<random>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

mat mul(mat &A, mat &B){
    mat C(A.size(), vll(B[0].size()));
    rep(i,A.size()){
        rep(k,B.size()){
            rep(j,B[0].size()){
                C[i][j]=(C[i][j]^(A[i][k]&B[k][j]));
            }
        }
    }
    return C;
}

mat pow(mat A,ll n){
    mat B(A.size(), vll(A.size()));
    rep(i,A.size()){
        B[i][i]=(1ll<<32)-1;
    }
    while(n>0){
        if(n&1) B=mul(B,A);
        A=mul(A,A);
        n>>=1;
    }
    return B;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    string s;
    cin>>s;
    ll ans=0;
    rep(i,s.size()){
        if(s[i]=='1') ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#C,D = map(int,input().split())
N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
flag=True
A=100
c=0
while flag==True:
    c+=1
    A+=int(A*0.01)

    if A>=N:
        print(c)
        flag=False


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

using namespace std;
using ll = long long;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)


void add_animal(char s, string &t)
{
    int lt = t.length();
    // cout << lt << s << t[lt-2] << t[lt-2] << endl;
    if (s == 'o' && t[lt - 2] == 'S' && t[lt - 1] == 'S')
        t += 'S';
    else if (s == 'x' && t[lt - 2] == 'S' && t[lt - 1] == 'S')
        t += 'W';
    else if (s == 'o' && t[lt - 2] == 'W' && t[lt - 1] == 'S')
        t += 'W';
    else if (s == 'x' && t[lt - 2] == 'W' && t[lt - 1] == 'S')
        t += 'S';
    else if (s == 'o' && t[lt - 2] == 'S' && t[lt - 1] == 'W')
        t += 'W';
    else if (s == 'x' && t[lt - 2] == 'S' && t[lt - 1] == 'W')
        t += 'S';
    else if (s == 'o' && t[lt - 2] == 'W' && t[lt - 1] == 'W')
        t += 'S';
    else if (s == 'x' && t[lt - 2] == 'W' && t[lt - 1] == 'W')
        t += 'W';
}

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int n;
    string s;
    cin >> n >> s;
    string ans = "None";
    s = s + s;

    string t1, t2, t3, t4;
    t1 = "SS", t2 = "WS", t3 = "SW", t4 = "WW";

    rep(i, 2 * n - 2)
    {
        add_animal(s[i + 1], t1);
        add_animal(s[i + 1], t2);
        add_animal(s[i + 1], t3);
        add_animal(s[i + 1], t4);
    }

    if (t1.substr(0, n) == t1.substr(n, 2*n))
        ans = t1.substr(0, n);
    if (t2.substr(0, n) == t2.substr(n, 2*n))
        ans = t2.substr(0, n);
    if (t3.substr(0, n) == t3.substr(n, 2*n))
        ans = t3.substr(0, n);
    if (t4.substr(0, n) == t4.substr(n, 2*n))
        ans = t4.substr(0, n);

    if (ans == "None")
        cout << -1 << endl;
    else
        cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
using namespace std;
bool T=false;
int main(){
    int N,Rcnt=0,cnt=0;cin>>N;
    vector<char> c(N);
    for (int i = 0; i < N; i++){
        cin>>c[i];
        if(c[i]=='R')Rcnt++;
    }
    if(Rcnt==N)T=true;
    else{
        for (int i = Rcnt; i < N; i++)
        {
            if(c[i]=='R')cnt++;
        }
    }
    cout<<cnt<<endl;
}

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

int main()
{
	int n,i,j,a[20],r,t;
	for(;scanf("%d",&n),n;)
	{
		for(i=0,r=1<<25;i<n;i++)scanf("%d",&a[i]);
		for(i=0;i<(1<<n);i++)
		{
			for(j=t=0;j<n;j++)
				t+=(i>>j)&1?-a[j]:a[j];
			r=r<abs(t)?r:abs(t);
		}
		printf("%d\n",r);
	}
	return 0;
}

Measured memory_bytes: 600
import math

X = int(input())


def is_prime_number(number):
    is_dividable = lambda divided, divider: divided % divider == 0
    result = all([not is_dividable(number, divider) for divider in range(2, int(math.sqrt(number)))])

    return result


answer = X
while True:
    if is_prime_number(answer): break
    answer += 1

print(answer)


Measured memory_bytes: 3060
A,B=map(int,input().split())
def gcd(a,b):
  a,b=max(a,b),min(a,b)
  if a==b:
    return a
  else:
    if a%b==0:
      return b
    else:
      return gcd(b,a%b)
g=gcd(A,B)
print(int(A*B/g))

Measured memory_bytes: 3060