akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int n, x, *ls;
	scanf("%d %d", &n, &x);
	ls = malloc(sizeof(int) * n);
	for (int i=0; i<n; i++) {
		scanf("%d", &ls[i]);
	}

	int var = 0;
	int ans = 1;
	for (int i=0; i<n; i++) {
		var += ls[i];
		if (var <= x) {
			ans++;
		} else {
			printf("%d\n", ans);
			return 0;
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;

int main(){
    string T; cin >> T;
    int N = T.size();

    int k = -1;
    for(int i=0;i<N-1;i++){
        if(T[i] == T[i+1]){
            k = i;
            break;
        }
    }
    if(k != -1){
        k++;
        cout << k << " " << k+1 << endl;
        return 0;
    }
    int l = -1;
    for(int i=0;i<N-2;i++){
        if(T[i] == T[i+2]){
            l = i;
            break;
        }
    }
    if(l != -1){
        l++;
        cout << l << " " << l+2 << endl;
        return 0;
    }else{
        cout << -1 << " " << -1 << endl;
    }
    return 0;
}

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

int main() {
  int k, n;
  cin>> k >> n;
  vector<int> a(n);
  for(int i=0; i < n; i++) cin >> a[i];
  int ans = -1;
  vector<int> b(n+1);
  for(int i=0; i < n-1; i++) {
    ans = max(a[i+1] - a[i], ans);
  }
  ans = max(k-a[n-1]+a[0], ans);
  cout << k-ans << endl;
}


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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

int n;
string s;

int cnt(string& s) {
  int res = 0;
  forn (i,s.size()-1) {
    if (s[i] == 'A' && s[i+1] == 'B') res++;
  }
  return res;
}

int main()
{
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  int start_b = 0;
  int end_a = 0;
  int both = 0;

  int res = 0;

  cin >> n;
  forn(i,n) {
    cin >> s;
    res += cnt(s);
    if (s[0] == 'B' && s[s.size()-1] == 'A') both++;
    else if (s[0] == 'B') start_b++;
    else if (s[s.size()-1] == 'A') end_a++;
  }

  if (both > 1) res += both-1;
  if (both > 0 && end_a > 0) res++, end_a--;
  if (both > 0 && start_b > 0) res++, start_b--;

  cout << res + min(end_a,start_b) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define SF scanf
#define PF printf
#define MAXN 200010
using namespace std;
int n,k,las,tims;
char s[MAXN],p[MAXN];
int main(){
	SF("%d%d",&n,&k);	
	SF("%s",s+1);
	for(int i=1;i<=n;i++)
		s[i]='B'-s[i];
	las=n;
	for(int i=1;i<=min(2*n,k);i++){
		if((s[tims+1]^(tims%2))==1){
			s[tims+1]^=1;
			continue;
		}
		else{
			if(las-tims==0&&n%2==1){
				s[tims+1]^=1;
				continue;	
			}
		}
		int add=(las-tims>=1);
		tims+=add;
		while(las-tims>=n%2+1&&(s[las]^(tims%2))==(n+tims-las+1)%2)
			las--;
	//PF("[%d]",las);
	}
	//PF("[%d %d]",las,tims);
	for(int i=1;i<=max(1,las-tims);i++)
		p[i]='B'-(s[i+tims]^(tims%2));
	for(int i=max(2,las-tims+1);i<=n;i++)
		p[i]='B'-(n-i+1)%2;
	if(k>=2*n){
		int t=(k-2*n)%2;
		if(n%2==1&&t==1)	
			p[1]='A'+'B'-p[1];
		for(int i=2;i<=n;i++)
			p[i]='B'-(n-i+1)%2;
	}
	PF("%s",p+1);
}

Measured memory_bytes: 2124
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int outgo[202020];
int du[202020];
int a[202020];
struct Edge
{
	int val,next;
}edges[202020];
int first[202020];
int te=1;
int cnt;
int visit[202020];
inline int get(int now)
{
	cnt++;
	for(int e=first[now];e;e=edges[e].next)
		visit[edges[e].val]=cnt;
	int i;
	for(i=0;visit[i]==cnt;i++);
	return i;
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&outgo[i]);
		du[outgo[i]]++;
	}
	queue<int> q;
	for(int i=1;i<=n;i++)
		if(!du[i])
			q.push(i);
	int visitcnt=0;
	while(!q.empty())
	{
		int now=q.front();
		q.pop();
		visitcnt++;
		int to=outgo[now];
		a[now]=get(now);
		te++;
		edges[te].val=a[now];
		edges[te].next=first[to];
		first[to]=te;
		if(!(--du[to]))
			q.push(to);
	}
	if((n-visitcnt)%2==0)
	{
		puts("POSSIBLE");
		return 0;
	}
	int k=-1;
	for(int i=1;i<=n;i++)
		if(du[i])
		{
			int tmp=get(i);
			if(k==-1)
				k=tmp;
			if(k!=tmp)
			{
				puts("POSSIBLE");
				return 0;
			}
		}
	puts("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 5248
#include<cstdio>
#include<algorithm>
using namespace std;
int a,s,d,f,g,h[41][41];
int z,x,c;
void fanc(int,int);
int main(void)
{
	int i,j;
	while(1){
		c=0;
		scanf("%d %d",&a,&s);
		if(a==0&&s==0) break;
		for(i=0;i<a;i++) for(j=0;j<s;j++) h[i][j]=0;
		scanf("%d",&d);
		for(i=0;i<d;i++){
			scanf("%d %d",&f,&g);
			h[f-1][g-1]=-1;
		}
		z=0;
		x=0;
		fanc(z,x);
		printf("%d\n",c);
	}
	return 0;
}
void fanc(int z,int x){
	int i,j;
	if(z+1<a&&h[z+1][x]==0) fanc(z+1,x);
	if(x+1<s&&h[z][x+1]==0) fanc(z,x+1);
	if(z==a-1&&x==s-1) c++;
}

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

int main() {
  string a;
  cin >> a;
  for (int i = 0; i < a.size(); i++) {
    if (a.at(i) != 'x') {
      a.at(i) = 'x';
    }
  }
  cout << a << endl;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
	static Scanner in = new Scanner(System.in);
	static boolean[][] r;
	public static void main(String[] args){
		int A = in.nextInt(), B  = in.nextInt(), C = in.nextInt();
		
		for(int i = 1; i < B; i++){
			if((i * A) % B == C){
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");
	}
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX =2000007;
const int MOD = 998244353;
//

     signed main(){
     string s,t;int ans=0;
     cin>>s>>t;
     for(int i=0;i<s.size();i++)if(s[i]!=t[i])ans++;
     cout<<ans<<endl;

     }


 


 






    





      

        


Measured memory_bytes: 3920
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    s = input()
    a = s[0]
    b = ""
    found_a = False
    found_b = False
    for si in s[1:]:
        if si != a:
            if si != b:
                b = si
            else:
                found_b = True
        else:
            found_a = True

    if found_a and found_b:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 38384
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;




int main(){

	int W,a,b;

	scanf("%d %d %d",&W,&a,&b);


	if(b+W <= a){

		printf("%d\n",a-(b+W));

	}else if(a+W <= b){

		printf("%d\n",b-(a+W));

	}else{

		printf("0\n");
	}

	return 0;
}


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

int main() {
  
  while (true) {
    
    int n, x; cin >> n >> x; int count = 0;
    
    if (n == 0 && x == 0) return 0;
    
    for (int i = 1; i <= n - 2; i++) {
      for (int j = i + 1; j <= n - 1; j++) {
        for (int k = j + 1; k <= n; k++) {
          if ((i + j + k) == x) count++;
        }
      }
    }
    
    cout << count << endl;
    
  }
  
}


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

typedef long long ll;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

const int MOD = 1e9 + 7 ;
const double PI = 2 * acos(0.0) ;

int main()
{
    ll n, x, flag = 0 ;
    cin >> n ;

    for (int i = 0; i < n; i++) {
        cin >> x ;
        if (x % 2 == 0) {
            if (x % 3 == 0 or x % 5 == 0)   continue ;
            else {
                flag = 1 ;
            }
        }
    }
    if (flag)   cout << "DENIED" << endl ;
    else    cout << "APPROVED" << endl ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"
#define fcout cout << fixed << setprecision(18)

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926535
/*
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
*/
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1
#define LINF 1000000000000000001 // 1e18+1

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------
ll n,h,w;
ll a,b;

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

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

  cin>>n>>h>>w;
  int cnt=0;
  REP(i,n){
    cin>>a>>b;
    if(a >= h && b >= w)cnt++;
  }
  P(cnt);
  return 0;
}


Measured memory_bytes: 256
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>
#include <cstdint>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef unsigned long long		SQWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int X, Y;
	cin >> X >> Y;
	cout << X + Y / 2 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
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; }
//const ll INF = 1LL << 60;
//const int INF = 1001001001;

int main(void){
    int n;
    cin >> n;
    int a[n+1]={0};
    FOR(i,1,n){
        int A;
        cin >> A;
        a[A]++;
    }
    for(int i=1;i<=n;i++) cout << a[i] << endl;

    return 0;
}

Measured memory_bytes: 4400
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <functional>
#include <queue>
#include <cmath>
#include <utility>

using namespace std;

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

int n,m;
vector<int> a;

signed main()
{
	cin>>n>>m;
	a.resize(n);
	rep(i,n)cin>>a[i];
	sort(begin(a),end(a));
	//rep(i,n)printf("%lld%c",a[i],i==n-1?'\n':' ');

	vector<pair<int,int> > v;
	rep(i,m){
		int b,c;cin>>b>>c;
		v.push_back(pair<int,int>(c, b));
	}

	sort(begin(v),end(v),greater<pair<int,int>>());

	int cur = 0;
	int pos = 0;
	while (1) {
		rep(i, v[cur].second) {
			if (a[pos] >= v[cur].first) goto end;
			a[pos] = v[cur].first;
			pos++;
			if (pos >= n) goto end;
		}
		cur++;
		if (cur >= m) goto end;
	}
end:;

	int sum = 0;
	rep(i, n) sum += a[i];
	cout << sum << endl;
}


Measured memory_bytes: 3188
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

class MainClass {
  public static void Main (string[] args) {
    //入力
    var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    var N = input[0];
    var M = input[1];
    var list = new List<List<int>>();
    var clist = new List<List<int>>();
    var anslist = new List<int>();

    for(var i = 0; i < N; i++){
      list.Add(Console.ReadLine().Split(' ').Select(int.Parse).ToList());
    }
    for(var i = 0; i < M; i++){
      clist.Add(Console.ReadLine().Split(' ').Select(int.Parse).ToList());
    }
    //処理
    for(var i = 0; i < N; i++){
      var mlist = new List<int>();
      for(var j = 0; j < M; j++){
        mlist.Add(Math.Abs(list[i][0] - clist[j][0]) + Math.Abs(list[i][1] - clist[j][1]));
      }
      anslist.Add(mlist.IndexOf(mlist.Min()) + 1);

    }

    //出力
    anslist.ForEach(Console.WriteLine);
    
  }
}

Measured memory_bytes: 13524
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int main(void) {
    while (true) {
        int n;cin>>n;
        if (n == 0) break;
        double s[n];
        double sum = 0;
        for (int i = 0; i < n; i++) {
            cin>>s[i];
            sum += s[i];
        }
        double avg = sum / n;
        double vl2 = 0;
        for (int i = 0; i < n; i++) {
            vl2 += pow(s[i] - avg, 2);
        }
        printf("%.5f\n", sqrt(vl2 / n));
    }
    return 0;
}


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

int main (void) {
  int K;
  cin >> K;
  
  int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << a[K-1] << endl;
  
  return 0;
  
}
  


Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello
{
    public static void Main()
    {
        //アルファベットテーブルを作成する
        var alpha = new string[26] { "a", "b", "c", "d", "e",
                                     "f", "g", "h", "i", "j", "k",
                                     "l", "m", "n", "o", "p", "q",
                                     "r", "s", "t", "u", "v", "w",
                                     "x", "y", "z" };
        var N = long.Parse(Console.ReadLine());
        var e = 1L;
        var cnt = 1;
        while (e * 26 < N)
        {
            N = N - (long)Math.Pow(26, cnt);
            //26の階乗の数より小さいかチェックするための変数を設ける
            e *= 26;
            cnt++;
        }
        N--;
        var ans = "";
        //最後尾の文字列から順に回答を組み立てていく
        for (int num = cnt - 1; 0 <= num; num--)
        {
            ans = ans + alpha[N % 26];
            N /= 26;
        }
        //順番が逆順なので反転して直す
        Console.WriteLine(String.Join("", ans.Reverse()));
    }
}


Measured memory_bytes: 28604
def LCS(X, Y):
    n = len(X)
    m = len(Y)
    T = [0]*(n+1)
    
    for j in range(m):
        T_old = T[:]
        c = Y[j]
        for i in range(n):
            if X[i] == c:
                T[i] = T_old[i-1] + 1
            elif T[i-1] > T[i]:
                T[i] = T[i-1]            
    return T[len(X)-1] 



q = int(input())
for cnt in range(q):
    X = input()
    Y = input()
    print(LCS(X, Y))


Measured memory_bytes: 5624
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
#define ll long long
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
static const int MAX = 200005;

ll A[10][10];

int main(){
    string s;
    cin >> s;
    int N = atoi(s.c_str());
    ll ans = 0;
    int n = s.size();
    
    for(int i = 1; i <= N; i++){
        string t = to_string(i);
        A[t[0] - '0'][t[t.size()-1] - '0']++;
    }
    for(int i = 1; i <= N; i++){
        string t = to_string(i);
         ans += A[t[t.size()-1] - '0'][t[0] - '0'];        
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>
#define N 5000


int main(){
	int s[N];
	int i, j;
	int n;
	int sum, msum;

	for(;;){
		scanf("%d", &n);
		if( n==0 )
			break;

		for( i=0; i<n; i++ )
			scanf("%d", &s[i]);

		for( i=0; i<n; i++ ){
			for( j=i, sum=0; j<n; j++ ){
				sum += s[j];
				if( i==0 && j==0 )
					msum = sum;
				if( sum > msum )
					msum = sum;
			}
		}
		printf("%d\n", msum);
	}
	return 0;
}

Measured memory_bytes: 616
#!/usr/bin/env python3

def main():
    s = list(input())
    k = int(input())
    n = len(s)
    for i in reversed(range(n)):
        if s[i] != "1":
            s[i:n] = s[i] * (n - i)
    if k <= n:
        print(s[k - 1])
    else:
        print(s[-1])

main()


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;

    int ans = 1;
    for (int A=1; A*A<=M; A++)
    {
        if (M%A != 0) continue;

        int B = M/A;

        if((long)A*N <= M) ans = max(ans, A);
        if((long)B*N <= M) ans = max(ans, B);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    long long a,b,c,d,e,f,g=0;
    cin>>a>>b>>c;
    if(a==b&&b==c&&c%2==0){
        cout<<-1<<endl;
        return 0;
    }
    while(a%2==0&&b%2==0&&c%2==0){
        g++;
        d=(b+c)/2;
        e=(c+a)/2;
        f=(a+b)/2;
        a=d;
        b=e;
        c=f;
    }
    cout<<g<<endl;
}


Measured memory_bytes: 256
N = gets.to_i
A = Array.new(N) { Array.new(gets.to_i) { gets.split.map(&:to_i) } }

def check(liar)
  person = [1] * N; liar.each {|i| person[i] = 0 }
  N.times do |i|
    cond = person[i]
    A[i].each do |j,a|
      next if person[i] == 0
      return false if person[j-1] != a
    end
  end
  return true
end

ans = 0
N.times do |i|
  N.times.to_a.combination(i).each do |liar|
    if check(liar)
      ans = N - i
      break
    end
  end
  break if ans != 0
end
puts ans


Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> 
#include <iostream> 
using namespace __gnu_pbds; 
using namespace std; 
typedef tree<
pair<int, int>,
null_type,
less<pair<int, int>>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
# define ll  long long int
# define ld  long double
# define pb push_back
# define pp pop_back
# define ff first
# define ss second
# define mp make_pair
# define ac accumulate
# define mod 1000000007
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
int  main()
{
    // #ifndef ONLINE_JUDGE
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // #endif
   IOS;
   ll a,b,c;
   cin>>a>>b>>c;
   ll s=a+b+c;
   if(s>=22)
   {
    cout<<"bust";
   }
   else
    cout<<"win";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
#define SortAsc(c) std::sort(c.begin(), c.end())
#define SortDesc(c) std::sort(c.rbegin(), c.rend())
int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, 1, -1};

int main()
{
    int a;
    for(int i =0;i<5;i++){
      cin >> a;
      if (a==0){
        cout << i+1 << endl;
        return 0;
      }
    }
}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>

using namespace std;

using ll = long long;

int main() {
	ll n, m;
	cin >> n >> m;
	vector<int> alreadyAC(n, 0);
	vector<int> WA(n,0);
	ll ac = 0;
	ll wa = 0;

	for (int i = 0; i < m; i++) {
		int p;
		string s;
		cin >> p >> s;

		p --;

		if (s == "AC") {
			if (alreadyAC[p] == 1) {
				continue;
			}
			alreadyAC[p] = 1;
			ac++;
			continue;

		} else {
			if (alreadyAC[p] == 1) {
				continue;
			}
			WA[p]++;
		}

	}
	int sum_wa = 0;
	for (int i = 0; i < n; i++) {
		if (alreadyAC[i] == 1) {
			sum_wa += WA[i];
		}
	}

	cout << ac << " " << sum_wa << endl;


	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
int a,b;
cin>>a>>b;
if (a>0) {
  cout<<"Positive"<<endl;
  return 0;
}
if (a<=0 and b>=0){
  cout<<"Zero"<<endl;
  return 0;
}
if((b-a)%2==1){
  cout<<"Positive"<<endl;
}else{
  cout<<"Negative"<<endl;
}

return 0;
}


Measured memory_bytes: 256
#include<map>
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<ctime>
#include<vector>
#include<bitset>
#include<string>
#include<cstdio>
#include<numeric>
#include<utility>
#include<sstream>
#include<cstdlib>
#include<iomanip>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#define _USE_MATH_DEFINES
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define endl "\n"
typedef long long int lli;
typedef unsigned long long int uli;
const uli mod = 1e9 + 7;
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);


    char a;
    cin >> a;
    if(a >= 'A' && a <= 'Z')
        cout << 'A' << endl;
    else
        cout << 'a' << endl;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

typedef unsigned long long ULLONG;
typedef long long LLONG;

template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}

static const long long MOD_NUM = 1000000007LL;

static void B_task();

int main()
{
	B_task();
	fflush(stdout);
	return 0;
}

static void B_task()
{
	LLONG H, N;
	get2int<LLONG>(H, N);

	LLONG tdmg = 0;
	for (int i = 0; i < N; i++) {
		int dmg;
		get1int(dmg);

		tdmg += dmg;
	}

	if (tdmg >= H) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
}


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

int main(){
    long long ans,o=1,p=1,mod=1000000007;
    int n,m;
    scanf("%d %d",&n,&m);
    if (abs(n-m)>1) {
        printf("0\n");
    } else {
        for (int i=1;i<=min(n,m);i++) {
            o*=i;
            p*=i;
            o%=mod;
            p%=mod;
        }
        if (abs(n-m)%2) {
            o*=max(n,m);
            o%=mod;
            ans=(o*p)%mod;
        } else {
            ans=(o*p*2)%mod;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


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

using namespace std;

int gcd (long long int a, long long int b) {
	if (b == 0)
		return a;
	else
		return gcd (b, a % b);
}

long long int lcd(long long int a, long long int b) {
    return (a * b) / gcd(a, b);
}

long long int fact(long long int N) {
    long long int result = 1;
    while(N > 0) {
        result = result * N % MOD;
        N--;
    }
    return result;
}

long long int cnk(long long int n, long long int k) {
    return fact(n) / (fact(k) * fact(n - k));
}

long long int binpow(long long int a, long long int n) {
    long long int result = 1;
    while(n != 0) {
        if(n % 2 == 1) {
            result = result * a % MOD;
        }
        a = a * a % MOD;
        n /= 2;
    }
    return result;
}

long long int powermod(long long int base, long long int power) {
    if (power == 0) {
        return 1;
    }
    else {
        long long int cur = powermod(base, power / 2);
        cur = cur * cur;
        cur = cur % MOD;
        if (power % 2 == 1)
            cur = cur * base;
        cur = cur % MOD;
        return cur;
    }
}

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

    int n, m[82] = {0};
    cin >> n;
    for(int i = 1; i < 10; i++) {
        for(int j = i; j < 10; j++) {
            if(n == i * j) {
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	
	int h;
	int a;
	scanf("%d %d",&h,&a);
	int d;
	d = h % a;
	int c;
	c = h / a;

	
	if(d>=1){
		printf("%d",c+1);
	}
	if(d<1){
		printf("%d",c);
	}
	
	
	
	
	return 0;
}

Measured memory_bytes: 1736
import java.util.Scanner;

/**
 * Created by sougo on 2016/12/18.
 */


public class Main {
    public static void main(String[] args){

        try {
            Scanner scan = new Scanner(System.in);
            int a = scan.nextInt();
            String b = scan.next();
            int c = scan.nextInt();

            if (b.equals("+")) {
                a = a+c;
                System.out.println(a);
            } else {
                a= a-c;
                System.out.println(a);
            }
        }catch (Exception e){}
    }


}


Measured memory_bytes: 10188
#B問題

#ABSの定石使うとなぜかRE

#今回はPython解説サイト参照

#①入力を文字列で受け取る→②一文字ずつ整数に変換して、forループで回しながら足し算する

N = input()
cur = 0

for i in N:
    cur += int(i)

if cur % 9 == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9108
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int ans = solve();
		System.out.println(ans);
	}
	
	public static int solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] p = new int[n];
		
		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt() - 1;
		}
		sc.close();
		
		int count = 0;
		for (int i = 0; i < n; i++) {
			if (p[i] == i) {
				count++;
				i++;
			}
		}
		return count;
	}
}

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

struct Line{ int h,p,q; };

bool CmpLine(const Line& l, const Line& r)
{ return (l.h > r.h); }

int main(void)
{
	while(1)
	{
		int n, m, a;
		cin >> n >> m >> a;
		if(n==0 && m==0 && a==0)
			break;

		Line* l=new Line[m];
		for(int i=0; i<m; i++)
			cin >> l[i].h >> l[i].p >> l[i].q;
		sort(l, l+m, CmpLine);

		int currH   = l[0].h;
		int currPos = a;
		for(int i=0; i<m; i++)
		{
			if(currH > l[i].h)currH = l[i].h;
			
			     if(currPos == l[i].p){currPos=l[i].q;currH--;}
			else if(currPos == l[i].q){currPos=l[i].p;currH--;}
		}

		cout << currPos << endl;
		delete [] l;
	}
	return 0;
}

Measured memory_bytes: 1228
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
import numpy as np
#decimal.getcontext().prec = 10

N, L = MAP()
a = LIST()

for i in range(1, N):
	if L <= a[i] + a[i-1]:
		idx = i
		break
else:
	print("Impossible")
	exit()

print("Possible")

for i in range(1, idx):
	print(i)

for i in range(N-1, idx-1, -1):
	print(i)

Measured memory_bytes: 38584
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

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

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return float64(i)
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	sc.Split(bufio.ScanWords)
	n, k := readInt(), readInt()

	a := make([]int, n+1)
	for i := 1; i < n+1; i++ {
		a[i] = readInt()
	}

	s := make([]int, 0, 2*int(1e5))
	seen := make([]int, n+1)
	for i := 0; i < n+1; i++ {
		seen[i] = -1
	}

	v := 1
	for seen[v] == -1 {
		seen[v] = len(s)
		s = append(s, v)
		v = a[v]
	}
	loop := s[seen[v]:len(s)]

	if k < len(s) {
		fmt.Println(s[k])
	} else {
		r := (k - seen[v]) % (len(loop))
		fmt.Println(loop[r])
	}
}


Measured memory_bytes: 8016
#include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
using namespace std;

#define rep(i, n) repi(i, 0, n)
#define rep1(i, n) repi(i, 1, n + 1)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)

typedef long long ll;

int main()
{
    int n, t;
    cin >> n >> t;
    vector<int> cs;
    rep(i, n) {
        int ci, ti;
        cin >> ci >> ti;
        if (ti <= t) {
            cs.push_back(ci);
        }
    }
    sort(cs.begin(), cs.end());
    if (cs.size() == 0) {
        cout << "TLE" << endl;
    } else {
        cout << cs[0] << endl;
    }
    return 0;
}

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

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	if (n % 1000 == 0) cout << 0; else cout << 1000 - (n % 1000);
	return 0;
}

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

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

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int main(){
    int x;
    cin >> x;
    if (x==0) {
        cout << 1 << endl;
    }
    else {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 3616
#include <iostream>

using namespace std;

int main(void){
    int a[5],k,flag=0;
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> k;
    for(int i=0;i<5;i++){
        for(int j=i;j<5;j++){
            if(abs(a[i]-a[j])>k)flag = 1;
        }
    }
    if(flag)cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <climits>
#include <iomanip>
#include <sstream>
#include <list>
#include <iterator>
using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"


template <typename A, typename B> 
ostream& operator<<(ostream& os, pair<A,B> &p) {
	return os << "(" << p.first << "," << p.second << ")";
} 

template <typename A> 
ostream& operator<<(ostream& os, vector<A> &p) {
	for (auto &x : p) {
		os << x << " ";
	}
	os << endl;
	return os;
} 

vector<int> primes;
void siv(int n) {
	vector<bool> is_prime(n+1, true);
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= n; i++) {
		if (is_prime[i]) {
			primes.push_back(i);
		}
	    if (is_prime[i] && (long long)i * i <= n) {
	        for (int j = i * i; j <= n; j += i)
	            is_prime[j] = false;
	    }
	}
}

void foo(char *x, char *y) {
	while (*y != '\0') {
		*x = *y;
		x++, y++;
	}
	*x = '\0';
}

void xg() {
	int n, a, b;
	cin >> n;
	double total = 0, curr = 0;
	while (n--) {
		cin >> a >> b;
		total += b * 10;
		curr += a * b;
	}

	cout << "Current : " << curr << " / " << total << endl;
	cout << "% : " << curr / total * 10<< endl;
}

template <typename T>
T gcd(T a, T b) {
	if (a < 0) a *= -1;
	if (b < 0) b *= -1;
	
	while (b != 0) {
		T temp = a;
		a = b;
		b = temp % b;
	}

	return a;
}


// cout << setfill('0') << setw(5) << number < endl;
// while(getline(cin, s)) { .. } | `s` is a string

bool qsortComparator(const int &a, const int &b) {
	return a > b;
}

int partition(int lo, int hi, vector<int> &a) {
	int i = lo, j = hi + 1, element = a[lo]; // start element as pivot.
	while (true) {
		while (qsortComparator(a[++i], element)) {
			if (i == hi)
				break;
		}

		while (qsortComparator(element, a[--j])) {
			if (j == lo)
				break;
		}

		if (i >= j)
			break;

		swap(a[i], a[j]);
	}

	swap(a[lo], a[j]);
	return j;
}


void qsort(int lo, int hi, vector<int> &a) {
	if (lo >= hi)
		return ;
	int pivot = partition(lo, hi, a);
	qsort(lo, pivot - 1, a);
	qsort(pivot + 1, hi, a);
}

void getArr(vector<int> &a) {
	for (auto &it : a)
		cin >> it;
	sort(a.rbegin(), a.rend());
}

void solve() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (auto &it : a)
		cin >> it;

	sort(a.begin(), a.end());
	int ans = 0;
	for (int i = 0; i < a.size(); ++i) {
		for (int j = i + 1; j < a.size(); ++j) {
			if (a[i] == a[j])
				continue;
			for (int k = j + 1; k < a.size(); ++k) {
				if (a[i] == a[k] || a[j] == a[k] || a[i] + a[j] <= a[k])
					continue;
				// cout << i +1 << " " << j + 1 << " " <<  k + 1 << endl;
				ans++;
			}
		}
	}

	cout << ans << endl;
}


int main(){
	IOS;
	
	

	int t = 1;
	// cin >> t;
	while (t--) 
		solve();

	return 0;
}



























 

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

int main(){
  int a,b,c,d,e,f,i,j,k,l,s=0,w=100;
  cin>>a>>b>>c>>d>>e>>f;a*=100;b*=100;
  for(i=0;i<=f;i+=a)
  for(j=0;i+j<=f;j+=b)
  for(k=0;i+j+k<=f;k+=c)
  for(l=0;i+j+k+l<=f;l+=d)
  if((i||j)&&((k+l)*(100+e)<=e*(i+j+k+l)&&s*(i+j+k+l)<=(k+l)*(w+s))){
    w=i+j,s=k+l;
  }
  cout<<w+s<<" "<<s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    for(int i=0;i<m;i++) cin >> x[i];
    sort(be(x));
    vector<int> y;
    int ans = 0;
    for(int i=1;i<m;i++){
    	y.pb(x[i] - x[i-1]);
    	ans += y[i-1];
    }
    sort(be(y));
    n--;
    reverse(be(y));
    for(int i=0;i<n && i<m-1;i++){
    	ans -= y[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
#define MAX_N 100010
int prime[MAX_N];         // i番目の素数
bool is_prime[MAX_N + 1]; // is_prime[i]がtrueならiは素数

int sieve(int n) {
    int p = 0;
    for(int i = 0; i <= n; i++) {
        is_prime[i] = true;
    }
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i < n + 1; i++) {
        if(is_prime[i]) {
            prime[p++] = i;
            for(int j = 2 * i; j <= n; j += i) {
                is_prime[j] = false;
            }
        }
    }
    return p;
}

int main() {
    long long Q;
    cin >> Q;
    sieve(100010);
    int ruiseki[100010];
    for(int i = 1; i < 100010; i++) {
        if(is_prime[i] and is_prime[(i + 1) / 2]) {
            ruiseki[i] = ruiseki[i - 1] + 1;
        } else {
            ruiseki[i] = ruiseki[i - 1];
        }
    }
    REP(i, Q) {
        int l;
        int r;
        cin >> l >> r;
        cout << ruiseki[r] - ruiseki[l - 1] << endl;
    }
}

Measured memory_bytes: 1152
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int g[201][201];

int gcd(int a, int b) {
    return (b == 0 ? a : gcd(b, a%b));
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n = gi();
    for (int i = 1; i <= n; i++)
        for (int j = i; j <= n; j++) {
            int x = gcd(i, j);
            g[i][j] = x;
            g[j][i] = x;
        }

    int s = 0;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
            for (int k = 1; k <= n; k++)
                s += g[i][g[j][k]];

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

    return 0;
}


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

#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define pb push_back
#define mp make_pair
#define debug(x) cout<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#define debug2(x, y) cout<<__LINE__<<": "<<#x<<" = "<<x<<\
                                     "  "<<#y<<" = "<<y<<endl;
#define all(c) (c).begin(), (c).end()
#define F first
#define S second
#define UNIQUE(c) \
    sort(all(c)); \
    (c).resize(unique(all(c))-c.begin());

#define PI 3.1415926535897932384626433832795028841971

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

const int INF = 0x3f3f3f3f;
const double EPS = 1e-9;

inline int cmp(double x, double y = 0, double tol = EPS){
  return ((x <= y+tol) ? (x+tol < y) ? -1:0:1);
}

int main() {
  double L;
  double side;

  cin >> L;

  side = L / 3.0;

  double vol = side * side * side;

  printf("%.10lf\n", vol);

	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
    return int(input())

def rl():
    return list(map(int, input().split()))


def solve():
    n, k = rl()
    P = rl()
    print (sum(sorted(P)[:k]))






mode = 's'

if mode == 'T':
    t = ri()
    for i in range(t):
        solve()
else:
    solve()


Measured memory_bytes: 65720
import java.util.*;
import java.io.*;
public class Main {
  public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int d = sc.nextInt();
   int t = sc.nextInt();
   int s = sc.nextInt();
   int dif = t * s;
   if (d<=t*s){
     System.out.println("Yes");
   }
   else{
     System.out.println("No");
  }
}
}


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

int main(){
  int n,i;
  scanf("%d",&n);
  int a[n];
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
  }
  for(i=n;2<=i;i--){
    printf("%d ",a[i]);
  }
  printf("%d\n",a[1]);

  return 0;
}


Measured memory_bytes: 1984
#include<bits/stdc++.h>
#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define per(i,n,j) for(int i=(n);i>=(j);i--)
using ll=long long;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return(a%b)?gcd(b,a%b):b;}
ll lcm(ll a,ll b){return(a*b/gcd(a,b));}
const ll INF=1LL<<60;

int n,X;
vector<int> x(100100);

int main(){
    cin>>n>>X;
    rep(i,0,n){
        cin>>x[i];
        x[i]=abs(x[i]-X);
    }

    int g=gcd(x[0],x[1]);
    rep(i,2,n) g=gcd(g,x[i]);
    cout<<g<<"\n";
    return 0;
}


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

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


Measured memory_bytes: 256
#!/usr/bin/env python3
a = list(map(int, input().split()))
k = int(input())
ans = 0
for it in range(3 ** k):
    i = it
    # a_i = a #　こうするとa も変更される
    a_i = [a[0], a[1], a[2]]
    cnt = 0
    while cnt < k:
        j = i % 3
        i //= 3
        # 選ぶのはa_i[j]
        a_i[j] *= 2
        cnt += 1
        if cnt == k:
            # print(a_i)
            if a_i[0] < a_i[1] and a_i[1] < a_i[2]:
                ans += 1
if ans > 0:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 9200
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の標準入力
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z;
		Integer nArray[] = new Integer[n];
		int mArray[] = new int[m];
		for(int i = 0; i < n; i++) {
			nArray[i] = sc.nextInt();
		}
		for(int j = 0; j < m; j++) {
			mArray[j] = sc.nextInt();
		}
		Arrays.sort(nArray, Collections.reverseOrder());
		Arrays.sort(mArray);
		z = mArray[0];
		if(x < z && z <= y && nArray[0] < z) {
			System.out.println("No War");
		} else {
			System.out.println("War");
		}
		sc.close();
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cerr<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<ll,ll>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

template<typename T>
struct WeightedUnionFind {
    vector<int> d;
    vector<T> ws;

    WeightedUnionFind(int n) : d(n, -1), ws(n) {}

    int root(int x){
        if(d[x] < 0) return x;
        auto par = root(d[x]);
        ws[x] += ws[d[x]];
        return d[x] = par;
    }

    T weight(int t){
        root(t);
        return ws[t];
    }

    bool unite(int x, int y, T w){
        w += weight(x);
        w -= weight(y);
        x = root(x), y = root(y);
        if(x == y) return false;
        if(d[x] > d[y]) swap(x, y), w *= -1;
        d[x] += d[y];
        d[y] = x;
        ws[y] = w;
        return true;
    }

    T diff(int x, int y){
        return weight(y) - weight(x);
    }

    bool same(int x, int y){
        return root(x) == root(y);
    }
};

int main(){
    int n,m;cin >> n >> m;
    WeightedUnionFind<int> uf(n);
    rep(i,m){
        int l,r,d;cin >> l >> r >> d;
        --l;--r;
        if(uf.same(l,r)){
            if(uf.diff(l,r) != d){
                cout << "No" << endl;
                return 0;
            }
        }else{
            uf.unite(l, r, d);
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 1024
"use strict";

function main(input) {
  input = input.trim().split(" ");
  const H = parseInt(input[2]) - parseInt(input[0]);
  const M = parseInt(input[3]) - parseInt(input[1]);
  let minute = H * 60;

  minute = minute + M - parseInt(input[4]);
  console.log(minute);
}

main(require("fs").readFileSync("/dev/stdin", "utf-8"));


Measured memory_bytes: 29628
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

typedef tuple<int, int, int> T;
// get<K>(tuple型の変数)


int main(void){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    vector<int> p(n);
    rep(i, n) cin >> p[i], --p[i];

    vector<int> dp(n+5, 0);
    rep(i, n){
        if(p[i]==0) dp[p[i]]=1;
        else dp[p[i]]=dp[p[i]-1]+1;
    }
    int Mv=0;
    rep(i, n) chmax(Mv, dp[i]);
    cout << n-Mv << endl;

    return 0;
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % 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 modpow(ll a, ll n, ll mod) {
  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(0);
  ios::sync_with_stdio(false);

  ll N, L;
  cin >> N >> L;
  
  map<ll, int> mp;

  ll M = L;
  for(ll i = 2; i * i <= L; i++){

    while(M % i == 0){
      M = M / i;
      mp[i]++;
    }
  }

  if(M != 1){
    mp[M]++;
  }

  ll ans = 1;

  for(auto itr = mp.begin(); itr != mp.end(); itr++){

    if(itr->second >= N){

      rep(j, itr->second / N){
        ans *= itr->first;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256