akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main()
{
  int N;
  cin >> N;
  
  map<string, int> S;
  rep(i, N) 
  {  
    string tmp_s;
    cin >> tmp_s;
    
    if (S.count(tmp_s)) 
    {
      S.at(tmp_s)++;
    } 
    else 
    {
      S[tmp_s] = 1;
    }
  }
  
  cout << S.size() << endl;

  return 0;
}

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

int main()
{
    char st[3];
    cin >> st;
    int sum=700;
    int flag=0;
    for(int i=0;i<3;i++){
        if(st[i]=='o')
            flag++;
    }
    cout << sum+flag*100;
    return 0;
}


Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>
#include <cassert>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>
#include <functional>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

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

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    string str;
    cin >> str;
    for (int i = 0; i < str.size(); i++) {
        if (str[i] == '?') str[i] = 'D';
    }
    cout << str << endl;

    return 0;
}

Measured memory_bytes: 3740
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;

int N;
double t[102],T[102] = {0};
//double dT[101] = {0};
double V[102];

double velocity(double l,double r,double x,double v){
	if(0<=x && x <= l) return v+l-x;
	else if(l<=x && x<=r) return v;
	else return v+x-r;
}

int main(){
	cin >> N;
	for(int i=1;i<=N;i++){
		cin >> t[i];
		T[i+1] = T[i] + t[i];
	}	
	for(int i=1;i<=N;i++){
		cin >> V[i];
	}
	V[0] = 0;
	V[N+1] = 0;
	double time = 0;
	vector<double> F;
	while(time<=T[N+1]){
		double nowv = 1e9;
		for(int i=0;i<=N+1;i++){
			if(i==0){
				nowv = min(nowv,velocity(0,0,time,0));
			}else if(i==N+1){
				nowv = min(nowv,velocity(T[N+1],T[N+1],time,0));
			}else{
				nowv = min(nowv,velocity(T[i],T[i+1],time,V[i]));
			}
		}
		F.push_back(nowv);
		time += 0.5;
	}
	double ans = 0;
	for(int i=0;i<F.size();i++){
		ans += 0.25*(F[i]+F[i+1]);
	}
	printf("%.6f\n",ans);
}

Measured memory_bytes: 892
#include<iostream>
#include<cmath>
#include<cstdio>
 
using namespace std;
 
long double denominator,ans;
int n,m,k;
 
void solve(int rev,int sum){
  if(rev){
    for(int i = 1; i <= m; i++)
      solve(rev-1,sum+i);
  }else{
    sum = max(1,sum-k);
    ans += (long double)sum/denominator;
  }
}
 
int main(){
 
  while(cin >> n >> m >> k && n+m+k){
    ans = 0;
    denominator = pow((double)m,(double)n);
    solve(n,0);
    printf("%.8Lf\n",ans);
  }
  return 0;
}

Measured memory_bytes: 1248
#include <stdio.h>
#include <algorithm>

using namespace std;

struct bomb{
  int h,w;
}b[300010];
struct xx{
  int num,ind;
}numh[300010], numw[300010];

bool cmpb(bomb a, bomb b){
  if (a.h == b.h)
    return a.w<b.w;
  return a.h<b.h;
}
bool cmp(xx a, xx b){
  return a.num > b.num;
}
int h,w,m;

bool find(int x, int y){
  bomb t;
  t.h=x;t.w=y;
  int pos = lower_bound(b, b+m, t, cmpb) - b;
  if (pos<m && b[pos].h == x && b[pos].w == y)
    return 1;
  return 0;
}

int main(){

  scanf("%d%d%d",&h,&w,&m);
  if (m<=2){
    printf("%d\n",m);
    return 0;
  }
  for (int i=0; i<m; ++i)
    scanf("%d%d",&b[i].h, &b[i].w);

  sort(b,b+m,cmpb);

  for (int i=0; i<m; ++i){
    numh[b[i].h-1].num++;
    numw[b[i].w-1].num++;
  }
  for (int i=0; i<h; ++i)
    numh[i].ind = i+1;
  for (int i=0; i<w; ++i)
    numw[i].ind = i+1;

  sort(numh, numh+h, cmp);
  sort(numw, numw+w, cmp);


  int ans = numh[0].num+numw[0].num;

  int ansh=1, answ=1;
  while(ansh<h && numh[ansh].num == numh[ansh-1].num) ++ansh;
  while(answ<w && numw[answ].num == numw[answ-1].num) ++answ;

  //printf("%d %d %d\n", ans, ansh, answ);

  if (1LL * ansh * answ > 1LL * m + 100){
    printf("%d\n", ans);
    return 0;
  }
  for (int i=0; i<ansh; ++i){
    for (int j=0; j<answ; ++j){
      int x = numh[i].ind, y = numw[j].ind;
      //printf("%d %d\n",x,y);
      if (!find(x,y)){
        printf("%d\n",ans);
        return 0;
      }
    }
  }

  printf("%d\n",ans-1);

}


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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define eps 1e-9
#define fast_cin ios_base::sync_with_stdio(false)

const int MOD = 1e9+7;

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

ll POWER[65];
ll power(ll a, ll b) {ll ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=MOD) ret%=MOD;if(a>=MOD) a%=MOD;b>>=1;}return ret;}
ll inv(ll x) {return power(x,MOD-2);}

void precompute() {
	POWER[0]=1;
	for(int i=1;i<63;i++) POWER[i]=POWER[i-1]<<1LL;
}

int main() {
//	freopen("TASK.in","r",stdin);freopen("TASK.out","w",stdout);
//	precompute();
	ll a,b,c;
	cin>>a>>b>>c;
	ll ans;
	if(a%2==0 or b%2==0 or c%2==0) {
		ans=0;
	}
	else {
		ans=abs(b*c*(a/2)-b*c*(a-a/2));
		ll temp=abs(a*c*(b/2)-a*c*(b-b/2));
		ans=min(ans,temp);
		temp=abs(b*a*(c/2)-b*a*(c-c/2));
		ans=min(ans,temp);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;



int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	
	ini(n);
	set<string> set1;
	FOR(i,0,n){
		ins(str);
		set1.insert(str);
	}
	out(set1.size());
















	return 0;
}


Measured memory_bytes: 19200
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>

//#include <bits/stdc++.h>
using namespace std;
using LL = int;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourd; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, q, last, cnt, sum, ans, dp[10000][4], a[2000000], b[2000000];
string str, ss;
bool f[1100][1100];
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
vector<Edge>vec[200000];
vector<LL>v;
map<Pll, LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> n >> m >> s;
	if(n+m>=s)
	cout<<max(s-n,(LL)0)<<endl;
	else cout << "NA" << endl;
	return 0;
}


Measured memory_bytes: 7848
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		sc.close();
		if(A > 9 || B > 9){
			System.out.println(-1);
		}else{
			System.out.println(A * B);
		}
	}
}

Measured memory_bytes: 22740
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define REV(v) reverse(v.begin(),v.end())
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
#define dout(n) cout<<# n<<" = "<<n<<endl;
#define v1out(v) FOR(j,0,v.size()){cout<<v[j]; if(j!=(ll)v.size()-1)cout<<" ";else cout<<endl; }
#define v2out(v) FOR(i,0,v.size())v1out(v[i]);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ld p = 3.141592653;
    ld n;cin>>n;
    cout(6)<<p*n*2<<endl;
}

Measured memory_bytes: 3804
#include <stdio.h>
int main(){
  int W,H,x,y,r;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if((x - r) < 0 || (x + r) > W)printf("No\n");
  else if((y - r) < 0 || (y + r) > H)printf("No\n");
  else if((x - r) >= 0 && (x + r) <= W && (y - r) >= 0 && (y + r) <= H)
    printf("Yes\n");
  return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ld long double
#define pii pair <int, int>
#define sz(a) (int)(a.size()) 
#define resize(v) v.resize(unique(all(v)) - v.begin()); 
#define all(a) a.begin(), a.end()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

using namespace std;
 
void Fast_Read_Out()
{
    ios_base::sync_with_stdio(0);
    cin.tie(), cout.tie();
}
 
void Random()
{
    unsigned int seed;                                                                        
    asm("rdtsc" : "=A" (seed));
    srand(seed);        
}
 
unsigned int Time()
{
     unsigned int time = clock() / 1000.00;                           
     return time;
}
 
const int mod = (int)1e9 + 7;
 
int main ()
{
	#ifdef JUDGE
		freopen("input.txt", "r", stdin);
	#endif		
	Fast_Read_Out();
	Random();
	string s;
	cin >> s;
	int pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
	for(char c : s)
	{
		if(c == 'N') pos1 = 1;
		if(c == 'S') pos2 = 1;
		if(c == 'W') pos3 = 1;
		if(c == 'E') pos4 = 1;
	}
	if(pos1 == pos2 && pos3 == pos4) cout << "Yes", exit(0);
	cout << "No";
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>

using namespace std;

int main()
{
    int A, B;
    if (scanf("%d%d", &A, &B) < 2) return 0;

    int cnt = 0;

    for (int i = A; i <= B; i++)
    {
        string s = to_string(i);
        if (s[0] == s[4] && s[1] == s[3])
        {
            cnt++;
        }
    }

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

    return 0;
}


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


int main() {
  int a, b;
  cin >> a >> b;
  ll ans = 0;
  if (b <= a) swap(a, b);
  for (int i = 0; i < b; i++) {
    ans *= 10;
    ans += a;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int n;
  cin >> n;
  VEC<int> t(n + 2, 0);
  VEC<int> v(n + 2, 0);
  int T = 0;
  REPC(i, 1, n) {
    cin >> t[i];
    T += t[i];
  }
  REPC(i, 1, n) cin >> v[i];
  // DUMP(t);
  // DUMP(v);
  auto velocity = [&](double time) -> double {
    double vel = 1e9;
    double tt = 0;
    REP(i, 0, n + 2) {
      double l = tt;
      double r = tt + t[i];
      if (0 <= time && time <= l) vel = min(vel, v[i] + l - time);
      if (l <= time && time < r) vel = min(vel, (double)v[i]);
      if (r <= time) vel = min(vel, v[i] + time - r);
      // DUMP("    ", time, l, r, v[i], vel);
      tt += t[i];
    }
    return vel;
  };
  double sum = 0;
  double pv = 0;
  for (double i = 0; i <= T; i += 0.5) {
    double cv = velocity(i);
    sum += 0.25 * (cv + pv);
    // DUMP(i, pv, cv, sum);
    pv=cv;
  }
  printf("%lf\n",  sum);

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>

//同じコードでそんなにばらつくんですか

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = ((tmp & ma0) ^ ma0) ? 68 - __builtin_ctzll((tmp & ma0) ^ ma0) : 0;
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (64 - dig >> 3);
	while ((ct = *ci++) >= '0') tmp = tmp * 10 + ct - '0';
	return tmp;
}

bool NG[100001];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint(), M = getint();
	int H[100001];
	rep1(i, N) H[i] = getint();
	rep(i, M) {
		int a = getint(), b = getint();
		if (H[a] >= H[b]) NG[b] = 1;
		if (H[a] <= H[b]) NG[a] = 1;
	}
	int kotae = N;
	rep1(i, N) kotae -= NG[i];

	printf("%d", kotae);

	Would you please return 0;
}

Measured memory_bytes: 2212
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << min(c, b / a) << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
import numpy as np
stdin = sys.stdin

ni = lambda: int(ns()) #int
na = lambda: list(map(int, stdin.readline().split())) #int,list
ns = lambda: stdin.readline().rstrip()  # str
n=ni()
a=[]
for i in range(n):
	s,p = list(map(str, stdin.readline().split()))
	a.append([s,p])

ans = sorted(a, key=lambda x: (x[0],-int(x[1])))
for i in range(n):
	print(a.index(ans[i])+1)



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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int Alice = 0;
  int Bob = 0;
  for(int i = 0; i < n; i++){
    if(i % 2 == 0){
      Alice += a[i];
    }
    else{
      Bob += a[i];
    }
  }
  cout << Alice - Bob << endl;
  return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

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

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

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

  ll a, v;
  ll b, w;
  ll t;
  cin >> a >> v >> b >> w >> t;

  ll dist = abs(a - b);
  ll spd = (v - w);

  if (t * spd >= dist) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define M_PI           3.14159265358979323846  /* pi */
using namespace std;
using  ll = long long;

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

	vector<ll>t(n + 1,0);
	vector<ll>x(n + 1,0);
	vector<ll>y(n + 1,0);

	for (ll i = 1; i <= n; i++) {
		cin >> t.at(i) >> x.at(i) >> y.at(i);
	}
	ll tnow;
	ll xynow;
	bool result = true;

	for (ll i = 1; i <= n; i++) {
		tnow = (t.at(i) - t.at(i - 1));
		xynow = fabs(x.at(i) - x.at(i - 1) + (y.at(i) - (y.at(i - 1))));

		if (tnow < xynow)result = false;
		if (xynow % 2 != tnow % 2)result = false;
	}
	if (result == true)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 5548
#include <bits/stdc++.h>
using namespace std;
long long int a[100001];
vector <long long int>dp(100001,-1);

long long int rec(long long int i,long long int n)
{
    if(i==n)return 0;
if(dp[i]!=-1)return dp[i];
else 
if(i==n-1) return dp[i]= rec(i+1,n) + abs(a[i+1]-a[i]) ;
 else return dp[i]= min( rec(i+1,n) + abs(a[i+1]-a[i]) , rec(i+2,n) + abs(a[i+2]-a[i]) );


}
int main(void){
long long int n;
cin>>n;
//int a[n+1];
for(long long int i=1;i<=n;i++)cin>>a[i];
cout<<rec(1,n);
   // for(int i=0;i<10000;i++)cout<<dp[i]<<" ";
}


Measured memory_bytes: 4096
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  map<char,string>in;
  in['A']="00000";
  in['B']="00001";
  in['C']="00010";
  in['D']="00011";
  in['E']="00100";
  in['F']="00101";
  in['G']="00110";
  in['H']="00111";
  in['I']="01000";
  in['J']="01001";
  in['K']="01010";
  in['L']="01011";
  in['M']="01100";
  in['N']="01101";
  in['O']="01110";
  in['P']="01111";
  in['Q']="10000";
  in['R']="10001";
  in['S']="10010";
  in['T']="10011";
  in['U']="10100";
  in['V']="10101";
  in['W']="10110";
  in['X']="10111";
  in['Y']="11000";
  in['Z']="11001";
  in[' ']="11010";
  in['.']="11011";
  in[',']="11100";
  in['-']="11101";
  in['\'']="11110";
  in['?']="11111";
  map<string,char>out;
  out["101"]=' ';
  out["000000"]='\'';
  out["000011"]=',';
  out["10010001"]='-';
  out["010001"]='.';
  out["000001"]='?';
  out["100101"]='A';
  out["10011010"]='B';
  out["0101"]='C';
  out["0001"]='D';
  out["110"]='E';
  out["01001"]='F';
  out["10011011"]='G';
  out["010000"]='H';
  out["0111"]='I';
  out["10011000"]='J';
  out["0110"]='K';
  out["00100"]='L';
  out["10011001"]='M';
  out["10011110"]='N';
  out["00101"]='O';
  out["111"]='P';
  out["10011111"]='Q';
  out["1000"]='R';
  out["00110"]='S';
  out["00111"]='T';
  out["10011100"]='U';
  out["10011101"]='V';
  out["000010"]='W';
  out["10010010"]='X';
  out["10010011"]='Y';
  out["10010000"]='Z';

  string s;
  while(getline(cin,s)){
    string a="";
    rep(i,s.size())a+=in[s[i]];
    int to=0;
    string tmp="";
    while(to<a.size()){
      tmp+=a[to];
      to++;
      if(out[tmp]){
	cout<<out[tmp];
	tmp="";
      }
    }
    cout<<endl;
  }
}

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

const ll INF = 1ll<<60;

typedef pair<ll,ll> P;

int main() {
    ll n, x, d;
    cin >> n >> x >> d;
    
    if (d == 0) {
        if (x == 0) {
            cout << 1 << endl;
        } else {
            cout << n+1 << endl;
        }
        return 0;
    }
    
    map<int,vector<P>> mp;
    rep(i,n+1) {
        ll s = x*i;//kx
        ll l = (ll)i*(i-1)/2;//min
        ll r =  (ll)i*(n-i);//max
        s += l*d;
        //r -= l;//r'
        //負のmod対策
        mp[(s+(d<<30))%d].emplace_back(s,r);
    }
    
    ll ans = 0;
    for (auto p : mp) {
        auto a = p.second;
        int m = a.size();
        rep(i,m) a[i].first = (a[i].first-p.first)/d;
        vector<P> ev;
        rep(i,m) {
            ev.emplace_back(a[i].first, 1);
            ev.emplace_back(a[i].first+a[i].second+1, -1);
        }
        sort(ev.begin(), ev.end());
        ll cnt = 0, pre = -INF;
        for (auto e : ev) {
            ll len = e.first-pre;
            if (cnt) ans += len;
            cnt += e.second;
            pre = e.first;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 22144
#include <stdio.h>

int main(void){
    
    int i,j,k=0,l=0;
    int floor=0;
    double y,v,t;
    
    while(1){
        scanf("%lf",&v);
        if(feof(stdin))break;
        
        t=v/9.8;
        y=4.9*t*t;
        
        floor=(y+5)/5+0.999999999999999999999999999999999999999;
        
        
        printf("%d\n",floor);
    }
    return(0);
}

Measured memory_bytes: 632
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
//vector<vector<ll>> piyo(tate,vector<ll> (yoko));

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1000000000
#define ll long long
#define ln cout<<endl;
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str1,str2;
    cin>>n;
    vector<ll> v(n);
    rep(i,n)   cin >> v[i];
    sort(v.begin(),v.end(),std::greater<ll>());
    rep(i,n){
        if(i%2==0) sum+=v[i];
        else maxi+=v[i];
    }
    cout<<sum-maxi<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1


def main():
    N = int(input())

    total = 0
    for n in range(1, N + 1):
        if n % 3 == 0 and n % 5 == 0:
            pass
        elif n % 3 == 0:
            pass
        elif n % 5 == 0:
            pass
        else:
            total += n
    print(total)


if __name__ == '__main__':
    main()


Measured memory_bytes: 67972
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>

std::vector<size_t> make_vector(size_t n, size_t x) {
  return std::vector<size_t>(n, x);
}

template <class Tp>
std::vector<Tp> make_vector(size_t n, const Tp& x) {
  return std::vector<Tp>(n, x);
}

template <class... Ts>
auto make_vector(size_t n, size_t m, const Ts&... x) {
  return std::vector<decltype(make_vector(m, x...))>(n, make_vector(m, x...));
}

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

  std::vector<size_t> S(N+1);
  for (size_t i = 0; i < K; ++i){
    size_t A, B;
    scanf("%zu %zu", &A, &B);
    S[A] = B;
  }

  constexpr intmax_t mod = 1e4;
  auto dp = make_vector(N+1, 3, 3, size_t(0));

  {
    size_t i = 1;
    for (size_t k = 0; k < 3; ++k)
      if (S[i] == 0 || S[i]-1 == k)
        dp[i][0][k] = 1;
  }

  {
    size_t i = 2;
    for (size_t j = 0; j < 3; ++j)
      for (size_t k = 0; k < 3; ++k)
        if (S[i] == 0 || S[i]-1 == k)
          dp[i][j][k] += dp[i-1][0][j];
  }

  {
    for (size_t i = 3; i <= N; ++i)
      for (size_t j0 = 0; j0 < 3; ++j0)
        for (size_t j = 0; j < 3; ++j)
          for (size_t k = 0; k < 3; ++k)
            if ((S[i] == 0 || S[i]-1 == k) && !(j0 == k && j == k))
              (dp[i][j][k] += dp[i-1][j0][j]) %= mod;
  }

  intmax_t res = 0;
  for (size_t j = 0; j < 3; ++j)
    for (size_t k = 0; k < 3; ++k)
      (res += dp[N][j][k]) %= mod;

  printf("%jd\n", res);
}



Measured memory_bytes: 2808
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>

using namespace  std;

int main(){
    long long int h,n,x=1,sum=0;
    cin >> h;
    for(int i=1;i<41;i++){
        x = x*2;
        if(h<x) {
            n=i;
            break;
        }
    }
    cout << x-1 << endl;
    return 0;
}

Measured memory_bytes: 888
#include <cstdio>
#include <algorithm>
#include <vector>

const int MN = 5005;
const int Inf = 0x3f3f3f3f;

int N, A[MN], Ans;
std::vector<int> G[MN];

int siz[MN], mxf[MN], mnf[MN], szg[MN], mxg[MN], mng[MN];
void DFS0(int u, int fz) {
	siz[u] = A[u];
	int mxid = 0;
	for (auto v : G[u]) if (v != fz) {
		DFS0(v, u);
		siz[u] += siz[v];
		mxf[u] += mxf[v] + siz[v];
		if (mxf[mxid] + siz[mxid] < mxf[v] + siz[v]) mxid = v;
	}
	mnf[u] = std::max(mnf[mxid] + siz[mxid] - (mxf[u] - mxf[mxid] - siz[mxid]), mxf[u] & 1);
}
void DFS1(int u, int fz) {
	int id1 = 0, mx1 = mxg[u] + szg[u], mn1 = mng[u] + szg[u];
	int id2 = -1, mx2 = -1, mn2 = 1;
	for (auto v : G[u]) if (v != fz) {
		if (mxf[v] + siz[v] > mx2)
			id2 = v,
			mx2 = mxf[v] + siz[v],
			mn2 = mnf[v] + siz[v];
		if (mx2 > mx1)
			std::swap(id1, id2),
			std::swap(mx1, mx2),
			std::swap(mn1, mn2);
	}
	int mx0 = mxf[u] + mxg[u] + szg[u];
	int now = std::max(mn1 - (mx0 - mx1), mx0 & 1);
	if (now == 0) Ans = std::min(Ans, mx0 / 2);
	for (auto v : G[u]) if (v != fz) {
		szg[v] = szg[u] + siz[u] - siz[v];
		mxg[v] = mx0 - mxf[v] - siz[v];
		int mx = mx1, mn = mn1;
		if (id1 == v) mx = mx2, mn = mn2;
		mng[v] = std::max(mn - (mxg[v] - mx), mxg[v] & 1);
		DFS1(v, u);
	}
}

int main() {
	scanf("%d", &N), Ans = Inf;
	for (int i = 1; i <= N; ++i) scanf("%1d", &A[i]);
	for (int i = 1, x, y; i < N; ++i)
		scanf("%d%d", &x, &y),
		G[x].push_back(y),
		G[y].push_back(x);
	DFS0(1, 0);
	DFS1(1, 0);
	printf("%d\n", Ans == Inf ? -1 : Ans);
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#define inf (int)(1e8)

int alf_to_num(char c){
	return (int)c - (int)'A';
}

int main(){
	int H, W, i, j, k, nowv;
	char s, t;
	scanf("%d %d %c %c", &H, &W, &s, &t);
	char **a = (char **)malloc(sizeof(char *) * (H + 2));
	for(i = 0; i <= H + 1; i++){
		a[i] = (char *)malloc(sizeof(char) * (W + 2));
		if(i == 0 || i == H + 1){
			for(j = 0; j <= W + 1; j++){
				a[i][j] = '.';
			}
		}
		else{
			a[i][0] = '.';
			scanf("%s", &a[i][1]);
			a[i][W + 1] = '.';
		}
	}
	int **dis = (int **)malloc(sizeof(int *) * 26);
	for(i = 0; i < 26; i++){
		dis[i] = (int *)malloc(sizeof(int) * 26);
		for(j = 0; j < 26; j++){
			dis[i][j] = inf;
		}
	}

//	int dx = {0, 1, 0, -1};
//	int dy = {1, 0, -1, 0};
	for(i = 0; i <= H + 1; i++){
		for(j = 0; j <= W + 1; j++){
			nowv = alf_to_num(a[i][j]);
			if(0 <= nowv && nowv < 26){
/*				for(b = 0; b < 4; b++){
					if(a[i + 2 * dx[b]][j + 2 * dy[b]])
				}
*/				if(a[i - 2][j] == '|'){
					for(k = 2; ; k++){
						if(a[i - k][j] == 'o'){
							dis[nowv][alf_to_num(a[i - k - 1][j])] = 1;
							dis[alf_to_num(a[i - k - 1][j])][nowv] = 1;
							break;
						}
						else{
							a[i - k][j] = '.';
						}
					}
				}
				if(a[i + 2][j] == '|'){
					for(k = 2; ; k++){
						if(a[i + k][j] == 'o'){
							dis[nowv][alf_to_num(a[i + k + 1][j])] = 1;
							dis[alf_to_num(a[i + k + 1][j])][nowv] = 1;
							break;
						}
						else{
							a[i + k][j] = '.';
						}
					}
				}
				if(a[i][j - 2] == '-'){
					for(k = 2; ; k++){
						if(a[i][j - k] == 'o'){
							dis[nowv][alf_to_num(a[i][j - k - 1])] = 1;
							dis[alf_to_num(a[i][j - k - 1])][nowv] = 1;
							break;
						}
						else{
							a[i][j - k] = '.';
						}
					}
				}
				if(a[i][j + 2] == '-'){
					for(k = 2; ; k++){
						if(a[i][j + k] == 'o'){
							dis[nowv][alf_to_num(a[i][j + k + 1])] = 1;
							dis[alf_to_num(a[i][j + k + 1])][nowv] = 1;
							break;
						}
						else{
							a[i][j + k] = '.';
						}
					}
				}
			}
		}
	}

	for(k = 0; k < 26; k++){
		for(i = 0; i < 26; i++){
			for(j = 0; j < 26; j++){
				if(dis[i][j] > dis[i][k] + dis[k][j]){
					dis[i][j] = dis[i][k] + dis[k][j];
				}
			}
		}
	}
	printf("%d\n", dis[alf_to_num(s)][alf_to_num(t)]);
/*	for(i = 0; i <= H + 1; i++){
		for(j = 0; j <= W + 1; j++){
			printf("%c", a[i][j]);
		}
		printf("\n");
	}
*/	return 0;
}


Measured memory_bytes: 2104
#include<stdio.h>
#define mod 998244353
long long a[300000]={0};
long long sum[300000]={0};
  int  main(){
	int left[20],right[20];
	int n,k,i,j,p;
	scanf("%d %d",&n,&k);
	for (i=1;i<=k;i++){
		scanf("%d %d",&left[i],&right[i]);
	}
	a[1]=1;
	sum[1]=1;
    for (i=2;i<=n;i++) {	
		for (j=1;j<=k;j++){
			if (i<left[j]) continue;
			if (i<=right[j]){
				a[i]=(a[i]+sum[i-left[j]])% mod;
				continue;
			}
            a[i]=(a[i]+sum[i-left[j]])% mod;
            a[i]=(a[i]-sum[i-right[j]-1])% mod;
           }
           sum[i]=(sum[i-1]+a[i])% mod;
       }
    if (a[n]<0) a[n]+=mod;
	printf("%lld",a[n]);
}

Measured memory_bytes: 4812
#include <bits/stdc++.h>
#include <stdlib.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

int main(){
    string s;
    bool flag=true;
    cin  >> s;
    int l=s.length();
    if(l%2==1) flag=false;
    for(int i=0;i<l;i++){
        if(i%2==0){
            if(s[i]!='h') flag=false;
        }
        else {
            if(s[i]!='i') flag=false;
        }
    }

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

Measured memory_bytes: 256
from collections import Counter
n, *v = map(int, open(0).read().split())
vo = Counter(v[::2])
ve = Counter(v[1::2])
vomc = vo.most_common() + [(0, 0)]
vemc = ve.most_common() + [(0, 0)]
if vomc[0][0] == vemc[0][0]:
    ans = min(n//2 - vomc[0][1] + n//2 - vemc[1][1], n//2 - vomc[1][1] + n//2 - vemc[0][1])
else:
    ans = n//2 - vomc[0][1] + n//2 - vemc[0][1]
print(ans)

Measured memory_bytes: 27544
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#define rep(i,n) for(int i = 0;i<(n);i++);
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
	if (a < b)swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}

int main(){
  ll A,B,C;
  cin >> A >> B >> C;
  if(A == B && B == C)cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		while(true) {
			int m=cin.nextInt(),f=cin.nextInt(),r=cin.nextInt();
			if(m+f+r==-3)break;
			int sum=m+f;
			if(m==-1 || f==-1)System.out.println("F");
			else if(sum>=80)System.out.println("A");
			else if(sum>=65)System.out.println("B");
			else if(sum>=50)System.out.println("C");
			else if(sum>=30) {
				if(r>=50)System.out.println("C");
				else System.out.println("D");
			}
			else System.out.println("F");
		}
	}
}


Measured memory_bytes: 26140
n=int(input())
t=n//4
if n%4==0 or n%7==0:
  print('Yes')
else:
  for i in range(1,t):
    for j in range(1,t):
      if (i*4+j*7)%n==0:
        print('Yes')
        exit()
  print('No')

Measured memory_bytes: 2940
import sys
# gcd
from fractions import gcd
# 切り上げ，切り捨て
# from math import ceil, floor
# リストの真のコピー（変更が伝播しない）
# from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l)  # カウンタークラスが作られる。S=Counter({'b': 5, 'c': 4, 'a': 3})
# print(S.most_common(2))  # [('b', 5), ('c', 4)]
# print(S.keys())  # dict_keys(['a', 'b', 'c'])
# print(S.values())  # dict_values([3, 5, 4])
# print(S.items())  # dict_items([('a', 3), ('b', 5), ('c', 4)])
from collections import deque
# import math
# from functools import reduce
#
# input関係の定義
# fin = open('in_3.txt', 'r')
# sys.stdin = fin
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template


def iterate_tokens():
    for line in sys.stdin:
        for word in line.split():
            yield word


if __name__ == '__main__':

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    V = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"

    # write code

    left = []
    right = []
    left.append(0)
    right.append(0)
    left.append(max(V[0], 0))
    right.append(max(V[-1], 0))
    for i in range(2, 2*N+1):
        tmp_max = 0
        for j in range(-(-i // 2), i+1):
            tmp_V = V[:j]
            tmp_V.sort()
            # print(i, j, tmp_V[i - 2 * j:])
            if tmp_max < sum(tmp_V[i - 2 * j:]):
                tmp_max = sum(tmp_V[i - 2 * j:])
        # print(tmp_max)
        left.append(tmp_max)

    for i in range(2, 2*N+1):
        tmp_max = 0
        for j in range(-(-i // 2), i+1):
            tmp_V = V[-j:]
            tmp_V.sort()
            if tmp_max < sum(tmp_V[i - 2 * j:]):
                tmp_max = sum(tmp_V[i - 2 * j:])
        # print(tmp_max)
        right.append(tmp_max)
    ans = []
    # print(left)
    # print(right)
    sV = sum([i for i in V if i >= 0])
    # print(sV)
    for j in range(0, min(2*N, K) + 1):
        tmp_ans = -10**9
        for i in range(j+1):
            if tmp_ans < left[i] + right[j - i]:
                tmp_ans = left[i] + right[j - i]
        ans.append(tmp_ans)
    print(min(max(ans), sV))


Measured memory_bytes: 5172
import re
n , m = map(int,input().split())
sc = [list(map(int,input().split())) for _ in range(m)]
#n,m = 3,1
#sc = [[3,1]]

ck = True
a = ['a'] * (n+1)
for s,c in sc :

  if a[s] == 'a' :
    a[s] = str(c)
  else :
    if a[s] != str(c) :
      ck = False
      break

  if n >= 2 and s == 1 and c == 0 :
    ck = False
    break

if n >= 2 and a[1] == 'a':
  a[1] = '1'
elif n == 1 and a[1] == 'a':
  a[1] = '0'

b = ''.join(a[1:])
b = re.sub('a','0',b)

if ck :
  print(int(b))
else :
  print('-1')

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int N;
    int max_value = 0, sum_value = 0;
    
    cin >> N;
    for(int i = 0; i < N; i++){
        int temp = 0;
        cin >> temp;
        max_value = max(max_value, temp);
        sum_value += temp;
    }
        
    cout << sum_value - max_value / 2 << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int R,G,B,N;
cin>>R>>G>>B>>N;
int ans = 0;
for(int r=0;r<N/R+2;r++){
  for(int g=0;g<N/G+2;g++){
    int X=N-G*g-R*r;
    if(X==0){
      ans++;
    }
    else if(X>0&&X%B==0){
      ans++;
    }
  }
}
cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll mod= 1e9 + 7;


int main(){
  int n,i;
  cin >>n >>i;
  cout << n-i+1 << endl;

}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi= vector<vi>;
using vs = vector<string>;
using pl = pair<ll,ll>;
#define ci(n,a)   ll a[n]; rep(i,(n)) cin>>a[i];
#define rep(i,n)  for(ll i = 0; i < (n); ++i)
#define red(i,n)  for(ll i = (n)-1; i >= 0; --i)
#define all(a)    begin(a),end(a)
#define pb(a)     push_back(a)
#define mp(a,b)   make_pair(a,b)
#define yn(a)     cout << ( (a)?"YES\n":"NO\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+9, LINF = 1e18;


int main(int argc,char* argv[])
{
    int a,b,c;
    cin>>a>>b>>c;
    cout<<min(b/a,c)<<endl;

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define int long long

signed main(){
    int a, p;
    cin >> a >> p;
    cout << (3*a+p)/2 << endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/dp/tasks/dp_i
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;

#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define EPS (1e-7)
#define INF (1e9)
#define MODI (1000000007)

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

// dp[i][j] : コインをi枚使い、j枚が表である確率
// double dp[3001][3001];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    // 入力、DP後、DP前
    vector<double> p(n), dpA(n + 1, 0), dpB(n + 1, 0);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    dpB[0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            // i-1回目で表の枚数がj-1で、i回目が表
            // i-1回目で表の枚数がjで、i回目が裏
            dpA[j] = dpB[j - 1] * p[i - 1] + dpB[j] * (1.0 - p[i - 1]);
        }
        swap(dpB, dpA);
    }
    double ans = 0;
    for (int i = n / 2 + 1; i <= n; i++) {
        ans += dpB[i];
    }
    printf("%0.10f\n", ans);

    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reprv(i, n) for (int i = n - 1; i >= 0; i--)
#define ll long long
using namespace std;

int main() {
    int n,k;

    cin >> n >> k;

    bool sunuke[n + 1] = {};

    rep(i, n) {
        int d;
        cin >> d;
        rep(j, d) {
            int s;
            cin >> s;
            sunuke[s] = true;
        }
    }

    int total = 0;
    for( int i = 1; i < n + 1; i ++) {
        if (sunuke[i] == false) {
            total++;
        }
    }

    cout << total << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a[3];
	for(int i=0; i<3; i++)
	{
		cin>>a[i];
	}
	sort(a,a+3);
	if(a[2]==a[0]+a[1])
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
import math
a,b,h,m = [int(x) for x in input().split()] 
x = (h*60+m)/2  
y = 6*m   
angle = abs(x - y)  
angle = min(360 - angle, angle) 
pi = 3.14159265358979323
k = math.pi/180
if angle==180:
    print(a+b)
    
elif(angle==0):
    print(abs(a-b))
    
else:
    angle = angle*k
    p = math.cos(angle)
    if(p<-1):
        p=0
    ans=pow(a,2)+pow(b,2)- 2*a*b*p;
    ans = math.sqrt(ans);
    print(ans)

Measured memory_bytes: 9544
n,k = map(int, input().split())
d = []
a = []
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int, input().split())))

count = []
for i in range(k):
    for j in range(len(a[i])):
        count.append(a[i][j])

count = set(count)

print(n-len(count)) 

Measured memory_bytes: 9132
#include <bits/stdc++.h>
#define NEWLINE '\n'
using namespace std;
typedef long long ll;
///*********************

int main()
{
    vector<int> v;
    int n;
    cin >> n;
    v.resize(n * 2);
    for (auto &it : v)
        cin >> it;
    sort(v.begin(), v.end());
    int sum = 0;
    for (int i = 0; i < n * 2; i += 2)
        sum += v[i];
    cout << sum << NEWLINE;
    return 0;
}


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

const int INF = 1e9;

int main() {
  int H, W;
  cin >> H >> W;

  pair<int, int> C, D;
  cin >> C.first >> C.second;
  cin >> D.first >> D.second;
  C.first--;
  C.second--;
  D.first--;
  D.second--;
  
  int S[H][W];
  for (int i = 0; i < H; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < W; j++) {
      if (s[j] == '#'){
        S[i][j] = -1;
      } else {
        S[i][j] = INF;
      }
    }
  }

  pair<int, int> walk[] = {
    {1,0},{-1,0},{0,-1},{0,1}
  };

  pair<int, int> magic[] = {
    {1,1},{-1,1},{1,-1},{-1,-1},
    {2,0},{-2,0},{0,-2},{0,2},
    {2,2},{-2,2},{2,-2},{-2,-2},
    {2,1},{-2,1},{2,-1},{-2,-1},
    {1,2},{-1,2},{1,-2},{-1,-2}
  };

  priority_queue<pair<int,pair<int,int>>, vector<pair<int,pair<int,int>>>, greater<pair<int,pair<int,int>>> > q;  //cost,h,w
  q.push({0,C});
  S[C.first][C.second]=0;
  int ans = -1;
  while (!q.empty()){
    pair<int,pair<int,int>> info = q.top();
    q.pop();

    int cost = info.first;
    pair<int, int> place = info.second;
    
    if (D.first == place.first && D.second == place.second) {
      ans = cost;
      break;
    }

    bool needMagic = false;
    //歩く
    for(auto w: walk) {
      int nextFirst = place.first + w.first;
      int nextSecond = place.second + w.second;
      int nextCost = cost;
      if
      ( 0<=nextFirst && nextFirst<H &&
        0<=nextSecond && nextSecond<W &&
        nextCost < S[nextFirst][nextSecond]
      ) {
  	    S[nextFirst][nextSecond] = nextCost;
        q.push({nextCost,{nextFirst,nextSecond}});
      }
      //魔法を使うか判断（障害物があったら魔法を使う）
      if
      ( 0<=nextFirst && nextFirst<H &&
        0<=nextSecond && nextSecond<W &&
        S[nextFirst][nextSecond] == -1
      ) {
        needMagic = true;
      }
    }
    //障害物があったら魔法をつかう
    if (!needMagic) continue;
    for(auto m: magic) {
      int nextFirst = place.first + m.first;
      int nextSecond = place.second + m.second;
      int nextCost = cost+1;
      if
      ( 0<=nextFirst && nextFirst<H &&
        0<=nextSecond && nextSecond<W &&
        nextCost < S[nextFirst][nextSecond]
      ) {
  	    S[nextFirst][nextSecond] = nextCost;
        q.push({nextCost,{nextFirst,nextSecond}});
      }
    }
  }

  cout << ans << endl;

  return 0;
}

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

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        return a.first > b.first;
    }
}

int main(){
    int n;
    ll h;
    cin >> n >> h;

    pair<ll, ll> p[n];
    for(int i = 0; i < n; i++){
        cin >> p[i].first >> p[i].second;
    }
    sort(p, p + n);
    ll max = p[n - 1].first;
    sort(p, p + n, compare_by_b);
    ll ans = 0;
    ll now = 0;
    int flag = 0;
    for(int i = 0; i < n; i++){
        if(max < p[i].second){
            now += p[i].second;
            ans++;
            if(now >= h){
                flag = 1;
                break;
            }
        }
    }

    if(flag == 0){
        while(1){
            if(now >= h){
                break;
            }
            now += max;
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
sieve = [True] * 10**6
prime = []
for i in range(2, 10**6):
  if sieve[i]:
    prime.append(i)
    if i < 10**3:
      for j in range(i**2, 10**6, i):
        sieve[j] = False
n = int(input())
if n == 1:
  print(0)
else:
  e = []
  for p in prime:
    if n % p == 0:
      idx = 0
      while n % p == 0:
        n = n // p
        idx += 1
      e.append(idx)
    if n == 1:
        break
  if len(e) > 0:
    total = 0
    for idx in e:
      cnt = 1
      while idx >= cnt*(cnt+1)//2:
        cnt += 1
      cnt -= 1
      total += cnt 
    if n == 1:
      print(total)
    else:
      print(total + 1)
  else:
    print(1)

Measured memory_bytes: 19964
<?php

class Scanner
{
    private $arr = [];
    private $count = 0;
    private $pointer = 0;

    public function next()
    {
        if ($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        ++$this->pointer;

        return $result;
    }

    public function hasNext()
    {
        return $this->pointer < $this->count;
    }

    public function nextInt()
    {
        return (int) $this->next();
    }

    public function nextDouble()
    {
        return (float) $this->next();
    }
}

$sc = new Scanner();
$n = $sc->nextInt();
$d = $sc->nextInt();

$answer = ceil($n/($d*2 + 1));

echo $answer.PHP_EOL;


Measured memory_bytes: 16252
#include <bits/stdc++.h>
#define INF 99999999
using namespace std;
int main(){
	int N,M,a,b,dis = 0,v;
  cin >> N >> M;
  vector<vector<int>> vec(N);
  vector<int> light(N,INF);
  light.at(0) = 0;
  queue<int> q;
  for(int i = 0;i < M;i++){
	cin >> a >> b;
    vec.at(a - 1).push_back(b - 1);
    vec.at(b - 1).push_back(a - 1);
  }
	q.push(0);
  while(!q.empty()){
    v = q.front();
    q.pop();
    for(int c : vec[v]){
      if(light.at(c) != INF) continue;
   	
     light.at(c) = v;
      q.push(c);
    }
  }
  cout << "Yes" << endl;
  for(int i = 1;i < N;i++){
    cout << light[i] + 1 << endl;
  }
return 0;
}

Measured memory_bytes: 10104
n, k = map(int, input().split())
s = 0
for i in range(k, n+2):
    t = (i*(2*n-i+1)//2 - i*(i-1)//2 + 1) % (10**9+7)
    s = (s + t) % (10**9+7)

print(s)


Measured memory_bytes: 9180