akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  string s;
  cin >> s;
  vector<string> vs;

  string tmp = "";
  rep(i, s.size()) {
    tmp += s[i];
    if (vs.size() == 0 || vs.back() != tmp) {
      vs.eb(tmp);
      tmp = "";
    }
  }

  cout << vs.size() << endl;
}


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

#define ll long long
#define pb push_back
#define eb emplace_back
//#define st first
#define sc second

using namespace std;

const ll mod = 1e9 + 7;
const int e = 55;
const int base = 311;

// dung inverse module de tinh nCk
// beginer 82
// mbeginer
// cach tao hoan vi tu n so : n*(n+1)/2;

//vector<pair<ll,ll>>adj[e];
//vector<ll>adj[e];

/*ll Pow(ll n, ll dem)
{
    if(dem == 0) return 1;
    if(dem == 1) return n ;
    ll t = Pow(n, dem/2);
    if(dem % 2 == 0) return (t*t);
    else return ((t * t) * n);
}*/

/*ll C(ll k, ll n)
{
    if(k == 0) return 1;
    if(n < k) return 0;
    return (gt[n]%mod * (igt[k]%mod * igt[n-k]%mod)%mod)%mod;
}*/


int main()
{
   ll a, b, c, d;
   cin >> a >> b >> c >> d;
   int dem =0;
   while(a>0 && c>0)
   {
      if(dem % 2 == 0)
      {
          c -= b;
      }
      else
      {
          a -= d;
      }
      dem ++;
   }
   if(dem % 2 == 1) cout <<"Yes";
   else cout <<"No";
}
/*

*/


Measured memory_bytes: 3580
#include <iostream>
using namespace std;
int main(){
char s[10];
int a,x;
cin>>s;

a=int(s[8])-48;
x=int(s[9])-48;
	if(s[0]=='2'&&s[1]=='0'&&s[2]=='1'&&s[3]=='7'&&s[4]=='/'&&s[5]=='0'&&s[6]=='1'&&s[7]=='/'&&(a+x)>=1&&(a+x)<=31){
		s[3]='8';
		cout<<s<<endl;
}
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc078c()
}

private const val ok = 100
private const val ng = 1900

fun abc078c() {
    val (n, m) = readLine()!!.split(" ").map { it.toInt() }

    val chanceToAC = Math.pow(0.5, m.toDouble())
    val takeTime = ng * m + ok * (n - m)

    val answer = takeTime / chanceToAC

    println(answer.toLong())
}


Measured memory_bytes: 35956
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)

int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
 ll n,m;
  while(cin>>n>>m,n+m){
    vector<ll> tl(n+m);
    rep(i,n+m){
      cin>>tl[i];
    }
    sort(tl.begin(),tl.end());
    ll maxx = tl[0];
    rep(i,n+m-1){
      maxx = max(maxx,tl[i+1] - tl[i]);
    }
    cout<<maxx<<endl;
  }
  

}

Measured memory_bytes: 1292
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	S, W = getlist()
	if S > W:
		print("safe")
	else:
		print("unsafe")
	


if __name__ == '__main__':
	main()

Measured memory_bytes: 64732
/*
g++ -std=c++11 -o2 -Wall ABC103B.cpp -o ./out/ABC103B.out
./out/ABC103B.out
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(){
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  bool flag;
  string s, t;
  cin >> s;
  cin >> t;
  int n = s.size();
  for (int i = 0; i < n; ++i) {
    flag = true;
    for (int j = 0; j < n; ++j) {
      if (s[(i + j) % n] != t[j]) {
        flag = false;
        break;
      }
    }
    if (flag) break;
  }
  if (flag) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}


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

typedef long long ll;
typedef unsigned long long int llu;
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define mem(a, v) memset(a, v, sizeof(a))
#define PI acos(-1)
#define S(a) scanf("%d",&a)
#define SL(a) scanf("%lld",&a)
#define S2(a, b) scanf("%d%d",&a,&b)
#define nl printf("\n")
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define deb2(x, y) cout<<#x<<" : "<<x<<" | "<<#y<<" : "<<y<<endl;
#define deb3(x, y, z) cout<<#x<<" : "<<x<<" | "<<#y<<" : "<<y<<" | "<<#z<<" : "<<z<<endl;
#define debv(x) {cout<<#x<<" : "<<endl; for(int ii =0; ii < x.size(); ii++) cout<<x[ii]<<" "; cout<<endl; }
#define debarr(x, xs) {cout<<#x<<" : "<<endl; for(int ii =0; ii < xs; ii++) cout<<x[ii]<<" "; cout<<endl; }
//auto T=clock(); 
//cout<<double(clock()-T)/CLOCKS_PER_SEC<<'\n';
//cout << fixed << setprecision(10) << f(0, 0, 0) << "\n";
const ll mod = 1000000007LL;
const int lmt = 100005;

ll a[lmt];
map<pair<int, int>, ll> M;
vector<int> adj[lmt];
bool ans = true;

void dfs(int u, int p) {
    if((adj[u].size() == 1) && (p != 0)) {
        M[mp(max(u, p), min(u, p))] = a[u];
        return ;
    }
    ll sum = 0;
    for(int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        if(v != p)
            dfs(v, u);
        if(v != p) {
            ll tmp = M[mp(max(u, v), min(u, v))];
            if(tmp > a[u])
                ans = false;
            if(tmp < 0)
                ans = false;
            sum += tmp;
        }
    }
    if(adj[u].size() == 1) {
        if(sum != a[u])
            ans = false;
    }
    else {
        ll val = 2LL*a[u] - sum;
        if((p == 0) && (val != 0))
            ans = false;
        if(val < 0)
            ans = false;
        if(val > a[u])
            ans = false;
        M[mp(max(u, p), min(u, p))] = val;
    }
}

int main(){
    int n;
    S(n);
    for(int i = 1; i <= n; i++) {
        SL(a[i]);
    }
    for(int i = 1; i < n; i++) {
        int x, y;
        S2(x, y);
        adj[x].pb(y);
        adj[y].pb(x);
    }
    dfs(1, 0);
    if(ans)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}

Measured memory_bytes: 23424
///supercalifragilisticexpialidocious.
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <cstdlib>
#include <cctype>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <utility>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <list>
#include <bitset>
#include <complex>
using namespace std;
#define f first
#define s second
#define PB pop_back
#define pb push_back
#define mp make_pair
#define int long long
#define sz(s) (int)s.size()
#define seper(n) setprecision(n)
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a,b,sizeof a)
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll;
typedef map<int , int> mii;
typedef pair<int , int> pii;
typedef map<string , int> msi;
typedef pair<int , string> pis;
typedef pair<int , pair<int , int> > piii;
const int MAXN = 1e5 + 10;
int n , ind , a[MAXN] , prs[MAXN];
int32_t main()
{
	cin >> n;
	for(int i = 0 ; i < n ; i ++)
		cin >> a[i];
	sort(a , a + n);
	for(int i = 0 ; i <= n ; i ++)	
		prs[i + 1] = prs[i] + a[i];
	for(int i = 0 ; i < n ; i ++)
		if(prs[i] * 2 < a[i])
			ind = i;
	return cout << n - ind << endl , 0;
}


Measured memory_bytes: 1792
using System;

namespace AtCoder0621
{
	class Program
	{
		static void Main(string[] args)
		{
			A();
		}

		static void A()
		{
			var s = Console.ReadLine();
			if (s == s.ToLower())
				Console.WriteLine('a');
			else
				Console.WriteLine('A');
		}
	}
}


Measured memory_bytes: 26300
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
ll dp[100005];
ll n;
ll cost(ll h[],ll step)
{
	if(step==1)
	return 0;
	if(step<1)
	return INT_MAX;
	ll ans1=INT_MAX,ans2=INT_MAX;
	if(dp[step]!=-1)
	return dp[step];
	if(step-1>=1)
	ans1=abs(h[step]-h[step-1])+cost(h,step-1);
	if(step-2>=1)
	ans2=abs(h[step]-h[step-2])+cost(h,step-2);
	dp[step]=min(ans1,ans2);
	return dp[step];
}
int main()
{
	cin>>n;
	ll h[n+1],i;
	h[0]=0;
	for(i=1;i<=n;i++)
	{
		cin>>h[i];
		dp[i]=-1;
	}
	//sort(h,h+n);
	ll ans=cost(h,n);
	cout<<ans;
	return 0;
}

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

long long a[300],b[300],c[300];
int main()
{
    long long i, j=0, n=0, t, k,m, l=INT_MAX, INT=1e10, n1=0, n2=0, l1, k1;
    cin>>n;
    for(i=0; i<n; i++){
        cin>>a[i];
        if(a[i]%2==0&&(a[i]%3!=0&&a[i]%5!=0))j=1;
    }
    j==0?cout<<"APPROVED"<<endl:cout<<"DENIED"<<endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    print('Yay!' if e - a <= k else ':(')



# 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)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    c = int(next(tokens))  # type: int
    d = int(next(tokens))  # type: int
    e = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    solve(a, b, c, d, e, k)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9020
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,q;
string s;
char t[200005],d[200005];

bool go_left(int pos){
    for(int i=0;i<q;i++){
        if(s[pos]==t[i]){
            if(d[i]=='L'){
                pos--;
            }else{
                pos++;
            }
        }
        if(pos==-1)return true;
        if(pos==n)return false;
    }
    return false;
}

bool go_right(int pos){
    for(int i=0;i<q;i++){
        if(s[pos]==t[i]){
            if(d[i]=='L'){
                pos--;
            }else{
                pos++;
            }
        }
        if(pos==-1)return false;
        if(pos==n)return true;
    }
    return false;
}

int main(void){
    scanf("%d%d",&n,&q);
    cin >> s;
    for(int i=0;i<q;i++){
        scanf(" %c %c",&t[i],&d[i]);
    }
    int l=-1,r=n;
    while(r-l>1){
        int mid=(l+r)/2;
        if(go_left(mid))l=mid;
        else r=mid;
    }
    int l2=-1,r2=n;
    while(r2-l2>1){
        int mid=(l2+r2)/2;
        if(go_right(mid))r2=mid;
        else l2=mid;
    }
    printf("%d\n",n-(n-r2+l+1));
    return 0;
}




Measured memory_bytes: 900
#include <stdio.h>

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

Measured memory_bytes: 596
N,x = map(int,input().split())
a = list(map(int,input().split()))
s1 = sum(a)
for i in range(0,N-2):
    if a[i]+a[i+1] > x:
        a[i] = min(a[i],x)
        a[i+1] = x - a[i]
    else: pass
if a[N-1]+a[N-2]>x:
    a[N-1] = min(a[N-1],x)
    a[N-2] = x - a[N-1]
s2 = sum(a)
print(s1-s2)

Measured memory_bytes: 14252
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
int main()
{
    ll l,r,d,ci=0;
    scanf("%lld%lld%lld",&l,&r,&d);
    for(;l<=r;l++)
        if(l%d==0)
        ci++;
    printf("%lld\n",ci);
    return 0;
}


Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N,K; cin>>N>>K;
    vector<int> A(N);
    rep(n,0,N) cin>>A.at(n);

    sort(ToEnd(A));
    int64_t ans=0;
    rep(i,0,K) ans+=A.at(i);

    cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
using namespace std;
const int INF = 1001001001;
const int MOD = 1e9+7;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int a,b,c,d,e,f; cin >> a >> b >> c >> d >> e >> f;
  set<int> water,sugar;
  rep(i,f+1) rep(j,f+1){
    if((i*a+j*b)*100 <= f) water.insert((i*a+j*b)*100);
    if(i*c+j*d <= f) sugar.insert(i*c+j*d);
  }
  double concentration = -10.0;
  int mx_sugar = 0, mx_sugarwater = 0;
  for(auto x : water) for(auto y : sugar){
    if(x+y <= f){
      if(100*y <= e*x){
        if(chmax(concentration,100.0*y/(x+y))){
          mx_sugar = y;
          mx_sugarwater = x+y;
        }
      }
    }
  }
  cout << mx_sugarwater << " " << mx_sugar;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> G[2005];
int cnt;
void dfs(int u, int lst, int depth, int lim) {
	cnt++;
	if (depth == lim) return;
	for (int i = 0; i < (int)G[u].size(); i++) {
		int v = G[u][i];
		if (v == lst) continue;
		dfs(v, u, depth + 1, lim);
	}
}
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i < n; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	int ans = n - 1;
	if (m % 2 == 0) {
		for (int u = 1; u <= n; u++) {
			cnt = 0;
			dfs(u, 0, 0, m / 2);
			cnt = n - cnt;
			ans = min(ans, cnt);
		}
	} else {
		for (int u = 1; u <= n; u++) {
			for (int i = 0; i < (int)G[u].size(); i++) {
				int v = G[u][i];
				if (u > v) continue;
				cnt = 0;
				dfs(u, v, 0, (m - 1) / 2);
				dfs(v, u, 0, (m - 1) / 2);
				cnt = n - cnt;
				ans = min(ans, cnt);
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, xx, tmp, sum = 0;
	cin >> nn >> xx;
	for(int64 ii = 1;ii <= nn;ii++)
	{
		cin >> tmp;
		sum += tmp;
		if(sum > xx)
		{
			cout << ii << endl;
			return 0;
		}
	}
	cout << (nn + 1) << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<vector>
#include<map>

using namespace std;

void solve2() {
	int N;
	cin >> N;
	map<int, int> m;
	for (int i = 0; i < N; i++)
	{
		int n;
		cin >> n;
		m[i+1] = n;
	}
	int ans = 0;
	for (auto it = m.begin(); it != m.end(); it++)
	{
		if ((*it).first == m[(*it).second])
			ans++;
	}
	cout << ans/2 << endl;
}

void solve1() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		cout << s[i];
		if (i == 3)
			cout << " ";
	}
	cout << endl;
}

int main() {
	solve2();
	return 0;
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

typedef long long ll;

using namespace std;
int main()
{
    int N;
    int A[51], B[51], C[51];
    cin >> N;
    REP(i, N)
    {
        cin >> A[i];
        A[i]--;
    }
    REP(i, N)
    {
        cin >> B[i];
    }
    REP(i, N - 1)
    {
        cin >> C[i];
    }

    int ans = 0;
    int eatNum;
    REP(i, N)
    {
        ans += B[A[i]];
        if (i >= 1)
        {
            if (A[i] - eatNum == 1 && eatNum != N - 1)
            {
                ans += C[eatNum];
            }
        }
        eatNum = A[i];
    }

    cout << ans << endl;
}


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

using namespace std;

int main()
{
    int a, b, c, d;
    cin>>a>>b>>c>>d;
    int A=c/b+((c%b)!=0), B=a/d+((a%d)!=0);
    if(A<=B)printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define cases long long t;cin>>t;while(t--)
#define f_io ios::sync_with_stdio(false)
#define foi(a,n) for(long long i=a;i<n;i++)
#define foj(a,n) for(long long j=a;j<n;j++)
#define fok(a,n) for(long long k=a;k<n;k++)
#define ll long long
#define MOD 1000000007
using namespace std;

int main()
{
    f_io;
    ll n;
    cin >> n;
    vector<ll> p(n),q(n),dp(n+1,1),c(9,0);
    foi(0,n)
        cin >> p[i];
    foi(0,n)
        cin >> q[i];
    foi(2,n+1)
        dp[i]=dp[i-1]*i;
    //dp[0]=0;
    ll a=1,b=1;
    ll nc=n;
    foi(1,9)
        c[i]=i-1;
    foi(0,n)
    {
        nc--;
        a+=c[p[i]]*dp[nc];
        foj(p[i],9)
            c[j]--;
        //cout << a << " ";
    }
    foi(1,9)
        c[i]=i-1;
    nc=n;
    foi(0,n)
    {
        nc--;
        b+=c[q[i]]*dp[nc];
        foj(q[i],9)
            c[j]--;
        //cout << a << " ";
    }
    cout << abs(a-b);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int ans = 1;
        for(int i=0;i<N;i++){ans = Math.min(2*ans,ans+K);}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23764
N=int(input())
A=[list(map(int,input().split())) for i in range(N)]
a=A[0][0]
b=A[0][1]
import fractions
for i in range(1,N):
  if a<=A[i][0] and b<=A[i][1]:
    a=A[i][0] 
    b=A[i][1]
  else:
    aa=1
    bb=1
    if a>A[i][0]:
      if a%A[i][0]==0:
        aa=a//A[i][0]
      else:
        aa=1+a//A[i][0]
    if b>A[i][1]:
      if b%A[i][1]==0:
        bb=b//A[i][1]
      else:
        bb=1+b//A[i][1]
    c=max(aa,bb)
    a=c*A[i][0]
    b=c*A[i][1]
print(a+b)

Measured memory_bytes: 5328
#include <algorithm>
#include <bitset>
#include <chrono>
#include <complex>
#include <cstdint>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <ostream>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        string s;
        regex re = regex("^((dream)|(dreamer)|(erase)|(eraser))+$");
        in >> s;
        bool ans = regex_match(s, re);
        out << (ans ? "YES" : "NO") << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Measured memory_bytes: 46928
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
const long long INF = 1LL<<60;
#define pairint pair<int,int>
signed main(){
  int x=0,y=0,z=0,w=0;
  std::cin >> x;
  while(x>=500){
    x-=500;
    y+=1000;
  }
  while(x>5){
    x-=5;
    y+=5;
  }
  std::cout << y << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <map>

using namespace std;

struct graph
{
    int N;
    int X;
    int Y;
    
    int dist(int i, int j) {
        if (i <= X) {
            if (Y <= j) {
                return (X-i) + (j - Y) + 1;
            } else {
                return (X-i) + min((j - X), (Y - j) + 1);
            }
        } else if (Y <= i) {
            return (j - i);
        } else if (Y <= j) {
            return (j - Y) + min((i - X) + 1, (Y - i));
        } else {
            return min((j - i), (Y - j) + (i - X) + 1);
        }
    }
};

int main()
{

    int N, X, Y;
    cin >> N >> X >> Y;
    
    graph g;
    g.X = X;
    g.Y = Y;
    g.N = N;
    
    map<int, int> counts;
    for (int i = 1; i < N; i++) {
        for (int j = i+1; j <= N; j++) {
            int dist = g.dist(i, j);
            //cout << "dist(" << i << "," << j << ")=" << dist << endl;
            try {
                counts[dist] = counts[dist] + 1;
            }
            catch (...)
            {
                counts[dist] = 1;
            }
        }
    }
    
    for (int k = 1; k < N; k++) {
            try {
                cout << counts[k] << endl;
            }
            catch (...)
            {
                cout << 0 << endl;
            }
        
    }
}

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

using namespace std;

const int MAXN=2e5+5;
int n;
char s[MAXN];

inline int greedy(string last,int i){
	int ans=1;
	while(i<=n){
		string tmp;
		tmp+=s[i++];
		if(tmp!=last) ++ans;
		else{
			if(i+1<=n) tmp+=s[i++],++ans;
			else i=n+1;
		}
		last=tmp;
	}
	return ans;
}

int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	string tmp1;
	tmp1+=s[1];
	int ans=greedy(tmp1,2);
	if(n>=2){
		tmp1+=s[2];
		ans=max(ans,greedy(tmp1,3));
	}
	reverse(s+1,s+n+1);
	string tmp2;
	tmp2+=s[1];
	ans=max(ans,greedy(tmp2,2));
	if(n>=2){
		tmp2+=s[2];
		ans=max(ans,greedy(tmp2,3));
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 384
def solve(string):
    a, b, c, k = map(int, string.split())
    if k <= a:
        return str(k)
    if k <= a + b:
        return str(a)
    return str(a - (k - a - b))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


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

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

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  int N,x,y;
  cin >> N >> x >> y;
  x--; y--;

  vector<int> ans(N,0);
  for(int i = 0; i < N-1; i++){
    for(int j = i+1; j < N; j++){
      int len = j - i;

      len = min(len, abs(i - x) + 1 + abs(j - y));
      ans[len]++;
    }
  }

  for(int i = 1; i < N; i++){
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 3612
X = int(input())

def check(num):
    max_div = int(num**0.5)
    for div in range(2, max_div+1):
        if num % div == 0:
            return False
    else:
        return True

num = X
while True:
    if check(num):
        print(num)
        break
    
    num += 1

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)

using namespace std;
typedef pair<int, int> ipair;

int main(int argc, char **argv) {
    int R, G, B, N;
    cin >> R >> G >> B >> N;

    int res = 0;
    for(int r = 0; r <= 3000; ++r) {
        for(int g = 0; g <= 3000; ++g) {
            if(N - (r * R + g * G) >= 0 && (N - (r * R + g * G)) % B == 0)
                ++res;
        }
    }
    
    cout << res << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

typedef long long ll;

int main(void) {
    ll n, k;
    cin >> n >> k;

    vector<ll> c(1e5);
    for (ll i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        c[a - 1] += b;
    }

    for(ll i = 0; i < 1e5; i++){
        k -= c[i];
        if(k <= 0){
            cout << i + 1 << endl;
            break;
        }
    }

    return 0;
}


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

vector<int> g[100005], dp(100000,-1);
// int ans;

int dfs(int node)
{
	if(dp[node] != -1)	return dp[node];

	int ans = 0;

	for(auto i:g[node])
		ans = max(ans, dfs(i)+1);

	return dp[node]=ans;
}

int main()
{
	#ifndef ONLINE_JUDGE
			freopen("input", "r", stdin);
			freopen("output","w",stdout);
	#endif

	ios_base::sync_with_stdio(0);	cin.tie(NULL);	cout.tie(0);

	int n,m,x,y;	cin>>n>>m;

	for(int i=0;i<m;++i)
	{
		cin>>x>>y; x--, y--;
		g[x].push_back(y);
	}

	int ret = 0;

	for(int i=0;i<n;++i){
		ret = max(ret, dfs(i));
		// cout<<dp[i]<<" ";	cout<<endl;
	}	

	// cout<<endl;
	cout<<ret<<endl;

}

Measured memory_bytes: 11076
using System;
using System.Linq;

namespace _0340
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] y = new int[n]; int ret = int.MaxValue;
            for (int i = 0; i <= x[0]; i++)
            {
                int now = i;
                y[0] = x[0] - i;
                for (int j = 1; j < n; j++) y[j] = x[j];
                for (int j = 0; j < n - 1; j++)
                {
                    if (y[j] > 0)
                    {
                        now += y[j] * 2;
                        y[j + 1] -= y[j];
                    }
                }
                now += Math.Max(y[n - 1],0);
                ret = Math.Min(ret,now);
            }
            Console.WriteLine(ret);
        }
    }
}


Measured memory_bytes: 9904
#include<iostream>
#include<string>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)

int main(void) {
	string str[3];
	rep(i, 3)cin >> str[i];
	rep(i, 3)cout << str[i].at(0);
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
import numpy as np
from bisect import bisect_right
def main():
    n, m, k = list(map(int, input().split()))
    A = np.array([0, ] + list(map(int, input().split())))
    B = np.array([0, ] + list(map(int, input().split())))
    A = np.cumsum(A)
    B = np.cumsum(B)
    ans = 0
    for i in range(n + 1):
        if A[i] > k:
            break
        j = bisect_right(B, k - A[i])
        ans = max(ans, i + j - 1)
    print(ans)

if __name__ == '__main__':
    main()


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

int main() {
    vector<int> bingo;
    rep(i,9) {
        int a;
        cin >> a;
        bingo.push_back(a);
    }
    int n;
    cin >> n;
    rep(i,n) {
        int b;
        cin >> b;
        rep(i,9) {
            if (bingo[i] == b) bingo[i] = -1;
        }
    }
    // yoko
    bool flag = false;
    if (bingo[0] == -1 && bingo[1] == -1 && bingo[2] == -1) flag = true;
    if (bingo[3] == -1 && bingo[4] == -1 && bingo[5] == -1) flag = true;
    if (bingo[6] == -1 && bingo[7] == -1 && bingo[8] == -1) flag = true;
    // tate
    if (bingo[0] == -1 && bingo[3] == -1 && bingo[6] == -1) flag = true;
    if (bingo[1] == -1 && bingo[4] == -1 && bingo[7] == -1) flag = true;
    if (bingo[2] == -1 && bingo[5] == -1 && bingo[8] == -1) flag = true;
    // naname
    if (bingo[0] == -1 && bingo[4] == -1 && bingo[8] == -1) flag = true;
    if (bingo[2] == -1 && bingo[4] == -1 && bingo[6] == -1) flag = true;
    
    if (flag) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 256
// 2_abc135_b
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> p(n + 1);
    int cnt = 0;
    rep1(i, n){
        cin >> p[i];
        if(p[i] != i) cnt++;
    }

    if(cnt <= 2) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.HashSet;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner (System.in);
        int n = sc.nextInt(), m = sc.nextInt();
        int []v = new int[n + 1];
        int []c = new int[n + 1];
        for(int i = 1; i <= n; ++i) {
            v[i] = sc.nextInt();
        }

        for(int i = 1; i <= m; ++i){
            int a, b; 
            a = sc.nextInt();
            b = sc.nextInt();
            c[a] --;
            if(v[b] < v[a]){
                c[a] ++;
            }
            c[b] --;
            if(v[b] > v[a]){
                c[b] ++;
            }
        }
        int ans = 0;
        for(int i = 1; i <= n; ++i) {
            ans += (c[i] == 0) ? 1 : 0;
        }   
        System.out.println(ans);
    }    
}

Measured memory_bytes: 49776
# -*- coding: utf-8 -*-

num = int(input())

def count_divide(target_int):
    evaluating = target_int
    divide_count = 0
    while True:
        if evaluating == 0:
            break
        if evaluating % 2 == 0:
            evaluating /= 2
            divide_count += 1
        else:
            break
    return divide_count
    
result = {}

for i in range(1, num + 1):
    # print("--{}".format(i))
    result[i] = count_divide(i)

# print(result)
sorted = sorted(result.items(), key = lambda x: x[1], reverse = True)
print(sorted[0][0])

Measured memory_bytes: 3060
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

enum { OP_NULL, OP_ADD, OP_SUB, OP_MUL };

/* global variables */

/* subroutines */

/* main */

int main() {
  while (! cin.eof()) {
    string keys;
    cin >> keys;
    if (keys == "") break;

    int r1 = 0, r2 = 0, r3 = OP_NULL;
    bool error = false;
    
    for (int pos = 0;; pos++) {
      char key = keys[pos];

      if (key >= '0' && key <= '9') {
	r2 = r2 * 10 + (key - '0');
	if (r2 > 9999) {
	  error = true;
	  break;
	}
      }
      else {
	switch (r3) {
	case OP_NULL: r1 = r2; break;
	case OP_ADD: r1 += r2; break;
	case OP_SUB: r1 -= r2; break;
	case OP_MUL: r1 *= r2; break;
	}
	r2 = 0;

	if (r1 < 0 || r1 > 9999) {
	  error = true;
	  break;
	}

	if (key == '=') break;
	switch (key) {
	case '+': r3 = OP_ADD; break;
	case '-': r3 = OP_SUB; break;
	case '*': r3 = OP_MUL; break;
	}
      }
    }

    if (error) printf("E\n");
    else printf("%d\n", r1);
  }

  return 0;
}

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

const int MOD = 1000000007;
const int INF = 1000000000;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}

// a = max(a, b), a = min(a, b)
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; }

//int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    bool flag = false;
    if(A == B && B != C) flag = true;
    else if(A == C && B != C) flag = true;
    else if(B == C && A != B) flag = true;
    flag ? yes : no;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 5)


n, m = map(int, input().split())
info = [list(map(int, input().split())) for i in range(m)]
q = int(input())
query = [list(map(int, input().split())) for i in range(q)]


graph = [[] for i in range(n)]
for a, b in info:
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
    
query = query[::-1]

dp = [-1] * (n * (10 + 1))
# dp = [[-1] * (10 + 1) for i in range(n)]
# [v][d] -> [v * 11 + d]
first = [0] * n

def solve(v, d, c):
    if d < 0 or dp[v * 11 + d] != -1:
        return
      
    dp[v * 11 + d] = c
    if first[v] == 0:
        first[v] = c

    solve(v, d - 1, c)
    for u in graph[v]:
        solve(u, d - 1, c)
    return
  

for v, d, c in query:
    v -= 1
    solve(v, d, c)

for i in range(n):
    print(first[i])

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

int main() {
    string s;
    int co = 0, ans = 0;
    cin >> s;
    rep(i, 3) {
        if (s[i] == 'R') {
            co++;
        } else {
            if (s[i] == 'S') {
                ans = max(ans, co);
                co = 0;
            }
        }
    }
    ans = max(ans, co);
    cout << ans << endl;
    return 0;
}

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

#define trav(a, A) for (auto & a : A)
#define f first
#define s second

typedef long long ll;

const ll MOD = 1e+9+7;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const ll MAXN = 1e+5+7;

int main ()
{
	ios_base::sync_with_stdio (0);
	cin.tie (0);
	ll i, j, n, x, y;
	cin >> n >> x >> y;
	vector <vector <ll>> graph (n);
	for (i = 1; i < n; ++i)
		graph[i].push_back (i - 1),
		graph[i - 1].push_back (i);
	graph[x - 1].push_back (y - 1);
	graph[y - 1].push_back (x - 1);
	vector <vector <ll>> viz (n, vector <ll> (n, INF));
	vector <ll> freq (n, 0);
	for (i = 0; i < n; ++i)
	{
		queue <ll> dfs;
		dfs.push (i);
		viz[i][i] = 0;
		while (!dfs.empty ())
		{
			ll cur = dfs.front ();
			dfs.pop ();
			trav (v, graph[cur])
				if (viz[i][v] > viz[i][cur] + 1)
					viz[i][v] = viz[i][cur] + 1,
					dfs.push (v);
		}
	}
	for (i = 0; i < n; ++i)
		for (j = i + 1; j < n; ++j)
			++freq[viz[i][j]];
	for (i = 1; i < n; ++i)
		cout << freq[i] << '\n';

	return 0;
}



Measured memory_bytes: 31744
from collections import Counter
n=int(input())
ln=list(map(int,input().split()))
m=int(input())
lm=list(map(int,input().split()))
d=dict(Counter(ln))
ans="YES"
for i in lm:
    try:
        if d[i]>=1:d[i]-=1
        else:ans="NO"
    except:ans="NO"
print(ans)

Measured memory_bytes: 47840
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 09/11/20 07:34:59
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  vector<int> L(n); for (auto& l:L) cin>>l;
  sort(L.begin(), L.end());
  ll ans = 0;
  for (int r = n-1; r >= 2; r--) {
    for (int i = 0; i < r-1; i++) {
      auto cnt = L.begin() + r - upper_bound(L.begin()+i+1, L.begin()+r, L[r]-L[i]);
      ans += cnt;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3612
#include<iostream>
 
using namespace std;
 
static const int MAX_N = 100;
static const int MAX_A = 10000;
 
int a[MAX_N + 1];
 
bool dp[MAX_N + 1][MAX_A + 1];
 
int main() {
    int n;
    string ans;
 
    cin >> n;
 
    if (n % 10 == 7) ans = "Yes";
    else if ((n / 10) % 10 == 7) ans = "Yes";
    else if ((n / 100) == 7) ans = "Yes";
    else  ans = "No";
 
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 3632
fn main() {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).unwrap();
    let bytes = buffer.as_bytes();
    if &bytes[2] == &bytes[3] && &bytes[4] == &bytes[5] {
        println!("Yes");
    }
    else {
        println!("No");
    }
}

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

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;

llong gcd(llong n, llong m){
	while(m != 0){
		n %= m;
		swap(n,m);
	}
	return n;
}

string rem(const string &str){
	string ret;
	for(auto e : str){
		if(isdigit(e))ret.push_back(e);
	}
	return ret;
}

signed main(){
	string str; cin >> str;
	llong nm,dn;
	auto par = str.find('(');
	auto d = str.find('.');
	if(par == str.npos){
		nm = stoi(str.substr(0,d) + str.substr(d+1));
		dn = 1;
		for(llong i = 0; i < str.size() - d -1; i++)dn *= 10;
		auto g = gcd(nm, dn);
//		cerr << nm << ":" << dn << endl;
		nm /= g;
		dn /= g;
		cout << nm << "/" << dn << endl;
		return 0;
	}
	else{
		llong cnt = 1;
		dn = stoi(rem(str));
//		cerr << dn << endl;
		nm = dn;
		dn -= stoi(str.substr(par+1, str.size() -2-par));
		for(llong i = par+1; i < str.size()-1; i++){
			nm *= 10;
			cnt *= 10;
		}
		cnt--;
//		cerr << cnt << endl;
//		cerr << dn << ":" << nm << endl;
		for(llong i = d+1; i < str.size()-2; i++){
			cnt *= 10;
		}
//		cerr << dn << ":" << nm << endl;
		nm -= dn;
		dn = cnt;
//		cerr << dn << ":" << nm << endl;
		auto g = gcd(dn, nm);
		dn /= g;
		nm /= g;
		cout << nm << "/" << dn << endl;
	}

		

	return 0;
}




Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
  int H,N;
  cin >> H >> N;
  int sum = 0;
  for(int i=0; i<N; i++) {
    int a;
    cin >> a;
    sum+=a;
  }

  if( sum >= H) puts("Yes");
  else puts("No");
}


Measured memory_bytes: 256
N,M = map(int,input().split())
a = list(list(map(int, input().split())) for x in range(M))

#aをbについて昇順にする。
a=sorted(a, key=lambda x: x[1])
hasi = -1#どこの橋を壊したか
sum = 0

for i in range(0,M):
    # print(c1,c2,hasi)
    if (hasi >= a[i][0])and (hasi < a[i][1]):
        continue
    else:
        hasi = a[i][1]-1
        sum = sum+1

print(sum)


Measured memory_bytes: 29852
#include <stdio.h>

int main()
{
	int i, j, tmp;
    int arg[10];
    
	for(i=0; i<10; i++){
		scanf("%d", &arg[i]);
	}
	
	for(i=0; i<10; i++){
		for(j=i+1; j<10; j++){
			if(arg[j] > arg[i]){
				tmp = arg[i];
				arg[i] = arg[j];
				arg[j] = tmp;
			}
		}
	}
	
	for(i=0; i<3; i++){
		printf("%d\n", arg[i]);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <string>
#include <stdlib.h>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <deque>
#include <iterator>
#include <iomanip>
using namespace std;


 
int main() {
	long double n;
	cin >> n;
	cout << fixed << setprecision(10) << pow(n / 3, 3);
}


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

void sum(vector<long long> &ans, vector<vector<int>> &t, int gp, int p) {
  int i = 0;
  while (i < t.at(p).size()) {
    if (t.at(p).at(i) != gp) ans.at(t.at(p).at(i)) += ans.at(p);
    i++;
  }
  i = 0;
  while (i < t.at(p).size()) {
    if (t.at(p).at(i) != gp) sum(ans, t, p, t.at(p).at(i));
    i++;
  }
  return;
}

int main() {
  
  int N, Q;
  cin >> N >> Q;
  
  vector<vector<int>> t(N, vector<int>());
  //vector<int> num(N, -1);
  //num.at(0) = 0;
  
  for (int i = 0; i < N - 1; i++) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    
    //if (num.at(a) != -1 && num.at(b) == -1) num.at(b) = num.at(a) + 1;
    //else if (num.at(a) == -1 && num.at(b) != -1) num.at(a) = num.at(b) + 1;
    
    //if (num.at(a) < num.at(b)) t.at(a).push_back(b);
    //else t.at(b).push_back(a);
    
    t.at(a).push_back(b);
    t.at(b).push_back(a);
  }
  
  vector<long long> ans(N, 0);
  for (int i = 0; i < Q; i++) {
    int x;
    long p;
    cin >> x >> p;
    x--;
    ans.at(x) += p;
  }
  
  sum(ans, t, 0, 0);
  
  for (int i = 0; i < N; i++) cout << ans.at(i) << " ";
  
  return 0;
}



Measured memory_bytes: 33664
//waz
#include <bits/stdc++.h>
 
using namespace std;
 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))
 
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;
 
#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))
 
int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

int n, m, a[110];

bool comp(const int &i, const int &j)
{
	return (i & 1) > (j & 1);
}

int b[110], ans;

int main()
{
	gii(n, m);
	int cnt = 0;
	for (int i = 1; i <= m; ++i) gi(a[i]);
	for (int i = 1; i <= m; ++i)
		if (a[i] & 1) ++cnt;
	if (cnt > 2)
	{
		puts("Impossible");
		return 0;
	} 
	sort(a + 1, a + m + 1, comp);
	if (a[2] & 1) swap(a[2], a[m]);
	for (int i = 1; i <= m; ++i)
		printf("%d ", a[i]);
	puts("");
	if (m == 1)
	{
		if (a[1] - 1) printf("2\n%d %d \n", 1, a[1] - 1);
		else printf("1\n%d \n", 1);
		return 0;
	}
	if (a[1] - 1) b[++ans] = a[1] - 1;
	for (int i = 2; i < m; ++i)
		b[++ans] = a[i];
	b[++ans] = a[m] + 1;
	printf("%d\n", ans);
	for (int i = 1; i <= ans; ++i)
		printf("%d ", b[i]);
	puts("");
	return 0;
}

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

typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)

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

#define wd(x) printf("%d" ,x)
#define NL printf("\n")

int main(){
	int m,d;
	rd2(m,d);
	int ct=0;
	for(int i=1;i<=m;i++){
		for(int j=22;j<=d;j++){
			if(j%10>=2&&j/10>=2){
				int x=j%10;
				int y=j/10;
				if(x*y==i)
					ct++;
			}
		}
	}
	wd(ct);
	NL;
	return 0;
}

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

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            Solve();
        }
        private const int MOD = 1000000007;
        private static Dictionary<string,int> dic = new Dictionary<string, int>();

        static void Solve()
        {
            var o = ReadAndParseIntArr();
            long n = o[0];
            long m = o[1];
            var a = ReadAndParseLongArr();

            var accum = new long[n+1];
            for(int i=0;i<n;++i)
            {
                accum[i+1] =  (accum[i] + a[i]) % m;
            }

            Dictionary<long, long> dic = new Dictionary<long, long>();
            long ans = 0;
            for(int i=0;i<accum.Length;++i)
            {
                long key = accum[i];
                if( dic.ContainsKey(key))
                {
                    ans += dic[key];
                    dic[key]++;
                }
                else
                {
                    dic.Add(key, 1);
                }
            }
            Console.WriteLine(ans);
        }
#region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
#endregion
    }
}

Measured memory_bytes: 21856
use std::io::{Read, stdin};
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let mut h: Vec<i64> = vec![0; n];
    for i in 0..n{
        h[i] = read();
    }
    let mut cnt = 0;
    for i in 0..n {
        loop{
            if h[i] == 0{
                break;
            }
            for j in i..n {
                if h[j] == 0{
                    break;
                }
                h[j] -= 1;
            }
            cnt +=1;
        }


    }
    println!("{}", cnt);

}


fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

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

long long int gcd(int a, int b){ //最大公約数
    if(a%b==0){
        return (b);
    }
    return (gcd(b, a%b));
}

int main(){
    long long  int a, b;
    cin >> a >> b;
    cout << a*b/gcd(a,b) << endl;
}

Measured memory_bytes: 256
n,m,c = map(lambda x:int(x),input().split())
b = list(map(lambda x:int(x),input().split()))
corrects = 0
for i in range(n):
  an = list(map(lambda x:int(x),input().split()))
  sum = c
  for j in range(m):
    sum += (an[j]*b[j])
  if sum>0:
    corrects += 1
print(corrects)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, A;
  cin >> H >> A;
 
  
  if (H % A == 0) {
    cout << H / A << endl;
  }
  
  else {
    cout << H / A + 1 << endl;
  }
  
}

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

int main()
{
    int a[3]{};
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]+a[1]==a[2])
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256