akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

typedef struct Store {
  long long price;
  long long limit;
} store_t;

int comparator(const void *a, const void *b);

store_t S[100001];
int main(void) {
  int N,M;
  scanf("%d %d", &N,&M);

  for(int i=0; i<N;i++) {
    long long a, b;
    scanf("%lld %lld", &a, &b);
    S[i].price = a;
    S[i].limit = b;
  }

  qsort(S, N, sizeof(store_t), comparator);

  long long basket = 0;
  long long budget = 0;
  for(int i=0; i<N; i++) {
    long long buy = (M - basket) < S[i].limit ? (M - basket) : S[i].limit;
    basket += buy;
    budget += buy * S[i].price;

    //printf("%d: %lld * %lld\n", i, buy, S[i].price);

    if(basket >= M) break;
  }

  printf("%lld\n", budget);

  return 0;
}

int comparator(const void *a, const void *b) {
  return ((store_t*)a)->price - ((store_t*)b)->price;
}


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

int main() {
  int h, w, n;
  cin >> h >> w >> n;

  cout << ceil(double(n) / max(h, w)) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
int dp[6][1010];//動的計画法
int prime[10000001];
char str[1010][1010];
vector<pair<int,int> > pc[100001];
int ABS(int a){return max(a,-a);}
int main(){
	int x;
	cin>>x;
	if(x<1200) cout<<"ABC"<<endl;
	else cout<<"ARC"<<endl;
	return 0;
}

Measured memory_bytes: 4352
from bisect import bisect_right

N, D, A = map(int, input().split())
M = []
for i in range(N):
  x, h = map(int, input().split())
  M.append((x, -(-h//A)))
M.sort(key=lambda x: x[0])
X = list(map(lambda x: x[0], M))
H = list(map(lambda x: x[1], M))

dmg = [0] * (N+1)
ans = 0

for i in range(N):
  x, h = M[i]
  h = max(0, h - dmg[i])
  dmg[bisect_right(X, x + 2*D)] -= h
  dmg[i+1] += dmg[i] + h
  ans += h
print(ans)


Measured memory_bytes: 41056
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

struct UnionFind {
    vector<int> d;
    UnionFind(int n=0): d(n, -1) {}
    int find(int x) {
        if (d[x]<0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x==y) return false;
        if (d[x] > d[y]) swap(x, y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    int size(int x) {
        return -d[find(x)];
    }
};

vector<P> to[100005];
bool used[100005];
int coor[100005];

void dfs(int v, int p=-1) {
    if (used[v]) return;
    used[v] = true;
    for (auto e: to[v]) {
        if (e.first==p) continue;
        coor[e.first] = coor[v] + e.second;
        dfs(e.first, v);
    }
}

int main(){
    int n, m;
    cin >> n >> m;
    UnionFind u(n);
    vector<pair<P, int>> x;
    rep(i, m) {
        int l, r, d;
        cin >> l >> r >> d;
        l--; r--;
        if (u.same(l, r)) {
            x.emplace_back(P(l, r), d);
        }
        else {
            u.unite(l, r);
            to[l].emplace_back(r, d);
            to[r].emplace_back(l, -d);
        }
    }
    rep(i, n) {
        dfs(i);
    }
    string ans = "Yes";
    for (auto e: x) {
        int l = e.first.first;
        int r = e.first.second;
        int d = e.second;
        if (coor[r]-coor[l]!=d) {
            ans = "No";
            break;
        }
    }    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 15396
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;
 
int main(void)
{
    int s;
    cin >> s;
    pr(48-s);
}

Measured memory_bytes: 256
while True:
  try:
     a,b,c,d,e,f= map(int,input().split())
  except EOFError:
     break
  x = (e*c-f*b)/(e*a-b*d)
  y = (d*c-f*a)/(d*b-a*e)
  if -0.0005 < x <= 0:
    x = 0.000
  if -0.0005 < y <= 0:
    y = 0.000
  print(f'{x:.3f}',f'{y:.3f}')


Measured memory_bytes: 5628
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

n=int(input())
a=list(map(int,input().split()))
b=a[0]
ans=0
for i in range(1,n):
    b=lcm(a[i],b)
for i in range(n):
    ans += b//a[i]
print(ans%(10**9 + 7))

Measured memory_bytes: 4084
N, K = map(int, input().split())
d = [0]*(10**5+1)
for i in range(N):
    a, b = map(int, input().split())
    d[a] += b

k = K
for i in range(len(d)):
    k -= d[i]
    if k <= 0:
        print(i)
        break


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

using namespace std;

#define N 666666
char str[N];
map<int,int> mp;
signed main(){
	scanf("%s",str+1);
	int ans=1;
	int n=strlen(str+1); 
	int add=1;
	for(int i=2;i<=n;i++){
		if(str[i]!=str[i-1]||mp[i-1]){
			//add=1;
		}else{	
			i++;
			if(i>n) break;
			mp[i]=1;
		}
		ans++;
	}cout<<ans;
	return 0;
}

Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    string s; cin>>s;
    if(s=="KIHBR"||s=="AKIHBR"||s=="KIHABR"||s=="KIHBAR"||s=="KIHBRA"||s=="AKIHABR"||s=="AKIHBAR"||s=="AKIHBRA"||s=="KIHABAR"||s=="KIHABRA"||s=="KIHBARA"||s=="AKIHABAR"||s=="AKIHABRA"||s=="AKIHBARA"||s=="KIHABARA"||s=="AKIHABARA"){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    
}


Measured memory_bytes: 3612
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#include <iostream>
#include <stack>
#include <tuple>
#include <map>
#include <cassert>

using namespace std;
typedef long long ll;

long long gcd(long long a, long long b) {
    if(a < b){
        return gcd(b, a);
    }
    long long r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

// n 未満の数のうち、c でも d でも割り切れない数の個数を返す。
ll solve(ll n, ll c, ll d){
    ll n1 = (n - 1) / c;
    ll n2 = (n - 1) / d;
    ll g = gcd(c, d);
    ll lcm = c * (d / g);
    ll n3 = (n - 1) / lcm;
    return n - (n1 + n2 - n3);
}

int main(){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll num_a = solve(a, c, d);
    ll num_b = solve(b + 1, c, d);
    cout << num_b - num_a << endl;
    return 0;
}


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

typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
#define rep(i,n) for (unsigned int i = 0; i < n; ++i) 
#define REP(i,k,n) for (int i = k; i <= n; ++i) 
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define mp make_pair
const int maxe = 2e5+5;

ll t=1, n=0, m=0, ans=0;

void solve(){
	string s;
	cin >> s;
	ll maxdays = 0;
	ll ans = 0;
	rep(i, s.length()){
		if(s[i] == 'R') maxdays++;
		else{
			ans = max(maxdays, ans);
			maxdays = 0;
		}
	}
	ans = max(maxdays, ans);
	cout << ans;
	
}

int main(){
	while(t--){
		solve();
	}
	return 0;
}





Measured memory_bytes: 3616
#include<stdio.h>
int main()
{
	int a,b,c;
	while(scanf("%d%d%d",&a,&b,&c)!=EOF)
	{
		int count=0;
		int arr[b];
		int lol[a][b];
		for(int i=0;i<b;i++) scanf("%d",&arr[i]);
		for(int i=0;i<a;i++)
			for(int j=0;j<b;j++)
				scanf("%d",&lol[i][j]);
		for(int i=0;i<a;i++)
		{
			int temp=0;
			for(int j=0;j<b;j++)
			{
				temp+=arr[j]*lol[i][j];
			}
			if(temp+c>0) count++;
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>

int a[4];

using namespace std;

int main() 
{
	while(~scanf("%d%d%d", &a[1], &a[2], &a[3])) {
		sort (a + 1, a + 3 + 1);
		int t = (a[2] - a[1]) / 2;
		a[2] -= 2 * t; a[3] -= 2 * t;
		t += (a[2] - a[1] + a[3] - a[1]);
		printf("%d\n", t);
	}
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
 
string map[12];
 
const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0}; 
 
void dfs(int x, int y)
{
    map[y][x] = '0';
    for(int i = 0; i < 4; ++i){
        int nx = x + dx[i], ny = y + dy[i];
        if(0 <= nx && nx < 12 && 0 <= ny && ny < 12 && map[ny][nx] == '1'){
            dfs(nx,ny);
        }
    }
}
 
int main()
{
    int ans;
    while(cin >> map[0]){
        ans = 0;
        
        for(int i = 1; i < 12; ++i){
            cin >> map[i];
        }
        
        for(int i = 0; i < 12; ++i){
            for(int j = 0; j < 12; ++j){    
                if(map[i][j] == '1'){
                    ++ans;
                    dfs(j,i);
                }
            }
        }
        
        cout << ans << endl;
    }
}

Measured memory_bytes: 1192
#include <iostream>
#include<algorithm>
#include<climits>
using namespace std;
int main(void){
    int kumachan_N, kumachan_A,kumachan_Ans=INT_MAX;
    cin >> kumachan_N;
    for(int i=0; i<kumachan_N;i++){
        int kumachan=0;
        cin>>kumachan_A;
        while(kumachan_A%2==0){
            kumachan++;
            kumachan_A/=2;
        }
        kumachan_Ans=min(kumachan_Ans,kumachan);
    }
        cout<<kumachan_Ans<<endl;
    
    } 



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <complex>
using namespace std;
const int INF = 1<<28;

struct feet {
	int x, y, p, cnt;
	feet(int a, int b, int c, int d): x(a), y(b), p(c), cnt(d) {};
	bool operator >(feet const &a) const {
		return cnt > a.cnt;
	}
};

int main() {
	int w, h;
	int x[9] = {1, 1, 1, 1, 1, 2, 2, 2, 3};
	int y[9] = {2, 1, 0, -1, -2, 1, 0, -1, 0};
	while(cin >> w >> h, w|h) {
		priority_queue<feet, vector<feet>, greater<feet> > pq;
		map<int, int> memo;
		set<int> t;

		int field[h][w];
		for(int i=0; i<h; i++) {
			for(int j=0; j<w; j++) {
				char input;
				cin >> input;
				if((int)input - '0' < 10)
					field[i][j] = (int)input - '0';
				else if(input == 'X') 
					field[i][j] = INF;
				else if(input == 'S') {
					field[i][j] = 0;
					pq.push(feet(j, i, 0, 0));
					pq.push(feet(j, i, 1, 0));
				}
				else if(input == 'T') {
					field[i][j] = 0;
					t.insert(j*100+i);
				}
			}
		}

		int ans = INF;

		while(pq.size()) {
			feet f = pq.top();
			pq.pop();

			if(t.count(f.x*100+f.y)) { // 'T'
				ans = ans>f.cnt ? f.cnt : ans;
				continue;
			}

			for(int i=0; i<9; i++) {
				feet temp(f.x+x[i], f.y+y[i], !f.p, f.cnt+field[f.y+y[i]][f.x+x[i]]);
				if(f.p) {
					temp.x = f.x-x[i];
					temp.cnt = f.cnt+field[f.y+y[i]][f.x-x[i]];
				}
				int chk = temp.x*10000 + temp.y*100 + temp.p;
				if(field[temp.y][temp.x] != INF) { // 'x'
					if(0 <= temp.x && temp.x < w && 0 <= temp.y && temp.y < h) { //out of range
						if(memo.find(chk) == memo.end() || memo[chk] > temp.cnt) {
							memo[chk] = temp.cnt;
							pq.push(temp);
						}
					}
				}
			}
		}
		cout << (ans==INF ? -1 : ans) << endl;
	}
	return 0;
}

Measured memory_bytes: 1368
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
    using namespace std;
    using namespace __gnu_pbds;
    #define ll long long
    #define int long long
    #define pb push_back
    #define For(i,n) for(ll  i=0;i<n;i++)
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;clock_t clk = clock();
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define ld long double
    #define read(t) ll t;cin>>t;
    #define all(x) x.begin(),x.end()
    #define fi first
    #define se second
    #define pii pair<ll,ll>
    #define endl "\n"
    #define sz(x) (int)(x).size()
    #define what_is(x) cerr << #x << " is " << x << endl;
    #define time cerr << "Time (in ms): " << double(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';
    const double pi=3.14159265358979323846264;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
/*.....................................................................................................................*/

    ll mod =(ll)1e9+7;
    ll add(ll x,ll y) {return (x+y)%mod;}
    ll mult(ll x, ll y){return ((x%mod )* (y%mod)) % mod;}
    long long binpow(long long x, long long p) 
    {
        if (p == 0) return 1;
    	if (p == 2 || (p & 1)) return mult(x, binpow(x, p - 1));
    	return binpow(binpow(x, p / 2), 2);
    }
    ll modinv(ll a) {return binpow(a,mod-2);}
    // bool check(ll x){}
    ll binsearch(ll l,ll r)
    {
        while(l<r)
        {
            ll mid=(l+r)/2;
            // if(check(mid))r=mid;
            // else l=mid+1;
        }
        return l;
    }
    const ll man=(ll)1005;
    vector<ll>adj[man];
    bool vis[man][man];
    ll d[man],depth[man],par[man];
    void addedge(ll u,ll v){adj[u].pb(v);adj[v].pb(u);}
    ll dx[4]={1,-1,0,0};ll dy[4]={0,0,1,-1};
/*........................................................................................................................*/

signed main()/*Check flow...question galat mat padhna */
{
    fast;  
    ll n;
    cin>>n;
    ll a[n];
    For(i,n)cin>>a[i];
    sort(a,a+n);
    ll mx=a[n-1];
    map<ll,ll>mp;
    For(i,n)
    {
        if(mp[a[i]]>=1)
        {
             mp[a[i]]++;continue;
        }
        for(ll j=a[i];j<=mx;j+=a[i])mp[j]++;
    }
    ll ans=0;
    For(i,n)
    {
        if(mp[a[i]]==1)ans++;
    }
    cout<<ans<<endl;
}      


Measured memory_bytes: 67260
#include<stdio.h>


int search(int A[], int n, int key) {
 int i = 0;
 A[n] = key;
 while ( A[i] != key ) i++;
 return i != n;
}
int main() {
 int i, n, A[10000+1], q, key, sum = 0;
 scanf("%d", &n);
for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
 scanf("%d", &q);
for ( i = 0; i < q; i++ ) {
 scanf("%d", &key);
 if ( search(A, n, key) ) sum++;
}
printf("%d\n", sum);
 return 0;
}


Measured memory_bytes: 2720
import java.util.*;

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

        if (input.contains("7")) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}


Measured memory_bytes: 35736
//dlang template---{{{
import std.stdio;
import std.conv;
import std.string;
import std.array;
import std.algorithm;

// MIT-License https://github.com/kurokoji/nephele
class Scanner
{
  import std.stdio : File, stdin;
  import std.conv : to;
  import std.array : split;
  import std.string;
  import std.traits : isSomeString;

  private File file;
  private char[][] str;
  private size_t idx;

  this(File file = stdin)
  {
    this.file = file;
    this.idx = 0;
  }

  this(StrType)(StrType s, File file = stdin) if (isSomeString!(StrType))
  {
    this.file = file;
    this.idx = 0;
    fromString(s);
  }

  private char[] next()
  {
    if (idx < str.length)
    {
      return str[idx++];
    }

    char[] s;
    while (s.length == 0)
    {
      s = file.readln.strip.to!(char[]);
    }

    str = s.split;
    idx = 0;

    return str[idx++];
  }

  T next(T)()
  {
    return next.to!(T);
  }

  T[] nextArray(T)(size_t len)
  {
    T[] ret = new T[len];

    foreach (ref c; ret)
    {
      c = next!(T);
    }

    return ret;
  }

  void scan()()
  {
  }

  void scan(T, S...)(ref T x, ref S args)
  {
    x = next!(T);
    scan(args);
  }

  void fromString(StrType)(StrType s) if (isSomeString!(StrType))
  {
    str ~= s.to!(char[]).strip.split;
  }
}

//Digit count---{{{
int DigitNum(int num) {
  int digit = 0;

  while (num != 0) {
    num /= 10;
    digit++;
  }

  return digit;
}
//}}}
//}}}

void main() {
  Scanner sc = new Scanner;

  int N;
  sc.scan(N);
  int[] a = new int[N];

  foreach (i; 0 .. N)
    sc.scan(a[i]);

  int Alice = 0, Bob = 0;

  sort(a);
  reverse(a);

  foreach (i; 0 .. N) {
    if (i % 2 == 0)
      Alice += a[i];
    else
      Bob += a[i];
  }

  writeln(Alice - Bob);
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    struct P
    {
        public int h;
        public int w;
        public int len;
        public P(int h,int w,int len)
        {
            this.h = h;
            this.w = w;
            this.len = len;
        }
    }
    static void Main(string[] args)
    {
        var hw = Input.ar;
        var gred = new string[hw[0]];
        for (var i = 0; i < hw[0]; i++)
            gred[i] = ReadLine();
        var white = gred.Sum(str => str.Count(c => c == '.'));
        var que = new Queue<P>();
        var bo = new bool[hw[0], hw[1]];
        bo[0, 0] = true;
        que.Enqueue(new P(0, 0, 1));
        var gH = new[] { 0, 0, 1, -1 };
        var gW = new[] { 1, -1, 0, 0 };
        var go = new P(-1, -1, -1);
        while (que.Count != 0)
        {
            var p = que.Dequeue();
            if (p.h == hw[0] - 1 && p.w == hw[1] - 1)
            {
                go = p;
                break;
            }
            for(var i = 0; i < 4; i++)
            {
                var h = p.h + gH[i];
                var w = p.w + gW[i];
                if (0 <= h && h < hw[0] && 0 <= w && w < hw[1] && !bo[h, w] && gred[h][w] != '#')
                {
                    bo[h, w] = true;
                    que.Enqueue(new P(h, w, p.len + 1));
                }
            }
        }
        WriteLine(go.len != -1 ? white - go.len : -1);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public  
static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 11476
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long; using ld = long double; using ull = unsigned long long; using uint = unsigned int;
using vi  = vector<int>; using vb  = vector<bool>; using vd  = vector<double>; using vl  = vector<ll>;
using vvi = vector<vi>;  using vvb = vector<vb>;   using vvd = vector<vd>;     using vvl = vector<vl>;
 
#define REP(i,n) for(ll i=0; i<(n); ++i)
#define FOR(i,b,n) for(ll i=(b); i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define TEN(x) ((ll)1e##x)
 
template<typename T> inline string join(const vector<T>& vec, string sep = " ") { stringstream ss; REP(i, vec.size()) ss << vec[i] << ( i+1 == vec.size() ? "" : sep ); return ss.str(); }
 
 
///////////////
 
#define EPS (1e-10)
#define NEXT(x, i) (x[(i + 1) % x.size()])
 
template<class T> using CR = const T &;
using P = complex<ld>;
using G = vector<P>;
 
int sgn(ld a, ld b = 0) {
    if (a > b + EPS) return 1;
    if (a < b - EPS) return -1;
    return 0;
}
 
ld dot(P a, P b) { return real(conj(a)*b); }
ld cross(P a, P b) { return imag(conj(a)*b); }
 
int ccw(P a, P b, P c) {
    b -= a;
    c -= a;
    if (sgn(cross(b, c))) return sgn(cross(b, c)); // clockwise or counter clockwise
    if (sgn(dot(b, c)) == -1) return 2;            // c--a--b
    if (sgn(norm(b), norm(c)) == -1) return -2;    // a--b--c
    return 0;                                      // a--c--b
}
 
struct L : public vector<P> {
    L(P a, P b) { push_back(a); push_back(b); }
};


struct C {
    P p; ld r;
    C(P p, ld r) : p(p), r(r) { }
};
pair<P, P> pCC(CR<C> c1, CR<C> c2) {
    ld d = abs(c1.p - c2.p);
    ld rc = (d*d + c1.r*c1.r - c2.r*c2.r) / (2*d);
    ld rs = sqrt(c1.r*c1.r - rc*rc);
    P diff = (c2.p - c1.p) / d;
	return { c1.p + diff * P(rc, rs), c1.p + diff * P(rc, -rs) };
}

//////////////
 
int main() {
#ifdef INPUT_FROM_FILE
    ifstream cin("sample.in");
    ofstream cout("sample.out");
#endif
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(30);
	ld x1, y1, r1, x2, y2, r2;
	cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
	auto p = pCC(C({ x1, y1 }, r1), C({ x2, y2 }, r2));
	if (p.first.imag() > p.second.imag()) swap(p.first, p.second);
	if (p.first.real() > p.second.real()) swap(p.first, p.second);
	cout << p.first.real() << " " << p.first.imag() << " " << p.second.real() << " " << p.second.imag() << endl;

    return 0;
}

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

typedef long long ll;

#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define AA(i) cout << i << endl;
#define AS(i) cout << i << " ";

const int INF = 1001001001;
const double PI = 3.14159;

using namespace std;

int main() {

    ll n;
    cin >> n;
    string ans = "";
    while (n) {
        n--;
        ans += (char)('a' + (n % 26));
        n /= 26;
    }
    reverse(ans.begin(), ans.end());
    AA(ans);
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s ;
    cin >> s ;
    if (s=="SUN")
        cout << 7 ;
    else if (s=="MON")
    {
        cout << 6 ;
    }
    else if (s=="TUE")
    {
        cout << 5 ;
    }
    else if (s=="WED")
    {
        cout << 4 ;
    }
    else if (s=="THU")
    {
        cout << 3 ;
    }
    else if (s=="FRI")
    {
        cout << 2 ;
    }
    else if (s=="SAT")
    {
        cout << 1 ;
    }
    

    return 0;
}

Measured memory_bytes: 3616
from fractions import gcd
n = int(input())
a = list(map(int,input().split()))

s = [a[0]]
for i in range(1,n):
    s.append(gcd(s[-1],a[i]))

u = [a[n-1]]
for i in range(n-2,-1,-1):
    u.append(gcd(u[-1],a[i]))

#print(s,u)

ans = max(u[-2],s[-2])
for i in range(1,n-1):
    #print(s[i-1],u[-2-i])
    now = gcd(s[i-1],u[-2-i])
    ans = max(ans,now)
print(ans)

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

int main()
{
  int n;
  cin >> n;
  int v[n];
  for(int i = 0; i < n; i++)
    cin >> v[i];
  for(int i = 0; i < n; i++)
  {
    if(v[i] % 2 == 0 && v[i] % 3 != 0 && v[i] % 5 != 0)
    {
      cout << "DENIED\n";
      return 0;
    }
  }
  cout << "APPROVED\n";
  return 0;
}

Measured memory_bytes: 256
n, k = map(int,input().split())
h = list(int(i) for i in input().split())

dp = [0] * n

for i in range(0, n - 1):
  if(i > 0):
    dp[i + 1] = min(dp[i - x] + abs(h[i + 1] - h[i - x]) for x in range(k) if (i - x) >= 0)
  else:
    dp[i + 1] = (abs(h[i + 1] - h[i]))

print(dp[n - 1])



Measured memory_bytes: 54240
/*#include<bits/stdc++.h>
using namespace std;
int n=0,m=0,e[10001][10001]={0},root=0,num[10001]={0},low[10001]={0},in=0,c=0;
int min(int a,int b)
{
    return a<b?a:b;
}
void dfs(int cur,int father)
{
    int i;
    in;
    num[cur]=in;
    low[cur]=in;
    for(i=1;i<=n;i++)
    {
        if(e[cur][i]==1)
        {
            if(num[i]==0)
            {
                dfs(i,cur);
                low[cur]=min(low[i],low[cur]);
                if(low[i]>num[cur])
                    c++;
            }
            else
                if(i!=father)
                {
                    low[cur]=min(low[cur],num[i]);
                }
        }
    }
    return ;
}
int main( )
{
    int i,j,x,y;
    cin>>n>>m;
    for(i=1;i<+n;i++)
        for(j=1;j<+n;j++)
            e[i][j]=0;
    for(i=1;i<=m;i++)
    {
        cin>>x>>y;
        e[x][y]=1;
        e[y][x]=1;
    }
    root=1;
    dfs(1,root);
    if(c==0)
        return 0;
    else
        cout<<c<<endl;
    getchar();getchar();
    return 0;
}
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
int n,m,sum,xi,Map[55][55],visit[55];
int main( )
{
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        int a,b;
        cin>>a>>b;
        visit[a]++;
        visit[b]++;
    Map[a][b]=Map[b][a]=1;
    }
    bool falg=true;
    while(1)
    {
    falg=true;
    for(int i=1;i<=n;i++)
    {
        if(visit[i]==1)
        {
            sum++;
            xi=i;
            falg=false;
            visit[i]--;
            break;
        }
    }
    if(falg)
        break;
    for(int i = 1;i<=n;i++)
    {
        if(Map[xi][i]==1)
        visit[i]--;
    }
    }
    cout<<sum<<endl;
}

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






#define pf                  printf
#define sf(a)               scanf("%d",&a)
#define sfl(a)              scanf("%lld",&a)
#define sff(a,b)            scanf("%d %d",&a,&b)
#define sffl(a,b)           scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)         scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)        scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d)      scanf("%d %d %d %d",&a,&b,&c,&d)
#define sffffl(a,b,c,d)     scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define sfffff(a,b,c,d,e)   scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
#define sfffffl(a,b,c,d,e)  scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e)
#define sfc(a)              scanf("%c",&a)
#define pii                 pair<int,int>
#define ms(a,b)             memset(a,b,sizeof(a))
#define pb(a)               push_back(a)
#define pbp(a,b)            push_back({a,b})
#define db                  double
#define ft                  float
#define ll                  long long
#define ull                 unsigned long long
#define pii                 pair<int,int>
#define ff                  first
#define ss                  second
#define sz(x)               x.size()
#define all(x)              x.begin(),x.end()
#define CIN                 ios_base::sync_with_stdio(0); cin.tie(0)
#define max3(a, b, c)       max(a, b) > max(b, c) ? max(a, b) : max(b, c)
#define min3(a, b, c)       min(a, b) < min(b, c) ? min(a, b) : min(b, c)
#define for0(i,n)           for(int i=0;i<n;i++)
#define for1(i,n)           for(int i=1;i<=n;i++)
#define forrev(i,n)         for(int i=n-1; i>=0; i--)
#define forab(i,a,b)        for(int i=a;i<=b;i++)
#define forba(i,b,a)        for(int i=b;i>=a;i--)
#define stlloop(x)          for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define case1(z)            cout<<"Case "<<z<<": "
#define case2(z)            printf("Case %d: ",z)
#define PI                  acos(-1) //3.14159265358979323846264338328
#define valid(tx,ty)        tx>=0 && tx<row && ty>=0 && ty<col
#define intlim              2147483648
#define N                   100005
#define inf                 100000008
#define mod                 1000000007

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/



int main()
{
    ll n,i,ans=0;
    cin>>n;
    for(i=0;n>0;i++)
    {
        ans+=(pow(2,i));
        n/=2;
    }
    cout<<ans<<endl;
    return 0;
}
































Measured memory_bytes: 512
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
OK = []
NG = 0
count = 0
for i in range(N):
    x = A[i] - B[i]
    if x < 0:
        NG -= x
        count += 1
    else:
        OK.append(x)
l = len(OK)
OK.sort(reverse = True)
i = 0
while NG > 0 and i < l:
    NG -= OK[i]
    count += 1
    i += 1
if NG <= 0:
    print(count)
else:
    print(-1)

Measured memory_bytes: 18708
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	lli n;
	cin>>n;

	vector<lli> a(n);
	REP(i,0,n)cin>>a[i];

	lli sum=0;
	REP(i,0,n)sum+=a[i];

	lli lSum=0;
	lli ans = INF;
	REP(i,0,n-1){
		lSum += a[i];
		lli rSum = sum-lSum;
		ans = min(ans,abs(lSum-rSum));
	}

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    int d[n];
    for(int i=0;i<n;i++) cin>>d[i];
    sort(d, d+n);
    cout<<d[n/2]-d[n/2-1];
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=205,M=21005,inf=0x3f3f3f3f,INF=0x7fffffff;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int n,m,cnt,S,T,ans,a[N][N],b[N],col[N*N];
int fir[N],firr[N],siz;
struct edge{int u,v,w,nex;}e[M];
void add(int u,int v,int w){
	e[++siz]=(edge){u,v,w,fir[u]};fir[u]=siz;
	e[++siz]=(edge){v,u,0,fir[v]};fir[v]=siz;
}
int dist[N],que[N];
void dec(int x,int fl){e[x].w-=fl;e[x^1].w+=fl;}
bool bfs(int S,int T){
	memset(dist,0x3f,4*(cnt+1));
	int l=1,r=1;que[l]=S;dist[S]=0;
	while (l<=r){
		int x=que[l];
		for (int i=fir[x];i;i=e[i].nex)
		if ((e[i].w)&&(dist[e[i].v]>dist[x]+1)){
			que[++r]=e[i].v;
			dist[e[i].v]=dist[x]+1;
		}
		l++;
	}
	return dist[T]!=inf;
}
int dfs(int x,int flow,int &T){
	if (x==T) return flow;
	int fl=0,t=0;
	for (int i=firr[x];i;i=e[i].nex)
	if (e[i].w&&(dist[e[i].v]>dist[x])){
		t=dfs(e[i].v,min(flow-fl,e[i].w),T);
		dec(i,t);fl+=t;
		if (fl==flow) {firr[x]=i;return fl;}
	}
	firr[x]=0;
	return fl;
}
ll dinic(){
	ll flow=0;
	while (bfs(S,T)){
		for (int i=0;i<=cnt;i++) firr[i]=fir[i];
		flow+=dfs(S,2147483647,T);
		cerr<<flow<<endl;
	}
	return flow;
}
int main(){
	n=read();m=read();
	for (int i=1;i<=n;i++)
	for (int j=1;j<=m;j++) a[i][j]=read(),col[++cnt]=i;
	for (int k=1;k<=m;k++){
		S=0;T=cnt=n*2+1;
		siz=1;memset(fir,0,sizeof(fir));
		for (int i=1;i<=n;i++){
			add(S,i,1);
			add(i+n,T,1);
			for (int j=k;j<=m;j++)
			add(i,n+col[a[i][j]],1);
		}
		assert(dinic()==n);
		for (int i=2;i<siz;i+=2)
		if ((e[i].u<=n)&&(e[i].v>n)&&e[i^1].w) b[e[i].u]=e[i].v-n;
		for (int i=1;i<=n;i++)
		for (int j=k;j<=m;j++)
		if (col[a[i][j]]==b[i]) swap(a[i][j],a[i][k]);
	}
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++) printf("%d ",a[i][j]);
		printf("\n");
	}
	for (int j=1;j<=m;j++){
		for (int i=1;i<=n;i++) b[col[a[i][j]]]=a[i][j];
		for (int i=1;i<=n;i++) a[i][j]=b[i];
	}
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++) printf("%d ",a[i][j]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 768
object Main {
  def main(args: Array[String]): Unit = {
    val nums = io.StdIn.readLine().split(' ').map(_.toInt)
    val ans = if(nums(2) - nums(1) <= 0){
      "delicious"
    }else if(0 < nums(2) - nums(1) && nums(2) - nums(1) <= nums(0)){
      "safe"
    }else{
      "dangerous"
    }
    println(ans)
  }
}


Measured memory_bytes: 25368
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int X;
    cin >> X;
    int mx = 1; //X以下の最大のべき乗数
    int limit = (int)sqrt(X);
    for(int i = 2; i <= limit; i++){
        int num = i * i;
        for(int j = 2;; j++){
            if(num <= X){
                mx = max(mx, num);
                num *= i;
            }else{
                break;
            }
        }
    }
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define ic_a int a;cin>>a;
#define ic_b int b;cin>>b;
#define ic_s string s;cin>>s;
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000

using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
typedef long double ld;
const ld eps = 1.0e-10; // 許容される誤差
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int keta(int n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10; n /= 10;
	}
	return sum;//Nanashi,tRue,wai
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */
ld mysqrtl(ld x)
{
	ld a = sqrtl((double)x); // 近似値
	do {
		a = (a + x / a) / 2.0L;
	} while (fabsl(x - a * a) > eps);
	return a;
}

//平方根を求める。sqrtより精度が高い。
//epsを変えて誤差を調整する。
int main(void) {
	Rapid_pleaseAC_fast;
	llint ans = 0, n = 0, m=0, count, sum = 0, ch = 0;
	llint  a, aa, aaa, rr = 0, gg = 0, bb = 0,b;
	bool check = false;
	string s,out;
	vector<llint> r, g;
	char c;
	cin >>a>>aa>>aaa;
	if (a % 2 == 0 || aa % 2 == 0 || aaa % 2 == 0)cout << 0 << endl;
	else cout << min(min(a*aa,aa*aaa),a*aaa) << endl;
	
	
	please AC;
}


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

int main() {
  int N;
  cin >> N;
  
  if(N / 1000 == (N / 100 - N / 1000 * 10) && N / 1000 == (N / 10 - N / 100 * 10)){
    cout << "Yes" <<endl;
  }
  else if(N % 10 == (N / 100 - N / 1000 * 10) && N % 10 == (N / 10 - N / 100 * 10)){
    cout << "Yes" <<endl;
  }
  else{
    cout << "No" <<endl;
  }
}


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


int main() {
    int N;
    std::cin >> N;
    std::map<int, int> map;

    for (int i = 0; i < N; i++) {
        int val;
        std::cin >> val;
        for (int j = 2; j < std::sqrt(val) + 1; j++) {
            if (val % j == 0) {
                if (map.find(j) == map.end()) {
                    map[j] = 1;
                } else {
                    map[j]++;
                }
            }
            while (val % j == 0) {
                val /= j;
            }
        }
        if (val > 1) {
            if (map.find(val) == map.end()) {
                map[val] = 1;
            } else {
                map[val]++;
            }
        }
    }

    bool is_pc = true;
    bool is_sc =  true;
    for (auto pair : map) {
        if (pair.second > 1) {
            is_pc = false;
        }
        if (pair.second == N) {
            is_sc = false;
        }
    }
    if (is_pc) {
        std::cout << "pairwise coprime" << std::endl;
    } else if (is_sc) {
        std::cout << "setwise coprime" << std::endl;
    } else {
        std::cout << "not coprime" << std::endl;
    }
}


Measured memory_bytes: 7272
# include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,count=0,d,len;
  cin>>n>>k;
  string s;
  cin>>s;
  len=s.length();
  for(int i=0;i<len-1;i++){
    if(s[i]!=s[i+1])
      count++;
  }
  cout<<min(n-1,n-1-count+2*k)<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>

using namespace std;

class Dice{
private:
  int D1;
  int D2;
  int D3;
  int D4;
  int D5;
  int D6;

public:
  Dice(int d1,int d2,int d3,int d4,int d5,int d6){
  D1=d1;
  D2=d2;
  D2=d2;
  D3=d3;
  D4=d4;
  D5=d5;
  D6=d6;
  }

  void roll(char dire){
  int dd1=D1;
  int dd2=D2;
  int dd3=D3;
  int dd4=D4;
  int dd5=D5;
  int dd6=D6;
  
  if(dire=='E')
    {
    D1=dd4;
    D3=dd1;
    D4=dd6;
    D6=dd3;
    }
  if(dire=='N')
  {
    D1=dd2;
    D2=dd6;
    D5=dd1;
    D6=dd5;
  }
  if(dire=='S')
  {
    D1=dd5;
    D5=dd6;
    D6=dd2;
    D2=dd1;
  }
  if(dire=='W')
  {
    D1=dd3;
    D3=dd6;
    D6=dd4;
    D4=dd1;
  }
  
  }
  
  int ue(){
  return D1;
  }
  
  int light(int up,int mae){
    int i;
    int j;
    int k;
    int l;
      for(i=0;i<4;i++)
      {
      roll('E');
     for(j=0;j<4;j++)
     {
      roll('S');
     for(k=0;k<4;k++)
     {
        roll('E');
        for(l=0;l<4;l++)
        {
        roll('S');
          if(up==D1 && mae==D2)
          return D3;
        }
     }
     }
    }
  }
  
  
  int check1(){
    return D1;
  }
  int check2(){
    return D2;
  }
  int check3(){
    return D3;
  }
  int check4(){
    return D4;
  }
  int check5(){
    return D5;
  }
  int check6(){
    return D6;
  }


};

int main()
{
  int di1[6]={};
  int di2[6]={};
  int i;
  int j;
  int k;
  int l;
  
  for(i=0;i<6;i++)
    cin >> di1[i];
    
  for(i=0;i<6;i++)
    cin >> di2[i];
    
  Dice dice1(di1[0],di1[1],di1[2],di1[3],di1[4],di1[5]);
  Dice dice2(di2[0],di2[1],di2[2],di2[3],di2[4],di2[5]);
  
  for(i=0;i<4;i++)
  {
    dice1.roll('E');
    for(j=0;j<4;j++)
    {
      dice1.roll('S');
      
      for(k=0;k<4;k++)
      {
         dice1.roll('E');
         for(l=0;l<4;l++)
         {
          dice1.roll('S');
          if(dice1.check1()==dice2.check1() &&dice1.check2()==dice2.check2() &&dice1.check3()==dice2.check3()&&dice1.check4()==dice2.check4()&&dice1.check5()==dice2.check5() &&dice1.check6()==dice2.check6() )
              {
                cout <<"Yes\n";
                goto Exit;
              }
         }
         
      }
    }
  }
  

    cout << "No\n";
  
  Exit:;
}

Measured memory_bytes: 1128
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <bitset>
#include <stack>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)

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

int main(void)
{
    int N;
    cin >> N;
    int a[N];
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    sort(a, a + N);
    lli cnt = 0;
    for (int i = 0; i < N - 2; i++)
    {
        for (int j = i + 1; j < N - 1; j++)
        {
            for (int k = j + 1; k < N; k++)
            {
                if (a[k] < a[i] + a[j])
                {
                    cnt++;
                }
                else
                {
                    break;
                }
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main()
{
    int x, y, W, H, r;
    cin >> W >> H >> x>> y >>r;
	//No????????¶
	if(x+r > W || x-r < 0 || y+r > H || y-r < 0){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
ll inf = LLONG_MAX;
long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll x, t;
  cin >> x >> t;
  cout << max(x - t, 0LL) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int i, a, b, k, tmp;
	scanf("%d%d%d", &a, &b, &k);

	for (i = 0;i < (k / 2);i++) {
		if (a % 2 == 0) {
			b = a / 2 + b;
			a = a - a / 2;
		}
		else {
			a = a-1;
			tmp = a;
			b = a / 2 + b;
			a = tmp - a / 2;
		}
		if (b % 2 == 0) {
			a = b / 2 + a;
			b = b - b / 2;
		}
		else {
			b = b-1;
			tmp = b;
			a = b/2 + a;
			b = tmp - b / 2;
		}
	}
	if (k % 2 == 1) {
		if (a % 2 == 0) {
			b = a / 2 + b;
			a = a - a / 2;
		}
		else {
			a = a - 1;
			tmp = a;
			b = a / 2 + b;
			a = tmp - a / 2;
		}
	}

	printf("%d %d\n", a, b);

	return 0;

}

Measured memory_bytes: 128
//do not think about past and stay in this moment
//organize and work - Abhinav IIITA
#include <bits/stdc++.h>
#include <ctime>
using namespace std;
#define int long long
#define ld long double
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end() 
const ld pi = acos(-1.0);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


// -----------------------------------------------------------------------

// -----------------------------------------------------------------------

void solve(){
	int n,h;
	cin>>n>>h;
	int arr[n],brr[n];
	for(int i=0;i<n;++i)
	cin>>arr[i]>>brr[i];
	int mx=-1;
	for(int i=0;i<n;++i)
	mx=max(mx,arr[i]);
	int s=0;
	sort(brr,brr+n);
	int cnt=0;
	for(int i=n-1;i>=0;--i){
		if(brr[i]<mx)
		break;
		s+=brr[i];cnt++;
		if(s>=h)
		break;
	}
	if(s>=h)
	cout<<cnt;
	else{
		cnt+=(h-s+mx-1)/mx;
		cout<<cnt;
	}
	
}


// -----------------------------------------------------------------------


int32_t main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); 	
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
#include <chrono> 
 
using namespace std;
using namespace std::chrono; 
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
#define gcd(a,b) __gcd(a,b)
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
#define vc vector<char>
#define pb(n) push_back(n)
#define pp pop_back()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define type(a) typeid(a).name();
#define print(arr) cout << "[" ;for(unsigned int i=0;i<(unsigned int) arr.size();i++){ (i==arr.size()-1)?cout << arr[i]:cout << arr[i] << ",";}cout << "]" << endl
#define Arr(arr,l) cout << "[" ;for(unsigned int i=0;i<(unsigned int) l;i++){ (i==l-1)?cout << arr[i]:cout << arr[i] << ",";}cout << "]" << endl
#define console(arr) cout << "["<<endl; for(ll i=0;i<(ll)arr.size();++i){cout << " [";for(ll j=0;j<(ll)arr[i].size();++j){(j==(int)arr[i].size()-1)?cout << arr[i][j]:cout << arr[i][j] << ",";}cout << "]"<<endl;} cout << "]"<<endl
#define starting() auto start = high_resolution_clock::now()
#define ending() auto stop = high_resolution_clock::now();auto duration = duration_cast<microseconds>(stop - start);cout << endl << endl << "Execution Time : "<<duration.count()/1000 << " ms" << endl
 
template <typename T1,typename T2>
void mapped(map<T1,T2>m){for(auto ite=m.begin();ite!=m.end();++ite){cout << "'" << ite->first << "'"<<" : "<<ite->second <<endl;}}
 
template <typename T1 , typename T2>
void mappedArr(map<T1,vector<T2>>m){for(auto ity=m.begin();ity!=m.end();++ity){cout << "'"<< ity->first <<"'"<<" : "<<"[";
for(int i=0;i<(int)ity->second.size();++i){(i==(int)ity->second.size()-1)?cout << ity->second[i]:cout << ity->second[i] << ",";}cout << "]"<<endl;}}
 
string int_to_string(int x){ stringstream ss; ss << x; string ni = ss.str(); return ni;}
int char_to_int(char c){ int n = (int)c - 48; return n; }
int string_to_int(string x){ int n; stringstream s(x); s >> n; return n; }
 
template <typename T1,typename T2>
void ArrPair(vector<pair<T1,T2>>vp){for(int i=0;i<(int)vp.size();++i){
cout << "(" << vp[i].first << "," << vp[i].second << ")"<<endl ;}}
 
const int MOD = 1e9 + 7;
const ll INF = 1e18L + 5;
 
int main(){
   int n,l;
   cin >> n >> l;
   vector<vector<string>> v(n,vector<string> (l));
   for ( int i = 0; i < n; ++i){
	  string s;
	  cin >> s;
	  for (int j = 0; j < l; ++j){
		  v[i][j] = s[j];
	  } 
   }
   sort(v.begin(),v.end());
   //string ans =  "";
   for (int i = 0; i < n; ++i){
	   for(int j = 0; j < l; ++j) {
		   cout << v[i][j];
	   }
   }
}














Measured memory_bytes: 768
x=input()
a = list(map(int, x))
b =[0]*len(a)
c =[0]*len(a)

b=a
x=sum(b)
y=0

c=a
for i in range(len(a)):
	c=a
	if c[i]>0:
		c[i]=c[i]-1
		for j in range(i+1,len(a)):
			c[j]=9
		if sum(c)>x:
			x=sum(c)
print(x)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef pair<lli, lli> pll;
typedef pair<int, int> pii;
#define ff first
#define ss second
#define mod 1000000007

vector<lli> dp,h;
lli k;

lli func(lli in){
    if(in==h.size()-1 ) return 0;
    if(in>=h.size()) return 0;
    if(dp[in]!=-1) return dp[in];

    lli a,b;
    a=abs(h[in+1]-h[in]) + func(in+1);
    for(lli i=2;in+i<h.size() && i<=k;i++) a=min(a, abs(h[in+i]-h[in]) + func(in+i));

    return dp[in]=a;
}

int main(){
    lli n;
    cin>>n>>k;
    lli i,j,l;
    dp.resize(n);
    for(i=0;i<n;i++){
        cin>>j;
        h.push_back(j);
        dp[i]=-1;
    }
    lli ans=func(0);
    cout<<ans<<endl;
    return 0;
}


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

long long numberOfDivisor(long long n){
    long long cnt = 0;
    for (long long i=1; i*i <= n; ++i) {
        if (n%i==0) {
            cnt++;
            if (n/i != i) cnt++; 
        }
    }
    return cnt;
}

int main() {
    int N; cin >> N;
    int res = 0;
    for (int i=1;i<=N;i+=2) if (numberOfDivisor(i)==8) res++;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3596