akhauriyash/Code-Regression huggingface dataset:
//四則演算 #pragma GCC target("avx")
//並列計算 #pragma GCC optimize("O3")
//条件分岐を減らす #pragma GCC optimize("unroll-loops")
//浮動小数点演算 #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define each(i, a) for(auto &i : a)
#define SORT(i) sort(i.begin(),i.end())
#define rSORT(i) sort(i.rbegin(),i.rend())
#define fSORT(i,a) sort(i.begin(),i.end(),a)
#define all(i) i.begin(),i.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
inline void print() { cout << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }

int main() {
    init();

    int k; string s; cin >> k >> s;
    if (s.length() <= k)print(s);
    else print(s.substr(0, k) + "...");

    return 0;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main{
	public static  void  main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] count = new int[26];
		while(sc.hasNext()) {
			String str = sc.nextLine();
			for(int i = 0; i < str.length(); i++) {
				char ch = str.charAt(i);
				if('a' <= ch && ch <= 'z') {
					count[str.charAt(i) - 'a']+=1;;
				}
				else if('A' <= ch && ch <= 'Z') {
					count[str.charAt(i) - 'A']+=1;;
				}
			}
		}
		for(int i = 0; i < 26; i++){
			char ch = (char)('a' + i);
			System.out.println(ch + " : " + count[i]);
	    }
	}
}






Measured memory_bytes: 26096
from bisect import bisect_left,bisect_right

n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
cns = 0
for i in B:
    x = bisect_left(A,i)
    y = bisect_right(C,i)
    y = n - y
    ans += x*y
print(ans)




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

prime = [2]

for i in range(2, 101):
    for j in range(2, i-1):
        if i % j == 0:
            break
    else:
        prime.append(i)

factor = [0] * 101

for i in range(1, N+1):
    for p in prime:
        if i == 1:
            break
        while i % p == 0:
            i /= p
            factor[p] += 1

def num(m):
    return len(list(filter(lambda x:x >= m-1, factor)))

print(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) \
        + num(5) * (num(5) -1) * (num(3) - 2) // 2)


Measured memory_bytes: 3064
import Data.Char
import Control.Monad

import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM

import qualified Data.ByteString.Char8 as BS
import Data.Maybe

getInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine


main :: IO ()
main = do
  n <- readLn :: IO Int
  a <- getInts  

  v <- VM.replicate 100001 0 :: IO (VM.IOVector Int)

  forM_ a $ \x -> do
    VM.modify v (+1) x
  
  q <- readLn :: IO Int

  let
    f 0 ans = return ()
    f k ans = do
      [b, c] <- getInts

      x <- VM.read v b
      VM.write v b 0
      VM.modify v (+x) c
    
      let ans' = ans + x * (c - b)

      print ans'
      f (k-1) ans'
      
  f q (sum a)


Measured memory_bytes: 19912
#include <iostream>
using namespace std;
int main()
{
	int H, N, A;
	bool winnable;
	winnable = false;
	cin >> H >> N;
	for (int i = 0; i < N; i++) {
		cin >> A;
		if (H - A <= 0) {
			winnable = true;
		}
		H = H - A;
	}
	if (winnable) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int h = scanner.nextInt();
		System.out.println( (a + b) * h / 2 );
		scanner.close();
	}
}


Measured memory_bytes: 9804
#include <bits/stdc++.h>
using namespace std;
int main() {
	string S;
	cin >> S;
	char c = ' ';
	int n = 0;
	for (char x : S) {
		if (c != x) {
			c = x;
			++ n;
		}
	}
	cout << n-1 << endl;
}


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

int main()
{
    int x;cin>>x;
    for(int i=1;i<=x;i++){
        if(i%3==0|i%10==3)cout<<" "<<i;
        else{
            int b=i;
            while(b){
                b/=10;
                if(b%10==3){
                    cout<<" "<<i;
                    break;
                }
            }
        }
    }
    cout<<endl;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int sll;
typedef long double ld;
#define A 1000000007
#define D 100000000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define M 4000
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<pair<ll,ll>, null_type,less_equal<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI acos(-1)
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n" 

int main() 
{
    FAST;
    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    ll ans=0,co=0,in=n-1;
    sort(a,a+n);
    co++;
    ans+=a[in];
    in--;
    while(co<n-1)
    {
        ans+=(2*a[in]);
        in--;
        co+=2;
    }
    if(co==n)
        ans-=a[in+1];
    cout<<ans;
    subt;
    return 0;
}

Measured memory_bytes: 5340
a = list(map(int,input().split()))
N=a[0]
L=a[1]

if L+N-1 <= 0:
    print(N * L + N * (N-1) //2 -L - N +1)
elif L >= 0:
    print(N * L + N * (N-1) //2 -L )
else:
    print(N * L + N * (N-1) //2 )

Measured memory_bytes: 3060
from collections import OrderedDict

n, q = map(int, input().split())
od = OrderedDict()

for i in range(n):
    name, time = input().split()
    od.update({name: int(time)})
total = 0

while len(od) > 0:
    name, time = od.popitem(False)
    if time <= q:
        total += time
        print("{} {}".format(name, total))
    else:
        total += q
        time -= q
        od.update({name: time})

Measured memory_bytes: 14932
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

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

def readInts():
  return list(map(int,input().split()))
def main():
    a,b,c = readInts()
    d = max(a,b,c)*3 - (a+b+c)
    print(d%2 + (d+1)//2)
if __name__ == '__main__':
  main()


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

const int MAXN = 2e6+10;
const int P = 1e9+7;

LL fac[MAXN];
LL invf[MAXN];

LL fp(LL a, LL n){
    if(n==0)
        return 1;

    LL h = fp(a, n/2);
    h *= h;
    h %= P;
    if(n&1){
        h = h*a %P;
    }

    return h;
}


LL C(LL a, LL b){
    return fac[a] * invf[a-b] % P * invf[b] %P;
}
int main(){
    int r1, c1, r2, c2;
    cin >>r1>>c1>>r2>>c2;

    fac[0] = 1;
    fac[1] = 1;
    invf[0] = 1;
    invf[1] = 1;

    for(int i=2;i<=(int)2e6+1;i++){
        fac[i] = fac[i-1] * i %P;
        invf[i] = fp(fac[i], P-2);
    }

    LL ans = 0;

    for(int i=r1;i<=r2;i++){
        ans += C(i+c2+1, c2) - C(i+c1, c1-1);
        ans %=P;
    }

    if(ans<0)
        ans+=P;
    cout<<ans;

}


Measured memory_bytes: 31488
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc =new Scanner(System.in);
		
		int n = Integer.parseInt(sc.nextLine());
		String txt = sc.nextLine();
		
		if (n == 1 || n % 2 != 0) {
			System.out.println("No");
		}else {
			boolean stop = false;
			for (int i=0; i<n/2; ++i) {
				
				if (txt.charAt(i) != txt.charAt((n/2)+i)) {
					stop = true;
					break;
				}
			}
			System.out.println(stop ? "No" : "Yes");
		}
		
		
		sc.close();
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define SORT(v) sort((v).begin(), (v).end())
#define REV(v) sort((v).begin(), (v).end(), greater<int>())
#define INF 1000000007
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){std::fill( (T*)array, (T*)(array+N), val );};


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

  int a;
  string s;
  cin >> a >> s;
  if(a >= 3200) cout << s << endl;
  else cout << "red" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;


public class Main {
    public static void main(String[] args){

        int[] term = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

        Scanner s = new Scanner(System.in);
        
        int a = s.nextInt();

        System.out.println(term[a-1]);
    }
}

Measured memory_bytes: 21716
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (size_t i = 0; i < size_t(n); i++)
#define forn1(i,n) for (size_t i = 1; i <= size_t(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const int MAX_N = 100000;
int n;
int a[MAX_N];

ll calc(bool init) {
    ll ans = 0;
    ll cur = 0;
    int s = init ? 1 : -1;
    forn(i, n) {
        ll temp = cur + a[i];
        if (temp * s > 0) {
            cur = temp;
        } else {
            ans += abs(temp) + 1;
            cur = s;
        }
        //cout << init << " " << cur << endl;
        s *= -1;
    }
    return ans;
}

int main() {
    fastio();

    cin >> n;
    forn(i, n) cin >> a[i];

    cout << min(calc(true), calc(false)) << endl;

    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include <stdio.h>

using namespace std;

int main()
{
  int a,b;
  cin>>a>>b;
  int d=a/b;
  int r=a%b;
  double f=(double)a/b;
  cout<<d<<" "<<r<<" ";
  printf("%.5lf\n", f);
  return 0;
}
  


Measured memory_bytes: 3228
import java.util.*;
import java.io.BufferedInputStream;
 
public class Main {
  private static int[] count;
  private static int n, x, y;
  public static void main(String[] args){
    Scanner sc = new Scanner (new BufferedInputStream(System.in));
    n = sc.nextInt();
    x = sc.nextInt();
    y = sc.nextInt();
    int[] res = new int[n];
    for(int i = 1; i <= n; ++i) {
      count = new int[n + 1];
      Arrays.fill(count, Integer.MAX_VALUE);
      LinkedList<Integer> que = new LinkedList<>();
      que.offer(i);
      count[i] = 0;
      int d = 0;
      while(!que.isEmpty()) {
        int now = que.poll();
        if(now > 1 && count[now - 1] == Integer.MAX_VALUE) {
          que.offer(now - 1);
          count[now - 1] = count[now] + 1;
        }
        if(now < n && count[now + 1] == Integer.MAX_VALUE) {
          que.offer(now + 1);
          count[now + 1] = count[now] + 1;
        }
        if(now == x && count[y] == Integer.MAX_VALUE) {
          que.offer(y);
          count[y] = count[x] + 1;
        }
        if(now == y && count[x] == Integer.MAX_VALUE) {
          que.offer(x);
          count[x] = count[y] + 1;
        }
      }
      for(int j = 1; j <=n; ++j) {
        res[count[j]]++;
      }
    }
    for(int i = 1; i < n; ++i) {
      System.out.println(res[i] / 2);
    }
  }
}


Measured memory_bytes: 92100
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
typedef long long ll;

int main() {
    ll a;
    cin >> a;
    long double b;
    cin >> b;
    long double c = a*b;
    dunk((ll)c);
    return 0;
}

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

int main() {
  int A,B,K;
  cin>>A>>B>>K;
  
  int m=min(A,B);
  int count=0;
 
  for(int i=m;i>=1;--i){
    if(A%i==0 && B%i==0){
      ++count;
      if(count==K){
        cout<<i<<endl;
        return 0;
      }
    }
  }
  
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>   
#include <stdio.h>    
 
using namespace std;
     
#define F first
#define S second
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)2e5 + 123;
const ll inf = (ll)3e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

string s;

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> s;
   for (int i = 0; i < sz (s) - 1; i ++)
      if (s[i] == s[i + 1])
         cout << "Bad", exit (0);
   cout << "Good";

}                                     

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
// cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}


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


Measured memory_bytes: 2104
#include<stdio.h>

 long long int check(int);
 long long int solve();

 long long int num,van_num;
 long long int cab[1000000];

 int main(){
      long long int i;
      long long int ans;

      scanf("%d %d",&num,&van_num);
      for(i=0;i<num;i++){
             scanf("%d",&cab[i]);
             }
      ans=solve();
      printf("%d\n",ans);

      return 0;
      }

 long long int check(int max_burd){
      long long int i=0,j;
      long long int van_burd;
      for(j=0;j< van_num;j++){
           van_burd=0;
           while(van_burd+cab[i]<=max_burd){
                 van_burd+=cab[i];
                 i++;
                 if(i==num)return num;
                 }
           }
       return i;
       }

 long long int solve(){
        long long int left=0;
        long long int right=100000*10000;
        long long int mid;
        long long int num_pie;

        while(right-left>1){
             mid=(left+right)/2;
             num_pie=check(mid);
             if(num_pie>=num){
                  right=mid;
                  }
             else{
                  left=mid;
                  }
             }
         return right;
         }
     



Measured memory_bytes: 2584
n, x, m = map(int, input().split())
a = [0] * (pow(10, 5) + 5)
b = [0] * (pow(10, 5) + 5)
c = [0] * (pow(10, 5) + 5)
for i in range(1, m + 1):
    if x == 0:
        ans = c[i - 1]
        break
    if a[x] == 0:
        a[x] = i
        b[i] = x
        c[i] = c[i - 1] + b[i]
        x = (x ** 2) % m
    else:
        if i >= n:
            ans = c[n]
        else:
            ans = c[i - 1]
            n -= (i - 1)
            s, t = a[x] - 1, i - 1
            ans += (c[t] - c[s]) * (n // (t - s))
            n %= (t - s)
            ans += (c[s + n] - c[s])
        break
print(ans)

Measured memory_bytes: 16332
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    int t=0,n=b;
    while(b>0){
        t++;
        b/=10;
    }
    n+=pow(10,t)*a;
    for(int i=0;i<10000;i++){
        if(i*i==n){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


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

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 998244353ll

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define part(v, s, e) v.begin() + s, v.begin() + e
#define print(v) for (auto i: v) cout << i << " ";

int main() {
    fast;
    ll x, a;
    cin >> x >> a;
    if (x < a)
        cout << 0 << endl;
    else
        cout << 10 << endl;
    return 0;
}


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

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

  int A, B; cin >> A >> B;
  int ans = 0;
  for (int x = A; x <= B; x++) {
    string s = to_string(x);
    if (s[0] == s[4] && s[1] == s[3]) ans++;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
    int n;cin>>n;
    int cnt = 0;
    map<int,int>mp;
    while(1){
        cnt++;
        if(mp[n])break;
        mp[n]++;
        if(n%2 == 0)n /= 2;
        else n = 3*n+1;
    }
    cout<<cnt;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int a;
	for (int i = 0; i < 18; i++) {
		cin >> a;
	}
	cout << 0 << " " << 0 << " " << 1 << endl;
	cout << 0 << " " << 0 << " " << 59 << endl;
	cout << 15 << " " << 59 << " " << 59 << endl;
}

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

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

    long acc_a[n + 1], acc_b[n + 1];
    acc_a[0] = acc_b[0] = 0;
    for (int i = 1; i <= n; i++) {
        acc_a[i] = acc_a[i - 1] + a[i - 1];
        acc_b[i] = acc_b[i - 1] + max(0l, a[i - 1]);
    }

    long ans = 0;
    for (int i = k; i <= n; i++) {
        ans = max(ans, acc_b[n] - acc_b[i] + max(0l, acc_a[i] - acc_a[i - k]) + acc_b[i - k] - acc_b[0]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

A = lines[0][0]
B = lines[0][1]
M = lines[0][2]

a_price = []
b_price = []
for i in 1..A do
  a_price.push(lines[1][i-1])
end
for i in 1..B do
  b_price.push(lines[2][i-1])
end

min_with_discount = 1000000000000000000000000
for i in 1..M do
  a_tmp = lines[i+2][0]
  b_tmp = lines[i+2][1]
  discount = lines[i+2][2]
  price = a_price[a_tmp-1] + b_price[b_tmp-1] - discount
  if price < min_with_discount then
    min_with_discount = price
  end
end
  
min_without_discount = a_price.sort[0] + b_price.sort[0]
if min_with_discount < min_without_discount then
  print min_with_discount
else
  print min_without_discount
end

Measured memory_bytes: 20596
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <functional>

using namespace std;

//#define LOG(...) printf(__VA_ARGS__)
#define LOG(...)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define INF INT_MAX

struct P
{
    int n,cost,ticket;
    bool operator >(const P &p) const{
        return cost>p.cost;
    }
};

struct E{
    int to,cost;
};


int main() {
    int c,n,m,s,d;
    while(cin >> c >> n >> m >> s >> d,c|n|m|s|d){
        vector<vector<E>> edge=vector<vector<E>>(n+1);
        REP(i, m){
            int from,to,cost;
            cin >> from >> to >> cost;
            edge[from].push_back({to,cost});
            edge[to].push_back({from,cost});
        }

        int cost=INF;
        priority_queue<P, vector<P>, greater<P>> que;
        vvi town(n+1, vi(c+1, INF));

        que.push({s,0,c});
        while(!que.empty()){
            P p=que.top();que.pop();
            LOG("n:%d cost:%d tic:%d\n",p.n,p.cost,p.ticket);

            if(p.n==d){
                cost=p.cost;
                break;
            }

            REP(i, edge[p.n].size()){
                E e=edge[p.n][i];
                int ncost=p.cost+e.cost;
                if(town[e.to][p.ticket]>ncost){
                    LOG("afds n:%d cost:%d tic:%d\n",e.to,ncost,p.ticket);
                    town[e.to][p.ticket]=ncost;
                    que.push({e.to,ncost,p.ticket});
                }
                if(p.ticket>0){
                    ncost=p.cost+e.cost/2;
                    if(town[e.to][p.ticket-1]>ncost){
                        LOG("afds n:%d cost:%d tic:%d\n",e.to,ncost,p.ticket-1);
                        town[e.to][p.ticket-1]=ncost;
                        que.push({e.to,ncost,p.ticket-1});
                    }
                }
            }
        }

        cout << cost << endl;
    }
}

Measured memory_bytes: 1260
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long n = 100;
        long k = sc.nextLong();
        for (int i = 0; i < 4000; i++) {
            double a = n * 1.01;
            n = (long)a;
            if (n >= k) {
                System.out.println(i+1);
                return;
            }
        }
    }
}


Measured memory_bytes: 35816
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);

using namespace std;
typedef long long int  ll;
typedef pair<int, int> P;

constexpr int MOD = 1e9 + 7;
constexpr ll inf = 1LL << 60;

//lcm//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}


////////////////////////////////////////////////////////////////////

int main(){

ll n,a,b,c;
cin>>n>>a>>b>>c;

char op[n+1];
for(int i=1;i<=n;i++){
string s;
cin>>s;
if(s=="AB")op[i]='C';
else if(s=="AC")op[i]='B';
 else op[i]='A';
}

char nu[n+1];



if(a+b+c==0){cout<<"No"<<endl;
return 0;}

for(int i=1;i<=n;i++){
	
if(op[i]=='A'){
if(a!=0){
if(b+c==0){cout<<"No"<<endl; return 0;}
if(b>=c){b--; c++; nu[i]='C';}
else{b++; c--; nu[i]='B';}
}
if(a==0){
if(b==1 && c==1 && i<=n-1){
	if(op[i+1]=='C'){b++; c--; nu[i]='B';}
	else if(op[i+1]=='B'){c++; b--; nu[i]='C';}
	else{b++; c--; nu[i]='B';}
}
else if(b<=c){b++; c--; nu[i]='B';}
else if(b>c){b--; c++; nu[i]='C';}
}
}


//
if(op[i]=='B'){
if(b!=0){
if(a+c==0){cout<<"No"<<endl; return 0;}
if(a>=c){a--; c++; nu[i]='C';}
else{a++; c--; nu[i]='A';}
}
if(b==0){
if(a==1 && c==1 && i<=n-1){
	if(op[i+1]=='C'){a++; c--; nu[i]='A';}
	else if(op[i+1]=='A'){c++; a--; nu[i]='C';}
	else{a++; c--; nu[i]='A';}
}
else if(a<=c){a++; c--; nu[i]='A';}
else if(a>c){a--; c++; nu[i]='C';}
}

}

//
if(op[i]=='C'){
if(c!=0){
if(b+a==0){cout<<"No"<<endl; return 0;}
if(b>=a){b--; a++; nu[i]='A';}
else {b++; a--; nu[i]='B';}
}
if(c==0){
if(b==1 && a==1 && i<=n-1){
	if(op[i+1]=='A'){b++; a--; nu[i]='B';}
	else if(op[i+1]=='B'){a++; b--; nu[i]='A';}
	else{b++; a--; nu[i]='B';}
}
else if(b<=a){b++; a--; nu[i]='B';}
else if(b>a){b--; a++; nu[i]='A';}
}

}



}

	cout<<"Yes"<<endl;
for(int i=1;i<=n;i++){
cout<<nu[i]<<endl;
}

return 0 ;








}

Measured memory_bytes: 3824
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

#define int long long
#define endl '\n'
const int N = 100001;

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	int ans = 0;
	for(int i = 1 ; i <= n ; i ++){
		if(i >= 1 && i <= 9) ans ++;
		if(i >= 100 && i <= 999) ans ++;
		if(i >= 10000 && i < 100000) ans ++;
	}
	cout << ans;
}


Measured memory_bytes: 256
sa = list(input())
sb = list(input())
sc = list(input())
turn = "a"
for i in range(len(sa+sb+sc)):
    if turn == "a":
        if len(sa) == 0:
            print("A")
            break
        else:
            turn = sa[0]
            sa.remove(sa[0])
    elif turn == "b":
        if len(sb) == 0:
            print("B")
            break
        else:
            turn = sb[0]
            sb.remove(sb[0])
    else:
        if len(sc) == 0:
            print("C")
            break
        else:
            turn = sc[0]
            sc.remove(sc[0])

Measured memory_bytes: 9144
from collections import defaultdict

nodes = defaultdict(list)

for _ in [0]*3:
    node1, node2 = map(int, input().split())
    nodes[node1].append(node2)
    nodes[node2].append(node1)

for i in range(1, 5):
    stack = []
    visited = [False]*4
    stack.append(i)
    while len(stack) != 0:
        now = stack.pop(-1)
        visited[now-1] = True
        for i in nodes[now]:
            if not visited[i-1]:
                stack.append(i)
                break
    if all(visited):
        print('YES')
        exit(0)

print('NO')

Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
  string s;
  string D = "AIDUNYAN";
  sort(D.begin(), D.end());
   
  string const azupero = "AIZUNYAN";
   
  cin >> s;
  int size = s.size();
   
  for(int i=0; i<size; i++) {
    string sub = s.substr(i, 8);
    sort(sub.begin(), sub.end());
    if(sub == D) {
      for(int j=0; j<8; j++) {
    s[i+j] = azupero[j];
      }
      i+=7;
    }
  }
   
  cout << s << endl;
   
  return 0;
}

Measured memory_bytes: 1216
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str,ptr;


   cin>>a>>b;

   if(b==1)
   {
       cout<<0<<endl;

       return 0;
   }

   a--;
   b--;

    n=b/a;

    if(b%a)n++;

    cout<<n<<endl;


}



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

#define MAX_NUM 20
int num[MAX_NUM + 5][MAX_NUM + 5];
int num0[MAX_NUM + 5];
int cou;

int main() {
	int N, M, C;
	cin >> N >> M >> C;
	
	for(int i = 0; i < M; ++i) {
		scanf("%d", &num0[i]);
	}
	for(int j = 0; j < N; ++j) {
		for(int i = 0; i < M; ++i) {
			scanf("%d", &num[j][i]);
		}
	}
	
	int sum = 0;
	for(int j = 0; j < N; ++j) {
		for(int i = 0; i < M; ++i) {
			sum += num[j][i] * num0[i];
		}
		if(sum + C > 0) {
			++cou;
		}
		sum = 0;
	}
	
	cout << cou;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <stack>

using namespace std;

int gcd(int a, int b){
  while(true){
    if(b>=a){
      swap(a, b);
    }

    if(b==0){
      return a;
    }
    
    a = a%b;
  }
}	

int main(){
  int a, b;
  cin >> a >> b;
  cout << gcd(a, b) << endl;
  
  
}

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

int main() {
  int a, b, k;
  vector<int> v;
  cin >> a >> b >> k;
  for (size_t i = 1; i <= 100; i++) {
    if (a % i == 0 && b % i == 0) {
      v.push_back(i);
    }
  }
  cout << v[v.size() - k] << endl;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 10005
#define eps 1e-12
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        res = res * 10 + c - '0';
        c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
        out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,M;
struct node {
    int to,next,val;
}E[1005];
int sumE,head[25],pos[(1 << 15) + 5];
int f[16][(1 << 15) + 5],h[16][(1 << 15) + 5],sum[(1 << 15) + 5];
void add(int u,int v,int c) {
    E[++sumE].to = v;
    E[sumE].next = head[u];
    E[sumE].val = c;
    head[u] = sumE;
}
inline int lowbit(int x) {
    return x & (-x);
}
void Init() {
    read(N);read(M);
    int u,v,c;
    for(int i = 1 ; i <= M ; ++i) {
        read(u);read(v);read(c);
        add(u,v,c);add(v,u,c);
        h[u][1 << v - 1] = c;
        h[v][1 << u - 1] = c;
    }
    for(int i = 1 ; i <= N ; ++i) {
        for(int j = 1 ; j < (1 << N) ; ++j) {
            if(lowbit(j) == j) continue;
            h[i][j] = h[i][j - lowbit(j)] + h[i][lowbit(j)];
        }
    }
    for(int i = 1 ; i <= N ; ++i) pos[(1 << i - 1)] = i;
    for(int i = 1 ; i < (1 << N) ; ++i) {
        sum[i] = sum[i - lowbit(i)] + h[pos[lowbit(i)]][i - lowbit(i)];
    }
}
void Solve() {
    for(int i = 1 ; i <= N ; ++i) {
        for(int j = 0 ; j < (1 << N) ; ++j) {
            f[i][j] = -1e9;
        }
    }
    f[1][1] = 0;

    for(int j = 0 ; j < (1 << N - 1) ; ++j) {
        for(int i = 1 ; i <= N ; ++i) {
            int S = j << 1 | 1;
            if(!(S & (1 << i - 1))) continue;
            int L = S ^ (1 << i - 1);
            for(int T = L; T ; T = (T - 1) & L) {
                if(f[i][S ^ T] >= 0)
                    f[i][S] = max(f[i][S],f[i][S ^ T] + sum[T ^ (1 << i - 1)]);
            }
            if(f[i][S] >= 0) {
                for(int k = head[i] ; k ; k = E[k].next) {
                    int v = E[k].to;
                    if(!(S & (1 << v - 1))) {
                        f[v][S ^ (1 << v - 1)] = max(f[v][S ^ (1 << v - 1)],f[i][S] + E[k].val);
                    }
                }
            }
        }
    }
    out(sum[(1 << N) - 1] - f[N][(1 << N) - 1]);enter;
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
    Init();
    Solve();
}


Measured memory_bytes: 4352
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]

r = II()
import math
print(round(math.pi*r*2,2))

Measured memory_bytes: 9220
#include <bits/stdc++.h>
#include <algorithm>
#include <atcoder/all>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
using ll = long long;
using ull = unsigned long long;
#define REP(i, m, n) for (ll(i) = (ll)(m); i < (ll)(n); ++i)
#define REP2(i, m, n) for (ll(i) = (ll)(n)-1; i >= (ll)(m); --i)
#define rep(i, n) REP(i, 0, n)
#define rep2(i, n) REP2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using Edge = pair<int, long long>;
using Graph = vector<vector<Edge>>;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
// constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
template <class T> inline void print(T x) { cout << x << '\n'; }
template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }

// ~~~~~~~~~~~~~~memo~~~~~~~~~~~~~~
// for (int i = 0; i < n; ++i)
// v ector<long long> v(n), c(n);
// cout << res << endl;
// cout << res << '\n';
// int型の2次元配列(h×w要素の)の宣言
// vector<vector<int>> data(h, vector<int>(w));
// rotate(s.begin(), s.begin() + 1, s.end());
// sort(all(a),greater<int>());
// s.substr(0,2) 先頭から2文字切り出す
// for (auto it = mp.rbegin();it != mp.rend(); ++it)
// vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(w + 1,
// vector<int>(k+1, 0)));

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, q;
    cin >> n >> q;
    dsu uf(n);
    rep(i, q) {
        ll t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            uf.merge(u, v);
        } else {
            if (uf.same(u,v)) {
                print(1);
            } else {
                print(0);
            }
            
        }
    }
    return 0;
}


Measured memory_bytes: 3964
#include <bits/stdc++.h>
    using namespace std;
    #define INF 2000000000
    typedef long long int ll;
    typedef pair<ll,ll> ii;
    typedef pair<ii,ll> iii;
    typedef vector<ll> vi;
    typedef vector<ii> vii;
    #define getbit(n,i) (((n)&(1<<(i)))!=0)
    #define setbit0(n,i) ((n)&(~(1<<(i))))
    #define setbit1(n,i) ((n)|(1<<(i)))
    #define togglebit(n,i) ((n)^(1<<(i)))
    #define lastone(n) ((n)&(-(n)))
    #define read freopen("debug\\in.txt","r",stdin)
    #define write freopen("debug\\out.txt","w",stdout)
    #define fi first
    #define se second
    #define getI(a) scanf("%d",&a)
    #define getII(a,b) scanf("%d%d",&a,&b)
    #define PI (acos(-1))
    #define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
    #define mod (1000000007)
    #define asz 500005
    #define pb push_back
    #define ppf pop_front
    #define ppb pop_back
    #define pf push_front
    ll ispos(ll n,ll num,ll m){
    	ll res=num;
    	if(m%(num+1)==0)
    	res+=(m/(num+1));
    	else
    	res+=(m/(num+1)+1);
    	return res;
	}
    int main()
    {
        fastread;
        ll t,i,j,k,l,n,m;
           ll a,b;
           cin>>a>>b;
           if(a*500>=b)
           cout<<"Yes";
           else
           cout<<"No";
		
    	return 0;
    }

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder.Io;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var nab = ReadLongArray();
            var n = nab[0];
            var a = nab[1];
            var b = nab[2];
            var x = ReadLongArray();

            long cost = 0;
            for (int i = 0; i < x.Length - 1; i++)
            {
                cost += Math.Min((x[i + 1] - x[i]) * a, b);
            }
            Console.WriteLine(cost);
        }
    }

    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);
    }
}


Measured memory_bytes: 22880
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
const int INF=1e9+7;

int main(){
  ll n;cin>>n;
  vll a(n-1),dp(n,0);//人iの部下の人数
  rep(i,0,n-1){
    cin>>a[i];
    a[i]--;
    dp[a[i]]++;
  }
  
  rep(i,0,n){
    cout<<dp[i]<<endl;
  }
}

Measured memory_bytes: 6428
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while (true) {
            int H = sc.nextInt();
            int W = sc.nextInt();
            if (H == 0 && W == 0) {
            break;
            }

            for(int j=0;j<W;j++){
                System.out.print("#");
            }
            System.out.println();

            for(int i=0;i<H-2;i++){
                System.out.print("#");
                for(int j=0;j<W-2;j++){
                    System.out.print(".");
                }
                System.out.print("#");
                System.out.println();
            }

            for(int j=0;j<W;j++){
                System.out.print("#");
            }

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

        sc.close();
        }
}


Measured memory_bytes: 37632
S = gets.chomp

a = b = 0

for x in 0...S.size
  if x % 2 == 0
    if S[x] == "0"
      a += 1
    elsif S[x] == "1"
      b += 1
    end
  else
    if S[x] == "0"
      b += 1
    elsif S[x] == "1"
      a += 1
    end
  end
end

if a < b
  puts a
else
  puts b
end

Measured memory_bytes: 1916
import Foundation

struct Vec2 {
    var x:Double;
    var y:Double;
}

func Distance(a:Vec2, b:Vec2)->Double {
    let v = Vec2(x:a.x - b.x, y:a.y - b.y)
    return sqrt(v.x * v.x + v.y * v.y)
}

func CalcHVec(h:Double, m:Double, length:Double) -> Vec2 {
    let pi2 = Double.pi * 2.0
    let hrad = pi2 * h / 12.0
    let mrad = (pi2 / 12.0) * m / 60.0

    return Vec2(x:cos(hrad + mrad) * length, y:sin(hrad + mrad) * length)
}

func CalcMVec(m:Double, length:Double) -> Vec2 {
    let pi2 = Double.pi * 2.0
    let mrad = pi2 * m / 60.0

    return Vec2(x:cos(mrad) * length, y:sin(mrad) * length)
}

let args = readLine()?.split(separator: " ") ?? []

let a = Double(args[0]) ?? 0  // 時針長さ
let b = Double(args[1]) ?? 0  // 分針長さ
let h = Double(args[2]) ?? 0
let m = Double(args[3]) ?? 0

let hvec = CalcHVec(h: h, m: m, length: a)
let mvec = CalcMVec(m: m, length: b)
let result = Distance(a: hvec, b: mvec)

print(result)

Measured memory_bytes: 13784