akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18

int main() {
    int A, B, M, ans = 1e8;
    cin >> A >> B >> M;
    vector<int> a(A), b(B);
    for (int i = 0; i < A; i++) cin >> a[i];
    for (int i = 0; i < B; i++) cin >> b[i];
    for (int i = 0; i < M; i++) {
        int x, y, c;
        cin >> x >> y >> c;
        x--, y--;
        ans = min(ans, a[x] + b[y] - c);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    ans = min(ans, a[0] + b[0]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int x,n;
int p;
int q[111];
int i;

int main(){
   
    scanf("%d %d",&x,&n);
    int ans = -100000;

    for(i=0;i<n;i++){
        scanf("%d",&p);
        q[p]++;
    }

    for(i=0;i<=101;i++){
        if(!q[i] && abs(x-ans)>abs(x-i))
            ans = i;
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 1732
#!/mnt/c/Users/moiki/bash/env/bin/python

N,M,Q = map(int, input().split())

trains = [ [int(j) for j in input().split()] for _ in range(M)]
queries = [ [int(j) for j in input().split()] for _ in range(Q)]


begin = [0] * (N+1)
# end  = [0] * (N+1)
end = [ [0] * (N+1) for _ in range(N+1)]


for l,r in trains:
    begin[l] += 1
    end[l][r] += 1

for l in range(N, 1, -1):
    for r in range(1,N+1):
        end[l-1][r] += end[l][r]


# print("  ", begin)
# for e,i in enumerate(end):
#     print("{:2d}".format(e), i)
# # exit(0)

for l,r in queries:
    # print("begin: ", begin[l:r+1])
    # print("begin: ", begin[l:r+1])
    ans = min ( sum(begin[l:r+1]), sum(end[l][l:r+1]))
    print(ans)
    


Measured memory_bytes: 117336
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		long a = parseLong(sc.next());
		long b = parseLong(sc.next());
		long x = parseLong(sc.next());
		sc.close();
		out.println((b/x)-(a/x)+(a%x==0?1:0));
	}
}


Measured memory_bytes: 23636
#include<stdio.h>
int Debt(int n);
int main()
{
	int i = 0;
	int temp = 0;
	int k;
	int n;
	int sum = 100000;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		k = (int)(sum*0.05)%1000;
		if (k != 0)
		{
			temp = 1000;
		}
		else{
			temp = 0;
		}
		sum += sum*0.05+temp-k;
	}
	printf("%d\n", sum);
}

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

int main() {
    int mod = 1e9 + 7;
    int n; cin >> n;
    long long ans = 1;
    for (int i = 1; i <= n; i++) {
        ans *= i % mod;
        ans %= mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
typedef long long int lli;
lli a[200000];

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

    lli a1 = 0, a2 = 0;
    lli sum = 0;
    for(int i=0; i<n; i++) {
        sum += a[i];
        if(i%2) {
            if(sum >= 0) {
                a1 += sum + 1;
                sum = -1;
            }
        } else {
            if(sum <= 0) {
                a1 += 1 - sum;
                sum = 1;
            }
        }
    }

    sum = 0;
    for(int i=0; i<n; i++) {
        sum += a[i];
        if(!(i%2)) {
            if(sum >= 0) {
                a2 += sum + 1;
                sum = -1;
            }
        } else {
            if(sum <= 0) {
                a2 += 1 - sum;
                sum = 1;
            }
        }
    }

    printf("%lld\n", std::min(a1,a2));
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>

using namespace std;


int main() {
    long long int i,j,k,m,n,a,b,r,X,Y;

   cin >> X;

   Y=100;
   n = 0;
  while (Y < X) {
    n++;
    Y += (Y/100);
  }
  cout << n << endl;

  return 0;
}


Measured memory_bytes: 3632
import sys
N, K = map(int, sys.stdin.readline().rstrip().split())
number = list(range(1, N+1))
lists = []
for i in range(K):
  d = sys.stdin.readline().rstrip()
  li = [int(x) for x in sys.stdin.readline().rstrip().split()]
  for k in li:
    if k in number:
      number.remove(k)
  lists.append(li)
#print(lists)
print(len(number))

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

using namespace std;
using ll = long long;

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

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

  for (int i = s.size() - t.size(); i >= 0; i--) {
    string u = s.substr(i, t.size());
    string ans = s;
    bool f = true;
    for (int j = 0; j < t.size(); j++) {
      if (u[j] == '?') {
        ans[i + j] = t[j];
        continue;
      }
      if (u[j] != t[j])
        f = false;
    }
    if (f) {
      for (int k = 0; k < s.size(); k++) {
        cout << (ans[k] == '?' ? 'a' : ans[k]);
      }
      cout << endl;
      return 0;
    }
  }
  cout << "UNRESTORABLE" << endl;

  return 0;
}


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

int main() {
  
  int t=0, tf=0, b=0, bf=0;
  
  cin >> t >> tf >> b >> bf;
  
  int train = min(t, tf);
  int bus = min(b, bf);
  
  int sum = train+bus;
  
  cout << sum << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<istream>
#include <stdio.h>
#include<vector>
#include <fstream>
#include <string>
#include<stdio.h>
using namespace std;
int main() {
	int A, P,M;
	cin >> A >> P;
	M = (3 * A + P) / 2;
	cout << M << endl;
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n ; 
  cin >> n ; 
  vector<int> d(n) ;
  rep(i,n) cin >> d.at(i) ;
  sort(all(d)) ;
  int ans = 0 ;
  
  for(int i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      for(int k=j+1;k<n;k++){
        if(d.at(i) != d.at(j) && d.at(j)!=d.at(k)){
          if(d.at(k) < d.at(i) + d.at(j) ) ans ++ ;
        }
      }
    }
  }
  
  cout <<ans ;
  
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll n;
    string s;
    cin>>n>>s;
    string a=s.substr(0,n),b=s.substr(n,n);
    reverse(all(b));
    map<pair<string,string>,ll>m;
    map<pair<string,string>,ll>m2;
    rep(i,(1<<n)){
        string t="",u="";
        rep(j,n){
            if(i&(1<<j)){
                t=t+a[j];
            }else{
                u=u+a[j];
            }
        }
        pair<string ,string>k=mp(t,u);
        if(m.find(k)==m.end())m[k]=1;
        else m[k]++;
    }
    rep(i,(1<<n)){
        string t="",u="";
        rep(j,n){
            if(i&(1<<j)){
                t+=b[j];
            }else{
                u+=b[j];
            }
        }
        pair<string ,string>k=mp(t,u);
        if(m2.find(k)==m2.end())m2[k]=1;
        else m2[k]++;
    }
    ll ans=0;
    for(auto e:m){
        pair<string,string>k=e.first;
        if(m2.find(k)!=m2.end())ans+=e.second*(m2[k]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 89856
#include <iostream>
#include <unordered_map>
using namespace std;
const int N = 3;
int bingo[3][3];
bool st[3][3];
int n;
bool check(){
  for(int i = 0; i < 3; i ++){
    if(st[i][0] && st[i][1] && st[i][2]) return true;
    if(st[0][i] && st[1][i] && st[2][i]) return true;
  }
  if(st[0][0] && st[1][1] && st[2][2]) return true;
  if(st[0][2] && st[1][1] && st[2][0]) return true;
  return false;
}
int main(){
  for(int i = 0; i < 3; i ++){
    for(int j = 0; j < 3; j ++){
      cin >> bingo[i][j];
    }
  }
  cin >> n;
  while(n --){
    int x;
    cin >> x;
    for(int i = 0; i < 3; i ++){
      for(int j = 0; j < 3; j ++){
        if(bingo[i][j] == x){
          st[i][j] = true;
          if(check()) {
            cout << "Yes" << endl;
            return 0;
          }
        }
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

template<typename T>
void debug(T val)
{
    //cout << val << endl;
}

int main()
{
    int n, k;
    vector<int> v;

    cin >> n >> k;

    v.resize(n);

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

    int ans = 0;
    for(int i = 0; i <= k; ++i)
    {
        for(int j = 0; j + i <= min(n, k); ++j)
        {
            priority_queue<int, vector<int>, greater<int> > pq;
            int val = 0;

            for(int l = 0; l < i; ++l)
            {
                pq.push(v[l]);
                val += v[l];
            }

            for(int l = 0; l < j; ++l)
            {
                pq.push(v[n - 1 - l]);
                val += v[n - 1 - l];
            }

            for(int l = 0; l < k - (i + j); ++l)
            {
                if(!pq.empty() && pq.top() < 0)
                {
                    val -= pq.top();
                    pq.pop();
                }
            }

            ans = max(ans, val);
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
    string s;
    cin >> s;
    int  cnt = 0 ;

for (int i = 0 ; i < 3 ; i++){
    if ( s[i] == '1' ){
     cnt++ ;

    }
} 
cout  << cnt  << endl;

}

Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) {
    	Scanner input = new Scanner(System.in);
      	int N = input.nextInt();
      	int M = input.nextInt();
      	Map<Integer, int[]> map = new TreeMap<Integer, int[]>();


      	for (int i = 0; i < M; i++) {
          	int P = input.nextInt();
          	int Y = input.nextInt();
          	int[] arr = new int[2];
          	arr[0] = P; //
          	arr[1] = i; //入力順
          	map.put(Y, arr);
        }

      	String[] ans = new String[M];
      	int[] city = new int[N];

      	for (int[] arr : map.values()) {
        	ans[arr[1]] = String.format("%06d%06d", arr[0], ++city[arr[0]-1]);
        }
      	for (int i = 0; i < M; i++) {
			System.out.println(ans[i]);
        }
    }
}


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

using namespace std;

typedef long long ll;

const int MOD=1e9+7;

int n,a,b;
ll ans=1;

inline ll qp(int b) {
	ll a=2,ans=1;
	while(b) {
		if(b&1) (ans*=a)%=MOD;
		(a*=a)%=MOD;
		b>>=1;
	}
	return ans;
}

inline void exgcd(const int &a,const int &b,ll &x,ll &y) {
	if(!b) {
		x=1,y=0;
		return ;
	}
	exgcd(b,a%b,y,x);
	y-=(a/b)*x;
	return ; 
}

inline ll comb(const int &n,const int &m) {
	ll x,y,ans=1;
	for(int i=n-m+1; i<=n; ++i) ans=ans*i%MOD;
	for(int i=2; i<=m; ++i) {
		exgcd(i,MOD,x,y);
		if(x<0) x+=MOD;
		ans=ans*x%MOD;
	} 
	return ans;
}

int main() {
	scanf("%d %d %d",&n,&a,&b);
	ans=(qp(n)-1-comb(n,min(a,n-a))-comb(n,min(b,n-b)))%MOD;
	if(ans<0) ans+=MOD;
	printf("%lld\n",ans);
	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; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
#define ll long long int
#define ld long double
#define ff first
#define ss second  
#define endl '\n'
#define pb push_back
#define t_case ll tt; cin>>tt; while (tt--)
#define all(v) v.begin(),v.end()
#define ub(a,x) upper_bound(all(a),x)-a.begin()
#define lb(a,x) lower_bound(all(a),x)-a.begin()
#define fr(a,b,c) for (ll a=b;a<c;a++)
#define take(xx,n) for (int i=0;i<n;i++) cin>>xx[i];
#define take1(xx,n) for (int i=1;i<=n;i++) cin>>xx[i];
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
const auto inf=LLONG_MAX; 

int main() 
{
	fastio
	//t_case
	{
		ll sum=0,f=1,ans=0,n,m=1,mx=-inf,mn=inf,x,y,k  ; cin>>n; 
		f=0;
		fr(i,0,n) {
			if (sum==3) f=1;
			int x,y; cin>>x>>y;
			if (x==y) sum++;
			else sum=0;
		}
		if (sum==3) f=1;
		if  (f) cout<<"Yes";
		else cout<<"No";
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int n;
  cin>>n;
  int mi = MOD;
  FOR(i,1,n/2 + 1) {
    int a = i;
    int b = n - i;
    int as = 0,bs = 0;
    while(a > 0) {
      as += a % 10;
      a /= 10;
    }
    while(b > 0) {
      bs += b % 10;
      b /= 10;
    }
    mi = min(mi, as + bs);
  }
  cout << mi << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n;i++)
using ll = long long;
#define int ll
using namespace std;
using pii = pair<int,int>;
using piii = pair<pair<int,int>,int>;
ll INF =LLONG_MAX/10;
signed main(){
    int n,m; cin>>n>>m;
    vector<piii>edge;
    rep(i,m){
        int a,b,c; cin>>a>>b>>c;
        edge.push_back(piii(pii(--a,--b),c));
    }
    bool update=false;
    vector<int>d(n,-INF);
    vector<bool>visit(n,false);
    visit[0]=true;
    d[0]=0;
    bool unrated=false;
    int v=0;
    while(true){
        v++;
        update=false;
        rep(i,edge.size()){
            piii e=edge[i];
            int to=e.first.second;
            int from=e.first.first;
            int cost=e.second;
            if(d[to]==INF||d[from]==INF)continue;
            if(d[to]<d[from]+cost){
                if(v>n&&to==n-1)unrated=true;
                d[to]=d[from]+cost;
                update=true;
            }
        }
        if(!update)break;
        if(v>2*(n-1)&&unrated){return puts("inf")*0;}
        if(v>2*(n-1))break;
    }
    cout<<d[--n]<<endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdlib>

#include<cmath>
#include<map>
#include<string>
#include<vector>
#include<algorithm> 

using namespace std;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) std::cout << (j ? s1 : s2) << endl;
# define YES(j) std::cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define rep(n,i) for(i = 0 ; i < n ; i++)

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

    int res=sqrt(n);
    while(res*res>n){
        res+=1;
    }
    p(res*res)
}

Measured memory_bytes: 256
/*
    to amy
    https://atcoder.jp/contests/abc135/tasks/abc135_a
*/

#include <bits/stdc++.h>

using namespace std;

#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define pb push_back
#define F first
#define S second
#define MAX 2005

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

int solve(int a, int b){
    if((a-b) == 0 || b-a == 0) return 0;
    if((a+b) % 2 == 0) return (a+b)/2;
    return -1;
}

int main() {
    IOS
    int a,b;
    while(cin>>a>>b){
        int ans = solve(a,b);
        if(ans == -1) cout<<"IMPOSSIBLE"<<endl;
        else cout<<ans<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl "\n"

int32_t main()
{
	IOS;
	int n;
	cin>>n;
	if(n>=1000)
		cout<<"ABD";
	else cout<<"ABC";

 	return 0;		
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind
#define rt (a); return (a); 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
int gcd(int a, int b) {
	if (b > a)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
int ans = 0;
int s[10][10];
int k[10];
int p[10];
void bit(int m, int n,int d) {
	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			bool w = true;
			rep(i, 0,d ) {
				int x = 0;
				rep(j, 0, k[i])if (now[s[i][j] - 1] == '1')x++;
				if (x%2 != p[i])w = false;
			}
			if(w)ans += 1;
		}
		else {
			for (int i = m - 1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
}
;
int main() {
	int n;
	cin >> n;
	whei(int) a(n, hei(int)(3));
	//入力
	rep(i, 0, n) {
		rep(j, 0, 3)cin >> a[i][j];
	}
	whei(int) dp(n,hei(int)(3));
	rep(i, 0, 3)dp[0][i] = a[0][i];
	rep(i, 1, n) {
		rep(j, 0, 3) {
			rep(k, 0, 3) {
				if (j != k) {
					dp[i][j] = max(dp[i][j], dp[i - 1][k] + a[i][j]);
				}
			}
		}
	}
	int ans = 0;
	rep(i, 0, 3)ans = max(ans, dp[n - 1][i]);
	cout << ans << endl;
	 return 0;

}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define repi(i,a,b) for(int i = (a); i<= (b); i++)
#define repA(i,n) for(int i=n; i>=0; i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (int)(a.size())

typedef long long ll;
typedef long double ld;
const ll mod = (ll)(1e9+7);//998244353;
const int N = (int)(2e6+5);

void pre() {

}

void solve() {
  int a,b;  cin>>a>>b;
  cout<<max(a-2*b,0);
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  #endif
  int t = 1;
  pre();
//  cin>>t;
  rep(i,t)  {
    //cout<<"\nCase #"<<(i+1)<<"\n";
    solve();
    cout<<'\n';
  }
  return 0;
}


Measured memory_bytes: 3624
N=int(input())
if N<10 :
    print(N)
elif 10<=N<100:
    print(9)
elif 100<=N<1000 :
    print(9+N-100+1)
elif 1000<=N<10000 :
    print(909)
elif 10000<=N<100000 :
    print(909+N-10000+1)
elif N==100000 :
    print(90909)


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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1010;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code


int main()
{
	ll n;
	cin>>n;
	if(n%2 == 1) cout<<0<<endl;
	else
	{
		ll cnt = 1;
		ll curr = 10;
		ll ans = 0;
		ll two = 0, five = 0;
		while(true)
		{
			ll z = n;
			curr = 5*curr;
			ll k = z / curr;
			ans += cnt*k;
			if(k == 0) break;
		}
		ll kk = n / 10;
		ans += kk;
		cout<<ans<<endl;
	}
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.math.*;

public class Main {

    private static Scanner sc;

    public static void main(final String[] args) {
        final Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null)
                br.close();
        }

        public String next() throws IOException {
            if (i < s.length)
                return s[i++];
            String st = br.readLine();
            while (st == "")
                st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }

    private void solve() {
        try {
            long a;
            a = sc.nextLong();
            long aa = a;
            int count = 0;
            if (a == 1) {
                System.out.println(0);
                return;
            }
            for (long i = 2; i * i <= aa; i++) {
                int loop = 0;
                while (a % i == 0) {
                    a /= i;
                    loop++;
                }
                for (int j = 1; j <= loop; j++) {
                    loop -= j;
                    count++;
                }
            }
            if (a != 1) {
                System.out.println(count + 1);
                return;
            } else {
                System.out.println(count);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}


Measured memory_bytes: 32708
#include <bits/stdc++.h>
#define rep(i,a,b) for(long long i = a; i < b; i++)
#define print(a) cout << a << "\n"
#define dump(a) for(auto x : a) cout << x << " "; cout << "\n"
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using namespace std;
typedef long long ll;
using vi   = vector<int>;
using vll  = vector<ll>;
using vs   = vector<string>;
using vvi  = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvs  = vector<vector<string>>;

int main()
{
  int N;cin >> N;
  ll L[100];rep(i,0,N) cin >> L[i];
  ll total = 0;

  rep(i,0,N - 2) {
    rep(j,i+1,N) {
      rep(k,j+1,N) {
        if (L[i] == L[j]) continue;
        if (L[i] == L[k]) continue;
        if (L[j] == L[k]) continue;
        
        if (L[i] > L[j]) {
          if (L[i] > L[k]) {
            if (L[i] - L[k] >= L[j]) continue;
          } else {
            if (L[k] - L[i] >= L[j]) continue;
          }
        } else {
          if (L[j] > L[k]) {
            if (L[j] - L[k] >= L[i]) continue;
          } else {
            if (L[k] - L[j] >= L[i]) continue;
          }
        }
        
        // cout << i+1 << j+1 << k+1 << endl;
        // cout << L[i] << L[j] << L[k] << endl;
        total++;
      }
    }
  }
  print(total);

  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
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; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

string s, t;
int dp[1010][1010];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i, 0, n) {
        memset(dp, 0, sizeof(dp));
        cin >> s >> t;
        erep(i, 0, s.size()) {
            erep(j, 0, t.size()) {
                if (s[i] == t[j]) 
                    dp[i+1][j+1] = dp[i][j] + 1;
                else
                    dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
            }
        }
        cout << dp[s.size()][t.size()] << endl;
    }
    return 0;
}


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

typedef long long ll;
int N, W;
int w, w0, v;
vector<vector<int> > vv(4);

int value(int I, int J, int K, int L) {
  int result = 0;
  ll weight = 0;
  for (int i = 0; i < I; i++) {
    result += -vv[0][i];
    weight += w0;
  }
  for (int j = 0; j < J; j++) {
    result += -vv[1][j];
    weight += w0 + 1;
  }
  for (int k = 0; k < K; k++) {
    result += -vv[2][k];
    weight += w0 + 2;
  }
  for (int l = 0; l < L; l++) {
    result += -vv[3][l];
    weight += w0 + 3;
  }
  if (weight > W) return 0;
  return result;
}

int main() {
  // 入力
  cin >> N >> W;
  cin >> w0 >> v;
  vv[0].push_back(-v);
  for (int i = 1; i < N; i++) {
    cin >> w >> v;
    vv[w - w0].push_back(-v);
  }
  for (int i = 0; i < 4; i++) {
    sort(vv[i].begin(), vv[i].end());
  }
  int ans = 0;
  for (int i = 0; i <= vv[0].size(); i++) {
    for (int j = 0; j <= vv[1].size(); j++) {
      for (int k = 0; k <= vv[2].size(); k++) {
        for (int l = 0; l <= vv[3].size(); l++) {
          ans = max(ans, value(i, j, k, l));
        }
      }
    }
  }
  // 解答
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

void solv(int n) {
  int i, j, c[501], s[501], f[501], k;
  int sec;

  c[0] = s[0] = f[0] = 0;
  for (i = 1; i <= n - 1; i++) {
    scanf("%d %d %d", c + i, s + i, f + i);
  }

  for (k = 1; k <= n; k ++) {
    sec = 0;
    for (i = k; i < n; i++) {
      for (j = 0; sec > s[i] + f[i] * j; j++) {}
      sec = s[i] + f[i] * j + c[i];
    }
    printf("%d\n", sec);
  }
}

int main(int argc, char **argv) {
  int n;

  while (scanf("%d\n", &n) != EOF) {
    solv(n);
  }

  return 0;
}


Measured memory_bytes: 128
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun calc0 (a)
  (declare #.OPT
           (uint62 a))
  (let ((res 0))
    (declare (uint62 res))
    (dotimes (k (integer-length a) res)
      (if (zerop k)
          (let ((rem (mod a 4)))
            (if (or (= rem 0) (= rem 3))
                (setf (ldb (byte 1 0) res) 0)
                (setf (ldb (byte 1 0) res) 1)))
          (let ((rem (mod a (expt 2 (+ k 1)))))
            (cond ((< rem (expt 2 k))
                   (setf (ldb (byte 1 k) res) 0))
                  ((evenp rem)
                   (setf (ldb (byte 1 k) res) 1))
                  (t
                   (setf (ldb (byte 1 k) res) 0))))))))

(defun main ()
  (let* ((a (read))
         (b (read)))
    (declare (uint62 a b))
    (println
     (if (zerop a)
         (calc0 b)
         (logxor (calc0 b) (calc0 (- a 1)))))))

#-swank(main)


Measured memory_bytes: 19552
#include<iostream>
#include<vector>
#include<string>
#include<iomanip>
#include<set>

using namespace std;

int main()
{
	int n,k;
	cin >> n >> k;
	int mx=(n-1)*(n-2)/2;
	if(k>mx)
	{
		cout << -1 << endl;
		return 0;
	}
	
	int con=mx-k;

	cout << n-1+con << endl;

	for(int i=2;i<=n;i++)
		cout << 1 << " " << i << endl;
	

	int count=0;
	bool flag=false;
	for(int i=2;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			count++;
			if(count>con)
			{
				flag=true;
				break;
			}
			cout << i << " " << j << endl;
		}
		if(flag)
			break;
	}
			





}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int x,y,s;
  cin >> x >> y >> s;
  while(x != 0){
    int ans = 0;
    for(int i=1; i<=s-1; i++){
      for(int j=1; j<=s-1; j++){
        int a = i + (i*x)/100;
        int b = j + (j*x)/100;
        if(a+b == s){
          chmax(ans,i+(i*y)/100+j+(j*y)/100);
        }
      }
    }
    cout << ans << endl;
    cin >> x >> y >> s;
  }
  return 0;
}



Measured memory_bytes: 3204
<?php

class out {
    public static function println($str = "") {
        echo $str . PHP_EOL;
    }
}
$input = trim(fgets(STDIN));
$input = str_replace(array("\r\n","\r","\n"), '', $input);
$array = str_split($input);
$answer = 0;
for ($i=0; $i < count($array); $i++) {
  if ($array[$i] === "1") {
      $answer += 1;
  }
}
out::println($answer);

?>


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 string s;
 cin >> s;
 
  int ans = 0;
  for (int i = 0; i < 3; i++) {
    if (s[i] == '1') {
      ans++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.InputStreamReader;
import java.io.LineNumberReader;

/**
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_B
 * 
 * @author eitatsuro
 * 
 */
public class Main {
    private final static String SPACE = " ";
    public static void main(String[] args) {
        try {
            LineNumberReader stdReader = new LineNumberReader(
                    new InputStreamReader(System.in));
            
            String sStr;
            int n = 0;
            int x = 0;
            int count = 0;

            while ((sStr = stdReader.readLine()) != null) {
                
                // ??\???
                String[] inputs = sStr.split(SPACE);
                n = Integer.valueOf(inputs[0]);
                x = Integer.valueOf(inputs[1]);

                // ??????????????????
                if ( n ==0 && x ==0) {
                    break;
                }

                // 1 .. n?????§?????°?????????????????????3????????°???????????§????¨????x??¨?????????????????????.
                for (int i=1; i<=n; i++){
                    for(int j=i+1; j<=n; j++) {
                        for(int k=j+1; k<=n; k++){
                            if (i+j+k == x) {
                                count++;
                            }
                        }
                    }
                }
                
                // ????????????
                System.out.println(count);
                // ?????????
                count = 0;
            }

            stdReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
        
    }
}

Measured memory_bytes: 25224
using System;

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int countAC = 0;
        int countWA = 0;
        int countTLE = 0;
        int countRE = 0;

        for (int i = 0; i < n; i++)
        {
            string r = Console.ReadLine();
            switch (r)
            {
                case "AC":
                    countAC++;
                    break;
                case "WA":
                    countWA++;
                    break;
                case "TLE":
                    countTLE++;
                    break;
                case "RE":
                    countRE++;
                    break;
            }
        }

        Console.WriteLine("AC x " + countAC);
        Console.WriteLine("WA x " + countWA);
        Console.WriteLine("TLE x " + countTLE);
        Console.WriteLine("RE x " + countRE);
    }
}


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

using namespace std;
typedef long long ll;

const int N = int(1e5) + 7;

void init(){

}

void solve(){
    int a;
    string s;
    cin >> a >> s;
    if(a < 3200) cout << "red\n";
    else cout << s << "\n";
}

int main(){
    int test_cases_number = 1;
//    scanf("%d", &test_cases_number);
//    ios_base::sync_with_stdio(0);
//    cin.tie(0); cout.tie(0);
//    cin >> test_cases_number;
    for(int i = 0; i < test_cases_number; i++)
        solve();
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdint>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <cassert>

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

using namespace std;

int main() {

  long long N = 0, M = 0;
  cin >> N >> M;

  typedef std::pair<LL,LL> P;
  std::priority_queue<P> q;

  for(size_t i=0; i<N; i++) {
    LL a;
    cin >> a;
    q.push( std::make_pair(a, 1) );
  }

  for(size_t i=0; i<M; i++) {
    LL b,c;
    cin >> b >> c;
    q.push( std::make_pair(c,b) );
  }

  LL ans = 0;
  for(size_t i=0; i<N; i++) {
    P x = q.top();
    q.pop();
    ans += x.first;
    x.second--;
    if(x.second > 0) {
      q.push(x);
    }
  }

  std::cout << ans << std::endl;

  return 0;
}



Measured memory_bytes: 6512
#include<bits/stdc++.h>
#define  ll   long long int
#define  sz   200010

using namespace std;


int main()
{


    ll n,i,j,k,d;

    cin>>n;

    while(n>0)
    {
        d=n%10;
        if(d==7)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
        n=n/10;
    }


    cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() {
  int N;
  cin >> N;
  vector<P> A(N);
  REP(i, N) {
    int a;
    cin >> a;
    A[i] = P(a, i);
  }
  sort(A.begin(), A.end(), greater<P>());
  REP(i,N){
    if(i==A[0].second){
      cout << A[1].first << endl;
    }else{
      cout << A[0].first << endl;
    }
  }
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define all(r) r.begin(),r.end()
using namespace std;
typedef int64_t ll;
typedef vector<ll> vll;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        ll n, h;
        in >> n >> h;
        vll a(n), b(n);
        ll amax = 0, ans = 0;
        for (int i = 0; i < n; i++) {
            in >> a[i] >> b[i];
            amax = max(amax, a[i]);
        }
        sort(all(b));
        reverse(all(b));
        for (int i = 0; i < n && 0 < h; i++) {
            if (b[i] > amax) {
                h -= b[i];
                ans++;
            }
            else {
                break;
            }
        }
        if (0 < h) {
            ans += (h + amax - 1) / amax;
        }
        out << ans << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<ll> A(3 * N);
  for (int i = 0; i < 3 * N; ++i) {
    cin >> A[i];
  }
  sort(A.rbegin(), A.rend());
  ll result = 0;
  for (int i = 1; i < N * 2; i += 2) {
    result += A[i];
  }
  cout << result << endl;
}

Measured memory_bytes: 2688
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include <bits/stdc++.h> 
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

char c[500][500];

bool check(int x,int m){
  rep(i,m){
    rep(j,m){
      if(c[(i+x)%m][j]!=c[(j+x)%m][i]){
        return false;
      }
    }
  }
  return true;
}

int main(){
  int n;
  cin >> n;
  rep(i,n)rep(j,n)cin >> c[i][j];
  ll ans=0;
  rep(i,n){
    if(check(i,n))ans+=n;
  }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip> 
#include <bits/stdc++.h>
using namespace std;
double pi=3.14159265358979323846264338;


bool issqt(long long k){
	if(k<=3)return true;
	long long s=(long long)sqrt(k);
	//cout<<k<<" "<<s<<endl;
	for(long long i=2;i<=s;i++)
		if(k%i==0)return false;
	return true;
}
 
 
int main() {
	int x,n;
	cin>>x>>n;
	int arr[101];
	int cur=x;
	int ind;
	for(int i=1;i<=n;i++){
		cin>>arr[i];
	}
	for(int i=0;;i++){
		bool ok=true;
		cur=x-i;
		for(int j=1;j<=n;j++){
			if(cur==arr[j]){ok=false;}
		}
		
		if(ok){cout<<cur<<endl; return 0;}
		cur=x+i;
		ok=true;
		for(int j=1;j<=n;j++){
			if(cur==arr[j]){ok=false;}
		}
		if(ok){cout<<cur<<endl;return 0;}
	}
	cout<<arr[ind]<<endl;
	
  return 0;
}



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

int main(void){
  string s;
  cin >> s;
  int i = s.at(6) - '0', j = s.at(5) - '0';
  if(i < 5 && j == 0) cout << "Heisei" << endl;
  else cout << "TBD" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N, M; cin >> N >> M;
  vector<int> A(N); for (auto &a : A) cin >> a; sort(A.rbegin(), A.rend());
  puts(4 * M * A[M - 1] >= accumulate(begin(A), end(A), 0) ? "Yes" : "No");}

Measured memory_bytes: 3636
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;

#define MAX_N 12
#define MAX_M 12

int a[MAX_N][MAX_M];

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    rep(i, n) {
        cin >> c[i];
        rep(j, m) cin >> a[i][j];
    }


    int ans = INF;
    rep(s, 1 << n) {
        int cost = 0;
        vector<int> d(m);
        rep(i, n) {
            if (s >> i & 1) {
                cost += c[i];
                rep(j, m) d[j] += a[i][j];
            }
        }
        bool ok = true;
        rep(j, m) if (d[j] < x) ok = false;
        if (ok) ans = min(ans, cost);
    }
    if (ans == INF) cout << -1 << endl;
    else cout << ans << endl;

    return 0;
}

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

int main() {
  int n,m=0;
  cin >>n;
  m = n%10;
  if(m==3){cout << "bon"<<endl;}
  else if(m==0 || m==1 || m==6 || m== 8){cout << "pon"<<endl;}
  else{cout << "hon"<<endl;}
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int saitan(int n,int k,vector<int> vec){
  int saityou = 0;
  for(int i = 0;i < k;i++){
    if(i == (k - 1)){
      int last = (vec.at(0) + n - vec.at(i));
      if(saityou < last)
        saityou = last;
      return (n - saityou);
    }
    int bef = vec.at(i),nex = vec.at(i + 1);
    if(saityou < (nex - bef))
      saityou = (nex - bef);
  }
}
int main(){
  int N,k;
  cin >> N >> k;
  vector<int> vec(k);
  for(int i = 0;i < k;i++)
    cin >> vec.at(i);
  cout << saitan(N,k,vec) << endl;
  return 0;
}


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

int main() {
	char A[4];
	for (int i = 0; i <= 3; i++) {
		cin >> A[i];
	}
	if (A[0] == A[1] && A[1] == A[2]) {
		cout << "Yes" << endl;
	}
	else if (A[1] == A[2] && A[2] == A[3]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

int main() {
  int N, step = 1;
  cin >> N;
  if (N == 1) {
    cout << 1 << endl;
    return 0;
  }

  vector<int> d(N);
  for (int i = 0; i < N; i++) { cin >> d.at(i); }
  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());
  for (int i = 0; i < N - 1; i++) {
    if (d.at(i) > d.at(i + 1)) {
      step += 1;
    }
  }
  cout << step << endl;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    int a[n][m], index[n] = {}, count[m] = {}, current = 0, result = n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
            a[i][j]--;
        }
        count[a[i][0]]++;
    }
    vector<bool> alive(m, true);
    for (int i = 1; i < m; i++) {
        for (int j = 0; j < m; j++) {
            if (alive[j] && count[j] > count[current]) {
                current = j;
            }
        }
        result = min(result, count[current]);
        alive[current] = false;
        for (int j = 0; j < n; j++) {
            count[a[j][index[j]]]--;
            while (!alive[a[j][index[j]]]) {
                index[j]++;
            }
            count[a[j][index[j]]]++;
        }

    }
    cout << result;
    return 0;
}


Measured memory_bytes: 640
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let mut a = vec![0; n];
    let mut b = vec![0; n];
    let mut c = vec![0; n-1];
    for i in 0..n {
        a[i] = read::<usize>() - 1;
    }
    for i in 0..n {
        b[i] = read::<usize>();
    }
    for i in 0..n-1 {
        c[i] = read::<usize>();
    }


    let mut ans = b[a[0]];
    let mut last = a[0];
    for i in 1..n {
        ans += b[a[i]];
        if last+1 == a[i] {
            ans += c[a[i-1]];
        }
        last = a[i];
    }

    println!("{}", ans)
}

Measured memory_bytes: 4352
n = int(input())
dat = list(input().split())

dat = list(map(int,dat))

dat.sort(reverse=True)

asum = 0
bsum = 0

for i in range(n):
	if i % 2 == 0:
		asum = asum + dat[i]
	else:
		bsum = bsum + dat[i]
		
print(asum-bsum)

Measured memory_bytes: 3064
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut numbers = vec![];
    'o: for i in 0..n {
        let s = read::<String>();
        let s = s.parse::<f64>().unwrap();
        // let s2 = (s * 10000.0).round() / 10000.0;
        let num = ((s * 10000000000.0).round() + 0.1) as i128;
        numbers.push(num);
    }
    // debug!(numbers);
    let max_idx = 20;
    let mut mutiples = vec![vec![0; max_idx + 1]; max_idx + 1];
    let mut ans = 0i128;
    for num in numbers {
        let mut num = num;
        let mut two_c = 0;
        for i in 0..max_idx {
            if num % 2 == 0 {
                two_c += 1;
                num /= 2;
            } else {
                break;
            }
        }

        let mut five_c = 0;
        for i in 0..max_idx {
            if num % 5 == 0 {
                five_c += 1;
                num /= 5;
            } else {
                break;
            }
        }
        //debug!(num, two_c, five_c);
        ans += mutiples[max_idx - two_c][max_idx - five_c];

        for i in 0..two_c + 1 {
            for j in 0..five_c + 1 {
                mutiples[i][j] += 1;
            }
        }
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 5704
n,m = map(int, input().split())

cnt = [0]*m

for i in range(n):
    survey = list(map(int, input().split()))
    k = survey[0]
    for j in range(1,k+1):
        favorite = survey[j]
        cnt[favorite - 1] += 1

print(cnt.count(n))

Measured memory_bytes: 9132
from copy import deepcopy

n, m = list(map(int, input().split()))

edges = {}
for i in range(m):
    a, b = list(map(int, input().split()))
    if not a in edges.keys():
        edges[a] = [b]
    else:
        edges[a].append(b)
    if not b in edges.keys():
        edges[b] = [a]
    else:
        edges[b].append(a)

ans = 0

nodes = edges[1]
visited = [1] + [0]*(n-1)
nodes_visited = [(node, visited) for node in nodes]
while len(nodes_visited) > 0:

    # print(nodes_visited)
    node, vstd = nodes_visited[0]
    vstd = deepcopy(vstd)
    nodes_visited = nodes_visited[1:]

    vstd[node-1] = 1
    if min(vstd) > 0:
        ans += 1
        continue

    for node_next in edges[node]:
        if vstd[node_next-1] == 1:
            continue
        else:
            nodes_visited.append((node_next, vstd))

print(ans)

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

long long int B[110]; 
int main(void) {
    int N;
    cin >> N;
    for (int i=1;i<=N-1;i++)
        cin >> B[i];
    B[0]=B[1];
    B[N]=B[N-1];

    long long int ans=0;
    for (int i=1;i<=N;i++)
    {
        ans += min(B[i-1],B[i]);
    }

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


Measured memory_bytes: 256