akhauriyash/Code-Regression huggingface dataset:
M,D = map(int, input().split())
ans = 0
for i in range(1,M+1):
    for j in range(1,D+1):
        if j>= 22:
            d = str(j)
            d1 = int(d[1])
            d10 = int(d[0])
            if d1 * d10 == i and d1 >= 2:
                #print(d1,d10,i)
                ans += 1
print(ans)

Measured memory_bytes: 3060
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[10];
		for(int i=0;i<10;i++){
			a[i]= sc.nextInt();
		}
		Arrays.sort(a);
		System.out.println(a[9]);
		System.out.println(a[8]);
		System.out.println(a[7]);
	}
}

Measured memory_bytes: 17236
#include <bits/stdc++.h>
#define ll long long 
#define ld long double
#define int long long
using namespace std;
const ll INF = 1e18;
const ll MOD = 998244353;

int basis[100];
int cnt = 0;

void insert(int mask) {
	for(int i = 61; i >= 0; i--) {
		if(!(mask&(1ll << i)))	continue;
		if(basis[i] == 0)	{
			basis[i] = mask;
			cnt++;
			return;
		}
		mask ^= basis[i];
	}
}

bool check(int mask) {
	for(int i = 61; i >= 0; i--) {
		if(!(mask&(1ll << i)))	continue;
		if(!basis[i]) return false;
		mask ^= basis[i];
	}
	return (mask == 0);
}

int32_t main() {
	ios::sync_with_stdio(!cin.tie(NULL));

	int t;
	cin >> t;
	while(t--) {
		int n;
		cin >> n;
		memset(basis, 0, sizeof(basis));
		cnt = 0;
		int arr[n];
		for(int i = 0; i < n; i++)	cin >> arr[i];
		string s;
		cin >> s;
		bool flag = true;

		for(int i = n - 1; i >=0; i--) {
			if(s[i] == '0') {
				insert(arr[i]);
			}
			else {
				if(!check(arr[i])) {
					cout << 1 << "\n";
					flag = false;
					break;
				}
			}
		}
		if(flag)
		cout << 0 << "\n";
	}
}



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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,m; cin>>n>>m;
	vector<uint64_t>a(n+1); a.at(0)=a.at(1)=1;
	vector<bool>v(n+1,true);
	for(int i=0;i<m;++i){
		int A; cin>>A;
		v.at(A)=false;
	}
	for(int i=2;i<=n;++i){
		if(v.at(i-2))a.at(i)+=a.at(i-2);
		if(v.at(i-1))a.at(i)+=a.at(i-1);
		a.at(i)%=(int)(1e9+7);
	}
	cout<<a.back()<<"\n"s;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int a1,a2,a3;
    cin>>a1>>a2>>a3;
    cout<<(a1+a2+a3>=22?"bust":"win")<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int MAX = 200;

void insertionSort(int *a, int n){
    int v,j;
    for(int i=1;i<n;i++){
        v = a[i];
        j = i - 1;
        while (j >= 0 && a[j] > v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1]= v;
        for(int k = 0;k<n; k++){
            if(k>0) cout << " ";
            cout << a[k];
        }
        cout << endl;
    }

}

int main(){
    int A[MAX];
    int n;
    cin >> n;

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

        for(int k = 0;k<n; k++){
            if(k>0) cout << " ";
            cout << A[k];
        }
        cout << endl;
    insertionSort(A,n);


    return 0;
}


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

int main() {
  int n, a[200], j = 0;
  bool flag = true;
  cin >> n;

  for (int i = 0; i < n; i++) { cin >> a[i]; }
  while (flag) {
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 1) flag = false;
      else a[i] /= 2;
    }
    if (flag) j++;
  }
  cout << j << endl;
  return 0;
}


Measured memory_bytes: 256
import numpy as np
n, x = map(int, input().split())

l = np.zeros(51, dtype=np.int64)
p = np.zeros(51, dtype=np.int64)

for i in range(n + 1):
    if i == 0:
        l[i] = 1
        p[i] = 1
        continue
    l[i] = 3 + 2 * l[i - 1]
    p[i] = 1 + 2 * p[i - 1]

ans = 0
for i in range(n, -1, -1):
    layer = l[i]
    if x >= layer:
        ans += p[i]
        break
    elif x <= 1:
        break

    half = l[i - 1] + 1
    if x > half:
        ans += 1
        ans += p[i - 1]
        x -= half
        x -= 1
    elif x <= half:
        x -= 1

print(ans)


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

#define rep_(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) rep_(v, 0, n)
#define lep(v, n) rep_(v, 1, n + 1)
#define rrep_(v, f, l) for (int v = (l), v##_ = (f); v >= v##_; --v)
#define rrep(v, n) rrep_(v, 0, n - 1)
#define rlep(v, n) rrep_(v, 1, n)
#define show_a(a, size) rep(a##_it, size) std::cout << a[a##_it] << " \n"[a##_it == a##_it_ - 1];
#define show_v(v) show_a(v, v.size())
#define eachv(v, i) rep(i, v.size())
#define reachv(v, i) rrep(i, v.size())
#define debug(x) std::cerr << #x << " = " << x << "\n";

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }

int main()
{
    vector<int> times;
    rep(i, 3){
        int h, m, s;
        int start;
        int end;
        h = in();
        m = in();
        s = in();
        start = h * 3600 + m * 60 + s;
        h = in();
        m = in();
        s = in();
        end = h * 3600 + m * 60 + s;
        times.push_back(end - start);
    }
    rep(i, 3){
        int h, m, s;
        h = times[i] / 3600;
        m = (times[i] % 3600) / 60;
        s = times[i] % 60;
        printf("%d %d %d\n", h, m, s);
    }
    return (0);
}

Measured memory_bytes: 1208
const res =require('fs').readFileSync('/dev/stdin','utf8')
    .match(/^[\s\S]*?(?=\n0 0)/g)[0]
    .split('\n')
    .map(r=>r.split(' ')
        .map(Number))
    .map(([H,W])=>[...Array(H).keys()]
        .map(i=>[...Array(W).keys()]
            .map(j=>(i%2===j%2?'#':'.'))
            .join(''))
        .join('\n'))
    .join('\n\n')
    .concat('\n');
console.log(res)


Measured memory_bytes: 20144
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    let n:usize = read();
    let mut a:Vec<i64> = (0..n).map(|_| read()).collect();
    a.sort();
    a.reverse();
    println!("{}", a.iter().enumerate().filter(|&(i,_)| i%2==0).map(|(_,x)| x).sum::<i64>() - a.iter().enumerate().filter(|&(i,_)| i%2!=0).map(|(_,x)| x).sum::<i64>());
}


Measured memory_bytes: 4352
//IncubatorMan
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}

template <class T>
void read(T &x) {
    char c;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        ;
    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
#define ll long long 
#define lll __int128_t
#define pb push_back
#define mp make_pair
#define All(x) (x).begin(),(x).end()
typedef pair < int,int> ii;
typedef vector<ii> vii;
typedef vector<ll>vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll hashPrime = 1610612741;

void solve(){
    int k;
    cin>>k;
    string A;
    cin>>A;
    if(A.size()<=k){
        cout<<A<<endl;
    }
    else {
        cout<<A.substr(0,k);
        cout<<"...\n";
        //cout<<endl;
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
        int test=1;
        //read(test);
        //cin>>test;
        while(test--){
            solve();
        }
    return 0;
}

Measured memory_bytes: 3600
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[]ss = S.toCharArray();
        ArrayList<Character>a = new ArrayList<>();

        for(int i=0; i<S.length(); i++) {
        	if(!a.contains(ss[i])){		
        	      a.add(ss[i]);		
        	}
        }
        if(a.size()==S.length()){
            System.out.println("yes");    
        }else{
            System.out.println("no");
    }
}
}


Measured memory_bytes: 35652
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	minA := min(a)
	maxA := max(a)
	fmt.Println(abs(minA - maxA))
}

func min(a []int) int {
	min := a[0]
	for _, v := range a {
		if v < min {
			min = v
		}
	}
	return min
}

func max(a []int) int {
	max := a[0]
	for _, v := range a {
		if v > max {
			max = v
		}
	}
	return max
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

Measured memory_bytes: 512
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> query(m); // b, a
    REP(i, m) cin >> query[i].second >> query[i].first;
    sort(ALL(query));

    int ans = 1;
    pair<int, int> prev_query = query[0];
    FOR(i, 1, m - 1) {
        if(prev_query.first <= query[i].second) {
            ans++;
            prev_query = query[i];
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	static char[][] c;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 文字列をchar型配列に
		int H = sc.nextInt();
		int W = sc.nextInt();
		c = new char[H][W];
		for (int i = 0; i < H; i++) {
			c[i] = sc.next().toCharArray();
		}
		String ans = "Yes";

		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (c[i][j] == '.') {
					continue;
				} else {
					if (i != 0) {
						if (c[i - 1][j] == '#') {
							continue;
						}
					}
					if (i != H - 1) {
						if (c[i + 1][j] == '#') {
							continue;
						}
					}
					if (j != 0) {
						if (c[i][j - 1] == '#') {
							continue;
						}
					}
					if (j != W - 1) {
						if (c[i][j + 1] == '#') {
							continue;
						}
					}
					ans = "No";
					break;
				}
			}
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
#include <stdio.h>
#define MAX 100000

int partition(int, int);
int A[MAX];
int n;
int partition(int p,int r){
  int B,j,x,i;
  x = A[r];
  i = p-1;
  for( j = p ; j < r; j++){
    if( A[j] <= x){
      i = i+1;
      B = A[i];
      A[i] = A[j];
      A[j] = B;
    }
  }
    B = A[i+1];
    A[i+1] = A[r];
    A[r] = B;

  return i+1;
}

int main(){
  int p, i;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d",&A[i]);
  }

  p = partition(0,n-1);

  for(i = 0; i < p; i++){
    printf("%d ",A[i]);
  }

  printf("[%d]",A[p]);
  
  for(i = p + 1; i < n; i++){
    printf(" %d",A[i]);
  }
  printf("\n");

  return 0;
}

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

int main(){
  char c;
  cin >> c;
  if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') cout << "vowel" << endl;
  else cout << "consonant" << endl;
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  ll X;
  scanf("%lld",&X);
  ll Y;
  scanf("%lld",&Y);
  cout << X+Y/2 << endl;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int k;
    cin >> k;
    int val = 7%k;
    for (int i = 1; i <= 3*k; ++i) {
        if(val == 0) {
            cout << i << "\n";
            return 0;
        }
        val = (val*10+7)%k;
    }
    cout << -1 << "\n";
    return 0;
}

Measured memory_bytes: 3608
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
#import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
#sys.setrecursionlimit(10**6)
input=sys.stdin.readline
show_flg=False
#show_flg=True

n,k=MI()
a=LI()
na=[-i for i in a]
qs,ql=[],[]

def slidmin(a,k):
    n=len(a)
    b=[0 for i in range(n-k+1)]
    q=deque()
    for i in range(k):
        #show(q)
        while q and a[q[-1]]>=a[i]:
            q.pop()
        q.append(i)
    b[0]=a[q[0]]
    s=len(q)
    rt=[0 for _ in range(n-k+1)]
    if s==k:
        rt[0]=1
    for i in range(k,n):
        #show(q,i,a[q[0]])
        while q and a[q[-1]]>=a[i]:
            q.pop()
            s-=1
        q.append(i)
        s+=1
        if q[0]<=i-k:
            q.popleft()
            s-=1
        b[i-k+1]=a[q[0]]
    return rt,b

sz,m=slidmin(a,k)
sz,M=slidmin(na,k)
M=[-i for i in M]
ans=1
p=-1
c=0
for i in range(k):
    if p<a[i]:
        c+=1
    else:
        c=1
    p=a[i]
fl=True if c==k else False
show(a)
for i in range(n-k):
    if p<a[i+k]:
        c+=1
    else:
        c=1
    p=a[i+k]
    inc=1
    if c==k:
        if fl:
            inc=0
            show('c==k')
        fl=True
    if a[i]==m[i] and a[i+k]==M[i+1]:
        inc=0
        show('min=m,Max=M')
    show(i,inc)
    ans+=inc
print(ans)


Measured memory_bytes: 103880
n = input()
array = []
i = 1
while i <= n:
    x = i
    if x % 3 == 0:
        array.append(i)
    else:
        while x != 0:
            if x % 10 == 3:
                array.append(i)
                break
            x /= 10
    i += 1
print str(array).replace('[', ' ').replace(']', '').replace(',', '')

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

//#define  double pi 2*acos(0.0);
int main()
{
    int m,n,i,j,k=0;
    cin>>n;
    vector<int>a(n+1);
     for(i=0;i<n-1;i++)
     {
         cin>>j;
         a[j]++;
     }
     for(i=1;i<=n;i++)
        cout<<a[i]<<" ";
     cout<<endl;
}


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

int main() {
  int s;
  cin >> s;
  int a, b, c;
  a = s * 0.01;
  b = (s - a*100)* 0.1;
  c = (s - a*100 - b*10);
  cout <<  a + b + c << endl;
}

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

int main(){
   int a[3];
   for(int i=0;i<3;i++)cin>>a[i];
   sort(a,a+3);
   cout << (a[0]==a[1]?a[2]:a[0]);
   return 0;
}

Measured memory_bytes: 256
# AGC013A - Sorted Arrays
def main():
    N, *A = map(int, open(0).read().split())
    ans, cur = 0, A[0]
    flg = 0  # unknown (0), increasing (1), decreasing (2)
    for i in A:
        if (flg == 1 and i < cur) or (flg == 2 and i > cur):  # end of trend
            ans += 1
            flg = 0
        elif not flg and cur < i:  # new increasing trend
            flg = 1
        elif not flg and cur > i:  # new decreasing trend
            flg = 2
        cur = i
    print(ans + 1)


if __name__ == "__main__":
    main()

Measured memory_bytes: 14052
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
 
ll fac[500001],finv[500001],inv[500001];
 
void table() {
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(ll i=2;i<500001;i++){
        fac[i]= fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
 
ll comb(ll n, ll k){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

ll perm(ll n,ll k){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return (fac[k]*comb(n,k))%MOD;
}
 
int main(){
    table();
    ll N,M; cin>>N>>M;
    
    ll tmp=perm(M,N);
    rep1(k,N){
        if(k%2==0){
            tmp += (comb(N,k)*perm(M-k,N-k))%MOD;
            tmp %= MOD;
        }
        else{
            tmp -= (comb(N,k)*perm(M-k,N-k))%MOD;
            if(tmp<0) tmp += MOD;
        }
    }
    cout<<(perm(M,N)*tmp)%MOD<<endl;
}


Measured memory_bytes: 15232
package main

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

////////////////////////////////////////
///        templates                 ///
////////////////////////////////////////

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readBigLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func strSprit(str string) []string {
	cols := strings.Split(str, " ")
	return cols
}

func parseInt(str string) int {
	n, _ := strconv.Atoi(str)
	return n
}

func intSprit(str string) []int {
	strs := strSprit(str)
	cols := make([]int, len(strs))
	for i, v := range strs {
		cols[i] = parseInt(v)
	}
	return cols
}

type SortSlice []int

func (s SortSlice) Len() int {
	return len(s)
}

func (s SortSlice) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s SortSlice) Less(i, j int) bool {
	return s[i] < s[j]
}

func reverseString(str string) string {
	buf := []rune(str)
	for i, j := 0, len(buf)-1; i < j; i, j = i+1, j-1 {
		buf[i], buf[j] = buf[j], buf[i]
	}
	return string(buf)
}

////////////////////////////////////////
///        end templates             ///
////////////////////////////////////////

func main() {
	line := nextLine()
	N := parseInt(line)

	a := make([]int, N+1)
	for i := 1; i <= N; i++ {
		line = nextLine()
		a[i] = parseInt(line)
	}

	count := 0
	index := 1
	for count <= N {
		if index == 2 {
			fmt.Println(count)
			return
		} else {
			count++
			index = a[index]
		}
	}

	fmt.Println(-1)

}


Measured memory_bytes: 2048
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        double r=Double.parseDouble(br.readLine());

        double x=Math.PI;

        double a=r*r*x;
        double b=2*x*r;

        double c = a;
        String menseki=String.format("%.6f",c);
        c = b;
        String gaisyu=String.format("%.6f",c);

        System.out.println(menseki+" "+gaisyu);
	}

}



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

void main_()
{
    int N;
    array<vector<int>, 2> Ass;
    cin >> N;
    for (auto&& as : Ass) {
        copy_n(istream_iterator<int>(cin), N, back_inserter(as));
    }

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        int candies = accumulate(begin(Ass[0]), end(Ass[0]) - i, 0)
            + accumulate(begin(Ass[1]) + N - i - 1, end(Ass[1]), 0);
        ans = max(ans, candies);
    }

    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */
void yes(){
  cout << "Yes" << endl;
  exit(0);
}

void no(){
  cout << "No" << endl;
  exit(0);
}

int main() {
  ll n,d; cin >> n >> d;
  cout <<(n+2*d)/(2*d+1)<< endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-14

#define all(v) v.begin(),v.end()
#define INF (1LL<<60)
#define mp make_pair
#define pb push_back

#define fi first
#define se second

#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)

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

typedef long long ll;

#define MAX_E 200200
struct edge{
	ll to,cost;
};

// edge es[MAX_E];
ll d[MAX_E];
int N;

typedef pair<int,int> P;
vector<edge> G[MAX_E];

// void shortest_path(int s){
// 	for (int i = 0; i <= N; ++i)
// 	{
// 		d[i] = INF;
// 	}
// 	d[s]=0;
// 	while(true){
// 		bool update = false;
// 		for(int i = 0;i < N*2;i++){
// 			edge e = es[i];
// 			if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
// 				d[e.to] = d[e.from] + e.cost;
// 				update = true;
// 			}
// 		}
// 		if(!update) break;
// 	}
// }
void dijkstra(int s){
	priority_queue<P,vector<P>,greater<P>> que;
	for (int i = 0; i <= N; ++i)
 	{
 		d[i] = INF;
 	}
	d[s] = 0;
	que.push(P(0,s));
	while(!que.empty()){
		P p = que.top(); que.pop();
		int v = p.second;
		if(d[v] < p.first) continue;
		for (int i = 0; i < G[v].size(); ++i)
		{
			edge e = G[v][i];
			if(d[e.to] > d[v] + e.cost){
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to],e.to));
			}
		}
	}
}
int main(){
	int Q,K;
	cin >> N;
	rep(i,N-1){
		int a,b,c;
		cin >> a>> b >> c;
		edge t;
		t.to = b;
		t.cost = c;
		G[a].pb(t);
		t.to = a;
		G[b].pb(t);
		
	}
	cin >> Q >> K;
	dijkstra(K);
	rep(i,Q){
		int x,y;
		cin >> x >> y;
		cout << d[x]+d[y] << endl;
	}
	return 0;
}

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

int main(){
    int N;
    cin>>N;
    N = N%1000;
    if(N==0){
        cout<<0<<endl;
    }
    else{
        N=1000-N;
        cout<<N<<endl;
    }
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define ll128 __uint128_t
#define ld long double
#define pll pair <ll, ll>

#define vll vector <ll>
#define vld vector<ld>
#define vpll vector<pll>

#define vvll vector <vll>

#define rep(i, a, b) for(ll i = (ll)a; i < (ll)b; i++)
#define per(i, a, b) for(ll i = (ll)a - 1; i >= (ll)b; --i)

#define endl "\n"
#define pb push_back
#define pf push_front

#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

#define sorta(v) sort(all(v))
#define sortd(v) sort(rall(v))

#define debug if (1)
#define log(val) debug {cout << "\n" << #val << ": " << val << "\n";}

#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define file(name) freopen(name".in", "r", stdin); freopen(name".out", "w", stdout);
#define FILE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

#define mod (ll)(1e9 + 7)
#define inf (mod * mod)

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

ostream & operator << (ostream & out, vll & a) {
    for(auto i : a) out << i << " ";
    return out;
}

istream & operator >> (istream & in, vll & a) {
    for(auto &i : a) in >> i;
    return in;
}

const ll N = 2e5 + 5;
ll md = 1e9 + 7;

ll fact[N], revfact[N];

ll cnk1(ll n, ll k) {
    if (n < k || k == 0) return 1;
    return (((1LL * fact[n] % md * revfact[n - k] % md) % md) * revfact[k] % md) % md;
}

ll cnk(ll n, ll k) {
    return cnk1(n + k - 2, n - 1);
}

ll binpow (ll a, ll n, ll m) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % m;
        a = a * a % m;
        n >>= 1;
    }
    return res;
}

void precalc() {
    fact[0] = 1;
    fact[1] = 1;
    rep(i, 2, N) {
        fact[i] = (1LL * fact[i - 1] % md * i % md) % md;
    }
    revfact[0] = 1;
    revfact[N - 1] = binpow(fact[N - 1], md - 2, md);
    for(ll i = N - 2; i >= 1; i--) {
        revfact[i] = (1LL * revfact[i + 1] % md * (i + 1) % md) % md;
    }
}

int main() {
    ll h, w, a, b;
    cin >> h >> w >> a >> b;
    precalc();


    ll curi = h - a;
    ll ans = 0;
    rep(j, b + 1, w + 1) {
        ans += (cnk(curi, j) * (cnk(a, w - j + 1)));
        ans %= md;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6772
#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define FOR(i,n) for(size_t i=0;i<(n);i++)
#define REP(n) FOR(i,n)
#define cinv(v,n) for(size_t i=0;i<(n);i++){cin>>(v)[i];}
#define nvec(type,v,n) vector<type> v(n);cinv(v,n)
#define npairs(type1,type2,v,n) vector<pair<type1,type2>> v(n);for(size_t i=0;i<(n);i++){cin>>v[i].first>>v[i].second;}
#define npairs(type1,type2,v,n) vector<pair<type1,type2>> v(n);for(size_t i=0;i<(n);i++){cin>>v[i].first>>v[i].second;}
#define ntuples(type1,type2,type3,v,n) vector<tuple<type1,type2,type3>> v(n);for(size_t i=0;i<(n);i++){cin>>get<0>(v[i])>>get<1>(v[i])>>get<2>(v[i]);}

#define min_index(v) size_t(min_element(all(v))-(v).begin())
#define max_index(v) size_t(max_element(all(v))-(v).begin())
#define min_e(v) *min_element(all(v))
#define max_e(v) *max_element(all(v))

#define count_le(v,a) size_t(upper_bound(all(v),a)-(v).begin())
#define count_lt(v,a) size_t(lower_bound(all(v),a)-(v).begin())
#define count_ge(v,a) size_t((v).end()-lower_bound(all(v),a))
#define count_gt(v,a) size_t((v).end()-upper_bound(all(v),a))

#define order(neq_sl) [](const auto s, const auto l){return neq_sl;}
#define make_lr(v,type,l,r) vector<type> l(n+1),r(n+1);FOR(i,n){l[i+1]=l[i]+v[i];r[i+1]=r[i]+v[n-1-i];}

#define acm accumulate
#define SUM(v) accumulate(all(v),0l)


int main() {
  char a;
  cin>>a;
  cout<<char(a+1);
}

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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))

int64 gcd(int64 a, int64 b){
  /* a >= b */
  int64 c = a%b;
  if(c==0){
    return b;
  }else{
    return gcd(b, a%b);
  }
}

int main(int argc, char *argv[])
{
  int n;
  scanf("%d", &n);

  int64 *a;
  a = (int64*)malloc(sizeof(int64)*n);

  int i;
  for(i=0;i<n;i++){
    scanf("%lld", a+i);
  }

  int ans=a[0];
  for(i=1;i<n;i++){
    if(a[i]>ans) ans = gcd(a[i], ans);
    else ans = gcd(ans, a[i]);
  }
  printf("%d\n", ans);
  return 0;
}


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

#define ll long long
#define mod 1000000007
#define debug1(x) cerr<<#x<<" : "<<x<<"\n";
#define debug2(x,y) cerr<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\n";
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

vector<ll>adj[200001];
bool vis[200001]={false};
ll temp=0;
void dfs(ll s){
    temp++;
    vis[s]=true;
    for(ll i=0;i<adj[s].size();i++){
        if(vis[adj[s][i]]==false)dfs(adj[s][i]);
    }

}

int main() {
    IOS;
    ll n,m;
    cin>>n>>m;
    ll a[m],b[m];
    for(ll i=0;i<m;i++){
        cin>>a[i]>>b[i];
        adj[a[i]].push_back(b[i]);
        adj[b[i]].push_back(a[i]);
    }
    ll ans=0;
    for(ll i=1;i<=n;i++){
        if(vis[i]==false){
            temp=0;
            dfs(i);
            ans = max(ans,temp);
        }
    }
    cout<<ans;


    return 0 ;
}


Measured memory_bytes: 24036
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
char s[100000];
long long n, f[4][100000]; // 0 ? 1 A 2 AB 3 ABC

int main(){
    scanf("%s", s + 1);
    n = strlen(s + 1);
    f[0][0] = 1;
    for (int i = 1; i <= n; i++){
        for (int j = 0; j <= 3; j++){
            f[j][i] = f[j][i-1];
            if (s[i] == '?') f[j][i] = (f[j][i]*3)% mod;
            if (j > 0 && (s[i] == '?' || s[i] - 'A' + 1 == j)){
                f[j][i] = (f[j][i] + f[j-1][i-1])% mod;
            }
        }
    }
    cout << f[3][n];
}


Measured memory_bytes: 3456
$t1, $t2 = gets.chomp.split.map(&:to_i)
$a1, $a2 = gets.chomp.split.map(&:to_i)
$b1, $b2 = gets.chomp.split.map(&:to_i)

if $a1*$t1 + $a2*$t2 == $b1*$t1 + $b2*$t2
    puts "infinity"
    exit 0
end

def f(t)
    c = t / 2
    if t % 2 == 0
        a = $a1 * $t1 * c + $a2 * $t2 * c
        b = $b1 * $t1 * c + $b2 * $t2 * c
        aa = a + $a1 * $t1
        bb = b + $b1 * $t1
        return false if a == b
        if a < b
            return aa >= bb
        else
            return aa <= bb
        end
    else
        a = $a1 * $t1 * (c+1) + $a2 * $t2 * c
        b = $b1 * $t1 * (c+1) + $b2 * $t2 * c
        aa = a + $a2 * $t2
        bb = b + $b2 * $t2
        return false if a == b
        if a < b
            return aa >= bb
        else
            return aa <= bb
        end
    end
end

if not f(1)
    puts "0"
    exit 0
end

ok = 1
ng = 1<<60

while ok+1 < ng
    x = (ok + ng) / 2
    if f(x)
        ok = x
    else
        ng = x
    end
end

puts ok


Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
struct node{
	long long x,s;
}a[200005];
long long n,maxn,sum;
long long f[200005];
bool cmp(node a,node b){
	return a.s<b.s;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>a[i].s>>a[i].x;
	sort(a+1,a+n+1,cmp);
	f[1]=maxn=a[1].x;
//	for(int i=2;i<=n;i++){
		for(int j=2;j<=n;j++){
			f[j]=max(f[j-1]+a[j].x-a[j].s+a[j-1].s,a[j].x);
		}
//	}
	for(int i=1;i<=n;i++){
		maxn=max(maxn,f[i]);
	}
	cout<<maxn<<endl;
	return 0;
}

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



int main()
{
	int a, b;

	cin >> a >> b;

	int i, j;
	char ta[50][50];
	char ca[50][50];

	for (i = 0; i < a; i++) {
		for (j = 0; j < b; j++) {
			cin >> ta[i][j];
		}
	}

	int l, k, count;

	for (i = 0; i < a; i++) {
		for (j = 0; j < b; j++) {

			if (ta[i][j] == '.') {
				count = 0;
				for (k = -1; k <= 1; k++) {
					for (l = -1; l <= 1; l++) {
						if (i + k < 0 || i + k >= a || j + l < 0 || j + l >= b) {
							continue;
						}

						if (ta[i + k][j + l] == '#') {
							count++;
						}
					}
				}

				ca[i][j] = '0' + count;
			}
			else {
				ca[i][j] = ta[i][j];
			}
		}
	}

	for (i = 0; i < a; i++) {
		for (j = 0; j < b; j++) {
			cout << ca[i][j];
		}

		cout << endl;
	}


    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    string s;
    cin >> s;
    int n = s.size(), cnt = 0;
    for (int i = 0; i < n; i++) {
        if (i & 1) {
            if (s[i] == '0') cnt++;
        } else if (s[i] == '1') cnt++;
    }
    cout << min(cnt, n - cnt) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define c(n) cin>>n
#define co(n) cout<<n<<endl
using namespace std;

int main(){
  long a,b=2,c=0,d=0,e,n,m=0;
  c(n);
  for(int i=1;i<=n;i+=2){
    rep(j,1,i+1){
      if(i%j==0) c++;
    }
    if(c==8) d++;
    c=0;
  }
  co(d);
    
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int mx[100005];
int tot[100005];

signed main()
{

ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int n;
    cin>>n;
    int a[n+1];
    for(int i=0;i<=n;i++)
    {
        cin>>a[i];
    }
    mx[0]=1-a[0];
    if(mx[0]<0)
    {
        cout<<-1;
        return 0;
    }
    for(int i=1;i<=n;i++)
    {
        int z=mx[i-1]*2-a[i];
        int mm=1e15;
        z=min(z,mm);
        if(z<0)
        {
            cout<<-1;
            return 0;
        }
        mx[i]=z;
    }
    tot[n]=a[n];
    for(int i=n-1;i>=0;i--)
    {
        int z=tot[i+1];
        tot[i]=a[i]+min(mx[i],tot[i+1]);
    }
    for(int i=1;i<=n;i++)
    {
        int z=tot[i-1]-a[i-1];
        z*=2;
        if(tot[i]>z)
        {
            cout<<-1;
            return 0;
        }
    }
    int ans=0;
    for(int i=0;i<=n;i++)
    {
        ans+=tot[i];
    }
    
    cout<<ans;

} 



Measured memory_bytes: 5956
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

template<class T>
struct SegmentTree {
private:
    int n;
    vector<T> node;
    T def;
    function<T(T,T)> lop;
    function<T(T,T)> out;
    
public:
    SegmentTree() {}
    SegmentTree(const vector<T> &v, T _def, function<T(T,T)> _lop, function<T(T,T)> _out) {
        int vl = (int)v.size();
        n = 1;
        while(n < vl) n *= 2;
        def = _def; lop = _lop; out = _out;
        node = vector<T>(2 * n - 1, def);
        for(int i = 0; i < vl; i++) node[i + n - 1] = v[i];
        for(int i = n - 2; i >= 0; i--) node[i] = out(node[i * 2 + 1], node[i * 2 + 2]);
    }
    
    void update(int idx, T val) {
        idx += (n - 1);
        node[idx] = lop(node[idx], val);
        while(idx > 0) {
            idx = (idx - 1) / 2;
            node[idx] = out(node[idx * 2 + 1], node[idx * 2 + 2]);
        }
    }
    
    T query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if ((r <= a) || (b <= l)) return def;
        if ((a <= l) && (r <= b)) return node[k];
        return out(query(a, b, 2 * k + 1, l, (l + r) / 2), query(a, b, 2 * k + 2, (l + r) / 2, r));
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll inf = LONG_LONG_MIN / 2 + 1;
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    auto lop = [](ll a, ll b){ return a + b; };
    auto out = [](ll a, ll b){ return max(a, b); };
    SegmentTree<ll> st(a, inf, lop, out);
    rep(i, n) {
        ll lv = st.query(0, i);
        ll rv = st.query(i + 1, n);
        cout << max(lv, rv) << endl;
    }
    return 0;
}


Measured memory_bytes: 7296
#include<stdio.h>
#include<stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(long*)b - *(long*)a;
}

struct sara{
	long a;
	long b;
	int i;
};

struct kei{
	long sum;
	int i;
};

int main(){
	int n,i/*,ct=0,ca=0,siyo[100000]={0},mina=0,mint=0*/;
	struct sara ab[100000]/*,abcp[100000]*/;//cp a:-b,b:-a
	long long ans=0,taka=0,aoki=0;
	struct kei kei[100000];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%ld%ld",&ab[i].a,&ab[i].b);
	//	abcp[i].b=ab[i].a;
	//	abcp[i].a=ab[i].b;
		ab[i].i/*=abcp[i].i*/=i;
		kei[i].i=i;
		kei[i].sum=ab[i].a+ab[i].b;
	}
//	qsort(ab,n,sizeof(struct sara),compare_int);
//	qsort(abcp,n,sizeof(struct sara),compare_int);
	qsort(kei,n,sizeof(struct kei),compare_int);
	for(i=0;i<n;i++){
		if(i%2==0){
//		for(ct=mint;ct<n;ct++){
//			if(siyo[ab[ct].i]==0){
	//			siyo[ab[ct].i]=1;
	//			taka+=ab[ct].a;
	//			mint=ct;
				taka+=ab[kei[i].i].a;
//				break;
//			}
//		}
		}else {
//		for(ca=mina;ca<n;ca++){
//			if(siyo[abcp[ca].i]==0){
	//			siyo[abcp[ca].i]=1;
	//			aoki+=abcp[ca].a;
	//			mina=ca;
				aoki+=ab[kei[i].i].b;
//				break;
//			}
//		}
		}
	}
//	for(i=0;i<n;i++)printf("%ld,%ld\n",abcp[i].a,abcp[i].b);
	printf("%lld\n",taka-aoki);
	return 0;
}

Measured memory_bytes: 5628
#include <stdio.h>
int main(){
    int x,y;
    for(;;) {
        scanf("%d%d", &x,&y);
        if (x == 0 && y == 0) {
            break;
        }
        if(x < y){
            printf("%d %d\n",x,y);
        }else if(x > y){
            printf("%d %d\n",y,x);
        }else{
            printf("%d %d\n",x,y);
        }
    }
     return 0;
}


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

int main() {
	vector<char> c(9);
	rep(i, 9) cin >> c[i]; 
	printf("%c%c%c\n", c[0], c[4], c[8]);
	return 0;
}

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

using namespace std;

#ifndef aa
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
#define deb(x) cout << x << endl
#define done(x) {cout << x << endl;return;}
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
//const int mod = 998244353;
const int mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
typedef map<int, int> mii;
typedef set<int> si;
typedef set<pair<int,int>> spii;
typedef queue<int> qi;


const int N = 2e5 + 5;


void solve() {

  int n;
  cin>>n;
  map<string,int> mp;
  rep(_,0,n){
   string s;
   cin>>s;
   mp[s]++;
  }
  vector<string> v = {"AC","WA","TLE","RE"};
  trav(s,v)
    cout<<s<<" x "<<mp[s]<<endl;
   
          
}


signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout << fixed << setprecision(15);
    int t = 1;
    //cin >> t;

    while (t--)
        solve();
#ifdef aa
    cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}




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


int divide(int a, int b) {
    return (a % mod) * powm(b, mod - 2) % mod;
}

int norm(int a) {
    while (a >= mod) a -= mod;
    while (a < 0) a += mod;
    return a;
}


int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}


Measured memory_bytes: 3636
#include <stdio.h>

int main(){
	int countTable[256] = {0};
	char ch;

	while((ch = getchar()) != EOF){
				countTable[ch]++;
	}
	for(int i = 97; i <=122;i++)printf("%c : %d\n",i,countTable[i]+countTable[i-32]);
}



Measured memory_bytes: 2620
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N=2e5+100;
const int M=4e5+100;
int head1[N],ver1[M],Next1[M];
int tot1,tot2;
int add1(int x,int y)
{
	ver1[++tot1]=y;
	Next1[tot1]=head1[x];
	head1[x]=tot1;
}

int head2[N],ver2[M],Next2[M];
int add2(int x,int y)
{
	ver2[++tot2]=y;
	Next2[tot2]=head2[x];
	head2[x]=tot2;
}
int cnt=0;
int c1[N],c2[N];
void dfs1(int x)
{
	c1[x]=cnt;
	for(int i=head1[x]; i; i=Next1[i])
	{
		int y=ver1[i];
		if(c1[y])continue;
		dfs1(y);
	}
}
void dfs2(int x)
{

	c2[x]=cnt;
	for(int i=head2[x]; i; i=Next2[i])
	{
		int y=ver2[i];

		if(c2[y])continue;
		dfs2(y);
	}
}

map<pair<int,int>,int>MM;
int main()
{
	int n,k,l;
	cin>>n>>k>>l;
	for(int i=1; i<=k; i++)
	{
		int x,y;
		cin>>x>>y;
		add1(x,y);
		add1(y,x);
	}
	for(int i=1; i<=l; i++)
	{
		int x,y;
		cin>>x>>y;
		add2(x,y);
		add2(y,x);
	}
	for(int i=1; i<=n; i++)
	{
		if(c1[i]==0)
		{
			cnt++;
			dfs1(i);
		}
	}
	cnt=0;
	for(int i=1; i<=n; i++)
	{
		if(c2[i]==0)
		{
			cnt++;
			dfs2(i);
		}
	}
	for(int i=1; i<=n; i++)
		MM[make_pair(c1[i],c2[i])]++;
	for(int i=1; i<=n; i++)
	{
		cout<<MM[make_pair(c1[i],c2[i])]<<" ";
		if(i==n)cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 20352
#include <iostream>

using namespace std;

int *A;

int main(void)
{
	int N, min = 500000000;
	cin >> N;

	A = new int[N];
	for (int i = 0; i < N; ++i) {
		int cnt = 0;
		cin >> A[i];
		while (A[i] % 2 == 0) {
			A[i] /= 2;
			++cnt;
		}
		if (cnt < min) {
			min = cnt;
		}
	}

	cout << min << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;

# define mp make_pair
# define pb push_back
# define PI acos(-1)
# define ff first 
# define ss second 
# define endl '\n'
# define vt vector
# define all(c) (c).begin(), (c).end()
# define rep(i,a,b) for(int i = a ; i < b ; ++i)

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

template<class T> bool umin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool umax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

const int MOD = 1e9+9 ;
const ll inf = 1e18 ;  
const ll mod = 1e9+7 ;  

ll nCr(ll n,ll r){ll t=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){t*=(n-i);t/=(i+1);}return t;}
ll power(ll a, ll n) { ll r=1;while(n){if(n&1)r=(r*a)%MOD;n>>=1;a=(a*a)%MOD;}return r%MOD;}
ll sq(int x) { ll ans = x*x ; return ans ; }
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
void read(vt<int> &a) {
	rep(i,0,a.size()) 
	cin >> a[i] ; 
}
void read(vt<ld> &a) {
	rep(i,0,a.size()) 
	cin >> a[i] ; 
}

// ==========Start Here==============

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL) ; 
	
	ll n ; 
	cin >> n ; 
	n--; 
	cout << (n*(n+1))/2  ; 

 	
 	return 0 ; 
 	
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int h;
    while(cin >> h, h){
        vector<vector<int>> v(7, vector<int>(h+2, -1));
        for (int i = 0; i < h; ++i) {
            for (int j = 0; j < 5; ++j) {
                scanf("%d", &v[j+1][i+1]);
            }
        }
        int ok = 1, ans = 0;
        while(ok){
            ok = 0;
            for (int i = 4; i >= 2; --i) {
                for (int j = 0; j < h; ++j) {
                    for (int k = 0; k+i < 5; ++k) {
                        int w = 1;
                        for (int l = k; l < k+i; ++l) {
                            if(v[l+1][j+1] != v[l+2][j+1]) w = 0;
                            if(v[l+1][j+1] == -1) w = 0;
                        }
                        if(w){
                            ok = 1;
                            for (int l = k; l <= k+i; ++l) {
                                ans += v[l+1][j+1];
                                v[l+1][j+1] = -1;
                            }
                            break;
                        }
                    }
                }
            }
            for (int i = 1; i <= 5; ++i) {
                stable_sort(v[i].begin()+1,v[i].end()-1, [&](int x, int y){
                    return (x == -1) > (y == -1);
                });
            }
        }
        cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 3216
#include<cstdio>
#include<cstring>
using namespace std;

const int maxn=30,inf=0x3f3f3f3f;
int n,m,f[500][500],ans,mx[4]={-1,0,1,0},my[4]={0,-1,0,1},id[maxn][maxn],cnt;
char c[maxn][maxn];
bool b[500];

int mmax(int a,int b)
{
	if (a>=b)
		return a;
	return b;
}

int mmin(int a,int b)
{
	if (a<=b)
		return a;
	return b;
}

bool jud(int x,int y)
{
	return x>=1&&x<=n&&y>=1&&y<=m;
}

int main()
{
	int i,j,k,x,y;
	scanf("%d%d",&n,&m);
	memset(f,0x3f,sizeof(f));
	for (i=1;i<=n;i++)
		scanf("%s",c[i]+1);
	for (i=1;i<=n;i++)
		for (j=1;j<=m;j++)
		{
			id[i][j]=(++cnt);
			if (c[i][j]=='.')
				b[cnt]=1,f[cnt][cnt]=0;
		}
	for (i=1;i<=n;i++)
		for (j=1;j<=m;j++)
			if (c[i][j]=='.')
				for (k=0;k<=3;k++)
				{
					x=i+mx[k],y=j+my[k];
					if (jud(x,y)&&c[x][y]=='.')
						f[id[i][j]][id[x][y]]=f[id[x][y]][id[i][j]]=1;
				}
	for (k=1;k<=cnt;k++)
		if (b[k])
		for (i=1;i<=cnt;i++)
			if (b[i])
			if (i!=k)
				for (j=1;j<=cnt;j++)
					if (b[j])
					if (i!=j&&k!=j)
						f[i][j]=mmin(f[i][k]+f[k][j],f[i][j]);
	for (i=1;i<=cnt;i++)
		if (b[i])
		for (j=1;j<=cnt;j++)
			if (b[j])
			if (f[i][j]<inf)
				ans=mmax(ans,f[i][j]);
	printf("%d\n",ans);
}

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

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


Measured memory_bytes: 3736