akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  string res = "";
  for(int i = 0; i < s.length(); i++){
    if(s[i] == '0') res += "0";
    else if(s[i] == '1') res += "1";
    else{
      if(res.length() != 0){
        string kari = res;
        res = "";
        for(int j = 0; j < kari.length()-1; j++) res += kari[j];
      }
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)
#define Graph vector<vecctor<ll>>
#define pairs vector<pair<ll,ll>>
#define pb push_back



using namespace std;
using ll = long long;
const ll INF = 1e18;
const double PI = acos(-1);

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(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    ll a,b;
    cin >> a >> b;
    ll tmp = a;
    a = max(a,b);
    b = min(tmp,b);
    tmp = a;
    while(tmp%b != 0){
        tmp += a;
    }
    cout << tmp << endl;
    return 0;
}


Measured memory_bytes: 3648
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    int n;
    int[] a;
    void run() {
        Scanner sc = new Scanner(System.in);

        n = sc.nextInt();
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt() + 1;
        }
        System.out.println(solve());
    }

    long MOD = 1000000007;
    long solve() {
        int[] cnt = new int[n + 1];
        cnt[0] = 3;


        long ans = 1;
        for (int i = 0; i < n; i++) {
            int idx = a[i];
            ans = ans * cnt[idx - 1] % MOD;
            cnt[idx - 1] --;
            cnt[idx] ++;
            if (cnt[idx - 1] < 0 || cnt[idx] > 3) return 0;
        }
        return ans;
    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }

}


Measured memory_bytes: 53016
#include <iostream>
using namespace std;
#define pb push_back
int n;
long int min(long int a,long int b){
    return a>b?b:a;
}
int main() {
        int i,x;
    cin>>n;
 int h[n];
 long int dp[n+1];
    for(i=0;i<n;i++)
             cin>>h[i];
     dp[0]=10000000;
        dp[1]=0;dp[2]=abs(h[1]-h[0]);
        for(i=2;i<n;i++){
            dp[i+1]=min(abs(h[i]-h[i-1])+dp[i],abs(h[i]-h[i-2])+dp[i-1]);
            
        }
        cout<<dp[n];

	return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;cin >> n;
  while(n--){
    string s;cin >> s;
    vector<int> v;
    for(int i=0;i<s.size();i++){
      v.push_back(s[i]-'0');
    }
    int a=0,x=0;
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++){
      x*=10;
      x+=v[i];
    }
    sort(v.begin(),v.end(),greater<int>());
    for(int i=0;i<v.size();i++){
      a*=10;
      a+=v[i];
    }
    cout << a-x << endl;
  }
}

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

int main()
{
    int n,k;
    cin>>n>>k;
    int s[n];
    for(int i=0;i<n;i++)
    {  cin>>s[i];
       }
    sort(s,s+n);
   long long int sum=0;
    for(int i=0;i<n-k;i++)
    {
     sum=sum+s[i];}
  
  cout<<sum<<endl;
     return 0;

}


Measured memory_bytes: 1024
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

#include <iostream>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007

ll n, m, s[110000], t6 = 0, t1 = 0, t4 = 0, tt[110000], tc = 0;
bool used[110000];
vector<vector<ll>> list(200000);

void dfs(ll a) {
	if (a == tt[1]) tc++;
	else {
		REP(i, list[a].size()) {
			if (!used[list[a][i]]) {
				if (list[a][i] != tt[1])used[list[a][i]] = true;
				dfs(list[a][i]);
			}
		}
	}
}
int main() {
	cin >> n >> m;
	REP(i, m) {
		ll a, b;
		cin >> a >> b;
		s[a]++;
		s[b]++;
		list[a].push_back(b);
		list[b].push_back(a);
	}
	REPO(i, n) {
		if (s[i] >= 6)t6++;
		if (s[i] == 4) {
			tt[t4] = i;
			t4++;
		}
		if (s[i] % 2 == 1)t1++;
	}
	if (t6 > 0 and t1 == 0)cout << "Yes" << endl;
	else if (t1 == 0 and t4 >= 3)cout << "Yes" << endl;
	else if (t1 == 0 and t4 >= 2) {
		used[tt[0]] = true;
		dfs(tt[0]);
		if (tc == 2)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	else cout << "No" << endl;
}


Measured memory_bytes: 9728
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

int main(){
    int N;
    cin >> N;
    int F[110][15]={0};
    for (int i=0;i<N;i++){
	for (int j=0;j<10;j++){
	    cin >> F[i][j];
	}
    }
    ll P[110][15]={0};
    for (int i=0;i<N;i++){
	for (int j=0;j<11;j++){
	    cin >> P[i][j];
	}
    }

    ll res=-1000000000;
    for (int i=1;i<1024;i++){
	bool bit[10];
	for (int j=0;j<10;j++) bit[j]=false;
	int x=i,cnt=0;
	while (x > 0){
	    if (x%2 == 1) bit[cnt]=true;
	    x/=2;
	    cnt++;
	}

	ll pre=0;
	for (int j=0;j<N;j++){
	    int num=0;
	    for (int k=0;k<10;k++){
		if ((bit[k]) && (F[j][k])) num++;
	    }

	    pre+=P[j][num];
	}

	res=max(res,pre);
    }

    cout << res << endl;

    return 0;
}

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

int main()
{
  	int n;
  	cin>>n;
  	int a[n+1];
  	a[0] = 0;
  	for(int i = 1; i < n+1; i++)
      	cin>>a[i];
  	int k = 1, c = 0;
  	bool flag = false;
  	while(c < n)
    {
    	if(a[k] == 2 && k != 0)
        {
          	flag = true;
          	break;
        }
      	k = a[k];
      	c++;
    }
  	if(flag)
      	cout<<c+1;
  	else
      	cout<<-1;
	return 0;
}

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

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

    std::vector<int> A(N);
    std::vector<int> B(N);
    std::vector<int> C(N);

    for (int i = 0; i < N; ++i) {
        std::cin >> A[i];
    }

    for (int i = 0; i < N; ++i) {
        std::cin >> B[i];
    }

    for (int i = 0; i < N; ++i) {
        std::cin >> C[i];
    }

    std::sort(A.begin(), A.end());
    std::sort(B.begin(), B.end());
    std::sort(C.begin(), C.end());

    uint64_t sum = 0;
    for (int i = 0; i < N; ++i) {
        auto itr_a = std::lower_bound(A.begin(), A.end(), B[i]);
        const uint64_t cnt_a = N - std::distance(itr_a, A.end());

        auto itr_c = std::lower_bound(C.begin(), C.end(), B[i] + 1);
        const uint64_t cnt_c = std::distance(itr_c, C.end());

        sum += cnt_a * cnt_c;
    }

    std::cout << sum << std::endl;

    return 0;
}


Measured memory_bytes: 1408
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
static double[,,] dp = new double[301,301,301];//残り1,2,3の皿の枚数:=その時点からの期待値
static int n = int.Parse(Console.ReadLine());
static int[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
static int[] aims = new int[3];

	static void Main()
	{

    for(int i = 0; i <= 300; i++)
    {
      for(int j = 0; j <= 300; j++)
      {
        for(int k = 0; k <= 300; k++)
        {
          dp[i,j,k] = -1;
        }
      }
    }
    dp[0,0,0] = 0;

    for(int i = 0; i < n; i++)
    {
      aims[nums[i]-1]++;
    }
    
		Console.WriteLine(DP(aims[0],aims[1],aims[2]));
	}

  static double DP(int a, int b, int c)
  {
    if(dp[a,b,c] != -1) return dp[a,b,c];

    double answer = n;
    if(a>0) answer += DP(a-1,b,c)*a;
    if(b>0) answer += DP(a+1,b-1,c)*b;
    if(c>0) answer += DP(a,b+1,c-1)*c;
    answer /= (double)(a+b+c);
    return dp[a,b,c] = answer;
  }
  
}

Measured memory_bytes: 224212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //10^19 < 9223372036854775807
typedef unsigned long long ull; //10^20 < 18446744073709551615

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 

#define MOD 1000000007

int main(void)
{
    ll N, X, T;
    cin >> N >> X >> T;

    ll ans = ceil((double)N/X)*T;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3588
def examA():
    S, W = LI()
    if S<=W:
        print("unsafe")
    else:
        print("safe")
    return

def examB():
    A, B, C, D = LI()
    while(True):
        C -= B
        if C<=0:
            print("Yes")
            break
        A -= D
        if A<=0:
            print("No")
            break
    return

def examC():
    N = I()
    S = [SI()for _ in range(N)]
    Set = set(S)
    ans = len(Set)
    print(ans)
    return

def examD():
    S = SI()
    N = len(S)
    D = [0]*(N+1)
    for i in range(N):
        D[i+1] = (D[i]+int(S[N-1-i])*pow(10,i,2019))%2019
    #print(D)
    ans = 0
    C = Counter(D)
    #print(C)
    for c in C.values():
        ans += (c-1)*c//2
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examD()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

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

int main() {
  string S;
  cin >> S;
  int ans = 700;
  if (S[0] == 'o') ans += 100;
  if (S[1] == 'o') ans += 100;
  if (S[2] == 'o') ans += 100;
  cout << ans << endl;
}

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

x= len(str(N))

# print(x)

if(not x%2==0):
    total+= (N-(10**(x-1)))+1
    x -= 1

# print(total)

for i in range(x):
    if (i%2==0):
        total+= 9*(10**i)

print(total)

Measured memory_bytes: 3060
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#include <cstdint>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

long x, y;

int main(){
    scanf("%ld%ld", &x, &y);
    if(2*x <= y && y <= 4*x && y % 2 == 0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}


Measured memory_bytes: 3696
# -*- coding: utf-8 -*-

#同じ数字が連続する箇所が存在するならBad, そうでなければGood

S = input()
jud = False

#もし4桁じゃなかったら×
if len(S) != 4:
    print("4桁でありません")

for i in range(0,3):
    if S[i] == S[i+1]:
        jud = True
    else:
        pass

if jud == True:
    print("Bad")
else:
    print("Good")

Measured memory_bytes: 2940
N = gets.to_i
Cs = [nil] + gets.split.map(&:to_i)
ABs = readlines.map{|l| l.split.map(&:to_i)}

@g = ABs.each_with_object(Array.new(N + 1){[]}){|(a, b), h| h[a] << b; h[b] << a}
@m = Array.new(N + 1, 0)
@s = ->(n){n*(n + 1)/2}

def dfs(u, p)
  s = 1
  ur = Hash.new(0)
  c = Cs[u]
  @g[u].reject{_1 == p}.each do |v|
    s1, ur1 = dfs(v, u)
    s += s1
    @m[c] += @s[s1 - ur1[c]]
    ur, ur1 = ur1, ur if ur1.size > ur.size
    ur1.each{ur[_1] += _2}
  end
  ur[c] = s
  [s, ur]
end

_, ur = dfs(1, 0)
sn = @s[N]
(1 .. N).each{|c| puts sn - @m[c] - @s[N - ur[c]]}

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

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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

// Library

//
int main() {
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int a, b, c;
    cin >> a >> b >> c;
    int ans = max(10 * a + b + c, a + 10 * b + c);
    ans = max(ans, a + b + 10 * c);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
fun main(args: Array<String>) {
    val numberA = readLine()!!.toInt()
    var numberList = mutableListOf<Long>()
    for (i in 0 until numberA){
        numberList.add(readLine()!!.toLong())
    }

    while (true){
        if(numberList.size == 1){
            break
        }
        val kobaiList = mutableListOf<Long>()
        for (i in 0 until numberList.size-1){
            kobaiList.add((numberList[i] / gcd(numberList[i],numberList[i+1])) * numberList[i+1])
        }
        numberList.clear()
        numberList=kobaiList

    }
    println(numberList[0])
}
fun gcd(a: Long, b: Long) : Long {
    var A = a
    var B = b
    while (b != 0L){
        if (A<B){
            val C = A
            A=B
            B=C
        }
        else if (B == 0L){
            break
        }else{
            val C=A
            A=B
            B=C%B
        }
    }
    return A
}

Measured memory_bytes: 33392
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;

signed main(){
    ll n;
    cin>>n;
    ll m=mod;
    rep(i,n+1){
        ll ct=0;
        ll ti=i,tj=0;
        while(ti>0){
            if(ti%(int)pow(6,tj+1)==0) tj++;
            else ti -= pow(6,tj),ct++;
        }
        ti = n-i,tj=0;
        while(ti>0){
            if(ti%(int)pow(9,tj+1)==0) tj++;
            else ti -= pow(9,tj),ct++;
        }
        m = min(m,ct);
    }
    cout<<m<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    bool x;
    cin >> x;
    x = !x;
    cout << x << endl;
}


Measured memory_bytes: 3672
/**
 *   author: Shubham Srivastava
 *   created: 02 May 2020  17:40:40
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define MOD 1000000007
#define INF 0x7fffffff
#define sorti(v) sort(v.begin(),v.end())
#define sortd(v) sort(v.rbegin(),v.rend())
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
ll parent[2000005];

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll k;cin>>k;
    ll a,b;cin>>a>>b;
    ll x = (a/k)*k;
    if(x < a)
        x += k;
    if(x>=a && x<=b)
        cout<<"OK";
    else
        cout<<"NG";
return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll a=0, b=0, c=0, i;
    string S;

    cin >> S;

    for(i=0; i<S.size(); i++){
        if(S[i]=='a') a++;
        if(S[i]=='b') b++;
        if(S[i]=='c') c++;
    }

    if(abs(a-b)<=1 && abs(b-c)<=1 && abs(c-a)<=1){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 512
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
use std::collections::HashMap;

fn main() {
    input!{
      n: usize,
      aa: [i64; n],
    }
    let mut map: HashMap<i64, i64> = HashMap::new();
    for &a in &aa {
        for &v in [a, a+1, a-1].iter() {
            let e = map.entry(v).or_insert(0);
            *e += 1;
        }
    }
    let mut values = map.values().map(|&v| v).collect::<Vec<i64>>();
    values.sort();
    println!("{}", values[values.len()-1]);
}


Measured memory_bytes: 12540
#include<iostream>
using namespace std;
main(){
  int a[10],b[10];
  for(int i=0;i<7;i++){
    cin>>a[i];
    cin>>b[i];
  }
  for(int j=0;j<6;j++){
    cout<<a[j]-b[j]<<endl;
  }
  cout<<a[6]-b[6]<<endl;
  return(0);
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
int n,a,b,c,i,j,k;
int main(){
  for(cin>>n,i=1;i<=n;a+=(c==8?1:0),i+=2)for(c=0,j=1;j<=i;j++)if(i%j==0)c++;
  cout<<a;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int a;cin>>a;
	cout<<a/3<<endl;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
#define iinf 2000000000
#define linf 1000000000000000000LL
#define ulinf 10000000000000000000ull
#define MOD1 1000000007LL
#define mpr make_pair
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned long UL;
typedef unsigned short US;
typedef pair < int , int > pii;
clock_t __stt;
inline void TStart(){__stt=clock();}
inline void TReport(){printf("\nTaken Time : %.3lf sec\n",(double)(clock()-__stt)/CLOCKS_PER_SEC);}
template < typename T > T MIN(T a,T b){return a<b?a:b;}
template < typename T > T MAX(T a,T b){return a>b?a:b;}
template < typename T > T ABS(T a){return a>0?a:(-a);}
template < typename T > void UMIN(T &a,T b){if(b<a) a=b;}
template < typename T > void UMAX(T &a,T b){if(b>a) a=b;}
int n,g[505][505],s[505][505],mx[505];
bool e[505][505];
LL res;
int readchar(){
	char c=getchar();
	while(c==' ' || c=='\n') c=getchar();
	if(c=='#') return 0;
	return c-'0';
}
void add(int x,int y){
	e[x][y]=1;
	if(x<n-1 && g[x+1][y] && !e[x+1][y]) add(x+1,y);
	if(y<n-1 && g[x][y+1] && !e[x][y+1]) add(x,y+1);
}
int getlower(int x,int y){
	int cx=x,cy=y,ret=(y?s[x][y-1]:0);
	mx[y]=x;
	while(1){
		while(1){
			if(cx+1<n && e[cx+1][cy]){
				++cx;
				mx[y]=cx;
				ret+=(cy?s[cx][cy-1]:0);
			}
			else if(cy+1<n && e[cx][cy+1]){
				++cy;
			}
			else break;
		}
		bool found=0;
		while(cy+1<n){
			++cy;
			if(e[cx][cy]){
				found=1;
				break;
			}
		}
		if(!found) break;
	}
	return ret;
}
int getupper(int x,int y){
	int cx=x,cy=y,ret=0;
	while(1){
		while(1){
			if(cy+1<n && e[cx][cy+1]){
				++cy;
			}
			else if(cx+1<n && e[cx+1][cy]){
				ret+=s[cx][cy];
				++cx;
			}
			else break;
		}
		bool found=0;
		while(cx<n-1){
			ret+=s[cx][cy];
			++cx;
			if(cx>mx[y]) break;
			if(e[cx][cy]){
				found=1;
				break;
			}
		}
		if(!found || cx>mx[y]) break;
	}
	if(cx<=mx[y]) ret+=s[cx][cy];
	return ret;
}
void solveline(int x){
	int i,j,k;
	memcpy(s,g,sizeof(g));
	for(i=0;i<n;++i){
		for(j=1;j<n;++j){
			s[i][j]+=s[i][j-1];
		}
	}
	for(i=x;i<n;++i) memset(e[i],0,sizeof(e[i]));
	for(i=0;i<n;++i){
		if(!g[x][i]) continue;
		add(x,i);
		res-=(LL)g[x][i]*(LL)getlower(x,i);
	}
	for(i=x;i<n;++i) memset(e[i],0,sizeof(e[i]));
	for(i=n-1;i>=0;--i){
		if(!g[x][i]) continue;
		add(x,i);
		res+=(LL)g[x][i]*(LL)(getupper(x,i)-g[x][i]);
	}
}
void del(int x,int y){
	if((!x || !g[x-1][y]) && (!y || !g[x][y-1])){
		g[x][y]=0;
		if(x<n-1 && g[x+1][y]) del(x+1,y);
		if(y<n-1 && g[x][y+1]) del(x,y+1);
	}
}
int main(){
    // inputting start
    // 数据结构记得初始化！ n，m别写反！
    int i,j,k;
	scanf("%d",&n);
	for(i=0;i<n;++i){
		for(j=0;j<n;++j){
			g[i][j]=readchar();
		}
	}
    #ifdef LOCAL
        TStart();
    #endif
    // calculation start
    // 数据结构记得初始化！ n，m别写反！
	for(i=0;i<n;++i){
		for(j=0;j<n;++j){
			e[i][j]=(!!g[i][j]);
		}
	}
    for(i=n-1;i>=0;--i){
		solveline(i);
		for(j=0;j<n;++j){
			if(g[i][j]) del(i,j);
		}
	}
	printf("%lld\n",res);
    #ifdef LOCAL
        TReport();
    #endif
    return 0;
}

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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

const int D = 18;
const int N = 2e5 + 5;

ll f[D];
ll dp[D][D];

void get_f(int n){
    for(int i = 0; i <= 9; i++) f[n] += dp[n][i];
}

vector<ll> v;

void brute(int i, int last, ll cur){
    if(i == 0) return;

    v.pb(cur);

    if(last > 0) brute(i-1, last-1, cur * 10 + last - 1);
    brute(i-1, last, cur * 10 + last);
    if(last < 9) brute(i-1, last+1, cur * 10 + last + 1);
};


int main(){
    fcin;

    for(int r = 1; r <= 9; r++) dp[1][r] = 1;
    for(int n = 2; n < D; n++){
        for(int r = 0; r <= 9; r++){
            if(r == 9) dp[n][r] = dp[n-1][r-1] + dp[n-1][r];
            else if(r == 0) dp[n][r] = dp[n-1][r] + dp[n-1][r+1];
            else dp[n][r] = dp[n-1][r-1] + dp[n-1][r] + dp[n-1][r+1];
        }
    }

    for(int n = 0; n < D; n++) get_f(n);

    int k;
    cin >> k;

    int nd = -1;
    for(int n = 1; n < D - 1; n++){
        if(k <= f[n + 1]){
            nd = n + 1;
            break;
        }
    }

    assert(nd != -1);

    for(int i = 1; i <= 9; i++){
        brute(nd, i, i);
    }

    nth_element(v.begin(), v.begin() + k - 1, v.end());
    cout << v[k-1] << endl;

    return 0;
}



Measured memory_bytes: 2420
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    gcd = 0
    a = list(map(int, input().rstrip('\n').split()))
    for v in a:
        gcd = fractions.gcd(gcd, v)
    c = 0
    while True:
        if gcd % 2 != 0:
            print(c)
            exit()
        else:
            gcd //= 2
            c += 1


if __name__ == '__main__':
    slove()


Measured memory_bytes: 65388
#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    char a[20];
    int n=0,i=0,s=0;
    while(scanf("%c",&a[n])&&a[n]!='\n')
    {
        if(a[n]=='A'||a[n]=='T'||a[n]=='C'||a[n]=='G')
            i++;
        else
            if(s<i)
            {s=i;
            i=0;}
        n++;
    }
    if(i>s)
        s=i;
cout<<s;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	ll n,nmax=1,ans=1;
	cin>>n;
	if(n==1){
		cout<<1<<endl;
		return 0;
	}
	for(int i=2;i<=n;i++){
		for(int j=2;;j++){
			ll dim=pow(i,j);
			if(dim>n)break;
			ans=std::max(ans,dim);
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define INF  numeric_limits<int>::max()
#define NINF numeric_limits<int>::min()

using namespace std;
using ll = long long;

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

    int N, X;
    vector<int> L;

    std::cin >> N >> X;
    REP(i, N) {
        int l;
        std::cin >> l;
        L.push_back(l);
    }

    int ans = 1;
    int pt = 0;
    REP(i, N) {
        if(X < pt + L[i]) {
            break;
        }
        else {
            pt += L[i];
            ans++;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
   int a, b;
   cin >> a >> b;
   if (a + b >= 10)
   {
      cout << "error" << endl;
   }
   else
   {
      cout << a + b << endl;
   }
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m;
int p[30];
int a[200005],b[200005];
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		cin>>b[i];
	} 
	int ans=0;
	for(int i=29;i>=0;i--){
		int l=1<<i;
		int r=1<<i+1;
		sort(b,b+n);
		//for(int j=0;j<n;j++) cout<<a[j]<<" ";cout<<endl;
		//for(int j=0;j<n;j++) cout<<b[j]<<" ";cout<<endl;
		for(int j=0;j<n;j++){
			int k1=lower_bound(b,b+n,l-a[j])-b;
			int k2=upper_bound(b,b+n,r-a[j]-1)-b-1;
		//	cout<<i<<" -- "<<k1<<" "<<k2<<endl;
			int k3=lower_bound(b,b+n,r+l-a[j])-b;
			if((k2-k1+1+(n-k3))%2==1){
				ans^=l;
			}	
		}
		//cout<<l<<endl;
		for(int j=0;j<n;j++){
			if(a[j]>=l)a[j]-=l;
			if(b[j]>=l)b[j]-=l;	
		//	cout<<b[j]<<" ";
		}   // cout<<endl;
	}
	cout<<ans;
	return 0;
}
/*
2
1 2
1 0
*/


Measured memory_bytes: 1792
def resolve():
    from collections import deque
    n, m = map(int, input().split())
    michi = [[] for j in range(n)]
    for _ in range(m):
        a, b = map(int, input().split())
        michi[a-1].append(b-1)
        michi[b - 1].append(a - 1)
    heya=[-1]*n

    def f():
        check=0
        que = deque([])
        que.append(0)
        while que:
            p = que.popleft()
            for i in michi[p]:
                if heya[i] == -1:
                    heya[i] = p + 1
                    check += 1
                    if check == n :
                        break
                    que.append(i)

        return

    f()
    print("Yes")
    for i in heya[1:]:
        print(i)
resolve()

Measured memory_bytes: 94636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int[] orders = new int[5];

		for(int i = 0 ; i < orders.length; i++) {
			orders[i] = scanner.nextInt();
		}

		int last_order = 0;
		int devide_remainder = 10;

		for(int i = 0; i < orders.length; i++) {
			int num = orders[i] % 10;
			if(num < devide_remainder && num != 0) {
				last_order = i;
				devide_remainder = num;
			}
		}

		int sum = 0;

		for(int i = 0; i < orders.length; i++) {
			int num = orders[i] % 10;

			if(i == last_order || num == 0) {
				sum += orders[i];
			}else {
				sum += orders[i] / 10 * 10 + 10;
			}
		}

		System.out.println(sum);
	}
}


Measured memory_bytes: 23764
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);
		    
		    int A = scanner.nextInt();
		    int B = scanner.nextInt();
		    int counter = 0;
		    
		    for(int i = 0; i <= B - A; i++) 
		    {
		    	if( ((A + i) /10000) % 10 == (A + i)% 10 && 
		    			((A + i) /1000) % 10 == ((A + i) /10) % 10 ) 
		    	{
		    		counter++;
		    	}
		    }
		    System.out.println(counter);
		    
		    scanner.close(); }
		  }

Measured memory_bytes: 21844
n = int(input())
#a, b, c, x, y = map(int, input().split())
#al = list(map(int, input().split()))
#al=[list(input()) for i in range(n)]


def prime_factorize(n):
    n_origin = n+0
    primelist = []
    a = 2
    while a*a <= n_origin:
        if n % a != 0:
            a += 1
            continue
        ex = 0
        while n % a == 0:
            ex += 1
            n = n//a
        primelist.append([a, ex])
        a += 1
    if n != 1:
        primelist.append([n, 1])
    return primelist


def sumf(n):
    return n*(n+1)//2


primes = prime_factorize(n)
ans = 0
for pl in primes:
    a, ex = pl
    i = 0
    while True:
        if sumf(i+1) > ex:
            break
        i += 1
    ans += i
print(ans)


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

int main()
{

   long long int n,i,k=0,j,l,m,sum;
   cin>>n;
 vector<long long int>a;
   for(i=1;i*i<=n;i++)
   {
       sum=0;
       if(n%i==0)
       {
          sum+=i;
       }
       if(n%(n/i)==0)
       {
       sum+=n/i;
   }
   if(sum!=0){
   a.push_back(sum);
   }
   }
  m=999999999999;
  for(j=0;j<a.size();j++)
  {
      if(a[j]<m)
      {
          m=a[j];
      }
  }

cout<<m-2<<endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a + b < 3) {
            System.out.println("Impossible");
            System.exit(0);
        }

        System.out.println( ((a>3 && a%3 == 0) || (b>3 && b%3 == 0) || ((a+b)%3 == 0)) ? "Possible" : "Impossible" );
    }

}

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

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

    if (count(s.begin(), s.end(), '7') > 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include<algorithm>
#define int long long
using namespace std;
typedef pair<int,int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000000

int MOD=1000000007;
int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}

int gyaku(int n){
    return modpow(n,MOD-2);
}
////////////////////////////////////////////////////////////
int keta(int n){
  int c=0;
  while(n>0){
    n/=10;
    c++;
  }
  return c;
}
signed main() {
  int sx,sy,gx,gy;
  cin>>sx>>sy>>gx>>gy;
  int dx=gx-sx,dy=gy-sy;
  rep(i,dx)cout<<'R';
  rep(i,dy)cout<<'U';
  rep(i,dx)cout<<'L';
  rep(i,dy+1)cout<<'D';
  rep(i,dx+1)cout<<'R';
  rep(i,dy+1)cout<<'U';
  cout<<"LU";
  rep(i,dx+1)cout<<'L';
  rep(i,dy+1)cout<<'D';
  rep(i,1)cout<<'R';

}


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

using namespace std;

int main()
{
	int N;
	cin >> N;
	string S;
	cin >> S;

	int half = N / 2;

	if (N % 2 != 0) {
		cout << "No" << endl;
		return 0;
	}

	for (int i = 0; i < half; i++) {
		if (S[i] != S[i + half]) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
  std::string s;
  std::cin >> s;
  for (unsigned i = (unsigned int) s.size(); i > 0; ) {
    if (i >= 6 && s.substr(i - 6, 6) == "eraser") {
      i -= 6;
      continue;
    }
    if (i >= 5 && s.substr(i - 5, 5) == "erase") {
      i -= 5;
      continue;
    }
    if (i >= 7 && s.substr(i - 7, 7) == "dreamer") {
      i -= 7;
      continue;
    }
    if (i >= 5 && s.substr(i - 5, 5) == "dream") {
      i -= 5;
      continue;
    }
    std::cout << "NO";
    return 0;
  }
  std::cout << "YES";
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define fi first
#define se second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define debug(x) cerr<<#x<<": "<<(x)<<'\n'
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9+7;
const ll inf = 0x3f3f3f3f;
const ll nax = 0;

int main(){
	IOS	
	string s; cin >> s;
	int n=s.length(), maks=0;
	for(int i=0;i<n;++i){
		if(s[i]=='R'){
			int cur=0;
			while(s[i]=='R'){
				cur++; i++;
			}
			maks=max(maks, cur);
			i--;
		}
	}
	cout << maks << '\n';
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

signed main(){

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

  __int128_t res = 1;
  for(int i = 0; i < n; i++){
    res *= a[i];
    if(res > 1000000000000000000){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << (int)res << endl;

  return 0;
}

Measured memory_bytes: 4032
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=2e5+1000;
ll n,k,a[maxn];
int main(){
    //freopen("in.txt","r",stdin);
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=k;i<n;i++){
        if(a[i]>a[i-k]){
            cout<<"Yes"<<endl;
        }else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 5200
#include<iostream>
#include<queue>
using namespace std;
int main(){
	int n;
	cin>>n;
	queue<long long> q;
	for(int i=1;i<=9;i++) q.push(i);
	long long x;
	while(n--){
		x=q.front();
		q.pop();
		if(x%10) q.push(x*10+x%10-1);
		q.push(x*10+x%10);
		if(x%10!=9) q.push(x*10+x%10+1);
	}
	cout<<x;
	return 0;
}


Measured memory_bytes: 1792
from itertools import groupby
n =int(input())

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n%i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

from itertools import groupby
ans = 0
p = prime_decomposition(n)
for k,g in groupby(p):
  gn = len(list(g))
  for i in range(1,1000000):
    gn -= i
    if gn >= 0:
      ans += 1
    else:
      break
print(ans)


Measured memory_bytes: 9188
using System;
using System.Collections.Generic;
class Program
{
	static int[] dp;
	static List<List<int>> node;
	static void Main(string[] args)
	{
			// 入力フェーズ
			//int N = Int32.Parse(Console.ReadLine());
			string[] input = Console.ReadLine().Split(' '); // N,M
			int N = Int32.Parse(input[0]);
			int M = Int32.Parse(input[1]);

			// ノード情報を作る 1-indexedにする
			node = new List<List<int>>();
			for(int i=0; i<=N; i++)
			{
				List<int> a = new List<int>();
				node.Add(a);
			}
			// エッジ情報の読み込み
			for(int i=0; i<M; i++)
			{
				input = Console.ReadLine().Split(' ');
				int x = Int32.Parse(input[0]);
				int y = Int32.Parse(input[1]);
				node[x].Add(y);
			}

			dp = new int[N+1]; // dpテーブル
			// 頂点iから伸びる経路の最大の長さ
			for(int i=0; i<=N; i++)
			{
				dp[i] = -1; // -1で初期化する
			}

			int longestPath = 0; // 最大の長さの経路をメモ
			for(int i=1; i<=N; i++)
			{
				// 各ノードから伸びる経路の最大の長さを求めて行く
				longestPath = Math.Max(longestPath, getLongestPath(i));
			}
			Console.WriteLine(longestPath + "");
    }

		static int getLongestPath(int i)
		{
			// 頂点iからの経路の最大の長さを返す
			// iから伸びる頂点がなければ0を返す
			if(node[i].Count == 0)
			{
				dp[i] = 0;
				return 0;
			}

			if(dp[i] != -1)
			{
				// すでに定まっているので返す
				return dp[i];
			}
			else
			{
				// iから伸びている頂点から伸びる最大の経路 + 1を返す
				int ret = 0;
				for(int j=0; j<node[i].Count; j++)
				{
					int k = node[i][j];
					// 行き先の経路長がすでに定まっていたらそれを使う
					if(dp[k]>=0)
					{
						ret = Math.Max(ret, dp[k] + 1);
					}
					else
					{
					  ret = Math.Max(ret, getLongestPath(k) + 1);
					}
				}
				dp[i] = ret;
				return ret;
			}
		}
}


Measured memory_bytes: 27660
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(n,v) cout<<#v<<":";for(int i=0;i<n;i++)cout<<v[i]<<" ";cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


struct UnionFind{
    vector<ll> par;
    vector<ll> siz;

    void init(ll n){
        for(ll i=0;i<n;i++){
            par.push_back(i);
            siz.push_back(1);
        }
    }
    ll root(ll x){
        //根を返す
        if(par[x]==x){
            return x;
        }
        else{
            return (par[x]=root(par[x]));
        }
    }
    bool sameParent(ll x,ll y){
        return(root(x)==root(y));
    }
    void unite(ll x, ll y){
        x=root(x);y=root(y);
        if(x==y)    return;
        //データ構造->小を大にくっつける
        if(siz[x]<siz[y]) swap(x,y);
        siz[x] += siz[y];
        par[y]=x;
    }

    ll size(ll x){
        return siz[root(x)];
    }
};

int main(){
    ll n;
    cin>>n;
    vector<pair<pair<ll,ll>,ll>> vx(n),vy(n);
    for(ll i=0;i<n;i++){
        ll x,y;
        cin>>x>>y;
        vx[i]=make_pair(make_pair(x,y),i);
        vy[i]=make_pair(make_pair(y,x),i);
    }
    sort(ALL(vx));sort(ALL(vy));
    vector<pair<ll,pair<ll,ll>>> vv;
    for(ll i=0;i<n-1;i++){
        ll cost=abs(vx[i].first.first-vx[i+1].first.first);
        ll A=min(vx[i].second,vx[i+1].second);
        ll B=max(vx[i].second,vx[i+1].second);
        vv.push_back(make_pair(cost,make_pair(A,B)));

        ll cost2=abs(vy[i].first.first-vy[i+1].first.first);
        ll A2=min(vy[i].second,vy[i+1].second);
        ll B2=max(vy[i].second,vy[i+1].second);
        vv.push_back(make_pair(cost2,make_pair(A2,B2)));
    }
    sort(ALL(vv));
    UnionFind uf;
    uf.init(n);
    ll rem=n-1,idx=0,ans=0;
    while(rem){
        ll A=vv[idx].second.first,B=vv[idx].second.second;
        if(!uf.sameParent(A,B)){
            uf.unite(A,B);
            ans+=vv[idx].first;
            rem--;
        }
        idx++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 13932
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
constexpr int MOD = 998244353;

int mod(const ll &x){
    return x > 0 ? x % MOD : (x % MOD + MOD) % MOD;
}

int modm(const ll &x,const ll &m){
    return (x % MOD) * (m % MOD) % MOD;
}

int modpow(ll x, ll p) {
    int ret = 1;
    while(p > 0) {
        if (p & 1) ret = modm(ret,x);
        x = modm(x,x);
        p >>= 1;
    }
    return ret;
}

// x * modinv(d)
int modd(ll x,ll d) {
    return modm(x,modpow(d,MOD-2));
}

int main(void)
{
    IOS
    int n, k;
    cin >> n >> k;
    vector<pii> vp(k);
    REP(i,k) cin >> vp[i].first >> vp[i].second;
    vector<int> vsum(k);
    vector<int> v(n+1);
    v[1] = 1;
    FOR(i,2,n+1) {
        REP(j,k) {
            if (i - vp[j].first > 0) vsum[j] = mod(vsum[j] + v[i - vp[j].first]);
            if (i - vp[j].second > 1) vsum[j] = mod(vsum[j] - v[i - vp[j].second-1]);
            v[i] = mod(v[i] + vsum[j]);
        }
    }
    OUT(v[n])

    return 0;
}

Measured memory_bytes: 3984
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		int n = fs.nextInt();
		
		for(int i = 0; i < 3; i++) {
			if(n % 10 == 7) {
				System.out.println("Yes");
				return;
			}
			n /= 10;
		}
		System.out.println("No");
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 32816
#include<stdio.h>
#include<stdlib.h>
int main(){
  long long n,min=10000000,max=-10000000,sum=0,i;
  long long *array;
  scanf("%lld",&n);
  array=(long long*)malloc(n*sizeof(long long));

  for(i=0;i<n;i++){
    scanf("%lld",&array[i]);
    if(min>=array[i]){ min=array[i];}
     sum+=array[i];
    if(max<=array[i]){ max=array[i];}
 }

    printf("%lld %lld %lld\n",min,max,sum);
    return 0;
}

Measured memory_bytes: 1872
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=100005;
bool a[maxn];
int num[maxn];
int n,m;
int main(){
	//judge();
	read(n);read(m);a[1]=1;
	rep(i,1,n)num[i]=1;
	rep(i,1,m){
		int x,y;read(x);read(y);
		if(a[x])a[y]=1;
		if(num[x]==1)a[x]=0;
		num[x]--;num[y]++;
	}int res=0;
	rep(i,1,n)res+=a[i];
	cout<<res;
	return 0;
}


Measured memory_bytes: 768
#include <iostream>
using namespace std;
int gcd(int a,int b)
{
  if(b == 0)return a;
  return gcd(b,a%b);
}
int lcm(int a,int b){
  return (a/gcd(a,b))*b;
}

int main(){
  int a,b;
  while(cin >> a >> b){
    if(a < b)swap(a,b);
    cout << gcd(a,b) << ' ' << lcm(a,b) << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
from collections import deque

number_list = [float("inf") for i in range(1000 + 1)]
number_list[1] = 0
que = deque([[1, [1], 0]])


while len(que) > 0:
    n, array, depth = que.popleft()
    if depth > 16:
        continue
    for i in array:
        if n + i <= 1000 and number_list[n + i] >= depth + 1:
            number_list[n + i] = depth + 1
            que.append([n + i, array + [n + i], depth + 1])

        if n - i > 0 and number_list[n - i] >= depth + 1:
            number_list[n - i] = depth + 1
            que.append([n - i, array + [n - i], depth + 1])


while True:
    N = int(input())
    if N == 0:
        break
    print(number_list[N])


Measured memory_bytes: 88332
#include<bits/stdc++.h>
using namespace std;
long long division(long long n, long long x){
    if(n==-1){

        return -1;
    }else if(n!=-1){
      
        return n/x;
    }

}

int main(){
    long long a,b,x;
    cin>>a>>b>>x;
    cout<<division(b,x)-division((a-1),x)<<endl;
    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string s;cin>>s;
	int w;cin>>w;
	for(int i = 0; i < s.size(); i++) {
		if (w * i < s.size()){
			cout << s[w * i];
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256