akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    int max=0;
    int second_max=0;
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    int max_i;
    int second_max_i;
    for(int i=0;i<N;i++){
        if(max < A[i]){
            max = A[i];
            max_i = i;
        }
    }
    for(int i=0;i<N;i++){
        if((i!=max_i)&&(second_max<A[i])){
            second_max = A[i];
            second_max_i = i;
        }
    }
    for(int i=0;i<N;i++){
        if(i!=max_i){
            cout << max << endl;
        }
        else{
            cout << second_max << endl;
        }
    }
}

Measured memory_bytes: 3940
c = [list(map(int,input().split())) for i in range(3)]
if c[0][0] - c[0][1] == c[1][0] - c[1][1] and c[0][1] - c[0][2] == c[1][1] - c[1][2] and c[1][0] - c[1][1] == c[2][0] - c[2][1] and c[1][1] - c[1][2] == c[2][1] - c[2][2] and c[0][0] - c[1][0] == c[0][1] - c[1][1] and c[1][0] - c[2][0] == c[1][1] - c[2][1] and c[0][1] - c[1][1] == c[0][2] - c[1][2] and c[1][1] - c[2][1] == c[1][2] - c[2][2]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<iostream>
#include<queue>
#include<algorithm>
#include<tuple>
#include<map>
#include<vector>

using namespace std;

struct S{
  int y,x,c,s;
  bool operator<(S p)const{
    return c>p.c;
  }
};

int h,w;

bool valid(int y,int x){
  return 0<=y&&y<h&&0<=x&&x<w;
}

map<tuple<int,int,int,int>,int> mem;

int bfs(int sy,int sx,int ty,int tx,map<tuple<int,int,int,int>,int> m){
  auto t=make_tuple(sy,sx,ty,tx);
  if(mem.count(t))return mem[t];
  m[make_tuple(sy,sx,ty,tx)]=1;
  m[make_tuple(ty,tx,sy,sx)]=1;
  bool p[30][30]={};
  vector<tuple<int,int> > v[1000];
  v[0].emplace_back(sy,sx);
  for(int i=0;i<1000;i++){
    for(auto &f:v[i]){
      int y=get<0>(f);
      int x=get<1>(f);
      if(y==h-1&&x==w-1)return mem[t]=i;
      if(p[y][x]++)continue;
      for(int j=0;j<4;j++){
	static int d[]={0,-1,0,1,0};
	int ny=y+d[j];
	int nx=x+d[j+1];
	if(valid(ny,nx)&&m[make_tuple(y,x,ny,nx)]==0){
	  v[i+1].emplace_back(ny,nx);
	}
      }
    }
  }
  return mem[t]=-1;
}

int main(){
  while(cin>>h>>w,h){
    mem.clear();
    map<tuple<int,int,int,int>,int> m;
    for(int i=0;i<h;i++){
      for(int j=0;j<w-1;j++){
	int d;
	cin>>d;
	m[make_tuple(i,j,i,j+1)]=d;
	m[make_tuple(i,j+1,i,j)]=d;
      }
      if(i<h-1){
	for(int j=0;j<w;j++){
	  int d;
	  cin>>d;
	  m[make_tuple(i,j,i+1,j)]=d;
	  m[make_tuple(i+1,j,i,j)]=d;
	}
      }
    }
    int p[30][30];
    const int INF=1<<29;
    fill(p[0],p[30],INF);
    priority_queue<S> que;
    que.push({0,0,0,0});
    while(!que.empty()){
      S cs=que.top();
      que.pop();
      if(p[cs.y][cs.x]<=cs.s)continue;
      p[cs.y][cs.x]=cs.s;
      for(int i=0;i<4;i++){
	static int d[]={0,-1,0,1,0};
	int ny=cs.y+d[i];
	int nx=cs.x+d[i+1];
	if(valid(ny,nx)&&m[make_tuple(cs.y,cs.x,ny,nx)]==0){
	  int r=bfs(cs.y,cs.x,ny,nx,m);
	  if(r>0){
	    que.push({ny,nx,cs.c+1,max(cs.c+r,cs.s)});
	  }
	}
      }
    }
    cout<<((p[h-1][w-1]==INF)?-1:p[h-1][w-1])<<endl;
  }
}

Measured memory_bytes: 1964
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();

#define MAXX 500005
#define PI 3.14159265358979323846264338327950
#define F first
#define S second
#define ll  int
#define mod  1000000007



int main()
{
	FAST;
	ll n, m;
	cin >> n >> m;
	ll a[n+2];
	for(ll i = 0; i < n; i ++){
		cin >> a[i];
	}
	int l = 0;
    int r = m;
    while(r < n){
        if(a[r] > a[l])
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
        l++;
        r++;
    }
}

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

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

void solve(long long N, long long M, std::vector<long long> A)
{
    long long cnt = 0;
    long long sum = 0;
    for (int i = 0; i < N; i++)
    {
        sum += A[i];
    }

    for (int i = 0; i < N; i++)
    {
        if (A[i] >= (long double)((long double)(sum) / (4.0 * (long double)(M))))
        {
            cnt++;
        }
    }

    if (cnt >= M)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &A[i]);
    }
    solve(N, M, std::move(A));
    return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

int cnt[510][510];
signed main()
{
    
    int n, m, q;
    cin >> n >> m >> q;
    vector<vector<int>> v(n,vector<int>());
    for (int i = 0; i < m; i++)
    {
        int l, r;
        cin >> l >> r;
        l--, r--;
        v[l].push_back(r);
    }
   // show(v);
    for (int i = 0; i < n; i++)
    {
        sort(ALL(v[i]));
    }

    int ans;
    for (int i = 0; i < q; i++)
    {
        int s, t;
        cin >> s >> t;
        s--, t--;
        ans = 0;
        for (int j = s; j <= t; j++)
        {
            ans += upper_bound(ALL(v[j]), t) - v[j].begin();
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3456
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	const inf = 1 << 60

	n, m := nextInt(), nextInt()
	a, b, c := make([]int, m), make([]int, m), make([]int, m)

	cost, use := make([][]int, n), make([][]bool, n)
	for i := 0; i < n; i++ {
		cost[i], use[i] = make([]int, n), make([]bool, n)
		for j := 0; j < n; j++ {
			cost[i][j] = inf
		}
	}
	for i := 0; i < m; i++ {
		a[i], b[i], c[i] = nextInt()-1, nextInt()-1, nextInt()
		cost[a[i]][b[i]], cost[b[i]][a[i]] = c[i], c[i]
	}

	// ワーシャルフロイド
	for k := 0; k < n; k++ {
		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				cost[i][j] = min(cost[i][j], cost[i][k]+cost[k][j])
			}
		}
	}

	ans := 0
	for i := 0; i < m; i++ {
		if c[i] > cost[a[i]][b[i]] {
			ans++
		}
	}

	puts(ans)
}


Measured memory_bytes: 768
from collections import defaultdict
import math
dt = defaultdict(int)
def primeFactors(n): 
      
    while n % 2 == 0: 
        dt[2]+=1 
        n = n // 2
    for i in range(3,int(math.sqrt(n))+1,2): 
          
        while n % i== 0: 
            dt[i]+=1 
            n = n //i 
              
    if n > 2: 
        dt[n]+=1
def how(n):
    i=1 
    while (i*(i+1))//2 <= n:
        i+=1 
    i-=1
    return i
        
n = int(input())
primeFactors(n)
ans = 0 
#print(dt)
for key in dt.keys():
    ans+= how(dt[key])
    #print(how(dt[key]))
print(ans)


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

const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

vector<int> to[200005];

mint dfs(int v){
    mint res = 1;
    for(int u : to[v]){
        res *= dfs(u);
    }
    return res + 1;
}

int main(){
    int n;
    cin >> n;
    vector<P> p(n);
    rep(i,n) cin >> p[i].first >> p[i].second;
    sort(p.begin(), p.end());
    set<P> s;
    for(int i = n-1; i >= 0; i--){
        int x = p[i].first, d = p[i].second;
        while(s.size() && s.begin()->first < x+d){
            to[i].push_back(s.begin()->second);
            s.erase(s.begin());
        }
        s.emplace(x, i);
    }
    
    mint ans = 1;
    for(auto x : s){
        int v = x.second;
        ans *= dfs(v);
    }
    cout << ans << endl;
}

Measured memory_bytes: 25068
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<list>
#include<stack>
#include<map>
#include<set>
#include<string>
#include <sstream>
#include<bitset>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;


int main(){
  long ii,jj,kk,n,k,e;
  vector<int> a;
  bitset<32> m;
  bitset<32> t;
  bitset<32> tmp;
  cin >> n;

  cin >> k;

  for(ii=0;ii<k;ii++){
    cin >> e;
    t.set(e);
  }

  for(ii=0;ii<pow(2,n);ii++){
    m = ii;

    tmp = (~t|m) | (t & m);

    //cout << "ii:" << ii << endl;
    //cout << m << endl;
    //cout << t << endl;
    if(tmp.all()){
      cout << ii << ":";

      for(jj=0;jj<n;jj++){
        if(m.test(jj)){
          cout << " " << jj;
        }
      }
    
      cout << endl;
    }
    
  }

  
  return 0;
}



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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

struct toado
{
    double x,y;
};

int n,b[10];
double t=0,d[10][10],dem=1;
toado a[10];

void nhap()
{
    scanf("%d",&n);
    for (int i=1;i<=n;++i)
    {
        cin>>a[i].x>>a[i].y;
        b[i]=i;
    }
}

void process()
{
    for (int i=1;i<=n;++i)
    {
        for (int j=1;j<=n;++j)
        {
            double x=a[i].x-a[j].x,y=a[i].y-a[j].y;
            d[i][j]=sqrt(x*x+y*y);
        }
    }
    for (int i=1;i<n;++i)
        t+=d[i][i+1];
    while (next_permutation(b+1,b+1+n))
    {
        for (int i=1;i<n;++i)
            t+=d[b[i]][b[i+1]];
        dem++;
    }
    cout.precision(7);
    cout<<fixed<<t/dem;
}

int main()
{
    nhap();
    process();
    return 0;
}


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

using namespace std;

int main(void)
{
    string X, Y;

    cin >> X >> Y;

    if(X>Y){
        cout << '>' << endl;
    }
    else if(X<Y){
        cout << '<' << endl;
    }
    else{
        cout << '=' << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
	int n,a[100000],ans=2000000000,md=-1;
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	int subans=a[n-1];
	cout<<subans<<" ";
	for(int i=0;i<n-1;i++){
	    if(min(subans-a[i],a[i])>md){
	        ans=a[i];
	        md=min(subans-a[i],a[i]);
	    }
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

int gX,gY;
char gIdx[255];

void move(bool jewels[21][21],char dir,int dist){

  jewels[gX][gY] = false;
  for(int i=0;i<dist;i++){
    int dx = gX + tx[gIdx[dir]];
    int dy = gY + ty[gIdx[dir]];
    jewels[dx][dy] = false;
    gX = dx;
    gY = dy;
  }
}

bool isClear(bool jewels[21][21]){
  for(int y=0;y<=20;y++){
    for(int x=0;x<=20;x++){
      if(jewels[x][y]) return false;
    }
  }
  return true;
}

int main(){
  int N;
  bool jewels[21][21];

  while(~scanf("%d",&N)){
    if(N==0) break;
    gX = 10;
    gY = 10;
    gIdx['N'] = 2;
    gIdx['E'] = 1;
    gIdx['S'] = 0;
    gIdx['W'] = 3;

    memset(jewels,0,sizeof(jewels));

    for(int i=0;i<N;i++){
      int x,y;
      scanf("%d %d",&x,&y);
      jewels[x][y] = true;
    }
    int M;
    scanf("%d",&M);
    for(int i=0;i<M;i++){
      char buf[2];
      int dist;
      scanf("%s %d",buf,&dist);
      move(jewels,buf[0],dist);
    }

    printf("%s\n",isClear(jewels) ? "Yes" : "No");
  }
}

Measured memory_bytes: 1168
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
// const int mod = 998244353;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

const int maxn = 100;
int n;
LL a[maxn];
inline void work() {
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];
    LL res = 1000;
    for (int i = 0; i < n - 1; ++i) {
        if (a[i] < a[i + 1]) {
            res += (res / a[i]) * (a[i + 1] - a[i]);
        }
    }
    cout << res << endl;
}

int main() {
    // freopen(".txt", "r", stdin);
    quickread();
    work();
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>

int main(void){
  int i,j,n,x;
  char ch,s[5]={'S','H','C','D'};
  int card[4][13]={};
  scanf("%d\n",&n);

  for(i=0;i<n;i++){
    scanf("%c %d\n",&ch,&x);
    for(j=0;j<4;j++)
      if(s[j]==ch)
        card[j][x-1]=1;
  }
  
  for(i=0;i<4;i++)
    for(j=0;j<13;j++)
      if(card[i][j]==0)
        printf("%c %d\n",s[i],j+1);

  return (0);
}
    


Measured memory_bytes: 2036
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=2e5+100;
const ll inf=0x3f3f3f3f3f3f3f3f;
const ll mod=1e9+7;
ll t,n,k,a[maxn];
int main(){
    //freopen("in.txt","r",stdin);
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>n>>k;
    ll res=1,zheng=0,fu=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]>0) zheng++;
    }
    sort(a,a+n);
    if(zheng==0){
        if(k%2==1){
            for(int i=1;i<=k;i++){
                res=res*a[n-i]%mod;
            }
        }else{
            for(int i=0;i<k;i++){
                res=res*a[i]%mod;
            }
        }
        cout<<(res+mod)%mod<<endl;
        return 0;
    }
    if(k%2==0){
        zheng=n-1,fu=0;
    }else{
        zheng=n-2,fu=0,k-=2;//打的时候这里忘了减2了
        res=a[n-1];
    }
    for(;k>0&&zheng-1>=0&&fu+1<n;k-=2){
        if(a[zheng]*a[zheng-1]<a[fu]*a[fu+1]){
            res=res*a[fu]%mod*a[fu+1]%mod;
            fu+=2;
        }else{
            res=res*a[zheng]%mod*a[zheng-1]%mod;
            zheng-=2;
        }
    }
    while(res<0){
        res+=mod;
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 5160
#include<iostream>
#include<vector>
#include<string>
#include<utility>
using namespace std;

int val(string s) {
	return s[1] - '0';
}

void bubSort(vector<string>& a) {
	int n = a.size();

	for (int i = 0; i < n; i++) {
		for (int j = n - 1; j >= i + 1; j--) {
			if (val(a[j]) < val(a[j - 1])) {
				swap(a[j], a[j - 1]);
			}
		}
	}
}

void selSort(vector<string>& a) {
	int n = a.size();
	for (int i = 0; i < n; ++i) {
		int minj = i;
		for (int j = i; j < n; j++) {
			if (val(a[j]) < val(a[minj])) minj = j;
		}
		swap(a[i], a[minj]);
	}
}

string check(vector<string> rel, vector<string> v) {
	vector<string> hozon1(10, ""), hozon2(10, "");
	for (int i = 0; i < rel.size(); i++) {
		hozon1[val(rel[i])].push_back(rel[i][0]);
	}
	for (int i = 0; i < v.size(); i++) {
		hozon2[val(v[i])].push_back(v[i][0]);
	}
	bool same = true;
	for (int i = 1; i <= 9; i++) if (hozon1[i] != hozon2[i]) same = false;
	return same ? "Stable" : "Not stable";
}

int main() {
	int n;
	cin >> n;
	vector<string> v(n);
	for (int i = 0; i < n; ++i) cin >> v[i];

	vector<string> v_1 = v, v_2 = v;


	bubSort(v_1);

	selSort(v_2);


	for (int i = 0; i < n; ++i) {
		if (!i) cout << v_1[i];
		else cout << " " << v_1[i];
	}
	cout << endl;
	cout << check(v, v_1) << endl;;



	for (int i = 0; i < n; ++i) {
		if (!i) cout << v_2[i];
		else cout << " " << v_2[i];
	}
	cout << endl;
	cout << check(v, v_2) << endl;;



	return 0; 
}



Measured memory_bytes: 3212
#include <iostream>

using namespace std;

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


int main(){
  int a, b;
  cin >> a >> b;
  int c, d, e, f;
  int ans = 0;
  repd(i, a, b+1){
    c = i % 10; d = i / 10000;
    e = i / 1000 % 10; f = i / 10 % 10;
    if(c == d && e == f){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
    int n,x,count=0;
    cin>>n>>x;
    vector<int> l(n),d(n+1,0);
    rep(i,n) cin>>l.at(i);
    for (int i=1; i<n+1; i++) d.at(i)=d.at(i-1)+l.at(i-1);
    rep(i,n+1) {
        if (d.at(i)<=x) count++;
        else break;
    }
    cout<<count<<endl;
}   

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


namespace Data_Convertion
{
	class Program
	{
		static int Main ( string[] args )
		{
			while (true)
			{
				//??\???
				int convertionCount = int.Parse (Console.ReadLine ());

				if (convertionCount == 0)
				{
					break;
				}

				string[][] inputStr = new string[convertionCount][];
				for (int lp = 0; lp < convertionCount; lp++)
				{
					inputStr[lp] = Console.ReadLine ().Trim ().Split (' ');
				}

				int charCount = int.Parse (Console.ReadLine ());
				string[] inputStr2 = new string[charCount];
				for (int lp = 0; lp < inputStr2.Length; lp++)
				{
					inputStr2[lp] = Console.ReadLine ();
				}

				//??????
				Convertion convertion = new Convertion (inputStr);

				//??????
				foreach (var item in inputStr2)
				{
					string tmp = convertion.Convert (item);
					Console.Write (tmp);
				}
				Console.WriteLine ();
			}

			return 0;
		}
	}
}

class Convertion
{
	public Convertion ( string[][] table )
	{
		this.Table = new List<StringSet> (table.GetLength (0));
		for (int lp = 0; lp < table.GetLength (0); lp++)
		{
			this.Table.Add (new StringSet (table[lp][0], table[lp][1]));
		}
	}

	private List<StringSet> Table { set; get; }

	public string Convert ( string str )
	{
		foreach (var item in Table)
		{
			if (item.Before == str)
			{
				str = item.After;
				break;
			}
		}
			
		return str;
	}
}

class StringSet
{
	public StringSet ( string str1, string str2 )
	{
		this.Before = str1;
		this.After = str2;
	}

	public string Before { private set; get; }
	public string After { private set; get; }
}

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


int main() {
    int a,b,t;
    cin>>a>>b>>t;

    cout<<((int)((t+0.5)/a)*b)<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		long a = in.nextLong(), b = in.nextLong(), c = in.nextLong();
		if(a % 2 ==0 || b % 2 ==0 || c % 2 ==0 ){
			System.out.println("0");
		}else{
			long ans = a * b;
			ans = Math.min(ans, a * c);
			ans = Math.min(ans, b * c);
			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 21844
#include<stdio.h>

int main(){
    int a,b,c,d;
    scanf("%d %d %d",&a,&b,&c);
    if(a>b){
        d=a;
        a=b;
        b=d;
    }
    if(b>c){
        d=b;
        b=c;
        c=d;
    }
    if(a>b){
        d=a;
        a=b;
        b=d;
    }
    printf("%d %d %d\n",a,b,c);
}


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

using ll = long long;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)

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

Measured memory_bytes: 256
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

int main() {
	int N, M; cin >> N >> M;
	vector<int> A(N); rep(i, N)cin >> A[i];

	double sum = 0;
	rep(i, N) sum += A[i];

	double cons = sum / (4 * M);

	ll cnt = 0;
	rep(i, N) {
		if (A[i] >= cons) cnt++;
	}

	if (cnt >= M) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(std::unique(all(x)), x.end());
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=acos(-1);
using namespace std;
vector<int> dx={1,0,-1,0};
vector<int> dy={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int r;
    cin>>r;
    cout<<r*r<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int main (void) {
    int N;

    cin >> N;
    ll a[3 * N];
    for (int i = 0; i < 3 * N; i++) {
        cin >> a[i];
    }

    sort(a, a + 3 * N, greater<ll>());
    ll ans = 0;
    for (int i = 1; i <= 2 * N; i += 2) {
        ans += a[i];
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;

/// Errichto debugger
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

ll Solve1(int n, int p, string s)
{
    if(p == 2 || p == 5)
    {
        ll Ans = 0;

        for(int i = 0; i < n; i++)
            if((s[i] - '0') % p == 0)
                Ans += (ll) (i + 1);

        return Ans;
    }

    reverse(s.begin(), s.end());
    for(int i = 0; i < n; i++)  s[i] -= '0';

    vector <int> P10(n, 1);
    for(int i = 1; i < n; i++)  P10[i] = (ll) 10 * P10[i - 1] % p;

    vector <int> Pref(n + 1);
    for(int i = 0; i < n; i++)  Pref[i + 1] = (Pref[i] + (ll) s[i] * P10[i] % p) % p;

    ll Ans = 0;
    vector <int> Cnt(p);

    for(int i = 0; i < n; i++)
    {
        Cnt[Pref[i]]++;
        Ans += (ll) Cnt[Pref[i + 1]];
    }

    return Ans;
}

ll Solve2(int n, int p, string s)
{
    ll Ans = 0;
    for(int i = 0; i < n; i++)  s[i] -= '0';

    for(int i = 0; i < n; i++)
    {
        for(int j = i; j < n; j++)
        {
            int x = 0;

            for(int k = i; k <= j; k++) x = (10 * x + s[k]) % p;

            if(!x)  Ans++;
        }
    }

    return Ans;
}

int rand(int x, int y)
{
    return x + rand() % (y - x + 1);
}

int main()
{
    int n, p;   cin >> n >> p;
    string s;   cin >> s;

    cout << Solve1(n, p, s) << endl;

    /*const int N = 1010;

    vector <int> P;
    bitset <N> isPrime;

    isPrime[0] = isPrime[1] = 1;
    for(int i = 2; i < N; i++)  isPrime[i] = 1;

    for(int x = 2; x < N; x++)
    {
        if(isPrime[x])
        {
            P.push_back(x);
            for(int y = x * x; y < N; y += x)
            {
                isPrime[y] = 0;
            }
        }
    }

    while(true)
    {
        int n = rand(1, 9);
        int p = P[rand() % P.size()];
        string s = string(n, '0');

        for(int i = 0; i < n; i++)  s[i] += rand() % 10;

        ll Ans1 = Solve1(n, p, s);
        ll Ans2 = Solve2(n, p, s);

        cout << n << " " << p << endl;
        cout << s << endl;

        cout << Ans1 << " " << Ans2 << endl << endl;

        if(Ans1 != Ans2)    return 0;
    }*/
}



Measured memory_bytes: 2308
#include <iostream>
#include <cstring>
#define eps 0
using namespace std;
typedef long long int ll;
typedef long double lld;
lld dp[500][500][500];
ll n,a;
ll as[4];
lld dfs(ll,ll,ll);
int main() {
  scanf("%lld",&n);
  
  for(int i = 0; i < n; i++)
  {
    scanf("%lld",&a);
    as[a]++;
  }
  //start 
  //cout <<as[1]<<" "<<as[2]<<" "<<as[3]<<endl;
  lld ans = dfs(as[1],as[2],as[3]);
  printf("%.9Lf\n",ans);
}
lld dfs(ll a,ll b,ll c)
{
  if(a<=eps&&b<=eps&&c<=eps)return 0;
  if(dp[a][b][c]>eps)return dp[a][b][c];

  lld res;
  res = 1;
  if(a>0)res+=dfs(a-1,b,c)*(1.0*a)/(1.0*n);
  if(b>0)res+=dfs(a+1,b-1,c)*(1.0*b)/(1.0*n);
  if(c>0)res+=dfs(a,b+1,c-1)*(1.0*c)/(1.0*n);
  return dp[a][b][c] = res*n*1.0/(a+b+c);

}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

int main()
{
    string s;
    cin >> s;
    int size = s.size();
    reverse(s.begin(), s.end());
    s += '0';
    int carry = 0;
    int ans = 0;
    for (int i = 0; i < size + 1; i++) {
        int add = 0;
        if (s.at(i) - '0' + carry <= 4) {
            add = (s.at(i) - '0') + carry;
            carry = 0;
        } else if (s.at(i) - '0' + carry == 5) {
            add = 5;
            if (s.at(i + 1) - '0' >= 5) {
                carry = 1;
            } else {
                carry = 0;
            }
        } else {
            add = 10 - ((s.at(i) - '0') + carry);
            carry = 1;
        }

        ans += add;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1412
#include<stdio.h>

int main(){
  int k,s,x,y,cnt=0;
  scanf("%d%d",&k,&s);
  for(x=k;x>=0;x--){
    if(s-x>2*k) break;
    else{
      for(y=k;y>=0;y--){
        if(s-x-y<=k&&s-x-y>=0) {
        cnt++;
//        printf("%d %d %d\n",x,y,s-x-y);
        }
      }
    }
  }
  printf("%d\n",cnt );
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> void chmin(T& t, const U& u){if(t>u)t=u;}
template<typename T,typename U> void chmax(T& t, const U& u){if(t<u)t=u;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T mpow(T a, T n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  int n,ans=0;cin>>n;
  string s;cin>>s;
  rep(l,0,10){
      rep(j,0,10){
          rep(k,0,10){
              string can="";
              can+='0'+l;
              can+='0'+j;
              can+='0'+k;

              bool f1=true,f2=false,f3=false;
              rep(i,0,n){
                  if(f1 && s[i]==can[0]){
                      f2=true;
                      f1=false;
                  }else if(f2 && s[i]==can[1]){
                      f3=true;
                      f2=false;
                  }else if(f3 && s[i]==can[2]){
                      ans++;
                      break;
                  }
              }

          }
      }
  }
    cout<<ans<<endl;
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	if (abs(a - c) <= d)
		cout << "Yes" << endl;
	else if (abs(a - b) <= d && abs(b - c) <= d)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
ship = {i:[] for i in range(1, n+1)}

for _ in range(m):
    a, b = map(int, input().split())
    ship[a].append(b)

for i in ship[1]:
    if n in ship[i]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Measured memory_bytes: 46140
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long X;
    cin >> X;
    long long ans = 0;
    long long G = X / 500;
    long long N = (X - G * 500)/5;
    ans += G * 1000 + N * 5;
    cout << ans << endl;
}


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

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define ull unsigned long long 
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll; 
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef vector<pll> vpll ;
// int ab  (int  x ) { return (x>0?x:-x); }
ll dp[5005][5005][2];
vector<ll> coins ;  
ll solve(int i , int j , bool p ){
	if( i > j )return 0 ; 
	ll& r = dp[i][j][p] ; 
	if( r != -1 )return r; 
	if(p)
	return r = min ( {solve ( i + 1 , j,!p) - coins[i] , solve(i+1,j,!p)-coins[i] , solve(i,j-1,!p)-coins[j] , solve(i,j-1,!p)-coins[j]});
	return r = max ( {solve ( i + 1 , j,!p) + coins[i] , solve(i+1,j,!p)+coins[i] , solve(i,j-1,!p)+coins[j] , solve(i,j-1,!p)+coins[j]}); 
}


int main(){
	int n ; 
	cin >> n ; 
	coins.resize(n); 
	for(ll& a : coins )cin >>  a; 
	memset(dp,-1,sizeof dp); 
	cout << solve(0,n-1,0)<<endl; 
}

Measured memory_bytes: 392064
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <chrono>
#include <random>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    double r1, r2;
    cin >> r1 >> r2;
    double ans = (r1 * r2) / (r1 + r2);
    cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll N, K;
    cin >> N >> K;
    VL p(N);
    rep(i,0,N)cin>>p[i];
    sort(ALL(p));
    ll ans=0;
    rep(i,0,K)ans+=p[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner

object Main extends App { 
  val sc = new Scanner(System.in)
  val S1, S2 = sc.nextLine()

  class DP(s0:String, s1:String) {
    val a0 = ("*"+s0).toCharArray
    val a1 = ("*"+s1).toCharArray
    val hight = a0.length
    val width = a1.length
    val memo = Array.ofDim[Int](hight, width)
    for (i <- 0 until hight) memo(i)(0) = i
    for (j <- 0 until width) memo(0)(j) = j

    def solver():Int = {
      for (i <- 1 until hight; j <- 1 until width) {
        val ci = memo(i-1)(j)+1
        val cd = memo(i)(j-1)+1
        val cr = memo(i-1)(j-1) + (if (a0(i) == a1(j)) 0 else 1)
        memo(i)(j) = List(ci,cd,cr).min
      }
      memo(hight-1)(width-1)      
    }
  }

  val dp = new DP(S1, S2)

  println(dp.solver())
}


Measured memory_bytes: 264132
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int K=stdIn.nextInt();
		double p[]=new double[N];
		int k[]=new int[1001];
		double max=0,cout=0;
		for(int i=0;i<1001;i++){
			if(i!=0)
				k[i]=k[i-1]+i;
		}
		for(int i=0;i<N;i++){
			p[i]=stdIn.nextInt();
			p[i]=k[(int)p[i]]/p[i];
			if(i<K)
				cout+=p[i];
			else{
				if(max<cout)
					max=cout;
				cout-=p[i-K];
				cout+=p[i];
			}
		}
		if(max<cout)
			max=cout;
		System.out.println(max);
	}
}


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

//Made with <3 by MinumCoklatPanas
typedef long long ll;
const ll INF = 1e9;
const ll INFF = 1e18;
const ll MAXN = 510;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> a(n),b(m);
    for (ll i = 0 ; i < n ; i++)
    {
        cin >> a[i];
        if (i > 0)
            a[i] += a[i - 1];
    }
    for (ll i = 0 ; i < m ; i++)
    {
        cin >> b[i];
        if (i > 0)
            b[i] += b[i - 1];
    }
    ll ans = 0;
    for (ll i = 0 ; i < n ; i++)
    {
        if (a[i] > k) break;
        ll ambil = i + 1;
        ll sisa = k - a[i];
        ll nxt = upper_bound(b.begin(),b.end(),sisa) - b.begin();
        ambil += nxt;
        ans = max(ans,ambil);
    }
    for (ll i = 0 ; i < m ; i++)
    {
        if (b[i] > k) break;
        ll ambil = i + 1;
        ll sisa = k - b[i];
        ll nxt = upper_bound(a.begin(),a.end(),sisa) - a.begin();
        ambil += nxt;
        ans = max(ans,ambil);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6364
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	string s1,s2;
	cin >> s1 >> s2;
	int ans = 0;
	for(int i = 0;i < 3;i++)
	{
		if(s1[i] == s2[i])
			ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=4e5+5;
typedef long long ll;
pair<int,int> a[maxn];
int num[maxn],len;
int n;
ll t1[maxn*4][2];
inline int lc(int u){
	return u<<1;
}
inline int rc(int u){
	return u<<1|1;
}
inline void co(int u,int id){
	t1[u][id]=max(t1[lc(u)][id],t1[rc(u)][id]);
}
inline void insert(int u,int l,int r,int pl,ll x,int id){
	if (l==r){
		t1[u][id]=max(t1[u][id],x);
		return;
	}
	int mid=(l+r)/2;
	if (pl<=mid) insert(lc(u),l,mid,pl,x,id);
	else insert(rc(u),mid+1,r,pl,x,id);
	co(u,id);
}
inline ll qmax(int u,int l,int r,int ql,int qr,int id){
	if (ql<=l&&r<=qr) return t1[u][id];
	ll res=-2e9;
	int mid=(l+r)/2;
	if (ql<=mid) res=max(res,qmax(lc(u),l,mid,ql,qr,id));
	if (mid+1<=qr) res=max(res,qmax(rc(u),mid+1,r,ql,qr,id));
	return res;
}
vector<int> adj[maxn];
int main(){
	cin>>n;
	for (int i=1;i<=n;i++){
		scanf("%d%d",&a[i].first,&a[i].second);
		num[++len]=a[i].first;
		num[++len]=a[i].second;
	}
	memset(t1,0xf3,sizeof(t1));
	sort(num+1,num+len+1);
	len=unique(num+1,num+len+1)-num-1;
	for (int i=1;i<=n;i++){
		a[i].first=lower_bound(num+1,num+len+1,a[i].first)-num;
		a[i].second=lower_bound(num+1,num+len+1,a[i].second)-num;
		adj[a[i].first].push_back(a[i].second);
	}
	ll ans=0;
	for (int i=1;i<=len;i++){
		for (int j=0;j<adj[i].size();j++){
			int tp=adj[i][j];
			ans=max(ans,num[i]-num[tp]+qmax(1,1,len,tp,len,1));
			ans=max(ans,num[i]+num[tp]+qmax(1,1,len,1,tp,0));
			insert(1,1,len,tp,-num[i]+num[tp],1);
			insert(1,1,len,tp,-num[i]-num[tp],0);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 47400
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

int main(){
  int n;
  cin >> n;
  int w[n];
  int a,b;
  a = 0; b = 0;
  rep(i,n){
    cin >> w[i];
    a  += w[i];
  }
  int ans = 100000;
  int dif;
  rep(i,n){
    dif = abs(a-b);
    ans = min(dif,ans);
    a -= w[i];
    b += w[i];
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#define max(a,b) (((a) > (b)) ? (a) : (b))
using namespace std;
int s[100001],n,tmp;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>tmp;
		s[tmp]++;
	}
	if(n==1)
	{
		cout<<"1";
		return 0;
	}
	int res=1;
	for(int i=0;i<100000;i++)
	{
		tmp=s[i]+s[i+1]+s[i-1];
		if(tmp>res)
			res=tmp;
	}
	cout<<res;
	return 0;
} 

Measured memory_bytes: 640
#include<stdio.h>

int main(){
	int n;
	int i;
	double debt = 100000;
	
	scanf("%d", &n);
	
	for( i = 0; i < n; i++){
		debt *= 1.05;
		if((int)debt % 1000 != 0){
			debt = debt - ((int)debt % 1000) + 1000;
		}
	}
	
	printf("%.0f\n", debt);
	
    return 0;
}


Measured memory_bytes: 2052
#include<iostream>		//123456789
#include<cstdio>
using namespace std;	//584167932
long n,m;
long p[100000]={0},num[100000];
long i,j;
long a,temp;
int main()
{
	while(cin >> n >> m , n!=0 && m!=0)
	{
		for(j=1;j<=m;j++) p[j]=0;
		for(i=0;i<n;i++)
		{
			for(j=1;j<=m;j++)
			{
				cin >> a;
				p[j]+=a;
			}
		}
		for(j=1;j<=m;j++) num[j]=j;
		for(i=1;i<=m;i++)
		{
			for(j=i+1;j<=m;j++)
			{
					if(p[i]<p[j] || (p[i]==p[j] && num[i]>num[j]))
				{
					temp=p[i];
					p[i]=p[j];
					p[j]=temp;
					temp=num[i];
					num[i]=num[j];
					num[j]=temp;
				}
			}
		}
		cout << num[1];
		for(i=2;i<=m;i++)
		{
			cout << " " << num[i];
		}
		cout << endl;
	}
	return 0;
}

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, K;
    cin >> n >> K;
    vector<int> v(3);
    for (int i = 0; i < 3; ++i) {
        cin >> v[i];
    }

    const string s = "spr";
    string t;
    cin >> t;
    int ans = 0;
    vector<int> hoge(K, false);
    for (int i = 0; i < n; ++i) {
        if (i >= K) {
            if (t[i] == t[i - K]) {
                if (hoge[i % K]) {
                    hoge[i % K] = !hoge[i % K];
                } else {
                    hoge[i % K] = !hoge[i % K];
                    continue;
                }
            } else {
                hoge[i % K] = false;
            }
        }

        for (int j = 0; j < 3; ++j) {
            if (t[i] == s[j]) {
                ans += v[j];
                break;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

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

int main() {
  string n;
  cin >> n;
  for(int i = 0; i < n.size(); i++){
    if(n.at(i) == '1'){
      n.at(i) = '9';
    }
    else if(n.at(i) == '9'){
      n.at(i) = '1';
    }
  }
  cout << n << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	int x;
	cin >> x;
	int c500 = x / 500;
	x -= c500 * 500;
	int c5 = x / 5;
	int ans = c500 * 1000 + c5 * 5;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include <cmath>
using namespace std;

int main(){
    double a;
    
    cin >> a;
    double b = a*a*M_PI;
    double c = a * 2 * M_PI;
    printf("%f %f", b,c);
    
    return 0;
}


Measured memory_bytes: 3276
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

//繰り返し二乗法
ll mod_pow(ll x,ll n){
	ll res = 1;
	while(n > 0){
		if(n & 1){
			res = res * x % mod;
		}
		x = x * x % mod;
		n >>= 1;
	}
	return res;
}

int main(){
	int n;cin>>n;
	vector<ll> t(n);
	vector<ll> a(n);
	vector<ll> high(n,LINF);
	for(int i = 0; i < n; i++) {
		cin>>t[i];
	}
	for(int i = 0; i < n; i++) {
		cin>>a[i];
	}
	high[0] = t[0];
	for(int i = 1; i < n; i++) {
		if(t[i] > t[i - 1]){
			high[i] = t[i];
		}
	}
	if (high[n - 1] != LINF && high[n - 1] != a[n - 1]){
		cout << 0 << endl;
		return 0;
	}
	high[n - 1] = a[n - 1];
	for(int i = n - 2; i >= 0; i--) {
		if(high[i] != LINF && a[i] < high[i]){
			cout << 0 << endl;
			return 0;
		}
		if(a[i] > a[i + 1]){
			if(high[i] != LINF && high[i] != a[i]){
				cout << 0 << endl;
				return 0;
			}
			high[i] = a[i];
		}
	}
	ll l,r;
	ll dist;
	ll ans = 1;
	for(int i = 0; i < n - 1; i++) {
		// cout << high[i] << endl;
		if (high[i + 1] == LINF){
			if(high[i] != LINF){
				l = high[i];
				dist= 1;
			}
			else{
				dist++;
			}			
		}
		if(high[i + 1] != LINF && high[i] == LINF){
			// cout << "l " << l << " r " << r << " dist " << dist << " pow " << mod_pow(min(l,r),dist) << endl;
			r = high[i + 1];
			ans *= mod_pow(min(l,r),dist);
			ans %= mod;
		}
	}
	cout << ans << endl;

	return 0;
}

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

int main(){
  int N,K; cin>>N>>K;
  double ans=0;
  for(int i=1;i<=N;i++){
    double prob=1.0/N;
    int value=i;
    while(value<K){
      value*=2;
      prob*=0.5;
    }
    ans += prob;
  }
  cout<<fixed<<setprecision(10)<<ans<<endl;
}  

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

int main(){

//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    int n;
    cin >> n;
    string s;
    cin >> s;

    int res = 0;
    int tmp = 0;

    REP(i,n)
    {
        if(s[i] == 'I')
        {
            ++tmp;
        }
        else
        {
            --tmp;
        }

        res = max(res,tmp);
    }



    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
    #include<cstring>
    #include<cstdio>
    using namespace std;
    inline int read()
    {
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
    }
    int n,H,in[405],out[405],B[405],s[405],tote,size[405];
    inline int getfa(int x){return s[x]?s[x]=getfa(s[x]):x;}
    inline void Merge(int f,int t){if(getfa(f)!=getfa(t)) size[getfa(t)]+=size[getfa(f)],s[getfa(f)]=getfa(t);}
    int main()
    {
    n=read();H=read();
    for(int i=1;i<=n;++i)
    {
    int a=read(),b=read(),c=read(),d=read();
    int f=c?c+H:a,t=d?d:b+H;
    if(f==t) B[f]=1; else
    {
    ++out[f],++in[t];
    Merge(f,t);++size[getfa(f)];++tote;
    }
    // cout<<f<<" "<<t<<endl;
    }
    int S=0;
    for(int i=1;i<=H*2;++i)
    {
    // cout<<i<<" "<<in[i]<<" "<<out[i]<<endl;
    if(B[i]&&!in[i]&&!out[i]) return 0*puts("NO");
    if(i> H&&out[i]>in[i]) return 0*puts("NO");
    if(i<=H&&out[i]<in[i]) return 0*puts("NO");
    if(out[i]!=in[i])
    if(S) Merge(S,i);
    else S=i;
    }
    if(!S||size[getfa(S)]!=tote) return 0*puts("NO");
    puts("YES");
    return 0;
    }

Measured memory_bytes: 384