akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T, class T2> void smin(T& a, T2 val) {if (a > val) a = val;}template<class T, class T2> void smax(T& a, T2 val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N];

int32_t main(){_
   
   cin>>n;

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

   int ans = 0;
   for (int i = 0; i < n; ++i)
   {
      for (int j = i+1; j < n; ++j)
      {
         for (int k = j+1; k < n; ++k)
         {
            if (a[i] == a[j] or a[i] == a[k] or a[j] == a[k]){
               continue;
            }
            if (a[j] + a[k] > a[i] and a[k] + a[i] > a[j] and a[j] + a[i] > a[k]){
               tr(i+1, j + 1, k+1);
               ++ans;
            }
         }
      }
   }
   
   cout<<ans;

   return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <utility>
using namespace std;	

struct lp
{
	int s, e, d;
	bool operator<(const lp &r) const {
		if (e != r.e) return e < r.e;
		return s < r.s;
	}
};

lp p[100009];
int d[100009];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		int x, l; cin >> x >> l;
		p[i].s = x - l; p[i].e = x + l; p[i].d = 0;
	}
	sort(p, p + n);
	p[n].e = 2000000099; p[n].s = 0;
	int ans = 1;
	for (int i = 0; i < n; i++) {
		lp t; t.s = 2000000009; t.e = p[i].s;
		auto r = lower_bound(p, p + n + 1, t); 
		if (r == p) {
			p[i].d = max(1, p[i - 1].d); continue;
		}
		r--;
		p[i].d = max(p[i - 1].d, (*r).d + 1);
		ans = max(ans, p[i].d);
	}
	cout << ans << '\n';
	return 0;
}	

Measured memory_bytes: 1536
n = int(input())
a = [""] * n
for i in range(n):
    a[i] = input()

a.sort()

ans = []
count = 1
for i in range(n-1):
    if a[i] != a[i+1]:
        ans.append((-count, a[i]))
        count = 1
    else:
        count += 1

ans.append((-count, a[-1]))

ans.sort()
mx, _ = ans[0]
for c, s in ans:
    if c == mx:
        print(s)
    else:
        break




Measured memory_bytes: 34820
#include <iostream>
#include <string>
#include <vector>
#include <boost/algorithm/string.hpp>

int countWord(std::string& word, std::string& text) {
  std::vector<std::string> words;
  boost::to_lower(text);
  boost::split(words, text, boost::is_space());

  int count = 0;
  for (auto s : words) {
    if (s == word) count++;
  }
  return count;
}

int main() {
  std::string word, buf, text = "";
  const std::string eot = "END_OF_TEXT";

  std::cin >> word;
  while (std::cin >> buf) {
    if (text == eot) break;
    text += buf + " ";
  }

  std::cout << countWord(word, text) << std::endl;
  return 0;
}



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

int main()
{
	int h, w, n, sr, sc;
	string s, t;
	cin >> h >> w >> n >> sr >> sc >> s >> t;
	auto test = [&s, &t, &n](bool lr, int p, int edge) -> bool {
		int sf = 0, sb = 0, tf = 0, tb = 0;
		for(auto i = 0; i < n; ++i){
			if((lr && s[i] == 'R') || (!lr && s[i] == 'D')){
				++sf;
			}
			if((lr && s[i] == 'L') || (!lr && s[i] == 'U')){
				++sb;
			}
			if(sf + sb + 1 > edge || p + sf - tb > edge || p - sb + tf < 1){
				return false;
			}
			if((lr && t[i] == 'R') || (!lr && t[i] == 'D')){
				if(sb > 0){
					--sb;
				}else{
					tf = min(edge - p, tf + 1);
				}
			}
			if((lr && t[i] == 'L') || (!lr && t[i] == 'U')){
				if(sf > 0){
					--sf;
				}else{
					tb = min(p - 1, tb + 1);
				}
			}
		}
		return true;
	};
	cout << (test(true, sc, w) && test(false, sr, h) ? "YES" : "NO") << endl;
	return 0;
}

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

using namespace std;
#define MAXN 201010
int n, v[MAXN], l[MAXN], r[MAXN];
stack<int> p;
int main(){
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> v[i];
		while(!p.empty() && v[p.top()] > v[i])
			p.pop();
		l[i] = p.empty() ? 0 : p.top();
		p.push(i);
	}
	
	while(!p.empty())
		p.pop();
		
	long long ans = 0LL;
	for (int i = n; i >= 1; i--)
	{
		while(!p.empty() && v[p.top()] > v[i])
			p.pop();
		r[i] = p.empty() ? n + 1 : p.top();
		p.push(i);
		
		ans += (long long)v[i] * (i - l[i]) * (r[i] - i);
	}
	cout << ans << "\n";
	
	return 0;
}


Measured memory_bytes: 3456
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();
        long lcm = lcm(c,d);
        long ac = (a-1)/c;
        long bc = b/c;
        long ad = (a-1)/d;
        long bd = b/d;
        long al = (a-1)/lcm;
        long bl = b/lcm;
        System.out.println(b - (a-1) - (bc + bd - bl - (ac + ad - al)));
        sc.close();

    }

    public static long lcm(long a, long b) {
        return a * b / gcd(a, b);
    }

    public static long gcd(long a, long b) {
        if (a < b)
            return gcd(b, a);
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<string.h>
#include<math.h>
using namespace std;
long long n;
long long a[1000003],b[1000003],c[1000003];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
    	cin>>a[i];
	}
	for(int i=1;i<=n;i++){
    	cin>>b[i];
	}
	for(int i=1;i<=n;i++){
    	cin>>c[i];
	}
    sort(a+1,a+1+n),sort(b+1,b+1+n),sort(c+1,c+1+n);
    long long sum=0;
    long long ai=0,ci=0;
    for(int i=1;i<=n;i++){
        while(a[ai+1]<b[i]&&ai+1<=n){
        	ai++;
		}
        while(c[ci+1]<=b[i]&&ci+1<=n){
        	ci++;
		}
        sum+=ai*(n-ci);
    }
    cout<<sum<<endl;
    return 0;
}
/*

in:
2
1 5
2 4
3 6

out:
3

*/

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

int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
}
map<ll,ll> m;
rep(i,n)m[a[i]]++;
for (auto i = m.begin(); i != m.end(); ++i) {
  ans+=(i->second-1)*i->second;
}
rep(i,n){
  cout << (ans-(m[a[i]]-1)*m[a[i]]+(m[a[i]]-1)*(m[a[i]]-2))/2 << endl;
  
}
return 0;
}

Measured memory_bytes: 11136
def main():
    N = int(input())
    T = []
    for i in range(N):
        T.append(int(input()))
    
    def lcm(a):
        from fractions import gcd
        x = a[0]
        for i in range(1, len(a)):
            x = (x * a[i]) // gcd(x, a[i])
        return x

    r = lcm(T)
    print(r)



if __name__ == "__main__":
    main()

Measured memory_bytes: 5240
import sys
input = sys.stdin.buffer.readline
N = int(input())
L = list(map(int, input().split()))

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            if L[i] == L[j]:
                continue
            if L[j] == L[k]:
                continue
            if L[k] == L[i]:
                continue
            if L[i] + L[j] <= L[k]:
                continue
            if L[j] + L[k] <= L[i]:
                continue
            if L[k] + L[i] <= L[j]:
                continue
            ans += 1
print(ans)


Measured memory_bytes: 9276
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout <<" "<<kbrni;cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

int main()
{
    int n;
    cin >> n;
    vector<int> vec(n);
    rep(i,n){
        cin >> vec[i];
    }
    if(n == 1){
        cout << vec[0] << "\n";
        return 0;
    }
    if(n % 2 == 0){
        int hoge = n / 2;
        for(int i=hoge;i>=1;i--){
            cout << vec[2*i-1] << " ";
        }
        for(int i=0;i<hoge-1;i++){
            cout << vec[2*i] << " ";
        }
        cout << vec[2*(hoge-1)] << "\n";
    }else{
        int hoge = n / 2;
        for(int i=hoge;i>=0;i--){
            cout << vec[2*i] << " ";
        }
        for(int i=1;i<hoge;i++){
            cout << vec[2*i-1] << " ";
        }
        cout << vec[2*hoge-1] << "\n";
    }
    return 0;
}


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

int main()
{
    int n;
    cin>>n;
    string ans="AGC";
    if(n<1200)ans="ABC";
    else if(n<2800)ans="ARC";
    cout<<ans<<endl;
    return 0;
}


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

int map[100][100] = {} ;
int dx[] = { -1,1 } ;
int dy[] = { 1,-1 } ;
int n , m , p=0 ;

void move( int count , int ny , int  nx ){
	
	map[ny][nx] = count ;
	count++;
	
	if( ny == n-1 && nx == n-1 ){}
	else {
		if( ny+dy[m%2] >= 0 && ny+dy[m%2] <= n-1 &&
			nx+dx[m%2] >= 0 && nx+dx[m%2] <= n-1 )
				move( count , ny+dy[m%2] , nx+dx[m%2] ) ;
		else {
			m++;
			if( ny == 0 || ny == n-1 ){
				if( nx == n-1 ) move( count , ny+1 , nx ) ;
				else move( count , ny , nx+1 ) ;
			}
			else if( nx == 0 || nx == n-1 )
				move( count , ny+1 , nx ) ;
		}
	}
}

int main(){
	
	while(1){
		cin >> n ;
		if( n == 0 ) break ;
		
		m = 1 ;
		p++ ;
		
		move( 1 , 0 , 0 ) ;
		
		cout << "Case " << p << ':' << endl ;
		for( int i=0 ; i<n ; i++ ){
			for( int j=0 ; j<n ; j++ ){
				if( map[i][j] < 10 ) cout << ' ' ;
				if( map[i][j] < 100 ) cout << ' ' ;
				cout << map[i][j] ;
			}
			cout << endl ;
		}
	}
	
return 0 ;
}

Measured memory_bytes: 1168
#include<bits/stdc++.h>
#define ts cout<<"ok"<<endl
#define ll long long
#define hh puts("")
using namespace std;
int n;
struct node{
	string s;
	int id,sc;
}a[10005];
inline int read(){
    int ret=0,ff=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') ff=-ff;ch=getchar();}
    while(isdigit(ch)){ret=ret*10+(ch^48);ch=getchar();}
    return ret*ff;
}
inline bool check(string a,string b){//aa是否小于bb,是:1 
	int len=a.length();
	for(int i=0;i<len;i++){
		if(a[i]<b[i]) return 1;
		if(a[i]>b[i]) return 0;
	}
	return 0;
}
inline bool cmp(node aa,node bb){
	return aa.s==bb.s?aa.sc>bb.sc:aa.s<bb.s;
}
signed main(){
	n=read();
	for(int i=1;i<=n;i++){
		cin>>a[i].s;
		a[i].sc=read();
		a[i].id=i;
	}
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++) printf("%d\n",a[i].id);
    return 0;
}

Measured memory_bytes: 384
#include <iostream>

int min3(int x, int y, int z)
{
	if (x>y) return y>z ? z : y;
	else return x>z ? z : x;
}

int main()
{
	while (true) {
		int size;
		std::cin >> size;
		
		if (size==0) break;
		
		std::string* board = new std::string[size];
		for (int i=0; i<size; i++) {
			std::cin >> board[i];
		}
		
		int** max_square_size = new int*[size]; 
		for (int i=0; i<size; i++) {
			max_square_size[i] = new int[size];
		}
		
		int max_size = 0;
		for (int i=size-1; i>=0; i--) {
			for (int j=size-1; j>=0; j--) {
				if (board[i][j] == '*') max_square_size[i][j] = 0;
				else if (i==size-1 || j==size-1) max_square_size[i][j] = 1;
				else if (board[i+1][j] == '*' || board[i][j+1] == '*' || board[i+1][j+1] == '*') max_square_size[i][j] = 1;
				else {
					max_square_size[i][j] = min3(max_square_size[i+1][j], 
						max_square_size[i][j+1], max_square_size[i+1][j+1]) + 1;
				}
				if (max_square_size[i][j] > max_size) {
					max_size = max_square_size[i][j];
				}
			}
		}
		
		for (int i=0; i<size; i++) delete[] max_square_size[i];
		delete[] max_square_size;
		delete[] board;
		
		std::cout << max_size << std::endl;
	}
	
	return 0;
}
	


Measured memory_bytes: 7968
import sys
import numpy as np

input=sys.stdin.readline

n,k=map(int,input().split())
h=[0]*n
h=list(map(int,input().split()))

dp=np.zeros(n,dtype=int)
h=np.array(h)

for i in range(1,n):
  start=max(0,i-k)
  dp[i]=min(dp[start:i] + np.abs(h[i]-h[start:i]))

print(dp[n-1])

Measured memory_bytes: 23604
#include <bits/stdc++.h>
int g[50][50];
using namespace std;

int main(){
  int N;
  cin>>N;
  int k;
  std::vector<string> S(N);
  for(int i=0;i<N;i++)cin>>S[i];
  for(int i=0;i<N;i++)for(int j=0;j<S[i].size();j++)g[i][(char)S[i][j]-97]++;
  for(int j=0;j<26;j++){
    k=100;
    for(int i=0;i<N;i++)k=min(k,g[i][j]);
    for(int l=0;l<k;l++)cout<<(char)(j+97);
  }
  cout<<endl;
}


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

#define ull unsigned long long
#define endl '\n'
#define ll long long
const int N = 2e5 + 5;
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        //freopen("VLJUM.INP", "r", stdin);
        //freopen("VLJUM.OUT", "w", stdout);
        ll n;
        cin >> n;
        ll sum = 0;
        for (int i = 1; i <= n; i++){
                if (i % 3 != 0 && i % 5 != 0) {
                        sum += i;
                }
        }
        cout << sum;
}


Measured memory_bytes: 3648
#! -*- coding: utf-8 -*-

def shiritori(words):
    history = set()
    pre = None
    for cur in words:
        if cur in history:
            return False
        if pre and pre[-1] != cur[0]:
            return False
        history.add(cur)
        pre = cur
    return True

def main():
    n = int(input())
    words = []
    for _ in range(n):
        words.append(input().strip())
    if shiritori(words):
        print('Yes')
    else:
        print('No')

main()


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

int main() {
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	char d = 'A' - 'a';

	cout << (char)(s1[0]+d);
	cout << (char)(s2[0]+d);
	cout << (char)(s3[0]+d);
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int a;
scanf("%d",&a);
if(a==9 || a==19||a==29||a==39||a==49 || a==59||a==69||a==79||a==89)
printf("Yes\n");
else if(a>=90)
printf("Yes\n");
else
printf("No\n");
return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>
int main ()
{
    int i,j,n,a,max=0,sum,b;
    char s[100],m[100];
    scanf("%d",&n);
    scanf("%s",s);
    for(i=0;i<n;i++)
    {
        sum=0;
        for(j=0;j<=i;j++)
        {
            for(a=i+1;a<n;a++)
            {
                if(s[j]==s[a])
                {
                    int fh=0,b=0;
                    for(;m[b]!='\0';b++)
                    {
                        if(m[b]==s[a])
                        {
                            fh=1;break;
                        }
                    }
                    if(fh==0)
                    {
                        m[b]=s[a];sum++;
                    }
                }
            }
        }
        for(b=0;m[b]!='\0';b++)
            m[b]='\0';
        if(sum>max)
            max=sum;
    }
    printf("%d\n",max);
    return 0;
}



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

for _ in range(h):
    cloud = list(input())
    cnt = -1
    flag = False
    ans = []
    for c in cloud:
        if c == "c":
            flag = True
            cnt = 0
        elif flag:
            cnt += 1
        ans.append(cnt)
    print(' '. join(str(a) for a in ans))


Measured memory_bytes: 5612
import itertools


def _run(a, b, c, k):
    for conditions in itertools.product([0, 1, 2], repeat=k):
        buff = [a, b, c]
        for condition in conditions:
            buff[condition] = buff[condition] * 2
        if buff[0] < buff[1] < buff[2]:
            print("Yes")
            return
    print("No")


def _main():
    A, B, C = map(int, input().split())
    K = int(input())
    _run(A, B, C, K)


if __name__ == "__main__":
    _main()


Measured memory_bytes: 9192
a, b, m = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
m_list = [list(map(int, input().split())) for i in range(m)]

normal_min = min(a_list) + min(b_list)
for m_list_it in m_list:
    x, y, c = m_list_it[0], m_list_it[1], m_list_it[2]
    spe_min = a_list[x-1] + b_list[y-1] - c
    if spe_min < normal_min:
        normal_min = spe_min
print(normal_min)

Measured memory_bytes: 38560
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] l = new int[n];
    int sum = 0;

    for(int i = 0; i < n; i++) {
      l[i] = sc.nextInt();
    }
    
    Arrays.sort(l);

    for(int i = n-2; i >= 0; i--) {
      sum += l[i];
    }

    if(l[n-1] < sum) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }

}


Measured memory_bytes: 21972
def sequence_decomposing(arr)
  seq_last_nums = [arr.shift]

  arr.each do |a|
    j = seq_last_nums.bsearch_index { |x| x >= a }

    if j.nil?
      seq_last_nums[-1] = a
    elsif j == 0
      seq_last_nums.unshift(a)
    else
      seq_last_nums[j - 1] = a
    end
  end

  seq_last_nums.size
end

n = gets.to_i
arr = []
n.times{ arr << gets.to_i }

puts sequence_decomposing(arr)


Measured memory_bytes: 4148
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <string>
#define F first
#define S second
using namespace std;
int n,m;
int c;
int f[22][22];
typedef pair<int,int> P;
vector<P> v;

int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
bool used[33];
map<P,int> dp;
int solve(int bit,int h){
  //cout << h << " = (" << v[h].F << "," << v[h].S << ")" << endl;
  if(bit == (1<<c)-1){
    if(v[h].F == v[0].F || v[h].S == v[0].S){
      return 1;
    }
    return 0;
  }

  if(dp.find(P(bit,h)) != dp.end()){
    //cout << h << " = (" << v[h].F << "," << v[h].S << ") : " << dp[P(bit,h)] << endl;
    return dp[P(bit,h)];
  }

  int ret = 0;
  for(int i = 0; i < 4; i++){
    int nx = v[h].F + dx[i];
    int ny = v[h].S + dy[i];
    while(0 < nx && nx <= n && 0 < ny && ny <= m){
      if(f[nx][ny] && !used[f[nx][ny]]){
	used[f[nx][ny]] = true;
	ret += solve(bit | (1<<f[nx][ny]),f[nx][ny]);
	used[f[nx][ny]] = false;
	break;
      }
      nx += dx[i];
      ny += dy[i];
    }
  }
  //cout << h << " : " << ret << endl;
  if(__builtin_popcount(bit) < 13) dp[P(bit,h)] = ret;
  return ret;
}

int main(void){
  while(1){
    cin >> n >> m; if(!n) break;
    c = 1;
    v.clear();
    v.push_back(P(0,0));
    memset(f,0,sizeof(f));
    memset(used,false,sizeof(used));
    for(int i = 1; i <= m; i++){
      for(int j = 1; j <= n; j++){
	cin >> f[j][i];
	if(f[j][i] == 2){
	  v[0].F = j;
	  v[0].S = i;
	  f[j][i] = 0;
	}else if(f[j][i] == 1){
	  f[j][i] = c;
	  v.push_back(P(j,i));
	  c++;
	}
      }
    }

    dp.clear();
    cout << solve(1,0) << endl;
    //break;
  }
}

Measured memory_bytes: 5676
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define FOR(i, a)           for (auto &i : a)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define sum(x)              accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
const int MOD    = (int)(1e9 + 7);
const int INF    = (int)(1e13 + 7);
const double EPS = 1e-14;
const double PI  = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int a, int b) {                                                             //return x^y in order(log(y))
  int res = 1;
  for (a %= MOD; b; a = a * a % MOD, b >>= 1)
    if (b & 1) res = res * a % MOD;
  return res;
}

class ANickname {
public:
  static void solve(istream &cin, ostream &cout) {
    string S;
    cin >> S;
    cout << S[0] << S[1] << S[2] << endl;
  }
};


signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
  ANickname solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


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

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

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

template<class M, class N>
constexpr std::common_type_t<M, N> gcd(M m, N n) {
    return n == 0 ? abs(m) : gcd(n, abs(m) % abs(n));
}

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

    int N;
    std::cin >> N;

    ll ans = 0;
    REP(i, N) {
        ll a;
        std::cin >> a;
        ans = gcd(ans, a);
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#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 srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

const int MAX_SIZE = 52;

int LCS(const string& a, const string& b){
    int n = (int)a.size(), m = (int)b.size();
    vector<int> x(n), y(m);
    rep(i,n){
        x[i] = a[i]-'a';
        if(x[i] < 0){
            x[i] = a[i]-'A'+26;
        }
    }
    rep(i,m){
        y[i] = b[i]-'a';
        if(y[i] < 0){
            y[i] = b[i]-'A'+26;
        }
    }
    vector<vector<int> > vec(MAX_SIZE);
    for(int j = m-1; j >= 0; --j){
        vec[y[j]].push_back(j);
    }
    vector<int> xs(n+1, INF);
    xs[0] = -INF;
    vector<P> nx(n+1,P(-INF,-INF));
    rep(i,n){
        vector<int>& ys = vec[x[i]];
        rep(j,(int)ys.size()){
            int k = lower_bound(xs.begin(),xs.end(),ys[j]) - xs.begin();
            xs[k] = ys[j];
            nx[k] = P(y[ys[j]], k-1);
        }
    }
    return lower_bound(xs.begin(),xs.end(),INF-1) - xs.begin() - 1;
}


int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int q;
    cin >> q;
    rep(i,q){
        string a,b;
        cin >> a >> b;
        cout << LCS(a,b) << "\n";
    }
    return 0;
}



Measured memory_bytes: 3232
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

map<string,ll> M;

int main(){
    string S,T;
    ll N,C=0;
    cin>>N;
    rep(i,N){
        cin>>S;
        M[S]++;
    }
    cin  >> N;
    rep(i,N){
        cin >> S;
        M[S]--;
    }
    for(auto P : M){
        if(P.second>0){
            C=max(C,P.second);
        }
    }
    cout <<C  << endl;
}

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

using namespace std;

int N;
int main(){
    cin >> N;
    cin.ignore();

    if(N % 1000 == 0){
        cout << 0 << endl;
        return 0;
    }

    int ans = 1000 * (N / 1000 + 1) - N;
    cout << ans << endl;
    return 0;

}

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

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

int main(){
    int h,w;
    cin>>h>>w;
    vector<string>s(h);
    rep(i,h)cin>>s[i];
    vector<vector<int>>x(h,vector<int>(w,0));
    rep(i,h)rep(j,w){
        rep(dir,8){
            int vy=i+dy[dir];
            int vx=j+dx[dir];
            if(vy>=h||vy<0||vx>=w||vx<0)continue;
            if(s[vy][vx]=='#')x[i][j]++;
        }
    }
    rep(i,h){
        rep(j,w){
            if(s[i][j]=='#')cout<<'#';
            else cout<<x[i][j];
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
A,B,H,M=(int(x) for x in input().split())

import math

time = H*60 + M
dist = (5.5 * time)%360
if 0 < dist < 180:
   dist = 360 - dist

ans = math.sqrt(A*A + B*B  - 2*A*B*math.cos(math.radians(dist)))

print(ans)

Measured memory_bytes: 9352
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin>>N>>K;
  vector<double>list(N);
  for(int i=0;i<N;i++){
    cin>>list.at(i);
    list.at(i)=list.at(i)+1;
  }
  double sum=0;
  for(int i=0;i<K;i++){
    sum=sum+list.at(i);
  }
  double maxi=sum;
  if(N==K){
    cout<<fixed<<setprecision(10)<<sum/2<<endl;
  }
  else{
    for(int i=K;i<N;i++){
      sum=sum-list.at(i-K)+list.at(i);
      maxi=max(maxi,sum);
    }
    cout<<fixed<<setprecision(10)<<maxi/2<<endl;
  }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    string n;
    cin >> n;
    int count;
    for(int i=0; i<n.length(); i++){
        count = (count+(int)(n[i]-'0'))%9;
    }
    if(count == 0){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 3748
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main()
{
  long long int i,j,k;
  long long int N,M;
  long long int space;
  scanf("%lld %lld",&N,&M);
  long long int str[M+1];
  
  space = 0;
  for(i=1;i<=M;i++){
    scanf("%lld",&j);
    space += j;
  }
  
  k = N - space;
  if( k < 0 ){
    printf("-1\n");
  }
  else{
    printf("%lld\n",k);
  }

  return 0; 
  
}

Measured memory_bytes: 2108
#include "bits/stdc++.h"
using namespace std;
string S;
bool ok(string t)
{
	if(t.size()%2==1)
	{
		return false;
	}
	int hal=t.size()/2;
	for(int i=0;i<hal;i++)
	{
		if(t[i]!=t[i+hal])
		{
			return false;
		}
	}
	return true;
}
int main()
{
	cin>>S;
	S.erase(S.end()-1);
	while(!S.empty())
	{
		if(ok(S))
		{
			cout<<S.size()<<endl;
			break;
		}
		S.erase(S.end()-1);
	}
	return 0;
}
/*
qwqworzqwqworz
Output:4

papapapa
Output:4
*/


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

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

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0; i < (end); i += 1)
#define all(x) (x).begin(),(x).end()
//#define len(array)  (sizeof(array)/sizeof((array)[0]))
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}


//#define int ll

class DAliceBrown {
public:
        ll x,y;
void solve(std::istream& cin, std::ostream& cout) {
    cin >> x >> y;
    if(abs(x-y) <= 1)cout << "Brown\n";
    else cout << "Alice\n";
}
};


#undef int
int main() {
	DAliceBrown solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
N=int(input())
R=list(map(int,input().split()))

print(*R)

for n in range(1,N):
    if R[n-1]<=R[n]:
        pass
    elif R[n-1]>R[n]:
        v=R[n]
        for i in R[:n]:
            if i>v:
                j=R.index(i)
                break
        R[j+1:n+1]=R[j:n]
        R[j]=v
    print(*R)


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


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

int dr[] = {0, 0, 1, -1};
int dc[] = {1, -1, 0, 0};

int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    REP(r, H) cin >> S[r];
    REP(r, H) REP(c, W)
    {
        if (S[r][c] == '#')
        {
            bool ok = false;
            REP(i, 4)
            {
                int nr = r + dr[i];
                int nc = c + dc[i];
                if (nr >= 0 && nr < H && nc >= 0 && nc < W)
                {
                    if (S[nr][nc] == '#')
                    {
                        ok = true;
                        break;
                    }
                }
            }
            if (!ok)
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

using namespace std;

int main() {
	double one_tsubo = 3.305785;
	int a,b;
	cin>>a>>b;
	double ans = (double)a*(double)b/one_tsubo;
	printf("%lf\n",ans);
	return 0;
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
map<ll,ll> m;
ll ans(ll q,ll a,ll b,ll c,ll d,ll n)
{
  ll fi;
  //cout<<q<<" ";
  if(q==0)
    return 0;
  if(q==1)
    return d;
  if(m.count(q))
    return m[q];
  // bcz max ll=1e18;
  fi=1e18;
  if(q<fi/d)
  fi=min(fi,q*d);
  if(q%2==0)
    fi=min(ans(q/2,a,b,c,d,n)+a,fi);
  else
  {
    ll j,k;
    j=ans((q-1)/2,a,b,c,d,n)+d+a;
    k=ans((q+1)/2,a,b,c,d,n)+d+a;
    fi=min(fi,min(j,k));
  }
  if(q%3==0)
    fi=min(ans(q/3,a,b,c,d,n)+b,fi);
  else
  {
    ll j,k;
    ll z=q%3;
    j=ans((q-z)/3,a,b,c,d,n)+z*d+b;
    k=ans((q+3-z)/3,a,b,c,d,n)+(3-z)*d+b;
    fi=min(fi,min(j,k));
  }
  if(q%5==0)
    fi=min(ans(q/5,a,b,c,d,n)+c,fi);
  else
  {
    ll j,k;
    ll z=q%5;
    j=ans((q-z)/5,a,b,c,d,n)+z*d+c;
    k=ans((q+5-z)/5,a,b,c,d,n)+(5-z)*d+c;
    fi=min(fi,min(j,k));
  }
  m[q]=fi;
  return fi;
}
int main()
{
  ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  ll t;
  cin>>t;
  while(t>0)
  {
    t--;
    m.clear();
  ll n,a,b,c,d;
  cin>>n>>a>>b>>c>>d;
  ll s=ans(n,a,b,c,d,n);
  cout<<s<<endl;
  }
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n + 1, 0);
    for (int i = 1; i <= n; ++i) {
        cin >> a.at(i);
    }
    int now = 1;
    int cnt = 0;
    while (now != 2) {
        int next = a.at(now);
        if (next == 1) {
            break;
        }
        a.at(now) = 1;
        cnt += 1;
        now = next;
    }
    cout << (now == 2 ? cnt : -1) << '\n';
}


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

int main(void){
  
  int n,i;
  vector<int> fb(1000001);
  long long sum = 0;
  
  cin >> n;
  for(i=1;i<n+1;i++){
    fb.at(i) = i;
    if((i % 3 | i % 5) == 0) fb.at(i) = 0;
    else{
   if(i % 3 == 0) fb.at(i) = 0;
   if(i % 5 == 0) fb.at(i) = 0;
    }
    sum += fb.at(i);
  }
 
  cout << sum;
  return 0;
}

Measured memory_bytes: 7024
from string import ascii_lowercase as LOW
from string import ascii_uppercase as UP

a = {l:u for l,u in zip(list(LOW),list(UP))}
b = {u:l for u,l in zip(list(UP),list(LOW))}
a.update(b)

data = input()
data = [a[s] if s in a else s for s in data]
data = ''.join(data)
print(data)

Measured memory_bytes: 8132
#include <stdio.h>
#include <math.h>

int main(void)
{
	int n, i, j;
	scanf("%d", &n);
	for(i=1;i<10;i++){
        for(j=1;j<10;j++){
            if(i*j==n){
                printf("Yes");
                n=-1;
                break;
            }
        }   
		
	}
    if(n>0){
        printf("No");
    }	
	return 0;
}

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

int solve(string s){
    string rs = "",rs1;
    vector<int> sub;
    int j = 0,res = 0;

    for(int i = 0;i < s.size();i ++){
        while(s[i]=='x') i ++;
        if(i<s.size()){
            rs += s[i];
            sub.push_back(i-j);
            j = i;
        }
    }
    sub.push_back(s.size()-1-j);
    rs1 = rs;
    reverse(rs1.begin(),rs1.end());

    if(rs1!=rs) return -1;
    else{
        int n = rs.size(),l;
        if(rs.size()%2){
            for(int r = n/2+1;r <= n;r ++){
                l = n-r;
                res += abs(sub[r]-sub[l]);
            }
        }else{
            for(int r = n/2+1;r <= n;r ++){
                l = n-r;
                res += abs(sub[r]-sub[l]);
            }
        }
    }
    return res;
}

int main(){
    string s;
    cin >> s;
    cout << solve(s) << endl;
    return 0;
}

Measured memory_bytes: 1148
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1e9+7
using namespace std;
typedef long long ll;

int main(){

    int N,sum=0;
    cin>>N;
    vector<int> s(N);
    rep(i,N){
        cin>>s[i];
        sum+=s[i];
    }

    sort(s.begin(),s.end());

    if(sum%10==0){
        for(int i=0;i<N;i++){
            if(s[i]%10==0)continue;
            sum -= s[i];
            break;
        }
    }

    if(sum%10==0){
        cout<<"0";
    }else{
        cout<<sum;
    }
}

Measured memory_bytes: 256
// to be build tomorrow
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main ()
{
    ll t = 1;
    while (t--)
    {
        ll X, N;
        cin >> N;
        ll a[N];
        ll p[1000005] = {0};
        for (ll i = 0 ; i < N ; i++)
        {
            cin >> a[i];
            p[a[i]]++;
        }
        ll vs[1000005] = {0};
        ll answer = 0;
        for (ll i = 1; i < 1000005 ; i++){
            if (vs[i])
            continue;
            if (!p[i])
            continue;
            for (ll j = 2*i ; j < 1000005; j += i)
            {
                vs[j] = 1;
            }
        }
        for (ll i = 0 ; i < 1000005; i++)
        {
            if (!vs[i] && p[i] == 1)
            answer++;
        }
        cout << answer;
    }
    return 0;
}


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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)
#define lower_bound_idx(V,c) distance(V.begin(),lower_bound(V.begin(),V.end(),c))

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    int N;
    cin >>N;

    cout << N*N*N <<endl;
    return (0);
}

Measured memory_bytes: 256
_ = input()
S = input().lstrip('.').rstrip('#')
n = len(S)
A = list(S)

x = 0
y = S.count('.')
ans = min(n-y, y)
for i in range(n):
  if S[i] == '#':
    x += 1
  else:
    y -= 1
  ans = min(ans, x + y)
print(ans)

Measured memory_bytes: 10492
import java.util.*;
 
public class Main{
        public static void main(String[] args){
                try(Scanner sc = new Scanner(System.in)){
                        int A = sc.nextInt() % 3;
                        int B = sc.nextInt() % 3;
                        if(A == B && A != 0){
                                System.out.println("Impossible");
                        }else{
                                System.out.println("Possible");
                        }
                }
        }
}

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

int main(){
    string s,t;
    cin>>s>>t;
    bool ok=true;
    for(int i=0;i<s.size();++i){
        if(s[i]!=t[i])ok=false;
    }
    if(ok)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <vector>

#define el endl
#define fd fixed
#define INF INT_MAX/2-1
#define pb push_back

using namespace std;

bool exist(int n, vector<int> decimal) {
  int digit = 1, x = 10;
  while (n/x) {
    digit++;
    x *= 10;
  }
  if (digit == 1) {
    for (int i = 0; i < decimal.size(); i++) {
      if (decimal[i] == n) return true;
    }
  } else if(digit == 2) {
    for (int i = 0; i < decimal.size()-1; i++) {
      if (decimal[i] == n/10 && decimal[i+1] == n%10) return true;
    }
  }
  else {
    for (int i = 0; i < decimal.size()-2; i++) {
      if (decimal[i] == n/100 && decimal[i+1] == (n%100)/10 && decimal[i+2] == n%10) return true;
    }
  }
  return false;
}

int main() {
  int n, tmp;
  cin >> n;
  vector<int> decimal;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    decimal.pb(tmp);
  }
  for (int i = 0; i < 1000; i++) {
    if (!exist(i, decimal)) {
      cout << i << el;
      break;
    }
  }
}

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

using namespace std;

int N, M;
long long int K, A[200005], B[200005];

vector<long long int> V;

int main(void) {

	cin >> N >> M >> K;
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
	}

	V.push_back(0);
	for (int i = 1; i <= M; i++) {
		cin >> B[i];
		V.push_back(B[i]);
	}

	for (int i = 1; i <= M; i++) {
		V[i] = V[i - 1] + V[i];
	}

	long long int tmp = 0;
	int ans = 0;
	for (int i = 0; i <= N; i++) {
		tmp += A[i];
		if (tmp > K) { break; }
		int j = upper_bound(V.begin(), V.end(), K - tmp)-V.begin()-1;

		//cout << "i= " << i << " j= " << j << endl;
		ans = max(ans, i + j);
	}

	cout << ans << endl;

	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int d[n];

    for (size_t i = 0; i < n; i++)
    {
        cin >> d[i];
    }

    sort(d, d + n);

    int prev = -1;
    int ans = 0;
    for (size_t i = 0; i < n; i++)
    {
        if (prev == d[i])
        {
            continue;
        }
        else
        {
            ans += 1;
            prev = d[i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
long long n;
long long mod;
long long dp[N];
vector< long long > g[N];
vector< long long > sm[N];
vector< long long > lz[N];
long long idx[N];
long long fr[N];
long long sz[N];
void upd(long long l,long long r,long long ll,long long rr,long long now,long long v,long long T)
{
    if(lz[T][now]!=1)
    {
        sm[T][now] = sm[T][now]*lz[T][now]%mod;
        if(l!=r)    lz[T][now<<1] = lz[T][now<<1]*lz[T][now]%mod,lz[T][now<<1|1] = lz[T][now<<1|1]*lz[T][now]%mod;
        lz[T][now] = 1;
    }
    if(l>r||l>rr||r<ll)  return ;
    if(l>=ll&&r<=rr)
    {
        sm[T][now] = sm[T][now]*v%mod;
        if(l!=r)   lz[T][now<<1] = lz[T][now<<1]*v%mod,lz[T][now<<1|1] = lz[T][now<<1|1]*v%mod;
        return ;
    }
    long long mid = (l+r) >> 1;
    upd(l,mid,ll,rr,now<<1,v,T); upd(mid+1,r,ll,rr,now<<1|1,v,T);
}
long long query(long long l,long long r,long long idx,long long now,long long T)
{
    if(lz[T][now]!=1)
    {
        sm[T][now] = sm[T][now]*lz[T][now]%mod;
        if(l!=r)    lz[T][now<<1] = lz[T][now<<1]*lz[T][now]%mod,lz[T][now<<1|1] = lz[T][now<<1|1]*lz[T][now]%mod;
        lz[T][now] = 1;
    }
    if(l>r||l>idx||r<idx)  return 1;
    if(l==r)    return sm[T][now];
    long long mid = (l+r) >> 1;
    return query(l,mid,idx,now<<1,T)*query(mid+1,r,idx,now<<1|1,T)%mod;
}
void solve(long long u,long long par = -1)
{
    long long cnt = 0;
    dp[u] = 1;
    long long all = g[u].size();
    for(long long i=1;i<=all*4+1;i++) sm[u].push_back(1),lz[u].push_back(1);
    for(auto &x:g[u])
    {
        if(x==par)  continue;
        idx[x] = ++cnt;
    }
    for(auto &x:g[u])
    {
        if(x==par)    continue;
        solve(x,u);
        fr[x] = cnt;
        dp[u] = dp[u]*(dp[x]+1)%mod;
        upd(1,cnt,1,idx[x]-1,1,dp[x]+1,u); upd(1,cnt,idx[x]+1,cnt,1,dp[x]+1,u);
    }
    sz[u] = cnt;
}
void reroot(long long u,long long par = -1)
{
    if(par!=-1)
    {
        long long now = (query(1,fr[u],idx[u],1,par)+1)%mod;
        dp[u] = dp[u]*now%mod,upd(1,sz[u],1,sz[u],1,now,u);
    }
    for(auto &x:g[u])
    {
        if(x==par)    continue;
        reroot(x,u);
    }
}
int main()
{
    scanf("%lld %lld",&n,&mod);
    for(long long i=1,u,v;i<n;i++)    scanf("%lld %lld",&u,&v),g[u].push_back(v),g[v].push_back(u);
    solve(1);
    reroot(1);
    for(long long i=1;i<=n;i++)   printf("%lld\n",dp[i]);
    return 0;
}


Measured memory_bytes: 46848
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



signed main(){
  int N;cin>>N;
  int d[110];
  for(int t=0;t<N;t++){
    cin>>d[t];
  }

  sort(d,d+N);

  int cont=1;
  for(int t=0;t<N-1;t++){
    if(d[t]!=d[t+1])cont++;
  }

  cout<<cont<<endl;
  return 0;
}


Measured memory_bytes: 256
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

;; Hauptteil

(defun main ()
  (let* (ns)
    (push (read) ns)
    (push (read) ns)
    (push (read) ns)
    (push (read) ns)
    (if (and (member 1 ns)
             (member 9 ns)
             (member 7 ns)
             (member 4 ns))
        (write-line "YES")
        (write-line "NO"))))

#-swank(main)


Measured memory_bytes: 14048