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

#define int long long
typedef pair<int, int> P;
typedef pair<P, int> Pp;

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

int n;
map<int, int> G[100000];
map<int, int> used[100000];
map<int, int> zipx, zipy;
bool f = false;

void dfs(int x, int y, int c) {
  // cout << x << " " << y << " " << c << endl;
  if ( f ) return;
  int zx = zipx[x], zy = zipy[y];  
  if ( !G[zx][zy] ) return;  
  if ( used[zx][zy] && used[zx][zy] != c ) {    
    f = true;
    return;    
  } else if ( used[zx][zy] ) {
    return;    
  }
  used[zx][zy] = c;
  int d = G[zx][zy]-1;  
  for ( int i = 0; i < 4; i++ ) {
    int nx = x+dx[i], ny = y+dy[i];    
    if ( d == i ) {
      dfs(nx, ny, 3-c);      
    } else {
      dfs(nx, ny, c);      
    }
  }
}

signed main() {
  while ( cin >> n, n ) {
    for ( int i = 0; i < 100000; i++ ) {
      G[i].clear();
      used[i].clear();
    }
    zipx.clear(); zipy.clear();
    f = false;    
    vector<Pp> dat(n);
    vector<int> X, Y;  
    for ( int i = 0; i < n; i++ ) {
      int x, y;
      char d;
      cin >> x >> y >> d;
      dat[i] = (Pp(P(x, y), d == 'y'));    
      X.emplace_back(x);
      X.emplace_back(x+1);
      X.emplace_back(x-1);
      Y.emplace_back(y);
      Y.emplace_back(y+1);
      Y.emplace_back(y-1);
    }

    {
      sort(X.begin(), X.end());
      X.erase(unique(X.begin(), X.end()), X.end());
      int cnt = 0;
      for ( int i = 0; i < X.size(); i++ ) {
	zipx[X[i]] = cnt++;
      }
    }

    {
      sort(Y.begin(), Y.end());
      Y.erase(unique(Y.begin(), Y.end()), Y.end());
      int cnt = 0;
      for ( int i = 0; i < Y.size(); i++ ) {
	zipy[Y[i]] = cnt++;      
      }
    }

    for ( int i = 0; i < n; i++ ) {
      int x = dat[i].first.first, y = dat[i].first.second, d = dat[i].second;
      int nx = zipx[x], ny = zipy[y];    
      if ( d == 0 ) { // x
	G[nx][ny] = 2;
	G[zipx[x+1]][ny] = 4;
      } else {
	G[nx][ny] = 1;
	G[nx][zipy[y+1]] = 3;      
      }
    }

    for ( int i = 0; i < n; i++ ) {
      int x = dat[i].first.first, y = dat[i].first.second, d = dat[i].second;
      int nx = zipx[x], ny = zipy[y];
      if ( used[nx][ny] ) continue;
      dfs(x, y, 1);
      if ( f ) break;    
    }

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



Measured memory_bytes: 40768
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5,YL=1e9+7;
inline int MO(const int &x){return x>=YL?x-YL:x;}
inline int in(){int k;cin>>k;return k;}
inline int low(int x){return x&(-x);}
char s[N];
typedef std::pair<int,int> P;
#define mk make_pair
int main()
{
	ios::sync_with_stdio(0);
	int n,cnt=0;cin>>n>>s+1;
	for(int i=1;i<=n;++i)cnt+=s[i]=='R';
	if(cnt>n-cnt)puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
//string b="12345";
//a = int(b[4]-48);
using namespace std;
int main()
{
	int K, X;
	cin >> K >> X;

	if (500*K>=X) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}

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

void fnInput(vector<int> &rvnNum)
{
  int nMaxSiz;
  cin >> nMaxSiz;

  rvnNum.resize(nMaxSiz);
  for (int i = 0; i < nMaxSiz; i++)
    cin >> rvnNum[i];
}

int fnPartition(vector<int> &rvnNum, int nFront, int nBack)
{
  int nMid = nFront;

  for (int i = nFront; i < nBack; i++)
    if (rvnNum[i] <= rvnNum[nBack])
      swap(rvnNum[nMid++], rvnNum[i]);

  swap(rvnNum[nMid], rvnNum[nBack]);
  return nMid;
}

void fnResult(const vector<int> &cnrvnNum, int nMid)
{
  for (int i = 0; i < cnrvnNum.size(); i++)
  {
    if (i)  cout << " ";
    if (i == nMid) cout << "[";
    cout << cnrvnNum[i];
    if (i == nMid) cout << "]";
  }
  cout << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> vnNum;

  fnInput(vnNum);
  int nFront = 0;
  int nBack = vnNum.size() - 1;

  int nMid = fnPartition(vnNum, nFront, nBack);
  fnResult(vnNum, nMid);

  return 0;
}

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

int main() {
  vector<int>c(9);
  for(int i=0;i<9;i++)cin>>c[i];
  int a=0;
  if(c[0]-c[1]==c[3]-c[4]&&c[3]-c[4]==c[6]-c[7])a++;
  if(c[1]-c[2]==c[4]-c[5]&&c[4]-c[5]==c[7]-c[8])a++;
  if(c[0]-c[3]==c[1]-c[4]&&c[1]-c[4]==c[2]-c[5])a++;
  if(c[3]-c[6]==c[4]-c[7]&&c[4]-c[7]==c[5]-c[8])a++;
  if(a==4) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
//testing unlocked
#include <bits/stdc++.h>
#define gc getchar()
#define pc(x) putchar(x)
template<typename T> void scan(T &x){x = 0;register bool _=0;register T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){register bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}
 
using namespace std;
 
 
int main(){
    
    int a, b;
    scan(a, b);
    if(a > 9 || b > 9){
        return 0*puts("-1");
    }
    print(a*b);
    
    return 0;
}

Measured memory_bytes: 768
#include <iostream>
using namespace std;
#define rep(i,s,n)for(int i=s;i<n;i++)
#define repe(i,s,n)for(int i=s;i<=n;i++)
typedef long long  ll;

int main()
{
	int a, b; cin >> a >> b;
	int cnt = 0;
	repe(i, a, b)
		if (i / 10000 == i % 10 &&
			((i / 1000) % 10) == ((i / 10) % 10)) cnt++;

	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
struct edge {
	int to, cost;
};

int dist[3000];
vector<edge> G[3000];
P p[100000];
int l[100000];

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

	int N, M, K;
	cin >> N >> M >> K;

	for(int i = 0; i < M; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		p[i] = { a, b };
		l[i] = c;
		G[a].push_back({ b, c });
		G[b].push_back({ a, c });
	}

	const int INF = 1 << 25;
	fill((int*)begin(dist), (int*)end(dist), INF);
	priority_queue<P> q;
	for(int i = 0; i < K; i++) {
		int s;
		cin >> s;
		s--;
		dist[s] = 0;
		q.push({ 0, s });
	}

	while(q.size()) {
		int v = q.top().second;
		int d = q.top().first;
		q.pop();
		if(dist[v] < d) continue;
		for(auto e : G[v]) {
			int to = e.to;
			int c = e.cost;
			if(dist[to] > d + c) {
				dist[to] = d + c;
				q.push({ d + c, to });
			}
		}
	}

	int ans = 0;
	for(int i = 0; i < M; i++) {
		int u = p[i].first, v = p[i].second;
		int d = (dist[u] + dist[v] + l[i] + 1) / 2;
		ans = max(ans, d);
	}

	cout << ans << endl;
}

Measured memory_bytes: 7188
class Combi
  def initialize(max_n, mod = 10**9+7)
    @mod = mod
    @max_n = max_n

    @fac = Array.new(@max_n+1)
    @inv = Array.new(@max_n+1)
    @finv = Array.new(@max_n+1)

    @fac[0] = @fac[1] = 1
    @finv[0] = @finv[1] = 1
    @inv[1] = 1
    2.upto(@max_n) do |i|
      @fac[i] = @fac[i-1] * i % @mod
      @inv[i] = @mod - @inv[@mod%i] * (@mod/i) % @mod
      @finv[i] = @finv[i-1] * @inv[i] % @mod
    end
  end

  def nCk(n,k)
    @fac[n] * @finv[n - k] * @finv[k] % @mod
  end
end

require 'set'; require 'prime'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

h = {}
i1, i2 = nil, nil
a.each_with_index do |e, i|
  if h.has_key? e
    i1 = h[e]
    i2 = i
    break
  else
    h[e] = i
  end
end

# p [i1,i2]

combi = Combi.new(n+1)

1.upto(n+1) do |k|
  x = combi.nCk(n+1,k)
  y = n - i2 + i1 >= k-1 ? combi.nCk(n - i2 + i1, k-1) : 0

  ans = x - y
  ans += MOD if ans < 0
  # p [k,ans, '', x,y]
  puts ans
end


Measured memory_bytes: 21356
import collections

ans_list = []

for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            tmp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if tmp <= 10000:
                ans_list.append(tmp)

ans_list = sorted(ans_list)

N = int(input())

c = collections.Counter(ans_list)

for i in range(1, N + 1):
    print(c[i])


Measured memory_bytes: 21504
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;

static const double EPS = 1e-8;

const int tx[] = {0,1,0,-1};
const int ty[] = {-1,0,1,0};

class Button{
public:
	int lu_x,lu_y,rl_x,rl_y;
	string name;
	Button() : lu_x(0),lu_y(0),rl_x(0),rl_y(0),name(""){}
	Button(int lu_x,int lu_y,int rl_x,int rl_y,string name): lu_x(lu_x),lu_y(lu_y),rl_x(rl_x),rl_y(rl_y),name(name){}
};

int main(){
	int n;
	int W,H;
	
	while(~scanf("%d",&n)){
		if(n==0) break;
		map<string,vector<Button> > page;
		vector<string> browsed;
		scanf("%d %d",&W,&H);
		for(int i=0;i<n;i++){
			string name;
			int num;
			cin >> name >> num;
			for(int j=0;j<num;j++){
				string next;
				int lu_x,lu_y,rl_x,rl_y;
				cin >> lu_x >> lu_y >> rl_x >> rl_y >> next;
				page[name].push_back(Button(lu_x,lu_y,rl_x,rl_y,next));
				if(browsed.size()==0) browsed.push_back(name);
			}
		}

		int m;
		int pos = 0;
		scanf("%d",&m);
		for(int i=0;i<m;i++){
			string act;
			cin >> act;
			if(act=="click"){
				int x,y;
				cin >> x >> y;
				string now = browsed[pos];
				for(int j=0;j<page[now].size();j++){
					if((page[now][j].lu_x <= x && x <= page[now][j].rl_x)
						&& (page[now][j].lu_y <= y && y <= page[now][j].rl_y)){
							//printf("to %s\n",page[now][j].name.c_str());

							browsed.erase(browsed.begin()+pos+1,browsed.end());
							browsed.push_back(page[now][j].name);
							pos++;
							break;
					}
				}
			}
			else if(act=="back"){

				if(pos>0){
					pos--;
					//printf("back\n");
				}
			}
			else if(act=="forward"){
				if(pos<browsed.size()-1){
					pos++;
					//printf("forwardk\n");
				}
			}
			else if(act=="show"){
				cout << browsed[pos] << "\n";
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

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

	int Q, H, S, D; cin >> Q >> H >> S >> D;
	int N; cin >> N;

	int A = 0;
	A = min(4 * Q, 2 * H);
	A = min(A, S);

	int B = 2 * A - D;

	ll res = 0LL;
	if (B <= 0){
		res = (ll)N * A;
	}else
	if (B > 0){
		res = (ll)D * (N / 2LL) + (N % 2 != 0 ? (ll)A : 0LL);
	} // end if

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

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, string>> a(m);
  for (int i = 0; i < m; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  int ac = 0;
  set<int> st;
  for (int i = 0; i < m; ++i) {
    if (a[i].second == "AC") {
      st.insert(a[i].first);
    }
  }
  ac = st.size();
  int pn = 0;
  vector<bool> f(n, false);
  for (int i = 0; i < m; ++i) {
    if (a[i].second == "AC") {
      f[a[i].first] = true;
    }
    if (st.count(a[i].first) >= 1 && f[a[i].first] == false &&
        a[i].second == "WA") {
      ++pn;
    }
  }
  cout << ac << " " << pn << endl;
}


Measured memory_bytes: 11136
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  long long int ans=0,n,i;
  scanf("%lld\n",&n);
  for(i=1;i<=n;i++){
    if(i%3==0 && i%5==0){
    }
    else if(i%3==0){
    }
    else if(i%5==0){
    }
    else{
      ans+=i;
    }
  }
  printf("%lld\n",ans);
  return 0;
}

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

int main()
{
	int n;
	cin>>n;
	int a[n+1],i,j,k,ans=0;
	for(int i=1; i<=n; i++)	cin>>a[i];
	sort(a+1,a+n+1);
	for(i=1; i<n-1; i++)
		for(j=i+1; j<n; j++)
			for(k=j+1; k<=n; k++)
				if(a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k] &&  (a[i]+a[j])>a[k])
					ans++;
	cout<<ans;
	return 0;
 } 

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1e9+7;
int cnt1[66] , cnt0[66];

ll logs[61];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    logs[0] = 1;
    for(int i = 1; i <= 60; i ++) {
        logs[i] = (logs[i - 1] + logs[i - 1]) % MOD;
    }
    int ans = 0;
    int n;
    cin >> n;
    for(int i = 0; i < n; i ++) {
        ll a;
        cin >> a;
        string s = "";
        for(ll j = 0; j < 60; j ++) {
            if(a&(1ll<<j))
                s += '1';
            else {
                s += '0';
            }
        }
        if(i != 0) {
            for(int j = 0; j < s.size(); j ++) {
                if(s[j] == '0') {
                    ans += ((ll)cnt1[j] * logs[j]) % MOD;
                    ans %= MOD;
                    cnt0[j] ++;
                }
                else {
                    ans += ((ll)(cnt0[j]) * logs[j]) % MOD;
                    ans %= MOD;
                    cnt1[j] ++;
                }
            }
        }
        else {
            for(int j = 0; j < s.size(); j ++) {
                if(s[j] == '1')
                    cnt1[j] ++;
                else {
                    cnt0[j] ++;
                }
            }
        }
    }
    cout << (int)(ans % MOD);
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	var input string
	fmt.Scanf("%d", &n)
	s := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%s", &input)
		s[i] = input
	}
	s = removeDuplicate1(s)
	fmt.Println(len(s))
}

func removeDuplicate1(args []string) []string {
	results := make([]string, 0, len(args))
	encountered := map[string]bool{}
	for i := 0; i < len(args); i++ {
		if !encountered[args[i]] {
			encountered[args[i]] = true
			results = append(results, args[i])
		}
	}
	return results
}


Measured memory_bytes: 26628
import java.util.Scanner;
public class Main {
  public static void main( String[] args ) {
	  Scanner scan = new Scanner(System.in);
	  int N = scan.nextInt();
	  int[] A = new int[N];
	  for( int i = 0; i < N; i++ ) {
		  A[i] = scan.nextInt();
	  }
	  for( int i = 0; i < N; i++ ) {
		  if( A[i] % 2 == 0 ) {
			  if(( A[i] % 3 != 0 && A[i] % 5 != 0 )) {
				  System.out.println("DENIED");
				  return;
			  }
		  }
	  }
	  System.out.println("APPROVED");
  }
}



Measured memory_bytes: 23892
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    int mi = n;
    int ma = 0;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        mi = min(mi, b);
        ma = max(ma, a);
    }

    cout << max(0, mi - ma + 1) << endl;
    return 0;
}

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

int main(){
  int a,b,c; cin >> a >> b >> c;
  int x;     cin >> x;
  int count =0;
  
  for(int i=0;i<a+1;i++){
    for(int j=0;j<b+1;j++){
      for(int k=0;k<c+1;k++){
        if(500*i+100*j+50*k ==x){
          count++;
        }
      }
    }
  }
  cout << count << endl;
}

          

Measured memory_bytes: 256
n, m = map(int, input().split())
buf = [None] * m
cnt = {k: [] for k in range(n+1)}
for i in range(m):
  p, y = map(int, input().split())
  cnt[p].append((y, i))
for p, l in cnt.items():
  if not l:
    continue
  l.sort()
  for j, (y,i) in enumerate(l):
    buf[i] = "{:06d}{:06d}".format(p, j+1)
print("\n".join(buf))

Measured memory_bytes: 46880
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int H,W; cin >> H >> W;
    vector<string> S(H);
    rep(i,H) cin >> S[i];

    auto func=[&](int x) {
        vector<vector<ll>> cnt(H+1, vector<ll>(H+1));
        rep(i,H) {
            rep(j,H) {
                if (S[H-1-i][x]==S[H-1-j][x+1]) {
                    cnt[i][j]++;
                }
            }
        }
        for (int i = H-1; i > 0; i--) {
            for (int j = H-1; j > 0; j--) {
                cnt[i-1][j-1] += cnt[i][j];
            }
        }
        vector<vector<ll>> dp(H+1, vector<ll>(H+1,1e18));
        dp[0][0] = cnt[0][0];
        rep(i,H+1) {
            rep(j,H+1) {
                if (i < H) chmin(dp[i+1][j],dp[i][j]+cnt[i+1][j]);
                if (j < H) chmin(dp[i][j+1],dp[i][j]+cnt[i][j+1]);
            }
        }
        return dp[H][H];
    };

    ll ans = 0;
    rep(i,W-1) {
        ans += func(i);
    }

    cout << ans << ln;
}

Measured memory_bytes: 1864
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        int alice = 0;
        int bob = 0;
        if (n % 2 == 0) {
            for (int i = 1; i < n; i += 2) {
                alice += a[i];
            }
            for (int i = 0; i < n - 1; i += 2) {
                bob += a[i];
            }
        } else {
            for (int i = 0; i < n; i += 2) {
                alice += a[i];
            }
            for (int i = 1; i < n - 1; i += 2) {
                bob += a[i];
            }
        }
        System.out.println(alice - bob);
    }
}


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

int main() {
	int a, b;
	int big = 0;
	int s = 0;
	cin >> a >> b;
	if (a<=b) {
		big = b;
		s = a;
	}
	else {
		big = a;
		s = b;
	}
	while (big--) {
		cout<<s;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define p(s) cout << s << endl;
typedef long long LL;
template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
   int n,a,b; cin>>n>>a>>b;
   cout << (n*a>b?b:n*a) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
#include <math.h>

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    double pi=M_PI,r;
    cin>>r;
    printf("%.6lf %.6lf\n",r*r*pi,r*2*pi);
    return 0;
}



Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,b) for(int  i=(a); i<(b);++i)
#define ff(i,a,b) for(int  i=(a); i>=(b);--i)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
int d,t,s;
cin>>d>>t>>s;
if(t*s>=d) cout<<"Yes\n";
else cout<<"No\n";


    return 0;
}




Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=100005;
LL read(){
	LL x=0;
	char ch=getchar();
	while (!isdigit(ch))
		ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x;
}
LL n;
int a[N],tot;
int main(){
	n=read()+1;
	tot=100;
	for (int i=1;i<=tot;i++)
		a[i]=i;
	int t=0;
	while (n>>(t+1))
		t++;
	for (int i=1;i<=t;i++)
		a[++tot]=i;
	int k=t;
	for (int x=t-1;x>=0;x--)
		if (n>>x&1){
			tot++;
			for (int i=tot;i>101+x;i--)
				a[i]=a[i-1];
			a[101+x]=++k;
		}
	cout << tot << endl;
	for (int i=1;i<=tot;i++)
		cout << a[i] << " ";
	return 0;
}

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

const int N = 100005;
int n;
int cnt;
int a[N];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	if (n == 1) return printf("Second\n"), 0;
	for (int i = 1; i <= n; ++i) cin >> a[i];

	int winner = 0;
	while(true) {
		bool check = true;
		for (int i = 1; i <= n; ++i) if (a[i] != 1) check = false;
		if (check) {
			return printf(winner == 1 ? "First\n" : "Second\n"), 0;
		}

		winner ^= 1;

		int nEven = 0;
		for (int i = 1; i <= n; ++i) if (a[i] % 2 == 0) ++nEven;
		if (nEven % 2 == 1) {
			return printf(winner == 1 ? "First\n" : "Second\n"), 0;
		}

		int pos, nOdd = 0;
		for (int i = 1; i <= n; ++i) {
			if (a[i] > 1 && (a[i] & 1)) nOdd++, pos = i; 
		}
		if (nOdd != 1) {
			return printf(winner == 1 ? "Second\n" : "First\n"), 0;
		}
		a[pos]--;
		int g = 0;
		for (int i = 1; i <= n; ++i) g = __gcd(g, a[i]);
		for (int i = 1; i <= n; ++i) a[i] /= g;
	}
}

Measured memory_bytes: 640
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

long long ston(string s){
  long long n;
  sscanf(s.c_str(), "%lld", &n);
  return n;
}

int main(){
	ll ans = 0;
  ll n;
  cin>>n;
  rep(i,1,pow(4,10)){
  	ll a = i;
  	ll b = 0;
  	ll c = 0;
  	ll flag = 1;
  	rep(j,0,10){
  		if(a%4==0){
  			if(c>0)flag=0;
  			b+=0;
  		}
  		if(a%4==1){
  			c|=1;
  			b+=3;
  		}
  		if(a%4==2){
  			c|=2;
  			b+=5;
  		}
  		if(a%4==3){
  			c|=4;
  			b+=7;
  		}
  		a/=4;
  		if(j!=9)b*=10;
  	}
  	if(flag==1&&b<=n&&c==7){
  		ans++;
  	}
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
using ui64 = uint_fast64_t;
#define REP(i, n) for (i64 (i) = 0; (i) < (n); ++(i))
#define FOR(i, a, b) for (i64 (i) = (a); (i) < (b); ++(i))

bool fir_is_red;
int N;
string ans;

// red => true

// [l, r)
bool ask(int l, int r) {
    cout << '?';
    FOR(i, l, r) cout << ' ' << i + 1;
    cout << endl;
    string ret;
    cin >> ret;
    if (ret == "-1") exit(1);
    return (ret == "Red") ^ !fir_is_red;
}
bool ask(int l, int r, int x) {
    cout << '?';
    FOR(i, l, r) cout << ' ' << i + 1;
    cout << ' ' << x + 1;
    cout << endl;
    string ret;
    cin >> ret;
    if (ret == "-1") exit(1);
    return (ret == "Red") ^ !fir_is_red;
}
bool ask(int l1, int r1, int l2, int r2, int x) {
    cout << '?';
    FOR(i, l1, r1) cout << ' ' << i + 1;
    FOR(i, l2, r2) cout << ' ' << i + 1;
    cout << ' ' << x + 1;
    cout << endl;
    string ret;
    cin >> ret;
    if (ret == "-1") exit(1);
    return (ret == "Red") ^ !fir_is_red;
}

void answer() {
    if (fir_is_red) cout << "! " << ans << endl;
    else {
        cout << "! ";
        REP(i, 2 * N) {
            cout << (ans[i] == 'R' ? 'B' : 'R');
        }
        cout << endl;
    }
}

signed main() {

    cin >> N;
    
    ans = string(2 * N, '?');

    fir_is_red = true;
    fir_is_red = ask(0, N);

    int red = 0, blue = N;
    while (abs(red - blue) > 1) {
        int mid = (red + blue) >> 1;
        if (ask(mid, mid + N)) red = mid;
        else blue = mid;
    }

    // [blue, red + N)が半々
    // [0, red) + [blue + N, 2 * N)も半々

    REP(i, 2 * N) {
        if (blue <= i and i < red + N) {
            ans[i] = ask(0, red, blue + N, 2 * N, i) ? 'R' : 'B';
        } else {
            ans[i] = ask(blue, red + N, i) ? 'R' : 'B';
        }
    }

    answer();

}

Measured memory_bytes: 724
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	int a[10000],n,i,j,t,c=0,min;	cin>>n;
	for(i=0;i<n;i++)cin>>a[i];
	for(i=0;i<n;i++){
		min=i;
		for(j=i;j<n;j++){
			if(a[j]<a[min])min=j;
		}
		if(i!=min){
			t=a[min];
			a[min]=a[i];
			a[i]=t;
			c++;
		}
	}
		for(i=0;i<n;i++){
			if(i)cout<<" ";
			cout<<a[i];
		}
		cout<<endl<<c<<endl;
			return 0;
		
}


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

int main()
{
        ll N; cin >> N;
        vector<ll> A(N, 0);
        for (int i = 0; i < N; ++i) {
                cin >> A[i];
        }
        ll ans = 0;
        bool loop = true;
        while (1) {
                for (int i = 0; i < N; ++i) {
                        if (A[i] % 2 == 0) {
                                A[i] = A[i] / 2;
                        }
                        else {
                                loop = false;
                                break;
                        }
                }
                if (loop == false) break;
                ans++;
        }
        cout << ans << endl;


}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  int L,R;
  int Lk = 1,Rk = N;
  for(int i = 0;i<M;i++){
    cin>>L>>R;
    if(L>Lk){
      Lk = L;
    }
    if(R<Rk){
      Rk = R;
    }
  }
  if((Rk - Lk + 1)<=0){
    cout << 0 << endl;
  }
  else{
    cout << Rk - Lk +1 << endl;
  }
  return 0;
}


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

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pi;
typedef long double ld;
typedef pair<long double, long double> pld;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll i, j, k;

    string S;
    cin >> S;
    ll l = S.length();
    if(S[l - 1] == 's') {
        cout << S + "es" << endl;
    } else {
        cout << S + "s" << endl;
    }

    return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define dbg(x) cout<<"( "<<#x<<" -> "<<x<<" )"<<endl;
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    ll a[n];
    for (int i=0;i<n;i++)
    scanf("%lld",&a[i]);
    ll cnt=0LL;
    for (int i=0;i<n-2;i++)
    {
        for (int j=i+1;j<n-1;j++)
        {
            for (int k=j+1;k<n;k++)
            {
                if (((a[i]+a[j])>a[k]) && ((a[i]+a[k])>a[j]) && ((a[j]+a[k])>a[i]) && (a[i]!=a[j]) && (a[j]!=a[k]) && (a[i]!=a[k]))
                cnt++;
            }
        }
    }
    printf("%lld\n",cnt);
    return 0;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<vector<int>> v(N);

  for(int i = 0;i < M;i++){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }


  for(int i:v[0]){
    for(int j:v[i]){
      if(j == N - 1){
        cout << "POSSIBLE" << endl;
        return 0;
      }
    }
  }

  cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 12016
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<bool> isLike(m, true);
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    vector<bool> a(m, false);
    for (int j = 0; j < k; j++) {
      int inA;
      cin >> inA;
      a[inA - 1] = true;
    }
    for (int j = 0; j < m; j++) {
      if (a[j] == false) isLike[j] = false;
    }
  }
  int ans = 0;
  for (int i = 0; i < m; i++)
    if (isLike[i] == true) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if(a < b){
			if(b < c){
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		} else {
			System.out.println("No");
		}

	}
}




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

int main(){
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> l(q), r(q);
  for(int i = 0; i < q; i++){
    cin >> l[i] >> r[i];
  }
  
  vector<int> count(n+1, 0);
  for(int i = 1; i < n; i++){
    if(s[i-1] == 'A' && s[i] == 'C'){
      count[i+1] = count[i] + 1;
    }
    else{
      count[i+1] = count[i];
    }
  }	//累積和の考え方
  
  vector<int> answer(q, 0);
  
  for(int i = 0; i < q; i++){
    if(l[i] == 1){
      answer[i] = count[r[i]];
    }
    else{
      if(s[l[i]-2] == 'A' && s[l[i]-1] == 'C'){
        answer[i] = count[r[i]] - count[l[i]-1] - 1;
      }
      else{
        answer[i] = count[r[i]] - count[l[i]-1];
      }
    } 
  }
  
  for(int i = 0; i < q; i++){
    cout << answer[i] << endl;
  }
} 

Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s;
    cin>>t;
    long int c=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
        {
            c++;
        }
    }
    cout<<c;
}

Measured memory_bytes: 3856
#include<stdio.h>

int main()
{
	double a, b, c;
	
    scanf("%lf%lf", &a, &b);

	printf("%d ", (int)a/(int)b);
	printf("%d ", (int)a % (int)b);
	printf("%lf\n", a / b);

	return 0;
}

Measured memory_bytes: 1076
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct RMQ{
  int n;
  vector<int> dat;
  const int def=INT_MIN;
  RMQ(){}
  RMQ(int n_){init(n_);}
  RMQ(int n_,int* a){init(n_);construct(n_,a);}
  void init(int n_){
    n=1;
    while(n<n_) n*=2;
    dat.clear();
    dat.resize(2*n-1,def);
  }
  void construct(int n_, int* a){
    for(int i=0;i<n_;i++) dat[i+n-1]=a[i];
    for(int i=n-2;i>=0;i--)
      dat[i]=max(dat[i*2+1],dat[i*2+2]);
  }
  void update(int k,int a){
    k+=n-1;
    if(dat[k]>=a) return;
    dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=max(dat[k*2+1],dat[k*2+2]);
    }
  }
  int query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l) return def;
    if(a<=l&&r<=b) return dat[k];
    int vl=query(a,b,k*2+1,l,(l+r)/2);
    int vr=query(a,b,k*2+2,(l+r)/2,r);
    return max(vl,vr);
  }
  int query(int a,int b){
    return query(a,b,0,0,n);
  }
};

typedef pair<int,int> P;
int r,c,n;
bool in(int x,int y){
  return (x!=0&&x!=r)&&(y!=0&&y!=c);
}
int po(int x,int y){
  if(y==0) return x;
  if(x==r) return r+y;
  if(y==c) return r+c+(r-x);
  return r+c+r+(c-y);
}

signed main(){
  cin>>r>>c>>n;
  vector<P> v;
  for(int i=0;i<n;i++){
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    //cout<<in(x1,y1)<<" "<<in(x2,y2)<<endl;
    if(in(x1,y1)||in(x2,y2)) continue;
    //cout<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<endl;
    //cout<<po(x1,y1)<<" "<<po(x2,y2)<<endl;
    P p(po(x1,y1),po(x2,y2));
    if(p.first>p.second) swap(p.first,p.second);
    v.push_back(p);
    /*
      v.push_back(P(p.first+2*(r+c),p.second+2*(r+c)));
      swap(p.first,p.second);
      p.second+=2*(r+c);
      v.push_back(p);
      v.push_back(P(p.first+2*(r+c),p.second+2*(r+c)));
    */
  }
  //sort(v.begin(),v.end());
  n=v.size();
  vector<int> comp;
  for(int i=0;i<n;i++){
    comp.push_back(v[i].first);
    comp.push_back(v[i].second);
  }
  sort(comp.begin(),comp.end());
  comp.erase(unique(comp.begin(),comp.end()),comp.end());
  int sz=comp.size();
  //for(int i=0;i<sz;i++) cout<<i<<" "<<comp[i]<<endl;
  map<int,int> m;
  for(int i=0;i<sz;i++) m[comp[i]]=i;
  RMQ rmq(sz);
  for(int i=0;i<n;i++){
    
    rmq.update(m[v[i].first],m[v[i].second]);
  }
  bool ans=1;
  for(int i=0;i<n;i++){
    //cout<<v[i].first<<" "<<v[i].second<<endl;
    //cout<<m[v[i].first]<<"m"<<m[v[i].second]<<endl;
    //cout<<rmq.query(m[v[i].first],m[v[i].second])<<":"<<m[v[i].second]<<endl;
    ans&=(rmq.query(m[v[i].first],m[v[i].second])<=m[v[i].second]);
  }
  cout<<(ans?"YES":"NO")<<endl;
  return 0;
}


Measured memory_bytes: 19952
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc =new Scanner(System.in);
		String s=sc.next();
		int a_exi=0;
		int b_exi=0;
		int c_exi=0;
		String ans;

		if(s.contains("a")) a_exi++;
		if(s.contains("b")) b_exi++;
		if(s.contains("c")) c_exi++;

		if(a_exi==1 && b_exi==1 && c_exi==1) ans="Yes";
		else ans="No";

		System.out.println(ans);

	}
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
main(){
  int n,m;
  cin>>n>>m;
  int a,b;
  vector<int> t(n,0);
  for(int i=0;i<m;++i){
    cin>>a>>b;
    t[min(a,b)-1]++;
    t[max(a,b)-1]--;
  }
  for(int i=0;i<n;++i){
    if((i&&(t[i]+=t[i-1])%2)||(t[i]%2))return cout<<"NO",0;
  }
  cout<<"YES";
}

Measured memory_bytes: 640
N, A, B, C = gets.split.map(&:to_i)
@ls = []
N.times do
  @ls << gets.to_i
end

def dfs(cur, a, b, c)
  if cur == N
    if [a,b,c].min > 0
      return (a - A).abs + (b - B).abs + (c - C).abs - 30
    else
      return 10 ** 20
    end
  end

  ret0 = dfs(cur+1, a, b, c)
  ret1 = dfs(cur+1, a + @ls[cur], b, c) + 10
  ret2 = dfs(cur+1, a, b + @ls[cur], c) + 10
  ret3 = dfs(cur+1, a, b, c + @ls[cur]) + 10
  return [ret0, ret1, ret2, ret3].min
end

puts dfs(0, 0, 0, 0)



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

bool isPrimeNumber(ll n) {
    if (n < 2) return false;
    for (ll i = 2; i * i <= n; ++i) if (n % i == 0) return false;
    return true;
}

int main() {
    int x;
    cin >> x;
    int i = x;
    while (!isPrimeNumber(i)) ++i;
    cout << i << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pi 2*acos(0.0)
#define MOD 1000000007
#define N 100001
#define SZ 100000
int main()
{
    ll n,ans=0,i,temp=1;
    map<ll,int>mp;
    cin>>n;
    for(i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            temp=i;
            //cout<<i<<" ";
            while(n%temp==0)
            {
                ans++;
                n/=temp;
                //cout<<temp<<" ";
                temp*=i;
            }
        }
        if(n%i==0)
        {
            while(n%i==0)
            {
                n/=i;
            }
        }
    }
    //puts("");
    if(n>1)
        ans++;
    //cout<<n<<endl;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3592
#include <cstdio>
#include <algorithm>
using namespace std;
int h[100200], dp[100200];
int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &h[i]);
		dp[i+1] = 1001001001;
	}
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= k; j++) {
			dp[i+j] = min(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
		}
	}
	printf("%d\n", dp[n-1]);
	return 0;
}


Measured memory_bytes: 896
#087 C


N =int(input())
A1 =[int(j) for j in input().split()]
A2 =[int(j) for j in input().split()]
ans=[]
for i in range(len(A1)):
    ans.append(sum(A1[0:i+1])+sum(A2[i:]))
print(max(ans))

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int max = Integer.MIN_VALUE;
    int sum = 0;
    for (int i = 0; i < n; i++) {
      int l = in.nextInt();
      sum += l;
      if(l > max){
        max = l;
      }
    }// End loop

    System.out.println(max < sum - max ? "Yes" : "No");

  }
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N;
    cin >> N;
    vec s(N+1, 0);
    REP(i,1,N+1) cin >> s[i];

    ASC(s);
    ll sum = 0, m = 0;
    REP(i,1,N+1) sum += s[i];
    REP(i,0,N+1) {
        if((sum - s[i]) % 10 != 0) m = MAX(m,sum-s[i]); 
    }
    PR(m);

    return 0;
}

/*



*/

Measured memory_bytes: 3560
#include <iostream>
#include <cmath>
using namespace std;
int return_result(int);
int main()
{
    int up, down,s;
    int up_result, down_result;
    cin >> s;
    up = floor(s/100);
    down = s % 100;
    
    up_result = return_result(up);
    down_result = return_result(down);

    if(up_result ==0){
        if(down_result ==0 || down_result ==2){
            cout <<"NA" <<endl;
            return 0;
        }
        else if(down_result == 1){
            cout << "YYMM" <<endl;
            return 0;            
        }

    }

    if(down_result ==0){
        if(up_result ==0 || up_result ==2){
            cout <<"NA" <<endl;
            return 0;
        }
        else if(up_result == 1){
            cout << "MMYY" <<endl;
            return 0;            
        }

    }    


    if(up_result ==2 && down_result == 2){
        cout << "NA" <<endl;
        return 0;
    }

    if(down_result ==1 && up_result == 2){
        cout << "YYMM" <<endl;
        return 0;
    }

    if(down_result ==2 && up_result == 1){
        cout << "MMYY" <<endl;
        return 0;
    }
    if(up_result == 1 && down_result == 1){
    cout << "AMBIGUOUS" << endl;
    return 0;
    }
    return 0;
}

int return_result(int a)
{
    if(0 < a && a <= 12){
        return 1; //return month
    }
    else if(a >= 13){
        return 2; //return year
    }

    else if(a == 0){
        return 0; //return ambigious
    }

    return 4;

}

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

int n,m;
int mini=1e9,ans=0;

int main(){
	cin >> n;
	for (int i=1,p;i<=n;i++){
		cin >> p;
		if (p<=mini){mini=p;ans++;}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func min(x, y int) int {
	if x > y {
		return y
	}
	return x
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := nextInt(sc)

	P := make([]int, n+1)
	for i := 1; i <= n; i++ {
		l := nextInt(sc)
		P[i-1] = l
		m := nextInt(sc)
		P[i] = m
	}

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

	for l := 2; l <= n; l++ {
		for i := 1; i <= n - l + 1; i++ {
			j := i + l - 1
			matrix[i][j] = (1 << 21)
			for k := i; k <= j-1; k++ {
				matrix[i][j] = min(matrix[i][j], matrix[i][k] + matrix[k+1][j] + P[i-1] * P[k] * P[j])
			}
		}
	}
	fmt.Println(matrix[1][n])
}


Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define ll long long int
#define N 100
#define f(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++)
#define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--)
#define po pop_back
#define pb push_back
#define lb lower_bound
#define fi first
#define se second
#define debug(x) cout << #x << " = " << x << endl
#define ub upper_bound
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define all(x) x.begin(), x.end()
#define PI 3.141592653
#define cot cout.tie(0)
#define endl "\n"
using namespace std;
/**
        * @author :: Sawlani
        *
        */

 

int main()
{
       

        ll n,m;
        cin >> n >>  m;

        ll a[m+1];
         ll sum=0;
        f(i,1,m) {cin >> a[i];sum+=a[i];}

        if(sum>n)
        {
            cout << -1;
        }
        else
        {
            cout <<  n-sum;
        }
        
         
}

Measured memory_bytes: 3672
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;

#define dbg(x1) cout<<#x1<<" = "<<(x1)<<endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<(x1)<<" "<<#x2<<" = "<<(x2)<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<(x1)<<" "<<#x2<<" = "<<(x2)<<" "<<#x3<<" = "<<(x3)<<endl

int a[maxn], cnt[maxn];
int seq[2][maxn];
int pos[2];

int main() {
    //freopen(".in", "r", stdin);
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        cnt[a[i]]++;
    }
    int delta = 0;
    for (int i = 1; i <= 100000; i++) {
        while (cnt[i] >= 3) {
            cnt[i] -= 2;
            delta += 2;
        }
    }
    for (int i = 1; i <= 100000; i++) {
        if (cnt[i] == 0) continue;
        if (cnt[i] == 1) seq[0][++pos[0]] = i;
        else seq[1][++pos[1]] = i;
    }
    if (pos[1] % 2 == 0) {
        delta += pos[1];
    } else {
        delta += pos[1] - 1;
        delta += 2;
    }
    printf("%d\n", n - delta);

    return 0;
}


Measured memory_bytes: 1408
def main():
    N = int(input())
    ans = 0
    for i in range(1, N+1):
        if i % 15 == 0 or i % 5 == 0 or i % 3 == 0:
            continue
        else:
            ans += i
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 67232
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

int N;
int ret = 0;
vector<int> vec(13);
vector<bool> T(25);

void def(int a) {
    if(a == 12) {
        int cnt = 0;
        int ret2 = Inf;
        for(int i = 1;i < 25;i++) {
            if(T.at(i) == true) {
                ret2 = min(ret2,i - cnt);
                cnt = i;
            }
        }
        ret = max(ret,ret2);
    }
    else {
        if(vec.at(a) == 2) {
            T.at(a) = true;
            T.at(24 - a) = true;
            def(a + 1);
        }
        else if(vec.at(a) == 1) {
            T.at(a) = true;
            def(a + 1);
            T.at(a) = false;
            T.at(24 - a) = true;
            def(a + 1);
            T.at(24 - a) = false;
        }
        else {
            def(a + 1);
        }
    }
    return;
}
int main() {
    cin >> N;
    vec.at(0) = 1;
    for(int i = 0;i < N;i++) {
        int A;
        cin >> A;
        vec.at(A)++;
    }
    bool cnt = true;
    for(int i = 1;i < 12;i++) {
        if(vec.at(i) >= 3) {
            cnt = false;
        }
    }
    if(vec.at(0) >= 2 || vec.at(12) >= 2) {
        cnt = false;
    }
    if(cnt == false) {
        cout << 0 << endl;
    }
    else {
        T.at(0) = true;
        T.at(24) = true;
        if(vec.at(12) != 0) {
            T.at(12) = true;
        }
        def(1);
        cout << ret << endl;
    }
}

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



#define MAX 20

typedef struct list
{
	int num,data1, data2;
	struct list *next;
}LIST;


int main()
{
	int w,n,x,y,i,cur;
	LIST *prear = NULL,*pcur=NULL;
	int num[31] = {0};

	scanf("%d\n%d",&w, &n);

	LIST *phead = (LIST *)malloc(sizeof(LIST));
	if (phead)
	{
		scanf("%d,%d", &x, &y);
		phead->data1 = x;
		phead->data2 = y;
		--n;
	}
	prear = phead;

	while (n)
	{
		LIST *p = (LIST *)malloc(sizeof(LIST));
		if (p)
		{
			scanf("%d,%d", &x, &y);
			p->data1 = x;
			p->data2 = y;
			prear->next = p;
			prear = p;
			--n;
		}
	}
	prear->next = NULL;
	prear = phead;
	
	for (i = 1; i <= w; i++)
	{
		cur = i;
		while (prear)
		{
			if (cur == prear->data1)
			{
				cur= prear->data2;
			}
            else if (cur == prear->data2)
			{
				cur = prear->data1;
			}

			prear = prear->next;
		}
		num[cur] = i;
		prear = phead;
	}
	

	for (i = 1; i <= w; i++)
	{
		printf("%d\n",num[i]);
	}

	return 0;
}


Measured memory_bytes: 596
class UnionFind:
    def __init__(self, n):
        self.root = list(range(n))
        self.size = [1] * (n)
    def find_root(self, x):
        root = self.root
        while root[x] != x:
            root[x] = root[root[x]]
            x = root[x]
        return x
    """
    def find_root(self, x):
        root = self.root
        if root[x] == x:
            return x
        else:
            root[x] = self.find_root(root[x])
            return root[x]
    """
    def merge(self, x, y):
        x = self.find_root(x)
        y = self.find_root(y)
        if x == y:
            return
        sx, sy = self.size[x], self.size[y]
        if sx < sy:
            self.root[x] = y
            self.size[y] += sx
        else:
            self.root[y] = x
            self.size[x] += sy

n, m, k = map(int, input().split())

uf = UnionFind(n)

ab = []
for _ in range(m):
    a, b = map(int, input().split())
    ab.append((a, b))
    uf.merge(a-1, b-1)
cd = []
for _ in range(k):
    c, d = map(int, input().split())
    cd.append((c, d))

#print(uf.root, uf.size)

ans = [uf.size[uf.find_root(uf.root[i])] - 1 for i in range(n)]

#print(' '.join(map(lambda x: str(x), ans)))
for a, b in ab:
    ans[a-1] -= 1
    ans[b-1] -= 1
#print(' '.join(map(lambda x: str(x), ans)))
for c, d in cd:
    if uf.find_root(uf.root[c-1]) == uf.find_root(uf.root[d-1]):
        ans[c-1] -= 1
        ans[d-1] -= 1
print(' '.join(map(lambda x: str(x), ans)))



Measured memory_bytes: 45684
#include<iostream>
using namespace std;
int main()
{
	int h,n;
	cin>>h>>n;
	int a[n+1];
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		ans+=a[i];
	}
	if(ans-h<0)
	{
		cout<<"No";
	}
	else{
		cout<<"Yes";
	}
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    Int N; cin >> N;
    Int ans = 0;
    for (Int p = 2; p * p <= N; p++) {
        int cnt = 0;
        while (N % p == 0) cnt++, N /= p;
        for (int i = 1; i <= cnt; i++) {
            ans += 1, cnt -= i;
        }
    }
    if (N != 1) ans += 1;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());

typedef long long ll;

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

ll lcm(ll a,ll b){
  return a/gcd(a,b)*b;
}

ll check(ll a,ll b){
  if(a<b) return check(b,a);
  if(a%b == 0) return a;
  else return lcm(a,b);
}

int main(){
  int n;
  cin >>n;
  ll ans = 1;
  rep(i,n){
    ll x;
    cin >>x;
    ans = check(ans,x);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
l = list(map(int,input().split()))
ans = 0
for i in range(60):
    c0 = 0
    c1 = 0
    c1 = sum([1 for a in l if (a>>i) & 1])
    c0 = n - c1
    ans += (c1*c0)*(2**i)
print(ans%((10**9)+7))

Measured memory_bytes: 42212