akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
  ll a, b;
  cin >> a >> b;
  if(max(a, b) - min(a, b) >= 2)
  {
    cout << "Alice" << endl;
  }
  else cout << "Brown" << endl;
}

Measured memory_bytes: 256
import java.util.*;
class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int n;
    String s;
    n=sc.nextInt();
    sc.nextLine();
    s=sc.nextLine();
    char a[]=s.toCharArray();
    for(int i=0;i<s.length();i++)
    {
      a[i]=(char)((((a[i]-'A')+n)%26)+65);
    }
    String s1=new String(a);
    System.out.println(s1);
  }
}

Measured memory_bytes: 21972
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define mp(a,b) make_pair((a),(b))
#define eq ==

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> pii;

// →↑←↓
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};


const double EPS = 1e-9;

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> pasta(N);
    for(int i=0;i<K;i++){
        int a,b;
        cin >> a >> b;
        a--;
        pasta[a] = b;
    }

    vector<vector<vector<int> > > V(N+1,vector<vector<int> >(4,vector<int>(3)));
    if(pasta[0] == 0){
        V[1][1][1] = 1;
        V[1][2][1] = 1;
        V[1][3][1] = 1;
    }else{
        V[1][pasta[0]][1] = 1;
    }

    const int MOD = 10000;
    for(int i=1;i<N;i++){
        int p = pasta[i];

        if(p != 0){
            for(int j=1;j<=3;j++){
                for(int k=1;k<=2;k++){
                    if(p != j){
                        V[i+1][p][1] = (V[i+1][p][1] + V[i][j][k]) % MOD;
                    }else{
                        V[i+1][p][k+1] = (V[i+1][p][k+1] + V[i][j][k]) % MOD;
                    }
                }
            }
        }else{
            for(int l=1;l<=3;l++){
                for(int j=1;j<=3;j++){
                    for(int k=1;k<=2;k++){
                        if(l == j){
                            V[i+1][l][k+1] = (V[i+1][l][k+1] + V[i][l][k]) % MOD;
                        }else{
                            V[i+1][l][1] = (V[i+1][l][1] + V[i][j][k]) % MOD;
                        }
                    }
                }
            }
        }
    }
    int ret = 0;
    for(int i=1;i<=3;i++){
        for(int k=1;k<=2;k++){
            ret = (ret + V[N][i][k]) % MOD;
        }
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 1236
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
using ll = long long int;

int a, b;

int main(void) {
	cin >> a >> b;
	int ret;
	if (a >= 13)
		ret = b;
	else if (a <= 5)
		ret = 0;
	else
		ret = b / 2;
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

def dist(list1,list2):
    d = 0
    for i in range(len(list1)):
        d += (list1[i]-list2[i])**2
    return math.sqrt(d)
n,d = I2()
x = []
for i in range(n):
    inp = Intl()
    x.append(inp)
#print(x)
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        d = dist(x[i],x[j])
        if int(d) == d:cnt += 1
print(cnt)

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

def linput(tt=int):
	return list(map(tt,input().split()))

def gcd(a: int, b: int):
	while b: a, b = b, a%b
	return a

def lcm(a: int, b: int):
	return a * b // gcd(a, b)

def main():
	#a,b,c = linput()
	X = int(input())
	
	res = 0
	R = 360
	
	T = 360
	G = 0
	while T!=G:
		if T>G: G+=X; res+=1
		else: T+=R
	
	print(res)

if __name__ == "__main__":
	main()


Measured memory_bytes: 9196
while True:	
	a,b,c=map(int,input().split())
	if a==-1 and b==-1 and c==-1:
		break
	if	a==-1 or b==-1:
		print("F")
	elif a+b >= 80:
		print("A")
	elif a+b >= 65:
		print("B")
	elif a+b >= 50  or c >=50:
		print("C")
	elif a+b >= 30:
		print("D")
	elif a+b < 30:
		print("F")


Measured memory_bytes: 5592
local function meld(a,b)
    if not a then
        return b
    elseif not b then
        return a
    elseif a[1]<b[1] then
        b[4]=a[3]
        a[3]=b
        return a
    else
        a[4]=b[3]
        b[3]=a
        return b
    end
end

local function pair(a,d)
    local b=a and a[4]
    if b then
        local c=b[4]
        a=meld(a,b)
        a[4]=d
        d=a
        return pair(c,d)
    else
        local e
        while d do
            e=d
            d=d[4]
            a=meld(a,e)
        end
        return a
    end
end

local PairingHeap={}

PairingHeap.empty=function(self)
    return not self[1]
end

PairingHeap.push=function(self,key,value)
    self[1]=meld(self[1],{key,value,false,false})
end

PairingHeap.top=function(self)
    return self[1][2]
end

PairingHeap.pop=function(self)
    self[1]=pair(self[1][3],false)
end

PairingHeap.join=function(self,other)
    self[1]=meld(self[1],other[1])
    return self
end

PairingHeap.new=function(self)
    local obj={false}
    setmetatable(obj,{__index=PairingHeap})
    return obj
end

----------

local n,m=io.read("n","n")
local a=PairingHeap:new()
for i=1,n do
    local input=io.read("n")
    a:push(-input,input)
end

for i=1,m do
    local x=a:top()
    x=(x//2)
    a:pop()
    a:push(-x,x)
end
 
local total=0
for i=1,n do
    total=total+a:top()
    a:pop()
end
print(total)

Measured memory_bytes: 29160
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
#include <complex>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 

static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-10;

int dp[510][510];
int main(){
  int H,W;
  while(~scanf("%d %d",&H,&W)){
    if(H == 0 && W == 0) break;
    memset(dp,0,sizeof(dp));

    for(int y=0;y<H;y++){
      char line[505];
      scanf("%s",line);
      for(int x=0;x<W;x++){
        dp[y+1][x+1] = dp[y][x+1];
        if(line[x] == '.'){
          dp[y+1][x+1]++;
        }
        else{
          dp[y+1][x+1] = 0;
        }
      }
    }

    int res = 0;
    for(int y=0;y<H;y++){
      priority_queue<P> que;
      for(int x=0;x<=W;x++){
        int next = dp[y+1][x+1];
        int len = 0;
        while(!que.empty() && que.top().first >= next){
          len += que.top().second;
          res = max(res,len * que.top().first);
          que.pop();
        }
        len++;
        que.push(P(next,len));
      }
    }
    printf("%d\n",res);
  }
}

Measured memory_bytes: 2216
N,M=map(int,input().split())
a=[]
for _ in [0]*M:
    a.append(int(input()))

a.append(N+1)    

step=[]

if a[0]==1:j=1
else:j=0

for i in range(2,N+1):
    if i <a[j]:
        step.append(i)
    else:
        step.append(0)
        j+=1

stepsum=[1]   #k段目までの組み合わせ
if a[0]==1:   #1段目がNGなら
    stepsum.append(0)
else:
    stepsum.append(1)
    
for i in step:
    if i==0:stepsum.append(0)
    else:stepsum.append(((stepsum[i-1]+stepsum[i-2]))%1000000007)


ans=stepsum[N]%1000000007
print(ans)

Measured memory_bytes: 57944
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

typedef long long ll;

using namespace std;

int main(void) {
  int N, a[3000]; cin >> N;
  int ans = 0;
  for (int i = 0; i < N; i++ ) { cin >> a[i]; ans += a[i] - 1; }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        try {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] abc = br.readLine().split(" ");
        Arrays.sort(abc);
        
        System.out.println(String.join(" ", abc));
        br.close();
        } catch (Exception e){
            
        }

    }
}


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

using namespace std;

int n,x;

set<int>st;

int main()
{
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin>>x;
        st.insert(x);
    }
    if (st.size()==n)cout << "YES\n";
    else cout << "NO\n";
    return 0;
}



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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n, m;
    cin >> n >> m;
    vector<int> v(n, 0);

    REP(i, m){
        int a, b;
        cin >> a >> b;
        v[a-1]++;
        v[b-1]++;
    }

    bool y = true;
    REP(i, n){
        y &= ~(v[i]%2);
    }

    cout << (y ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>

int main() {
  char b;
  scanf("%c", &b);
  if (b == 'A') {printf("T\n");}
  if (b == 'C') {printf("G\n");}
  if (b == 'G') {printf("C\n");}
  if (b == 'T') {printf("A\n");}
  return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][][] count = new int[4][3][10];
		int b, f, r, v;
		
		for (int i = 0; i < n; i++){
			b = sc.nextInt() - 1;
			f = sc.nextInt() - 1;
			r = sc.nextInt() - 1;
			v = sc.nextInt();
			count[b][f][r] += v;
		}
		
		for (int i = 0; i < 4; i++){
			for (int j = 0; j < 3; j++){
				for (int k = 0; k < 10; k++){
					if (k < 9){System.out.print(" " + count[i][j][k]);}
					else {System.out.println(" " + count[i][j][k]);}
				}
			}
			if (i < 3){
				System.out.println("####################");
			}
		}
	}
}

Measured memory_bytes: 21052
nums = list(input())
comb = []
def f(now):
  if len(now) == 3:
    comb.append(now)
    return
  
  f(now+['+'])
  f(now+['-'])

f([])

for op in comb:
  temp = nums[0]

  for j in range(len(op)):
    temp = temp + op[j] + nums[j+1]

  if eval(temp) == 7:
    print('{}{}{}'.format(temp, '=', '7'))
    break

Measured memory_bytes: 3064
# include <bits/stdc++.h>
# define ll long long 
using namespace std;
const int N = 2e5 + 100;
ll dp[N], a[N], h[N], tree[4 * N], ans, n;
void update(int l, int r, int x, ll v, int p){
    if(l > x || r < x)return;
    if(l == r){
        tree[p] = v;
    }else{
        int m = (l + r) >> 1;
        update(l, m, x, v, p << 1);
        update(m + 1, r, x, v, p << 1 | 1);
        tree[p] = max(tree[p << 1], tree[p << 1 | 1]);
    }
}
ll count(int l, int r, int L, int R, int p){
    if(l > R || L > r)return 0;
    if(L <= l && R >= r)return tree[p];
    int m = (l + r) >> 1;
    return max(count(l, m, L, R, p << 1), count(m + 1, r, L, R, p << 1 | 1));
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> h[i];
    }
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(int i = 1; i <= n; i++){
        dp[i] = count(1, n, 1, h[i] - 1, 1) + a[i];
        update(1, n, h[i], dp[i], 1);
        ans = max(ans, dp[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 11264
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()



const int MAX_N=100010;
vector<bool> sss(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}



/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  ll n;
  cin>>n;
  vector<bool> p=sss();
  if(n==2){
  cout<<2<<endl;
  return 0;
}
if(n==3){
cout<<3<<endl;
return 0;
}
if(n==5){
cout<<5<<endl;
return 0;
}
if(n==7){
cout<<7<<endl;
return 0;
}

  while(!p[n]){
    n++;
  }
  cout<<n<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fori(i,a,b) for(int i=a;i<(int)(b);i++)
#define repi(i,n) fori(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}

#define MAX 3030
ll dp[MAX][MAX];
void solve(string s, string t){
    repi(i,MAX)repi(j,MAX)dp[i][j]=0;
    int n=s.length();
    int m=t.length();
    repi(i,n)repi(j,m){
        dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
        if(s[i]==t[j])chmax(dp[i+1][j+1],dp[i][j]+1);
    }
    string ans="";
    while(n>0&&m>0){
        if(s[n-1]==t[m-1]){
            ans+=s[n-1];
            n--;
            m--;
        }
        else if(dp[n][m]==dp[n-1][m])n--;
        else if(dp[n][m]==dp[n][m-1])m--;
    }
    reverse(all(ans));
    cout<<ans<<endl;
}

int main(){
    string s;
    cin >> s;
    string t;
    cin >> t;
    solve(s, t);
    return 0;
}


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

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef pair <ll ,ll> pll;
typedef pair <int ,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define print(a) {for (auto iiiiiiiiii : a) cout << iiiiiiiiii << ' '; cout << '\n';}
#define fi first
#define se second
#define all(x) (x).begin() , (x).end()

ll next() {ll x; cin >> x; return x;}

const ll inf = 1e18 , mod = 998244353;
const int intf = 2e9 , maxn = 1e5;
const double PI = 3.141592653589 , eps = 1e-8;

int n;
string s;

void dfs(int v , vector <bool> &was){
    was[v] = true;
    if (v + 1 < n && !was[v + 1] && s[v + 1] != '#') dfs(v + 1 , was);
    if (v + 2 < n && !was[v + 2] && s[v + 2] != '#') dfs(v + 2 , was);
}

void revdfs(int v , vector <bool> &was){
    was[v] = true;
    if (v - 1 >= 0 && !was[v - 1] && s[v - 1] != '#') revdfs(v - 1 , was);
    if (v - 2 >= 0 && !was[v - 2] && s[v - 2] != '#') revdfs(v - 2 , was);
}

void rint(bool a , bool b){
    if (a && b){
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    exit(0);
}

void solve(){
    int a , b , c , d;
    cin >> n >> a >> b >> c >> d;
    a-- , b-- , c-- , d--;
    cin >> s;

    vector <bool> cana(n , false) , canb(n , false) , canc(n , false) , cand(n , false);
    dfs(a , cana);
    dfs(b , canb);
    revdfs(c , canc);
    revdfs(d , cand);

    if (c < d){
        rint(cana[c] , canb[d]);
    }

    for (int i = 0; i + 2 < n; i ++){
        if (s[i] == '.' && s[i + 1] == '.' && s[i + 2] == '.'){
            if (cana[i] && canb[i + 1] && cand[i + 1] && canc[i + 2]) rint(true , true);
            if (cana[i + 1] && canb[i] && cand[i + 2] && canc[i + 1]) rint(true , true);
        }
    }
    rint(false , false);
}

int main()
{
    #ifdef HERE
        freopen("input.txt" , "r" , stdin);
    #else
        //freopen(".in" , "r" , stdin); freopen(".out" , "w" , stdout);
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #endif
    cout.precision(20);

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


    #ifdef HERE
        cout << setprecision(3) << fixed << "\n\nRuntime: " << (long double)(clock()) / CLOCKS_PER_SEC << " s.\n";
    #endif
    return 0;
}
/*

*/


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

using namespace std;

typedef long double ld;
typedef long long ll;

#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define f first
#define s second

template<typename T, typename U> bool ckmin(T &a, U b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool ckmax(T &a, U b){ return b > a ? a = b, true : false; }

int k, r, c;
vector<vector<ll>> b;
vector<vector<array<ll, 4>>> dp;
vector<pair<int, int>> ord;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> r >> c >> k;
    b.assign(r, vector<ll>(c, 0));
    for(int i = 0; i < k; ++i){
        int a, x, y; cin >> a >> x >> y; a--, x--;
        b[a][x] = y;
    }
    dp.assign(r + 1, vector<array<ll, 4>>(c + 1, array<ll, 4>()));
    for(int i = 0; i < r + c - 1; ++i){
        for(int j = max(0, i - c + 1); j <= min(i, r - 1); ++j){
            ord.eb(j, i - j);
        }
    }
    // for(auto i : b){
    //     for(auto j : i){
    //         cout << j << " ";
    //     }
    //     cout << "\n";
    // }
    for(auto &[x, y] : ord){
        // cerr << x << " " << y << "\n";
        for(int i = 0; i < 4; ++i){
            //different row
            if(i != 3) ckmax(dp[x + 1][y][0], dp[x][y][i] + b[x][y]);
            else ckmax(dp[x + 1][y][0], dp[x][y][i]);
            ckmax(dp[x][y + 1][i], dp[x][y][i]);
            if(i != 3) ckmax(dp[x][y + 1][i + 1], dp[x][y][i] + b[x][y]);
        }
    }
    // for(auto i : dp){
    //     for(auto j : i){
    //         cout << j[0] << " ";
    //     }
    //     cout << "\n";
    // }
    // for(auto i : dp){
    //     for(auto j : i){
    //         cout << j[1] << " ";
    //     }
    //     cout << "\n";
    // }
    // for(auto i : dp){
    //     for(auto j : i){
    //         cout << j[2] << " ";
    //     }
    //     cout << "\n";
    // }
    // for(auto i : dp){
    //     for(auto j : i){
    //         cout << j[3] << " ";
    //     }
    //     cout << "\n";
    // }
    cout << max({dp[r - 1][c - 1][0] + b[r - 1][c - 1], dp[r - 1][c - 1][1] + b[r - 1][c - 1], dp[r - 1][c - 1][2] + b[r - 1][c - 1], dp[r - 1][c - 1][3]});
    return 0;
}

Measured memory_bytes: 486284
// abc129_e
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

ull dp[100002][2] = {0};

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt");
    cin.rdbuf(in.rdbuf());
#endif

    string N;
    cin >> N;

    dp[0][0] = 0;
    dp[0][1] = 1;
    REP(i, N.size()){
        if (N[i] == '1'){
            dp[i+1][0] = (3 * dp[i][0] + dp[i][1]) % MOD;
            dp[i+1][1] = 2 * dp[i][1] % MOD;
        } else {
            dp[i+1][0] = 3 * dp[i][0] % MOD;
            dp[i+1][1] = dp[i][1] % MOD;
        }
    }

    ull ans = (dp[N.size()][0] + dp[N.size()][1]) % MOD;

    print(ans);

    return 0;
}


Measured memory_bytes: 2000
//Use valgrind once if the submission doesn't go through. It can detect uninitialized variables and see where they could be an issue.
#define VALID(h,w,grid) (h>=0&&h<grid.size()&&w>=0&&w<grid[0].size()&&grid[h][w]=='.')
#include <bits/stdc++.h>
#include <numeric>
using namespace std;

int main(){

	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);

	int H,W,sh,sw,eh,ew;
	priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> q;	
	cin>>H>>W;
	vector<string> grid(H);
	vector<vector<int>> dp(H,vector<int>(W,INT_MAX));
	cin>>sh>>sw>>eh>>ew;
	for(auto &i:grid){
		cin>>i;
	}
	dp[--sh][--sw]=0;
	q.push({0,sh*W+sw});
	array<pair<int,int>,4> adj={{ {1,0},{-1,0},{0,1},{0,-1} }};
	array<pair<int,int>,20> magic={{ {-2,-2}, {-2,-1}, {-1,-2}, {-2,0}, {0,-2}, {-2,1}, {1,-2}, {-2,2}, {2,-2}, {2,-1}, {-1,2}, {2,0}, {0,2}, {2,1}, {1,2}, {2,2}, {-1,-1}, {-1,1}, {1,-1}, {1,1} }};
	//cout<<grid[4][2]<<endl;
	while(!q.empty()){
		int h=q.top().second/W,w=q.top().second%W,t=q.top().first;
		q.pop();
		if(t<=dp[h][w]){
			for(auto &i:adj){
				if(VALID(h+i.first,w+i.second,grid)&&dp[h+i.first][w+i.second]>dp[h][w]){
					dp[h+i.first][w+i.second]=dp[h][w];
					q.push({dp[h+i.first][w+i.second],(h+i.first)*W+w+i.second});
				}
			}
			for(auto &i:magic){
				if(VALID(h+i.first,w+i.second,grid)&&dp[h+i.first][w+i.second]>dp[h][w]+1){
					dp[h+i.first][w+i.second]=dp[h][w]+1;
					q.push({dp[h+i.first][w+i.second],(h+i.first)*W+w+i.second});
				}
			}
		}
	}
	if(dp[--eh][--ew]==INT_MAX){
		cout<<-1<<endl;
	}
	else{
		cout<<dp[eh][ew]<<endl;
	}
}


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

int main() {
  //--------------------//
  // modを利用
  //--------------------//
  ll n;
  cin >> n;
  string ans;
  while(n){
    n--;
    ans += 'a' +n%26;
    n /= 26;
  }

  reverse(ans.begin(),ans.end());
  cout << ans << endl;
  return 0;
}

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

#define f first
#define s second
#define pb push_back
#define all(c) c.begin(),c.end()

#define gi(x) scanf("%d", &x)
#define pi(x) printf("%d", x)
#define gl(x) scanf("%lld", &x)
#define pl(x) printf("%lld", x)
#define sp printf(" ")
#define nl printf("\n")

typedef long long int lld;
typedef long double ldb;

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

main(){
	lld x, y;
	cin >> x >> y;
	if(x%y == 0){
		return cout << "-1", 0;
	}
	for(lld i = 1; ; ++i){
		lld res = x*i;
		if(res % y == 0) continue;
		return cout << res, 0;
	}
}


Measured memory_bytes: 256
input()
x = [int(i) for i in input().split(" ")]
steps = []
res, c = 0, 0
for i in range(len(x)-1):
  steps.append(x[i] - x[i+1])
for i in steps:
  if i >= 0:
    c += 1
  else:
    c = 0
  if c > res:
    res = c
print(res)
  

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

int main()
{
	int a,b,c,d,e,i,j,temp=0,count= 0,o=0;
	int amari[5];
	int sum = 0;
	cin >> a >> b >> c >> d >> e;
	amari[0] = a % 10;
	amari[1] = b % 10;
	amari[2] = c % 10;
	amari[3] = d % 10;
	amari[4] = e % 10;
	for( i = 0; i < 5; i++ ){
		if(amari[i] == 0){
			count++;
		}
	}

	for( j = 0; j < 4 ; j++){
		for( i = 0; i < 4; i++ ){
			if( amari[i] > amari[i+1] ){
				temp = amari[i];
				amari[i] = amari[i+1];
				amari[i+1] = temp;
			}
		}
	}

	for( i = 0; i < 5; i++ ){
		if( amari[i] != 0 ){
			o = amari[i];
			break;
		}
	}

	amari[0] = a % 10;
	amari[1] = b % 10;
	amari[2] = c % 10;
	amari[3] = d % 10;
	amari[4] = e % 10;
if( count != 5 ){
	sum = a - amari[0] + 10 + b - amari[1] + 10 + c - amari[2] + 10 + d - amari[3] + 10 + e - amari[4] + 10 - (count+1) * 10 + o;
}else{
	sum = a - amari[0] + 10 + b - amari[1] + 10 + c - amari[2] + 10 + d - amari[3] + 10 + e - amari[4] + 10 - count * 10 + o;
}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
// atcoder/agc032/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  int n;
  while (cin >> n) {
    vec<int> a(n);
    cin >> a;
    each (i, a) --i;

    vec<int> b(n, -1);
    for (int i = 0; i < n; ++i) {
      int k = -1;
      for (int j = 0; j < a.size(); ++j) {
        if (a[j] == j) {
          k = j;
        }
      }
      if (k == -1) break;
      b[i] = a[k];
      a.erase(a.begin() + k);
    }

    reverse(b.begin(), b.end());
    if (a.size()) {
      cout << -1 << endl;
      continue;
    }
    each (i, b) {
      cout << i + 1 << endl;
    }
  }

  return 0;
}


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

using namespace std;

int main() {
	int n;
	cin >> n;
	long long int W;
	cin >> W;
	vector<long long int> w0;
	vector<long long int> w1;
	vector<long long int> w2;
	vector<long long int> w3;
	long long int v, w;
	cin >> w >> v;
	w0.push_back(v);
	long long int vv, ww;
	for (int i = 1; i < n; i++) {
		cin >> ww >> vv;
		if (ww - w == 0) {
			w0.push_back(vv);
		}
		else if (ww - w == 1) {
			w1.push_back(vv);
		}
		else if (ww - w == 2) {
			w2.push_back(vv);
		}
		else {
			w3.push_back(vv);
		}
	}
	sort(w0.begin(), w0.end(), greater<long long int>());
	sort(w1.begin(), w1.end(), greater<long long int>());
	sort(w2.begin(), w2.end(), greater<long long int>());
	sort(w3.begin(), w3.end(), greater<long long int>());
	vector< vector<long long int> > dp(n+1, vector<long long int>(310, 0));
	for (int i = 0; i < w0.size(); i++) {
		for (int j = n; j >= 1; j--) {
			for (int k = 0; k < 310; k++) {
				dp[j][k] = max(dp[j][k], dp[j - 1][k] + w0[i]);
			}
		}
	}
	for (int i = 0; i < w1.size(); i++) {
		for (int j = n; j >= 1; j--) {
			for (int k = 1; k < 310; k++) {
				dp[j][k] = max(dp[j][k], dp[j - 1][k - 1] + w1[i]);
			}
		}
	}
	for (int i = 0; i < w2.size(); i++) {
		for (int j = n; j >= 1; j--) {
			for (int k = 2; k < 310; k++) {
				dp[j][k] = max(dp[j][k], dp[j - 1][k - 2] + w2[i]);
			}
		}
	}
	for (int i = 0; i < w3.size(); i++) {
		for (int j = n; j >= 1; j--) {
			for (int k = 3; k < 310; k++) {
				dp[j][k] = max(dp[j][k], dp[j - 1][k - 3] + w3[i]);
			}
		}
	}
	/*for (int i = 0; i <= n; i++) {
		for (int j = 0; j < 10; j++) {
			cout << dp[i][j] << ' ';
		}
		cout << endl;
	}*/
	long long int MM = 0;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j < 310; j++) {
			if (W >= w*(long long int)i + (long long int)j) {
				MM = max(MM, dp[i][j]);
				//cout << w*i + j << endl;
			}
			else {
				break;
			}
		}
	}
	cout << MM << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 

int main() {
	int n;
	cin >> n;
	bool ok = false;
	while(n) {
		if(n%10 ==7){
			ok = true;
			break;
		}
		n /= 10;
	}
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define ll long long
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define vi vector<int>
#define vl vector<long long>
#define pb push_back

int abs(int a){
    return ( a>0 ? a : -a );
}

int main(void){
    string n;
    cin >> n;
    int a,b,c,d;
    a=n.at(0)-'0';
    b=n.at(1)-'0';
    c=n.at(2)-'0';
    d=n.at(3)-'0';

    if(a+b+c+d==7){
        cout << n.at(0) << '+' << n.at(1) << '+' << n.at(2) << '+' << n.at(3) << '=' << 7 << endl;
        return 0;
    }else if(a+b+c-d==7){
        cout << n.at(0) << '+' << n.at(1) << '+' << n.at(2) << '-' << n.at(3) << '=' << 7 << endl;
        return 0;
    }else if(a+b-c+d==7){
        cout << n.at(0) << '+' << n.at(1) << '-' << n.at(2) << '+' << n.at(3) << '=' << 7 << endl;
        return 0;
    }else if(a+b-c-d==7){
        cout << n.at(0) << '+' << n.at(1) << '-' << n.at(2) << '-' << n.at(3) << '=' << 7 << endl;
        return 0;
    }else if(a-b+c+d==7){
        cout << n.at(0) << '-' << n.at(1) << '+' << n.at(2) << '+' << n.at(3) << '=' << 7 << endl;
        return 0;
    }else if(a-b+c-d==7){
        cout << n.at(0) << '-' << n.at(1) << '+' << n.at(2) << '-' << n.at(3) << '=' << 7 << endl;
        return 0;
    }else if(a-b-c+d==7){
        cout << n.at(0) << '-' << n.at(1) << '-' << n.at(2) << '+' << n.at(3) << '=' << 7 << endl;
        return 0;
    }else if(a-b-c-d==7){
        cout << n.at(0) << '-' << n.at(1) << '-' << n.at(2) << '-' << n.at(3) << '=' << 7 << endl;
        return 0;
    }

}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int a[1000],i,n;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=n-1;i>=1;i--)
{
printf("%d ",a[i]);
}
printf("%d\n",a[0]);
return 0;
}


Measured memory_bytes: 2072
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(cnt,e) for(ll cnt=0;cnt<e;cnt++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;


ll i,j,k;


int main(){
    ll N;
    cin>>N;
    V A(N+1);
    for(ll i=2;i<=N;i++)cin>>A[i];
    V ans(N+1,0);
    for(ll i=2;i<=N;i++){
        ans[A[i]]++;
    }
    for(ll i=1;i<=N;i++)cout<<ans[i]<<endl;
    


}


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

int main()
{
  int n,a[105],num=0;
  cin>>n;
  for(int i=1; i<=n; i++)
  {
    cin>>a[i];
    num+=a[i];
  }
  sort(a+1,a+1+n);
  int sum=0;
  int mn=1000000;
  for(int i=a[1]; i<=a[n]; i++)
  {
    for(int j=1; j<=n; j++)
    {
      sum+=pow(abs(i-a[j]),2);
    }
    mn=min(mn,sum);
    sum=0;
  }
  cout<<mn<<endl;
  return 0;
}


Measured memory_bytes: 256
def find_xor_from_zero(n):
    # XORは周期4で求まることを利用
    return [n, 1, n + 1, 0][n % 4]


def main():
    a, b = map(int, input().split())
    if a != b:
        print(find_xor_from_zero(a - 1) ^ find_xor_from_zero(b))
    else:
        print(a)


if __name__ == '__main__':
    main()



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

int main() {
  int N;
  cin >> N;
  int a,b,c;
  a = N / 100;
  b = (N-a*100)/10;
  c = N % 10;
  if (a == 7 || b == 7 || c == 7) {
    cout << "Yes" <<endl;
  }
  else {
    cout << "No" <<endl;
  }
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
    
#define ll long long int
#define pb push_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define pre(i , j , n) for(ll i = j ; i >= n ; i--)
#define all(x) x.begin(), x.end()
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<char>	vc;
typedef vector<bool>	vb;
typedef pair<ll,ll> 	pll;
#define br "\n"
#define MAX  1000001
#define ff first
#define ss second
#define MAXIM 100003



void solve(){
    vll a(2),b(2);
    ll ans=1;
    rep(i,0,2) cin >> a[i];
    rep(i,0,2) cin >> b[i];
    ans = a[0]*b[0];
    rep(i,0,2){
        rep(j,0,2){
            ans = max(ans,a[i]*b[j]);
        }
    }
    cout << ans;
}
	

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif 

	ll t = 1;

	// cin >> t;
	rep(i,0,t){
		solve();
	}
 
}	

Measured memory_bytes: 3652
/*
Thank you for helping me out Endagorion
You have really been an inspiration
I will prove my worth to you
i will return in APRIL

"May God help me in this venture of mine"

*/


#include <iostream>
#include <sstream>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <cassert>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <queue>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>

using namespace std;

#define endl '\n'
#define lli long long int
#define USE_MATH_DEFINES
const long INF = 100000;

// int dr[]={0,0,1,-1};
int countt[1010101];
// int dc[]={1,-1,0,0};

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

	#ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	#endif
	int n,k;
	cin>>n>>k;
	int flag[10]={0};
	for(int i=0;i<k;i++)
	{
		int temp;
		cin>>temp;
		flag[temp]=1;
	}
	for(int i=n;i<100*n;i++)
	{
		int temp = i;
		bool poss = 1;
		while(temp)
		{
			int k = temp%10;
			if(flag[k]==1)
			{
				poss=0;
				break;
			}
			temp/=10;
		}
		if(poss)
		{
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
  long long x = 1;
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P=std::pair<long long,long long>;

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

  ll n;
  std::cin>>n;

  ll a[3],b[3];
  rep(i,0,3)std::cin>>a[i];
  rep(i,0,3)std::cin>>b[i];

  std::vector<ll> dp(n+1,0);

  rep(i,0,n+1){
    rep(j,0,3){
      if(i>=a[j])chmax(dp[i],dp[i-a[j]]-a[j]+b[j]);
    }
  }

  ll m=n+dp[n];

  dp=std::vector<ll>(m+1,0);

  rep(i,0,m+1){
    rep(j,0,3){
      if(i>=b[j])chmax(dp[i],dp[i-b[j]]-b[j]+a[j]);
    }
  }

  std::cout<<m+dp[m]<<"\n";

  return 0;
}


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

long long ncr(int n, int r) {
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
ll mod(ll a,ll b,ll m){
    if(b==0)return 1;
    if(b%2==0){
        ll y =  mod(a,b/2,m);
        return (y*y)%m;
    }
    else{
        return ((a%m)*mod(a,b-1,m))%m;
    }
}

ll modinv(ll a,ll m){
return mod(a,m-2,m);
//works only for prime m.
//else calculate phi(m)-1.
}



int main()
{
    int n,k;
    cin>>n>>k;
    vector<int>h(n);
    for(int i=0;i<n;i++)cin>>h[i];
    int dp[n];
    dp[0]=0;
    for(int i=1;i<n;i++)dp[i]=INT_MAX;
    for(int i=1;i<n;i++){
        for(int j=1;j<=k;j++){
            if(j>i)break;
            else{
                dp[i]=min(dp[i],abs(h[i]-h[i-j])+dp[i-j]);
            }
        }
    }
    cout<<dp[n-1];
    return 0;
}


Measured memory_bytes: 3960
#include<stdio.h>
int main(void){
  int n,x,i;
  int j=0;
  scanf("%d %d",&n,&x);
  int l[n],r[n+1];
  r[0]=0;
  for(i=0;i<n;i++){
    scanf("%d",&l[i]);
    r[i+1]=r[i]+l[i];
  }
  for(i=0;i<=n;i++){
    if(x>=r[i]){
      j=j+1;
    }
  }
  printf("%d",j);
}


Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextFloat64() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func PowInt(x, y int) int {
	mod := 1000000000 + 7
	ans := 1
	for i := 0; i < y; i++ {
		ans = ans * x % mod
	}
	return ans
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(nil, 10000000000)

	n := nextInt()

	mod := 1000000000 + 7

	if n == 1 {
		fmt.Println(0)
		return
	}
	if n == 2 {
		fmt.Println(2)
		return
	}

	a := PowInt(10, n)
	b := PowInt(9, n)
	c := PowInt(8, n)
	ans := (a - b - b + c)
	ans = ans % mod
	ans = (ans + mod) % mod
	fmt.Println(ans)
}


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<Int> A(N); for (auto &a : A) cin >> a;
    sort(begin(A), end(A));
    vector<bool> neg(N);
    for (int i = 0; i < N; i++) neg[i] = A[i] < 0 ? true : false;
    neg[0] = true;
    neg[N-1] = false;
    Int ans = 0;
    for (int i = 0; i < N; i++) ans += (neg[i] ? -1 : +1) * A[i];
    cout << ans << '\n';
    for (int i = 1; i < N-1; i++) if (!neg[i]) {
        cout << A[0] << ' ' << A[i] << '\n';
        A[0] -= A[i];
    }
    for (int i = 0; i < N-1; i++) if (neg[i]) {
        cout << A[N-1] << ' ' << A[i] << '\n';
        A[N-1] -= A[i];
    }
    return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,x;
	cin>>x>>n;
	int numeros[200];
	for(int i=0;i<200;i++){
		numeros[i]=abs(i+1-x);
	}
	bool permitido[200];
	for(int i=0;i<200;i++){
		permitido[i]=true;
	}
	int no;
	for(int i=0; i<n;i++){
		cin>>no;
		permitido[no-1]=false;
	}
	/*for(int i=0;i<200;i++){
		if(permitido[i]){
			cout<<i+1<<" "<<numeros[i]<<" |";
		}
	}*/
	/*for(int i=0;i<200;i++){
		cout<<numeros[i]<<" ";
	}*/
	//int minimum=numeros[0];
	int minimum;
	for(int i=0;i<200;i++){
		if(permitido[i]==true){
			minimum=numeros[i];
			break;
		}
	}
	for(int i=0; i<200;i++){
		if(minimum>numeros[i] && permitido[i]){
			minimum=numeros[i];
		}
	}
	int ubicacion;
	for(ubicacion=0; ubicacion<200;ubicacion++){
		if(numeros[ubicacion]==minimum && permitido[ubicacion]){
			break;
		}
	}
	if(n==0){
		ubicacion=x-1;
	}
	if(x<=minimum){
		ubicacion=-1;
	}
	cout<<ubicacion+1;
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <climits>
#include <cmath>
#include <utility>
#include <iomanip>

using namespace std;



int main(int argc, char *argv[])
{
	int n;

	//input
	cin >> n;



	//calc
	vector<int> d;
	for (int i = 0; i < n; i++){
		int di;
		cin >> di;
		d.push_back(di);
	}
	sort(d.begin(), d.end());

	int ans = d[n / 2] - d[n / 2 - 1];

	//ans
	cout << ans << endl;



	return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    ll res = (1ll<<60);
    ll A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    for(int x=0;x<=2*max(X, Y);x++){
        ll tmp = x*C + max(X - x/2, 0ll)*A + max(Y - x/2, 0ll)*B;
        chmin(res, tmp);
    }
    cout << res << endl;

    return 0;
}

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

int main () {
    string s, t;
    cin >> s >> t;
    
     
   
    
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    
    
    if (s < t) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int N;
  string S;
  cin >> N;
  rep(i, N){
      cin >> S;
      if(S == "Y"){
          cout << "Four" << endl;
          break;
      }
      if(i == N - 1){
          cout << "Three" << endl;
      }
  }
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        q: usize,
        lr: [(i64, i64); q],
    };

    let n = *lr.iter().map(|(_, r)| r).max().unwrap() as usize;

    let mut sieve = vec![true; n + 1];
    sieve[0] = false;
    sieve[1] = false;
    for i in 2.. {
        if i * i > n {
            break;
        }
        if sieve[i] {
            for j in (i + i..=n).step_by(i) {
                sieve[j] = false;
            }
        }
    }

    let mut c = vec![0; n + 2];
    for i in 1..=n {
        c[i] = c[i - 1]
            + if i % 2 == 0 {
                0
            } else {
                if sieve[i] && sieve[(i + 1) / 2] {
                    1
                } else {
                    0
                }
            };
    }

    for &(l_i, r_i) in lr.iter() {
        println!("{}", c[r_i as usize] - c[(l_i - 1) as usize]);
    }
}


Measured memory_bytes: 5156
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp {
	char name[100];
	int t;
} P;

P Q[LEN];
int head, tail, n;

void enqueue(P x) {
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}

P dequeue() {
	P x = Q[head];
	head = (head + 1) % LEN;
	return x;
}

int min(int a, int b) { return a < b ? a : b; }

int main() {
	int elaps = 0, c;
	int i, q;
	P u;
	scanf("%d %d", &n, &q);
	for (i = 1; i <= n; i++) {
		scanf("%s", &Q[i].name);
		scanf("%d", &Q[i].t);
	}
	head = 1; tail = n + 1;

	while (head != tail) {
		u = dequeue();
		c = min(q, u.t);
		u.t -= c;
		elaps += c;
		if (u.t > 0)enqueue(u);
		else {
			printf("%s %d\n", u.name, elaps);
		}
	}
	return 0;
}

Measured memory_bytes: 10756
#include<bits/stdc++.h>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
const int N=2e5+5;
const int MOD=1e9+7;
//ll a[N],sum[N];
char s[N];
int main(void){
//    ios::sync_with_stdio(false);
//    cin.tie(0);cout.tie(0);

    ll n,m,d;
    cin>>n>>m>>d;
    if(d==0)    printf("%.15Lf\n",(long double)(m-1)/n);
    else    printf("%.15Lf\n",(long double)2*(n-d)*(m-1)/n/n);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  int A, B, T;
  cin >> A >> B >> T;
  cout << T / A * B << '\n';
  return 0;
}


Measured memory_bytes: 3604