akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

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

int main() {
    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i,h) {
        cin >> s[i];
    }
    rep(i,h) {
        rep(j,w) {
            if (s[i][j] == '#') {
                bool canPaint = false;
                rep(k,4) {
                    int nx = i+dx[k];
                    int ny = j+dy[k];
                    if (0 <= nx && nx < h && 0 <= ny && ny < w) {
                        if (s[nx][ny] == '#') {
                            //cout << nx << " " << ny << endl;
                            canPaint = true;
                            break;
                        }
                    }
                }
                if (!canPaint) {
                    cout << "No\n";
                    return 0;
                }
            }
        }
    }
    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 256
lines = []
colums = []
 
while True:
 H,W = map(int,input().split())
 if H == 0 and W == 0:
   break
 lines.append(H)
 colums.append(W)
 
for H,W in zip(lines,colums):
 for i in range(H):
   if i == 0 or i == H-1:
     for j in range(W):
       print("#",end="")
   else:
     for j in range(W):
       if 0 < j and j < W-1:
         print(".",end="")
       else:
         print("#",end="")
   print("\n",end="")
 print("\n",end="")


Measured memory_bytes: 7020
d=2
map=*$<
o=?R
x,y=1,0
(u,v=9,9
(d+=1
u=x+[0,0,-1,0][d%4]
v=y+[0,1,0,-1][d%4]
)until u>=0&&v>=0&&v<9&&map[v][u]==?1
e=d%4
x+=[1,0,-1,0][e]
y+=[0,2,0,-2][e]
o+="RDLU"[e]
d+=2
)while [x,y]!=[0,0]
puts o

Measured memory_bytes: 6092
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int cnt=0;
		String comp_word = "";
		String str = "";

		Scanner sc= new Scanner( System.in );

		comp_word = sc.next();
		comp_word = comp_word.toLowerCase();

		while( true ) {
			str = sc.next();


			if ( str.equals("END_OF_TEXT") ) {
				break;
			}

			str = str.toLowerCase();

			if( str.equals(comp_word) ) {
				cnt++;
			}

		}

		System.out.println( cnt );

		sc.close();
	}
}



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

const int inf = 0x3f3f3f3f;
const ll linf = 0x3f3f3f3f3f3f3f3fLL;

const double eps = 1e-6;

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

    ll a; cin >> a;
    double b; cin >> b;
    ll bb = b * 100 + eps;
    cout << a * bb / 100 << endl;
    return 0;
}

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> x(n), y(n);
    int parity = 0;
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
        parity += (abs(x[i]) + abs(y[i])) % 2;
    }

    if (parity != 0 && parity != n) {
        cout << -1 << endl;
        return 0;
    }

    int m = 31 + (parity == 0);
    vector<ll> d(m, 1);

    cout << m << endl;
    cout << d[0];
    for (int i = 1; i < m; i++) {
        d[i] = (1LL << (i % 31));
        cout << " " << d[i];
    }
    cout << endl;

    for (int i = 0; i < n; i++) {
        vector<int> ans(m, 0);

        ll u = x[i] + y[i] + (parity == 0);
        u = (u - 1 + (1LL << 31)) >> 1;
        for (int j = 0; j < 31; j++) {
            if (u & (1LL << j)) ans[j] |= 1;
        }

        ll v = x[i] - y[i] + (parity == 0);
        v = (v - 1 + (1LL << 31)) >> 1;
        for (int j = 0; j < 31; j++) {
            if (v & (1LL << j)) ans[j] |= 2;
        }

        for (int j = 0; j < m; j++) {
            cout << "LUDR"[ans[j]];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = []
cnt = 0

for i in range (N):
  A.append(list(map(int, input().split())))
  
for a in range (N):
  tl =0
  for b in range (M):
    tl += A[a][b]*B[b]
  if tl + C > 0:
    cnt += 1
    
print(cnt)

Measured memory_bytes: 3064
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

vector<vector<int>> ans(20, vector<int>(1000));
bool used[20];

void solve(int level, int sum){
    if(10 < level) return ;

    for(int i=0; i<=9; i++){
        if(used[i]) continue;
        used[i] = true;
        ans[level+1][sum+(level+1)*i]++;
        solve(level + 1, sum + (level + 1) * i);
        used[i] = false;
    }

    return ;
}

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

    solve(0, 0);
    
    int n, s;
    while(cin>>n>>s){
        if(330 < s) s = 0, n = 0;
        cout << ans[n][s] << endl;
    }

    return 0;
}


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

int main() {
    string S;
    cin >> S;

    map<string, int> day;
    day["SUN"] = 7;
    day["MON"] = 6;
    day["TUE"] = 5;
    day["WED"] = 4;
    day["THU"] = 3;
    day["FRI"] = 2;
    day["SAT"] = 1;

    cout << day[S] << endl;
}

Measured memory_bytes: 3572
while True:
  a,b=map(int, input().split())
  if a == 0 and b == 0:
    break
  for i in range(a):
    for j in range(b):
      if (i+j)%2!=0:
        print(".",end="")
      else:
        print('#',end='')
    print('')
  print('')
    

Measured memory_bytes: 7008
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
using namespace std;

int main(){ 
  int n,x=0,y=0,ans=100000,c=0;
  cin>>n>>x;
  x=2*x+1;
  if(n%x!=0) co(n/x+1);
  else co(n/x);
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define cal(a, b) (a*(a+1))/2*b
typedef long long ll;
int main() {
  ll n, m;
  cin >> n;
  m = cal(n, 1);
  m -= cal(n / 5, 5) + cal(n / 3, 3) - cal(n / 15, 15);
  cout << m;
}

Measured memory_bytes: 3512
#include <iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main(){

	int N;
	cin >> N;

	int a[101];
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}

	sort(a, a + N, greater<int>());

	vector<int> b;

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

	/*	cout << "a[i]=" << a[i] << " ";
		cout << endl;
	*/	if (a[i] != a[i + 1])
			b.push_back(a[i]);
	
	}
	
	b.push_back(a[N-1]);
	
	cout << b.size() << endl;
	/*for (int i = 0; i < b.size(); ++i) {

		cout << "b[i]=" << b[i] << " ";
	}
*/

}

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

using namespace std;

int main(){

 int i, j;
 for(i=1;i<10;i++){
  for(j=1;j<10;j++){
   printf("%dx%d=%d\n", i, j, i*j);
  }
 }

    return 0;
}

Measured memory_bytes: 1096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pi 3.1415926536
#define pb push_back
#define N 1000000007
#define M 998244353
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define nrep(i,a,b) for(int i=a;i>=b;i--)
int main(){
    ll t,i,j,l,h,n,x,k;
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll a[6];
    rep(i,1,5) cin>>a[i];
    rep(i,1,5){
    	if(a[i] == 0) cout<<i;
	}
}

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

int main()
{
  string s;
  cin >> s;
  if (s == "Sunny") {
    cout << "Cloudy\n";
  } else if (s == "Cloudy") {
    cout << "Rainy\n";
  } else if (s == "Rainy") {
    cout << "Sunny\n";
  } else {
    cout << "Error\n";
    return 1;
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
red = []
blue = []

for _ in range(n):
    a,b = map(int,input().split())
    red.append((a,b))

for _ in range(n):
    c,d = map(int,input().split())
    blue.append((c,d))

blue.sort()
red.sort(key=lambda x:(x[1]*(-1)))

bk = [True]*n
rk = [True]*n
point = 0

for i in range(n):
    for j in range(n):
        if blue[i][0] > red[j][0] and blue[i][1] > red[j][1]:
            if bk[i] and rk[j]:
                point += 1
                bk[i] = False
                rk[j] = False

print(point)

Measured memory_bytes: 3064
#pragma comment(linker, "/STACK:1000000000")
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <memory>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <ctime> 
#include <stack>
#include <iostream>

#define mp make_pair
#define pb push_back

typedef long long ll;
typedef long double ld;

using namespace std;

const int MAXN = 200010;

int comp = 0;
const int MODULE = 1000 * 1000 * 1000 + 7;
bool wss[MAXN];
vector <int> e[MAXN];
ll ans = 1;


vector <int> cl[MAXN];
vector <int> mn;
vector <pair <int, int> > b;

ll pw(ll a, int b) {
	if (b == 0) return 1;
	ll v = pw(a, b / 2);
	v = (v * v) % MODULE;
	if (b & 1) v = (v * a) % MODULE;
	return v;
}
ll fct[MAXN];

int main() {
	ios_base::sync_with_stdio(0);
	//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
	int n, x, y;
	scanf("%d%d%d", &n, &x, &y);	
	fct[n] = 1;
	for (int i = 1; i <= n; i++) fct[n] = (fct[n] * i) % MODULE;
	fct[n] = pw(fct[n], MODULE - 2);
	for (int i = n; i >= 1; i--)
		fct[i - 1] = (fct[i] * i) % MODULE;
	for (int i = 0; i < n; i++) {
		pair <int, int> pp;
		scanf("%d%d", &pp.second, &pp.first);
		cl[pp.second].push_back(pp.first);
	}

	for (int i = 1; i <= n; i++) {
		sort(cl[i].begin(), cl[i].end());
		if (cl[i].size() == 0) continue;
		mn.push_back(cl[i][0]);
	}

	mn.push_back(y + 1);
	sort(mn.begin(), mn.end());

	for (int i = 1; i <= n; i++) {
		if (cl[i].size() == 0) continue;
		int dv;
		if (mn[0] == cl[i][0]) dv = mn[1];
		else dv = mn[0];
		int rg = max(x - cl[i][0], y - dv);
		b.push_back(mp(cl[i][0], upper_bound(cl[i].begin(), cl[i].end(), rg) - cl[i].begin()));
	}

	sort(b.begin(), b.end());
	int rg = y - b[0].first;
	int cur = 1;
	for (int i = 0; i < b.size(); i++) {
		if ((i != 0) && (b[i].first > rg)) {
			break;
		}
		for (int j = 0; j < b[i].second; j++) {
			ans = (ans * cur++) % MODULE;
		}
		ans = (ans * fct[b[i].second]) % MODULE;
	}		
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 18292
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#include<bitset>
#include<stack>
#include<time.h>



#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define ALL(x) x.begin(),x.end()
#define sz(a) ((int)a.size())
#define getmid ((l+r)>>1)
#define mst(var,val) memset(var,val,sizeof(var))
#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define lowbit(x) x&(-x)
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ls rt<<1
#define rs rt<<1|1
using namespace std;
#ifdef local
#define dbg(args...) cout << #args << " -> ", err(args);
void err(){ cout << endl; }
template<typename T, typename... Args>
void err(T a, Args... args){ cout << a << ' '; err(args...); }
#else
#define dbg(args...)
#endif // local

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <double, double> pdd;
const int inf=0x3f3f3f3f;
const long long INF=0x3f3f3f3f3f3f3f3fLL;
const double PI=acos(-1.0);
const long double eps=1e-8;
const int mod=1e9+7;
const int maxn=3e5+100;
const int N=1e6+1000;
const int M=500+10;
const ll mm=(1LL<<32);

template <class T>
inline void read(T &x)
{
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar())
        f ^= c == '-';
    for (; isdigit(c); c = getchar())
        x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    T y = 1;
    int len = 1;
    for (; y <= x / 10; y *= 10)
        ++len;
    for (; len; --len, x %= y, y /= 10)
        putchar(x / y + 48);
}
ll qpow(ll a,ll b,ll mod)
{
    ll ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%mod;
        b>>=1;
        a=(a*a)%mod;
    }
    return ans;
}



int main()
{
#ifdef local
    freopen("in.txt","r",stdin);
#endif // local
    IOS;
    ll n;cin>>n;
    ll len=1,tmp=26;
    while(n>tmp)
    {
        n-=tmp;
        tmp*=26;
        len++;
    }
    n-=1;
    string ans="";
    for(int i=1;i<=len;++i)
    {
        ans+='a'+n%26;
        n/=26;
    }
    reverse(ALL(ans));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXD = 12;

struct Prob {
    int score, p, c;
} P[MAXD];

int main() {
    int D, G, ans = 0;
    scanf("%d %d", &D, &G);
    for (int i = 0; i < D; i++) {
        scanf("%d %d", &P[i].p, &P[i].c);
        P[i].score = 100 * (i + 1);
        ans += P[i].p;
    }

    for (int s = 0; s < 1 << D; s++) {
        int sum = 0, cnt = 0, restMax = -1;

        for (int i = 0; i < D; i++) {
            if (s & (1 << i)) {
                sum += P[i].score * P[i].p + P[i].c;
                cnt += P[i].p;
            } else {
                restMax = i;
            }
        }

        if (sum < G) {
            int need = (G + P[restMax].score - 1 - sum) / P[restMax].score;
            if (need > P[restMax].p) continue;
            cnt += need;
        }

        ans = min(ans, cnt);
    }

    printf("%d\n", ans);

    return 0;
}


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

#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctz(x)
#define setbitsll(x) __builtin_popcountll(x)
#define zerobitsll(x) __builtin_ctzll(x)
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef map<int,int> mii;

const int MOD = 1e9+7;
const ll maxVal = 1e18;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	ll * arr = new ll [n];
	bool zero = false;
	for (int i = 0;i < n;++i) {
		cin >> arr[i];
		if (arr[i] == 0ll) {
			zero = true;
		}
	}
	ll res = 1ll;
	if (zero) {
		cout << 0 << '\n';
		delete [] arr;
		return 0;
	}
	for (int i = 0;i < n;++i) {
		if (res > maxVal/arr[i]) {
			cout << -1 << '\n';
			delete [] arr;
			return 0;
		} else {
			res = res*arr[i];
		}
	}
	delete [] arr;
	cout << res << '\n';
	return 0;
}



Measured memory_bytes: 3836
import java.util.*;
import java.io.*;
 
public class Main{
 
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int[] A = new int[N];
        for(int i = 0; i < N; i++){
            A[i] = s.nextInt();
        }
        boolean is = false;
        for(int i = 0; i < N; i++){
            if(A[i] % 2 == 0){
                if(A[i] % 3 == 0 || A[i] % 5 == 0){

                }else{
                    is = true;
                }
            }
        }
        
        if(is){
            System.out.println("DENIED");
        }else{
            System.out.println("APPROVED");
        }
	}
} 

Measured memory_bytes: 23892
import java.util.Scanner;

public class Main {

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

        final long N = sc.nextLong();

        int ans = Integer.MAX_VALUE;
        for (int i = 1; i <= Math.sqrt(N); i++) {
            if (N % i == 0) {
                int a = String.valueOf(i).length();
                int b = String.valueOf(N / i).length();
                ans = Math.min(Math.max(a,b), ans);
            }
        }

        System.out.println(ans);
    }
}


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

int min(int x, int y)
{
    if (x <= y) return x;
    else return y;
}

int max(int x, int y)
{
    if (x >= y) return x;
    else return y;
}

int main()
{
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    int ans = max(a, max(b, c)) - min(a, min(b, c));
    printf("%d\n", ans);
    return 0;
}


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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

ll N;

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

	while (N > 0) {
		vec.pb(N % 10);
		N /= 10;
	}

	int ret = 0;
	reverse(ALL(vec));

	int c = 0;

	rep(i, vec.size()) {
		c += vec[i];
	}

	cout << max(c, vec[0]-1+9*((int)vec.size()-1)) << endl;

	return 0;
}

Measured memory_bytes: 256
// ~/SolverToBe/Developers/Corvus
// ~/sudo apt-get verdict Accpeted

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <memory.h>
#include <limits.h>
#include <math.h>
#include <string.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <functional>
#include <assert.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int N = 100005, M = 1000005;
const ll MOD = 1e9 + 7;
const double eps = 1e-9;

int n,k,a[N],dp[105][N],s[N];

void build(int j) {
    s[0] = dp[j][0];
    for(int i=1; i<=k; i++)
        s[i] = (s[i-1] + dp[j][i])%MOD;
} 

int main() {
    scanf("%d%d",&n,&k);
    for(int i=0; i<n; i++)
        scanf("%d",a+i);
    for(int i=0; i<=min(k,a[n-1]); i++)
        dp[n-1][i] = 1;
    build(n-1);
    for(int i=n-2; i>=0; i--) {
        for(int j=0; j<=k; j++) {
            int l = max(0, j-a[i]), r = j;
            dp[i][j] = (s[r] - (l ? s[l-1] : 0) + MOD)%MOD;
        }
        build(i);
    }
    printf("%d\n", dp[0][k]);
    return 0;
}

Measured memory_bytes: 41216
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    int k;
    cin>>s>>k;
    int n=s.length();
    for(int i=0;i<n&&i<k;i++){
        if(s[i]!='1'){
            cout << s[i]<<endl;
            return 0;
        }
        if(i==k-1){
            cout << 1<<endl;
        }
    }

    return 0;
}


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

const int BIT_LENGTH = 64;

uint64_t pow64(const uint64_t base, const uint64_t index) {
    uint64_t x = 1;
    for(uint64_t i = 0; i < index; ++i) {
        x *= base;
    }
    return x;
}

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

    auto a = std::vector<uint64_t>(n, 0);

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

    auto zeros = std::vector<uint64_t>(BIT_LENGTH, 0);
    auto ones = std::vector<uint64_t>(BIT_LENGTH, 0);

    for(int i = 0; i < n; ++i) {
        uint64_t mask = 1;
        for(int b = 0; b < BIT_LENGTH; ++b) {
            if(a[i] & mask) {
                ++ones[b];
            } else {
                ++zeros[b];
            }
            mask <<= 1;
        }
    }

    uint64_t result = 0;
    uint64_t pow2 = 1;
    const uint64_t mod = pow64(10, 9) + 7;

    for(int b = 0; b < BIT_LENGTH; ++b) {
        uint64_t s = (ones[b] * zeros[b]) % mod;
        s = (s * pow2) % mod;
        result = (result + s) % mod;
        pow2 = (2 * pow2) % mod;
    }

    std::cout << result;

    return 0;
}


Measured memory_bytes: 2560
N = gets.to_i
Hn = gets.split.map(&:to_i)

max = Hn.max

count = 0
max.times do |i|
  succ = false
  Hn.each do |h|
    if h > i
      count += 1 unless succ
      succ = true
    else
      succ = false
    end
  end
end

p count


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
  int n = 20;
  int L;cin >> L;
  WeightedGraph G(n);
  vector<int> sum(n);
  int M = 0;
  int n2 = 19;
  for(int i = 1; i < n; ++i){
    G[i-1].push_back({i,0});
    int beki = (1<<(i-1));
    sum[i]=sum[i-1]+beki;
    if(sum[i]<L){
      G[i-1].push_back({i,beki});
      M = 2*beki;
      ++n2;
    }
  }
  for(int i = n-1; i >= 0; --i){
    if(sum[i]+M<L){
      G[i].push_back({n-1,M});
      M += sum[i]+1;
      ++n2;
    }
  }
  cout << n << " " << n2 << endl;
  for(int i = 0; i < n; ++i){
    for(auto e : G[i]){
      cout << i+1 << " " << e.first+1 << " " << e.second << endl;
    }
  }
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
#define N 158
int n,s,p,dp1[N],dp2[N][N][N],pw[N];
int solve(int m)
{
	dp1[0]=1;
	for(int i=1;i<=m;i++)
	{
		if(i>s/2+1)dp1[i]=(2ll*dp1[i-1]-dp1[i-s/2-2]+p)%p;
		else if(i==s/2+1)dp1[i]=(2ll*dp1[i-1]-1+p)%p;
		else dp1[i]=2ll*dp1[i-1]%p;
	}
	return dp1[m];
}
int main()
{
	scanf("%d%d%d",&n,&s,&p);
	pw[0]=1;for(int i=1;i<=150;i++)pw[i]=pw[i-1]*2%p;
	if(~s&1)printf("%lld\n",1ll*solve(n/2)*solve(n-n/2)%p);
	else 
	if(s==1) s=4,printf("%d\n",solve(n));
	else 
	{
		int l2=n/2,l1=n-n/2;
		if(n<=s){int as=1;for(int i=1;i<=n;i++)as=as*2%p;printf("%d\n",as);return 0;}
		for(int i=0;i<=(s+1)/2;i++)dp2[0][0][i]=(s+1)/2==i?1:pw[(s+1)/2-i-1];
		for(int i=0;i<l1-(s+1)/2;i++)
		for(int j=0;j<=s+1;j++)
		for(int k=0;k<=n;k++)
		if(dp2[i][j][k])
		{
			dp2[i+1][0][0]=(dp2[i+1][0][0]+dp2[i][j][k])%p;
			dp2[i+1][0][k+1]=(dp2[i+1][0][k+1]+dp2[i][j][k])%p;
			if(j<s+1)
			{
				dp2[i+1][j==0?0:j+1][0]=(dp2[i+1][j==0?j:j+1][0]+dp2[i][j][k])%p;
				int st=j<k+1?k+2:j+1;
				if(st<=s+1)dp2[i+1][st][k+1]=(dp2[i+1][st][k+1]+dp2[i][j][k])%p;
			}
		}
		int as=0,ls=l2-(l1-(s+1)/2);
		for(int i=0;i<=s+1;i++)
		for(int j=0;j<=n;j++)
		{
			int tp=dp2[l1-(s+1)/2][i][j],s1=pw[ls];
			if(ls-(s+2-i)>=0)
			s1=(s1-pw[ls-(s+2-i)]+p)%p;
			as=(as+1ll*tp*s1)%p;
		}
		printf("%d\n",as);
	}
}

Measured memory_bytes: 6528
package main

import "fmt"

func main() {
	var r, d int
	var x []int

	var tmp int
	fmt.Scan(&r, &d, &tmp)
	x = []int{tmp}

	for i := 0; i < 10; i++ {
		res := r*x[i] - d
		x = append(x, res)
		fmt.Println(res)
	}
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main()
{
    int ab; //辺AB
    int bc; //辺BC
    int ca; //辺cb
    int s; // 面積
    cin >> ab >> bc >> ca; //各辺の値の入力
    s = ((ab * bc) / 2); //面積を求める
    cout << s << '\n'; //面積を表示
}

Measured memory_bytes: 256
#define ll int
#define pb push_back
#define make_pair mp
#define first f
#define second s
#define upper_bound ub
#define lower_bound lb
#define MOD 1000000007
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;


#define ordered_set tree<pair<ll,ll> , null_type,less<pair<ll,ll> >, rb_tree_tag,tree_order_statistics_node_update>ll fn
ll st[300000*4+5],len=1;
void update(ll ver, ll left, ll right, ll ind, ll val){
    if(left==right && left==ind){
        st[ver]=max(st[ver],val);
    }
    else if(left>ind||right<ind){
        return;
    }
    else{
        ll mid = left + (right-left)/2;
        update(2*ver+1,left,mid,ind,val);
        update(2*ver+2,mid+1,right,ind,val);
        st[ver]=max(st[2*ver+1],st[2*ver+2]);
    }
}
void get_max(ll ver, ll left, ll right, ll leftq, ll rightq, ll &maxans){
    if(left==right && left>=leftq && left<=rightq){
        maxans=max(maxans,st[ver]);
    }
    else if(leftq>right||rightq<left){
        return;
    }
    else if(leftq<=left && rightq>=right){
        maxans=max(maxans,st[ver]);
    }
    else{
        ll mid = left + (right-left)/2;
        get_max(2*ver+1,left,mid,leftq,rightq,maxans);
        get_max(2*ver+2,mid+1,right,leftq,rightq,maxans);
    }
}
void solve(){
  ll n,k;cin>>n>>k;
  ll a[n];
  for(ll i=0;i<n;i++){
    cin>>a[i];
  }
  while(len<=300000){len*=2;}
  memset(st,0,sizeof(st));
  ll ans=0;
  for(ll i=0;i<n;i++){
    ll val=a[i];
    ll max_ans=0;
    get_max(0,0,len-1,val-k,val+k,max_ans);
    ans=max(max_ans+1,ans);
    update(0,0,len-1,val,max_ans+1);
  }
  cout<<ans;
}

int main ()
{
  ios_base::sync_with_stdio (false);
  cin.tie (NULL);
  ll t;
  //cin>>t;
  t = 1;
  while (t)
    {
      solve();t--;
      //cout<<"end of test case"<<endl;
    }
  return 0;
}


Measured memory_bytes: 9468
X=[]
while(True):
    h,w=map(int,input().split())
    if (h,w)==(0,0):
        break
    else:
        X.append((h,w))
Y=[]
N=200
for h in range(1,N+1):
    for w in range(h+1,N+1):
        Y.append((h*h+w*w,min(h,w),h,w))
Y.sort()
Z=[[-1 for i in range(N+1)] for j in range(N+1)]
for i in range(len(Y)):
    p,q,r,s=Y[i]
    Z[r][s]=i
#(h*h+w*w,min(h,w))
for seq in X:
    h,w=seq
    x,y,a,b=Y[Z[h][w]+1]
    print(a,b)



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

int main() {
  int x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> x1 >> y1 >> x2 >> y2;
  
  x3 = x2 + y1 - y2;
  y3 = y2 - x1 + x2;
  x4 = x1 + y1 - y2;
  y4 = y1 - x1 + x2;    
  
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
  
  return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Solve());
            return;
        }

        private static int Solve()
        {
            var nmStr = Console.ReadLine()
                .Split(' ')
                .Select(x => int.Parse(x))
                .ToArray();
            var n = nmStr[0];
            var m = nmStr[1];

            var loved = new bool[m];
            for (int i = 0; i < m; i++) loved[i] = true;

            for (int i = 0; i < n; i++) UpdateLoved(m, loved);

            return loved.Count(x => x);
        }

        private static void UpdateLoved(int m, bool[] loved)
        {
            var arr = Console.ReadLine()
                .Split(' ')
                .Select(x => int.Parse(x))
                .Skip(1);
            foreach (var e in Enumerable.Range(1, m).Except(arr)) loved[e - 1] = false;
        }
    }
}


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

#define lp(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define ff first
#define ss second

using namespace std;

void elimBlocks(){
    string s;
    cin >> s;
    int countZ = 0, countO = 0;
    for (int i = 0; i < s.size(); i++){
        if (s.at(i) == '1')
            countO++;
        else
            countZ++;
    }
    cout << 2 * min(countO, countZ);
}

int main() {
    elimBlocks();
}


Measured memory_bytes: 512
def min(a,b)
  if a<b
    return a
  else
    return b
  end
end

n,m=gets.chomp.split(/ /).map{|i| i.to_i}
c=Array.new(m)
c=gets.chomp.split(/ /).map{|i| i.to_i}
d=Array.new(m).map{Array.new(n+1,10000)}
for i in 0..m-1
  d[i][0]=0
end
for j in 0..n
  if j%c[0]==0
    d[0][j]=j/c[0]
  end
end
for i in 1..m-1
  for j in 1..n
    if j>=c[i]
      d[i][j]=min(d[i-1][j],d[i][j-c[i]]+1)
    else
      d[i][j]=d[i-1][j]
    end
  end
end
puts d[m-1][n]

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

int main(){
    int N; cin >> N;
    vector<int> L(N);
    vector<vector<int>> plus(N, vector<int>(N));
    ll ans =0;

    rep(i,N){
        cin >> L[i];
    }

    sort(L.begin(), L.end());



    rep(i,N-2){
        for(int j=i+1;j <N-1; j++){

        plus[i][j] = L[i]+L[j];

            for(int k=j+1; k <N; k++){

                if(L[k] < plus[i][j]){
                    ans++;
                }
                
            }

        }
    }

    cout << ans << endl;
}



Measured memory_bytes: 16000
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力(スペース改行関係なし)
		double n = sc.nextInt();
      	double x = sc.nextInt();
      	int t = sc.nextInt();
		double kaisuu = Math.ceil(n/x);
		System.out.println((int)kaisuu * t);

		
	}
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    string s;cin>>s;

    if(s.find("AC")!=string::npos)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

int main() {
  int N;
  string a;
  string s = "Three";
  cin >> N;
  for (int i=0; i<N; i++) {
    cin >> a;
    if (a == "Y") {
      s = "Four";
    }
  }
  cout << s << endl;
}


Measured memory_bytes: 256
def main():
	n = int(input())
	r = [0]*5
	r[0] = int(input())
	r[1] = int(input())
	r[2] = int(input())
	r[3] = int(input())
	r[4] = int(input())
	total = 4
	min_r = min(r)
	div = n // min_r
	mod = n % min_r
	total += div
	if mod != 0:
		total += 1

	print(total)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
// let input = "3000";

function main(input){
  input = input.trim();
  input = parseInt(input);
  let amari = input%1000;
  let answer;
  
  if(amari===0){
    answer = 0;
  }else{
    answer = 1000 - amari;
  }
  console.log(answer);
}
main(require("fs").readFileSync("/dev/stdin","utf8"));


Measured memory_bytes: 30736
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int N;
  vector<int> v;

  cin >> N;

  for (int i = 0; i < N; i++) {
    int t;
    cin >> t;
    v.push_back(t - 1);
  }

  int c = 0;
  for(int i = 0; i < N; i++) {
    if(v[v[i]] == i) c++;
  }

  cout << c / 2 << endl;
}

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

int main() {
	int64_t A, B, C, K;
	cin >> A >> B >> C >> K;
	int64_t ans = A - B;
	if (K % 2 == 1) ans = -ans;
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

A_n+1 = B_n + C_n
B_n+1 = A_n + C_n
C_n+1 = A_n + B_n
よってA_n+1 - B_n+1 = B_n - A_n
正負が逆転するだけ
*/

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    int a[100][2];
    for (int i=0; i<n; i++){
        cin >> a[i][0] >> a[i][1];
    }
    // Be careful when the loop ends
    for (int i=0; i<n-2; i++){
        if(a[i][0]==a[i][1] && a[i+1][0]==a[i+1][1] && a[i+2][0]==a[i+2][1]){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}

Measured memory_bytes: 3596
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] d = new int[N];
		int from, to;

		for (int i = 0; i < N; i++) {
			d[i] = sc.nextInt();
		}

		Arrays.sort(d);

		from = d[N / 2 - 1];
		to = d[N / 2];

		System.out.println(to - from);
	}
}


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

using namespace std;

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int x = x2 - x1;
    int y = y2 - y1;
    cout << x2 - y << " " << y2 + x << " " << x1 - y << " " << y1 + x << endl;
    return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define mp make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<=n;i++)
ll mod=1000000007;
ll n,k,t,m,q,flag=0;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(a) -- no. of elements strictly less than a
// s.find_by_order(i) -- itertor to ith element (0 indexed)
ll min(ll a,ll b){if(a>b)return b;else return a;}
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}

map<ll,ll>m1[300005];
map<ll,ll>c1;
ll cc[300005];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifdef NOOBxCODER
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #else 
    #define NOOBxCODER 0
    #endif
    //cin>>t;
    t=1;
    while(t--){
        cin>>n>>m;cin>>k;
        fo1(i,m)cc[i]=0;
        fo(i,k){
            ll a,b;
            cin>>a>>b;
            c1[a]++;
            m1[a][b]=1;
            cc[b]++;
        }
        pll p[m+1];
        fo1(i,m)p[i]=mp(-cc[i],i);
        sort(p+1,p+m+1);
        ll ans=0;
        fo1(i,n){
            for(int j=1;j<m+1;j++){
                if(m1[i][p[j].se]==1){
                    if(j==m)ans=max(ans, c1[i] - p[j].fi-1);
                    else{
                        if(p[j].fi == p[j+1].fi)continue;
                        else{
                            ans=max(ans, c1[i] - p[j].fi-1);
                            break;
                        }
                    }
                }
                else{
                    ans=max(ans, c1[i] - p[j].fi);
                    break;
                }
                
            }
        }
        cout<<ans;




        
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}


Measured memory_bytes: 81116
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <iostream>
#include <deque>
#include <functional>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

#define int long long

#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

#define debug(x) cerr << #x << ": " << x << endl;

const int MOD = 1e9 + 7;

signed main(void)
{
  int num;
  int n;
  int d;
  cin >> n >> d;

  for (int i = 0; i <= n; ++i) {
    if (n <= (2 * d + 1) * i) {
      cout << i << endl;
      break;
    }
  }

}


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

int main()
{
  ll X;
  cin >> X;
  
  ll happy = 0;
  happy += (X / 500) * 1000;
  X = X % 500;
  happy += (X / 5) * 5;
  
  cout << happy << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

int main() {
  unsigned long long N, A, B; cin >> N >> A >> B;

  unsigned long long Ans = ( N/(A+B) ) * A;
  unsigned long long Nokori = N % (A+B);
  Ans += min( Nokori, A );

  cout << Ans << endl;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(1000000)


N, M = map(int, input().split())
C = [set([]) for i in range(N)]


def dfs(n, y):
    seen[n] = True
    y += 1
    for c in C[n]:
        if seen[c]:
            continue
        else:
            y = dfs(c, y)
    return y


for i in range(M):
    a, b = map(int, input().split())
    C[a - 1].add(b - 1)
    C[b - 1].add(a - 1)

ans = 0
seen = [False] * N
for i in range(N):
    if seen[i]:
        continue
    x = 0
    x = dfs(i, x)
    ans = max(ans, x)

print(ans)


Measured memory_bytes: 245732
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		int X = GetInt();
		int Y = GetInt();
		int Z = GetInt();
		WriteLine($"{Z} {X} {Y}");
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

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

using namespace std;

void print(int a) {
	cout << a << " ";
}

int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	int px, py, qx, qy;
	px = x2 - x1;
	py = y2 - y1;

	qx = -py;
	qy = px;

	int x3, y3, x4, y4;
	x3 = x2 + qx;
	y3 = y2 + qy;

	x4 = x3 - px;
	y4 = y3 - py;

	print(x3);
	print(y3);
	print(x4);
	print(y4);

}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    int a, b;
    std::cin >> a >> b;

    if (a == 1) a = 14;
    if (b == 1) b = 14;

    if      (a == b) std::cout << "Draw"  << std::endl;
    else if (a >  b) std::cout << "Alice" << std::endl;
    else             std::cout << "Bob"   << std::endl;       

    return 0;
}


Measured memory_bytes: 256
#pragma region head
    #include <bits/stdc++.h>
    using namespace std;
    using ll = long long;
    using vi = vector<int>;
    using vll = vector<ll>;
    using pi = pair<int, int>;
    using pll = pair<ll,ll>;
    template <class T> using vv = vector<vector<T>>;
    #define rep(i,n) for(int i = 0; i < (int)(n); i++)
    #define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
    #define rrep(i,n) for(int i = (int)(n)-1; i >= 0; i--)
    #define rrepi(i,a,b) for(int i = (int)(b)-1; i >= (int)(a); i--)
    const int INF = 1002003004;
    const ll LINF = 1002003004005006007ll;
    struct preprocess{preprocess()
    {cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}}____;
#pragma endregion head

#pragma region library

#pragma endregion library

int main(){
    int n; cin >> n;
    vector<pi> ls;
    rep(i,n){
        string s; cin >> s;
        int sz = s.length();
        int now=0,btm=0;
        rep(j,sz){
            if(s[j]=='(')now++;
            else now--;
            btm = min(btm, now);
        }
        ls.emplace_back(btm,now);
    }
    sort(ls.begin(), ls.end());
    int total=0;
    bool flag=true;
    while(!ls.empty()){
        int btm,now;
        tie(btm,now) = ls.back();
        if(now<0) break;
        ls.pop_back();
        if(total+btm<0) {flag=false; break;}
        total+=now;
    }
    rep(i,ls.size()){
        int btm,now;
        tie(btm,now) = ls[i];
        btm=btm-now; now=-now;
        ls[i].first=btm; ls[i].second = now;
    }
    int total2=0;
    sort(ls.begin(),ls.end());
    while(!ls.empty()){
        int btm, now;
        tie(btm,now) = ls.back();
        ls.pop_back();
        if(total2+btm<0) {flag=false; break;}
        total2+=now;
    }
    if(flag&&total==total2) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    
    
}

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

long gcd(long m,long n){
  if(!n)return m;
  return gcd(n,m%n);
}
long lcm(long m,long n){
  if(!(m%n&&n%m))return max(m,n);
  return m/gcd(m,n)*n;
}
int main(){
  long n,t=1,c;
  cin>>n;
  for(long i=0;i<n;++i)t=lcm(t,(cin>>c,c));
  cout<<t;
  return 0;
}

Measured memory_bytes: 256
n = gets.to_i
sx, sy = [0, 0]
(1..n).each do |_x|
  x, y = gets.split
  if x == y
    sx += 1
    sy += 1
  elsif x < y
    sy += 3
  else
    sx += 3
  end
end
puts "#{sx} #{sy}"

Measured memory_bytes: 8720
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for (int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
typedef long long ll;

int main()
{
  int N;
  cin >> N;
  rep(i, 8)
  {
    if (N < (1 << i))
    {
      cout << (1 << (i - 1)) << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
int main() {
    int N; cin >> N;
    vector<pair<string, l_l>> v(N);
    for (int i = 0; i < N; i++) {
        string s;
        int p;
        cin >> s >> p;
        v[i] = v[i] = {s, {-p, i + 1}};
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < N; i++){
        cout << v[i].second.second << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<sstream>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> b;
	int btmp;
	if(n%2 ==0)
		for (int i = 0; i < n; i++) {
			cin >> btmp;
			if (i % 2 == 0)
				b.push_back(btmp);
			else
				b.insert(b.begin(), btmp);
		}
	else
		for (int i = 0; i < n; i++) {
			cin >> btmp;
			if (i % 2 != 0)
				b.push_back(btmp);
			else
				b.insert(b.begin(), btmp);
		}
	auto itr = b.begin();
	string out = "";
	while (itr != b.end()) {
		string s = (itr + 1 == b.end()) ? "" : " ";
		out += to_string(*itr) + s;
		itr++;
	}
	cout << out;
	return 0;
}


Measured memory_bytes: 4980
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{


	public static void main(String[] args){

//		Scanner scan = new Scanner(System.in);
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
			//int n=scan.nextInt();//int?????????int???????????????????????§?????????????????????
			String t=reader.readLine();
			String s=reader.readLine();//String????????????????????????????????????
			int n=Integer.parseInt(t);
			String[] str =s.split(" ");//
			int array_num[]= new int[n];
			long max, min, sum;
			sum=0;
			max=-1000000;
			min=1000000;

			for(int i=0;i<n;i++){
				array_num[i]=Integer.parseInt(str[i]);
				sum+=array_num[i];

				if(array_num[i]>max)max=array_num[i];
				if(array_num[i]<min)min=array_num[i];
			}

			System.out.println(min+" "+max+" "+sum);



	//		scan.close();
			reader.close();
		}catch(IOException e){
			System.out.println("??¨??????:"+e);

		}

	}

}

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

int main()
{
	for (int i = 1; i <= 5; i++)
	{
		int x;
		cin >> x;
		if (x == 0)
		{
			cout << i;
			return 0;
		}
	}
}

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


#define li          long long int
#define uli         unsigned long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



int main() {
    li a,b;
    cin>>a>>b;
    cout<<a/__gcd(a,b)*b<<endl;


    return 0;
}


Measured memory_bytes: 3640