akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

int h, w;
vector<string> s;
int dy[] = {0, -1, 0, 1}, dx[] = {1, 0, -1, 0};

bool in(int y, int x) { return 0 <= y && y < h && 0 <= x && x < w; }
int bfs(int sy, int sx, int gy, int gx)
{
    int res = 0;
    int y = sy, x = sx;
    int d[30][30];
    rep(i, h) rep(j, w) d[i][j] = INF;
    d[y][x] = 0;
    queue<P> que;
    que.push(P{y, x});
    while (!que.empty())
    {
        P p = que.front();
        que.pop();
        int nowy = p.first;
        int nowx = p.second;
        rep(i, 4)
        {
            int ny = nowy + dy[i];
            int nx = nowx + dx[i];
            if (!in(ny, nx) || s[ny][nx] == '#')
                continue;
            if (d[ny][nx] == INF)
            {
                d[ny][nx] = d[nowy][nowx] + 1;
                que.push(P(ny, nx));
            }
        }
    }
    return d[gy][gx];
}

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

    cin >> h >> w;
    s.resize(h);
    rep(i, h) cin >> s[i];
    int ans = 0;
    rep(sy, h) rep(sx, w)
    {
        if (s[sy][sx] == '#')
            continue;
        rep(gy, h) rep(gx, w)
        {
            if (s[gy][gx] == '#')
                continue;
            int len = bfs(sy, sx, gy, gx);
            ans = max(ans, len);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define F first
#define S second
#define bitcnt(v) __builtin_popcount(v)
#define all(v) v.begin(), v.end()

vector<vector<int>> graph;

void solution(){

	int n; cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	vector<int> c(n);
	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i] >> c[i];
	}
	vector<vector<int>> dp(3,vector<int>(n+1,0));

	dp[0][1] = a[0];
	dp[1][1] = b[0];
	dp[2][1] = c[0];

	for(int i = 2; i <= n; i++){
		dp[0][i] = a[i-1] + max({dp[0][i-2], dp[1][i-1], dp[2][i-1]});
		dp[1][i] = b[i-1] + max({dp[1][i-2], dp[0][i-1], dp[2][i-1]});
		dp[2][i] = c[i-1] + max({dp[2][i-2], dp[0][i-1], dp[1][i-1]});
	}

	cout << max({dp[0][n], dp[1][n], dp[2][n]}) << endl;




	
}	

int main(){ 

	fio; // fast input output
	int t;
	t = 1;
	// cin >> t;
	for(int i = 1; i <= t; i++){
		// GOOGLE //
		// cout << "Case #" << i << ": ";

		solution();
	} 
	return 0;
}

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

int main(){
  vector<int> a(3);

  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end(), greater<int>());
  cout << a[0]*10+a[1]+a[2] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>

using namespace std;

int main(){
    int N;
    long long sum=0;
    cin>>N;
    int A[N],B[N-1];
    for(int i=0;i<N-1;i++) cin>>B[i];
    A[0]=B[0];
    for(int i=0;i<N-2;i++){
        if(B[i]>B[i+1])A[i+1]=B[i+1];
        else {
            A[i+1]=B[i];
        }
    }
    A[N-1]=B[N-2];
    for(int i=0;i<N;i++){
        sum+=A[i];
    }
    cout<<sum<<endl;
    return 0;
}

//B>=max(A,A+1)
// 0 153 10 10 23
// 0,0,10,10,
//9 12 1
//9  9 1 1
//右下を確定させる

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		Pair[] pairs = new Pair[m];
		for (int i = 0; i < m; i++) {
		    pairs[i] = new Pair(sc.nextInt(), sc.nextInt());
		}
		Arrays.sort(pairs);
		UnionFindTree uft = new UnionFindTree(n);
		for (int i = m - 1; i >= 0; i--) {
		    uft.unite(pairs[i]);
		}
		int q = sc.nextInt();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < q; i++) {
		    if (uft.same(sc.nextInt(), sc.nextInt())) {
		        sb.append("yes");
		    } else {
		        sb.append("no");
		    }
		    sb.append("\n");
		}
		System.out.print(sb);
	}
	
	static class UnionFindTree {
	    int[] parents;
	    
	    public UnionFindTree(int size) {
	        parents = new int[size];
	        for (int i = 0; i < size; i++) {
	            parents[i] = i;
	        }
	    }
	    
	    public int find(int x) {
	        if (parents[x] == x) {
	            return x;
	        } else {
	            return parents[x] = find(parents[x]);
	        }
	    }
	    
	    public boolean same(int x, int y) {
	        return find(x) == find(y);
	    }
	    
	    public void unite(int x, int y) {
	        if (same(x, y)) {
	            return;
	        }
	        parents[find(x)] = find(y);
	        find(x);
	    }
	    
	    public void unite(Pair p) {
	        unite(p.left, p.right);
	    }
	}
	
	static class Pair implements Comparable<Pair> {
	    int left;
	    int right;
	    
	    public Pair(int x, int y) {
	        left = Math.min(x, y);
	        right = Math.max(x, y);
	    }
	    
	    public int compareTo(Pair another) {
	        if (left == another.left) {
	            return right - another.right;
	        } else {
	            return left - another.left;
	        }
	    }
	}
}



Measured memory_bytes: 103592
import java.util.Scanner;
/**
 *
 * @author kouki
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z;
        z = x*3+y;
        int pie=0;
        pie = z/2;
        System.out.println(pie);
    }
    
}

Measured memory_bytes: 23124
package main

import (
	"fmt"
	"math"
)

func main(){
	var x1, y1, x2, y2 float64
	fmt.Scan(&x1, &y1, &x2, &y2)
	fmt.Println(math.Sqrt(math.Pow(x2-x1, 2) + math.Pow(y2-y1, 2)))
}


Measured memory_bytes: 1188
#include <stdio.h>

int	main(void)
{
  	int	N;
  	
  	scanf("%d", &N);
  
  	if(N / 100 == 7)
    {
      	printf("Yes");
      	return (0);
    }
  	if((N / 10) % 10 == 7)
    {
      	printf("Yes");
      	return (0);
    }
  	if(N % 10 == 7)
    {
      	printf("Yes");
      	return (0);
    }
    printf("No");
    return (0);
}

Measured memory_bytes: 1708
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		System.out.println((N - 2) * 180);
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}


Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
ll sum[1000000+10]; 
ll mod=1e9+7;
ll dp[1000000+10];
ll qpow(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1){
			res=res*a%mod;
		}
		b/=2;
		a=a*a%mod;
	}
	return res;
}
ll get(int a,int b){
	return sum[a]*(qpow(sum[a-b],mod-2))%mod*qpow(sum[b],mod-2)%mod;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll n,k;
	cin >> n >> k;
	sum[0]=1;
	rep(i,1,100000+1){
		sum[i]=sum[i-1]*i%mod;
	}
	ll num=0;
	for(int i=k;i>=2;i--){
		if(k/i<2) {
			dp[i]=1;
			num+=dp[i];
			continue;
		}
		dp[i]=qpow(k/i,n); 
		for(int j=2;j*i<=k;j++){
				dp[i]=(dp[i]-dp[j*i]+mod)%mod;
		}
		num+=dp[i];
		num%=mod;
	}
	dp[1]=(qpow(k,n)-num+mod)%mod;
	/*rep(i,1,k+1){
		cout<<dp[i]<<" ";
	}*/
	ll res=0;
	rep(i,1,k+1){
		res=(res+i*dp[i])%mod;
	}
	cout<<res;
	return 0;
}



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

#include <limits.h>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

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

    int x = (A + K - 1) / K;
    int y = B / K;
    if (y - x >= 0) {
        cout << "OK" << endl;
    } else {
        cout << "NG" << endl;
    }

    return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric> 
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x, a, b;
	cin >> x >> a >> b;
	if(abs(x - a) < abs(x - b)) cout << 'A' << endl;
	else cout << 'B' << endl;
	return 0;
}



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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a;
    string s;
    cin >> a >> s;
    if (a >= 3200) cout << s << endl;
    else cout << "red" << endl;
    return 0;
}

Measured memory_bytes: 256
S = input()
s1 = int(S[:2])
s2 = int(S[2:])
 
if 0 < s1 < 13:
    if 0 < s2 < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 0 < s2 < 13:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int , int> ii;
typedef pair<ii , int> iii;
int n , m , a , b , isi[200000] , ans;
bool cek[200000];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	for(int i = 1 ; i <= n ; i++){
		isi[i] = 1;
	}
	cek[1] = true;
	for(int i = 1 ; i <= m ; i++){
		cin >> a >> b;
		if(cek[a])cek[b] = true;
		if(isi[a] == 1)cek[a] = false;
		isi[b]++;
		isi[a]--;
	}
	ans = 0;
	for(int i = 1 ; i <= n ; i++){
		if(cek[i]){
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 4004
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int x = in.nextInt();

        int hour = x / 3600;
        int min = x % 3600 / 60;
        int sec = x % 60;

        System.out.println(hour + ":" + min + ":" + sec);
        System.exit(0);
    }
}



Measured memory_bytes: 26300
#include <stdio.h>
int main(){
	int n,l,aji;
	scanf("%d%d", &n,&l);
	if (l>0) aji = (2*l+n)*(n-1)/2;
	
	else if (l+n-1 < 0) aji = (2*l+n-2)*(n-1)/2;
	
	else aji = (2*l+n-1)*n/2;
	
	printf("%d",aji);
	
	return 0;
}

Measured memory_bytes: 128
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include <unordered_map>
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define MAPFOR(it,m) for( auto it = (m).begin(); it != (m).end() ; ++it )
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)


int main(void){
    ll n, q;
    cin >> n;
    unordered_map<int, int> m;
    vll a(n);
    REP(i, n) {
        ll v;
        cin >> v;
        m[v]++;
        a[i] = v;
    }
    ll sum = accumulate(ALL(a), 0LL);
    cin >> q;
    REP(i, q) {
        int b, c;
        cin >> b >> c;
        ll count = m[b];
        sum += (c-b) * count;
        m[c] += m[b];
        m[b] = 0;
        cout << sum << endl;
    }
    
    return 0;
}

Measured memory_bytes: 7664
n,m = map(int,input().split())
a = [0]*n
b = [1]*m
ans = a+b
count = 0
for i in range(0,n+m):
    for j in range(i+1,n+m):
        if (ans[i]+ans[j])%2==0:
            count += 1
print(count)

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    char str[30];
    char S[30];
    gets(str);
    int i=strlen(str);
    int j;
    S[i]='\0';
    for(i--, j=0; i>=0; i--, j++)
    S[j]=str[i];
    puts(S);
    return 0;
}

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

int main() {
    int n;
    int m;
    int p[] = {1,3,5,7,8,10,12};
    int o[] = {4,6,9,11};
    int l = 2;
  
    int judgea = 0;
    int judgeb = 0;
  
  
   cin >> n >> m;
  
   for (int i = 0;i<7;i++){
     
     if(n==p[i]){
       judgea = 1;
     }
     
     if(m==p[i]){
        judgeb = 1;
     }
     
   }
  
  for (int j = 0;j<4;j++){
     
     if(n==o[j]){
       judgea = 2;
     }
     
     if(m==o[j]){
        judgeb = 2;
     }
     
   }
  
   if(n==l){
     judgea = 3;
   }
   if(m==l){
     judgeb = 3;
   }
  
  if (judgea==judgeb){
      cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 256
/*input
4
10 30 40 20
*/
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long 
#define vl vector<ll> 
#define pl pair<ll,ll> 
#define vpl vector<pl> 
#define vvl vector<vl> 
using namespace std;
const ll N = 1e5 +5;
vl t;
ll frog(vl& v,ll n)
{
   

	if(t[n] != -1)return t[n];
	if(n == 0)return 0;
	
	ll cst1,cst2;
	cst1 = (abs(v[n-1]-v[n])+frog(v,n-1));
	if(n >= 2){
	cst2 = (abs(v[n-2]-v[n])+frog(v,n-2));}
	else cst2 = INT_MAX;
	return t[n]  = min(cst1,cst2);

	
 
}

int main()

{
	ios_base::sync_with_stdio(false); 
    cin.tie(0); cout.tie(0);
   
   ll n,h ;
   vl v;

   cin >> n;
   t.resize(n);
   for(auto x = 0 ;x< n;x++)cin >> h,v.pb(h),t[x] = -1;
  	ll cst =  frog(v,n-1);
   cout << cst;


        

  return 0;
   		
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll h,w; cin>>h>>w;
  ll n; cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  
  vvll ans(h,vll(w));
  
  ll now=0;
  rep(i,h){
    if(i%2){
      rrep(j,w){
        ans[i][j]=now+1;
        a[now]--;
        if(a[now]<=0){
          now++;
        }
      }
    }else{
      rep(j,w){
        ans[i][j]=now+1;
        a[now]--;
        if(a[now]<=0){
          now++;
        }
      }
    }
  }
  
  rep(i,h){
    rep(j,w){
      cout<<ans[i][j];
      if(j!=w-1) cout<<' ';
    }
    cout<<endl;
  }
  
}

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

int main() {
  long n,ans=0;
  cin >> n;
  for(long i=1;true;i++) {
    if((n-i)/i<=i) break;
    if((n-i)%i==0) {
      ans+=(n-i)/i;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

int main() {
    long long s; cin >> s;
    int x = (int(1e9) - s % int(1e9)) % int(1e9);
    int y = (s + x) / int(1e9);
    cout << "0 0 1000000000 1 " << x << " " << y << "\n";
    return 0;
}

Measured memory_bytes: 256
import * as fs from 'fs';

namespace AtCoder.abc117 {

    export class Program {
        /**
         * in
         *
         * out
         *
         */
        static main(inp: string): void {
            const [x, y] = inp.split(' ').map(Number)
            console.log(x/y);
        }
    }
}

AtCoder.abc117.Program.main(fs.readFileSync('/dev/stdin', 'utf8').trim());


Measured memory_bytes: 7500
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

//--- 変数宣言 ---//
int d, g;
vector<int> p(10), c(10);
const int INF = 10000;
int score;  //いまの得点
int num;    //解いた問題数
int rest;   //部分的に解く問題の問題番号
int need;   //残り解く問題数
int ans = INF;  //解く問題数の最小値(INFで初期化)
vector<int> a(10);  //a[i]が0または1の配列(0＆1列)

//ansを計算する関数
void calc() {   
    score = 0;  
    num = 0;    
    rest = -1;  

    //a[i]が0か1か調べる
    rep(i, d) {
    //a[i]が1だったら
        if(a[i] == 1) {
            //i番目の問題をすべて解く。コンプリボーナスも得点に加える
            score += ((i+1)*100*p[i] + c[i]);
            //解いた問題数をp[i]増やす
            num += p[i];
        }
        //a[i]が0だったら
        else {
            /* i番目の問題を部分的に解く候補にする。ループが終わるときには、
                aの0のものの中で最も得点の高い問題番号がrestに入る。*/
            rest = i;
        }
    }

    //aの1の問題をすべて解いてもスコアがgに届かない場合
    if(g > score) {
        //100*(rest+1)は、rest番目の問題を1問解くごとに得られる点数
        //p[rest]はrest番目の問題数の最大値
        /* (g-score-1)/(100*(rest+1)) + 1で、残りg-score点必要で
            1問ごとに100*(rest+1)点入るときに解く必要のある最低問題数
            が求まる。これをp[rest]と比べればよい */
        need = min( (g-score-1)/(100*(rest+1)) + 1, p[rest] );
        //部分的に解く問題の合計点数を得点に加える
        score += (rest+1)*100*need;
        //解いた問題数をneed増やす
        num += need;
    }

    //スコアがgを超えたら
    if(score >= g) {
        //numの最小値がansに入る
        ans = min(ans, num);
    }
}

//全ての0＆1列を列挙してcalcでansを計算するDFS
void dfs(int depth) {
    if(depth == d) {  //depthがdに達したら
        calc(); //ansを計算して
        return; //一つ上の深さに戻る
    }

    //a[depth]に0を書いて1つ下の深さに行く
    a[depth] = 0;  dfs(depth+1);

    //a[depth]に1を書いて1つ下の深さに行く
    a[depth] = 1;  dfs(depth+1);
}

int main() {
    cin >> d >> g;
    rep(i, d) {
        cin >> p[i] >> c[i];
    }

    dfs(0); //深さ0からスタート

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

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

int main() {
    char *s;
    char buf[512];
    int n;

    cin >> buf;
    s = (char*) malloc(strlen(buf) + 1);
    char *t = s;
    for(int i=0; buf[i]!='\0'; i++){
        s[i]=buf[i];
    }

    for (int i = 0; i < strlen(s); ++i) {
        if(*s == 'A'){
            s++;
            if (*s == 'C') {
                cout << "Yes" << endl;
                free(t);
                return 0;
            }
            s--;
        }
        s++;
    }
    cout << "No" << endl;

    free(t);

    return 0;
}

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

int main(){
  int n, m, a, b;
  cin >> n >> m;
  int h[n];
  vector<bool> flag(n, 0);
  vector<int> c(n, 0);
  vector<int> p(n, 0);
  for(int i = 0; i < n; i++){
    cin >> h[i];
  }
  for(int i = 0; i < m; i++){
    cin >> a >> b;
    flag[a-1] = 1;
    flag[b-1] = 1;
    p[a-1]++;
    p[b-1]++;
    if(h[a-1] > h[b-1]) c[a-1]++;
    else if(h[a-1] < h[b-1]) c[b-1]++;
  }
  int ans = 0;
  for(int i = 0; i < n; i++){
    if(flag[i]){
      if(c[i] == p[i]) ans++;
    } else ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4540
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException, InterruptedException {
        Scanner sc = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        long sum =0;
        int i = 1;
        while (i<=n){
            if (i%3 !=0 && i%5!=0)
                sum+=i;
            i++;
        }
        out.print(sum);
        out.flush();
        out.close();
    }



    static class Scanner {
        BufferedReader br;
        StringTokenizer st;

        boolean ready() throws IOException {
            return br.ready();
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        Scanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

        int nextChar() throws IOException {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) throws IOException {
            int[] ans = new int[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextInt();
            return ans;
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

    }
}


Measured memory_bytes: 33032
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc;// = new Scanner(System.in);
        sc = new Scanner(System.in);
        while(true){
            int m = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            if(m == -1 && f == -1 && r == -1)break;

            if(m == -1 || f == -1){
                System.out.println("F");
            }else if(m+f >= 80){
                System.out.println("A");
            }else if(m+f >=65 && m+f < 80){
                System.out.println("B");
            }else if(m+f >=50 && m+f <65){
                System.out.println("C");
            }else if(m+f >=30 && m+f <50){
                if(r >= 50){
                    System.out.println("C");
                }else{
                    System.out.println("D");
                }
            }else{
                System.out.println("F");
            }
            sc.nextLine();
        }
        //System.out.println();
    }
}


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

#define u unsigned
#define s short
#define ll long long
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, a, b) for (int i = (a-1); i >= (b); i--)

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    u s int x, y, z;

    cin >> x >> y >> z;

    swap(x, y);
    swap(x, z);

    cout << x << " " << y << " " << z << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=100010;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
ll x;
ll solve(ll x){
	if(x==1) return 1;
	else return 1+solve(x/2)*2;
}
int main(){
	x=read();
	printf("%lld\n",solve(x));
}

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

#define MOD (1000 * 1000 * 1000 + 7)
#define INF (1LL << 60)
#define pb push_back
#define po pop_back
#define fi first
#define se second

typedef long long ll;
typedef long double ld;

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

    ll rec1 = a * b;
    ll rec2 = c * d;

    cout << (rec1 > rec2 ? rec1 : rec2) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
#include <sstream>
#include <queue>
using namespace std;
typedef long long ll;

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  for (int i = 0; i < h; i++) {
    cin >> s[i];
  }

  int ans = 0;
  for (int is = 0; is < (1<<h); is++) {
    for (int js = 0; js < (1<<w); js++) {
      int cnt = 0;
      for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
          if (is & (1 << i)) continue;
          if (js & (1 << j)) continue;
          if (s[i][j] == '#') cnt++;
        }
      }

      if (cnt == k) ans++;
    }
  }

  cout << ans << endl;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b + c >= 22){
        cout << "bust\n";
    }
    else{
        cout << "win\n";
    }
}

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

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int[] S = new int[n];
		int[] A = new int[n];

		for (int i = 0; i < n; i ++) {
			S[i] = i;
			A[i] = scanner.nextInt();
		}

		scanner.close();

		quickSort(S, A, 0, n - 1);
		
		boolean[] did = new boolean[n];
		int cost = 0;
		
		for (int i = 0; i < n; i ++) {
			if (did[i]) continue;
			did[i] = true;
			if (S[i] == i) continue;
			
			int x = 0;
			int y = (A[i] + A[0]) * 2;
			for (int j = S[i]; S[j] != S[i]; j = S[j]) {
				did[j] = true;
				x += A[j] + A[i];
				y += A[j] + A[0];
			}
			cost += Math.min(x, y);
		}
		System.out.println(cost);
	}

	public static int partition (int[] S, int[] A, int p, int r) {
		int x = A[r];
		int i = p - 1;

		for (int j = p; j < r; j++) {
			if (A[j] <= x) {
				i ++;
				int tempc = S[i];
				S[i] = S[j];
				S[j] = tempc;
				int temp = A[i];
				A[i] = A[j];
				A[j] = temp;
			}
		}

		int tempc = S[++ i];
		int temp = A[i];
		S[i] = S[r];
		A[i] = A[r];
		S[r] = tempc;
		A[r] = temp;

		return i;
	}

	public static void quickSort(int[] S, int[] A, int p, int r) {
		if (p < r) {
			int q = partition(S, A, p, r);
			quickSort(S, A, p, q - 1);
			quickSort(S, A, q + 1, r);
		}
	}
} 



Measured memory_bytes: 30748
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007; 
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}






int main(){
    int N, M; std::cin >> N >> M;
    std::vector<int> cnt(N, 0);
    {
        int a, b;
        for(int i(0); i < M; ++i){
            std::cin >> a >> b;
            ++cnt[a-1]; ++cnt[b-1];
        }
    }
    for(int i(0); i < N; ++i){
        std::cout << cnt[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
const ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, m, deg[200200];
vvi g;
vi h;
void dfs1(int v = 1) {
	for(auto i : g[v]) {
		if(h[i]>h[v])
			cout << v << " " << i << "\n", deg[v]++;
		else if(h[i]==-1)
			h[i] = h[v]+1, dfs1(i);
	}
}
void dfs2(int v = 1) {
	for(auto i : g[v]) {
		if(h[i]!=-1)
			continue;
		h[i] = h[v]+1, dfs2(i);
		if(deg[i]&1)
			cout << i << " " << v << "\n", deg[i]++;
		else
			cout <<v << " " << i << "\n", deg[v]++;
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	if(m&1)
		return cout << -1, 0;
	g.resize(n+1);
	for(int f, t, i = 0; i < m; i++) {
		cin >> f >> t;
		g[f].pb(t);
		g[t].pb(f);
	}
	h.assign(n+1, -1), h[1]=0;
	dfs1();
	h.assign(n+1, -1), h[1]=0;
	dfs2();
	return 0;
}


Measured memory_bytes: 15872
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int ans = 0;
            string[] S = Console.ReadLine().Split(' ');

            int H = int.Parse(S[0]);
            int W = int.Parse(S[1]);

            string[] s = Console.ReadLine().Split(' ');

            int h = int.Parse(s[0]);
            int w = int.Parse(s[1]);

            ans = (H - h) * (W - w);

            Console.WriteLine(ans.ToString());
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 1000006;
const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;

ll ans = INF;

#define X first
#define Y second

void upd (pll &p, ll x) {
    p.X = min(p.X, x);
    p.Y = max(p.Y, x);
}
void solve (ll w, ll h) {
    REP1 (i, w) {
        pll sz = {INF, -INF};
        upd(sz, i * h);
        {
            pll nw = sz;
            upd(nw, (w-i)/2 * h);
            upd(nw, (w-i+1)/2 * h);
            ans = min(ans, nw.Y- nw.X);
        }
        {
            pll nw = sz;
            upd(nw, h/2 * (w-i));
            upd(nw, (h+1)/2 * (w-i));
            ans = min(ans, nw.Y- nw.X);
        }

    }
}
/*********************GoodLuck***********************/
int main () {
    IOS();
    ll w, h;
    cin >> w >> h;

    solve(h, w);
    solve(w, h);

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


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
  int64_t H;
  cin >> H;

  int64_t c=0;
  c = std::log2(H);
  int64_t c2 = 1;
  int64_t n = 1;
  for(int i=0;i<c;++i)
  {
    c2 +=2*n;
    n = n * 2;
  }
  cout << c2 << endl;;


  return 0;
}


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

int main(){

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

	ios::sync_with_stdio(false),cin.tie(0);
	
	const long long p = 1000000007;

	long long n,k; cin>>n >>k;
	long long a[n];
	for(long long i=0;i<n;i++) cin >> a[i];
	sort(a,a+n);
	long long ans = 1;
	if(k%2 == 1){
		if(a[n-1] == 0) {cout << 0 << endl; return 0;}
		if(a[n-1]<0){

			for(long long i=0;i<k;i++){
				ans = ((ans%p)*a[n-1-i])%p;
			ans = (p+ans%p)%p;
			}
			cout << (p+ans%p)%p << endl;
			return 0;
		}

		ans = a[n-1];
		n--;
	}

	k = k/2;

	long long i=0; long long j=n-2;

	while(k>0){
		if(a[i]*a[i+1]>a[j]*a[j+1]){
			ans = ((ans%p)*(a[i]%p))%p;
			ans = ((ans%p)*(a[i+1]%p))%p;
			ans = (p+ans%p)%p;
			i+=2;
		}
		else{
			ans = ((ans%p)*(a[j]%p))%p;
			ans = ((ans%p)*(a[j+1]%p))%p;
			ans = (p+ans%p)%p;
			j-=2;
		}

		k--;
	}

	cout << (p+ans%p)%p << endl;

	return 0;
}

Measured memory_bytes: 5140
N = int(input())
S = input()
r = 0
g = 0
b = 0
for i in range(N):
    if S[i] == "R":
        r += 1
    elif S[i] == "G":
        g += 1
    else:
        b += 1
ans = r * g * b

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        x = j + j - i
        if S[i] != S[j] and x <= N - 1:
            if S[i] != S[x] and S[x] != S[j]:
                ans -= 1

print(ans)


Measured memory_bytes: 73324
N = int(input())
D = [int(v) for v in input().split(' ')]

D.append(0)
L = len(D)

D.sort()


min_diff = D[1] - D[0]

if L >= 3:
    d = (24 - D[L - 2]) - D[L - 1]
    if min_diff > d:
        min_diff = d

for i in range(2, L):
    d = D[i] - D[i - 2]
    if min_diff > d:
        min_diff = d

print(min_diff)

Measured memory_bytes: 3188
#include <stdio.h>
#define MAX 100001
int parent(int i){return i/2;}
int left(int i){return 2*i;}
int right(int i){return 2*i+1;}
int main(){
  int H,i,A[MAX];
  scanf("%d",&H);
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=H;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(parent(i)>=1) printf("parent key = %d, ",A[parent(i)]);
    if(left(i)<=H) printf("left key = %d, ",A[left(i)]);
    if(right(i)<=H) printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;

ll pascal[51][51];

void makepascal(ll x){
    memset(pascal,0,51*51);
    pascal[0][0]=1;
    for(int i=1;i<=x;i++){
        pascal[i][0]=1;
        for(int j=1;j<=i;j++){
            pascal[i][j]=pascal[i-1][j-1]+pascal[i-1][j];
        }
    }
}

int main(){
    int N,A,B;
    cin>>N>>A>>B;
    vector<ll> v(N);
    for(int i=0;i<N;i++){
        cin>>v[i];
    }
    sort(v.rbegin(),v.rend());
    double ave=0.0;
    for(int i=0;i<A;i++){
        ave+=(double)v[i];
    }
    ave/=(double)A;
    printf("%.10f\n",ave);
    int cnt=0;
    for(int i=0;i<N;i++){
        if(v[i]==v[0]) cnt++;
        else break;
    }
    if(cnt>=A){
        ll ans=0;
        makepascal(cnt);
        for(int i=A;i<=min(cnt,B);i++){
            // cntCiを求める
            ans+=pascal[cnt][i];
        }
        cout<<ans<<endl;
        return 0;
    }
    int a=0,b=0;
    for(int i=0;i<N;i++){
        if(v[i]==v[A-1]){
            if(i<A) b++;
            a++;
        }
    }
    makepascal(a);
    cout<<pascal[a][b]<<endl;

    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,sum=0,ei=0,tyo=0,don=0;

  while(1){
    cin >> a >> b >> c;
    if(a > b){
      swap(a,b);
    }
    if(a > c){
      swap(a,c);
    }
    if(b > c){
      swap(b,c);
    }
    if( a+b <= c) break;
    sum++;
    if(c*c == a*a+b*b){
      tyo++;
    } else if(c*c > a*a+b*b){
      don++;
    } else if(c*c < a*a+b*b){
      ei++;
    }
  }
  cout << sum << " " << tyo << " " << ei << " " << don << endl;
  return 0;
}

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

typedef long long LL;

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

int main() {
    int x;
    cin >> x;
    if(x < 1200) {
        cout << "ABC" << endl;
    }else{
        cout << "ARC" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a,b = li()

if a <= 5:
    b = 0
elif a <= 12:
    b //= 2

print(b)

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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, a, n) for (int i = (n); i < (a); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)

template<typename T,typename U>
void Inparray(T &f,U n){
  for(int i=0;i<n;i++) cin>>f[i];
}

template<typename T,typename U>
void Printarray(T f,U n){
  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];
}

void flagfunc(bool flag,string A,string B){
  flag ? cout<<A<<endl : cout<<B<<endl;
}

void flag2func(bool flag){
  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

void flag3func(bool flag){
  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n,d,x,a,ans=0;cin>>n>>d>>x;
  for (int i = 0; i < n; ++i)
  {
  	cin>>a;
  	for (int j = 1; j <= d; j+=a){
  		ans++;
  	}
  	// cout<<"ans "<<ans<<endl;
  }
  cout<<ans+x<<endl;
}


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

int swap(int* x, int* y){
	int tmp = *y;
	*y = *x;
	*x = tmp;
}
	
int main(){
	int w, n, array[31];
    int a, b;
    
    char sep;
    
	for(int i=1; i<=30; i++){
		array[i] = i;
	}
	
	cin >> w;
	cin >> n;
	
	while(0<n){
		cin >> a >> sep >> b;
		
		swap(&array[a], &array[b]);
		--n;
	}
	
	for(int j=1; j<=w; j++){
		cout << array[j] << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,cnt=0;
	cin>>a>>b;
	for (int i=0;i<b;i++)
	{
		cin>>c;
		cnt+=c;
	}
	if (cnt>a)
		cout<<-1;
	else
		cout<<a-cnt;
	return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <cmath>

using namespace std;

const double EPS = 1e-7;

struct Point {
    double x, y;
    Point() {}
    Point(double x, double y) : x(x), y(y) {}
    Point operator+(const Point& p) const { return Point(x + p.x, y + p.y); }
    Point operator-(const Point& p) const { return Point(x - p.x, y - p.y); }
    Point operator*(double k) const { return Point(k * x, k * y); }
    Point operator/(double k) const { return Point(x / k, y / k); }
};
double dot(const Point& a, const Point& b) { return a.x * b.x + a.y * b.y; }
double cross(const Point& a, const Point& b) { return a.x * b.y - a.y * b.x; }
double norm(const Point& a) { return sqrt(dot(a, a)); }
Point rot90(const Point& p) { return Point(p.y, -p.x); } // 時計回りに90度回転 
ostream& operator<<(ostream& os, const Point& p) { return os << "(" << p.x << "," << p.y << ")"; }

int ccw(Point a, Point b, Point c){
    b = b - a; c = c - a;
    if (cross(b, c) > EPS) return +1;      // a,b,cの順に反時計周り
    if (cross(b, c) < -EPS) return -1;     // a,b,cの順に時計周り
    if (dot(b, c) < 0) return +2;          // c--a--b 直線
    if (norm(b) < norm(c)) return -2;      // a--b--c 直線
    return 0;                              // a--c--b 直線
}

struct Segment {
    Point a, b;
    Segment() {}
    Segment(const Point& a, const Point& b) : a(a), b(b) {}
};
bool intersects(const Segment& s, const Segment& t) {
    return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

istream& operator>>(istream& is, Point& p) { return is >> p.x >> p.y; }
istream& operator>>(istream& is, Segment& s) { return is >> s.a >> s.b; }
int main() {
    int Q; cin >> Q;
    for (int i = 0; i < Q; i++) {
        Segment s, t;
        cin >> s >> t;
        cout << intersects(s, t) << endl;
    }
    return 0;
}

Measured memory_bytes: 1232
/*input
oder atc
*/
/**
    Author: Kristopher Paul
    Date Created: 29-12-2019
    Contest Name:
                _/    _/   _/_/_/_/   _/   _/_/_/_/
               _/  _/     _/    _/   _/   _/
              _/_/       _/_/_/_/   _/   _/_/_/_/
             _/  _/     _/  _/     _/         _/
            _/    _/   _/    _/   _/   _/_/_/_/
**/
#include<bits/stdc++.h>
#include<stdio.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int ll
#define pb push_back
#define INF 1e18
#define MOD 1000000007
//#define MOD 998244353
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define umap unordered_map
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define all(v) v.begin(),v.end()
#define WL(t) while(t--)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define out(x) cout << #x << " is " << x << endl
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

//Uncomment for File I/O
/*
#define cin fin
#define cout fout

ifstream fin("cowmbat.in");
ofstream fout("cowmbat.out");
*/

using namespace std;
//using namespace __gnu_pbds;

//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // set
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // multiset

int ModExp(int x,int y,int m){
    int res = 1;
    x = x % m;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % m;

        y = y>>1;
        x = (x*x) % m;
    }
    return res;
}

void solve(){
    string a,t;
    cin >> a >> t;
    cout << t << a << endl;
}

signed main(){
    FastIO;
    int t = 1;
//    cin >> t;
    WL(t){
        solve();
    }
}


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

int main() {
	int x, n;
	cin >> x >> n;
	unordered_set<int> st;
	for (int i=0; i<n; i++) {
		int a; cin >> a;
		st.insert(a);
	}
	int start = 0;
	int res;
	while (true) {
//		cout << x-start << " ";
		if (st.find(x-start) == st.end()) {
			res = x-start;
			break;
		}
//		cout << x+start << " ";
		if (st.find(x+start) == st.end()) {
			res = x+start;
			break;
		}
		start++;
	}
//	cout << "\n";
	cout << res;
}


Measured memory_bytes: 3640
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<lli> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

lli c[100], a[100][100];
vector<string> v;

void f(lli len, string X = "") {

    if(X.size() == len) {
        v.push_back(X);
        return ;
    }

    f(len, X + '0');
    f(len, X + '1');

}


void solve()
{

    lli n, m, x;
    cin>>n>>m>>x;

    for(int i = 0; i < n; i ++) {
        cin>>c[i];
        for(int j = 0; j < m; j ++) {
            cin>>a[i][j];
        }
    }

    f(n);


    lli ans = inf;

    for(auto it : v) {

        lli cnt[m] = {};
        lli cst = 0;
        for(int i = 0; i < n; i ++) {
            if(it[i] == '1') {
                cst += c[i];
                for(int j = 0; j < m; j ++) {
                    cnt[j] += a[i][j];
                }
            }
        }

        bool ok = 1;
        for(int i = 0; i < m; i ++) {
            if(cnt[i] >= x) {
                ;
            }
            else {
                ok = 0;
            }
        }

        if(ok ) {
            ans = min(ans, cst);
        }

    }

    if(ans == inf) {
        ans = -1;
    }
    cout<<ans;

    cout<<"\n";
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


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

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

    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;

    char c1 = s1[0]-'a'+'A';
    char c2 = s2[0]-'a'+'A';
    char c3 = s3[0]-'a'+'A';

    cout << c1 << c2 << c3 << endl;
}

Measured memory_bytes: 256