akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 60) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n;
set<int> si;

int main() {
	cin >> n;
	rep(i, n) {
		int num;
		cin >> num;
		if (si.find(num) != si.end()) {
			si.erase(num);
		}
		else si.insert(num);
	}
	cout << si.size() << endl;
}

Measured memory_bytes: 4864
#!/usr/bin/env python

from collections import deque, defaultdict
import itertools as ite
import sys
import math
from decimal import *

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N = input()
A = map(int, raw_input().split())
for num in A:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            print "DENIED"
            exit()
print "APPROVED"

Measured memory_bytes: 4268
//#pragma GCC optimize("trapv")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
#include <x86intrin.h>
#define pb push_back
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;
const int maxn = 5005, mod = 998244353;
ll dp[104][4][2];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	int k;
	cin >> s >> k;
	reverse(all(s));
	dp[0][0][0] = 1;
	for(int i = 0; i < s.size(); i++) {
		for(int cnt = 0; cnt <= 3; cnt++) {
			for(int k = 0; k < 2; k++) {
			for(int d = 0; d < 10; d++) {
				if(d>0&&cnt==3) break;
				dp[i+1][cnt+(d>0)][d==(s[i]-'0')?k:d>(s[i]-'0')]+=dp[i][cnt][k];
			}
			}
		}
	}
	cout << dp[s.size()][k][0];
}


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

int n;
int a[100001];

int main() {
	cin>>n>>a[0];
	for(int i=1;i<=n;i++) cin>>a[i];
	int ans=abs(a[1]-a[0]);
	for(int i=1;i<n;i++)
		ans=__gcd(ans,abs(a[i+1]-a[i]));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        n: usize,
        av: [Usize1; n],
        bv: [usize; n],
        cv: [usize; n - 1],
    };

    let mut res = 0;
    let mut prev = n;
    for i in 0..n {
        let a = av[i];
        res += bv[a];
        if prev + 1 == a {
            res += cv[prev];
        }
        prev = a;
    }
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2228
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repr(i,a,b) for(int i=a,i > b;--i)
#define mm(lamb, tttt) memset(lamb, tttt, sizeof lamb)

#define null NULL
#define eps 0.000000001
#define mod 1000000007

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define sz(V) (ll)V.size()
#define _ <<" "<<

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <iterator>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <limits.h>
#include <iomanip>
#include <cctype>
#include <numeric>
#include <complex>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair <double, double> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<int> vii;

using cd = complex<double> ;
const double PI = acos(-1);

ll h,w,a,b;
// you need to evaluate (m+n)Cm quickly for m ,n in the range upto 1e5 !! what a mess! since you cant store all this its best to clacualet the factorials moduleo mod and then use them.
// do we need the inverses ?? modulo m but that neewd not even exist is but 1e9+7 is indeed prime! so i have to calculate all the primes ! using that O(logm) extended eucilds algo and then 
// calculate the inverses of factorilas recursilvely oh great and thats not it then the modulo of the .
// can i do better mayve using the fermats theorem i just need to binary exponentiate yesh thast it.

ll bin(ll a,ll p){
	if( p == 1) return a%mod;
	ll mid = bin(a,p/2);
	if(p%2 == 0) return (mid*mid)%mod;
	else return (((mid*mid)%mod)*a)%mod;
}

vector<ll> inv(1e5+5,1);
vector<ll> facinv(1e5+5,1);
vector<ll> fac(2e5+5,1);

void calc(){
	for(int i=1;i<(int) 2e5+1;i++){
		fac[i] = (i*fac[i-1])%mod;
	}
	for(int i=1;i<(int)1e5+1 ;i++){
		inv[i] = bin(i,mod-2);
	}
	for(int i=1;i<(int)1e5+1 ;i++){
		facinv[i] = (inv[i]*facinv[i-1])%mod;
	}
}

ll C(ll m,ll n){
	return (((fac[m+n]*facinv[m])%mod)*facinv[n])%mod;
}

int main(){
	cin>>h>>w>>a>>b;
	calc();
	ll deduct=0;
	for(int i=0;i<b;i++){
		deduct+=(C(h-a-1,i))*(C(a-1,w-i-1));
		deduct%=mod;
	}
	//cout<<deduct<<endl;
	ll ans=C(w-1,h-1)-deduct;
	if(ans < 0) ans+=mod;
	cout<<ans<<endl; 

}




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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;
const int Nmax=114514;
vi g[Nmax];
void FirstWin(){
	printf("First\n");
	exit(0);
}
void SecondWin(){
	printf("Second\n");
	exit(0);
}
int dfs(int v,int p){
	if(g[v].size()==1&&p!=-1)return 1;
	int cnt=0;
	for(auto ch:g[v])if(ch!=p)
		cnt+=dfs(ch,v);
	if(cnt>=2)FirstWin();
	return cnt^1;
}
signed main(){
	int n=read();
	REP(i,n-1){
		int a=read()-1,b=read()-1;
		g[a].PB(b);
		g[b].PB(a);
	}
	if(dfs(0,-1))FirstWin();
	else SecondWin();
}


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

int main() {
    string s;
    cin >> s;
    int n = (int)s.size();
    int result = 0, cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'S')
            ++cnt;
        else {
            if (cnt > 0) {
                result += 2;
                --cnt;
            }
        }
    }
    cout << n - result << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
    int n,l,i,j;
    char a[105][105];
    scanf("%d %d",&n,&l);
    for(i = 0; i<n; i++)
        scanf("%s",&a[i]);
    for(i =0; i<n-1; i++)
    {
        for(j = i+1;j<n;j++)
        {
            if(strcmp(a[i],a[j])>0)
            {
                char t[105];
                strcpy(t,a[i]);
                strcpy(a[i],a[j]);
                strcpy(a[j],t);
            }
        }
    }
    for(i = 0;i<n;i++)
    {
        printf("%s",a[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 256
/*
* @author:  codancer
* @createTime:  2020-08-22, 20:05:44
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9+7;
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define fep(i,a,b) for(int i=(a);i>=(b);i--)
#define deb(x) cerr<<#x<<" = "<<(x)<<"\n"
typedef vector<int> VI;
typedef vector<ll> VII;
typedef pair<int,int> pii;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll Rand(ll B) {
	return (ull)rng() % B;
}
int main(){
	int n;
	cin>>n;
	vector<ll> a(n);
	ll ans=0;
	rep(i,0,n-1) cin>>a[i];
	rep(i,1,n-1){
		if(a[i]<a[i-1]){
			ans+=a[i-1]-a[i];
			a[i]=a[i-1];
		}
	}
	cout<<ans<<'\n';
	return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M, long long O, std::vector<long long> A)
{
    int tot = 0;
    rep(i, N)
    {
        double temp = (double)A[i] / O;
        if (temp < 1.0 / 4.0 / M)
        {
            continue;
        }
        tot++;
    }
    if (tot >= M)
    {
        cout << YES << endl;
    }
    else
    {
        cout << NO << endl;
    }
}

int main()
{
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    std::vector<long long> A(N);
    long long O = 0;
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &A[i]);
        O += A[i];
    }
    solve(N, M, O, std::move(A));
    return 0;
}


Measured memory_bytes: 256
x = list(map(int, input().split()))
y = list(map(int, input().split()))
z = [list(map(int, input().split())) for i in range(x[0])]
count = 0
for i in z:
  tmp = x[2]
  for j in range(0, x[1]):
    tmp += i[j]*y[j]
  if tmp > 0:
    count += 1
print(count)

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

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

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

    bool jdg=true;

    rep(i,0,s.size()-1){
        if(s[i]==s[i+1]){
            cout<<"no"<<endl;
            jdg=false;
            break;
        }
    }
    if(jdg){
        cout<<"yes"<<endl;
    }
}


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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] as = br.readLine().split(" ");
		int n = Integer.parseInt(as[0]);
		int k = Integer.parseInt(as[1]);
		int res = 0;
		while(true) {
			res++;
			if(Math.pow(k, res) > n) {
				break;
			}
		}
		System.out.println(res);
	
	}

}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
const int maxn=100005;
int n;
vector<int> G[maxn];
int dfs(int u,int fa) {
    int ret=0,empty=0;
    for (int i=0;i<(int)G[u].size();++i) {
        int v=G[u][i];
        if (v==fa) continue;
        int x=dfs(v,u);
        if (x)
            ret+=x;
        else
            ++empty;
    }
    return ret+max(0,empty-1);
}
int main()
{
    scanf("%d",&n);
    for (int i=0;i<n-1;++i) {
        int u,v;
        scanf("%d%d",&u,&v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    int res=1;
    for (int i=0;i<n;++i)
        if ((int)G[i].size()>2) {
            res=max(res,dfs(i,-1));
            break;
        }
    printf("%d\n",res);
    return 0;
}
/*
10
2 8
6 0
4 1
7 6
2 3
8 6
6 9
2 4
5 8
*/


Measured memory_bytes: 9088
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  int n;
  cin>>n;
  int a, b[100010];
  REP(i, 100010) b[i] = 0;
  REP(i, n) {
    cin>>a;
    ++b[a];
    ++b[a+1];
    ++b[a+2];
  }
  if(n==1){
    cout<<1<<endl;
    return 0;
  }
  int ans=0;
  REP(i, 100010) ans=max(ans, b[i]);
  cout<<ans<<endl;

  return 0;
}


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

int main(){
  int N;        //青いカードの枚数
  int M;        //赤いカードの枚数
  string Word;  //文字列

  cin >> N;  //青いカード枚数を読む
  vector <string> BlueWord(N,"");  //青いカードの文字セット
  vector <int>    BlueCtr (N, 0);  //青i番目の文字セットの枚数
  int Bctr = 0;                    //文字列のセット数
  bool NewWord;                    //読み込んだカードが新規ならtrue
  int MaxNo = 0;                   //文字列の最大個数

  for(int i=0; i<N; i++){
    NewWord = true;
    cin >> Word;                   //青いカードの読み込み

    for (int j=0; j<Bctr; j++){
      if (BlueWord.at(j) == Word){  //既にある
        BlueCtr.at(j) += 1;
        NewWord = false;
        break;
      }
    } 
    if (NewWord == true){
      BlueWord.at(Bctr) = Word;
      BlueCtr.at(Bctr) = 1;
      Bctr += 1;
    }
  }

//  for (int i=0; i<Bctr; i++){
//    cout << BlueWord.at(i) << "  " <<BlueCtr.at(i) << endl;
//  }

  cin >> M;  //赤いカードを読む
  vector <string> RedWord(M,"");  //赤いカードの文字セット
  vector <int>    RedCtr (M, 0);  //赤i番目の文字セットの枚数
  int Rctr = 0;                   //文字列のセット数
  for (int i=0; i<M; i++){
    NewWord = true;
    cin>> Word;                   //赤いカードの読み込み
    
    for(int j=0; j<Rctr; j++){
      if (RedWord.at(j) == Word){  //既にある
        RedCtr.at(j) += 1;  
        NewWord = false;
        break;
      }
    }
    if (NewWord == true){
      RedWord.at(Rctr) = Word;
      RedCtr.at(Rctr) = 1;
      Rctr += 1;
    }
  }

//  for (int i=0; i<Rctr; i++){
//    cout << RedWord.at(i) << "  " <<RedCtr.at(i) << endl;
//  }

  for (int i=0; i<Bctr; i++){
    for (int j=0; j<Rctr; j++){
      if (BlueWord.at(i) == RedWord.at(j)){
         BlueCtr.at(i) -= RedCtr.at(j);
         break;
      }
    }
    if (BlueCtr.at(i) > MaxNo){
      MaxNo = BlueCtr.at(i);
    }
  }

  cout << MaxNo ;

}

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

int main(void){
    // Your code here!
    int a, b;
    
    cin >> a >> b;
    
    cout << (a + b) % 24 << endl;
    
    return 0;
    
}

Measured memory_bytes: 256
l = [int(input()) for _ in range(5)]

ans = 0
min_div = 10
for i in l:
  ans += 10 * ((i + 10 - 1) //10)
  if i % 10 != 0:
  	min_div = min(min_div, i % 10)
print(ans - (10 - min_div))


Measured memory_bytes: 9088
def main():
    S = input()
    N = len(S)
    # S[0] == S[-1] -> 最終的に「ababa」形式（長さ奇数） -> 元の長さが偶数ならFirstの勝ち
    # S[0] != S[-1] -> 最終的に「ababab」形式（長さ偶数） -> 元の長さが奇数ならFirstの勝ち
    if (S[0] == S[-1]) ^ (N % 2 == 1):
        print('First')
    else:
        print('Second')


if __name__ == '__main__':
    main()

Measured memory_bytes: 9036
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define EPS 1e-10
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

/**
 * Usage:
 * 
 * chmin(old, new);
 * chmax(old, new);
 * 
 */ 
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}




int N;
ll a[110000];
ll b[110000];

int main () {
  cin >> N;

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

  ll ans = 0;
  
  for (int i=N;i>=1;--i) {
    ll tmp = a[i] + ans;

    ll d = tmp % b[i];
    if (d != 0LL) ans += (b[i] - d);
  }

  cout << ans << "\n";
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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

	ll n;
	cin >> n;
	if(n % 2 == 1){
		cout << 0 << endl;
		return 0;
	}

	ll d = 5;
	ll ans = 0;

	while(d <= 1e18){
		ans += n / (d*2);		
		d *= 5;
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
#define INF LLONG_MAX
#define mod 1000000007
typedef long long ll;
int main(void)
{
	ll H, count=1;
	cin >> H;
	while(H-pow(2, count)>=0) count++;
	ll ans = pow(2, count)-1;
	cout << ans << endl;
	return 0;
}


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

namespace B
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int[] items = RIntAr();

            int n = items[0];
            int h = items[1];
            int w = items[2];

            int res = 0;
            for (int i = 0 ; i < n ; i++)
            {
                int[] line = RIntAr();
                if (line[0] >= h && line[1] >= w) res++;
            }
            Console.WriteLine(res);
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define endl "\n"
 
int32_t main()
{
	fast;
	int n;
	cin>>n;
	vector<int> b(n-1);
	for(int i=0;i<n-1;i++)
		cin>>b[i];
	vector<int> v(n);
	v[0]=b[0];
	for(int i=1;i<n;i++)
	{
		if(b[i-1]<v[i-1])
		{
			v[i-1]=b[i-1];
			v[i]=b[i-1];
		}
		else
		{
			v[i]=b[i-1];
		}
	}
	int s=0;
	for(int i=0;i<n;i++)
		s+=v[i];
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include<iomanip>
#include<iterator>
#include<vector>
#include<map>
#include<utility>
#include<set>
#include<stack>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);


    int k,x;
    cin>>k>>x;
    for(int i=1;i<2*k;i++)cout<<x-k+i<<" ";
    return 0;
}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll C[3][3];
ll A[3], B[3];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    REP(i, 3) {
        REP(j, 3) {
            cin >> C[i][j];
        }
    }

    A[0] = 0;
    B[0] = C[0][0];
    A[1] = C[1][0] - B[0];
    A[2] = C[2][0] - B[0];
    B[1] = C[0][1];
    B[2] = C[0][2];

    bool e = true;
    REP(i, 3) {
        REP(j, 3) {
            if (A[i] + B[j] != C[i][j])
                e = false;
        }
    }

    if (e)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

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

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

bool check(const Graph &G) {
    int n = (int)G.size();
    vector<bool> visit(n, false);
    visit.at(0) = true;
    queue<int> que;
    que.push(0);
    while (!que.empty()) {
        int cur = que.front(); que.pop();
        for (int nx : G.at(cur)) {
            if (!visit.at(nx)) {
                visit.at(nx) = true;
                que.push(nx);
            }
        }
    }
    return count(visit.begin(), visit.end(), false) == 0;
}

void solve() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> e(m);
    for (int i=0; i<m; ++i) {
        cin >> e.at(i).first >> e.at(i).second;
        --e.at(i).first;
        --e.at(i).second;
    }

    int res = 0;
    for (int i=0; i<m; ++i) {
        Graph G(n);
        for (int j=0; j<m; ++j) {
            if (i == j) continue;
            G.at(e.at(j).first).push_back(e.at(j).second);
            G.at(e.at(j).second).push_back(e.at(j).first);
        }
        if (!check(G)) ++res;
    }
    cout << res << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [0]*N
relation = []
for i in range(N):
    tmp = []
    A[i] = int(input())
    for j in range(A[i]):
        tmp.append(list(map(int, input().split())))
    relation.append(tmp)

ans = 0
for i in range(1<<N):
    cond = [0]*N
    for j in range(N):
        if 1&(i>>j):  # 右シフトして論理積（bit全探索）
            cond[j] = 1

    mujun = False
    stop_flag = False
    for j in range(N):  # 一人一人判定

        # 正直者の時だけ判定
        # 不親切の場合、特に判定はしない（嘘でも本当でも良いので）
        if cond[j] == 1:
            for k in range(A[j]):  # jの証言を一つずつチェック
                #print(cond[rel[j][k][0]-1])
                #print(rel[j][k][1])
                if cond[relation[j][k][0]-1] != relation[j][k][1]:  # jのk番目の証言をチェック
                    mujun = True
                    stop_flag = True
                    break

        if stop_flag:
            break
    
    if not mujun:
        ans = max(ans, sum(cond))

print(ans)

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

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<vector<int>> F(N, vector<int>(10));
	for (auto &vec : F) {
		for (auto &x : vec) {
			cin >> x;
		}
	}
	vector<vector<int>> P(N, vector<int>(11));
	for (auto &vec : P) {
		for (auto &x : vec) {
			cin >> x;
		}
	}

	long long ans = numeric_limits<long long>::min();

	for (int mask = 1; mask < (1 << 10); ++mask) {
		long long temp = 0;
		for (int i = 0; i < N; ++i) {
			int c = 0;
			for (int k = 0; k < 10; ++k) {
				if (F[i][k] == 1 && (mask & (1 << k))) {
					++c;
				}
			}
			temp += P[i][c];
		}
		ans = max(ans, temp);
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define int long long
#define st first
#define nd second
#define rd third
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define RE(i, n) FOR(i, 1, n)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(i, n) for(int i = 0;i <(n); ++i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
template<typename TH> void _dbg(const char* sdbg, TH h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename TH, typename... TA> void _dbg(const char* sdbg, TH h, TA... t) {
  while(*sdbg != ',')cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
#define next ____next
#define prev ____prev
#define left ____left
#define hash ____hash
typedef long long ll;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<pair<int, int> > VPII;
typedef vector<pair<ll, ll> > VPLL;

template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
template<class T1, class T2>
ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class A, class B, class C> struct Triple { A first; B second; C third;
  bool operator<(const Triple& t) const { if (st != t.st) return st < t.st; if (nd != t.nd) return nd < t.nd; return rd < t.rd; } };
template<class T> void ResizeVec(T&, vector<int>) {}
template<class T> void ResizeVec(vector<T>& vec, vector<int> sz) {
  vec.resize(sz[0]); sz.erase(sz.begin()); if (sz.empty()) { return; }
  for (T& v : vec) { ResizeVec(v, sz); }
}
typedef Triple<int, int, int> TIII;
template<class A, class B, class C>
ostream& operator<< (ostream &out, Triple<A, B, C> t) { return out << "(" << t.st << ", " << t.nd << ", " << t.rd << ")"; }
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }

    
int32_t main() {

  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  cerr << fixed << setprecision(10);
  cin.tie(0);
  //double beg_clock = 1.0 * clock() / CLOCKS_PER_SEC;
  
  string s;
  cin>>s;
  int best = SZ(s);
  FOR (c, 'a', 'z') {
    int m = 0;
    string t = string(1, c) + s + string(1, c);
    int last = 0;
    REP (i, SZ(t)) {
      if (t[i] == c) {
        maxi(m, i - last - 1);
        last = i;
      }
    }
    mini(best, m);
  }
  cout<<best<<endl;
    

  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  return 0;
}


Measured memory_bytes: 256
S = input()[::-1]

kari = ['dream', 'dreamer', 'erase', 'eraser']

words = [i[::-1] for i in kari]

l = len(S)
i = 0

while True:
    if S[i:i+5]==words[0] or S[i:i+5]==words[2]:
        i += 5
    elif S[i:i+6]==words[3]:
        i += 6
    elif S[i:i+7]==words[1]:
        i += 7
    else:
        print('NO')
        exit()
    if i == l:
        print('YES')
        exit()

Measured memory_bytes: 3188
input_str = input()

n, k = map(int, input_str.split())

result = k * n - k * (k+1) + 2 * k + 1

sum = 0
for i in range(k, n+2):
    sum += i*n - (i * (i+1)) + 2 * i + 1

print(sum % (10**9 + 7))


Measured memory_bytes: 9128
main :: IO()
main = do
  l1 <- getLine
  str <- getLine
  putStrLn $ solve l1 str

solve :: String -> String -> String
solve l1 str = show.snd $ foldl tr (x,0) xs
  where
    _:a:b:_ = map read $ words l1
    x:xs = map read $ words str
    tr :: (Int, Int) -> Int -> (Int, Int)
    tr (x, c) dest = (dest, c + min b ((dest - x) * a))


Measured memory_bytes: 69116
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = LONG_LONG_MAX / 2;
const ll mod = 1000000000 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main() {
  int N;
  cin >> N;
  vector<ll> v1, v2;
  for (int i = 0; i < N; i++) {
    ll x, y;
    cin >> x >> y;
    v1.push_back(x + y);
    v2.push_back(-x + y);
  }
  ll ans =
      *max_element(v1.begin(), v1.end()) - *min_element(v1.begin(), v1.end());
  ans = max(ans, *max_element(v2.begin(), v2.end()) -
                     *min_element(v2.begin(), v2.end()));
  cout << ans << endl;
}


Measured memory_bytes: 6644
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;
map<int,int> m;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
	ll N,W;
	cin >> N >> W;
	ll w1,v1;
	cin >> w1 >> v1;
	vector<vector<ll>> v(4);
	v[0].push_back(v1);
	for(int i=1;i<N;i++){
		int a,b;
		cin >> a >> b;
		a -= w1;
		v[a].push_back(b);
	}
	for(int i=0;i<4;i++){
		sort(ALL(v[i]),greater<>());
	}
	ll ans = 0;
	for(int a=0;a<=N;a++)for(int b=0;b<=N;b++)for(int c=0;c<=N;c++)for(int d=0;d<=N;d++){
		if(a+b+c+d>N)continue;
		if(a>v[0].size())continue;
		if(b>v[1].size())continue;
		if(c>v[2].size())continue;
		if(d>v[3].size())continue;
		ll Wsum = 0,Vsum = 0;
		Wsum = a*w1 + b*(w1+1) + c*(w1+2) + d*(w1+3);
		if(Wsum > W)continue;
		for(int i=0;i<a;i++)Vsum += v[0][i];
		for(int i=0;i<b;i++)Vsum += v[1][i];
		for(int i=0;i<c;i++)Vsum += v[2][i];
		for(int i=0;i<d;i++)Vsum += v[3][i];
		ans = max(ans,Vsum);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
const int INF = 1 << 29;
const ll LINF = 1l << 61;
const ld PI = abs(acos(-1));
#define pq priotity_queue
#define pb push_back
#define mp make_pair
#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 cbuf(buf, init) memset(buf, init, sizeof(buf))

template <class T>
constexpr T modp(T x, T y)
{
    return (y + x % y) % y;
}
template <class T>
constexpr T sq(T x)
{
    return x * x;
}
template <class T>
constexpr double divd(T x, T y)
{
    static_cast<double>(x) / static_cast<double>(y);
}

template <class T>
T nextInput()
{
    T t;
    cin >> t;
    return t;
}

#define netint nextInput<ll>()
#define netstr nextInput<string>()

template <class T>
void print(T&& t)
{
    cout << forward<T&&>(t) << endl;
}

void print(double t) { cout << fixed << setprecision(14) << t << endl; }

//

int main()
{
    //
    rep(i, 0, 3)
    {
        string inp;
        cin >> inp;
        cout << inp[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
N =int(input())

list = [[3,5,7]]

for i in range(9):
    new =[]
    for j in list[-1]:
        new.append(10*j+3)
        new.append(10*j+5)
        new.append(10*j+7)
    list.append(new)

a_list=[]
ans =0
for i in list:
    for j in i:
        if N <j:
            print(ans)
            exit()
        if '3' in str(j) and '5' in str(j) and '7' in str(j):
            ans += 1

Measured memory_bytes: 76396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())


int main(){	
	long long N;
	long long M;
	scanf("%lld",&N);
	scanf("%lld",&M);
	vector<vector<long long>> A(N-1+1,vector<long long>(M-1+1));
	vector<ll> piv(N);
	for(int i = 0 ; i <= N-1 ; i++){
		for(int j = 0 ; j <= M-1 ; j++){
			scanf("%lld",&A[i][j]);
			A[i][j]--;
		}
	}
	ll res = 1000;
	set<ll> s;
	rep(i, M) {
		map<ll, ll> m;
		rep(j, N) {
			m[A[j][piv[j]]]++;
		}
		ll maxp = -1, maxs = -1;
		rep(j, M) {
			if (maxs < m[j]) {
				maxs = m[j];
				maxp = j;
			}
		}
		s.insert(maxp);
		rep(j, N) {
			while (s.find(A[j][piv[j]]) != s.end()) {
				piv[j]++;
			}
		}
		res = min(res, maxs);
	}
	cout << res << endl;
	return 0;
}



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

using namespace std;

int main() {
    int n;
    double x, res = 0.0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x;
        res += 1.0 / x;

    }
    res = 1.0 / res;
    cout << fixed << setprecision(9) << res;
    return 0;
}


Measured memory_bytes: 256
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
l=[]
a,b=map(int,input().split())
import fractions
g=fractions.gcd(a,b)
for i in range(len(prime_decomposition(g))):
  if prime_decomposition(g)[i] not in l:
    l.append(prime_decomposition(g)[i])
print(len(l)+1)

Measured memory_bytes: 5048
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
#define inf 100000000/*10^8*/



////////////////////////////////////////



int main(){
    int n;cin>>n;
    set<int>a;
    for(int i=0;i<=n-1;i++){
        int c;cin>>c;a.insert(c);
    }
    int ans=a.size();
    if(ans%2==0)ans--;
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 4992
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
using namespace std;

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

}

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

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#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 _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n,k;cin>>n>>k;
  if (k==1) {
    cout << 0 << endl;
  }
  else{
    cout << (n-k)+1 - 1 << endl;
  }
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
#include<stdio.h>

void sort(int *number,int total){
	int tmp=0;
	int i=0;
	int j=0;
	for (i=0; i<total; ++i) {
		for (j=i+1; j<total; ++j) {
			if (number[i] > number[j]) {
				tmp =  number[i];
				number[i] = number[j];
				number[j] = tmp;
			}
		}
	}
	return;
}

int main(){
	int N=0;
	int X=0;
	int M[100];
	int n=0;
	scanf("%d %d",&N,&X);
	for(int i=0;i<N;i++){
		scanf("%d",&M[i]);
		if(X>=M[i]){
			X-=M[i];
			n++;
		}
	}
	sort(M,N);
	while(X>=M[0]){
		X-=M[0];
		n++;
	}

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

Measured memory_bytes: 128
h,w,m = map(int, input().split())
row = [0]*(h+1)
rn = [[] for _ in range(h+1)]
col = [0]*(w+1)
cn = [[] for _ in range(w+1)]
data = []
for _ in range(m):
  hd,wd = map(int, input().split())
  row[hd] += 1
  rn[hd].append(wd)
  col[wd] += 1
  cn[wd].append(hd)

cm = max(col)
rm = max(row)
ri = [x for x,y in enumerate(row) if y == rm]
ci = [x for x,y in enumerate(col) if y == cm]
for r in ri:
  rs = set(rn[r])
  for c in ci:
    if c not in rs:
      ans = cm+rm
      print(ans)
      exit()
ans = cm+rm-1
print(ans)

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

using namespace std;

int main()
{
	int t;
	long long int a,b,c,d;
	cin>>a>>b>>c>>d;
	long long int mul1 = a*c;
	long long int mul2 = max(mul1, a*d);
	long long int mul3 = max(mul2, b*c);
	long long int mul4 = max(mul3, b*d);
	cout<<mul4;
	
}

Measured memory_bytes: 3632
import java.util.*;

class Main
{
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        double d = sc.nextDouble();
        
        double[][] array = new double[n][2];
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            array[i][0] = sc.nextDouble();
            array[i][1] = sc.nextDouble();
            double distance = Math.sqrt( Math.pow(array[i][0], 2) + Math.pow(array[i][1], 2) );
            
            if (distance <= d) {
                count++;
            }
        }
        
        System.out.println(count);
        
        
    }
}
        
        
        


Measured memory_bytes: 70592
#include <stdio.h>

int main(){

  int S,h,m,s;
  scanf("%d",&S);
  h=S/3600;
  S%=3600;
  m=S/60;
  S%=60;
  s=S;
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}
  

Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
vl a;

void f(ll x,int I){
	a.push_back(x);
	if(I==10) return;
	if(x%10>0) f(x*10+x%10-1,I+1);
	if(x%10<9) f(x*10+x%10+1,I+1);
	f(x*10+x%10,I+1);
}

int main(){
	for(int i=1;i<=9;i++) f(i,0);
	sort(a.begin(),a.end());
	cin>>n;
	cout<<a[n-1]<<endl;
}

Measured memory_bytes: 10476
import math

a_b = list(map(int, input().split()))

a = a_b[0]
b = a_b[1]

#aを満たす範囲
a_min = math.ceil(a / 0.08)
a_max = math.ceil((a+1) / 0.08)

#bを満たす範囲
b_min = math.ceil(b / 0.10)
b_max = math.ceil((b+1) / 0.10)

for i in range(a_min, a_max):
  if i >= b_min and i < b_max:
    print(i)
    break
  else:
    pass
  if i == a_max - 1:
    print(-1)


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

using namespace std;

#define ll long long
#define MAX 100100

int n, x[MAX], m, d[MAX], ans[MAX], tmp[MAX];
ll K;
double a[MAX];

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &x[i]);
  scanf("%d%lld", &m, &K);
  for (int i = 1; i <= n; ++i) d[i] = i, ans[i] = i;
  for (int i = 1, x; i <= m; ++i) scanf("%d", &x), swap(d[x], d[x + 1]);
  while (K) {
    if (K & 1) {
      for (int i = 1; i <= n; ++i) tmp[i] = ans[d[i]];
      for (int i = 1; i <= n; ++i) ans[i] = tmp[i];
    }
    for (int i = 1; i <= n; ++i) tmp[i] = d[d[i]];
    for (int i = 1; i <= n; ++i) d[i] = tmp[i];
    K >>= 1;
  }
  for (int i = 1; i <= n; ++i) a[i] = x[ans[i]] - x[ans[i] - 1];
  for (int i = 1; i <= n; ++i) printf("%.1lf\n", a[i] += a[i - 1]);
  return 0;
}


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

using namespace std;

#define INF 0x7FFFFFFF

int main() {
  vector<int> a;
  vector<int> b;
  
  int A, B, M, a_min = INF, b_min = INF, ans = INF;
  
  cin >> A >> B >> M;
  
  for (int i = 0; i < A; i++) {
    int in;
    
    cin >> in;
    
    a.push_back(in);
    
    a_min = min(a_min, in);
  }
  
  for (int i = 0; i < B; i++) {
    int in;
    
    cin >> in;
    
    b.push_back(in);
    
    b_min = min(b_min, in);
  }
  
  ans = min(ans, a_min + b_min);
  
  for (int i = 0; i < M; i++) {
    int x, y, c;
    
    cin >> x >> y >> c;
    
    ans = min(ans, a[x - 1] + b[y - 1] - c);
  }
  
  cout << ans << endl;
  
  return 0;
}

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

#define INF 1001001001
#define MAX (1e9+5)

int main() {
  int n;
  cin >> n;
  cout << !n << endl;
  
  return 0;
}


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

const ll INF = 1LL << 60;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;
 
	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}
 
	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}
 
	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい]
	}
 
	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}
 
		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);
 
		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;
 
		return true;
	}
};

ll N, K, L;
int main() {
    cin >> N >> K >> L;

    UnionFind uf1 = UnionFind(N);
    UnionFind uf2 = UnionFind(N);

    rep(i, K) {
        ll p, q; cin >> p >> q;
        p--;
        q--;
        uf1.connect(p, q);
    }

    rep(i, L) {
        ll r, s; cin >> r >> s;
        r--;
        s--;
        uf2.connect(r, s);
    }

    map<P, ll> mp;
    rep(i, N) {
        mp[P(uf1.root(i), uf2.root(i))]++;
    }

    rep(i, N) {
        cout << mp[P(uf1.root(i), uf2.root(i))] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 13568
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int con=0;
		int max = 0;
		int[] arr = new int[N];

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

		for (int i = 1; i < N; i++) {
			if (arr[i-1] - arr[i] >= 0) {
				con++;
			}else {
				max = Math.max(max, con);
				con = 0;
			}
		}

		max = Math.max(max, con);

		System.out.println(max);
	}

}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int cur_x = 0, cur_y = 0;
  bool ok = true;
  int curr_time = 0;
  for (int i = 0; i < n; i++) {
    int t, x, y;
    cin >> t >> x >> y;
    int dis = abs(x - cur_x) + abs(y - cur_y);
    if (dis > t || (dis < t && (t - curr_time - dis) % 2 != 0)) ok = false;
    cur_x = x;
    cur_y = y;
    curr_time = t;
  }
  puts(ok ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
const int Maxn=5000;
typedef long long ll;
int d[Maxn+5];
int main(){
	int k,q;
	int n,m,x;
	scanf("%d%d",&k,&q);
	for(int i=1;i<=k;i++){
		scanf("%d",&d[i]);
	}
	ll a;
	int ans;
	for(int i=1;i<=q;i++){
		scanf("%d%d%d",&n,&x,&m);
		a=(x%m);
		for(int j=1;j<=k;j++){
			a+=1ll*((d[j]+m-1)%m+1)*((n-1+k-j)/k);
		}
		ans=n-1-a/m;
		printf("%d\n",ans);
	}
	return 0;
}


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

using namespace std;
#define int int64_t
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define gsort(x) sort((x).begin(), (x).end(), greater<int>())
#define rv(s) reverse((s).begin(), (s).end())
#define pii pair<int, int>
#define re(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
const long long mod = 1e9 + 7;

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

   int n, a, cnt = 0;
   cin >> n;
   vector<int> x;

   rep(i, 1000010)
   {
      x.push_back(n);
      cnt = n;
      if (n % 2 == 0)
         n /= 2;
      else
         n = (cnt * 3) + 1;
      rep(j, x.size())
      {
         if (x[j] == n)
         {
            cout << i + 2 << '\n';
            return 0;
         }
      }
   }
}

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

int main()
{
    string S;
    cin >> S;
    string ans = "";
    for (char c = 'a'; c <= 'z'; ++c)
    {
        bool found = false;
        for (int i = 0; i < S.size(); ++i)
        {
            if (S[i] == c)
            {
                found = true;
                break;
            }
        }
        if (found == false)
        {
            ans = c;
            break;
        }
    }
    if (ans == "")
    {
        cout << "None" << endl;
    }
    else
    {
        cout << ans << endl;
    }
}

Measured memory_bytes: 3732
#include <stdio.h>
#include <stdlib.h>

typedef struct {
	int a;
	int b;
}pair;

int compair(const void *x, const void *y){
	int sub = ((pair *)x)->b - ((pair *)y)->b;
	if(sub == 0){
		return ((pair *)x)->a - ((pair *)y)->a;
	}
	else{
		return sub;
	}
}

int main(){
	int N, M, i;
	scanf("%d%d", &N, &M);
	pair *ps = (pair *)malloc(sizeof(pair) * M);
	for(i = 0; i < M; i++){
		scanf("%d%d", &ps[i].a, &ps[i].b);
	}
	qsort(ps, M, sizeof(pair), compair);
	int last = 0, ans = 0;
	for(i = 0; i < M; i++){
		if(last < ps[i].a){
			ans++;
			last = ps[i].b - 1;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1788