akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.util.Scanner;

/**
 * Created on 2017/09/29 7:16.
 */
public class Main {
    private static boolean isStrong(int a1, int b1, int a2, int b2) {
        int p1 = 100 * b1;
        int q1 = a1 + b1;
        int p2 = 100 * b2;
        int q2 = a2 + b2;

        return q1 != 0 && (q2 == 0 || p1 * q2 > p2 * q1);

    }

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

        int A = sc.nextInt() * 100;
        int B = sc.nextInt() * 100;
        int C = sc.nextInt();
        int D = sc.nextInt();
        int E = sc.nextInt();
        int F = sc.nextInt();

        int ansA = 0;
        int ansB = 0;

        for (int a = 0; a * A <= F; a++) {
            for (int b = 0; a * A + b * B <= F; b++) {
                int wa = a * A + b * B;
                int limit = Math.min(wa / 100 * E, F - wa);
                for (int c = 0; c * C <= limit; c++) {
                    for (int d = 0; c * C + d * D <= limit; d++) {
                        int wb = c * C + d * D;
                        if (isStrong(wa, wb, ansA, ansB)) {
                            ansA = wa;
                            ansB = wb;
                        }
                    }
                }
            }
        }
        System.out.println((ansA + ansB) + " " + ansB);
    }
}

Measured memory_bytes: 21972
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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; }

#define keta setprecision(10) //10桁表示


int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll m;
	cin >> m;
	vector <ll> d(m), c(m);
	rep(i, m)
	{
		cin >> d[i] >> c[i];
	}
	ll sum = 0;
	ll ke = 0;
	ll keSu = 0;

	rep(i, m)
	{
		keSu += c[i];
	}
	for(int i=0;i<m;i++)
	{
		sum += d[i]*c[i];
	}
	//ll tmp = sum;
	//ll sumketa = 0;
	//while (tmp>=10)
	//{
	//	tmp /= 10;
	//	sumketa++;
	//}
	//for (ll i = 1; i <= sumketa; i++)
	//{
	//	ke += sum / pow(10LL, i);
	//	sum += sum / pow(10LL, i);
	//	sum %= (ll)pow(10LL, i);

	//}
	ke = sum / 9LL;
	if (sum % 9LL == 0)
	{
		ke -= 1;
	}

	cout << keSu-1+ke << endl;


	return 0;
}

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

int main() {
  int a, b;
  char op;
  cin >> a >> op >> b;
  if (op == '+') {
    cout << a + b << endl;
    return 0;
  }
  cout << a - b << endl;
  return 0;
}

Measured memory_bytes: 3632
#define PROBLEM "https://judge.yosupo.jp/problem/dominatortree"

#include<bits/stdc++.h>
using namespace std;

#define call_from_test
#ifndef call_from_test
#include<bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;
//END CUT HERE
#ifndef call_from_test
signed main(){
  return 0;
}
#endif

#ifndef call_from_test
#include<bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
struct DominatorTree{
  struct UnionFind{
    vector<int> &semi;
    vector<int> ps,ms;
    UnionFind(vector<int> &semi):
      semi(semi),ps(semi.size()),ms(semi.size()){
      iota(ps.begin(),ps.end(),0);
      iota(ms.begin(),ms.end(),0);
    }
    int find(int v){
      if(ps[v]==v) return v;
      int r=find(ps[v]);
      if(semi[ms[v]]>semi[ms[ps[v]]]) ms[v]=ms[ps[v]];
      return ps[v]=r;
    }
    int eval(int v){
      find(v);
      return ms[v];
    }
    void link(int p,int v){ps[v]=p;}
  };

  vector< vector<int> > G,R;
  vector<int> ord,par,idom,semi;
  DominatorTree(int n):
    G(n),R(n),par(n),idom(n,-1),semi(n,-1){
    ord.reserve(n);
  }

  void add_edge(int u,int v){
    G[u].emplace_back(v);
    R[v].emplace_back(u);
  }

  void dfs(int v){
    semi[v]=ord.size();
    ord.emplace_back(v);
    for(int u:G[v]){
      if(~semi[u]) continue;
      par[u]=v;
      dfs(u);
    }
  }

  void build(int rt){
    int n=G.size();
    dfs(rt);

    vector< vector<int> > bkt(n);
    UnionFind uf(semi);
    vector<int> us(n);

    for(int i=(int)ord.size()-1;i>=0;i--){
      int v=ord[i];
      for(int u:R[v]){
        if(semi[u]<0) continue;
        u=uf.eval(u);
        if(semi[v]>semi[u]) semi[v]=semi[u];
      }
      bkt[ord[semi[v]]].emplace_back(v);
      for(int u:bkt[par[v]]) us[u]=uf.eval(u);
      bkt[par[v]].clear();
      uf.link(par[v],v);
    }

    for(int i=1;i<(int)ord.size();i++){
      int v=ord[i],u=us[v];
      idom[v]=(semi[v]==semi[u]?semi[v]:idom[u]);
    }

    for(int i=1;i<(int)ord.size();i++){
      int v=ord[i];
      idom[v]=ord[idom[v]];
    }

    idom[rt]=rt;
  }

  int operator[](int k){return idom[k];}
};
//END CUT HERE
#ifndef call_from_test
int main(){
  return 0;
}
#endif

#undef call_from_test

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

  DominatorTree G(n);
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    G.add_edge(a,b);
  }
  G.build(0);

  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    int r;
    cin>>r;
    r--;
    cout<<(G[r]?G[r]:r)+1<<"\n";
  }
  cout<<flush;
  return 0;
}



Measured memory_bytes: 22176
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  int n;
  cin >> n;
  int a[n+1];
  int f = 0;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    if(a[i]%2==0){
      if(a[i]%3==0 || a[i]%5==0);
      else f = 1;
    }
  }
  if(!f){
    cout << "APPROVED" << endl;
  }
  else {
    cout << "DENIED" << endl;
  }


return 0;
}
///....


Measured memory_bytes: 256
ni,ki = [int(i) for i in input().split()]
arri = [int(i) for i in input().split()]
    
def getRes(arr,n,k):
    dp = [0]*n
    for i in range(1,n):
        H = arr[i]
        dp[i] = min([dp[j]+abs(arr[j]-H) for j in range(max(0,i-k),i)])
    return dp[-1]

print(getRes(arri,ni,ki))


Measured memory_bytes: 13980
#include <bits/stdc++.h>
using namespace std;
/// 最小値を更新
template<class T> inline bool chkMin(T& a, T b){
  if(a > b){
    a = b;
    return true;
  }
  return false;
}

/// 最大値を更新
template<class T> inline bool chkMax(T& a, T b){
  if(a < b){
    a = b;
    return true;
  }
  return false;
}

int main() {
  int num;
  
  cin >> num;
  
  long long luck[num][3];
  long long dp[num][3];
  
  for(int i = 0; i < num; i++){
    for(int j = 0; j < 3; j++){
      cin >> luck[i][j];
      dp[i][j] = 0;
    }
  }
  dp[num][0] = 0;
  
  for(int i = 0; i < num; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 3; k++){
        if(j == k) continue;
        // 遷移先, 現在の位置+遷移先の幸福度
        chkMax(dp[i+1][k], dp[i][j] + luck[i][k]);       
      }
    }
  }

  cout << max(dp[num][0],max(dp[num][1],dp[num][2]));
}


Measured memory_bytes: 4992
#include<stdio.h>
void main()
{
 int a,b,c,d,i=1;
 scanf("%d",&a);
 scanf("%d",&b);
 scanf("%d",&c);
 scanf("%d",&d);
while(a>0 && c>0)
{
 if(i%2==1)
 {
    c=c-b;
 }
  else
 { 
     a=a-d;
 }
 i++;
} 
if(a<=0)
 printf("No");
else
 printf("Yes");
}

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

int main() 
{
        int time;
        int b;
        int sum;
        int point;
        int i;

        cin >> time >> b;
        i = -1;
        sum = 0;
        while (++i < time)
        {
                cin >> point;
                if (point > b - point)
                        sum += (b - point) * 2;
                else
                        sum += point * 2;
        }
        cout << sum << endl;
}
    

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

using namespace std;

int main() {
  int n;
  cin >> n;
  set<int> st;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    st.insert(x);
  }
  puts(st.size() == n ? "YES" : "NO");
 
  return 0;
}

Measured memory_bytes: 9600
#include <iostream>

using namespace std;

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

int main(void){
	while(true){
		int n;
		int a = 0, b = 0;
		cin >> n;
		if(n == 0) break;
		rep(i, n){
			int x, y;
			cin >> x >> y;
			if(x > y){
				a += x + y;
			}
			if(y > x){
				b += x + y;
			}
			if(y == x){
				a += x;
				b += y;
			}
		}
		cout << a << " " << b << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
int main(void){
    int i,j;
    scanf("%d",&i);
    scanf("%d",&j);
    if(i+j>=24){
        printf("%d\n",(i+j)-24);
        
    }
    else{
        printf("%d\n",i+j);
    }
    
    return 0;
    
}

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

#define pb push_back

const int N = 1e5L + 11;
int a[N];

int main() {
	ios :: sync_with_stdio(false);
	int n; cin >> n;
	for(int i = 1; i <= n; i ++) {
		cin >> a[i];
		if(i & 1) a[i] = 1 - a[i];
	}
	vector <int> v = {0, 0}; int p = 0;
	for(int i = 1; i <= n; i ++)
		if(a[i] != a[i + 1] || i == n) {
			v.pb(i - p);
			p = i;
		}
	int ans = 0;
	for(int i = 0; i + 2 < v.size(); i ++)
		ans = max(ans, v[i] + v[i + 1] + v[i + 2]);
	cout << ans << '\n';
}

Measured memory_bytes: 3644
program test02
 implicit none
!character a, b
 integer a, b
 integer i, ii, j, jj

 read(5,*) a, b

 if ( a < b ) then
  do i=1,b
  write (*,fmt='(i0)',advance='no') a
  end do
 else
  do j=1,a
  write (*,fmt='(i0)',advance='no') b
  end do
 end if

endprogram test02


Measured memory_bytes: 384
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    int N;ll K;cin>>N>>K;
    pair<int,int> p[100010];
    int a,b;
    for(int i=0;i<N;i++){
        cin>>a>>b;
        p[i]={a,b};
    }
    sort(p,p+N);
    int i=0;ll count=0;
    while(count<K){
        count+=(ll)p[i].second;
        i++;
    }
    cout<<p[i-1].first<<endl;
    return 0;
}

Measured memory_bytes: 1024
package main

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

var sc *bufio.Scanner

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

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

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, a, b := nextInt(), nextInt(), nextInt()

	minSum, maxSum := a*(n-1)+b, a+b*(n-1)
	fmt.Println(maxInt(0, maxSum-minSum+1))
}


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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var arg = Console.ReadLine().Split(' ');
            var N = arg[0].ToDecimal();
            var A = arg[1].ToDecimal();
            var B = arg[2].ToDecimal();
            //decimal ans = 0;
            //if (A == 0)
            //{
            //    ans = 0;
            //}
            //else if (N < A + B)
            //{
            //    if(N < A)
            //    {
            //        ans = N;
            //    }
            //    else
            //    {
            //        ans = A;
            //    }
            //}
            //else
            //{
            //    var mul = Math.Floor(N / (A + B)) * (A + B);
            //    ans = Math.Floor(N / (A + B)) * A;
            //    if (mul + A <= N)
            //    {
            //        ans += B;
            //    }
            //    else if (mul + A > N)
            //    {
            //        ans += N - mul;
            //    }
            //}
            var ans = Math.Floor(N / (A + B)) * A;
            var rem = N % (A + B);
            ans += Math.Min(rem, A);
            Console.WriteLine(ans.ToString());
        }
    }

    public static class Extentions
    {
        public static int ToInt(this object obj)
        {
            return int.Parse(obj.ToString());
        }

        public static decimal ToDecimal(this object obj)
        {
            return decimal.Parse(obj.ToString());
        }
    }
}


Measured memory_bytes: 11092
/*input
10
5 3
5 7
8 9
1 9
9 10
8 4
7 4
6 10
7 2
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
 
using namespace std; 
 
int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
#define rept(v) for(auto it=v.begin();it<v.end();it++)
#define all(v) v.begin(),v.end()
const int INF = 1<<30;
typedef long long ll;
typedef pair<int,int> pii;
 
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int a;
	cin >> a;
	cout << a + pow(a, 2) + pow(a, 3);
	return 0;
}

Measured memory_bytes: 4140
import math
n=int(input())
kyorisum=0
tate=[]
yoko=[]
for i in range(n):
    x,y=map(int,input().split())
    tate.append(x)
    yoko.append(y)
for i in range(n-1):
    for j in range(i+1,n):
        kyorisum+=math.sqrt((tate[i]-tate[j])**2+(yoko[i]-yoko[j])**2)
print(kyorisum/n*2)


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

int main() {
	int x,y,z;
	cin >> x >> y >> z;
	int k = y + z + z,cnt = 1;
	while(k <= x)
	{
		if(k + y + z > x)
		{
			break;
		}
		else
		{
			k += y + z;
			cnt++;
		}
	}
    cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long arr[100000+10];




int main()
{
    int n;
    cin>>n;
    for(int i =0 ;i<n ; i++)
        cin>>arr[i];
    long cnt = 0;
    long m = LONG_MIN ;
    for(int i =1;i<n;i++){
        if(arr[i-1]>=arr[i]) cnt++;
        else {
            m = max(m,cnt);
            cnt =0;
        }
    }
    printf("%d\n", m>=cnt ? m : cnt);
    return 0;
}


Measured memory_bytes: 1024
main = putStrLn . (\x-> " " ++x).unwords . map show . solve . read =<< getLine

checknum :: Int -> Bool
checknum x = x `rem` 3 ==0

include3 :: Int -> Bool
include3 x
  | x > 0 = x `rem ` 10 ==3 || include3 ( x `div` 10)
  | otherwise = False

solve :: Int -> [Int]
solve n = filter (\x -> checknum x|| include3 x) [1..n]

Measured memory_bytes: 4052
#include<algorithm>
#include<array>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)

int main()
{
	int a, b, c, d;
	std::cin >> a >> b >> c >> d;
	std::cout << ((a*b >= c*d) ? a*b : c*d) << std::endl;
}

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

int main()
{
  int n;
  long long k;
  scanf("%d%d",&n,&k);
  int a[n],b[n];
  for(int i=0; i<n; i++){
    scanf("%d",&a[i]);
    b[i] = a[i];
  }
  sort(b, b+n);
  reverse(b, b+n);
  
  long long inv1=0;
  long long inv2=0;
  long long inv2_sum=0;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      if(a[i] > a[j]) inv1++;
      if(b[i] > b[j]) inv2++;
    }
  }
//  printf("%d %d\n",inv1,inv2);
  inv1 = ((inv1 % MOD) * k) % MOD;
//  inv2 = ((inv2 % MOD) * (k-1)) % MOD;
  for(int i = k-1; i > 0; i--){
    inv2_sum += ((inv2 % MOD) * i) % MOD;
  }
  printf("%d\n",(inv1+inv2_sum)%MOD);
}


Measured memory_bytes: 384
h, w = map(int, input().split())
field = [input() for _ in [0] * h]
HR = list(range(h))
WR = list(range(w))
WR2 = list(range(w - 2, -1, -1))

# horizontal dp, vertical dp
hor = [[[-1] * h for _ in WR] for _ in HR]  # hor[top][left][bottom] = right
ver = [[[-1] * w for _ in WR] for _ in HR]  # ver[top][left][right] = bottom

for i in HR:
    hi = hor[i]
    fi = field[i]
    curr = hi[-1][i] = w - 1
    curc = fi[-1]
    for j in WR2:
        if fi[j] != curc:
            curr = hi[j][i] = j
            curc = fi[j]
        else:
            hi[j][i] = curr

for i in HR:
    hi = hor[i]
    vi = ver[i]
    fi = field[i]
    for j in WR:
        hij = hi[j]
        vij = vi[j]
        fij = fi[j]
        curr = hij[i]
        for k in HR[i + 1:]:
            if field[k][j] != fij:
                break
            curr = hij[k] = min(curr, hor[k][j][k])
        curr = j
        for k in range(h - 1, i - 1, -1):
            h_ijk = hij[k]
            if h_ijk == -1:
                continue
            while curr <= h_ijk:
                vij[curr] = k
                curr += 1

ans = 0
while True:
    if hor[0][0][-1] == w - 1:
        break
    for i in HR:
        hi = hor[i]
        vi = ver[i]
        for j in WR:
            hij = hi[j]
            vij = vi[j]

            # print(ans + 1, i, j, 'first')
            # print(hor[i][j])
            # print(ver[i][j])

            # Update hor using hor, ver using ver
            for k in HR[i:]:
                h_ijk = hij[k]
                if h_ijk == -1:
                    break
                if h_ijk == w - 1:
                    continue
                hij[k] = max(h_ijk, hi[h_ijk + 1][k])
            for k in WR[j:]:
                v_ijk = vij[k]
                if v_ijk == -1:
                    break
                if v_ijk == h - 1:
                    continue
                vij[k] = max(v_ijk, ver[v_ijk + 1][j][k])

            # print(ans + 1, i, j, 'before')
            # print(hor[i][j])
            # print(ver[i][j])

            # Update hor using ver, ver using hor
            curr = j
            for k in range(h - 1, i - 1, -1):
                h_ijk = hij[k]
                if h_ijk == -1:
                    continue
                while curr <= h_ijk:
                    vij[curr] = max(vij[curr], k)
                    curr += 1
            curb = i
            for k in range(w - 1, j - 1, -1):
                v_ijk = vij[k]
                if v_ijk == -1:
                    continue
                while curb <= v_ijk:
                    hij[curb] = max(hij[curb], k)
                    curb += 1

            # print(ans + 1, i, j, 'after')
            # print(hor[i][j])
            # print(ver[i][j])
    ans += 1

print(ans)


Measured memory_bytes: 152204
#include<bits/stdc++.h>
using namespace std;
int main(){
    int k,x,l=-1000000,r=1000000;
    cin>>k>>x;
    int al=max(l,x-k+1),ar=min(r,x+k-1);
    for(int i=al;i<=ar;i++)cout<<i<<" ";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PI acos(-1.0)
#define eps 1e-67
#define pf printf
#define sf scanf
#define sd(n) scanf("%d",&n)
#define sd2(n1,n2) scanf("%d %d",&n1,&n2)
#define slf(n) scanf("%lf",&n)
#define slf2(n1,n2) scanf("%lf %lf",&n1,&n2)
#define sLf(n1) scanf("%Lf",&n1)
#define sLf2(n1,n2) scanf("%Lf %Lf",&n1,&n2)
#define sl(n) scanf("%lld",&n)
#define sl2(n1,n2) scanf("%lld %lld",&n1,&n2)
#define rep(i,a,b) for(long long int i=a;i<b;i++)
#define repb(i,a,b) for(long long int i=a;i>=b;i--)
#define repa(i,a,b,c) for(long long int i=a;i<b;i=i+c)
#define reps(i,a,b,c) for(long long int i=a;i>b;i=i-c)
#define asort(a) sort(a.begin(),a.end())
#define asortb(a,comp) sort(a.begin(),a.end(),comp)
#define arev(a) reverse(a.begin(),a.end())
#define all(v) (v).begin(),(v).end()
#define allc(v,comp) (v).begin(),(v).end(),comp
#define allrc(v,a,b,comp) (v).begin()+a,(v).end()-b,comp
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define pbb pop_back
#define mp make_pair
#define mt make_tuple
#define bs(v,x) binary_search(v.begin(),v.end(),x)
#define lb(v,x) lower_bound(v.begin(),v.end(),x)
#define ub(v,x) upper_bound(v.begin(),v.end(),x)
#define tl(c) towlower(c)
#define root(x) sqrt(x)
#define power(a,n) pow(a,n)
#define tu(c) towupper(c)
#define sq(a) ((a)*(a))
#define cube(a) ((a)*(a)*(a))
#define mx 1000
#define MX 100000
#define mod 1000000007
using namespace std;
typedef string str;
typedef long long int ll;
typedef double lf;
typedef long double llf;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef char ch;
typedef map<ll,ll> mpl;
vll v[26];
void Solve()
{
    ll n;
    ll i,j,k;
    string ans,mm;
    mm="abcdefghijklmnopqrstuvwxyz";
    cin>>n;
    rep(i,0,n)
    {
         string s;
         cin>>s;
         map<ll,ll> m;
         rep(i,0,s.size())
         {
             char c=s[i];
             ll aa=c-'a';
             m[aa]++;

         }
         rep(j,0,26)
         {
             v[j].pb(m[j]);
         }

    }
    rep(i,0,26)
    {
        asort(v[i]);
    }
    rep(i,0,26)
    {
        char dd=mm[i];
        rep(j,0,v[i][0])
        {

            ans.pb(dd);
        }
    }
    cout<<ans<<endl;
}
int main()
{
    Solve();
    return 0;
}

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

int main() {
    int n,m;
    cin>>n>>m;
    int mx=max(n,m);
    int mod=1e9+7;
    ll fac[mx+1];
    fac[0]=fac[1]=1;
    for (ll i=2;i<=mx;i++)
        fac[i]=fac[i-1]*i%mod;
    if (abs(n-m)>=2)
        cout<<0<<endl;
    else if (abs(n-m)==1)
        cout<<fac[n]*fac[m]%mod<<endl;
    else
        cout<<fac[n]*fac[m]%mod*2%mod<<endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n;
        int a,b;
        int pa,pb;
        while((n=sc.nextInt())!=0){
            pa=0;  pb=0;
            for(int i=0;i<n;i++){
                a=sc.nextInt();
                b=sc.nextInt();
                if(a>b){pa+=a+b;}
                else if(a<b){pb+=a+b;}
                else if(a==b){pa+=a;  pb+=b;}
            }
            System.out.println(pa+" "+pb);
        }
    }
}


Measured memory_bytes: 58112
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a);i<=(b);i++)
#define ROF(i,a,b) for(int i = (a);i>=(b);i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT first
#define SD second
#define N 405
#define M 51
#define INF 500
#define MOD 924844033
#define MOD2 1000000009
#define eps 1e-7
using namespace std;
inline int Max(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^b;
}
inline int Min(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^a;
}

ll a[N];
ll x[N][4];
ll c[N][10];
ll dp[N][10];
int mp[4][4] = {{1,0,3,2},{0,3,2,1},{3,2,1,0},{2,1,0,3}};
map<ll,int>m;
ll get(ll x,ll y,ll z,ll h)
{
    ll ret = x;
    ret = (ret<<10)+y;
    ret = (ret<<10)+z;
    ret = (ret<<10)+h;
    return ret;
}
ll pack(ll x,ll y,ll z,ll h)
{
    return min(min(get(x,y,z,h),get(y,z,h,x)),min(get(z,h,x,y),get(h,x,y,z)));
}
ll fac(ll x)
{
    ll ret = 1;
    FOR(i,1,x)ret*=i;
    return ret;
}
ll rot(ll key)
{
    int k[4];
    FOR(i,0,3)
    {
        k[i] = key&((1<<10)-1);
        key>>=10;
    }
    if(k[0] == k[1]&&k[1] == k[2]&&k[2] == k[3])return 4;
    if(k[0] == k[2]&&k[1] == k[3])return 2;
    return 1;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while(cin>>n)
    {
        c[1][0] = c[1][1] = 1;
        FOR(i,2,n)
        {
            c[i][0] = 1;
            FOR(j,1,min(4,i-1))c[i][j] = c[i-1][j]+c[i-1][j-1];
            c[i][i] = 1;
        }
        FOR(i,1,n)
        {
            FOR(j,0,3)cin>>x[i][j];
            a[i] = pack(x[i][0],x[i][1],x[i][2],x[i][3]);
        }
        ll ans = 0;
        m.clear();
        FOR(i,1,n)
        {
            FOR(ii,1,i-1)
            {
                FOR(j,0,3)
                {
                    ll y[4];
                    y[0] = pack(x[i][1],x[i][0],x[ii][mp[j][0]],x[ii][mp[j][1]]);
                    y[1] = pack(x[i][0],x[i][3],x[ii][mp[j][3]],x[ii][mp[j][0]]);
                    y[2] = pack(x[i][3],x[i][2],x[ii][mp[j][2]],x[ii][mp[j][3]]);
                    y[3] = pack(x[i][2],x[i][1],x[ii][mp[j][1]],x[ii][mp[j][2]]);
                    sort(y,y+4);
                    ll ret = 1;
                    for(int p = 0;p<4;)
                    {
                        int cnt = 1;
                        for(int r = p+1;r<4&&y[r] == y[p];r++)cnt++;
                        int num = m[y[p]];
                        if(y[p] == a[ii])num--;
                        if(num<cnt)
                        {
                            ret = 0;
                            break;
                        }
                        ret*=c[num][cnt]*pow(rot(y[p]),cnt)*fac(cnt);
                        p+=cnt;
                    }
                    ans+=ret;
                }
            }
            m[a[i]]++;
        }
        cout<<ans<<endl;
    }
    return 0;
}


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

namespace ITP1_3_D
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var a = int.Parse(input[0]);
            var b = int.Parse(input[1]);
            var c = int.Parse(input[2]);
            Console.WriteLine(Enumerable.Range(a, b - a + 1).Count(n => c % n == 0));
        }
    }
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,vec) V vec(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t meke_tuple
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a));reverse(all(a))
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (ll)(a.size())
#define ENDL cout<<endl
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define show(a) rep(ghf,SZ(a)){rep(kjh,SZ(a[ghf])){cout<<(a[ghf][kjh]<10?" ":"")<<a[ghf][kjh]<<" ";}ENDL;}
#define out(a) cout<<(a)<<endl
#define fi first
#define se second
#define Vec vector
#define P pair
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> V;
typedef pair<ll,ll> Pi;
typedef vector<Pi> VP;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

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

  int n,k;
  str s;
  cin>>n>>k>>s;
  k--;
  s[k]-='A'-'a';
  out(s);
  
  
  
  
  return 0;
}



Measured memory_bytes: 256
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	LL h,w;
	while(cin >> h >> w) {
		if(h < w) swap(h,w);
		LL ans = 1e15;
		if(w%3 == 0 or h%3 == 0){
			ans = 0;
		}else{
			ans = w;
		}
		FOR(i,1,h){
			DEBUG(i);
			LL t = w/2;
			DEBUG(t);
			DEBUG(abs(min({i*w,t*(h-i),t*i})-max({i*w,t*(h-i),t*i})));
			LL val = abs(min({i*w,t*(h-i),(w-t)*(h-i)})-max({i*w,t*(h-i),(w-t)*(h-i)}));
			if(t != 0 and w-t != 0) chmin(ans,val);
		}
		swap(h,w);
		DEBUG(w);
		FOR(i,1,h){
			DEBUG(i);
			LL t = w/2;
			DEBUG(t);
			DEBUG(abs(min({i*w,t*(h-i),t*i})-max({i*w,t*(h-i),t*i})));
			LL val = abs(min({i*w,t*(h-i),(w-t)*(h-i)})-max({i*w,t*(h-i),(w-t)*(h-i)}));
			if(t != 0 and w-t != 0) chmin(ans,val);
		}
		cout << ans << endl;
	}
	return 0;
}


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

#define pb push_back
#define inf INT_MAX
#define pii pair<int,int>
#define f first
#define s second
#define mp make_pair
#define mod 1000000009
#define ld long double
#define eps 1e-8
#define MAXN 2123

vector<pii> are[MAXN];
int dis[MAXN];
int val[MAXN];

void dij(int x){
    for(int i=0;i<MAXN;i++)dis[i]=-1;
    priority_queue<pii> q;
    dis[x]=0;q.push(mp(0,x));
    while(!q.empty()){
        x=q.top().s;int c=-q.top().f;q.pop();
        if(dis[x]!=c)continue;
        for(pii at:are[x]){
            int y=at.s,c=at.f;
            if(dis[y]==-1||dis[x]+c<dis[y]){
                dis[y]=dis[x]+c;
                q.push(mp(-dis[y],y));
            }
        }
    }
    for(int i=0;i<MAXN;i++)val[dis[i]]++;
}

int32_t main (){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<setprecision(2)<<fixed;

    int n,x,y;
    cin>>n>>x>>y;
    for(int i=0;i<n-1;i++){
        are[i].pb(mp(1,i+1));
        are[i+1].pb(mp(1,i));
    }
    x--;y--;
    are[x].pb(mp(1,y));
    are[y].pb(mp(1,x));

    for(int i=0;i<n;i++)dij(i);

    for(int i=1;i<n;i++){
        cout<<val[i]/2<<endl;
    }

    return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll t1, t2;
    ll a1, a2;
    ll b1, b2;
    cin >> t1 >> t2;
    cin >> a1 >> a2;
    cin >> b1 >> b2;
    ll dif1 = t1 * a1 - t1 * b1;
    ll dif2 = t2 * a2 - t2 * b2;
    if (dif1 == (0-dif2)) {
        // 1サイクルで元に戻る
       cout << "infinity" << endl;
        return 0;
    } else if ((dif1 < 0 && dif1 + dif2 < 0) || (dif1 > 0 && dif1 + dif2 > 0)){
        // 距離は離れるばかり
        cout << 0 << endl;
        return 0;       
    } else {
        ll dif = dif1 + dif2;
        ll conf = abs(dif1) / abs(dif);
        ll md = abs(dif1) % abs(dif);
        if(md == 0)
            cout << conf * 2 << endl;
        else 
            cout << 1 + conf * 2 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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;
ll inf=(ll)1E17;

#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);
///////////////////////////////////////


int main(){fastio;
    ll n,m;cin>>n>>m;
    l_l a[n];rep(i,0,n-1)cin>>a[i].first>>a[i].second;
    sort(a,a+n);
    ll ans=0;
    ll c=0;
    rep(i,0,n-1){
        if(c+a[i].second<=m){
            c+=a[i].second;
            ans+=a[i].first*a[i].second;
        }else{
            ans+=a[i].first*(m-c);
            break;
        }
    }
    cout<<ans<<endl;
    
    return 0;
}








Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)

using ll = long long;
using namespace std;

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

    vector<int> cost(n + 1, 0);
    rep(i, 0, n) {
        cin >> cost[i];
    }

    vector<int> sumcost(n + 1, 0);
    rep(i, 0, n) {
        if (i == 0) {
            sumcost[i] = abs(cost[i]);
        } else {
            sumcost[i] = sumcost[i - 1] + abs(cost[i - 1] - cost[i]);
        }
    }
    sumcost[n] = sumcost[n - 1] + abs(cost[n - 1] - 0);

    rep(i, 0, n) {
        int sublen1 = i > 0 ? abs(cost[i] - cost[i - 1]) : abs(cost[i]);
        int sublen2 = abs(cost[i] - cost[i + 1]);
        int addlen  = i > 0 ? abs(cost[i - 1] - cost[i + 1]) : abs(cost[i + 1]);

        int ans = sumcost[n] - sublen1 - sublen2 + addlen;
        cout << ans << endl;
    }
    return 0;
}


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

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<int> dp(N), H(N);
	for (auto& e: H) scanf("%d", &e);
	H.push_back(1ll << 30);
	for (int i{N - 1}; i >= 0; i--)
		if (H[i] >= H[i + 1])
			dp[i] = dp[i + 1] + 1;

	printf("%d\n", *std::max_element(dp.begin(), dp.end()));

	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#define N 1300000
using namespace std;
int start(int);
int goal(int);
int sosu[N];
int main(){
  int i,j,n,s,g;
  for(i=0;i<N;i++) sosu[i]=1;
  sosu[0]=0;
  sosu[1]=0;
  for(i=0;i<N/2;i++){
    if(sosu[i]==1){
      for(j=i*2;j<N;j+=i){
    sosu[j]=0;
      }
    }
  }
  while(1){
    cin >> n;
    if(n==0) break;
    if(sosu[n]!=1){
      s=start(n);
      g=goal(n);
      cout << g-s << endl;
    }
    else cout << 0 << endl;
  }
  return 0;
}
int start(int n){
  int i,result;
  if(n%2==0) n--;
  else n-=2;
  for(i=n;i>=2;i-=2){
    if(sosu[i]==1){
      result=i;
      break;
    }
  }
  return result;
}
int goal(int n){
  int i,result;
  if(n%2==0) n++;
  else n+=2;
  for(i=n;i<N;i+=2){
    if(sosu[i]==1){
      result=i;
      break;
    }
  }
  return result;
}

Measured memory_bytes: 6236
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	shogen := make([][]int, N)
	for i := 0; i < N; i++ {
		shogen[i] = make([]int, N)
		for j := 0; j < N; j++ {
			shogen[i][j] = -1
		}
		var n int
		fmt.Scan(&n)
		for j := 0; j < n; j++ {
			var x, y int
			fmt.Scan(&x, &y)
			x--
			shogen[i][x] = y // 人iからみて人jはy(1:正直,0:不正直)
		}
	}
	maxhonests := 0
	for bits := 0; bits < (1 << uint(N)); bits++ { // 正直な人を決め打って全探索する
		ok := true               // この正直者達の組み合わせで矛盾は生じないか？
		for i := 0; i < N; i++ { // bitsに含まれる正直者の証言をチェックする
			if (bits & (1 << uint(i))) != 0 { // 人iは正直である
				for j := 0; j < N; j++ { // 人iの全ての証言を調べる
					if (shogen[i][j] == 1 && !isHonest(bits, j)) ||
						(shogen[i][j] == 0 && isHonest(bits, j)) {
						// 人iは人jを正直と証言しているが正直者リストに含まれていない、あるいは
						// 人iは人jを不正直と証言しているが、正直者リストに含まれている。
						ok = false // このbitsは矛盾する
					}
				}
			}
		}
		if ok { // 矛盾が生じない場合の正直者の人数を数える
			maxhonests = max(maxhonests, bcount(bits))
		}
	}
	fmt.Println(maxhonests)
}

func isHonest(honests, j int) bool {
	if (honests & (1 << uint(j))) != 0 {
		return true
	}
	return false
}

func bcount(b int) int {
	r := 0
	for b > 0 {
		if (b & 1) != 0 {
			r++
		}
		b /= 2
	}
	return r
}

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


Measured memory_bytes: 512
package main

import "fmt"

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

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n+2)
	for i := 1; i < len(as)-1; i++ {
		fmt.Scan(&as[i])
	}

	cost := 0
	for i := 0; i < len(as)-1; i++ {
		cost += diff(as[i], as[i+1])
	}

	for i := 1; i < len(as)-1; i++ {
		a0 := as[i-1]
		a1 := as[i]
		a2 := as[i+1]
		fmt.Println(cost - diff(a0, a1) - diff(a1, a2) + diff(a0, a2))
	}
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }


void compute() {

}

int d[] = {0,1,0,-1};
string s[510];
int h,w;
bool check() {
  rep(y,h) {
    rep(x,w) {
      if( s[y][x] == '.') continue;
      int cnt = 0;
      rep(i,4) {
	int nx = x + d[i];
	int ny = y + d[(i+1)%4];
	if( !( 0 <= nx && nx < w && 0 <= ny && ny < h ) ) continue;
	if( s[ny][nx] == '#' ) ++cnt;
      }
      if( cnt == 0 ) {
	return false;
      }
    }
  }
  return true;
}

int main() {
  cin >> h >> w;
  rep(i,h) cin >> s[i];
  puts(check()?"Yes":"No");
  compute();
  return 0;
}


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

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
double pi=acos(-1);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
// #define mp make_pair
#define pq priority_queue
const ll mod=1000000007;
#define f first
#define s second
#define pii pair< ll, ll >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace boost::multiprecision;
using namespace std;
void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int N=1000005;
ll fact[N],invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}

void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){ return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod; }



const int N1=1e6+1;
vector<int> isprime(N1,1),prime;
void seive(){
  rep(i,2,sqrt(N1)+1){
      if(isprime[i]){
        for(int j=i*i;j<N1;j+=i) isprime[j]=0;
        prime.pb(i);
      }
  }
  rep(i,sqrt(N1)+1,N1) if(isprime[i]) prime.pb(i);
}



struct dsu {
    vector<int> par, rank;
    dsu(int n): par(n+1), rank(n+1) {
        for (int i = 0; i <= n; i++) {
            par[i] = i;
            rank[i]= 1;
        }
    }
    int root(int a) {
        if (a == par[a]) return a;
        return par[a] = root(par[a]);
    }
    void merge(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] > rank[b]) swap(a, b);
        par[b] = a;
    }
    set<int> parent(int n){
        set<int> s;
        for(int i=1;i<=n;i++){
            s.insert(root(i));
        }
        return s;
    }
};

void solve(){
  int m;
  cin>>m;
  cout<<48-m<<endl;
}

int main(){
    optimizeIO();
    int r=1;
    {solve();}
}


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

#define int long long
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define yn(x) ((x) ? "Yes" : "No")

typedef pair <int, int> ii;
typedef pair <int, ii> iii;

const int siz = 2e5 + 10;
const int SIZ = 1e6 + 10;
const int mod = 1e9 + 7;
const int maxx = 2e9;
const int MAXX = 1e18;
const string file = "3";



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

//    freopen ((file + ".inp").c_str(), "r", stdin);
//    freopen ((file + ".out").c_str(), "w", stdout);

    int x;
    cin >> x;

    cout << yn(x >= 30) << "\n";

//    cerr << "Time: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define MAX 110
#define inf 1<<29
#define linf 1e18
#define eps (1e-8)
#define mod 1000000007
#define pi M_PI
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,int> pdi;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

struct edge{ int to,cap,rev; };

int V,E;
vector<edge> G[MAX];
int level[MAX];
int iter[MAX];

void add_edge(int from,int to,int cap){
  G[from].push_back((edge){to,cap,(int)G[to].size()});
  G[to].push_back((edge){from,0,(int)G[from].size()-1});
}

void bfs(int s){
  memset(level,-1,sizeof(level));
  queue<int> q;
  level[s]=0;
  q.push(s);
  while(q.size()){
    int v=q.front();
    q.pop();
    for(int i=0;i<G[v].size();i++){
      edge &e=G[v][i];
      if(e.cap > 0 && level[e.to]<0){
        level[e.to]=level[v]+1;
        q.push(e.to);
      }
    }
  }
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  for(int &i=iter[v];i<G[v].size();i++){
    edge &e=G[v][i];
    if(e.cap > 0 && level[v]<level[e.to]){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
        e.cap-=d;
        G[e.to][e.rev].cap+=d;
        return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow=0;
  for(;;){
    bfs(s);
    if(level[t]<0)return flow;
    memset(iter,0,sizeof(iter));
    int f;
    while((f=dfs(s,t,inf))>0)flow+=f;
  }
}

int main()
{
  cin>>V>>E;
  FOR(i,0,E){
    int a,b,c;
    cin>>a>>b>>c;
    add_edge(a,b,c);
  }
  cout<<max_flow(0,V-1)<<endl;
 
  return 0;
}

Measured memory_bytes: 3192
n, k = (int(_) for _ in input().split())
m, q, ans = (n, 0, 0)

while m > 0:
    if k <= m:
        ans += (m - k + 1)/n * 0.5**q
        m = k - 1
    k = k // 2 + k % 2
    q += 1

print(ans)


Measured memory_bytes: 2940
def main():
    i = int(input())
    if i == 0:
        print(0)
        exit()

    ans = ""
    while i:
        p, q = divmod(i, 2)
        if q:
            ans += "1"
        else:
            ans += "0"
        i = -p

    print(ans[::-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
using namespace std;
struct s{
    string worm;
    int nowans;
};
int main(){
    char dc[6][3]={'r','g','b','g','r','b','r','b','g','b','r','g','g','b','r','b','g','r'};
    while(1){
        int che[100000]={0};
        s IN,now;
        queue 
 que;
        cin >> IN.worm;
        IN.nowans=0;
        if(IN.worm[0]=='0')
            break;
        que.push(IN);
        while(1){
            int chenum=0;
            if(que.empty()){
                puts("NA");
                goto exit;
            }
            now=que.front(),que.pop();
            for(int i=0;i<now.worm.size();i++){
                if(now.worm[i]=='r')
                    chenum+=pow(3,i)*0;
                else if(now.worm[i]=='g')
                    chenum+=pow(3,i)*1;
                else if(now.worm[i]=='b')
                    chenum+=pow(3,i)*2;
            }
            if(che[chenum]==1)
                continue;
            else
                che[chenum]=1;
            for(int i=0;i<now.worm.size()-1;i++){
                if(now.worm[i]!=now.worm[i+1])
                    break;
                if(i==now.worm.size()-1-1){
                    printf("%d\n",now.nowans);
                    goto exit;
                }
            }
            for(int i=0;i<now.worm.size()-1;i++){
                if(now.worm[i]!=now.worm[i+1]){
                    for(int j=0;j<6;j++){
                        if(now.worm[i]==dc[j][0]&&now.worm[i+1]==dc[j][1]){
                            now.worm[i]=dc[j][2],now.worm[i+1]=dc[j][2],now.nowans++;
                            que.push(now);
                            now.worm[i]=dc[j][0],now.worm[i+1]=dc[j][1],now.nowans--;
                        }
                    }
                }
            }
        }
exit:;
    }
    return 0;
}

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

#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define endl '\n'
#define eps  1e-9
const double pi=acos(-1);
const int mod=1e9+7;
//____________________


int32_t main()
{ 
  io;
 
   
  int a,b;
  cin>>a>>b;
  if(b%a)
    cout<<b-a;
  else
    cout<<a+b;
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int t;
	int ans = N;
	for(int i = 0; i < N; i++) {
		cin >> t;
		if(A <= t && t < B) ans--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N = input()

A = map(int,raw_input().split())

B = []
C = []

for i in A:
    if i not in B:
        B.append(i)
    elif i not in C:
        C.append(i)

def gcd(x,y):
    if y == 0:
        return x
    return gcd(y,x%y)

ans = 0;
for i in range(len(B)):
    res = 0
    for j in range(len(B)):
        if B[i] not in C:
            if i == j:
                continue
        res = gcd(res,B[j])
    ans = max(ans,res)
        

if ans == 0:
    if len(B) == 1:
        print B[0]
    else:
        print 1
else:
    print ans

Measured memory_bytes: 11340
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    ll m = pow(10, 15);
    ll a;
    for (int i = 0; i < 5; i++)
    {
        cin >> a;
        m = min(a, m);
    }

    if (N % m == 0)
        cout << N / m + 4 << endl;
    else
        cout << N / m + 1 + 4 << endl;
}

Measured memory_bytes: 256