akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, ll> pii;
#define FastIO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define forn(i, n) for (int i = 0; i < n; ++i)
#define forn1(i, n) for (int i = 1; i <= n; ++i)
#define pb push_back
#define fr first
#define sc second
const int MAXN = 500;
const int INF = 1e9;

char start[MAXN][MAXN];
int fin[MAXN][MAXN];

//#define DEBUG

int main(){
  FastIO;
  #ifdef DEBUG
    freopen("input.txt", "r", stdin);
  #endif
  ll h;
  ll w, k;
  cin >> h >> w >> k;
  forn(i, h)forn(j, w)cin >> start[i][j];
  int cur = 0;
  for (int i = 0; i < h; ++i)
  {
    for (int j = 0; j < w; ++j)
    {
      if (!fin[i][j] && start[i][j] == '#')
      {
        ++cur;
        int ii = i, jj = j + 1, iil = i, jjl = j;
        fin[i][j] = cur;
        int cnt = 0;
        if (start[i][j] == '#')cnt = 1;
        for (;jjl > 0 && cnt < 2 && fin[i][jjl - 1] == 0; --jjl)
        {
          if (start[i][jjl - 1] == '#'){
            ++cnt;
            if (cnt >= 2)break;
          }
          fin[i][jjl - 1] = cur;
        }
        for (;jj < w && cnt < 2 && fin[i][jj] == 0; ++jj)
        {
          if (start[i][jj] == '#'){
            ++cnt;
            if (cnt >= 2)break;
          }
          fin[i][jj] = cur;
        }
        iil = i - 1;
        for(; iil >= 0; --iil)
        {
          bool ok = true;
          for (int z = jjl; z < jj; ++z)
          {
            if (start[iil][z] == '#' || fin[iil][z] != 0)ok = false;
          }
          if (!ok)break;
          for (int z = jjl; z < jj; ++z)fin[iil][z] = cur;
        }
        ++ii;
        for(; ii < h; ++ii)
        {
          bool ok = true;
          for (int z = jjl; z < jj; ++z)
          {
            if (start[ii][z] == '#' || fin[ii][z] != 0)ok = false;
          }
          if (!ok)break;
          for (int z = jjl; z < jj; ++z)fin[ii][z] = cur;
        }
      }
    }
  }
  forn(i, h)
  {
    forn(j, w)
    {
      cout << fin[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}


Measured memory_bytes: 1536
N = int(input())
D, X = map(int, input().split())
A = [int(input()) for _ in range(N)]


def f(x):
    count = 0
    for i in range(0, D):
        if (i * x + 1 <= D):
            count += 1
        else:
            break
    return count


s = []
for i in range(N):
    s.append(f(A[i]))

print(sum(s) + X)


Measured memory_bytes: 3060
import java.util.Scanner;
public class Main {
    public static void main(String[] defargs) {
        Scanner scanner = new Scanner(System.in);
        double r = scanner.nextDouble();
        double pi = Math.PI;
        double area = r * r * pi;
        double ensyu = (double)2 *(double) pi * r;
        System.out.printf("%f %f\n" , area , ensyu);
    }
}


Measured memory_bytes: 28224
#define _USE_MA_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,k;
    cin>>n>>k;
    cout<<n-k+1<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int score[5];
	int i;
	int sum;
	
	sum = 0;
	for (i = 0; i < 5; i++) {
		scanf("%d", &score[i]);
		if (score[i] < 40) {
			score[i] = 40;
		}
		sum += score[i];
	}
	printf("%d\n", sum / 5);
	return (0);
}

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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

		var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			var results = new List<string>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveStringArray()[0];
				results.Add(inp);
			}
			var AC = 0;
			var WA = 0;
			var TLE = 0;
			var RE = 0;

			foreach (var result in results) {

				switch (result) {
					case "AC":
						AC++;
						break;
					case "WA":
						WA++;
						break;
					case "TLE":
						TLE++;
						break;
					case "RE":
						RE++;
						break;

					default:
						break;
				}


			}


			//答えの出力
			Console.WriteLine($"AC x {AC}");
			Console.WriteLine($"WA x {WA}");
			Console.WriteLine($"TLE x {TLE}");
			Console.WriteLine($"RE x {RE}");

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}

Measured memory_bytes: 36292
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
Volume0-0021

Parallelism
=end
def para?(x1,y1,x2,y2,x3,y3,x4,y4)
  eps=1e-10
  if x1==x2 and x3==x4 then
    return true
  elsif x1==x2 or x3==x4 then
    return false
  else
    return ((y2-y1)/(x2-x1) - (y4-y3)/(x4-x3)).abs <eps
  end
end

n=STDIN.gets.to_i
0.upto(n-1){|i|
  x1,y1,x2,y2,x3,y3,x4,y4 = STDIN.gets.chomp.split.map{|x| x.to_f}
  puts para?(x1,y1,x2,y2,x3,y3,x4,y4) ? "YES" : "NO"
}

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

int main(){
	int h, w;

	while(1){
		cin >> h >> w;

		if(h == 0 && w == 0){
			break;
		}

		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				if((i+j)%2 == 0){
					cout << '#' << flush;
				}else{
					cout << '.' << flush;
				}
			}
			cout << endl;
		}
		cout << endl;
	}

	return(0);
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
	  result=(result*base)%modulus;
	  exponent=exponent>>1;
	  base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
vl g[MAX];
ll n,k;
ll sub[MAX];
ll dfs(ll u,ll p,ll i,ll d){
	sub[u]=k-i-d;
	ll j = 0;
	for(auto v:g[u]){
		if(v!=p){
			dfs(v,u,j,min(d+1,2LL));
			j++;
		}
	}	
}

int main(){FAST;
cin>>n>>k;
for(ll i=0;i<n-1;i++){
	ll u,v;cin>>u>>v;
	g[u].pb(v);
	g[v].pb(u);
}
dfs(1,0,0,0);
ll ans = 1;
for(ll i=1;i<=n;i++){
	if(sub[i]<0){
		ans=0;
		break;
	}
	else{
		ans=(ans*sub[i])%MOD;
	}
}
cout<<ans;
return 0;
}

Measured memory_bytes: 11136
import sys
input = sys.stdin.readline
from collections import *
from math import *

N, K = map(int, input().split())
MOD = 10**9+7
ans = 0

for i in range(K, N+2):
    c = ((2*N-i+1)*i)//2-i*(i-1)//2+1
    ans += c
    ans %= MOD

print(ans)

Measured memory_bytes: 68064
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s.at(0)==s.at(1)&&s.at(0)!=s.at(2)&&s.at(2)==s.at(3))
    cout << "Yes" << endl;
  else if (s.at(0)==s.at(2)&&s.at(0)!=s.at(1)&&s.at(1)==s.at(3))
    cout << "Yes" << endl;
  else if (s.at(0)==s.at(3)&&s.at(0)!=s.at(1)&&s.at(2)==s.at(1))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char** argv){
  string str;

  while(cin >> str) {
    int n = 0;

    for (int i = 0; i < 4; i++) {
      if (str[i] == '+')
	n++;
      else
	n--;
    }

    cout << n << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;
int k, t, s;
int a[110];
int main()
{
	cin >> k >> t;
	rep(i, t)
	{
		cin >> a[i];
	}
	sort(a, a+t);
	s=0;
	rep(i, t-1)
	{
		s+=a[i];
	}
	cout << max(0, a[t-1]-s-1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 1000

int top;
int S[MAX];

int initialize(){
       return top=0;
       }

int isempty(){
       return top==0;
       }

int isfull(){
       return top>=MAX-1;
       }

void push(int n){
       if (isfull()){return;}

       top++;
       S[top]=n;
       }

int pop(){
       if (isempty()){return;}

       top--;
       return S[top+1];
       }

int main(){
       int i,j,x,y;
       char op[MAX];
       initialize();
       while(scanf("%s",&op) != EOF){
                   if(op[0]=='+'){
                               x=pop();
                               y=pop();
                               push(y+x);
                               }
                   else if(op[0]=='-'){
                               x=pop();
                               y=pop();
                               push(y-x);
                               }
                   else if(op[0]=='*'){
                               x=pop();
                               y=pop();
                               push(y*x);
                               }
                   else {push(atoi(op));}
                   }
          printf("%d\n",pop());
          return 0;
          }




Measured memory_bytes: 2124
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))
ll ee[800][800],a[800],cnt[800],dpcnt,dp[800];
ll cnta,cntb,n,m,base;

void f(ll i,ll c){
	a[i]=c;
	if(c==1)++cnta;else++cntb;
	rep(j,0,n){
		if(!ee[i][j]){
			if(a[j]&&a[j]==c){
				puts("-1");
				exit(0);
			}
			if(!a[j])f(j,-c);
		}
	}
}

int main(){
	scanf("%lld%lld",&n,&m);
	rep(i,0,m){
		ll p,q;
		scanf("%lld%lld",&p,&q);
		ee[p-1][q-1]=ee[q-1][p-1]=1;
	}
	rep(i,0,n)ee[i][i]=1;
	rep(i,0,n){
		if(!a[i]){
			cnta=cntb=0;
			f(i,1);
			base+=min(cnta,cntb);
			cnt[dpcnt++]=llabs(cnta-cntb);
		}
	}
	dp[base]=1;
	rep(i,0,dpcnt){
		for(ll j=800;j>=cnt[i];--j){
			dp[j]|=dp[j-cnt[i]];
		}
	}
	dp[0]=1;
	ll temp,temp2,ans,ans2;
	temp=n/2;
	while(!dp[temp])++temp;
	temp2=n-temp;
	ans=temp*(temp-1)/2+temp2*(temp2-1)/2;
	temp=n/2;
	while(!dp[temp])--temp;
	temp2=n-temp;
	ans2=temp*(temp-1)/2+temp2*(temp2-1)/2;
	printf("%lld\n",min(ans,ans2));
}

Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,i;
  	cin>>a>>b;
	
  	c=a*pow(10,floor(log10(b)+1))+b;
  
  	for(i=1;i<=sqrt(c);i++){
      if(i*i==c){
        cout<<"Yes"<<endl;
      	return 0;
      }
    }
  
  	cout<<"No"<<endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define M 500005
int n,A,B,C,D;
int main(){
	scanf("%d %d %d %d %d",&n,&A,&B,&C,&D);
	int m=n-1;
	for(int i=0;i<=m;i++){//加 
		int j=m-i;
		ll xia=A+1ll*i*C-1ll*j*D;
		ll shang=A+1ll*i*D-1ll*j*C;
		if(B>=xia&&B<=shang){
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

				//a??????
				int intA = sc.nextInt();
				//b??????
				int intB = sc.nextInt();

				double dbF; //?????°?????£?¨?
				//f???????????????????????°???????????§???????¨????
				 dbF = (double) intA /  (double) intB;
				 //?¨??????????db????????°??????string???????????????
				 String f2 = String.format("%.5f", dbF);
				//?¨??????????????????????a/b = d
				System.out.println(intA / intB + " " + intA % intB + " " + f2);
	}
}

Measured memory_bytes: 26560
/*input
32
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5
*/
#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 ll          long long
#define pb          push_back
#define pii         pair<long,long>
#define vi          vector<long long>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define mod         998244353
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repi(i,a,b) for(ll i=a;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define fIO         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define tr(it, a)   for(auto it = a.begin(); it != a.end(); it++)
#define clr(x)      memset(x, 0, sizeof(x))
#define debug(x)      cerr << #x << "=" << x << endl
#define debug2(x, y)  cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define TIME        cerr << "\nTime elapsed: "<<1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; 
//#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update>;

ll sub(ll a, ll b){return (a-b+hell)%hell;}
ll add(ll a, ll b){return (a+b)%hell;}
ll mul(ll a, ll b){return (a*b)%hell;}
/*vector<ll>adj[100005];
bool vis[100005];
ll siz,edges;
void dfs(ll i)
{
    vis[i]=1;
    //siz++;
    for(ll j=0;j<adj[i].size();j++)
    {        
        edges++;
        if(!vis[adj[i][j]])
            dfs(adj[i][j]);
    }
}
ll mpow(ll base, ll exp) {
  base %= hell;
  ll result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % hell;
    base = ((ll)base * base) % hell;
    exp >>= 1;
  }
  return result;
}*/
int main()
{
fIO;
ll n,sum=0,t=1,m,ans=0;

//cin >> t;
while(t--){
  //string s;
  cin>>n;
  vi a(n+1);
  rep(i,1,n+1)cin>>a[i];
  mi m;
  m[a[1]+1]++;
  rep(i,2,n+1){
    if(i>a[i]){
      ans+=m[i-a[i]];
    }
    m[a[i]+i]++;
  }
  cout<<ans;













}
TIME;
    
}

Measured memory_bytes: 18332
n,y = map(int, input().split())
a = -1
b = -1
c = -1

for i in range(n+1):
    for j in range(n+1):
        k = n-i-j
        if k < 0:
            pass
        else:
            yy = 10000*i + 5000*j + 1000*k
            if yy == y:
                a = i
                b = j
                c = k
                break
print(a,b,c)

Measured memory_bytes: 3064
from operator import itemgetter

n, m = map(int, input().split())

# 区間の終端でソート
ab = sorted([tuple(map(int, input().split())) for i in range(m)], key=itemgetter(1))
# 前回除いた橋
removed = -1
ans = 0

for a, b in ab:
    # a が removed より大きい = まだ取り除いてない
    if a > removed:
        removed = b - 1
        ans += 1

print(ans)

Measured memory_bytes: 24724
//fifer a tak luboin
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <ctime>
#include <sstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <unordered_map>
#include <map>
#include <set>
 
#define ll long long
#define mp make_pair
#define pb push_back
#define s second
#define f first
#define endl "\n"
 
using namespace std; 
 
const ll inf = 1e14;
const int mod = 998244353;
const int N = (int)100100;
const double eps = 1e-10;                                     
const double pi = acos(-1.0);
int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

ll cost[N];
vector<int> g[N];
ll dp[1 << 12];
int main() { 
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); 
    // freopen("lshape.in", "r", stdin);
    // freopen("lshape.out", "w", stdout);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int x;
        cin >> cost[i] >> x;
        for (int j = 0; j < x; j++) {
            int xx;
            cin >> xx;
            g[i].pb(xx);
        }
    }

    for (int mask = 0; mask < (1 << 12); mask++) {
        dp[mask] = inf;
    }
    dp[0] = 0;

    for (int mask = 0; mask < (1 << n); mask++) {
        for (int i = 0; i < m; i++) {
            int nmask = mask;
            for (int j = 0; j < g[i].size(); j++) {
                if ((nmask & (1 << (g[i][j] - 1))) > 0) nmask -= (1 << (g[i][j] - 1)); 
            }
            dp[mask] = min(dp[mask], dp[nmask] + cost[i]);
        }
    }

    if (dp[(1 << n) - 1] == inf) cout << -1 << endl;
    else cout << dp[(1 << n) - 1] << endl;

    
    
       
    return 0;    
}


Measured memory_bytes: 2688
import java.io.*;

public class Main{
  public static void main(String[] args){
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    try{
      int count=0;
      String line;
      while((line=br.readLine())!=null){
          count=0;
          String[] input=line.split(" ");
          int n=Integer.parseInt(input[0]);
          int x=Integer.parseInt(input[1]);
          if(n==0 && x==0) break;
          for(int i=1;i<=n-2;i++){
            for(int j=i+1;j<=n-1;j++){
              for(int k=j+1;k<=n;k++){
                if(i+j+k==x) count++;
              }
            }
          }
          System.out.println(count);
      }
    }catch(IOException e){
      System.out.println(e);
    }
  }
}



Measured memory_bytes: 24604
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
int main(){
  int N;
  cin >> N;
  int ans=0;
  rep(i,N){
    int a;
    cin >> a;
    ans+=a;
  }
  cout << ans-N << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
   int a,b;
   cin>>a>>b;
   if(a<b){
      for(int i = 1 ; i <= b ; ++i)
      cout<<a;
      return 0;
   }
   else{
      for(int i = 1 ; i <= a ; ++i)
      cout<<b;
      return 0;
   }
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 100


int main(){
  int Sec[N],num,i,j,count=0;
  int temp=0,min=0;

  scanf("%d",&num);
  for(i=0;i<num;i++){
    scanf("%d",&Sec[i]);
  }

  for(i=0;i<num-1;i++){
    min=i;
    for(j=i;j<num;j++){
      if(Sec[j]<Sec[min]){
	min=j;
      }
    }
    temp=Sec[i];
    Sec[i]=Sec[min];
    Sec[min]=temp;
    if(i!=min)count++;
  }
  
  for(i=0;i<num-1;i++){
    printf("%d ",Sec[i]);
  }

  printf("%d\n%d\n",Sec[num-1],count);
  return 0;
}



Measured memory_bytes: 2080
defmodule Main do
  def main do
    IO.gets("")
    |> String.trim()
    |> String.to_integer()
    |> get_mod()
    |> IO.puts()
  end
 
  def get_mod(m) do
    d = rem(m, 1000)
    cond do
      d > 0 -> 1000 - d
      true -> 0
    end
  end
end

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


// Author: @devangs
int main() 
{
int n;
cin>>n;

int a[n][2];
int i=0,j=0;

for (i=0; i<n; ++i)
cin>>a[i][0]>>a[i][1];

bool ans=false;

for (i=0; i<n-2; i++)
if (a[i][0]==a[i][1] && a[i+1][0]==a[i+1][1] && a[i+2][0]==a[i+2][1])
ans=true;

if (ans)
cout<<"Yes";

else
cout<<"No";
}


Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String str = sc.next();

		int count = 0;

		for(int i = 0; i < 3; i++) {


				if(count > 0) {
					if(str.charAt(i) == 'R') {
						if(str.charAt(i-1) == 'R') {
							count++;
						}
					}



			} else {
				if(str.charAt(i) == 'R') {
					count++;
				}
			}

		}
		System.out.println(count);

	}

}

Measured memory_bytes: 35516
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 20 12:35:48 2017

"""
 
from collections import Counter

NKList = list(map(int,input().split()))
N = NKList[0]
K = NKList[1]

AList = list(map(int,input().split()))

countDict = Counter(AList)
soretedList = sorted(countDict.values())

l = len(soretedList)

if len(soretedList) <= K :
    print(0)
else:
    print(N - sum(soretedList[l-K:] ))

Measured memory_bytes: 32564
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
    int a;
    double h, l;
    int cnt = 0;
    while(~scanf("%d,%lf,%lf", &a, &h, &l)){
	if(h >= 25 * l * l){
	    printf("%d\n", a);
	    cnt++;
	}
    }
    if(cnt == 0){
	puts("該当なし");
    }
    return 0;
}

Measured memory_bytes: 1056
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  string S;
  cin >> S;
  
  vector<string> A(8);
  A = {"A","SUN","MON","TUE","WED","THU","FRI","SAT"};
  for( int i = 1; i <= 7; i++ ){
    if( S == A.at(i) ) cout << 8-i << endl;
  }
      
}


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

int main() {
  int count;
  cin >> count;
  count--;
  vector<long long> a(count + 1);
  vector<long long> b(count);
  long long t = 0;
  
  for(int i=0; i<count; i++){
    cin >> b.at(i);
  }
  
  for(int i=0; i<count+1 ; i++){
    //cout << b.at(i) << endl;
    if(i==0) { //最初の１つ
      t = t + b.at(i);
    } else if (i == count) { // 最後の１つ
      t = t + b.at(i-1);
    } else {//　それ以外
      //cout << "b.at(i):" << b.at(i) << "b.at(i-1):" << b.at(i-1) << endl;
      //cout << min(b.at(i), b.at(i-1));
       t = t + min({ b.at(i), b.at(i-1) });
    }
  }
  cout << t << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <string>
using namespace std;
#define FL(i,a,b) for(int i = a;i<b;i++)
typedef vector<int> vi;
typedef long long int lli;
const int inf = numeric_limits<int>::max();




int main(){
    int k,a,b;
    cin>>k>>a>>b;
    string ans = "NG";
    for(int i = a;i<=b;i++){
        if(i%k==0){
            ans = "OK";
            break;
        }
    }
    cout<<ans;
    
}




Measured memory_bytes: 3628
import sys


class Node:
    __slots__ = ['key', 'left', 'right']

    def __init__(self, key):
        self.key = key
        self.left = self.right = None


root = None


def insert(key):
    global root
    x, y = root, None
    while x:
        y = x
        if key < x.key:
            x= x.left
        else:
            x = x.right

    if y is None:
        root = Node(key)
    elif key < y.key:
        y.left = Node(key)
    else:
        y.right = Node(key)


def inorder(node):
    return inorder(node.left) + f' {node.key}' + inorder(node.right) if node else ''


def preorder(node):
    return f' {node.key}' + preorder(node.left) + preorder(node.right) if node else ''


input()
for e in sys.stdin:
    if e[0] == 'i':
        insert(int(e[7:]))
    else:
        print(inorder(root)); print(preorder(root))


Measured memory_bytes: 63540
#include<iostream>
#include<cmath>
#include<vector>
#include<queue>
#include<algorithm>
#include <stack>
#include<set>
#include<cstring>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <string.h>
#include<iterator>
#include <map>
using namespace std;
bool cmp(long long a, long long b){
    return a > b;
}
int gcd(int a, int b) {
    int t;
    while (b != 0) {
        t = b;
        b = a % b;
        a = t;
    }
    return a;
}
long long levels[100500];
void dfs(long long current, long long prev, set<long long>* sets){
    for (auto it:sets[current]){
        if (prev != it){
            levels[it] = levels[current] + 1;
            dfs(it, current, sets);
        }
    }
}

long long st[10], fin[10];
int matr[25][25], saved_matr[5][5], ish_matr[5][5];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    long long t, ch, i, curr, p = 1, x, y, weight, j, k = 0, n, m = 1, ch1, ans = 0;
    long long a, b;
    int fl, fl1, fl2, fl3;
    string s;
//    cin >> t;
    long long f, size_f, size_s, weight1, weight2;
    long long sum, k_min, k_max, s1;
    long long da, db;
//    for (auto test_case = 0; test_case < t; test_case++) {
//    }
    cin >> x;
    cout << 1 - x;
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
void rd(long long &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
void wt_L(long long x){
  char f[20];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
long long A[100010], N, ans[100010];
int main(){
  int i, left, stk;
  pair<int, int> last;
  vector<pair<int, int>> pq;
  rd(N);
  {
    int PiIOrLma;
    for(PiIOrLma=0;PiIOrLma<N;PiIOrLma++){
      rd(A[PiIOrLma]);
    }
  }
  pq.reserve(N);
  for(i=0;i<N;i++){
    pq.emplace_back(A[i], i);
  }
  pq.emplace_back(0, 0);
  sort(pq.begin(), pq.end());
  reverse(pq.begin(), pq.end());
  stk = 0;
  left = pq[0].second;
  for(i=0;i<N;i++){
    left =min_L(left, pq[i].second);
    ans[left] += (long long)(i+1)*(pq[i].first - pq[i+1].first);
  }
  {
    int FJNsjZ7B;
    for(FJNsjZ7B=0;FJNsjZ7B<N;FJNsjZ7B++){
      wt_L(ans[FJNsjZ7B]);
      putchar_unlocked('\n');
    }
  }
  return 0;
}
// cLay varsion 20180208-1

// --- original code ---
// ll N;
// ll A[100010];
// ll ans[100010];
// 
// {
//     vector<pair<int, int>> pq;
//     pair<int, int> last;
//     int stk, left;
//     
//     rd(N, A(N));
//     pq.reserve(N);
//     REP(i, N) pq.emplace_back(A[i], i);
//     pq.emplace_back(0, 0);
//     sort(pq.begin(), pq.end()); // greater...
//     reverse(pq.begin(), pq.end());
//     
//     stk = 0;
//     left = pq[0].second;
//     
//     REP(i, N) {
//         left = min(left, pq[i].second);
//         ans[left] += (ll)(i+1)*(pq[i].first - pq[i+1].first);
//     }
//     
//     wtLn(ans(N));
// }

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

int main() {
  string s; cin>>s;
  for(int i=1;i<s.size();i++) {
    if(s[i]==s[i-1]) {
      cout<<"Bad"<<endl;
      return 0;
    }
  }
  cout<<"Good";
}

Measured memory_bytes: 3612
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;

class Scanner
{
    private string[] Line;
    private int Index;

    public Scanner()
    {
        Line = new string[0];
        Index = 0;
    }

    public string Next()
    {
        if (Index >= Line.Length)
        {
            Line = Console.ReadLine().Split(' ');
            Index = 0;
        }
        var ret = Line[Index];
        Index++;
        return ret;

    }

    public int NextInt()
    {
        return int.Parse(Next());
    }
}

struct S
{
    public int Num, Sum;

    public S(int num, int sum)
    {
        this.Num = num;
        this.Sum = sum;
    }
}

class Program
{
    private int N, M;

    private void Scan()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        M = sc.NextInt();
    }

    public void Solve()
    {
        Scan();
        int time = M * 1900 + (N - M) * 100;
        int t = 1;
        for (int i = 0; i < M; i++)
        {
            t *= 2;
        }
        Console.WriteLine((long)t * time);
    }

    static public void Main()
    {
        new Program().Solve();
    }
}

Measured memory_bytes: 11092
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int main(){
  int a,b,c,n,m,x,s=0;
  scanf("%d %d %d %d %d",&a,&b,&c,&n,&m);
  if(a+b>c*2){
    x=MIN(n,m);
    s+=x*c*2;
    n-=x;
    m-=x;
  }
  s+=MIN(a*n+b*m,(n+m)*c*2);
  printf("%d\n",s);
  return 0;
}


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



int main() {


    int n;
    cin>>n;

    int a[n+1];
    int b[n];

    for(int i=0;i<n+1;++i)
        cin>>a[i];

    for(int i=0;i<n;++i)
        cin>>b[i];
    ll sum = 0;
    for(int i=0;i<n;++i){
        if(a[i]>b[i])
        {
            sum+=b[i];
           // a[i] = a[i] - b[i];
        }
        else{
            sum+= a[i];
            b[i]-=a[i];
            if(a[i+1]>b[i]){
                sum+=b[i];
                a[i+1]-=b[i];
            }
            else{
                    sum+=a[i+1];
                a[i+1] = 0;

            }
        }
    }

    cout<<sum;




      return 0;
      }


Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String S = sc.next();
    char[]ss = S.toCharArray();
    ArrayList<Integer>ans  = new ArrayList<>();
    
    int all = 0;
    for(int i=0; i<n; i++) {
    	if(ss[i] == 'I' ) {    
    		all += 1;
    	}else {
    		all += -1;
    	}
    	ans.add(all);
    	Collections.sort(ans,Collections.reverseOrder());	
    	}
    System.out.println(Math.max(0, (ans.get(0))));
      }
}

Measured memory_bytes: 35688
using System;

namespace AtCoder.ABC102
{
    public class A
    {
        public static void Solve()
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);

            var val = 0;
            if (a % 2 == 0)
            {
                val = a;
            }
            else
            {
                val = a * 2;
            }
            
            Console.WriteLine(val);
        }    
    }
}

namespace AtCoder {
    class Program
    {
        static void Main(string[] args)
        {
            ABC102.A.Solve();
        }
    }
}


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

public class Main {

	public static void main(String[] args) {
		OriginScanner os = new OriginScanner();
		PrintWriter pw = new PrintWriter(System.out);
		
		int a = os.nextInt();
		int b = os.nextInt();
		
		int c = Math.max((a + b), (a - b));
		int d = Math.max(c, (a * b));
		
		pw.println(d);
		pw.close();
	}
	
	static class OriginScanner {
		private BufferedReader br;
		private StringTokenizer st;
		
		public OriginScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String nextLine() {
			String str = null;
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				System.out.println(e);
			}
			return str;
		}
		String next() {
			if (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(nextLine());
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}

Measured memory_bytes: 20564
a, b, c, d = map(int, input().split())
if a % d != 0:
  tk = a // d + 1
else:
  tk = a // d

if c % b != 0:
  ao = c // b + 1
else:
  ao = c // b

if ao <= tk:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9176
N = int(input())

arr=[1]*N

s = ['' for i in range(N)]

if(N==1):
    print("a")
    exit()

def num2alpha(num):
    return chr(num+97)

def dfs(k,c):
    if(k==N):
        print("".join(s))
        return
    for i in range(c):
        s[k]=num2alpha(i)
        dfs(k+1,c)
    s[k]=num2alpha(c)
    dfs(k+1,c+1)

dfs(0,0)


Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int a[MAXN], b[MAXN];
int main()
{
	int n;
	cin >> n;
	long long ans = 0;
	for (int i = 1; i <= n + 1; i++)cin >> a[i];
	for (int i = 1; i <= n; i++)cin >> b[i];
	for (int i = 1; i <= n; i++)
	{
		if (a[i] > b[i])
		{
			ans += b[i];
			a[i] -= b[i];
			b[i] = 0;
		}
		if (a[i] <= b[i])
		{
			ans += a[i];
			b[i] -= a[i];
			a[i] = 0;
		}
		if (a[i + 1] > b[i])
		{
			ans += b[i];
			a[i + 1] -= b[i];
			b[i] = 0;
		}
		if (a[i + 1] <= b[i])
		{
			ans += a[i + 1];
			b[i] -= a[i + 1];
			a[i + 1] = 0;
		}	
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s[0]=='R'&&s[1]=='R'&&s[2]=='R'){
    cout << 3 << endl;
  }
  else if(s[0]=='R'&&s[1]=='R'){
    cout << 2 << endl;
  }
  else if(s[1]=='R'&&s[2]=='R'){
    cout << 2 << endl;
  }
  else if(s[0]=='R'||s[1]=='R'||s[2]=='R'){
    cout << 1 << endl;
  }
  else{
    cout << 0 << endl;
  }
}

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

int main(){
   string S, T;
   cin >> S >> T;
   string temp;
   temp = T.substr(0, S.size());
   //cout << T.size() << endl;
   //cout << temp << endl;
   if (temp == S)
      cout << "Yes" << endl;
   else
      cout << "No" << endl;
}



Measured memory_bytes: 3624
#include<cstdio>
#include<vector>
using namespace std;

const int N_MAX = 100005;
int color[N_MAX];
vector<pair<int, int>> edge[N_MAX];

void dfs(int k){
    vector<pair<int, int>>::iterator it;
    for(it = edge[k].begin(); it != edge[k].end(); it++){
        int u = it->first;
        int w = it->second;
        if (color[u] < 0){
            color[u] = (color[k] + w) % 2;
            dfs(u);
        }
    }
}

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

    for(int i = 0; i < n - 1; i++){
        int u, v, w;
        scanf("%d %d %d", &u, &v, &w);
        edge[u].push_back(make_pair(v, w));
        edge[v].push_back(make_pair(u, w));
    }

    for(int i = 1; i <= n; i++) color[i] = -1;

    color[1] = 0;
    dfs(1);

    for(int i = 1; i <= n; i++){
        printf("%d\n", color[i]);
    }
    return 0;
}

Measured memory_bytes: 7552
#include <bits/stdc++.h>
using namespace std;
#define repx(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
int d[2020][50];

int main(){
    
    // 1. N, K の 条件.
    // -> ある1枚の紙に着目した場合に, この紙に書かれている K個 の 整数を, 
    // 残りの (N - 1)枚 の 紙に振り分ける必要があるので, 
    // N - 1 = K * (K - 1) となっている必要があるはず.
    // ex.
    // N = 3, K = 2
    // 1 2
    // 2 3
    // 3 1
    // 
    // N = 7, K = 3
    // 1 2 3
    // 1 4 5
    // 1 6 7
    // 2 4 7
    // 2 5 6
    // 3 4 6
    // 3 5 7
    // 
    // N = 13, K = 4
    // 1 2 3 4
    // 1 5 6 7
    // 1 8 9 10
    // 1 11 12 13
    // 2 5 8 11
    // 2 6 9 12
    // 2 7 10 13
    // 3 5 10 12
    // 3 6 8 13
    // 3 7 9 11
    // 4 5 9 13
    // 4 6 10 11
    // 4 7 8 12
    // 
    // int N = 3, K = 2;
    // int N = 7, K = 3;
    // int N = 13, K = 4;
    // int N = 21, K = 5;
    // int N = 1057, K = 33; // WA版.
    int N = 1407, K = 38;
    
    // 2. 条件を満たす整数を保存.
    // 2-1. 0列目 を 整備.
    d[0][0] = 1;
    repx(i, 1, N){
        if(i < K) d[i][0] = 1;
        else      d[i][0] = d[i - K + 1][0] + 1;
    }
    
    // 2-2. セル(0, 1) ～ セル(K - 1, K - 1) を 整備.
    rep(i, K) repx(j, 1, K) d[i][j] = (K - 1) * i + j + 1;
    
    // 2-3. セル(K, 1) ～ セル(N - 1, K - 1) を 整備.
    int r, c;
    repx(i, K, N){
        repx(j, 1, K){
            // 開始地点を調整.
            c = i - (K - 1) * (d[i][0] - 1);
            c -= (j - 1) * (d[i][0] - 2);
            while(c < 1) c += (K - 1);
            d[i][j] = d[j][c];
        }
    }
    
    // 3. 出力.
    printf("%d %d\n", N, K);
    rep(i, N){
        rep(j, K){
            printf("%d", d[i][j]);
            if(j < K - 1) printf(" ");
        }
        printf("\n");
    }
    return 0;
    
}

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

int n,q;
vector<int> fenwick;;

void init() {
    fenwick.assign(n+2, 0);
}

void adjust(int idx, int v) {
    idx++;
    while(idx<=n) {
        fenwick[idx] += v;
        idx += (idx&-idx);
    }
}

int query(int idx) {
    idx++;
    int res = 0;
    while(idx>0) {
        res += fenwick[idx];
        idx -= (idx&-idx);
    }
    return res;
}

int rsq(int low, int high) {
//    cout << low << ";" << high << ":"<<query(high) - query(low-1) << endl;
    return query(high) - query(low-1);
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    cin >> n >> q;
    init();
    vector<int> vals(n);
    for(int i=0;i<n;i++) cin >> vals[i];
    vector<vector<int>> queries;
    int l,r;
    auto cmp = [](auto a, auto b) {
        return a[1] < b[1];
    };
    for(int i=0;i<q;i++) {
        cin >> l >> r;l--;r--;
        queries.push_back({l,r,i});
    }
    sort(queries.begin(), queries.end(), cmp);
    vector<int> res(q), lastseen(n+1,-1);
    int j = 0;
    for(int i=0;i<n;i++) {
        int v = vals[i];
        if(lastseen[v] != -1) adjust(lastseen[v], -1);
        lastseen[v] = i;
        adjust(i, 1);
        while(j<q && queries[j][1] == i) {
            int idx = queries[j][2];
//            cout << "test idx" << idx << endl;
            res[idx] = rsq(queries[j][0], queries[j][1]);
            j++;
        }
    }
    for(int i=0;i<q;i++) cout << res[i] << "\n";
}


Measured memory_bytes: 38924
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

string convert(string in)
{
    vector<char> alphabets;
    vector<bool> alphabetsExist(26, false);
    for (int i = 0; i < in.size(); i++) 
    {
        if (false == alphabetsExist[in[i] - 'a'])
        {
            alphabets.emplace_back(in[i]);
        }
        alphabetsExist[in[i] - 'a'] = true;
    }

    vector<char> charToChar(26);
    for (int i = 0; i < alphabets.size(); i++)
    {
        charToChar[alphabets[i] - 'a'] = 'a' + i;
    }

    for (int i = 0; i < in.size(); i++)
    {
        in[i] = charToChar[in[i] - 'a'];
    }

    return in;
}
map<string, bool> stringExist;
int N;
void dfs(string in)
{
    string convertedStr = convert(in);
    if (true == stringExist[convertedStr])
    {
        return;
    }

    stringExist[convertedStr] = true;

    if (N == convertedStr.size())
    {
        cout << convertedStr << endl;
        return;
    }

    for (char i = 'a'; i <= 'z'; i++)
    {
        string newString = convertedStr + i;
        dfs(newString);
    }
}

int main(void) 
{
    
    cin >> N;
    
    dfs("");
    return 0;
}

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

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

    ll l[n];
    rep(i, n){
        cin >> l[i];
    }

    sort(l, l + n);

    ll count = 0;
    for(int i = 0; i < n - 2; i++){
        for(int j = i + 1; j < n - 1; j++){
            for(int k = n - 1; k > j; k--){
                if(l[i] + l[j] > l[k]){
                    count += k - j;
                    break;
                }
            }
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>
#include <omp.h>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;

const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 
//const long long int pl=1000000;

long long int M;
int main(){

    cout << fixed << setprecision(18);
    cin>>M;
    cout<<48-M<<endl;
}



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

int main() {
  
  int S;
  cin >> S;
  
  int s1, s2, s3;
  s1 = S / 100;
  s2 = (S - s1 * 100) / 10; 
  s3 = S - (s1 * 100 + s2 * 10);
  
  cout << s1 + s2 + s3 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;
    int len = s.size();

    int cnt = 0;
    for(int i = 0; i < len; i++){
        if(s[i] != t[i])
            cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}


Measured memory_bytes: 3900
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<30)
#define MOD 1000000007
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if (a <= 8 && b <= 8)cout << "Yay!" << endl;
    else cout << ":(" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <queue>
using namespace std;

int upb(int n)
{
  int ret=0;
  while(n>0) ret++, n/=2;
  return ret;
}

int main()
{
  vector<bool> close(1<<(5*5), false);

  for (int n; cin>>n, !(n==0); ){

    vector<vector<int> > pats(n*n+1);
    vector<vector<int> > tmp(n, vector<int>(n, 0));
    for (int i=0; i<n; i++){
      for (int j=0; j<n; j++){
	for (int k=i; k<n; k++){
	  for (int l=j; l<n; l++){
	    for (int a=i; a<=k; a++)
	      for (int b=j; b<=l; b++)
		tmp[a][b]=1;
	    int bd=0;
	    for (int a=0; a<n; a++){
	      for (int b=0; b<n; b++){
		bd=(bd<<1)|tmp[a][b];
	      }
	    }
	    pats[upb(bd)].push_back(bd);
	    for (int a=i; a<=k; a++)
	      for (int b=j; b<=l; b++)
		tmp[a][b]=0;
	  }
	}
      }
    }

    int bd=0;
    for (int i=0; i<n; i++){
      for (int j=0; j<n; j++){
	int t; cin>>t;
	bd=(bd<<1)|t;
      }
    }

    fill(close.begin(), close.begin()+(1<<(n*n)), false);
    /*
    for (int i=0; i<(n*n); i++)
      close[i]=false;
    */

    queue<pair<int, int> > mm;
    mm.push(make_pair(0, bd));
    close[bd]=true;
    while(!mm.empty()){
      int dep=mm.front().first;
      int cbd=mm.front().second;
      mm.pop();
      //cout<<cbd<<endl;
      int ub=upb(cbd);
      for (int i=0; i<pats[ub].size(); i++){
	int nbd=cbd^pats[ub][i];
	if (nbd==0){
	  for (int i=0; i<=dep; i++)
	    cout<<"myon";
	  cout<<endl;
	  goto _exit;
	}
	//cout<<"*** "<<nbd<<endl;
	if (close[nbd]) continue;
	close[nbd]=true;
	mm.push(make_pair(dep+1, nbd));
      }
    }
  _exit:;
  }
  return 0;
}

Measured memory_bytes: 5848
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main
{
    public static void main(String[] args)throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//        Scanner input = new Scanner(System.in);
        int n = Integer.parseInt(br.readLine());
        int i,a,b,c;
        int []color = new int[n+1];
        Set<Integer> done = new HashSet<>();
        for(i=1;i<n+1;i++){
            color[i] = 0;
    }
        EvenRataion []mark = new EvenRataion[n+1];
        for(i=1;i<n+1;i++){
            mark[i] = new EvenRataion();
        }
        for(i=0;i<n-1;i++){
            String[] in = br.readLine().split(" ");
            a = Integer.parseInt(in[0]);
            b = Integer.parseInt(in[1]);
            c = Integer.parseInt(in[2]);
            if (c%2==0){
                mark[a].even.add(b);
                mark[b].even.add(a);
            }
            else {
                mark[a].odd.add(b);
                mark[b].odd.add(a);
            }
        }
        List<Integer> run = new ArrayList<>();
        run.add(1);
        List<Integer> temp = new ArrayList<>();
        while (run.size()>0){
            int y = run.get(0);
            run.remove(0);
            done.add(y);
            if (color[y]==0){
                for(int v:mark[y].odd){
                    if(!done.contains(v)){
                        run.add(v);
                        color[v] = 1;
                        temp.add(v);
                    }
                }
                for(int v:mark[y].even){
                    if(!done.contains(v)){
                        temp.add(v);
                    }
                }
            }
            else{
                for(int v:mark[y].even){
                    if(!done.contains(v)){
                        run.add(v);
                        color[v] = 1;
                        temp.add(v);
                    }
                }
                for(int v:mark[y].odd){
                    if(!done.contains(v)){
                        temp.add(v);
                    }
                }

            }
            if(run.size()==0){
                run.addAll(temp);
                temp.clear();
            }
        }
        for(i=1;i<n+1;i++){
            System.out.println(color[i]);
    }
    }
    static class EvenRataion{
        Set<Integer> even = new HashSet<>();
        Set<Integer> odd = new HashSet<>();

    }
}

Measured memory_bytes: 120052