akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;


void main() {
    const long MAX = 3501;
    auto N = readln.chomp.to!long;

    foreach (b; 1..MAX) {
        foreach (c; 1..MAX) {
            long bunbo = 4 * b * c - b * N - c * N;
            long bunsi = b * c * N;
            if (bunbo <= 0 || bunsi % bunbo != 0)
                continue;
            long a = bunsi / bunbo;
            writeln(a, " ", b, " ", c);
            return;
        }
    }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    string s;
    int scount = 0;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        if(i != s.size()) {
            if (s[i] == s[i + 1]) {
                if (s[i + 1] == '1') {
                    s[i + 1] = '0';
                    scount++;
                } else {
                    s[i + 1] = '1';
                    scount++;
                }
            }
        }
    }
    cout << scount;
    return 0;
}

Measured memory_bytes: 512
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(v) v.begin(), v.end()


int main() {
    int n;
    cin >> n;
    
    long long sum = 0;
    for(int i = 1; i<=n; i++){
        if(i%3 != 0 && i%5 != 0) sum += i;
    }
    
    dunk(sum);
}



Measured memory_bytes: 3636
#%%
s = input()
n = len(s)

if n < 2:
    print(0)

else:
    ans, i = 0, 0
    rem = []

    while i < n:

        if not rem:

            if i+1 < n:
                if s[i] == s[i+1]:
                    rem.append(s[i])
                    i += 1

                else:
                    i += 2
                    ans += 2

            else:
                i += 1

        else:
            if rem[-1] != s[i]:
                rem.pop()
                i += 1
                ans += 2
            
            else:
                if i + 1 < n:
                    if s[i] == s[i+1]:
                        rem.append(s[i])
                        i += 1

                    else:
                        i += 2
                        ans += 2

                else:
                    i += 1
    print(ans)


Measured memory_bytes: 3964
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int[] c = new int[a*2-1];
        int d = b - a + 1;
        for(int i = 0;i < c.length; i++){
            c[i] = d;
            d++;
        } 
        for(int i = 0; i < c.length;i++){
            if(i != 0){
                System.out.print(" ");
            }
            System.out.print(c[i]);
        }
    }
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    int a,b;
    cin>>a>>b;
    if(abs(a-b)%2==0){
        cout<<abs(a-b)/2+min(a,b);
    }
    else cout<<"IMPOSSIBLE";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const double pi=3.14159265358979323846;
int main()
{
	double a,b,h,m,anm,anh,ans;
	cin>>a>>b>>h>>m;
	anm=360*m/60;
	anh=360*h/12;
	ans=anm-anh-anm/12;
	if(ans<0)
		ans+=360;
	cout<<fixed<<setprecision(10)<<sqrt(a*a+b*b-2*a*b*cos(ans/180*pi));
	return 0;
}

Measured memory_bytes: 4224
#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() {
  ll x, k, d;
  cin >> x >> k >> d;
  x = abs(x);
  
  ll ans;
  if (x/d > k) {
    ans = x - d*k;
  } else {
    ll e = x/d;
    k -= e;
    x -= e*d;
    if (k%2 == 1) x = abs(x-d);
    ans = x;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define inf 10000000000000007
#define MOD 1000000007
#define x first
#define y second
#define ll long long
#define ii pair<ll, ll>
#define vi vector<ll>
#define vii vector<ii>
#define pb push_back
#define ubnd upper_bound
#define lbnd lower_bound
#define mp make_pair
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N = 2e5 + 5;
ll n, k;
ll dp[N][55];
ll A[N], B[N], C[N];

int main()
{
 //   ios
  //  freopen("in.txt", "r", stdin);
  //  freopen("out.txt", "w", stdout);
    ll i ,j , ans=0, a,  c, d,b, p=0,z;
    cin>>k;
    for(i=1; i<=k; i++)
        cin>>C[i];
    A[k]= 2;
    B[k]= 2;

    for(i=k; i>=1; i--){
        if(B[i]/C[i] == (A[i]-1)/C[i]){
            cout<<-1;
            return 0;
        }
        A[i-1] = (A[i] + C[i]-1)/C[i]*C[i];
        B[i-1] = B[i] - B[i]%C[i] + C[i]-1;
    }
    cout<<A[0]<<" "<<B[0];
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  int n;cin>>n;
  vector<vector<int>> vec(n,vector<int>(n,-1));
  rep(i,n){
    int a;cin>>a;
    rep(j,a){
      int x,y;cin>>x>>y;
      x--;
      vec[i][x]=y;
    }
  }
  int ans=0;
  rep(bit,1<<n){
    vector<int> d(n);
    rep(i,n)if(bit&(1<<i))d[i]=1;
    bool ok=true;
    rep(i,n)if(d[i]){
      rep(j,n){
        if(vec[i][j]==-1)continue;
        if(vec[i][j]!=d[j])ok=false;
      }
    }
    if(ok)ans=max(ans,__builtin_popcount(bit));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define endl '\n'
#define PI 3.14159265358979323844
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define mp make_pair
#define pb push_back
#define int long long int 
#define forr(i,a,b) for (int i= a; i <b; ++i)
    using namespace std; 
   int a[100001][4];
   int dp[100004][3];
   int maxifuc(int n , int pos){
       if(n==0)return a[n][pos];
       if(dp[n][pos]!=-1)return dp[n][pos];
       if(pos==0){
           dp[n][0]= max(maxifuc(n-1,1)+a[n][0],maxifuc(n-1,2)+a[n][0]);
        
       }
       if(pos==1){
       dp[n][1]= max(maxifuc(n-1,0)+a[n][1],maxifuc(n-1,2)+a[n][1]);}
       if(pos==2){
       dp[n][2]= max(maxifuc(n-1,0)+a[n][2],maxifuc(n-1,1)+a[n][2]);}
         return dp[n][pos];  
           }
           
           
    signed main(){
     int n;cin>>n;
     memset(dp , -1 , sizeof dp);
    forr(i,0,n){
        forr(j,0,3)cin>>a[i][j];
    }
    cout<<  max( maxifuc(n-1,0), max(maxifuc(n-1,1),maxifuc(n-1,2)));}
      
        
        
        
       

Measured memory_bytes: 10368
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
struct C {
	int a, b, c;
} l[40010];
double ans[2];
int comp(const C& x, const C& y) {
	int xx = x.b * y.a;
	int yy = y.b * x.a;
	if (x.a * y.a < 0) {
		return xx > yy;
	} else {
		return xx < yy;
	}
}
int b[40010];
void add(int k) {
	while (k < 40010) {
		b[k]++;
		k += k & -k;
	}
}
int sum(int k) {
	int res = 0;
	while (k) {
		res += b[k];
		k -= k & -k;
	}
	return res;
}
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d%d%d", &l[i].a, &l[i].b, &l[i].c);
	}
	long long tot = n * (n - 1ll) / 2;
	long long h = tot / 2;
	for (int z = 0; z < 2; z++) {
		sort(l, l + n, comp);
		double lo = -1e12, hi = 1e12;
		for (int k = 0; k < 100; k++) {
			if (hi - lo < 1e-10) break;
			double mid = (lo + hi) / 2;
			vector<pair<double, int> > s;
			long long e = 0;
			for (int i = 0; i < n; i++) {
				double f = (l[i].c - l[i].b * mid) / l[i].a;
				s.push_back((make_pair(f, i + 1)));
			}
			sort(s.begin(), s.end());
			for (int i = 1; i <= n; i++) {
				b[i] = 0;
			}
			for (int i = 0; i < n; i++) {
				e += sum(s[i].second);
				add(s[i].second);
			}
			if (e <= h) {
				hi = mid;
			} else {
				lo = mid;
			}
		}
		ans[z] = lo;
		for (int i = 0; i < n; i++) {
			swap(l[i].a, l[i].b);
		}
	}
	printf("%.12f %.12f\n", ans[1], ans[0]);
	return 0;
}


Measured memory_bytes: 2568
import numpy as np
n = int(input())
a = np.array([list(map(int, input().split())) for i in range(n)])
a = a[np.argsort(a[:, 1])]
ans = "Yes"
k = 0
for i in range(len(a)):
    k += a[i,0]
    if k > a[i,1]:
        ans = "No"
        break
print(ans)

Measured memory_bytes: 62476
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define INF (int)1e9
#define INFL (ll)1e11
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	int n;
	cin >> n;

	vector<vector<int>> v(2, vector<int>(n / 2)), cnt(2, vector<int>(100000, 0));
	REP(i, n) {
		cin >> v[i % 2][i / 2];
		cnt[i % 2][v[i % 2][i / 2] - 1]++;
	}

	vector<int> max(2, 0), next(2, 0), max_id(2, 0), next_id(2, 0);
	REP(i, 2) {
		REP(j, 100000) {
			if (max[i] < cnt[i][j]) {
				next[i] = max[i];
				next_id[i] = max_id[i];
				max[i] = cnt[i][j];
				max_id[i] = j;
			}
			else if (next[i] < cnt[i][j]) {
				next[i] = cnt[i][j];
				next_id[i] = j;
			}
		}
	}

	int res = n - max[0] - max[1];
	if (max_id[0] == max_id[1]) res = min(n - max[0] - next[1], n - max[1] - next[0]);
	cout << res << "\n";

	//REP(i, 2) cout << max_id[i] << " " << next_id[i] << "\n";

	return 0;
}



Measured memory_bytes: 1852
#include <iostream>
#include <queue>
#include <algorithm>
#include <vector>
#define INF 10e8 
using namespace std;

int c,n,m,s,d;

int cost[101][101];
int state[101][11];
struct node{
	int c;  //cost
	int n;	//number
	int t;	//times
	bool operator >(node b)const{
    return c > b.c;
	}
};

int dijkstra(int s,int g){
	node start;
	start.c=0,start.n=s,start.t=c;
	priority_queue<node,vector<node>,greater<node> > q;
	q.push(start);
	while(!q.empty()){
		node cur=q.top();
		q.pop();
		if(cur.n == g){
			int ans=cur.c;
			return ans;
		}
		if(state[cur.n][cur.t]<=cur.c)
			continue;
		else
			state[cur.n][cur.t]=cur.c;
		for(int i=1;i<=n;i++){
			if(cur.n== i)
				continue;
			node next;
			if(cur.t > 0){
				next.c=cur.c+(cost[cur.n][i]/2);
				next.n=i;
				next.t=cur.t-1;
				q.push(next);
			}
			next.c=cur.c+cost[cur.n][i];
			next.n=i;
			next.t=cur.t;
			q.push(next);
		}
	} 
}
int main(void){
	while(cin >> c >> n >> m >> s >> d,c|n|m|s|d){
		for(int i=1;i<=n;i++)
			for(int j=0;j<=c;j++)
				state[i][j]=INF;
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++)
				cost[i][j]=INF;
		int a,b,f;
		for(int i=0;i<m;i++){
			cin >> a >> b >> f;
			cost[a][b]=cost[b][a]=f;
		}
		int ans=dijkstra(s,d);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 6332
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  string s;
  cin>>s;
  int ans=0,n=s.size();
  for(int k=0;k<n;k++){
    if(s[k]!='J') continue;
    int j=0,o=0,i=0;
    while(k<n&&s[k]=='J') k++,j++;
    while(k<n&&s[k]=='O') k++,o++;
    while(k<n&&s[k]=='I') k++,i++;
    //cout<<j<<" "<<o<<" "<<i<<endl;
    k--;
    if(o>j||o>i) continue;
    ans=max(ans,o);
  }
  cout<<ans<<endl;
  return 0;
}

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

vector<pair<int, int>>vec; int H, W, K, a[10009], col[109][109];

int main() {
	cin >> H >> W >> K;
	for (int i = 1; i <= K; i++) cin >> a[i];
	int cx = 1, cy = 1;
	while (cx <= H) {
		vec.push_back(make_pair(cx, cy));
		if (cx % 2 == 1) {
			if (cy == W) cx++;
			else cy++;
		}
		else {
			if (cy == 1) cx++;
			else cy--;
		}
	}
	int cnt = 0;
	for (int i = 1; i <= K; i++) {
		for (int j = 0; j < a[i]; j++) { col[vec[cnt].first][vec[cnt].second] = i; cnt++; }
	}
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			if (j >= 2)cout << " "; cout << col[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 640
import subprocess
import os
import time


import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

# input = sys.stdin.readline


def main():
    n = int(input())
    s = input()

    if n % 2:
        print('No')
        sys.exit()

    if s[0: int(n/2)] == s[int(n/2):]:
        print('Yes')
        sys.exit()

    print('No')


if __name__ == '__main__':
    main()

Measured memory_bytes: 4692
def Replacing():
    import sys
    input = sys.stdin.readline

    n = int(input())
    A = list(map(int,input().split()))
    q = int(input())
    
    total = sum(A) # これを基に各queryに対応(加算、減算)する
    
    l = [0 for i in range(10**5+1)] # 配列のインデックスを各valueとみなす
    for _ in A: # 各インデックスに各keyを加算
        l[_] += 1
    
    for i in range(q):
        b, c = map(int,input().split())
        total += c * l[b] # totalの調整のみ
        total -= b * l[b] # 同上
        print(total)
        l[c] += l[b] # ここでリストの更新
        l[b] = 0 # 同上

Replacing()


Measured memory_bytes: 20280
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<double> v(N);
    for(int i=0; i<N; i++){
        cin >> v.at(i);
    } 
    sort(v.begin(),v.end());
    double tmp=(v.at(0)+v.at(1))/2;
    for(int i=2; i<N; i++){
        tmp+=v.at(i);
        tmp/=2;
    }
    cout << tmp << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
A = 10 ** 15

for i in [1,-1]:
    B = 0
    C = 0
    for j in a:
        B += j
        if B * i <= 0:
            C += abs(B - i)
            B = i
        i *= -1
    A = min(A,C)
print(A)

Measured memory_bytes: 14212
/**
 * File              : D.cpp
 * Author            : JCHRYS <jchrys@me.com>
 * Date              : 12.01.2020
 * Last Modified Date: 12.01.2020
 * Last Modified By  : JCHRYS <jchrys@me.com>
 */

#include <bits/stdc++.h>
using namespace std;
int const MAXN = 20;
int const INF = 2e9;
int h, w;
char grid[MAXN][MAXN];
bool visit[MAXN][MAXN]{};
int f, r;
int Q[20000][3];  // y, x, dis
int dy[4] {-1, 1, 0, 0};
int dx[4] {0, 0, -1, 1};


bool is_valid(int y, int x) {
    return y >= 0 && y < h && x >= 0 && x < w && grid[y][x] == '.';
}

int get_min_move(int sy, int sx, int ey, int ex) {
    f = r = 0;
    Q[r][0] = sy;
    Q[r][1] = sx;
    Q[r][2] = 0;// distance
    r++;
    memset(visit, 0, sizeof visit);
    while (f < r) {
        int y = Q[f][0];
        int x = Q[f][1];
        int d = Q[f][2];
        f++;
        if (!is_valid(y, x)) continue;
        if (visit[y][x]) continue;
        if (y == ey && x == ex) {
            return d;
        }
        visit[y][x] = true;
        for (int i = 0; i < 4; i++) {
            int ny = y + dy[i];
            int nx = x + dx[i];
            int nd = d + 1;
            Q[r][0] = ny;
            Q[r][1] = nx;
            Q[r][2] = nd;
            r++;
        }
    }
    return -1;
}

int main() {
    cin >> h >> w;
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            cin >> grid[i][j];

    int ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            for (int y = 0; y < h; y++) {
                for (int x = 0; x < w; x++) {
                    if (grid[i][j] == '#' || grid[y][x] == '#') continue; 
                    ans = max(ans, get_min_move(i, j, y, x));
                }
            }
        }
    }
    
    cout << ans;
    return 0;
}


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

int main() {
	for (;;){
		string n1;
		cin >> n1;
		int m1 = 0, m2 = 0;
		if (cin.eof()) break;
		for (int i = 0; i < n1.size(); i++){
			if (n1[i] == 'J'){
				if (n1[i + 1] == 'O'){
					if (n1[i + 2] == 'I'){
						m1 += 1;
					}
				}
			}
			else if (n1[i] == 'I'){
				if (n1[i + 1] == 'O'){
					if (n1[i + 2] == 'I'){
						m2 += 1;
					}
				}
			}
		}
		cout << m1 << endl;
		cout << m2 << endl;
	}
	return 0;
}

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  rep(i, N - 2) {
    if (S.substr(i, 3) == "ABC") ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3536
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N; cin >> N;
    vector<int> A(N);
    REP(i, 0, N) cin >> A[i];

    int ans = 1 << 28;
    for (int i = -100; i <= 100; i++) {
        int sum = 0;
        REP(j, 0, N) {
            sum += pow(A[j] - i, 2);
        }
        ans = min(ans, sum);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int w[10],k[10],i,j,x,y;
	for(i=0;i<10;i++){
		scanf("%d",&w[i]);
	}
	for(i=0;i<10;i++){
		scanf("%d",&k[i]);
	}
	sort(w,w+10,greater<int>());
	sort(k,k+10,greater<int>());
	for(i=0;i<3;i++){
		x+=w[i];
		y+=k[i];
	}
	printf("%d %d\n",x,y);
	return 0;
}

Measured memory_bytes: 1040
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
int main() {
    ll a,b;
    cin >> a >> b;
    if (a*b==15){
        cout << "*" << endl;
        return 0;
    }else if (a+b==15){
        cout << "+" << endl;
        return 0;
    }
    cout << "x" << endl;
    return 0;
}


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

int main() {
  int N, M, A, sum = 0;
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    cin >> A;
    sum += A;
  }

  if (N > sum) {
    cout << N - sum << endl;
  } else if (N == sum) {
    cout << 0 << endl;
  } else {
    cout << -1 << endl;
  }
}

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

int main() {
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  
  if(a==0)
    cout << 1 << endl;
  else if(b==0)
    cout << 2 << endl;
  else if(c==0)
    cout << 3 << endl;
  else if(d==0)
    cout << 4 << endl;
  else if(e==0)
    cout << 5 << endl;
}

Measured memory_bytes: 3544
import math
a,b,c=map(int,input().split())
radc=c*math.pi/180
C=(a**2+b**2-2*a*b*math.cos(radc))**0.5
S=a*b*math.sin(radc)*0.5
h=2*S/a
print(S,a+b+C,h,sep='\n')


Measured memory_bytes: 5724
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, m) revi(i, m, 0)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  st S;
  ci(S);
  rep(bit, 1 << 3){
    int a = S.at(0) - 48;
    rep(i, 3){
      if(bit >> i & 1 == 1){
        a += S.at(i + 1) - 48;
      }
      else{
        a -= S.at(i + 1) - 48;
      }
    }
    if(a == 7){
      rep(i, 3){
        cout << S.at(i);
        if(bit >> i & 1 == 1){
          cout << '+';
        }
        else{
          cout << '-';
        }
      }
      cout << S.at(3) << "=7" << endl;
      rt;
    }
  }
}

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

void fnInput(int& rnShtHand, int& rnLngHand, int& rnHour, int& rnMinute)
{
  cin >> rnShtHand >> rnLngHand >> rnHour >> rnMinute;
}

double fnClockHandsDist(int nShtHand, int nLngHand, int nHour, int nMinute)
{
  static const double PI = 3.141592653589793;

  double nShtAngl = (nHour + (nMinute / 60.0)) / 12.0 * 2 * PI;
  double nLngAngl = (nMinute / 60.0) * 2 * PI;
  double nDiffAngl = abs(nShtAngl - nLngAngl);
  if (nDiffAngl > PI)
    nDiffAngl = 2 * PI - nDiffAngl;

  double nHandsDist = nShtHand * nShtHand + nLngHand * nLngHand 
                      - 2 * nShtHand * nLngHand * cos(nDiffAngl);
  return sqrt(nHandsDist);
}
  
int main()
{
  int nShtHand, nLngHand, nHour, nMinute;

  fnInput(nShtHand, nLngHand, nHour, nMinute);
  cout << fixed << setprecision(10) << fnClockHandsDist(nShtHand, nLngHand, nHour, nMinute);
  cout << endl;

  return 0;
}

Measured memory_bytes: 4116
import sys
input = sys.stdin.readline

a, b, c = map(int, input().split())
match = [a, b, c]
cnt = 0

for i in range(3):
    if match[i] == 5:
        cnt += 2
    elif match[i] == 7:
        cnt += 1

if cnt == 5:
    ans = 'YES'
else:
    ans = 'NO'

print(ans)


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
vector<long long> fact(2001,-1);
long long factr(long long n){
	if(fact[n]==-1) fact[n]=n*factr(n-1)%mod;
	return fact[n];
}
long long modpow(long long x, int n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res*x%mod;
    	x = x*x%mod;
        n >>= 1;
    }
    return res;
}
long long inv(long long n){
    return modpow(n,mod-2);
}
long long binom(long long n, long long r){
    long long top=1, bot=1;
	r=min(r,n-r);
    // for(long long i=0; i<r; ++i) top = top*(n-i) %mod;
    // for(long long i=r; i>1; --i) bot = bot*i %mod;
	top=factr(n);
	bot=factr(r)*factr(n-r)%mod;
    return top*inv(bot)%mod;
}
int main(){
	fact[0]=1;

	int n, k;
	cin >> n >> k; 
	for(int i=1; i<=k; ++i){
		long long ans=0;
		if(n-k+1>=i) ans=binom(n-k+1,i)*binom(k-1,i-1)%mod;
		cout << ans << endl;
	}
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
	int matrixa[100][100] = {};		//Value A
	int vectorb[100] = {};			//Value b
	int vectorc[100] = {};			//Answer
	int sum = 0;					//Calc temp
	int n, m = 0;					//matrix size
	int i, j = 0;

	scanf("%d %d", &n, &m);
	
	//Matrix Input.
	i = 0;
	while(i < n)
	{
		j = 0;
		while(j < m)
		{
			scanf("%d", &matrixa[i][j]);
			j++;
		}
		i++;
	}

	//Vector Input.
	j = 0;
	while(j < m)
	{
		scanf("%d", &vectorb[j]);
		j++;
	}

	//Multiplication.
	i = 0;
	while(i < n)
	{
		j = 0;
		while(j < m)
		{
			vectorc[i] += matrixa[i][j] * vectorb[j];
			j++;
		}
		i++;
	}

	//Display VectorC.
	j = 0;
	while(j < n)
	{
		printf("%d\n", vectorc[j]);
		j++;
	}

	return (0);

}



Measured memory_bytes: 2128
#include <iostream>
#include <vector>
#include <algorithm>

int keta_k(int n, int k)
{
	int keta = 0;
	while (n)
	{
		n /= k;
		keta++;
	}
	return keta;
}

int main()
{
	int N, K;
	std::cin >> N >> K;

	std::cout << keta_k(N, K);
}

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

using namespace std;
using ll = long long;

bool dfs(vector<vector<pair<int, int>>> &graph, vector<int> &vpos,
         vector<bool> &seen, int idx, int dist) {
  if (seen[idx]) {
    return vpos[idx] == dist;
  }

  seen[idx] = true;
  vpos[idx] = dist;
  return all_of(graph[idx].begin(), graph[idx].end(), [&](auto &node) {
    return dfs(graph, vpos, seen, node.first, dist + node.second);
  });
};

int main(int argc, const char *argv[]) {
  int n, m;
  cin >> n >> m;
  vector<vector<pair<int, int>>> graph(n);
  for (int i = 0; i < m; ++i) {
    ll l, r, d;
    cin >> l >> r >> d;
    l--, r--;
    graph[l].push_back({r, d});
    graph[r].push_back({l, -d});
  }

  vector<bool> seen(n, false);
  vector<int> vpos(n, -1);
  bool ans = true;
  for (int i = 0; i < n && ans; ++i) {
    if (!seen[i]) {
      vpos[i] = 0;
      ans = dfs(graph, vpos, seen, i, 0);
    }
  }

  cout << (ans ? "Yes" : "No") << '\n';

  return 0;
}

Measured memory_bytes: 16804
#include <iostream>
using namespace std;
typedef long long ll;
ll n, k, a[110000], b, res, ans, cou, c[110000];
int main(void){
    // Your code here!
    cin >> n >> k;
    for (ll i = 1; i <= n; i++) {
        cin >> b;
        res += (b > 0 ? b : 0);
        a[i] = a[i - 1] + (b < 0 ? b : 0);
        c[i] = c[i - 1] + (b > 0 ? b : 0);
    }
    for (ll i = 0; i <= n - k; i++) {
        if (i == 0) {
            ans = a[i + k] - a[i];
            cou = c[i + k] - c[i];
        } else {
            ans = max(ans, a[i + k] - a[i]);
            cou = min(cou, c[i + k] - c[i]);
        }
    }
    cout << max(res + ans, res - cou) << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>       // ヘッダファイルインクルード


std::vector<int> original_max(std::vector<int> &V) {

    int max_v = 0;
    int max_v_index = 0;
    int second_max_v = 0;
    int second_max_v_index = 0;

    for (int j = 0; j < (int) V.size(); ++j) {
        if (max_v < V[j]) {
            max_v = V[j];
            max_v_index = j;
        }
    }

    for (int j = 0; j < (int) V.size(); ++j) {
        if (second_max_v < V[j] && max_v_index != j) {
            second_max_v = V[j];
            second_max_v_index = j;
        }
    }
    
    return std::vector<int>{max_v_index, second_max_v_index};
}

int main() {

    int N, a;
    std::vector<int> A;

    std::cin >> N;

    for (int i = 0; i < N; ++i) {
        std::cin >> a;
        A.push_back(a);
    }

    std::vector<int> r = original_max(A);

    for (int j = 0; j < N; ++j) {
        if (r[0] == j) {
            std::cout << A[r[1]] << '\n';
        } else {
            std::cout << A[r[0]] << '\n';

        }
    }
}

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

/* REPmacro */
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define REPR(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=(int)(m);i<(int)(n);++i)

/*alias*/
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define PB push_back
#define MP make_pair 

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

/*using*/
using ll = long long;
using ull = unsigned long long;
using unsi = unsigned;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using db = double;
using plex = complex<double>;
using vs = vector<string>;

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

/* func */

/*struct*/
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

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

//#define int ll
//#define int long long

signed main()
{
  int n,k;cin >> n >> k;
  vi v1(n,0);
  REP(i,n)
  cin >> v1[i];
  int l = 0;
  
  sort(ALL(v1),greater<int>());
  
  for(int i = 0; i < k; ++i)    
    l += v1[i];

  cout << l;
  
  return 0;
}

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

using namespace std;
typedef long long ll;

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

    vector<int> p(n + 1), q(n + 1);
    for (int i = 0; i < n; i++) p[i + 1] = p[i] + (s[i] == '#' ? 1 : 0);
    for (int i = n - 1; i >= 0; i--) q[i] = q[i + 1] + (s[i] == '.' ? 1 : 0);

    int ret = n;
    for (int i = 0; i <= n; i++)ret = min(ret, p[i] + q[i]);
    cout << ret << endl;
    return 0;
}

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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

const int N = 100005;

int main() {

	FAST;

	int a[6];
	for (int i = 1; i <= 5; i ++) {
		cin >> a[i];
	}
	for (int i = 1; i <= 5; i ++) {
		if (!a[i]) {
			cout << i << '\n';
		}
	}
	return 0;
}

Measured memory_bytes: 3656
#include <vector>
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
    int K, A, B;
    cin >> K >> A >> B;
    bool out = false;
    if(B - A >= K) out = true;
    else if(B%K < A%K) out = true;
    else if(A%K == 0) out = true;
    cout << (out ? "OK" : "NG") << endl;
    return 0; 
}

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

using namespace std;

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

  vector<int> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }

  int ret = 0;
  for(int i = 0; i < n; i++) {
    int prev = i ? a[i-1] : a[n-1]-c;
    int next = i+1<n ? a[i+1] : a[0]+c;

    ret = max(ret, a[i] - prev);
    ret = max(ret, next - a[i]);
  }

  cout << c - ret << endl;

  return 0;
}


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

#define ForA(i,b,a) for(int i = a; i >= b; i--)
#define ForB(i,a,b) for(int i = a; i <= b; i++)
#define IOS ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mmset(arr, n) memset(arr, n, sizeof arr)
#define PI 3.1415926535897932384626433832795l
#define deci(n) cout<<fixed<<setprecision(n);
#define F first
#define S second
#define mk make_pair
#define pb push_back
#define ALPHA 27
#define IT(a , b) map <a , b> :: iterator
#define ll long long int
#define ld long double
#define debug(x) cerr << '#' << ' ' << x << '\n'
#define len(s) s.length()
#define maxn 100010

using namespace std;

const ll INF = (ll)(8e18);
const ll MOD = 1e9 + 7;

class Print{
   public:
   void print(int n){
       cout << n << '\n';
       exit(0);
   }
   void print(ll n){
       cout << n << '\n';
       exit(0);
   }
   void print(string s){
       cout << s << '\n';
       exit(0);
   }
   void print(ld n){
       cout << n << '\n';
       exit(0);
   }
};

int a[maxn];

int main()
{
    IOS;
   // #ifndef ONLINE_JUDGE
   // freopen("input.txt", "r", stdin);
   // #endif
    Print _p;
    int n; cin >> n;
    int check = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] >= 0) check++;
    }
    sort(a, a + n);
    if(check == n){
        if(n == 2){
           cout << a[1] - a[0] << '\n';
           cout << a[1] << ' ' << a[0] << '\n';
           return 0;
        }
       int ans = 0;
       for(int i = 2; i < n; i++) ans += a[i];
       ans += a[1] - a[0];
       cout << ans << '\n';
       int p = a[0] - a[1];
       cout << a[0] << ' ' << a[1] << '\n';
       for(int i = 2; i < n - 1; i++){
           cout << p << ' ' << a[i] << '\n';
           p -= a[i]; 
       }
       cout << a[n - 1] << ' ' << p << '\n';
       return 0;
    }
    if(check > 0){
       int ans = 0;
       for(int i = 0; i < n; i++) ans += abs(a[i]);
       int Index = 0;
       for(int i = 0; i < n; i++){
           if(a[i] >= 0){
               Index = i;
               break;
           }
       }
       cout << ans << '\n';
       int p = a[0];
       for(int i = Index; i < n - 1; i++){
           cout << p << ' ' << a[i] << '\n';
           p -= a[i]; 
       }
       cout << a[n - 1] << ' ' << p << '\n';
       p = a[n - 1] - p;
       for(int i = Index - 1; i > 0; i--){
           cout << p << ' ' << a[i] << '\n';
           p -= a[i];
       }
       return 0;
    }
    sort(a, a + n, greater <int>());
    int ans = 0;
    for(int i = 2; i < n; i++) ans += abs(a[i]);
    ans += a[0] - a[1];
    cout << ans << '\n';
    int p = a[0] - a[1];
    cout << a[0] << ' ' << a[1] << '\n';
    for(int i = 2; i < n; i++){
        cout << p << ' ' << a[i] << '\n';
        p -= a[i]; 
    }
    return 0;
    #ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}


Measured memory_bytes: 2304
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		var hs = new HashSet<String>();
		foreach(var s in S) hs.Add(s);
		Console.WriteLine(hs.Count);
		
	}
	int N;
	String[] S;
	public Sol(){
		N = ri();
		S = new String[N];
		for(int i=0;i<N;i++) S[i] = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 49152
n = int(input())
list_score = []
for _ in range(n):
  list_score.append(int(input()))
list_score.sort()

check = 0
while check < len(list_score):
  one_score = list_score[check]
  sum_score = sum(list_score)
  if sum_score % 10 != 0:
    print(sum_score)
    exit()
  else:
    if one_score % 10 != 0:
      list_score.remove(one_score)
    else:
      check += 1
print(0)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define wl(n) while(n--)
#define fr(i,a,b) for(i=a;i<b;i++)
#define rev(i,a,b) for(i=b-1;i>=a;i--)

#define mem(a,i) memset(a,i,sizeof(a))
typedef pair<int,int> ii;
#define mp make_pair
#define ll long long
#define MOD 1000000007
#define pb push_back
#define psh push
#define nl printf("\n")
#define fi first
#define sec second

#define si(n) scanf("%d",&n);

#define ss(s) scanf("%s",s)
#define sc(c) scanf("%c",&c)
#define sf(f) scanf("%lf",&f)

#define pi(n) printf("%d\n", n)

#define ps(s) printf("%s\n", s)
#define pc(c) printf("%c\n", c)
#define pf(f) printf("%lf\n", f)
#define INF (1LL<<52)
map<int,string>CharMap;
void num2str()
{
	
	CharMap[0]="0";
	CharMap[1]="1";
	CharMap[2]="2";
	CharMap[3]="3";
	CharMap[4]="4";
	CharMap[5]="5";
	CharMap[6]="6";
	CharMap[7]="7";
	CharMap[8]="8";
	CharMap[9]="9";
}
string to_string(ll n)
{
	string s="";
	while(n>0)
	{
	   int x=n%10;
	   n/=10;
	   s=CharMap[x]+s;	
	}
	return s;
}
ll pow1(ll x,ll y)
{
    if(y==0)
    return 1;
    ll temp= pow1(x,y/2)%MOD;
    if(y%2==0)
    return (temp*temp)%MOD;
    else
    return (((temp*temp)%MOD)*x)%MOD;
}

ll gcd(ll a,ll b)
{
	if(b==0)
		return a;
	return gcd(b,a%b);
}
int main()
{
	num2str();
	string s;
	int i,l,r;
	cin>>s;
	fr(i,0,s.length())
	{
		if(s[i] == 'A')
		{
			l = i;
			break;
		}
	}
	for(i=s.length()-1 ;i >= 0;i--)
	{
		if(s[i] == 'Z')
		{
			r=i;
			break;
		}
	}
	cout<<r-l+1<<endl;
	return 0;
}



Measured memory_bytes: 640
/*
AizuOnline A2013
Title Osaki
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//Global data section
int N;
int  dept[10000];
int  arrv[10000];
//
int solve(int n)
{
        int i,j,c,mx;

        i=j=0;
        c=mx=0;

        while(i<N && j<N)
        {
                if(dept[i]==arrv[j])
                {
                        i++;j++;
                }
                else if(dept[i]<arrv[j])
                {
                        i++;
                        c++;
                        if(c>mx)
                                mx=c;
                }
                else
                {
                        j++;
                        c--;
                }
        }
        return(mx);
}
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

main()
{
        int i,ret,h,m,s;

        while(EOF!=scanf("%d",&N) && N) 
        {
                for(i=0;i<N;i++)
                {
                        scanf("%d:%d:%d ",&h,&m,&s);
                        dept[i]=3600*h+60*m+s;
                        scanf("%d:%d:%d",&h,&m,&s);
                        arrv[i]=3600*h+60*m+s;
                }
                qsort(dept,N,sizeof(int),compare_int);
                qsort(arrv,N,sizeof(int),compare_int);

                ret=solve(N);
                printf("%d\n",ret);
        }
                
return(0);
}

Measured memory_bytes: 760
arr = [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]
puts arr[gets.chomp.to_i - 1]


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
typedef pair<pll, pll> P;
const ll INF = 1ll<<62;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int A, B, Q;
ll s[112345], t[112345];

ll solve(ll x) {
	vector<pll> pos;
	if (s[0] < x) pos.push_back(pll(*(lower_bound(s, s + A, x) - 1), 0));
	if (s[A - 1] > x) pos.push_back(pll(*lower_bound(s, s + A, x), 0));
	
	if (t[0] < x) pos.push_back(pll(*(lower_bound(t, t + B, x) - 1), 1));
	if (t[B - 1] > x) pos.push_back(pll(*lower_bound(t, t + B, x), 1));
	
	vector<int> pmv;
	REP(i, pos.size()) pmv.push_back(i);
	
	ll res = INF;
	do {
		int f = 0;
		ll cursum = 0, curpos = x;
		REP(i, pmv.size()) {
			cursum += abs(curpos - pos[pmv[i]].fi);
			curpos = pos[pmv[i]].fi;
			if (pos[pmv[i]].se == 0) f |= 1;
			else f |= 2;
			
			if (f == 3) {
				chmin(res, cursum);
				break;
			}
		}
	} while (next_permutation(ALL(pmv)));
	
	return res;
}


int main() {
	cin >> A >> B >> Q;
	REP(i, A) scanf("%lld", s + i);
	REP(i, B) scanf("%lld", t + i);
	
	REP(i, Q) {
		ll x;
		scanf("%lld", &x);
		
		if (debug) printf("ans :  ");
		printf("%lld\n", solve(x));
	}
	
	
	return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
//#define DEBUG
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define deb(x) std::cout << #x << " " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}
template<typename... T>
void write(T... a){
    ((cout << a << "\n"),...);
}

template<typename... T>
void write_space(T... a){
    ((cout << a << " "),...);
}

constexpr int MOD = 1e9 + 7;

ll pow_mod(ll a , ll p, ll MOD){
    if( p < 2){
        ll ans = 1;
        while(p--){
            ans =  (ans * a) % MOD;
        }
        return ans;
    }else{
        if( p % 2){
            ll ans = pow_mod(a, p / 2, MOD);
            ans = (ans * ans) % MOD;
            ans = (a * ans) % MOD;
            return ans;
        }else{
            ll ans = pow_mod(a , p /2, MOD);
            ans = (ans * ans) % MOD;
            return ans;
        }
    }
}

void solve(){
    int n;
    read(n);
    if( n == 1){
        cout << 0 << endl;
        return;
    }
    // has only 0 - 8
    ll count1 = pow_mod(9 , n , MOD);
    // has only 1 - 9
    ll count2 = count1;
    // has only 1- 8
    ll count3 = pow_mod(8, n , MOD);

    ll count = (count1 + count2 - count3 + MOD) % MOD;
    ll universe = pow_mod(10 , n , MOD);

    ll ans = (universe + MOD - count) % MOD;
    cout << ans << endl;

}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/
    solve();
    return 0;
}



Measured memory_bytes: 3648
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <chrono>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define MAXN 100010

typedef long long ll;

int main() {
    ll N, M;
    cin >> N >> M;
    pair<ll, ll> shops[N];
    for (ll i = 0; i < N; i++) {
        cin >> shops[i].first >> shops[i].second;
    }
    sort(shops, shops + N);
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        if (M - shops[i].second > 0) {
            ans += shops[i].second * shops[i].first;
            M -= shops[i].second;
        } else {
            ans += M * shops[i].first;
            break;
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 1792
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		int[] b = new int[N-1];
		int sum = 0;

		for(int i = 0; i<N-1;i++) {
			b[i] = sc.nextInt();
		}
		
		for(int i = 0;i<N-1;i++) {
			a[i] = b[i];
			a[i+1]=b[i];
			

		}
		for(int i = 0;i<N-2;i++) {

			if(b[i+1] > b[i] ) {
				a[i+1] = b[i];
			}
				

		}
		
		for(int i=0;i<N;i++) {
			sum += a[i];
		}
		

		System.out.println(sum);

		sc.close();
	}
}



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

int main() {
	
	int n, d;
	cin >> n >> d;
	
	vector<vector<int>> x(n, vector<int>(d));
	rep(i, n){
		rep(j, d){
			cin >> x[i][j];
		}
	}
	int ans = 0;
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			double kyori = 0.0;
			for(int k=0; k<d; k++){
				kyori += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
			}
			kyori = sqrt(kyori);
			
			if(floor(kyori) == kyori) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

const int mod = 1000000007;

template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< mod >;

const int A_MAX = 1000002;
const int N_MAX = 10003;
int A[N_MAX];
int num[A_MAX];

int main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++)cin >> A[i];

    memset(num, 0, sizeof(num));
    for(int i = 0; i < n; i++){
        int m = A[i];
        for(int p = 2; p * p <= m; p++){
            if (m % p != 0)continue;
            int pn = 0;
            while(m % p == 0){
                pn++;
                m /= p;
            }
            num[p] = max(num[p], pn);
        }
        if (m != 1)num[m] = max(num[m], 1);
    }

    modint all(1);
    for(int p = 2; p < A_MAX; p++){
        if (num[p] == 0)continue;
        modint pm(p);
        all *= pm.pow(num[p]);
    }
    modint ans(0);
    for(int i = 0; i < n; i++){
        modint Am(A[i]);
        ans += (all / Am);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000000000000



int main(){
	
	int N;
	cin>>N;
	set<int> S;
	for(int i=0;i<N;i++){
		int a;
		cin>>a;
		S.insert(a);
	}
	
	cout<<S.size()<<endl;
	
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	string s;
	while (n != 0) {
		if (abs(n) & 1) {
			s.push_back('1');
			--n;
		}
		else {
			s.push_back('0');
		}
		n /= -2;
	}
	if (s.empty()) s.push_back('0');
	reverse(s.begin(), s.end());
	cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <iomanip>

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

int main(){
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());
    ll n,a,b; 
    cin >> n >> a >> b;
    vector <ll> x(n);
    //ソート済
    REP(i,n)
    {
        cin >> x[i];
    }
    ll res = 0;

    for(ll i = 1; i < n; ++i)
    {

        if((x[i] - x[i-1]) * a <= b)
        {
            res += (x[i] - x[i-1]) * a;
        }
        else
        {
            res += b;
        }
    }

    cout << res << endl;
    return 0;
}



Measured memory_bytes: 1024
import sys
t='X'
for e in sys.stdin:
 for i in'0123456789'[(e[0]==t)*(e[1]!='+')or('+X'in e)*('+X='not in e):]:
  l,r=e.replace(t,i).split('=')
  if eval(l)==int(r):print(i);break
 else:print('NA')


Measured memory_bytes: 5620
start = Time.now
N = gets.to_i
XYD = $<.map{|s|
  x, y, d = s.split
  [x.to_i, y.to_i, d.intern]
}
f = ->n{
  tbl = {
    R: [1, 0],
    L: [-1, 0],
    U: [0, 1],
    D: [0, -1],
  }
  min_x = min_y = 1.0/0
  max_x = max_y = -1.0/0
  XYD.each{|x, y, d|
    x *= 2
    y *= 2
    mul_x, mul_y = tbl[d]
    x += n * mul_x
    y += n * mul_y
    min_x = x if x < min_x
    max_x = x if x > max_x
    min_y = y if y < min_y
    max_y = y if y > max_y
  }
  (max_x - min_x) * (max_y - min_y)
}

l = 0
r = 10**9
# p f[0]
100.times{|i|
  if f[(l * 2 + r) / 3] < f[(l + r * 2) / 3]
    r = (l + r * 2) / 3
  else
    l = (l * 2 + r) / 3
  end
  break if Time.now - start > 4.9
}
p f[(l + r) / 2].fdiv 4

Measured memory_bytes: 11772