akhauriyash/Code-Regression huggingface dataset:
#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>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

ll sum(ll l, ll r) {
  return (l+r)*(r-l+1)/2;
}

int main() {
  int n, k;
  cin >> n >> k;
  mint ans;
  for (int i = k; i <= n+1; ++i) {
    ll l = sum(0,i-1), r = sum(n-i+1,n);
    ans += r-l+1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
using namespace         std;
#define                 int long long
#define                 double long double
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<endl
#define                 endl '\n'              
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 1014159
#define  vi vector<int>
#define  v  vector
#define die exit(0)
using namespace __gnu_pbds;  
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update> oset; 
gp_hash_table<int, int> table;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
struct chash {
    int operator()(int x) const { return x ^ RANDOM; }
};



void solve()
{
	int n;
	cin>>n;
	if(n%2)
	{
		cout<<0<<"\n";
		return;
	}   
	int ans = 0;
	int ct = 1;
	while(n)
	{
		int x = n/5;
		x/=2;
		//x*=ct++;
		ans+=x;
		n/=5;
	}
	cout<<ans<<"\n";
}


signed main() 
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    int t = 1;
    //cin>>t;
    forn(i,1,t)
    {
        solve();
        nl;
    }



    return 0;

}

//       clang++ c.cpp ; ./a.out < a.txt ;  ./a.out < b.txt  ;./a.out < c.txt

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define exists(s,x) (s).find(x)!=(s).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)
#define fi first
#define se second
typedef long long ll;
const ll INF = 1LL<<60;
const ll MOD = 1000000007;

inline ll add(ll x, ll y) {return (x+y)%MOD;}
inline ll mul(ll x, ll y) {return (x*y)%MOD;}
inline ll sub(ll x, ll y) {
    ll res = x - y;
    if(res < 0) res += MOD;
    return res;
}
inline ll modpow(ll x, ll y) {
    ll res = 1;
    while(y) {
        if(y&1) res = mul(res,x);
        y >>= 1;
        x = mul(x,x);
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    ll s;
    vector<ll> C(N);
    REP(i,N){
        ll a, b; cin >> a >> b;
        s -= b;
        C[i] = a + b;
    }
    sort(all(C),greater<ll>());
    for(int i=0; i<N; i+=2) {
        s += C[i];
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
map<int,int>mp;
int main()
{
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,y,a[100005],i,j,b[100005],d;
    cin>>n>>y;
    for(i=0; i<n; i++)
    {
        cin>>a[i]>>b[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    ll sum=0,c=0;
    for(int i=n-1; i>=0; i--)
    {
        if(a[n-1]<=b[i])
        {
            c++;
            sum+=b[i];
            if(sum>=y)
                break;
        }
        else
            break;
    }
    if(sum>=y)
        cout<<c<<endl;
    else if((y-sum)%a[n-1]==0)
    {
        cout<<c+(y-sum)/a[n-1]<<endl;
    }
    else
        cout<<c+(y-sum)/a[n-1]+1<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

using namespace std;
using ll = long long;

int main(){
    int n;
    cin>>n;
    ll ans=0;
    for(int i=0;i*i<=n;i++){
        ans=i*i;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
using namespace std;
int main() {
    long long n;
    cin>>n;
    if(n==1)cout<<0<<endl;
    else cout<<(n*(n-1))/2<<endl;
    return 0;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
for c in range(0,C+1):
	if c*50 > X :
		break
	for b in range(0,B+1):
		if c*50+b*100 > X:
			break
		for a in range(0,A+1):
			if a*500+b*100+c*50 > X:
				break
			if a*500+b*100+c*50 == X:
				count += 1
print(count)

Measured memory_bytes: 3064
from enum import Enum

class Color(Enum):
  WHITE = 0
  GRAY = 1
  BLACK = 2

def dfs_visit(u, total_time):
  colors[u] = Color.GRAY
  total_time += 1
  d[u] = total_time
  stack.append(u)
  for v in range(N):
    if adj[u][v] == 1 and colors[v] == Color.WHITE:
      total_time = dfs_visit(v, total_time)
  colors[u] = Color.BLACK
  total_time += 1
  f[u] = total_time
  return total_time



def dfs(total_time):
  for i in range(N):
    if colors[i] != Color.WHITE:
      continue
    total_time = dfs_visit(i, total_time)

N = int(input())
L = [list(map(int, input().split())) for i in range(N)]
adj = [[0 for i in range(N)] for j in range(N)]

for i in range(N):
  for node in L[i][2:]:
    adj[i][node-1] = 1

colors = [Color.WHITE for i in range(N)]
stack = []
total_time = 0
d = [0 for i in range(N)]
f = [0 for i in range(N)]

dfs(total_time)

for i in range(N):
  print(i+1, d[i], f[i])



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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

template<typename T>
bool sign(T x, T y) {
    if(x == 0 || y == 0)
        return false;
    return x/abs(x) == y/abs(y);
}

int main() {
    LL N;
    cin >> N;
    LL A[N];
    REP(i, N) {
        cin >> A[i];
    }
    LL res = 0;
    LL sum = 0;
    LL x = 1;
    REP(i, N) {
        sum += A[i];
        if(sum == 0) {
            sum += x;
            res += 1;
        }else{
            if(!sign(x, sum)) {
                res += abs(x - sum);
                sum = x;
            }
        }
        x *= -1;
    }
    LL res2 = 0;
    sum = 0;
    x = -1;
    REP(i, N) {
        sum += A[i];
        if(sum == 0) {
            sum += x;
            res2 += 1;
        }else{
            if(!sign(x, sum)) {
                res2 += abs(x - sum);
                sum = x;
            }
        }
        x *= -1;
    }
    cout << min(res, res2) << endl;
    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>

int main() {
	char c;

	std::cin >> c;

	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
		std::cout << "vowel" << std::endl;
	}
	else {
		std::cout << "consonant" << std::endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;

int gcd(int a, int b)
{
    int c;

    if (a < b) {
        a+=b; b=a-b; a-=b;
    }

    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }

    return a;
}

int main(){
	int N;
	long long A[100000];
	long long K;

	scanf("%d %lld",&N,&K);
	for(int i=0;i<N;i++){
		scanf("%lld", &A[i]);
	}

	long long max = A[0];
	long long min = A[0];
	for(int i=0;i<N;i++){
		if(max < A[i]) max = A[i];
		if(min > A[i]) min = A[i];
		if(K==A[i]){
			printf("POSSIBLE\n");
			return 0;
		}
	}

	if(K > max){
		printf("IMPOSSIBLE\n");
		return 0;
	}else{
		int c = A[0];
		if(N > 1) int c = gcd(A[0],A[1]);
		for(int i=1;i<N;i++){
			c = gcd(c,A[i]);
		}
		if(K%c==0){
			printf("POSSIBLE\n");
			return 0;
		}else{
			printf("IMPOSSIBLE\n");
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
int max(int a , int  b){
  if(a > b) return a;
  else return b;

}
int min(int a , int b){
  if(a < b) return a;
  else return b;
}
bool cmp(pair < int , string >   a , pair < int , string >   b){
  if(a.first < b.first ) return true;
  else return false;
}
long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int dp[3005][3005];
pair < int , int  >  point[3005][3005];
int pos[3005][3005];
int32_t main(){  
  fast;
  string s,t;
  cin >> s >> t;
  for(int i = 0 ; i <= s.size();i++){
    for(int j = 0 ; j<=t.size();j++) pos[i][j]=-1;
  }
  for(int i = 1 ; i <=  s.size() ; i++){
    for(int j = 1 ; j <= t.size() ; j++){
      if(s[i-1] == t[j-1]){
        dp[i][j] = 1+dp[i-1][j-1];
        pos[i][j] = i;
        point[i][j] = {i-1,j-1}; 
      }
      else{
       dp[i][j] = max(dp[i-1][j] , dp[i][j-1]); 
        if(dp[i-1][j] > dp[i][j-1]) {
            point[i][j] = {i-1,j};
        }
        else{
          point[i][j] = {i,j-1};
        }
    }
  }
}
  int i  = s.size();
  int j = t.size();
  string ans = "";
  while(i>=1 && j>=1){
    if(pos[i][j] !=-1) ans = s[i-1]+ans;
    auto tmp = point[i][j];
    i = tmp.first;
    j = tmp.second; 
  }
  cout << ans << "\n";
  return 0;
} 

/*
1 -- 0
2 -- 

...
30 -- 3
..
49- --3
50 -- 4
60 -- 5
--
69 - 
70 -- 

subset sum = 100
100
100 - 

x  <=ww

*/

Measured memory_bytes: 282368
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define MAX 100000
#define INF 2140000000
#define MOD 1000000007

int main() {
	string s;
	int parity[26] = {0};
	bool flag = 1;

	cin >> s;

	for (int i = 0; i < s.size(); ++i) {
		parity[s[i] - 'a']++;
	}

	for (int i = 0; i < 26; ++i) {
		if (parity[i] % 2) {
			flag = 0;
		}
	}

	if (flag) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>
#include <sstream>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

/*
0のアスキー　"48"
*/

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) x.begin(),x.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

ll ninokosu(ll X){
    ll c = 0;
    while(X % 2 == 0){
        X /= 2;
        c++;
    }
    return c;
}

int main(){
    ll N;
    cin >> N;
    vector<ll>A(N);
    for(ll i = 0;i < N;i++)
        cin >> A.at(i);
    ll res = 0;

    for(ll i = 0;i < N;i++){
        res += ninokosu(A.at(i));
    }

    cout << res << endl;
}





    

Measured memory_bytes: 3716
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder_ensyuu1
{
    class Program
    {
        private static void Main(string[] args)
        {
            int[] values = GetConsole();

            if (values[0] < 1 || values[0] > 100)
            {
                Console.WriteLine("error");
                return;
            }

            if (values[1] < 0 || values[1] > 4111)
            {
                Console.WriteLine("error");
                return;
            }

            int rating = values[1];
            if (values[0] < 10)
            {
                rating = rating + 100 * (10 - values[0]);
            }
            Console.WriteLine(rating);
        }

        private static int[] GetConsole()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

    }
}



Measured memory_bytes: 13268
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int g = sc.nextInt();
		int b = sc.nextInt();
		int n = sc.nextInt();
		int count = 0;
		int sum = 0;
		for (int i = 0; i <= n / r; i++) {
			for (int j = 0; j <= n / g; j++) {
				if (i * r + j * g > n) {
					break;
				}
				if ((n - (i * r + j * g)) % b == 0) {
					++count;
				}
			}
		}
		System.out.println(count);
	}
	/*
	public static int p(int num, int end, int result) {
		if (num < end) {
			return result;
		} else {
			return p(num - 1, end, result * num);
		}
	}
	
	public static int c(int num, int end, int result, int result2) {
		if (num < end) {
			return result;
		} else {
			return p(num - 1, end, result * num) / p(end, 1, result2);
		}
	}
	 */
}


Measured memory_bytes: 23636
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include <algorithm> // sort
#include <map> // pair
using namespace std;

int main(){
  int n,m;
  cin >> n >> m;
  pair<long long,long long> a[n+m];
  long long b[m],c[m];
  long long x,y;
  for(int i=0;i<n;i++){
    cin >> x;
    a[i].first = -x;
    a[i].second=1;
  }
  for(int i=0;i<m;i++){
    cin >> x >> y;
    b[i] = x;
    c[i] = -y;
  }
  for(int i=0;i<m;i++){
    a[n+i]=make_pair(c[i],b[i]);
  }
  sort(a,a+n+m);
  // for(auto itr=a.begin();itr != a.end();itr++){
  //   cout << *itr;
  // }
  // for(int i=0;i<n+m;i++){
  //   cout << a[i].first << endl;
  // }
  long long sum=0;
  int j=0;
  for(int i=0;i<n;){
    if(a[j].second != 0){
      sum += -a[j].first;
      a[j].second--;
      //cout << -a[j].first << endl;
      i++;
    }else{
      j++;
    }
  }
  cout << sum;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n,k;
  cin >> n >> k;
  vi a(n);
  rep(i,n)cin >> a[i];
  sort(rng(a),greater<int>());
  int ans = 0;
  rep(i,k){
    ans+=a[i];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=200000+19;

struct Edge{
	int y,nxt;
} E[N*2];
int las[N],fa[N],vis[N],onc[N],A[N],tmp[N],T[N],val[N],pa[N];
int n,cnt,Time,pre,u,v,x,y,rt;

void Add_Edge(int x,int y){
	E[cnt]=(Edge){y,las[x]};las[x]=cnt++;
}
int getf(int x){
	return pa[x]==x?x:pa[x]=getf(pa[x]);
}
void Union(int x,int y){
	x=getf(x),y=getf(y);
	if (x!=y) pa[x]=y;
}
void dfs(int x){
	vis[x]=1;
	for (int i=las[x],y;~i;i=E[i].nxt){
		y=E[i].y;
		if (!vis[y]){
			fa[y]=x;
			dfs(y);
		} else{
			u=x,v=y;
		}
	}
}
void calc(int x){
	for (int i=las[x];~i;i=E[i].nxt) calc(E[i].y);
	Time++;
	for (int i=las[x];~i;i=E[i].nxt) T[val[E[i].y]]=Time;
	val[x]=0;
	while (T[val[x]]==Time) val[x]++;
}
void Work(){
	For(s,2,*A+1){
		int x=A[s];
		for (int i=las[x],y;~i;i=E[i].nxt) if (!onc[y=E[i].y]) calc(y);
		Time++;
		for (int i=las[x],y;~i;i=E[i].nxt) if (!onc[y=E[i].y]) T[val[y]]=Time;
		T[val[A[s-1]]]=Time;
		val[x]=0;
		while (T[val[x]]==Time) val[x]++;
	}
}

int main(){
	memset(las,-1,sizeof(las));
	n=IN();
	For(i,1,n+1) pa[i]=i;
	For(i,1,n+1){
		x=IN(),y=i;
		Add_Edge(x,y);
		if (getf(x)!=getf(y)){
			Union(x,y);
		} else{
			rt=x;
		}
	}
	dfs(rt);
	for (int w=u;w!=v;w=fa[w]){
		onc[w]=1;
		A[++*A]=w;
	}
	onc[v]=1;
	A[++*A]=v;
	for (int i=las[u],y;~i;i=E[i].nxt)
		if ((y=E[i].y)!=v){
			calc(y);
			tmp[val[y]]=1;
		}
	val[u]=0;
	while (tmp[val[u]]) val[u]++;
	Work();
	if (val[A[*A]]!=val[u]){
		puts("POSSIBLE");
		return 0;
	}
	pre=val[u];
	val[u]++;
	while (tmp[val[u]]) val[u]++;
	Work();
	if (val[A[*A]]==pre){
		puts("POSSIBLE");
		return 0;
	}
	puts("IMPOSSIBLE");
}

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

int main(){
    long int N;
    cin>>N;
    
    long int ans=0;
    for(long int i=1;i<=N;i++){
        long int count=0;
        for(int j=i;j>0;j/=10){
           count+=1;
        }
        if(count%2==1)ans+=1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int r,c;
	int sheet[101][101] = {};
	int sum=0;
	scanf("%d%d",&r,&c);
	for(int i=0;i<r;i++){
		for(int j=0;j<c;j++){
			scanf("%d",&sheet[i][j]);
			//printf("%d ",sheet[i][j]);
			sheet[i][c]+=sheet[i][j];
		}
	}
	for(int i=0;i<=r;i++){
		for(int j=0;j<=c;j++){
			printf("%d",sheet[i][j]);
			if(j!=c)printf(" ");
			sheet[r][j] += sheet[i][j];
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+1;

int val[N];
int n;

inline int read(){
   int out = 0;char ch;
   for(ch = getchar();ch > '9' || ch < '0';ch = getchar());
   for(;ch >= '0' && ch <= '9';ch = getchar())
      out = (out<<3)+(out<<1)+(ch&15);
   return out;
}
struct edge{
   int tail[N],to[N],nxt[N],tot;
   inline void add_edge(int x,int y){
      to[++tot] = y; nxt[tot] = tail[x]; tail[x] = tot;
   }
}e;

int v[16],f[1<<17];
int deg[N];
int main(){
   n = read();
   for(int i = 1;i < n; ++i){
      int u,v,w;
      u = read(); v = read(); w = read();deg[u] ^= w; deg[v] ^= w;
   }
   for(int i = 0;i < n; ++i)v[deg[i]] += 1;
   int ans = 0;
   int ps = 0;
   for(int i = 0;i < 16; ++i){
      if(i)ans += v[i]/2; v[i] %= 2;
      if(i)ps |= (1<<(i-1))*v[i];
      //cerr << i <<' ' << v[i] << ' ' << deg[i] << endl;
   }
   //cerr << ps <<' ' << ans << endl;
   memset(f,0x3f,sizeof f);
   f[ps] = 0;

   for(int i = (1<<16)-1;i > 0; --i){
      if(f[i] == 0x3f3f3f3f)continue ;
      for(int j = 0;j < 15; ++j)
         for(int k = j+1;k < 15; ++k){
            if(((1 << j) & i) && ((1<<k)&i)){
               int pi = (i ^ (1<<(j))); pi ^= (1<<(k));
               int w = ((j+1)^(k+1));
               if(pi & (1<<(w-1)))f[pi^(1<<(w-1))] = min(f[pi^(1<<(w-1))],f[i]+2);
               else f[pi^(1<<(w-1))] = min(f[pi^(1<<(w-1))],f[i]+1);
            }
         }
   }
   printf("%d\n",f[0]+ans);
   return 0;
}


Measured memory_bytes: 3328
n=int(input())
ls=list(input())
nums={'0':[],'1':[],'2':[],'3':[],'4':[],'5':[],'6':[],'7':[],'8':[],'9':[]}
for idx,num in enumerate(ls):
    nums.setdefault(num,[]).append(idx)
count=0
for i in range(1000):
    i_zero=str(i).zfill(3)
    cand=list(i_zero)
    first_ls=nums.get(cand[0])
    if not first_ls:
        continue
    first=first_ls[0]
    last_ls=nums.get(cand[2])
    if not last_ls:
        continue
    last=last_ls[-1]
    second_ls=nums.get(cand[1])
    flag=False
    for j in second_ls:
        if j>first and j<last:
            flag=True
    if flag:
        count+=1
print(count)

Measured memory_bytes: 4596
#include <stdio.h>

int main() {
	int i, j, k, n, v;
	int a[100];

	scanf("%d", &n);

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

	for (i = 0; i < n; i++) {
		v = a[i];
		j = i - 1;

		while (j >= 0 && a[j] > v) {
			a[j+1] = a[j];
			j--;
		}
                a[j+1] = v;
		for (k = 0; k < n - 1; k++) {
			printf("%d ", a[k]);
		}

		printf("%d\n", a[n - 1]);
	}

	return 0;
}

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

const int maxm = 105;
const int maxn = 1e5 + 7;
int dp[maxn], num[maxm];
int N, K;

int f(int st) {
  if (st < 0) {
    return 1;
  }
  if (dp[st] != -1)
    return dp[st];
  int ret = 0;
  for (int i = 0; i < N; i++) {
    int x = f(st - num[i]);
    if (x == 0) {
      ret = 1;
      break;
    }
  }
  return dp[st] = ret;
}

int main() {
  cin >> N >> K;
  fill(dp, dp + maxn, -1);
  dp[0] = 0;
  for (int i = 0; i < N; i++) {
    cin >> num[i];
  }
  int res = f(K);
  if (res == 1)
    cout << "First" << endl;
  else
    cout << "Second" << endl;
}


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

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

    if (A % 3 == 0
    ||  B % 3 == 0
    ||  (A+B) % 3 == 0) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
}

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

int main(){
    string S, T;
    int count = 0;
    cin >> S;
    cin >> T;
    for(int i = 0; i < 3; i++){
        if(S[i] == T[i]){
            count++;
        }
    }
    cout << count;
    return 0;
}

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

int main() {
  string S;
  cin >> S;
  
  string ans = "Yes";

  for (int i = 0; i < S.length(); i++) {
	if (i % 2 == 0) {
      if (S[i] == 'L') {
        ans = "No";
        break;
      };
    }
	else if (i % 2 == 1) {
      if (S[i] == 'R') {
        ans = "No";
        break;
      }
    }
  }
  
  cout << ans << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
using namespace std;
int main() {
	
	int a, b, d, r;
	double A, B, f;

	cin >> a >> b;
	A = a;
	B = b;

	d = a / b;
	r = a % b;
	f = A / B;

	cout << d << " " << r << " " << fixed << setprecision(5) << f << endl;

	
}


Measured memory_bytes: 3276
a,b = input().split()
a1 = int(a)
bs = list(b)
b1 = int(bs[0])
b2 = 0
if len(b)==3:
    b2 = int(bs[2])*10
else:
    b2 = int(bs[2]+bs[3])
b1 = b1*100+b2
ans = list(str(a1*b1))
del ans[-1]
if ans:
    del ans[-1]
if ans:
    print(''.join(ans))
else:
    print(0)

Measured memory_bytes: 9072
x1, y1, x2, y2 = map(int,input().split())
x12 = x2 - x1
y12 = y2 - y1
x3 = x2 - y12
y3 = y2 + x12
x4 = x3 -x12
y4 = y3 -y12
print(x3, y3, x4, y4)

Measured memory_bytes: 8908
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ATwoCoins solver = new ATwoCoins();
        solver.solve(1, in, out);
        out.close();
    }

    static class ATwoCoins {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            out.println(a + b >= c ? "Yes" : "No");
        }

    }
}



Measured memory_bytes: 21844
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

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

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    LL a,b,n;
    cin>>a>>b>>n;

    VL kouho;
    kouho.PB(b-1);
    kouho.PB(n);
    kouho.PB((n/b)*b-1);

    LL result = 0;

    REP(i,SIZE(kouho)){
        LL x = kouho[i];
        if(x > n){
            continue;
        }
        LL f = a*x/b - a*(x/b);
        result = max(result,f);

    }

    cout<<result<<endl;



	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
using namespace std;
int main(void){
    
    int H, W;
    cin >> H >> W;
    char a[102][102];
    
    for(int i = 0; i <= H+1; i++){
        for(int j = 0; j <= W+1; j++){
            if(i == 0 || i == H+1 || j == 0 || j == W+1) a[i][j] = '#';
            else cin >> a[i][j];
            
        }
    }
    
    for(int i = 0; i <= H+1; i++){
        for(int j = 0; j <= W+1; j++){
            cout  << a[i][j];
        }cout << endl;
    }
 
} 

Measured memory_bytes: 3100
/**
 *  author: MOOONI
 *  hackers are welcome!
**/
#include <bits/stdc++.h>

#define debug(x) cerr << #x << " = " << x << endl

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k;
  cin >> k;
  string s;
  cin >> s;
  string res = "";
  for (int i = 0; i < (int) s.size(); i++) {
    if (i + 1 > k) {
      res += "...";
      cout << res << '\n';
      return 0;
    } 
    res += s[i];
  }
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define int long long 

using namespace std ;

int n; 
int a[20];
int x[20][20],y[20][20];

int32_t main(){
        ios_base::sync_with_stdio(0); cin.tie(0);

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

        cin >> n; 
        for(int i = 0 ; i < n ; i++ ){
                cin >> a[i] ;
                for(int j = 0 ; j < a[i] ; j++ ){
                        cin >> x[i][j] >> y[i][j];
                        x[i][j]--;
                }
        }
        int ans = 0 ;
        for(int bits = 1 ; bits < (1<<(n)) ; bits++ ){
                bool flag = true; 
                for(int i = 0 ; i < n ; i++ ){
                        if(!(bits & (1<<i))) continue;
                        for(int j = 0 ; j < a[i] ; j++ ){
                                if( (bits >> x[i][j] & 1)^y[i][j] )
                                        flag = false ;
                        }
                }
                if(flag)
                        ans = max(ans,(int)__builtin_popcount(bits));
        }
        cout << ans << endl; 
        return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<limits.h>
int main(void)
{
	int n,x[101],min=101,max=-101,min2=INT_MAX,g,i,j;
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%d", &x[i]);
		if(min>x[i])
		min=x[i];
		if(max<x[i])
		max=x[i];
	}
	for(i=min; i<=max; i++){
		g=0;
		for(j=0; j<n; j++){
			g+=abs(x[j]-i)*abs(x[j]-i);
		}
		if(min2>g){
			min2=g;
		}
	}
	printf("%d\n", min2);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define nyan "(=^･ω･^=)"
using namespace std;

const int mod = 1e9 + 7;
const long long INF = 1LL<<60;
using ll = long long;
using P = pair<int,int>;

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

int main(){
    int n;
    cin >> n;
    
    int ans = 0;
    
    vector<int> B(n+1);
    rep(i, n) cin >> B[i+1];
    
    // a[1] = b[1]
    ans += B[1];
    
    for (int i = 2; i <=n-1; i++) ans += min(B[i-1], B[i]);
    
    ans += B[n-1];
    
    cout << ans <<endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(scn.nextInt());
		}
		Collections.reverse(list);
		for (int i = 0; i < list.size(); i++) {
			if (i == list.size() - 1) {
				System.out.print(list.get(i));
			} else {
				System.out.print(list.get(i) + " ");
			}
		}
		System.out.println();
	}
}



Measured memory_bytes: 26304
#include <bits/stdc++.h>
using namespace std;
const int MAX_H = 20;
const int MAX_W = 20;
int H, W, ans = 0;
vector<vector<char>> Grid(MAX_H, vector<char>(MAX_W));
vector<vector<int>> D(MAX_H, vector<int>(MAX_W, -1));
queue<pair<int, int>> Q;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

void search()
{
  while (!Q.empty())
  {
    pair<int, int> xy = Q.front();
    Q.pop();
    int x = xy.first;
    int y = xy.second;
    for (int i = 0; i < 4; i++)
    {
      int next_x = x + dx[i];
      int next_y = y + dy[i];
      if (next_x < 0 || next_y < 0 || next_x >= W || next_y >= H)
      {
        continue;
      }
      if (Grid.at(next_y).at(next_x) == '#' || D.at(next_y).at(next_x) != -1)
      {
        continue;
      }
      D.at(next_y).at(next_x) = D.at(y).at(x) + 1;
      Q.push(make_pair(next_x, next_y));
    }
  }
}

void findAnsAndReset()
{
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      ans = max(ans, D.at(i).at(j));
      D.at(i).at(j) = -1;
    }
  }
}

int main()
{
  cin >> H >> W;
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      cin >> Grid.at(i).at(j);
    }
  }

  for (int sx = 0; sx < W; sx++)
  {
    for (int sy = 0; sy < H; sy++)
    {
      if (Grid.at(sy).at(sx) == '#')
      {
        continue;
      }
      Q.push(make_pair(sx, sy));
      D.at(sy).at(sx) = 0;
      search();
      findAnsAndReset();
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    long long int x,ans = 0,y=100;
    cin>>x;
    while(y<x)
    {
    	y = y + (0.01*y);
    	ans ++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main(){
  int m,f,r;
  cin >> m >> f >> r;
  while(m!=-1||f!=-1||r!=-1){
    if(m==-1||f==-1) cout << "F" << endl;
    else if(m+f>=80) cout << "A" << endl;
    else if(m+f>=65) cout << "B" << endl;
    else if(m+f>=50) cout << "C" << endl;
    else if(m+f>=30)
      if(r>=50) cout << "C" << endl;
      else cout << "D" << endl;
    else cout << "F" << endl;

    cin >> m >> f >> r;
  }
  return 0;
}



Measured memory_bytes: 3080
N, M = map(int, input().split())
students = list()
points = list()
for i in range(0, N):
    coord = list(map(int, input().split()))
    students.append(coord)
for i in range(0, M):
    coord = list(map(int, input().split()))
    points.append(coord)
for student in students:
    min_dis = 4000000000
    ans = 0
    m = 0
    for point in points:
        m += 1
        temp = abs(student[0] - point[0]) + abs(student[1] - point[1])
        if min_dis > temp:
            min_dis = temp
            ans = m
    print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define loop(i,a,b)           for(ll i=a;i<=b;++i)
#define boost				  ios_base::sync_with_stdio(0);cin.tie(NULL);
#define pb                    push_back
#define F                     first
#define S                     second
#define mp                    make_pair
#define clr(x)                x.clear()
#define MOD                   1000000007
#define itoc(c)               ((char)(((int)'0')+c))
#define all(p)                p.begin(),p.end()
#define iscn(num)             scanf("%d",&num);
#define scn(num)              scanf("%lld",&num);
#define scn2(num,num2)        scanf("%lld%lld",&num,&num2);
#define dbg(x)                cerr <<"( "<<#x << " = " << x << " )"<<endl
using namespace std;
template<class T >T set_bit(T N,T pos){return N=N | (1<<pos);}
template<class T >T reset_bit(T N,T pos){return N= N & ~(1<<pos);}
template<class T > bool check_bit(T N,T pos){return (bool)(N & (1<<pos));}
template <class T > void max_self(T &a, T b){
	a=max(a,b);
}
template <class T > void min_self(T &a, T b){
	a=min(a,b);
}
////////////////////////

const ll INF = 2e18 + 99;
typedef pair<ll,ll> Pair;
typedef vector<int> vec;;

void ara_read(vec &v,ll n){
	ll temp;
	for(ll i=0; i< n; i++){
		scanf("%lld",&temp);
		v.emplace_back(temp);
	}
}
void print_ara(vec &v){
	for(ll x : v)
		printf("%lld ",x);
	puts("");
}
////////////////////////

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

int main()
{
	int n; scanf("%d",&n);
	int com[n][n];
	const int nax = (1<<n) ;
	loop(i,0,n-1){
		loop(j,0,n-1){
			scanf("%d",&com[i][j]);
		}
		
	}
	vector < int > dp(nax);
	dp[0] = 1;
	loop(mask,0,nax-2){
		int cnt = __builtin_popcount(mask);
		loop(x,0,n-1){
			if(com[cnt][x] && !check_bit(mask,x)){
				int temp = mask ^ (1 << x);
				add_self(dp[temp],dp[mask]);
			}
		}
	}
	
	printf("%d\n",dp[nax-1]);
	
    return 0;
}


Measured memory_bytes: 8448
#include <algorithm>
#include <climits>
#include <cstring>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;
using ll = long long;

const int NMAX = 1e2 + 11;
const int VMAX = 1e3 + 11;

int n, c, v_max, w[NMAX], v[NMAX];
ll  mem[NMAX][VMAX];

ll solve(void)
{
    v_max = accumulate(v + 1, v + n + 1, 0);
    vector<vector<ll>> mem(n + 1, vector<ll>(v_max + 1, (ll)1e12));
    for (int i = 0; i <= n; ++i)
        mem[i][0] = 0;

    for (int i = 1; i <= n; ++i)
    {
        for (int vacc = 1; vacc <= v_max; ++vacc)
        {
            ll &ans = mem[i][vacc];
            if (vacc - v[i] >= 0)
                ans = min(w[i] + mem[i - 1][vacc - v[i]], mem[i - 1][vacc]);
            else
                ans = mem[i - 1][vacc];
        }
    }

    int ans = 0;
    for (int vacc = 1; vacc <= v_max; ++vacc)
        if (mem[n][vacc] <= c)
            ans = vacc;

    return ans;
}

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

    for (int i = 1; i <= n; ++i)
        cin >> w[i] >> v[i];

    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 80256
weather = input()
suc_rain = 0
suc_rain_max = 0
for s in weather:
    if s == 'R':
        suc_rain += 1
    else:
        suc_rain = 0
    suc_rain_max = max(suc_rain_max, suc_rain)
print(suc_rain_max)


Measured memory_bytes: 9024
import java.util.*;

class Main {
	static final long M = 998244353;

	static class BIT {
		private int n;
		private int[] a;

		BIT(int _n) {
			n = _n + 1;
			a = new int[n];
		}

		public int sum(int i) {
			int s = 0;
			for (int index = i; index > 0; index -= (index & -index)) {
				s += a[index];
			}
			return s;
		}

		public void add(int i, int x) {
			for (int index = i; index < n; index += (index & -index)) {
				a[index] += x;
			}
		}
	}


	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] xy = new int[n][2];
		NavigableMap<Integer, Integer> hx = new TreeMap<>();
		NavigableMap<Integer, Integer> hy = new TreeMap<>();
		for (int i = 0; i < n; i++) {
			xy[i][0] = sc.nextInt();
			xy[i][1] = sc.nextInt();
			hx.put(xy[i][0], 0);
			hy.put(xy[i][1], 0);
		}

		int index = 0;
		for (Integer i : hx.keySet()) hx.put(i, index++);
		index = 0;
		for (Integer i : hy.keySet()) hy.put(i, index++);

		for (int i = 0; i < n; i++) {
			xy[i][0] = hx.get(xy[i][0]);
			xy[i][1] = hy.get(xy[i][1]);
		}

		Arrays.sort(xy, (a, b) -> Integer.compare(a[0], b[0]));
		long[] a = new long[n];
		long[] b = new long[n];
		long[] c = new long[n];
		long[] d = new long[n];
		BIT bit = new BIT(n + 1);
		for (int i = 0; i < n; i++) {
			int y = xy[i][1] + 1;
			a[i] = bit.sum(y);
			b[i] = i - a[i];
			bit.add(y, 1);
		}
		long[] t = a;
		a = c;
		c = t;

		t = b;
		b = d;
		d = t;
		bit = new BIT(n + 1);
		for (int i = n - 1; i >= 0; i--) {
			int y = xy[i][1] + 1;
			a[i] = bit.sum(y);
			b[i] = (n - 1 - i) - a[i];
			bit.add(y, 1);
		}

		long answer = 0;
		for (int i = 0; i < n; i++) {
			//System.out.printf("%d %d %d %d\n", a[i], b[i], c[i], d[i]);
			answer = (answer + f(a[i], b[i], c[i], d[i])) % M;
		}
		System.out.println(answer);
	}

	private static long pow(long x, long n, long M) {
		long a = 1;
		while (n > 0) {
			if ((n & 1) == 1) a = (a * x) % M;
			x = (x * x) % M;
			n >>= 1;
		}
		return a;
	}

	private static long f(long a, long b, long c, long d) {
		long result = 0;
		long[] abcd = {a, b, c, d};
		long[] o = new long[4];
		long[] ox = new long[4];
		for (int i = 0; i < 4; i++) {
			ox[i] = pow(2, abcd[i], M);
			o[i] = ox[i] - 1;
		}
		result += (((((ox[0] * o[1]) % M) * o[2]) % M) * ox[3]) % M;
		result += (((((o[0] * ox[1]) % M) * ox[2]) % M) * o[3]) % M;
		result -= (((((o[0] * o[1]) % M) * o[2]) % M) * o[3]) % M;
		if (result < 0) result += M;
		result += (((((ox[0] * ox[1]) % M) * ox[2]) % M) * ox[3]) % M;
		return result % M;
	}
}


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

int main(){
  int A,B,M,i;
  cin >> A >> B >> M;
  vector<int> a(A);
  vector<int> b(B);
  vector<tuple<int,int,int>> c(M);

  int mina = 0;
  for(i=0;i<A;++i){
    cin >> a.at(i);
    if(mina==0)
      mina = a.at(i);
    mina = min(mina,a.at(i));
  }
  int minb = 0;
  for(i=0;i<B;++i){
    cin >> b.at(i);
    if(minb==0)
      minb = b.at(i);
    minb = min(minb,b.at(i));
  }
  int minsum = mina+minb;
  for(i=0;i<M;++i)
    cin >> get<0>(c.at(i)) >> get<1>(c.at(i)) >> get<2>(c.at(i));

  for(i=0;i<M;++i){
    minsum = min(minsum,a.at(get<0>(c.at(i))-1)+b.at(get<1>(c.at(i))-1)-get<2>(c.at(i)));
  }
  cout << minsum;

}


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

#define ll long long
#define mod 1000000007

int n;

int  dp[3005][3005];

int  t;

pair<int,int>p[3005];



int func(int pos,int tot)
{
    if(pos==n)return 0;

    if(dp[pos][tot]!=-1)return dp[pos][tot];

    ll re=0,re1=0;

    if(tot+p[pos].first<t)re=p[pos].second+func(pos+1,tot+p[pos].first);
    else re=p[pos].second;

    re1=func(pos+1,tot);

    return dp[pos][tot]=max(re,re1);
}

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

   memset(dp,-1,sizeof dp);

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

   sort(p,p+n);

   printf("%d\n",func(0,0));

    return 0;
}


Measured memory_bytes: 35712
#include <algorithm>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <utility>
#include <vector>

int main() {
  size_t N, K;
  std::cin >> N >> K;

  double ans = 0;
  for (size_t i = 1; i <= N; i++) {
    double add = 1.0 / N;
    size_t now = i;
    while (now < K) {
      now *= 2;
      add /= 2;
    }
    ans += add;
  }

  std::cout << std::fixed << std::setprecision(12) << ans << std::endl;
  return 0;
}


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

using namespace std;
using   ll=long long;

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

#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define pll				pair<int , int>
#define int             long long int
#define endl            "\n"

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			998244353

ll mod_pow(ll a,ll b,ll m)
{
    ll res = 1;
    while(b)
    {
        if(b&1)
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(int a , int m)
{
	return mod_pow(a , m - 2 , m);
}

void solve() {
	
	int n;
	
	cin >> n;
	
	int dp[n+1] {};
	
	int sm = 0;
	
	for(int i = 1; i < n; ++i) {
		for(int j = i; j < n; j += i) {
			dp[j]++;
		}
		
		sm += dp[i];
	}
	
	cout << sm;
	
}

signed main() {
	fast;
   
    int t = 1;

	//cin >> t;

    while(t--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 11388
#include<iostream>
#include<unordered_map>
#include<bits/stdc++.h>
#include<map>
#include<set> 
#include<iterator> 
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int x,y,z;cin>>x>>y>>z;
	int i=1;
	while(x*i<=z){
		if(x*i>=y){
			cout<<"OK";return 0;
		}
		i++;
	}
	cout<<"NG";return 0;
}

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

n = lines[0][0]
m = lines[0][1]

def satisfied?(n,m,lines)
  ns = n.to_s
  for i in 1..m do
    if ns[lines[i][0]-1] != lines[i][1].to_s then
      return false
    end
  end
  return true
end

answer = -1

for i in (10 ** (n-1)) .. (10 ** n - 1) do
  if satisfied?(i,m,lines) then
    answer = i
    break
  end
end
if n == 1 and satisfied?(0,m,lines) then
  answer = 0
end
  
print answer

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define il inline
#define RG register
#define ll long long
#define inf (1LL<<60)
#define N (105)

using namespace std;

struct edge{ int nt,to; ll flow,cap; }g[10005];

int head[N],d[N],q[N],a[N],S,T,n,num;
ll ans;

il int gi(){
  RG int x=0,q=1; RG char ch=getchar();
  while ((ch<'0' || ch>'9') && ch!='-') ch=getchar();
  if (ch=='-') q=-1,ch=getchar();
  while (ch>='0' && ch<='9') x=x*10+ch-48,ch=getchar();
  return q*x;
}

il void insert(RG int from,RG int to,RG ll cap){
  g[++num]=(edge){head[from],to,0,cap},head[from]=num;
  g[++num]=(edge){head[to],from,0,0},head[to]=num; return;
}

il int bfs(RG int S,RG int T){
  memset(d,0,sizeof(d));
  RG int h=0,t=1; q[t]=S,d[S]=1;
  while (h<t){
    RG int x=q[++h],v;
    for (RG int i=head[x];i;i=g[i].nt){
      v=g[i].to;
      if (!d[v] && g[i].cap>g[i].flow){
	d[v]=d[x]+1,q[++t]=v;
	if (v==T) return 1;
      }
    }
  }
  return d[T];
}

il ll dfs(RG int x,RG int T,RG ll a){
  if (!a || x==T) return a; RG ll f,flow=0;
  for (RG int i=head[x],v;i;i=g[i].nt){
    v=g[i].to;
    if (d[v]==d[x]+1 && g[i].cap>g[i].flow){
      f=dfs(v,T,min(a,g[i].cap-g[i].flow));
      if (!f){ d[v]=-1; continue; }
      g[i].flow+=f,g[i^1].flow-=f;
      flow+=f,a-=f; if (!a) return flow;
    }
  }
  return flow;
}

il ll maxflow(RG int S,RG int T){
  RG ll flow=0;
  while (bfs(S,T)) flow+=dfs(S,T,inf);
  return flow;
}

int main(){
  n=gi(),num=1,S=n+1,T=n+2;
  for (RG int i=1;i<=n;++i){
    a[i]=gi(),ans+=(a[i]>0)*a[i];
    a[i]>0?insert(i,T,a[i]):insert(S,i,-a[i]);
    for (RG int j=i+i;j<=n;j+=i) insert(i,j,inf);
  }
  cout<<ans-maxflow(S,T); return 0;
}


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

int SumOfDigits(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}


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

  int ans = 10000000;

  for (int i = 1; i < N; i++) {
    int sum;
    sum = SumOfDigits(i) + SumOfDigits(N-i);
    ans = min(ans, sum);
  }

  cout << ans << endl;

}

Measured memory_bytes: 256
object Main extends App {
    val stn = ('a' to 'z').toList ::: ('A' to 'Z').toList
    val in = io.Source.stdin.getLines
    for (n <- in if n != "0") {
        val k = in.next.split(" ").map(_.toInt)
        val kk = Stream.continually(k).flatten
        println(in.next.zip(kk).map{case (c, i) =>
            stn((stn.indexWhere(_ == c)-i+52)%52)
        }.mkString)
    }
}

Measured memory_bytes: 47008
import math
 
N = int(input())
place_list = [input().split() for i in range(N)] 
 
distances = []
 
for i, one_place in enumerate(place_list[:len(place_list)]):
    mini_distances = []
    for another_cordinate in place_list[i+1:]:
        distance = math.sqrt((int(one_place[0]) - int(another_cordinate[0])) ** 2 + (int(one_place[1]) - int(another_cordinate[1])) ** 2)
        distances.append(distance)
 
distances = [n*math.factorial(N-1) for n in distances]
 
print(2*sum(distances)/math.factorial(N))

Measured memory_bytes: 3064
#include <iostream>

int main()
{
    int x, y;
    char op;
    while (1) {
        std::cin >> x;
        std::cin >> op;
        std::cin >> y;
        if (std::cin.good() == 0) {
            break;
        }
        switch (op) {
        case '+':
            std::cout << x + y << std::endl;
            break;
        case '-':
            std::cout << x - y << std::endl;
            break;
        case '*':
            std::cout << x * y << std::endl;
            break;
        case '/':
            std::cout << x / y << std::endl;
            break;
        default:
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3088