akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"fmt"
)

const MOD = 1000000007

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	idx, value int
	index      int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}
func main() {
	var N, K int
	fmt.Scanf("%d %d\n", &N, &K)
	res := 0
	for i := K; i <= N+1; i++ {
		min := i * (i - 1) / 2
		max := i * (2*N - i + 1) / 2
		r := max - min + 1
		res = (res + r) % int(1e9+7)
	}
	fmt.Println(res)
}


Measured memory_bytes: 1816
// I am Nothing, You Are Nothing!
// Krishna is Everything ...
// Jai Shree Krishna

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5 + 5, mod = 1e9 + 7;

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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n, k;
	cin >> n >> k;

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

	dp[1] = 0;

	for (int i = 2; i <= n; i++) {
		int ans = INT_MAX;
		for (int j = 1; j <= k; j++) {
			if (i - j > 0) {
				ans = min(ans, dp[i - j] + abs(a[i] - a[i - j]));
			} else {
				break;
			}
		}
		dp[i] = ans;
	}
	cout << dp[n] << endl;


	return 0;
}


Measured memory_bytes: 4772
#include <bits/stdc++.h>
using namespace std;
set<int>s;
int n,k;
int main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>k;
    int temp;
    for(int i=0;i<k;++i)
    {
        cin>>temp;
        s.insert(temp);
    }
    bool flag;
    for(int i=n;;++i)
    {
        flag=false;
        temp=i;
        while(temp)
        {
            if(s.count(temp%10))
            {
                flag=true;
                break;
            }
            else
            {
                temp/=10;
            }
        }
        if(!flag)
        {
            cout << i<<endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
from bisect import bisect_right

n = int(input())
XYU = [list(input().split()) for _ in range(n)]

dis = 10 ** 19 

# 正面衝突用
box = {"U":defaultdict(list),"D":defaultdict(list),"L":defaultdict(list),"R":defaultdict(list)}

for x, y, u in XYU:
  x = int(x)
  y = int(y)
  if u in ["U","D"]:
    box[u][x].append(y) 
  else:
    box[u][y].append(x)
    
for k1 in box.keys():
  for k2 in box[k1].keys():
    box[k1][k2] = sorted(box[k1][k2])
    
for k, v in box["U"].items():
  if k in box["D"]:
    for pos in v:
      if pos < box["D"][k][-1]:
        a = bisect_right(box["D"][k], pos)
        dis = min(dis, (box["D"][k][a] - pos) * 10 // 2)

for k, v in box["R"].items():
  if k in box["L"]:
    for pos in v:
      if pos < box["L"][k][-1]:  
        a = bisect_right(box["L"][k], pos)
        dis = min(dis, (box["L"][k][a] - pos) * 10 // 2)

# 右肩下がりの同一直線上から発進した機体の衝突用
cox = {"U":defaultdict(list),"D":defaultdict(list),"L":defaultdict(list),"R":defaultdict(list)}

for x, y, u in XYU:
  x = int(x)
  y = int(y)
  cox[u][x+y].append(x) 
    
for k1 in cox.keys():
  for k2 in cox[k1].keys():
    cox[k1][k2] = sorted(cox[k1][k2])
    
for k, v in cox["R"].items():
  if k in cox["U"]:
    for pos in v:
      if pos < cox["U"][k][-1]:
        a = bisect_right(cox["U"][k], pos)
        dis = min(dis, (cox["U"][k][a] - pos) * 10)

for k, v in cox["D"].items():
  if k in cox["L"]:
    for pos in v:
      if pos < cox["L"][k][-1]:  
        a = bisect_right(cox["L"][k], pos)
        dis = min(dis, (cox["L"][k][a] - pos) * 10)

# 右肩上がりの同一直線上から発進した機体の衝突用
dox = {"U":defaultdict(list),"D":defaultdict(list),"L":defaultdict(list),"R":defaultdict(list)}

for x, y, u in XYU:
  x = int(x)
  y = int(y)
  dox[u][x-y].append(x) 
    
for k1 in dox.keys():
  for k2 in dox[k1].keys():
    dox[k1][k2] = sorted(dox[k1][k2])
    
for k, v in dox["U"].items():
  if k in dox["L"]:
    for pos in v:
      if pos < dox["L"][k][-1]:
        a = bisect_right(dox["L"][k], pos)
        dis = min(dis, (dox["L"][k][a] - pos) * 10)

for k, v in dox["R"].items():
  if k in dox["D"]:
    for pos in v:
      if pos < dox["D"][k][-1]:  
        a = bisect_right(dox["D"][k], pos)
        dis = min(dis, (dox["D"][k][a] - pos) * 10)

if dis == 10 ** 19:
  print("SAFE")
else:
  print(dis)

Measured memory_bytes: 189868
#include <bits/stdc++.h>
#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 (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;
const int MAX = 100005;

vector<int> G[MAX];
vector<int> c(MAX, -1);
int color = 0;

void dfs(int u) {
  if (c[u] != -1) return;
  c[u] = color;
  for (int v: G[u]) {
    dfs(v);
  }
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> p(n);
  rep(i, n) {
    cin >> p[i];
    p[i]--;
  }
  rep(i, m) {
    int x, y;
    cin >> x >> y;
    G[x - 1].push_back(y - 1);
    G[y - 1].push_back(x - 1);
  }

  rep(i, n) {
    if (c[i] == -1) {
      dfs(i);
      color++;
    }
  }

  set<int> id[color];
  rep(i, n) id[c[i]].insert(p[i]);

  int ans = 0;
  rep(i, n) {
    if (id[c[i]].find(i) != id[c[i]].end()) ans++;
  }
  cout << ans << endl;


  
  return 0;
}

Measured memory_bytes: 13568
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here! sakuraihaaho
    string x;   
    int hai[26] ={};
     while(getline(cin,x)){
        for(int i = 0;i<x.size();i++){
            if( (int)x.at(i)>=(int)'a'&&(int)x.at(i)<=(int)'z') hai[x.at(i)-(int)'a'] +=1;
            else if((int)x.at(i)>=(int)'A'&&(int)x.at(i)<=(int)'Z')  hai[x.at(i)-(int)'A'] +=1;
        }
    } 
    for(int i = 0;i<26;i++){
        cout<<(char)('a'+i)<<" : "<<hai[i]<<endl;
    }
    return 0;
}



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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)

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

  int ans = max(0, a - 2 * b);
  ANS(ans);
  return 0;
}


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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

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

void hawawa()
{
	string str, str2;
	cin >> str >> str2;
	if (string(rbegin(str), rend(str)) == str2) {
		cout << "YES\n";
	}
	else {
		cout << "NO\n";
	}
}

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <cmath>
#include <map>

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const nmax = 8;

char v[1 + nmax][1 + nmax];

int main() {
  int n, m;
  std::cin >> n >> m;
  int result = 0;
  for(int i = 1;i <= n; i++)
    for(int j = 1;j <= m; j++) {
      std::cin >> v[i][j];
      result += (v[i][j] == '#');
    }
  if(result == n + m - 1)
    std::cout << "Possible";
  else
    std::cout << "Impossible";
  return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define INPUT(x) scanf("%d",&x)
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(x,s,e) for(int x = s; x <= e; x++)
#define BR printf("\n")
#define INF 2000000000

int main(){
    INT(A);INT(B);INT(H);
    cout << (A+B)*(H/2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <numeric>
#include <array>
#include <queue>
#include <set>
using namespace std;
using ll = long long int;
#define REP(i,n) for(int i=0;i<n;i++)

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

    if (A <= 5)
    {
        cout << 0 << endl;
    }
    else if ( 6<= A and A <= 12)
    {
        cout << B/2 << endl;
    }
    else
    {
        cout << B << endl;
    }
}

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

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main(){
	int N;
	cin >> N;
	vector<LL> A(N);
	rep(i,N) cin >> A[i];
	rep(i,N) A[i]-=i+1;
	sort(A.begin(),A.end());
	LL b=A[N/2];
	LL ans=0;
	rep(i,N) ans+=abs(A[i]-b);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
using System;
using System.Linq;

namespace C___Vacation
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var vacation = new int[N+1,3];

            for(int i = 1 ; i < N+1 ; i++)
            {
                var Read = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                vacation[i,0] = Read[0];
                vacation[i,1] = Read[1];
                vacation[i,2] = Read[2];
            }

            var happiness = new long[N+1,3];
            for(int i = 1 ; i < N+1 ; i++)
            {
                happiness[i,0] = Math.Max(happiness[i-1,1],happiness[i-1,2]) + vacation[i,0];
                happiness[i,1] = Math.Max(happiness[i-1,0],happiness[i-1,2]) + vacation[i,1];
                happiness[i,2] = Math.Max(happiness[i-1,0],happiness[i-1,1]) + vacation[i,2];
            }

            Console.WriteLine(Math.Max(happiness[N,2],Math.Max(happiness[N,0],happiness[N,1])));

        }
    }
}


Measured memory_bytes: 20660
import java.util.Scanner;


public class Main {
    
    public static void main(String[] args) {
        
        Scanner input = new Scanner (System.in);
        
        int n = input.nextInt();
        
        int [] array1 = new int [n];
        
        for(int i = 0 ; i < n ; i++)
            array1[i] = input.nextInt();
        
        int [] array2 = new int [n];
        
        array2[0] = 0;
        array2[1] = Math.abs(array1[0] - array1[1]);
        
        for(int i = 2 ; i < n ; i++)
        {
            int temp1 = Math.abs(array1[i-1] - array1[i]) + array2[i-1];
            int temp2 = Math.abs(array1[i-2] - array1[i]) + array2[i-2];
            
            array2[i] = Math.min(temp1 , temp2);
        }
        
        System.out.println(array2[n-1]);
    }
        
        
    
}


Measured memory_bytes: 50508
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]


def dfs(i, sum, count, nokori):
    global ans
    if i == d:#全ての最後の問題セットにたどり着いたら,　全ての葉を確認
        if sum < g:
            use = max(nokori)#選んでいない種類で最大のスコアの問題を選ぶ
            #-(-(g-sum)//(use*100)) <- (g-sum)//(use*100)
            n = min(pc[use-1][0], -(-(g-sum)//(use*100)))#その難易度の問題の数 または 残りの必要スコア/その難易度の問題1問の点数　の最小値をとる->余計に問題を解かない＆問題数を超えてとかない
            count += n
            sum += n * use * 100

        if sum >= g:#全ての葉の達成してる最小の答えを記録
            ans = min(ans, count)

    else:
        dfs(i+1, sum, count, nokori)#選ばなかった場合
        dfs(i+1, sum + pc[i][0] * (i+1) * 100 + pc[i][1], count + pc[i][0], nokori - {i+1})#全て解いた番号をセットから抜いて、合計&countを更新

ans = float("inf")
dfs(0, 0, 0, set(range(1, d+1)))
print(ans)

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

typedef vector<vector<int>> Matrix;

const int INF = 1e9;
Matrix d;

void warshall_floyd(int n) {
	int max = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < n; k++) {
				d.at(j).at(k) = min(d.at(j).at(k), d.at(j).at(i) + d.at(i).at(k));
				if (max < d.at(j).at(k) && d.at(j).at(k) != INF) max = d.at(j).at(k);
			}
		}
	}
}

int main() {
	int H, W;
	cin >> H >> W;
	vector<vector<int>> S(H, vector<int>(W));
	int V_cnt = H * W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			char tmp[2];
			cin >> tmp[0];
			if (tmp[0] == '.') {
				S.at(i).at(j) = 1;
			}
			else S.at(i).at(j) = 0;
		}
	}

	d = Matrix(V_cnt, vector<int>(V_cnt, INF));
	for (int i = 0; i < V_cnt; i++) d.at(i).at(i) = 0;

	vector<int> shift = {-1, 1, -W, W};
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (S.at(i).at(j) == 0) continue;
			else {
				if (j > 0 && S.at(i).at(j - 1) == 1) {
					d.at(i * W + j).at(i * W + j + shift.at(0)) = 1;
				}
				if (j < W - 1 && S.at(i).at(j + 1) == 1) {
					d.at(i * W + j).at(i * W + j + shift.at(1)) = 1;
				}
				if (i > 0 && S.at(i - 1).at(j) == 1) {
					d.at(i * W + j).at(i * W + j + shift.at(2)) = 1;
				}
				if (i < H - 1 && S.at(i + 1).at(j) == 1) {
					d.at(i * W + j).at(i * W + j + shift.at(3)) = 1;
				}
			}
		}
	}

	warshall_floyd(V_cnt);
	int ans = 0;
	for (int i = 0; i < V_cnt; i++) {
		for (int j = 0; j < V_cnt; j++) {
			if (i != j && d.at(i).at(j) != INF) {
				if (ans < d.at(i).at(j)) ans = d.at(i).at(j);
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    int n;
    string s, t;
    cin >> n >> s >> t;
    rep(i, n)
    {
        int count = 0;
        rep(j, n - i)
        {
            if (s[i + j] == t[j])
                count++;
            else
                ;
            if (count == n - i)
            {
                cout << s.length() + t.length() - count << endl;
                return 0;
            }
        }
    }
    cout << s.length() + t.length() << endl;
    return 0;
}

Measured memory_bytes: 256
public class Main {

  private static void solve() {
    int n = ni();
    System.out.println(n * n);

  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

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

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



Measured memory_bytes: 23252
#include<bits/stdc++.h>
main()
{
	int x,y,n;
	scanf("%d%d%d",&x,&y,&n);
	int sum=0;
	for(int i=x;i<=y;i++)
	{
		if(i%n==0)sum++;
	}
	printf("%d\n",sum);
}

Measured memory_bytes: 3808
#include<stdio.h>

typedef long long int LL;

LL dp[401][401];
int opt[401][401];

class solution {
private:
	int n;
	LL pref[401];
	LL ar[401];
	void prec() {
		pref[0] = ar[0];
		for (int i = 1; i <= n; i++) {
			pref[i] = pref[i - 1] + ar[i];
		}
	}
	void solve() {
		for (int i = 0; i < n; i++) {
			for (int j = 1; j <= n - i; j++) {
				if (i < 2) {
					dp[j][j + i] = pref[j + i] - pref[j - 1];
					if (i == 0) dp[j][j] = 0;
					opt[j][j + i] = j;
				}
				else {
					dp[j][j + i] = ~(1ll << 63);
					for (int k = j; k < j + i; k++) {
						if (dp[j][k] + dp[k + 1][j + i] < dp[j][j + i]) {
							dp[j][j + i] = dp[j][k] + dp[k + 1][j + i];
							opt[j][j + i] = k;
						}
					}
					dp[j][j + i] += pref[j + i] - pref[j - 1];
				}
			}
		}
	}
public:
	solution() {
		scanf("%d", &n);
		ar[0] = 0;
		for (int i = 1; i <= n; i++) {
			scanf("%lld", &ar[i]);
		}
		prec();
		solve();
		printf("%lld\n", dp[1][n]);
	}
};

#ifndef L0C4L
int main() {
	solution();
	return 0;
}
#endif

Measured memory_bytes: 2048
import java.util.*;
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        int re = n.indexOf("7");
        if(re != -1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } 
}

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



int main(){
    int W, H;
    vector<int> v_ans;
    while(1){
        cin >> W >> H;
        if(W == 0) break;
        vector<pair<int,int>> move;
        move.push_back(make_pair(1,0));
        move.push_back(make_pair(-1,0));
        move.push_back(make_pair(0,1));
        move.push_back(make_pair(0,-1));
        vector<vector<int>> E_LandR(H, vector<int>(W - 1, 0));
        vector<vector<int>> E_UandD(H, vector<int>(W, 0));
        int cnt = -1;
        for (int i = 0; i < 2 * H - 1; i++){
            int num;
            if(i % 2 == 0){
                num = W - 1;
                cnt++;
            }else{
                num = W;
            }
            for (int j = 0; j < num; j++){
                int a;
                cin >> a;
                if(a == 1 && i % 2 == 0) E_LandR[cnt][j] = 1;
                if(a == 1 && i % 2 == 1) E_UandD[cnt][j] = 1;
            }
        }

        vector<vector<int>> dist(1000, vector<int>(1000, 0));
        queue<pair<int, int>> que;
        que.push(make_pair(0, 0));
        while (!que.empty()){
            int x = que.front().first;
            int y = que.front().second;
            que.pop();
            for (auto p: move){
                int nx = x + p.first;
                int ny = y + p.second;
                if(nx < 0 || nx >= W || ny < 0 || ny >= H) continue;
                if(nx != x){
                    if(nx > x && E_LandR[y][x] == 1){
                        continue;
                    }else if((nx < x && E_LandR[y][nx] == 1)){
                        continue;
                    }
                }else if(y != ny){
                    if(ny > y && E_UandD[y][x] == 1){
                        continue;
                    }else if((ny < y && E_UandD[ny][x] == 1)){
                        continue;
                    }
                }
                if(dist[ny][nx] == 0 ){
                    dist[ny][nx] = dist[y][x] + 1;
                    que.push(make_pair(nx, ny));
                }
            }
        }

        if(dist[H - 1][W - 1] != 0){
            v_ans.push_back(dist[H - 1][W - 1] + 1);
        }else{
            v_ans.push_back(dist[H - 1][W - 1]);
        }
    }
    for(auto p:v_ans){
        cout << p <<endl;
    }

}



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

#define REP(A, H) for(int A = 0; A < H; A++)
#define ALL(c) c.begin(), c.end()

int dp[10001][10001];

int main(void) {
  int n, q; std::cin >> n >> q;
  std::string s; std::cin >> s;
  std::vector< std::pair<int, int> > ques;
  REP(i, q) {
    int l, r; std::cin >> l >> r; l--; r--; ques.push_back(std::make_pair(l, r));  
  }

  std::vector<int> accsum(s.length());
  accsum[0] = 0;
  accsum[1] = 0;
  REP(i, s.length()) {
    if (i == 0) continue; 
    if (s[i - 1] == 'A' && s[i] == 'C') {
      accsum[i]++;
    }
    accsum[i + 1] = accsum[i];
  }

  // REP(i, s.length()) {
  //   std::cout << accsum[i] << std::endl;
  // }

  REP(i, q) {
    std::cout << accsum[ques[i].second] - accsum[ques[i].first] << std::endl;
  }

  return 0;
}


Measured memory_bytes: 2292
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, N);
  VEC(int, A, N);
  int dup = 0;
  map<int, int> m;
  rep(i, 0, N) {
    if (m[A[i]]++) dup++;
  }
  print(N - dup - dup % 2);
}


Measured memory_bytes: 5376
#include <stdio.h>

void output(int A[], int n){
  int i;
  for (i = 1; i < n+1; i++){
    printf("%d", A[i]);
    if(i < n)printf(" ");
    else  printf("\n");
  }

}

int main(){
  int A[1000];
  int n, i, j, v;

  scanf("%d", &n);

  for(i = 1; i <= n; i++){
    scanf("%d", &A[i]); 
  }


  
  for(i = 1; i <= n; i++){
    v = A[i];
    j = i - 1;

    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    
    A[j+1] = v;
    output(A, n);
  }

  return 0;
}

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

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
int gcd(int a,int b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

//重みある時
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;

int n;
Graph G;
vector<int> ans;

void dfs(int v,int p,int c){
    ans[v] = c;
    for(auto e:G[v]){
        if(e.first == p) continue;
        if(e.second & 1) dfs(e.first,v,1-c);  // 重み奇数なら違う色で塗る
        else dfs(e.first,v,c);
    }
}

int main() {
    cin >> n;
    G.assign(n,vector<Edge>());
    for (int i = 0; i < n-1; ++i) {
        int u,v,w;
        cin >> u >> v >> w;
        u--,v--;
        G[u].push_back(Edge(v,w));
        G[v].push_back(Edge(u,w));
    }
    ans.resize(n);
    dfs(0,-1,0);
    for(auto v:ans) cout << v << endl;
    return 0;
}

Measured memory_bytes: 8960
import java.util.*;

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

        if((A1+A2+A3) <= 21){
            System.out.println("win");
        }else{
            System.out.println("bust");
        }
    }
}


Measured memory_bytes: 23508
#ifdef _WIN32
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

// 継承可能な型
template <class Type>
struct IN : Type
{
	IN()
	{
		std::cin >> *this;
	}
};

// 継承不可能な型
template <class Type>
struct IN_
{
	Type val;

	IN_()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN_<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN_<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN_<Type>& value)
{
	return is >> value.val;
}

template <class Type>
void OUT(const Type& value)
{
	std::cout << value << std::endl;
}

template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value << ' ';
	OUT(args...);
}

void Yes()
{
	OUT("Yes");
}
void No()
{
	OUT("No");
}

using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;

// 階乗を計算 O(N) (N=10^7 で O(10^7))
int Factorial(ll n)
{
	for (ll i = n - 1; i > 1; i--)
		n *= i;
	return n;
}

// nCrを計算 O(N) (N=10^7 で O(10^7))
ll Combination(const ll n, const ll r)
{
	return Factorial(n) / (Factorial(r) * Factorial(n - r));
}

// 素数判定 O(sqrt(N)) (N=10^7 で O(10^3))
bool IsPrime(const ll num)
{
    if (num < 2) return false;
    if (num == 2) return true;
    if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }

    return true;
}

// 各桁の和を計算 O(logN) (N=10^7 で O(7))
ll DigitSum(ll n)
{
	ll sum = 0;
	while(n != 0){
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

#define FOR(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for (ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for (ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for (auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for (auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

#ifdef _DEBUG
	system("pause");
#endif

	return 0;
}

using namespace std;

//////////////////////////////

void Main()
{
	inll N;

	vll dp(N + 1);

	dp[0] = 0;

	FOR(n, 1, N + 1)
	{
		dp[n] = dp[n - 1] + 1;
		for (ll i = 6; n - i >= 0; i *= 6)
		{
			dp[n] = min(dp[n], dp[n - i] + 1);
		}
		for (ll i = 9; n - i >= 0; i *= 9)
		{
			dp[n] = min(dp[n], dp[n - i] + 1);
		}
	}
	
	return OUT(dp[N]);
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
class Main{
	static int sum=0;
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		long A=sc.nextLong();
		long N=sc.nextLong();
		long M=sc.nextLong();
		long max=0;
		while(pw(max+A+1,N)<=M) {
			max++;
		}
		for(long i=A; i<=A+max; i++) {
			long zan=i-A;
			long ma=ketawa(pw(i,N));
			if(zan==ma && zan>0) {
				sum++;
			}
		}
		pl(sum);
	}
	static long ketawa(long a) {
		long sum=0;
		while(a>0) {
			sum+=a%10;
			a/=10;
		}
		return sum;
	}
	static long pw(long base,long p) {
		long ans=1;
		for(long i=0; i<p; i++) {
			ans*=base;
		}
		return ans;
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
}


Measured memory_bytes: 24220
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    h, w = map(int, input().split())
    if h == 1 or w == 1:
        ans = 1
    elif h % 2 == 0:
        ans = (h // 2) * w
    elif w % 2 == 0:
        ans = (w // 2) * h
    else:
        ans = h * (w // 2) + (h // 2) + 1
    print("%d" % ans)


if __name__ == '__main__':
    main()


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

using namespace std;

int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);

    constexpr int A_MAX = 1000000;

    vector<int> min_factor(A_MAX);
    // q[n] = i where n = i * p^e, p = min_factor[n], p does not divide i. + 1);
    vector<int> q(A_MAX + 1, 1);
    vector<int> primes;
    for (int i = 2; i <= A_MAX; ++i) {
        min_factor[i] = i;
    }
    for (int i = 2; i <= A_MAX; ++i) {
        if (min_factor[i] == i) {
            primes.push_back(i);
        }
        for (int p : primes) {
            int n = i * p;
            if (n > A_MAX) {
                break;
            }
            min_factor[n] = p;
            if (p == min_factor[i]) {
                q[n] = q[i];
                break;
            } else {
                q[n] = i;
            }
        }
    }

    int N;
    cin >> N;
    vector<int> a(A_MAX + 1);
    for (int i = 0; i < N; ++i) {
        int A;
        cin >> A;
        ++a[A];
    }

    bool is_pairwise_coprime = true;
    for (int n = A_MAX; n > 1; --n) {
        if (a[n] > 1) {
            if (a[n] == N) {
                cout << "not coprime" << endl;
                return 0;
            }
            is_pairwise_coprime = false;
        }
        a[min_factor[n]] += a[n];
        a[q[n]] += a[n];
    }
    if (is_pairwise_coprime) {
        cout << "pairwise coprime" << endl;
    } else {
        cout << "setwise coprime" << endl;
    }

    return 0;
}


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

int main(){
int n,a,b,c,d;
cin >> n >> a >> b >> c >> d;
int x=(n-1)/a+1;
int y=(n-1)/c+1;
cout << min(x*b,y*d) << endl;
}


Measured memory_bytes: 3096
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8');
const args: string[][] = input.split('\n').map(l => l.split(' '));

const [a, b, c, d] = args[0].map(x => parseInt(x));

let hp_takahashi = a;
let hp_aoki = c;
let takahashi_win: boolean;
while (true) {
    hp_takahashi -= d;
    hp_aoki -= b;

    if (hp_aoki <= 0) {
        takahashi_win = true;
        break
    } else if (hp_takahashi <= 0) {
        takahashi_win = false;
        break
    }
}

const msg = takahashi_win ? 'Yes' : 'No';

console.log(msg);

Measured memory_bytes: 29688
#include<bits/stdc++.h>
using namespace std;
#define pi acos(0.0)
#define ll long long
#define f first
#define s second
#define gap ' '
#define pb push_back
int main()
{
    int n,k;
    cin>>k>>n;
    if(n==1)
    {
       cout << 0;
    }
    else{
       cout<<k-n;
    }
}


Measured memory_bytes: 256
if __name__ == "__main__":
    n, m, x = map(int, input().split())
    ca = []
    for _ in range(n):
        tmp = list(map(int, input().split()))
        ca.append(tmp)
    ans = float('inf')
    for mask in range(1 << n):
        cost = 0
        algo = [0] * m

        for i in range(n):
            if 1 & (mask >> i):
                cost += ca[i][0]
                for j in range(1, m + 1):
                    algo[j - 1] += ca[i][j]
        ok = True
        for i in range(m):
            if algo[i] < x:
                ok = False
                break
        if ok:
            ans = min(ans, cost)
    if ans == float('inf'):
        print(-1)
    else:
        print(ans)

Measured memory_bytes: 9232
A = []
for _ in range(3):
    A += [int(v) for v in input().strip().split()]
N = int(input())
nums = [int(input()) for _ in range(N)]

for n in nums:
    try:
        A[A.index(n)] = -1
    except ValueError:
        pass

def _(A):
    for i in range(3):
        if len(set(A[i*3:(i*3+3)])) == 1:
            return "Yes"
    for i in range(3):
        if len(set(A[i::3])) == 1:
            return "Yes"
    if A[0] * A[4] * A[8] == -1:
        return "Yes"
    if A[2] * A[4] * A[6] == -1:
        return "Yes"
    return "No"

print(_(A))

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int count = 0;


void insertSort(int *A,int n,int g){
  int i,j;
  int key;
  for( i = g ; i < n ; i++){
    j = i;
    key = A[i];
    while( 0 <= j - g){
      if( A[j-g] <= key) break;
      A[j] = A[j-g];
      j -= g;
      count++;
    }
   A[j] = key;
 }
}


int main(){
  int n;
  int i,j;
  int *A;
  int G[20];

  scanf("%d", &n);
  A = malloc(n * sizeof(int));
  for( i = 0 ; i < n ; i++ ) scanf("%d", &A[i]);

  int m = 0;
  G[0] = 0;
  while(1){
    if( n < 3*G[m]+1) break;
    G[m+1] = 3*G[m] + 1;
    m++;
 }

 for( i = m ; i > 0 ; i--) insertSort(A,n,G[i]);

  printf("%d\n", m);
  for( i = m ; i >= 1 ; i-- ) printf("%d ", G[i]);
  printf("\n");
  printf("%d\n", count);

  for( i = 0 ; i < n ; i++ ) printf("%d\n", A[i]);

  return 0;
}



Measured memory_bytes: 5732
/* ---------- STL Libraries ---------- */

// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */

using namespace std;

/* ---------- Type Abbreviation ---------- */

using ll = long long;

template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using GPQ = priority_queue<T, vector<T>, greater<T>>;

#define mp make_pair
#define mt make_tuple

/* ----------- debug ---------- */

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p);

template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
    os << "[";
    for (auto vv : v)
        os << vv << ",";
    return os << "]";
}

template <class T>
ostream& operator<<(ostream& os, set<T> v) {
    os << "[";
    for (auto vv : v)
        os << vv << ",";
    return os << "]";
}

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
    return os << "(" << p.first << "," << p.second << ")";
}

/* ---------- Constants ---------- */

// const ll MOD = 1000000007;
// const ll MOD = 998244353;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* ---------- Short Functions ---------- */

template <typename T>
inline T sq(T a) { return a * a; }

template <typename T>
T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    return b == 0 ? a : gcd(b, a % b);
}

template <typename T, typename U>
T mypow(T b, U n) {
    if (n == 0) return 1;
    if (n == 1) return b /* % MOD */;
    if (n % 2 == 0) {
        return mypow(b * b /* % MOD */, n / 2);
    } else {
        return mypow(b, n - 1) * b /* % MOD */;
    }
}

ll pcnt(ll b) {
    return __builtin_popcountll(b);
}

template <typename T>
T iceil(T n, T d) {
    return (n + d - 1) / d;
}

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

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

    int l[n];
    for (int i = 0; i < n; ++i) cin >> l[i];
    sort(l, l + n);
    cout << (accumulate(l, l + n - 1, 0) > l[n - 1] ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
import Control.Monad
import Data.List
import Data.Char

main = do
    nums <- map digitToInt <$> getLine
    putStrLn $ solve operatorCombi nums
    

-- 使う演算子たち
operators = ["+", "-"]

-- 取りうる演算子の組み合わせ
operatorCombi =
    [(a, b, c) 
    | a <- operators
    , b <- operators
    , c <- operators
    ]

type Op = String

-- 数値の一覧に演算子をそれぞれ適用した結果7になる式を文字列で返す
solve :: [(Op, Op, Op)] -> [Int] -> String
solve (op:ops) operands =
    if (apply op operands) == 7 then
        expStr op operands
    else
        solve ops operands


apply :: (Op, Op, Op) -> [Int] -> Int
apply (op1s, op2s, op3s) [n1, n2, n3, n4] = n1 `op1` n2 `op2` n3 `op3` n4
    where toF "+" = (+)
          toF "-" = (-)
          toF otherwise = \_ _ -> 0
          op1 = toF op1s
          op2 = toF op2s
          op3 = toF op3s


expStr :: (Op, Op, Op) -> [Int] -> String
expStr (op1, op2, op3) [n1, n2, n3, n4] =
    show n1 ++ op1 ++ show n2 ++ op2 ++ show n3 ++ op3 ++ show n4 ++ "=7"


Measured memory_bytes: 380
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
vector<int>adjacent[100001];
int dp[100001];

void dfs(int u)
{
	if(dp[u]!=0)
		return;
	else if(adjacent[u].size()==0)
	{
		dp[u]=0;
	}
	vector<int>::iterator it=adjacent[u].begin();
	while(it!=adjacent[u].end())
	{
		if(dp[*it]==0)
		{
			dfs(*it);
			dp[u]=max(dp[u],1+dp[*it]);
		}
		else
		{
			dp[u]=max(dp[u],1+dp[*it]);
		}
		it++;
	}
}
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		adjacent[a].push_back(b);
	}

	for(int i=1;i<=n;i++)
	{
		dfs(i);
	}

	int mi=-1;
	for(int i=1;i<=n;i++)
	{
		mi=max(mi,dp[i]);
	}

	cout<<mi<<endl;
}

Measured memory_bytes: 7424
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

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

    int kind = 1;

    rep(i,n-1){
        if(a[i] != a[i+1]) kind++;
    }

    if(kind %2 == 0){
        cout << kind -1 << endl;
    }
    else cout << kind << endl;
}


Measured memory_bytes: 640
import collections
n=int(input())
d=list(map(int,input().split()))
m=int(input())
t=list(map(int,input().split()))
dd,tt=collections.Counter(d),collections.Counter(t)
for k,v in tt.items():
  if dd.get(k)==None:
    print("NO")
    exit()
  elif dd.get(k)<v:
    print("NO")
    exit()
print("YES")

Measured memory_bytes: 57056
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM_ID.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 LN             PIC X(10).
01 a              PIC 9(1).
01 ca             PIC X(1).
01 b              PIC 9(1).
01 n              PIC 9(10).
01 i              PIC 9(10).
01 ans            PIC X(10).
PROCEDURE DIVISION.
  ACCEPT LN.
  UNSTRING LN DELIMITED BY SPACE INTO a b.
  IF a < b
      MOVE b TO n
      MOVE a TO ca
  ELSE
      MOVE a TO n
      MOVE b TO ca
  END-IF.
  PERFORM VARYING i FROM 1 BY 1 UNTIL n < i
      MOVE ca TO ans(i:1)
  END-PERFORM.
  DISPLAY ans(1:n).
  STOP RUN.


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

int main() {
    while (true) {
        int x, y;
        cin >> x >> y;

        if (x == 0 && y == 0) {
            break;
        }

        if (x < y) {
            printf("%d %d\n", x, y);
        } else {
            printf("%d %d\n", y, x);
        }
    }
}


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

int main() {
    //変数定義, 入力処理
    // vector<vector<int>> data(3, vector<int>(4)); //二次元配列
    int R;
    cin >> R;
    //処理

    //出力処理
    cout << fixed << setprecision(10) << R * 2 * M_PI << endl;
    return 0;
}


Measured memory_bytes: 3788
#include <stdlib.h>
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

struct Node {
	int key;
	Node* p;
	Node* l;
	Node* r;
};

Node* root;
Node* NIL;

void insert(int z) {

	Node* y = NIL;
	Node* x = root;

	Node* zn = (Node *) malloc(sizeof(Node));
	zn->key = z;
	zn->l = NIL;
	zn->r = NIL;

	while (x != NIL) {
		y = x;
		if (zn->key < x->key)
			x = x->l;
		else
			x = x->r;
	}

	if (y == NIL)
		root = zn;
	else if (zn->key < y->key)
		y->l = zn;
	else
		y->r = zn;

}

bool find(Node* n, int k) {
	if (n->key == k)
		return true;

	bool result;
	if (k < n->key) {
		if (n->l != NIL)
			result = find(n->l, k);
		else
			result = false;
	}

	if (n->key < k) {

		if (n->r != NIL)
			result = find(n->r, k);
		else
			result = false;
	}
	return result;
}

void printInOrder(Node* n) {
	if (n == NIL)
		return;

	printInOrder(n->l);
	cout << " " << n->key;
	printInOrder(n->r);
}

void printPreOrder(Node* n) {
	if (n == NIL)
		return;
	cout << " " << n->key;
	printPreOrder(n->l);
	printPreOrder(n->r);
}

int main() {

	int n;
	scanf("%d", &n);

	string s;
	int k;
	for (int i = 0; i < n; ++i) {
		cin >> s;
		if (s == "insert") {
			scanf("%d", &k);
			insert(k);
		} else if (s == "find") {
			scanf("%d", &k);
			if (find(root, k))
				cout << "yes" << endl;
			else
				cout << "no" << endl;
		} else {
			printInOrder(root);
			cout << endl;
			printPreOrder(root);
			cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 21820
#include <stdio.h>

int main(void)
{
  int A,B;
  int C = 0;

  scanf("%d %d",&A,&B);

  if(A%3 == 0)
    C = 1;
  if(B%3 == 0)
    C = 1;
  if((A+B)%3 == 0)
    C = 1;

  if(C == 1)
    printf("Possible\n");
  else
    printf("Impossible");

  return 0;
}


Measured memory_bytes: 128
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            long n = long.Parse(input);
            double rootn = Math.Sqrt(n);
            long max = 0;
            for(long i = 1; i < rootn + 1; i++)
            {
                if(n % i == 0 & i > max)
                {
                    max = i;
                }
            }

            Console.WriteLine(max + n / max - 2);
        }
    }
}


Measured memory_bytes: 13140
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		int[] counts = new int[3];
		for (char c : arr) {
			counts[c - 'a']++;
		}
		Arrays.sort(counts);
		if (counts[2] - counts[0] > 1) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}
	}
}


Measured memory_bytes: 27732
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    int x;
    cin >> x;
    if(x%100 > x/100*5) cout << "0" << endl;
    else cout << "1" << endl;
    return 0;
}

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

int main() {
  int N; 
  cin>>N;
  int x = (N-1)/111;
  cout<<(x+1)*111<<endl;
  return 0;
}

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)


typedef long double dd;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
//////////////////////////


ll SOLVE(){
    string s;cin>>s;
    rep(i,0,7){
        ll sum=s[0]-'0';
        rep(j,0,2){
            if((i>>j)&1)sum+=s[j+1]-'0';
            else sum-=s[j+1]-'0';
        }
        if(sum==7){
            cout<<s[0];
            rep(j,0,2){
                cout<<((i>>j)&1?'+':'-');
                cout<<s[j+1];
            }
            cout<<"=7";
            return 0;
        }
    }
    
    return 0;
}

int main(){fastio
    
    clock_t start = clock();
    SOLVE();
    clock_t end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    cerr<<endl<<time<<"ms"<<endl;
    
    return 0;
}



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

int main(){
  int K,S;
  cin >> K >> S;
  
  int x = 0;
  int counter;
  while(x <= K){
    int y = 0;
    while(y <= K){
      if(0 <= S-x-y && S-x-y <=K)  counter++;
      y++;
    }
    x++;
  }
  
  cout << counter << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  long long sum = 0, n, a[100000] = {0};
  scanf("%lld", &n);getchar();
  for(int i = 0; i < n; i++){
    scanf("%lld", &a[i]);getchar();
    if(i % 2 == 0){
      sum += a[i];
    }else{
      sum -= a[i];
    }
  }
  printf("%lld", sum);
  
  for(int i = 0; i < n - 1; i++){
    printf(" %lld", (a[i] - (sum / 2)) * 2);
    sum = (a[i] - (sum / 2)) * 2;
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 2048