akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
//increase stack size
#pragma comment(linker, "/STACK:16777216")

ll mxm() {return LLONG_MIN;}
template<typename... Args>
ll mxm(ll a, Args... args) { return max(a,mxm(args...)); }

ll mnm() {return LLONG_MAX;}
template<typename... Args>
ll mnm(ll a, Args... args) { return min(a,mnm(args...)); }

template<class T> ostream& operator<<(ostream& os,vector<T> V){
	os<<"[ ";for(auto v:V)os<<v<<" ";return os<<"]";
}
template<class L,class R> ostream& operator<<(ostream& os,pair<L,R> P){
	return os<<"("<<P.first<<","<<P.second<<")";
}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
template<typename Arg1>
void __f(const char* name,Arg1&& arg1){
	cout<<name<<" : "<<arg1<<endl;
}
template <typename Arg1,typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
	const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...) 1
#endif

#define ld long double
#define pll pair<ll,ll>
#define ii pair<int,int>
#define vll vector<ll>
#define vii vector<ii>
#define vi vector<int>
#define vpll vector<pll>
#define vld vector<ld>
#define vvld vector<vld>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvpll vector<vpll>
#define vvii vector<vii>
#define I insert
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x)	x.begin(),x.end()

const int mod=1e9+7;
// 128 bit: __int128
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,mod-2);}

struct compare{
	bool operator() (const int &a,const int &b) const{
		return a>b;
	}
};

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	ll n;
	cin >> n;
	vll ans;
	ans.pb(100);
	for(ll i = 1; ;i++){
		ll x = ans.back();
		x += x / 100;
		ans.pb(x);
		if(x >= n){
			cout << i << endl;
			return 0;
		}
		if(x > 1e18) break;
	}

}

Measured memory_bytes: 3716
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    if(a < b) cout << "a < b" << endl;
    if(a == b) cout << "a == b" << endl;
    if(a > b) cout << "a > b" << endl;
    return 0;
}

Measured memory_bytes: 1156
n = int(input())
blue = []
for i in range(n):
    blue.append(input())
m = int(input())
red = []
for i in range(m):
    red.append(input())
ans = 0
for i in range(n):
    ans = max(ans,blue.count(blue[i])-red.count(blue[i]))
print(ans)

Measured memory_bytes: 3064
package main

import "fmt"

const (
	A = iota
	B
	C
	D
)

const mod = 1e9 + 7

var (
	n   int
	sum int
)

func main() {
	fmt.Scan(&n)

	memo := make([][][][]int, 101)
	for i := 0; i <= 100; i++ {
		memo[i] = make([][][]int, 4)
		for j := 0; j < 4; j++ {
			memo[i][j] = make([][]int, 4)
			for k := 0; k < 4; k++ {
				memo[i][j][k] = make([]int, 4)
			}
		}
	}

	for a := 0; a < 4; a++ {
		for b := 0; b < 4; b++ {
			for c := 0; c < 4; c++ {
				if a == A && b == B && c == C {
					continue
				}
				if a == A && b == C && c == B {
					continue
				}
				if a == B && b == A && c == C {
					continue
				}
				memo[3][a][b][c] = 1
			}
		}
	}

	for i := 3; i <= n; i++ {
		for a := 0; a < 4; a++ {
			for b := 0; b < 4; b++ {
				for c := 0; c < 4; c++ {
					for d := 0; d < 4; d++ {
						if b == A && c == B && d == C {
							continue
						}
						if b == A && c == C && d == B {
							continue
						}
						if b == B && c == A && d == C {
							continue
						}
						if a == A && b == B && d == C {
							continue
						}
						if a == A && c == B && d == C {
							continue
						}
						memo[i][b][c][d] = (memo[i][b][c][d] + memo[i-1][a][b][c]) % mod
					}
				}
			}
		}
	}

	var sum int
	for a := 0; a < 4; a++ {
		for b := 0; b < 4; b++ {
			for c := 0; c < 4; c++ {
				sum = (sum + memo[n][a][b][c]) % mod
			}
		}
	}
	fmt.Println(sum)
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int mod(ll x){
	return (x%INF);
}
int F[MAXN];
int main(){
	//~ #ifndef ONLINE_JUDGE
    //~ freopen("file.in", "r", stdin);
	//~ #endif
	F[0]=1;
	for(int i=1;i<MAXN;i++)
		F[i]=mod(F[i-1]*1LL*i);
	int n,m;	
	scanf("%d%d",&n,&m);
	if(abs(n-m)>1)
		puts("0");
	else{
		if(abs(n-m)==1)
			printf("%d\n",mod(F[n]*1LL*F[m]));
		else
			printf("%d\n",mod(mod(F[n]*1LL*F[m])*2LL));	
	}
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef struct{
    int m[6];
}Dice;

Dice D[100], d[2];
int n;
string s = "NNENN", w="HHHH";

void roll(char c, Dice *d){
    switch(c){
        case 'N':
        swap(d->m[0],d->m[1]);
        swap(d->m[1],d->m[5]);
        swap(d->m[5],d->m[4]);
        break;
        case 'S':
        swap(d->m[0],d->m[4]);
        swap(d->m[4],d->m[5]);
        swap(d->m[5],d->m[1]);
        break;
        case 'E':
        swap(d->m[0],d->m[3]);
        swap(d->m[3],d->m[5]);
        swap(d->m[5],d->m[2]);
        break;
        case 'W':
        swap(d->m[0],d->m[2]);
        swap(d->m[2],d->m[5]);
        swap(d->m[5],d->m[3]);
        break;
        case 'H':
        swap(d->m[1],d->m[2]);
        swap(d->m[2],d->m[4]);
        swap(d->m[4],d->m[3]);
        break;
    }
}
bool isDifferent(Dice *d, Dice *e){
    for(unsigned i=0;i<s.size()+1;i++){
        for(unsigned j=0;j<w.size();j++){
            for(int k=0;k<6;k++){
                if(d->m[k] != e->m[k])break;
                if(k==5) return false;
            }
            roll(w[j],d);
        }
        if(i<s.size()) roll(s[i],d);
    }
    return true;
}
int main(void){
    int n=0;
    cin>>n;
    for(int i=0;i<n;i++)for(int j=0;j<6;j++) cin>>D[i].m[j];
    for(int i=0;i<n-1;i++){
        d[0]=D[i];
        for(int j=i+1;j<n;j++){
            d[1]=D[j];
            if(!isDifferent(&d[0],&d[1])){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    
}


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

const int N = 1010;
int n , x[N] , y[N] , mask;

void outputSeq(int x , int y , int w) {
    if(w == -1) return ;
    char ans;
    if(abs(x) > abs(y)) {
        if(x >= 0) ans = 'R' , x -= (1 << w);
        else ans = 'L' , x += (1 << w);
    } else {
        if(y >= 0) ans = 'U' , y -= (1 << w);
        else ans = 'D' , y += (1 << w);
    }
    outputSeq(x , y , w - 1);
    cout << ans;
}

int main() {
    cin >> n;
    for(int i = 1 ; i <= n ; ++i) {
        cin >> x[i] >> y[i];
        if((x[i] + y[i])&1) mask |= 1;
        else mask |= 2;
    }
    if(mask == 3) {cout << -1 << endl ; return 0;}

    if(mask == 1) cout << "31\n";
    else cout << "32\n1 ";
    for(int i = 0 ; i < 31 ; ++i) cout << (1 << i) << ' ';
    cout << endl;

    for(int i = 1 ; i <= n ; ++i) {
        if(mask == 2) cout << 'L' , x[i]++;
        outputSeq(x[i] , y[i] , 30) , cout << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

int main() {
  string s;
  cin >> s;

  if(s == "ABC")
    cout << "ARC" << endl;
  else cout << "ABC" << endl;
}

Measured memory_bytes: 3576
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define N 2*10e5
#define precise cout<<fixed<<setprecision(10)
#pragma GCC optimize("O0")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#define rep(i,a,b) for(int i=a;i<b;i++)
#define min3(a,b,c) min(a,min(b,c))
#define nl cout<<"\n";
#define all(v) v.begin(),v.end()
#define F first
#define S second
typedef long long ll;
typedef vector<long long> vl;
typedef vector<pair<long,long>> vp;
#define mod 1000000007
void get(ll arr[],ll n){for(ll i=0;i<n;i++) cin>>arr[i];}
ll gcd(ll a,ll b);
ll binpow(ll a,ll b);
void solve()
{
    ll n;
    cin>>n;
    ll ans=1;
    if(n<2) cout<<"0";
    else 
    {
        ll ten=1,eight=1,nine=1;
        rep(i,0,n)
        {
            ten = (ten*10)%mod;
            eight = (eight*8)%mod;
            nine = (nine*9)%mod;
        }
        ans = (ten - (2*nine)%mod + eight + mod)%mod;
        cout<<ans;
    }
}
int main()
{
 	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t;
	t=1;
	//cin>>t;
	while(t--)
	{
	 	solve();
	}
	//cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}
ll binpow(ll a, ll b) {
   ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	string s;
	cin >> s;
	int res;
	s.push_back('o');
	for (res = 0; res < N; res++) {
		if (s[res] == 'x'&&s[res + 1] == 'x') {
			break;
		}
	}
	cout << min(N,res + 1) << endl;
}

Measured memory_bytes: 3356
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;

const string YES = "Yes";
const string NO = "No";

bool solve(long long a, long long b, long long c){
	LL d=c-a-b;
	if(d<0){
		return false;
	}
	return 4*a*b<d*d;

}

int main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    long long c;
    scanf("%lld",&c);
    if(solve(a, b, c)){
		cout << YES << endl;
	}
	else{
		cout << NO << endl;
	}
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using ull = unsigned long long;

auto gcd(ull a, ull b) {
	std::pair<ull, ull> mm = std::minmax(a, b);
	auto rem = mm.second % mm.first;
	while (rem != 0) {

//		std::cout << rem << " " << mm.second << " " << mm.first << "\n";
		mm.second = mm.first;
		mm.first = rem;
		rem = mm.second % mm.first;
	}

	return mm.first;
}


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

int main() {

	ull n, m;
	std::string s, t;
	std::cin >> n >> m >> s >> t;

	auto gcd_ = gcd(n, m);
	auto lcm_ = lcm(n, m);

//	std::cout << gcd_ << " " << lcm_<< "\n";

	bool good = true;


	for (unsigned int i{}; i < lcm_; i++) {

		//if ( i%gcd_ != 0) continue;

		const auto si = static_cast<unsigned>(i* n/gcd_);//0,2,4
		const auto ti = static_cast<unsigned>(i* m/gcd_);//0,1,2

		if (n <= si || m<=ti)break;

//		std::cout << s[si] << " " << t[ti] << " ";
//		std::cout << si << " " << ti << "\n";
		good &= s[si] == t[ti];
	}


	std::cout << (good ? std::to_string(lcm_) : std::to_string(-1)) << "\n";

	return 0;
}

Measured memory_bytes: 512
//xtwakioi! xtwddYnoi(双重含义)!
#include <bits/stdc++.h>
#define ri register
#define int long long
#define E (n+1)
using namespace std; const int N=200010;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar();
    return s*w;
}
signed main()
{
    int w,a,b;
    cin>>w>>a>>b;
    int res=0;
    if(a>b+w) res=a-b-w;
    if(a+w<b) res=b-a-w;
    printf("%lld\n",res);
    return 0;
}

Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  string answer;
  if(a <= b){
    for(int i = 0; i < b; i++){
      char A = '0' + a;
      answer += A;
    }
  }
  else{
    for(int i = 0; i < a; i++){
      char B = '0' + b;
      answer += B;
    }
  }
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

void solve()
{
	int N;
	cin >> N;
	for(int a = 0; a < N; ++a)
	{
		cout << "Case " << a + 1 << ":" << endl;
		int Num;
		cin >> Num;
		for(int i = 0; i < 10; ++i)
		{
			Num = Num * Num / 100;
			Num %= 10000;
			cout << Num << endl;
		}
	}
}

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

Measured memory_bytes: 0
/*
	JAI JAGANNATH!
*/
//@Author : zanj0

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

typedef long long int lli;

#define ff              first
#define ss              second
#define pb              push_back
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            lli x; cin>>x; while(x--)

void zanj0()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
void solve() {
	int x;
	cin >> x;
	cout << !x << endl;
}
int main()
{
	zanj0();
	solve();
	return 0;
}

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

#[fastout]
fn main() {
    input! {
        k: usize,
        s: String,
    }
    let s = s.as_str().chars().collect::<Vec<char>>();
    if s.len() <= k {
        println!("{}", s.iter().collect::<String>());
    } else {
        for i in 0..k {
            print!("{}", s[i]);
        }
        println!("{}", "...");
    }
}


Measured memory_bytes: 2196
#include<stdio.h>
#include<stdlib.h>
    
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef node* Node;
#define NIL NULL
   
node array[500000];
int size=0;
   
Node root = NIL;
    
Node treeMinimum(Node x){
  while(x->left!=NIL)x=x->left;
  return x;
}
    
Node treeSearch(Node u, int k){
  Node i=u;
  while(i!=NIL){
    if(i->key==k)return i;
    else if(i->key<k)i=i->right;
    else i=i->left;    
  }
  return NIL;
}
    
Node treeSuccessor(Node x){
  if(x->right!=NIL)return treeMinimum(x->right);
  Node y=x->parent;
  while(y!=NIL&&x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}
    
void treeDelete(Node z){
  Node y;
  Node x;
  if(z->left==NIL||z->right==NIL)y=z;
  else y=treeSuccessor(z);
      
  if(y->left!=NIL)x=y->left;
  else x=y->right;
    
  if(x!=NIL)x->parent=y->parent;
      
  if(y->parent==NIL)root=x;
  else if(y==y->parent->left)y->parent->left=x;
  else y->parent->right=x;
	
  if(y!=z)z->key=y->key;
	
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
	
  z = &array[size++];
  z->key = k;
  z->left = NIL;
  z->right = NIL;
	
  while(x!=NIL){
    y=x;
    if(z->key<x->key)x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL)root=z;
  else if(z->key<y->key)y->left=z;
  else y->right=z;  
}

void inorder(Node u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
  
void preorder(Node u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,x;
  char str[20];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%s", str);
    if(str[0]=='f'){
      scanf("%d",&x);
      Node t=treeSearch(root,x);
      if (t!=NIL) printf("yes\n");
      else printf("no\n");
    }else if(str[0]=='i'){
      scanf("%d",&x);
      insert(x);
    }else if(str[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }else if(str[0]=='d'){
      scanf("%d",&x);
      treeDelete(treeSearch(root,x));
    }
  }
   
  return 0;
}


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

int main() {
    ll N; cin >> N;
    vector<ll> a;
    vector<ll> b;
    vector<ll> c;
    for(int i = 0; i < N; i++) {
        ll tmp; cin >> tmp;
        a.push_back(tmp);
    }
    for(int i = 0; i < N; i++) {
        ll tmp; cin >> tmp;
        b.push_back(tmp);
    }
    for(int i = 0; i < N; i++) {
        ll tmp; cin >> tmp;
        c.push_back(tmp);
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    ll ans = 0;
    for(auto i:b){
        // 真ん中より小さい上の段の数
        auto it_l = lower_bound(a.begin(), a.end(), i);
        ll lower_num = it_l - a.begin();

        auto it_h = upper_bound(c.begin(), c.end(), i);
        ll upper_idx = it_h - c.begin() + 1;
        ll upper_num = c.size() - upper_idx + 1;
        //cout << "search: " << i << " " << lower_num << " " << upper_num << endl;
        ans += upper_num * lower_num;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3444
import sys
from fractions import gcd

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def lcm(x, y):
    return x * y // gcd(x, y)


def main():
    N, M, *A = map(int, read().split())
    A = [a // 2 for a in A]

    semi_lcm = A[0]
    for a in A[1:]:
        semi_lcm = lcm(semi_lcm, a)
        if semi_lcm > M or semi_lcm // a % 2 == 0:
            print(0)
            return

    print((M // semi_lcm + 1) // 2)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 16148
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;

class Program
{

    static void Main(string[] args)
	{


        int N = int.Parse(Console.ReadLine());
        string[] input = Console.ReadLine().Split(' ');

        int[] hight = new int[N];

        long count = 0;

        for (int i = 0; i < N; i++)
        {
            hight[i] = int.Parse(input[i]);

            if (i == 0) continue;

            if (hight[i - 1] > hight[i])
            {
                int j = hight[i - 1] - hight[i];
                hight[i] += j;
                count += j;
            }
        }

        Console.WriteLine(count);

    }
}

Measured memory_bytes: 43232
#include<cstdio>
int check(int a,int b,int c)
{
	for(int i=1;i<=b;i++)
	if((a*i+c)%b==0) return 1;
	return 0;
}
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(check(a,b,b-c)) printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
using namespace std;
int main() {
    long a;
    double b;
    cin >> a >> b;
    long b0 = (long) (b * 100 + 0.1);
    long ans = a * b0 / 100;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3196
#include <iostream>
#include <string>
#include <assert.h>

int main(){
    short A, B;
    std::cin >> A >> B;

    assert(2 <= A);
    assert(1 <= B);

    short holes = 1;
    short cnt = 0;
    while(holes < B){
        holes--;
        holes += A;
        cnt++;
    }
    std::cout << cnt;
    return 0;
}


Measured memory_bytes: 256
S = input()
SS = S.replace('BC','X')
#SS
import re
SSS = re.split('[BC]', SS)
#SSS
ans = 0
for i in SSS:
    acnt = 0
    for g in i:
        if g == 'A':
            acnt += 1
        else:
            ans += acnt
print(ans)

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

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int count=0;
  int counta=0, countb=0;
  for(int i=0; i<N; i++){
    if(S.at(i)=='('){
      count++;
    }
    else{
      count--;
    }
    if(count<0){
      counta++;
      count++;
    }
  }
  count=0;
  for(int i=N-1; i>=0; i--){
    if(S.at(i)==')'){
      count++;
    }
    else{
      count--;
    }
    if(count<0){
      countb++;
      count++;
    }
  }
  for(int i=0; i<counta; i++){
    S.insert(S.begin(), '(');
  }
  for(int i=0; i<countb; i++){
    S.push_back(')');
  }
  cout << S << endl;
}

Measured memory_bytes: 256
//#pragma warning disable
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Numerics;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int F() => int.Parse(ReadLine());
	long FL() => long.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	long[] GL() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
	public const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F();
		const int T = 10;
		var store = new bool[N, T];
		var cnt = new int[N];
		for (int s = 0; s < N; s++)
		{
			var I = G();
			for (int t = 0; t < T; t++) if (store[s, t] = I[t] == 1) cnt[s]++;
		}
		var max = 0;
		var bonus = new int[N, T + 1];
		for (var s = 0; s < N; s++)
		{
			var I = G();
			for (int t = 0; t <= T; t++) bonus[s, t] = I[t];
			max += bonus[s, cnt[s]];
		}
		for (var i = 1; i < (1 << T); i++)
		{
			cnt = new int[N];
			for (int t = 0; t < T; t++)
			{
				if ((i & (1 << t)) == 0) continue;
				for (var s = 0; s < N; s++) if (store[s, t]) cnt[s]++;
			}
			var sum = 0;
			for (int s = 0; s < N; s++) sum += bonus[s, cnt[s]];
			max = Math.Max(max, sum);
		}
		Console.WriteLine(max);
	}
}


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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << endl;}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}

ll pre[2019];
ll now[2019];

signed main() {
    //my-code
    string s; cin >> s;
    int d;
    ll ans = 0;
    REP(i, 2019) {
        now[i] = 0;
    }
    // now[0] = 1;
    REP(i, s.length()) {
        d = (int)(s[i]-'0');
        REP(i, 2019) {
            pre[i] = now[i];
        }
        REP(i, 2019) {
            now[i] = 0;
        }
        REP(i, 2019) {
            now[(i*10+d)%2019] += pre[i];
        }
        now[d] += 1;
        ans += now[0];
    }

    cout << ans << endl;

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 3800
N = int(input())
mod = 1000000007
data = dict([(i+j+k, 1) for i in 'ACGT' for j in 'AGCT' for k in 'ACGT'])
data['AGC'] = 0
data['ACG'] = 0
data['GAC'] = 0
 
def check(text):
    if 'AGC' in text:
        return False
    if 'AGC' in text[1] + text[0] + text[2] + text[3]:
        return False
    if 'AGC' in text[0] + text[2] + text[1] + text[3]:
        return False
    if 'AGC' in text[0] + text[1] + text[3] + text[2]:
        return False
    else:
        return True

for x in range(0,N-3):
    new_data = dict([(i+j+k, 0) for i in 'ACGT' for j in 'AGCT' for k in 'ACGT'])
    for y in data.keys():
        for z in 'ACGT':
            if check(y+z):
                new_data[y[1:]+z] += data[y]%mod
    data = new_data.copy()

print(sum(data.values())%mod)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<numeric>
#include<algorithm>
#include<tuple>
#include<cmath>
#include <iomanip>

typedef unsigned long long ull;
typedef long long ll;

ll DENOM = 1000000000LL + 7LL;
using namespace std;

ll n, m, x;

ll solve(vector<bool>& v, int i, vector<ll>& c, vector<vector<ll> >& a){
    if (i==v.size()){
        vector<ll> aa(a[0].size(),0);
        ll cost = 0;
        for (int j=0; j<c.size(); ++j){
            if(v[j]){
                cost += c[j];
                for (int k=0; k<aa.size(); ++k){
                    aa[k] += a[j][k];
                }
            }
        }
        for (int k=0; k<aa.size(); ++k){
            if (aa[k] < x) return DENOM;
        }
        return cost;
    }else{
        v[i]=true;
        ll ret1 = solve(v, i+1, c, a);
        v[i]=false;
        ll ret2 = solve(v, i+1, c, a);
        return min(ret1, ret2);
    }
}

int main(){
    cin >> n >> m >> x;
    vector<ll> c(n);
    vector<vector<ll> > a(n);
    for (int i=0; i< n; ++i){
        cin >> c[i];
        vector<ll> aa(m);
        for (int j=0; j<m; ++j){
            cin >> aa[j];
        }
        a[i] = aa;
    }
    vector<bool> buy(n,true);
    ll ret = solve(buy, 0, c, a);
    if (ret==DENOM) ret = -1;
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3108
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


int main()
{
	int w, h, n;
	cin >> w >> h >> n;

	int x0 = 0, x1 = w, y0 = 0, y1 = h;
	for (int i = 0; i < n; i++)
	{
		int s, t, a;
		cin >> s >> t >> a;

		if (a == 1)
		{
			x0 = max(x0, s);
		}
		else if (a == 2)
		{
			x1 = min(x1, s);
		}
		else if (a == 3)
		{
			y0 = max(y0, t);
		}
		else if (a == 4)
		{
			y1 = min(y1, t);
		}
	}

	println((max(x1 - x0, 0) * max(y1 - y0, 0)));
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>
#include <array>

using namespace std;

int main()
{
    map<char, array<bool,13> > in_possession = {{'S', {}}, {'H', {}}, {'C', {}}, {'D', {}}};
    int n;

    scanf("%d\n", &n);
    for (int i = 0; i < n; i++) {
        char suit;
        int rank;

        scanf("%c %d\n", &suit, &rank);
        in_possession[suit][rank-1] = true;
    }

    for (char suit : { 'S', 'H', 'C', 'D' })
        for (int i = 0; i < 13; i++)
            if (!in_possession[suit][i])
                cout << suit << ' ' << i+1 << endl;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,v.size())
#define all(v) (v).begin(),(v).end()
#define bit(n) (1ll<<(n))
#define clamp(n,mi,ma) max(min(n,ma),mi)
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define pb push_back
#define F first
#define S second
#define endl '\n'
#ifndef LOCAL
struct ostdmy{template<class T>ostdmy&operator<<(const T&t){return*this;}};ostdmy cer_;
#define cerr cer_
#endif
#define cho(n,a,b) cout<<((n)?a:b)<<endl
#define YES(n) cho(n,"YES","NO")
#define Yes(n) cho(n,"Yes","No")
#define Poss(n) cho(n,"Possible","Impossible")
template<class T>bool chmax(T&a,const T&b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(const T&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(const T&i:v)o<<i<<' ';return o;}
int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n;
    cin>>n;
    if(n%2)n*=2;
    cout<<n<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
long long modpow(long long m, long long n, long long modvalue) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2, modvalue);
        return t * t % modvalue;
    } else {
        return modpow(m, n - 1, modvalue) * m % modvalue;
    }
}
bool bitcheck(ll x, ll y) { return (x >> y) & 1; }

template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;

long long moddiv(long long a, long long b, ll modvalue) { return (a * modpow(b, mod - 2, modvalue)) % modvalue; }

const ll INF = 1LL << 60;

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}

ll nCkmod(ll n, ll k, ll modvalue) {
    ll numera = 1;
    for (int i = n; i > n - k; i--) {
        numera *= i;
        numera %= modvalue;
    }
    ll denomi = 1;
    REP(i, k) {
        denomi *= (i + 1);
        denomi %= modvalue;
    }
    return moddiv(numera, denomi, modvalue);
}
map<ll, ll> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
int main() {
    ll n, m;
    cin >> n >> m;
    primeFactors(m);
    ll ans = 1;
    for (auto x : cnt) {
        ans *= nCkmod(x.second + n - 1, n - 1, mod);
        ans %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
import scala.io.StdIn.{readInt,readLine}

object Main {
  def main(args:Array[String]) = {
    var n = 0
    while({n=readInt;n}!=0) {
      val a = readLine.split(" ").map(_.toInt)
      var rem = 32
      var i = 0
      while(rem!=0) {
        rem = rem - (rem-1)%5
        println(rem)
        rem = rem - (if(a(i%n)<=rem) a(i%n) else rem)
        println(rem)
        i += 1
      }
    }
  }
}

Measured memory_bytes: 43768
s = input()
n = len(s)

total = 0
for i in range(2**(n-1)):
  tmp = s[0]
  for j in range(1, n):
    if (i >> j-1) & 1:
      tmp = tmp + "+" + s[j]
    else:
      tmp = tmp + s[j]
  
  total = total + eval(tmp)

print(total)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())

int main()
{
    ll i,j,n;
    string s;
    cin>>s;
    ll ans = 0;
    if(s[0]==s[1] && s[1]==s[2] && s[0]=='R') ans = 3;
    else if((s[0]=='R' && s[1]=='R')||(s[1]=='R' && s[2]=='R')) ans = 2;
    else if(s[0]=='R' || s[1]=='R' || s[2]=='R') ans = 1;
    else ans = 0;
    cout<<ans<<"\n";
}

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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define eps 1e-9
#define fast_cin ios_base::sync_with_stdio(false)

const int MOD = 1e9+7;

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

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

int main()
{
	//freopen("Task.in","r",stdin);freopen("Task.out","w",stdout);
	fast_cin;
	int n; cin >> n;
	if (n == 1)
	{
		ll z;
		cin >> z;
		cout << z << endl;
	}
	else if (n == 2)
	{
		ll a,b;
		cin >> a >> b;
		cout << a/gcd(a,b)*b << endl;
	}
	else{
		ll a,b;
		cin >> a >> b;
		ll lcm =  a/gcd(a,b)*b ;
		n -= 2;
		while(n--){
			ll x; cin >> x;
			lcm = x/gcd(lcm,x)*lcm;
		}
		cout << lcm << endl;
	}

	return 0;
	
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    int N; cin >> N;
    vector<double> r(N),x(N,0);
    for (int i=0;i<N;++i) cin >> r[i];
    for (int i=0;i<N;++i){
        for (int j=0;j<i;++j){
            x[i]=max(x[i],x[j]+sqrt((r[i]+r[j])*(r[i]+r[j])-(r[i]-r[j
            ])*(r[i]-r[j])));
        }
    }
    double Min=0,Max=0;
    for (int i=0;i<N;++i){
        Min=min(Min,x[i]-r[i]);
        Max=max(Max,x[i]+r[i]);
    }
    cout << Max-Min << '\n';
}


Measured memory_bytes: 3304
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
int main(){
      string S,St;
      cin >> S >> St;
      bool ans = true;
      if(S[0] != St[2])ans = false;
      if(S[1] != St[1])ans = false; 
      if(S[2] != St[0])ans = false;
      if(ans)cout << "YES";
      else cout << "NO";
        return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

int N, A, B, C;
vector<string> s(N);
vector<string> ans;

void f(int i, char s, char t){
  if(s == 'A') A++; if(t == 'A') A--;
  if(s == 'B') B++; if(t == 'B') B--;
  if(s == 'C') C++; if(t == 'C') C--;
  ans[i] = s;
}
void g(char s, char t){
  if(s == 'A') A--; if(t == 'A') A++;
  if(s == 'B') B--; if(t == 'B') B++;
  if(s == 'C') C--; if(t == 'C') C++;
}

void dfs(int n){
  if(A < 0 || B < 0 || C < 0) return;
  if(n == N){
    Yes;
    REP(i, N) cout << ans[i] << "\n";
    exit(0);
  }

  REP(i, 2){
    f(n, s[n][i], s[n][1-i]);
    dfs(n+1);
    g(s[n][i], s[n][1-i]);
  }
}

signed main() {
  cin >> N >> A >> B >> C;

  s.resize(N);
  REP(i, N) cin >> s[i];

  ans.resize(N);
  dfs(0);

  No;

  return 0;
}

Measured memory_bytes: 15880
H,W=map(int,input().split())
s0='.'*(W+2)
s1='.'+input()+'.'

ans=''
for i in range(H):
    if i==H-1:
        s2='.'*(W+2)
    else:
        s2='.'+input()+'.'
    
    for j in range(1,W+1):
        if s1[j]=='.':
            x=s0[j-1:j+2]+s1[j-1]+s1[j+1]+s2[j-1:j+2]
            ans+=str(x.count('#'))
        else:
            ans+='#'
    s0=s1
    s1=s2

for i in range(H):
    print(ans[i*W:i*W+W])

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

int main(){
  char c;
  cin >> c;
  switch(c){
    case 'A':
      cout << "T";
      return 0;
    case 'C':
      cout << "G";
      return 0;
    case 'G':
      cout << "C";
      return 0;
    case 'T':
      cout << "A";
      return 0;
  }
  
}
      
      


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

int main() {
    int N,Y;
    cin >> N >> Y;
    int EN10000=-1,EN5000=-1,EN1000=-1;

    bool flag = false;
    for(int i=0; i<=N; i++){
        for(int j=0; j<=N; j++){
            int s = Y - i*10000 - j*5000;
            int sn = N - i - j;
            if ( s == sn*1000 && sn >= 0 ) {
                EN10000 = i;
                EN5000 = j;
                EN1000 = sn;
                flag = true;
                break;
                }
            }
            if(flag) break;
        }
        cout << EN10000 << " " << EN5000 << " " << EN1000 << endl;
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
using namespace std;
vector<stack<int> > v;
int n,arr[200005],loc[200005],ans[200005];
vector<int> adj[200005];
int binser(int x){
    int l =0;
    int r = v.size()-1;
    int ret;
    while(l<=r){
        int mid = (l+r)/2;

        if(x<=v[mid].top()){
            ret=mid;
            r = mid-1;
        }
        else{
            l=mid+1;
        }
    }
    return ret;
}
void dfs(int u ,int par){
    
    if(v.empty()){
        v.eb();
        v[0].push(arr[u]);
        loc[u]=0;
    }
    else if(arr[u]>v.back().top()){
        v.eb();
        v.back().push(arr[u]);
        loc[u]=v.size()-1;
    }
    else{
        int tmp=binser(arr[u]);
        v[tmp].push(arr[u]);
        loc[u]=tmp;
    }
    // cout<<u<<' '<<v.back().top()<<endl;
    ans[u]=v.size();
    for(int v:adj[u]){
        if(v!=par){
            dfs(v,u);
        }
    }
    v[loc[u]].pop();
    if(v.back().empty())v.pop_back();
}
int main(){
    cin>>n;
    for(int i =1;i<=n;i++){
        cin>>arr[i];
    }
    for(int i =1;i<n;i++){
        int a,b;
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    dfs(1,0);
    for(int i =1;i<=n;i++){
        cout<<ans[i]<<endl;
    }
}

Measured memory_bytes: 111460
def powmod(a,n,mod):
    ans = 1
    while n > 0:
        if n & 1:
            ans = ans * a % mod
        a = a ** 2 % mod 
        n >>= 1 
    return ans

N=int(input())
m=10**9+7
L=[powmod(10,N,m),powmod(9,N,m),powmod(9,N,m),powmod(8,N,m)]
A=(L[0]+L[3]-(L[1]+L[2]))%m
print(A)

Measured memory_bytes: 8916
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <cmath>
#include <climits>
#include <cstdint>
#include <string>
using namespace std;

inline namespace atcoder {
    template <typename T, size_t Depth>
    struct vector_helper { using type = vector<typename vector_helper<T, Depth - 1>::type>; };
    template <typename T>
    struct vector_helper<T, 0> { using type = T; };
    template <typename T, size_t Depth>
    using vector_t = typename vector_helper<T, Depth>::type;

    template <typename T> using vec = vector_t<T, 1>;
    template <typename T> using vvec = vector_t<T, 2>;
    template <typename T> using vvvec = vector_t<T, 3>;
}

int main() {
    string s, t; cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());

    cout << (s < t ? "Yes" : "No") << endl;
}



Measured memory_bytes: 3620
#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;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int t; cin >> t; cin.ignore(); while(t--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}
 
int main(){
    fast();
 
/* you get what you work for not what you wish for */
    
    int a[3] = {0};
    ll x, y;
    cin >> x >> y;
    x--, y--;
    a[x] = 1;
    a[y] = 1;
    for(int i=0; i<3; i++){
        if(!a[i]){
            cout << i + 1 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;

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

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / (b))
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))
//#define int long long int //dont forget to change int to signed

const int INT_INF = 1000000007;

int main() {
	char X, Y;
	cin >> X >> Y;
	if (X < Y) {
		cout << "<" << endl;
	}else if (X > Y){
		cout << ">" << endl;
	} else {
		cout << "=" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <set>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;

int main(){
    int N,M; cin >> N >> M;
    vector<int> k(M);
    vector<vector<int> > s(M);
    int sum=0;
    for(int i=0;i<M;i++){
        cin >> k[i];
        for(int j=0;j<k[i];j++){
            int a; cin >> a; a--;
            s[i].push_back(a);
        }
    }
    vector<int> p(M);
    for(int i=0;i<M;i++){
        cin >> p[i];
    }
    for(int i=0;i<(1<<N);i++){
        bool f = true;
        for(int j=0;j<M;j++){
            int con=0;
            //cout << i << " ";
            for(int l=0;l<k[j];l++){
                //cout << s[j][l] << ",";
                if(i & (1<<s[j][l])){
                    con++;
                }
            }
            //cout << "=" << con << " " << sum <<"\n";
            if(con%2!=p[j]){
                f=false;
                break;
            }
        }
        if(f){
            sum++;
        }
    }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,i;
    cin>>n;
    string str1,str2,str;
    cin>>str1>>str2;
    for(i=0;i<n;i++){
        str+=str1[i];
        str+=str2[i];
    }
    cout<<str<<endl;
    return 0;
}


Measured memory_bytes: 256
#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 k;
    cin >> k;
    vector<int> defo = {1, 1, 1, 2, 1, 2 ,1 ,5 ,2,2 ,1,5 ,1, 2, 1, 14, 1 ,5 ,1 ,5, 2, 2 ,1 ,15, 2, 2, 5, 4, 1 ,4 ,1, 51};
    cout << defo[k-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
#include <iterator>
using namespace std;

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

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i, a, cont, next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i, a, b, step) repfn(i, a, i < b, i + step)
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

int rndup1000(int x) {
  int mod = x % 1000;
  if (mod)
    return x - mod + 1000;
  else
    return x;
}

int main(int argc, char **argv)
{
  int n;
  int debt = 100000;
  cin >> n;
  while (n--) {
    debt = rndup1000((debt/100)*105);
  }
  cout << debt << endl;
  return 0;
}

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

int main(void){
  
    int N,K,Q,A;
    cin >> N >> K >> Q;
    map<int,int>mp{};
    for(int i=1;i<=N;i++) mp[i] = 0;
  
    for(int i=0;i<Q;i++){
        cin >> A;
        mp[A]++;
    }
    
    for(int i=1;i<=N;i++){
        if(Q - mp[i] >= K) cout << "No" << endl;
        else cout << "Yes" <<endl;
    }
   
}

Measured memory_bytes: 8296