akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vii;
typedef vector<char> vc;
typedef vector<vc> vcc;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define F first
#define S second
#define in insert
#define mina(a,b) (a)=min((a),(b));
#define maxa(a,b) (a)=max((a),(b));
const int INF = 1e9 + 7;
void solve(){
    string s; cin>>s;
    int cnt=0,ans=0;
    for(int i = 0; i < s.size(); i++){
        if(s[i]=='A' || s[i]=='G' || s[i]=='T' || s[i]=='C') cnt++;
        else{
            maxa(ans,cnt);
            cnt=0;
        }
    }
    maxa(ans,cnt);
    cout<<ans;
}
int main(){
    int T=1;
    //cin>>T;
    for(int i = 0; i < T; i++) solve(); 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  bool p,w,g,y = false;
  rep(i,n){
      string s;
      cin >> s;
      if(s=="P"){
          if (p==false){
              p=true;
          }
      }
      else if(s=="W"){
          if (w==false){
              w=true;
          }
      }
      else if(s=="G"){
          if (g==false){
              g=true;
          }
      }
      else{
          if (y==false){
              y=true;
          }
      }
  }
  int ans = 0;
  if (p) ++ans;
  if (w) ++ans;
  if (g) ++ans;
  if (y) ++ans;

  if (ans==3) cout<<"Three"<<endl;
  else cout<<"Four"<<endl;
}

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

A, B, C = map(int, raw_input().split())

ans = 0
while not (A%2 or B%2 or C%2 or A == B == C):
    A, B, C = (B + C)/2, (C + A)/2, (A + B)/2
    ans += 1
print ans if not A == B == C else -1 if A%2 == 0 else 0



Measured memory_bytes: 2572
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        String [][]a=new String[m][2];
        for(int i=0;i<m;i++){
            a[i][0]=sc.next();
            a[i][1]=sc.next();
        }
        int ans=0;
        for(int i=0;i<m;i++){
            Graph g=new Graph();
            for(int j=0;j<n;j++)g.add((j+1)+"");
            for(int j=0;j<m;j++){
                if(i!=j)g.add(a[j][0],a[j][1]);
            }
            if(g.connectedCompo()!=1)ans++;
        }
        System.out.println(ans);
    }
}
class Graph {
	Map<String, ArrayList<String>> edge ;
	Map<String, Integer> vertex ;
	public Graph() {
		edge = new HashMap<String, ArrayList<String>>();
		vertex=new HashMap<String,Integer>();
	}
	public void add(String a) {
		if (!edge.containsKey(a)) {
			ArrayList<String>cont=new ArrayList<>();
			edge.put(a,cont);
			vertex.put(a,1);
		}
	}
	public void add(String a, String b) {
		if (edge.containsKey(a)) {
			edge.get(a).add(b);
			vertex.put(a,vertex.get(a)+1);
		} else {
			ArrayList<String>cont=new ArrayList<>();
			cont.add(b);
			edge.put(a, cont);
			vertex.put(a,1);
		}
		if (edge.containsKey(b)) {
			edge.get(b).add(a);
			vertex.put(b,vertex.get(b)+1);
		} else {
			ArrayList<String>cont=new ArrayList<>();
			cont.add(a);
			edge.put(b, cont);
			vertex.put(b,1);
		}
	}
	public int connectedCompo() {
		Map<String,Integer>copyV=new HashMap<>(vertex);
		int count=0;
		while(copyV.size()!=0) {
			count++;
			String a="";
			for(String key:copyV.keySet()) {
				a=key;
				break;
			}
			copyV.remove(a);
			ArrayList<String>queue=new ArrayList<>();
			queue.add(a);
			Map<String,Boolean>check=new HashMap<String,Boolean>();
			check.put(a,false);
			while(queue.size()!=0) {
				ArrayList<String>cont=edge.get(queue.get(0));
				queue.remove(0);
				for(int i=0;i<cont.size();i++) {
					if(!check.containsKey(cont.get(i))) {
						copyV.remove(cont.get(i));
						queue.add(cont.get(i));
						check.put(cont.get(i),false);
					}
				}
			}
		}
		return count;
	}

}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
using namespace std;
int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int Ar[3];
	int count;
	int A,B,C;
	cin >> Ar[0] >> Ar[1] >> Ar[2];
	sort(Ar,Ar+3);
	A=Ar[0];
	B=Ar[1];
	C=Ar[2];
	if (A%2==B%2&&A%2==C%2){
		count = ((C-A)/2)+((C-B)/2);
	}else{
		count = 1;
		if (A%2==B%2){
			A++;
			B++;
		}else if(A%2==C%2){
			A++;
			C++;
		}else{
			B++;
			C++;
		}
		count += ((C-A)/2)+((C-B)/2);
	}
	cout << count << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a, b;
  char op;
  while(1){
      scanf("%d %c %d", &a, &op, &b);
      if(op=='?'){
          break;
      }else if(op=='+'){
          printf("%d\n", a+b);
      }else if(op=='-'){
          printf("%d\n", a-b);
      }else if(op=='*'){
          printf("%d\n", a*b);
      }else if(op=='/'){
          printf("%d\n", a/b);
      }
  }
  return 0;
}


Measured memory_bytes: 2140
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <sstream>

using namespace std;

vector< vector<int> > hyou(100, vector<int>(100, -1));

int main() {
	cin >> hyou[0][0];
	int dx[2] = {0, 1};
	string a;
	int counter = 1;
	int counter2 = 0;
	getline(cin, a);
	while (getline(cin, a)) {
		counter2 = 0;
		string b;
		while (a.find(',') != string::npos) {
			stringstream ss;
			b = a.substr(0, a.find(','));
			ss << b;
			ss >> hyou[counter][counter2];
			a = a.substr(a.find(',')+1);
			counter2++;
		}
		stringstream ss;
		ss << a;
		ss >> hyou[counter][counter2];
		counter++;
	}
	for (int i = 1; i <= counter/2; i++) {
		for (int j = 0; ; j++) {
			if (hyou[i][j] == -1) {
				break;
			} else if (j == 0){
				hyou[i][j] += hyou[i-1][j];
			} else {
				hyou[i][j] += max(hyou[i-1][j-1], hyou[i-1][j]);
			}
		}
	}
	for (int i = counter/2+1; i < counter; i++) {
		for (int j = 0; ; j++) {
			if (hyou[i][j] == -1) {
				break;
			} else {
				hyou[i][j] += max(hyou[i-1][j], hyou[i-1][j+1]);
			}
		}
	}
	cout << hyou[counter-1][0] << endl;
	return 0;
}

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

int tvtimeline[32][200010];

int main() {
    int N,C;
    cin >> N >> C;
    for (int i=0; i<N; i++) {
        int s,t,c;
        cin >> s >> t >> c;
        tvtimeline[c][2*s - 1] += 1;
        tvtimeline[c][2*t] -= 1;
    }

    for (int i=1; i<=C; i++) {
        for (int j=1; j<200010; j++) {
            tvtimeline[i][j] += tvtimeline[i][j - 1];
        }
    }

    int ans = 0;
    for (int i=1; i<200010; i++) {
        int c = 0;
        for (int j=1; j<=C; j++) {
            if (tvtimeline[j][i] > 0) c++;
        }
        ans = max(ans, c);
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
	
	std::string a;
	std::string b;
	std::string c;

	std::cin >> a >> b >> c;

	if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
		std::cout << "YES" << std::endl;
	}
	else {
		std::cout << "NO" << std::endl;
	}
	return 0;
}

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

const int N = 2e5+5;
ll d,a;
int n;
ll ans = 0;
set<pair<ll,ll>> data;



void solve(){
	set<pair<ll,ll>> endingAt;
	ll total = 0;
	for(auto i : data){
		ll lim = i.first;
		while(!endingAt.empty() and endingAt.begin()->first < lim ){
			total -= endingAt.begin()->second;
			endingAt.erase(endingAt.begin());
		}

		if( total < (i.second) ){
			ll reqd = (i.second - total)/a;
			if( (i.second -total)% a != 0 ){ reqd++; }
			ll amount = reqd * a;
			ll endsat = i.first + 2 * d;
			// cout<<"Start new bomb at:"<<i.first+d<<" with amount"<<amount<<endl;
			total += amount;
			endingAt.insert({endsat, amount});
			ans += reqd;
		}
	}
}

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

	cin>>n>>d>>a;
	for(int i=0; i<n; ++i){
		ll a,b;
		cin>>a>>b;
		data.insert({a,b});
	}
	solve();
	cout<<ans<<endl;


	return 0;
}


Measured memory_bytes: 19072
using System;
using System.Linq;
using static System.Console;

namespace ConsoleAppAtCoderABC171
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(ReadLine());

            Func(n - 1);
        }

        static void Func(long x)
        {
            var q = x / 26;
            var r = x % 26;

            if(q != 0)
            {
                Func(q - 1);
            }

            var alpha = new char[] {
                'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
                'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
            };

            Write(alpha[r]);
        }
    }
}


Measured memory_bytes: 27508
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#define inf 1e9+7
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

const int MAX = 1000001;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main() {
    ll x,y;
    cin >> x >> y;
    if((x+y)%3!=0) cout << 0 << endl;
    else {
        ll d=(x+y)/3;
        ll l=x-d;
        ll k=y-d;
        COMinit();
        cout << COM(l+k,l) << endl;
    }
}






Measured memory_bytes: 23680
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back 
#define MP make_pair
typedef long long ll;
const ll INF=1<<28;
const ll LINF=1ll<<61;
//My own input/output stream
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putsp()
#define putii(x,y) puti(x),putnum(y),putsp()
#define putiii(x,y,z) putii(x,y),putnum(z),putsp()
#define putsi(x) putnum(x),putendl()
#define putsii(x,y) puti(x),putnum(y),putendl()
#define putsiii(x,y,z) putii(x,y),putnum(z),putendl()
inline ll getnum()
{
	register ll r=0;register bool ng=0;register char c;c=getchar();
	while(c!='-'&&(c<'0'||c>'9'))c=getchar();
	if(c=='-')ng=1,c=getchar();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=getchar();
	if(ng)r=-r;return r;
}
template <class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline void putsp(){putchar(' ');}
inline void putendl(){putchar('\n');}
inline char mygetchar(){register char c=getchar();while(c==' '||c=='\n')c=getchar();return c;}
int n;
int main()
{
	geti(n);
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		int x;
		geti(x);
		if(x&1)cnt++;
	}
	if(cnt%2==0)puts("YES");else puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;


int main(){
    int h,w;
    cin >> h >> w;
    int A,B;
    cin >> A >> B;
    cout << (h-A)*(w-B) << endl;
}

Measured memory_bytes: 256
loop do
    n = gets.to_i
    break if n == 0
    h = {}
    all_names = []
    n.times do
        name, _, *scenes = gets.chomp.split
        all_names << name
        scenes.each do |c|
            (h[c] ||= []) << name
        end
    end
    point = Hash.new(0)
    h.each do |_, names|
        names.each do |name|
            point[name] += n - names.size + 1
        end
    end
    n = all_names.min_by {|name| [point[name], name]}
    puts [point[n], n] * ' '
end


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

int main() {
  int n;
  cin >> n;
  string s;
  bool p=false;
  bool w=false;
  bool g=false;
  bool y=false;
  bool four=false;
  for (int i=0; i < n; i++) {
    cin >> s;
    if (s=="Y")
      y=true;
    else if (s=="P")
      p=true;
    else if (s=="W")
      w=true;
    else if (s=="G")
      g=true;
  }
  if (p && w && g && y)
    cout << "Four";
  else if (p && w && g)
    cout << "Three";
}



Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - Red or Not
 */

#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 */

char s[16];

/* subroutines */

/* main */

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

  if (a >= 3200) puts(s);
  else puts("red");
  return 0;
}


Measured memory_bytes: 256
from bisect import bisect_right as bisect

n=int(input())
s=list(map(int,input().split()))
q=int(input())
t=list(map(int,input().split()))

s.sort()

ans=0
for i in range(q):
    index=bisect(s,t[i])
    if index>0:
        if t[i]==s[index-1]:
            ans+=1

print(ans)



Measured memory_bytes: 16744
#include<cstdio>
#include<cstring>
#include<iostream>
#define N 110
using namespace std;
int n,m;
inline int trans(int &x,int &y)
{
	if(x&1)
	{
		if(y==m) x++;
		else y++;
	}
	else{
		if(y==1) x++;
		else y--;
	}
	return 0;
}
int a[N][N];
int main()
{
	int p;scanf("%d%d%d",&n,&m,&p);
	int nowx=1,nowy=1;
	for(int now=1;now<=p;now++)
	{
		int c;scanf("%d",&c);
		for(int i=1;i<=c;i++)
			a[nowx][nowy]=now,
			trans(nowx,nowy);
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(j<m) printf("%d ",a[i][j]);
			else printf("%d\n",a[i][j]);
	return 0;
}

Measured memory_bytes: 384
// C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

int main()
{
    int min = 1000000000;
    int ans = 0;
    int ansin;
    int n;
    int x[100];
    cin >> n;

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

    for (int i = 1; i <= 100; i++) {
        for (int j = 0; j < n; j++) {
            ans += (x[j] - i) * (x[j] - i);
        }

        if (ans < min) {
            ansin = i;
            min = ans;
           
        }
        ans = 0;
    }

    cout << min << endl;

    return 0;


}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 256
//%std
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read()
{
	ll out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		fh=-1,jp=getchar();
	while (jp>='0'&&jp<='9')
		out=out*10+jp-'0',jp=getchar();
	return out*fh;
}
int main()
{
	ll n=read(),ans=0;
	for(ll i=1;i*i<=n;++i)
		if(n%i==0)
			ans=i+n/i-2;
	cout<<ans<<endl;
	return 0;
}


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

int main () {
  long long N,K;
  cin >> N >> K;
  vector<pair<long long,long long>> p(N);
  for (int i = 0; i < N; i++) {
    cin >> p.at(i).first >> p.at(i).second;
  }
  sort(p.begin(), p.end());
  
  long long num;
  long long mae = 0;
  for (int i = 0; i < N; i++) {
    mae += p.at(i).second;
    if (mae >= K){
      cout << p.at(i).first << endl;
      return 0;
    }
  }
}

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

using namespace std;
#define rep(i,n) for (int i =0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;

int main() {
	int A[32]={ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	int K;
	cin >> K;
	
	cout << A[K-1];
	
}
	

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

lis = list(map(int, input().split()))

lis = sorted(lis)

if len(lis) == 2:
    print((lis[0]+lis[1])/2)
    exit()
else:
    ans = 0
    tmp = (lis[0]+lis[1])/2
    for i in range(2,n-1):
        tmp = (tmp + lis[i])/2
        
    ans = (tmp+lis[n-1])/2
    
print(ans)

Measured memory_bytes: 3064
program bomb
  implicit none
  integer :: h, w, i, c, j
  character(len=50), allocatable :: s(:), ans(:)
  
  read(*,*) h, w
  allocate(s(h),ans(h))
  do i = 1, h
     read(*,'(a)') s(i)
  end do

  call bombcount(s, h, w, ans)

  do i = 1, h
     write(*,'(a)') trim(adjustl(ans(i)))
  end do

  deallocate(s, ans)

  stop
contains
  
  subroutine bombcount(s, h, w, ans)
    implicit none
    character(len=50) :: s(h), ans(h)
    integer :: i, j, h, w, num(0:h+1,0:w+1)
    integer :: a, c

    num = 0
    do i = 1, h
       do j = 1, w
          ans(i)(j:j) = '0'
       end do
       if ( w /= 50 ) then
         do j = w+1, 50
           ans(i)(j:j) = ''
         end do
       end if
    end do

    do i = 1, h
       do j = 1, w
          if ( s(i)(j:j) == '#' ) then
             do a = i-1, i+1
                do c = j-1, j+1
                   num(a,c) = num(a,c) + 1
                end do
             end do
          end if
       end do
    end do

    do i = 1, h
       do j = 1, w
          if ( s(i)(j:j) == '#' ) then
             write(ans(i)(j:j),'(a)') '#'
          else
             write(ans(i)(j:j),'(i1)') num(i,j)
          end if
       end do
    end do
    
  end subroutine bombcount
end program bomb



Measured memory_bytes: 2944
<?php

$input = trim(fgets(STDIN));
$input_array = explode(" ", $input);

$input = trim(fgets(STDIN));
$kane_array = explode(" ", $input);
sort($kane_array);

$sum = 0;
for ($i = 0; $i < $input_array[1]; $i++) {
    $sum += $kane_array[$i];
}
echo $sum;


Measured memory_bytes: 16080
#include <iostream>
#include <algorithm>
#include <vector>
#define N 1000000
using namespace std;

/*int binarySearch(int n,long S[],int key){
  int left=0;
  int right=n-1;
  int mid;

  while(left < right){
    mid=(left + right)/2;
    if(S[mid]==key) return mid;
    else if(key<S[mid]) right=mid;
    else left=mid+1;
  }

  return 0;
}
*/
int main(){
  int n,q;
  vector<int> S;

  cin >> n;
  for(int i=0;i<n;i++){
    int s;
    cin >> s;
    S.push_back(s);
  }
  sort(S.begin(),S.end());

  int cnt=0;
  cin >> q;

  while(q--){
    int x;
    cin >> x;
    if(binary_search(S.begin(),S.end(),x)) cnt++;
  }

  cout << cnt << endl;

  return 0;
}



Measured memory_bytes: 3432
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, M, K;
vector<int> A, B;
string S, T;

void input() {
  int x, y, z;
  cin >> N;
  ;
}
void solve() {
  rrep(i, ((N + 1) / 2), 1) {
    if (i * i <= N) {
      cout << i * i << endl;
      return;
    }
  };
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int a=0,x=0,y=0;
  scanf("%d",&a);
  scanf("%d",&x);
  if (a==x) {
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
import math
import numpy as np

A, B, H, M = map(int, input().split())

past = 60.0*H + M
half_day = 12*60.0

omega_long = past/half_day
omega_short = M/60.0
#past/half_day*12.0                                                                                    

#print(omega_long)                                                                                     
#print(omega_short)                                                                                    

omega = np.abs(omega_long - omega_short)
omega = 2*np.pi*omega

ans = np.sqrt(math.pow(B*np.sin(omega),2) + math.pow((A-B*np.cos(omega)),2))

print(ans)




Measured memory_bytes: 27200
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
  private static final long M = 1_000_000_007;
  private static long[] fact;
  private static long[] factinv;

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int K = scanner.nextInt();

    fact = new long[K + 1];
    fact[0] = 1;
    for (int i = 1; i <= K; i++) fact[i] = fact[i - 1] * i % M;
    factinv = new long[K + 1];
    factinv[0] = 1;
    for (int i = 1; i <= K; i++) factinv[i] = factinv[i - 1] * inverse(i, M) % M;

    Node[] nodes = new Node[N];
    for (int i = 0; i < N; i++) nodes[i] = new Node(i);
    for (int i = 0; i < N - 1; i++) {
      int a = scanner.nextInt() - 1;
      int b = scanner.nextInt() - 1;
      nodes[a].adjacents.add(nodes[b]);
      nodes[b].adjacents.add(nodes[a]);
    }
    System.out.println(dfs(nodes[0], K));
  }

  private static long dfs(Node node, int K) {
    node.visited = true;
    long d = 1;
    int numChildren = 0;
    for (Node n : node.adjacents) {
      if (!n.visited) {
        d *= dfs(n, K);
        d %= M;
        numChildren++;
      }
    }
    if (node.id == 0) {
      d *= perm(K, numChildren + 1);
    } else {
      d *= perm(K - 2, numChildren);
    }
    d %= M;
    return d;
  }

  private static long perm(int n, int k) {
    if (k > n) return 0;
    return fact[n] * factinv[n - k] % M;
  }

  private static class Node {
    final int id;
    boolean visited;
    final List<Node> adjacents = new ArrayList<>();

    private Node(int id) {
      this.id = id;
    }
  }

  private static long inverse(long a, long mod) {
    return modpow(a, mod - 2, mod);
  }

  private static long modpow(long a, long n, long mod) {
    long res = 1;
    while (n > 0) {
      if (n % 2 == 1) res = (res * a) % mod;
      a = (a * a) % mod;
      n >>= 1;
    }
    return res % mod;
  }
}


Measured memory_bytes: 108712
a, b, k = map(int, input().split())
ans = []
for i in range(k):
    if a + i <= b:
        ans.append(a + i)
for j in range(b - k + 1, b + 1):
    if j not in ans and a <= b - k + 1:
        ans.append(j)
for k in range(len(ans)):
    print(ans[k])


Measured memory_bytes: 9184
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 998244353 //1000000007 // //100000000
#define INF 1000000000000000000
#define ll int //long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

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

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}


void solve(){
    string s;
    cin >> s;
    map<char, ll> mp;
    for(auto x: s) mp[x]++;
    itr(it, mp)
    {
        if(it->sd %2 == 1) ANS("No");
    }
    ANS("Yes")
}
main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long int ll;

int main()
{
	int n,k;
	cin>>n>>k;
	k = k - 1;
	ll *x = new ll[n];
	rep(i,n){
		cin>>x[i];
	}
	ll left,right,distance;
	distance = 100000000000;
	for(int i = 0; i + k < n; i++){
		left = x[i];
		right = x[i+k];
		ll temp;
		if( left <= 0 && right <= 0){
			temp = abs(left);
		}else if(left >= 0 && right >= 0){
			temp = abs(right);
		}else{
			temp = min(abs(left),abs(right))*2 + max(abs(left),abs(right));
		}
		distance = min(distance,temp);
		//cout<<temp<<endl;
	}
	cout<<distance<<endl;
	return 0;
}



Measured memory_bytes: 1024
MOD = 10**9+7
n = int(input())
F = [1]*(n+1)
for i in range(n):
  F[i+1] = F[i]*(i+1)
  F[i+1] %= MOD
X = list(map(int, input().split()))
D = [X[i+1]-X[i] for i in range(n-1)]
T = [1]*n
for i in range(2, n):
  T[i] = T[i-1]*i+F[i-1]
  T[i] %= MOD
t = 1
for i in range(1, n-1):
  t *= (n-i)
  t %= MOD
  T[n-1-i] *= t
  T[n-1-i] %= MOD
ans = 0
for i in range(1, n):
  ans += D[i-1]*T[i]
  ans %= MOD
print(ans)

Measured memory_bytes: 18940
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();
		int C = sc.nextInt();

		int Blist[] = new int[M];
		for(int i=0; i<Blist.length; i++){
			Blist[i] = sc.nextInt();
		}

		int Alist[][] = new int[N][M];
		for(int s=0; s<N; s++){
			for(int t=0; t<M; t++){
				Alist[s][t] = sc.nextInt();
			}
		}

		int answer = 0;
		for(int x=0; x<N; x++){
			int sum = 0;
			for(int y=0; y<M; y++){
					sum += Alist[x][y] * Blist[y];
			}
			sum += C;
			if(sum > 0){
				answer++;
			}
		}

		System.out.println(answer);
    }
}

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

bool solve(string& s, string& t) {
    if (s.size() + 1 != t.size()) {
        return false;
    } else {
        for (int i = 0; i < s.size(); i++) {
            if (s[i] != t[i]) {
                return false;
            }
        }
        return true;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);


    string s, t;
    cin >> s >> t;

    if (solve(s, t)) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }
}


Measured memory_bytes: 3652
n, m = map(int, input().split())
s, e = set(), set()
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        s.add(b)
    elif b == n:
        e.add(a)
if len(s & e) != 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 18936
/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        xv: [i64; m],
    }

    if n >= m {
        println!("0");
        return;
    }

    let mut xv = xv;
    xv.sort();
    let total_distance = xv[m - 1] - xv[0];

    // println!("{:?}", xv);
    // println!("{:?}", total_distance);

    let mut distances: Vec<_> = xv.windows(2).map(|pair| pair[1] - pair[0]).collect();
    distances.sort_by(|a, b| b.cmp(a));

    // println!("{:?}", distances);

    let erasable_distance: i64 = distances[..(n - 1)].iter().sum();

    // println!("{:?}", erasable_distance);

    let answer = total_distance - erasable_distance;
    println!("{}", answer);
}


Measured memory_bytes: 6396
#include<stdio.h>


void write_rect(int x,int y);

int main()
{
		int h,w;
		int check=1;
		
		while(check){
			
				scanf("%d %d",&h,&w);
				
				if(h == 0 && w == 0){
						check = 0;
				}else{
						write_rect(h,w);
				}
		}

		return 0;
}

void write_rect(int height,int width){

		int i,l;
		for(i=0;i<height;i++){
				for(l=0;l<width;l++){
						printf("#");
				}
				printf("\n");
		}
		printf("\n");
}
			


Measured memory_bytes: 2104
eval"N,K,*A="+`dd`.split*?,
s=eval A*?+
1.upto(3e4){|j|s%j<1&&$*<<j<<s/j}
p$*.select{|h|t=0
K>=A.map{|x|x%h}.sort.map{|x|t+=x}[~t/h]}.max

Measured memory_bytes: 16512
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int a;
		int map[];
		int max;

		map = new int[101];
		max = 0;
		while (sc.hasNext()) {
			a = sc.nextInt();
			map[a]++;
			if (max < map[a]) {
				max = map[a];
			}
		}
		for (int i = 1; i <= 100; i++) {
			if (map[i] == max) {
				System.out.println(i);
			}
		}

	}
}

Measured memory_bytes: 12000
from operator import itemgetter
from itertools import chain

n = int(input())
aaa = [tuple(map(int, input().split())) for _ in range(n)]
flatten = sorted(chain.from_iterable([(a, i), (b, i)] for i, (a, b) in enumerate(aaa)))
picked = set()
ans = 0

for ab, i in flatten[:n]:
    picked.add(i)
    ans += ab

if len(picked) == n:
    exclude = flatten[n - 1]
    include = flatten[n]
    if exclude[1] == include[1]:
        tmp1 = include[0] - flatten[n - 2][0]
        tmp2 = flatten[n + 1][0] - exclude[0]
        ans += min(tmp1, tmp2)
    else:
        ans -= exclude[0]
        ans += include[0]

ans = min(ans, sum(map(itemgetter(0), aaa)), sum(map(itemgetter(1), aaa)))

print(ans)


Measured memory_bytes: 41644
n,m = map(int,input().split())
g = [[]*(n+1) for _ in range(n+1)]
d = []
for _ in range(m):
    a,b = map(int,input().split())
    g[a].append(b)
    g[b].append(a)
    d.append([a,b])
seen = [False]*(n+1)
seen[0]=True
def dfs(s):
    seen[s]=True
    for e in g[s]:
        if not seen[e]:
            dfs(e)
cnt = 0
for i in range(m):
    a,b = d[i]
    g[a].remove(b)
    g[b].remove(a)
    dfs(1)
    for i in range(n+1):
        if not seen[i]:
            cnt += 1
            break
    seen = [False]*(n+1)
    seen[0]=True
    g[a].append(b)
    g[b].append(a)
print(cnt)

Measured memory_bytes: 79936
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

struct SegTree{
    int n; vector<ll> dat;
    //初期化
    SegTree(){}
    SegTree(int _n){
        n=1;
        while(n<_n) n*=2;
        dat=vector<ll>(2*n-1,LLONG_MAX);
    }
    ll get(int k){
        return dat[k+n-1];
    }
    //k番目(0-indexed)の値をaに変更
    void update(int k, ll a){
        k+=n-1;
        dat[k]=a;
        //更新
        while(k>0){
            k=(k-1)/2;
            dat[k]=min(dat[2*k+1],dat[2*k+2]);
        }
    }
    //内部的に投げられるクエリ
    ll _query(int a, int b, int k, int l, int r){
        if(r<=a || b<=l) return LLONG_MAX;
        if(a<=l && r<=b) return dat[k];

        ll vl=_query(a,b,2*k+1,l,(l+r)/2);
        ll vr=_query(a,b,2*k+2,(l+r)/2,r);
        return min(vl,vr);
    }
    //[a,b)
    ll query(int a, int b){
        return _query(a,b,0,0,n);
    }
};

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

    SegTree t[2];
    rep(i,2){
        t[i] = SegTree(n);
        rep(j,n){
            int x;
            scanf(" %d", &x);
            t[i].update(j,x);
        }
    }

    set<int> upd;
    rep(i,n) upd.insert(i);

    int Q;
    scanf(" %d", &Q);
    while(Q--){
        int x,y,z;
        scanf(" %d %d %d", &x, &y, &z);
        if(x<=2){
            x -= 1;
            t[x].update(y-1,z);
            upd.insert(y-1);
        }
        else if(x<=4){
            x -= 3;
            printf("%lld\n", t[x].query(y-1,z));
        }
        else{
            x -= 5;
            for(int idx:upd) t[x].update(idx, t[!x].get(idx));
            upd.clear();
        }
    }
    return 0;
}



Measured memory_bytes: 20500
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10

MOD = 10 ** 9 + 7

# 1 <= |S| <= 10^5
S = [c for c in stdin.readline().rstrip()]
N = len(S)


# dp[i][j] := 先頭i文字として考えられるもののうち，13で割ったあまりがjであるものの数
# dp[100005][13]
dp = [[0] * 13 for _ in range(10**5+5)]

dp[0][0] = 1

for i in range(N):
    c = 0
    if S[i] == "?":
        c = -1
    else:
        c = int(S[i])

    for j in range(10):
        if (c != -1 and c != j):
            continue
        
        for ki in range(13):
            dp[i+1][(ki * 10 + j) % 13] += dp[i][ki]

    for j in range(13):
        dp[i+1][j] %= MOD


ans = dp[N][5]

print(ans)


Measured memory_bytes: 91880
def genP():
	yield 2
	yield 3
	c=6
	while 1:
		yield c-1
		yield c+1
		c+=6
def sosu(n):
	if n in [2,3,5]:
		return True
	l=int(n**0.5)+1
	p=genP()
	for i in p:
		if i>l:
			return True
			break
		elif n%i==0:
			return False
			break



def resolve():
	x=int(input())
	while 1:
		if sosu(x):
			print(x)
			break
		else:
			x+=1

resolve()

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rrep1(i,n) for(ll i=n;i>=1;i--)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;

template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}

ll K;
ll s[2001][2001];
ll ssum(ll x1,ll y1,ll x2,ll y2){
    return s[x2][y2]-s[x1][y2]-s[x2][y1]+s[x1][y1];
}

int main(){
	ll N; cin>>N>>K;
    ll ans=0;
    map<P,ll> m;
  
    rep(i,N){
        ll x,y; cin>>x>>y;
        string c; cin>>c;
        if(c[0]=='W') x+=K;

        x%=(2*K); y%=(2*K);
        m[mp(x,y)]++;
    }
  
    rep1(i,2*K){
        rep1(j,2*K){
            s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1];
            auto it=m.find(mp(i-1,j-1));
            if(it!=m.ed) s[i][j]+=it->b;
        }
    }

    rep(i,K){
        rep(j,2*K){
            ll tmp=0;
            tmp+=ssum(i,j,i+K,min(j+K,2*K));
            tmp+=ssum(min(i+K,2*K),min(j+K,2*K),2*K,2*K);
            tmp+=ssum(0ll,min(j+K,2*K),i,2*K);
            tmp+=ssum(0ll,max(0ll,j-K),i,j);
            tmp+=ssum(i+K,max(0ll,j-K),2*K,j);
            tmp+=ssum(i,0ll,i+K,max(j-K,0ll));

            chmax(ans,tmp);
        }
    }
    cout<<ans;
}


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

typedef long long ll;
ll L[87];

int main() {
  int N; cin >> N;
  L[0] = 2,L[1] = 1;
  for ( int i = 2; i <= N; i++ ) {
    L[i] = L[i-1] + L[i-2];
  }
  cout << L[N] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <tuple>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <random>
#include <queue>
#include <deque>
#include <iterator>
#include <map>
#include <functional>
#include <numeric>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define pb(a) push_back(a)
#define llong long long
#define INF 1145141919
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
int dy[] = { 1, 0, -1, 0 };
int dx[] = { 0, 1, 0, -1 };
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

string n;
string solve() {
	for (int i = 0; i < 3; i++) {
		if (n[i] == '1') {
			n[i] = '9';
		} else if (n[i] == '9') {
			n[i] = '1';
		}
	}
	return n;
}
int main() {
	cin >> n;
	cout << solve() << endl;
	return 0;
}

Measured memory_bytes: 256
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N = I()
S = LS2()
for i in range(len(S)):
    a = ord(S[i]) + N
    if a <= 90:
        S[i] = chr(a)
    else:
        S[i] = chr(a-26)

print(''.join(S))

Measured memory_bytes: 65200
S = input()
plusi = len(S) - 1

total = 0
for i in range(2**plusi):
    prej = 0
    ret = []
    for j in range(plusi):
        if (i >> j) & 1:
            total += int(S[prej:j+1])
            prej = j + 1
    total += int(S[prej:plusi+1])
print(total)

Measured memory_bytes: 3060
check = [False,False]


for i in range(0,100000):
    check.append(True)

for i in range(2,100000):
    if(check[i]):
        for j in range(i*i,100000,i):
            check[j]=False


while True:
    try:
        x = int(input())
        a = b = x

        for i in reversed(range(0,x)):
            if(check[i]):
                a = i
                break

        while True:
            x += 1
            if(check[x]):
                b = x
                break
        
        print("%d %d"%(a,b))
        
    except:
        break


Measured memory_bytes: 6468
#include <iostream>
#include <vector>
#include <string>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

// MOD
const int MOD = 1000000007;

// 入力
int H, W;
vector<string> a;

// DP テーブル
int dp[1100][1100] = {0};

// add
void add(int &a, int b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

int main() {
    cin >> H >> W;
    a.resize(H);
    for (int i = 0; i < H; ++i) cin >> a[i];

    // DP 初期化: すでに配列全体が 0 に初期化されているので OK

    // DP 初期条件
    dp[0][0] = 1;

    // DP ループ
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            if (i+1 < H && a[i+1][j] == '.') add(dp[i+1][j], dp[i][j]);
            if (j+1 < W && a[i][j+1] == '.') add(dp[i][j+1], dp[i][j]);
        }
    }
    cout << dp[H-1][W-1] << endl;
}

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

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

    ll cnt = 0;
    ll mns = 1;
    while(true){
        if(H == 1){
            cnt += mns;
            break;
        }else{
            cnt += mns;
            H = H/2;
            mns = mns*2;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (int)1e9
#define endl "\n"
#define ll long long
#define ull unsigned long long

using namespace std;

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

    double ans = (double)log10(n) / (double)log10(m);

    if (ceil(ans) == ans)
        ans++;

    cout
        << ceil(ans) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n, k;
    string s;
    cin >> n >> s >> k;
    for(auto c : s) {
        if (c != s[k-1]) cout << '*';
        else cout << s[k-1];
    }
    cout << endl;
}

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

int main(){
  long long int k, a, b;
  long long int n = 1;
  cin >> k >> a >> b;
  
  if(b - a <= 2 || k - 1 < a){
    cout << n + k << endl;
  }else{
    n += a - 1;
    k -= a - 1;
    
    n += k / 2 * ( b - a);
    n += k % 2;
    cout << n << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int solve(int n, int s, int t){
    if (n == 1) {
     if (s >= t && s < 10) return 1;
     else return 0;
    }
    int ret = 0;
    for(int i = t; i < 10 && i < s; i++)
        ret += solve(n - 1, s - i, i + 1);
    return ret;
}

int main(){
    int n,s;
    while(cin >> n >> s) {
      if (n == 0 && s == 0) break;
      cout << solve(n, s, 0) << endl;
    }
    return 0;
}

Measured memory_bytes: 0
def check(n):
    """
    nの約数が8個かどうかを調べる
    """
    count = 0
    for i in range(1, n + 1):
        if n % i == 0:
            count += 1

    if count == 8:
        # print(n)
        return True
    else:
        return False


def main():
    n = int(input())
    count = 0
    for i in range(3, n + 1, 2):
        if check(i):
            count += 1

    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll tmp1,tmp2,tmp3;
const ll mod = 1e9+7;
const int INF = 1e9;
const ll INFLONG = 1e18;
int main(){
  ll x;
  cin >> x;
  cout << x * x * x << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <regex>
#include <list>
#include <iomanip>
#include <iterator>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <climits>
#include <string>
#include <set>
#include <numeric>
#include <bitset>
#include <cmath>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <numeric>
#include <vector>
#include <cassert>
#include <ctime>

using namespace std;

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define FORi(i,a,b) for(int i=int(a);i<=int(b);i++)
#define FOR(i,n) FORi(i,1,n)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mt make_tuple
#define pb push_back
#define sz size()
#define SET(__set, val) memset(__set, val, sizeof(__set))

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;
using pii=pair<int, int>;
using pdd=pair<double, double>;
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto& p: c) os << p << " ";
	return os<<']';
}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}


template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

constexpr int INF=1e9;
constexpr int MOD=1000000007;
constexpr double EPS=1e-9;
constexpr int maxw=31;
constexpr int maxn=100001;

string solve(string &a, string &b) {
	int i, j;
	if(b.size() > a.size()) return "UNRESTORABLE";
	for(i = a.size() - b.size(); i >= 0; i--) {
		for(j = 0; j < b.size(); j++) if(a[i+j] != '?' && a[i+j] != b[j])
			break;
		if(j == b.size()) {
			for(int j = 0; j < b.size(); j++) a[i+j] = b[j];
			for(int j = 0; j < i; j++) if(a[j] == '?') a[j] = 'a';
			for(int j = i+b.size(); j < a.size(); j++) if(a[j] == '?') 
				a[j] = 'a';
			return a;
		}
	}
	return "UNRESTORABLE";
}

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

	string a, b;
	while(cin>>a) {
		cin>>b;
		cout << solve(a, b) << endl;
	}
	return 0;
}


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


int main() {
  string s;
  cin >> s;
  if (s == "ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;
}

Measured memory_bytes: 3624