akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    int A[10][10], i, j, k, N, b[100], judge=0, check[10][10];

    for(i=1; i<=3; i++){
        for(j=1; j<=3; j++){
            cin >> A[i][j];
            check[i][j]=0;
        }
    }

    cin >> N;

    for(k=1; k<=N; k++){
        cin >> b[k];

        for(i=1; i<=3; i++){
            for(j=1; j<=3; j++){
                if(A[i][j] == b[k]){
                    check[i][j] = 1;
                }
            }
        }
    }

    if(check[1][1]==1&&check[2][2]==1&&check[3][3]==1){
        judge = 1;
    }
    if(check[3][1]==1&&check[2][2]==1&&check[1][3]==1){
        judge = 1;
    }

    for(i=1; i<=3; i++){
        if(check[i][1]==1 && check[i][2]==1 && check[i][3]==1){
            judge = 1;
        }
        if(check[1][i]==1 && check[2][i]==1 && check[3][i]==1){
            judge = 1;
        }
    }

    if(judge == 1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;

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

ll gcd(ll x, ll y) { return y ? gcd(y, x%y) : x; }

const int mod = 1000000007;
const int INF = 1001001001;

int main() {
    string s;
    cin >> s;
    int l = s.size() - 1;
    ll ans = 0;

    for(int i = 0; i < 1 << l; i++) {
        ll a = ll(s[0] - '0');
        for(int j = 0; j < l; j++) {

            if (i & 1 << j) {
                ans += a;
                a = ll(s[j+1] - '0');
            } else {
                a *= 10;
                a += ll(s[j+1] - '0');
            }
        }
        ans += a;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <cstring>
#include <ctime>
using namespace std;
typedef long long ll;
const int maxn = 505;
const int maxm = maxn * maxn;

int n;
int a[maxn],ans[maxm];
pair<int,int>s[maxn];

bool solve() {
    int l = 1;
    for(int i=1; i<=n; i++) {
        int cnt = 0;
        if(s[i].second-1==0)continue;
        while(l<=n*n&&l<=s[i].first) {
            if(ans[l]) {
                l++;
                continue;
            }
            ans[l] = s[i].second;
            l++;
            cnt++;
            if(cnt==s[i].second-1)break;
        }
        if(cnt<s[i].second-1) {
            //cout<<s[i].second<<endl;
            return false;
        }
    }
    l = n*n;
    for(int i=n; i>=1; i--) {
        int cnt = 0;
        if(n-s[i].second==0)continue;
        while(l>0&&l>=s[i].first) {
            if(ans[l]) {
                l--;
                continue;
            }
            ans[l] = s[i].second;
            l--;
            cnt++;
            if(cnt==n - s[i].second)break;
        }
        if(cnt<n - s[i].second) {
            //cout<<s[i].second<<endl;
            return false;
        }
    }
    return true;
}

int main() {
   // freopen("in.cpp","r",stdin);
    cin>>n;
    for(int i=1; i<=n; i++) {
        cin>>a[i];
        ans[a[i]] = i;
        s[i] = make_pair(a[i],i);
    }
    sort(s+1,s+n+1);
    if(solve()) {
        cout<<"Yes"<<endl;
        for(int i=1; i<n*n; i++) {
            cout<<ans[i]<<" ";
        }
        cout<<ans[n*n]<<endl;
    } else {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 2176
import math
from collections import defaultdict,deque
#from itertools import permutations
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""

a,b,c=ml()
lol=[b]*a
for i in range(c):
    n=ii()
    lol[n-1]+=1
    
for i in lol:
    if(i-c>0): print("Yes")
    else: print("No")    


Measured memory_bytes: 76540
{ Free PascalのHello, world.(日本語版) }
 
program Hello;

{$MODE OBJFPC}
{$CODEPAGE UTF8}
{$LONGSTRINGS ON}
 
uses
  SysUtils,
  Classes;
  
 procedure MainProc;
	var
		text : string;
		strlist : TStringList;
		horizon : Integer;
		vertical : Integer;
		answer : Integer;
	begin
	ReadLn(text);
	strlist := TStringList.Create;
	try
		strlist.Delimiter := ' ';
		strlist.DelimitedText := text;
		horizon := StrToInt(strlist.Strings[0]);
		vertical := StrToInt(strlist.Strings[1]);
		finally
			FreeAndNil(strlist);
			end;
		answer := (horizon - 1) * (vertical - 1);	
		WriteLn(answer);
	end;
  
begin
MainProc;
end.


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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VI d(n);
  REP(i, n) cin >> d[i];
  sort(ALL(d));
  int ans = 0;
  int b = n / 2;
  if(d[b - 1] != d[b]){
    ans = d[b] - d[b-1];
  }
  out(ans);
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(void) {
	long long n, a, b;
	cin >> n >> a >> b;
	long long div;
	long long remain;
	div = n / (a + b);
	remain = n % (a + b);
	long long blue;
	blue = div * a;
	if (remain>=a) {
		blue += a;
	}else{
		blue += remain;
	}
	cout << blue << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int n,a[101],i=0,min=1000,max=0;
    scanf("%d",&n);
    for(i=0; i<n; i++){
        scanf("%d",&a[i]);
        if(a[i] < min){
            min = a[i];
        }
        if(a[i] >max){
            max = a[i];
        }

    }
    printf("%d\n",max-min);

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
ll dp[101][100005];
int main()
{
     ll n,we,i,j;
     cin>>n>>we;
  ll w[n+1],v[n+1];
  for(i=1;i<=n;i++)
  {
    cin>>w[i]>>v[i];
  }
    for(i=1;i<=n;i++)
    {
      for(j=1;j<=we;j++)
      {
          
        dp[i][j]= (j<w[i])?dp[i-1][j]:max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
      }
    }
  cout<<dp[n][we];
    return 0;
}


Measured memory_bytes: 78336
/*input
10
3 1 4 1 5 9 2 6 5 3
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
    out<<'('<<P.F<<','<<P.S<<')';
    return out;
}
#define version 20190713
//}}}
const ll maxn=20;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        
        b>>=1;
    }
    return res;
}

int a[maxn];

vector<pll> dp[maxn][maxn];

void go(int l,int r){
    if(l==r){
        dp[l][r].pb(MP(0,0));
        return;
    }
    if(SZ(dp[l][r])) return;
    if(l==r-1){
        dp[l][r].pb(MP(a[l],a[l]));
        return;
    }
    for(int i=l;i<r;i++){
        go(l,i);
        go(i+1,r);

        for(auto t:dp[l][i]) for(auto s:dp[i+1][r]){
            dp[l][r].pb(MP(t.F+t.S+a[i]+s.F,t.S+a[i]+s.F+s.S));
        }
    }
    sort(ALL(dp[l][r]));
    vector<pll> tmp;
    for(auto t:dp[l][r]){
        if(SZ(tmp)==0||tmp.back().S>t.S) tmp.pb(t);
    }
    swap(dp[l][r],tmp);
}

int main(){
    IOS;
    int n;
    cin>>n;
    REP(i,n) cin>>a[i];
    go(1,n-1);

    ll ans=INF64;
    for(auto i:dp[1][n-1]){
        ans=min(ans,i.F+i.S);
    }
    ans+=a[0]+a[n-1];
    cout<<ans<<'\n';
    return 0;
}


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

ll ar[100000005],br[100000005];
int main()
{
    ll a,c,i,cnt=0,k=1;

    cin>>a;
    c=a;
    for(i=0; i<a; i++)
    {
        cin>>ar[i];
    }
    sort(ar,ar+a);

 while(cnt!=c-1)
 {

    for(i=1;i<a;i++)
    {
    

        ar[i]=ar[i]%ar[0];
        if(ar[i]!=0)
        {
            ar[k++]=ar[i];
        }
        else
            cnt++;
    }

        sort(ar,ar+k);
        a=k;
        k=1;
        i=1;


 }

        cout<<ar[0]<<endl;



    return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define int ll
#define pb push_back
#define sz(i) (int)(i.size())
#define fi first
#define se second
#define ld long double
#define pii pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = 1e9 + 7;
using namespace std;
#ifndef ONLINE_JUDGE
#define tr(...) {__l(__LINE__);__f(#__VA_ARGS__, __VA_ARGS__);}
inline void __l(int line) { cerr << "#" << line << ": "; }template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << std::endl;}template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
const int N = 1e5 + 10;
// make sure N size is correctttt!!!!!!!!!
template<typename T>inline std::ostream &operator << (std::ostream & os,const std::set<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}

int n, m;
std::vector<int> v[N];
bool vis[N];

set<int> ms[N];
stack<int> topo;


int parent[N], dp[N];

void dfs(int s, int p){
   vis[s] = 1;
   parent[s] = p;
   for(auto it: v[s]){
      if(vis[it])continue;
      dfs(it, s);
   }
   topo.push(s);
}

std::vector<int> rev[N];
int Pans;

void WOW(int s){
   // tr(s, rev[s]);
   for(auto i: rev[s]){
      smax(dp[i], dp[s] + 1);
      smax(Pans, dp[i]);
//      WOW(i);
   }
}

int32_t main(){_

   cin>>n;
   cin>>m;

   for (int i = 0; i < m; ++i)
   {
      int x, y;
      cin>>x>>y;
      v[x].pb(y);
      rev[y].pb(x);
      ms[x].insert(y);
      parent[y] = x;
   }

   int ans = 0;
   for (int i = 1; i <= n; ++i)
   {
      if(vis[i])continue;      
      dfs(i, -1);
   }

   std::vector<int> v;
   while(!topo.empty()){
      v.pb(topo.top());
      topo.pop();
   }

   reverse(v.begin(), v.end());

   for (int i = 1; i <= n; ++i)
   {
      dp[i] = 1;
   }

   Pans = 1;

   // cout<<v<<endl;
   memset(vis, 0, sizeof vis);
   
   for (int i = 0; i < sz(v); ++i)
   {
      if(vis[v[i]])continue;
      WOW(v[i]);
   }

   // for (int i = 0; i < sz(v); ++i)
   // {
      // for(auto j: rev[i]){
         // smax(dp[j], dp[v[i]]+1);
         // smax(Pans, dp[j]);
      // }
   // }

   cout<<max(Pans-1,1LL);
   //make sure N size is correct!!!!!!!!!
   return 0;
}

Measured memory_bytes: 26152
#include <cstdio>
#include <algorithm>
using namespace std;

int main() {
	int N;
	scanf("%d", &N);
	int *a = new int[N];
	int p[100002] = {0};
	int max = 0, min = 100001;
	for (int i = 0; i < N; i++) {
		scanf("%d", &a[i]);
		p[a[i]]++;
		if (max < a[i])
			max = a[i];
		if (min > a[i])
			min = a[i];
	}
	sort(a, a+N);
	int count = 0;
	int result = 0;
	for (int X = min; X <= max; X++) {
		if (X == 0)
			count = p[X] + p[X+1];
		else 
			count = p[X-1] + p[X] + p[X+1];
		if (result < count)
			result = count;
		count = 0;
	}
	printf("%d\n", result);
	delete[] a;
}


Measured memory_bytes: 1272
#include <bits/stdc++.h>
using namespace std;
 
 
 
int main() {
 
  int a,b;
  cin>>a>>b;
 
  if(a+b==15)
    cout<<'+'<<endl;
  else if(a*b==15)
    cout<<'*'<<endl;
  else
    cout<<'x'<<endl;
  
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  
  int ans = 0;
  // 全探索
  for (int i = 0; i < 1000; i++) {
    int c[3] = {i / 100, (i/10) % 10, i % 10};
    
    int ind = 0;
    for (int j = 0; j < N; j++) {
      if (S[j] == '0' + c[ind]) ind++;
      
      if (ind == 3) {
        ans++;
        break;
      }
    }
    
  }
  
  cout << ans << endl;
}

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

int main(){
    int n;
    cin >> n;  
    vector<int> ans(n);

    for(int i = 1; i <= n; ++i){
        int a;
        cin >> a;
        ans[a-1] = i;
    }

    for(int i = 0; i < n; ++i){
        cout << ans[i] << " ";
    }
    cout << "\n" << endl;

}

Measured memory_bytes: 1152
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===
n, m = map(int, input().split())
a = getSomeInputListInt(n)
b = getSomeInputInt(m)

ans = 0
for i in range(n):
    for j in range(m):
        a[i][j] *= b[j]
    print(sum(a[i]))




Measured memory_bytes: 7360
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
#define rep(i,a,n) for(ll i = a ; i <=n;++i)
#define sf(n) scanf("%lld",&n)
#define pf(n) printf("%lld\n",n)
#define bug printf("bug\n")
#define pi 3.14159265

int main(){


ll a , b , c , x , y ;
cin >> a >>b >> c >> x >> y ;

ll c1 = a * x + b * y;
ll c2 = c*2*max(x,y);
ll c3 = 0;
if(x== y) cout <<min(c1,c2)<<endl;

else{
ll mi = min(x,y);
if(mi == x){
  c3 = c * x * 2 + (y - x) * b ;

}
else if(mi == y){
  c3 = c * y * 2 + (x - y) * a ;

}
cout <<min({c1,c2,c3})<<endl;
}
return 0;
}


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

using namespace std;

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

int N;
vector<int> A, B;
vector<P> in;

int dp[2001][2001];//Aがi番目まで整序されて、Bがj番目まで整序されてる時の最小手数
int costA[2001][2001], costB[2001][2001];
int cntA[2000], cntB[2000];

int main() {
	cin >> N;
	A.resize(N), B.resize(N), in.resize(2 * N);
	for (int i = 0; i < 2 * N; i++) {
		cin >> in[i].first >> in[i].second;
		in[i].second--;
	}

	for (int i = 0; i < 2 * N; i++) {
		int sumA[2001] = {}, sumB[2001] = {};
		for (int j = N - 1; j >= 0; j--) {
			sumA[j] = sumA[j + 1] + cntA[j];
			sumB[j] = sumB[j + 1] + cntB[j];
		}
		
		int num = in[i].second;
		for (int j = 0; j <= N; j++) {
			if (in[i].first == 'B') {
				costA[num][j] = sumA[num + 1] + sumB[j];
			}
			else {
				costB[j][num] = sumA[j] + sumB[num + 1];
			}

		}
		if (in[i].first == 'B')cntA[num]++;
		else cntB[num]++;
	}

	for (int i = 0; i <= N; i++)for (int j = 0; j <= N; j++)
		if (!(i == 0 && j == 0))dp[i][j] = 1145141919;
	dp[0][0] = 0;

	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N; j++) {
			if (i + 1 <= N) {
				dp[i + 1][j] = min(dp[i][j] + costA[i][j], dp[i + 1][j]);
			}
			if (j + 1 <= N) {
				dp[i][j + 1] = min(dp[i][j] + costB[i][j], dp[i][j + 1]);
			}
		}
	}
	cout << dp[N][N] << endl;
	return 0;
}

Measured memory_bytes: 47232
#include <iostream>
using namespace std;
int main (){
  int N;
  cin>>N;
  int num[9],total=1,K;
  K=N;
  if(K!=1000000000){
  for(int i=0;i<9;i++){
    num[i]=N%10;
    N=(N-N%10)/10;
  }
  total=0;
  for(int i=0;i<9;i++){
    total+=num[i];
  }}
  if(K%total==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


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

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

  vector<long long> h(n, 0);
  for(int i=0;i <n; i++)
    cin >> h[i];

  vector<long long> dp(n, 0);
  dp[1] = abs(h[0] - h[1]);
  for(int i=2; i<n; i++)
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]) , dp[i-2]+abs(h[i]-h[i-2]));

  cout<<dp[n-1]; 
  return  0;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

const int MAX_N=2e5;

int N;
ll A[MAX_N];

ll psx[MAX_N+1],psp[MAX_N+1];

int main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	REP(i,N){
		psx[i+1]=psx[i]^A[i];
		psp[i+1]=psp[i]+A[i];
	}
	ll ans=0;
	REP(i,N){
		ll lb=-1,ub=i;
		while(ub-lb>1){
			ll mid=(lb+ub)>>1;
			if ((psx[i+1]^psx[mid])==psp[i+1]-psp[mid]){
				ub=mid;
			}else{
				lb=mid;
			}
		}
		ans+=i-ub+1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef __int128 lll;
#define print(i) cout << "debug: " << i << endl
#define close() ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define mem(a, b) memset(a, b, sizeof(a))
const ll mod = 1e9 + 7;
const int maxn = 2e6;
const int inf = 0x3f3f3f3f;

int main()
{
    int n; cin >> n;
    if(n >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define repr(i,a,b) for(int i=a; i<b; i++)
typedef vector<int> vi;
typedef vector<vi> vvi;

bool is_integer( double x ){
  return std::floor(x)==x;
}

bool check(vi a, vi b) {
  int d2 = 0;
  rep(i, a.size()) {
    d2 += (a[i] - b[i]) * (a[i] - b[i]);
  }

  if( is_integer(sqrt(d2)) ) return true;
  else return false;

}

int main(void) {
  int N, D;
  cin >> N >> D;
  vvi x(N,vi(D));
  rep(i,N) {
    rep(j,D) {
      cin >> x[i][j];
    }
  }

  int ans = 0;
  rep(i,N) {
    repr(j,i+1,N) {
      if(check(x[i],x[j])) ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007

#define read(type) readInt<type>()
#define max1 1000008
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
typedef long int li;

typedef unsigned long int uli;

typedef long long int ll;

typedef unsigned long long int  ull;


void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}

int main() {
 int n,a;
 cin>>n>>a;
 int x[n];
 FOR(i,n){
 cin>>x[i];}
 ll dp[n+1][n+1][2501];
    FOR(i,n+1)
    {
    FOR(j,n+1)
        {
    FOR(k,n*a + 1)
        {
        dp[i][j][k] = 0;
        }
        }
    }
    dp[0][0][0] = 1;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            for(ll k=0;k<=2500;k++)
            {
                if(j == 0 || (k - x[i-1]) < 0)
                {
                    dp[i][j][k] = dp[i-1][j][k];
                }
                else
                {
                    dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i-1]];
                }
            }
        }
    }

    ll res = 0;
    for(int k = 1; k <= n; k++)
    {
        res += dp[n][k][k*a];
    }
    out(res);

}



Measured memory_bytes: 51072
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
const int N=1e5+3;
int dp[N][13];
const int mod=1e9+7;

//dp[i][j]  number of digits at ith idx that give remainder j
int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("in","r",stdin);
	freopen("out","w",stdout);
	#endif

	string s;
	cin>>s;int n=s.length();
	dp[0][0]=1; //put 0 here
	for(int i=0;i<n;i++)
	{
		int c;
		if(s[i]=='?')c=-1;
		else c=s[i]-'0';
		for(int j=0;j<=9;j++)
		{
			if(c!=-1 and c!=j)continue;
			for(int rem=0;rem<13;rem++)
			{
				dp[i+1][(rem*10+j)%13]+=dp[i][rem];
			}
		}
		for(int j=0;j<13;j++)dp[i+1][j]%=mod;
	}

	cout<<dp[n][5];
	
}

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

using namespace std;
typedef long long LL;

int main(){
  string S;
  cin >> S;
  int N=S.size();
  N--; S.pop_back();
  while(1){
    if(N%2==1){
      N--;
      S.pop_back();
      continue;
    }
    rep(i,N/2){
      if(S[i]!=S[i+N/2]){
        N--;
        S.pop_back();
        break;
      }
      if(i==N/2-1){
        cout << N << endl;
        return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    String s = sc.next();
    if(a>=3200){
      System.out.println(s);
    }else{
      System.out.println("red");
    }
  }
 }

Measured memory_bytes: 23252
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

ll get(ll x) {
	ll ans = 0;
	while (x) {
		ans += x % 10;
		x /= 10;
	}
	return ans;
}

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	set<ll> ss;
	ll now = 1;
	for (int i = 0; i <= 15; ++i, now *= 10) {
		for (ll j = 0;; ++j) {
			ll x = now * j + now - 1;
			if (x <= get(x) * now)
				ss.insert(x);
			else
				break;
		}
	}
	ss.erase(0);
	int k;
	cin >> k;
	for (ll x: ss){
		cout << x << "\n";
		--k;
		if (k == 0)
			break;
	}
	return 0;
}




Measured memory_bytes: 384
#include<stdio.h>

#define MATRIX_MAX 100

#define LOOP_RESET 0

#define MATRIX_RESET 0

#define DIFF 1

#define RETURN 0

int main(){

        unsigned long ulW_D_inact[MATRIX_MAX][MATRIX_MAX];        /* 行列Ａの格納用配列 */

        unsigned long ulW_D_act[MATRIX_MAX][MATRIX_MAX];          /* 行列Ｂの格納用配列 */

        unsigned long ulW_D_ans[MATRIX_MAX][MATRIX_MAX];          /* 積の格納用変数 */

        unsigned short usW_D_row;                                 /* 行数の格納用変数 */

        unsigned short usW_D_share;                               /* 共用部分の格納用変数 */

        unsigned short usW_D_col;                                 /* 列数の格納用変数 */

        unsigned short usW_C_i, usW_C_j, usW_C_k;                 /* ループ変数 */

        

        /* 配列の初期化 */

        for(usW_C_i = LOOP_RESET;usW_C_i < MATRIX_MAX;usW_C_i++){

                for(usW_C_j = LOOP_RESET;usW_C_j < MATRIX_MAX;usW_C_j++){

                        ulW_D_inact[usW_C_i][usW_C_j] = MATRIX_RESET;

                        ulW_D_act[usW_C_i][usW_C_j] = MATRIX_RESET;

                        ulW_D_ans[usW_C_i][usW_C_j] = MATRIX_RESET;

                }

        }

        

        /* 行数、共通部分、列数の入力 */

        scanf("%d %d %d", &usW_D_row, &usW_D_share, &usW_D_col);

        

        /* 行列Ａの入力 */

        for(usW_C_i = LOOP_RESET;usW_C_i < usW_D_row;usW_C_i++){

                for(usW_C_j = LOOP_RESET;usW_C_j < usW_D_share;usW_C_j++){

                        scanf("%ld", &ulW_D_inact[usW_C_i][usW_C_j]);

                }

        }

        

        /* 行列Ｂの入力 */

        for(usW_C_i = LOOP_RESET;usW_C_i < usW_D_share;usW_C_i++){

                for(usW_C_j = LOOP_RESET;usW_C_j < usW_D_col;usW_C_j++){

                        scanf("%ld", &ulW_D_act[usW_C_i][usW_C_j]);

                }

        }

        

        /* 行列Ａと行列Ｂの積の計算 */

        for(usW_C_i = LOOP_RESET;usW_C_i < usW_D_row;usW_C_i++){

                for(usW_C_j = LOOP_RESET;usW_C_j < usW_D_col;usW_C_j++){

                        for(usW_C_k = LOOP_RESET;usW_C_k < MATRIX_MAX;usW_C_k++){

                                ulW_D_ans[usW_C_i][usW_C_j] += ulW_D_inact[usW_C_i][usW_C_k] * ulW_D_act[usW_C_k][usW_C_j];

                        }

                }

        }

        

        /* 計算結果の出力 */

        for(usW_C_i = LOOP_RESET;usW_C_i < usW_D_row;usW_C_i++){

                for(usW_C_j = LOOP_RESET;usW_C_j < usW_D_col - DIFF;usW_C_j++){

                        /* 末端列以外の出力 */

                        printf("%ld ", ulW_D_ans[usW_C_i][usW_C_j]);

                }

                /* 末端列の出力 */

                printf("%ld\n", ulW_D_ans[usW_C_i][usW_D_col - DIFF]);

        }

        

        return RETURN;

}



Measured memory_bytes: 2116
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 1010101010101010;
const int INF = 1010101010;
const int dx[] = {-1,0,1,0,-1,-1,1,1};
const int dy[] = {0,-1,0,1,1,-1,1,-1};

int main(){
  while(true){
    int n; cin>>n;
    if(n==0) return 0;
    vector<int> t(400000);
    rep(i,n){
      string s,e; cin>>s>>e;
      int t0=0,t1=0;
      t0+=(s[0]-'0')*36000+(s[1]-'0')*3600+(s[3]-'0')*600+(s[4]-'0')*60+(s[6]-'0')*10+(s[7]-'0');
      t1+=(e[0]-'0')*36000+(e[1]-'0')*3600+(e[3]-'0')*600+(e[4]-'0')*60+(e[6]-'0')*10+(e[7]-'0');
      t[t0]++; t[t1]--;
    }
    rep(i,370000) t[i+1]+=t[i];
    int ans=0;
    rep(i,370000) ans=max(ans,t[i]);
    cout<<ans<<endl;
  }
}



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

int main() {
  long int A, B, C, D;
  cin >> A >> B >> C >> D;
  long int sumAC = 0, sumAD = 0,sumACD = 0, sumBC = 0, sumBD = 0, sumBCD = 0, sumACDuso = 0, sumBCDuso = 0;
  long int out;
  long int saidai;
  long int tempC = C, tempD = D;
  saidai = C * D;
  int r;
  if(tempC > tempD){
    long int tmp = tempC;
    tempC = tempD;
    tempD = tmp;
  }
  r = tempD % tempC;
  while(r != 0){
    tempD = tempC;
    tempC = r;
    r = tempD % tempC;
  }
  saidai = saidai / tempC;
    
  sumAC = A / C;
  sumAD = A / D;
  sumBC = B / C;
  sumBD = B / D;
  sumACD = A / (saidai);
  sumBCD = B / (saidai);
  sumBCDuso = sumBC + sumBD - sumBCD;
  sumACDuso = sumAC + sumAD - sumACD;
  if(A % C == 0 | A % D == 0){
    sumACDuso--;
  }
  out = sumBCDuso - sumACDuso;
  out = B - A + 1 - out;
  cout << out << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

typedef long long llint;

const int MAXN = 2005;
const int MOD = 1000000007;

llint a, b, sol;
llint nck[MAXN] [MAXN];
llint sum[MAXN] [MAXN];
llint dp[MAXN] [MAXN];

llint add (llint x, llint y) {
    if (x+y>=MOD) return x+y-MOD; return x+y;
}

llint mul (llint x, llint y) {
    return x*y%MOD;
}

void precompute () {
    for (int i=0; i<MAXN; i++) {
        nck[i] [0]=nck[i] [i]=1;
        sum[i] [0]=1;
    }
    for (int i=1; i<MAXN; i++) {
        for (int j=1; j<=i; j++) {
            nck[i] [j]=add(nck[i-1] [j-1], nck[i-1] [j]);
            sum[i] [j]=add(sum[i] [j-1], nck[i] [j]);
        }
    }
}

int main () {
    cin >> a >> b;
    precompute();
    for (int i=0; i<MAXN; i++) {
        dp[i] [0]=1;
        for (int j=1; j<MAXN; j++) {
            if (i==0) {
                dp[i] [j]=1;
            } else {
                dp[i] [j]=add(dp[i-1] [j], sum[j-1] [min(i, j-1)]);
            }
        }
    }
    for (int i=0; i<=a; i++) {
        int lim=min(a-i, b-1);
        for (int j=0; j<=lim; j++) {
            sol=add(sol, mul(nck[b-1] [j], dp[a-i-j] [j]));
        }
    }
    cout << sol;
    return 0;
}


Measured memory_bytes: 94464
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>

using namespace std;

#define ll long long

int main(void){
    int h, w, n;
    cin >> h >> w >> n;
    int ans = 0;

    if(h > w){
        ans = ceil((double)n/(double)h);
    }else{
        ans = ceil((double)n/(double)w);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,i,j,m,a,b,c,k;
  int s[1500];
  for(i=1;i<1500;i++)s[i]=i*(i+1)/2;//printf("%10d",s[i]);}
  while(1){
    scanf("%d",&n);
    if(!n)break;
    int d[20000]={0};
    b=0;
    for(i=0;i<n;i++){
      scanf("%d",&d[i]);
      b+=d[i];
    }//printf("%d",b);
    for(i=0;s[i]<=b;i++){
      if(s[i]==b)break;
    }
    if(s[i]==b){
      m=i;//printf("%d",m);
      c=n;
      int z=0;
      for(i=c;i<10000+c;i++){//printf(":%d:",i);
	//m=i;
	for(j=m;j>0;j--){//printf("%d,",d[i+j-m-1]);
	  if(d[i+j-m-1]!=j)break;
	}//printf("\n");
	if(j==0){
	  printf("%d\n",i-c);
	  break;
	}
	d[i]=n;
	z=0;
	for(j=1;j<=n;j++){
	  d[i-j]--;
	  d[i-j+z]=d[i-j];
	  if(d[i-j]==0){
	    z++;
	  }
	}
	n-=z-1;
     	//if(i>40)break;
	//printf("%d,%d:\n",n,z);
	//for(j=0;j<n;j++)printf("%d ",d[i-n+j+1]);printf("\n");
      }
      if(i==10000+c)printf("-1\n");
    }
    else printf("-1\n");
  }
  return 0;
}

Measured memory_bytes: 704
#include<iostream>
#include<vector>
#define repeat(i,n) for(int i=0;(i)<(n);i++)
using namespace std;
const int inf=1e9+7;
int main(){
    int n,t;cin>>n>>t;
    vector<int>a(n);repeat(i,n) cin>>a[i];
    vector<int> minacc(n+1); minacc[0]=inf;repeat(i,n)minacc[i+1]=min(minacc[i],a[i]);
    auto profit=[&](int i){return a[i]-minacc[i+1];};
    int max_profit=-1,cnt=0;
    repeat(i,n){
        if(max_profit<profit(i)){
            max_profit=profit(i);
            cnt=1;
        }
        else if(max_profit==profit(i)){
            cnt+=1;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int n, m, x, y, z, f[100010], ans;
bool vis[100010];
inline int anc(int x){
	if(x == f[x]) return x;
	return f[x] = anc(f[x]);
}
inline void Union(int x, int y){
	int fx = anc(x), fy = anc(y);
	if(fx != fy) f[fx] = fy;
	return;
}
int main(){
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i) f[i] = i;
	for(int i = 1; i <= m; ++i){
		scanf("%d%d%d", &x, &y, &z);
		Union(x, y);
	}
	for(int i = 1; i <= n; ++i){
		if(!vis[anc(i)]){
			vis[f[i]] = 1;
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define all(v) (v).begin(),(v).end()
#define pb push_back
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  int n;
  cin>>n;
  vi x(n);
  rep(i,n) cin>>x[i];
  int ans=INF;
  FOR(p,1,100){
    int ams=0;
    rep(i,n) ams+=(x[i]-p)*(x[i]-p);
    chmin(ans,ams);
  }

  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys,math
input = sys.stdin.readline

def f(s):
    n = int(s)%2
    return n

N,P = list(map(int,input().split()))
A = list(map(f,input().split()))

c0 = A.count(0)
c1 = A.count(1)
fact = [1]* (c1+1)
for i in range(1,c1+1):
    fact[i]= fact[i-1]*i

cnt = 0
for i in range(P,c1+1,2):
    cnt += fact[c1]//fact[i]//fact[c1-i]

print(cnt*pow(2,c0))


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

int main(){
  ios_base::sync_with_stdio(false);
  int n,a,b;
  while(1){
    cin >> n;
    if(n==0) break;
    int ans1=0,ans2=0;
    for(int i=0;i<n;i++){
      cin >> a >> b;
      if(a>b) ans1+=(a+b);
      else if(b>a)ans2+=(a+b);
      else{
	ans1+=a;
	ans2+=b;
      }
    }
    cout << ans1 << ' ' << ans2 << endl;
  }
  return 0;
}

Measured memory_bytes: 3104
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

c = [''] * n
ans = 0
for i in range(n):
    if t[i] == 'r':
        rsp = 'p'
        point = p
    elif t[i] == 's':
        rsp = 'r'
        point = r
    elif t[i] == 'p':
        rsp = 's'
        point = s
    
    if i >= k and c[i-k] == rsp:
        rsp = ''
        point = 0
    
    c[i] = rsp
    ans += point
print(ans)

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

long ReturnDigits(long x)
{
    int digits = 0;
    while(x>0)
    {
        x /= 10;
        digits++;
    }

    return digits;
}

long ReturnMaxDigits(long x, long y)
{
    return max(ReturnDigits(x), ReturnDigits(y));
}


int main()
{
    long N;
    cin >> N;

    long m = 10;
    for (long i = 1; i <= pow(N, 0.5); i++)
    {
        if (i * (N/i) == N)
            m = min(ReturnMaxDigits(i, N/i), m);
    }

    cout << m << endl;
}

Measured memory_bytes: 384
N = int(input())

a, b = [], []
for i in range(N):
    x, y = map(int, input().split())
    a.append(x+y)
    b.append(x-y)

a.sort()
b.sort()

answer = max(a[-1] - a[0], b[-1] - b[0])
print(answer)

Measured memory_bytes: 25856
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int n;

    while (cin >> n, n) {
        int y;
        int ans_no;
        double max_ans = 0;

        cin >> y;
        while (n--) {
            int b, r, t;
            double gankin;
            
            cin >> b >> r >> t;
            // 単利
            if (t == 1) 
                gankin = 1 + y * r / 100.0;
            // 複利
            else
                gankin = pow((1 + r / 100.0), y);

            if (max_ans < gankin) {
                max_ans = gankin;
                ans_no = b;
            }
        }
        cout << ans_no << endl;
    }

    return 0;
}

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

namespace ABC167D
{
    class Program
    {
        static void Main(string[] args)
        {
            var NK = ReadLong();
            int N = (int)NK[0];
            long K = NK[1];

            int[] A = ReadInt().Select(x => x - 1).ToArray();
            int[] arrived = new int[N].Select(x => -1).ToArray();
            arrived[0] = 0;

            int circle = 0;
            int circleStart = 0; //index
            int index = 0;
            while (true)
            {
                circle++;
                int next = A[index];

                if (arrived[next] != -1)
                {
                    circleStart = next;
                    break;
                }

                index = next;
                arrived[next] = circle;
            }

            int ans = 0;

            if (K <= arrived[circleStart])
            {
                for (int i = 0; i < N; i++)
                {
                    if (arrived[i] == K) ans = i;
                }
            }
            else
            {
                int oneCircle = circle - arrived[circleStart];

                long amari = (K - arrived[circleStart]) % oneCircle;

                for (int i = 0; i < N; i++)
                {
                    if (arrived[i] == amari + arrived[circleStart]) ans = i;
                }
            }

            Console.WriteLine(ans + 1);
            Console.ReadKey();
        }

        static int[] ReadInt()
        {
            int[] ret = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return ret;
        }
        static long[] ReadLong()
        {
            long[] ret = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return ret;
        }
    }
}


Measured memory_bytes: 38744
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
 
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define allof(a) (a).begin(),(a).end()
 
typedef vector<int> vi;
 
int main()
{
    for(int a,b,c;cin>>a>>b>>c;){
        vi cards;
        repi(i,1,10+1)
            if(i!=a && i!=b && i!=c)
                cards.push_back(i);
        int i=distance(cards.begin(),upper_bound(allof(cards),20-a-b));
        if(i>=4)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
     
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
    double x1, y1, x2, y2, d;
    cin >>x1 >> y1 >> x2 >> y2;
    d = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
    cout << setprecision(5) << fixed;
    cout << d << endl;
    return 0;
}


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

long long a[400];
long long s[400];
long long dp[401][401];

int main(){
  int N;
  std::cin>>N;
  for(int i=0;i<N;++i){
    std::cin>>a[i];
    s[i]=(i>0?s[i-1]:0)+a[i];
  }
  for(int i=0;i<=N;++i){
    for(int j=0;j<=N;++j){
      dp[i][j]=1LL<<60;
    }
  }
  for(int i=0;i<N;++i){
    dp[i][i+1]=0;
  }
  for(int d=2;d<=N;++d){
    for(int i=0;i+d<=N;++i){
      for(int k=i+1;k<i+d;++k){
	dp[i][i+d]=std::min(dp[i][i+d], dp[i][k]+dp[k][i+d]+s[i+d-1]-(i>0?s[i-1]:0));
      }
    }
  }
  std::cout<<dp[0][N]<<std::endl;
  return 0;
}


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

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        double r = sc.nextDouble();
        
        double s = r * r * Math.PI;
        double l = r * 2 * Math.PI;
        
        System.out.println(String.format("%.6f", s) + " " + String.format("%.6f", l));
    }
}


Measured memory_bytes: 28276
//

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int x,y,a,b,c;cin>>x>>y>>a>>b>>c;
    priority_queue<int,vector<int>,greater<int>>p,q;
    priority_queue<int>r;
    rep(i,0,a){
        int t;cin>>t;
        p.push(t);
    }
    rep(i,0,b){
        int t;cin>>t;
        q.push(t);
    }
    rep(i,0,c){
        int t;cin>>t;
        r.push(t);
    }
    while(p.size()>x)p.pop();
    while(q.size()>y)q.pop();
    rep(i,0,c){
        int j=p.top(),k=q.top(),l=r.top();
        if(j<=k&&j<l){
            p.pop();
            r.pop();
            p.push(l);
        }else if(k<=j&&k<l){
            q.pop();
            r.pop();
            q.push(l);
        }else{
            break;
        }
    }
    int ans = 0;
    while(!p.empty()){ans+=p.top();p.pop();}
    while(!q.empty()){ans+=q.top();q.pop();}
    cout<<ans<<nnn;
}

Measured memory_bytes: 6420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF=1e18,MOD=1e9+7;
pair<int,int> maps[2001][2001];
int main(){
    int h,w;
    cin>>h>>w;
    vector<string>m(h);
    for(int i=0;i<h;i++)cin>>m[i];
    int start=0,end=0,cnt;
    for(int i=0;i<h;i++){
        start=0;
        end=0;
        cnt=0;
        for(int j=0;j<w;j++){
            if(m[i][j]=='#'){
                maps[i][j].first=0;
                end=j-1;
                if(end-start>=0){
                    for(int k=start;k<=end;k++){
                        maps[i][k].first=cnt;
                    }
                }
                start=j+1;
                cnt=0;
                continue;
            }
            cnt++;
            if(j==w-1&&m[i][j]!='#'){
                end=j;
                for(int k=start;k<=end;k++){
                    maps[i][k].first=cnt;
                }
            }
        }
    }



    for(int i=0;i<w;i++){
        start=0;
        end=0;
        cnt=0;
        for(int j=0;j<h;j++){
            if(m[j][i]=='#'){
                maps[j][i].second=0;
                end=j-1;
                if(end-start>=0){
                    for(int k=start;k<=end;k++){
                        maps[k][i].second=cnt;
                    }
                }
                start=j+1;
                cnt=0;
                continue;
            }
            cnt++;
            if(j==h-1&&m[j][i]!='#'){
                end=j;
                for(int k=start;k<=end;k++){
                    maps[k][i].second=cnt;
                }
            }
        }
    }
    int ans=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++)ans=max(ans,maps[i][j].first+maps[i][j].second);
    }
    if(ans!=0)ans--;
    cout<<ans<<endl;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;

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

Measured memory_bytes: 3596
s = int(input())
a = [s]
check = [s]
while a:
    n = a.pop()
    if n in a:
        print(len(a)+1)
        exit()
    elif n%2==0:
        a.append(n)
        a.append(n//2)
    else:
        a.append(n)
        a.append(n*3+1)


Measured memory_bytes: 2940
import Data.Char
import qualified Data.ByteString.Lazy.Char8 as BLC

swapCase :: Char -> Char
swapCase c
    | isUpper c = toLower c
    | isLower c = toUpper c
    | otherwise = c

main = BLC.getContents >>= BLC.putStr . BLC.map swapCase

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

int main() {
	string s;
	cin >> s;
	
	int a,z;
	for(int i=0; i<s.length(); i++){
		if(s[i]=='A'){
			a=i; break;
		}
	}
	for(int i=s.length()-1; i>=0; i--){
		if(s[i]=='Z'){
			z=i; break;
		}
	}
	
	cout << z-a+1 << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6+7;
typedef long long ll;
int n, m, k;


int main()
{
    ios::sync_with_stdio(0); cin.tie(0); //C++关同步
    cin >> n;
    cout << n / 500 * 1000 + (n % 500) / 5 * 5 << "\n";
    return 0;
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll INF=1LL<<60;
const int MOD=1e9+7;

int main(){
    int N; cin >> N;
    vi a(N);
    ll val=0;
    for(int i=0; i<N; i++){
       cin >> a[i];
       val^=a[i];
    }
    for(int i=0; i<N; i++){
        if(i != 0) cout << " ";
        cout << (val^a[i]);
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 4044
#include <bits/stdc++.h>
 
#include <cmath>
using namespace std;
 
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
typedef long long ll;
 
int main() {
    int R;
    cin >> R;
    cout << 2 * R * M_PI << endl;
    return 0;
}

Measured memory_bytes: 3728
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <deque>
using ll = long long;
using namespace std;

int main(){
    ll n, k, cnt = 0, a, b;
    cin >> n >> k;
    ll A[100010] = {0};
    for (int i = 0; i < n; i++) {
        cin >> a >> b;
        A[a] += b;
    }
    ll index = 0;
    while(cnt<k){
        cnt += A[index];
        index++;
    }
    cout << index-1 << endl;
    return 0;
}


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

#define Mset(s, n)      memset(s, n, sizeof(s))
#define Rp0(i, m)       for(int i = 0; i < m; ++i)
#define Rpd(i, m, l)    for(int i = l; i >= m; --i)
#define Rp1(i ,m)       for(int i = 1; i <= m; i++)
#define All(a)          (a).begin(), (a).end()
#define Lwb             lower_bound
#define Upb             upper_bound
#define Sz(a)           int((a).size())
#define u_map           unordered_map
#define Exist(a, b)     (find(All(a), (b)) != (a).end())
#define Sort(x)         sort(All(x))
#define Gsort(x)        sort(All(x), greater<typeof(*((x).begin()))>())
#define Unique(v)       Sort(v); (v).resize(unique(ALL(v)) - (v).begin())
#define Max(a, b, c)    max(a, max(b, c))

#define fi              first
#define se              second
#define pb              push_back
#define pf              push_front
#define is              insert
#define ooi             INT_MAX
#define ool             LLONG_MAX
#define ll              long long
#define ull             unsigned ll
#define ld              long double
#define pii             pair<int, int>
#define vi              vector<int>
#define vpii            vector<pii>

const ll MOD = (ll) 1e9 + 7;
const ld PI = acos((ld) -1);
inline int Get_bit(int x, int k){return (x >> (k - 1)) & 1;}
inline ll Gcd(ll a, ll b) {ll r; while(b){ r = a % b; a = b; b = r;} return a;}
inline ll Lcm(ll a, ll b) {return a / Gcd(a, b) * b;}
inline ll Pow(ll n, ll k) {ll r = 1; for(; k; k >>= 1, n = n * n % MOD){if(k & 1) r = r * n % MOD;} return r;}
const int base = 311;


const int N = 5e3 + 5;
ll n, m, k, ans, q, s, t;
ll a[N];

void Solve(){
    string s;
    cin >> n;
    cin >> s;
    int m = unique(All(s)) - (s).begin();
    cout << m;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(6);
    Solve();
}



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

int N,K;
vector<int> A;

bool need(int idx) {
  int a = A[idx];
  if (a >= K) return true;
  vector<int> dp(K+1);
  dp[0] = 1;
  int max_j = 0;
  for (int i = 0; i < N; i++) {
    if(i == idx) continue;
    int b = A[i];
    int max_j2 = max_j;
    for (int j = 0; j <= max_j; j++) {
      if (dp[j] == 0) continue;
      if (j+b < K-a) {
        dp[j+b] = 1;
        max_j2 = max(max_j2, j+b);
      } else if (j+b < K) {
        return true;
      }
    }
    max_j = max_j2;
  }
  return false;
}

int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A.push_back(a);
  }
  sort(A.begin(),A.end(),greater<int>());

  int ok = -1;
  int ng = N;
  while (ng - ok > 1) {
    int m = (ok+ng) / 2;
    if(need(m)) {
      ok = m;
    } else {
      ng = m;
    }
  }
  cout << N - ok - 1 << endl;
}

Measured memory_bytes: 256