akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <string>

const int MaxN = 1e6;
using namespace std;

int n;
char d;
map <char,int> a;

int main()
{
	cin >> n;
	int y = 0;
	for(int i = 1;i <= n;i++)
	{
		scanf(" %c",&d);
		if(a[d] == 0)
		{
			y++;
			a[d] = 1;
		}
	}
	if(y == 3) cout << "Three" << endl;
	else if(y == 4) cout << "Four" << endl;
	return 0;
}
		


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int c1,c2,c3;
  int s[11];
  int k,count;
  while(cin>>c1>>c2>>c3){
    for(int i=1;i<=10;i++) s[i] = i;
    count = 0;  
    for(int i=1;i<=10;i++){
      if(c1==s[i]||c2==s[i]||c3==s[i]) s[i] = 0;
    }
    k = 20 - c1 - c2;
    for(int i=k;i>=1;i--) if(s[i]!=0) count++;
    if(count>=4) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

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

typedef long long LL;
int cal(int a, int b)
{
    int c = a/2;
    if((LL)a+c > (LL)b*c)
         return (int)((LL)a+c-(LL)b*c);
    int x = (int)ceil(b*c*1.0/(a+c));
    return max((a+c)*x-b*c, (b-x)*(a-2*c));
}
int cal2(int a, int b)
{
    int c = (int)ceil(a/2.0);
    if(a+c > (LL)b*c) return 1e9;
    int x = (LL)b*c/(c+a);
    return max((int)((LL)b*c-(LL)x*(a+c)), (int)((LL)(b-x)*(2*c-a)));
}
int cal3(int a, int b)
{
    double x = floor(b/3.0);
    double y = ceil(b/3.0);
    return (int)(y*a-x*a);
}
int main()
{
    int a, b;
    scanf("%d%d",&a,&b);
    int ans = min(cal(a, b), min(cal(b, a), min(cal2(a, b), min(cal2(b, a), min(cal3(a, b), cal3(b, a))))));
    printf("%d\n",ans);
    return 0;
}


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


int main() {
	
	int n,k;
	cin >> n >> k;
	vector<int> h(n);
	for(auto &i : h) cin >> i;
	sort(h.begin(),h.end());
	int64_t cnt=0;
	for(int i=0; i<n-k; i++) cnt += h.at(i);
	cout << cnt << endl;
	
	
	return 0;
}

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

using namespace std;

bool OK(const string& S) {
  if (S[0] != 'A') {
    return false;
  }

  int pos_C = -1;
  for (int i = 2; i <= S.length() - 2; i++) {
    if (S[i] == 'C') {
      pos_C = i;
      break;
    }
  }

  if (pos_C == -1) {
    return false;
  }

  for (int i = 1; i < S.length(); i++) {
    if (i == pos_C) continue;
    if (tolower(S[i]) != S[i]) {
      return false;
    }
  }

  return true;
}

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

  if (OK(S)) {
    cout << "AC";
  } else {
    cout << "WA";
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
  	static Scanner scanner = new Scanner(System.in);
 
    public static void main(String[]$) {
    	int n = scanner.nextInt();
    	int m = scanner.nextInt();
      	int[] a = new int[n];
      	int[] b = new int[n];
      	for (int i = 0; i < n; i++) {
        	a[i] = scanner.nextInt();
        	b[i] = scanner.nextInt();
        }
      	int[] c = new int[m];
      	int[] d = new int[m];
      	for (int i = 0; i < m; i++) {
        	c[i] = scanner.nextInt();
        	d[i] = scanner.nextInt();
        }
      	for (int i = 0; i < n; i++) {
          	int min = Integer.MAX_VALUE;
          	int index = -1;
      		for (int j = m - 1; j >= 0; j--) {
              	int dist = Math.abs(a[i] - c[j]) + Math.abs(b[i] - d[j]);
   	   	   	   	if (min >= dist) {
                    min = dist;
               	   	index = j + 1;
                }
            }
            System.out.println(index);
        }
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <cstdio>
#include <climits>
using namespace std;
#define rep2(x,from,to) for(int x = (from); x < (to); ++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
	int n, m;
	while(cin >> n, n) {
		cin >> m;
		int cost[100][100];
		rep(i,100) {
			rep(j,100) {
				cost[i][j] = INT_MAX;
			}
		}
		rep(i,m) {
			int s, t, len;
			scanf("%d,%d,%d", &s, &t, &len);
			len /= 100;
			cost[s][t] = len;
			cost[t][s] = len;
		}
		int dist[100];
		bool visited[100];
		rep(i,n) {
			dist[i] = INT_MAX;
			visited[i] = 0;
		}
		dist[0] = 0;
		visited[0] = 1;
		int ret = 0;
		while(1) {
			bool flag = true;
			rep(i,n) {
				if(!visited[i]) {
					flag = false;
					break;
				}
			}
			if(flag) break;
			int min = INT_MAX;
			int to;
			rep(i,n) {
				if(visited[i]) {
					rep(j,n) {
						if(!visited[j]) {
							if(cost[i][j] < min) {
								min = cost[i][j];
								to = j;
							}
						}
					}
				}
			}
			visited[to] = 1;
			ret += min;
		}
		cout << ret - n + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
(defun solve(a &optional (ans 0))
    (cond
      ((<= (length a) 2) ans)
      (t
       (when
	   (or (< (first a) (second a) (third a))
	       (> (first a) (second a) (third a)))
	 (incf ans))
       (solve (rest a) ans))))

(defun main()
  (let ((n (read))
	(a (read-from-string (concatenate 'string "(" (read-line) ")"))))
    (princ (solve a))
    (fresh-line)))

(main)


Measured memory_bytes: 24456
package main

import "fmt"

type product struct {
	weight int
	value  int
}

func main() {
	var N, W int
	var w, v int
	fmt.Scan(&N, &W)
	products := make([]product, N+1)
	for i := 1; i <= N; i++ {
		fmt.Scan(&w, &v)
		products[i].value = v
		products[i].weight = w
	}
	values := make([][]int, N+1)
	for i := 0; i <= N; i++ {
		values[i] = make([]int, W+1)
	}

	for w := 0; w <= W; w++ {
		if products[1].weight <= w {
			values[1][w] = products[1].value
		}
	}

	for i := 2; i <= N; i++ {
		p := products[i]
		for w := 0; w <= W; w++ {
			value := 0
			if w > p.weight {
				value = getMax(values[i-1][w], values[i-1][w-p.weight]+p.value)
			} else {
				value = values[i-1][w]
			}
			values[i][w] = value
		}
	}
	fmt.Println(values[N][W])

}

func getMax(a, b int) int {
	if a >= b {
		return a
	} else {
		return b
	}
}


Measured memory_bytes: 81792
#include <iostream>

using namespace std;

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

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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

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

    ll N, W;
    cin >> N >> W;

    vector<vector<ll>> A(4);
    ll w1 = 0;
    REP(i, N) {
        ll w, v;
        cin >> w >> v;
        if(i == 0) w1 = w;
        A[w - w1].push_back(v);
    }

    vector<vector<ll>> accsum_A(4, vector<ll>(1, 0));
    REP(i, 4) {
        RSORT(A[i]);
        REP(j, A[i].size()) {
            accsum_A[i].push_back(accsum_A[i].back() + A[i][j]);
        }
    }

    ll ans = 0;
    for(size_t i0 = 0; i0 <= 100; i0++) {
        if(A[0].size() < i0) continue;
        for(size_t i1 = 0; i1 <= 100 - i0; i1++) {
            if(A[1].size() < i1) continue;
            for(size_t i2 = 0; i2 <= 100 - i0 - i1; i2++) {
                if(A[2].size() < i2) continue;
                for(size_t i3 = 0; i3 <= 100 - i0 - i1 - i2; i3++) {
                    if(A[3].size() < i3) continue;
                    if(i0 * w1 + i1 * (w1 + 1) + i2 * (w1 + 2) + i3 * (w1 + 3) <= (size_t)W) {
                        chmax(ans, accsum_A[0][i0] + accsum_A[1][i1] + accsum_A[2][i2] + accsum_A[3][i3]);
                    }
                }
            }
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner; 
public class Main { public static void main(String[] args) { Scanner scan=new Scanner(System.in); double x1=scan.nextDouble(); double y1=scan.nextDouble(); double x2=scan.nextDouble(); double y2=scan.nextDouble(); double a=x1-x2; double b=y1-y2; double c=0; if(Math.abs(a)==0 || Math.abs(b)==0) { c=Math.abs(a)+Math.abs(b); }else { c=Math.sqrt(Math.pow(a,2)+Math.pow(b, 2)); } System.out.printf("%.8f\n",c); scan.close(); } } 


Measured memory_bytes: 28232
#include <stdio.h>
int main(void){
      int n,min,max,i,a[10000];
   long long sum=0;
   scanf("%d",&n);
   for(i=0;i<n;i++){
      scanf("%d",&a[i]);
       sum+=a[i];
   }
   max=min=a[0];
   for(i=1;i<n;i++){
      if(a[i]>max)max=a[i];
       if(a[i]<min)min=a[i];
   }
printf("%d %d %lld\n",min,max,sum);

  return 0;

}


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

using vi = vector<int>;
using vll = vector<long long>;

constexpr long long mod = 1000000007;

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

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

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

    int cnt[2] = {0};
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == ')') {
            if (cnt[1] > 0) {
                cnt[1]--;
            } else {
                cnt[0]++;
            }
        } else {
            cnt[1]++;
        }
    }

    string sf;
    for (int i = 0; i < cnt[0]; i++) {
        sf += '(';
    }
    s = sf + s;

    cnt[0] = 0;
    cnt[1] = 0;

    for (int i = s.size() - 1; i >= 0; i--) {
        if (s[i] == '(') {
            if (cnt[1] > 0) {
                cnt[1]--;
            } else {
                cnt[0]++;
            }
        } else {
            cnt[1]++;
        }
    }
    string sb;
    for (int i = 0; i < cnt[0]; i++) {
        sb += ')';
    }
    s = s + sb;
    cout << s << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int num1 = sc.nextInt();
		int num2 = sc.nextInt();
		int sum = num1 + num2;
		String ans = sum % 2 == 0 ? String.valueOf(sum/2) : "IMPOSSIBLE";
		System.out.printf("%s \n", ans);
	}
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
const double eps = 1e-8;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T> ostream& operator << (ostream& os, const set<T>& s) { for (auto si : s) os << si << " "; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { (a += (b % mod + mod)) %= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12);
    int T;
    T = 1;
    while (T--) solve();
}

void solve() {
    int h, n;
    cin >> h >> n;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];
    
    vector<int> dp(h + 1, inf);
    dp[h] = 0;
    for (int i = h; i >= 1; --i) {
        rep(j, n) {
            chmin(dp[max(0, i - a[j])], dp[i] + b[j]);
        }
    }
    cout << dp[0] << endl;
    // cerr << dp << endl;
}


Measured memory_bytes: 3688
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <algorithm>
using namespace std;


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

	vector<int> p;
	for(int i=0;i<n;i++){
		int a;
		cin >> a;
		p.push_back(a);
	}

	int ans = 0;
	for(int i=1;i<n-1;i++){
		if(p[i-1] > p[i] && p[i+1] < p[i]){
			ans++;
		}else if(p[i+1] > p[i] && p[i-1] < p[i]){
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
long long ans;
long long dfs(long long a,long long b)
{
	if(b%a==0)
	{
		return b/a*a*3;  
	}
	return dfs(b%a,a)+b/a*a*3;
}
int main()
{
	long long n,x;
	scanf("%lld%lld",&n,&x);
	printf("%lld",dfs(x,n-x));
}

Measured memory_bytes: 128
from itertools import permutations
n,m=map(int,input().split())
G=[[0]*n for i in range(n)]
for i in range(m):
	a,b=map(int,input().split())
	G[a-1][b-1]=G[b-1][a-1]=1
l=[i+1 for i in range(n-1)]
c=0
for v in permutations(l,n-1):
	L=[0]+[i for i in v]
	if all([G[L[i]][L[i+1]]==1 for i in range(n-1)]):
		c+=1
print(c)

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  ll N, K;
  cin >> N >> K;

  if (N == 1) {
    cout << K << endl;
    return 0;
  }

  cout << setprecision(30) << K * pow(K - 1, N - 1) << endl;

  return 0;
}


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

int main()
{
  i64 N;
  cin >> N;
  vector<i64> a(N);
  for (i64 i = 0; i < N; i++)
    cin >> a[i];
  vector<i64> ans;
  for (i64 i = N; 0 < i; i--)
  {
    for (i64 j = i * 2; j <= N; j += i)
      a[i - 1] = (a[i - 1] + a[j - 1]) % 2;
    if (a[i - 1] == 1)
      ans.push_back(i);
  }
  i64 size = ans.size();
  cout << size << endl;
  for (i64 i = 0; i < size; i++)
    cout << ans[i] << " \n"[i + 1 == size];
  return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(cnt,e) for(ll cnt=0;cnt<e;cnt++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;
ll kaijou[2*100000+3];
ll gyakugen[2*100000+3];
long long ruijou(long long x, long long y){
    if(y==0) return 1;
    else if(y%2==0) return ruijou(x*x%mod,y/2);
    else return x*ruijou(x,y-1)%mod;
}

ll combination(ll n,ll c){
    if(n<c)return 0;
    return ((kaijou[n]*gyakugen[c])%mod)*gyakugen[n-c]%mod;
}
ll mo(ll x){
    ll ans=x%mod;
    if(x>=0)return ans;
    return ans+mod;
}


ll i,j,k;


int main(){
    ll N;
    cin>>N;
    ll K;
    cin>>K;
    ll ans=0;
    for(ll i=N+1;i>=K;i--){
       ll msum=i*(i-1)/2;
       ll usum=N*(N+1)/2-(N-i)*(N-i+1)/2;
       ans+=usum-msum+1;
       ans%=mod;

       
    }
    cout<<ans<<endl;


}


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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int N;
	cin >> N;
	vector<string> a;
	map<string, int> b;
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		a.push_back(s);
		b[s]++;
		if (b[s] >= 2) {
			cout << "No";
			return 0;
		}
	}
	for (int i = 0; i < N - 1; i++) {
		string k;
		string c;
		k = a[i];
		c = a[i+1];
		if (k[k.size() - 1] != c[0]) {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
}

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

int main(){
  int N;
  cin >> N;
  int iAC = 0;
  int iWA = 0;
  int iTLE = 0;
  int iRE = 0;
  for(int i = 0; i < N; i++){
    string s;
    cin >> s;
    if(s == "AC") iAC++;
    else if(s == "WA") iWA++;
    else if(s == "TLE") iTLE++;
    else if(s == "RE") iRE++;
  }
  cout << "AC x " << iAC << endl;
  cout << "WA x " << iWA << endl;
  cout << "TLE x " << iTLE << endl;
  cout << "RE x " << iRE << endl;
}


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

int main () {

    int a[3];

    scanf("%d %d %d", &a[0], &a[1], &a[2]);

    sort(a, a + 3);

    printf("%d\n", (a[1] - a[0]) + (a[2] - a[1]));

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int64_t> name(5, 0);
  for (int i = 0; i < N; i++) {
    string tmp;
    cin >> tmp;
    if (tmp[0] == 'M') name[0]++;
    else if (tmp[0] == 'A') name[1]++;
    else if (tmp[0] == 'R') name[2]++;
    else if (tmp[0] == 'C') name[3]++;
    else if (tmp[0] == 'H') name[4]++;
  }
  int64_t res = 0;
  for (int i = 0; i < 5; i++) {
    for (int j = i+1; j < 5; j++) {
      for (int k = j+1; k < 5; k++) {
        res += (name[i]*name[j]*name[k]);
      }
    }
  }
  cout << res << endl;
}


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

#define sf scanf
#define pf printf
#define rep(i, n) for (i = 0; i < n; ++i)
#define rep0(i, n) for (i = 0; i <= n; ++i)
#define rep1(i, n) for (i = 1; i <= n; ++i)
#define repp(i, a, n) for (i = a; i <= n; ++i)

using namespace std;

typedef long long ll;

int main() {
    int a, b;
    sf("%d %d", &a, &b);

    if (2*b >= a) pf("0\n");
        else pf("%d\n", a-2*b);

    return 0;
}


Measured memory_bytes: 256
N = list(map(int,input().split()))
ans = [1001,1001]
for i in range(N[0]):
	ch = list(map(int,input().split()))
	if((ch[1] <= N[1]) and (ans[0] > ch[0])):
		ans = ch
if(ans[0]==1001):
	print("TLE")
else:
	print(ans[0]) 

Measured memory_bytes: 3060
//BY: YASH JAIN, CF: yashjain0333
#include <bits/stdc++.h>
using namespace std;
#define May_the_fork_be_with_you ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define INF 1e18
#define ll long long
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define int long long
#define N 200005

void solve(){
    int n; cin>>n;
    //first dimension is sum and second is elements to be added
    vector<vector<int>> dp(n+1,vector<int>(n+1,0));
    for(int i=0;i<=n;i++) dp[0][i] = 1;
    for(int i=3;i<=n;i++){
        for(int j=3;j<=n;j++){
            if(j>i) dp[i][j] = dp[i][j-1];
            else {
                dp[i][j] = (dp[i][j-1]+dp[i-j][n])%MOD;
            }
        }
    }
    cout<<dp[n][n];
}

int32_t main(){
    May_the_fork_be_with_you
    int t = 1; 
    // cin>>t;
    while (t--) {
        solve();
	}
}

Measured memory_bytes: 34516
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static String UN = "UNRESTORABLE";
	public static void main(String[] args) {
		int i=0,j=0,k=0;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		HashMap<Integer, Integer> map = new HashMap<>();
		int a = 0;;
		Integer v = null;
		for(i=0;i<n;i++) {
			a = parseInt(sc.next());
			v = map.get(a);
			if(v == null) {
				map.put(a, 1);
			} else {
				map.put(a, v + 1);
			}
		}
		sc.close();
		for(Iterator<Integer> ii = map.keySet().iterator(); ii.hasNext();) {
			if(map.get(ii.next()) % 2 == 0) {
				ii.remove();
			}
		}
		out.println(map.keySet().size());
	}
}


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

const int N = 1000010;
const ll MOD = ll(1e9 + 7);

int n;
ll f[N];

int main() {
    cin >> n;

    f[0] = 1;
    ll sm = 0;

    for (int i = 0; i <= n; i++) {
        f[i] = (f[i] + sm) % MOD;
        if (i >= 2) {
            f[i] = (f[i] - f[i - 2] + MOD) % MOD;
        }
        if (i == n - 1) {
            f[n] = (f[n] + f[i] * (n - 1) % MOD) % MOD;
        } else if (i < n - 1) {
            f[n] = (f[n] + f[i] * (n - 1) % MOD * (n - 1) % MOD) % MOD;
            f[n] = (f[n] + f[i] * (i + 1)) % MOD;
        }
        sm = (sm + f[i]) % MOD;
    }

    cout << f[n] << endl;
}

Measured memory_bytes: 8192
//omajinai c++ atcoder
#include <iostream> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<cmath>
#include<iomanip>
#include<type_traits>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define itn int
#define yes() printf("Yes\n")
#define no() printf("No\n")
typedef long long ll;
constexpr auto mod = 1000000007;
using namespace std;

int main() {
    int n;cin>>n;
    vector<int> b(n);
    int ind;
    rep(i,n-1){
        cin>>ind;
        b[ind-1]++;
    }
    rep(i,n){
        cout<<b[i]<<endl;
    }
}

Measured memory_bytes: 3992
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll n;
ll a[300000];
int main(){
	cin >> n;
	REP(i,n) {
		cin >> a[i];
		a[i]--;
	}
	ll ans = 0;
	REP(i,n) {
		if(i == a[a[i]]) 
			ans++;
	}
	cout << ans / 2 << endl;
	return 0;
}


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

#define PI acos(-1)
#define pb push_back
#define int long long int
#define pi pair<int, int>
#define fir first
#define sec second
#define MAXN 200001
#define MAXL 20
#define mod 1000000007

signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++)
    cin >> v[i];
  int ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      for (int k = j + 1; k < n; k++)
        if (v[i] + v[j] > v[k] && v[i] + v[k] > v[j] && v[k] + v[j] > v[i] && v[i] != v[j] && v[i] != v[k] && v[j] != v[k])
          ans++;
  cout << ans << endl;
}

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

int main(){
  int X,N,D;
  cin>>N>>D>>X;
  vector<int> A(N);
  vector<int> C(D,0);
  for(int i =0;i<N;i++){
    cin>>A.at(i);
  }

  for(int i =0;i<N;i++){
    int Day = 0;
    while(Day<D){
        C.at(Day)++;
        Day+=A.at(i);
    }
  }
  int ans = 0;
  for(int i =0;i<D;i++){
    ans+=C.at(i);
  }
  ans+=X;

  cout<<ans<<endl;
}


Measured memory_bytes: 256
def make_divisors(n):
    divisors = set([])
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    return divisors
N,M = map(int,input().split())
A=make_divisors(M)
ans=0
for i in A:
 if i<=M/N:
  ans=max(ans,i)
print(ans)

Measured memory_bytes: 3064
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramA a = new ProgramA();
            a.main();//実行する

        }

    }
    //ABC178
    class ProgramA
    {
        public void main()
        {
            //入力
            int s = int.Parse(Console.ReadLine());
            //30以上ならYes、それ以外はNoを出力

            for (int i = 0; i < s; i++)
                Console.Write("ACL");


        }
    }

    class ProgramB
    {
        public void main()
        {
            //入力
            int n = int.Parse(Console.ReadLine());
            int[] zorome = new int[n];
            for (int i = 0; i < n; i++)
            {
                string[] s = Console.ReadLine().Split(' ');
                if (int.Parse(s[0]) == int.Parse(s[1]))
                    zorome[i] = 1;
                else
                    zorome[i] = 0;
            }
            int count = 0;
            for(int i = 0;i < n;i++)
            {
                if (zorome[i] == 1)
                    count++;
                else
                    count = 0;

                if (count == 3)
                {
                    Console.WriteLine("Yes");
                    return;
                }

            }
            
            Console.WriteLine("No");

        }
    }

    class ProgramC
    {
        public void main()
        {

            //入力
            long n = long.Parse(Console.ReadLine());

            long count = 0;
            for(int i = 1;i < n;i++)
            {
                count += (n - 1) / i;
            }

            Console.WriteLine(count);

        }

    }

    class ProgramD
    {
        public void main()
        {
            string[] s = Console.ReadLine().Split(' ');
            long n = long.Parse(s[0]);
            long k = long.Parse(s[1]);
            long MOD = 998244353;

            long[] dp = new long[n];
            List<long> list = new List<long>();

            for(int i = 0; i < k;i++)
            {
                string[] t = Console.ReadLine().Split(' ');
                for (int j = int.Parse(t[0]); j <= int.Parse(t[1]); j++)
                    list.Add(j);
            }
            list.Sort();
            dp[0] = 1;
            int num = list.Count();
            for (int i = 0; i < n;i++)
            {
                for (int j = 0; j < num; j++)
                {
                    long temp = list[j];
                    if(i - temp >= 0)
                    {
                        dp[i] += dp[i - temp];
                        dp[i] %= MOD;
                    }

                }
                
                
            }

            Console.WriteLine(dp[n - 1]);

        }
            
    }

    class ProgramE
    {

        public void main()
        {

        }


    }

}






Measured memory_bytes: 27332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+5;
int a[N],b[N],n;
int main(){
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    queue<int> q;
    for(int i=0;i<n;i++){
        if(b[i]-a[i]>=b[(i-1+n)%n]+b[(i+1)%n])
            q.push(i);
    }
    ll ans = 0;
    while (!q.empty()){
        int i = q.front();q.pop();
        int k = (b[i]-a[i])/(b[(i+n-1)%n]+b[(i+1)%n]);
        b[i]-=k*(b[(i-1+n)%n]+b[(i+1)%n]);ans+=k;
        i=(i+n-1)%n;
        if(b[i]-a[i]>=b[(i+n-1)%n]+b[(i+1)%n])
            q.push(i);
        i=(i+2)%n;
        if(b[i]-a[i]>=b[(i+n-1)%n]+b[(i+1)%n])
            q.push(i);
    }
    bool f=1;
    for(int i=0;i<n;i++){
        if(a[i]!=b[i]){
            f=0;
            break;
        }
    }
    if(f)cout<<ans<<endl;
    else cout<<-1<<endl;
}

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

using namespace std;

int main(){
  int N,H;
  vector<int> a;
  vector<int> b;
  cin >> N >> H;
  int amax=0;
  int ia, ib;
  for(int i=0;i<N;i++){
    cin >> ia >> ib;
    a.push_back(ia);
    b.push_back(ib);
    amax = max(amax, ia);
  }
  sort(b.begin(), b.end());
  int count = 0;
  for(int i=N-1; i<N && b[i] > amax;i--){
    H -= b[i];
    count += 1;
    if(H<=0){
      cout << count <<endl;
      return 0;
    }
  }
  //std::cout << "Throw end H/amax"<<H/amax << '\n';
  if(H%amax == 0){
    int ans = H/amax  + count;
    cout << ans<< endl;
  }else{
    int ans = H/amax+1  + count;
    cout << ans<< endl;
  }
  return 0;

}


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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second

ll a[55] , a2[55] , n;

bool check()
{
    for(int i=1; i<n; i++)
        if (a[i+1] < a[i]) return 0;
    return 1;
}

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

    cin >> n;
    for(int i=1; i<=n; i++)
        cin >> a[i] , a2[i]=a[i];

    if (check()) return cout << "YES\n" , 0;

    for(int i=1; i<=n; i++)
    {
        for(int j=i+1; j<=n; j++)
        {
            swap(a[i],a[j]);
            for(int k=1; k<=n; k++)
                a2[k] = a[k];
            if (check())
                return cout << "YES\n" , 0;
            swap(a[i],a[j]);
        }
    }

    cout << "NO\n";
  //

    return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;


void solve()
{
	int r;
	cin >> r;
	cout << r * r;
}

int main()
{
	fastio;
	solve();

	return 0;
}

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

int main() {
	cin.tie(NULL);
	cout.tie(NULL);
	
	// your code goes here
	int k;
	cin>>k;
	
	int p  = k%1000;
	int res=0;
	if(p!=0)res=1000-p;
	
	cout<<res<<'\n';
	return 0;
}

Measured memory_bytes: 3584
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int H, W;
    io.read(H, W);
    auto a = io.read_vec<string>(H);
    for(int i = 0; i < W + 2; i++){
        cout << '#';
    }
    cout << '\n';
    for(int i = 0; i < H; i++){
        cout << '#';
        for(int j = 0; j < W; j++){
            cout << a[i][j];
        }
        cout << "#\n";
    }
    for(int i = 0; i < W + 2; i++){
        cout << '#';
    }
    cout << '\n';
    return 0;
}

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

int main(void) {
  int n, *ar, *sum, i, j;
  if((ar = (int*)malloc(sizeof(int) * 1000000)) == NULL) return 1;
  if((sum = (int*)malloc(sizeof(int) * 1000000)) == NULL) return 1;
  for(i = 1; i < 1000000; ++i) ar[i] = 1, sum[i] = 0;
  for(i = 2; i < 1000; ++i) {
    if(ar[i]) for(j = 2; i * j < 1000000; ++j) ar[i * j] = 0;
  }
  for(i = 2; i < 1000000; ++i) sum[i] = sum[i - 1] + ar[i];
  while(scanf("%d", &n) != EOF) {
    printf("%d\n", sum[n]);
  }
  free(ar);
  free(sum);
  return 0;
}


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

const int mod = 1000000007;
ll modinv(ll a){
    ll b = mod, u = 1, v = 0;
    while(b){
        ll t = a/b;
        a -= t * b; swap(a,b);
        u -= t * v; swap(u,v); 
    }
    u %= mod;
    if(u < 0) u+= mod;
    return u;
}

int main(){
    ll n, k;
    cin >> n >> k;
    if(k>=n-1) k= n-1;

    ll ans;
    if(k==1) ans=0;
    else ans = 1;
    ll combn = 1;
    ll comb1 = 1;
    for(int i = 1; i<=k; i++){
        (combn *= n-i+1)%=mod;
        (combn *= modinv(i))%=mod;
        (comb1 *= n-i)%=mod;
        (comb1 *= modinv(i))%=mod;
        if(combn<0)combn += mod;
        if(comb1<0)comb1 += mod;
        ans += (combn*comb1)%mod;
        ans %= mod;
        if(ans<0) ans += mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<functional>
#include<algorithm>
#include<queue>

using namespace std;

typedef unsigned long long int ll;

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

    ll ans = 0;

    if(n % 2 != 0){
        cout << 0 << endl;
        return 0;
    }

    ll a = 10;
    while(1){
        if(a <= n) ans += n / a;
        else break;
        a *= 5;
    }

    cout << ans << endl;

    return 0;
}

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

int main()
{
	int a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		double y = (double)(a*f - d*c) / (double)(a*e - b*d);
		double x = (double)(c - b*y) / (double)a;
		printf("%4.3f %4.3f\n", x, y);
	}
    return 0;
}

Measured memory_bytes: 3216
#include<cstdio>
#include<cstring>
int main(){
	char s[1000000];
	scanf("%s",s);
	int l=strlen(s);
	char t[(l+3)/2];
	for(int i=0;i<l;i+=2){
		t[i/2]=s[i];
	}
	t[(l+1)/2]=0;
	printf("%s",t);
	return 0;
}

Measured memory_bytes: 384
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int main(){
  string s;
  cin >> s;
  int n = s.length();
  int ans = 0;
  for(int i=0;i<n/2;i++){
    if(s[i] != s[n-i-1]) ans += 1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
def actual(N, A):
    A_desc = sorted(A, reverse=True)

    alice_cards = A_desc[::2]
    bob_cards = A_desc[1::2]

    return sum(alice_cards) - sum(bob_cards)

N = int(input())
A = map(int, input().split())

print(actual(N, A))

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

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

  ll ans = n;
  while (true) {
    n -= 1000;
    if (n <= 0) {
      ans = abs(n);
      break;
    }
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;
const ll MOD=1e9+7;

int n;
ll dp[100010][2];//0が黒1が白
int flag[100010][2];
vvi l(100010,vi(0));

ll ddpp(int now,int frm,int col){
    if (flag[now][col]){
        return dp[now][col];
    }
    else{
        flag[now][col]=1;
        if (l[now].size()==1 && frm!=0){
            dp[now][col]=1;
            return 1;
        }
        else{
            ll ans1=1;
            for (int x:l[now]){
                if (x==frm){
                    continue;
                }
                else{
                    if (col==0){
                        ans1*=ddpp(x,now,1);
                        ans1%=MOD;
                    }
                    else{
                        ans1*=ddpp(x,now,1)+ddpp(x,now,0);
                        ans1%=MOD;
                    }
                }
            }
            dp[now][col]=ans1;
        }
        return dp[now][col];
    }
}


int main() {
    cin>>n;
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        l[a].push_back(b);
        l[b].push_back(a);
    }
    ddpp(1,0,0);
    ll ans1=dp[1][0];
    //cout<<flag[1][0]<<endl;
    memset(flag,0,sizeof(flag));
    //cout<<flag[1][0]<<endl;
    ddpp(1,0,1);
    ll ans2=dp[1][1];
    cout<<(ans1+ans2)%MOD<<endl;
    

    return 0;
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')

typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
const int mod = 1e9 + 7;
ll power(ll a, ll b)
{
    ll ans = 1 % mod;
    while (b > 0)
    {
        if (b & 1)
        {
            ans = ans * a % mod;
        }
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int n;
    cin >> n;
    vector<ll> a(n + 1);
    ll mx = -1;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        mx = max(mx, a[i]);
    }
    int len = 0;
    while (mx)
    {
        mx = mx >>= 1;
        len++;
    }
    vector<ll> cnt0(len + 1), cnt1(len + 1);
    for (int i = 1; i <= n; i++)
    {
        ll cur = a[i];
        int t = 0;
        for (int j = 0; j < len; j++)
        {
            if (cur >> j & 1)
            {
                cnt1[j]++;
            }
            else
            {
                cnt0[j]++;
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < len; i++)
    {
        ans = (ans + cnt0[i] * cnt1[i] % mod * power(2, i) % mod) % mod;
    }
    cout << ans << "\n";
    //cout << len << "\n";
    return 0;
}

Measured memory_bytes: 5552
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) puts("Yes");
    else puts("No");
    return 0;
}

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

int main(){
	int a,b;
	char c;

	while(1){
		cin>>a>>c>>b;
		if(c=='?')break;

		if(c=='+'){
			cout<<a+b<<endl;
		}
		else if(c=='-'){
			cout<<a-b<<endl;
		}
		else if(c=='*'){
			cout<<a*b<<endl;
		}
		else if(c=='/'){
			cout<<a/b<<endl;
		}
	}

	return 0;

}

Measured memory_bytes: 1160
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int firstNumber     = sc.nextInt();
        int secondNumber    = sc.nextInt();
        
        System.out.print(firstNumber / secondNumber);
        System.out.print(" " + firstNumber % secondNumber + " ");
        System.out.printf("%.10f\n", (double) firstNumber / (double) secondNumber);
    }
}


Measured memory_bytes: 26600
#include <bits/stdc++.h>
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define out(s) freopen(s, "w", stdout);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
		freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 1e5 + 5;
string s, t;
int pres[N], pret[N];
signed main() {
	#ifdef BLU
	in("blu.inp");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> s >> t;
	fw (i, 0, s.length()) {
		pres[i] = i ? pres[i - 1] : 0;
		if (s[i] == 'A') pres[i]++;
		else pres[i] += 2;
	}
	fw (i, 0, t.length()) {
		pret[i] = i ? pret[i - 1] : 0;
		if (t[i] == 'A') pret[i]++;
		else pret[i] += 2;
	}
	
	int q;
	cin >> q;
	while (q--) {
		int a1, b1, c1, d1;
		cin >> a1 >> b1 >> c1 >> d1;
		a1--, b1--, c1--, d1--;
		
		int sum1 = pres[b1] - (a1 ? pres[a1 - 1] : 0), sum2 = pret[d1] - (c1 ? pret[c1 - 1] : 0);
		if (sum1 % 3 == sum2 % 3) cout << "YES\n";
		else cout << "NO\n";
	}
	return 0;
}


Measured memory_bytes: 1744
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define EPS 1e-10
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}
ll dx[]={0, 0, -1, 1};
ll dy[]={1, -1, 0, 0};// up,down,left right


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll X, Y;
    cin >> X >> Y ;
    
    ll b = (Y - 2 * X) / 2;
    ll a = X - b;
    
    if( (a * 2 + b * 4) != Y or a < 0 or b < 0) {
        cout << "No" << endl;
    }
    else cout << "Yes" << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <time.h>
#include <complex>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using ld = long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
typedef long long ll;


int main(){


	double L;
	double ans;

	scanf("%lf", &L);

	L = L / 3.0;

	ans = L*L*L;

	printf("%.10f\n", ans);

	return 0;

}
    


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

using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	long long ans = 0, sum = 0;
	map<long long, long long> ma;
	ma[0] = 1;
	for (int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		sum = (sum + a) % m;
		ans += ma[sum]++;
	}
	cout << ans << endl;

	return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<string> S(N);
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        S[i] = s;
    }

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

    long long res = 0, cnt = 0;
    string pre;
    for (int i = 0; i < N; i++) {
        if (S[i] == pre) {
            cnt++;
        } else {
            res += cnt * (cnt - 1) / 2;
            cnt = 1;
        }
        pre = S[i];
    }
    res += cnt * (cnt - 1) / 2;

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 5760