akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std ;

#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
#define popcount(x) __builtin_popcountll(x)
#define pll pair<ll,ll> 
#define ld long double

const int M=1000000007;
const int MM=998244353;
const long double PI = acos(-1);

ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T, U> &p)
{ 
    return os<<'('<<p.F<< ","<<p.S<<')'; 
}

int _runtimeTerror_()
{
	int n;
	cin>>n;
	vector<ll> a(n);
	for(int i=0;i<n;++i)
	{
		long double d;
		cin >> d;
		d+=1e-12;
		a[i] = d*1e9;
		//cout<<a[i]<<"\n";
		//cerr<<a[i]<<"\n";
	}
	map<pll,ll> ff[20];
	vector<int> cnt10(n);
	vector<pll> f;
	for(int i=0;i<n;++i)
	{
		ll k=a[i];
		ll cnt=0;
		while(a[i]%10==0)
			++cnt,a[i]/=10;
		cnt10[i]=cnt;
		ll tw=0,fi=0;
		while(a[i]%2==0)
			++tw,a[i]/=2;
		while(a[i]%5==0)
			++fi,a[i]/=5;
		f.pb({tw,fi});
		ff[cnt][{tw,fi}]++;
		//cout<<f[i]<<"\n";
		a[i]=k;
	}	
	ll ans=0,val=0;
	for(int i=0;i<n;++i)
	{
		--ff[cnt10[i]][f[i]];
		//cout<<"cnt "<<cnt10[i]<<"\n";
		for(int j=0;j<=18;++j)
		{
			for(auto k:ff[j])
			{
				ll x = cnt10[i]+j;
				x+=min(f[i].F,k.F.S)+min(f[i].S,k.F.F);
				if(x>=18)
					ans+=k.S;
			}
		}
		++ff[cnt10[i]][f[i]];
		//cout << ans <<"\n";
	}
	assert(ans%2==0);
	ans/=2;
	//ans+=val*(val-1)/2;
	cout<<ans<<"\n";
	return 0;
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#ifdef runSieve
		sieve();
	#endif
	#ifdef NCR
		initialize();
	#endif
	int TESTS=1;
	//cin>>TESTS;
	while(TESTS--)
		_runtimeTerror_();
	return 0;
}

Measured memory_bytes: 9920
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d,k;
cin>>a>>b>>c;
cin>>d;
if(a>=b&&a>=c)
k=a;
else if(b>=a&&b>=c)
k=b;
else if(c>=a&&c>=b)
k=c;
if(d==1)
cout<<a+b+c+k<<endl;
else
cout<<a+b+c+k*pow(2,d)-k<<endl;
return 0;
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b==c){
    cout << "Yes" << endl;
  }
  else if(a+c==b){
    cout << "Yes" << endl;
  }
  else if(b+c==a){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n,i,ans;cin >> n;ans = 0;
    char s[n];
    for(i=0;i<n;i++)cin >> s[i];
    i = 1;
    if (n==1) cout << 0 << endl;
    else{
        while(i < n){
            if (s[i] != s[i-1]){
                ans += 1;i += 2;
            } else i += 1;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main(int argc, char** argv) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if (argc == 2 && atoi(argv[1]) == 123456789)
        freopen("d:\\code\\cpp\\stdin", "r", stdin);


    int n;
    cin >> n;
    int T;
    cin >> T;

    int sol = 0;
    for(int i=0; i<n; i++){
        int ci, ti;
        cin >> ci >> ti;
        if (ti <= T) {
            if (sol == 0 || ci < sol)
                sol = ci;
        }
    }
    if (sol == 0)
        cout << "TLE";
    else
        cout << sol;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define ll long long
ll A[100009]{};
ll B[100009]{};
ll C[100009]{};
ll dp[100009][2]{};
int main()
{
    ll N; cin>>N;
    for(ll i = 0 ; i<N; i++)
    {
        cin>> A[i] >> B[i] >> C[i];
    }


    dp[0][0] = A[0]; dp[0][1] = B[0]; dp[0][2] = C[0];  //base case

    for(int i = 0 ; i< N ; i++)
    {
      if(i-1>=0)
       {

            ll maxA = A[i] + max(dp[i-1][1],dp[i-1][2]);
            ll maxB = B[i] + max(dp[i-1][0] , dp[i-1][2]);
            ll maxC = C[i] + max(dp[i-1][0],dp[i-1][1]);




           dp[i][0] = maxA;
           dp[i][1] = maxB;
           dp[i][2] = maxC;
        }
    }

    ll ans = max(dp[N-1][0], dp[N-1][1]); ans = max(ans , dp[N-1][2]);

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 4096
#include<stdio.h>

int main() {
	int a, b, c, d;
	while(scanf("%d%d%d%d",&a,&b,&c,&d)!=EOF) {
		a += b;
		c += d;
		if(a>c) printf("Left\n");
		if(a<c) printf("Right\n");
		if(a==c) printf("Balanced\n");
	}
}

Measured memory_bytes: 128
n,k = map(int,input().split())
a = list(map(int,input().split()))

s = sorted(a,reverse=True)
mod = 10**9 + 7
ans = 1
#全部の要素が負の数であり奇数個の場合は大きい順に取ったものが答え
if k % 2 == 1 and s[0] < 0:
        for i in range(k):
            ans = ans * s[i] % mod
        print(ans)
        exit()#終了

l = 0
r = n - 1
#次の処理のための計算　（kが奇数だった場合)
#この処理の必要性
#奇数個だった場合三個のうち二つで正の数の最大値を作れば良い
if k % 2 == 1:
  ans = ans * s[l]
  l += 1


for _ in range(k // 2):
  ml = s[l] * s[l + 1]
  mr = s[r] * s[r - 1]
  if ml > mr:
    ans = ans * ml % mod
    l += 2
  else:
    ans = ans * mr % mod
    r -= 2

print(ans)


Measured memory_bytes: 31660
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
const int size = 1e6 ;


int main() {
   /* #ifndef ONLINE_JUDGE 
   freopen("input.txt","r",stdin) ;
   freopen("output.txt","w",stdout) ;
   #endif */
   int N , M ;
   cin >> N ;
   int x ;
   set<int>s ;
   set<int>::iterator it ;
   for(int i = 0 ; i < N ; i++ )
   {
      cin >> x ;
      s.insert(x) ;
   }
   while(s.size() > 1 )
   {
     it = s.begin();
     int mini = *it ;
     set<int>temp ;
     it++;
     while(it != s.end())
     {
        int num2 = *it ;
        if(num2 % mini) temp.insert(num2%mini) ;
        it++;
     }

     temp.insert(mini) ;
     s = temp ;
     
   }
   cout<<*(s.begin())<<endl;
   return 0 ;
}


Measured memory_bytes: 5248
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int K[200001];
int zentai, N;
ll kotae[200001];
int C[200001];
int E[400001], ne[400001], he[200001];

void dfs(int p, int mae) {


	int k = K[C[p]] + zentai;
	int k0 = k;

	for (int to = he[p]; to; to = ne[to]) {
		if (mae != E[to]) {
			dfs(E[to], p);
			int sa = K[C[p]] + zentai - k;
			kotae[C[p]] -= ll(sa) * (sa + 1) >> 1;
			k += sa;
		}
	}

	zentai++;
	K[C[p]] = k0 - zentai;
}


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


	cin >> N;
	rep1(i, N) cin >> C[i];
	int k = 1;
	rep(i, N - 1) {
		int a, b;
		cin >> a >> b;

		E[k] =b;
		ne[k] = he[a];
		he[a] = k++;
		E[k] = a;
		ne[k] = he[b];
		he[b] = k++;
	}

	dfs(1, -1);
	ll n = ll(N) * (N + 1) / 2;
	rep1(i, N) {
		int sa = K[i] + zentai;
		co(n + kotae[i] - (ll(sa) * (sa + 1) >> 1));
	}

	Would you please return 0;
}

Measured memory_bytes: 26248
f :: Integer -> Integer -> Integer
f 1 1 = 1
f 1 m = (m-2)
f n 1 = (n-2)
f n m =(n-2)*(m-2)

main = do
       x<-getLine
       let (a:b:[])=map read (words x)::[Integer]
       putStrLn $ show $ f a b

Measured memory_bytes: 508
n, m = map(int, input().split())
A = [input() for i in range(n)]
B = [input() for i in range(m)]
d = n - m + 1
flag1 = True
flag2 = False

for k in range(d):
    for i in range(d):
        for j in range(m):
            for l in range(m):
                flag1 = True
                if A[k + j][i + l] != B[j][l]:
                    flag1 = False
                    break

            if flag1 == False:
                break

            if j == m - 1 and flag1 == True:
                flag2 = True

        if flag2 == True:
            break

    if flag2 == True:
        break

if flag2 == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define int long long
#define INF 1000000000000000000
using namespace std;

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
template<typename T>
void debug(vector<vector<T>> m){ REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;} }



signed main(){

    int N, K; cin >> N >> K;
    vec A(N); readv(A);

    mat dp(61, vec(2, -INF));
    dp[60][0] = 0;
    IREP(i, 60){
        int n1 = 0;
        REP(j, N) if((A[j] >> i) & 1) n1++;
        if((K >> i) & 1){
            if(dp[i + 1][0] > -INF) Max(dp[i][0], dp[i + 1][0] + ((N - n1) << i));
            if(dp[i + 1][1] > -INF) Max(dp[i][1], dp[i + 1][1] + (max(n1, N - n1) << i));
            if(dp[i + 1][0] > -INF) Max(dp[i][1], dp[i + 1][0] + (n1 << i));
        }else{
            if(dp[i + 1][0] > -INF) Max(dp[i][0], dp[i + 1][0] + (n1 << i));
            if(dp[i + 1][1] > -INF) Max(dp[i][1], dp[i + 1][1] + (max(n1, N - n1) << i));
        }
    }
    cout << max(dp[0][0], dp[0][1]) << endl;

    return 0;
}


Measured memory_bytes: 1024
isth :: Int -> Bool
isth n | n == 0 = False
       | n `mod` 10 == 3 = True
       | otherwise = isth (n `div` 10)
solv :: Int -> Int -> String
solv i n | i > n          = "\n"
         | i `mod` 3 == 0 = " " ++ show i ++ solv (i+1) n
         | isth i         = " " ++ show i ++ solv (i+1) n
         | otherwise      = solv (i+1) n
solvM :: String -> String
solvM l = solv 1 (read l)
main = getLine >>= \l -> return (solvM l) >>= putStr

Measured memory_bytes: 4120
let () =
  let a, b, c = Scanf.scanf "%d %d %d" (fun a b c -> a, b, c) in
  let [x;y;z]  = List.rev @@ List.sort compare [a;b;c] in
  let n_xy = x - y in
  let n_yz = y - z in
  let res =
    if n_yz mod 2 = 0 then
      n_xy + n_yz / 2
    else
      n_xy + n_yz / 2 + 2
  in
  Printf.printf "%d\n" res
  

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

int main() {
  int n,y;
  cin >> n >> y;
  rep(a,n+1){
    rep(b,n-a+1){
      int c = n-a-b;
      if(a*10000+b*5000+c*1000 == y){
        cout << a << " " << b << " " << c << endl;
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 256
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


s = input()
n = len(s)
if s[::-1] != s:
    print("No")
    exit()

mae = s[:(n-1)//2]
usito = s[(n+3)//2-1:]
meee = mae[::-1]
usi = usito[::-1]
if meee == mae and usi == usito:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll h, w, k;
  cin >> h >> w >> k;
  vector<string> c(h);
  REP(i, h) cin >> c[i];

  ll ans = 0;
  REP(i, 1<<h){
    REP(j, 1<<w){
      ll n = 0;
      REP(a, h){
        if(i>>a & 1) continue;
        REP(b, w){
          if(j>>b & 1) continue;
          if(c[a][b] == '#') n++;
        }
      }
      if(n == k) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
    int n, m, X, Y;
    cin >> n >> m >> X >> Y;
    vector<int> x(n), y(m);
    REP(i, n) cin >> x[i];
    REP(i, m) cin >> y[i];
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    if(x.back() < Y && X < y.front() && x.back() < y.front())
        cout << "No War" << endl;
    else
        cout << "War" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <bitset>
using namespace std;

#define rep(i, n) for (int i=0; i<int(n); i++)
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using ll = long long;


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

int main() {
	int n;
	cin >> n;
	ll A[n];
	rep(i, n) cin >> A[i];

	ll a = A[0];
	for (int i=1; i<n; i++) {
		a = lcm(a, A[i]);
	}
	cout << a << endl;
}

Measured memory_bytes: 3548
s = list(input())
t = list(input())


max_change = len(t)
for start in range(len(s) - len(t) +1):
    diff =0
    for i in range(len(t)):
        if s[start + i] != t[i]:
            diff += 1
    if diff <= max_change:
        max_change = diff
print(max_change)

Measured memory_bytes: 9064
import java.util.*;
public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        String S = sc.next();
        String T = sc.next();
        
        for (int i = 0; i < 3; i++) {
        	if (S.charAt(i) != T.charAt(2-i)) {
        		System.out.println("NO");
        		return;
        	}
        }
        
        System.out.println("YES");
    }
}

Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<iomanip>
using namespace std;
int main(){
	string s;
	cin >> s;
	int a = s.size()-2;
	cout << s[0] << a << s[s.size()-1] << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
void solve(){
    int n;
    cin>>n;string str;
    map<char,int>final;
    for(int i=97;i<=122;i++){
        char c=char(i);
        final[c]=51;
    }
    for(int i=0;i<n;i++){
        map<char,int>mp;
        cin>>str;
        for(int j=0;j<str.length();j++){
            mp[str[j]]++;
        }
        //cout<<mp['b']<<'\n';
        for(int i=97;i<=122;i++){
            char c=char(i);
            final[c] = min(final[c],mp[c]);
        }
    }
    //for(auto x:final)
    //cout<<x.first<<" "<<x.second<<'\n';
    bool flag=false;
    for(auto x:final)
    {
        if(x.second!=0) {flag=true;break;}
    }
    if(!flag) {cout<<"";return;}
    for(int i=97;i<=122;i++){
        for(int j=1;j<=final[char(i)];j++)
        cout<<char(i);
    }
}
int  main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t;
    //cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>	
    		#include <stdio.h>
    		#include <string>
    		typedef long long int ll; 
     
            using namespace std;
             int main(){
               string S;
               cin >> S; 
               ll K;
               cin >>K;
        
        bool flag=1;
        for(int i=1; i <S.size(); i++){
            if(S.at(i-1)!=S.at(i)) flag=0; 
        }
               
        if(flag==1){  
            cout<< (K*S.size())/2 << endl;
        }else{
               ll sum=0; 
               ll counter =1;
               
               
               for(ll i=1; i <S.size(); i++ ){
                   
                   if( S.at(i-1)!=S.at(i) || i== (S.size()-1) ){
                       if(i==(S.size()-1) &&  S.at(i-1)==S.at(i) ) counter++; 
                       sum =  sum+ (counter/2); 
                       counter =1; 
                   }else{
                       counter++;
                   }
               }
               
               //cout<< sum << endl;
               
               string T = S.append(S);
               ll sum_2=0; 
               counter =1; 
               
               for(ll i=1; i <T.size(); i++ ){
                   
                   if( T.at(i-1)!=T.at(i) || i== (T.size()-1) ){
                       if(i==(T.size()-1) &&  T.at(i-1)==T.at(i) ) counter++; 
                       sum_2 =  sum_2+ (counter/2); 
                       counter =1; 
                   }else{
                       counter++;
                   }
               }
               
               //cout<< sum_2 << endl;
               
               cout<< sum + (K-1)*(sum_2-sum) << endl;  
        }// でかいelse       
  

              
             }


Measured memory_bytes: 256
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
/*----------------------------------------------------------------*/

// int MOD = 998244353;
int MOD = 1000000007;


/*----------------------------------------------------------------*/
signed main(){

	int n;
	string s;
	cin >> n >> s;
	int cnt = 0;
	rep(i,n-2){
		if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C')cnt++;
	}
	cout << cnt;
	

	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://ddcc2020-qual.contest.atcoder.jp/tasks/ddcc2020_qual_b
// rm -r -f test;oj dl https://abc150.contest.atcoder.jp/tasks/abc150_b

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b;
    char c;
    scanf("%d %c %d",&a,&c,&b);
    if(c=='+')
    {
        printf("%d",a+b);
    }
    else
    {
        printf("%d",a-b);
    }
    return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.Queue;

public class Main {

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

		int r = Integer.parseInt(br.readLine());

		System.out.println(r * r);
	}
}

Measured memory_bytes: 21204
/*
 * ABC093 B
 */
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
	int A, B, K;
	cin >> A >> B >> K;

	int i;
	vector<int> vec;
	for (i = 0; i < K; i++) {
		if (A + i > B) {
			break;
		}
		vec.push_back(A + i);
	}
	
	for (i = 0; i < K; i++) {
		if (B - i < A) {
			break;
		}
		vec.push_back(B - i);
	}

	sort(vec.begin(), vec.end());
	int pre = 0;
	for (int v: vec) {
		if (pre != v) {
			cout << v << endl;
			pre = v;
		}
	}

	return 0;
}


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

using namespace __gnu_pbds;
using namespace std;

#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )

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

#define rep(i,a,b) for(int (i) = (a); (i) < (b); ++(i))
#define trav(a, x) for(auto& a : x)

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define shandom_ruffle random_shuffle
#define funoredered_map __fast_unordered_map
template<class Key, class Value, class Hash = std::hash<Key>>
using funordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

constexpr int INF = 0x3f3f3f3f;
constexpr int NINF = 0xc0c0c0c0;
constexpr double EPS = 1e-8;
constexpr ll MOD = 1000000007LL;

template <typename T>
using ordered_set = 
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll modPow( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

inline int cmp_double( double x, double y, double tol = EPS) {
    return (x <= y + tol) ? ( x + tol < y) ? -1 : 0 : 1;
}

constexpr int maxW = 1e5 + 13;

long long DP[110][maxW];

int main()
{
	ios::sync_with_stdio(0); cin.tie(NULL);
    int n; long long k;
    cin >> n >> k;
    vector<long long> W(n + 1);
    vector<long long> V(n + 1);
    for(int i = 1; i <= n; ++i) {
        cin >> W[i] >> V[i];
    }
    
    for(int i = 0; i <= n; ++i) DP[i][0] = 0LL;

    for(int W = 0; W < maxW; ++W) DP[0][W] = 0LL;

    for(int peso = 1; peso <= k; ++peso) {
        for(int idx = 1; idx <= n; ++idx) {
            DP[idx][peso] = DP[idx - 1][peso];
            if( W[idx] <= peso ) { 
                DP[idx][peso] = max( DP[idx][peso], 
                                     DP[idx - 1][peso - W[idx]] + V[idx] ); 
            }
        }
    }
    long long res = -1;

    for(int i = 1; i <= n; ++i) res = max( res, DP[i][ k ] );

    cout << res << endl;

    return 0;
}



Measured memory_bytes: 80256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
   int N ;
   long X;
   cin >> N >> X;
   int i,j,r;
   int a,b;
   long h[N];
   long max = 0;
   for (i=0;i<N;i++)
   {
       cin >> h[i];
       if(h[i] < X)
       {
           h[i] = X-h[i];
       }
       else
       {
           h[i] = h[i] - X;
       }
   }
   sort(h,h+N);
   for(i=0;i<N;i++)
   {
       a = h[i+1];
       b = h[i];
       r = a % b;
       while(r !=0)
       {
           a = b;
           b = r;
           r = a % b;
       }
       h[i+1] = b;
   }
   cout << h[N-1] << endl;
   
    
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <vector>
#include <utility>
#include <algorithm>

int main(void){
	
	// n stores, buy m cans
	int n, m; scanf("%d %d", &n, &m);
	std::vector<std::pair<long long int, int>> store;
	for(int i=0; i<n; i++){
		int cost, amount; scanf("%d %d", &cost, &amount);
		store.push_back({(long long int)cost, amount});
	} std::sort(store.begin(), store.end());
	
	long long int spent = 0, left = m;
	for(auto it: store){
		long long int cost = it.first;
		int amount = it.second;
		if(left <= 0) break;
		else if(left >= amount){
			spent += cost*amount;
			left -= amount;
		}
		else{
			spent += cost*left;
			left = 0;
			break;
		}
	} printf("%lld", spent);
	
	return 0;
}

Measured memory_bytes: 2420
# coding: utf-8

def gcd(a, b):
    if a < b:
        a, b = b, a
    while b:
        a, b = b, a % b
    return a

def main():
    a, b = map(int, raw_input().split())
    print gcd(a, b)

if __name__ == '__main__':
    main()

Measured memory_bytes: 4200
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

const LL MOD = 1e9 + 7;
LL dp[100002][4] = {0};

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    dp[0][0] = 1;
    REP(i, s.size())
    {
        char c = s[i];
        if(c == 'A' || c == '?')
        {
            dp[i + 1][0] = (dp[i + 1][0] + dp[i][0]) % MOD;
            dp[i + 1][1] = (dp[i + 1][1] + dp[i][1] + dp[i][0]) % MOD;
            dp[i + 1][2] = (dp[i + 1][2] + dp[i][2]) % MOD;
            dp[i + 1][3] = (dp[i + 1][3] + dp[i][3]) % MOD;
        }
        if(c == 'B' || c == '?')
        {
            dp[i + 1][0] = (dp[i + 1][0] + dp[i][0]) % MOD;
            dp[i + 1][1] = (dp[i + 1][1] + dp[i][1]) % MOD;
            dp[i + 1][2] = (dp[i + 1][2] + dp[i][2] + dp[i][1]) % MOD;
            dp[i + 1][3] = (dp[i + 1][3] + dp[i][3]) % MOD;
        }
        if(c == 'C' || c == '?')
        {
            dp[i + 1][0] = (dp[i + 1][0] + dp[i][0]) % MOD;
            dp[i + 1][1] = (dp[i + 1][1] + dp[i][1]) % MOD;
            dp[i + 1][2] = (dp[i + 1][2] + dp[i][2]) % MOD;
            dp[i + 1][3] = (dp[i + 1][3] + dp[i][3] + dp[i][2]) % MOD;
        }
    }
    PUTS(dp[s.size()][3]);
}

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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;
const int mxn=1e5+5;
int a[mxn];
ll dp[mxn];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	ll n,m; 
	cin >> n >> m;
	for(int i=0; i<n; i++)cin >> a[i];
	sort(a,a+n);
	int le = 0, ri = 2e5+1;
	ll cnt,happiness=0LL;
	while(le<=ri){
		int mid = (le+ri)/2;
		cnt=0;
		for(int i=0; i<n; i++){
			int left = a[i];
			int right = mid-left;
			ll ptr = lower_bound(a,a+n,right)-a;
			cnt+=n-ptr;
		}
		if(cnt>m){
			le=mid+1;
		}else{
			ri=mid-1;
		}
	}
	le--;
	cnt = 0LL;
	for(int i=n-1; i>=0; i--){
		dp[i]=dp[i+1]+(ll)a[i];
	}
	for(int i=0; i<n; i++){
		int left = a[i];
		int right = le-left;
		ll ptr = lower_bound(a,a+n,right)-a;
		cnt += n-ptr;
		happiness += dp[ptr]+(n-ptr)*left;
	}
	cnt = cnt-m;
	happiness -= cnt*le;
	cout << happiness << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 1408
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        M = new int[n][n];
        d = new int[n];
        p = new int[n];
        color = new int[n];
	
        for(int i = 0; i < n ; i ++){
            p[i] = -1;
            d[i] = INFTY;
        }
	
        for(int i = 0 ; i < n ; i ++){
            for(int j = 0 ; j < n; j ++){
                int e = sc.nextInt();
                M[i][j] = e == -1 ? INFTY : e;
            }
        }
	
        System.out.println(prime());
    }
    
    static int[][] M;
    static int[] color;
    static int[] d;
    static int[] p;
    static int n;
    static final int INFTY = 1 << 21;
    static final int WHITE = 0;
    static final int GRAY = 1;
    static final int BLACK = 2;
    

    
    static int prime(){
        d[0] = 0;
        int minv,u;
        while (true) {
            minv = INFTY;
            u = - 1;
            for(int i = 0 ; i < n ; i ++){
                if(color[i] != BLACK && minv > d[i]){
		    minv = d[i];
		    u = i;
                }
            }
	    
	    
            if(u == -1) break;
	    
            color[u] = BLACK;
	    
            for(int v = 0 ; v < n ; v ++){
                if(color[v] != BLACK && M[u][v] != INFTY){
                    if(d[v] > M[u][v]){
                        d[v] = M[u][v];
                        p[v] = u;
                        color[v] = GRAY;
                    }
		    
                }
            }
        }
	
	
        int sum = 0;
        for(int i = 0 ; i < n ; i ++){
            if(p[i] > -1){
                sum += M[i][p[i]];
            }
        }
        return sum;
    }
}



Measured memory_bytes: 40632
using System;

public class Hello{
    public static void Main(){
        
        var input = Console.ReadLine().Split(' ');
        var result = "No";
        for(var i = 1;i < 9;i++){
            int count = 0;
            for(var j = 0;j < 3;j++){
                if(i == int.Parse(input[j])){
                count++;
                }
            }
            if(count == 2){
                result  = "Yes";
                break;
            }
        }
      Console.WriteLine(result);  
    }
}

Measured memory_bytes: 11092
#include <stdio.h>
int main(void){
   
   int n,i;
   int x[100];
   
   scanf("%d",&n);
   
   for(i=1;i<=n;i++){
       scanf("%d",&x[i]);
   }
   
   for(i=n;i>=1;i--){
       if(i!=1)
       printf("%d ",x[i]);
       else
       printf("%d\n",x[i]);
   }
   
   
   
   return 0;

   }



Measured memory_bytes: 2104
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
    
using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main(){

    int A, B, C;
    cin >> A >> B >> C;
    int X;
    cin >> X;

    int ans = 0;
    for(int a = 0; a <= A; a++){
        for(int b = 0; b <= B; b++){
            for(int c = 0; c <= C; c++){
                if(500 * a + 100 * b + 50 * c == X) ans++;
            }
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
// Problem : F - LCS
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_f
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
#define nl cout<<"\n"
#define endl "\n"
#define all(c) (c).begin(),(c).end()
#define trav(a,x) for(auto a = x.begin() ; a != x.end() ; a++)
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll>
#define vll vector<ll>
#define f first
#define s second
typedef long long ll;
typedef unsigned long long ull ;
typedef long double ld;

inline ll max(ll a,ll b) {return ((a>b)?a:b);}
inline ll min(ll a,ll b) {return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b) {if(b==0) return a; a%=b;return gcd(b,a);}
ll power(ll x, ll y){if(y == 0) return 1; ll a = power(x,y/2);if (y % 2 == 0) return a * a; else return x * a * a; }
ll powermod(ll x, ll ex , ll md) {ll ans = 1ll;while (ex > 0) {if (ex & 1ll) ans = (ans * x) % md; ex >>= 1ll;x = (x * x) % md;}return ans;}

const ll inf = 1e18 + 9;
const ll mod = 1e9 + 7;
const ld PI = acos(-1);
const ld eps = 1e-9;

const ll N = 4e3 + 1;
string s1 , s2;
ll l1 , l2;
ll dp[N][N];//  dp[i][j] - longest subsequence for prefix of s1 , s2 till i and j resp.
void solve(){
	cin >> s1 >> s2;
	ll l1= s1.size();
	ll l2= s2.size();
	// base
	if(s2[0] == s1[0]) dp[0][0] = 1;
	else dp[0][0] = 0; 
	for(ll j = 1  ; j < l2 ; j++){
		if(s2[j] == s1[0]) dp[0][j] = 1;
		else dp[0][j] = dp[0][j - 1];
	}
	// transition
	for(ll i = 1 ; i < l1 ; i++){
		for(ll j = 0; j < l2 ; j++){
			if(s1[i] == s2[j]) dp[i][j] = dp[i - 1][j - 1] + 1;
			else dp[i][j] = max(dp[i - 1][j] , dp[i][j - 1]);
		}
	}
	// for(ll i = 0 ; i < l1 ; i++){
		// cout << i <<" : "<< s1[i] <<" : " << endl;
		// for(ll j= 0  ; j < l2 ; j++) cout << "(" << s2[j] << " : " << dp[i][j] <<") ";
		// nl;
	// }
	string ans;
	ll i = l1 - 1;
	ll j = l2 - 1;
	ll val = dp[i][j];
	if(val == 0) {
		cout <<"";
		return ;
	}
	while(i > 0 && j > 0){
		if(s1[i] == s2[j]){
			ans.pb(s1[i]);
			i--;
			j--;
		}
		else{
			if(dp[i - 1][j] >= dp[i][j - 1]) i--;
			else j--;
		}
	}
	// cout << i <<" " << j << endl;
	if((int)(ans.size()) != val){
		if(i == 0){
			for(ll k = 0 ; k <= j ; k++) if(s1[i] == s2[k]) {
				ans.pb(s1[i]);
				break;
			}
		}
		else if(j == 0){
			for(ll k = 0 ; k <= i ; k++) if(s2[j] == s1[k]) {
				ans.pb(s1[k]);
				break;
			}
		}
	}
	reverse(all(ans));
	cout << ans << endl;
	return ;
}
int main(){
    IOS;
    cout << fixed << setprecision(20);
    ll NTC=1;
    // cin>>NTC;
    ll PTC=0;
    while(PTC++<NTC){
        // cout<<"Case #"<<PTC<<":"<<' ';
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 94208
s=input()
if s=='SUN':
  print(7)
elif s=='MON':
  print(6)
elif s=='TUE':
  print(5)
elif s=='WED':
  print(4)
elif s=='THU':
  print(3)
elif s=='FRI':
  print(2)
else:
  print(1)






Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,b,a) for (int i=b;i>=a;i--)
#define mes(a,b)  memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
typedef long long ll;
const int N = 2e5+10;

ll ans[N];
int n, minID;
struct P { int v, id; }p[N];
bool cmp(const P &a, const P &b) {
    if(a.v==b.v) return a.id>b.id;
    return a.v>b.v;
}
int main()
{
    scanf("%d", &n);
    rep(i,1,n) scanf("%d", &p[i].v), p[i].id=i;
    sort(p+1, p+1+n, cmp);
    minID=INF;
    rep(i,1,n) {
        minID=min(minID, p[i].id);
        if(p[i].v!=p[i+1].v) ans[minID]+=1LL*(p[i].v-p[i+1].v)*i;
    }
    rep(i,1,n) printf("%lld\n", ans[i]);

    return 0;
}


Measured memory_bytes: 2688
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first > b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vector<pll> A(N);
  REP(i, N) {
    ll a;
    cin >> a;
    A[i] = make_pair(a, i);
  }
  sort(ALL(A), paircomp);

  ll now = 1e10;
  ll count = 1;
  vl ans(N, 0);
  REP(i, N) {
    now = min(now, A[i].second);
    // cout << A[i].first << "," << A[i].second << "," << now << endl;
    if (i < N - 1) {
      if (A[i].first == A[i + 1].first) {
        count++;
      } else {
        ans[now] += count * (A[i].first - A[i + 1].first);
        count++;
      }
    } else {
      ans[now] += count * A[i].first;
    }
  }
  REP(i, N) cout << ans[i] << endl;
  return 0;
}


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

int main() {
    int N, X, sum, num;

    cin >> N >> X;

    sum = 0;
    vector <int> m(N);
    for (int i = 0; i < N; i++){
        cin >> m[i];
        sum = sum + m[i];
    }
    
    int min = *min_element(m.begin(), m.end());

    num = (X - sum)/min;

    cout << N + num << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


inline double distance(double xa, double ya, double xb, double yb)
{
  double dx = xb - xa, dy = yb - ya;

  return sqrt(dx * dx + dy * dy);
}

int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(20);
  std::cerr << std::fixed << std::setprecision(6);

  int A, B, H, M;

  std::cin >> A >> B >> H >> M;

  double ta = 2. * M_PI / 12. * H + 2. * M_PI / 12. * M / 60.;
  double tb = 2. * M_PI / 60. * M;

  double xa = A * cos(ta), ya = A * sin(ta);
  double xb = B * cos(tb), yb = B * sin(tb);

  std::cout << distance(xa, ya, xb, yb) << std::endl;

  return 0;
}


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

using namespace std;

using int64 = long long;

struct Edge {
  int from, to;
};

vector<vector<Edge>> ReadDirectedGraph(
    int n, int m, bool is_one_indexed=false) {
  vector<vector<Edge>> graph(n);
  for (int i = 0; i < m; i++) {
    int v1, v2;
    cin >> v1 >> v2;
    if (is_one_indexed) {
      v1--;
      v2--;
    }
    graph[v1].push_back(Edge({v1, v2}));
  }
  return graph;
}

int Max(const vector<int>& xs) {
  int value = INT32_MIN;
  for (int x : xs) value = max(x, value);
  return value;
}

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

  int n, m;
  cin >> n >> m;
  vector<vector<Edge>> graph = ReadDirectedGraph(n, m, true);

  vector<int> heights(n, -1);

  function<void(int)> dfs = [&](int v) {
    if (heights[v] >= 0) return;

    if (graph[v].size() == 0) {
      heights[v] = 0;
      return;
    }

    int height = 0;
    for (Edge e : graph[v]) {
      dfs(e.to);
      height = max(height, heights[e.to] + 1);
    }
    heights[v] = height;
  };

  for (int i = 0; i < n; i++) dfs(i);

  cout << Max(heights) << endl;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) (v).begin(), (v).end()
#define fr(i, a, b) for (int i = (a); i <= (b); ++i)

void solve();

signed main () {
    clock_t beg = clock();
    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    #endif 
    int t = 1; 
    // cin >> t;    
    int tt = t;
    while (t--) {
        // cout << "Case #" << tt - t << ": "; 
        solve();
    }
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
    return 0;
}

void solve() {  
    int d, t, s;
    cin >> d >> t >> s;
    if (s * t >= d) {
        cout << "Yes";
    } else {
        cout << "No";
    }
}       

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

ll ctoi(char c){
    return (ll)(c - '0');
}

void solve(){
    ll N;
    cin >> N;

    string s=to_string(N);
    ll len = s.length();

    if (ctoi(s[0]) * (ll)pow(10,len-1) + (ll)pow(10,len-1) - 1 == N) {
        cout << ctoi(s[0]) + 9 * (len-1) << endl;
    }else{
        cout << ctoi(s[0]) + 9 * (len-1) -1 << endl;
    }

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define STR_MAX 1000
#define BUF_SIZE (STR_MAX+50)
#define SET_MAX 150

// size: specify sizeof(str)
int get_str(char *str, int size) {
    if(!fgets(str, size, stdin)) return -1;
    return 0;
}

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int main(void) {
    int num = get_int();
    static int dp[STR_MAX+1][STR_MAX+1];
    int i, j;
    int ans[SET_MAX];
    int aidx = 0;
    int set;
    for(set = 0; set < num; set++) {
        memset(dp, 0, sizeof(int)*(STR_MAX+1)*(STR_MAX+1));
        static char str1[BUF_SIZE];
        static char str2[BUF_SIZE];
        get_str(str1, BUF_SIZE);
        get_str(str2, BUF_SIZE);
        int len1 = strlen(str1) - 1;
        int len2 = strlen(str2) - 1;
        for(i = 1; i <= len1; i++) {
            char ch1 = str1[i-1];
            for(j = 1; j <= len2; j++) {
                char ch2 = str2[j-1];
                dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
                if(ch1 == ch2) dp[i][j] = dp[i-1][j-1]+1;
            }
        }
        ans[aidx++] = dp[len1][len2];
    }
    
    for(i = 0; i < num; i++) {
        printf("%d\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 5712
#include <stdio.h>
 
    long gcd_euclid(long m, long n){
        long temp;
        while (n) {
            temp = m%n;
            m=n;
            n=temp;
        }
        return m;
}

 int main(){
     long a,b;
     long temp;
     long gcd, lcm;
     
     while(scanf("%ld %ld", &a, &b)!=EOF){
         gcd =gcd_euclid(a,b);
         temp=a/gcd;
         lcm = temp * b;
         printf("%ld %ld\n", gcd,lcm);
     }
    return 0;
}


Measured memory_bytes: 1976
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
#define c2i(c) ((int)c-'0')
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
int char2int(char c) {
  return int(c-'0');
}
char s[200'009];
int f[10'009];
int main() {
    int n, p;
    scanf("%d%d%s", &n, &p, s);
    if(p==2||p==5){
        ll ans = 0;
        rrep(i,n) 
            if (c2i(s[i])%p == 0) ans += i+1;
        cout << ans << endl;
        return 0;
    } 
    ll rem = 0;
    ll pow = 1;
    ll ans = 0;
    REP(i,1,p) f[i] = 0;
    f[0] = 1;
    rrep(i,n){
        rem = (rem + c2i(s[i])*pow)%p;
        ans += f[rem];
        f[rem]++;
        pow = pow*10%p;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
template<class T> using vv=vector<vector<T>>;

int main() {
  vector<int> stack;

  while (true) {
    int count;
    cin >> count;
    if (count == 0) { break; }
    vi point(count);
    for (int i = 0 ; i < count ; i++) {
      cin >> point[i];
    }
    sort(point.begin(), point.end());
    int ave = 0;
    for (int i = 1 ; i <= point.size()-2 ; i++) {
      ave += point[i];
    }
    ave /= (count-2);
    stack.push_back(ave);
  }

  for (int i = 0 ; i < stack.size() ; i++) {
    printf("%d\n", stack[i]);
  }

  return 0;
}

Measured memory_bytes: 3192
from collections import deque

N, K = map(int, input().split())
A = list(map(int, input().split()))
T = set([0])  # 0-indexed

c = 0  # 0-indexed
for i in range(N + 1):
    c = A[c] - 1
    # print('c', c)
    if c not in T:
        T.add(c)
    else:
        break
C = deque([c])
T = set([c])  # 0-indexed
for i in range(N + 1):
    c = A[c] - 1
    # print('c', c)
    if c not in T:
        T.add(c)
        C.append(c)
    else:
        break
c2 = 0  # 0-indexed
S = deque([0])
for i in range(N + 1):
    c2 = A[c2] - 1
    if c2 == c:
        break
    else:
        S.append(c2)
# print('C', C)
# print('S', S)
# print('len(C), len(S)', len(C), len(S))

if C[0] == 0:
    mod = K % len(C)
    ans = C[mod]
else:
    if len(S) > K:
        ans = S[K]
    else:
        mod = (K - len(S)) % len(C)
        ans = C[mod]
print(ans + 1)


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

typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    int N;
    cin >> N;
    map<int, int> mp;
    bool is = true;
    rep(i, N){
        int a;
        cin >> a;
        if(mp.count(a) != 0){
            is = false;
            break;
        }else{
            mp[a]++;
        }
    }
    if(is) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 12988