akhauriyash/Code-Regression huggingface dataset:
"use strict";
    
const main = arg => {
    const b = arg.split("\n")[0];
    
    if(b == "A") {
        console.log("T")
    } else if (b == "T") {
        console.log("A")
    } else if (b == "C") {
        console.log("G")
    } else if (b == "G") {
        console.log("C");
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 22076
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <cstdlib>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int n; cin >> n;
	cout << 0 << endl;
	string z; cin >> z;
	if (z == "Vacant")return 0;
	int ok = 0, ng = n;
	while (true)
	{
		int mid = abs(ok + ng) / 2;
		cout << mid << endl;
		string s; cin >> s;
		if (s == "Vacant")return 0;
		else if ((mid % 2 == 0 && s == z) || (mid % 2 == 1 && s != z))
		{
			ok = mid;
		}
		else ng = mid;
	}
}

Measured memory_bytes: 852
#include<iostream>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
string NEG[]={"2","1","0"},AND[][3]={{"0","0","0"},{"0","1","1"},{"0","1","2"}},
OR[][3]={{"0","1","2"},{"1","1","2"},{"2","2","2"}};
string replaceAll(string s,string f,string t) {
	string r;
	for(int p=0;(p=s.find(f))!=s.npos;)r+=s.substr(0,p)+t,s=s.substr(p+f.size());
	return r+s;
}
string replace(string s,string f,string t){
	string r;
	int p=s.find(f);
	if (p!=s.npos)r+=s.substr(0,p)+t,s=s.substr(p+f.size());
	return r+s;
}
int main(){
	string s,t,nt,n,a,o,nm;
	while(cin>>s,s!="."){
		int c=0;
		rep(p,3)rep(q,3)rep(r,3){
			nm=" ";nm[0]='0'+p;
			t=replaceAll(s,"P",nm);nm[0]='0'+q;
			t=replaceAll(t,"Q",nm);nm[0]='0'+r;
			t=replaceAll(t,"R",nm);
			for(nt=t;;t=nt){
				rep(i,3){
					n="- ",n[1]=i+'0';
					nt=replaceAll(nt,n,NEG[i]);
					rep(j,3){
						a="(X*X)",a[1]=i+'0',a[3]=j+'0';
						o="(X+X)",o[1]=i+'0',o[3]=j+'0';
						nt=replaceAll(nt,a,AND[i][j]);
						nt=replaceAll(nt,o,OR[i][j]);
					}
				}
				if(t==nt)break;
			}
			if(t=="2")c++;
		}
		cout<<c<<endl;
	}
	return 0;
}

Measured memory_bytes: 924
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define int long long
#define ll long long
#define pp pair<int,int>
#define mod 998244353
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
int max(int x, int y)
{
    return x>y ? x : y;
}
int min(int x, int y)
{
    return x<y ? x : y;
}
void _(int&a , int b)
{
    a=(a%mod+b%mod)%mod;
    a=(a+mod)%mod;
}
ll cl(ll a,ll b)
{
    return (a/b)+(!(!(a%b)));
}
long long modexp(long long base, long long power)
{
    long long res=1;
    while(power)
    {
        if(power&1) res=(res*base)%mod;
        power>>=1;
        base=(base*base)%mod;
    }
    return res;
}

long long invmod(long long num)
{
    return modexp(num,mod-2);
}

double logpow(double base, long long exp)
{
    double res=0.0;
    while(exp)
    {
        if(exp&1)    res+=base;
        exp>>=1;
        base+=base;
    }
    return res;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;cin >> n;
    vector<ll> v(n,0);
    ll a[n];
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    if(a[0]){cout << "0";return 0;}
    for (int i = 0; i < n; ++i)
    {
        v[a[i]]++;
    }
    if(v[0]!=1){cout << "0";return 0;}
    ll t=0;
    for (int i = 0; i < n; ++i)
    {
        if(v[i]==0)t=1;
        else
        {
            if(t){cout << 0;return 0;}
        }
    }
    int ans=1;
    for(int i=1;i<n and v[i];i++)
    {
        ans=((ans%mod)*(modexp(v[i-1],v[i])))%mod;
    }
    cout << ans;
    }

Measured memory_bytes: 1792
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 10000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;


int main(){
    bool flag=true;
    int N,ans=0,x,y;
    cin>>N;
    string s[310];
    for(int i=0;i<N;i++){
        cin>>s[i];
    }

    for(int i=0;i<N;i++,flag=true){
        for(int j=0;j<N;j++){
            for(int k=0;k<N;k++){
                if(s[j][(k+i)%N]!=s[k][(j+i)%N]) flag=false;
            }
        }
        //cout<<flag<<endl;
        if(flag) ans++;
    }
    cout<<ans*N<<endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 200005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>n;
	ll ar[n+1],a=0;
	for(i=1;i<=n;i++){
		cin>>ar[i];
		a=(a^ar[i]);
	}

	ll an[n+1];
	for(i=1;i<=n;i++){
		k=(a^ar[i]);
		an[i]=(k^a)^a;
	}
	for(i=1;i<=n;i++){
		cout<<an[i]<<" ";
	}
	return 0;	
}

Measured memory_bytes: 6736
AE = 5.times.map{|_| gets.to_i}
jikan = AE.map{|i| i % 10 == 0 ? i : i / 10 * 10 + 10}.sum
amari = AE.map{|i| i % 10}.select{|i| i > 0}.min
if amari.to_i > 0
  p jikan - 10 + amari
else
  p jikan
end

Measured memory_bytes: 14420
import java.util.*;

class Main{
    public static  void main(String args[]){
      Scanner sc = new Scanner(System.in);
      int s = sc.nextInt();
      int s1 = s /100;
      int s2 = (s - s1 * 100) /10;
      int s3 = s - s1 * 100 - s2 * 10;
      int n = 0;
      if (s1 == 1){
        n += 1;
      }
      if (s2 == 1){
        n += 1;
      }
      if (s3 == 1){
        n += 1;
      }

      System.out.println(n);





    }
}


Measured memory_bytes: 20820
#include <stdio.h>

int main(void) {
    int i,n,count = 0;
    int p[20] = {};

    scanf("%d",&n);

    if(n >= 3 && n <= 20) {
        for(i = 0; i < n; i++) {
            scanf("%d",&p[i]);
        }

        for(i = 1; i < n-1; i++) {
            if(p[i] > p[i-1] && p[i] < p[i+1]) {
                count++;
            } else if(p[i] < p[i-1] && p[i] > p[i+1]) {
                count++;
            }
         }

         printf("%d",count);
         
    } else {
        return 1;
    }

    return 0;
    
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;
 
int main()
{
  int N,ans=0;
  cin>>N;
  vector<int> p(N);
  for(int i=0;i<N;i++)cin>>p[i];
  sort(p.begin(),p.end());
  for(int i=0;i<N;i++){
    if(i!=N-1){
      ans+=p[i];
    }else{
      ans+=p[i]/2;
    }
  }
  cout<<ans<<endl;
}

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

using namespace std;

const long long int MOD=1e9+7;

int main() {
    int N;
    cin >> N;
    
    vector<vector<vector<vector<long long int> > > > dp(5, \
        vector<vector<vector<long long int> > >(5, \
            vector<vector<long long int> >(5, \
                vector<long long int>(N+1, 0))));
    for(int cs=1; cs<5; cs++) {
        dp[0][0][cs][1] = 1;
    }
    for(int ps=1; ps<5; ps++) {
        for(int cs=1; cs<5; cs++) {
            dp[0][ps][cs][2] += dp[0][0][ps][1];
        }
    }
    
    for(int pps=1; pps<5; pps++) {
        for(int ps=1; ps<5; ps++) {
            for(int cs=1; cs<5; cs++) {
                if(!((pps==1&&ps==3&&cs==2)||\
                    (pps==1&&ps==2&&cs==3) ||\
                    (pps==3&&ps==1&&cs==2))) {
                    dp[pps][ps][cs][3] += dp[0][pps][ps][2];
                }
            }
        }
    }
    
    
    long long int ans=0;
    for(int n=3; n<N; n++) {
        for(int pps=1; pps<5; pps++) {
            for(int ps=1; ps<5; ps++) {
                for(int cs=1; cs<5; cs++) {
                    for(int ppps=1; ppps<5; ppps++) {
                        if(!((pps==1&&ps==3&&cs==2)||\
                            (pps==1&&ps==2&&cs==3) ||\
                            (pps==3&&ps==1&&cs==2) ||\
                            (ppps==1&&pps==3&&cs==2) ||\
                            (ppps==1&&ps==3&&cs==2))) {
                            dp[pps][ps][cs][n+1] += dp[ppps][pps][ps][n]%MOD;
                        }
                    }
                }
            }
        }
    }

    for(int pps=0; pps<5; pps++) {
        for(int ps=0; ps<5; ps++) {
            for(int cs=0; cs<5; cs++) {
                ans += dp[pps][ps][cs][N]%MOD;
            }
        }
    }
    
    cout << ans%MOD << endl;

    return 0;
    
}

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

signed main(void)
{
	long long r, d, x;
	cin >> r >> d >> x;
	rep(i, 10)
	{
		x = r * x - d;
		cout << x << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <functional>
#include <iomanip>
//#include <windows.h>  //Should be deleted when using AtCoder&POJ
using namespace std;

#define ll long long
#define pii pair<int,int>
/**==Info==
*Program:1
*Problem:Built?
*Date:2018-3-31
*Algorithm:Teacher's Solution by Set
*Stats:Unknown*/

bool debug=false;

int n;
int x[100005],y[100005];

pii sx[100005],sy[100005];

set<pair<int,pii> > s; //<length,point a,point b>

int dsu[100005],ranks[100005];


int getP(int a){
	if(dsu[a]==a) return a;
	return dsu[a]=getP(dsu[a]);
}

void Union(int a,int b){
	if(ranks[b]>ranks[a]){
		dsu[a]=b;
	}else{
		dsu[b]=a;
		if(ranks[a]==ranks[b]) ranks[b]++;
	}
	
}


int getDis(int a,int b){
	return min(abs(x[a]-x[b]),abs(y[a]-y[b]));
}


int main(int argc,char* argv[]){
	scanf("%d",&n);
	
	for(int i=0;i<n;i++){
		scanf("%d%d",&x[i],&y[i]);
		sx[i]=make_pair(x[i],i);
		sy[i]=make_pair(y[i],i);
	}
	
	sort(sx,sx+n);
	sort(sy,sy+n);
	
	for(int i=0;i<n-1;i++){
		s.insert(make_pair(getDis(sx[i].second,sx[i+1].second),make_pair(sx[i].second,sx[i+1].second)));
		s.insert(make_pair(getDis(sy[i].second,sy[i+1].second),make_pair(sy[i].second,sy[i+1].second)));
	}
	
	for(int i=0;i<n;i++){
		dsu[i]=i;
		ranks[i]=0;
	}
	
	int ans=0;
	while(s.size()){
		pair<int,pii> pip=*s.begin();
		s.erase(s.begin());
		
		if(debug)cout<<pip.first<<" "<<pip.second.first<<" "<<pip.second.second<<endl;
		
		if(getP(pip.second.first)==getP(pip.second.second)) continue;
		
		if(debug)cout<<"--"<<endl;
		
		Union(getP(pip.second.first),getP(pip.second.second));
		ans+=pip.first;
	}
	
	cout<<ans;
	return 0;
}



Measured memory_bytes: 15872
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
using ll = long long;
const int inf = 1e8;
const int sz = 1005;
int n, m, ans;

int main() {

    while (cin >> m >> n) {
        
        ans = 0;

        int k = 1;

        while (k < n) {
            k--;
            k += m;
            ans++;
        }
        
        cout << ans << "\n";
    }
    return 0;
}

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

using namespace std;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  int ac = c - a;
  if (ac < 0) ac *= -1;
  if (ac <= d) {
    cout << "Yes" << endl;
  } else {
    int ab = b - a;
    if (ab < 0) ab *= -1;
    int bc = c - b;
    if (bc < 0) bc *= -1;
    if (ab <= d && bc <= d) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD =  1000000007 ;
const int INF = 2000000000;


    std::string S;
    int A[30];

int main(){
    cin>>S;
    for(auto x:S){
        A[int(x-'a')]++;
    }
    for(int i=0;i<26;i++){
        if(A[i]==0){cout<<char(i+'a');return 0;}
    }
    cout<<"None";
    return 0;

}


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

int main(){
	int dt[150000];
	dt[0]=0;
	dt[1]=0;
	for(int i=2;i<150000;i++){
		dt[i]=1;
	}
	for(int i=2;i<750;i++){
		for(int j=2*i;j<150000;j+=i){
			dt[j]=0;
		}
	}
	vector<int> prime;
	for(int i=0;prime.size()<10001;i++){
		if(dt[i]==1){
			prime.push_back(i);
		}
	}
	unsigned long long sum[10001];
	sum[0]=0;
	sum[1]=prime[0];
	for(int i=2;i<10001;i++){
		sum[i]=sum[i-1]+prime[i-1];
	}
	int n;
	while(1){
		cin>>n;
		if(n==0)break;
		cout<<sum[n]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1972
num=list(map(int,input().split()))
s=input()
for i in s:
    if i=='E':
        num=[num[3],num[1],num[0],num[5],num[4],num[2]]    
    if i=='W':
        num=[num[2],num[1],num[5],num[0],num[4],num[3]]
    if i=='S':
        num=[num[4],num[0],num[2],num[3],num[5],num[1]]
    if i=='N':
        num=[num[1],num[5],num[2],num[3],num[0],num[4]]
        
print(num[0])


Measured memory_bytes: 5600
#include <stdio.h>

#include <stdlib.h>
int n , k;


int main(){
  
  scanf("%d %d",&n,&k);

  int p = 0 ,sum =0 , nokori = n , hituyou = 1 ,tk = k;
  
  while(1){     if(nokori <= 0){break;}    
    if(sum > tk)
      {
	while (1){
	  if(sum <= tk){break;}
	  hituyou++;tk = hituyou * k;if(hituyou > nokori){break;}
	}
      }
    if(hituyou > nokori){break;}
    sum+= hituyou;
    p+=1;
    nokori -= hituyou;
  }

  printf("%d\n",p);
  return 0;
}



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

int main() {
  ll n,k;
  cin >> n >> k;
  vector<pair<ll,ll>> vec;
  rep(i,n){
    ll x,y;
    cin >> x >> y;
    vec.push_back(make_pair(x,y));
  }
  sort(vec.begin(),vec.end());
  ll now=0;
  rep(i,n){
    now+=vec[i].second;
    if(k<=now) {
      cout << vec[i].first << endl;
      break;
    }
  }
    
}


Measured memory_bytes: 5332
#include<cstdio>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<cstring>
#include<iostream>
using namespace std;
#define M 1000010
inline int rd()
{
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+(c^48);c=getchar();}
	return f*x;
}
int n;
map<int,int>vis;
int main()
{
    n=rd();
    for(int i=1;i<=n;i++)
    {
    	int x=rd();
    	if(vis[x]==1)
    	{
    		puts("NO");
    		return 0;
		}
		vis[x]=1;
	}
	puts("YES");
    return 0;
}

Measured memory_bytes: 9600
#include<iostream>
using namespace std;
#define int long long int
int32_t main()
{
	int n;
	cin>>n;
	int j,arr1[n],arr2[n];
	for(j=0;j<n;j++)
	    cin>>arr1[j];
	for(j=0;j<n;j++)
	{
		arr2[j]=arr1[j];
	}
	int sum=0;
	int answer1=0,answer2=0;
	for(j=0;j<n;j++)
	{
		sum+=arr1[j];
		if(j%2==0)
		{
			if(sum>0)
			{
				
			}
			else
			{
			    
				answer1+=(1-sum);
				sum=1;
			}
		}
		else
		{
			if(sum<0)
			{
				
			}
			else
			{
				answer1+=(sum+1);
				sum=-1;
			}
		}
	}
	sum=0;
	for(j=0;j<n;j++)
	    arr1[j]=arr2[j];
	for(j=0;j<n;j++)
	{
		sum+=arr1[j];
		if(j%2!=0)
		{
			if(sum>0)
			{
				
			}
			else
			{
			    
				answer2+=(1-sum);
				sum=1;
			}
		}
		else
		{
			if(sum<0)
			{
				
			}
			else
			{
				answer2+=(sum+1);
				sum=-1;
			}
		}
	}
	cout<<min(answer1,answer2)<<endl;
}


Measured memory_bytes: 1792
odds = ["R", "U", "D"]
evens = ["L", "U", "D"]

s = input()
is_passed = True

for index, c in enumerate(s):
    if index % 2 == 0:
        if not c in odds:
            is_passed = False
    else:
        if not c in evens:
            is_passed = False

print("Yes" if is_passed else "No")

Measured memory_bytes: 3060
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func vi(n int, args ...int) []int {
	res := make([]int, n)
	if len(args) == 0 {
		return res
	}
	v := args[0]
	if v == 0 {
		return res
	}
	for i := 0; i < n; i++ {
		res[i] = v
	}
	return res
}

func vvi(n int, args ...int) [][]int {
	res := make([][]int, n)
	m := n
	if len(args) > 0 {
		m = args[0]
	}
	v := 0
	if len(args) > 1 {
		v = args[1]
	}
	for i := 0; i < n; i++ {
		res[i] = vi(m, v)
	}
	return res
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

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

func abs(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func main() {
	defer stdout.Flush()
	n := readInt()
	a := make([]int, n)
	b := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = readInt()
		b[i] = a[i] - (i + 1)
	}
	sort.Ints(b)
	var sum uint64
	for j := 0; j < n; j++ {
		sum += uint64(abs(int64(a[j]) - int64(b[n/2]+j+1)))
	}
	println(uint64(sum))

}


Measured memory_bytes: 6272
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	long long a,b,c;
	cin>>a>>b>>c;
	if(a>c)
		swap(a,c);
	if(b>c)
		swap(b,c);
	if(c%2==0||a%2==0||b%2==0)
		a=0;
	cout<<a*b<<endl;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  rep(i, n) cin >> v[i];

  vector<int> res(n);
  for (int i = 0; i < min(k, 100); ++i) {
    vector<int> tmp(n+10);
    for (int j = 0; j < n; ++j) {
      tmp[max(j+1-v[j], 0)]++;
      tmp[min(j+1+v[j]+1, n+3)]--;
    }
    for (int j = 0; j < n; ++j) {
      tmp[j+1] += tmp[j];
      v[j] = tmp[j+1];
    }
  }

  for (int i = 0; i < n; ++i) {
    cout << v[i] << ' ';
  }
  cout << endl;
}


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

int main()
{
    ll x,y;
    while(cin>>x)
    {
        vector<ll>v;
        ll preSum[200006];
        for(int i=0;i<x;i++)
        {
            cin>>y;
            if(i==0)
            {
                preSum[0]=y;
            }
            else
            {
                preSum[i]=preSum[i-1]+y;
            }
            v.push_back(y);

        }
        /*for(int i=0;i<x;i++)
        {
            cout<<preSum[i]<<" ";
        }

        cout<<endl;
        */
        ll mid=0,ans=99999999999;
        while(mid<x-1)
        {
            ll leftSum=preSum[mid];
            ll rightSum=preSum[x-1]-preSum[mid];
            ll tmp=abs(leftSum-rightSum);
            //cout<<" mid "<<mid<<" leftS "<<leftSum<<" rightS "<<rightSum<<" tmp "<<tmp<<endl;
            ans=min(ans,tmp);
            //cout<<" ans "<<ans<<endl;
            mid++;
        }
        cout<<ans<<endl;
        v.clear();
    }

    return 0;
}


Measured memory_bytes: 3444
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include <algorithm>
int dp[10][100010];
int v[10][100010];
int main()
{
    int i,j;

    int N;
    scanf("%d", &N);
    for(i=1;i<=N;i++)
    {
        scanf("%d", &v[1][i]);
        scanf("%d", &v[2][i]);
        scanf("%d", &v[3][i]);
    }

    dp[1][1] = v[1][1];
    dp[2][1] = v[2][1];
    dp[3][1] = v[3][1];
    for(i=2;i<=N;i++)
    {
        dp[1][i] = std::max(v[1][i]+dp[2][i-1],v[1][i]+dp[3][i-1]);
        dp[2][i] = std::max(v[2][i]+dp[1][i-1],v[2][i]+dp[3][i-1]);
        dp[3][i] = std::max(v[3][i]+dp[1][i-1],v[3][i]+dp[2][i-1]);
    }

    int max = INT_MIN;
    for(i=1;i<=3;i++)
        if(dp[i][N]>max)
            max = dp[i][N];

   /* for(i=1;i<=N;i++) {
        for (j = 1; j <= N; j++)
            printf("%d ", dp[j][i]);
        printf("\n");
    }*/
    printf("%d", max);


    return  0;
}

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

int const N = 5000;
ll dp[N + 1][N + 1];
int x[N + 1], in[N + 1];

inline void up(ll &x, ll y) { if (y < x)x = y; }

int main(){
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);
	f(i, 1, n + 1)scanf("%d", x + i);
	f(i, 1, n + 1)in[x[i]] = i;
	f(i, 0, n + 1)f(j, 0, n + 1)dp[i][j] = 1e18;
	dp[0][0] = 0;
	f(p, 0, n + 1)f(i, 0, n){
		int lc = in[i + 1];
		up(dp[p][i + 1], dp[p][i] + (lc < p ? a : b));
		if (lc >= p)up(dp[lc][i + 1], dp[p][i]);
	}
	ll an = 1e18;
	f(i, 0, n + 1)up(an, dp[i][n]);
	printf("%lld\n", an);
}

Measured memory_bytes: 195712
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
int main(){
    int n,m;
    cin>>n>>m;
    vector<int> l(m);
    vector<int> r(m);
    rep(i,m) cin>>l[i]>>r[i];
    int L=*max_element(l.begin(),l.end());
    int R=*min_element(r.begin(),r.end());

    int ans = R-L+1;
    if (ans>=0)cout << ans ;
    else cout <<"0";
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.EducationalDP
{
    class O
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] checks = new int[n];
            for (int i = 0; i < n; i++)
            {
                int[] ok = ReadInts();
                int val = 0;
                int unit = 1;
                for (int j = 0; j < n; j++)
                {
                    val += ok[j] == 1 ? unit : 0;
                    unit *= 2;
                }
                checks[i] = val;
            }

            int all = 1 << n;
            long[,] dp = new long[n, all];
            //男iまで見たときにペアになっている女の状態jのときの組み合わせ総数
            long mask = 1000000000 + 7;
            for(int i = 1; i < all; i++)
            {
                int now = -1;
                for(int j = 0; j < n; j++)
                {
                    int div = 1 << j;
                    if ((i & div) > 0) now++;
                }
                if (now == 0)
                {
                    if ((i & checks[now]) > 0) dp[now,i] = 1;
                }
                else
                {
                    for(int j = 0; j < n; j++)
                    {
                        int div = 1 << j;
                        if ((checks[now] & div) == 0) continue;
                        if ((i & div) > 0)
                        {
                            dp[now, i] += dp[now - 1, i - div];
                            dp[now, i] %= mask;
                        }
                    }
                }
            }
            /*for(int i = 0; i < n; i++)
            {
                for(int j = 0; j < all; j++)
                {
                    Console.Write(dp[i, j] + " ");
                }
                Console.WriteLine();
            }*/
            Console.WriteLine(dp[n - 1, all - 1]);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 320224
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int inf = 1e9;

int main()
{
    int a,b,c;
    while (cin >> a >> b >> c) {
        int A[] = {a,b,c};
        sort(A,A+3);
        int ans = inf;
        do {
            int res = 0;
            FOR(i,1,3) {
                res += abs(A[i]-A[i-1]);
            }
            ans = min(ans,res);
        } while (next_permutation(A,A+3));
        cout << ans << endl;
    }
    return 0;
}


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

#define int long long int
#define rep(a,b,c) for(int a=b;a<c;a++)
#define repm(a,b,c) for(int a=(b-1);a>=c;a--)
#define pb push_back
#define str string
#define sf(a) scanfs("%d",&a)
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()

using namespace std;

const int INF = 1e18 + 9;
const int Mod = 1e9 + 7;
inline int replac(str s){double ans=0;rep(i,0,s.length()){ans+=(s[i]-'0')*pow(10,s.length()-i-1);}return (int)ans;}
inline string numstr(int m){str s="";while(m>0){char c;int a=m/10;if(a>0)a=m%(a*10);else a=m;c=(char)('0'+a);s+=c;m/=10;}str st="";for(int i=s.size()-1;i>=0;i--){st+=s[i];}return st;}
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
int cake[2002];int n;int dp[2002][2002][2];
//ushi n-1???ra
int f(int num,int ushi,bool chan){
    int mae=((ushi-n+num)<0)?(ushi+num)%n:(ushi-n+num)%n;
    //cout << mae <<" ";
    if(dp[num][ushi][chan]>-1)return dp[num][ushi][chan];
    else if(num>n){
        return dp[num][ushi][chan]=0;
    }else if(chan){
        return dp[num][ushi][chan]=max(f(num+1,ushi,false)+cake[mae],f(num+1,(n+ushi-1)%n,false)+cake[ushi]);
    }else{
        if(cake[mae]>cake[ushi]){return dp[num][ushi][chan]=f(num+1,ushi,true);}
        else{return dp[num][ushi][chan]=f(num+1,(n+ushi-1)%n,true);}
    }
}
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    rep(i,0,n){
        cin >> cake[i];
    }
    rep(i,0,2001){
        rep(j,0,2001){
            rep(k,0,3){
                dp[i][j][k]=-1;
            }
        }
    }
    int ans = 0;
    rep(i,0,n){
        int y = f(1,i,true);
        ans=max(ans,y);
        //cout << i << "=" << y << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 65852
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cctype>
#define INF 10000000
using namespace std;
bool debug=false;

int main(){
  int n;
  int score[205]={0};
  int data[205][3];
  cin>>n;

  for(int i=0;i<n;i++)for(int j=0;j<3;j++)cin>>data[i][j];
  
  for(int i=0;i<3;i++){
    map<int ,int> m;
    for(int j=0;j<n;j++){
      m[data[j][i]]++;
    }
    for(int j=0;j<n;j++){
      if(m[data[j][i]]==1)score[j]+=data[j][i];
    }
  }
  

  for(int i=0;i<n;i++)cout<<score[i]<<endl;
  return 0;
}

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

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

class Mint{
    public:
    int v;
    const long long MOD = 1000000007;
    Mint():v(0){}
    Mint(signed v):v(v){}
    Mint(long long t){v=t%MOD; if(v<0)v+=MOD;}

    Mint pow(long long k){
        Mint res(1), tmp(v);
        while(k){
            if(k&1)res*=tmp;
            tmp*=tmp;
            k>>=1;
        }
        return res;
    }
    Mint inv(){return pow(MOD-2);}

    Mint& operator+=(Mint a){v+=a.v; if(v>=MOD)v-=MOD; return *this;}
    Mint& operator-=(Mint a){v+=MOD-a.v; if(v>=MOD)v-=MOD; return *this;}
    Mint& operator*=(Mint a){v=1LL*v*a.v%MOD; return *this;}
    Mint& operator/=(Mint a){return (*this)*=a.inv();}

    Mint operator+(Mint a) const{return Mint(v)+=a;};
    Mint operator-(Mint a) const{return Mint(v)-=a;};
    Mint operator*(Mint a) const{return Mint(v)*=a;};
    Mint operator/(Mint a) const{return Mint(v)/=a;};

    Mint operator-(){return v ? MOD-v : v;}
    bool operator==(Mint a)const{return v==a.v;}
    bool operator!=(Mint a)const{return v!=a.v;}

    Mint operator=(Mint a) {v=a.v;return a;}

    friend ostream& operator<<(ostream& os, const Mint& mint){
        os << mint.v;
        return os;
    }
};

class cmbs{
    public:
    vector<Mint> fact, finv, inv;
    cmbs(){
        fact.clear(); finv.clear(); inv.clear();
    }
    void init(int n){
        if(n+1 <= (signed)fact.size())return;
        fact.assign(n+1,1);
        finv.assign(n+1,1);
        inv.assign(n+1,1);

        for(int i=1; i<=n; i++) fact[i] = fact[i-1]*Mint(i);
        finv[n] = Mint(1)/fact[n];
        for(int i=n; i>=1;i--) finv[i-1] = finv[i]*Mint(i);
        for(int i=1; i<=n; i++) inv[i] = finv[i]*fact[i-1];
    }
    Mint comb(long long n, int k){
        if(n<k||k<0)return Mint(0);
        Mint res(1);
        for(int i=0; i<k; i++){
            res *= Mint(n-i);
            res /= Mint(i+1);
        }
        return res;
    }
    Mint C(int n,int k){
        if(n<k||k<0)return Mint(0);
        init(n);
        return fact[n]*finv[n-k]*finv[k];
    }
    Mint P(int n, int k){
        if(n<k || k<0)return Mint(0);
        init(n);
        return fact[n]*finv[n-k];
    }
    Mint H(int n, int k){
        if(n<0||k<0)return Mint(0);
        if(!n&&!k)return Mint(1);
        init(n+k-1);
        return C(n+k-1,k);
    }
    Mint bell_number(int n, int k){
        if(n==0)return Mint(1);
        k = std::min(k,n);
        init(n);
        Mint ret;
        std::vector<Mint> pref(k+1);
        pref[0] = Mint(1);
        for(int i=1; i<=k; i++){
            if(i&1) pref[i] = pref[i-1] - finv[i];
            else pref[i] = pref[i-1] + finv[i];
        }
        for(int i=1; i<=k; i++){
            ret += Mint(i).pow(n) * finv[i] * pref[k-i];
        }
        return ret;
    }
};

int main(){
    ll n,k;
    cin>>n>>k;
    cmbs cmb;
    cout<<cmb.bell_number(n,k)<<endl;
    return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
int n,m,u,v;
long long x,h[100007],val,dis[100007];
vector < pair<int,long long> > edge[100007];
priority_queue < pair <long long,int> , vector < pair<long long,int> > ,greater < pair<long long,int> > > pr;
int main(){
    ios_base::sync_with_stdio(0);
    cin>>n>>m>>x;
    for(int i=1;i<=n;i++) cin>>h[i];
    for(int i=1;i<=m;i++){
        cin>>u>>v>>val;
        if(h[u]>=val) edge[u].pb(mp(v,val));
        if(h[v]>=val) edge[v].pb(mp(u,val));
    }
    for(int i=1;i<=n;i++) dis[i]=1e16;
    dis[1]=0;
    pr.push(mp(dis[1],1));
    while(!pr.empty()){
        val=pr.top().fi;
        u=pr.top().se;
        pr.pop();
        if(dis[u]!=val) continue;
        for(int i=0;i<(int)edge[u].size();i++){
            v=edge[u][i].fi;
            long long cost=edge[u][i].se;
            int extra=0;
            if(x>=val+cost+h[v]) extra=x-(val+cost+h[v]);
            if(dis[v]>val+cost+extra){
                dis[v]=val+cost+extra;
                pr.push(mp(dis[v],v));
            }
        }
    }
    if(dis[n]>=1e16) cout<<-1;
    else cout<<dis[n]*2LL+h[n]-x;
cout<<endl;
}

Measured memory_bytes: 22588
#include <iostream>
using namespace std;
int main(void){
    int a,b,c;int x[10001]={};int ans=0;
    cin >> a >> b >> c;
    for(int i=1;i<=c;i++){if(c%i==0){x[i]=1;}}
    for(int j=a;j<=b;j++){ans+=x[j];}
    cout << ans << endl;
}


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

bool isPalin(string S){
	string t = S;
	reverse(t.begin(),t.end());
	return S == t;
}

int main(){
	string s;
	cin >> s;
	bool ans = true;
	if(!isPalin(s)) ans = false;
	if(!isPalin(s.substr(0,s.size()/2))) ans = false;
	cout << (ans ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 3072
n = int(input())
A = list(map(int,input().split()))
for i in range(1,n+1):
    A[i-1] = A[i-1]-i
A.sort()
flag = True
if n % 2 == 1:
    b = A[(n-1)//2]
else:
    if A[n//2] == A[n//2-1]:
        b = A[n//2]
    else:
        flag = False
if flag:
    ans = 0
    for i in A:
        ans += abs(i-b)
    print(ans)
else:
    ans1=0
    ans2=0
    for i in A:
        ans1 += abs(i-A[n//2])
        ans2 += abs(i-A[n//2-1])
    print(min(ans1,ans2))

Measured memory_bytes: 26020
#include <bits/stdc++.h>
#include<math.h>
using namespace std;
int sqr(int a){return a*a;}
int main(){
    double a,b,angle,c;
    cin>>a>>b>>angle;
    double redA = angle*3.1415926535/180;
    c = sqrt(sqr(a)+sqr(b)-(2*a*b*cos(redA)));
    double s = (a+b+c)/2;
    double area = sqrt(s*(s-a)*(s-b)*(s-c));
    double h = 2*area/a;
  printf("%lf %lf %lf\n",area,s*2,h);
    return 0;
    
}
//4 3 90
 // 
//c2 = a2 + b2 − 2ab cos(C)


Measured memory_bytes: 3384
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define ld long double
const ll MOD = 998244353;
const ll INF = 1e18;
using namespace std;



int32_t main(){    
	#ifdef XOX
		freopen("Input.txt", "r", stdin);
		freopen("Output.txt", "w", stdout);
	#endif
 
	ios::sync_with_stdio(!cin.tie(NULL));

	int n;
	cin >> n;
	int a = 0, b  = 0, c = 0, d = 0;
	string s;
	
	for(int i = 0; i < n; i++) {
		cin >> s;
		a += (s[0] == 'A');
		b += (s[0] == 'W');
		c += (s[0] == 'T');
		d += (s[0] == 'R');
	}

	cout << "AC x " << a << "\nWA x " << b << "\nTLE x " << c << "\nRE x " << d ; 
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <string>
using namespace std;
const int  maxn=1e5+10;
int n,l;
string str[105];
bool vis[105];
string ans;
int main(){
    scanf("%d%d",&n,&l);
    memset(vis,false,sizeof(vis));
    for(int i=1;i<=n;i++){
        cin>>str[i];
    }
    sort(str+1,str+n+1);
    for(int i=1;i<=n;i++){
        ans+=str[i];
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
    long long int n, x;
    std::cin >> n >> x;
    long long int t = 2 * n - 1;
    std::vector<long long int> v(t, 0);

    if (x == t || x == 1) {
        std::cout << "No" << std::endl;
        return 0;
    }

    for (long long int i = 0; i < t;) {
        v[i] = ++i;
    }

    std::cout << "Yes" << std::endl;

    if (x == 2) {
        /* big small x big */
        switch (n) {
            case 2:
            break;

            case 3:
            v = std::vector<long long int>({4,1,2,3,5});
            break;

            default:
            std::swap_ranges(v.begin(), v.begin() + 3, v.begin() + n - 2);
            std::iter_swap(v.end() - 1, v.begin() + n - 3);
            break;
        }
    } else {
        /* small big x small */
        std::swap_ranges(v.begin() + x - 2, v.begin() + x + 1, v.begin() + n - 2);
        std::iter_swap(v.begin() + n - 2, v.begin() + n);
    }
    
    for (auto& i : v) {
        std::cout << i << std::endl;
    }

    return 0;
}

Measured memory_bytes: 3072
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>

#define max(a,b) ((a)>(b))?(a):(b)
#define min(a,b) ((a)>(b))?(b):(a)

typedef long long ll;
typedef unsigned long long ull;

int main(void)
{
	int n, cnt = 1;

	scanf("%d\n", &n);
	char pc = getchar();
	for (size_t i = 1; i < n; i++)
	{
		char c = getchar();
		if (pc!=c)
		{
			cnt++;
			pc = c;
		}
	}

	printf("%d", cnt);
}

Measured memory_bytes: 128
#include<stdio.h>
int min(int a,int b)
{
	if(a<b)
	a=a;
	if(a>b)
	a=b;
	return a;
}
int max(int a,int b )
{
	if(a>b)
	a=a;
	if(a<b)
	a=b;
	return a;
}
int main()
{
	int a,b,c,d;
	int sum;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if (b<c||d<a)
	sum = 0;
	else
	{
		sum=min(b,d)-max(a,c);
	}
		printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 888
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const int MOD = 1000000007;
using namespace std;


int main(){
    int x, a, b; cin >> x >> a >> b;
    cout << (abs(x-a) < abs(x-b) ? "A" : "B") << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];

int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n;

    for(int i=2;i<=n;i++){
        cin>>x;
        A[x]++;
    }

    for(int i=1;i<=n;i++)
        cout<<A[i]<<"\n";

    return 0;
}


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

int main(){
    string s,t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;
    if(u==s){
        cout << a-1 << " "<<b;
    }else{
        cout << a << " "<<b-1;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

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


Measured memory_bytes: 2132
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

  public static void main(String[] args) {
    FastScanner sc = new FastScanner();

    int K = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    String ans = "NG";
    for (int i = 0; i <= B; i++) {
      if (i * K >= A && i * K <= B) {
        ans = "OK";
        break;
      }
    }

    System.out.println(ans);

  }
}

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;

  private boolean hasNextByte() {
    if (ptr < buflen) {
      return true;
    } else {
      ptr = 0;
      try {
        buflen = in.read(buffer);
      } catch (IOException e) {
        e.printStackTrace();
      }
      if (buflen <= 0) {
        return false;
      }
    }
    return true;
  }

  private int readByte() {
    if (hasNextByte()) {
      return buffer[ptr++];
    } else {
      return -1;
    }
  }

  private static boolean isPrintableChar(int c) {
    return 33 <= c && c <= 126;
  }

  private void skipUnprintable() {
    while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
      ptr++;
    }
  }

  public boolean hasNext() {
    skipUnprintable();
    return hasNextByte();
  }

  public String next() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    StringBuilder sb = new StringBuilder();
    int b = readByte();
    while (isPrintableChar(b)) {
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  public int nextInt() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    int n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }

  public long nextLong() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    long n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }
}

Measured memory_bytes: 25328
#15:30
'''
[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
 0 1 2 3  4  5  6  7  8  9 10 11 12 13 14
'''
n = int(input())
prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
fact = [0,0,0,0,0]
check = []
for i in range(15):
  p = prime[i]
  d = n
  tmp = 0
  while d != 0:
    d //= p
    tmp += d
  check.append(tmp)
  if tmp >= 74:
    fact[0] += 1
  if tmp >= 24:
    fact[1] += 1
  if tmp >= 14:
    fact[2] += 1
  if tmp >= 4:
    fact[3] += 1
  if tmp >= 2:
    fact[4] += 1
#print(check)
#print(fact)
ans = 0
ans += fact[0]
ans += fact[1] * (fact[4]-1)
ans += fact[2] * (fact[3]-1)
ans += fact[3] * (fact[3]-1) * (fact[4]-2) // 2
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;
int main(){
	double x1, y1, x2, y2, x;
	cin >> x1 >> y1 >> x2 >> y2;

	x = pow(x2 - x1, 2) + pow(y2 - y1, 2);
	x = sqrt(x);

	printf("%f\n", x);

	return 0;
}


Measured memory_bytes: 3184
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

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

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

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

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

    int total = 0;
    for(int i = 0; i < n; i++){
        total += s[i];
    }
    if(total % 10 != 0){
        cout << total << endl;
        return 0;
    }

    sort(s.begin(), s.end());
    bool ok = false;
    for(int i = 0; i < n; i++){
        if(s[i] % 10 != 0){
            ok = true;
            total -= s[i];
            break;
        }
    }

    if(ok){
        cout << total << endl;
    } else {
        cout << 0 << endl;
    }

}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
	string S;
	int w;
	cin >> S >> w;
	rep(i, S.size()) {
		if (i % w == 0) {
			cout << S.at(i);
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int N,M;
    scanf("%d %d",&N,&M);
    int n,m,s;
    if(N==0){
        n=0;
    }
    else{
        n=N*(N-1)/2;
    }
    if(M==0){
        m=0;
    }
    else{
        m=M*(M-1)/2;
    }
    s=n+m;
    printf("%d",s);
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;

int main(){
    int N; cin >> N;
    long long rgb[3]={};
    string s; cin >> s;
    rep(i, N){
        if(s[i] == 'R') rgb[0]++;
        else if(s[i] == 'G') rgb[1]++;
        else if(s[i] == 'B') rgb[2]++;
        else cout << "!" << endl;
    }
    //cout << rgb[0] << " " << rgb[1] << " " << rgb[2] << endl;
    long long sum = rgb[0]*rgb[1]*rgb[2];
    //cout << "sum = " << sum << endl;
    rep(i, N-2){
        //cout << "i =" << i<< endl;
        for(int j=1; j<(N+1-i)/2; j++){
            //cout << "j =" <<j << endl;
            //if(s[i]==s[i+j]) cout << "a" << endl;
            //if(s[i]==s[i+2*j]) cout << "b" << endl;
            //if(s[i+j]==s[i+2*j]) cout << "c" << endl;
            if(s[i]!=s[i+j] && s[i]!=s[i+2*j] && s[i+j]!=s[i+2*j]){
                sum--;
            }
        }
    }
    cout << sum << endl;

}

Measured memory_bytes: 3628