akhauriyash/Code-Regression huggingface dataset:
package main

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

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *Io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

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

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

func main() {
	io := NewIo()
	//defer io.Flush()
	n := io.NextInt()
	q := io.NextInt()
	s := io.Next()
	l := make([]int,q)
	r := make([]int,q)
	for i:=0; i<q; i++ {
		l[i] = io.NextInt()
		r[i] = io.NextInt()
	}
	sum := make([]int,n)
	counter := 0
	i := 0
	for i<n-1 {
		if s[i] == 65 { //A
			if s[i+1] == 67 { //C
				counter ++
			}
		}
		sum[i]=counter
		i+=1
	}
	for i:=0; i<q; i++ {
		leftSum := 0
		if l[i]>1{
			leftSum = sum[l[i]-2]
		}
		rightSum := 0
		if r[i]>1{
			rightSum = sum[r[i]-2]
		}
		io.PrintLn(rightSum-leftSum)
	}
	io.Flush()
}

Measured memory_bytes: 6272
n = gets.to_i
p = gets.strip.split.map(&:to_i)
q = gets.strip.split.map(&:to_i)

a, b = 0, 0
index = 0
(1..n).to_a.permutation(n) do |one_list|
  index += 1
  a = index if one_list == p
  b = index if one_list == q
end

puts (a-b).abs

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

bool hasBomb(int i, int H, int j, int W, string cells[]) {
  if (i < 0 || H <= i) {
    return false;
  }
  if (j < 0 || W <= j) {
    return false;
  }
  if (cells[i][j] != '#') {
    return false;
  }
  return true;
}

int main() {
  int H, W;
  string cells[50];
  string results[50];
  
  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    cin >> cells[i];
    results[i] = cells[i];
  }
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (cells[i].at(j) == '#') {
        continue;
      }
      int bomb = 0;
      if (hasBomb(i - 1, H, j - 1, W, cells)) bomb++;
      if (hasBomb(i - 1, H, j, W, cells)) bomb++;
      if (hasBomb(i - 1, H, j + 1, W, cells)) bomb++;
      if (hasBomb(i, H, j - 1, W, cells)) bomb++;
      if (hasBomb(i, H, j + 1, W, cells)) bomb++;
      if (hasBomb(i + 1, H, j - 1, W, cells)) bomb++;
      if (hasBomb(i + 1, H, j, W, cells)) bomb++;
      if (hasBomb(i + 1, H, j + 1, W, cells)) bomb++;
      results[i].at(j) = bomb + 0x30;
    }
  }
  
  for (int i = 0; i < H; i++) {
    cout << results[i] << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	int a, b, d, r;
	double f, A, B;
	cin >> a >> b;
	A = a;
	B = b;
	d = a / b;
	r = a % b;
	f = A / B;
	cout << d << " " << r << " ";
	printf("%.8lf\n", f);

	return 0;
}



Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
  string s;
  cin >> s;
  s[3] = '8';
  cout << s;
    return 0;
}

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

if 400 <= x < 600:
    print('8')
elif 600 <= x < 800:
    print('7')
elif 800 <= x < 1000:
    print('6')
elif 1000 <= x < 1200:
    print('5')
elif 1200 <= x < 1400:
    print('4')
elif 1400 <= x < 1600:
    print('3')
elif 1600 <= x < 1800:
    print('2')
else:
    print('1')

Measured memory_bytes: 9180
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  double m[2][2],x[2],mi[2][2],det;
  while(cin >>m[0][0]>>m[0][1]>>x[0]>>m[1][0]>>m[1][1]>>x[1]){
    det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    mi[0][0] = m[1][1]/det;
    mi[0][1] = -m[0][1]/det;
    mi[1][0] = -m[1][0]/det;
    mi[1][1] = m[0][0]/det;
    printf("%.3lf %.3lf\n",x[0]*mi[0][0]+x[1]*mi[0][1],x[0]*mi[1][0]+x[1]*mi[1][1]);
  }
  return 0;
}

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

int main() {
  int N,L;
  cin >> N >> L;
  
  int pie_N;
  pie_N = (L + (L + N - 1)) * N / 2;

  int eat_apple = L;
  
  rep(i, N){
    int Aji = L + (i + 1) - 1;
    if(Aji == 0){
      eat_apple = 0;
      break;
    }
   
    if(abs(eat_apple) > abs(Aji)){
      eat_apple = Aji;
    }   
  }
   
  cout << pie_N - eat_apple << endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.util.Scanner;

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

        int N = sc.nextInt();

        int count = 0;
        for (int i = 105; i <= N; i += 2) {
            int numDiv = 0;
            for (int div = 1; div <= i; div++) {
                if (i % div == 0) {
                    numDiv++;
                }
            }
            if (numDiv == 8) {
                count++;
            }
        }

        System.out.println(count);
    }
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> p(n);
    for(auto &x: p)
        cin >> x;
    int ans = 0;
    for(int i = 1; i < n - 1; i++) {
        if(p[i] > p[i - 1] && p[i] < p[i + 1])
            ans++;
        if(p[i] < p[i - 1] && p[i] > p[i + 1])
            ans++;
    }
    cout << ans << endl;
}

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

int n;
class tree{
	public:
	int id,parent,left,right,depth,height;
}data[25];

void decidedep(int dep,int i){
	data[i].depth=dep;
	if(data[i].left!=-1)	decidedep(dep+1,data[i].left);
	if(data[i].right!=-1)	decidedep(dep+1,data[i].right);
}

void decidehei(int hei,int i){
	data[i].height=max(hei,data[i].height);
	if(data[i].parent!=-1)	decidehei(hei+1,data[i].parent);
}

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		data[i].parent=-1;
		data[i].left=-1;
		data[i].right=-1;
		data[i].height=0;
	}
	int no,le,ri;
	for(int i=0;i<n;i++){
		cin>>no>>le>>ri;
		data[no].id=no;
		data[no].left=le;
		data[no].right=ri;
		if(le!=-1)	data[le].parent=no;
		if(ri!=-1)	data[ri].parent=no;
	}
	for(int i=0;i<n;i++){
		if(data[i].parent==-1)	decidedep(0,i);
		if(data[i].left==-1&&data[i].right==-1)	decidehei(0,i);
	}
	
	for(int i=0;i<n;i++){
		cout<<"node "<<data[i].id<<": parent = "<<data[i].parent;
		if(data[i].parent!=-1){
			if(data[data[i].parent].left==data[i].id){
				cout<<", sibling = "<<data[data[i].parent].right;
			}
			else{
				cout<<", sibling = "<<data[data[i].parent].left;
			}
		}
		else cout<<", sibling = -1";
		int degree=0;
		if(data[i].left!=-1)	degree++;
		if(data[i].right!=-1)	degree++;
		cout<<", degree = "<<degree;
		cout<<", depth = "<<data[i].depth<<", height = "<<data[i].height;
		if(data[i].parent==-1)	cout<<", root"<<endl;
		else if(data[i].left==-1&&data[i].right==-1)	cout<<", leaf"<<endl;
		else 	cout<<", internal node"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1164
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))


INF=10**20
def main():
    N,K=mi()
    MOD = 10**9+7

    ans = 0
    dic = {} 
    for x in range(K,0,-1):  # gcd = x となるA1~AN(<=K)を探す
        p_count = K//x
        count = pow(p_count,N,MOD)

        i = 2
        while x*i <= K:
            if not x*i in dic: break
            count -= dic[x*i]
            count %= MOD
            i += 1

        count %= MOD
        dic[x] = count
        
        ans += count * x
        ans %= MOD
        # print(x,count)
    
    print(ans)








if __name__ == "__main__":
    main()

Measured memory_bytes: 85648
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <tuple>
#include <stack>
#include <bitset>

#define MAX_N 100010
#define INF   1000000000
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
deque<char> deq;

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

    string S; cin >> S;
    ll Q;     cin >> Q;
    for(ll i = 0; i < S.size(); i++) deq.push_back(S[i]);

    ll T, F;
    char C;

    ll rev = 1;
    for(ll i = 0; i < Q; i++) {
      cin >> T;
      if(T == 1) rev = -rev;
      else {
	cin >> F >> C;
	if(rev == 1) {
	  if(F == 1) deq.push_front(C);
	  if(F == 2) deq.push_back(C);
	}
	else {
	  if(F == 1) deq.push_back(C);
	  if(F == 2) deq.push_front(C);
	}
      }
    }

    ll N = deq.size();
    for(ll i = 0; i < N; i++) {
      if(rev == 1) {
	cout << deq.front();
	deq.pop_front();
      }
      else {
	cout << deq.back();
	deq.pop_back();
      }
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 960
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(n);i++)

int main(){
	int n,m,d,k;
	int dist[100001];
	while(cin>>d&&d){
		int ans=0;
		cin>>n>>m;
		rep(i,n-1){
			cin>>dist[i+1];
		}
		sort(dist+1,dist+n);
		dist[0] = 0;
		dist[n] = d;
		while(m--){
			cin>>k;
			int i = upper_bound(dist,dist+n+1,k)-dist;
			ans += min(dist[i]-k, k-dist[i-1]);
		}
		cout<<ans<<endl;
	}
	return 0;
}

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

using namespace std;

#define INF (1ll << 62)
#define pb push_back
#define ii pair<int,int>
#define OK cerr <<"OK"<< endl
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define endl '\n'

char mat[2000][2000];
int dp[2000][2000];

int n, m;

int mod(int n) {
	return n % 1000000007;
}

int valid(int x, int y) {
	return (1 <= x && x <= n && 1 <= y && y <= m && mat[x][y] == '.');
}

int f(int x, int y) {

	if(!valid(x, y))
		return 0;


	if(ii(x, y) == ii(n, m))
		return 1;

	if(dp[x][y] != -1)
		return dp[x][y];

	return dp[x][y] = mod(f(x + 1, y) + f(x, y + 1));
}

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

  cin >> n >> m;

  memset(dp, -1, sizeof(dp));

  for(int i = 1; i <= n; i++)
  	for(int j = 1; j <= m; j++)
  		cin >> mat[i][j];

  cout << f(1, 1) << endl;

}

Measured memory_bytes: 35200
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("board.in");ofstream out("board.out");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); //uid u1(5, 10); u1(rnd);

int main() {
    fast;
    int a,b; cin>>a>>b;
    cout<<(a*3+b)/2<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main () {
  ll n, w; cin>>n>>w;
  ll dp[n+1][w+1];
  memset (dp, 0, sizeof dp);
  for (ll i=1;i<=n;++i) {
    ll wei, val; cin>>wei>>val;
    for (ll j=1;j<=w;++j) {
      if (j<wei) dp[i][j]=dp[i-1][j];
      else dp[i][j]=max(dp[i-1][j], val+dp[i-1][j-wei]);
    }
  }
  cout<<dp[n][w];
  return 0;
}

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

	typedef pair<int, int> P;
	P a[202];

	int main(){
		int N, n, d;
while(1){

		cin >> N;
		if(N == 0) break;
		//cin >> n >> d;
		a[0] = P(0, 0);
		
		for(int i=1; i<N; i++){
			int nx, ny;
			cin >> n >> d;
			nx = a[n].first;
			ny = a[n].second;
			
			if(d == 0) nx--;
			else if(d == 1) ny--;
			else if(d == 2) nx++;
			else if(d == 3) ny++;
			
			a[i] = P(nx, ny);
		}
		
		int xmi = 99999;
		int ymi = 99999;
		int xma = -99999;
		int yma = -99999;
		
		for(int i=0; i<N; i++){
			int x ,y;
			x = a[i].first;
			y = a[i].second;
			
			xmi = min(xmi, x);
			ymi = min(ymi, y);
			xma = max(xma, x);
			yma = max(yma, y);
		}
		if(N == 1) cout << 1 << " " << 1 << endl;
		else cout << abs(xmi - xma) + 1 << " " << abs(ymi - yma) + 1 << endl;
		
}//end	
}


Measured memory_bytes: 3044
n = list(input())
l = sorted(list(map(int,input().split())))
count = 0

import bisect
for i in range(len(l)):
    for j in range(i+1,len(l)):
        end = bisect.bisect_left(l,l[i]+l[j])
        start = j
        count += end - start -1
print(count)
        


Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;
typedef long long int ll;

int main()
{
    int n,k,x;
    int i;
    int sum;

    while(scanf("%d%d",&n,&k) != EOF)
    {
        int ans = (k+1)/2;
        sum = 0;
        for(i = 0;i < n;i++)
        {
            scanf("%d",&x);
            if(x > ans) sum += (k-x)*2;
            else sum += x*2;
        }
        printf("%d\n",sum);
    }

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
class abc128a{
  static void Main(){
    var IN = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    var A = IN[0];
    var P = IN[1];
    
    var piece = A * 3 + P;
    var result = piece / 2;
    
    Console.WriteLine(result);
    
    return;
    
  }
}

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

const ll INF = 1LL << 60;
const int MOD = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, b, e) for (int i = (b); i <= (e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

const int A = 0, C = 1, G = 2, T = 3;
ll dp[105][4][4][4];

// NGパターンは 'AGC'
bool ng(int x, int y, int z) {
    return x == A && y == G && z == C;
}

ll add_mod(ll a, ll b) {
    return (a + b) % MOD;
}

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

    dp[0][3][3][3] = 1;
    REP(i, N) REP(a, 4) REP(b, 4) REP(c, 4) REP(d, 4) {
        // AGC, ACG, GAC
        if (ng(b, c, d) || ng(b, d, c) || ng(c, b, d)) continue;

        // A*GC, AG*C
        if (ng(a, c, d) || ng(a, b, d)) continue;

        dp[i+1][b][c][d] = add_mod(dp[i+1][b][c][d], dp[i][a][b][c]);
    }

    ll ans = 0;
    REP(a, 4) REP(b, 4) REP(c, 4) {
        ans = add_mod(ans, dp[N][a][b][c]);
    }
    cout << ans << endl;

    return 0;
}


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

int main() {
  char a,b; cin >> a >> b;
  if(a<b){
    cout << "<";
  }
  else if(a>b){
    cout << ">";
  }
  else{
    cout << "=";
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <atcoder/lazysegtree>
#include <atcoder/modint>

using namespace std;

using ll = long long int;
using modint = atcoder::modint998244353;

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N, Q;
struct q {int l,r,d;};
vector<q> Qs;
void input(){
    fast_io();
    cin >> N >> Q;
    Qs.resize(Q);
    for (int i = 0; i < Q; i++)
    {
        int l,r,d; cin >> l >> r >> d;
        l--, r--;
        Qs[i] = q{l,r,d};
    }
}

vector<modint> pow_10;
struct S{
    modint x; int sz;
    // S(modint _x, int _sz):x(_x), sz(_sz){};
};
S op(S x, S y){return S{x.x*pow_10[y.sz] + y.x, x.sz + y.sz};}
S e(){return S{0, 0};}
// struct F{ int a;};
using F = int;
S mapping(F f, S x){
    if(f!=0) return S{(pow_10[x.sz]-1)/modint(9)*f, x.sz};
    return x;
}
F composition(F f, F g){
    if(f!=0) return f;
    return g;
}
F id(){return 0;}

int solve(){
    pow_10.resize(N);
    pow_10[0] = 1;
    for (int i = 0; i < N; i++)
    {
        pow_10[i+1] = pow_10[i]*10;
    }
    

    vector<S> Init(N);
    for (int j = 0; j < N; j++) Init[j] = S{1, 1};    
    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(Init);
    vector<modint> Ans;
    for (int i = 0; i < Q; i++)
    {
        int l,r,d;
        l = Qs[i].l;
        r = Qs[i].r;
        d = Qs[i].d;
        seg.apply(l, r + 1, d);
        modint ans = seg.all_prod().x;
        Ans.push_back(ans);
    }
    for(auto ans:Ans) cout << ans.val() << "\n";
    return 0;
}

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

Measured memory_bytes: 14108
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<utility>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
#include<string>
#include<cctype>
#include<cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef queue<int> qi;
typedef queue<ll> ql;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define pq priority_queue
#define rep(i,n) for (int i=0;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define INF 200000009
#define init(x) memset(x,0,sizeof(x))
int x; 
int main()
{
    ios::sync_with_stdio(false);
    cin>>x;
    cout<<48-x;
    return 0; 
}

Measured memory_bytes: 256
program prob
    implicit none
    integer(8) :: n, ans, i
    integer(8), allocatable :: a(:)
    read(*,*) n
    allocate(a(n))
    read(*,*) a
    ans = 0
    do i = 1, n
        ans = ans + a(i)
    end do
    ans = ans - n
    write(*,*) ans

    stop
contains
end program prob

Measured memory_bytes: 2892
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <queue>
#define REP(i,n) for(int i=0; i<(int)(n); i++)
 
#include <cstdio>
#include <set>
 
inline int getInt(){ int s; scanf("%d", &s); return s; }
 
using namespace std;
 
int main(){
  const int n = getInt();
  vector<string> s(n);
  vector<int> p(n);
  REP(i,n) cin >> s[i];
 
  srand('s' + 'h' + 'a' + 'l' + 'o' + 'k' + 'a' + 'w' + 'a' + 'i' + 'i');
  REP(i,1000){
    if(i < 500){
      const int next = (rand() % n) + 1;
      printf("%d\n", next); fflush(stdout);
      const int ai = getInt();
      const char c = s[next - 1][ai - 1];
      if(c == 'o') p[next - 1] += 3;
      if(c == '-') p[next - 1] += 1;
    }else{
      const int next = max_element(p.begin(), p.end()) - p.begin() + 1;
      printf("%d\n", next); fflush(stdout);
      const int ai = getInt();
      const char c = s[next - 1][ai - 1];
      if(c == 'o') p[next - 1] += 3;
      if(c == '-') p[next - 1] += 1;
    }
  }
 
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  ll X, K, D; cin >> X >> K >> D;
  if (X < 0) X = -X;
  if (X/D >= K) cout << X - K*D << endl;
  else {
    ll temp = X%D;
    ll remain = K - X/D;
    if (remain % 2 == 0) cout << temp << endl;
    else cout << -(temp - D) << endl;
  }

  return 0;
}

Measured memory_bytes: 3188
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <iterator>
#include <algorithm>
#include <map>
#include <string.h>
#include <vector>
#include <cmath>
#include <deque>
#include <iomanip>

using namespace std;
#define range(a) a.begin(), a.end()
#define rep(i, c) for(int i = 0; i < (int)c; i++)
typedef long long ll;

template <typename T> ostream& operator<<(ostream& out, vector<T> &v){
  for (int i = 0; i < (int)v.size(); i++) {
    out<<v[i]<<' ';
  }
  return out;
}

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

  // float n; cin >> n;
  // 
  // cout << n * 2 * 3.141592653589 << endl;

  int n, m; cin >> n >> m;
  vector<int> a(m);
  int sum = 0;
  rep(i, m){
    cin >> a[i];
    sum += a[i];
  }
  if(sum == n) cout << 0 << endl;
  else if (sum < n) cout << n - sum << endl;
  else cout << -1 << endl;








  return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char s[11];
int main()
{
	scanf("%s",s);
	if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I')cout<<"Yes";
	else cout<<"No";
	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int n;
vector<pair<int, ll> > g[100010];
vector<ll> d;

void dfs(int v, int p, ll dist) {
    d[v] = dist;
    rep (j, g[v].size()) {
        if (g[v][j].first == p) continue;
        dfs(g[v][j].first, v, dist + g[v][j].second);
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> n;
    d.resize(n);
    rep (i, n - 1) {
        int a, b;
        ll c;
        cin >> a >> b >> c;
        a--, b--;
        g[a].push_back(make_pair(b, c));
        g[b].push_back(make_pair(a, c));
    }
    int q, k;
    cin >> q >> k;
    k--;
    dfs(k, -1, 0);
    rep (i, q) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        cout << d[x] + d[y] << endl;
    }
    
    return 0;
}



Measured memory_bytes: 17408
#include<cstdio>
int main(){
    char s[17],t[17]="CODEFESTIVAL2016";
    scanf("%s",s);
    int answer=0;
    for(int i=0;i<16;i++){
        if(s[i]!=t[i])answer++;
    }
    printf("%d",answer);
    return 0;
}

Measured memory_bytes: 128
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        m: usize,
        ab: [[i64; 2]; n],
        cd: [[i64; 2]; m],
    }

    let inf = 50000_0000 + 5;
    let mut ans = inf;
    let mut check: Vec<i64> = vec![0;2];
    let mut point = 0;
    for i in 0..n {
        for j in 0..m {
            if ans > (ab[i][0]-cd[j][0]).abs()+(ab[i][1]-cd[j][1]).abs() {
                check[0] = cd[j][0];
                check[1] = cd[j][1];
                ans = (ab[i][0]-check[0]).abs()+(ab[i][1]-check[1]).abs();
                point = j;
            }
        }
        println!("{}", point+1);
        ans = inf;        
        point = 0;
    }

}


Measured memory_bytes: 2196
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)
#define all(v) v.begin(), v.end()
#define rall(x) (x).rbegin(), (x).rend()
#define pll pair<long long, long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vc vector<char>
#define vvc vector<vc>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
template <class T>bool chmax(T &a, const T &b){if (a < b){a = b;return 1;}return 0;}
template <class T>bool chmin(T &a, const T &b){if (b < a){a = b;return 1;}return 0;}
//snippets:tmp,cl,cvl,cs,co,coy,con,cov,setp

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll x;
    cin >> x;
    cout<<10-x/200<<endl;
}

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

using namespace std;

bool isPalindrome(string s) {
  string origin = s;
  reverse(s.begin(), s.end());
  if (origin == s) return true;
  else return false;
}

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

  int ans = 0;
  for (int i = A; i <= B; ++i) {
    if (isPalindrome(to_string(i))) {
      ans++;
    }
  }

  cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  while(1)
  {
    c-=b;
    if(c<=0)
    {
      cout<<"Yes";
      break;
    } 
    a-=d;
    if(a<=0)
    {
      cout<<"No";
      break;
    }
  } 
} 

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  auto f = [](i64 x, int k) {
    while (k) x /= 10, k--;
    return x % 10;
  };
  auto g = [](i64 x) {
    int ret = 0;
    while (x) x /= 10, ret++;
    return ret;
  };
  int k;
  cin >> k;
  i64 now = 1;
  rep(_, k - 1) {
    bool all = true;
    rep(i, g(now)) if (f(now, i) != 9) all = false;
    if (all) {
      now++;
      continue;
    }
    int idx = g(now) - 1;
    rep(i, g(now) - 1) {
      if (f(now, i) == 9 && f(now, i + 1) == 9) {
        continue;
      }
      if (f(now, i) == f(now, i + 1) + 1) {
        continue;
      }
      idx = i;
      break;
    }
    now += exp((i64) 10, idx);
    rrep(i, idx) {
      int v = f(now, i + 1);
      if (v > 0) v--;
      int x = f(now, i);
      now -= exp((i64) 10, i) * x;
      now += exp((i64) 10, i) * v;
    }
  }
  cout << now << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define P 1000000007
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;

void solve() {
	ll n;
	cin >> n;
	string sol = "";
	ll p = 1;
	int len = 0;
	while(p <= n) {
		n -= p;
		p *= 26;
		len++;
	}
	
	for(int i = 0; i < len; i++) {
		sol += (char) (n % 26 + 'a');
		n /= 26;
	}
	
	reverse(all(sol));
	cout << sol << endl;
}

int main(){
#define MULTITEST 0
#if MULTITEST   
 
    CASET {
        solve();
    }
    
#else

    solve();
    
#endif

    return 0;
}

Measured memory_bytes: 3640
// practice with Dukkha
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
	long long k; cin >> k;
	int n = 50;
	int r = k % n;
	cout << n << '\n';
	for (int i = 0; i < r; i++)
		cout << n - 1 + 1 + k / n << ' ';
	for (int i = r; i < n; i++)
		cout << n - 1 - r + k / n << ' ';
	cout << '\n';
	return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  set<int> factorSet(int x) {
    set<int> res;
    while (x != 1) {
      res.insert(f[x]);
      x /= f[x];
    }
    return res;
  }
};

const int A=1000005;
Sieve s(A);
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  bool pc = true;
  vector<bool> used(A);
  rep(i,n){
    auto ss = s.factorSet(a[i]);
    for(int ssi:ss){
      if(used[ssi]){
        pc=false;
        break;
      }
      used[ssi]=true;
    }
    if(!pc) break;
  }
  if(pc){
    cout << "pairwise coprime" << endl;
    return 0;
  }
  int g = a[0];
  rep(i,n) g = gcd(g,a[i]);
  if(g==1){
    cout << "setwise coprime" << endl;
  }else{
    cout << "not coprime" << endl;
  }

}


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

using namespace std;

const int N = 1e6 + 5;
const int mod = 1e9 + 7;

long long fac[N], inv[N];

long long C(int n, int k) {
  if (k > n) return 0;
  return (((fac[n] * inv[k]) % mod) * inv[n-k]) % mod;
}
long long powmod(long long b, long long p) {
  long long ret = 1;
  while (p) {
    if (p & 1)
      ret = (ret * b) % mod;
    b = (b * b) % mod;
    p >>= 1;
  }
  return ret;
}

int main() {
  fac[0] = inv[0] = 1;
  for (int i = 1; i < N; i++) {
    fac[i] = (fac[i-1] * i) % mod;
    inv[i] = powmod(fac[i], mod - 2);
  }
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  long long ans = 0;
  long long cur = 1;
  for (int i = 0; i <= m + k; i++) {
    ans = (ans + (((C(n - 1 + i, i) * cur) % mod) * powmod(3, m + k - i)) % mod) % mod;
    cur = (cur * 2) % mod;
    if (i >= m)
      cur = (cur + mod - C(i, m)) % mod;
    if (i >= k)
      cur = (cur + mod - C(i, k)) % mod;
  }
  if (ans < 0)
    ans += mod;
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 15872
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            String a = in.next();
            String b = in.next();
            int value = Integer.parseInt(a + b);
            for (int n = 1; n < value; n++) {
                if (n * n == value) {
                    System.out.println("Yes");
                    return;
                }
            }
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21844
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int w,h,d,x,y,vx,vy;
  string s;
  while(cin>>w>>h&&w+h){
    x=y=1;
    vx=0;
    vy=1;
    while(cin>>s&&s!="STOP"){
      if(0){
      }else if(s=="RIGHT"){
	if(vx){
	  if(vx==1){
	    vx=0;
	    vy=-1;
	  }else{
	    vx=0;
	    vy=1;
	  }
	}else{
	  if(vy==1){
	    vx=1;
	    vy=0;
	  }else{
	    vx=-1;
	    vy=0;
	  }
	}
      }else if(s=="LEFT"){
	if(vx){
	  if(vx==1){
	    vx=0;
	    vy=1;
	  }else{
	    vx=0;
	    vy=-1;
	  }
	}else{
	  if(vy==1){
	    vx=-1;
	    vy=0;
	  }else{
	    vx=1;
	    vy=0;
	  }
	}
      }else if(s=="FORWARD"){
	cin>>d;
	x+=vx*d;
	y+=vy*d;
	if(x<1)
	  x=1;
	if(y<1)
	  y=1;
	if(x>w)
	  x=w;
	if(y>h)
	  y=h;
      }else if(s=="BACKWARD"){
	cin>>d;
	x-=vx*d;
	y-=vy*d;
	if(x<1)
	  x=1;
	if(y<1)
	  y=1;
	if(x>w)
	  x=w;
	if(y>h)
	  y=h;
      }
    }
    cout<<x<<" "<<y<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
// 

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

int main(){
  int n;
  int data[9] = {111, 222, 333, 444, 555, 666, 777, 888, 999};
  cin >> n;
  for(int i = 0; i < 9; i++){
    if(data[i] >= n){
      cout << data[i] << endl;
      break;
    }
  }
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  set<int> S;
  for (int i = 1; i < 10; ++i) for (int j = 1; j < 10; ++j) S.insert(i * j);
  
  if (S.count(N)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> ii;
typedef map<int, int> MPII;
typedef set<int> SETI;

const int mxN = 2e5;
const ld pi = 4.0 * atanl(1.0);
const int iinf = 1e9 + 10;
const int inf = 1e18 + iinf + 10;
const int mod = 1000000007;
const ld prec = .000001;

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(c) c.begin(), c.end()
#define rall(c) c.end(), c.begin()

int n, m, t, a[mxN];
vi v;

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

int main() {
  fast();
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a, a + n);
  int ans = 0;
  for (int i = 0; i < n; ++i)
    ans +=
        min(abs(0 - a[i]), abs(k - a[i])) + min(abs(0 - a[i]), abs(k - a[i]));
  cout << ans;

  return 0;
}



Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <iomanip> 
#include <cstring>
#include <queue>
#include <stack> 
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
int check(int x){
	while(x){
		if(x % 10 == 7){
			return 1;
		}
		x/=10;
	}
	return 0;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	if(check(n)){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
	int a,b,c,x,ans=0;cin>>a>>b>>c>>x;
	for(int i=0;i<=a;i++){
		for(int j=0;j<=b;j++){
			for(int k=0;k<=c;k++){
				ans+= (i*500 + j*100 + k*50) == x;
			}
		}
	}
	cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int _gcd(int x,int y)
{
    return y?_gcd(y,x%y):x;
}
int extend_gcd(int a,int b,int &x,int &y)
{
    if(!b)
    {
        x=1;
        y=0;
        return a;
    }
    int ans=extend_gcd(b,a%b,x,y);
    int tmp=x;
    x=y;
    y=tmp-(a/b)*y;
    return ans;
}
void cal(int a,int b,int c)
{
    int x,y;
    int g=extend_gcd(a,b,x,y);
    b/=g;
    a/=g;
    printf("%d %d\n",x,y);
}
int main()
{
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        int c=_gcd(a,b);
        cal(a,b,c);
    }
    return 0;
}


Measured memory_bytes: 3220
#include<iostream>
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define ll long long int
#define  ull unsigned long long int
const  int MAX=1e5+9;
const  int MAX1=1e6+9;
const  double pi = acos(-1);
const  int inf =1e9;
const  long long  mod = 1e9+7;
bool prime[MAX];
int pfactors[MAX];
ll fact[MAX];
ll ifact[MAX];
ll mexp(ll a,ll b){ll res=1;while(b>0){if(b%2){res=(res*a);}a=(a*a);b=b/2;}return res;}
vector<int> totient(){
  long long tt[MAX];
    for(int i=1;i<MAX;i++) tt[i]=i;
    for(int i=2;i<MAX;i++){ if(tt[i]==i){for(int j=i;j<MAX;j+=i){  tt[j]/=i; tt[j]*=i-1;}}}
    vector<int>v;
    for(int i=1;i<MAX;i++)v.push_back(tt[i]);
    return v;
}
vector<int> seive(){
    for(int i=2;i<MAX;i++)prime[i]=false;
    int k=0;
  vector<int>p;
    for(int i =2;i<MAX;i++){if(!prime[i]){  for(int j=2*i;j<MAX;j+=i)  prime[j]=true;}}
      for(int i=2;i<MAX;i++){if(!prime[i])    p.push_back(i);}return p;} 
  int a[90];
int n;
set<int> v={1, 4, 9, 16 ,25 ,36 ,49 , 64 , 81};
int check(int a ,int b){
  int mask=(1<<10);
  vector<int>res;
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      if(a&(1<<i)){
        if(b&(1<<j)){
        int p=i*10+j;
        int q=j*10+i;
        if(v.find(p)!=v.end()){
          res.push_back(p);
        }
        if(v.find(q)!=v.end()){
          res.push_back(q);
        }
      }

      }
    }
  }
 // cout<<res.size()<<"\n";
  res.erase(unique(res.begin(),res.end()),res.end());
  if(res.size()==9)
    return 1;
  else
    return 0;

}
bool check(int a, int b ,int c)
{
  return a==b&&a==c;
}
int main(){
   // ios_base::sync_with_stdio(false); 
   // cin.tie(NULL);    
  //freopen ("in.txt","r",stdin);
 // freopen ("out..txt","w",stdout);
  int a, b,c;
  cin>>a>>b>>c;
  if(check(a, b, c))
    cout<<"Yes";
  else
    cout<<"No";
}

Measured memory_bytes: 256
//#include "debug.h"
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

#define MAXN 200
typedef long long i64;

int n, k;
char s[MAXN];

int input() {
	if (scanf("%s %d", s, &k) < 0) return 0;
	n = strlen(s);
	return 1;
}

void init() {
}

long solve() {
	long start = 0, end = 0;
	long r = 0;
	for (int i=0, j; i<n; i=j) {
		for(j=i+1; j<n && s[j]==s[i]; j++);
		long len = j - i;
		if (i==0) start = len;
		if (j==n) {
			if (i==0) return long(n)*k/2;
			end = len;
			if (s[n-1]==s[0]) {
				r += (start+end)/2*(k-1);
				r -= start/2 * k;
				r += start/2 + end/2;
				return r;
			}
		}
		r += len/2 * k;
	}
	return r;
}

void output(long ans) {
	printf("%ld\n", ans);
}

void cleanup() {
}

int main() {
	//precalc();
	//int ca; scanf("%d", &ca);
	while (input()) {
		init();
		output(solve());
		cleanup();
	}
}




Measured memory_bytes: 128
#include<iostream>
using namespace std;
void daysel(int x){
  switch(x % 7){
  case 6:
  cout << "Tuesday"<<endl; break;
  case 0:
  cout <<"Wednesday"<<endl;  break;
  case 1:
  cout <<"Thursday"<<endl;  break;
  case 2:
  cout <<"Friday"<<endl;  break;
  case 3:
  cout <<"Saturday"<<endl;  break;
  case 4:
  cout <<"Sunday"<<endl;  break;
  case 5:
  cout <<"Monday"<<endl;  break;
  }
}
void daycal(int month,int day){
  int x;
  switch(month){
  case 1:
  x = day; break;
  case 2:
  x = 31 + day; break;
  case 3:
  x = 60 + day; break;
  case 4:
  x = 91 + day; break;
  case 5:
  x = 121 + day; break;
  case 6:
  x = 152 + day; break;
  case 7:
  x = 182 + day; break;
  case 8:
  x = 213 + day; break;
  case 9: 
  x = 244 + day;break;
  case 10:
  x = 274 + day;break;
  case 11: 
  x = 305 + day; break;
  case 12:
    x = 335 + day; break;
  }
  daysel(x);

    }
int main(){
  int month,day;
  while(cin >> month >> day && !(month == 0 && day ==0)){   
      daycal(month,day);
  }  
  
}
      

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int n;
   cin>>n;
   int a[n];
   int k;
   cin>>k;
   for(int i=0;i<n;i++)
   {
    cin>>a[i];
   }

   long long dp[n+1];
   for(int i=0;i<n;i++){
    dp[i]=1000000001;
   }

dp[0]=0;
for(int i=0;i<n-1;i++){
    for(int j=1;i+j<n&&j<=k;j++){
    dp[i+j]=min(dp[i+j],dp[i]+abs(a[i]-a[i+j]));
    }

}
cout<<dp[n-1];

    return 0;
}

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

typedef long long ll;
const int maxn = 2E+5 + 5;
const ll mod = 1E+9 + 7;

int n;
ll siz[maxn], fa[maxn], dp[maxn], ans[maxn];
ll fac[maxn], inv[maxn];
vector<int> to[maxn];

ll qPow(ll a, ll b)
{
	a %= mod;
	
	ll res = 1;
	while(b) {
		if(b & 1) res = res * a % mod;
		a = a * a % mod, b >>= 1;
	}
	return res;
}

void DFS(int u, int father)
{
	fa[u] = father, siz[u] = 1, dp[u] = 1;
	for(int i = 0; i < to[u].size(); ++i) {
		int v = to[u][i];
		
		if(v == father) continue;
		
		DFS(v, u), siz[u] += siz[v], dp[u] = dp[u] * dp[v] % mod * qPow(siz[v], mod - 2) % mod;
	}
}

void Work(int u, ll tmp)
{
	for(int i = 0; i < to[u].size(); ++i) {
		int v = to[u][i];
		
		if(v == fa[u]) continue;
		
		Work(v, tmp * dp[u] % mod * qPow((n - siz[v]) * dp[v], mod - 2) % mod * siz[v] % mod);
	}
	ans[u] = tmp * dp[u] % mod * fac[n - 1] % mod;
}

int main()
{
	int N = 2E+5;
	
	fac[0] = 1;
	for(int i = 1; i <= N; ++i)
		fac[i] = fac[i - 1] * i % mod;
	inv[N] = qPow(fac[N], mod - 2);
	for(int i = N; i >= 1; --i)
		inv[i - 1] = inv[i] * i % mod;
	
	scanf("%d", &n);
	for(int i = 1; i < n; ++i) {
		int x, y;
		
		scanf("%d%d", &x, &y);
		to[x].push_back(y), to[y].push_back(x);
	}
	
	DFS(1, 0), ans[1] = dp[1] * fac[n - 1] % mod;
	for(int i = 0; i < to[1].size(); ++i) {
		int v = to[1][i];
		
		Work(v, dp[1] * qPow((n - siz[v]) * dp[v], mod - 2) % mod * siz[v] % mod);
	}
	
	for(int i = 1; i <= n; ++i)
		printf("%lld\n", ans[i]);
}

Measured memory_bytes: 23284
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
      	int y = scn.nextInt();
      	int k = -1;
      	int k5 = -1;
      	int k10 = -1;
      	int num = 0;
      	for(int i=0; i<=n; i++){
          for(int j=0; j<=n-i; j++){
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          }
        }
      	System.out.println(k10 + " " + k5 + " " + k);
	}
}


Measured memory_bytes: 39552
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps=1e-8;
int main() {
	int n, d, x; cin >> n >> d >> x;
	int sto[10][10];
	rep(i, d) {
		rep(j, n) {
			cin >> sto[i][j];
		}
	}
	int dp[11];
	dp[0] = x;
	Rep(i,1, d) {
		int ma = dp[i - 1];
		per(j, i) {
			int minidp[100001];
			fill(minidp, minidp + 100001, -1);
			minidp[0] = 0;
			rep(k, n) {
				if (sto[i][k] - sto[j][k] <= 0)continue;
				rep(l, dp[j]+1) {
					if (minidp[l] != -1&&l + sto[j][k] <= dp[j]) {
						minidp[l + sto[j][k]] = max(minidp[l + sto[j][k]], minidp[l] + sto[i][k]);
					}
				}
			}
			int subma = dp[j];
			rep(k, dp[j] + 1) {
				subma = max(subma, dp[j]+minidp[k] - k);
			}
			ma = max(ma, subma);
		}
		dp[i] = ma;
	}
	cout << dp[d - 1] << endl;
	return 0;
}


Measured memory_bytes: 3504
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main()
{
    int N;
    string s;
    cin >> N >> s;
    int rp = 0;
    int lp = 0;
    for(int i = 0; i < N; ++i){
        if(s[i] == ')'){
            if(lp>0){
                lp--;
                continue;
            }
            rp++;
        }else{
            lp++;
        }
    }

    s.insert(s.begin(),rp,'(');
    s.insert(s.end(),lp,')');
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
from collections import deque

N = int(input())

Q = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])

for i in range(N - 1):
    x = Q.popleft()
    if x % 10 != 0:
        y = 10 * x + x % 10 - 1
        Q.append(y)
    
    y = 10 * x + x % 10
    Q.append(y)

    if x % 10 != 9:
        y = 10 * x + x % 10 + 1
        Q.append(y)

ans = Q.popleft()

print(ans)

Measured memory_bytes: 18772