akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define INF 1000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> P;

ll N, M;

int main(){
    cin >> N >> M;
    
    ll ans = 1;
    vector<int> n;
    for(ll i=1;i*i<=M;i++){
        if(M % i == 0){
            n.push_back(i);
            n.push_back(M/i);
        }
    }
    sort(n.begin(), n.end());
    ans = *(upper_bound(n.begin(), n.end(), M/N) - 1);
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{  int n;
 cin>>n;
 long int sum=0;
 for(int i=1;i<=n;i++)
 { if(i%3!=0 && i%5!=0 && i%15!=0)
    {   sum=sum+i;
    }
  }
 cout<<sum;

}


Measured memory_bytes: 3172
#include <stdio.h>

int is_prime(int x)
{
	if(x == 1) { return 0; }
	if(x == 2) { return 1; }

	if(x % 2 == 0)
	{
		return 0;
	}
	
	for(int i = 3; i * i <= x; i += 2)
	{
		if(x % i == 0)
		{
			return 0;
		}
	}

	return 1;
}

int main()
{
	int n, x, cnt = 0;
	scanf("%d", &n);
	for(int i = 0; i < n; ++i)
	{
		scanf("%d", &x);
		cnt += is_prime(x);
	}
	printf("%d\n", cnt);
}



Measured memory_bytes: 2036
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <tuple>

using namespace std;
int main(){
    
    string s;
    cin >> s >>s;
    string y = "Yes";
    string n = "No";
    int ct = 0;
    for(auto ch : s){
        if(ch=='R')ct++;
    }
    string ret=n;
    if (ct > s.size()-ct) ret = y;
    cout << ret << endl;
}


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

const int N = 2e5 + 5;

struct NODE {
  int val, who, id;
  friend bool operator < (NODE a, NODE b) {
    return a.val < b.val;
  }
}P[N];

int n, m, x, y, A[N][2], tot;

bool vis[N][2];

int main() {
  cin >> n;
  for(int i = 1; i <= n; ++ i) {
    scanf("%d%d", &A[i][0], &A[i][1]);
    P[++ tot] = (NODE){A[i][0], i, 0};
    P[++ tot] = (NODE){A[i][1], i, 1};
  }
  sort(P + 1, P + tot + 1);
  long long ans = 0;
  for(int i = 1; i <= n; ++ i) {
    vis[P[i].who][P[i].id] = 1;
    ans += P[i].val;
  }
  int l = 0, r = 0;
  for(int i = 1; i <= n; ++ i) {
    l += vis[i][0];
    r += vis[i][1];
    if(vis[i][0] == vis[i][1]) {
      printf("%lld\n", ans);
      return 0;
    }
  }
  if(l == n || r == n) {
    cout << ans << endl;
    return 0;
  }

  int res = 1e9;

  vis[P[n + 1].who][P[n + 1].id] = 1;
  for(int i = 1; i <= n; ++ i) {
    if(!vis[P[i].who][P[i].id ^ 1]) {
      res = min(res, P[n + 1].val - P[i].val);
    }
    else res = min(res, P[n + 2].val - P[i].val);
  }
  cout << ans + res << endl;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define N 10000
using namespace std;
inline void read(int &x)
{
	x=0;
	static int p;p=1;
	static char c;c=getchar();
	while(!isdigit(c)){if(c=='-')p=-1;c=getchar();}
	while(isdigit(c)) {x=(x<<1)+(x<<3)+(c^'0');c=getchar();}
	x*=p;
}
int n;
struct node
{
	int a,b;
	bool operator <(const node &ss)const
	{
		return a+b<ss.a+ss.b;
	}
}e[N],x[N];
int vis[N];
int to[N<<3],beg[N>>3],nex[N<<3];
int cnt;
void add(int x,int y)
{
	to[++cnt]=y;
	nex[cnt]=beg[x];
	beg[x]=cnt;
}
int match[N<<3];
bool dfs(int x)
{
	for(int i=beg[x];i;i=nex[i])
    {
		int y=to[i];
        if(!vis[y])
        {
            vis[y]=1;
            if(!match[y]||dfs(match[y]))
            {
                match[y]=x;
                return 1;
            }
        }
    }
    return 0;
}
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	for(int i=1;i<=n;i++)
		read(e[i].a),read(e[i].b);
	for(int i=1;i<=n;i++)
		read(x[i].a),read(x[i].b);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(e[i].a<x[j].a&&e[i].b<x[j].b)add(i,j);
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		memset(vis,0,sizeof vis);
		if(dfs(i))ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
bool used[300005];

void solve(){
	for(int i=0;i<n*2-1;i++){
		printf("%d %d\n",i+1,i+2);
	}
}

void solve2(int v){
	printf("%d %d\n",1,2);
	printf("%d %d\n",2,3);
	printf("%d %d\n",3,n+1);
	printf("%d %d\n",n+1,n+2);
	printf("%d %d\n",n+2,n+3);
	for(int i=4;i<n;i+=2){
		printf("%d %d\n",n+1,i);
		printf("%d %d\n",i,i+1);
		printf("%d %d\n",n+1,n+i+1);
		printf("%d %d\n",n+i+1,n+i);
	}
	if(n%2==0){
		for(int i=1;i<=n-1;i++){
			if((n^i^1)<n){
				if(i==1){
					printf("%d %d\n",n+1,n);
				}else if(i==2){
					printf("%d %d\n",n+2,n);
				}else if(i==3){
					printf("%d %d\n",3,n);
				}else if(i%2==0){
					printf("%d %d\n",i,n);
				}else{
					printf("%d %d\n",n+i,n);
				}
				i=(n^i^1);
				if(i==1){
					printf("%d %d\n",n+1,n*2);
				}else if(i==2){
					printf("%d %d\n",n+2,n*2);
				}else if(i==3){
					printf("%d %d\n",3,n*2);
				}else if(i%2==0){
					printf("%d %d\n",i,n*2);
				}else{
					printf("%d %d\n",n+i,n*2);
				}
				break;
			}
		}
	}
}

int main(void){
	scanf("%d",&n);
	if(n<=2){
		printf("No\n");
	}else{
		int v=4;
		while(v<=n+1){
			if(v==(n+1)){
				printf("Yes\n");
				solve();
				return 0;
			}
			if(v==n){
				printf("No\n");
				return 0;
			}
			v*=2;
		}
		printf("Yes\n");
		v/=2;
		solve2(v);
	}
	return 0;
} 

Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  int ans = 0;
  vp lr(N);
  rep(i,N) {
    cin >> lr[i].first >> lr[i].second;
    chmax(ans,lr[i].second-lr[i].first+1);
  }
  sort(rng(lr));
  vvi rmin(2,vi(N+1,INF));
  rep(i,N) {
    rmin[0][i+1] = min(rmin[0][i],lr[i].second);
  }
  drep(i,N) {
    rmin[1][i] = min(rmin[1][i+1],lr[i].second);
  }
  ans += max(0,rmin[0][N]-lr[N-1].first+1);
  srep(k,1,N) {
    int l = max(0,rmin[0][k]-lr[k-1].first+1);
    int r = max(0,rmin[1][k]-lr[N-1].first+1);
    chmax(ans,l+r);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <cmath>
using namespace std;
int main() {
    long long n;
    int t = 0;
    cin >> n;
    for (long long i = 1; (i * i) <= n; i+=2) {
        int p = (i == 1) ? 2 : i;
        int c = 0;
        while (n % p == 0) {
            n /= p;
            c++;
        }
        if (c > 0) {
            for (int j = 1; c >= j; j++) {
                c -= j;
                t++;
            }
        }
    }
    if (n > 1) {
        t++;
    }
    cout << t << endl;
}


Measured memory_bytes: 3676
flag = 0
s = input()

a = s[0:2]
b = s[2:-1]
c = s[-1:]





if a[0] == 'A':
    if b.count('C') == 1:
        a = a.replace('A', '', 1)
        b = b.replace('C', '', 1)
        s = a+b+c
        if s.islower() == True:
            flag = 1

if flag == 1:            
    print('AC')
else:
    print('WA')

Measured memory_bytes: 3064
// finish date: 2018/01/10
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <map>
#include <climits>

using namespace std;

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

bool isExist(char c, string str) {
    rep(i, str.length()) {
        if (c == str[i]) return true;
    }
    return false;
}

int fact(int n) {
    int ans = 1;
    FOR(i, 1, n + 1) {
        ans *= i;
    }
    return ans;
}

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    cout << max(A * B, C * D) << endl;


    return 0;
}

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

using namespace std;
////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define LEN(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
using ll = long long;
using llu = long long unsigned;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
using vpii = vector<pii>;

const ld EPS = 1e-9;
inline int cmp(ld x, ld y = 0, ld tol = EPS) {
	return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

const int MOD = 1;
inline int mod(ll x, int m = MOD) {
	return (int)(((x%m) + m)%m);
}

// template<typename T, typename M = __gnu_pbds::null_type>
// using ordered_set = __gnu_pbds::tree<T, M, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

////////////////////////// Solution starts below. //////////////////////////////



int main () {
	// ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.precision(10);
    int n;
    cin>>n;
    n>=30? cout<<"Yes"<<endl:cout<<"No"<<endl;

	return 0;
}

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

typedef complex<double> P;

int main(void){
	while(1){
		int c[3];
		rep(i,3) cin >> c[i];
		if(cin.eof()) break;
		int res=20-c[0]-c[1];
		int num=0;
		range(i,1,11){
			rep(j,3) if(i==c[j]) continue;
			if(i<=res) num++;
		}
		if(num>=4)
			puts("YES");
		else
			puts("NO");
	}
	return 0;
}

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

typedef struct DICE{
    int s[6];
}dice;

dice dice_rotate(dice d, char rotate){
    int swap;
    if(rotate == 'E'){
        swap = d.s[2];
        d.s[2] = d.s[0];
        d.s[0] = d.s[3];
        d.s[3] = d.s[5];
        d.s[5] = swap;
    }else if(rotate == 'N'){
        swap = d.s[4];
        d.s[4] = d.s[0];
        d.s[0] = d.s[1];
        d.s[1] = d.s[5];
        d.s[5] = swap;
    }else if(rotate == 'S'){
        swap = d.s[1];
        d.s[1] = d.s[0];
        d.s[0] = d.s[4];
        d.s[4] = d.s[5];
        d.s[5] = swap;
    }else if(rotate == 'W'){
        swap = d.s[3];
        d.s[3] = d.s[0];
        d.s[0] = d.s[2];
        d.s[2] = d.s[5];
        d.s[5] = swap;
    }

    return d;
}

int main(){
    dice d;
    char rotate;
    int i,ensw;
    string rotate_list;

    for(i=0;i<6;i++){
        cin >> d.s[i];
    }

    cin >> rotate_list;

    for(i=0;i<rotate_list.size();i++){
        d = dice_rotate(d, rotate_list[i]);
    }

    cout << d.s[0] << endl;

    return 0;
}




Measured memory_bytes: 3224
n = int(input())
aa = list(map(int, input().split()))
bit = [[0] * 21 for _ in range(n)]
for i, a in enumerate(aa):
    for j in range(21):
        a, m = divmod(a, 2)
        if m: bit[i][j] = 1
#for x in bit:
#    print(x)
last = [-1] * 21
L = R = 0
ans = 0
while R < n:
    out = []
    nextL = []
    for j in range(21):
        if bit[R][j]:
            if last[j] == -1:
                last[j] = R
            else:
                out.append(j)
                nextL.append(last[j])
                last[j] = R
    #    print(L,R,ans,last)
    if out:
        #        print(out)
        d1 = R - L
        L = max(nextL) + 1
        d2 = R - L + 1
        #        print(d1,d2,(d1+d2)*(d1-d2+1)//2)
        ans += (d1 + d2) * (d1 - d2 + 1) // 2
        for j in range(21):
            if last[j] < L:
                last[j] = -1
    R += 1
d = n - L
ans += d * (d + 1) // 2
print(ans)


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

int main()
{
	int antena[5];
	int k;
	scanf("%d%d%d%d%d%d", &antena[0], &antena[1], &antena[2], &antena[3], &antena[4], &k);

	for (int i = 0; i < 5; i++) {	/* start number */
		for (int j = i + 1; j < 5; j++) {
			if (antena[j] - antena[i] > k) {
				printf(":(\n");
				return 0;
			}
		}
	}
	
	printf("Yay!\n");
	

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<tuple>
#include<set>
#include<unordered_map>
#include<string>
#include<map>
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int> P;
typedef pair<int, P> PP;
const long long inf = 1ll << 61;
const int mod = 1000000007;
typedef tuple<int, int, int> T;
int x[3005], y[3005];
int gcd(int a, int b) {
	if (!b)return a; return gcd(b, a%b);
}
unordered_map<int, int>M2;
map<T, int>M;
int hash2(int a, int b, int c) {
	int x = 30000;
	a += x; b += x; c += x;
	return c + b*x + a*x*x;
}
signed main() {
	int n, k; cin >> n >> k;
	rep(i, n)cin >> x[i] >> y[i];
	rep(i, n) {
		for (int j = i + 1; j < n; j++) {
			int b = x[i] - x[j], a = y[i] - y[j], c = x[i] * y[j] - x[j] * y[i];
			if (b < 0) {
				a *= -1; b *= -1; c *= -1;
				
			}
			else if (b == 0) {
				if (a < 0) {
					b *= -1; c *= -1;
				}
			}
			int G = gcd(a, gcd(abs(b), abs(c)));
			a /= G; b /= G; c /= G;
			M2[hash2(a, b, c)]++;
	//		M[T(a,b,c)]++;
	//		cout << b << ' ' << a << ' ' << c << endl;
		}
	}
	k = k*(k - 1) / 2;
	for (auto itr = M2.begin(); itr != M2.end(); itr++) {
		if (itr->second >= k) {
			cout << 1 << endl; return 0;
		}
	}
	cout << 0 << endl;
}



Measured memory_bytes: 242084
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	a, b := scanInt(), scanInt()
	fmt.Println(a * b)
}


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

namespace ABC138_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var v = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Array.Sort(v);
            var ans = (v[0] + v[1]) / 2.0;
            for (int i = 2; i < v.Length; i++)
            {
                ans = (ans + v[i]) / 2.0;
            }

            Console.WriteLine(ans);
        }
    }
}


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

signed main() {
    int a,b;
    cin >> a >> b;
    if (a == 1) {a = 14;};
    if (b == 1) {b = 14;};
    if (a > b) {
        cout << "Alice" << endl;
        return 0;
    }
    if (a == b) {
        cout << "Draw" << endl;
        return 0;
    }
    cout << "Bob" << endl;
}

Measured memory_bytes: 256
#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+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  vll a(n);
  bool flg=false;
  rep(i,n){
    cin>>a[i];
    if(a[i]==0) flg=1;
  }
  if(flg){
    cout<<0<<endl;
    return 0;
  }
  ll ans=1;
  rep(i,n){
    ll tmp=LINF;
    tmp/=ans;
    tmp/=a[i];
    if(tmp<1){
      cout<<-1<<endl;
      return 0;
    }
    
    ans*=a[i];
    if(ans>LINF){
      cout<<-1<<endl;
      return 0;
    }
  }
  cout<<ans<<endl;
  
}

Measured memory_bytes: 3972
#include<iostream>
#include<set>
using namespace std;
int main(){
  	string s;
  	cin>>s;
  	set<char>a;
  	a.insert(s[0]);
  	a.insert(s[1]);
  	a.insert(s[2]);
  	a.insert(s[3]);
  	if(a.size()==2)
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
c = Counter(A).most_common()
l = 0
s = 0
for e in c:
    if e[1] >= 4 and e[0] > l:
        l = e[0]
        s = e[0]
    elif e[1] >= 2 and e[0] > l:
        s = l
        l = e[0]
    elif e[1] >= 2 and e[0] > s:
        s = e[0]
print(l * s)

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

#define int long long

int N, K;
vector<int> G[100001];
int ans = 0;

int dfs(int v, bool f) {  
  if ( G[v].size() == 0 ) return 1;
  int ma = (int)0;  
  for ( int u : G[v] ) {
    if ( u == v ) continue;    
    if ( v ) ma = max(ma, dfs(u, false)+1);
    if ( !v ) ma = max(ma, dfs(u, true)+1);    
  }

  if ( ma >= K ) {
    if ( v && !f ) ans++;
    // cout << v << " " << ma << endl;
    return 0;    
  } else {
    return ma;    
  }
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin >> N >> K;

  int not1 = 0;
  vector<int> A(N);  
  for ( int i = 0; i < N; i++ ) {
    int a;
    cin >> a;
    a--;    
    A[i] = a;    
    if ( a ) not1++;
    if ( i == 0 ) {
      if ( a ) ans++;      
    } else {
      G[a].push_back(i);
    }
  }

  if ( K == 1 ) {
    cout << not1 << endl;    
  } else {
    dfs(0, true);    
    cout << ans << endl;    
  }
  
  return 0;
}


Measured memory_bytes: 11264
N = int(input())
p_list = [0] + [int(e) for e in input().split()]

ans = 0
i = 1

if p_list[1] == 1:
    ans += 1
    #print("swap",p_list[1],"⇔",p_list[2])
    p_list[1],p_list[2] = p_list[2],p_list[1]

i += 1

while i <= N-1:
    if p_list[i] == i:
        if p_list[i+1] == i+1:
            ans += 1
            #print("swap",p_list[i],"⇔",p_list[i+1])
            p_list[i],p_list[i+1] = p_list[i+1],p_list[i]
        else:
            ans += 1
            #print("swap",p_list[i],"⇔",p_list[i-1])
            p_list[i],p_list[i-1] = p_list[i-1],p_list[i]
            
    i += 1
    
if p_list[N] == N:
    ans += 1
    
#print(p_list)
print(ans)

Measured memory_bytes: 13880
//#pragma GCC optimize("O3", "unroll-loops")
//#pragma GCC target("avx2")
#include<bits/stdc++.h>

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FIXED cout << fixed << setprecision(12)
#define RANDOM srand(94385)
#define all(a) a.begin(), a.end()
#define shuffle(a) \
    for (int i = 0; i < sz(a); ++i) \
        swap(a[i], a[rand() % sz(a)]);
#define enter putchar('\n')
#define space putchar(' ')
#define Mem(a, x) memset(a, x, sizeof(a))
using namespace std;

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

void debug_out() { cerr << '\n'; }

template<typename T, typename ...R>
void debug_out(const T &f, const R &...r) {
    cerr << f << " ";
    debug_out(r...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__);

inline ll read() {
    ll x = 0;
    int f = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9') f |= (ch == '-'), ch = getchar();
    while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
    return x = f ? -x : x;
}

inline void write(ll x) {
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[23];
    int l = 0;
    while (x != 0)s[l++] = x % 10 + 48, x /= 10;
    while (l)putchar(s[--l]);
}

int lowbit(int x) { return x & (-x); }

template<class T>
T big(const T &a1, const T &a2) { return a1 > a2 ? a1 : a2; }

template<typename T, typename ...R>
T big(const T &f, const R &...r) { return big(f, big(r...)); }

template<class T>
T sml(const T &a1, const T &a2) { return a1 < a2 ? a1 : a2; }

template<typename T, typename ...R>
T sml(const T &f, const R &...r) { return sml(f, sml(r...)); }

template<class T, class U>
inline void checkMin(T &x, U y) { if (y < x) x = y; }

template<class T, class U>
inline void checkMax(T &x, U y) { if (y > x) x = y; }

template<class T, class U>
inline bool ifMax(T &x, U y) {
    if (y > x) return x = y, true;
    return false;
}

template<class T, class U>
inline bool ifMin(T &x, U y) {
    if (y < x) return x = y, true;
    return false;
}

const int M = 212345;// 2e5+5
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1000000007;// 1e9+7

// HAVE FREE OPEN IN MAIN FUNCTION



void init() {
    int n=read();
    write(n*n*n),enter;

}

void solve() {

}

int main() {
    init();

    solve();

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,a,b,j,l,i;
    cin>>k>>a>>b;
    j=0;
    for(i=1;i>0;i++)
    {
        l=k*i;
        if(l>=a&&l<=b)
        {
            j=1;
        }
        if(l>b)
            break;
    }
    if(j==1)
        cout<<"OK";
    else
        cout<<"NG";

}


Measured memory_bytes: 3624
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val (n, m) = sc.intList()
        val x = sc.intList()

        val cnt = Array(m) { 0 }
        val cnt2 = Array(m) { 0 }
        val f = Array(100001) { false }
        for (i in 0 until n) {
            cnt[x[i] % m]++
            if (f[x[i]]) {
                cnt2[x[i] % m]++
                f[x[i]] = false
            } else {
                f[x[i]] = true
            }
        }


        var ans = 0L
        for (i in 0 until m) {
            val j = m - i
            if (j < i) break
            if (i == 0 || i == j) {
                ans += cnt[i] / 2
            } else {
                ans += Math.min(cnt[i], cnt[j])
                ans += if (cnt[i] > cnt[j]) Math.min((cnt[i] - cnt[j]) / 2, cnt2[i]) else Math.min(
                    (cnt[j] - cnt[i]) / 2,
                    cnt2[j]
                )
                // println("$i $j ${cnt[i]} ${cnt[j]} ${cnt2[i]} ${cnt2[j]}")
            }
        }

        println(ans)
    }
}


class MyScanner() {
    private var index = 0
    private var line = listOf<String>()

    fun next(): String {
        while (line.size <= index) {
            line = readLine()!!.split(' ')
            index = 0
        }
        return line[index++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun strList(): List<String> {
        index = line.size
        return readLine()!!.split(' ')
    }

    fun intList() = strList().map { it.toInt() }
    fun longList() = strList().map { it.toLong() }
    fun doubleList() = strList().map { it.toDouble() }
}

Measured memory_bytes: 51784
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <sstream>

#define fi first
#define se second
#define pb push_back
#define fore(i, a, b) for (int i = (a), _b = (b); i < (_b); ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= (_b); ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= (_b); --i)

using namespace std;

typedef long long LL;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const int INF = 1e9 + 3;
const int MOD = 1e9 + 7;
const int N = 1e5 + 3;

int n, k, a[N];
bool f[N];

void input() {
	cin >> n >> k;
	fort(i, 1, n) cin >> a[i];
}

void solve() {
	fort(i, 0, k) fort(j, 1, n) if (i >= a[j] && !f[i - a[j]]) {
		f[i] = 1;
		break;
	}
	cout << (f[k] ? "First" : "Second") << '\n';
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
	input();
	solve();
    return 0;
}


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

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

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

struct Pos
{
  int x;
  int y;
};

int main()
{
  int h, w;
  int map[1100][1100];
  queue<Pos> positions;
  string buff;

  cin >> h >> w;
  for (int y = 0; y < h; ++y)
  {
    cin >> buff;
    for (int x = 0; x < w; ++x)
    {
      if (buff[x] == '.')
      {
        map[x][y] = -1;
      }
      else
      {
        map[x][y] = 0;
        positions.push({x, y});
      }
    }
  }

  const Pos moves[] = {
      {0, 1},
      {1, 0},
      {0, -1},
      {-1, 0},
  };

  int turn = 0;
  while (!positions.empty())
  {
    auto pos = positions.front();
    positions.pop();

    for (int i = 0; i < 4; ++i)
    {
      auto move = moves[i];
      Pos next = {pos.x + move.x, pos.y + move.y};
      if (next.x < 0 || w <= next.x || next.y < 0 || h <= next.y)
      {
        continue;
      }

      if (map[next.x][next.y] < 0)
      {
        int nextTurn = map[pos.x][pos.y] + 1;
        map[next.x][next.y] = nextTurn;
        if (turn < nextTurn)
        {
          turn = nextTurn;
        }
        positions.push(next);
      }
    }
  }
  cout << turn << endl;

  return 0;
}

Measured memory_bytes: 12688
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ss = Console.ReadLine().Split();
            var ring = new int[3];
            for (int i = 0; i < ring.Length; i++)
                ring[i] = int.Parse(ss[i]);

            Console.WriteLine(ring.Sum() - ring.Max());
        }
    }
}

Measured memory_bytes: 13268
#include<iostream>

#include<cmath>
#include<string>
#include <algorithm> 
using namespace std;

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

    if (
       s.find('a') != string::npos
    && s.find('b') != string::npos
    && s.find('c') != string::npos
    ) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import Data.Char
import Debug.Trace
import Data.List (unfoldr)
import Control.Monad
import qualified Data.Vector.Unboxed as UV

main = do
    [a, b, c] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    print $ if a - b > c then 0 else c - a + b


Measured memory_bytes: 380
#include <stdio.h>

#define MAX (1000200)
int v[MAX];

int main(void)
{
  int i, j, k;
  int m, n;

  for (i = 1; i <= MAX; i *= 2){
    for (j = 1; i * j <= MAX; j *= 3){
      for (k = 1; i * j * k <= MAX; k *= 5){
        v[i * j * k] = 1;
      }
    }
  }

  for (i = 1; i <= MAX; i++){
    v[i + 1] += v[i];
  }

  while (scanf("%d%d", &m, &n), m != 0){
    printf("%d\n", v[n] - v[m - 1]);
  }

  return (0);
}

Measured memory_bytes: 4504
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
 
 
public class Main {
	private static  BufferedReader	br  = null;
	private	static	int[][]			map = null;
	private	static	int				stp = 0;
	private	static	int				edp = 0;
	private	static	int				mon = 0;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}
 
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		parseParam();
		System.out.println(mon - dijkstra(stp, edp) - dijkstra(edp, stp));
	}

	private static int dijkstra(int start, int end) {
		int[]       cost = new int[map.length];
		boolean[]   used = new boolean[map.length];
 
		Arrays.fill(cost, Integer.MAX_VALUE);
		cost[start] = 0;
 
		while(true) {
			int cur = -1;
			for (int n = 0; n < map.length; n++) {
				if (!used[n] && (cur == -1 || cost[n] < cost[cur])) {
					cur = n;
				}
			}

			if (cur == -1) {
				break;
			}
			used[cur]  = true;

			for (int n = 0; n < map.length; n++) {
				if (map[cur][n] != -1) {
					int	cc = (cost[cur] == Integer.MAX_VALUE) ? cost[cur] : cost[cur] + map[cur][n];
					cost[n] = Math.min(cost[n], cc);
				}
			}
		}
 
		return cost[end];
	}
 
	private static void parseParam() {
		int	l = parseNum();

		if (l > 0) {
			int	p = parseNum();

			map = new int[l][l];
			for (int i = 0; i < l; i++) {
				Arrays.fill(map[i], -1);
			}

			while (p-- >= 0) {
				String		stdin = parseStdin();
				String[]	lines = stdin.split(",");
				int[]		datas = {
					Integer.parseInt(lines[0]),
					Integer.parseInt(lines[1]),
					Integer.parseInt(lines[2]),
					Integer.parseInt(lines[3]),
				};

				if (p >= 0) {
					map[datas[0]-1][datas[1]-1] = datas[2];
					map[datas[1]-1][datas[0]-1] = datas[3];
				} else {
					stp = datas[0] - 1;
					edp = datas[1] - 1;
					mon = datas[2] - datas[3];
				}
			}
		}
	}

    private static int parseNum() {
        int     num   = 0;
        String  strIn = null;
 
        if ((strIn = parseStdin()) != null) {
            num = Integer.parseInt(strIn);
        }
         
        return num;
    }
 
    private static String parseStdin() {
        String  strNum = null;
 
        try {
            String line = br.readLine();
            if (line != null) {
                if (!line.isEmpty()) {
                    strNum = line;
                }
            }
        }
        catch (IOException e) {}
 
        return strNum;
    }
}

Measured memory_bytes: 16924
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);

		int n=sc.nextInt();
		int a=sc.nextInt();
		
		int kouka=n%500;
		
		if(kouka-a<=0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}

}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a,b;
	cin>>a>>b;
	
	if(((a==1)&&(b==2))||((a==2)&&(b==1))){
		cout<<3;
	}
	else if(((a==1)&&(b==3))||((a==3)&&(b==1))){
		cout<<2;
	}
	else{
		cout<<1;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define debug(x) #x << "=" << (x)

#define DEBUG

#ifdef DEBUG
#define var_dump(...) fprintf(stdout, __VA_ARGS__)
#define dump(a) cout << a << "\n";
#else
#define var_dump(...) 42
#define dump(a) 42
#endif

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_B&lang=jp

int dp[105][10005];

int main() {
    int N, W; cin >> N >> W;
    int v[N];
    int w[N];
    REP(i, N) {
        cin >> v[i] >> w[i];
    }

    REP(i, N) {
        REP(j, W+1) {
            if (w[i] > j) {
                dp[i+1][j] = dp[i][j];
            }
            else {
                dp[i+1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
            }
        }
    }

    cout << dp[N][W] << "\n";


    return 0;
}



Measured memory_bytes: 7012
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: usize,
      h: i64,
      abs: [(i64, i64); n]
    }
    let mut vs = vec![];
    for i in 0..n {
        vs.push((abs[i].0, true));
        vs.push((abs[i].1, false));
    }
    vs.sort_by_key(|v| v.0);
    vs.reverse();

    let mut h = h;
    let mut ans = 0;
    for &(v, infinite) in vs.iter() {
        if infinite {
            debug!(h, v, infinite);
            ans += h/v + if h%v == 0 { 0 } else { 1 };
            return println!("{}", ans);
        } else {
            debug!(h, v, infinite, ans);
            h -= v;
            ans += 1;
            if h <= 0 {
                return println!("{}", ans);
            }
        }
    }
}


Measured memory_bytes: 11380
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <istream>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <climits>
using namespace std;

typedef ostringstream OSS;
typedef istringstream ISS;

typedef vector<int> VI;
typedef vector< VI > VVI;

typedef long long LL;

typedef pair<int, int> PII;
typedef vector<PII> VPII;

#define X first
#define Y second

int main(void) {
	string s;
	cin >> s;

	string r = string(s.rbegin(), s.rend());
	
	cout << r  << endl;

	return 0;
}

Measured memory_bytes: 1176
#include<ctime>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

char s[100010];

int main()
{
	scanf("%s",s+1);
	//give the fucking vjudge a flying fucking
	int n=strlen(s+1);
	if((!(n&1))^(s[1]==s[n]))
	{
		puts("Second");
	}
	else
	{
		puts("First");
	}
}

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

int main()
{
    string sh;
    cin >> sh;
    long long sum = 0;
    int length = sh.size();
    for(int i = length - 1; i >= 0; i--)
    {
        sum += sh[i] - '0';
    }
    cout << ((sum % 9 == 0)? "Yes" : "No") << endl;
}

Measured memory_bytes: 3704
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<long long,int> P;
static const int INF=1<<24;

int a[50];

int main(){
	int n,r;
	while(cin>>n>>r,!(n==0&&r==0)){
		rep(i,n+1){
			a[i]=n-i;
		}
		int p,c;
		int t1[50]={0},t2[50]={0};
		
		rep(i,r){
			cin>>p>>c;
			for(int j=0;j<c;j++){
				t1[j]=a[j+p-1];
				//cout<<t1[j]<<endl;
			}
			//cout<<endl;
			for(int j=0;j<p-1;j++){
				t2[j]=a[j];
			}
			for(int j=0;j<c;j++){
				a[j]=t1[j];
			}
			for(int j=0;j<p-1;j++){
				a[j+c]=t2[j];
			}
			/*
			rep(j,n){
				cout<<a[j]<<" ";
			}
			cout<<endl;
			*/
		}
		cout<<a[0]<<endl;
	}
	return 0;
}

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

int main(){
    int N, M, X;
    cin >> N >> M >> X;
    int algo[N][M];
    int cost[N];
    for(int i = 0; i < N; i++){
        cin >> cost[i];
        for(int j = 0; j < M; j++)cin >> algo[i][j];
    }
    int ans = 12345678;
    int all = 1<<N;
    for(int mask = 0; mask < all; mask++){
        int level[M]={};
        int tmp_cost = 0;
        for(int i = 0; i < N; i++){
            if((mask>>i)&1){
                tmp_cost += cost[i];
                for(int j = 0; j < M; j++){
                    level[j] += algo[i][j];
                }
            }
        }
        bool flag = true;
        for(int j = 0; j < M; j++){
            if(level[j] < X) flag = false;
        }
        if(flag) ans = min(ans,tmp_cost);
    }
    if(ans == 12345678) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 3596
package main

import (
	"fmt"
	"strings"
)

func main() {
	var R string
	fmt.Scan(&R)
	flag := true
	flag = flag && R[0] == 'A'
	idx := strings.Index(R[2:len(R)-1], "C")
	flag = flag && (idx != -1)
	for i := range R {
		if i == 0 || i == idx+2 {
			continue
		}
		if R[i:i+1] != strings.ToLower(R[i:i+1]) {
			flag = false
		}
	}
	if flag {
		fmt.Println("AC")
	} else {
		fmt.Println("WA")
	}
}


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

using namespace std;

int main()
{
    int vac, assig, days, sum = 0;

    cin >> vac >> assig;

    for (int i = 0; i < assig; i++)
    {
        cin >> days;
        sum += days;
    }

    if (sum <= vac)
        cout << (vac - sum);
    else
        cout << -1;

    return 0;
}


Measured memory_bytes: 3560
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int ans = 0;
        for (int i = 0;i<=n-3;i++) {
            String str = s.substring(i, i+3);
            if (str.equals("ABC")) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(void)
{
	int i, j, k, h, w, min, mink, ans=0;
	int c[10][10], dist2[10][10];
	int dist[10], u[10], prev[10];
	static int a[200][200];

	cin>>h>>w;

	for(i=0; i<10; i++){
		for(j=0; j<10; j++){
			cin>>c[i][j];
		}
	}
	for(i=0; i<h; i++){
		for(j=0; j<w; j++){
			cin>>a[i][j];
		}
	}

	for(i=0; i<10; i++){
		for(j=0; j<10; j++){
			dist[j]=1000; u[j]=1; prev[j]=0;

		}
		dist[i]=0;
		for(j=0; j<10; j++){
			min=100000;
			for(k=0; k<10; k++){
				if(min>dist[k]&&u[k]==1){
					min=dist[k]; mink=k;
				}
			}
			u[mink]=0; 
			for(k=0; k<10; k++){
				if(dist[k]>dist[mink]+c[mink][k]&&u[k]==1){
					dist[k]=dist[mink]+c[mink][k];
					prev[k]=mink;
				}
			}
		}
		for(j=0; j<10; j++){
			dist2[i][j]=dist[j];
		}
	}

	for(i=0; i<h; i++){
		for(j=0; j<w; j++){
			if(a[i][j]!=-1&&a[i][j]!=1){
				ans+=dist2[a[i][j]][1];
			}
		}
	}
	cout<<ans<<endl;
}

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

using namespace std;

int n;
char x[205], y[205];

int main() {
	scanf("%s%s", x, y);
	n = strlen(x);
	memcpy(x + n, x, n);
	for (int i = 0; i < n; i++)
		if (memcmp(x + i, y, n) == 0) {
			printf("Yes\n");
			return 0;
		}
	printf("No\n");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define sz(x) ((ll)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

int main() {
  int N, M;
  cin >> N >> M;
  string S;
  cin >> S;

  vector<int> ans;


  int pos = 0;
  reverse(all(S));
  while (true) {
    if (N - pos <= M) {
      ans.pb(N - pos);
      break;
    }

    int ok = false;
    repr(i, M, 1) {
      if (S[pos + i] == '0') {
        ok = true;
        pos += i;
        ans.pb(i);
        break;
      }
    }
    if (!ok) {
      cout << -1 << endl;
      return 0;
    }
  }

  reverse(all(ans));
  rep(i, sz(ans)) {
    cout << ans[i] << ((i == sz(ans) - 1) ? "\n" : " ");
  }
}

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

signed main(void)
{
	ll a, ans;
	string b;
	cin >> a >> b;
	ans = a * ((b[0] - '0') * 100 + (b[2] - '0') * 10 + (b[3] - '0')) / 100;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3580
#include <algorithm>
#include <cstdio>
#define MAX_E 100000

using namespace std;

struct edge {
    int u, v, cost;
    edge() {}
    edge(int a, int b, int c) : u(a), v(b), cost(c) {}
};

int n, m;
int par[MAX_E];
int rank[MAX_E];
edge edges[MAX_E];

bool comp(const edge& e1, const edge& e2) {
    return e1.cost < e2.cost;
}

// Ant book p84. union-find tree
void uf_init(int n) {
    for (int i = 0; i < n; i++) {
        par[i] = i;
        rank[i] = 0;
    }
}

int uf_find(int x) {
    if (par[x] == x) {
        return x;
    }
    else {
        return par[x] = uf_find(par[x]);
    }
}

void uf_unite(int x, int y) {
    x = uf_find(x);
    y = uf_find(y);
    if (x == y) return;

    if (rank[x] < rank[y]) {
        par[x] = y;
    }
    else {
        par[y] = x;
        if (rank[x] == rank[y]) rank[x]++;
    }
}

bool uf_same(int x, int y) {
    return uf_find(x) == uf_find(y);
}

// Ant book p101. kruskal
int kruskal() {
    sort(edges, edges + m, comp);
    uf_init(n);
    int res = 0;
    for (int i = 0; i < m; i++) {
        edge e = edges[i];
        if (!uf_same(e.u, e.v)) {
            uf_unite(e.u, e.v);
            res += e.cost;
        }
    }
    return res;
}

int main() {
    int x, y, w;

    scanf("%d %d", &n, &m);
    for (int j = 0; j < m; j++) {
        scanf("%d %d %d", &x, &y, &w);
        edges[j] = edge(x, y, w);
    }
    printf("%d\n", kruskal());

    return 0;
}

Measured memory_bytes: 4016
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n],b[n],c[n-1];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        a[i]--;
    }
     for(int i=0;i<n;i++)
    {
        cin>>b[i];
    }
     for(int i=0;i<n-1;i++)
    {
        cin>>c[i];
    }
    int ans=0;
    for(int i=0;i<n;i++)
    {
        ans+=b[a[i]];
        if(i>0 && a[i]==a[i-1]+1)
        {
            ans+=c[a[i-1]];
        }
    }
    cout<<ans<<"\n";
}

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

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(a == b && b == c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less

using namespace std;
#define md 1000000007
#define itn int
#define pb push_back
#define mp make_pair
#define ull unsigned long long int
#define ll long long int
#define ppi pair<int, int>
#define ppl pair<ll, ll>
#define vi vector<int>
#define all(x) x.begin(), x.end()
#define ff first
#define lb lower_bound
#define ub upper_bound
#define ss second
#define inf 1e9
#define enld '\n'
#define cuot cout
#define trace1(x) cerr << #x << ": " << x << endl
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define trace3(x, y, z)                                                        \
  cerr << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": "    \
       << z << endl
#define trace4(a, b, c, d)                                                     \
  cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \
       << c << " | " << #d << ": " << d << endl
#define trace5(a, b, c, d, e)                                                  \
  cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \
       << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define trace6(a, b, c, d, e, f)                                               \
  cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \
       << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | "   \
       << #f << ": " << f << endl
#define trace(v)                                                               \
  for (auto it = v.begin(); it != v.end(); it++)                               \
    cerr << *it << " ";                                                        \
  cerr << endl;
#define linf 1e18
#define reset(x) memset(x, 0, sizeof(x))
#define rep(i, a, b) for (int i = a; i < b; i++)

using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    oset;

void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

void solve() {
    double n,k;cin>>n>>k;
    double ans= 0;
    vector<int> v;
    int mx=0;
    for(int i=1;i<=n;i++){
        int y=i;
        int c=0;
        while(y<k){
            y*=2;
            c++;
        }
        v.pb(c);
        mx=max(mx,c);
    }
    double num=0;
    rep(i,0,n){
        num+= (1<<(mx-v[i]));
    }
    // cout<<num<<endl;
    ans=num/(n*(1<<mx));;
    cout<<fixed<<setprecision(12)<<ans<<endl;
}
int main() {
  fastio();
  int t;
  t = 1;
  //   cin>>t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 892
ans = int(input())
loopFlg = True

for i in range(26):
  if loopFlg == False:
    break
  for j in range(15):
    if 4*i + 7*j == ans:
      loopFlg = False

      
if loopFlg == True:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 9056
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=105;
int a[N],n,k,mx;
int main(){
	scanf("%d%d",&k,&n);
	fp(i,1,n)scanf("%d",&a[i]),cmax(mx,a[i]);
	printf("%d\n",(mx<<1)<=k?0:mx-(k-mx)-1);
	return 0;
}

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

int calc(int x){
    int res = 0;
    while(x % 100 == 0){
        x/= 100; res++;
    }
    return res;
}
int main(){
    int d, n; cin >> d >> n;
    
    int cnt=0, val=0;
    while(cnt < n){
        val++;
        if(calc(val)== d) cnt++;
    }
    
    cout << val << endl;
    return 0;
}

Measured memory_bytes: 3684