akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayDeque;
import java.util.Iterator;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		ArrayDeque<Integer> deque = new ArrayDeque<Integer>();
		try (Scanner sc = new Scanner (System.in)){
			int times = sc.nextInt();
			int d, x;
			for (int i=0; i < times; i++) {
				int query = sc.nextInt();
				d = sc.nextInt();
				switch (query) {
				//push(d,x)
				case 0:
					x = sc.nextInt();
					if (d == 0) deque.addFirst(x);
					else if (d == 1) deque.addLast(x);
					break;
				//randomAccess(d)
				case 1:
					Iterator<Integer> ite = deque.iterator();
					for(int j=0; j<d; j++) ite.next();
					System.out.println(ite.next());
					break;
				//pop(d)
				case 2:
					if (d == 0) deque.removeFirst();
					else if (d == 1) deque.removeLast();
					break;

				}
			}
		}
	}
}


Measured memory_bytes: 301052
#include <iostream>
#include <vector>
 
int selectionSort(std::vector<int>& a, int n) {
    int x = 0;
    int minj = 0;
    for (int i = 0; i < n - 1; i++) {
        minj = i;
        for (int j = i + 1; j < n; j++) {
            if (a[j] < a[minj]) {
                minj = j;
            }
        }
        if (minj != i) {
            std::iter_swap(a.begin() + i, a.begin() + minj);
            x++;
        }
    }
    return x;
}
 
int main(int argc, const char *argv[]) {
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
     
    int x = selectionSort(a, n);
     
    std::cout << a[0];
    for (int i = 1; i < n; i++) {
        std::cout << " " << a[i];
    }
    std::cout << std::endl;
     
    std::cout << x << std::endl;
     
    return 0;
}

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

int main(){
  int plus,minus,ans;
  char S[4];
  cin >> S;
  vector<char> SS(S,S+sizeof(S));
  for (int i=0;i<4;i++){
    if (S[i]=='+')
      plus++;
    else
      minus++;
  }
  ans = plus - minus;
  cout << ans <<"\n";
}

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

ll divs[mx+1];

void sieve()
{
    for(ll i=1; i<=mx; i++) divs[i]=2;
    divs[1]=1;
    for(ll i=2; i<=mx; i++)
    {
        for(ll j=2*i; j<=mx; j+=i)
            divs[j]++;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    cout<<n*(1+n+n*n)<<endl;
}


Measured memory_bytes: 3648
/* 
 Author:N_o_o_B 
 Created:November 09 2019 17:33:09
*/
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
const ll mod=998244353;
//const ll mod=1e9+7;
const ll INF=1e18;
ll powmod(ll a,ll n){
    ll res=1;
    while(n){
        if(n&1) res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n;
    cin >> n;
    vl cnt(n);
    bool fl=1;
    fori(i,n){
        int x;
        cin >> x;
        if(i==0 and x) fl=0; 
        cnt[x]++;
    }
    ll ans=(fl and cnt[0]==1);
    rep(i,1,n-2){
        ans=ans*powmod(cnt[i],cnt[i+1])%mod;
    }
    cout << ans << endl;


    time_taken();
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define MOD 1000000007
#define EPS (1 >> 30)
#define INF (1 << 30)
//#define INFll (1LL << 60)

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------

    string s;
    cin >> s;
    int n = s.size();
    ll count = 0;
    ll ans = 0;
    rep(i, n)
    {
        if (s[i] == 'A')
        {
            count++;
        }
        else if (s[i] == 'B' && s[i + 1] == 'C')
        {
            ans += count;
            i++;
        }
        else
        {
            count = 0;
        }
    }
    cout << ans << endl;
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
//ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
string s;

int main() {
    ll n;
    cin >> n;
    vl b;
    REP(i, n-1) {
        IPT(ll, b)
    }

    ll ans = b.at(0);

    REP(i, n - 2) {
        ans += min(b.at(i), b.at(i + 1));
    }
    ans += b.at(n - 2);

    MSG(ans)
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
		string S, T;
		cin >> S >> T;
		vector<int> s_to_t(26, 0);
		for (int i = 0; i < S.size(); i++) {
				if (s_to_t[S[i] - 'a'] == 0) {
						s_to_t[S[i] - 'a'] = T[i];
				} else if (s_to_t[S[i] - 'a'] != T[i]) {
						cout << "No" << endl;
						return 0;
				}
		}

		vector<int> t_to_s(26, 0);
		for (int i = 0; i < T.size(); i++) {
				if (t_to_s[T[i] - 'a'] == 0) {
						t_to_s[T[i] - 'a'] = S[i];
				} else if (t_to_s[T[i] - 'a'] != S[i]) {
						cout << "No" << endl;
						return 0;
				}
		}

		cout << "Yes" << endl;
		return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF LLONG_MAX/10
#define rep(i,n) for(int i=0;i<n;i++)
#define krep(i,k,n,m) for(int i=k;i<n;i+=m)
#define erep(i,k,n) for(int i=k;i<n;i++)
#define mod 1000000007
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}
signed main(){
    string s;
    cin>>s;
    rep(i,s.size()){
        cout<<'x';
    }
    cout<<endl;
}


Measured memory_bytes: 256
s = input()
t = input()

ans = len(t)
for i in range(len(s) - len(t) + 1):
    ans_tmp = 0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            ans_tmp += 1
    ans = min(ans, ans_tmp)
print(ans)

Measured memory_bytes: 9012
#include<iostream>
#include<vector>
#include <unordered_map>  
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <sstream>
#include <cmath>
using namespace std;

void A();

int main() {
	int n;
	vector<int> result,d;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		int tmp;
		cin >> tmp;
		d.push_back(tmp);
	}
	sort(d.rbegin(), d.rend());
	int last;
	for (int i = 0; i < n; ++i) {
		if (i == 0) {
			last = d[0];
			result.push_back(i);
		}
		else if (last > d[i]) {
			last = d[i];
			result.push_back(i);
		}
		
	}
	cout << result.size() << endl;
	return 0;
}

Measured memory_bytes: 256
-- {-# LANGUAGE TypeApplications #-}
-- {-# LANGUAGE BlockArguments #-}
import Control.Monad
import Data.Maybe
import Data.Char (isSpace)
import Data.List (unfoldr)
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS

tuplify2 (x:y:_) = (x,y)
tuplify2 _ = undefined

--Input functions with ByteString
readInt = fst . fromJust . BS.readInt
readIntTuple = tuplify2 . map readInt . BS.words
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntN n = map readInt <$> replicateM (fromIntegral n) BS.getLine
getIntList = readIntList <$> BS.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine
getIntMatrix = map readIntList . BS.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BS.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BS.getLine
getIntTuples = map readIntTuple . BS.lines <$> BS.getContents


main = do
  [n,m,x] <- getIntList
  books  <- replicateM n $ do
    c:as <-getIntList
    return (c,as)
  let allPatterns = replicateM n [True,False]
  let result = minimum $ map (filterSum x books) allPatterns
  print $ if (result == maxBound) then -1 else result

filterSum :: Int -> [(Int,[Int])] -> [Bool] -> Int
filterSum x books pattern =
  if (test x filteredBooks) then sum $ map fst filteredBooks else maxBound
    where filteredBooks = map snd $ filter (fst) $ zip pattern books

test  :: Int -> [(Int,[Int])] -> Bool
test x books = all (>= x) $ foldl (zipWith (+)) [0,0..] $ map snd books

Measured memory_bytes: 5120
N = int(input())
v = [int(v) for v in input().split()]

v_sorted = sorted(v)

new_list = []
for i in range(len(v)):
    if i == 0 or i == 1:
        new_list.append(v_sorted[i] / 2**(len(v)-1))
    else:
        new_list.append(v_sorted[i] / 2 ** (len(v)-i))
    
print(sum(new_list))

Measured memory_bytes: 9192
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


n = int(input())

ans = []

for i in range(11111):
    if is_prime(5*(i+1)+1):
        ans.append(5*(i+1)+1)
        if len(ans) == n:
            for j in range(n):
                print(ans[j], end=' ')
            print()
            exit()


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

	int main(){
	
	int n;
	scanf("%d",&n);
	char arr[10000];
	scanf("%s",arr);
	int len = strlen(arr);
	
	for(int i=0;i<len;i++){
		arr[i] += n;
		if(arr[i] > 'Z'){
			arr[i] -= 26;
		}
		printf("%c",arr[i]);
	}


		return 0;
	}

Measured memory_bytes: 1672
///答え見ました
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  vector<int64_t> a(n+1),b(n);
  for(int i=0; i<n+1; i++) cin >> a[i];
  for(int i=0; i<n; i++) cin >> b[i];
  
  
  int64_t count=0;
  for(int i=0; i<n; i++){
    
    if(a[i]<b[i]){
     count+=a[i];
     b[i]-=a[i];
     a[i]=0;
     if(a[i+1]<b[i]){
      count+=a[i+1];
       a[i+1]=0;
     }
     else {
      count+=b[i];
       a[i+1]-=b[i];
     }
   }
    
    else{
      count+=b[i];
      a[i]-=b[i];
    }
  }
  
  cout << count << endl;
  
  
}
  

Measured memory_bytes: 1792
#!/usr/bin/env python3
import sys
import collections as cl


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def main():
    N,A,B = MI()
    oneset = A + B

    rep = N // oneset

    print(rep * A + min(N % oneset,A))


main()


Measured memory_bytes: 64164
class diceClass:
	def __init__(self, valuelist):
		self.valuelist = valuelist
		self.t = valuelist[0]
		self.b = valuelist[5]
		self.n = valuelist[4]
		self.s = valuelist[1]
		self.e = valuelist[2]
		self.w = valuelist[3]

	def throw(self, direction):
		# N,S,W,E
		if direction == 'N':
			self.t, self.s, self.b, self.n = self.s, self.b, self.n, self.t
		elif direction == 'S':
			self.t, self.s, self.b, self.n = self.n, self.t, self.s, self.b
		elif direction == 'W':
			self.t, self.e, self.b, self.w = self.e, self.b, self.w, self.t
		elif direction == 'E':
			self.t, self.e, self.b, self.w = self.w, self.t, self.e, self.b


arrinput = list(map(int, input().split()))
dirinput = 'WWWWSWWWWSWWWWSWWWWWSWWWWSSWWWW'
dicresult = []

dice = diceClass(arrinput)
for s in dirinput:
	dice.throw(s)
	if dicresult.count([[dice.t, dice.s], dice.e]) == 0:
		dicresult.append([[dice.t, dice.s], dice.e])

q = int(input())
for i in range(0, q):
	a, b = map(int, input().split())
	for j in dicresult:
		if a == j[0][0] and b == j[0][1]:
			print(j[1])


Measured memory_bytes: 5608
import java.util.*;
import java.math.*;
import java.util.Scanner;
import java.util.Arrays;

public class Main {
	/*static void sort(int[] A,int l,int r) {
		if(l=r) {
			
		}
		sort(A,0,(l+r)/2);
		sort(A,1+ (l+r)/2,r);
		
	}*/

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		
		//X+Y+Z=S   0<=X,Y,Z<=K

		int K=sc.nextInt();
		int S=sc.nextInt();
		int count=0;
		
		for(int i=0;i<=K && S-i>=0;i++) {//X=i固定
			int sum=S-i;
			//System.out.println("i"+i);
			if(sum<=K) {
				count+=sum+1;
				//System.out.println(sum+1);
			}else{
				int dif=Math.max(0, 2*K - sum +1);
				//System.out.println(dif);
				count+=dif;
			}
		}
		System.out.println(count);
		
		
	}

}

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

int main()
{
  std::string s;
  cin >> s;
  int len = s.size();
  int count = 0;
  for(int i=0;i<len-1;i++){
    for(int j=1+i;j<len;j++){
      if(s[i]==s[j]) ++count;
    }
  }

  if(count == 0) cout << "yes" << endl;
  else cout << "no" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<cmath>
#include<queue>	
#include<functional>
#include<climits>
#include<utility>
#include<tuple>
#include<cassert>
#include<stack>
using namespace std;

//define
#define ALL(a) a.begin(),a.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(1)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long
#define PB push_back
#define LB lower_bound
#define UB upper_bound


//constant
const int MOD = 1000000007;
const int INF = INT_MAX / 3 - 1;
const double EPS = 1e-9;
const int dx4[4] = { 1,0,-1,0 };
const int dy4[4] = { 0,1,0,-1 };
const int dx8[8] = { -1,0,1,-1,1,-1,0,1 };
const int dy8[8] = { -1,-1,-1,0,0,1,1,1 };

//typedef
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;


int main() {
	string s;
	int k;
	cin >> s>>k;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'a')
			continue;
		if (k >= 'z' - s[i] + 1) {
			k -= 'z' - s[i] + 1;
			s[i] = 'a';

		}
		
	}
	if (k > 0) {
		s[int(s.size()) - 1] = (s[int(s.size()) - 1] -'a'+ k) % ('z' - 'a' + 1)+'a';

	}
	cout << s << endl;;
	return 0;
}

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

using namespace std;

int main()

{

    int k,a,b,flag=0;

    cin>>k>>a>>b;

    for(int i=a;i<=b;i++)

    {

        if(i%k==0)

        {

            flag=1;

            break;

        }



    }

    if(flag)

        cout<<"OK";

    else

        cout<<"NG";

    return 0;

}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

int main(){
    ll n,k;
    cin>>n>>k;
 
    ll ans=0;
    for(ll i=k;i<=n+1;i++){
        ll first=i*(i-1)/2;
        ll final=(n*2-i+1)*i/2;
        ll add=final-first+1;
        ans=(ans+add)%MOD;
    }
 
    cout<<ans<<endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#include<atcoder/fenwicktree>
using namespace std;
using namespace atcoder;
int main(){
  int n, m;
  cin >> n >> m;
  fenwick_tree<long long> fn(n);
  for(int i=0; i<n; i++){
      int a;
      cin >> a;
      fn.add(i, a);
    }
  while(m--){
    int t, a, b;
    cin >> t >> a >> b;
    if(t == 0){
      fn.add(a, b);
    }else{
      cout << fn.sum(a, b) << "\n";
    }
  }
  return 0;
}


Measured memory_bytes: 8212
def main():
    """
    ワーシャルフロイドで経由したときに変更がないことを確認する
    変更がある場合、
        最短経路ではないため条件を満たさない
    変更がない場合、
        経由の経路でも最短距離になるケースを除いて距離を計算する
    """
    N = int(input())
    a = [None] * N
    total = 0
    for i in range(N):
        a[i] = list(map(int, input().split()))
        total += sum(a[i])

    for k in range(N):
        for i in range(N):
            for j in range(N):
                # compare from-to / from-経由地点-to
                d = a[i][k] + a[k][j]
                if a[i][j] > d:
                    return -1

    # 不要判定
    v = [[False] * N for _ in range(N)]
    no_need = 0
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if i == k or j == k:
                    continue
                if not v[i][j] and (a[i][j] == a[i][k] + a[k][j]):
                    no_need += a[i][j]
                    v[i][j] = True

    # 対称なので半分にする
    return (total - no_need) // 2

if __name__ == '__main__':
    answer = main()
    print(answer)


Measured memory_bytes: 46044
class Main{public static void main(String a[]){System.out.println("1x1=1");System.out.println("1x2=2");System.out.println("1x3=3");System.out.println("1x4=4");System.out.println("1x5=5");System.out.println("1x6=6");System.out.println("1x7=7");System.out.println("1x8=8");System.out.println("1x9=9");System.out.println("2x1=2");System.out.println("2x2=4");System.out.println("2x3=6");System.out.println("2x4=8");System.out.println("2x5=10");System.out.println("2x6=12");System.out.println("2x7=14");System.out.println("2x8=16");System.out.println("2x9=18");System.out.println("3x1=3");System.out.println("3x2=6");System.out.println("3x3=9");System.out.println("3x4=12");System.out.println("3x5=15");System.out.println("3x6=18");System.out.println("3x7=21");System.out.println("3x8=24");System.out.println("3x9=27");System.out.println("4x1=4");System.out.println("4x2=8");System.out.println("4x3=12");System.out.println("4x4=16");System.out.println("4x5=20");System.out.println("4x6=24");System.out.println("4x7=28");System.out.println("4x8=32");System.out.println("4x9=36");System.out.println("5x1=5");System.out.println("5x2=10");System.out.println("5x3=15");System.out.println("5x4=20");System.out.println("5x5=25");System.out.println("5x6=30");System.out.println("5x7=35");System.out.println("5x8=40");System.out.println("5x9=45");System.out.println("6x1=6");System.out.println("6x2=12");System.out.println("6x3=18");System.out.println("6x4=24");System.out.println("6x5=30");System.out.println("6x6=36");System.out.println("6x7=42");System.out.println("6x8=48");System.out.println("6x9=54");System.out.println("7x1=7");System.out.println("7x2=14");System.out.println("7x3=21");System.out.println("7x4=28");System.out.println("7x5=35");System.out.println("7x6=42");System.out.println("7x7=49");System.out.println("7x8=56");System.out.println("7x9=63");System.out.println("8x1=8");System.out.println("8x2=16");System.out.println("8x3=24");System.out.println("8x4=32");System.out.println("8x5=40");System.out.println("8x6=48");System.out.println("8x7=56");System.out.println("8x8=64");System.out.println("8x9=72");System.out.println("9x1=9");System.out.println("9x2=18");System.out.println("9x3=27");System.out.println("9x4=36");System.out.println("9x5=45");System.out.println("9x6=54");System.out.println("9x7=63");System.out.println("9x8=72");System.out.println("9x9=81");}}

Measured memory_bytes: 16836
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
int main(void){

    vector<pair<int, int>> data;

    for(int i=0; i<5; i++) {
        pair<int, int> temp;
        int times;
        cin >> times;
        if(times%10==0) temp.first = 10;
        else temp.first = times%10;
        temp.second = times;
        data.push_back(temp);
    }
    
    sort(data.begin(), data.end());
    reverse(data.begin(), data.end());
    
    int result = 0;
    for(int i=0; i<4; i++) {
        result += data[i].second;
        if(data[i].second%10!=0) result += (10-data[i].second%10);
    }
    
    result += data[4].second;
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
$test_primes = Array.new(0);
$check_primes = Array.new(0);

def array_integer(a)
	0.upto(a.count) {|x|
		a[x] = a[x].to_i
	}
	return a
end

def is_prime(num)
#	print "prime check for ", num , "\n"
	return true if $test_primes.find{|i| i == num} != nil
	return true if $check_primes.find{|i| i == num} != nil
	return true if num == 2
	return false if num < 2
	return false if num % 2 == 0

	if $test_primes.length > 0 then
#		p $primes
		0.upto($test_primes.length - 1) {|i|
			break if num < $test_primes[i]
			return false if num % $test_primes[i] == 0
		}
 #   	print "prime list miss\n"
		test_num = $test_primes[$test_primes.length - 1]
	else
	    test_num = 3
	end
	
	ceil = Math.sqrt(num)
	while ceil >= test_num do
		if is_prime(test_num) then
			$test_primes.push(test_num) if $test_primes.find{|i| i == test_num} == nil
			return false if num % test_num == 0
		end
		test_num += 2
	end
	$check_primes.push(num) if $check_primes.find{|i| i == num} == nil
#	print "prime check end for ", num , "\n"
	return true
end


n = STDIN.gets.chomp.to_i
count = 0

1.upto(n) {
	num = STDIN.gets.chomp.to_i
    if is_prime(num) then 
	    count += 1 
#    	print num, " is prime\n"
    end
}
print count, "\n"



Measured memory_bytes: 8888
#include<iostream>
using namespace std;
int main()
{
	long long a,b;
	char o;
	cin>>a;
	cin>>o;
	cin>>b;
	if(1<=a&&b<=10^9){
		if(o=='+')
		cout<<a+b;
		else
		if(o=='-')
cout<<a-b;	
}
}

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

class C
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		Console.ReadLine();
		var a1 = read();
		var a2 = read();
		Console.WriteLine(Enumerable.Range(0, a1.Length).Max(i => a1.Take(i + 1).Sum() + a2.Skip(i).Sum()));
	}
}


Measured memory_bytes: 11476
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int n;
int main()
{
	n=5;
	for (int i=1;i<=n;++i)
	{
		int x;
		cin>>x;
		if (x==0)
		{
			cout<<i<<"\n";
			return 0;
		}
	}
	return 0;
}

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


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll h;
    cin>>h;
    ll beishu=1;
    ll ans=0;
    while(h!=0)
    {

        ans+=beishu;
        beishu*=2;
        h/=2;

    }
    cout<<ans<<'\n';



}








Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,x,ans=1e9+7,a,y,b;
int main(){
	cin>>n;
	for(int i=0;i<=n;i++)
	{
		x=i;
		a=0;
		while(x>0)
		{
			a+=x%6;
			x/=6;
		}
		y=n-i;
		while(y>0)
		{
			a+=y%9;
			y/=9;
		}
		ans=min(ans,a);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;

public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
      	int[][] red = new int[n][n];
        int[][] blue = new int[n][n];
      
      	for (int i = 0; i < n; i++) {
          red[i][0] = sc.nextInt();
          red[i][1] = sc.nextInt();
        }
      
        for (int i = 0; i < n; i++) {
          blue[i][0] = sc.nextInt();
          blue[i][1] = sc.nextInt();
        }
        
      Arrays.sort(red, new Comparator<int[]>() {
        @Override
        public int compare(int[] o1, int[] o2) {
			return o2[1] - o1[1];
        }
    });
      
     Arrays.sort(blue, new Comparator<int[]>() {
        @Override
        public int compare(int[] o1, int[] o2) {
			 return o1[0] - o2[0];
        }
    });
      	
        long ans = 0;
      	for (int i = 0 ; i < n; i++) {
			for (int j = 0; j < n; j++) {
              	if ((blue[i][0] > red[j][0]) && (blue[i][1] > red[j][1])){
                	ans++;
                	red[j][0] = 2 * n;
                	red[j][1] = 2 * n;
                	break;
              	}
			}
        }
      
      System.out.println(ans);
    }
    
}

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

#define ll long long


using namespace std;


const int INF = 1e9 + 5;


int main(){
	
	int n;
	
	cin >> n;
	
	vector<int> h(n);
	
	for(int& x: h)
		cin >> x;
		
	vector<int> s(n, INF);	//solution vector
	s[0] = 0;				//s[0] is starting stone so distance = 0


	for(int i = 0; i < n; i++){
		for(int j = 1; j <= 2; j++){
			if(i+j < n){
				
				s[i+j] = min(s[i+j], s[i] + abs(h[i]-h[i+j]));
			}
			
		}
		
	}
	cout << s[n-1];
		
	return 0;
	
}


Measured memory_bytes: 1024
w, h, n = map(int, input().split())

x, y, a = [0] * n, [0] * n, [0] * n

for i in range(n):
    x[i], y[i], a[i] = map(int, input().split())

start, end  = [0, 0], [w, h]

for i in range(n):
    if a[i] == 1 and x[i] > start[0]:
        start[0] = x[i]
    elif a[i] == 2 and x[i] < end[0]:
        end[0] = x[i]
    elif a[i] == 3 and start[1] < y[i]:
        start[1] = y[i]
    elif a[i] == 4 and end[1] > y[i]:
        end[1] = y[i]
    
if (end[0] - start[0]) <= 0 or (end[1] - start[1]) <= 0:
    print(0)
else:
    print( (end[0] - start[0]) * (end[1] - start[1]))

Measured memory_bytes: 3064
# include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long 
int dp[10005][105][2];
int n;string str;int k;
vector<int> v;
ll get(int pos,int sum,bool  f)
{ int & ans=dp[pos][sum][f];
  
  if(pos==n)
 { 
    if(sum%k==0) return (ans=1);
    else
      return (ans=0);
 }
 
 if(ans!=-1) return ans;
 ans=0;
  int lim=(f)? 9:v[pos];
  for(int i=0;i<=lim;i++)
  { 
    ans=((ll)ans%mod+(get(pos+1,(sum+i)%k,f | (i<v[pos])))%mod)%mod;

  }
   return ans;
  
}

int main()
{  //ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  //string str;
 // cin.ignore();
  cin>>str;
  cin>>k;
  n=str.size();
 // cout<<str<<" ";
 //cout<<k<<" ";
 for(auto& i:str)
  v.push_back(i-'0');
   memset(dp, -1, sizeof (dp));
 cout<<(get(0,0,0)-1+mod)%mod;
  return 0;
  
}

Measured memory_bytes: 9344
package main

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

func main() {
	sc := NewScanner()

	n := sc.ReadInt()

	ac := 0
	wa := 0
	tle := 0
	re := 0
	for i := 0; i < n; i++ {
		s := sc.ReadString()
		switch s {
		case "AC":
			ac++
		case "WA":
			wa++
		case "TLE":
			tle++
		case "RE":
			re++
		default:
			panic("unexpected input")
		}
	}

	labels := []string{"AC", "WA", "TLE", "RE"}
	counts := []int{ac, wa, tle, re}

	for i := 0; i < 4; i++ {
		fmt.Printf("%s x %d\n", labels[i], counts[i])
	}
}

// from [my library](https://github.com/ikngtty/go-contestlib)
// -   math/simple

func Abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func Min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow(base int, exponent uint) int {
	answer := 1
	for i := uint(0); i < exponent; i++ {
		answer *= base
	}
	return answer
}

func Ceil(divident, dividor int) int {
	quo := divident / dividor
	rem := divident % dividor

	if rem != 0 {
		if (divident > 0 && dividor > 0) ||
			(divident < 0 && dividor < 0) {
			return quo + 1
		}
	}
	return quo
}

// -   sortutil

func ReverseInts(a []int) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
}

func ReverseStrings(a []string) {
	sort.Sort(sort.Reverse(sort.StringSlice(a)))
}

// -   io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		no2();
	}

	static void no2() {
		try (Scanner sc = new Scanner(System.in)) {
			int h = sc.nextInt();
			int w = sc.nextInt();
			String tmp = sc.nextLine();
			int[][] arr = new int[h][w];

			for (int i = 0; i < h; i++) {
				String str = sc.nextLine();
				char[] c = str.toCharArray();
				int j = 0;
				for (char c1 : c) {
					if (c1 == '#') {
						arr[i][j] = 1;
					} else {
						arr[i][j] = 0;
					}
					j++;
				}
			}

			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					int t = 0;
					if (arr[i][j] == 1) {
						if (i != 0) {
							t += arr[i - 1][j];
						}
						if (j != 0) {
							t += arr[i][j - 1];
						}
						if (i != h - 1) {
							t += arr[i + 1][j];
						}
						if (j != w - 1) {
							t += arr[i][j + 1];
						}

						if (t == 0) {
							System.out.println("No");
							return;
						}
					}
				}
			}

			System.out.println("Yes");
		}
	}
}


Measured memory_bytes: 22612
#include<iostream>
#include<cmath>
#include<cstdlib>
using namespace std;
struct coo{
	int x;
	int y;
	int h;
}c[110];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>c[i].x;
		cin>>c[i].y;
		cin>>c[i].h;
	}
	int ch;
	int p=0;
	while(c[p].h==0) p++;
	for(int i=0;i<=100;i++)
	{
		for(int j=0;j<=100;j++)
		{
			int ch=c[p].h+abs(i-c[p].x)+abs(j-c[p].y);
			int f=0;
			for(int k=0;k<n;k++)
			{
				int hh=ch-abs(i-c[k].x)-abs(j-c[k].y);
				if(hh<0) hh=0;
				if(hh!=c[k].h)
				{
					f=1;
					break;
				}
			}
			if(!f)
			{
				cout<<i<<' '<<j<<' '<<ch<<endl; return 0;
			} 
		}
	}
} 

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using llint = long long;
using vint = vector<int>;

int main() {
    char b; cin >> b;
    if (b == 'A') cout << 'T' << endl;
    if (b == 'C') cout << 'G' << endl;
    if (b == 'T') cout << 'A' << endl;
    if (b == 'G') cout << 'C' << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;

public class Main
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int[] d1=new int[n];
        int[] d2=new int[n];
        for(int i=0;i<n;i++)
        {
            d1[i]=in.nextInt();
            d2[i]=in.nextInt();
        }
        boolean flag=false;
        for(int i=0;i<=n-3;i++)
        {
            if(d1[i]==d2[i] && d1[i+1]==d2[i+1] && d1[i+2]==d2[i+2])
            {
                flag=true;
                break;
            }
        }
        if(flag==true)
            System.out.println("Yes");
        else
            System.out.println("No");
    }

}


Measured memory_bytes: 36032
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        

fast();
//ll t;cin>>t;while(t--)
{
   ll w,h,n,l=0,d=0,r=INT_MAX,u=INT_MAX;
   cin>>w>>h>>n;
   r=w,u=h;
   for(int i=1;i<=n;i++)
   {
    ll xi,yi,a;
    cin>>xi>>yi>>a;
    if(a==1)
    {
         l=max(l,xi);
    }
    else if(a==2)
    {
          r=min(r,xi);
    }
    else if(a==3)
    {
        d=max(d,yi);
    }
    else if(a==4)
    {
         u=min(u,yi);
    }
   }
   cout<<(max(r-l,0ll)*max(u-d,0ll))<<endl;
   
  /* cerr<<fcx<<" "<<fcy<<endl;
   cerr<<scx<<" "<<scy<<endl;
   ll length=scx-fcx;
   ll breadth=scy-fcy;
   ll res=1ll*length*breadth;
   cout<<max(0ll,res)<<endl;
  */

}
return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
	int n, r;
	cin >> n >> r;
	cout << r + 100 * max(10 - n, 0) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  int x;
  cin >> x;
  if(x<1200) cout << "ABC" << endl;
  else cout << "ARC" << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n,k,x,y,z,cnt = 0;
    cin >> n >> k;
    int A[n];
    for(int i = 0;i < n;i++){
        cin >> A[i];
    }
    
    cnt++;
    x = (n - k);
    y = (k-1);
    z = x/y;
    if(x %y == 0){
        cnt += z;
    }
    else if(x % y != 0){
        cnt += z;
        cnt++;
    }
    
    cout << cnt<< endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream> // cout, endl, cin
#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

using namespace std;

int main() {
	int N;
	int cnt = 0;
	cin >> N;

	vector <int> p(N);

	for (int i = 0; i < N; i++) {
		cin >> p.at(i);
	}

	for (int i = 0; i < N; i++) {
		if (p.at(i) != i + 1) {
			cnt++;
		}
	}

	if (cnt <= 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int S = 0;
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    S += r - l + 1;
  }
  cout << S << endl;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
 
int main()
{
    int P, Q, R;
    cin >> P >> Q >> R;

    int ans = P + Q + R - max({P, Q, R});

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
std::map<int, int> freq;

int main() {
	int n, m;
	std::cin >> n;
	while(n--) {
		int temp;
		std::cin >> temp;
		freq[temp]++;
	}
	std::cin >> m;
	while(m--) {
		int temp;
		std::cin >> temp;
		if(!freq[temp]) {
			std::cout << "NO\n";
			return 0;
		}
		freq[temp]--;
	}
	std::cout << "YES\n";
}

Measured memory_bytes: 9600
//ABC088-D(Grid Repainting)
#include<iostream>
#include<queue>
using namespace std;

//白いマス目を黒に変えることができる
//すぬけくんが(1,1)から(H,W)までたどり着ける迷路のうち
//最も多く色を変えられるマス目の数
//ただしたどり着けない場合は-1を出力

//すぬけくんが行けるあらゆる組み合わせを試してそのために使ったパネルの数を数えるのは非効率
//すぬけくんがたどり着ける最短距離を求めて、その値を(もともとあった白のパネルの枚数-1)から引く

const int INF=10000000;
int H,W;
char field[60][60];
int d[60][60];//各点までの最短距離

typedef pair<int,int> P;

//移動4方向のベクトル
int dx[]={0,-1,1,0},dy[]={-1,0,0,1};

int bfs(){//dfs(スタートは(0,0)、ゴールは(H-1,W-1))
    
    for(int i=1; i<=H; i++)
        for(int j=1; j<=W; j++)d[i][j]=INF;
    
    queue<P> que;
    que.push(P(1,1));
    d[1][1]=0;
    
    while(que.size()){
        //キューの先頭を取り出す
        P q=que.front();
        que.pop();
        //ゴールなら探索終了
        
        if(q.first==H && q.second==W)break;
        
        //移動4方向をループ
        for(int i=0; i<4; i++){
            //移動先の座標をnx,nyとする
            int nx=q.first+dx[i],ny=q.second+dy[i];
            
            //行く先が範囲内で'.'で探索済みでないならqueueに追加
            if(nx>=1 && nx<=H && ny>=1 && ny<=W && field[nx][ny]=='.' && d[nx][ny]==INF){
                
                que.push(P(nx,ny));
                d[nx][ny]=d[q.first][q.second]+1;
            }
        }
    }
    return d[H][W];
    
}

int main(){
    cin>>H>>W;
    int white=0;
    for(int i=1; i<=H; i++){
        for(int j=1; j<=W; j++){
            cin>>field[i][j];
            if(field[i][j]=='.')white++;
        }
    }
    int n=bfs();//(1,1)からスタートで最短距離を求める
    if(n==INF){
        cout<<-1<<endl;
        return 0;
    }
    cout<<white-n-1<<endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>

#include <sstream>
#include <algorithm>
#include <cmath>

#include <string>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include<cassert>//assert();
#include <fstream>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
 
#define PII pair<int,int>
/////////
#ifdef getchar_unlocked
#define mygc(c) (c)=getchar_unlocked()
#else
#define mygc(c) (c)=getchar()
#endif
#ifdef putchar_unlocked
#define mypc(c) putchar_unlocked(c)
#else
#define mypc(c) putchar(c)
#endif
/////////
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
/////////
using namespace::std;
/////////
#ifdef _DEBUG
#define DEBUG_BOOL(b) assert(b)
#else
#define DEBUG_BOOL(b) 
#endif
/////数値読み込み
#define ENABLE_READER_ON(T)	\
inline void reader(T &x){\
	int k;x = 0;bool flag = true;\
	while(true){\
		mygc(k);\
		if( k == '-'){\
			flag = false;break;\
		}\
		if('0' <= k && k <= '9'){\
			x = k - '0';break;\
		}\
	}\
	if( flag ){\
		while(true){\
			mygc(k);\
			if( k<'0' || '9'<k)break;\
			x = x * 10 + (k - '0');\
		}\
	}else{\
		while(true){\
			mygc(k);\
			if( k<'0' || '9'<k)break;\
			x = x * 10 - (k-'0');\
		}\
	}\
}
//整数
ENABLE_READER_ON(int)
ENABLE_READER_ON(long)
ENABLE_READER_ON(long long)
ENABLE_READER_ON(unsigned int)
ENABLE_READER_ON(unsigned long)
ENABLE_READER_ON(unsigned long long)

//////
//文字読み込み
inline int reader(char c[]){int i,s=0;
for(;;){mygc(i);if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF) break;}
c[s++]=i;
for(;;){mygc(i);if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF) break;c[s++]=i;}
c[s]='\0';return s;
}

inline int reader(string& c,int size=100){int i;c.reserve(size);
for(;;){mygc(i);if(i != ' '&&i != '\n'&&i != '\r'&&i != '\t'&&i != EOF)break;}
c.push_back(i);
for(;;){mygc(i);if(i == ' ' || i == '\n' || i == '\r' || i == '\t' || i == EOF)break;c.push_back(i);}
return c.size();}

/////////
//数値出力
#define ENABLE_WRITER_ON(T)	\
inline void writer(T x){char f[20];int s = 0;\
if (x<0){mypc('-');while(x){f[s++] = ~(x%10)+1,x /= 10;}}\
else{while(x){f[s++] = (x % 10), x /= 10;}}\
if (!s)f[s++] = 0;while (s--)mypc(f[s] + '0');}

ENABLE_WRITER_ON(int)
ENABLE_WRITER_ON(long)
ENABLE_WRITER_ON(long long)
ENABLE_WRITER_ON(unsigned int)
ENABLE_WRITER_ON(unsigned long)
ENABLE_WRITER_ON(unsigned long long)
/////////
inline void writer(const char c[]){for (int i = 0; c[i] != '\0'; i++)mypc(c[i]); }
inline void writer(const string str){writer( str.c_str() );}

inline void solve(){
	string str;
	cin>>str;
	str[5] = ' ';
	str[13] = ' ';
	cout << str << endl;
}

int main(void){
    std::cin.tie(0); 
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed;//小数を10進数表示
    //cout << setprecision(16);//小数をいっぱい表示する。16?

	solve();

	return 0;
}


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

const ll mod=1000000007;

int main() {
  ll n,count=0;
  cin >> n;
  map<int,int> mp;
  r(i,n){
    int a;
    cin >> a;
    count+=mp[i-a];
    mp[a+i]++;
  }
  cout<<count<<endl;
}


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

int main() {
  int64_t n, mod = 1000000007, a = 1;
  string s;
  cin >> n >> s;
  map<char, int64_t> m;
  rep(i, n){
    if(!m.count(s[i])) m[s[i]] = 1;
    else ++m[s[i]];
  }
  for(auto p:m){
    a *= (p.second+1);
    a %= mod;
  }
  cout << a - 1 << endl;
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int a[3],b[3],sum[4]{};
  for(int i = 0;i < 3;++i){
    cin >> a[i] >> b[i];
    if(a[i] == 1||b[i] ==1){
      sum[0]++;
    }
    if(a[i] == 2||b[i] ==2){
      sum[1]++;
    }
    if(a[i] == 3||b[i] ==3){
      sum[2]++;
    }
    if(a[i] == 4||b[i] ==4){
      sum[3]++;
    }
  }
  sort(sum,sum + 4);
  if(sum[0] == 1 && sum[1] == 1 &&sum[2] ==2 && sum[3] ==2){
    cout << "YES" <<endl;
  }else{
    cout << "NO" <<endl;
  }
  
  
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define fori(a,b) for(i=a;i<b;i++)
using namespace std;
int main () {
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  ll s,w;
  cin>>s>>w;
  if(w>=s)
  cout<<"unsafe"<<endl;
  else
  cout<<"safe"<<endl;
  

return 0;
}


Measured memory_bytes: 3652
#include <algorithm>
#include <cstdio>
#include <ctype.h>
#include <functional>
#include <iostream>
#include <cassert>
#include <cfloat>
#include <climits>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
#define int long long

signed main() {
	int N;
	


	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int odd = 0;
	for (int i = 0; i < N; i++) {
		if (A[i] % 2 == 1) {
			odd++;
		}
	}
	string res;
	if (odd % 2 == 0) {
		res = "YES";
	}
	else {
		if ((N - odd + (odd / 2)) % 2 == 0) {
			res = "YES";
		}
		else {
			res = "NO";
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>

int main() {

    int N, C;
    cin >> N >> C;

    vi T(100010, 0);
    vi s(100010, 0);
    vi t(100010, 0);
    vi c(100010, 0);
    vi R(100010, 0);

    for (int i=0; i<N; i++) {
        cin >> s[i] >> t[i] >> c[i];
    }

    for (int i=1; i<=C; i++) {
        for (int j=0; j<100010; j++) {
            T[j] = 0;
        }
        for (int j=0; j<N; j++) {
            if (c[j] == i) {
                T[s[j] - 1] += 1;
                T[t[j]]     -= 1;
            }
        }
        for (int j=1; j<100010; j++) {
            T[j] += T[j-1];
        }
        for (int j=1; j<100010; j++) {
            if (T[j] > 0) {
                R[j]++;
            }
        }
    }

    int r_max = R[0];
    for (int i=0; i<100010; i++) {
        if (R[i] > r_max) {
            r_max = R[i];
        }
    }

    cout << r_max << endl;

    return 0;
}


Measured memory_bytes: 2176