akhauriyash/Code-Regression huggingface dataset:
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
300iq as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      static long MOD = 1000000007L;
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int X = Integer.parseInt(st.nextToken());
         int Y = Integer.parseInt(st.nextToken());
         int Z = Integer.parseInt(st.nextToken());
         int all = (1<<(X+Y+Z))-1;
         int bad = 1<<(Z-1);
         bad += 1<<(Y+Z-1);
         bad += 1<<(X+Y+Z-1);
         long[][] dp = new long[N+1][all+1];
         dp[0][0] = 1L;
         for(int i=1; i <= N; i++)
            for(int mask=0; mask <= all; mask++)
               for(int d=1; d <= 10; d++)
               {
                  long lmao = (long)mask;
                  int nextmask = (int)(lmao << d)+(1<<(d-1));
                  nextmask &= all;
                  if((nextmask&bad) != bad)
                  {
                     dp[i][nextmask] += dp[i-1][mask];
                     if(dp[i][nextmask] >= MOD)
                        dp[i][nextmask] -= MOD;
                     
                  }
               }
         long res = 1L;
         for(int i=0; i < N; i++)
            res = (res*10)%MOD;
         for(int mask=0; mask <= all; mask++)
         {
            res -= dp[N][mask];
            if(res < 0)
               res += MOD;
         }
         System.out.println(res);
      }
   }

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

typedef long long ll;


int N = 26;
int D;

vector<int> c(N+1);
vector<vector<int>> s;
vector<int> t;

ll now_score = 0;

ll greedy(){
    vector<int> last(N+1, 0);
    ll greedy_score=0;
    for(int d = 1; d <= D; d++){
        ll max_score = -1e9;
        vector<int> max_last;
        for(int n = 1; n <= N; n++){
            ll tmp_score = 0;
            vector<int> tmp_last(N+1);
            tmp_last = last;
            
            tmp_score +=  s[d][n];
            tmp_last[n] = d;
     
            int penalty = 0;
            for(int i = 1; i <= N; i++){
                penalty += c[i]*(d-tmp_last[i]);    
                
            }
            
            tmp_score -= penalty;

            if(max_score < tmp_score){
                max_score = tmp_score;
                max_last = tmp_last;
                t[d] = n;
            }                    
            
        }
        
        last = max_last;
        greedy_score += max_score;
    }

    return greedy_score;
}


ll scoring(){
    vector<int> last(N+1, 0);
    ll score = 0;
    for(int d = 1; d <= D; d++){

        score += s[d][t[d]];
        last[t[d]] = d;

        int penalty = 0;
        for(int i = 1; i <= N; i++){
            penalty += c[i]*(d-last[i]);    
        }
        
        score -= penalty;            
    }
    return score;
}


void exchange(int d){
    swap(t[d], t[d+1]);

    ll swap_score = scoring();
    
    if(now_score >= swap_score){
        swap(t[d], t[d+1]);
    }else{
        now_score = swap_score;
    }

}



int main(){

    cin>> D;

    s.resize(D+1);
    for(int i=0; i<=D; i++){
        s[i].resize(N+1);
    }
    t.resize(D+1);

    for(int i=1; i<=N; i++){
        cin>>c[i];
    }
 
    for(int i=1; i<=D; i++){
        for(int j=1; j<=N; j++){
            cin>>s[i][j];
        }
    }
    for(int i=1; i<=D; i++){
        cin>>t[i];
    }

    now_score = greedy();

    //解交換
    
    for(int d=1; d<D; d++){
        exchange(d);
    }
    
    for(int i=1; i<=D; i++){           
        cout<<t[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3652
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

Q, H, S, D = getNM()
N = getN()

# 最安値を求める必要がある
one = min(Q * 4, H * 2, S)
two = min(Q * 8, H * 4, S * 2, D)

ans = (N // 2) * two
ans += (N % 2) * one
print(ans)

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

class Program
{
    #region Reader
    static string ReadStr => Console.ReadLine();
    static string[] ReadStrs => Console.ReadLine().Split(' ');
    static int ReadInt => Convert.ToInt32(Console.ReadLine().Trim());
    static int[] ReadInts => Console.ReadLine().Trim().Split(' ').Select(s => Convert.ToInt32(s)).ToArray();
    static long ReadLong => Convert.ToInt64(Console.ReadLine().Trim());
    static long[] ReadLongs => Console.ReadLine().Trim().Split(' ').Select(s => Convert.ToInt64(s)).ToArray();
    #endregion
    #region Method
    const int mod = 1000000007;
    public static int Mod(int a, int mod) { return a % mod >= 0 ? a % mod : a % mod + mod; }
    public static long Mod(long a, long mod = mod) { return a % mod >= 0 ? a % mod : a % mod + mod; }
    #endregion





    /// <summary>
    /// 最大公約数
    /// </summary>
    /// <param name="a"></param>
    /// <param name="b"></param>
    /// <returns></returns>
    public static long Gcd(long a, long b)
    {
        if (a < b)
            // 引数を入替えて自分を呼び出す
            return Gcd(b, a);
        while (b != 0)
        {
            var remainder = a % b;
            a = b;
            b = remainder;
        }
        return a;
    }



    public static Dictionary<int, int> PrimeFactors(int n)
    {
        int i = 2;
        int tmp = n;
        Dictionary<int, int> d = new Dictionary<int, int>();

        while (i * i <= n) //※1
        {
            if (tmp % i == 0)
            {
                tmp /= i;
                if (d.ContainsKey(i)) d[i]++;
                else d.Add(i, 1);
            }
            else
            {
                i++;
            }
        }
        if (tmp != 1)
        {
            if (d.ContainsKey(tmp)) d[tmp]++;
            else d.Add(tmp, 1);
        }
        return d;
    }

    static void Main()
    {
        int N = ReadInt;



        WriteLine(N==1?0:1);
    }
}



Measured memory_bytes: 27504
#include<bits/stdc++.h>
#define int long long
using namespace std;

int n,x[205],y[205],mod=998244353,ans,two[205]={1};

signed main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) two[i]=two[i-1]*2%mod;
	ans=(two[n]-1-n-(n-1)*n/2+mod)%mod;
	for(int i=1;i<=n;i++) scanf("%d%d",x+i,y+i);
	for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++){
		int tot=0;
		for(int k=j+1;k<=n;k++) if((y[i]-y[j])*(x[j]-x[k])==(x[i]-x[j])*(y[j]-y[k])) tot++;
		ans=(ans-two[tot]+mod+1)%mod;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 256
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var a,b int
    fmt.Scan(&a,&b)
    ans := ":("
    if a <= 8 && b <= 8{
        ans = "Yay!"
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


Measured memory_bytes: 640
def main():
    d = int(input())
    c = [int(v) for v in input().split()]
    last = [-1] * 26
    s = []
    for _ in range(d):
        s.append([int(v) for v in input().split()])
    t = []
    for _ in range(d):
        t.append(int(input()))

    td = 0
    for i in range(d):
        test = t[i]-1
        td += s[i][test]
        last[test] = i
        for j in range(26):
            td -= c[j]*(i-last[j])
        print(td)

main()

Measured memory_bytes: 9416
#include <bits/stdc++.h>
#define For(i, l, r) for(int i = (l); i <= (int)(r); ++i)
#define Fordown(i, r, l) for(int i = (r); i >= (int)(l); --i)
#define Set(a, v) memset(a, v, sizeof(a))
using namespace std;

inline int read() {
	int x = 0, fh = 1; char ch;
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
	for (; isdigit(ch); ch = getchar()) x = (x<<1) + (x<<3) + (ch^'0');
	return x * fh;
}

int gcd (int x, int y) { return y == 0 ? x : gcd(y, x%y); }

int main() {
	int n = read(), k = read();
	bool flag = false;
	int ans = read();
	if (ans >= k) flag = true;
	For (i, 2, n) {
		int val = read();
		if (val >= k) flag = true;
		ans = gcd (ans, val);
	}
	if (k % ans == 0 && flag) printf ("POSSIBLE\n");
	else printf ("IMPOSSIBLE\n");
}

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

if N < 10:
    print(N)
elif 10 <= N and N < 100:
    print(9)
elif 100 <= N and N < 1000:
    ans = 9 + N - 99
    print(ans)
elif 1000 <= N and N < 10000:
    ans = 9 + 999 - 99
    print(ans)
elif 10000 <= N and N < 100000 :
    ans = 909 + N - 9999
    print(ans)
elif N == 100000 :
    ans = 909 + 99999 - 9999
    print(ans)

Measured memory_bytes: 3188
#include <cassert>
#include <cstddef>
#include <utility>
#include <vector>


template <class Abelian> class PotentializedUnionFind {

public:
	using value_type = Abelian;
	using difference_type = std::ptrdiff_t;
	using container_type = std::vector<std::pair<difference_type, value_type>>;
	using const_reference = const value_type &;
	using size_type = typename container_type::size_type;

protected:
	container_type c;

private:
	value_type potential(size_type x) {
		value_type ret = {};
		while (c[x].first >= static_cast<difference_type>(0)) {
			if (c[static_cast<size_type>(c[x].first)].first >=
				static_cast<difference_type>(0)) {
				c[x].second =
					c[static_cast<size_type>(c[x].first)].second + c[x].second;
				c[x].first = c[static_cast<size_type>(c[x].first)].first;
			}
			ret = ret + c[x].second;
			x = static_cast<size_type>(c[x].first);
		}
		return std::move(ret);
	}

public:
	PotentializedUnionFind() : c() {}
	explicit PotentializedUnionFind(const size_type size)
		: c(size, std::make_pair(-1, value_type())) {}

	size_type size() const { return c.size(); }
	bool empty() const { return c.empty(); }

	size_type find(size_type x) {
		assert(x < size());
		while (c[x].first >= static_cast<difference_type>(0)) {
			if (c[static_cast<size_type>(c[x].first)].first >=
				static_cast<difference_type>(0)) {
				c[x].second =
					c[static_cast<size_type>(c[x].first)].second + c[x].second;
				c[x].first = c[static_cast<size_type>(c[x].first)].first;
			}
			x = static_cast<size_type>(c[x].first);
		}
		return x;
	}
	value_type diff(const size_type x, const size_type y) {
		assert(x < size());
		assert(y < size());
		return potential(y) + (-potential(x));
	}
	bool same(const size_type x, const size_type y) {
		assert(x < size());
		assert(y < size());
		return find(x) == find(y);
	}
	size_type size(const size_type x) {
		assert(x < size());
		return static_cast<size_type>(-c[find(x)].first);
	}

	bool unite(size_type x, size_type y, value_type d) {
		assert(x < size());
		assert(y < size());
		d = d + diff(y, x);
		x = find(x);
		y = find(y);
		if (x == y)
			return false;
		if (c[x].first > c[y].first)
		std::swap(x, y), d = -d;
		c[x].first += c[y].first;
		c[y] = std::make_pair(static_cast<difference_type &&>(x), std::move(d));
		return true;
	}
};

#include<iostream>

int main() {
	int n, q;
	std::cin >> n >> q;
	PotentializedUnionFind<int> T(n);
	while (q--) {
		int t, x, y, z;
		std::cin >> t >> x >> y;
		if (t) {
			if (T.same(x, y))
				std::cout << T.diff(x, y) << std::endl;
			else
				std::cout << "?" << std::endl;
		}
		else {
			std::cin >> z;
			T.unite(x, y, z);
		}
	}
	return 0;
}



Measured memory_bytes: 4384
#include<iostream>
using namespace std;
int main()
{
    int R,G,B,N;
    cin >> R >> G >> B >> N;
    int rlim = N/R;
    int glim;
    int cnt = 0;
    for(int r = 0;r<=rlim;r++){
      int tmpN = N;
      tmpN = tmpN - R*r;
      //cout<<tmpN;
      if(tmpN == 0){
        cnt++;
      }
      else{
        glim = tmpN/G;
        for(int g = 0;g<=tmpN/G;g++){
          int prev = tmpN;
          tmpN = tmpN - G*g;
          if(tmpN % B == 0){
            cnt++;

          }
          tmpN = prev;
        }
      }
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

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

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ldouble = long double;

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

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

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


int main()
{
	ll a, b;
	cin >> a >> b;

	println((500 * a >= b ? "Yes" : "No"));
}


Measured memory_bytes: 3620
/* https://atcoder.jp/contests/abc096/tasks/abc096_c */

#include <iostream>
#include <vector>
#include <string>

bool solve(const int H, const int W, std::vector<std::vector<int>> &matrix)
{
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      if (matrix.at(i).at(j) == 0) {
        continue;
      }
      int idx_top = i-1 > 0 ? i-1 : 0;
      int idx_bottom = i+1 < H ? i+1 : i;
      int idx_left = j-1 > 0 ? j-1 : 0;
      int idx_right = j+1 < W ? j+1 : j;

      bool is_white_top = matrix.at(idx_top).at(j) == 0;
      bool is_white_bottom = matrix.at(idx_bottom).at(j) == 0;
      bool is_white_left = matrix.at(i).at(idx_left) == 0;
      bool is_white_right = matrix.at(i).at(idx_right) == 0;

      if (is_white_top && is_white_bottom && is_white_left && is_white_right) {
        return false;
      }
    }
  }
  return true;
}

int main(int argc, char *argv[])
{
  // Input
  int H, W;

  std::cin >> H >> W;

  std::vector<std::vector<int>> matrix(H, std::vector<int>(W));

  for (int i = 0; i < H; ++i) {
    std::string line;
    std::cin >> line;

    for (int j = 0; j < W; ++j) {
      matrix.at(i).at(j) = line.at(j) == '#' ? 1 : 0;
    }
  }

  // Output
  if (solve(H, W, matrix)) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
//	freopen("input.txt","r",stdin);
	int a,b,c;
	int cnt=0;
	cin>>a>>b>>c;
	while(1){
		if(a&1||b&1||c&1){
			printf("%d\n",cnt);
			break;
		}
		if(a==b&&b==c){
			printf("-1\n");
			break;
		}
		int tmp1 = a;
		int tmp2 = b;
		a = tmp2 / 2 + c / 2;
		b = tmp1 / 2 + c / 2;
		c = tmp1 / 2 + tmp2 / 2;
		cnt++;
	}
	return 0;
}

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

int n, s;
int memo[11][11][1024][400];

int solve( int t, int state, int sum ) {
    if ( sum < 0 ) return 0;
    if ( t == n + 1 ) return sum == 0;
    if ( memo[n][t][state][sum] != -1 ) return memo[n][t][state][sum];
    int answer = 0;
    for ( int i = 0; i < 10; ++ i ) {
        if ( state & ( 1 << i ) ) continue;
        answer += solve( t + 1, state | ( 1 << i ), sum - i * t );
    }
    return memo[n][t][state][sum] = answer;
}

int main() {
    for ( int i = 0; i < 11; ++ i ) {
        for ( int j = 0; j < 11; ++ j ) {
            for ( int k = 0; k < 1024; ++ k ) {
                for ( int l = 0; l < 400; ++ l ) {
                    memo[i][j][k][l] = -1;
                }
            }
        }
    }
    while ( scanf( "%d%d", &n, &s ) != EOF ) {
        printf( "%d\n", ( n > 10 || s > 340 ) ? 0 : solve( 1, 0, s ) );
    }

    return 0;
}

Measured memory_bytes: 0
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N = int(input())
    S = [input() for _ in range(N)]

    T = sorted((set(S)))
    l = len(T)

    D = {}
    for i in range(l):
        D[T[i]] = 0
    for i in range(N):
        D[S[i]] += 1

    m = max(D.values())
    for i in range(l):
        if D[T[i]] == m:
            print(T[i])


if __name__ == '__main__':
    main()


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

using System.Collections;

class Program
{
    static void Main()
    {
        int[] rdx = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        int r = rdx[0];
        int D = rdx[1];
        int X2000 = rdx[2];

        int currentX = X2000;

        for(int i = 0; i < 10; i++)
        {
            int next = r * currentX - D;
            Console.WriteLine(next);
            currentX = next;
        }



    }    
}


Measured memory_bytes: 13268
//                          **********  YATIN KWATRA  ********** 

//AC bakshi Rabha

#include <bits/stdc++.h>
#define ll                      long long 
#define ull                     unsigned long long 
#define FIO                     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl                    "\n"
#define fo(i,a,b)               for(int i = a; i<=b ; i++)
#define rfo(i,a,b)              for(int i = a; i>=b ; i--)
#define vii                      vector<int>
#define vll                     vector<ll>
#define pq                      priority_queue
#define uom                      unordered_map                
#define all(v)                  v.begin(),v.end()
#define mp                      make_pair
#define pb                      push_back
#define pob                     pop_back
#define ff                      first
#define ss                      second
#define pii                     pair<int,int> 
#define pll                     pair<long,long>
#define mll                     map<long,long>
#define mii                     map<int,int>
#define vvii                    vector<vii>
#define mod                     1000000007
// #define node                    Node

using namespace std;

void INPUT() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

}


void solve()
{ 
        int n;
        cin >> n;

        int d = n%10;

        if(d == 2 or d == 4 or d == 5 or d == 7 or d == 9) cout << "hon\n";
        else if(d == 1 or d == 6 or d == 8 or d == 0) cout << "pon\n";
        else cout << "bon\n";

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


Measured memory_bytes: 3612
n=int(input())
S=input()

ans=0
for i in range(10):
  for j in range(10):
    for k in range(10):
      idxi=S.find(str(i))
      if idxi==-1:
        continue
      idxj=S.find(str(j),idxi+1)
      if idxj==-1:
        continue
      idxk=S.find(str(k),idxj+1)
      if idxk==-1:
        continue
      ans+=1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
char a[5]={'a','e','i','o','u'};
int main()
{
    char c;
    c=getchar();
    for(int i=0;i<5;i++)
    {
        if(c==a[i])
        {
            cout<<"vowel"<<endl;
            return 0;
        }
    }
    cout<<"consonant"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long 
#define float long double 
#define el '\n'
#define all(a) (a).begin(),(a).end()
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
        enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
        ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
        *this << "[";
        for (auto it = d.b; it != d.e; ++it)
                *this << ", " + 2 * (it == d.b) << *it;
        ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

void dfs(int v,int dist,vector<int>graph[],vector<int>&in_degree,vector<int>& dp){
        for(int child : graph[v]){
                dp[child] = max(dp[child],dp[v]+1);
                in_degree[child]--;
                if(in_degree[child] == 0){
                        dfs(child,dist+1,graph,in_degree,dp);
                }
        }
}

signed main(){         
        IOS;
        int n , m ;
        cin >> n >> m ; 

        vector<int>graph[n+1];
        vector<int>in_degree(n+1,0);
        vector<int>dp(n+1,0);

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

        // imagine an extra vertex 0 which is connected to all the vertex ---> ans is longest distance form vertex 0 to any other vertex

        for(int i=1;i<=n;i++){
                in_degree[i]++;
                graph[0].push_back(i);
        }

        dfs(0,0,graph,in_degree,dp);

        cout << (*max_element(all(dp))) - 1 << endl ;

        return 0;
}

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

int main(int argc, char **argv)
{
	float s=0, ax, ay, bx, by, cx, cy, z, a, b, c;
	scanf("%f,%f", &ax, &ay);
	scanf("%f,%f", &bx, &by);
	
	while(scanf("%f,%f", &cx, &cy)!=EOF){
		a = sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
		b = sqrt((bx-cx)*(bx-cx)+(by-cy)*(by-cy));
		c = sqrt((cx-ax)*(cx-ax)+(cy-ay)*(cy-ay));
		z = (a+b+c)/2;
		s += sqrt(z*(z-a)*(z-b)*(z-c));
		bx = cx;
		by = cy;
	}
	printf("%.6f\n", s);
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
    int n,y;
    int ans[3]={-1,-1,-1};
    cin >>n>>y;
    
    for(int a=0;a<=n;a++){
        for(int b=0;b<=n-a;b++){
            if(y== a*10000+b*5000+(n-a-b)*1000){
                ans[0]=a;
                ans[1]=b;
                ans[2]=n-a-b;
            }
        }
    }


    printf("%d %d %d\n",ans[0],ans[1],ans[2]);
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <string>
#include <unordered_map>
#include <cmath>

typedef long long ll;
typedef long double ld;

using namespace std;
int main()
{
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); i++)
  {
    if (s[i] == '7')
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3616
N = int(input())
h = list(map(int,input().split()))
h += [0]
add = False
ans = 0
for n in range(100):
    for i in range(N+1):
        if h[i] != 0:
            h[i] -= 1
            add = True
        else:
            if add:
                ans += 1
            add = False
print(ans)

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

int main()
{
    int n,m;
    cin >> n >> m;
    vector<string> s(n);
    for(int i = 0;i < n;i++) cin >> s[i];
    sort(s.begin(),s.end());
    for(int i = 0;i < n;i++) cout << s[i];
    cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<string > vecstr;
int main()
{
  int n;
  cin >> n;
  cout << pow(2,(int)log2(n)) << endl;
}


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

# N = 1000000000000001

alphabet = [chr(ord('a') + i) for i in range(26)]

resid = []

while(True):
    q, mod = divmod(N - 1, 26)

    resid.append(mod)

    if(q == 0):
        break

    N = q

# print(resid)

for i in range(len(resid)):
    e = resid.pop()

    print(alphabet[e], end = "")

print("")


Measured memory_bytes: 9176
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>
#include <array>
#include <stack>
#include <queue>
#include <list>

using namespace std;

//???????????°??????TEST????????????????????¬???????????????????????????????????¢????????????
//#define TEST //*******************************************************************************************************************************************

//?????????????????¨??§?????\????????????????????????????????°?????????????¨???????????????????dout???????????????????????§???????????¬??????????????????????????????????????????
#ifdef TEST
    #define dout cout
#else
    stringstream dummy; //???????????°??????dout?????????????????????????????????
    #define dout dummy.str(""); dummy.clear(stringstream::goodbit); dummy //dummy?????????????????????????????????????????¨?????¢?????¢???????????????
    //???????????¨??????????????????goodbit?????????????????????????????¨???????????´????????????????????????????????¨?????°?????????????????§???????????????????????????????????? http://d.hatena.ne.jp/linden/20060427/p1
#endif


void deleteX(list<int> &list, int x) {
    for(auto itr=list.begin(); itr!=list.end(); itr++ ) {
        if(*itr==x) {
            list.erase(itr);
            break;
        }
    }
}


int main(void) {
    list<int> list;
    int n;
    string order;
    int x;
    
    cin >> n;
    
    for(int i=1; i<=n; i++) {
        
        cin >> order;
        
//        dout << order << " " << x << endl;
        
        if(order=="insert") {
            cin >> x;
            list.push_front(x);
        }
        else if(order=="delete") {
            cin >> x;
            deleteX(list, x);
        }
        else if(order=="deleteFirst") {
            list.pop_front();
        }
        else if(order=="deleteLast") {
            list.pop_back();
        }
    }
    
    
    
    
    
    //display list
//    dout << "---- display list ---- \n";
    for(auto itr=list.begin(); itr!=list.end(); itr++ ) {
        if(itr==list.begin()) {
            cout << *itr;
        } else {
            cout << " " << *itr;
        }
    }
    cout << endl;
    
    return 0;
}

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

#[fastout]
fn main() {
  input! {
    n: [i32;5],
  }
  let mut ans = 0;
  for v in (1..=5) {
    if n[v as usize -1] == 0 {
      ans = v;
    }
  }
  
  println!("{}",ans);
}


Measured memory_bytes: 2120
import sys
s = input()
t = input()
ans = 0
for i in range(len(s)- len(t) + 1):
    cnt = 0
    for j in range(len(t)):
        if t[j] == s[i+j]:
            cnt += 1
    ans = max(ans,cnt)
print(len(t)-ans)

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

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

  deque<ll> ans;

  rep(i, n) {
    if(i%2==0) ans.push_back(a[i]);
    else ans.push_front(a[i]);
  }
  if(n%2==1) reverse(ALL(ans));

  vector<ll> res;
  for(auto x : ans) res.push_back(x);
  line_out(res);
}

Measured memory_bytes: 9620
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a <= 9 && b <= 9)
		cout << a * b << endl;
	else
		cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Int long long
#define MOD 1000000009
using namespace std;


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


Measured memory_bytes: 4052
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//値の入力
		int N = sc.nextInt();
		int K = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();
		//合計金額
		int sum = 0;
		//条件分岐
		if(N <= K) {
			for(int i = 1; i <= N; i++) {
				sum += X;
			}
		}else {
			for(int i = 1; i <= K; i++) {
				sum += X;
			}
			for(int i = K+1; i <= N; i++) {
				sum += Y;
			}
		}
		System.out.println(sum);
	}

}


Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
const int MAXN=200100,MAXM=1000100,INF=0x3f3f3f3f;
struct Edge
{
	int to,val,nxt;
	inline Edge() {}
	inline Edge(register int to,register int val,register int nxt):to(to),val(val),nxt(nxt) {}
};
Edge e[MAXM];
int head[MAXN],S,T,cnt=-1;
int d[MAXN],cur[MAXN];
int vis1[MAXN],vis2[MAXN],id[MAXN],nxt[MAXN];
int N;
queue<int> q,q_;
vector<int> bel[MAXN];
inline void Addedge(register int x,register int y,register int z)
{
	e[++cnt]=Edge(y,z,head[x]),head[x]=cnt;
	e[++cnt]=Edge(x,0,head[y]),head[y]=cnt;
	return;
}
inline bool bfs()
{
	while(!q.empty()) q.pop();
	memset(d,-1,sizeof(d));
	d[S]=0,cur[S]=head[S],q.push(S);
	while(!q.empty())
	{
		register int now=q.front(); q.pop();
		for(register int i=head[now];~i;i=e[i].nxt)
			if(e[i].val&&(!(~d[e[i].to])))
			{
				register int to=e[i].to;
				d[to]=d[now]+1,cur[to]=head[to];
				if(to==T) return 1;
				q.push(to);
			}
	}
	return 0;
}
inline int dfs(register int now,register int num)
{
	if(now==T||!num) return num;
	register int ans=0;
	for(register int &i=cur[now];~i;i=e[i].nxt)
		if(e[i].val&&d[e[i].to]==d[now]+1)
		{
			register int to=e[i].to;
			register int f=dfs(to,min(num,e[i].val));
			if(f)
			{
				e[i].val-=f,e[i^1].val+=f;
				ans+=f,num-=f;
				if(!num) break;
			}
		}
	return ans;
}
inline int maxflow()
{
	register int ans=0;
	while(bfs()) ans+=dfs(S,INF);
	return ans;
}
inline bool solve(register int n)
{
	for(register int i=1;i<n;i++)
		for(register int j=head[n+i];~j;j=e[j].nxt)
			if(e[j].to&&!e[j].val) id[i]=e[j].to,vis1[e[j].to]=1;
	for(register int i=1;i<=n;i++)
		if(!vis1[i]) q_.push(i);
	register int cnt_=0;
	while(!q_.empty())
	{
		register int now=q_.front(); q_.pop();
		cnt_++;
		for(register int i=0;i<(int)bel[now].size();i++)
			if(!vis2[bel[now][i]])
			{
				register int to=bel[now][i];
				vis2[to]=1,nxt[to]=now,q_.push(id[to]);
			}
	}
	return cnt_==n;
}
int main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	memset(head,-1,sizeof(head));
	cin>>N;
	S=0,T=N<<1;
	for(register int i=1,x,y;i<N;i++)
	{
		cin>>x;
		Addedge(S,N+i,1);
		for(register int j=1;j<=x;j++) cin>>y,Addedge(N+i,y,1),bel[y].push_back(i);
	}
	for(register int i=1;i<=N;i++) Addedge(i,T,1);
	if(maxflow()<N-1) return puts("-1"),0;
	if(!solve(N)) return puts("-1"),0;
	for(register int i=1;i<N;i++) cout<<id[i]<<" "<<nxt[i]<<"\n";
	cout<<endl;
	return 0;
}

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

int main() {
    long long X;
    cin >> X;

    int A = 0;
    int B = 0;

    A = X / 500;
    B = (X % 500) / 5;

    cout << 1000 * A + B * 5 << endl;

}

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

vector<vector<int>> aij;
int costss[20];
int res=INT_MAX;
int thre[20];
int n,m,x;

bool helper(int sumcost){
  rep(i,m){
    if(thre[i]>0) return false;
  }
  res = min(res,sumcost);
  return true;
}

int solve(int idx,int cost){
  if(idx==n) return 1;
  rep(i,m){
    thre[i]-=aij[idx][i];
  }
  solve(idx+1,cost + costss[idx]);
  helper(cost+costss[idx]);
  rep(i,m){
    thre[i]+=aij[idx][i];
  }
  solve(idx+1,cost);
  helper(cost);
  return 1;
}

int main(){
  int num;
  cin >> n >> m >> x;

  rep(i,n){
    vector<int> tmp;
    cin >> costss[i];
    rep(j,m){
      cin >> num;
      tmp.push_back(num);
  	}
    aij.push_back(tmp);
  }
  rep(i,m) thre[i]=x;
  solve(0,0);
  if(res==INT_MAX)
    res = -1;
  cout << res;
  return 0;
}

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

int main(){
    long long int x,y,a;
    cin>>x>>y;
    int cnt;
    a=x;
    for(int i=1;;i++){
        if(y<a)break;
        cnt++;
        a=a*2;
    }
    cout<<cnt;
    return 0;
}

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

template <class S>
void print(vector<vector<S>> &v) {
  for (ll i = 0; i < (ll)v.size(); i++) {
    for (ll j = 0; j < (ll)v[i].size(); j++) {
      cout << v[i][j] << ' ';
    }
    cout << endl;
  }
}

int n;
int s;
int ans = 0;
int visited[500000];
int memo[500000];
int idx(int x, int y){
    if(x<y) swap(x,y);
    return y * (2*n - y - 1) /2 + x - y - 1;
}

int dfs(int node, vector<vector<int>> &edge) {
    if(visited[node]){
      if (visited[node] == 1) {
        cout << "-1\n";
        exit(0);
      }
      return memo[node];
    }
    visited[node] = 1;
    for(int i: edge[node]){
        memo[node] = max(memo[node], dfs(i, edge)+1);
        ans = max(ans, memo[node]+1);
    }
    visited[node] = 2;
    return memo[node];
}

int main(void){
    cin >> n;
    s = n*(n-1)/2;
    vector<vector<int>> edge(s,vector<int>());
    rep(i,n){
        int par;
        cin >> par;
        rep(j,n-2){
            int chi;
            cin >> chi;
            edge[idx(i,par-1)].push_back(idx(i,chi-1));
            par = chi;
        }
    }
    //print(edge);
    rep(i,s){
        if(!visited[i]){
          dfs(i, edge);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 31488
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

N, M = mi()

if N>=M:
  print(0)
  exit()

Xs = sorted(list(mi()))
gaps = [0] * (M-1)

for i in range(M-1):
  gaps[i] = Xs[i+1] - Xs[i]

gaps = sorted(gaps, reverse=True)

print(sum(gaps[N-1:]))

Measured memory_bytes: 54440
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	im := map[int]int{}
	for i := 0; i < n; i++ {
		a := getNextInt(scanner)
		im[a] = im[a] + 1
		if im[a] == 2 {
			fmt.Fprintln(writer, "NO")
			return
		}
	}
	fmt.Fprintln(writer, "YES")
}


Measured memory_bytes: 12800
from sys import stdin

n = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]

result = 'APPROVED'
for i in a:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            result = 'DENIED'


print(result)

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

 using namespace std;

 int main() {
   long long A, B, C;
   cin >> A >> B >> C;

   if (A * B * C % 2 == 0) cout << 0 << endl;
   else cout << min(A * B, min(B * C, C * A)) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
	int a,b,c,d,e,f;
	char zyunkai[1025],train[27]={""},X[27]={""};
	scanf("%d",&a);
	for(b=0;b<a;b++)
	{
		scanf("%s",&zyunkai);
		train[0]=zyunkai[0];
		d=1;
			for(c=3;;c+=3)
			{
				if(strchr(train,zyunkai[c])==NULL&&zyunkai[c-1]=='>')
				{
					train[d]=zyunkai[c];
					d++;
				}
				else if(strchr(train,zyunkai[c])==NULL&&zyunkai[c-2]=='<')
				{
					X[0]=zyunkai[c];
					strcat(X,train);
					strcpy(train,X);
					d++;
				}
				f=strlen(X);
				for(e=0;e<f;e++)
					X[e]=NULL;
				if(zyunkai[c+1]==NULL)
					break;
			}
		printf("%s\n",train);
		f=strlen(train);
		for(e=0;e<f;e++)
			train[e]=NULL;
		f=strlen(zyunkai);
		for(e=0;e<f;e++)
			zyunkai[e]=NULL;
	}
	return 0;
}

Measured memory_bytes: 608
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
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;
}

ll M = 1000000007;
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
void solve()
{
	ll n;
	cin>>n;
	ll ans=1;
	ans*=modpow(10,n,M);
	ans%=M;
	ans+=modpow(8,n,M);
	if(ans<0){
		ans+=M;
	}
	ans%=M;
	ans-=modpow(9,n,M);
	ans%=M;
	if(ans<0){
		ans+=M;
	}
	ans-=modpow(9,n,M);
	ans%=M;
	if(ans<0){
		ans+=M;
	}
	cout<<ans<<endl;

}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long n, k;
    cin >> n >> k;
    long long res = 0;
    for (long long b = k + 1; b <= n; b++) {
        res += n / b * (b - k);
        res += max(0LL, n - (n / b * b + k) + 1LL);
    }
    if (!k) res = n * n;
    cout << res << "\n";
    return 0;
}

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

typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
const double pi = 3.141592653589793238;

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


int main() {
  string N;
  cin >> N;
  if(N.at(0) == '7' || N.at(1) == '7' || N.at(2) == '7') {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

}


Measured memory_bytes: 3592
S = input()

# 一人ずつ場所を確定させる
# 進行方向に見ていって反対方向のシンボルが現れたら停留点はその場所のLRのどちらか偶奇で判断

import bisect

l = []
x = 0
for s1, s2 in zip(S[0] + S, S):
    if s1 != s2:
        x += 1
    l.append(x)

ans = [0] * len(S)
for i in range(len(S)):
    if S[i] == 'R':
        target = bisect.bisect_left(l, l[i]+1, lo=i)
    else:
        target = bisect.bisect_right(l, l[i]-1, hi=i) - 1
    
    # 余りが出れば、targetがLなら+1、Rなら-1
    diff = abs(target - i)
    if diff % 2 == 1:
        if S[i] == 'R':
            target -= 1
        else:
            target += 1
    
    ans[target] += 1

print(*ans)

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

int main() {
  int A=0, B=0, C=0;
  bool flag = false;
  cin >> A >> B >> C;
  // あまりの問題は周期に注目
  // 今回はたかだか割る数のB分だけ調べればOK
  rep(b, B){
    if ((A * (b+1)) % B == C) flag = true;
  }
  if (flag==true) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#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, k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i, n) cin >> h[i];

  sort(h.rbegin(), h.rend());

  int cnt = 0;
  ll ans = 0;
  rep(i, n) {
    if (cnt < k) {
      cnt++;
      continue;
    } else
      ans += h[i];
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024