akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
ll mod= 1e9+7;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

ll c[100][100];
main(){
    ll x,t,n,m,k,tmp=0,ans=0;
    cin>>x>>t;
    cout<<max(x-t,(ll)0);
}
    


Measured memory_bytes: 256
result_lis = list( map(int,input().split()) )
N,T = result_lis

def solve(n,total):
    sen = n * 1000
    if total < sen:
        return [-1,-1,-1]
    
    sa = total - sen
    kyu = sa // 9000
    
    for i in range(kyu+1):
        zan = total - (i*10000 + (n-i)*1000)
        if zan % 4000 == 0:
            satu1 = i
            satu2 = zan // 4000
            satu3 = n-satu1-satu2
            if satu1 >= 0 and satu2 >= 0 and satu3 >= 0:
                return [satu1,satu2,satu3]
    return [-1,-1,-1]
    
print(' '.join(map(str,solve(N,T))))

Measured memory_bytes: 3064
def main():
    N = int(input())
    A = list(map(int,input().split()))
    cnt = 0
    t = 0
    r = 0
    for l in range(N):
        while r < N and (t & A[r]) == 0:
            t += A[r]
            r += 1
        t -= A[l]
        cnt += (r-l)

    print(cnt)

main()

Measured memory_bytes: 23560
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * @author:26019
 */
public class Main {


    public static void main(String[] args) throws Exception {
        solve();
    }

    private static void solve() throws Exception {
        //BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File("C:\\Users\\26019\\Downloads\\out.txt"))));
        FastScanner cin = new FastScanner();
        int n = cin.nextInt(), k = cin.nextInt();
        int[] arr = cin.readArray(n);
        for (int i = k; i < n; i++) {
            if (arr[i] > arr[i - k]) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("C:\\Users\\26019\\Downloads\\P1190_9.in"))));
        StringTokenizer st = new StringTokenizer("");

        FastScanner() throws FileNotFoundException {
        }

        public String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        public String nextLine() { // 读取带空格的字符串
            String res = null;
            try {
                res = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return res;
        }

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

        public int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

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

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

    }
}


Measured memory_bytes: 58204
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

#define BR "\n"
#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a, b) ((((a) % (b) ) + (b)) % (b))
#define MO(a) AS_MOD(a,mod)
#define FEACH(it, cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it, cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)
#define MIN(V, T) V=min(V,T)

#define PrintArray(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;
#define PrintPairs(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i].fi <<"," << cont[__i].se<<")";} cout<<endl;
#define Print(v) cout<<v<<endl;
#define PDBG() cout<<"Line:"<<__LINE__<<endl;
#define PrintArray2D(cont, fh, th, fw, tw) for(int __i=fh;__i<th;++__i){for(int __j=fw;__j<tw;++__j) {cout<<cont[__i][__j]<<" ";} cout<<endl;}cout<<endl;
#define Resize2D(cont,H,W,V) cont.resize(H);for(int i=0;i<H;++i)cont[i].resize(W,V);
#define Resize3D(cont,H,W,D,V) cont.resize(H);for(int i=0;i<H;++i)cont[i].resize(W);for(int i=0;i<H;++i)for(int j=0;j<W;++j)cont[i][j].resize(D,V);
/*
 * ***_bound(6)
 * 5 6 6 6 6 6 7 7 7
 *   ^lower    ^upper
 * void reverse(c.begin(), c.end())
 *
 * graph
 * seg tree
 * dp
 * brute force
 * priority_queue<int,vector<int>, greater<int>> Q;
 */
struct Comparator{
    int operator()(int l, int r) const {
        return r<l;
    }
};
/*
struct PairComp{
    int operator()(P l, P r) const {
        return l.fi==r.fi?l.se<r.se:l.fi<r.fi;
    }
};*/
struct Vec;
//set<int, Comparator> S;

// solution below
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
int main() {
    cout.precision(15);
    cout << fixed;
    ll N,K;
    vector<ll> ps;
    cin >> N>>K;
    ps.resize(N);
    REP(i,N) {
        cin>>ps[i];
    }
    sort(ALL(ps));
    ll ans=0;
    REP(i,K) {
        ans+=ps[i];
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 3632
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

ll f[110][15],p[110][15];

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

	      	  cin.tie(0);  ios_base::sync_with_stdio(false);

	      	  ll N;
	      	  cin >> N;
	      	  for(i=1;i<=N;i++){
	      		  for(j=1;j<=10;j++){
	      			  cin >> f[i][j];
	      		  }
	      	  }
	      	  for(i=1;i<=N;i++){
	      		  for(j=0;j<=10;j++){
	      			  cin >> p[i][j];
	      		  }
	      	  }

	      	  ll mx=-1000000007;
	      	  for(i=1;i<(1<<10);i++){
	      		if(__builtin_popcount(i)==0) continue;
	      		  ll x=0;
	      		  for(k=1;k<=N;k++){
	      			  ll c=0;
	      		  for(j=0;j<10;j++){
		      			  if(i&(1<<j)){
		      				  if(f[k][j+1]==1) c++;

		      			  }
	      		  }
	      		     x+=p[k][c];

	      		  }
	      		  mx=max(mx,x);
	      	  }

	      	  cout << mx << endl;


	          return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
class UnionFind{
    public:
        ll size;
        ll *rank;
        ll *parent;

        UnionFind(ll N){
            this->size = N;
            rank = new ll[size];
            parent = new ll[size];
            for(ll i = 0; i < size; ++i){
                rank[i] = 0;
                parent[i] = i;
            }
        }

        ~UnionFind(){
        }

        ll find(ll child){
            return (child == parent[child] ? child : parent[child] = find(parent[child]));
        }

        void unit(ll x, ll y){
            x = find(x); y = find(y);
            if(x != y){
                if(rank[x] > rank[y]){
                    parent[y] = x;
                }else{
                    parent[x] = y;
                    if(rank[x] == rank[y]){
                        ++rank[y];
                    }
                }
            }
        }

        bool same(ll x, ll y){
            return (find(x) == find(y));
        }

};
struct V{
    ll x, y, i;
};
struct E{
    ll d, i, j;
};
int main(){
    ll N;
    cin >> N;
    vector<V> v(N);
    for(ll i = 0; i < N; i++){
        ll x, y;
        cin >> x >> y;
        v[i] = V{x, y, i};
    }
    vector<E> e;
    sort(v.begin(), v.end(), [&](V a, V b){return a.x < b.x;});
    for(ll i = 0; i < N - 1; i++) e.push_back(E{v[i + 1].x - v[i].x, v[i].i, v[i + 1].i});
    sort(v.begin(), v.end(), [&](V a, V b){return a.y < b.y;});
    for(ll i = 0; i < N - 1; i++) e.push_back(E{v[i + 1].y - v[i].y, v[i].i, v[i + 1].i});
    UnionFind U(N);
    ll ans = 0;
    sort(e.begin(), e.end(), [&](E a, E b){return a.d < b.d;});
    for(auto u : e){
        if(U.same(u.i, u.j)) continue;
        U.unit(u.i, u.j);
        ans += u.d;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 10864
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

int main() {
	int X;
	cin >> X;
	bool flag=true;
	--X;
	while(flag){
		++X;
		flag=false;
		for(int i=2; i*i<=X; ++i){
			flag=flag||(X%i==0);
		}
	}
	cout << X << endl;
	return 0;
}

Measured memory_bytes: 256
n,m =map(int,input().split())
lis = [[int(i)for i in input().split()]for _ in range(n)]
lis =sorted(lis,key=lambda x:x[0])
kane = 0
num = 0
for li in lis:
    if num + li[1] < m:
        kane += li[0]*li[1]
        num += li[1]
    else:
        kane += li[0]*(m-num)
        break
print(kane)

Measured memory_bytes: 23524
#include<stdio.h>

int main() {
	int n, x, min, temp, val, cnt, i;
	val = scanf("%d%d", &n, &x);
	if (val == 0) return 1;

	cnt = 0;
	min = 1000;
	for (i = 0; i < n; i++) {
		val = scanf("%d", &temp);
		if (val == 0) return 1;
		x -= temp;
		cnt++;
		if (min > temp) min = temp;
	}

	printf("%d", cnt + x / min);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
long long a,b,i,A,B;int x;
map<int,int>m;
int main()
{
    cin>>A>>B;
    a=A;b=B;
    for(i=2;i*i<=A;i++)
    {while(a%i==0){a/=i;m[i]=1;}}
    if(a!=1)m[a]=1;
    for(i=2;i*i<=B;i++)
    {while(b%i==0){b/=i;if(m[i]==1){x++;m[i]=2;}}}
    if(b!=1){if(m[b]==1)x++;}
    cout<<x+1;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<double,double> dd;
typedef pair<ll,ll> pll;
typedef pair<string,int> psi;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvll;
typedef vector<vector<ii> > vvip;
typedef vector<ii> vii;
typedef map<int,int> mpi;
#define pb push_back
#define F first
#define S second
//#define MOD 1000000007
#define NA -1
#define ALL(v) v.begin(),v.end()
#define mp make_pair
#define rep(i, n) for (int (i) = 0; (i) < (n); (i) ++)
#define rep1(i, n) for (int (i) = 1; (i) <= (n); (i) ++)
#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define db(x) {cout << #x << " = " << (x) << endl;}
#define dba(a, x, y) {cout<<#a<<" :";FOR(i123,x,y)cout<<setw(4)<<(a)[i123];cout<<endl;}
#define foreach(e, x) for (__typeof(x.begin()) e = x.begin(); e != x.end(); e++) 
#define clr(x) memset(x,0,sizeof(x));
#define sz(x) int((x).size())
#define endl '\n'
const int INF = INT_MAX;
const ll INFL = LLONG_MAX;
const ld pi = acos(-1);
#define sc(t) scanf("%d",&t)
// vector<string> split(const string &s, char delim) {
//     stringstream ss(s);
//     string item;
//     vector<string> tokens;
//     while (getline(ss, item, delim)) {
//         tokens.push_back(item);
//     }
//     return tokens;
// }

typedef pair<pll,ll> ppll;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
#define re return
#define MAX 100


ll ab(ll x)
{
	re x<0?(-x):x;
}
int main()
{
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt","r",stdin);
	//     freopen("output.txt","w",stdout);;
	// #endif
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	//ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	ios_base::sync_with_stdio(0); cout.precision(15); cout << fixed; cout.tie(0); cin.tie(0);
	
	int n;
	cin>>n;
	vll v(3*n);
	rep(i,3*n)
	cin>>v[i];
	sort(ALL(v));
	ll an=0;
	reverse(ALL(v));
	// 1 2 5 5 5 8
	int ct=0;
	for(int i=1,ct=0;i<=3*n-1 && ct<=n-1;i+=2,ct++)
	{

		an+=v[i];
	}
	cout<<an<<endl;
	
}
	


Measured memory_bytes: 2560
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

template <typename T> // T : type of cost
struct BellmanFord {
    T inf = numeric_limits<T>::max(); // initial value, reused when clear() is called
    int n;                            // number of nodes
    vector<T> dist;                   // distance from start node
    bool negativeLoop;
    struct edge {
        int from, to;
        T cost;
        edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
    };
    vector<edge> edges;

    BellmanFord(int n) : n(n), negativeLoop(false), dist(n, inf){};
    // 0-indexed!
    void addEdge(int from, int to, T cost) { edges.emplace_back(from, to, cost); }
    // calculate dist[i] as a shortest distance from start
    void build(int start, int end = -1) {
        dist[start] = 0;
        for (int i = 0; i < n; ++i) {
            for (auto &e : edges) {
                if (dist[e.from] != inf && dist[e.to] > dist[e.from] + e.cost) {
                    dist[e.to] = dist[e.from] + e.cost;
                    if (i == n - 1 && (end == -1 || end == e.to)) {
                        negativeLoop = true;
                        break;
                    }
                }
            }
        }
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    BellmanFord<ll> bf(n);
    for (int i = 0; i < m; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        bf.addEdge(a, b, -c);
    }
    bf.build(0, n - 1);
    if (bf.negativeLoop)
        cout << "inf"
             << "\n";
    else
        cout << -bf.dist[n - 1] << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(p,a,b)    for(int p=a;p<b;p++)
#define INF 0x3f3f3f3f
#define N 100007

int factorial(int n) 
{ 
    // single line to find factorial 
    return (n==1 || n==0) ? 1: n * factorial(n - 1);  
} 

int main() {
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("o2.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    string s;
    cin>>s;
    if(s=="ABC")cout<<"ARC";
    else cout<<"ABC";
    return 0;
}

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


int main() {
	int r, s, p;
	cin >> r >> s >> p;

	vector<int> d(p);
	for(int k=0;k<p;k++) {
		int i, j;
		cin >> i >> j;
		d[k] = (r - i + 1);
		if(j <= s) {
			d[k] += s - j + 1;
		}else {
			d[k] += j - (s + 1) + 1;
		}
	}
	sort(d.begin(), d.end());

	int ans = 0;
	for(auto& e : d) {
		ans = max(ans + 1, e);
	}
	cout << ans << endl;
	
	return 0;
}



Measured memory_bytes: 4596
#include<iostream>
using namespace std;
int main() {
  int N, K, D;
  cin >> N >> K;
  bool d[10];
  for (int i = 0;i < 10;++ i) d[i] = false;
  while(K--) {
    cin >> D;
    d[D] = true;
  }
  for (int i = N;;++ i) {
    for(int j = i;j;j /= 10) if(d[j % 10]) goto cont;
    cout << i;
    break;
    cont:;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define watch(x) cout<<(#x)<<" is "<<x<<endl;
#define ll long long int
#define pb push_back
#define in insert
#define mp make_pair
#define F first
#define S second
#define N 1000000
#define mod 1000000007
#define PI acos(-1)
int main()
{
	IOS
	int x,y;
	cin>>x>>y;
	int a,b;
    if(y-2*x< 0 || (y-2*x)&1 || 4*x-y <0 || (4*x-y)&1)
    cout<<"No";
    else
    cout<<"Yes";
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 5;
int n, m, mi, sum, t;

int main() {
    mi = 1e9;
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        cin >> t;
        sum += t;
        mi = min(mi, t);
    }
    cout << n + (m - sum) / mi << endl;
    return 0;
}


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

void fnInput(vector<double>& rvnValue)
{
  int nValueSiz;
  cin >> nValueSiz;
  rvnValue.resize(nValueSiz);

  for(double& rnValue : rvnValue)
    cin >> rnValue;
}
  
double fnMaxValueGet(const vector<double>& cnrvnValue)
{
  vector<double> vnAscValue(cnrvnValue);

  while (vnAscValue.size() > 1)
  {
    sort(begin(vnAscValue), end(vnAscValue));
    auto it = begin(vnAscValue);
    double nAveValue = ( *it + *(it + 1) ) / 2;

    vnAscValue.erase(it, it + 2);
    vnAscValue.push_back(nAveValue);
  }
  return vnAscValue[0];
}
  
int main()
{
  vector<double> vnValue;

  fnInput(vnValue);
  cout << fnMaxValueGet(vnValue) << endl;

  return 0;
}

Measured memory_bytes: 384
using System;

namespace B___Golden_Apple
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var n = double.Parse(input[0]);
            var d = double.Parse(input[1]);
            var ans = Math.Ceiling(n / (2 * d + 1));
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11220
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(N-K):
    if A[i] < A[i+K]:
        print('Yes')
    else:
        print('No')


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

using namespace std;

typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

const ll MAX_N = 210;

ll d[MAX_N][MAX_N];
ll N;
void warshall_floyd() {
    for(ll k = 0; k < N; k++) {
        for(ll i = 0; i < N; i++) {
            for(ll j = 0; j < N; j++) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int main() {
    ll i, j, k;
    ll M, R;
    cin >> N >> M >> R;
    for(i = 0; i < N; i++) {
        for(j = 0; j < N; j++) {
            if(i == j) {
                d[i][j] = 0;
            } else {
                d[i][j] = INF;
            }
        }
    }
    vll r(R);
    for(auto &e : r)
        cin >> e;
    for(i = 0; i < M; i++) {
        ll a, b, c;
        cin >> a >> b >> c;
        d[a - 1][b - 1] = c;
        d[b - 1][a - 1] = c;
    }
    warshall_floyd();
    ll ans = INF;
    sort(r.begin(), r.end());
    do {
        ll dist = 0;
        for(i = 0; i < R - 1; i++) {
            dist += d[r[i] - 1][r[i + 1] - 1];
        }
        ans = min(ans, dist);
    } while(next_permutation(r.begin(), r.end()));
    cout << ans << endl;

    return 0;
}


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

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int,int> pii;

#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define ff it->first
#define ss it->second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(auto i=0;i<n;++i)
#define LOOP_IT(it,s) for(auto it=(s).begin();it!=(s).end();++it)


#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif



int main(int argv, char* argc[])
{
    FASTIO


    ll n,m,x,mn=2e18;
    cin>>n>>m>>x;
    vll c(n);
    vector<vll> v(n);
    vll res(m);

    rep(i,n)
    {
        cin>>c[i];
        rep(j,m)
        {
            ll xx; cin>>xx;
            v[i].pb(xx);
        }
    }
    ll p = (ll)ceil(pow(2,n));

    for(ll i=0;i<p;++i)
    {
        bitset<15> s(i);
        ll tot = 0;

        res.clear();
        res.resize(m);


        rep(j,n)
        {
            if(s[j]==0)
                continue;
            tot+=c[j];

            ll cnt=0;
            for(ll k=0;k<m;++k)
            {
                res[k]+=v[j][k];
                if(res[k]>=x)
                    ++cnt;
            }

            if(cnt==m)
                mn = min(mn,tot);
        }

    }
    if(mn==2e18)
        mn=-1;
    cout<<mn;



    return 0;
}



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

int main() {
	int n, m;
	cin >> n >> m;
	int s[m];
	char c[m];
	for (int i = 0; i < m; i++) {
		cin >> s[i] >> c[i];
	}

	string ans = "";
	for (int i = 0; i < n; i++) {
		ans += "0";
	}
	if (n != 1) {
		ans.at(0) = '1';
	}

	for (int i = 0; i < m; i++) {
		ans.at(s[i]-1) = c[i];
	}

	for (int i = 0; i < m; i++) {
		if(ans.at(s[i]-1) != c[i]) {
			ans = "-1";
			cout << ans << endl;
			return 0;
		}
	}
	if (n != 1 && ans.at(0) == '0') {
		ans = "-1";
		cout << ans << endl;
		return 0;
	}

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

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int a,b,c;
	int t=0,h=0;

	while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
		if(a == b)
			h++;
		if(a*a + b*b == c*c)
			t++;
	}
	printf("%d\n%d\n",t,h);
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,k;
cin>>n>>k;
int arr[n+1];
for(int i=0;i<=n;i++)
    arr[i]=i;
int pref[n+1]={};
for(int i=1;i<=n;i++)
    pref[i]+=arr[i]+pref[i-1];
int suff[n+1]={};
suff[n]=arr[n];
for(int i=n-1;i>=0;i--)
    suff[i]+=suff[i+1]+arr[i];
    int mod=pow(10,9)+7;
    int ans=0;
for(int i=k-1;i<=n;i++)
{
    ans+=suff[n-i]-pref[i]+1;
    ans%=mod;
    ////cout<<ans<<" ";
}
cout<<ans<<endl;
    return 0;
}


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

int main(){
  int x;
  cin >> x;
  if(x>=2000){
    cout << 1 << endl;
    return 0;
  }
  rep(a,20){
  rep(b,20){
  rep(c,20){
  rep(d,20){
  rep(e,20){
  rep(f,20){
    int tmp = 0;
    tmp += a*100;
    tmp += b*101;
    tmp += c*102;
    tmp += d*103;
    tmp += e*104;
    tmp += f*105;
    if(tmp == x){
      cout << 1 << endl;
      return 0;
    }
  }
  }
  }
  }
  }
  }
  cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, k;
    scanf("%d%d%d", &a, &b, &k);
    int count = 0;
    for(int i = min(a, b); i > 0; i--) {
        if( a % i == 0 && b % i == 0) {
            count++;
            if(count == k) printf("%d\n", i);
        }
    }
    return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e13;
const int mod = 1e9+7;
#define ll long long
signed main() {
    int s;
    cin >> s;
    if(1e9<s) {
        int aa=(1000000000 - s%1000000000)%1000000000;
        int bb=(s+aa)/1000000000;
        cout << 0 <<" "<< 0 <<" "<<1000000000<<" "<<1<<" " <<aa<<" "<<bb <<endl;
    }else {
        cout << 0 <<" "<< 0 <<" "<<1<<" "<<0<<" " <<0<<" "<<s <<endl;
    }
  return 0;
}



Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 100005;
const int maxm = maxn*2;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
int main() {
    int n,tmp = 0,x;
    scanf("%d",&n);
    for(int i = 1;i<=n;i++) {
        scanf("%d",&x); tmp ^= x;
    }
    if(tmp) printf("No\n");
    else printf("Yes\n");
}


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

int n;

int a[] = {3, 5, 7};
bool che(int x)
{
    int ok[3] = {};
    while (x > 0)
    {
        if (x % 10 == 3)
            ok[0] = 1;
        else if (x % 10 == 5)
            ok[1] = 1;
        else
            ok[2] = 1;
        x /= 10;
    }
    return ok[0] * ok[1] * ok[2];
}
int dfs(int num)
{
    int res = 0;
    if (che(num))
        res++;
    rep(i, 3)
    {
        int nxt = 10 * num + a[i];
        if (nxt <= n)
            res += dfs(nxt);
    }
    return res;
}

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

    cin >> n;
    cout << dfs(0) << endl;
}


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

using ll = long long;
using vll = vector<ll>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define vllin(x,n) vll (x)(n);FOR(i,0,n-1){cin >>(x)[i];}
#define vllin2(a,b,n) vll (a)(n);vll (b)(n);FOR(i,0,n-1){cin >>(a)[i]>>b[i];}
#define vpl4in(x,n) vpl4 (x)((n),mp(0,0));FOR(i,0,n-1){cin >>x[i].fi>>x[i].se;}
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define sas cout<<(' ');
#define sayR(x) cout<<fixed<<setprecision(10)<<(x);
#define salR(x) cout<<fixed<<setprecision(10)<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;
#define pow(a,b) ll(pow(a,b))

ll MOD=1000000007;

signed main(){
	llin(n);
	stin(s);
	map<char,ll> a{};
	char b[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
	FOR(i,0,n-1){
		if(a[s[i]]>0){
			a[s[i]]++;
		}else{
			a[s[i]]=1;
		}
	}
	ll c=1;
	FOR(i,0,25){
		c=(c*(a[b[i]]+1))%MOD;
	}
	sal(c-1);
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define inf 1000000007
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
lol a,b,c,d;
int i[100010];
bool dp[100010];
bool vi[100010];
bool ka(int x){
    if(vi[x]) return dp[x];
    bool ca=false;
    vi[x]=true;
    for(int n=0;n<a;n++){
	if(x-i[n]>=0&&!ka(x-i[n])) ca=true;
    }
    return dp[x]=ca;
}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >>a>>b;
    for(int n=0;n<a;n++) cin >>i[n];
/*
  for(int n=1;n<=b;n++){
  for(int m=0;m<a;m++){
  if(n-i[m]>=0&&!dp[n-i[m]]) dp[n]=true;
  }
  }
  if(dp[b]) cout <<"First\n";
  else cout <<"Second\n";
*/
    if(ka(b)) cout <<"First\n";
    else cout <<"Second\n";
    return (0);
}


Measured memory_bytes: 5120
#include <stdio.h>

int main(void){
  int i;

  int n;
  scanf("%d", &n);

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

  long sum=b[n-2];
  for(i=n-2; i>0; i--){
    if(b[i] < b[i-1]){
      sum += b[i];
    }else{
      sum += b[i-1];
    }
  }
  sum += b[0];

  printf("%ld\n", sum);

  return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
  int a[100],n;
  cin>>n;
  for(int i=0;i<n;i++)
    cin >> a[i];
  for(int j=n-1;j>=0;j--){
    cout<<a[j];
    if(j!=0)
      cout<<" ";
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 3092
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    K = int(input())
    S = input()
    
    M = len(S)
    N = M + K
    MAXN = N + 2
    fact = [1]
    for i in range(1,MAXN + 1):
        fact.append(fact[-1]*i%MOD)
    inv_fact = [-1] * (MAXN + 1)
    inv_fact[-1] = pow(fact[-1],MOD - 2,MOD)
    for i in range(MAXN - 1,-1,-1):
        inv_fact[i] = inv_fact[i + 1]*(i + 1)%MOD
    
    nck = lambda N,K: 0 if K > N or K < 0 else fact[N]*inv_fact[N - K]*inv_fact[K]%MOD
    
    power25 = [1]
    power26 = [1]
    for i in range(N):
        power25.append(power25[-1]*25%MOD)
        power26.append(power26[-1]*26%MOD)
    
    ans = 0
    for i in range(M,N + 1):
        ans += nck(i - 1,M - 1) * power25[i - M] * power26[N - i] % MOD
        ans %= MOD
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 241796
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for (int i = k; i < (int)(n); i++)
#define repd(i, n) for (int i = n-1; i >= 0; i--)
#define rrepd(i, k, n) for (int i = n-1; i >= (int)(k); i--)
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
//V,Pは大文字i,l,bは小文字
using ll = long long;
using Vi = vector<int>;
using VVi = vector<Vi>;
using Vl = vector<ll>;
using VVl = vector<Vl>;
using Vb = vector<bool>;
using VVb = vector<Vb>;
using P = pair<int,int>;
using Pll = pair<ll, ll>;
const ll mod = 1000000007;
const ll inf = 1000000000000;//10の12乗

int main() {
    string s,t;
    cin >> s >> t;
    int n=t.size();
    ll ans=n;
    rep(i,s.size()-n+1){
        string ss=s.substr(i,n);
        ll now=0;
        rep(i,n){
            
            if(ss[i]!=t[i]) now++;
            
        }
        chmin(ans,now);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3600
import sys


def BubbleSort(C):
    for i in range(len(C)):
        for j in range(len(C)-1, i, -1):
            if C[j][1] < C[j-1][1]:
                C[j], C[j-1] = C[j-1], C[j]


def SelectionSort(C):
    for i in range(len(C)):
        mini = i
        for j in range(i, len(C)):
            if C[j][1] < C[mini][1]:
                mini = j
        C[i], C[mini] = C[mini], C[i]


def stable(cards, C):
    for a in range(len(C)-1):
        c1 = cards.index(C[a])
        c2 = cards.index(C[a+1])
        if C[a][1] == C[a+1][1] and c1 > c2:
            print("Not stable")
            break
    else:
        print("Stable")


def main():
    input = sys.stdin.readline
    N = int(input())
    cards = input().split()
    bs = [i for i in cards]
    ss = [i for i in cards]
    BubbleSort(bs)
    SelectionSort(ss)
    print(" ".join(bs))
    stable(cards, bs)
    print(" ".join(ss))
    stable(cards, ss)


if __name__ == "__main__":
    main()


Measured memory_bytes: 5616
#include <iostream>
#include <complex>

using namespace std;
typedef complex<double> P;

#define EPS (1e-5)

struct Seg {
  P s, t;
  Seg(P s, P t) : s(s), t(t) {}
};

double cross(P a, P b) {
  return (a.real()*b.imag() - a.imag()*b.real());
}

bool isIntersectedSS(Seg a, Seg b) {
  return ( cross(a.t-a.s, b.s-a.s) * cross(a.t-a.s, b.t-a.s) < EPS )
      && ( cross(b.t-b.s, a.s-b.s) * cross(b.t-b.s, a.t-b.s) < EPS );
}

int main() {
  int n; cin >> n;
  for(int I=0; I<n; I++) {
    int x, y;
    cin >> x >> y; P pt1(x, y);
    cin >> x >> y; P pt2(x, y);
    cin >> x >> y; P pt3(x, y);
    cin >> x >> y; P pk(x, y);
    cin >> x >> y; P ps(x, y);
    
    int ok = 0;
    ok += isIntersectedSS(Seg(pt1, pt2), Seg(pk, ps));
    ok += isIntersectedSS(Seg(pt2, pt3), Seg(pk, ps));
    ok += isIntersectedSS(Seg(pt3, pt1), Seg(pk, ps));
    
    if(ok%2) {
      cout << "OK" << endl;
    }
    else {
      cout << "NG" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1156
import math
n,d = map(int,input().split())
count = 0
alllist = []
for i in range(n):
    alist = list(map(int,input().split()))
    alllist.append(alist)


for i in range(n-1):
    for j in range(i+1,n):
        count1 = 0
        for s in range(d):
            count1 += (alllist[i][s]-alllist[j][s])**2
        if math.sqrt(count1) == int(math.sqrt(count1)):
            count += 1
print(count)

Measured memory_bytes: 3064
x,y=map(int,input().split())

mod = 10 ** 9 + 7
def cmb(n, r, mod):
    r = min(r, n - r)
    x = 1
    y = 1
    for i in range(r):
        x = x * (n - i) % mod
        y = y * (i + 1) % mod
    y = pow(y, mod-2, mod)
    return x * y % mod

if (x+y) %3: print(0);exit()

n=(x+y)//3

x-=n
y-=n
if x < 0 or y < 0: print(0);exit()

print(cmb(x+y,x,mod))

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

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define M_PI       3.14159265358979323846
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    cout<<setprecision(15);
    ll r;
    cin>>r;
    cout<<(2*r*M_PI)<<endl;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

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

using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define endl			"\n"

int32_t main(){
	
	int x, y, z;
	cin>>x>>y>>z;

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

	return 0;
}

Measured memory_bytes: 256
from bisect import bisect_left
import sys
sys.setrecursionlimit(10**6)

n=int(input())
a=list(map(int,input().split()))
g = [[]for _ in range(n)]
for i in range(n-1):
    u,v=map(int,input().split())
    g[u-1].append(v-1)
    g[v-1].append(u-1)

lis = [float('inf')]*n
ans = [0]*n

def dfs(now, pre):
    idx = bisect_left(lis, a[now])
    tmp = lis[idx]
    lis[idx] = a[now]
    ans[now] = bisect_left(lis, float('inf'))
    for to in g[now]:
        if to == pre:
            continue
        dfs(to, now)
    lis[idx] = tmp

dfs(0,-1)
for x in ans:
    print(x)

Measured memory_bytes: 345428
#include<bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<=(int)k;i++)
#define per(i,j,k) for(int i=(int)j;i>=(int)k;i--)
using namespace std;
typedef long long LL;
const int N=110000;
LL a[N],b[N];
int n;
int main(){
    LL ans=0;
    scanf("%d",&n);
    rep(i,1,n)scanf("%lld%lld",&a[i],&b[i]);
    LL tmp=0;
    per(i,n,1){
        a[i]+=tmp;
        int xx=(b[i]-(a[i]%b[i]))%b[i];
        tmp+=xx;
        ans+=xx;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    ll N;
    cin >> N;
    for(ll n = 1; n <= 3500; n++) {
        for(ll h = 1; h <= 3500; h++) {
            if((4 * h * n - N * h - N * n) != 0 &&
               (N * n * h) % (4 * h * n - N * h - N * n) == 0) {
                ll w = (N * n * h) / (4 * h * n - N * h - N * n);
                if(w <= 0)
                    continue;
                cout << h << " " << n << " " << w << endl;
                return 0;
            }
        }
    }
    return 0;
}

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

int main()
{
  int n,p;

  for(;cin>>n>>p,n||p;)
    {
      int count[n];
      memset(count,0,sizeof(count));
      int pp=p;
      for(int i=0;;i++)
	{
	  if(i>=n)
	    i=0;
	  if(pp!=0)
	    {
	      count[i]++;
	      pp--;
	    }
	  else
	    {
	      pp=count[i];
	      count[i]=0;
	    }
	  if(count[i]==p)
	    {
	      cout<<i<<endl;
	      break;
	    }
	}
      
    }
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdlib>
#include <cmath>
#include <string.h>
#include <memory.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <bitset>

#define F first
#define S second
#define MP make_pair

typedef long long ll;

using namespace std;

int const PI = acos(-1);
int dx[] = { 0, 1, 0, -1 };
int dy[] = { 1, 0, -1, 0 };

long long gcd(long long a, long long b) {
	return b == 0 ? a : gcd(b, a % b);
}

long long lcm(long long a, long long b) {
	return a * (b / gcd(a, b));
}

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	
	int tmp;
	for(int i = 2; i < 10000; i++) {
	  tmp = a * i;
	  if((a + tmp) % b == c % b) {
	    cout << "YES" << endl;
	    return 0;
	  }
	}
	
	cout << "NO" << endl;

  return 0;
}

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




int main(){
    int A,B;
    cin >>A>>B;
    rep(i,1010){
        if((int)((double)i*0.08)==A && (int)((double)i*0.1)==B){
                cout<<i<<endl;
                return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
    
}

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

using namespace std;


int main()
{
    string s;
    bool f = true;
    cin >> s;

    for(int i = 0;i < s.size();i++){
        if((i + 1) % 2 == 0 && s[i] != 'L' && s[i] != 'U' && s[i] != 'D'){
            f = false;
        }
        else if((i + 1) % 2 == 1 && s[i] != 'R' && s[i] != 'U' && s[i] != 'D'){
            f = false;
        }
    }

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

    return 0;
}

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

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

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

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

long long cnt;
int m;
int A[1000000];
vector<int> G;

void insertionSort(int A[],int n,int g){
    int v,j;
    for(int i=g;i<n;i++){
        v = A[i];
        j = i - g;
        while (j >= 0 && A[j] > v){
            A[j+g] = A[j];
            j = j - g;
            cnt++;
        }
        A[j+g] = v;
    }
}

void shellSort(int A[],int n){
    cnt = 0;
    for(int h=1;;){
        if(h>n)break;
        G.push_back(h);
        h = 3*h + 1;
    }
    m = G.size();
    for(int i=m-1;i>=0;i--){
        insertionSort(A,n,G[i]);
    }
}

int main(){
    cnt = 0;
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> A[i];
    }
    shellSort(A,n);
    // mの出力
    cout << m << endl;
    // Gの出力
    for(int i=G.size()-1;i>=0;i--){
        if(i < G.size() - 1) cout << " ";
        cout << G[i];
    }
    cout << endl;
    // cntの出力
    cout << cnt << endl;
    for(int i=0;i<n;i++){
        cout << A[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 7072
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

int main(){
    int a,b,c,x;
    int ans=0;
    cin>>a>>b>>c>>x;
    rep(i,0,a+1){
        rep(j,0,b+1){
            rep(k,0,c+1){
                ans+=(i*500+100*j+50*k==x);
            }
        }
    }
    cout<<ans<<endl;
    
    return 0;
}

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

using namespace std;
typedef long long ll;

ll H,W;
string s[30];
ll m[30][30];
ll dd[5] = {0,-1,0,1,0};

ll dist(ll a, ll b, ll c, ll d){
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            m[i][j] = 1e15;
        }
    }
    m[a][b] = 0;
    queue<pair<ll,ll>> q;
    q.push(make_pair(a,b));
    while(m[c][d] == 1e15){
        pair<ll,ll> p = q.front();
        q.pop();
        ll x = p.first;
        ll y = p.second;
        for(int i=0;i<4;i++){
            ll xx = x + dd[i];
            ll yy = y + dd[i+1];
            if(xx < 0 || xx >= H || yy < 0 || yy >= W) continue;
            if(m[xx][yy] != 1e15) continue;
            if(s[xx][yy] == '#') continue;
            m[xx][yy] = m[x][y] + 1;
            q.push(make_pair(xx,yy));
        }
    }
    return m[c][d];
}


int main(){
    cin >> H >> W;
    ll max_d = 0;
    for(int i=0;i<H;i++) cin >> s[i];
    for(int sx=0;sx<H;sx++){
        for(int sy=0;sy<W;sy++){
            for(int gx=0;gx<H;gx++){
                for(int gy=0;gy<W;gy++){
                    if(s[sx][sy] == '#' || s[gx][gy] == '#') continue;
                    max_d = max(max_d, dist(sx,sy,gx,gy));
                }
            }
        }
    }
    cout << max_d << endl;
    return 0;
}

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

using namespace std;

int64_t gcd(int64_t x, int64_t y) {
    return y ? gcd(y, x % y) : x;
}

int64_t lcm(int64_t x, int64_t y) {
  return x/gcd(x, y)*y;
}

int main(void){
    int64_t a, b;
    cin >> a >> b;
    int64_t res = lcm(a, b);
    cout << res << endl;
}

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

using namespace std;

typedef long long int ll;

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

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int a,b,c,d;
	cin >> a >>b>>c>>d;
	cout << min(a,b) + min(c,d) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>

#include <algorithm>

using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
const ll INF = 1ll << 60;

const int max_n = 1e5 + 10;
vector<int> a[max_n];
int d[max_n];
int n, m;

int dfs(int x)
{
    if (d[x] > 0)
        return d[x];
    int mx = 0;

    for (int i = 0; i < a[x].size(); ++i)
    {
        mx = max(mx, dfs(a[x][i]) + 1);
    }
    d[x] = mx;
    return mx;
}

int main()
{

    cin >> n;
    cin >> m;

    REP(i, m)
    {
        int x, y;
        cin >> x;
        cin >> y;
        x--;
        y--;
        a[x].push_back(y);
    }

    for (int i = 0; i < n; ++i)
    {
        d[i] = 0;
    }

    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        if (d[i] == 0)
            ans = max(ans, dfs(i));
    }

    cout << ans << endl;
}

Measured memory_bytes: 8192