akhauriyash/Code-Regression huggingface dataset:
# coding: utf-8
# Here your code !
employeeSalesList = []

def resetDataset():
    del employeeSalesList[0 : len(employeeSalesList) + 1]

def readDataCount():
    return int(input())

def searchEmployeeSales(employeeId):
    for data in employeeSalesList:
        if data[0] == employeeId:
            return data
    
    newData = [employeeId, 0]
    employeeSalesList.append(newData)
    return newData

def printEmployeeOfDataset():
    answerList = [data[0] for data in employeeSalesList if data[1] >= 1000000]
    if len(answerList) == 0:
        print("NA")
    else:
        print("\n".join(map(str, answerList)))

resetDataset()
dataCount = readDataCount()
while dataCount > 0:
    for _ in range(dataCount):
        employeeId, price, volume = list(map(int, input().split(" ")))
        employeeSales = searchEmployeeSales(employeeId)
        employeeSales[1] += price * volume
    printEmployeeOfDataset()
    resetDataset()
    dataCount = readDataCount()

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

// 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 T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;

using namespace std;


signed main() {
  int N;
  cin >> N;
  if(N == 2){
    cout << -1 << endl;
    return 0;
  }else if(N == 3){
    cout << "aa." << endl;
    cout << "..a" << endl;
    cout << "..a" << endl;
    return 0;
  }

  int x, y;
  if(N%4 == 0){
    x = N/4;
    y = 0;
  }else{
    x = N/4-1;
    y = N-(N/4-1)*4;
  }

  vector<vector<char>> vec(N, vector<char>(N, '.'));

  REP(i, x){
    vec[i*4+0][i*4+0] = 'a';
    vec[i*4+0][i*4+1] = 'a';
    vec[i*4+0][i*4+2] = 'b';
    vec[i*4+0][i*4+3] = 'c';
    vec[i*4+1][i*4+0] = 'd';
    vec[i*4+1][i*4+1] = 'd';
    vec[i*4+1][i*4+2] = 'b';
    vec[i*4+1][i*4+3] = 'c';
    vec[i*4+2][i*4+0] = 'b';
    vec[i*4+2][i*4+1] = 'c';
    vec[i*4+2][i*4+2] = 'a';
    vec[i*4+2][i*4+3] = 'a';
    vec[i*4+3][i*4+0] = 'b';
    vec[i*4+3][i*4+1] = 'c';
    vec[i*4+3][i*4+2] = 'd';
    vec[i*4+3][i*4+3] = 'd';
  }
  REP(i, x*4) REP(j, x*4){
    cout << vec[i][j];
    if(j == x*4-1){
      REP(k, y) cout << '.';
      cout << endl;
    }
  }


  if(y == 5){
    REP(i, x*4) cout << '.'; cout << "aabba" << endl;
    REP(i, x*4) cout << '.'; cout << "bcc.a" << endl;
    REP(i, x*4) cout << '.'; cout << "b..cb" << endl;
    REP(i, x*4) cout << '.'; cout << "a..cb" << endl;
    REP(i, x*4) cout << '.'; cout << "abbaa" << endl;
  }else if(y == 6){
    REP(i, x*4) cout << '.'; cout << "aabc.." << endl;
    REP(i, x*4) cout << '.'; cout << "ddbc.." << endl;
    REP(i, x*4) cout << '.'; cout << "..aabc" << endl;
    REP(i, x*4) cout << '.'; cout << "..ddbc" << endl;
    REP(i, x*4) cout << '.'; cout << "bc..aa" << endl;
    REP(i, x*4) cout << '.'; cout << "bc..dd" << endl;
  }else if(y == 7){
    REP(i, x*4) cout << '.'; cout << "aabbcc." << endl;
    REP(i, x*4) cout << '.'; cout << "dd.dd.a" << endl;
    REP(i, x*4) cout << '.'; cout << "..d..da" << endl;
    REP(i, x*4) cout << '.'; cout << "..d..db" << endl;
    REP(i, x*4) cout << '.'; cout << "dd.dd.b" << endl;
    REP(i, x*4) cout << '.'; cout << "..d..dc" << endl;
    REP(i, x*4) cout << '.'; cout << "..d..dc" << endl;
  }

  return 0;
}

Measured memory_bytes: 2304
///supercalifragilisticexpialidocious.
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <cstdlib>
#include <cctype>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <utility>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <list>
#include <bitset>
#include <complex>
using namespace std;
#define f first
#define s second
#define PB pop_back 
#define pb push_back
#define mp make_pair
#define int long long
#define y1 y_golabi
#define sz(s) (int)s.size()
#define seper(n) setprecision(n)
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a,b,sizeof a)
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll;
typedef map<int , int> mii;
typedef pair<int , int> pii;
typedef map<string , int> msi;
typedef pair<int , string> pis;
typedef pair<int , pair<int , int> > piii;
int n , x , p , np;
int32_t main()
{
	cin >> n >> x , np = 2 * n - 1;
	if(x == 2 * n - 1 or x == 1)
		return cout << "No" << endl , 0;
	cout << "Yes" << endl;
	for(int i = 0 ; i < np ; i ++)
	{
		int p = (x - n + i) % np;
		if(p < 0)
			p += np;
		cout << p + 1 << endl;
	}
	return cout << endl , 0;
}


Measured memory_bytes: 1536
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define MOD 1000000007

int n,k;
int tb[2345][2345][2];

int cnt(int sx, int sy, int ex, int ey, int p){
	int sum=0;
	sum += tb[ex][ey][p];
	sum -= tb[ex][sy][p];
	sum -= tb[sx][ey][p];
	sum += tb[sx][sy][p];
	return sum;
}

int main(void){
	int x,y,i,j,ans=0,a,b;
	char c;
	fill(tb[0][0],tb[2345][0],0);
	cin >> n >> k;
	k*=2;
	for(i=0; i<n; i++){
		cin >> x >> y >> c;
		tb[(x%k)+1][(y%k)+1][(c=='B')?0:1]++;
	}
	for(i=1; i<=k; i++){
		for(j=0; j<=k; j++){
			tb[i][j][0] += tb[i-1][j][0];
			tb[i][j][1] += tb[i-1][j][1];
		}
	}
	for(i=0; i<=k; i++){
		for(j=1; j<=k; j++){
			tb[i][j][0] += tb[i][j-1][0];
			tb[i][j][1] += tb[i][j-1][1];
		}
	}
	k /= 2;
	for(i=1; i<=k; i++){
		for(j=1; j<=k; j++){
			a = 0;
			a += cnt(0,0,i,j,0);
			a += cnt(0,j,i,j+k,1);
			a += cnt(0,j+k,i,2*k,0);
			a += cnt(i,0,i+k,j,1);
			a += cnt(i,j,i+k,j+k,0);
			a += cnt(i,j+k,i+k,2*k,1);
			a += cnt(i+k,0,2*k,j,0);
			a += cnt(i+k,j,2*k,j+k,1);
			a += cnt(i+k,j+k,2*k,2*k,0);
			b = 0;
			b += cnt(0,0,i,j,1);
			b += cnt(0,j,i,j+k,0);
			b += cnt(0,j+k,i,2*k,1);
			b += cnt(i,0,i+k,j,0);
			b += cnt(i,j,i+k,j+k,1);
			b += cnt(i,j+k,i+k,2*k,0);
			b += cnt(i+k,0,2*k,j,1);
			b += cnt(i+k,j,2*k,j+k,0);
			b += cnt(i+k,j+k,2*k,2*k,1);
			ans = max(ans,max(a,b));
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 43264
#include<iostream>
using namespace std;
int main()
{
  char ch;
  cin>>ch;
  if(ch=='A'){
    ch = 'T';
  }else if(ch=='C'){
   ch = 'G'; 
  }else if(ch=='G'){
   ch = 'C';
  }else{
    ch = 'A';
  }
  cout<<ch<<"\n";
 return 0; 
}

Measured memory_bytes: 256
x, k, d = list(map(int,input().split()))

#最小に要する回数

px = x%d
mx = x%d - d

pc = abs(x - px) // d
mc = abs(x - mx) // d

if min(pc,mc) < k:
  if ( (k-pc) % 2) == 0:
    print( abs(px) )
  else:
    print( abs(mx) )
else:
  print( abs(x) - d * k )

Measured memory_bytes: 61668
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=[int(_) for _ in input().split()]
    cunt=0
    for a in A:
        if a==cunt+1:cunt+=1
    if 1 in A:
        if n==1 and A[0]==1:print(0)
        else:print(n-cunt)
    else:
        print(-1)
        

if __name__=='__main__':
    main()

Measured memory_bytes: 72400
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

const MOD: u64 = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        m: usize,
        aa: [usize;m]
    }
    let n = n+1;
    let mut v = vec![true;n];
    for a in aa {
        v[a] = false;
    }
    let mut dp = vec![0;n+1];
    dp[n-1] = 1u64;
    for i in (0..n-1).rev() {
        if v[i] {
            dp[i] = (dp[i+1] + dp[i+2]) % MOD;
        } else {
            dp[i] = 0;
        }
    }
    println!("{}", dp[0]);
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int dp[110][110];
int main() {
    int H, W; cin >> H >> W;
    vector<string> S(H); for (auto &s : S) cin >> s;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            dp[i][j] = 1e9;
        }
    }
    deque<tuple<int, int, int>> D;
    D.emplace_back(S[0][0] == '#', 0, 0);
    while (!D.empty()) {
        int val, i, j; tie(val, i, j) = D.front();
        D.pop_front();
        if (dp[i][j] <= val) continue;
        dp[i][j] = val;
        if (i + 1 < H) {
            if (S[i][j] == '.' && S[i + 1][j] == '#') {
                D.emplace_back(val + 1, i + 1, j);
            } else {
                D.emplace_front(val, i + 1, j);
            }
        }
        if (j + 1 < W) {
            if (S[i][j] == '.' && S[i][j + 1] == '#') {
                D.emplace_back(val + 1, i, j + 1);
            } else {
                D.emplace_front(val, i, j + 1);
            }
        }
    }
    cout << dp[H - 1][W - 1] << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.*;
public class Main {
	public static int[][] dp;
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int dataSetNumber = 1;
		while(true) {
			int W = stdIn.nextInt();
			if(W == 0) break;
			int N = stdIn.nextInt();
			int[] v = new int[N];
			int[] w = new int[N];
			for(int i = 0; i < N; i++) {
				String tmp = stdIn.next();
				String[] tmp2 = tmp.split(",");
				v[i] = Integer.parseInt(tmp2[0],10);
				w[i] = Integer.parseInt(tmp2[1],10);
			}
			dp = new int[N+1][W+1];
			
			for(int i = 1; i <= N; i++) {
				for(int j = 0; j <= W; j++) {
					if(j - w[i-1] >= 0) {
						int c1 = dp[i - 1][j];
						int c2 = dp[i-1][j - w[i-1]] + v[i-1];
						if(c1 < c2) {
							dp[i][j] = dp[i-1][j - w[i-1]] + v[i-1];
						}
						else {
							dp[i][j] = dp[i-1][j];
						}
					}
					else {
						dp[i][j] = dp[i-1][j];
					}
				}
			}
			System.out.println("Case " + dataSetNumber + ":");
			dataSetNumber++;
			System.out.println(dp[N][W]);
			int max = dp[N][W];
			for(int i = 0; i <= W; i++) {
				if(dp[N][i] == max) {
					System.out.println(i);
					break;
				}
			}
			
		}
		
		

	}

}

Measured memory_bytes: 29916
package main

import "fmt"
import "os"

func main(){
	var x , y int
    fmt.Scan(&x, &y)
    
    for i := 0; i <= x; i++ {
    
    	val := i * 2 + (x-i) * 4
        
		if val == y {
        	fmt.Println("Yes")
            os.Exit(0)
        }
    }
    fmt.Print("No")
}

Measured memory_bytes: 1840
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
int main()
{
	#define int long long
	int n;
	cin >> n;
	map <string , int> freq;
	vector <string> s(n);
	for(int i = 0; i < n; i++)
	{
		cin >> s[i];
		sort(s[i].begin(),s[i].end());
	}
	for(string x : s)
	{
		 freq[x]++;
	}
	int ans = 0;
	for(auto s : freq)
    {
    	int l = s.second;
    	ans += (l*(l-1))/2;
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 18176
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
    int n; cin>>n;
    vector<int> a(n);
    rep(i,0,n) cin>>a[i];
    int cnt=0;
    rep(i,0,n){
        if(a[i]==cnt+1){
            cnt++;
        }
    }
    if(cnt==0){
        cout<<-1<<endl;
        return 0;
    }
    cout<<n-cnt<<endl;

}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 8005
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (lli)(x.size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"YES\n";
#define N cout<<"NO\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;

lli s;
lli dp[S][S];
void solve()
{
    cin>>s;
    if(s<=2)
    {
        cout<<0;
        return;
    }
    lli len=(s/3);

    for(lli j=3;j<=s;j++)
    {
        dp[1][j]=1;
    }
    for(lli i=2;i<=len;i++)
    {
        for(lli j=3;j<=s;j++)
        {
                dp[i][j]=(dp[i-1][j-3])%M;
        }
        for(lli j=3;j<=s;j++)
        {
                dp[i][j]=(dp[i][j]%M+dp[i][j-1]%M)%M;
        }
    }


    lli ans=0;

    for(lli i=1;i<=len;i++)
    {
        ans=ans%M+(dp[i][s])%M;
        ans=ans%M;
    }

    cout<<ans;

   





}



int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif
     // test
     {
        solve();
        nl
     }
    
}
//a+b=a?b+2?(a&b)
//__builtin_popcnt(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";

Measured memory_bytes: 16596
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

#define PMAX (1e8)+1

int main(){
    vector<bool> p(PMAX, true);
    p[0]=p[1]=false;
    for(int i=2; i*i<PMAX;i++){
        if(p[i]){
            for(int j=2;i*j<PMAX;j++)p[i*j]=false;
        }
    }

    int n,input,ans =0;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> input;
        if(p[input]) ++ans;
    }
    cout << ans << endl;
  return 0;
}

Measured memory_bytes: 14788
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	lint S;
	cin >> S;

	lint bi = 1'000'000'000;

	if(S!=bi*bi) cout << "0 0 1 " << bi << " " << S/bi + 1 << " " << bi - S%bi << "\n";
	else  cout << "0 0 1 " << bi << " " << bi << "  0" << "\n";

	return 0;
}

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

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}

void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 

#define pii pair<int,int >
#define vec vector<int >

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

#define data asd09123jdf02i3h

#define FOR(i,l,r) for(int i=l,i##_r=r;i<=i##_r;i++)

const int maxn = 1e6+10;
const int inf = 1e9;
const lf eps = 1e-8;
const int mod = 1e9+7;

char s[] = "-qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789";
int f[maxn],n;
int cnt=0;

int query(vector<char > &r) {
    // cnt++;if(cnt>850) while(1);
    printf("? ");
    for(int i=0;i<r.size();i++) putchar(r[i]);puts("");
    fflush(stdout);int x;read(x);return x;
}

vector<char > solve(int l,int r) {
    vector<char > res;
    if(l==r) {
        for(int i=1;i<=f[l];i++) res.pb(s[l]);
        return res;
    }
    int mid=(l+r)>>1;
    vector<char > ls=solve(l,mid),rs=solve(mid+1,r);
    int p=0,q=0;
    while(1) {
        if(q==rs.size()) {
            if(p==ls.size()) break;
            res.pb(ls[p++]);
        } else if(p==ls.size()) res.pb(rs[q++]);
        else {
            res.pb(ls[p++]);
            vector<char > re=res;
            for(int i=q;i<rs.size();i++) re.pb(rs[i]);
            if(query(re)!=n-re.size()) res.pop_back(),res.pb(rs[q++]),p--;
        }
    }
    // printf("debug :: %d %d\n",l,r);
    // for(int i=0;i<res.size();i++) putchar(res[i]);puts("");
    return res;
}

int main() {
    int b=62;
    for(int i=1;i<=b;i++) {
        vector<char > r;
        for(int j=1;j<=128;j++) r.pb(s[i]);
        f[i]=128-query(r);n+=f[i];
    }
    vector<char > ans=solve(1,b);
    printf("! ");
    for(int i=0;i<ans.size();i++) putchar(ans[i]);puts("");
    fflush(stdout);
    return 0;
}


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

inline int rd() {
  int x = 0;
  bool f = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + (c ^ 48);
    c = getchar();
  }
  return f ? -x : x;
}

inline ll fpow(ll x, ll t) {
  ll res = 1;
  for (;t; t >>= 1) {
    if (t & 1) res = res * x % mod;
    x = x * x % mod;
  }
  return res;
}

int main() {
  int n = rd();
  if (n == 1) {puts("0"); return 0;}
  ll res = fpow(10, n);
  ll tmp = (fpow(9, n) * 2 - fpow(8, n) + mod)% mod;
  res = (res - tmp + mod) % mod;
  printf("%lld\n", res);
	return 0;
}


Measured memory_bytes: 3760
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

typedef struct{
  int h,p,q;
}Date;



void bubbleSort(Date A[],int N){
  bool flag=1;

  for(int i=0;flag;i++){
    flag=0;
    for(int j=N-1;j>i;j--){
      if(A[j].h>A[j-1].h){
	swap(A[j],A[j-1]);
	flag=1;
      }
    }
  }
 
}


int main(){
  int n,m,a;
  Date line[1000];  
  while(1){
    cin>>n>>m>>a;
    if(n+m+a==0)break;

    for(int i=0;i<m;i++) cin>>line[i].h>>line[i].p>>line[i].q;

    bubbleSort(line,m);
    
    // for(int i=0;i<m;i++) cout<<endl<<line[i].h<<" "<<line[i].q<<endl;
    
    for(int i=0;i<m;i++){
      if(a==line[i].p) a=line[i].q;
      else if(a==line[i].q)a=line[i].p;
    }

    cout<<a<<endl;
    for(int i=0;i<m;i++) line[i].h=line[i].p=line[i].q=0;   
  }
  return 0;
}

Measured memory_bytes: 1172
#include <iostream>
#include <vector>

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

struct Edge{
    int from,to,weight;
    Edge(int f,int t,int w) : from(f), to(t), weight(w){}
};

using Edges = vector<Edge>;
using Graph = vector<Edges>;

class Tree{
    public:
        Tree(int size) : mGraph(size) {}
        void add_edge(int s, int t, int w = 1){
            mGraph[s].emplace_back(s,t,w);
            mGraph[t].emplace_back(t,s,w);
        }

        // diameter of a tree
        pair<int,int> dfs(int v, int pv){
            pair<int,int> ret(0,v);
            for(Edge nv : mGraph[v]){
                if(nv.to == pv) continue;
                pair<int,int> tmp = dfs(nv.to,v);
                if(chmax(ret.first,tmp.first + nv.weight)){
                    ret.second = tmp.second;
                }
            }
            return ret;
        }

        int diameter(){
            pair<int,int> s = dfs(0,-1);
            pair<int,int> t = dfs(s.second,-1);
            return t.first;
        }
        //
    private:
        Graph mGraph;
};

int main(){
    int n,s,t,w;
    cin >> n;
    Tree tree(n);
    for(int i = 0; i < n-1; ++i){
        cin >> s >> t >> w;
        tree.add_edge(s,t,w);
    }
    cout << tree.diameter() << '\n';
    return 0;
}


Measured memory_bytes: 12268
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
int main(){
  int h,w;
  cin>>h>>w;
  int x,y;
  cin>>x>>y;
  cout<<((double)h*w)/2<<" ";
  cout<<(x*2==h&&y*2==w?1:0)<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int N;
int num=0;
vector<int> botan;
int cnt=2;

void solve(){
    cin>>N;
    botan.push_back(0);
    for(int i=1;i<=N;i++){
        int ai;
        cin>>ai;
        botan.push_back(ai);

    }
//cout<<botan[3]<<endl;;
    if(botan[1]==2){cout<<1<<endl;return;}
    num=botan[1];
    while(cnt<N){
        if(botan[num]==2){cout<<cnt<<endl;return;}
        num=botan[num];
        cnt++;
    }
    cout<<-1<<endl;
    
}
int main(){
    solve();

    return 0;
}

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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define uniqueV(x)                                                             \
  sort(x.begin(), x.end());                                                    \
  x.erase(unique(x.begin(), x.end()), x.end());
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y)                                                           \
  cerr << "(" << #x << ", " << #y << ") = "                                    \
       << "(" << x << ", " << y << ")" << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

// ----------------------------------------------

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

  int n;
  cin >> n;
  vector<int> v(n);
  rep(i, n) { cin >> v[i]; }

  vector<int> a;

  rep(i, n) {
    a.push_back(v[i] - 1);
    a.push_back(v[i]);
    a.push_back(v[i] + 1);
  }
  sort(all(a));
  int as = a.size();

  int k = 0;
  int ans = 0;
  rep(i, as) {
    if (a[i] == a[i + 1]) {
      k++;
    } else {
      ans = max(ans, k);
      k = 0;
    }
  }

  cout << ans + 1 << endl;

  return 0;
}

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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    if(n == 2){
        cout << s << endl;
    }else{
        for(int i = 0; i < 3; i++){
            cout << s[2-i];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	Info(){
		to = dist = cost = 0;
	}

	bool operator<(const struct Info &arg) const{
		return dist > arg.dist;
	};
	Info(int arg_to,int arg_dist,int arg_cost){
		to = arg_to;
		dist = arg_dist;
		cost = arg_cost;
	}

	int to,dist,cost;
};

int N,M,min_dist[10001],min_cost[10001];

vector<Info> V[10001];

void func(){

	for(int i = 1; i <= N; i++){
		V[i].clear();
		min_dist[i] = BIG_NUM;
		min_cost[i] = BIG_NUM;
	}

	int from,to,dist,cost;

	for(int i = 0; i < M; i++){
		scanf("%d %d %d %d",&from,&to,&dist,&cost);
		V[from].push_back(Info(to,dist,cost));
		V[to].push_back(Info(from,dist,cost));
	}

	priority_queue<Info> Q;

	min_dist[1] = 0;
	min_cost[1] = 0;

	for(int i = 0; i < V[1].size(); i++){
		min_dist[V[1][i].to] = V[1][i].dist;
		min_cost[V[1][i].to] = V[1][i].cost;
		Q.push(Info(V[1][i].to,V[1][i].dist,V[1][i].cost));
	}

	int min_index;

	while(!Q.empty()){

		if(Q.top().dist > min_dist[Q.top().to]){
			Q.pop();
		}else{
			min_index = Q.top().to;
			Q.pop();

			for(int i = 0; i < V[min_index].size(); i++){
				if(min_dist[V[min_index][i].to] > min_dist[min_index]+V[min_index][i].dist){
					min_dist[V[min_index][i].to] = min_dist[min_index]+V[min_index][i].dist;
					min_cost[V[min_index][i].to] = V[min_index][i].cost;
					Q.push(Info(V[min_index][i].to,min_dist[V[min_index][i].to],min_cost[V[min_index][i].to]));
				}else if(min_dist[V[min_index][i].to] == min_dist[min_index]+V[min_index][i].dist && min_cost[V[min_index][i].to] > V[min_index][i].cost){
					min_cost[V[min_index][i].to] = V[min_index][i].cost;
				}
			}
		}
	}

	int ans = 0;

	for(int i = 2; i <= N; i++)ans += min_cost[i];

	printf("%d\n",ans);

}

int main(){

	while(true){
		scanf("%d %d",&N,&M);
		if(N == 0 && M == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 5156
(defun kaibunp (str)
  (string= str (reverse str))
  )

(defun solve (str)
  (let ((n (/ (1- (length str)) 2)))
    (and (kaibunp str)
	 (kaibunp (subseq str (1+ n)))
	 (kaibunp (subseq str 0 n))
	 )
    ;(princ (subseq str (1+ n)))
    ;(princ (subseq str (1+ n)))
    ))

(princ (if (solve (read-line)) "Yes" "No"))

Measured memory_bytes: 11488
#include <iostream>
#include <stdio.h>
#include <vector>

const double PI=3.14159265358979323846;

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  int ans = n, now = 1;
  rep(i,n){
    if(a[i] == now){
      ans--, now++;
    }
  }
  if(ans == n){
    cout << -1 << endl;
    return 0;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#%%
n = int(input())
a = list(input())
b = list(input())
c = list(input())


x=0

for i in range(len(a)):
    tmp = []
    tmp.append(a[i])
    tmp.append(b[i])
    tmp.append(c[i])
 
    d = len(list(set(tmp)))
    if d == 1:
        pass
    elif d == 2:
        x += 1
    else:
        x += 2

print(x)

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

int main(){

    int N, M;
    cin >> N >> M ;
    int  like_list[M];
    for(int i=0; i<M; i++){
        like_list[i] = 0;
    }  
    for(int i=0; i<N; i++){
        int k_i;
        cin >> k_i;
        for(int j=0; j<k_i; j++){
            int aij;
            cin >> aij;
            like_list[aij-1]++;
        }
    }
    int count = 0;
    for(int i=0; i<M; i++){
        if(like_list[i] == N){
            count ++ ;
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
// itne me hi thakk gaye?
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("-O3")
#define ll long long 
#define ull unsigned long long
using ld = long double;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ll rk = 256;
const ll mod2 = 998244353;
const ld PI = 3.141592653589793;
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define print(a) for(auto j:a) {cout<<j<<",";} cout << "\n";
#define endl '\n'
#define whatis(x) cout << "> "<<#x << " ==> " << x << endl;
#define lwi(x) cout << " your " << #x << " is ---> " << x << " ";
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
// // Printing pair
ostream & operator << (ostream & os, pair <ll, ll> const& x) {
    os << x.first << "," << x.second;
    return os;
}
 
// printing vector
template <class T>
ostream & operator << (ostream & os, vector <T> const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
// printing set
template <class T>
ostream & operator << (ostream & os, set <T> const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << "]" ;
}
const int mxn = 1e6+5;
int32_t main(){
    FastIO;
    ll a, b, v, w, t;
    cin >> a >> v >> b >> w >> t;
    if (a == b) cout << "YES\n";
    else {
        if(b < a) swap(a, b);
        if (w >= v) cout << "NO\n";
        else {
            ll d1 = v*t;
            ll d2 = w*t;
            if (d1 >= d2 + b-a) cout << "YES\n";
            else cout << "NO\n"; 
        } 
    }
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
 
  if (A+B == C+D) {
    cout << "Balanced" << endl;
  }
  
  else if (A+B < C+D){
    cout << "Right" << endl;
  }
  
  else
    cout << "Left" << endl;
}

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


int main(void){

int a [100];
int b [100];
int ans [100];
int c =0;
string op [100];

cin >> a[c] >> op[c] >>b[c];
while(op[c] != "?"){
    
    if(op[c] == "+"){
        ans[c] = a[c] + b[c];
    }
     if(op[c] == "-"){
        ans[c] = a[c] - b[c];
    }
     if(op[c] == "*"){
        ans[c] = a[c] * b[c];
    }
     if(op[c] == "/"){
        ans[c] = a[c] / b[c];
    }
     cout << ans[c] << endl;
     c++;
     cin >> a[c] >> op[c] >>b[c];

}
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (int)1e9 //10^9:∞
#define LLINF (long long)1e12
#define MOD (int)1e9+7 //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>
#define endl "\n"
#define DDD fixed<<setprecision(10)

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/

int N, Q;
vector<int> G[200005];
vector<int> ans(200005);
/*.....................DEFINE FUNCTIONS ......................*/
void dfs(int v, int p = -1) {

	for (int u : G[v]) {
		if (u == p)continue;
		ans[u] += ans[v];
		dfs(u, v);
	}

	return ;
}


/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__

	cin >> N >> Q;

	REP(i, N - 1) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	REP(i, Q) {
		int p, x;
		cin >> p >> x;
		p--;
		ans[p] += x;
	}
	dfs(0);

	REP(i, N) {
		cout << ans.at(i) << endl;
	}


	return 0;
}


Measured memory_bytes: 24260
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MAXN 200010
#define MAXS 1000010
using namespace std;

int read(){
	char c;
	while(((c=getchar())<'0' || c>'9') && c!='-');
	int flag=1;
	int res=c-'0';
	if(c=='-'){
		flag=-1;
		res=0;
	}
	while((c=getchar())>='0' && c<='9') res=res*10+c-'0';
	return res*flag;
}

int n,m,v0,maxs;
int a[MAXN];
int lim[MAXN];
int f1[MAXS],f2[MAXS];
int p[20][MAXN][2];

void calcP(int l){
	int last=1;
	for(int i=1;i<=n;i++){
		if(i==n || a[i+1]-a[i]>lim[l]){
			for(int j=last;j<=i;j++){
				p[l][j][0]=last;
				p[l][j][1]=i;
			}
			last=i+1;
		}
	}
	p[l][0][0]=1;
	p[l][n+1][1]=n;
}

void dp(){
	f1[0]=0; f2[0]=n+1;
	for(int s=1;s<maxs;s++){
		f2[s]=n+1;
		for(int i=1,l=1;i<=m;i++,l<<=1)
			if(s&l){
				f1[s]=max(f1[s],p[i][f1[s^l]+1][1]);
				f2[s]=min(f2[s],p[i][f2[s^l]-1][0]);
			}
	}
}

namespace Fenwick{
	int c[MAXN];

	void init(){ memset(c,-1,sizeof c); }

	void insert(int x,int y){
		x++;
		while(x<=n+2){
			c[x]=max(c[x],y);
			x+=x&(-x);
		}
	}

	int getmax(int x){
		x++;
		int res=-1;
		while(x){
			res=max(res,c[x]);
			x-=x&(-x);
		}
		return res;
	}
}

int main(){
#ifdef DEBUG
	freopen("g012e.in","r",stdin);
#endif
	n=read(); v0=read();
	for(int i=1;i<=n;i++) a[i]=read();
	lim[0]=v0;
	while(v0) lim[++m]=(v0/=2);
	maxs=1<<m;
	for(int i=0;i<=m;i++) calcP(i);
	dp();
	Fenwick::init();
	for(int i=0;i<maxs;i++)
		Fenwick::insert(f2[i],f1[(maxs-1)^i]);
	for(int i=1;i<=n;i++)
		if(p[0][i][0]==i){
			int res=Fenwick::getmax(p[0][i][1]+1);
			if(res>=i-1)
				for(int j=p[0][i][0];j<=p[0][i][1];j++)
					puts("Possible");
			else
				for(int j=p[0][i][0];j<=p[0][i][1];j++)
					puts("Impossible");
		}
	return 0;
}


Measured memory_bytes: 43776
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define PI 3.14159265
#define seive_len 1000001

bool seive[seive_len];
int primeSeive[seive_len];

typedef long long int lli;

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

lli lcm(lli a, lli b) {
  lli gcd_ = gcd(a, b);
  lli lcm_ = (a*b)/gcd_;
  return lcm_;
}

lli fastPower(lli a, lli b) {
  lli res=1;
  while(b > 0) {
    if(b&1)
      res *= a;
    a *= a;
    b >>= 1;
  }
  return res;
}

lli fastPowerM(lli a, lli b, lli mod) {
  a %= mod;
  lli res = 1;
  while(b) {
    if(b%2 == 1)
      res = (res*a)%mod;
    a = (a*a)%mod;
    b >>= 1;
  }
  return res;
}

void multiply(lli a[][2], lli b[][2], int mod) {
  int res[2][2];
  memset(res, 0, sizeof(res));
  for(int i=0;i<2;i++) {
    for(int j=0;j<2;j++) {
      for(int k=0;k<2;k++) {
        res[i][j] += a[i][k]*b[k][j]%mod;
      }
    }
  }
  for(int i=0;i<2;i++)
    for(int j=0;j<2;j++)
      a[i][j] = res[i][j];
}

void matrixExpo(lli a[][2], lli n, int mod) {
  if(n == 0 || n == 1)
    return;
  lli b[][2] = {{1,1}, {1,0}};
  matrixExpo(a, n/2, mod);
  multiply(a, a, mod);
  if(n%2)
    multiply(a, b, mod);
}

void makeSeive() {
  for(int i=2;i*i<=seive_len;i++) {
    if(seive[i]) {
      for(int j=i*i;j<=seive_len;j+=i)
        seive[j] = false;
    }
  }
}

void makePrimeSeive() {
  for(int i=1;i<seive_len;i++)
    primeSeive[i] = i;
  for(int i=4;i<seive_len;i+=2)
    primeSeive[i] = 2;
  for(int i=3;i*i<seive_len;i++) {
    if(primeSeive[i] == i) {
      for(int j=i*i;j<seive_len;j+=i) {
        if(primeSeive[j] == j)
          primeSeive[j] = i;
      }
    }
  }
}

bool isPrime(lli n) {
  for(int i=2;i<=sqrt(n);i++) {
    if(n%i == 0)
      return false;
  }
  return true;
}

void getInput(vector<lli>& a, int n) {
  lli x;
  for(int i=0;i<n;i++) {
    cin >> x;
    a.push_back(x);
  }
}

void replaceSpace(string& s) {
  for(int i=0;s[i];i++) {
    if(s[i] == ' ')
      s.replace(i, 1, "%20");
  }
}


void testCase() {
  lli i, n;
  cin >> n;
  vector<lli> a;
  getInput(a, n);
  vector<lli> b(n-1);
  lli sum = 0;
  for(i=n-1;i>=1;i--) {
    sum += a[i];
    b[i-1] = sum%MOD;
  }
  lli res = 0;
  for(i=0;i<n-1;i++) {
    res += ((lli)(a[i]%MOD*b[i]%MOD)%MOD);
    res %= MOD;
  }
  cout << res;
}

int main() {
	int t=1;
	// cin >> t;
  // makePrimeSeive();
  // FILE* fp;
  // fp = fopen("out.txt", "w");
	for(int i=1;i<=t;i++) {
    // fprintf(fp, "Case #%d:\n", i);
    // cout << "Case #" << i << ":" << ' ';
		testCase();
    cout << '\n';
	}
	return 0;
}

Measured memory_bytes: 6432
import java.math.BigDecimal;
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		BigDecimal a = new BigDecimal(scan.next());
		BigDecimal b = new BigDecimal(scan.next());
		BigDecimal tmp = a.multiply(b);
		long ans = tmp.longValue();
		System.out.print(ans);


	}
}

Measured memory_bytes: 35972
using System;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var str = cin.ReadLine.Replace("\n", "");

            var len = str.Length;

            var min = int.MaxValue;
            for (int index = 0; index < len - 2; index++)
            {
                min = Min(Abs(753 - int.Parse(str.Substring(index, 3))), min);
            }
            Console.WriteLine(min);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        public double[] ReadDoubleArray(long N) { var ret = new double[N]; for (long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,N) for(ll i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll n;

int main(){
    cin >> n;
    vector<ll> v(3*n);
    rep(i,3*n)cin >> v[i];
    sort(ALL(v));
    reverse(ALL(v));
    ll ans = 0;
    rep(i,n)ans += v[2*i+1];
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <math.h>
#include <cstdlib>
#include <string>
#include <stdio.h>
using namespace std;
int main(){
  double r;
  double s,l;
  cin >> r;
  s=r*r*M_PI;
  l=2*r*M_PI;
  printf("%.6lf %.6lf\n", s,l);


}



Measured memory_bytes: 3196
#include<cstdio>
#include<cstring>
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<string>
#include<cmath>
#include<algorithm>
#include<complex>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef pair<int,int> pa;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
int n,a[66],b[66];
LL ans;
bool c[66][66][66],v[66][66][66];
int main(){
	cin>>n;
	FOR(i,1,n) getint(a[i]);
	FOR(i,1,n) getint(b[i]);
	FOR(i,0,50) c[0][i][i]=1;
	FOR(i,1,50){
		FOR(j,0,50)
			FOR(k,0,50)
				c[i][j][k]=c[i-1][j][k]|c[i-1][j%i][k];
	}
	
	bool GG=0;
	FOR(i,1,n)
		if (!c[50][a[i]][b[i]]) GG=1;
	if (GG) return puts("-1"),0;
	
	FOR(i,1,n) v[51][i][a[i]]=1;
	FORD(i,50,1){
		bool gg=0;
		FOR(j,1,n){
			bool ok=0;
			FOR(k,0,50)
				if (v[i+1][j][k]){
					if (c[i-1][k][b[j]]) ok=1;
				}
			if (!ok) gg=1;
		}
		if (!gg){
			FOR(j,1,n)
				FOR(k,0,50)
					v[i][j][k]=v[i+1][j][k];
		}
		else{
			ans+=1ll<<i;
			FOR(j,1,n)
				FOR(k,0,50)
					if (v[i+1][j][k]){
						v[i][j][k%i]=1;
						v[i][j][k]=1;
					}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using piii = pair<pii, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int T;
    cin >> T;
    for (int i = 0; i < T; ++i) {
        int N, M, A, B;
        cin >> N >> M >> A >> B;
        cout << floor_sum(N, M, A, B) << '\n';
    }

    return 0;
}


Measured memory_bytes: 3644
n, m = map(int, input().split())
E0 = [frozenset(map(int, input().split())) for _ in range(m)]
E = set(E0)
ans = 0

for e in E0:
    e = list(e)
    v0, v = e[0], e[1]

    now_path = [v0]
    branches = []
    history = {v0}

    for _ in range(n):
        branch_pts = [w for w in range(1, n+1) if
                      frozenset([now_path[-1], w]) in E and
                      frozenset([now_path[-1], w]) != frozenset(e) and
                      w not in history]
        if v in branch_pts:
            break
        branches.extend([(len(now_path)-1, w) for w in branch_pts])
        history |= set(branch_pts)
        if not branches:
            ans += 1
            break
        branch = branches.pop(-1)
        now_path = now_path[:branch[0]+1]
        now_path.append(branch[1])

print(ans)


Measured memory_bytes: 3064
use std::io;
use std::iter::Iterator;

fn read<T: std::str::FromStr>() -> Vec<T> {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().split(' ').flat_map(str::parse).collect()
}

fn main() {
    let l1 = read::<i32>();

    let a = l1[0];
    let b = l1[1];

    let d = a / b;
    let r = a % b;
    let f = a as f64 / b as f64;

    println!("{} {} {}", d, r, f);
}



Measured memory_bytes: 5048
#include <bits/stdc++.h>
using namespace std;
 
#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	string s;
  int N;
  cin >> N;
  map<string,int> a;
  froop1(0,N){
    cin >> s;
    if(!a.count(s)){
      a[s] = 1;
    }
  }
  int count = 0;
  for(pair<string,int> p : a){
    count++;
  }
  cout << count << endl;
  
}

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

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;


int main(){
  long ii,jj,kk;
  vector<int> a;
  set<int> s;
  int q,c,x;

  cin >> q;
  set<int>::iterator it;
  for(ii=0;ii<q;ii++){
    cin >> c >> x;
    if(c == 0){
      s.insert(x);
      cout << s.size() << endl;
    }
    else{
      it = s.find(x);
      if(it != s.end()){
        cout << 1 << endl;
      }
      else{
        cout << 0 << endl;
      }
    }
  }
  
  return 0;
}



Measured memory_bytes: 12496
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long ans;
    cin >> ans;
    bool notsolved = true;
    for(int i = -120; i<120&&notsolved; i++){
        for(int j = -120; j<120&&notsolved; j++){
            if(pow(i,5)-pow(j,5)==ans){
                cout << i << " " << j;
                notsolved = false;
            }
        }
    }
}

Measured memory_bytes: 4100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i< (n); i++)
using ll = long long;
using P = pair<int, int>;
int main(){
    int const k = 1000;
    int x;
    P p;
    cin >> x;
    for(int i = -k; i <k; i++){
        for(int j = -k; j <k; j++){
            if (pow(i,5) - pow(j,5) == x){
                p.first = i;
                p.second = j;
                break;
            }
            
        }
    }
    cout << p.first << " " << p.second << endl;
    
return 0;
}

Measured memory_bytes: 4028
#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

#define str to_string
#define rep(i, n) for (int i=1; i<int(n); i++)
#define all(c) (c).begin(), (c).end()


int main() {
  rep(i, 10) rep(j, 10) cout << i << "x"<<j<<"="<<i*j<<"\n";
  return 0;
}

Measured memory_bytes: 1108
#include <bits/stdc++.h>
#include <vector> 
#include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;
const int mod = 1e9+7;

signed main(){
    int n;
    string s;
    cin >> n >> s;
    s+=s;
    bool f = false;
    int x[4] = {0,1,0,1};
    int y[4] = {1,0,0,1};
    int exp[4] = {1,1,0,0};
    int a[n+2];
    rep(p,4) {
        a[0]=x[p];
        a[1]=y[p];
       // cout << a[0] << flush;
        FOR(i,1,n+2) {
            if(s[i]=='o') {
                if(a[i]==0) a[i+1]=a[i-1];
                else a[i+1] = (a[i-1]+1)%2;
            }
            if(s[i]=='x') {
                if(a[i]==0) a[i+1]=(a[i-1]+1)%2;
                else a[i+1] = a[i-1];
            }
            //cout << a[i] << flush;
        }
       // cout << a[n] << endl;
        if(s[0]=='x') {
            exp[p]++;
            exp[p]%=2;
        } 

        if(a[0]==a[n]&&a[1]==a[n+1]){
            rep(i,n) {
            if(a[i]==0) cout << "S" << flush;
            else cout << "W" << flush;
            }
            cout << "" << endl;
            return 0;
        }
    }
    if(!f) cout << -1 << endl;
    else {
        rep(i,n) {
            if(a[i]==0) cout << "S" << flush;
            else cout << "W" << flush;
        }
    cout << "" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 4428