akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
void insertionSort(int a[], int num);
int main()
{
    int num, i;
    int a[1000];
    scanf("%d", &num);
    for(i = 0;i<num;i++){
        scanf("%d",&a[i]);
    }
    for (i = 0; i < num-1; i++)
        {
            printf("%d ", a[i]);
        }
        printf("%d\n",a[num-1]);
    insertionSort(a, num);
    return 0;
}
void insertionSort(int a[], int num)
{
    int v, i, j;
    for (i = 1; i < num; i++)
    {
        v = a[i];
        j = i - 1;
        while (j >= 0 && a[j] > v)
        {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = v;
        for (j = 0; j < num-1; j++)
        {
            printf("%d ", a[j]);
        }
        printf("%d\n",a[num-1]);
    }
}


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

class Program{
    static void Main(){
        int N = int.Parse(Console.ReadLine());
        string[] S = Console.ReadLine().Split(' ');
        int[] A = new int[N];
        for(int i = 0; i < N; i++){
            A[i] = int.Parse(S[i]);
        }

        Console.WriteLine(A.Max() - A.Min());
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;



int main(){

	int	a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a+3);
	cout << a[0]*a[1]/2 << endl;

	return 0;
}


Measured memory_bytes: 256
n = int(input())
l = list(map(int, input().split()))
l.sort()
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] < l[k] and l[i] + l[j] > l[k]:
                ans += 1
print(ans)


Measured memory_bytes: 9076
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <algorithm>

using namespace std;
using piii = pair<int, pair<int, int>>;
const int N = 1000005;
char g[N];
//char g[N][N];

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

bool check(vector<vector<int>>& g, int y, int x, int qy, int qx)
{
	if (y == qy)
	{
		if (x < qx) swap(x, qx);
		for (int i = qx; i <= x; ++i)
			if (g[y][i] == '@') return false;
	}
	else
	{
		if (y < qy) swap(y, qy);
			for (int i = qy; i <= y; ++i)
				if (g[i][x] == '@') return false;
	}
}

int h, w, k;
int xa, ya, xb, yb;
//xa, ya
int dijkstra(vector<vector<char>>& g, vector<vector<int>>& st, pair<int, int> s)
{
	vector<vector<int>> dist(h, vector<int>(w, 0x3f3f3f3f));
	priority_queue<piii, vector<piii>, greater<piii>> heap;
	heap.push({0, s});
	//cout << h << "---" << w << endl;
	//cout << s.second << "---" << s.first << endl;
	dist[s.first][s.second] = 0;

	while (heap.size())
	{
		auto t = heap.top();
		heap.pop();

		int dis = t.first, x = t.second.first, y = t.second.second;
		if (x == xb && y == yb) return dis;
		if (st[x][y]) continue;
		st[x][y] = true;

		for (int i = 0; i < 4; ++i)
		{
			for (int j = 1; j <= k; ++j)
			{
				int qy = y + dy[i] * j;
				int qx = x + dx[i] * j;
				if (qy < 0 || qy >= w || qx < 0 || qx >= h || g[qx][qy] == '@') break;
				//中间也需要检测一下
				//if (!check(g, y, x, qy, qx)) continue;
				if (dist[qx][qy] > dist[x][y] + 1)
				{
					//printf("(%d, %d)\n", qy, qx);
					dist[qx][qy] = dis + 1;
					heap.push({ dist[qx][qy], {qx, qy} });
				}
				else if (dist[qx][qy] <= dist[x][y])
					break;
			}
		}
	}
	if (dist[xb][yb] == 0x3f3f3f3f) return -1;
	return dist[xb][yb];
}

int main()
{	
	//freopen("in.txt", "r", stdin);
	scanf("%d%d%d", &h, &w, &k);

	scanf("%d%d%d%d", &xa, &ya, &xb, &yb);

	--xa, --ya;
	--xb, --yb;

	vector<vector<char>> maze(h, vector<char>(w, 0));
	vector<vector<int>> st(h, vector<int>(w, 0));

	for (int i = 0; i < h; ++i)
	{
		scanf("%s", g);
		for (int j = 0; j < w; ++j)
			maze[i][j] = g[j];
	}
	
	//check(maze, 0, 3, 1, 3);

	int res = dijkstra(maze, st, { xa, ya });

	printf("%d\n", res);

	return 0;
}

Measured memory_bytes: 16900
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef pair<int, int> P;

bool cp(P a, P b) {
	return a.second > b.second;
}

int main() {
	int n;

	while (cin >> n, n) {
		vector<P> v;
		for (int i = 0; i < n; ++i) {
			int p, d1, d2; cin >> p >> d1 >> d2;
			v.push_back( P(p, d1+d2) );
		}
		sort( v.begin(), v.end(), cp );
		cout << v[0].first << " " << v[0].second << endl;
	}
}

Measured memory_bytes: 1112
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int s[3];
	scanf("%d%d%d",&s[0],&s[1],&s[2]);
   sort(s,s+3);
printf("%d\n",s[2]-s[0]);
return 0;
	}


Measured memory_bytes: 256
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
//  cout.precision(15); cout << fixed;

int main() {
  int n, d, x; cin >> n >> d >> x;
  vector<int> A(n);
  loop(i,0,n) cin >> A[i];
  loop(i,0,n) {
    loop(j,0,d+1) {
      if (j*A[i] + 1 > d) break;
      x++;
    }
  }
  cout << x << endl;
  return 0;
}


Measured memory_bytes: 3616
# -*- coding: utf-8 -*-

ramen_basic = 700

data = list(input())

def is_yes(topping):
    if topping == "o":
        return True
    else:
        return False

count = 0

for topping in data:
    if is_yes(topping):
        count = count + 1

print(ramen_basic + count * 100)


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

int main() {
  string s;
  cin >> s;
  
  int counter = 0;
  
  for (int i = 0; i < 3; i++) {
    if (s[i] == 'o') {
      counter ++ ;
    }
  }
  
  cout << 700 + 100 * counter << endl;
}



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

int main(){
  string s;
  cin >> s;
  if (s == "SUN") cout << 7 << endl;
  if (s == "SAT") cout << 1 << endl;
  if (s == "FRI") cout << 2 << endl;
  if (s == "THU") cout << 3 << endl;
  if (s == "WED") cout << 4 << endl;
  if (s == "TUE") cout << 5 << endl;
  if (s == "MON") cout << 6 << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;
import java.lang.Math.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int W = sc.nextInt();
		long[][] dp = new long[N + 1][W + 1];
		int[] wList = new int[N];
		long[] vList = new long[N];
		for (int i = 0; i < N; i++) {
			wList[i] = sc.nextInt();
			vList[i] = sc.nextInt();
		}
		for (int i = 0; i < N + 1; i++) {
			dp[0][i] = 0;
		}

		for (int i = 1; i < N + 1; i++) {
			for (int j = 0; j < W + 1; j++) {
				if (j - wList[i - 1] >= 0) {
					dp[i][j] = Math.max(dp[i - 1][j], dp[i - 1][j - wList[i - 1]] + vList[i - 1]);
				} else {
					dp[i][j] = dp[i - 1][j];
				}
			}
		}

		System.out.println(dp[N][W]);
	}

}


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

digits = [(N // (10 ** i) % 10) for i in range(6)]

for i in range(6):
    i_top = 5 - i
    if digits[i_top] > 0: break

ans = 0
for i in range(0, i_top):
    if i % 2 > 0: continue
    ans += (9 * (10 ** i))

if i_top % 2 == 0:
    ans += (N - (10 ** i_top) + 1)

print(ans)


Measured memory_bytes: 3060
import java.util.Scanner;



public class Main {
 
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int k = sc.nextInt();
		char[][] color = new char[h][w];
		int ans = 0;
 
		for(int i = 0; i < h; i++) {
			color[i] = sc.next().toCharArray();
		}
		
		for(int i = 0; i < Math.pow(2, h); i++) {
			for(int j = 0; j < Math.pow(2, w); j++) {

				int count = 0;
				for(int x = 0; x < h; x++) {
					for(int y = 0; y < w; y++) {
						
						if(((i >> x) & 1) == 0 && ((j >> y) & 1) == 0
								&& color[x][y] == '#') {
							count++;
						}
					}
				}
				
				if(count == k) {
					ans++;
				}
			}
		}
		

		
		System.out.println(ans);
		sc.close();
	}

}

Measured memory_bytes: 35988
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){ return (int)s.size(); }

int main(){
    cout << fixed << setprecision(20);
    int n; cin >> n;
    vi a(n),b(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    int ma = 0;
    rep(i,n){
        int sum = 0;
        rep(j,i+1) sum += a[j];
        rng(j,i,n) sum += b[j];
        chmax(ma, sum);
    }
    cout << ma << endl;
    return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn._
object Main extends App {

  val n = readInt()
  if (n % 2 == 0){
    println(n * (n - 2) / 2)
    for (i ← 1 to n){
      for (j ← i + 1 to n if i + j != n + 1) {
        println(s"$i $j")
      }
    }
  }else {
    println((n - 1) * (n - 1) / 2)
    for (i ← 1 to n){
      for (j ← i + 1 to n if i + j != n){
        println(s"$i $j")
      }
    }
  }
  implicit class Extension[T](val value: T) extends AnyVal {
    @inline def let[A](@inline func: T ⇒ A): A = func(value)
    @inline def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}

Measured memory_bytes: 32412
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){ T x; cin >> x; return (x); }
template<typename T=int,typename C=vector<T>>
C vecin(int N){ C x(N);REP(i,N){ x[i]=in<T>(); }return move(x); }

void vout(){ cout << endl; }
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){ cout << ' ' << h;vout(forward<Tail>(t)...); }
void out(){ cout << endl; }
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){ cout << h;vout(forward<Tail>(t)...); }

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

	string S=in<string>();
	int N=S.size();
	if(!N || N%2){
		out("No");
		return 0;
	}
	for(int i=0;i<N;i+=2){
		if(S[i]!='h' || S[i+1]!='i'){
			out("No");
			return 0;
		}
	}
	out("Yes");
	return 0;
}


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

int d = 365;
int c[26];
int s[365][26];

int main() {
    cin >> d;
    for(int i=0;i<d;i++){
        cin >> c[i];
    }
    for(int i=0;i<d;i++){
        for(int j=0;j<26;j++){
            cin >> s[i][j];
        }
    }
    for(int i=0;i<d;i++){
        cout << 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3668
n,m = map(int,input().split())
f = lambda x : int(x) - 1
p = list(map(f,input().split()))
par = [i for i in range(n)]

def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]

def unite(x,y):
    rx = root(x)
    ry = root(y)
    if rx != ry:
        par[rx] = ry

for i in range(m):
    x,y = map(f,input().split())
    unite(x,y)

ans = 0
for i in range(n):
    if root(i) == root(p[i]): ans += 1

print(ans)


Measured memory_bytes: 13812
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void push(int);
int pop(void);
int data[500],top;

int main(){
  int a,b;
  char s[100];
  top=0;
  while(scanf("%s",s)!=EOF)
    { 
      if(s[0]=='+'){
	a=pop();
	b=pop();
	push(a+b);
      }
      else if(s[0]=='-')
	{
	  b=pop();
	  a=pop();
	  push(a-b);
	}
      else if(s[0]=='*'){
	a=pop();
	b=pop();
	push(a*b);
      }
      else {
	push(atoi(s));
      }
    }
  printf("%d\n",pop());
  return 0;
}

void push(int x){
  top++;
  data[top]=x;
}

int pop(){
  top--;
  return data[top+1];
}



Measured memory_bytes: 2128
n = int(input())
my_dic={}
for i in range(n):
	k = input()
	if k in my_dic:
		my_dic[k]+=1
	else:
		my_dic[k]=1

max = max(my_dic.values())
keys = [k for k, v in my_dic.items() if v == max]
keys.sort()
for i in range(len(keys)):
	print(keys[i])

Measured memory_bytes: 32096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
template<class T> ll sumArr(const T& a){ return accumulate(all(a), 0LL);}
template<class T> auto minArr(const T& a){ return *min_element(all(a));}
template<class T> auto maxArr(const T& a){ return *max_element(all(a));}
template<class T> void DEBUG_PRINT(T tmp){cout<<tmp<<endl;}
template<class T1,class... T2> void DEBUG_PRINT(T1 tmp,T2... tmp2){cout<<tmp<<" ";DEBUG_PRINT(tmp2...);}
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a / gcd(a, b) * b; }
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,m;
    cin>>n>>m;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    ll cnt = 0,sum = 0;
    sum = sumArr(a);
    rep(i,n)if(a[i] >= sum/ double(4.0*m))cnt++;
    if(cnt >= m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
const int INF = 1001001001;

int main(){
  int h, w, sh, sw, gh, gw;
  cin >> h >> w >> sh >> sw >> gh >> gw;
  --sh; --sw; --gh; --gw;
  vector<string> maze(h);
  for(int i=0; i<h; ++i) cin >> maze[i];
  
  vector<vector<int>> ans(h, vector<int>(w,INF));
  int cnt = 0;
  vector<vector<bool>> ok(h, vector<bool>(w, true));
  queue<P> que, que2;
  que.push(P(sh,sw));
  vector<int> dx1 = {-1, 0, 0, 1}, dy1 = {0, -1, 1, 0};
  vector<int> dx2 = {-2, -2, -2, -2, -2, -1, -1, -1, -1,  0, 0,  1,  1, 1, 1,  2,  2, 2, 2, 2};
  vector<int> dy2 = {-2, -1,  0,  1,  2, -2, -1,  1,  2, -2, 2, -2, -1, 1, 2, -2, -1, 0, 1, 2};                
  while(!que.empty() || !que2.empty()){
    if(que.empty()){
      swap(que,que2);
      ++cnt;
    }
    int x, y;
    tie(x,y) = que.front();
    que.pop();
    if(!ok[x][y]) continue;
    ans[x][y] = cnt;
    ok[x][y] = false;
    for(int i=0; i<4; ++i){
      int dx = x +dx1[i];
      int dy = y +dy1[i];
      if(dx >= 0 && dx <h && dy >= 0 && dy <w && maze[dx][dy] == '.' && ok[dx][dy]){
        que.push(P(dx,dy));
      }
    }
    for(int i=0; i<20; ++i){
      int dx = x +dx2[i];
      int dy = y +dy2[i];
      if(dx >= 0 && dx <h && dy >= 0 && dy <w && maze[dx][dy] == '.' && ok[dx][dy]){
        que2.push(P(dx,dy));
      }
    }
  }
  if(ans[gh][gw] == INF) cout << -1 << endl;
  else cout << ans[gh][gw] << endl;
}

Measured memory_bytes: 10012
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

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

  int sum = 0, k = 0;
  while (sum < n) {
    ++k;
    sum += k;
  }
  //printf("k=%d,sum=%d\n", k, sum);

  int d = sum - n;
  for (int i = 1; i <= k; i++)
    if (i != d) printf("%d\n", i);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n,w,i,j,maxi=0;
cin>>n>>w;
ll a[n+1],b[n+1];
for(i=1;i<=n;i++)
cin>>a[i]>>b[i];
ll dp[n+1][w+1];

for(i=0;i<=n;i++)
{
	for(j=0;j<=w;j++)
	{
		if(i==0 || j==0)
		dp[i][j]=0;
		else if(a[i]<=j)
		dp[i][j]=max(b[i]+dp[i-1][j-a[i]],dp[i-1][j]);
		else
		dp[i][j]=dp[i-1][j];
		
		
		
	}
}

cout<<dp[n][w];


	
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define fw(fileName) freopen(fileName, "w", stdout)
#define fr(fileName) freopen(fileName, "r", stdin)
#define fc(stream) fclose(stream);
#define MN_Mind ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"  //comment it on debug
#define Endl "\n"

int arr[(int)1e6+7];
  
 //vector<vector<ll> > dp( n+1 , vector<ll> (x+1, 1)); 
//cout<<flush;
int main() {
	MN_Mind


int x;
cin>>x;
cout<<(x+1)%2;

	return 0;
}

Measured memory_bytes: 3564
#include<stdio.h>
#include<iostream>
#include<string>
#include<memory>
#include<cmath>
#include<algorithm>
#include<vector>
double min_double(double a,double  b){
    if(a<b) return a;
    else return b;
}
void swap(int *x,int *y){
    int tmp;
    tmp=*x;
    *x=*y;  
    *y=tmp;
}
int gcd(int a,int b){
    if(a<b) swap(&a,&b);
    if(b<1) return -1;

    if(a%b==0) return b;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a * b / gcd(a,b);
}

int main(){
    int numQ;
    std::cin>>numQ;

    std::vector<int> d(numQ);
    for(int i=0;i<numQ;i++) std::cin>>d[i];

    std::sort(d.begin(),d.end());

    int ans = d[numQ/2]-d[(numQ/2)-1];
    std::cout<<ans<<std::endl;
    return 0;
}



Measured memory_bytes: 3644
import sys
from collections import deque, Counter
def I(): return int(sys.stdin.readline().rstrip())

if __name__=='__main__':
    n = I()
    l = []
    for _ in range(n):
        l.append(I())
    c = Counter()
    now = 0
    for i in range(1,n+1):
        now = l[now]-1
        c[now] += 1
        if now==1:
            print(i)
            exit()
        if c[now]==2:
            print(-1)
            exit()
    exit()

Measured memory_bytes: 23740
#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

int main(){

	int n,limit,sum,tmp;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		limit = n*(n-1)/2;

		sum = 0;

		for(int i = 0; i < limit; i++){
			scanf("%d",&tmp);
			sum += tmp;
		}

		printf("%d\n",sum/(n-1));
	}

    return 0;
}

Measured memory_bytes: 2688
#include<stdio.h>

int main(void)
{
	int a = 0;
	int b = 0;
	int sum = 0;
	int i = 0;
	
	while(scanf("%d %d", &a, &b) != EOF)
	{
		sum = a + b;
		
		for(i = 0; sum != 0; ++i)
		{
			sum /= 10;
		}
		printf("%d\n", i);
	}
	
	return 0;
}

Measured memory_bytes: 600
def check(cx, cy, H, x, y, h):
    if (h == 0) and (abs(cx-x)+abs(cy-y) > H):
        return True
    if H-h == abs(cx-x)+abs(cy-y):
        return True
    else:
        return False

def a():
    N = int(input())
    xs = []
    ys = []
    hs = []
    for _ in range(N):
        i = input().split(' ')
        xs.append(int(i[0]))
        ys.append(int(i[1]))
        hs.append(int(i[2]))
    
    for i, h in enumerate(hs):
        if h==0:
            continue
        else:
            init_x = xs[i]
            init_y = ys[i]
            init_h = h
            break
    for cx in range(101):
        for cy in range(101):
            H = abs(cx-init_x)+abs(cy-init_y)+init_h
            flag_stop = False
            for x, y, h in zip(xs, ys, hs):
                if not check(cx, cy, H, x, y, h):
                    flag_stop = True
                    break
            if flag_stop:
                continue
            else:
                print('{} {} {}'.format(cx, cy, H))
                return
a()



Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <queue>
#include <climits>
#include<cmath>

bool sort_pair( std::pair< int, int > origin, std::pair< int, int > another )
{
    return origin.first < another.first;
}

int main()
{
    int a;
    std::cin>> a;

    std::vector< int > b( a - 1 );

    for( int i = 0; i < a - 1; i++ )
    {
        std::cin>> b[i];
    }

    int64_t all = 0;
    for( int i = 0; i < a - 1; i++ )
    {
        if( i == 0 )
        {
            all += b[i];
        }
        else
        {
            all += std::min( b[i-1], b[i] );
        }
    }

    all += b.back();

    std::cout<< all;
}


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

int main() {
  string s;
  cin >> s;
  int q;
  cin >> q;
  string t;
  rep(qi,q) {
    int ty;
    cin >> ty;
    if (ty == 1) {
      swap(s,t);
    } else {
      int f; char c;
      cin >> f >> c;
      if (f == 1) {
        t += c;
      } else {
        s += c;
      }
    }
  }
  reverse(t.begin(), t.end());
  t += s;
  cout << t << endl;
}

Measured memory_bytes: 1128
n = int(input())
s = str(input())
w = 0
for i in range(n):
  if s[i] == ".":
    w += 1
mi = w
c = w
for i in range(n):
  if s[i] == "#":
    c += 1
  else:
    c -= 1
  if c < mi:
    mi = c
print(mi)
  
  

Measured memory_bytes: 3500
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
input = sys.stdin.readline
INF = 10**20
EPS = 1.0 / 10**10
MOD = 10**9 + 7
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def I(): return int(input())
def F(): return float(input())
def S(): return input()

class Graph:
  def __init__(self, _n):
    self.n = _n
    self.m = 0
    self.g = [[] for i in range(_n)]
  def add_edge(self, s, t, c = 1):
    self.g[s].append((t,c))
    self.g[t].append((s,c))
  def __getitem__(self, v):
    return self.g[v]

def edge_cost(i,j):
  L = [s - abs(ps[i][k]-ps[j][k]) for k in range(3)]
  if len([x for x in L if x <= 0]) > 0:
    return -1
  return 2*(L[0]*L[1]+L[1]*L[2]+L[2]*L[0])

def dfs(v, pv, k):
  if k == 0:
    for e in G[v]:
      if e[0] != pv and used[e[0]]:
        return e[1]
    return 0
  if used[v]:
    return INF
  used[v] = True
  res = INF
  for e in G[v]:
    if e[0] == pv:
      continue
    dd = dfs(e[0],v,k-1)
    if dd < INF:
      res = min(res,dd+e[1])
  used[v] = False
  return res


if __name__ == '__main__':
  while True:
    n,k,s = LI()
    if n == 0:
      break
    ps = [LI() for i in range(n)]

    G = Graph(n)
    for i in range(n-1):
      for j in range(i+1,n):
        c = edge_cost(i,j)
        if c > 0:
          G.add_edge(i,j,-c)

    used = [False] * n
    sub = INF
    for i in range(n):
      sub = min(sub,dfs(i,-1,k-1))
    if sub == INF:
      print(-1)
    else:
      print(6*k*s*s+sub)


Measured memory_bytes: 9396
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using ll = long long;

int main() {
    int N, M, Q;
    std::cin >> N >> M >> Q;
    std::vector<int>L(M), R(M);
    for (int i = 0; i < M; i++) {
        std::cin >> L[i] >> R[i];
    }

    std::vector<int> p(Q), q(Q);
    for (int i = 0; i < Q; i++) {
        std::cin >> p[i] >> q[i];
    }

    std::vector<std::vector<int>> sum(N + 1, std::vector<int>(N + 1, 0));
    for (int i = 0; i < M; i++) {
        sum[L[i]][R[i]]++;
    }

    for (int i = 1; i < N + 1; i++) {
        for (int j = 1; j < N + 1; j++) {
            sum[i][j] += sum[i - 1][j];
            sum[i][j] += sum[i][j - 1];
            sum[i][j] -= sum[i - 1][j - 1];
        }
    }

    for (int i = 0; i < Q; i++) {
        int ans = sum[q[i]][q[i]] - sum[q[i]][p[i] - 1] - sum[p[i] - 1][q[i]] + sum[p[i] - 1][p[i] - 1];
        std::cout << ans << std::endl;
    }

    return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#include <math.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;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int a,b,c;
cin >> a >> b;
if((a+b)%2==0) {
  cout << (a+b)/2 << endl;
} else {
  cout << "IMPOSSIBLE" <<endl;
}
return 0;
}


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

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    int left = 0;
    int right = 0;
    int count[N];
    for (int i = 1; i < N; i++) {
        if (S[i] == 'E') right++;
    }
    count[0] = left + right;
    for (int i = 1; i < N; i++) {
        if (S[i - 1] == 'W') left++;
        if (S[i] == 'E') right--;
        count[i] = left + right;
    }
    int count_min = 999999;
    for (int i = 0; i < N; i++) {
        count_min = min(count_min, count[i]);
    }
    cout << count_min << endl;
}

Measured memory_bytes: 4888
#include <iostream>
using namespace std;
int main(void){
    int N,T;
    cin>>N;
    T=0;
    int V[N];
    int C[N];
    int B[N];
    for(int i=0;i<N;i++){
        cin>>V[i];
    }
     for(int i=0;i<N;i++){
        cin>>C[i];
    }
     for(int i=0;i<N;i++){
        B[i]=V[i]-C[i];
        if(B[i]>0){
            T=T+B[i];
        }
    }
    
    cout<<T<<endl;
    return 0;
    
}

Measured memory_bytes: 256
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 1005
#define MAXM 2005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll n,m;
ll x;
struct edge{ll to,cost;};
struct edge2{ll u,v,w;};
edge2 a[MAXM];
vector<edge> G[MAXN];
vector<edge> tree[MAXN];
ll fa[MAXN],dep[MAXN],cost[MAXN];
map<P,int> mp;
void add(ll &a,ll b) {a+=b; if(a>=MOD) a-=MOD;}
void dec(ll &a,ll b) {a-=b; if(a<0) a+=MOD;}
bool cmp(edge2 p,edge2 q)
{
    return p.w<q.w;
}
void add_edge(ll u,ll v,ll w)
{
    G[u].push_back((edge){v,w});
    G[v].push_back((edge){u,w});
}
void add_tree_edge(ll u,ll v,ll w)
{
    tree[u].push_back((edge){v,w});
    tree[v].push_back((edge){u,w});
}
ll p[MAXN],r[MAXN];
void init(ll n)
{
    for(ll i=1;i<=n;i++)
    {
        p[i]=i;
        r[i]=0;
    }
}
ll find(ll x)
{
    if(p[x]==x) return x;
    else return p[x]=find(p[x]);
}
void unite(ll x,ll y)
{
    x=find(x);
    y=find(y);
    if(x==y) return;
    if(r[x]<r[y]) p[x]=y;
    else
    {
        p[y]=x;
        if(r[x]==r[y]) r[x]++;
    }
}
bool same(ll x,ll y)
{
    return find(x)==find(y);
}
ll pow_mod(ll a,ll i)
{
    ll s=1;
    while(i)
    {
        if(i&1) s=1LL*s*a%MOD;
        a=1LL*a*a%MOD;
        i>>=1;
    }
    return s;
}
ll kruskal()
{
    sort(a,a+m,cmp);
    init(n);
    ll ret=0;
    for(ll i=0;i<m;i++)
    {
        if(!same(a[i].u,a[i].v))
        {
            ret+=a[i].w;
            unite(a[i].u,a[i].v);
            mp[P(a[i].u,a[i].v)]=1;
            add_tree_edge(a[i].u,a[i].v,a[i].w);
        }
    }
    return ret;
}
void dfs(ll v,ll p,ll d,ll c)
{
    fa[v]=p;dep[v]=d;cost[v]=c;
    for(auto e:tree[v])
    {
        if(e.to==p) continue;
        dfs(e.to,v,d+1,e.cost);
    }
}
ll find_max(ll u,ll v)
{
    ll ans=0;
    if(dep[u]<dep[v]) swap(u,v);
    while(dep[u]>dep[v])
    {
        ans=max(ans,cost[u]);
        u=fa[u];
    }
    while(u!=v)
    {
        ans=max(ans,cost[u]);ans=max(ans,cost[v]);
        u=fa[u];v=fa[v];
    }
    return ans;
}
int main()
{
    scanf("%lld%lld",&n,&m);
    scanf("%lld",&x);
    for(ll i=0;i<m;i++)
    {
        ll u,v,w;
        scanf("%lld%lld%lld",&u,&v,&w);
        if(u>v) swap(u,v);
        add_edge(u,v,w);
        a[i].u=u;a[i].v=v;a[i].w=w;
    }
    ll res=kruskal();
    if(res>x)
    {
        puts("0");
        return 0;
    }
    ll d=x-res;
    ll less=0,equal=0,greater=0;
    dfs(1,0,0,0);
    for(ll i=0;i<m;i++)
    {
        if(mp[P(a[i].u,a[i].v)]) continue;
        ll now=res-find_max(a[i].u,a[i].v)+a[i].w;
        if(now==x) equal++;
        else if(now>x) greater++;
        else less++;
    }
    assert(equal+greater+less==(m-(n-1)));
    ll ans=0;
    if(d==0)
    {
        assert(less==0);
        ans=pow_mod(2,n-1);dec(ans,2);
        ans=1LL*ans*pow_mod(2,m-(n-1))%MOD;
        add(ans,2LL*(pow_mod(2,equal)-1)*pow_mod(2,m-(n-1)-equal)%MOD);
        printf("%lld\n",ans);
    }
    else
    {
        assert(d>0);
        ans=2LL*(pow_mod(2,equal)-1)*pow_mod(2,greater)%MOD;
        printf("%lld\n",ans);
    }
    return 0;
}



Measured memory_bytes: 640
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N, K = getNM()
X = getList()
ans = float('inf')

# 一直線に行くのが一番いいやり方
for i in range(N - K + 1):
    # もしX[i],X[i + K - 1]とも0以下の場合
    # 最短経路は0 ~ (X[i + K - 1]) ~ X[i]まで
    if X[i] <= 0 and X[i + K - 1] <= 0:
        ans = min(ans, -X[i])
    # もしX[i] < 0 <= X[i + K - 1]の場合
    # 最短経路は
    # X[i] ~ 0, 0 ~ X[i + K - 1]のうち近い方
    # + X[i] ~ X[i + K - 1]
    elif X[i] < 0 <= X[i + K - 1]:
        ans = min(ans, min(-X[i], X[i + K - 1]) + (X[i + K - 1] - X[i]))
    # もしX[i],X[i + K - 1]とも0以上の場合
    # 最短経路は0 ~ (X[i]) ~ X[i + K - 1]まで
    else:
        ans = min(ans, X[i + K - 1])
print(ans)

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

ll ok(ll n ){
    ll i ;
    if (n==2)
        return 1 ;
    if (n%2==0)
        return 0 ;
    for(i=3;i*i<=n;i+=2){
        if (n%i==0)
            return 0 ;
    }
    return 1 ;

}


int main(){
   ll n , t , k ;

   cin >> n ;

   for(t=n;;t++){
    if (ok(t)){
        cout << t << endl ;
        return 0;
    }
   }


}




Measured memory_bytes: 256
from collections import defaultdict
S = input()
T = input()
d1 = defaultdict(int)
d2 = defaultdict(int)
for i in range(len(S)):
    d1[S[i]] += 1
    d2[T[i]] += 1
tmp_1 = list(d1.values())
tmp_2 = list(d2.values())
tmp_1.sort()
tmp_2.sort()
if tmp_1==tmp_2:
    print('Yes')
else:
    print('No')


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


long long ans( long long L, long long X, long long* p, long long* total ){
    if( X == 1 && L >= 1 ){
        //cout << "a" << endl;
        return 0;
    }else if( 1 < X && X < total[L-1]+2 ){
        //cout << total[L-1]+2 << endl;
        return ans(L-1, X-1, p, total);
    }else if( X == total[L-1]+2 ){
        //cout << "c" << endl;
        return p[L-1] + 1;
    }else if( total[L-1]+2 < X && X < total[L] ){ 
        //cout << "d" << endl;
        return p[L-1] + 1 + ans(L-1, X-total[L-1]-2, p, total);
    }else return p[L];
}


int main(){

    long long N, X;
    cin >> N >> X;
    

    long long p[51], total[51], answer;
    p[0] = total[0] = 1;
    for( long long i = 0; i < N; i++ ){
        p[i+1] = 2 * p[i] + 1;
        total[i+1] = 2 * total[i] + 3;
    }

    answer = ans( N, X, p, total );
    
    cout << answer << endl;

    return 0;

}

Measured memory_bytes: 256
#include<stdio.h>

#define NIL -1

int fibonacci(int);

int fib[45];

int main(){

  int n,i,answer;
  
  scanf("%d",&n);

  for(i=0;i<=n;i++){

    fib[i]=NIL;

  }

  answer=fibonacci(n);

  printf("%d\n",answer);

  return 0;
}

int fibonacci(int n){

  if(n==0||n==1) return fib[n]=1;
  if(fib[n]!=NIL) return fib[n];

  return fib[n]=fibonacci(n-2)+fibonacci(n-1);

}

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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n;
    cin>>n;
    vector<ll> A(n);
    map<int,ll> m;
    for(auto & a: A)cin>>a,m[a]++;
    ll ret = 0ll;
    for(auto a : m){
       if(a.second >= 2){
           ret += a.second*(a.second-1)/2;
       }
    }
    
    for(int i=0;i<n;++i){
        ll cur = m[A[i]];
        ll curnum = ret;
        if(cur >= 2)curnum = curnum - 1ll*cur*(cur-1)/2 + 1ll*(cur-1)*(cur-2)/2;
        cout << curnum << endl;
    }
    return 0;
}

Measured memory_bytes: 11136
from collections import deque

N,M,K = map(int,input().split())
friend = [list(map(int,input().split())) for _ in range(M)]
block = [list(map(int,input().split())) for _ in range(K)]

f = [set() for _ in range(N+1)]
b = [set() for _ in range(N+1)]

for i,j in friend:
    f[i].add(j)
    f[j].add(i)
for i,j in block:
    b[i].add(j)
    b[j].add(i)

stack=deque()
ans = [0]*(N+1)
visited = [0]*(N+1)

for i in range(1,N+1):
    if visited[i]:
        continue
    link = {i}
    visited[i] = 1 
    stack.append(i)
    while stack:
        n = stack.pop()
        for j in f[n]:
            if visited[j]==0:
                stack.append(j)
                visited[j] = 1
                link.add(j)
    for i in link:
        ans[i] = len(link) - len(link & f[i]) - len(link & b[i]) - 1
print(*ans[1:])


Measured memory_bytes: 116828
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep3(i, s, n) for (int i = (s); i <= (int)(n); i++)
int rcv[3005][3005];
long long p[3005][3005][4];

int main() {
	int R;
	int C;
	int K;
	int x;
	int y;
	int z;
	long long zz;
	long long ans;


	cin >> R >> C >> K;


	rep(i, R+2){
		rep(j, C+2){
			rcv[i][j]=0;
			rep(kk, 4) p[i][j][kk]=0;
		}
	}

	rep3(i, 1, K) {
		cin >> x >> y >> z;
		rcv[x][y]=z;
	}

	rep3(i, 1, R) {
		rep3(j, 1, C) {
			zz=rcv[i][j];
			p[i][j][3]=max(p[i][j][3],p[i][j][2]+zz);
			p[i][j][2]=max(p[i][j][2],p[i][j][1]+zz);
			p[i][j][1]=max(p[i][j][1],p[i][j][0]+zz);
			p[i+1][j][0]=max(p[i+1][j][0],p[i][j][0]);
			p[i+1][j][0]=max(p[i+1][j][0],p[i][j][1]);
			p[i+1][j][0]=max(p[i+1][j][0],p[i][j][2]);
			p[i+1][j][0]=max(p[i+1][j][0],p[i][j][3]);
			p[i][j+1][0]=max(p[i][j+1][0],p[i][j][0]);
			p[i][j+1][1]=max(p[i][j+1][1],p[i][j][1]);
			p[i][j+1][2]=max(p[i][j+1][2],p[i][j][2]);
			p[i][j+1][3]=max(p[i][j+1][3],p[i][j][3]);
		}
	}
	ans=max(p[R][C][0],p[R][C][1]);
	ans=max(ans,p[R][C][2]);
	ans=max(ans,p[R][C][3]);

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 320676
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
void solve(){
	int[] xs = readln.chomp.to!(char[]).map!(to!int).array;
	
	xs.sort!"a<b"();
	
	if(xs[0] == xs[1] && xs[1] != xs[2] && xs[2] == xs[3]) "Yes".writeln;
	else "No".writeln;
}


Measured memory_bytes: 256
char = list(input())
q = int(input())

for i in range(q):
    s = input().split()
    if s[0] == "print":
        ans = char[int(s[1]):int(s[2])+1]
        print("".join(ans))
    elif s[0] == "reverse":
        tmp = char[int(s[1]):int(s[2])+1]
        result = ""
        for j in range(len(tmp)):
            result += tmp[-1-j]
        for i in range(len(result)):
            char[int(s[1])+i] = result[i]
    else:
        char = char[:int(s[1])] + list(s[3]) + char[int(s[2])+1:]


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

int main(){
  string A, B;
  cin >> A >> B;

  if (A.at(0) == B.at(2) && A.at(2) == B.at(0) && A.at(1) == B.at(1)){
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" <<endl;
  }
  
}

Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    int mx = 0;
    for (int i = 0; i + m <= n; i++) {
        int cnt = 0;
        for (int j = 0; j < m; j++) {
            if (t[j] == s[i + j]) cnt++;
        }
        mx = max(cnt, mx);
    }
    cout << m - mx << '\n';
    return 0;
}

Measured memory_bytes: 3628
N, K = map(int,input().split())
a = list(map(int,input().split()))
S = [0]*N
S[0] = a[0]
for k in range(1,N):
    S[k] = S[k-1] + a[k]
S = [0] + S
T = []
for k in range(N):
    for l in range(k+1,N+1):
        T.append(S[l]-S[k])
ans = 0
for d in range(41,-1,-1):
    c = 0
    for e in T:
        if (ans+2**d)&e == ans+2**d:
            c += 1
    if c >= K:
        ans += 2**d
print(ans)


Measured memory_bytes: 65916
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define rev(s) (string((s).rbegin(), (s).rend()))
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

int main() {
    int n;cin>>n;
    cout<<pow(n,3)<<endl;
}



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

int main() {
	double a,b,x;cin>>a>>b>>x;
	x/=a;
	double res=a*b-x;
	double ans;
	if(res<=a*b/2){
		ans=atan(2*res/a/a)*360/2/acos(-1);
	}else{
		ans=90-atan(2*x/b/b)*360/2/acos(-1);
	}
	cout<<setprecision(13)<<ans<<endl;
	return 0;
}


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

typedef long long ll;

int main() {
    int n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n), f(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n; i++)
        cin >> f[i];
    sort(a.begin(), a.end());
    sort(f.begin(), f.end(), greater<ll>());
    ll ub = 0;
    for (int i = 0; i < n; i++) {
        ub = max(ub, a[i] * f[i]);
    }
    ll lb = -1;
    while (ub - lb > 1) {
        ll mid = (lb + ub) / 2;
        ll train = 0;
        for (int i = 0; i < n; i++) {
            ll a_border = mid / f[i];
            train += max(a[i] - a_border, 0ll);
        }
        if (train <= k) {
            ub = mid;
        } else {
            lb = mid;
        }
    }
    cout << ub;
    return 0;
}

Measured memory_bytes: 6404
S = list(input())
ans = 0
count = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        count += 1
    else:
        if ans < count:
            ans = count
        else:
            pass
        count = 0
if ans < count:
    ans = count
else:
    pass
print(ans)

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

int main() {
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

struct UnionFind{
  vector<int> r;

  UnionFind(int N){
    r=vector<int>(N,-1);
  }

  int root(int x){
    if(r[x]<0) return x;
    return r[x]=root(r[x]);
  }

  bool unite(int x,int y){
    x=root(x);
    y=root(y);
    if(x>y) swap(x,y);
    if(x==y) return false;
    r[x]+=r[y];
    r[y]=x;
    return true;
  }

  int size(int x){
    return -r[root(x)];
  }
};

int main(){
  int n,m; cin>>n>>m;
  UnionFind UF(n);
  for(int i=0;i<m;i++){
    int a,b; cin>>a>>b;
    UF.unite(--a,--b);
  }
  int ans=0;
  for(int i=0;i<n;i++){
    ans=max(ans,UF.size(i));
  }
  cout<<ans;
}


Measured memory_bytes: 3996
N = int(input())
d = [ int(input()) for i in range(N)]
d = sorted(d)[::-1]
mochi = d[0]
count = 1

for j in range(1, N):
  if( d[j] < mochi ):
    count += 1
    mochi = d[j]

  else:
    continue
    
print(count)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#include <sstream>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007
#define M 998244353

using namespace std;

int main(){
    lli sx,sy,tx,ty;
    lli i,j;
    cin>>sx>>sy>>tx>>ty;
    rep(i,0,ty-sy){
        cout<<"U";
    }
    rep(i,0,tx-sx){
        cout<<"R";
    }
    rep(i,0,ty-sy){
        cout<<"D";
    }
    rep(i,0,tx-sx){
        cout<<"L";
    }
    cout<<"LU";
    rep(i,0,ty-sy){
        cout<<"U";
    }
    rep(i,0,tx-sx){
        cout<<"R";
    }
    cout<<"RDRD";
    rep(i,0,ty-sy){
        cout<<"D";
    }
    rep(i,0,tx-sx){
        cout<<"L";
    }
    cout<<"LU"<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int h = sc.nextInt();
    int w = sc.nextInt();
    int[][] a = new int[h][w];
    int[][] b = new int[h][w];
    for(int i = 0; i < h; i++) {
      for(int j = 0; j < w; j++) {
        a[i][j] = sc.nextInt();
      }
    }
    for(int i = 0; i < h; i++) {
      for(int j = 0; j < w; j++) {
        b[i][j] = sc.nextInt();
      }
    }
    int[][][] dp = new int[h][w][80 * (h + w + 1)];
    dp[0][0][Math.abs(a[0][0] - b[0][0])] = 1;
    for(int i = 0; i < h; i++) {
      for(int j = 0; j < w; j++) {
        int t = Math.abs(a[i][j] - b[i][j]);
        for(int k = 0; k < 80 * (h + w + 1); k++) {
          if(i > 0) {
            if((((k + t) < 80 * (h + w + 1)) && (dp[i - 1][j][k + t] == 1)) || (dp[i - 1][j][Math.abs(k - t)] == 1)) dp[i][j][k] = 1;
          }
          if(j > 0) {
            if((((k + t) < 80 * (h + w + 1)) && (dp[i][j - 1][k + t] == 1)) || (dp[i][j - 1][Math.abs(k - t)] == 1)) dp[i][j][k] = 1;
          }
        }
      }
    }
    int ans = 0;
    for(int i = 0; i < 80 * (h + w + 1); i++) {
      if(dp[h - 1][w - 1][i] == 1) {
        ans = i;
        break;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 499636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    int n;  cin>>n;
  
    map<ll,int>ma;
    bool ok = true;
    for(int i=0;i<n;i++)
    {
         ll a =0;
         cin>>a;
    
         if(!ma.count(a))
         {
              ma[a] = 1;
         }
         else
         {
             ok = false;
             break;
         }
      
    }

       if(ok)
         cout<<"YES"<<endl;
       else
          cout<<"NO"<<endl;

    return 0;

}


Measured memory_bytes: 12800
A, B = map(str, input().split())
 
B = str(int(float(B)*100+0.00001))
 
#print(B)
ans = []
p = [[]for k in range(len(B))]
for k in range(len(B)):
    for j in range(k):
        p[k].append(0)
for k in range(1, len(B)+1):
    a = 0
    for j in range(1, len(A)+1):
        if a > 9:
            a = int(str(a)[0]) + int(B[-k])*int(A[-j])
        else:
            a = int(B[-k])*int(A[-j])
        #print(a)
 
        p[k-1].append(int(str(a)[-1]))
        if j == len(A) and a >9:
            p[k-1].append(int(str(a)[0]))
 
for k in range(len(B)):
    for j in range(len(p[-1]) - len(p[k])):
        p[k].append(0)
 
#print(p)
a = 0
for k in range(len(p[0])): 
    if int(a) > 9: 
        a = int(str(a)[0])
    else:
        a =0
    for j in range(len(p)):
        a += p[j][k]
    ans.append(str(a)[-1])
    if k ==  len(p[0])-1 and a >9:
        ans.append(str(a)[0])

 
#print(ans)
op = ""
for k in range(1, len(ans)-1):
    op += ans[-k]
if len(ans)<3 or int(op) < 1:
    print("0")
else:
    print(op)


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

string s;

main(){
			cin>>s;
			if (s.size()<4){
				cout<<"No";
				return 0;
			}

			string tmp = "";
			for(int i=0; i<4; i++) tmp = tmp+s[i];
			if (tmp=="YAKI") cout<<"Yes";
			else cout<<"No";
}


Measured memory_bytes: 256
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  for(var i = 1; i <= 50000; i++){
    if(Math.floor(i * 1.08) == N){
      myout(i);
      return;
    }
  }
  myout(":(");
}

Measured memory_bytes: 32640
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, x, ans = 0;
  cin >> a >> b >> x;
  long long q = (a - 1) / x;
  if (a == 0 && x != 1) ans++;
  a = x * q + 1;
  ans += (b - a + 1) / x;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
program main
  implicit none
  integer :: n
  integer :: h, w
  integer, allocatable :: an(:)
  integer, allocatable :: masu(:)
  integer :: i, j, cnt

  read *, h, w
  read *, n

  allocate(an(n))
  allocate(masu(h*w))

  read *, an(1:n)

  cnt = 1
  do i = 1, n
    masu(cnt:cnt+an(i)-1) = i
    cnt = cnt + an(i)
  enddo

  do i = 1, h
    if(mod(i,2)==1)then
      print *, (masu(w*(i-1)+j), j = 1,w,1)
    else
      print *, (masu(w*(i-1)+j), j = w,1,-1)
    endif
  enddo

end program

Measured memory_bytes: 2892