akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S,False(1,-1);
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

template<typename A,size_t N,typename T>
void Fill(A(&array)[N],const T &val){
    fill((T*)array,(T*)(array+N),val);
}

int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}

const int MOD = INF+7;

int main(){
    int n,m,q;cin >> n >> m >> q;
    Graph G(n);
    rep(i,m){
        int a,b;cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    rep(i,n){
        if(!G[i].empty())sort(ALL(G[i]));
    }

    int l,r;
    while(cin >> l >> r){
        ll res = 0;
        l--;r--;
        REP(i,l,r){
            if(G[i].empty())continue;

            if(r == *lower_bound( ALL(G[i]) , r ) ){
                res += (upper_bound( ALL(G[i]) , r) - G[i].begin());
            }
            else res += lower_bound( ALL(G[i]) , r) - G[i].begin();
        }
        cout<<res<<endl;
    }
}

Measured memory_bytes: 2176
import java.util.*;
import java.util.Map.Entry;
 
 
 class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
    public static void main(String[] args) {
    
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long K = sc.nextLong();
        String S = sc.next();
        S=S+"Z";
        char[] c = S.toCharArray();
        
        long cnt=0;
        for(int i=0;i<N;i++) {
        	if(c[i]!=c[i+1]) {
        		cnt++;
        	}
        }
        cnt=cnt-2*K;
        if(cnt<1) {
        	cnt=1;
        }
        
        long ans=N-cnt;
        System.out.println(ans);        	
                		
    }
    
    
}

Measured memory_bytes: 27808
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int  a[N],flag[N];
int main()
{
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
	double n,m;
	cin>>n>>m;
	double sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	int items=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]>=sum/(4.0*m))items++;
	}
	if(items>=m)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
		return 0;
}


Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define Phuong_ ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define mp make_pair

/// easy access -------------
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<int,int> pii;
///-------------------------

int main()
{
    Phuong_; /// <3
    int n;
    cin >> n;
    vector<int> dem(n,0);
    for(int i=1; i<n; ++i)
    {
        int u;
        cin >> u;
        u--;
        dem[u]++;
    }
    for(int x:dem) cout << x << '\n';
    return 0;
}



Measured memory_bytes: 3988
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind
#define rt (a); return (a); 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
int gcd(int a, int b) {
	if (b > a)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
int ans = 0;
int s[10][10];
int k[10];
int p[10];
void bit(int m, int n, int d) {
	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			bool w = true;
			rep(i, 0, d) {
				int x = 0;
				rep(j, 0, k[i])if (now[s[i][j] - 1] == '1')x++;
				if (x % 2 != p[i])w = false;
			}
			if (w)ans += 1;
		}
		else {
			for (int i = m - 1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
}
;
int main() {
	llint a, b;
	cin >> a >> b;
	if (abs(a - b) % 2 == 1)cout << "IMPOSSIBLE" << endl;
	else cout << (a + b) / 2 << endl;
	return 0;

}


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

int main()
{
  char c;
  cin >> c;
  bool ans = false;
  if(c == 'a') ans = true;
  if(c == 'i') ans = true;
  if(c == 'u') ans = true;
  if(c == 'e') ans = true;
  if(c == 'o') ans = true;
  
  if(ans) cout << "vowel" << endl;
  else cout << "consonant" << endl;
  return 0;
}


Measured memory_bytes: 256
function is_one(s) {
  return s == "1" ? 1 : 0;
}
function main(input){
  const str = ("" + input);
  console.log(is_one(str[0]) + is_one(str[1]) + is_one(str[2]));
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iomanip>
#include <iostream>
#include <cassert>
#include <vector>
#include <algorithm>
#include <climits>
#include <bitset>

#include <stack>
#include <queue>
// #include <deque>
#include <set>
#include <map>
#include <string>
// #include <unordered_set>
// #include <unordered_map>

#include <tuple>
// #include <cmath>
// #include <numeric>

using namespace std;


typedef long long ll;
typedef pair<long long,long long> pll;
typedef pair<int,int> pii;
typedef pair<int,long long> pil;
typedef pair<long long,int> pli;
typedef vector<vector<long long>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef priority_queue<int, vector<int>, greater<int> > minq;
typedef priority_queue<int> maxq;
// to initialize PQs with a vector, do 
// minq(v.begin(),v.end()) or maxq(v.begin(),v.end())
// or minq(a,a+10) for arrays

#define emplace_back pb
const char el = '\n';
const long double twopi = 6.28318530717958623200;

/*
Edge cases:


*/

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

    int n; cin>>n; cin.ignore();
    cout<<setprecision(10)<<(long double)(twopi*n)<<el;


}

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

using namespace std;

int main() {
  string A, B;
  cin >> A >> B;
  A += B;
  istringstream iss(A);
  int N;
  iss >> N;

  int n = sqrt(N);
  if (n * n == N) {
    cout << "Yes";
  } else {
    cout << "No";
  }

  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 FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int resC = 0, resP = 0;
    int n, m;
    cin >> n >> m;
    vector<bool> prob(n, false);
    vector<int> cnt(n, 0);
    rep (i, m) {
        int p;
        string s;
        cin >> p >> s;
        p--;
        if (prob[p]) continue;
        if (s == "AC") prob[p] = true;
        else cnt[p]++;
    }
    rep (i, n) {
        if (!prob[i]) continue;
        resC++;
        resP += cnt[i];
    }
    cout << resC << " " << resP << endl;
    
    return 0;
}



Measured memory_bytes: 640
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<map>
#include<queue>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1000000007;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

/*#define int ll*/
signed main(){
    string s;
    cin>>s;
    int n=s.size();
    string x="ABC";
    
    ll dp[100010][4]={};
    for(int i=n;i>=0;i--){
        for(int j=3;j>=0;j--){
            if(i==n){
                dp[i][j]=(j==3?1:0);
            }else{
                dp[i][j]=dp[i+1][j]*(s[i]=='?'?3:1);
                if(j<3&&(s[i]=='?'||s[i]==x[j])){
                    dp[i][j]+=dp[i+1][j+1];
                }
                dp[i][j]%=mod;
            }
        }
    }
    cout<<dp[0][0]<<endl;
    return 0;
}

Measured memory_bytes: 3584
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin
from math import sqrt
N = int(stdin.readline())
for i in xrange(N):
    x1, y1, x2, y2, x3, y3 = (float(n) for n in stdin.readline().split())
    det = x1*y2 + x2*y3 + x3*y1 - x1*y3 - x2*y1 - x3*y2
    a = x1**2 + y1**2
    b = x2**2 + y2**2
    c = x3**2 + y3**2
    L = (a*y2 + b*y3 + c*y1 - a*y3 - b*y1 - c*y2) / det
    M = (x1*b + x2*c + x3*a - x1*c - x2*a - x3*b) / det
    N = (x1*y2*c + x2*y3*a + x3*y1*b - x1*y3*b - x2*y1*c - x3*y2*a) / det
    xp = L / 2.0
    yp = M / 2.0
    r = sqrt(abs(N + xp**2.0 + yp**2.0))
    print('{:.3f} {:.3f} {:.3f}'.format(xp, yp, r))

Measured memory_bytes: 4472
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int AA[SIZE];
LL fac[SIZE],inv[SIZE];
LL mypow(LL x,LL y){
    LL res=1;
    while(y){
        if(y&1)res=res*x%MOD;
        y>>=1;
        x=x*x%MOD;
    }
    return res;
}
LL C(int x,int y){
    if(y<0||y>x)return 0;
    return fac[x]*inv[y]%MOD*inv[x-y]%MOD;
}
void build(){
    assert(MOD>=SIZE);
    fac[0]=1;
    REPP(i,1,SIZE)fac[i]=fac[i-1]*i%MOD;
    inv[SIZE-1]=mypow(fac[SIZE-1],MOD-2);
    for(int i=SIZE-2;i>=0;i--)inv[i]=inv[i+1]*(i+1)%MOD;
}
int main(){
    build();
    int N,K;
    R(N,K);
    FOR(i,1,N)R(AA[i]);
    sort(AA+1,AA+N+1);
    LL an=0;
    FOR(i,1,N){
        ADD(an,-AA[i]*C(N-i,K-1));
        ADD(an,AA[i]*C(i-1,K-1));
    }
    W(an);
    return 0;
}


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

#define rep(i, a, b) for(ll i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

ll mypow(ll a) {
  return a*a*a*a*a;
}

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  int x;
  cin >> x;

  rep(a,-1000,1000) rep(b,-1000,1000) {
    if (mypow(a) - mypow(b) == x) return cout << a << ' ' << b << '\n', 0;
  }

}

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

#define  __  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define  int  long long
#define  endl  '\n'
const double pi = acos(-1);
const int mod = 1e9 + 7;
//______________________



int32_t main()
{ 
  __
  
  
  
  int n,k;
  string s;

  cin>>n>>k>>s;
  k--;

  s[k] = (s[k]-'A') + 'a';

  cout<<s;

 return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lc (p<<1)
#define rc ((p<<1)|1)
typedef long long ll;
const int mod=998244353;
inline int add(int a,int b)
{
	if((a+=b)>=mod)a-=mod;
	return a;
}
inline int dec(int a,int b)
{
	if((a-=b)<0)a+=mod;
	return a;
}
inline int mult(int a,int b)
{
	long long t=1ll*a*b;
	if(t>=mod)t%=mod;
	return t;
}
inline int power(int a,int b)
{
	int out=1;
	while(b)
	{
		if(b&1)out=mult(out,a);
		a=mult(a,a);
		b>>=1;
	}
	return out;
}
const int dir[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
int n,p[510*510];
int d[510][510];
class queue
{
    public:
        pair<int,int> dat[510*510];
        pair<int,int> *s,*t;
        void init()
        {
            s=t=dat;
        }
        void push(pair<int,int> x)
        {
            *(t++)=x;
        }
        void pop()
        {
            s++;
        }
        pair<int,int> front()
        {
            return *s;
        }
        bool empty()
        {
            return s==t;
        }
}q;
bool flag[510][510];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n*n;i++)scanf("%d",&p[i]);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            d[i][j]=min(min(i-1,n-i),min(j-1,n-j));
            flag[i][j]=1;
        }
    }
    int ans=0;
    for(int i=1;i<=n*n;i++)
    {
        int cx=(p[i]-1)/n+1,cy=(p[i]-1)%n+1;
        flag[cx][cy]=0;
        ans+=d[cx][cy];
        q.init();
        q.push(make_pair(cx,cy));
        while(!q.empty())
        {
            pair<int,int> fr=q.front();q.pop();
            for(int t=0;t<4;t++)
            {
                pair<int,int> nxt=make_pair(fr.first+dir[t][0],fr.second+dir[t][1]);
                if(d[nxt.first][nxt.second]>d[fr.first][fr.second]+flag[fr.first][fr.second])
                {
                    d[nxt.first][nxt.second]=d[fr.first][fr.second]+flag[fr.first][fr.second];
                    q.push(nxt);
                }
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 8088
#include <iostream>
using namespace std;
int main(void){
    int m, d, ans = 0;
    cin >> m >> d;
    for(int i=1;i<=m;i++){
        for(int j=12;j<=d;j++){
            if((j%10) > 1 && (j/10) > 1 && (j%10) * (j/10) == i)ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/agc019/tasks/agc019_b
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    string A; cin>>A;
    unordered_map<char,ll> numtbl;
    for(const auto& c:A){
        ++numtbl[c];
    }
    ll ans=1; //いれかえないやつ
    ans += A.size() * (A.size()-1) / 2;
    for(const auto& p: numtbl){
        ans -= p.second * (p.second-1) / 2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
package main

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

func main() {
	sc := NewBufScanner(os.Stdin)
	n := sc.Int()

	dic := make(map[string]int, n)
	for i := 0; i < n; i++ {
		command, address := sc.String(), sc.String()
		if command == "insert" {
			dic[address] = 1
		}

		if command == "find" {
			if dic[address] == 1 {
				fmt.Println("yes")
			} else {
				fmt.Println("no")
			}
		}
	}
}

type BufScanner struct {
	*bufio.Scanner
}

func NewBufScanner(r io.Reader) *BufScanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	return &BufScanner{s}
}

func (s *BufScanner) String() string {
	s.Scan()
	return s.Text()
}

func (s *BufScanner) Int() int {
	return int(s.UInt())
}

func (s *BufScanner) UInt() uint64 {
	s.Scan()
	i, e := strconv.ParseUint(s.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}



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

int dfs(int, std::vector<bool>, int);
int n, m;
std::list<int> edges[8];

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < m; i++)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        a--; b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    std::vector<bool> visited(8);
    std::fill(visited.begin(), visited.end(), false);
    printf("%d\n", dfs(0, visited, 0));

    return 0;
}


int dfs(int pos, std::vector<bool> visited, int visited_num)
{
    if (visited[pos]) return 0;
    if (visited_num == n - 1) return 1;
    visited[pos] = true;
    int count{};
    for (auto &e : edges[pos])
    {
        count += dfs(e, visited, visited_num + 1);
    }
    return count;
}


Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())		# 5 7 2

dx = x2-x1
dy = y2-y1
#print('{} {}'.format(dx, dy))	# フォーマット付き

x3 = x2 - dy
y3 = y2 + dx

x4 = x3 - dx
y4 = y3 - dy

print('{} {} {} {}'.format(x3, y3, x4, y4))	# フォーマット付き


Measured memory_bytes: 2940
#include<bits/stdc++.h> 
using namespace std; 
  
// A utility function to add an edge in an 
// undirected graph. 
void addEdge(vector<int> adj[], int u, int v) 
{ 
    adj[u].push_back(v); 
    adj[v].push_back(u); 
} 
  
// A utility function to print the adjacency list 
// representation of graph 
void printGraph(vector<int> adj[], int v,int e) 
{ 
    int visited[v]={0};
    vector<int>v1;
    visited[1]=1;
    for(int i=0;i<adj[1].size();i++)
    {
        v1.push_back(adj[1][i]);
        visited[adj[1][i]]=1;
    }
    while(!v1.empty())
    {
        int x=v1[0];
        v1.erase(v1.begin());
        for(int i=0;i<adj[x].size();i++)
        {
            if(visited[adj[x][i]]==0)
            {
                visited[adj[x][i]]=x;
                v1.push_back(adj[x][i]);
            }
        }
    }
    int flag=0;
    for(int i=1;i<v;i++)
    {
        
        if(visited[i]==0)
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
    {
        cout<<"No";
    }
    else
    
    {
        cout<<"Yes"<<endl;;
        for(int i=2;i<v;i++)
        {
            cout<<visited[i]<<endl;
        }
    }
} 
 void printGrap1h(vector<int> adj[], int V) 
{ 
    for (int v = 0; v < V; ++v) 
    { 
        cout << "\n Adjacency list of vertex "
             << v << "\n head "; 
        for (auto x : adj[v]) 
           cout << "-> " << x; 
        printf("\n"); 
    } 
}  
// Driver code 
int main() 
{ 
    int v,e;
    cin>>v>>e;
    v=v+1;
    vector<int> adj[v];
    for(int i=0;i<e;i++){
        int x,y;
        cin>>x>>y;
    addEdge(adj, x, y);
    //addEdge(adj ,y,x);
    }
    printGraph(adj, v,e); 
    return 0; 
} 

Measured memory_bytes: 10504
#include<bits/stdc++.h>
using namespace std;
bool prime(int x)
{
	bool f=true;
	if(x==1)
		f=false;
	for(int i=2;i*i<=x;i++)
	{
		if(x%i==0)
		{
			f=false;
			break;
		}
	}
	return f;
}
int n;
int main()
{
	cin>>n;
	while(!prime(n))
		n++;
	cout<<n;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr ll mod998=998244353;

int N,K;
vector<ll>p,m;

int tourist(){
	if(p.empty()){	
		for(int i=0;i<m.size();i++){
			m[i]+=mod;
		}
		if(K&1){
			ll res=1;
			for(int i=0;i<K;i++){
				res*=m[i];
				res%=mod;
			}
			return res;
		}
		else{
			ll res=1;
			for(int i=0;i<K;i++){
				res*=m[N-i-1];
				res%=mod;
			}
			return res;
		}
	}
	if(K==N){
		for(int i=0;i<m.size();i++){
			m[i]+=mod;
		}
		ll res=1;
		for(int i=0;i<m.size();i++){
			res*=m[i];
			res%=mod;
		}
		for(int i=0;i<p.size();i++){
			res*=p[i];
			res%=mod;
		}
		return res;
	}
	
	int P=max(0,K-(int)p.size());
	if(P&1)P++;
	while(m.size()>=P+2&&K-P-2>=0&&m[m.size()-P-1]*m[m.size()-P-2]>=p[p.size()-(K-P)]*p[p.size()-(K-P)+1])P+=2;
	for(int i=0;i<m.size();i++){
		m[i]+=mod;
	}
	ll res=1;
	for(int i=0;i<P;i++){
		res*=m[m.size()-1-i];
		res%=mod;
	}
	for(int i=0;i<K-P;i++){
		res*=p[p.size()-1-i];
		res%=mod;
	}
	return res;
}

int main(){
	cin>>N>>K;
	for(int i=0;i<N;i++){
		int A;
		cin>>A;
		if(A>=0)p.push_back(A);
		else m.push_back(A);
	}
	sort(p.begin(),p.end());
	sort(m.begin(),m.end(),greater<>());

	cout<<tourist()<<endl;
}


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

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


Measured memory_bytes: 3092
import java.io.*;
import java.util.Arrays;
 
 
 
public class Main{
    public static void main(String[] a)  throws IOException
    {
        BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
        int[] num = new int[10];
        for(int i=0; i<10; i++){
            num[i] = Integer.parseInt(br.readLine());
        }
        Arrays.sort(num);
	System.out.println(num[9]);
        System.out.println(num[8]);
        System.out.println(num[7]);

        }
}

Measured memory_bytes: 24444
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
const int INF = 100000000;
const int MAX_N = 100;
typedef pair<int , int> P;
typedef long long ll;
 
int main () {
  string s;
  string t;
  cin >> s >> t;
  int sLen = s.length();
  int tLen = t.length();
  int ans = tLen;
  for (int i = 0; i < sLen - tLen + 1; ++i) {
    string tmp;
    tmp = s.substr(i, tLen);
    int count = 0;
    for (int j = 0; j < tLen; ++j) {
      if (tmp[j] != t[j]) {
        ++count;
      }
    }
    ans = min(ans, count);
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 3692
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		// 出力
		if(a == b && b == c){
			System.out.println("No");
		}else if(!(a == b) && !( b == c) && !(a == c)){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 22996
s=list(input())
K=int(input())

def calcCostToGetA(char):
  if char=='a':
    return 0
  return (ord("z")+1)-ord(char)

for i in range(len(s)):
  cost=calcCostToGetA(s[i])
  if cost<=K:
    s[i]='a'
    K-=cost
    if K==0:
      break

if K>0:
  s[-1]=chr(ord(s[-1])+K%26)
  
print("".join(s))

Measured memory_bytes: 4156
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<cstdio>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<iomanip>
#include<utility>
#include<functional>
using namespace std;
int n;
long long k;
long long l[55],m[55];
long long dfs(long long num,int d)
{
	long long ld=(l[d]+(long long)1)/(long long)2;
	if(d<0)
		return (long long)0;
	if(num==ld)
		return m[d-1]+(long long)1;
	if(num>ld)
		return m[d-1]+(long long)1+dfs(num-ld,d-1);
	if(num<ld)
		return dfs(num-1,d-1);
}
int main()
{	
	cin>>n>>k;
	l[0]=(long long)1;
	m[0]=(long long)1;
	for(int i=1;i<=n;i++)
	{
		l[i]=l[i-1]*(long long)2+(long long)3;
		m[i]=m[i-1]*(long long)2+(long long)1;
	}
	cout<<dfs(k,n);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctype.h>
#include <math.h>
using namespace std;

int main(){
    int n;
    cin>>n;
    int a=n/100;
    if(111*a>=n){
        cout <<111*a<< endl;
    }
    else{
        cout <<111*(a+1)<<endl;
    }
}

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

int i,j,n,m,k;

int main() {
    bool ans = true;
    string s,t;
    cin >> s >> t;
    for(i = 0; i < s.size(); i++){
        if(s[i] != t[i]) ans = false;
    }
    if(t.size() != s.size() + 1) ans = false;
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	string s, t;
	
	cin>>s>>t;
	
	int ans = 0;
	
	for(int i = 0; i < s.size(); i++){
		if(s[i] != t[i]) {
			ans++;
		}
	}
	
	cout<<ans<<endl;
	
	
	return 0;
}

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

using namespace std;

#define endl "\n"

const int MOD = 1e9 + 7;
char A[1005][1005];

vector<vector<long>> dp(1005, vector<long>(1005, 0));

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	int H, M;
	cin >> H >> M;

	for(int i = 0; i< H; i++) {
		for(int j = 0; j<M; j++) {
			cin >> A[i][j];
		}
	}

	for(int i = 0; i < M; i++) {
		if(A[0][i] != '#')
			dp[1][i+1] = 1;
		else break;
	}

	for(int i = 0; i < H; i++) {
		if(A[i][0] != '#')	
			dp[i+1][1] = 1;
		else break;
	}

	for(int i = 2; i <= H; i++) {
		for(int j = 2; j<=M; j++) {
			if(A[i-1][j-1] != '#') {
				dp[i][j] = dp[i-1][j]  + dp[i][j-1];
				dp[i][j] = dp[i][j] % MOD;
			}
		}
	}

	cout << dp[H][M] << endl;

    return 0;
}



Measured memory_bytes: 12488
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) throws Exception{
        int n;
        BigDecimal a,b;
        int c;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for(int i=0;i<n;i++){
            a = sc.nextBigDecimal();
            b = sc.nextBigDecimal();
            a = a.add(b);
            c = a.precision();
            if (c > 80){
                System.out.println("overflow");
            }else{
                System.out.println(a);
            }
        }
    }
}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,a[20],ans;

signed main() {
    cin >> n;
    rep(i,n) cin >> a[i];
    rep11(i,n-1) {
        if (max(a[i-1],a[i+1]) >= a[i] && a[i] >= min(a[i-1],a[i+1])) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
/**
 * @brief ユーザ定義リテラル
 * @author えびちゃん
 */

#ifndef H_int_literals
#define H_int_literals

#include <cstddef>
#include <cstdint>

constexpr intmax_t  operator ""_jd(unsigned long long n) { return n; }
constexpr uintmax_t operator ""_ju(unsigned long long n) { return n; }
constexpr size_t    operator ""_zu(unsigned long long n) { return n; }
constexpr ptrdiff_t operator ""_td(unsigned long long n) { return n; }

#endif  /* !defined(H_int_literals) */

#include <cstdio>
#include <cstdint>
#include <utility>
#include <vector>
#include <string>

int main() {
  size_t n;
  scanf("%zu", &n);

  std::vector<std::vector<std::pair<size_t, int>>> a(n);
  for (size_t i = 0; i < n; ++i) {
    size_t m;
    scanf("%zu", &m);
    for (size_t j = 0; j < m; ++j) {
      size_t x;
      int y;
      scanf("%zu %d", &x, &y);
      --x;
      a[i].emplace_back(x, y);
    }
  }

  int res = 0;
  for (size_t i = 0; i < (1_zu << n); ++i) {
    bool valid = true;
    for (size_t j = 0; j < n; ++j) {
      if (i >> j & 1) {
        // honest
        for (size_t k = 0; k < a[j].size(); ++k) {
          size_t x = a[j][k].first;
          int y = a[j][k].second;
          valid &= ((i >> x & 1) == (y == 1));
        }
      } else {
        // unkind
        
      }
    }
    if (valid) res = std::max(res, __builtin_popcount(i));
  }
  printf("%d\n", res);
}


Measured memory_bytes: 256
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
typedef long long ll;
const int MYINF = 1e9+7;

#define MAX_N 110
#define MAX_M 110
static int a[MAX_N][MAX_M];
static int b[MAX_M];
static int c[MAX_N];

int main(int argc, char **argv)
{
	int i, j, n, m;
	scanf("%d %d", &n, &m);
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			scanf("%d", &a[i][j]);
		}
	}
	for (i = 0; i < m; i++) {
		scanf("%d", &b[i]);
	}
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			c[i] += a[i][j] * b[j];
		}
	}
	for (i = 0; i < n; i++) {
		printf("%d\n", c[i]);
	}
	return 0;
}

Measured memory_bytes: 648
def solve(string):
    a, b, c, x, y = map(int, string.split())
    if a + b <= 2 * c:
        return str(a * x + b * y)
    if 2 * c <= a and 2 * c <= b:
        return str(2 * c * max(x, y))
    base = 2 * c * min(x, y)
    diff = abs(x - y)
    cost = min(a, 2 * c) if x >= y else min(b, 2 * c)
    return str(base + cost * diff)


if __name__ == '__main__':
    print(solve(input()))


Measured memory_bytes: 38384
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iostream>
#include <float.h>

using namespace std;

int main(void){
	int ans[1000],q,x0,y0,x1,x2,x3,y1,y2,y3,x01,y01,x23,y23;
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%d%d%d%d%d%d%d%d",&x0,&y0,&x1,&y1,&x2,&y2,&x3,&y3);
		x01 = x1 - x0;
		y01 = y1 - y0;
		x23 = x3 - x2;
		y23 = y3 - y2;
		if(fabs(abs(x01*x23 + y01*y23) - sqrt(x01*x01 + y01*y01)*sqrt(x23*x23 + y23*y23)) <= DBL_EPSILON * fmax(1, fmax(fabs(x01*x23 + y01*y23), fabs(sqrt(x01*x01 + y01*y01)*sqrt(x23*x23 + y23*y23)))))ans[i] = 2;
		else if(abs(x01*x23 + y01*y23) == 0) ans[i] = 1;
		else ans[i] = 0;	
	}
	for(int i=0;i<q;i++){
		printf("%d\n",ans[i]);
		fflush(stdout);
	}
	return 0;
}


Measured memory_bytes: 3248
#include<bits/stdc++.h>
#include<string>
#include<cstring>
#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>
#define IOS ios::sync_with_stdio(false);cin.tie(0)
//#define ll long long
#define ll unsigned long long
#define inf 0x3f3f3f3f
#define mod 1000000007
#define eps 1e-6
#define PI acos(-1)
#define mysetit multiset<ll>::iterator
#define mymsetit multiset<ll>::iterator
#define mymapit map<ll,ll>::iterator
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define lowbit(x) (x&(-x))
#define mp make_pair
#define pb push_back
#define si size()
#define E exp(1.0)
#define fixed cout.setf(ios::fixed)
#define fixeds(x) setprecision(x)
using namespace std;
inline ll read(){ll s=0,w=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
return s*w;}
void put1(){ puts("YES") ;}
void put2(){ puts("NO") ;}
void put3(){ puts("-1"); }
ll qpf(ll a, ll b, ll p)
{ll ret = 0;while(b){if(b & 1) ret = (ret + a) % p;
a = (a + a) % p;b >>= 1;}return ret % p ;}
ll qp(ll a, ll n, ll p)
{ll ret = 1;while(n){if(n & 1) ret = qpf(ret, a, p);a = qpf(a, a, p);
n >>= 1;}return ret % p ;}
//θ=acos(L/2R);

const int manx=2e5+5;

ll a[manx],s[manx],b[manx];
int main(){
    ll n=read();
    if(n&1) cout<<n/2+1<<endl;
    else cout<<n/2<<endl;
    return 0;
}

Measured memory_bytes: 256
d,n = map(int, input().split())
if d == 0:
    if n != 100:
        print(n)
    else:
        print(101)
    
elif d == 1:
    if n != 100:
        print(n*100)
    else:
        print(10100)
elif d == 2:
    if n != 100:
        print(n*10000)
    else:
        print(1010000)

Measured memory_bytes: 9128
#!/usr/bin/env python3
n, m = map(int, input().split())
(*a, ) = map(int, input().split())
a.sort()
q = [[*map(int, input().split())] for _ in range(m)]
q.sort(key=lambda x: -x[1])
idx = 0
for b, c in q:
    for _ in range(b):
        if idx >= n or a[idx] >= c:
            print(sum(a))
            exit()
        a[idx] = c
        idx += 1
print(sum(a))


Measured memory_bytes: 36224
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
B = [0] * 40
for a in A:
  _a = a
  for i in range(40):
    B[i] += _a % 2
    _a >>= 1
KB = [0] * 40
_K = K
P = [[0, 0] for _ in range(40)]
for i in range(40):
  KB[i] = _K % 2
  _K >>= 1
  P[i] = [B[i] * 2 ** i, (N - B[i]) * 2 ** i]
cnt = 0
free = 0
for i in range(39, -1, -1):
  if free == 1:
    cnt += max(P[i])
  elif KB[i] == 0:
    cnt += P[i][0]
  elif P[i][0] >= P[i][1]:
    cnt += P[i][0]
    free = 1
  else:
    cnt += P[i][1]
print(cnt)

Measured memory_bytes: 14840
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main() {
    int n;
    cin >> n;
    map<string, int> m;
    rep(i, n) {
        string s;
        cin >> s;
        m[s]++;
    }
    cout << m.size() << endl;
}


Measured memory_bytes: 19092
//C - 4-adjacent: 
//Assunto: ;
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define loop(i, a, b) for(int i = a; i < b; i++)
#define loopBack(i, a, b) for(int i = a; i >= b; i--)
#define INF INT_MAX
#define LINF LLONG_MAX
#define DINF DBL_MAX
#define MAX 100050
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int n, d8 = 0, n2 = 0;
    bool ans = false;
    cin >> n;
    vector<int> seq(n);
    loop(i, 0, n) {
        cin >> seq[i];
        if(seq[i] % 4 == 0) d8++;
        else if(seq[i] == 2 or seq[i] % 4 == 2) n2++;
    }
    if(n2 % 2 == 0) n -= n2;
    else n -= (n2 - 1);
    if(d8 >= n / 2) ans = true;
    else ans = false;
    if(ans) cout << "Yes\n";
    else cout << "No\n";
    //cout << seq[0]+2 % 4 << " " << seq[1]+2 % 4 << "\n";
}

Measured memory_bytes: 640
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val s = sc.next()
  val t = sc.next()

  println(abc167a(s, t))
}

private fun abc167a(s: String, t: String): String {
  val sub = t.substring(0, s.length)

  if (sub.equals(s)) return "Yes"
  return "No"
}


Measured memory_bytes: 36320
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
    int R[MAX], n;
    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> R[i];
    }

    int maxv = -2000000000; //???????°??????????????????????????¨????
    int minv = R[0];

    for(int i = 1; i < n; ++i) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;

    return 0;
}

Measured memory_bytes: 3884
#include <bits/stdc++.h>
const int N = 1e5 + 54;
int n, a[N], dp[N], k;
int main() {
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	memset(dp, 0x3f, sizeof dp);
	dp[1] = 0;
	for (int i = 2; i <= n; ++i) 
		for (int j = std::max(1, i - k); j < i; ++j) 
			dp[i] = std::min(dp[i], dp[j] + abs(a[i] - a[j]));
	printf("%d\n", dp[n]); 
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main() {
    int A, B;
    cin >> A >> B;
    if(A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){

int x,y;
scanf("%d %d", &x, &y);
while (x>0||y>0){
if (x == 0 && y == 0){ break; }
else{
if (y<x){ printf("%d %d\n", y, x); }
else { printf("%d %d\n", x, y); }
}
scanf("%d %d", &x, &y);
}
return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    unsigned x;
    cin >> x;
    cout << bitset<32>(x) << "\n";
    cout << bitset<32>(~x) << "\n";
    cout << bitset<32>(x << 1) << "\n";
    cout << bitset<32>(x >> 1) << "\n";
}


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

int main(){
  int n,r;
  cin>>n>>r;
  if(n>=10) cout<<r<<endl;
  else cout<<r+100*(10-n)<<endl;
}

Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n, a[1001], ans=1000000;

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

  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      if(ans>abs(a[i]-a[j]) && i!=j){
        ans = abs(a[i]-a[j]);
      }
    }
  }
  cout << ans << endl;
  ans = 1000000;
  }
  return 0;
}

Measured memory_bytes: 3068
#include <stdio.h>

int main(void) {
  int N, K;
  int ans;
  int i;
  
  scanf("%d %d", &N, &K);
  ans = K;
  K--;
  
  for(i = 0; i < N - 1; i++)
    ans *= K;
  
  printf("%d\n", ans);
  
  return 0;
}

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

using namespace std;
typedef long long int ll;

ll gcd(ll a,ll b){
  if(a < b)swap(a,b);
  while(1){
    ll t = a%b;
    a = b;
    b = t;
    if(b == 0)return a;
  }
}

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

int main(){
  ll n;
  while(cin >> n , n){

    ll d[10],v[10];
    for(ll i = 0 ; i < n ; i++ ){
      cin >> d[i] >> v[i];
      ll cd = gcd(d[i],v[i]);
      d[i]/=cd;
      v[i]/=cd;
    }

    ll dlc = d[0];
    for(int i = 1 ; i < n ; i++ ){
      dlc = lcm(dlc,d[i]);
      }

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

    ll vlc = v[0];
    for(int i = 1 ; i < n ; i++ ){
      vlc = gcd(vlc,v[i]);
    }
    for(int i = 0 ; i < n ; i++ )cout << v[i]/vlc << endl;

  }
  return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define boost ios_base::sync_with_stdio(false), cin.tie(NULL);
 
using namespace std;
int main(){
  int v, e;
  cin>>v>>e;
  vector<vector<int>> out(v);
  vector<vector<int>> in(v);
  for(int i =0; i<e; i++){
    int a, b;
    cin>>a>>b;
    out[a-1].push_back(b-1);
    in[b-1].push_back(a-1);
    
  }
  vector<int> dp(v,0);
  vector<int> deg(v); //number of edges from vertex i to other
  queue<int> s;
  for(int i =0; i<v; i++){
    deg[i]=out[i].size();
    if(!deg[i]){
      s.push(i);
    }
  }
  int mx = 0;
  while(s.size()){
    int j = s.front();
    s.pop();
    for(int i : in[j]){
      if(deg[i]>0){
        dp[i] = max(1+dp[j], dp[i]);
        deg[i]--;
        if(deg[i]==0) s.push(i);
        mx = max(mx, dp[i]);
      }
    }
  }
    cout<<mx<<endl;
    
}

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

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> c(N), t(N);
  for (int i = 0; i < N; i++) 
    cin >> c.at(i) >> t.at(i);
  int ans = 0;
  bool TLE = true;
  for (int i = 0; i < N; i++) {
    if (t.at(i) <= T) { // i番目の経路で帰宅可能ならば
      if (c.at(i) <= c.at(ans)) { // i番目の経路のコストが小さければ
        ans = i;
        TLE = false;
      }
    }
  }
  if (TLE) // 帰宅可能な経路が無ければ
    cout << "TLE" << endl;
  else
    cout << c.at(ans) << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
  
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
 
const int MAX=510000;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  
  int n, k;
  cin >> n >> k;
  vector<int>vec(n);
  rep(i,n) cin >> vec[i];
  
  int ans = 0;
  for(int tot=1;tot<=min(n,k);tot++){
    for(int left=0;left<=tot;left++){//決めた
      int right = tot-left;
      priority_queue<int,vector<int>,greater<int>>que;
      int sum = 0;
      rep(i,left){
        que.push(vec[i]);
        sum += vec[i];
      }
      rep(i,right){
        que.push(vec[n-1-i]);
        sum += vec[n-1-i];
      }
      int res = k-tot;
      while(res && !que.empty()){
        int t = que.top();
        if(t>=0)break;
        res--;
        que.pop();
        sum -= t;
      }
      chmax(ans,sum);
    }
  }
  cout << ans << endl;
          
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
using namespace std;
#define i64  long long
 #define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define MOD 1000000007



void solve()
{
  int N,K;
  cin>>N>>K;
  vector<int> vec(N+1,0);
  for (int i = 0; i < N; i++)
  {
    int A;
    cin>>A;
    A--;
    vec[i] = (vec[max((int)0,i-1)] + A + K)%K;
      // cout<<vec[i]<<endl;
  }

  map<int,int> mp;
  mp[0] = 1;
  int ANS = 0;
  for (int i = 0; i < N ; i++)
  {
    if(i - K == -1 ) mp[0]--;
    if(K <= i)//i = 4 K = 4になって初めて
    {
      --mp[vec[i-K]];
      // cout<<"call"<<endl;
    }
    ANS += mp[vec[i]];
    //  cout<<mp[vec[i]]<<endl;
    ++mp[vec[i]];
  }

  cout<<ANS<<endl;
  
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  solve();
 
  return 0;
}

Measured memory_bytes: 14336
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

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

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    lint n, l;
    cin >> n >> l;
    lint ans = -LINF;
    lint diff = LINF;
    lint all = 0;
    lint sum = 0;
    vector<lint> a(n);
    REP(i, n){
        a[i] = l + (i + 1) - 1;
        //cout << a[i] << endl;
        all += a[i];
    }
    for (int i=0; i<n; ++i){
        sum = 0;
        for (int j=0; j<n; ++j){
            if(i == j){continue;}
            else {
                sum += a[j];
            }
        }
        if(diff > abs(all - sum)){
            diff = abs(all - sum);
            ans = sum;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int n, A[100001], L[100001];

int lis(){
    L[0]=A[0];
    int length=1;

    for(int i=1; i<n; i++){
        if(L[length-1]<A[i]){
            L[length++]=A[i];
        }else{
            *lower_bound(L,L+length, A[i])=A[i];
        }
    }

    return length;
}

int main(){
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> A[i];
    }

    cout << lis() << endl;

    return 0;
}


Measured memory_bytes: 3816