akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.StringTokenizer;

public class Main {
  private static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(final InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (final IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }
  }

  private static class OutputWriter extends PrintWriter {
    public OutputWriter(final OutputStream outputStream) {
      super(outputStream);
    }

    @Override
    public void println() {
      super.println();
      super.flush();
    }
  }

  private static boolean isLocal() {
    return new File("./.vscode/launch.json").exists();
  }

  public static void main(final String[] args) throws IOException {
    final InputStream inputStream = isLocal() ? new FileInputStream("in.txt") : System.in;
    final OutputStream outputStream = System.out;
    final InputReader in = new InputReader(inputStream);
    final OutputWriter out = new OutputWriter(outputStream);
    final Task solver = new Task();
    int testcase = 1;
    while (testcase-- > 0) {
      solver.solve(in, out);
    }
    out.close();
  }

  private static class Task {
    public void solve(final InputReader in, final PrintWriter out) {
      out.println(Math.PI * in.nextInt() * 2);
    }
  }
}


Measured memory_bytes: 33276
#include<stdio.h>
int main (void){

  int x;
  int y;

  while(1){
    scanf("%d",&x);
    scanf("%d",&y);
    if(x==0 && y==0)
      break;
    else
      if(x<y)
        printf("%d %d\n",x,y);
      else
        printf("%d %d\n",y,x);
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
struct fast_ios { fast_ios(){cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast_ios_;

int main()
{
    ll H;
    cin >> H;
    
    int n=1;
    while(H>>n!=0)
    {
        ++n;
    }
    cout << (ll)pow(2, n)-1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}

/*
[check]

game
* 全てのりんごの種類が1以下で自分のターンが回ってきたら勝利
* 全てのりんごを偶数にして相手に回すと勝ち


*/

int main()
{
    int n;
    cin >> n;
    vector<int> a;
    bool fwin = false;
    rep(i, n){ int tmp; cin >> tmp; if(tmp%2) fwin = true;}
    if (fwin) cout << "first" << endl;
    else cout << "second" << endl;
}



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

using namespace std;

int main()
{
	int s,k,c=0;
	scanf("%d%d",&k,&s);
	for(int x=0;0<=x&&x<=k;x++)
    {
        for (int y=0;0<=y&&y<=k;y++)
        {
            int z=s-(x+y);
            if(z>=0&&z<=k)
            {
                c++;
            }
        }
    }
    printf("%d",c);
}

Measured memory_bytes: 256
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
using namespace std;

const long long INF = 4000000000000000001;
const int inf = 1001001001;
const int MOD = 1000000007;
typedef pair<long long,long long> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}



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

    int N;cin >> N;
    vector<long long> retu(N);
    for(int i = 0;i<N;i++){
        cin >> retu.at(i);
    }
    long long ans = 0;
    for(int i = 0;i<N;i++){
        for(int j = 0;j<N;j++){
            for(int k = 0;k<N;k++){
                if(i == j || j == k || i == k) continue;
                int a = retu.at(i),b = retu.at(j),c = retu.at(k);
                if(a+b > c && b+c > a && c+a > b){
                    if(a == b || b == c || a == c) continue;
                    ans++;
                }
            }
        }
    }
    cout << ans/6 << endl;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<(a-c)*(b-d)<<endl;
  return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class x,class y> x sum(x a,y b){return a+b;}
template<class x,class y> x mul(x a,y b){return a*b;}
template<class x,class y> x sub(x a,y b){return a-b;}
template<class x,class y> x divi(x a,y b){return a/b;}

template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
#define N  1000005

int main()
{
    ios;
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
        ll i,j,k,l,m,n;
        cin>>k>>l>>m;
        for(i=l;i<=m;i++)
        {
            if(i%k==0)
            {
                cout<<"OK";
                return 0;
            }
        }
        cout<<"NG";
    }
    return 0;
}

Measured memory_bytes: 3652
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

type edge struct {
	to, num int
}

type node struct {
	e []edge
}

var edgeCol []int

func dfs(pos, prev, col int, n []node) {
	c := 0
	for _, v := range n[pos].e {
		if v.to == prev {
			continue
		}
		c++
		if c == col {
			c++
		}
		edgeCol[v.num] = c
		// out(v.to, pos, c)
		dfs(v.to, pos, c, n)
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	n := make([]node, N)
	for i := 0; i < N-1; i++ {
		f, t := getInt()-1, getInt()-1
		n[f].e = append(n[f].e, edge{t, i})
		n[t].e = append(n[t].e, edge{f, i})
	}
	edgeCol = make([]int, N-1)

	dfs(0, -1, -1, n)

	//	out(n)

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	ma := 0
	for _, v := range edgeCol {
		ma = max(ma, v)
	}
	fmt.Fprintln(w, ma)
	for _, v := range edgeCol {
		fmt.Fprintln(w, v)
	}
}


Measured memory_bytes: 32000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int mod2 = 998244353;

int main() {
  int n;
  cin >> n;
  vector<int> a(n+1);
  for (int i = 1;i < n+1;i++) cin >> a[i];
  int m = 0;
  vector<int> ans(n+1);
  for (int i = n;i > 0;i--) {
    int sum = 0;
    for (int j = i;j < n+1;j += i) {
      sum += ans[j];
    }
    sum %= 2;
    ans[i] = a[i] ^ sum;
    if (ans[i] == 1) m++;
  }
  cout << m << endl;
  for (int i = 1;i < n+1;i++) {
    if (ans[i] == 1) cout << i << endl;

  }
}

Measured memory_bytes: 2432
S = input()

alpha = 'abcdefghijklmnopqrstuvwxyz'
# len(S)が26未満の場合
if len(S) < 26:
    for char in alpha:
        # Sに入っていない文字の中で最小のものを末尾に足す
        if char not in S:
            print(S + char)
            exit()

# len(S)が26の場合
else:
    arr = [S[-1]]

    for i in range(1, 26):
        l = 25 - i
        if max(arr) > S[l]:
            chars = []

            for c in arr:
                # 下のifがよくわかってない
                # bcdefghijklmnopqrstuvwx | zya　みたいな時のため？
                # ifがないと~~~vwa とか吐いて前に戻ってしまうっぽい
                # 時間内に思いつく気が全くしない
                if c > S[l]:
                    chars.append(c)
            char = min(chars)
            # print(chars)

            # for c in arr:
            #     chars.append(c)
            # char = min(chars)

            print(S[:l] + char)
            exit()
        else:  # max(sr)>S[l]　の場合
            arr.append(S[l])

    print(-1)


Measured memory_bytes: 9028
#include <cstdio>
#include <vector>

using namespace std;

typedef long long ll;

int main() {
    ll n, sum = 0, oddSum = 0;
    scanf("%lld", &n);
    vector<ll> a(n + 1);
    for (ll i = 1; i <= n; ++i) {
        scanf("%lld", &a.at(i));
        sum += a.at(i);
        if (i % 2) oddSum += a.at(i);
    }
    ll prev = oddSum * 2 - sum;
    printf("%lld ", prev);
    for (ll i = 1; i < n; ++i) printf("%lld%c", prev = a.at(i) * 2 - prev, i == n - 1 ? '\n' : ' ');
    return 0;
}


Measured memory_bytes: 2048
a = []
a = gets.split.map(&:to_i)
l = 0
m = 0
n = 0
for i in 1..a[0]
  m = i
  l = 0
  for j in 1..5
   l = l + m % 10
   m = m / 10
  end
  if l >= a[1] && l <= a[2]
    n = n + i
  end
end
puts n
   

Measured memory_bytes: 3836
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    long x,k,d;
    scanf("%ld %ld %ld", &x, &k, &d);
    x =abs(x);
    if(x/d >= k){
        printf("%ld", x-k*d);
    } else {
        if(x % d == 0){
            if( (k - x/d) % 2 == 0){
                printf("0");
            } else {
                printf("%ld", d);
            }
        } else {
            if( (k-x/d) % 2 == 0){
                printf("%ld", x%d);
            } else {
                printf("%ld", d-x%d);
            }
        }
    }
    
    return 0;
}


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

long long  ans = 987654321;

long long  f(long long int n) {
    if (n < 10)
        return 1;
    else
        return f(n/10) + 1;
}

long long  g(long long int a, long long int b) {
    
    return max(f(a), f(b));
}




int main()
{
    long long int n;
    cin >> n;
    for (long long int i = 1; i*i <= n; i++) {
        if (n % i == 0) {
            long long int a = i;
            long long int b = n/i;
            if (g(a,b) < ans)
                ans =g(a,b);
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main(int argc,char** argv) {
	long n,r,l,res = 0;
	cin >> n;
	for(long i = 0;i < n;i++) {
		cin >> r >> l;
		res += abs(r - l) + 1;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

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


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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 998244353;
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 { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		assert(n < mod);
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
	mint p(int n, int k) {
		return fact[n] * ifact[n - k];
	}
}c(200005);

int main() {
	int N ,M, K;
	cin >> N >> M >> K;
	// 前処理
	mint nRet = 0;
	mint tmp = 1;
	for (int n = 0;n<N-1-K;++n) {
		tmp *= M - 1;
	}
	for (int k = K;k >= 0;--k) {
		mint ntemp = (mint)M * c(N - 1, k);
		ntemp *= tmp;
		nRet += ntemp;
		tmp *= M - 1;
	}
	cout << nRet << endl;
}

Measured memory_bytes: 6240
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

void dfs(const vector<VI> &vs, vector<bool> &visited, int v) {
  visited[v] = true;
  FOR(u,vs[v]) {
    if (!visited[u]) {
      dfs(vs, visited, u);
    }
  }
}

int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<VI> vs(n);
  REP(i,0,m) {
    int x, y, z;
    cin >> x >> y >> z;
    vs[x-1].push_back(y-1);
    vs[y-1].push_back(x-1);
  }
  vector<bool> visited(n, false);
  int ans = 0;
  REP(i,0,n) {
    if (!visited[i]) {
      ans++;
      dfs(vs, visited, i);
    }
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

const int N=3e5;
int col[N+2],row[N+2];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int m,n,q,x,y,mxC=0,mxR=0;
    map<pair<int,int>,bool>mp;
    cin >> n >> m >> q;
    while(q--)
    {
        cin >> x >> y;
        mp[{x,y}]=1;
        mxC=max(mxC,++col[y]);
        mxR=max(mxR,++row[x]);
    }
    vector<int>c,r;
    for(int i=1;i<=n;i++)
    {
        if(row[i] == mxR)r.emplace_back(i);
    }
    for(int i=1;i<=m;i++)
    {
        if(col[i] == mxC)c.emplace_back(i);
    }
    for(int i : r)
    {
        for(int j : c)
        {
            if(mp.find({i,j}) == mp.end())
                {
                    cout << mxC+mxR;
                    return 0;
                }
        }
    }
    cout << mxC+mxR-1;
    return 0;
}

Measured memory_bytes: 28484
from collections import deque
N,T=map(int,input().split())
Q=deque(list(map(int,input().split())))
time=Q.popleft()
ans=0
for t in range(N-1):
    t=Q.popleft()
    if t>time+T:ans+=T
    else:ans+=t-time
    time=t
ans+=T
print(ans)

Measured memory_bytes: 25968
#include <stdio.h>

int main (){
  int n, a[101],flag=0;

  scanf("%d", &n);

  for (int i = 0; i < n; i++){
    scanf("%d", &a[i]);

    if(a[i]%2==0){
      if( (a[i]%3 !=0 ) && (a[i]%5 != 0) ){
        flag=1;
        break;
      }
    }
  }
  if (flag)
    printf("DENIED\n");
  else
    printf("APPROVED\n");

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>

#define rep(i,n) for (long long int i = 0; i < (n); i++)
#define rep1(i,n) for (long long int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

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

    vector<int> v;
    int now = 1;
    rep(i,n) {
        if (a[i] == now){
            v.push_back(now);
            now++;
        }
    }

    if (v.empty())
        cout << -1 << endl;
    else
        cout << n - v.size() << endl;
    return 0;
}


Measured memory_bytes: 2168
import Foundation
var s = [Int]()
for i in 0 ..< 10 {
    var a = Int(pow(2, Double(i)))
    s.append(a)
}

let a = Int(readLine()!)!

var num = 0
while a >= s[num] {
    num += 1
}
print(s[num-1])

Measured memory_bytes: 13308
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "No" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl


signed main(void){
    int N;
    cin >> N;
    int d[10][10]={};
    int Ans=0;
    OREP(i,N){
        int l,r;
        r = i%10;
        int k = i;
        while(k>0){
            l=k%10;
            k/=10;
        }
        d[l][r]++;
    }
    REP(i,10){
        REP(j,10){
            Ans+=d[i][j]*d[j][i];
            //cout << i MM j MM d[i][j] MM d[j][i] << endl;
        }
    }
    cout << Ans << endl;
    return 0;
}



Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[] input = br.readLine().split(" " , 2);
        int a = Integer.parseInt(input[0]);
        int b = Integer.parseInt(input[1]);

        double ad = (double)a;
        double bd = (double)b;

        System.out.print(a/b + " " + a%b + " ");
        System.out.printf("%.5f\n" , ad/bd);
    }
}

Measured memory_bytes: 24856
#include<stdio.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

void run (void) {
  i32 n, a, b;
  scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32, &n, &a, &b);
  i32 ans = n;
  while (n--) {
    i32 t;
    scanf ("%" SCNi32, &t);
    if (a <= t && t < b) {
      ans--;
    }
  }
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run ();
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		try (Scanner scTmp = new Scanner(System.in);) {

			// Java 8
			String sTmp = scTmp.nextLine();
			StringBuilder sb = new StringBuilder();
			sTmp.chars().forEach(cTmp -> {
				switch (cTmp) {
				case '0':
					sb.append("0");
					break;
				case '1':
					sb.append("1");
					break;
				case 'B':
					if (sb.length() > 0) {
						sb.deleteCharAt(sb.length() - 1);
					}
					break;
				}
			});

			System.out.println(sb.toString());
		}
	}
}


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

#define     F       first
#define     S       second
typedef pair<int, int>  pi;
typedef long long       ll;

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

    string s;
    cin >> s;

    int cnt1=0, cnt2=0;
    for (int i=0; i<s.size(); ++i) {
        if (s[i]=='A') {
            ++cnt1;
        }
        else {
            ++cnt2;
        }
    }

    if (cnt1 && cnt2) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
typedef long long ll;
typedef long double ld;
using namespace std;
 
 
int main() {
    long long N,K;
    cin >> N >> K;
    long long nm1 = N%K;
    long long nm2 = K-nm1;
    if (nm1 > nm2){
        cout << nm2 <<endl;
    } else {
        cout << nm1 <<endl;
    }
    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef pair<int,int> pii;
typedef pair<long long, int> pli;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

ll mod = 998244353;

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

  int n;
  cin >> n;
  vi a(n);
  rep(i,n)cin >> a[i];

  map<int,ll> cnt;
  ll ret = 0;
  rep(i,n){
    ret += cnt[i-a[i]];
    cnt[a[i]+i]++;
  }
  cout << ret << endl;
}

Measured memory_bytes: 26696
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> void vdebug(vector<T> v){ cout << "vdebug" << endl; for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], ll n){ cout << "adebug" << endl; reps(i, 0, n){ cout << arr[i] << " "; } cout << endl; }
template<typename T1, typename T2> void mdebug(map<T1, T2> mp){ cout << "mdebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
template<typename T1, typename T2> void mldebug(multimap<T1, T2> mp){ cout << "mldebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
template<typename T1, typename T2> void mdebugr(map<T1, T2, greater<T1>> mp){ cout << "mdebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
template<typename T1, typename T2> void mldebugr(multimap<T1, T2, greater<T1>> mp){ cout << "mldebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


class BellmanFord {
  public:
    struct edge {
        int to;
        ll weight;
        edge(int t, ll w) : to(t),weight(w){}
    };
    vector<edge> es[100010];
    vector<ll> dist; // minimum distance
    int n; // num of nodes
    bool negative = false;

    BellmanFord(int nn): n(nn){}

    void add(int f, int t, ll w){
        es[f].push_back(edge(t, w));
    }

    void query(int s){
        dist.assign(n+1, inf);
        dist[s] = 0;
        reps(i, 0, 2*n){
            reps(j, 1, n){
                if(dist[j] == inf) continue;
                for(auto const& e : es[j]){
                    if(dist[e.to] > dist[j] + e.weight){
                        dist[e.to] = dist[j] + e.weight;
                        if(e.to == n && i == 2*n){
                            negative = true;
                        }
                    }
                }
            }
        }
    }
};


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

    ll n, m, a, b, c;
    cin >> n >> m;
    BellmanFord bf(n);
    rep(i, m){
        cin >> a >> b >> c;
        bf.add(a, b, -c);
    }

    bf.query(1);

    if(bf.negative) cout << "inf" << endl;
    else{
        cout << -bf.dist[n] << endl;
    }

    //vdebug(bf.dist);

    return 0;
}


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


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

  vector<int> flag(1000010, false);
  flag[s] = true;
  
  int cnt = 1;
  while(true){
    cnt++;
    if(s % 2 == 0) s = s/2;
    else s = 3*s+1;
    
    if(flag[s]) break;
    flag[s] = true;
    
  }

  cout << cnt << endl;
}

Measured memory_bytes: 4096
#include <iostream>
#include <string>
#include <queue>
#include <utility>
using namespace std;

int main(void){
    int N;
    cin >> N;
    int P[N],s[N];
    string S[N];

    for(int i = 0;i<N;i++){
        cin >> S[i] >> P[i];
        s[i] = i+1;
    }

    for(int i = 0;i<N;i++){
        for(int j = i;j > 0;j--){
         if(S[j] < S[j-1]){
             string t = S[j];
             S[j] = S[j-1];
             S[j-1] = t;
             int k = s[j];
             s[j] = s[j-1];
             s[j-1] = k;
             int o = P[j];
             P[j] = P[j-1];
             P[j-1] = o;
         }
        }
    }

    for(int i = 0;i<N;i++){
        for(int j = 0;j < N -1;j++){
            if(S[j] == S[j+1] && P[j] < P[j+1]){
             string t = S[j];
             S[j] = S[j+1];
             S[j+1] = t;
             int k = s[j];
             s[j] = s[j+1];
             s[j+1] = k;
             int o = P[j];
             P[j] = P[j+1];
             P[j+1] = o;
            }
        }
    }

    for(int i = 0;i < N;i++){
       cout << s[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N, M, Q = map(int, input().split())

A = [[0] * (N + 1) for i in range(N + 1)]
for i in range(M):
    l, r = map(int, input().split())
    A[l][r] += 1
    
for i in range(1, N + 1):
    for j in range(1, N + 1):
        A[i][j] += A[i - 1][j] + A[i][j - 1] - A[i - 1][j -1]
        
for i in range(Q):
    p, q = map(int, input().split())
    print(A[q][q] - A[q][p - 1] - A[p - 1][q] + A[p - 1][p - 1])

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




int main(){
	int N,M;
	cin>>N>>M;
	vector<int> S(N+1,0);
	for(int i=0;i<M;i++){
		int l,r;
		cin>>l>>r;
		l--;r--;
		S[l]++;
		S[r+1]--;
	}
	for(int i=1;i<=N;i++){
		S[i]+=S[i-1];
	}
	
	int ans = 0;
	
	for(int i=0;i<=N;i++){
		if(S[i]==M)ans++;
	}
	cout<<ans<<endl;
		
	
	
	
	return 0;
}

Measured memory_bytes: 640
import Control.Applicative
import Control.Monad
import Data.Array.IO
import Data.List

modifyArray arr i f = readArray arr i >>= \x -> writeArray arr i (f x)

main = do
  n <- readLn :: IO Int
  ps <- map read . words <$> getLine :: IO [Int]

  a <- newListArray (1,n) (take n (iterate (+n) n)) :: IO (IOUArray Int Int)
  b <- newListArray (1,n) (reverse $ take n (iterate (+n) n)) :: IO (IOUArray Int Int)

  forM_ (zip [0..] ps) $ \(i,p) -> do
    modifyArray a p (+i)
    modifyArray b p (+i)

  putStrLn =<< unwords . map show <$> getElems a
  putStrLn =<< unwords . map show <$> getElems b  


Measured memory_bytes: 9084
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,q=map(int,input().split())
    s=input()
    lis=[0]*(n+1) 
    for i in range(n-1):
        if s[i:i+2]=="AC":
            lis[i+1]+=1
        lis[i+2]=lis[i+1]
    for i in range(q):
        l,r=map(int,input().split())
        print(lis[r-1]-lis[l-1])


if __name__=='__main__':
    main()

Measured memory_bytes: 52824
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(){
  int N,M;
  cin>>N>>M;
  int P[M],Y[M];
  vector<int> A[N+1];
  rep(i,M){
    cin>>P[i]>>Y[i];
    A[P[i]].push_back(Y[i]);
  }
  rep(i,N) sort(A[i+1].begin(),A[i+1].end());
  rep(i,M){
    int L=P[i];
    int R=lower_bound(A[L].begin(),A[L].end(),Y[i])-A[L].begin()+1;
    rep(i,6-to_string(L).size()) cout<<0;
    cout<<L;
    rep(i,6-to_string(R).size()) cout<<0;
    cout<<R<<endl;
  }
}

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(){
    int n; cin >> n;
    vector<int> lis(n);
    ll sum = 0;
    REP(i, 0, n){cin >> lis[i]; sum += lis[i];}
    int m; cin >> m;
    REP(i, 0, m){
        int p, x; cin >> p >> x;
        p--;
        cout << sum-lis[p]+x << endl;
    }
}

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


int main() {

  int64_t n,a,b;
  cin>>n>>a>>b;

  if(a>b)
    cout<<0<<endl;
  else if(a!=b&&n==1)
    cout<<0<<endl;
  else if(a==b)
    cout<<1<<endl;
  else{
    cout<<a+(n-1)*b-(b+(n-1)*a)+1<<endl;
  }

  return 0;
}

//　一番大きな b
//　一番小さな a
//　最小は全部a, 最大は全部b
//　その間の和は全て作れる。a,a,a,a,...,a+1とか
//　一つはa,bにしないといけないので、
//　最大は、a,b,b,b,..,b=>a+(n-1)*b
//　最小は、b,a,a,a,..,a=>b+(n-1)*a
//　従って、a+(n-1)*b-(b+(n-1)*a)+1 => -(b-a)+(n-1)(b-a)+1 

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

using namespace std;
using ii = pair<int, int>;
using ll = long long;

int main(void)
{
    int n, m, ai;
    cin >> n >> m;

    multiset<int> a;
    for (int i = 0; i < n; ++i)
        cin >> ai, a.insert(ai);

    vector<ii> queries;
    queries.resize(m);
    for (auto &[ci, bi] : queries)
        cin >> bi >> ci;

    sort(queries.begin(), queries.end(), greater<ii>());

    for (auto [ci, bi] : queries)
    {
        if (*a.begin() >= ci)
            break;

        while (bi--)
        {
            auto it = a.begin();
            if (*it >= ci)
                break;
            a.erase(it);
            a.insert(ci);
        }
    }

    cout << accumulate(a.begin(), a.end(), (ll)0);

    return 0;
}


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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define long long long
#define db double
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
template <class T> inline void chmin(T &a, const T& val) { if (a > val) a = val; }
template <class T> inline void chmax(T &a, const T& val) { if (a < val) a = val; }
template <class T> long sqr(T a) { return 1ll * a * a; }
template <class T> void compress(T &a){
  sort(all(a)); a.resize(unique(all(a)) - a.begin());  
}

const db pi = acos(-1.00);
const db eps = 1e-6;
const int INF = 1e9;
const int MOD = 1e9+7;
const int dx[4] = {0, 0, -1, 1};
const int dy[4] = {-1, 1, 0, 0};

const int N = 1e6+1;
int n, a[N], cnt[N];

int main()
{
  fastio;
  int n; cin >> n;
  for (int i = 1; i <= n; i++){
    cin >> a[i]; cnt[a[i]]++;
  }
  for (int i = N - 1; i > 0; i--){
    for (int j = 2 * i; j < N; j += i){
      cnt[j] += cnt[i];
    }
  }
  int res = 0;
  for (int i = 1; i <= n; i++){
    if (cnt[a[i]] - 1 == 0) res++;
  }
  cout << res;
  return 0;
}

Measured memory_bytes: 8320
import java.util.Scanner;

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

		int n = sc.nextInt();
		int i = 1;

		do {
			int x = i;
			if (x % 3 == 0) {
				System.out.print(" " + i);
			}

			else {
				do {

					if (x % 10 == 3) {
						System.out.print(" " + i);
						break;

					}
					x /= 10;
				} while (x != 0);

			}

		} while (++i <= n);

		System.out.println();

	}

}

Measured memory_bytes: 28500
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

int main(){
    int N, T; cin >> N >> T;
    vector<pair<ll, ll>> AB(N);
    rep(i,N) cin >> AB[i].first >> AB[i].second;
    
    sort(AB.begin(), AB.end());

    vector<vector<ll>> dp(N+1, vector<ll>(3005,0));

    ll ans = 0;
    rep(i,N){
        rep(j,T){
            dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
            if (j - AB[i].first >= 0) dp[i+1][j] = max(dp[i+1][j], dp[i][j-AB[i].first]+AB[i].second);
        }
        ans = max(ans, dp[i][T-1] + AB[i].second);
    }
    cout << ans << endl;
}

Measured memory_bytes: 73972
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define sz(v) (ll((v).size()))
#define forn(i,n) for(ll i=0;i<(n);i++)
#define forr(i,n) for(ll i=(n)-1;i>=0;i--)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))

const ll mod = 1e9+7;

int main()
{
	ios_base::sync_with_stdio(false);

	string s,t;cin>>s>>t;
	ll ans=0;
	forn(i,s.length()){if(s[i]!=t[i])ans++;}
	cout<<ans<<endl;


}



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

int main() {
    int n;
    cin >> n;
    vector<vector<ll>> a(10,vector<ll>(10,0));
    rep2(i,1,n+1) {
        int top,last;
        last = i%10;
        top = i;
        while(top >= 10) {
            top /= 10;
        }
        a[top][last]++;
    }
    ll ans = 0;
    rep2(i,1,10) {
        rep2(j,1,10) {
            ans += a[i][j]*a[j][i];
        }
    }
    cout << ans << endl;
}

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

void solve()
{
	string s;
	cin >> s;
	if(s[1] == 'R') cout << "ABC";
	else cout << "ARC";
	
}

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


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
const int MX = 2e5+2;
vector<int> adj[MX];
int st[MX], ed[MX], arr[MX*2], acc[MX*2], stinv[MX*2], ans[MX];
int nxt = 1;
void dfs(int i) {
	if(st[i]) return;
	st[i] = nxt++;
	stinv[st[i]] = i;
	for(int a: adj[i]) {
		dfs(a);
	}
	ed[i] = nxt++;
}
int main() {
	ios::sync_with_stdio(0);cin.tie(0);
	int n, q;
	cin >> n >> q;
	for(int i=0; i<n-1; i++) {
		int a, b;
		cin >> a >> b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	dfs(1);
	while(q--) {
		int p, x;
		cin >> p >> x;
		arr[st[p]] += x;
		arr[ed[p]] -= x;
	}
	int cur = 0;
	for(int i=1; i<MX*2; i++) {
		cur += arr[i];
		acc[i] = cur;
	}
	for(int i=0; i<MX*2; i++) {
		if(stinv[i]) {
			ans[stinv[i]] = acc[i];
		}
	}
	for(int i=1; i<=n; i++) {
		cout << ans[i] << ' ';
	}
}

Measured memory_bytes: 26112
#include <bits/stdc++.h>
#define sz(arr) (int)(arr).size()
#define rng(arr) arr.begin(), arr.end()
#define show(x) cout << #x << " = " << x << endl;

using namespace std;
typedef long long int ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main() {
  Cin(int, n, m, k);

  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= m; ++j) {
      if (i * (m - j) + (n - i) * j == k) {
        puts("Yes");
        return;
      }
    }
  }
  puts("No");
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

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

int N;

vector<int> a(200001);

void solve(){
    int k = 1;
    int ans = 0;
    for(int i = 1; i <= N; ++i){
        if(k == a[i]) k++;
        else ans++;
    }
    if(ans == N) cout << -1;
    else cout << ans;
}
int main(){
    cin >> N;
    for(int i = 1; i <= N; ++i){
        cin >> a[i];
    }
    solve();
    return 0;
}

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

int main()
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;

    if (k < a)
    {
        cout << k << endl;
    }
    else if (k < a + b)
    {
        cout << a << endl;
    }
    else
    {
        cout << a - (k - a - b) << endl;
    }
}

Measured memory_bytes: 3592
function Main(input) {
		input = input.split(" ");
		const num = parseInt(input[0], 10);
		if (num > 81) {
				console.log('No');
				return;
		}
if (num == 1) {
				console.log('Yes');
				return;
		}

if((num%2==0 && num/2<10) ||(num%3==0 && num/3<10) ||(num%4==0 && num/4<10) ||(num%5==0 && num/5<10) ||(num%6==0 && num/6<10) ||(num%7==0 && num/7<10) ||(num%8==0 && num/8<10) ||(num%9==0 && num/9<10)){
console.log('Yes');
}else {
console.log('No');
}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std; 
typedef long long lli;
#define mod 1000000007
const int INF = 1e6;
const int MAX = 1e5+10;
#define fori(n) for(int i=0;i<n;i++)
#define forj(n) for(int j=0;j<n;j++)
#define forli(n) for(lli i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define vi vector<int>
#define vli vector<lli>
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define print(a) cout<<a<<endl
#define print2(a,b) cout<<a<<" "<<b<<endl
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl
#define sortvec(a) sort(a.begin(),a.end())
#define pdd pair<lli,lli>
 
//FUNCTONS
lli llipower(lli x, lli y){lli res = 1;x = x % mod; while (y > 0){if (y & 1) res = (res*x) % mod; y = y>>1;x = (x*x) % mod;}return res;}
lli gcd(lli a, lli b){ if (!a) return b; return gcd(b%a,a);}
lli binarySearch(vector<int> arr, int l, int r, int x){ 
	if (r >= l) { 
		lli mid = l + (r - l) / 2; 
		if (arr[mid] == x) return mid; 
		if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x); 
		return binarySearch(arr, mid + 1, r, x); 
	} 
	return -1;
}
template <typename T>
void printvec(vector<T> inp){
	for(int i=0;i<inp.size();i++){
		cout<<inp[i]<<" ";
	}
	cout<<endl;
}
template <typename T>
T ceildiv(T x, T y){
	return 1 + ((x - 1) / y);
}
bool pd(string s1,string s2){
	string temp=s1;
	reverse(temp.begin(),temp.end());
	if(temp==s2) return true;
	return false;
	
}
int main(){
	int n;
	cin>>n;
	vector<string> inps(n);
	fori(n) cin>>inps[i];
	sortvec(inps);
	//printvec(inps);
	vector<pair<int,int>> counts;
	string cur=inps[0];
	int count=0;
	int maxc=0;
	fori(n){
		if(inps[i]!=cur){
			maxc=max(maxc,count);
			//cout<<i-1<<" "<<count<<endl;
			counts.pb(mp(i-1,count));
			count=1;
			cur=inps[i];
		}
		else{
			count++;
		}
	}
	counts.pb(mp(n-1,count));
	maxc=max(maxc,count);
	fori(counts.size()){
		if(counts[i].S==maxc) cout<<inps[counts[i].F]<<endl;
	}
	
}
 
 

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

bool kaibun(string S, int A, int B){
    // Sの文字数は3以上の奇数
    // SのA文字目からB文字目までが回文かどうかを判定する関数
    int i = A-1;
    int j = B-1;
    while (i <= j){
        if (S.at(i) != S.at(j))
            return false;
        i += 1;
        j += -1;
    }
    return true;
}

int main(){
    string S;
    cin >> S;
    int N = S.size();
    if (kaibun(S, 1, N) && kaibun(S, 1, (N-1)/2) && kaibun(S, (N+3)/2, N))
        cout << "Yes" << endl;
    else 
        cout << "No" << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false); //cin.tie(NULL); cout.tie(NULL)
#define mp make_pair
#define pb push_back
#define fs first
#define sc second

using namespace std;
typedef long long ll;
typedef long double ld;


/* BIEN CUC BO BEGIN*/
	int a, b;
/* BIEN CUC BO END*/

void solve(){	
	cin >> a >> b;
	if (b%a){
		cout << b-a;
	} else {
		cout << a+b;
	}
}	

int main(){ FIO;
	solve();
return 0;}

Measured memory_bytes: 256
import java.util.*;
class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Deque<String[]> que = new LinkedList<String[]>();
		while(in.hasNext()) que.push(in.nextLine().split(","));
		System.out.println(solve(que));
	}
	static String solve(Deque<String[]> que) {
		String now = "A";
		while(!que.isEmpty()) {
			String[] pair = que.pollLast();
			now = now.equals(pair[0])?pair[1]:now.equals(pair[1])?pair[0]:now;
		}
		return now;
	}
}

Measured memory_bytes: 12000
#include <cstddef>
#include <vector>
#include <iostream>

#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(lint ngtkana_is_a_genius=0; ngtkana_is_a_genius<(lint)k; ngtkana_is_a_genius++)
using lint=long long;
using ld=long double;
template<class T> using numr=std::numeric_limits<T>;
struct input_t {
    template<class T> operator T() {
        T t;
        std::cin>>t;
        return t;
    }
} input;
#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main(){
    std::size_t n;
    unsigned long long k;
    std::cin >> n >> k;

    std::vector<std::size_t> a(n);
    for (std::size_t i=0; i<n; i++) {
        std::cin >> a.at(i);
        a.at(i)--;
    }

    std::vector<int> time(n, -1);
    time.at(0) = 0;
    std::vector<std::size_t> seq = { 0 };
    std::size_t s;
    while (true) {
        std::size_t x = a.at(seq.back());
        if (time.at(x)!=-1) {
            s = time.at(x);
            break;
        }
        time.at(x) = time.at(seq.back()) + 1;
        seq.push_back(x);
    }

    if (k < (unsigned long long)s) {
        std::cout << seq.at(k) + 1 << '\n';
        return 0;
    }

    std::cout << seq.at((k-s)%(seq.size()-s)+s)+1 << '\n';
}



Measured memory_bytes: 7712
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define ull unsigned long long 
#define FF first
#define SS second
#define MOD 1000000007

using namespace std;

int gcd(int a, int b) {
  while (a > 0 && b > 0)
    if (a > b) a %= b;
    else b %= a;
  return a + b;
}

ll modpower(ll x, ll y, ll p) //x^y mod p
{
    ll res = 1;      // Initialize result
 
    x = x % p;  // Update x if it is more than or 
                // equal to p
 
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y %2!= 0)
            res = (res*x) % p;
 
        // y must be even now
        y = y/2;
        x = (x*x) % p;  
    }
    return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	ll a,b;
	cin>>a>>b;
	for(int i=1;i<=999;i+=1)
	{
		ll u = ((i)*(i+1))/2;
		ll v = ((i+1)*(i+2))/2;
		if(u-a>0 && u-a==v-b)
		{
			cout<<u-a;
			break;
		}
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>

using namespace std;
int main() {
	string S;
	cin >> S;

	array<bool, 26> chList = {};
	for (char ch : S) {
		chList[ch - 97] = true;
	}

	for (size_t i = 0; i < 26; i++) {
		if (!chList[i]) {
			cout << (char)(i + 97);
			break;
		}
		if (i == 25) {
			cout << "None";
		}
	}

	return 0;
}

Measured memory_bytes: 512
# require 'pry'
def calc(n,s = "",pre = "a".unpack("C*")[0])
  if n == 0
    puts s
    return
  end
  ("a".unpack("C*")[0]).upto(pre) do |t|
    # calc(n - 1, s + [t].pack("C*"), t)
    calc(n - 1, s + [t].pack("C*"), t == pre ? pre + 1 : pre)
  end
end

N = gets.to_i
# binding.pry
calc(N)

Measured memory_bytes: 3196