akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
using namespace std;

int gcd(int a, int b) {
    while(a != b){
        if(a > b)
            a = a - b;
        else
            b = b - a;
    }
    return b;
}

int main(void){
    long a, b;
    while(cin >> a >> b) {
      int lcm = a * b / gcd(a,b);
      cout << gcd(a,b) << " " << lcm << endl;
    }
    return 0;
}



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

int main(){

  string l = "qwertasdfgzxcvb";
  string r = "yuiophjklnm";
  string str;

  while(cin >> str){
    if(str == "#") break;

    int x = 0,y = 0,a = -1;

    for(int i=0;i<str.size();i++){

      for(int j=0;j<=15;j++){
	if(l[j] == str[i]){
	  if(a == 1) x++;
	  a = 0;
	}
      }

      for(int j=0;j<=11;j++){
	if(r[j] == str[i]){
	  if(a == 0) x++;
	  a = 1;
	}
      }
    }
    cout << x << endl;

  }
}

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

int main()
{   int a[5];
  int k;
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>k)
    {
         sort(a,a+5);
         if(a[4]-a[0]>k)
            cout<<":(";
         else
            cout<<"Yay!";
         cout<<endl;

    }
        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
    int n;
    cin >> n;
    bool flag = false;
    int ans;
    while(flag == false){
         if((n%10 == (n/10)%10) && ((n/10)%10 == (n/100)%10)){
             ans = n;
             flag = true;
         }
         n++;
         
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n = gets.to_i
a = Array.new(n-1){gets.split(" ").map(&:to_i)}
ans = []
(n-1).times do |i|
  time = 0
  a[i..(n-2)].each do |cj, sj, fj|
    if sj <= time
      time += (time % fj == 0) ? cj : cj + fj - (time % fj)
    else
      time = sj + cj
    end
  end
  ans << time
end
ans << 0
puts ans

Measured memory_bytes: 1788
#include<stdio.h>
#include<string.h>
int main(void)
{
	char s[27];
	int i,n,j,flg;
	scanf("%s",s);
	n=strlen(s);
	flg=1;
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n;j++){
			if(s[i]==s[j]){
				flg=0;
				break;
			}
		}
		if(flg==0)  break;
	}
	if(flg==1)  printf("yes\n");
	else  printf("no\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int X;
  cin >> X;
  int ans = 1;
  for (;; ans++)
  {
    int pre = ans * (ans - 1) / 2;
    int now = ans * (ans + 1) / 2;
    if (pre < X && X <= now)
      break;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
  
int main(){
    std::array<u_int, 10> heights;
     
    for (u_int i = 0; i < 10; ++i){
        std::cin >> heights[i];
    }
     
    std::sort(heights.begin(), heights.end(), std::greater<u_int>());
     
    for (u_int i = 0; i < 3; ++i){
        std::cout << heights[i] << std::endl;
    }
	
    return 0;
}

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

int main() {
  int N, A;
  cin >> N >> A;
  
  if ( N % 500 <= A ) {
    cout << "Yes" << endl;
  }
  else if ( N % 500 > A ) {
    cout << "No" << endl;
  }
}  
    

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int A,B,C,D,cou;
	cin>>A>>B>>C>>D;
	while(true){
		if(cou%2==0)C-=B;
		else A-=D;
		cou++;
		if(C<=0){
			cout<<"Yes"<<endl;
			break;
		}
		if(A<=0){
			cout<<"No"<<endl;
			break;
		}
	}
}

Measured memory_bytes: 3132
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    System.out.println(solve2(n));
  }
  static long solve2(long n){
    long answer = 0;
    for(long i = 1; i <= n; i++){
      answer += (i + (i * (n / i))) * (n / i) / 2;
    }
    return answer;
  }
}


Measured memory_bytes: 35808
#include <iostream>
#include <iomanip>
     
using namespace std;
     
int main(){
 string s;
 int n,i,j,b;
 cin >> n;
 int a[4][14];
 for (i=0;i<4;i++) {
  for (j=1;j<14;j++) {
   a[i][j]=0;
  }
 }
 for (i=0;i<n;i++) {
  cin >> s;
  cin >> b;
  if (s=="S") {
   a[0][b]=1;
  } else if (s=="H") {
   a[1][b]=1;
  } else if (s=="C") {
   a[2][b]=1;
  } else {
   a[3][b]=1;
  }
 }
 for (i=0;i<4;i++) {
  for (j=1;j<14;j++) {
   if (i==0 && a[i][j]==0) {
     cout <<"S " << j <<endl;
   } else if (i==1 && a[i][j]==0) {
     cout <<"H " << j <<endl;
   } else if (i==2 && a[i][j]==0) {
     cout <<"C " << j <<endl;
   } else if (i==3 && a[i][j]==0) {
     cout <<"D " << j <<endl;
   }
  }
 }
 return 0;
}



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

show_flg=False
#show_flg=True

ans=0
h,w,k=LI()
m=[]
for i in range(h):
    s=[1 if i=='#' else 0 for i in input()]
    m.append(s)

mm=[[0]*(1+w) for _ in range(h)]
a=[[0]*w for _ in range(h)]
t=1
fst=inf
prev=0
cnt=0

for i in range(h):
    for j in range(w):
        mm[i][j+1]=m[i][j]+mm[i][j]

for i in range(h):
    for j in range(w+1):
        if mm[i][j]==0:
            mm[i][j]=1

t=0
for i in range(h):
    if sum(m[i])!=0:
        fst=min(fst,i)
        prev=i
        for j in range(w):
            a[i][j]=t+mm[i][j+1]
        t+=mm[i][w]
    else: # no ichigo
        for j in range(w):
            a[i][j]=a[prev][j]
        

if fst!=0:
    for i in range(fst):
        for j in range(w):
            a[i][j]=a[fst][j]
            
#show(m)
#show(a)
for aa in a:
    print(*aa)


Measured memory_bytes: 49368
var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim();
var n = +input;
 
process.stdout.write(n + ': ');
 
var primes = [];
 
while (n % 2 == 0) {
    primes.push(2);
    n /= 2;
}
while (n % 3 == 0) {
    primes.push(3);
    n /= 3;
}
for (var i = 1; n > 1; i++) {
    var low = i * 6 - 1;
    var high = i * 6 + 1;
    while (n % low == 0) {
        primes.push(low);
        n /= low;
    }
    while (n % high == 0) {
        primes.push(high);
        n /= high;
    }
}
 
process.stdout.write(primes.join(' ')+"\n");


Measured memory_bytes: 15304
#include <iostream>
#include <string.h>
#include <algorithm>
typedef long long ll;
using namespace std;

int main()
{
  int h,a,ans;
  cin >> h >> a;
  if(h%a == 0){
      ans = h/a;
  }else{
      ans = h/a + 1;
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  int n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  ll ans=0;
  for(int i=1;i<n;i++){
    if(a[i-1]<=a[i]) continue;
    else{
      ans+=a[i-1]-a[i];
    }
    a[i]=a[i-1];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 5196
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N, L, m(1e9), s{}; cin >> N >> L;
  for (int i{}, x; i < N; ++i) m = abs(x = L + i) < abs(m) ? x : m, s += x;
  cout << s - m;}

Measured memory_bytes: 3652
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue> //priority_queue 优先队列
#include <map>
#include <set> //multiset  
#include <vector>
#include <stack>
#include <cmath>
#include <sstream>
#include <string>
#define mod 1000000007
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
const db eps=1e-6;
const int INF=0x3f3f3f3f;
const int N=4e3+5;
using namespace std;
int s=0;
int t,n,m=0,a[N]={0};//1+1=-1 0
int main(){
	cin>>n;
	if(n==0){
		cout<<"0"<<endl;
		return 0;
	}
	while(n){
		a[s++]=n%-2;
		n/=-2;
	}
	for(int i=0;;i++){
		m++;
		if(a[i]==2){
			a[i]=0;
			a[i+1]+=-1;
		}
		if(a[i]==-2){
			a[i]=0;
			a[i+1]+=1;
		}
		if(a[i]==-1){
			if(a[i+1]==0){
				a[i]=a[i+1]=1;
			}else if(a[i+1]==-1){
				a[i]=1;
				a[i+1]=0;
			}else if(a[i+1]=1){
				a[i+1]=0;
				a[i]=1;
				a[i+2]++;
				a[i+3]++;
			}
		}
		if(i>s-1&&a[i+1]==0&&a[i+2]==0&&a[i+3]==0) break;
	}
//10101000101-1001-11-10-110101-11
	int flag=0;
	for(int i=m-1;i>=0;i--){
		if(a[i]==0&&flag==0) continue;
		if(a[i]!=0||flag){
			flag=1;
			cout<<a[i];
		}
	}
	cout<<endl;
	return 0;
}
//1 -2 4 -8 16 -32 64 -128 256 -512 1024
//-1 1
//1  0 1  1
//-1-1
//1  0
//-1 0
//1  1
//11000101011001101110100010101
//  000101011001101110100010101

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}
std::vector<std::vector<long long>> combTableByPascalsTriangle(
    int n) { /*パスカルの三角形を利用した組合せの前計算。O(N^2)。 * arg... *
int n: 組合せ計算したい要素の個数。nCrで指定しうる最大のn *
return... *  vector<vector<long long>> c :
組合せ計算nCrの結果がc[n][r]に入っている。 */
  auto c = std::vector<std::vector<long long>>(
      n + 1, std::vector<long long>(n + 1, 0));
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= i; ++j) {
      if (j == 0 or j == i) {
        c[i][j] = 1LL;
      } else {
        c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]);
      }
    }
  }
  return c;
}

int main() {
  int n, p;
  cin >> n >> p;
  bool odd_exist = 0;
  REP(i, 0, n) {
    int a;
    cin >> a;
    if (a % 2 == 1) odd_exist = 1;
  }
  LL ans = (odd_exist ? pow(2, n - 1) : p ? 0 : pow(2, n));
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
map <string,int> m;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		cin>>s;
		m[s]++;
	}
	printf("AC x %d\n",m["AC"]);
	printf("WA x %d\n",m["WA"]);
	printf("TLE x %d\n",m["TLE"]);
	printf("RE x %d\n",m["RE"]);
	return 0;
}

Measured memory_bytes: 3796
X = int(input())

if X == 1:
    print(1)
    exit()

ans = [False] * (X + 1)
for i in range(2, X + 1):
    v = i * i
    while v <= X:
        ans[v] = True
        v *= i

for i in range(X, -1, -1):
    if ans[i]:
        print(i)
        exit()


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

int main(){
  ll n;
  cin >> n;
  ll ans = n*(n+1)*(n+2)/6;
  ll u[n-1], v[n-1];
  rep(i,n-1) {
    cin >> u[i] >> v[i];
    if(u[i] > v[i]) swap(u[i],v[i]);
    ans -= u[i]*(n-v[i]+1);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6732
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
typedef long long int ll;
#define FOR(i,a,n) for(int i=(ll)a;i<(ll)n;++i)
#define TFOR(i,n)FOR(i,0,n)
#define ALL(x) x.begin(),x.end();
const int INF = 1LL << 30;
const ll LLINF = 1LL << 60;
int sum[100000];
int sum2[100000];
int main() {
	std::string s1, s2;
	int num;
	std::cin >> s1 >> s2 >> num;
	TFOR(i, s1.size()) {
		if (i == 0) { if (s1[i] == 'A')sum[i] = 1; else sum[i] = 2; }
		else if (s1[i] == 'A')sum[i] = sum[i - 1] + 1; else sum[i] = sum[i - 1] + 2;
	}
	TFOR(i, s2.size()) {
		if (i == 0) { if (s2[i] == 'A')sum2[i] = 1; else sum2[i] = 2; }
		else if (s2[i] == 'A')sum2[i] = sum2[i - 1] + 1; else sum2[i] = sum2[i - 1] + 2;
	}
	TFOR(i, num) {
		int a1, a2, b1, b2;
		std::cin >> a1 >> a2 >> b1 >> b2;
		if ((sum[a2 - 1] - (a1>=2?sum[a1 - 2]:0)) % 3 == (sum2[b2 - 1]- (b1>=2?sum2[b1-2]:0)) % 3)std::cout << "YES" << std::endl;
		else std::cout << "NO" << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define f(i,n) for(int i=0;i<n;i++) 
#define F first 
#define S second 
#define pb push_back 

using namespace std;

ll dis[1005][1005];

ll n,m;

string s[1005];


bool ok(int x,int y){
	if(x>=n or y>=m)return false;
	if(x<0 or y<0)return false;
	if(s[x][y]=='#')return false;
	return true;
}

ll c,d;

ll distance(ll x,ll y){
	int dx[4] = {0,0,1,-1};
	int dy[4] = {1,-1,0,0};
	if(x==0 and y==0)return 0;
	f(i,4){
		if(x==dx[i] and y==dy[i])return 0;
	}
	return 1;
}

void bfs(int x,int y){
	list<pair<int,int> > q;
	q.push_back({x,y});
	dis[x][y] = 0;
	
	while(!q.empty()){
		pair<int,int> p = q.front();
		q.pop_front();
		
		int dxx[5] = {-2,2,0,1,-1};
		int dyy[5] = {-2,2,0,1,-1};
		
		f(i,5){
			f(j,5){
				if(ok(p.F+dxx[i],p.S+dyy[j])){
					if(dis[p.F+dxx[i]][p.S+dyy[j]]>dis[p.F][p.S]+distance(dxx[i],dyy[j])){
						dis[p.F+dxx[i]][p.S+dyy[j]] = min(dis[p.F+dxx[i]][p.S+dyy[j]],dis[p.F][p.S]+distance(dxx[i],dyy[j]));
						if(distance(dxx[i],dyy[j])==0){
							q.push_front({p.F+dxx[i],p.S+dyy[j]});
						}else{
							q.push_back({p.F+dxx[i],p.S+dyy[j]});
						}
					}
				}
			}
		}
		
		
	}
	if(dis[c][d]!=(1e8))
		cout<<dis[c][d]<<"\n";
	else
		cout<<"-1\n";
}





void test(){
	cin>>n>>m;
	
	f(i,n)f(j,m)dis[i][j] = 1e8 ;
	ll a,b;
	cin>>a>>b>>c>>d;
	a--,b--,c--,d--;
	f(i,n)cin>>s[i];
	bfs(a,b);
}

int main(){
	int tests=1;
	// cin>>tests;
	while(tests--){
		test();
	}
}


Measured memory_bytes: 13596
#include <stdio.h>
#define MAXSIZE 100000

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

    int m;
    scanf("%d", &m);

    int p[MAXSIZE], x[MAXSIZE];
    for(int i = 0; i < m; i++){
        scanf("%d %d", &p[i], &x[i]);
    }

    int time_out;
    for(int i = 0; i < m; i++){
        time_out = 0;
        for(int j = 0; j < n; j++){
            time_out += (j == p[i] - 1)? x[i] : t[j];
        }
        printf("%d\n", time_out);
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

class Index {
public:
	Index(){};
	Index(string s){set(s);};
	~Index(){};

	int x, y, z;

	void set(string s) {
		if (s == "AB") {
			x = 0;
			y = 1;
			z = 2;
		} else if (s == "AC") {
			x = 0;
			y = 2;
			z = 1;
		} else {
			x = 1;
			y = 2;
			z = 0;
		}
	}
};

int main() {
	int n;
	vector<int> abc(3, 0);
	string s_abc = "ABC";
	cin >> n >> abc[0] >> abc[1] >> abc[2];

	vector<string> vs(n);
	for (int i = 0; i < n; i++) {
		cin >> vs[i];
	}
	string ans;

	Index idx1, idx2;
	for (int i = 0; i < n; i++) {
		idx1.set(vs[i]);

		if (abc[idx1.x] > abc[idx1.y]) {
			swap(idx1.x, idx1.y);
		}

		abc[idx1.x]++;
		abc[idx1.y]--;
		ans.push_back(s_abc[idx1.x]);
		if (i != n - 1) {
			idx2.set(vs[i+1]);

			if (abc[idx2.x] <= 0 && abc[idx2.y] <= 0) {
				// 戻す
				abc[idx1.x]--;
				abc[idx1.y]++;

				// 加減を逆に
				abc[idx1.x]--;
				abc[idx1.y]++;
				ans.back() = s_abc[idx1.y];
			}
		}

		if (abc[0] < 0 || abc[1] < 0 || abc[2] < 0) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
	for (char c: ans) {
		cout << c << endl;
	}
	return 0;
}


Measured memory_bytes: 5620
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
int main(){
	int R[MAX], n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> R[i];
	int maxv = -2000000000;
	int minv = R[0];
	for (int i = 1; i < n; i++){
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}
	cout << maxv << endl;
	return 0;
}

Measured memory_bytes: 3812
#include<cstdio>
#include<cstring>
int main(void){
  char a[100][100];
  int n,m;
  bool x,y;
  x=true;
  scanf("%d %d",&n,&m);
  for(int i=0;i<n;i++){
  scanf("%s",a[i]);
  }
  for(int i=0;i<n;i++){
   for(int j=0;j<m;j++){
 if(a[i][j]=='#'){
  y=false;
   if(i>0){
if(a[i-1][j]=='#')y=true;
   }
      if(i<(n-1)){
if(a[i+1][j]=='#')y=true;
   }
      if(j>0){
if(a[i][j-1]=='#')y=true;
   }
      if(j<(m-1)){
if(a[i][j+1]=='#')y=true;
   }
   if(!y)x=false;
 }
  }
  }
 if(x)printf("Yes\n");
  else printf("No\n");
  return 0;
}

    
    
    

Measured memory_bytes: 128
def main():
    a, b = map(int, input().split())

    # f(A, B) = f(0, a-1) ^ f(0, b) = F(a-1) ^ F(b)
    def F(x):
        if x % 2 == 0:
            if x % 4 == 0:
                return x
            else:
                return x ^ 1
        else:
            if (x + 1) % 4 == 0:
                return 0
            else:
                return 1

    print(F(a-1) ^ F(b))

main()

Measured memory_bytes: 61968
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 999999999
using namespace std;
int main() {
  int a, kai[31];
  kai[0] = 1;
  kai[1] = 1;
  kai[2] = 2;
  for (int i = 3; i < 31; i++) {
    kai[i] = kai[i - 1] + kai[i - 2] + kai[i - 3];
  }
  rep(i, 31) kai[i] = (kai[i] + 3649) / 3650;
  while (cin >> a, a)
    cout << kai[a] << endl;
  return 0;
}

Measured memory_bytes: 3052
a1,a2,a3 = map(int, input().split())
a4,a5,a6 = map(int, input().split())
a7,a8,a9 = map(int, input().split())

n = int(input())

list = []

for i in range(n):
    list.append(int(input()))

if a1 in list:
    a1 = 0

if a2 in list:
    a2 = 0

if a3 in list:
    a3 = 0

if a4 in list:
    a4 = 0

if a5 in list:
    a5 = 0

if a6 in list:
    a6 = 0

if a7 in list:
    a7 = 0

if a8 in list:
    a8 = 0

if a9 in list:
    a9 = 0



if a1 == 0 and a2 == 0 and a3 == 0:
    print('Yes')
elif a4 == 0 and a5 == 0 and a6 == 0:
    print('Yes')
elif a7 == 0 and a8 == 0 and a9 == 0:
    print('Yes')
elif a1 == 0 and a4 == 0 and a7 == 0:
    print('Yes')
elif a2 == 0 and a5 == 0 and a8 == 0:
    print('Yes')
elif a3 == 0 and a6 == 0 and a9 == 0:
    print('Yes')
elif a1 == 0 and a5 == 0 and a9 == 0:
    print('Yes')
elif a3 == 0 and a5 == 0 and a7 == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
S = list(map(str,input()))
n = len(S) - 1

def calc(S, i, Tar, ans):
    if i == n:
        return ans + int(Tar)
    return calc(S, i+1, S[i+1], ans + int(Tar)) \
            + calc(S, i+1, Tar + S[i+1], ans)

print(calc(S,0,S[0],0))

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

void testCase(){
    int n; long long k;
    cin>>n>>k;
    vector<int> v(n+1, 0);
    for(int i = 1; i <= n; i++) cin>>v[i];
    map<int, int> position, visited, revPos;
    int ptr = 1, step = 0;

    while(visited.find(ptr) == visited.end()){
        visited[ptr]++;
        position[step] = ptr;
        revPos[ptr] = step;
        step++;
        ptr = v[ptr];
    }

    int val = revPos[ptr];
    int cycle = step-revPos[ptr];

    // cout<<val<<" "<<cycle<<endl;

    if(k <= val){
        cout<<position[k]<<endl;
    }
    else{
        k -= val;
        k = k%cycle;
        int idx = position[k+val];
        cout<<idx<<endl;
    }
}

int main(){
    int t;
    t = 1;
    // cin>>t;
    while(t--){
        testCase();
    }
}



Measured memory_bytes: 31632
#!/usr/bin/env python3
import sys
from collections import deque

def solve(K: int):

    ct = 0
    q = deque([1,2,3,4,5,6,7,8,9])
    while(len(q)>0):
        a = q.popleft()
        al = a % 10
        ct += 1 
        if ct == K:
            print(a)
            break

        if al != 0:
            q.append(a*10+al - 1)
        q.append(a*10+al)
        if al != 9:
            q.append(a*10+al + 1)

        # print(q)


    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 40560
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.out



int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    int n;
    cin>>n;
    vi a(n),b(n);
    rep(i,n){
        cin>>a[i];
        b[i]=a[i];
    }
    Sort(b);
    int wr=0;
    for(int i=0;i<n;i++){
        if(a[i]!=b[i])wr++;
    }
    if(wr<=2)cout<<"YES"<<endl;
    else fin("NO");
    

//////////////////////////////////////////////////////
return 0;}

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

const int INF = 1000000000;

void WarshallFloyd(int d[100][100],int m){
	for(int k=0;k<m;k++){
		for(int i=0;i<m;i++){
			for(int j=0;j<m;j++){
				if(d[i][j]>d[i][k]+d[k][j]){
					d[i][j]=d[i][k]+d[k][j];
				}
			}
		}
	}
	return;
}

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

		if(n==0 && m==0)
			break;

		int C[100][100];
		int T[100][100];
		for(int i=0; i<m; i++){
			for(int j=0; j<m; j++){
				if(i==j){
					C[i][j] = T[i][j] = 0;
				}
				else{
					C[i][j] = T[i][j] = INF;
				}
			}
		}
		for(int i=0; i<n; i++){
			int a, b, c, t;
			cin >> a >> b >> c >> t;

			C[a-1][b-1] = C[b-1][a-1] = c;
			T[a-1][b-1] = T[b-1][a-1] = t;
		}

		WarshallFloyd(C,m);
		WarshallFloyd(T,m);

		int k,p,q,r;
		cin>>k;
		for(int i=0;i<k;i++){
			cin>>p>>q>>r;
			if(r==0) cout<<C[p-1][q-1]<<endl;
			if(r==1) cout<<T[p-1][q-1]<<endl;
		}


	}

	return 0;
}

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

int main(){
  int A,B,C,X,Y,sum1,sum2,sum3,sum4;
  cin >> A >> B >> C >> X >> Y;
  sum1=A*X+B*Y;
  sum2=max(X,Y)*2*C;
  sum3=2*X*C+max(Y-X,0)*B;
  sum4=2*Y*C+max(X-Y,0)*A;
  cout << min(min(sum1,sum2),min(sum3,sum4)) << endl;
}
 

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  string S;
  cin >> S;
  string correct = "CODEFESTIVAL2016";
  int l = S.length();
  int ans = 0;
  REP(i, l) {
    if (S[i] != correct[i]) {
      ++ans;
    }
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int64_t N; cin >> N;
  REP(h, 1, 3501) REP(n, 1, 3501) {
    auto nume = N * h * n;
    auto deno = 4 * h * n - N * n - N * h;
    if (deno > 0 && nume % deno == 0) {
      auto w = nume / deno;
      cout << h << " " << n << " " << w << "\n";
      return 0;
    }
  }
}


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

int main()
{
    long N;
    std::cin >> N;
    if(N/100==7 || (N-(N/100)*100)/10==7 || N-(N/100)*100-((N-(N/100)*100)/10)*10==7){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
    return 0;
}

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

int main(){


    string s; cin >> s;
    int k; cin >> k;
    set<string> a;
    int n = (int)s.size();

    for(int i = 0; i <= 5; i++){
        for(int l = 0; l < n; l++){
            int r = l + i;
            if(r >= n) continue;
            //[l, r]
            string t = "";
            for(int j = l; j <= r; j++) t = t + s[j];
            a.insert(t);
        }
    }

    vector<string> ans;
    for(auto x : a){
        ans.push_back(x);
    }

    sort(ans.begin(), ans.end());
    
    for(int i = 0; i < ans.size(); i++){
        //cout << ans[i] << endl;
    }

    //cout << ans.size() << k << endl;
    cout << ans[k - 1] << endl;

    return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
int main()
{
    int A1,A2,A3,sum=0;
    scanf("%d%d%d",&A1,&A2,&A3);
    sum=A1+A2+A3;
    if(sum>=22)
    {
        printf("bust\n");
    }
    else
    {
      printf("win\n");
    }
}


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

struct travel{
	int t;
	int x;
	int y;
};

int main(){
	int n; cin >> n;
	vector<travel> t(n);
	rep(i,n){
		cin >> t[i].t >> t[i].x >> t[i].y;
  	}
  	bool ok = true;
	rep(i,n){
		if(i == 0){
			if((abs(t[i].x + t[i].y ) > t[i].t)) ok = false;
			if(abs(t[i].x + t[i].y) % 2 != t[i].t % 2) ok = false;
		}else{
			int t1 = abs(t[i].x - t[i-1].x);
			int t2 = abs(t[i].y - t[i-1].y);
			if(t1 + t2 > t[i].t-t[i-1].t) ok = false;
			if((t1+t2) % 2 != (t[i].t-t[i-1].t) % 2) ok = false;
		}
	}
	if(ok){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	
    return 0;
}


Measured memory_bytes: 1408
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = || -> 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)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (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! { mut d: usize }
    let mut ret: String = "Christmas".to_string();
    while d < 25 {
        ret.push_str(" Eve");
        d += 1;
    }
    println!("{}", ret);
}

Measured memory_bytes: 4352
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int X = sc.nextInt();
    int cnt =0;
    for(int i=0; i<=A; i++){
      for(int j=0; j<=B; j++){
        for(int k=0; k<=C; k++){
        int sum = 500*i + 100*j + 50*k;
          if(sum == X){
          cnt++;
          }
        }
      }
    }
    System.out.println(cnt);
  }
}


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

int main(){
	int a, b, c;
	cin >> a >> b >> c;

	int count = 3;
	if (a == b) {
		--count;
	}

	if (a == c) {
		--count;
	}

	if (b == c) {
		--count;
	}

	if (count == 0) {
		count = 1;
	}

	cout << count << endl;

	return 0;
}


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

int dist(int arr[], int n, int k){
    int dp[n+1];
    dp[1] = 0;
    for(int i=2;i<=n;i++){
       dp[i] = INT_MAX;
        for(int j =1;j<=k && i-j>0;j++){
            
                int op1 = abs(arr[i]- arr[i-j]) + dp[i-j];
           
                dp[i] = min(dp[i], op1);  

        }
       
    }
    
    return dp[n];
}

int main() {
	int n, k;
	cin>>n>>k;
	int arr[n+1];
	for(int i=1;i<=n;i++){
	    cin>>arr[i];
	}
	cout<<dist(arr,n,k)<<endl;
	return 0;
}

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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  string s, correctS = "AKIHABARA";
  cin >> s;
  int indexS = 0, indexC = 0;

  int sLen = s.length();
  if(sLen < 5 || sLen > 9) {
    cout << "NO" << endl;
    return 0;
  }
  while(true) {
    if(s[indexS] == correctS[indexC]) {
      ++indexS;
      ++indexC;
    } else if(correctS[indexC] == 'A') {
      ++indexC;
    } else {
      cout << "NO";
      break;
    }
    if(indexS == sLen && indexC == correctS.length()) {
      cout << "YES";
      break;
    } else if(indexS > sLen || indexC > correctS.length()) {
      cout << "NO";
      break;
    }
  }
  
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#include <algorithm>  
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fr(i,a,b) for(long long int i=a; i<b; i++)
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;
/*vector<ll>g[1000001];
ll vis[1000005]={0};
ll l[1000001];
ll m[1000001];*/
/*queue<ll>q ;
void bfs(ll s)
{
       vis[s]=1;
       q.push(s);
       ll curr=q.front(); vis[curr]=1;
       while(!q.empty())
       {
              curr=q.front(); q.pop(); // vis[curr]=1;
              for(ll i=0;i<g[curr].size();i++)
              {
                     ll child=g[curr][i];
                     if(vis[child]==0) 
                     { 
                            q.push(child); 
                            vis[child]=1;
                     }
              }
       }
}
void dfs(ll curr,map<ll,ll>pehli)
{
       vis[curr]=1;
       if(pehli[l[curr]]==0)
       {
              m[curr]=-1;
              pehli[l[curr]]=curr;
       }
       else 
       {
              m[curr]=pehli[l[curr]];
              pehli[l[curr]]=curr;
       }
       for(ll i=0;i<g[curr].size();i++)
       {
              ll child=g[curr][i];
              if(vis[child]==0)
              {
                     dfs(child,pehli);
              }
       }
       
}*/
ll mul(ll a, ll b, ll m)
{
       ll result=(a%m *b%m)%m;
       return result;
}
signed main() 
{
    fast
    ll n;
    cin>>n;
    ll a[n],sum[n]={0};
    for(ll i=0;i<n;i++) 
    {
           cin>>a[i];
           if(i!=0) sum[i]=sum[i-1]+a[i];
           else sum[0]=a[0];
    }
    ll s=0;
    for(ll i=0;i<n-1;i++)
    {
           s=s+mul(sum[i],a[i+1],MOD);
           s=s%MOD;
    }
    cout<<s%MOD;
}

Measured memory_bytes: 6760
#include<bits/stdc++.h>
using namespace std;
int main(){
  int ans=0;
  int a;cin>>a;
  int b[3];b[0]=a%10;a/=10;b[1]=a%10;a/=10;b[2]=a%10;
  cout<<b[0]+b[1]+b[2]<<endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{

		int N =nextInt();
		int A =nextInt();
		int B =nextInt();


		System.out.println(Math.min(B,A*N));

	}
	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 21332
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        int cnt=0;

        for(int i =0;i<s.length();i++){
            if(i%2==0){
                if(s.charAt(i)=='R' || s.charAt(i)=='U' || s.charAt(i)=='D'){
                    cnt++;
                }
            }else{
                if(s.charAt(i)=='L' || s.charAt(i)=='U' || s.charAt(i)=='D'){
                    cnt++;
                }

            }
        }
       
        if(cnt==s.length()){
        System.out.println("Yes");
        }else{
            System.out.println("No");
        }

        
    }
}


Measured memory_bytes: 22228
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
VI d;
VI sml;
VI ed;
in td;
in n;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin>>n>>td;
  d.resize(n);
  sml.resize(n+1);
  ed.resize(n+1);
  forn(i,n)
    cin>>d[i];
  sml[n]=1;
  for(in i=n-1;i>=0;--i){
    if(d[i]>=sml[i+1]*2){
      sml[i]=sml[i+1];
    }
    else{
      sml[i]=sml[i+1]+d[i];
    }
  }
  ed[0]=td;
  forn(i,n){
    if(d[i]>=ed[i]*2){
      ed[i+1]=ed[i];
    }
    else{
      if(d[i]<=ed[i]){
	ed[i+1]=ed[i]-d[i];
      }
      else{
	ed[i+1]=d[i]-ed[i];
      }
    }
  }
  in Q;
  cin>>Q;
  in q;
  forn(zz,Q){
    cin>>q;
    --q;
    if(ed[n]!=0){
      cout<<"YES\n";
    }
    else{
      if(sml[q+1]<=ed[q])
	cout<<"YES\n";
      else
	cout<<"NO\n";
    }
  }
  return 0;
}


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

using namespace std;

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	swap(n, m);
	int l = 1, r = m;
	while(m--) {
		int a, b;
		scanf("%d %d", &a, &b);
		l = max(l, a);
		r = min(r, b);
	}

	printf("%d\n", max(0, r - l + 1));
}


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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long double a, b, c;
  cin >> a >> b >> c;
  ( 2 * sqrt(a*b) < (c - a - b) ) ? cout << "Yes\n" : cout << "No\n";
return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int n, m, u, v, s, t;
int d[1252525][10];
vi g[1252525];
constexpr int INF=1e9;

void bfs(int s){
    queue<int> q;
    q.push(s);
    while (!q.empty()) {
        int x = q.front();
        q.pop();
        for(auto y : g[x]){
            REP(i, 3){
                if(d[x][i]+1<d[y][(i+1)%3]){
                    d[y][(i+1)%3]=d[x][i]+1;
                    q.push(y);
                }
            }
        }
    }
	return;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	cin>>n>>m;
	REP(i, m){
		cin>>u>>v;
		--u;
		--v;
		g[u].push_back(v);
	}
	cin>>s>>t;
	--s;
	--t;
	REP(i, n){
		REP(j, 3){
			d[i][j]=INF;
		}
	}
	d[s][0]=0;
	bfs(s);
	// REP(i, n){
	// 	REP(j, 3){
	// 		cout<<d[i][j]<<" \n"[j==2];
	// 	}
	// }
	if(d[t][0]!=INF){
		cout<<d[t][0]/3<<'\n';
	}
	else{
		cout<<-1<<'\n';
	}
	return 0;
}


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

using namespace std;
using namespace chrono;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define pb push_back
#define odd(x) ((x)&1)
#define even(x) (!odd(x))
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(auto i=0ll;i<n;++i)
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define TEST_CASE int tc;cin>>tc;while(tc--)
#define Clock high_resolution_clock::now()

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;
}

#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define JD
// #define TIME

/******************************************************************************************************************************/


const ll inf = 2e18;
const ll mod = 1e9+7;
const ll N = 1e6+3;


int main()
{
    auto start_time = Clock;
    FASTIO

    #ifndef JD
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif

    
    
    ll n;
    cin>>n;
    ll ans=0;


    for(ll i=1;i<n;++i){
    	ans += (n/i);
    	if(n%i==0) --ans;
    }
    cout<<ans;
    







    

    auto end_time = Clock;
    #ifndef TIME
    	return 0;
    #endif
	cout << "\nTime elapsed: "
	<< (double)duration_cast<milliseconds>(end_time-start_time).count() 
	<< "ms";


    return 0;
}


Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;

const int maxn = 200005;
using ll = long long;

vector<int> edges[maxn];

int main(int argc, char const *argv[])
{
//  freopen("in.txt", "r", stdin);
  string s;
  cin >> s;
  int n = s.size();
  vector<int> v[26];
  for(int i = 0; i < n; i++){
    v[s[i] - 'a'].push_back(i);
  }
  ll ans = 0;
  for(int i = 0; i < n; i++){
    ll val = lower_bound(v[s[i] - 'a'].begin(), v[s[i] - 'a'].end(), i) - v[s[i] - 'a'].begin();
    val = (n - 1 - i) - (v[s[i] - 'a'].size() - 1 - val);
    ans += val;
  }
  cout << ans + 1 << endl;

  return 0;
}

Measured memory_bytes: 6644
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))
def prime_decomposition(n):
    i = 2
    table = []
    while i*i <= n:
        while n%i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table
def prime_decomposition2(n):
    i = 2
    table = defaultdict(int)
    while i*i <= n:
        while n%i == 0:
            n //= i
            table[i] += 1
        i += 1
    if n > 1:
        table[n] += 1
    return table
def make_divisor(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n%i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    return divisors

N = int(input())
list_pd1 = make_divisor(N)
list_pd1.sort()
dict_pd2 = prime_decomposition2(N-1)
#print(N, ':', list_pd1)
#print(N-1, ':', dict_pd2)

cnt = 1

# -1 nohou
for val in dict_pd2.values():
    cnt *= (val+1)
cnt -= 1
#print(cnt)

for k in list_pd1[1:]:
    #print('k:', k)
    sN = N
    while sN >= k:
        if sN%k==0:
            sN //= k
        else:
            sN %= k
    if sN == 1:
        cnt += 1

print(cnt)



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

int main(){
  int N; cin>>N;
  int p[N];
  REP(i,N){
    cin>>p[i];
  }
  sort(p,p+N);
  int ans=p[N-1]/2;
  REP(i,N-1){
    ans+=p[i];
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

typedef long long ll;

constexpr int INF = 1e8;
constexpr int MOD = 1e9+7;

int main(void) {
    int i;
    int a[10];
    REP (i,10) cin >> a[i];
    sort(a,a+10,greater<int>{});
    REP (i,3) cout << a[i] << endl;
    return 0;
}

Measured memory_bytes: 3124