akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<set>
#define ll long long
#include<map>
#define N 100010
#define pr(x) cerr<<#x<<"="<<x<<endl
#define mp(a,b) make_pair(a,b)
#define se second
using namespace std;
int x1,x2,y1,y2,n,m,k,i,t,st[N];
pair <int,int> s1[N],s2[N],s3[N],s4[N];
void add(int x)
{
	if (t<0) while(1);
	if (st[t]==x)t--;
	else st[++t]=x;
}
bool pan()
{
	if ((x1==0||x1==n|y1==0||y1==m)&&(x2==0||x2==n||y2==0||y2==m))
	return true;
	else return false;
}
int main ()
{
	scanf("%d%d%d",&n,&m,&k);
	for (i=1;i<=k;i++)
	{
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		if (pan())
		{
			if (x1==0&&y1!=0) s1[++s1[0].se]=mp(y1,i);
			if (y1==0&&x1!=n) s2[++s2[0].se]=mp(x1,i);
			if (x1==n&&y1!=m) s3[++s3[0].se]=mp(y1,i);
			if (y1==m&&x1!=0) s4[++s4[0].se]=mp(x1,i);
			
			if (x2==0&&y2!=0) s1[++s1[0].se]=mp(y2,i);
			if (y2==0&&x2!=n) s2[++s2[0].se]=mp(x2,i);
			if (x2==n&&y2!=m) s3[++s3[0].se]=mp(y2,i);
			if (y2==m&&x2!=0) s4[++s4[0].se]=mp(x2,i);
		}
	}
	sort(s1+1,s1+1+s1[0].se);
	sort(s2+1,s2+1+s2[0].se);
	sort(s3+1,s3+1+s3[0].se);
	sort(s4+1,s4+1+s4[0].se);
	for (i=s1[0].se;i>=1;i--) add(s1[i].se);
	for (i=1;i<=s2[0].se;i++) add(s2[i].se);
	for (i=1;i<=s3[0].se;i++) add(s3[i].se);
	for (i=s4[0].se;i>=1;i--) add(s4[i].se);
	if (t==0)
	printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <algorithm>

int n[5];
int main() {
	for (int i = 0; i < 4; ++i)
		std::cin >> n[i];
	std::sort(n, n + 4);
	if (n[0] == 1 && n[1] == 4 && n[2] == 7 && n[3] == 9)
		std::cout << "YES" << std::endl;
	else
		std::cout << "NO" << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int N;
	cin>>N;
	vector<int> A(N);
	FDS(i,N){
		cin>>A[i];
	}
	int ans=A[0];
	FDS(i,N){
		ans=G_C_D(ans,A[i]);
	}
	cout<<ans<<endl;
}

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

int main(){
	int n,d,x;
  	cin>>n>>d>>x;
  	int ans=x;
  	for(int i=0;i<n;i++){
      	int p;
      	cin>>p;
      	ans+=(d-1)/p+1;
    }
  	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    while(s.hasNext()) {
      int n = s.nextInt();
      System.out.println(countCombination(n));
    }   
  }
  public static int countCombination(int n) {
    int count = 0;
    int sumOfIntegers = 0;
    for(int i = 0; i <= 9; i++) {
      for(int j = 0; j <= 9; j++) {
        for(int k = 0; k <= 9; k++) {
          for(int h = 0; h <= 9; h++) {
            sumOfIntegers = i + j + k + h;
            if (sumOfIntegers == n) {
              count++;
            }   
          }   
        }   
      }   
    }   
    return count;
  }
}

Measured memory_bytes: 19148
n = int(input())

dp = [1 for i in range(0,n+1)]
c = list()
c.append(-1)
d = {}
for i in range(1,n+1):
    c.append(int(input()))

for i in range(1,n+1):
    if c[i] in d:
        j = d[c[i]]
        d[c[i]] = i
        if c[i-1] != c[i]:
            dp[i] = dp[i-1]+dp[j]
            continue
    else:
        d[c[i]] = i
    dp[i] = dp[i-1]
print(dp[-1]%(10**9+7))

Measured memory_bytes: 760484
x = int(input())
ex = [0 for i in range(1001)]
ex[1] = 1

for i in range(2, 1001):
  tmp = i * i
  while tmp <= 1000:
    ex[tmp] = 1
    tmp *= i
  
for i in range(x, 0, -1):
  if ex[i] == 1:
    print(i)
    break
    

Measured memory_bytes: 9032
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back

#define ll long long


int n;
double a[11111];

int main(){
    cin>>n;
    rep(i,n)cin>>a[i];
    sort(a,a+n);
    double ans=(a[1]+a[0])/2.0;
    
    for(int i=2;i<n;i++){
        ans=(ans+a[i])/2.0f;
    }
    printf("%.10lf\n",ans);
	return 0;
}

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

#define ankit_2305 cerr<<"\nTime taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<" sec\n";
#define START clock_t
#define TIMER time_p=clock();
#define ll long long

#define MOD 1000000007

using namespace std;


int main(){
    START TIMER
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	int x;
	cin>>x;
	ll ans = 1000LL*(x/500);
	x %= 500;
	ans += 5*(x/5);
	cout<<ans;
    ankit_2305
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    string N;
    cin >> N;
    if (N[0] == '7' || N[1] == '7' || N[2] == '7') cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3624
using System;
using System.Collections.Generic;

namespace abc171
{
    class Program
    {
        static long max = 1000000000000001L;
        static void Main()
        {
            var n = long.Parse(Console.ReadLine()) - 1;
            var endList = CreateEndList();
            var len = 0;
            var offsetN = 0L;
            for (var i = 1; i < endList.Count; ++i)
            {
                if (n < endList[i])
                {
                    len = i;
                    offsetN = n - endList[i - 1];
                    break;
                }
            }
            var name = new List<char>();
            for (var l = 0; l < len; ++l)
            {
                name.Add((char)((offsetN % 26) + 'a'));
                offsetN /= 26;
            }
            name.Reverse();
            Console.WriteLine(string.Concat(name));
        }
        static List<long> CreateEndList()
        {
            var endList = new List<long>();
            endList.Add(0L);
            var last = 0L;
            var count = 1;
            while(last < max)
            {
                var sameLenCount = 26L;
                for (var i = 1; i < count; ++i)
                {
                    sameLenCount *= 26L;
                }
                sameLenCount += last;
                endList.Add(sameLenCount);
                last = sameLenCount;
                ++count;
            }
            return endList; 
        }
    }
}


Measured memory_bytes: 27948
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
 
int main () {
  int N, M;
  cin >> N >> M;
  int s;
  vector<vector<int>> vec(M, vector<int>(N));
  vector<int> k(M);
  vector<int> p(M);
  rep(i, M){
    cin >> k[i];
    rep(j,k[i]){
      cin >> s;
      vec[i][s-1] = 1;
    }
  }

  rep(i,M) cin >> p[i];

 
  int ans = 0;
  // すべての選び方を試して調べる
  for (int tmp = 0; tmp < (1 << N); tmp++) {
    bitset<10> s(tmp);  // 最大10個なので20ビットのビット列として扱う
    int all = 0;
    rep(i, M){
      int sw = 0;
      rep(j,N){
        if( !(s.test(j)) || vec[i][j] != 1) continue;
        else if(s.test(j) && vec[i][j] == 1) sw++;
      }
      if((sw%2) == p[i]) all++;
    }
    if(all == M){
      ans++;
    }
  }

  cout << ans << endl;

  return 0;

}

Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define N 200100
int c[510],s[510],f[510],out[510];
int dp[2][N+10];
int main()
{
	int n;
	cin>>n;
	rep(i,n-1) cin>>c[i]>>s[i]>>f[i];
	for(int i=n-2;i>=0;i--){
		int now=i%2,ne=1-now;
		dp[now][N]=0;
		for(int j=N-1;j>=0;j--){
			dp[now][j]=dp[now][j+1]+1;
			if(j>=s[i] && j%f[i]==0) dp[now][j]=min(dp[now][j],dp[ne][j+c[i]]+c[i]);
		}
		out[i]=dp[now][0];
	}
	rep(i,n-1) cout<<out[i]<<endl;cout<<0<<endl;
}


Measured memory_bytes: 1792
mod=1000000007
def mi(a,m)
  b,u,v=m,1,0
  while b>0
    t=a/b
    a-=t*b
    u-=t*v
    a,b,u,v=b,a,v,u
  end
  u%=m
  u+=m if u<0
  return u
end
n,k=gets.split.map(&:to_i)
x=gets.split.map(&:to_i).sort
l=[]
(n-1).times do |i|
  l << x[i+1]-x[i]
end
s=l.sum
if k==1
  puts 0
  exit
end
a=0
b=0
bb=s
c=1
(n-1).times do |i|
  if i==0
    b=bb
  elsif i<n/2
    bb-=(l[i-1]+l[-i])
    b+=bb
  elsif i==n/2
    if n.odd?
#      bb+=(l[i]+l[-i-1])
    else
      b-=bb
      bb+=(l[i]+l[-i-1])
    end
  elsif i==n-2
    b=s
  else
    b-=bb
    bb+=(l[i]+l[-i-1])
  end
  if k==2
    a=(a+b)%mod
  else
    if i==k-2
      a=b%mod
    elsif i>k-2
      c=c*i%mod*mi(i-(k-2),mod)
      a=(a+b*(c%mod))%mod
    end
  end
end
puts a


Measured memory_bytes: 23324
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define ii pair<int,int>
#define vii vector<ii>
#define vi vector<int>

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

void solve(){
	int n,k; string s; cin >> n >> k >> s;
	--k;
	s[k] = tolower(s[k]);
	cout << s;
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s=="SUN"){
    cout<<"7";
  }
  if(s=="MON"){
    cout<<"6";
  }
  if(s=="TUE"){
    cout<<"5";
  }
  if(s=="WED"){
    cout<<"4";
  }
  if(s=="THU"){
    cout<<"3";
  }
  if(s=="FRI"){
    cout<<"2";
  }
  if(s=="SAT"){
    cout<<"1";
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
#include <deque>

using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;
typedef map<int,int> mint;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef deque<pair<ll,ll>> dep;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int inf=1e9+1000;
const int mod=1e9+7;
ll infi=1e18+100;


int N;
int a[105];

int main(){
	cin>>N;
	Rep(i,N) cin>>a[i];
	int ma=0;
	int mi=0;
	bool f=true;
	Rep(i,N){
		if(a[i]<3200){
		f=false;
		}
	}
	if(f){
		ma=N;
		mi=1;
	}
	else{
		Rep(i,N){
			if(a[i]>0&&a[i]<3200){
				ma++;
				mi++;
				for(int j=i+1;j<=N;j++){
					if((a[i]/400)==(a[j]/400)){
						a[j]=-1;
					}
				}
			}
			else if(a[i]>=3200){
				ma++;
			}
		}
	}
	cout<<mi<<" "<<ma<<endl;

	  return 0;
  }

Measured memory_bytes: 256
'''
問題文
あなたはコンピュータで試験を受けています。試験は N 問の問題からなり、i 問目の問題の配点は si です。それぞれの問題に対するあなたの解答は「正解」または「不正解」のいずれかとして判定され、正解した問題の配点の合計があなたの成績となります。あなたが解答を終えると、解答がその場で採点されて成績が表示される…はずでした。

ところが、試験システムに欠陥があり、成績が 10 の倍数の場合は、画面上で成績が 0 と表示されてしまいます。それ以外の場合は、画面に正しい成績が表示されます。この状況で、成績として画面に表示されうる最大の値はいくつでしょうか？

制約
入力値はすべて整数である。
1≤N≤100
1≤si≤100
'''
import sys

A = int(input())
#b, c = map(int, input().split())
S = []
for i in range(A):
    S.append(int(input()))


S_sum = sum(S)
if S_sum % 10 != 0 or S_sum == 0:
    print(S_sum)
    sys.exit()
else:
    S_new = S
    S_new.sort()
    for i in S_new:
        if i % 10 != 0:
            print(S_sum - i)
            sys.exit()
    print(0)


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i = 0;i < N;i++)cin >> A[i];
  for(int i = 0;i <= N;i++){
    if(A[i] % 2 == 0){
      if(A[i] % 3 != 0 && A[i] % 5 != 0){
        cout << "DENIED" <<endl;
        return 0;
      }
    }
  }
  cout << "APPROVED" <<endl;
}

Measured memory_bytes: 3572
#include<stdio.h>
#define N 4

int rand(int x){
  int i,j,A[4],y=0;
  x=x*x;

  A[0]=x/100000%10;
  A[1]=x/10000%10;
  A[2]=x/1000%10;
  A[3]=x/100%10;

  y+=A[0]*1000;
  y+=A[1]*100;
  y+=A[2]*10;
  y+=A[3];
  return y;
}

int main(){

  int n,i,j,x,R[10];
  
  scanf("%d",&n);
    
    for(i=0;i<n;i++){
    scanf("%d",&x);
    for(j=0;j<10;j++){
      if(j==0){
      printf("Case %d:\n",i+1);
      }
      x=rand(x);
      printf("%d\n",x);
    }
  }
    return 0;
}

Measured memory_bytes: 588
#include<bits/stdc++.h>
using namespace std;
#define ioS            ios::sync_with_stdio(false);cin.tie(0);
#define li             long int
#define ll             long li
#define ull            unsigned ll
#define pi             pair<int,int>
#define vi             vector<int>
#define vli            vector<li>
#define vll           vector<ll>
#define vvi            vector<vector<int>>
#define pb             push_back
#define mp             make_pair
#define forn(i,s,n)    for(auto i=s;i<n;++i)               
#define forr(i,s,n)    for(auto i=s;i>=n;--i) 
const ll mx = 1e5;
void solve(int test)
{
    ll x,k,d;
    cin>>x>>k>>d;
    x = abs(x);
    if(x/d  >= k)
    {
        cout<<(x - k*d)<<endl;
    }
    else
    {
        ll f = x%d;
        ll s = d-x%d;
        k = k-x/d;
        // cout<<"k "<<k<<endl;
        if(k%2)
            cout<<s<<endl;
        else
            cout<<f<<endl;    
    }
    
}
int32_t main()
{
    ioS    
    int t;
    // cin>>t;
    // forn(i,1,t+1)
        solve(0);
}



Measured memory_bytes: 3648
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	n := readInt()
	a := readInt()
	x := make([]int, n+1)
	for i := 1; i <= n; i++ {
		x[i] = readInt()
	}

	dp := make([][][]int64, 51)
	for i := range dp {
		dp[i] = make([][]int64, 51)
		for j := range dp[i] {
			dp[i][j] = make([]int64, 2510)
		}
	}
	dp[0][0][0] = 1

	for i := 1; i <= n; i++ {
		for j := 0; j <= i; j++ {
			for k := 0; k <= 50*n; k++ {
				v := dp[i-1][j][k]
				if j > 0 && k >= x[i] {
					v += dp[i-1][j-1][k-x[i]]
				}
				dp[i][j][k] = v
			}
		}
	}

	var ans int64
	for i := 1; i <= n; i++ {
		ans += dp[n][i][i*a]
	}
	println(ans)

}

// -----------------------------------------------------------------------------


Measured memory_bytes: 34048
#include<stdio.h>

int main(){
 int N,i;
  scanf("%d",&N);
  long int S;
  S = 0;
  for(i=1;i<=N;i++){
    if(i % 3==0 || i % 5==0){
      S = S;
    } else {
      S = S+i;
    }
  }
  printf("%ld",S);
    
  
  return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
typedef long long int Int;
#define INF 999999999
using ll = long long;
using VI = vector<int>;
int gcd(Int a, Int b) {
 return b != 0 ? gcd(b, a % b) : a;
}
int lcm(Int a, Int b) {
 return a / gcd(a, b)*b;
}
int main(){
  string s;
  cin >> s;
  for(int i=0;i<s.size();i++){
    if(s[i]==','){
      cout << " ";
    }
  else cout << s[i];
  }
  cout << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var input1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = input1[0];
            var M = input1[1];
            var observatories = Console.ReadLine().Split().Select(h => new Observatory() { Height = int.Parse(h), Good = true }).ToArray();

            for (int i = 0; i < M; i++)
            {
                var input2 = Console.ReadLine().Split().Select(int.Parse).ToArray();
                var A = input2[0] - 1;
                var B = input2[1] - 1;

                if (observatories[A].Height < observatories[B].Height)
                {
                    observatories[A].Good = false;
                }
                else if (observatories[A].Height > observatories[B].Height)
                {
                    observatories[B].Good = false;
                }
                else
                {
                    observatories[A].Good = false;
                    observatories[B].Good = false;
                }
            }

            Console.WriteLine(observatories.Count(o => o.Good));
        }

        class Observatory
        {
            public int Height { get; set; }
            public bool Good { get; set; }
        }
    }
}


Measured memory_bytes: 52976
#include <atcoder/convolution>
#include <atcoder/modint>
#include <cstdio>

using namespace std;
using namespace atcoder;

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    vector<long long> a(n), b(m);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &(a[i]));
    }
    for (int i = 0; i < m; i++) {
        scanf("%lld", &(b[i]));
    }

    vector<long long> c = convolution(a, b);
    // or: vector<long long> c = convolution<998244353>(a, b);

    for (int i = 0; i < n + m - 1; i++) {
        printf("%lld ", c[i]);
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 27252
//============================================================================
// Name        : AOL.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
    int x;
    int i=1;
	while(1){
		 cin>>x;
		if( x==0)break;
		cout<<"Case"<<" "<<i<<":"<<" "<<x<<endl;
		++i;
	}
    return 0;
}

Measured memory_bytes: 3044
#include <stdio.h>

int main(){
	int a[4],b[4],hit,blow,i,j;
	while(1){
		hit = 0;
		blow = 0;
		if(scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3]) == EOF) break;
		scanf("%d%d%d%d",&b[0],&b[1],&b[2],&b[3]);
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if (a[i]==b[j]){
					if (j==i){
						hit += 1;
					}
					else blow += 1;
				}
			}
		}
		printf("%d %d\n",hit,blow);
	}
	return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using u64 = uint_fast64_t;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    for (int i = 1; i <= 5; i++) {
        int a; cin >> a;
        if (a==0) {
            cout << i << ln;
            return 0;
        }
    }

}

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

using namespace std;

typedef long long LL;

const int mod = 1000000007;

const int N = 100005;

int t[N], a[N], h[N];

inline int mul(int a, int b) {
    return LL(a) * b % mod;
}

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

    for (int i = 1; i <= n; i++) scanf("%d", t+i);
    for (int i = 1; i <= n; i++) scanf("%d", a+i);

    int ans = 1;

    for (int i = 1; i <= n; i++) {
        if (i == 1 || t[i] > t[i-1]) h[i] = t[i];
        else h[i] = -1;
    }

    int now = 0;
    for (int i = n; i >= 1; i--) {
        now = max(now, h[i]);
        if (now > a[i]) {
            ans = 0; break;
        }
    }

    if (ans > 0) {

        for (int i = n; i >= 1; i--) {
            if (i == n || a[i] > a[i+1]) h[i] = a[i];
            else h[i] = -1;
        }

        now = 0;
        for (int i = 1; i <= n; i++) {
            now = max(now, h[i]);
            if (now > t[i]) {
                ans = 0; break;
            }
        }

    }

    if (ans > 0)
    for (int i = 1; i <= n; i++) {
        if (i == 1 || min(a[i],t[i]) > min(a[i-1],t[i-1]) || (i == n) || min(a[i],t[i]) > min(a[i+1],t[i+1])) {

        }
        else {
            ans = mul(ans, min(a[i],t[i]));
        }
    }

    printf("%d", ans);

    return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>
int main()
{
    int a[100];
    int n,i,j,x,temp;
    while(scanf("%d",&n)!=EOF)
    {
        for(i=0; i<n; i++)
            scanf("%d",&a[i]);
        x=0;
        for(i=n-1; i>0; i--)
        {
            for(j=0; j<i; j++)
            {
                if(a[j]>a[j+1])
                {
                    temp=a[j];
                    a[j]=a[j+1];
                    a[j+1]=temp;
                    x++;
                }
            }
        }
        for(i=0; i<n-1; i++)
            printf("%d ",a[i]);
        printf("%d\n",a[n-1]);
        printf("%d\n",x);
    }
    return 0;
}



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

using namespace std;

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

using ll = long long;
using pint = pair<int, int>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	int len = v.size();
    s << '[';
	for (int i = 0; i < len; ++i) {
		s << v[i]; if (i < len-1) s << ", ";
	}
    s << ']';
	return s;
}

int main(){

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


	int n;
	cin >> n;
	string s;
	cin >> s;
	string t = s;
	bool ok = false;
	rep(i, n){
	    if(s[0] != s[i]) ok = true;
	}
	if(!ok){
		ppp(0);
		return 0;
	}



	int b[n+2] = {0};
	int w[n+2] = {0};

	for(int i = 0; i <= n; ++i){
		b[i+1] = ((s[i]=='#') ? 1 : 0) + b[i];
	}
	for(int i = n+1; i > 0; --i){
		w[i-1] = ((s[i]=='.') ? 1 : 0) + w[i];
	}

	int ans = INF;
	for(int i = 0; i < n+2; ++i){
		ans = min(ans, b[i]+w[i]);
	}

	ppp(ans);
    return 0;
}


Measured memory_bytes: 2324
N,M = map(int, input().split())
A = [0]*M
for i in range(M):
    A[i] = int(input())
if M != 0:
    
    L = A[0]+1
    if L < N - A[M-1]:
        L = N - A[M-1]
    for i in range(M-1):
        L1 = A[i+1]-A[i]
        if L1 > L:
            L = L1
else:
    L = N +2
    
x = [0]*L
x.insert(0,0)
x.insert(1,1)
if L >2:
    for i in range(L-2):
        x[i+2] = x[i+1] + x[i]
if M != 0:
    S = x[A[0]] * x[N - A[M-1]]
    for i in range(M-1):
        S *= x[A[i+1]-A[i]-1]
else:
    S = x[N+1]
print(S%1000000007)

Measured memory_bytes: 460020
#include <iostream>
#include<string>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int p=n;
    char s[n];
    int i;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(i=1;i<n;i++)
    {
        if(s[i]==s[i-1])
            p--;
    }
    cout<<p;

    return 0;
}


Measured memory_bytes: 384
n,k=map(int, input().split())
s=input()
ans=""
for i in range(len(s)):
    if i==k-1:
        if s[k-1]=="A":
            ans=ans+"a"
        elif s[k-1]=="B":
            ans=ans+"b"
        elif s[k-1]=="C":
            ans=ans+"c"
    else:
        ans=ans+s[i]
print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;

typedef long long LL;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

#define fast ios_base::sync_with_stdio(0),cin.tie(0)
#define temp template<typename T>
#define debug(x) cerr<<"Line "<<__LINE__<<": "<<#x<<" = "<<x<<'\n'
#define itr(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define rep(i,a,b) for(int i=a;i<=(int)b;i++)
#define repr(i,a,b) for(int i=a;i>=(int)b;i--)
#define cas(n) printf("Case %d:",(int)n)
#define mem(x,v) memset(x,v,sizeof(x))
#define read(x) freopen(x,"r",stdin)
#define write(x) freopen(x,"w",stdout)
#define all(x) x.begin(),x.end()
#define aut(x,v) for(auto &x:v)
#define ini(n) scanf("%d",&n)
#define inl(n) scanf("%lld",&n)
#define ind(n) scanf("%lf",&n)
#define ins(n) scanf("%s",n)
#define insn(n) scanf(" %[^\n]",n)
#define outi(n) printf("%d",(int)n)
#define outl(n) printf("%lld",(LL)n)
#define outd(n,p) printf("%.*lf",p,(double)n)
#define outs(n) printf("%s",n)
#define sz(x) (int)x.size()
#define nl printf("\n")
#define sp printf(" ")
#define pb push_back
#define mp make_pair
#define xx first
#define yy second

const int inf=0x3f3f3f3f;
const int mod=1000000007;
const int mx=100005;
const LL  infL=0xf3f3f3f3f3f3f3f;
const double eps=1e-9;
const double pi=acos(-1.0);

int main()
{
    //read("in.txt"),write("out.txt");
    LL cnt=0,ans=0;
    string x;
    cin>>x;
    rep(i,0,sz(x)-1)
    if(x[i]=='W')
    {
        ans+=(i-cnt);
        cnt++;
    }
    outl(ans),nl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

struct UnionFind {
private:
	vector<int> uf;
	size_t sz;

public:
	UnionFind(size_t Size) {
		uf.assign(Size, -1);
		sz = Size;
	}

	int find(int x) { return (uf[x] < 0) ? x : uf[x] = find(uf[x]); }
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -uf[find(x)]; }
	int size() { return sz; }

	void unite(int x, int y) {
		x = find(x), y = find(y);
		if (x == y) { return; }
		--sz;

		if (uf[y] < uf[x]) { swap(x, y); }
		uf[x] += uf[y];
		uf[y] = x;
	}
};

int main() {
	int N, M;
	cin >> N >> M;
	UnionFind uf(N);
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		uf.unite(a - 1, b - 1);
	}
	cout << uf.size() - 1 << "\n";

	return 0;
}


Measured memory_bytes: 3760
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;



#define yummy cout<<"delicious"<<endl;
#define safe cout<<"safe"<<endl;
#define danger cout<<"dangerous"<<endl;

int main(){
 
    LL a,x,b;
    cin>>x>>a>>b;
    if(a-b>=0){
        yummy;
    }
    else if(b-a<=x){
        safe;
    }
    else{
        danger;
    }
    





}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

template<class T> inline bool chmin(T &a,T b){
    if (a>b){a=b; return true;} return false;
}
template<class T> inline bool chmax(T &a,T b){
    if (a<b){a=b; return true;} return false;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    while(cin >> S){
        int ans1=0,ans2=0;
        rep(i,(int)S.size()-2){
            if (S[i]=='J'&&S[i+1]=='O'&&S[i+2]=='I') ++ans1;
            if (S[i]=='I'&&S[i+1]=='O'&&S[i+2]=='I') ++ans2;
        }
        cout << ans1 << endl;
        cout << ans2 << endl;
    }
}


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

#define BR "\n"
#define SP " "

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

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

  for (int i = N - 1; i > 0; i--) {
    cout << a[i] << SP;
  }
  cout << a[0] << BR;

  return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;

vector<bool> checked;
vector<int> d;
vector<int> p;

int main() {
    int N; cin >> N;
    vector<vector<int>> G(N, vector<int>(N));
    checked.assign(N, false);
    d.assign(N, MAX);
    p.resize(N);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> G[i][j];
        }
    }
    d[0] = 0;
    p[0] = -1;

    while (true) {
        int MIN = MAX;
        int u;
        for (int i = 0; i < N; i++) {
            if(!checked[i] && chmin(MIN, d[i])) u = i;
        }

        if (MIN == MAX) break;
        checked[u] = true;

        for (int v = 0; v < N; v++) {
            if (!checked[v] && G[u][v] != -1) {
                chmin(d[v], G[u][v]);
                p[v] = u;
            }
        }
    }

    int sum = 0;
    for (int i = 0; i < N; i++) {
        sum += d[i];
    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3192
#define _CRT_SECURE_NO_WARNINGS

#include<bits/stdc++.h>

using namespace std;

#define PI			3.14159265
#define OO			1e9
#define SS       	second
#define FF       	first
#define Trace(n)  	cout<< #n <<" = "<< n << endl; 
#define ll			long long
#define endl		"\n"
#define EPS		    1e-9
//#define MOD         1e9 + 7	    
int dx[] = { 0, 0, -1, 1, 1, 1, -1, -1 };
int dy[] = { -1, 1, 0, 0, 1, -1, 1, -1 };

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

int main()
{
	fast();
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++)
		cin >> v[i];

	bool ok = true;

	v[0]--;
	for (int i = 1; i < n; i++)
	{
		if (v[i] > v[i - 1])
			v[i]--;
	}

	for (int i = 1; i < n; i++)
	{
		if (v[i] < v[i - 1])
		{
			ok = false;
			break;
		}
	}

	if (ok)
		cout << "Yes";
	else
		cout << "No";
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
using namespace std;

int main(){
  int w,a,b;
  cin >> w >> a >> b;
  int diff = abs(a-b);
  int res = 0;
  if(diff>w){
    res = diff - w;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long int;
using namespace std;
int main() {
    fastIO;
    int n;
    cin >> n;

    for (int i = 0; i <= 15; i++) {
        for (int j = 0; j <= 25; j++) {
            if (n == i * 7 + j * 4) {
                cout << "Yes";
                return 0;
            }
        }
    }

    cout << "No";
    return 0;
}

Measured memory_bytes: 3616
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<vector>
typedef long long i64;
using namespace std;
const int wa=1e9+7;
const int nmax = 8;
bool graph[nmax][nmax];
int dfs(int v, int N, bool visited[nmax]) {
	bool all_visited = true;
	for (int i = 0; i < N; i++) {
		if (visited[i] == false)all_visited = false;
	}
	if (all_visited) {
		return 1;
	}
	int ret = 0;
	for (int i = 0; i < N; i++) {
		if (graph[v][i] == false) continue;
		if (visited[i])continue;
		visited[i] = true;
		ret += dfs(i, N, visited);
		visited[i] = false;
	}
	return ret;
}

int main(void) {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int A, B;
		cin >> A >> B;
		graph[A - 1][B - 1] = graph[B - 1][A - 1] = true;
	}
	bool visited[nmax];
	for (int i = 0; i < N; i++) {
		visited[i] = false;
	}
	visited[0] = true;
	cout << dfs(0, N, visited) << endl;

	return 0;
}



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

int main(){
	double n;
	while(cin>>n){
		if(n>91){
			cout<<"heavy"<<endl;
		}else if(n>81){
			cout<<"light heavy"<<endl;
		}else if(n>75){
			cout<<"middle"<<endl;
		}else if(n>69){
			cout<<"light middle"<<endl;
		}else if(n>64){
			cout<<"welter"<<endl;
		}else if(n>60){
			cout<<"light welter"<<endl;
		}else if(n>57){
			cout<<"light"<<endl;
		}else if(n>54){
			cout<<"feather"<<endl;
		}else if(n>51){
			cout<<"bantam"<<endl;
		}else if(n>48){
			cout<<"fly"<<endl;
		}else{
			cout<<"light fly"<<endl;
		}
	}
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
const ll INF = 1e10;
const ld eps = 1e-9, pi = acos(-1.0);
typedef pair<ll, ll> P;

int main(){
  ll N;
  cin >> N;
  set<ll> st;
  for(int i=0;i<N;i++){
    ll x;
    cin >> x;
    st.insert(x);
  }
  cout << st.size() << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 20) + 1;
	
	char buf[L], *S , *T, c;
	 
	char getchar() {
		if(S == T) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}
	
	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	char B[25], *outs=B+20, *outr=B+20;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;
		
		if(!a)*--outs = '0';
		else 
			while(a)
				*--outs = (a % 10) + 48, a /= 10;
		
		if(x)
			*--outs = x;
		
		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inp_ll;

const int MAXN = 100010;

int calc(int a)
{
	if (!a)
		return 0;
	return a%10+calc(a/10);
}

int n;

int main()
{
	
	n = inp();
	int ans = MAXN;
	for (int a = 1; a < n; ++ a)
	{
		ans = min(ans, calc(a)+calc(n-a));
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		Main byakko = new Main();
		String string;
		int n;
		
		boolean[] primes = byakko.primeSieve();
				
		while(!(string = reader.readLine()).equals("0")){
			n = Integer.parseInt(string);
			
			for(int i = n; i > 0; i--){
				if(primes[i] && primes[i - 2] && primes[i - 6] && primes[i - 8]){
					System.out.println(i);
					break;
				}
			}
		}
		reader.close();
	}
	
	public boolean[] primeSieve(){
		boolean[] primes = new boolean[10000001];
		Arrays.fill(primes, true);
		
		primes[0] = primes[1] = false;
		for(int i = 2; i * i <= 10000000; i++){
			for(int j = 2; i * j  <= 10000000; j++){
				if(!primes[i * j]) continue;
				primes[i * j] = false;
			}
		}
		
		return primes;
	}
	
}

Measured memory_bytes: 35584
def main():
    n = int(input())
    ans = 0
    ans += n // 11 * 2
    if n % 11 <= 6 and n % 11 != 0:
        ans += 1
    elif n % 11 <= 10 and n % 11 > 6:
        ans += 2
    print(ans)
main()


Measured memory_bytes: 61732
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define ll  long long 
const ll INF=1LL<<60;
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
ll cost[10][10];
ll n=1000;
int main(){
  ll a,b,c,ans=0;cin>>a>>b;
  rep(i,10)rep(o,10)cin>>cost[i][o];
  rep(i,10){
    n=min(cost[i][1],n);
  }
    rep(k,10)rep(i,10)rep(o,10)cost[i][o]=min(cost[i][o],cost[i][k]+cost[k][o]);
    rep(i,a*b){
      cin>>c;
      if(c==-1)continue;
      ans+=cost[c][1];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define int long long
#define INT_MAX INT64_MAX
#define INT_MIN INT64_MIN
#define CLK clock_t clk = clock();//Start of main
#define OCLK cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';//End of main
#define MOD 1000000007
/* DEFINE cout */
#define pln cout << "===============================\n"
#define on cout<<"\n"
#define os cout<<" "
#define o2(a,b) cout<<a<<" "<<b
#define o(a) cout << a
#define bitcount __builtin_popcount
/* DEFINE cout */
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);//fastio
using namespace std;
struct hash_pair { // use pair as key in unordered_map<pair<int,int>,int,hash_pair>;
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
bool prime[10000001];
int P=MOD-2;
int factorial[10000001]={0};
int powerFunction(int x,int y){
    int res = 1;
    int p = MOD;
    x = x % p;
    while (y > 0){
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
void sieveFunction(int maxLimit){
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1]=false;
    for(int i=2; maxLimit >= i ; i++){
        if(prime[i]){
            for(int j=2*i ; maxLimit >= j ; j+=i)
                prime[j]=false;
        }
    }
}
void factorialFunction(int maxLimit){
    factorial[0]=1;
    for(int i=1 ; i <= maxLimit ; i++)
        factorial[i]=(factorial[i-1]*i)%MOD;
    return;
}
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
signed main(){
    int n, x, y;
    cin >> n >> x >> y;
    int ans[n+1];
    memset(ans, 0, sizeof(ans));
    for(int i=1; n>=i; i++){
        for(int j=i+1; n>=j; j++){
            int temp;
            if(j >= y){
                temp = min(abs(x-i) + 1 + (j-y), j-i);
            }else if(j >= x && j < y){
                temp = min(abs(x-i) + 1 + abs(j-y), j-i);
            }else{
                temp = j-i;
            }
            ans[temp]++;
        }
    }
    for(int i=1; n>i; i++){
        cout << ans[i] << endl;
    }
}






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

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


int main(){

    int R,D,AX;cin >> R >> D >> AX;
    int record[11];
    record[0]=AX;

    rep(i,0,11){
        record[i+1]=R*record[i]-D;
    }

    rep(i,1,11) cout << record[i] << endl;

}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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


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

  int c, ta;
  int tmp = -1;
  int tmp_min = INF;
  REP(i, n) {
    cin >> c >> ta;
    if (ta <= t && c < tmp_min) {
      tmp_min = c;
      tmp = 1;
    }
  }
  if (tmp < 0) {
    cout << "TLE" << endl;
  } else cout << tmp_min << endl;


  return 0;
}


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

typedef long long ll;
ll min (ll a, ll b){ return (a<b)?a:b;}
int A,B,C,X,Y;
int main(void){
    scanf("%d %d %d %d %d",&A,&B,&C,&X,&Y);
    int money = 0;
    
    int common = min(X,Y);
    int rest = (X<Y)? Y-common: X-common;
    
    if(C*2<A+B){
        money += common*2*C;
    }else{
        money += common*(A+B);
    }

    if(X<Y){
        if(2*C<B) money += rest*2*C;
        else      money += rest*B;
    }else{
        if(2*C<A) money += rest*2*C;
        else      money += rest*A;
    }
    
    printf("%d\n",money);
}

Measured memory_bytes: 128
#include<iostream>
#include<string.h>
#include<ctype.h>
#include<string>
#include<math.h>
#define pi 3.141592653589
#include<iomanip>
using namespace std;
#include<algorithm>
#define rep(i,a,n) for(int i=a;i<n;i++)
 
 
 
int main(){
    
    string s1,s2,s3;
    
    cin>>s1>>s2>>s3;
    if((s1[s1.size()-1]==s2[0])&&(s2[s2.size()-1]==s3[0]))cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string str;
    cin>>str;
    for(int i=0;i<str.size();i++){
        char c=str[i];
        c=(c-'A'-3+26)%26+'A';
        cout<<c;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 1176