akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
const int MO=1e9+7;
int A,B,C,D,X1,X2,X3,X4,X5,X6,Y1,Y2,Y3,Y4,Y5,Y6;
LL fac[3000010],inv[3000010],ans;
LL pw(LL x,LL y){
	LL t=1;
	for (;y;y>>=1){
		if (y&1) t=t*x%MO;
		x=x*x%MO;
	}
	return t;
}
LL Co(int x,int y){
	assert(y<=x && 0<=y);
	return fac[x]*inv[y]%MO*inv[x-y]%MO;
}
LL cal1(int x,int y){
	assert(x>=A && y>=B);
	return Co(x+y-A-B,x-A);
}
LL cal2(int x,int y){
	assert(x<=C && y<=D);
	return Co(C+D-x-y,C-x);
}
LL cal(int x,int y){
	return cal1(x,y)*cal2(x,y)%MO;
}
LL doit(){
	LL ans=0;
	if (X4-X3<=Y4-Y3){
		LL t=cal(X3,Y3);
		ans=t;
		FOR(i,X3+1,X4)
			(t+=cal1(i,Y3-1)*cal2(i,Y3)+cal1(X3-1,Y3+i-X3)*cal2(X3,Y3+i-X3))%=MO,(ans+=t)%=MO;
		FOR(i,Y3+1,Y4-X4+X3)
			(t+=cal1(X3-1,i+X4-X3)*cal2(X3,i+X4-X3)-cal1(X4,i-1)*cal2(X4+1,i-1))%=MO,(ans+=t)%=MO;
		FOR(i,X3+1,X4)
			(t-=cal1(i-1,Y4)*cal2(i-1,Y4+1)+cal1(X4,Y4-X4+i-1)*cal2(X4+1,Y4-X4+i-1))%=MO,(ans+=t)%=MO;
		return ans;
	}
	else{
		LL t=cal(X3,Y3);
		ans=t;
		FOR(i,Y3+1,Y4)
			(t+=cal1(X3-1,i)*cal2(X3,i)+cal1(i-Y3+X3,Y3-1)*cal2(i-Y3+X3,Y3))%=MO,(ans+=t)%=MO;
		FOR(i,X3+1,X4-Y4+Y3)
			(t+=cal1(i+Y4-Y3,Y3-1)*cal2(i+Y4-Y3,Y3)-cal1(i-1,Y4)*cal2(i-1,Y4+1))%=MO,(ans+=t)%=MO;
		FOR(i,Y3+1,Y4)
			(t-=cal1(X4-Y4+i-1,Y4)*cal2(X4-Y4+i-1,Y4+1)+cal1(X4,i-1)*cal2(X4+1,i-1))%=MO,(ans+=t)%=MO;
		return ans;
	}
}
int main(){
	fac[0]=1;
	FOR(i,1,3000000) fac[i]=fac[i-1]*i%MO;
	inv[3000000]=pw(fac[3000000],MO-2);
	FORD(i,2999999,0) inv[i]=inv[i+1]*(i+1)%MO;
	cin>>X1>>X2>>X3>>X4>>X5>>X6;
	cin>>Y1>>Y2>>Y3>>Y4>>Y5>>Y6;
	FOR(i,0,1)
		FOR(j,0,1)
			FOR(k,0,1)
				FOR(l,0,1){
					A=(i==0)?(X1-1):(X2);
					B=(j==0)?(Y1-1):(Y2);
					C=(k==0)?(X6+1):(X5);
					D=(l==0)?(Y6+1):(Y5);
					(ans+=doit()*pw(-1,i+j+k+l))%=MO;
				}
	ans=(ans%MO+MO)%MO;
	cout<<ans<<endl;
	return 0;
}


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

int main(void){
    int N, x, num_kouryo = 0;
    int *just_candies, *kouryo, *just_candies_kouryo;
    int loop, loop_kouryo = 0;

    scanf("%d %d", &N, &x);
    //printf("N = %d, x = %d\n", N, x);
    just_candies = (int *)malloc(N * sizeof(int));
    kouryo = (int *)malloc(N * sizeof(int));

    for(loop = 0; loop < N; loop++){
        scanf("%d", &just_candies[loop]);
        if(just_candies[loop] <= x){
            kouryo[loop] = 1;
            num_kouryo++;
        }else{
            kouryo[loop] = 0;
        }
    }
    //printf("num_kouryo = %d\n", num_kouryo);

    just_candies_kouryo = (int *)malloc(num_kouryo * sizeof(int));

    for(loop = 0; loop < N; loop++){
        if(loop_kouryo == num_kouryo){
            break;
        }else{
            if(kouryo[loop]){
                just_candies_kouryo[loop_kouryo] = just_candies[loop];
                loop_kouryo++;
            }
        }
    }

    /*for(loop = 0; loop < num_kouryo; loop++){
        if(loop == 0) printf("just_candies_kouryo: ");
        printf("%d%c", just_candies_kouryo[loop], (loop == num_kouryo-1)? '\n' : ' ');
    }*/

    int tmp, flag_swap = 1;
    int ans = 0;

    if(num_kouryo > 0){
        while(flag_swap == 1){
            flag_swap = 0;
            for(loop = 0; loop < num_kouryo-1; loop++){
                    if(just_candies_kouryo[loop] > just_candies_kouryo[loop+1]){
                        tmp = just_candies_kouryo[loop];
                        just_candies_kouryo[loop] = just_candies_kouryo[loop+1];
                        just_candies_kouryo[loop+1] = tmp;
                        flag_swap = 1;
                }
            }
        }

        /*for(loop = 0; loop < num_kouryo; loop++){
            if(loop == 0){
                printf("just_candies_kouryo swapped: ");
            }
            printf("%d%c", just_candies_kouryo[loop], (loop == num_kouryo-1)? '\n' : ' ');
        }*/

        for(loop = 0; loop < num_kouryo; loop++){
            if(x < just_candies_kouryo[loop]){
                //printf("loop = %d: x = %d < %d = just_candies_kouryo[%d]\n", loop, x, just_candies_kouryo[loop], loop);
                break;
            }else{
                //printf("loop = %d: current x = ", loop);
                x -= just_candies_kouryo[loop];
                ans++;
            }
            //printf("%d, ans = %d\n", x, ans);
        }
        printf("%d\n", (loop == num_kouryo && x > 0)? ans-1 : ans);
    }else{
        printf("0\n");
    }

    free(just_candies);
    free(kouryo);
    free(just_candies_kouryo);
    return 0;
}

Measured memory_bytes: 128
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "bitset"

using namespace std;

//const long long int MOD = 998244353;
const long long int MOD = 1000000007;
const long double EPS = 1e-7;

long long int N, M, K, H, W, L, R;

int gcd(int a, int b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

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

	cin >> N;
	vector<int>v(N);
	int even = 0;
	for (auto &i : v) {
		cin >> i;
		if (i % 2 == 0)even++;
	}
	if (even % 2) {
		cout << "First\n";
		return 0;
	}
	int odd = 0;
	for (auto i : v) {
		if (i % 2)odd = i;
	}
	if (even % 2 == 0 && (even != N - 1 || (even == N - 1 && odd == 1))) {
		cout << "Second\n";
		return 0;
	}
	int bag = v[0] - (v[0] % 2);
	for (auto &i : v) {
		if (i % 2)i--;
		bag = gcd(bag, i);
	}
	for (auto &i : v)i /= bag;
	string ans[2] = { "First","Second" };
	int cnt = 0;
	while (1) {
		cnt++;
		even = 0;
		for (auto i : v)if (i % 2 == 0)even++;
		if (even % 2) {
			cout << ans[cnt % 2] << endl;
			return 0;
		}
		odd = 0;
		for (auto i : v)if (i % 2)odd = i;
		if (even % 2 == 0 && (even != N - 1 || (even == N - 1 && odd == 1))) {
			cout << ans[(cnt + 1) % 2] << endl;
			return 0;
		}
		bag = v[0] - (v[0] % 2);
		for (auto &i : v) {
			if (i % 2)i--;
			bag = gcd(bag, i);
		}
		for (auto &i : v)i /= bag;
	}
	return 0;
}

Measured memory_bytes: 640
s = [int(i) for i in input()]

ans_0 = 0
tmp = 0
for i in s:
  if i != tmp:
    ans_0 += 1
  tmp = 1-tmp

ans_1 = 0
tmp = 1
for i in s:
  if i != tmp:
    ans_1 += 1
  tmp = 1-tmp
    
print(min(ans_0,ans_1))

Measured memory_bytes: 3956
//include
//------------------------------------------
#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>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int f(int n){
  int x, y, z;
  int ans = n;
  
  for(int y=0;y*y<=n;++y){
	for(int z=0;z*z*z<=n;++z){
	  if(y*y+z*z*z > n) break;
	  ans = min(ans, y+z+(n-y*y-z*z*z));
	}
  }

  return ans;
}

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

  while(true){
	int N; cin >> N; if(!N) break;
	cout << f(N) << endl;
  }

  return 0;
}

Measured memory_bytes: 1192
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define fi            first
#define se            second
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,n)      for(int i=0;i<n;i++)
#define repn(i,n)     for(int i=1;i<=n;i++)
#define rrep(i,n)     for(int i=n-1;i>=0;i--)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
/*---------------------------------------------------------------------*/
const int N = 2e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
    int k,n;
    cin>>k>>n;
    vector<ll>a(n);
    rep(i,n) cin>>a[i];
    ll ans=a[n-1]-a[0];
    for(int i=1;i<n-1;i++)
    {
        //ll gu=(a[n-1]-a[i])+((k+a[0])-a[n-1])+(a[i]-a[0]);

        ll mut =(a[i]-a[0])+((k+a[0])-k)+(k-a[n-1])+(a[n-1]-a[i+1]);
        //ans=min({ans,gu,mut});
        //ans=min(ans,gu);
        ans=min(ans,mut);
    }
    cout<<ans<<nl;
    return 0;
}


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

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

	long long N;
	cin >> N;
	long long res;
	if (N % 2 == 0) {
		res = (N / 2) * (N-1);
	}
	else
	{
		res = ((N-1) / 2) * N;
	}

	cout << res << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
#define MOD 1e9 + 7
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(c,a,b) for(ll c=a;c<b;c++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
	//Taken help from code of Akasaransh
	IOS
string s;
cin>>s;
for(ll i=0;i<s.size();i++)
{
if(s[i]!=',')
cout<<s[i];
else
cout<<" ";
}
}

Measured memory_bytes: 256
from math import inf
from random import randint,random
import time
START=time.time()
PROB=10**(-3)

def f(a,d,T):
    try:
        return T[d:].index(a)+d
    except ValueError:
        return len(T)

from random import randint
A=26

D=int(input())

C=[0]+list(map(int,input().split())) #減る満足度のベース
S=[0]*(D+1) #S[d][i] :(d+1)日目にコンテストiを開催した時の満足度

for i in range(1,D+1):
    S[i]=[0]+list(map(int,input().split()))
 
def g(d,q,T):
    p=T[d]

    a=f(p,d+1,T)
    b=f(q,d+1,T)
    
    Y=0
    h=L[d-1][p]
    for i in range(d,a):
        h+=1
        Y+=h-L[i][p]
        
    m=0
    Z=0
    for j in range(d,b):
        Z-=m-L[j][q]
        m+=1
        
    return (S[d][q]-S[d][p])+Z*C[q]-Y*C[p]

T=[0]
L=[[0]*(A+1) for _ in range(D+1)]
for d in range(1,D+1):
    M=-inf
    E=0

    for j in range(1,A+1):
        X=0
        for k in range(1,A+1):
            if j!=k:
                X-=C[k]*L[d][k]
                
        if M<=X+S[d][j]:
            M=X+S[d][j]
            E=j

    T.append(E)
    for j in range(1,A+1):
        if j!=E:
            L[d][j]=L[d-1][j]+1
        else:
            L[d][j]=0

while time.time()-START<=1.77:
    e=randint(1,D)
    q=randint(1,A)

    V=g(e,q,T)
    if V>0 or random()<PROB:
        p=T[d]

        a=f(p,d+1,T)
        b=f(q,d+1,T)
        
        h=L[d-1][p]
        for i in range(d,a):
            h+=1
            L[i][p]=h

        m=0
        for j in range(d,b):
            L[j][q]=m
            m+=1
        T[d]=q

for i in range(1,D+1):
    print(T[i])


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

int main() {
int N;
cin >> N;
vector<int> V(N) ;
for(int &x : V)
{
  cin >> x;
}
sort(V.begin(), V.end());
double ttl=0;
ttl+=V[0];
for (int i = 1; i < N; i++)
{
  ttl+=V[i]; ttl/=2;
}
printf("%.6lf\n", ttl);
  return 0;
}

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'
#define all(x) x.begin(), x.end()

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
using vvll = vector< vector<ll> >;
using vll = vector<ll> ;
using vb = vector<bool> ;
using pll = pair<ll, ll> ;

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

ll fast(ll x,ll y){
    ll res=1;
    while(y){
        if(y&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        y >>= 1;
    }
    return res;
}

ll inv(ll n){
    return fast(n,mod-2);
}


void pre(){



}


void solve(){

    ll n,m;
    cin >> n >> m;
    ll ans = (n+m-1)/m;
    cout << ans;

}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
 #include<stdio.h>
 #include<cstdlib>
 #include<cstdio>
 #include<string>
 #include<math.h>
 #include<time.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<fstream> 
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 #include<list>
 #include<memory>
 
 using namespace std;


 int main()
 {
   long long int arr[87]; 
   int n;
   arr[0]=2;
   arr[1]=1;
   for(int i=2;i<87;i++) arr[i]=arr[i-2]+arr[i-1];
   while(cin>>n)
   {
     cout<<arr[n]<<endl;
   }
   return 0;
 }
 

        


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

int main() {
  
  int N, K, R, S, P; cin >> N >> K >> R >> S >> P;
  
  string T; cin >> T; int64_t sum = 0;
  
  vector<bool> vec(N, true);
  
  for (int i = 0; i < N - K; i++) {
    
    if (vec[i] && T.at(i) == T.at(i + K)) vec[i + K] = false;
    
  }
  
  for (int i = 0; i < N; i++) {
    
    if (vec[i] == false) continue;
    
    if (T.at(i) == 'r') sum += P;
    if (T.at(i) == 's') sum += R;
    if (T.at(i) == 'p') sum += S;
    
  }
  
  cout << sum << endl;
  
}

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

int main()
{
	int ans=0;
	bool flag=1;
	cin>>s;
	int len=s.size();
	for(int i=1;i<len;i++)
	{
		if(s[i]!='9')
		{
			flag=0;
			break;
		}
	}
	if(flag)
	{
		ans=9*(len-1);
		ans+=s[0]-'0';
		cout<<ans;
	}
	else
	{
		ans=9*(len-1);
		ans+=s[0]-'0'-1;
		cout<<ans;
	}
}

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

using namespace std;


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

	int L;
	cin >> L;

	cout << fixed << setprecision(10) << (double)(L * L * L) / (3.0 * 3.0 * 3.0) << '\n';


	return 0;	
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int mod=pow(10,9)+7;
int main(){
    int h,w;
    cin>>h>>w;
    int dp[h][w];
    dp[0][0]=1;
    char c;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cin>>c;
        if(c=='#')
          dp[i][j]=0;
        else
          dp[i][j]=1;
      }
    }
  int i;
  for(i=0;i<w;i++){
    if(dp[0][i]==0)
      break;
  }
  for(int j=i;j<w;j++)
    dp[0][j]=0;
  for(i=0;i<h;i++){
    if(dp[i][0]==0)
      break;
  }
  for(int j=i;j<h;j++)
    dp[j][0]=0;
    for(int i=1;i<h;i++){
      for(int j=1;j<w;j++){
        if(dp[i][j]!=0)
          dp[i][j]=(dp[i-1][j] %mod +dp[i][j-1]%mod)%mod;
      }
    }
    cout<<dp[h-1][w-1]<<endl;
}

Measured memory_bytes: 7432
package main

import (
	"fmt"
)

func main() {
	var a, b, k int
	fmt.Scan(&a, &b, &k)
	x, y := 0, 0
	if k >= a {
		x = 0
		if k-a >= b {
			y = 0
		} else {
			y = b - (k - a)
		}
	} else {
		x = a - k
		y = b
	}

	fmt.Println(x, y)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second

using namespace std;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}

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

  error(N,K);

  vector<bool> A(N,0);
  int x;
  for(int i = 0; i < K; i++) {
    cin >> x;
    error(x);
    int y;
    for(int j = 0; j < x; j++){
      cin >> y;
      error(y);
      A[y-1] = 1;
    }
  }

  int ans = 0;
  for(int i = 0; i < N; i++) ans += !A[i];

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;cin >> n >> m;
	int ans=(n-m)*100*((int)pow(2,m));
	ans+=1900*m*((int)pow(2,m));
	cout << ans << endl;
}

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

using namespace std;

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

  int n;
  cin >> n;
  vector<pair<int, int>> x(n);
  for (int i = 0; i < n; i++) {
    int v;
    cin >> v;
    x[i] = make_pair(v, i);
  }
  sort(x.begin(), x.end());
  vector<int> m(n);
  for (int i = 0; i < x.size(); ++i) {
    int prev = x[i].second;
    m[prev] = i;
  }

  for (int i = 0; i < n; i++) {
    if (m[i] < n / 2) {
      cout << x[n / 2].first << endl;
    } else {
      cout << x[n / 2 - 1].first << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4608
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {

  int A, B; std::cin >> A >> B;
  std::cout << std::max( {A+B, A-B, A*B } ) << std::endl;

  return 0;
}


Measured memory_bytes: 256
function Main(input) {
  input = input.split('\n').map(Number);
  for(let i = 0; i <= input.length; i++){
    if(input[i] !==0){
      console.log(`Case ${i + 1}: ${input[i]}`);
    } else {
      break;
    }    
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 24052
"use strict";
function main(input) {
    const line = input.split("\n");
    let arr = line[0].split(" ");
    const N = parseInt(arr[0]);
    const D = parseInt(arr[1]);
    console.log(Math.ceil(N / (2 * D + 1)));
    return;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

using namespace std;
typedef long long ll;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)

int main(){
// ここに処理を記述
int N;
cin >> N;

vector<int> H;
int temp = 0;
for(int i=0; i<N; i++){
    cin >> temp;
    H.push_back(temp);
}

int ans = 0;
int left = 0;
int right = 1;

while(right != N){
    if(H[right-1] < H[right]){
        if(ans < (right - 1) - left){
            // cout << left << "->" << right << "\n";
            ans = (right - 1) - left;
        }
        left = right;
    }
    else if(right == N-1){
        if(ans < right - left){
            // cout << left << "->" << right << "\n";
            ans = right - left;
        }
    }
    right++;
}

cout << ans << "\n";

return 0;
}

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

using namespace std;

int main() {

    int n, a, b = 0;
    cin >> n >> a >> b;
    int sum = 0;
    for (int i = a; i <= n; ++i) {
        int r = i;
        int res = 0;
        while(r > 0) {
            res += r % 10;
            r /= 10;
        }
        if (res >= a && res <= b) {
            sum += i;
        }
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<set>

using namespace std;

typedef struct {
  int now, from;
  int cost, flow;
} Node;

bool operator<(const Node &lhs, const Node &rhs) {
  return lhs.cost < rhs.cost;
}

class Increase {
public:
  int n, flowMax = 1000000;
  vector<vector<int>> p;
  vector<int> parent;
  Increase(int _n, vector<vector<int>> _p) {
    n = _n;
    p = _p;
    parent.resize(n);
  }
  int solve() {
    int ret = 0;
    while(true) {
      for(int i = 0; i < n; i++) parent[i] = i;
      multiset<Node> q;
      q.insert(Node{0, -1, 0, 100000});
      while(q.size() > 0) {
        Node now = *q.begin();
        q.erase(q.begin());
        if(parent[now.now] != now.now) continue;
        parent[now.now] = now.from;
        if(now.now == n - 1) break;
        for(int i = 0; i < n; i++) if(parent[i] == i && p[now.now][i] > 0) q.insert(Node{i, now.now, now.cost + 1, min(now.flow, p[now.now][i])});
      }
      if(parent[n - 1] == n - 1) break;
      int now = n - 1, flow = flowMax;
      while(parent[now] >= 0 && parent[now] != now) {
        flow = min(flow, p[parent[now]][now]);
        p[parent[now]][now]--;
        p[now][parent[now]]++;
        now = parent[now];
      }
      ret += flow;
    }
    return ret;
  }
};

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> mp(h);
  for(int i = 0; i < h; i++) cin >> mp[i];

  int n = h + w + 2;
  // 0     S
  // n - 1 T
  // 1-w
  // w+1-h+w
  int sx, sy, tx, ty;
  for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) if(mp[i][j] == 'S') {
    sx = j;
    sy = i;
  } else if(mp[i][j] == 'T') {
    tx = j;
    ty = i;
  }

  vector<vector<int>> p(n);
  for(int i = 0; i < n; i++) p[i].resize(n);

  p[0][sx + 1] = 1000000;
  p[0][w + sy + 1] = 1000000;
  p[tx + 1][n - 1] = 1000000;
  p[w + ty + 1][n - 1] = 1000000;

  for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) if(mp[i][j] == 'o') {
    p[j + 1][w + i + 1] = 1;
    p[w + i + 1][j + 1] = 1;
  }

  if(sx == tx || sy == ty) {
    cout << -1 << endl;
    return 0;
  }

  Increase inc(n, p);
  cout << inc.solve() << endl;
}


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

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

    cout << a*b << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int NMAX=100007;
vector<int> S(NMAX+1,0);
vector<int> A(NMAX,0);

bool judge_prime(int p){
  if(p <= 2){
    return(false);
  }
  for(int i=2;i<floor(sqrt(p))+1;i++){
    if(p%i == 0 || ((p+1)/2) % i == 0){
      return(false);
    }
  }
  return(true);
}   

void prime_like(){
  for(int i=2;i<NMAX;i++){
    if(judge_prime(i)){
      A.at(i) = 1;
    }
  }
}

void initialize(){
  for(int i=0;i<NMAX;i++){
    S.at(i+1) = S.at(i) + A.at(i);
  }
}

// 区間[left, right)の総和
int sum(int left, int right){
    return S.at(right) - S.at(left);
}

int main(){
    int Q;
    cin >> Q;
    prime_like();
    initialize();
    for(int i=0;i<Q;i++){
      int l,r;
      cin >> l >> r;
      cout << sum(l,r+1) << endl;
    }
    return(0);
}

Measured memory_bytes: 1408
//love yjl forever
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pii pair<ll,ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int INF=0x3f3f3f3f,N=5e5+5;
int n,n1;
struct node {
	ll k,l,r;
}a[N];
bool cmp1(node x,node y)
{
	return x.l-x.r>y.l-y.r;
}
bool cmp(node x,node y)
{
	return x.k>y.k;
}
bool cmp2(node x,node y)
{
	return x.k<y.k;
}
void slove2()
{
	priority_queue<ll> q;
	ll ans=0;
	
	int j=1,i;
	for(i=1;i<=n1;i++)
	{
		while(a[j].k==i&&j<=n1)
		{
			ans+=a[j].l;
			q.push(-a[j].l+a[j].r);
			j++;
		}
		
		while(q.size()>i)
		{
			int x=q.top();q.pop();
			ans+=x;
		}
	}
	
	
	while(j<=n1)
		ans+=a[j].l,j++;
	
//	cout<<ans<<endl;
		
	while(!q.empty())
		q.pop();
	
	j=n;
	while(a[j].k>n)
	{
		ans+=a[j].l;
		j--;
	}
	
	for(int i=n;i>n1;i--)
	{
		while(a[j].k==i&&j>n1)
		{
			q.push(a[j].l-a[j].r);
			ans+=a[j].r;
			j--;
		}
		
		while(q.size()>n-i+1)
		{
			ll x=q.top();q.pop();
			ans+=x;
		}
				

	}
	while(j>n1)
	{
		ans+=a[j].r;
		j--;
	}
	cout<<ans<<endl;
}
int main()
{
//	freopen("b.in","r",stdin);
//	freopen("b.out","w",stdout);
	int i,T;
	cin>>T;
	while(T--)
	{
		cin>>n;
		for(i=1;i<=n;i++)
			scanf("%d%d%d",&a[i].k,&a[i].l,&a[i].r);
	
		sort(a+1,a+n+1,cmp1);
		

		for(i=1;i<=n;i++)
		{
			if(a[i].l<a[i].r) break;
		}
		n1=i;
		n1--;
//		cout<<n1<<endl;
//		cout<<endl;
//		for(i=1;i<=n;i++)
//			printf("%d %d %d\n",a[i].k,a[i].l,a[i].r);		
		sort(a+1,a+n1+1,cmp2);
//		cout<<endl;
//		for(i=1;i<=n;i++)
//			printf("%d %d %d\n",a[i].k,a[i].l,a[i].r);		
		sort(a+n1+1,a+n+1,cmp2);

		for(i=n1+1;i<=n;i++)
			a[i].k++;
			
//		cout<<endl;
//		for(i=1;i<=n;i++)
//			printf("%d %d %d\n",a[i].k,a[i].l,a[i].r);
//		cout<<endl;		
		slove2();
	}

}
/*
3

3
2 1 9
2 6 6
3 7 4

4
4 7 8
4 7 9
4 1 5
1 10 10

8
5 1 5
1 4 5
1 8 7
5 8 2
1 1 2
8 8 2
1 3 7
5 9 8
*/

Measured memory_bytes: 9004
#include<stdio.h>
int main(void)
{
    int n,i;
    scanf("%d",&n);
    int a[n];
    for(i=0; i<n; i++){
        scanf("%d",&a[i]);
    }
    for(i=n-1; i>=0; i--){
        printf("%d",a[i]);
        if(i==0) break;
        printf(" ");
    }
    putchar('\n');
    return 0;
}


Measured memory_bytes: 2044
import math

a,b = map(int,input().split())

n = math.floor(a / 0.08)
m = math.floor(b / 0.1)
n2 = n + 1
m2 = m + 1

p = math.floor(n * 0.08)
q = math.floor(n * 0.1)
x = math.floor(m * 0.08)
y = math.floor(m * 0.1)
p2 = math.floor(n2 * 0.08)
q2 = math.floor(n2 * 0.1)
x2 = math.floor(m2 * 0.08)
y2 = math.floor(m2 * 0.1)

if p == a and q == b and x == a and y == b:
    print(min(n,m))
elif p == a and q == b:
    print(n)
elif x == a and y == b:
    print(m)
elif p2 == a and q2 == b and x2 == a and y2 == b:
    print(min(n2,m2))
elif p2 == a and q2 == b:
    print(n2)
elif x2 == a and y2 == b:
    print(m2)
else:
    print(-1)

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

#define rep(i,n) for(ll (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrrep(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,pos,sum[501][501],q,l[ohara],r[ohara];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);
      
    cin>>n>>m>>q;
    rep(i,m){
        cin>>l[i]>>r[i];
        l[i]--;r[i]--;
        sum[l[i]][r[i]]++;
    }
    rep(i,n){
        rrep(j,1,n){
            sum[i][j]+=sum[i][j-1];
        }
    }
    rep(i,q){
        cin>>a>>b;
        a--;b--;
        rrep(j,a,b+1){
            ans+=sum[j][b];
            //if(sum[j][b]!=0)cout<<j<<" "<<sum[j][b]<<"\n";
        }
        Cout(ans);
        ans=0;
    }
    return 0;
}


Measured memory_bytes: 9856
def factorials(n,m):
    # 0~n!のリスト
    f = [1,1]
    for i in range(2,n+1):
        f.append(f[-1]*i%m)

    # 0~n!の逆元のリスト
    g = [1]
    for i in range(n):
        g.append(pow(f[i+1],m-2,m))

    return f,g

h,w,a,b = map(int, input().split())

f,g = factorials(h+w,10**9+7)

ans = 0

for i in range(b,min(w,h-a+b)):
    ans += f[h+b-a-1]*g[h+b-a-1-i]*g[i] * f[w+a-b-1]*g[a-b+i]*g[w-i-1]
    ans %= 10**9+7

print(ans)


"""# nCr mod mを求める
nCr = f[n]*g[n-r]*g[r]
nCr %= m
"""


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

int n;
int M[101010]={};
ll dp[101010]={};
ll cnt=0;


int main(){
   cin>>n;
   int a;
   
   rep(i,n){
      dp[i+1]=LLONG_MAX;
      a=9;
      while(a<=i+1){
         dp[i+1]=min(dp[i+1],dp[i+1-a]+1);
         a*=9;
      }
      a=6;
      while(a<=i+1){
         dp[i+1]=min(dp[i+1],dp[i+1-a]+1);
         a*=6;
      }
      dp[i+1]=min(dp[i+1],dp[i]+1);
   }
   cout<<dp[n]<<endl;
   return 0;
}



Measured memory_bytes: 1024
import Control.Monad
import Data.List
f n s
 |null s=n
 |null (init s)=n
 |s!!0=='A'&&s!!1=='B'=f(n+1)(drop 1 s)
 |otherwise=f(n)(drop 1 s)
main=do
 n<-readLn :: IO Int
 ss<-replicateM n getLine
 let sr=sum$map(f 0)ss
     sa=sum$map(\x->if head x=='B' &&last x/='A'then 1 else 0)ss
     sb=sum$map(\x->if last x=='A' &&head x/='B'then 1 else 0)ss
     ab=sum$map(\x->if head x=='B' &&last x=='A'then 1 else 0)ss
     sq=if ab==0 then min sa sb else if sa==0&&sb==0 then ab-1 else if sa==0||sb==0 then ab else ab+1+(min (sa-1) (sb-1))
 print$sr+sq

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

int n, m, l, r, ll = 1, rr;

int main(){
    scanf("%d%d", &n, &m);
    rr = n;
    for(int i = 0; i < m; i++){
        scanf("%d%d", &l, &r);
        ll = max(l, ll);
        rr = min(rr, r);
    }
    printf("%d\n", max(0, rr-ll+1));
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

class Main {
    private static void solve(int n) {
        Scanner scanner = new Scanner(System.in);
        int[] heights = new int[n];
        for (int i = 0; i < n; i++) {
            heights[i] = scanner.nextInt();
        }
        Arrays.sort(heights);
        for (int i = 0; i < 3; i++) {
            System.out.println(heights[heights.length - i - 1]);
        }
    }

    public static void main(String... args) {
        solve(10);
    }
}

Measured memory_bytes: 12000
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define REEP(i, N) for(ll i = N - 1; i >= 0; --i)
#define FOR(i,m,n) for(ll i = m; i < n; ++i)
#define RFOR(i,m,n) for(ll i = n - 1; i >= m; --i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define PB push_back
#define KIRIAGE(a, b) a += (b - a % b) % b // a を b の倍数値まで増やす
#define CEIL(c, a, b) if(a % b == 0) { c = a / b;} else { c = a / b + 1;} // a / b 以上の最小整数
#define sp(n) setprecision(n)
#define INF 1000000000
#define MOD 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	ll A, B, C;
	cin>>A>>B>>C;
	if(A % 2 == 0 || B % 2 == 0 || C % 2 == 0) cout<<0<<endl;
	else cout<<min(min(A*B, B*C), C*A)<<endl;
}


Measured memory_bytes: 256
n = int(input())
a,b=[],[]

for i in range(n):
    x,y = map(int,input().split())
    a.append(x)
    b.append(y)

a=list(reversed(a))
b=list(reversed(b))

OK=0
for i in range(n):
    A=a[i]+OK
    ok=-(-A//b[i])*b[i]-A
    OK+=ok

print(OK)


Measured memory_bytes: 17732
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
long long ans=-(1ll<<60),u[N],v[N];
priority_queue<int,vector<int>,greater<int>>p;
int n,X,Y,Z,i,a[N],b[N],c[N],id[N],x;
bool cmp(int x,int y){return a[x]-b[x]>a[y]-b[y];}
int main(){
	scanf("%d%d%d",&X,&Y,&Z);n=X+Y+Z;
	for(i=1;i<=n;++i)scanf("%d%d%d",a+i,b+i,c+i),id[i]=i;
	sort(id+1,id+n+1,cmp);
	for(i=1;i<=X;++i)p.push(x=a[id[i]]-c[id[i]]),u[X]+=x;
	for(i=X+1;i<=n-Y;++i)if(u[i]=u[i-1],x=a[id[i]]-c[id[i]],x>p.top())u[i]+=x-p.top(),p.pop(),p.push(x);
	for(;!p.empty();p.pop());
	for(i=n;i>=n-Y+1;--i)p.push(x=b[id[i]]-c[id[i]]),v[n-Y+1]+=x;
	for(;i>X;--i)if(v[i]=v[i+1],x=b[id[i]]-c[id[i]],x>p.top())v[i]+=x-p.top(),p.pop(),p.push(x);
	for(i=X;i<=n-Y;++i)ans=max(ans,u[i]+v[i+1]);
	for(i=1;i<=n;++i)ans+=c[i];
	printf("%lld\n",ans);
	return 0;
}

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

int main(){
    string w;
    cin >> w;
    int index[26];
    for(int i = 0; i < 26; i++){
        index[i] = 0;
    }
    for(int i = 0; i < w.length(); i++ ){
        index[(int)w[i] - 97]++;
    }
    for(int i = 0; i < 26; i++){
        if(index[i] % 2 != 0){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define loop(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(){
  int a[250]={},b[250]={}; //aは上下、bは左右
  int n;
  while(1){
    cin >> n;
    if(n==0) break;
    for(int i=1; i<n; i++){
      int x,y;
      cin >> x >> y;
      if(y==0){  //左
	    a[i]=a[x];
	    b[i]=b[x]-1;
	  }
	  if(y==1){  //下
	    a[i]=a[x]-1;
	    b[i]=b[x];
	  }
	  if(y==2){  //右
	    a[i]=a[x];
	    b[i]=b[x]+1;
	  }
	  if(y==3){  //上
	    a[i]=a[x]+1;
	    b[i]=b[x];
	  }
    }
    int amax=0,amin=0,bmax=0,bmin=0;
    loop(i,n){
      amax = max(amax,a[i]);
      amin = min(amin,a[i]);
      bmax = max(bmax,b[i]);
      bmin = min(bmin,b[i]);
    }
    amax-=amin;
    amax++;
    bmax-=bmin;
    bmax++;
    cout << bmax << " " << amax << endl;
    }  
  return 0;
}


Measured memory_bytes: 2984
#include <cstdio>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int dd(int x)
{
    int ans=0;
    while(x)
    {
        ans+=(x%10);
        x/=10;
    }
    return ans;
}
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        int _min=50;
        for(int i=1;i<n;i++)
        {
            _min=min(_min,dd(i)+dd(n-i));
            //printf("%d %d\n",dd(i),dd(n-i));
        }
        printf("%d\n",_min);
    }
    return 0;
}


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

int R, G, B, N;
ll ans;

int main()
{
    cin >> R >> G >> B >> N;
    ans = 0;
    for (int i = 0; i <= N / R; i++)
    {
        for (int j = 0; j <= N / G; j++)
        {
            int now = N - R * i - G * j;
            if (now >= 0 && now % B == 0)
                ans++;
        }
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
h = [int(input()) for i in range(N)]

import math

def enough(T):
    num = 0
    for hi in h:
        if hi - B * T <= 0:
            return True

        num += math.ceil((hi - B * T) / (A - B))
        if num > T:
            return False

    return True

h.sort(reverse=True)

iFrom = 1
iTo = math.ceil(h[0] / B)
while iFrom != iTo:
    iMid = iFrom + (iTo - iFrom) // 2

    if enough(iMid) == True:
        iTo = iMid
    else:
        iFrom = iMid + 1

print(iFrom)


Measured memory_bytes: 7512
#include<bits/stdc++.h>
#define mod 1000000007
#define fr first
#define se second
#define ll long long
#define PI 3.1415926535
#define pb push_back
#define mpr make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define senky_bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;
signed main()
{
      senky_bansal
      IIIT_ALLAHABAD

       ll a,b;
       cin>>a>>b;
       ll p = b-a;
       ll ans=1;
       if(p>0)
       ans+=(p+a-2)/(a-1);
       if(b==1)
       cout<<"0";
       else
       cout<<ans<<endl;
       





}




Measured memory_bytes: 256
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_C&lang=jp
#??????
if __name__ == "__main__":
    n_line = int(input())
    l = set([])
    for i in range(n_line):
        input_line = input().split()
        if input_line[0] == "insert":
            l.add(input_line[1])
        else:
            if input_line[1] in l:
                print("yes")
            else:
                print("no")

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

using namespace std;
using ll = long long;

int main()
{
  string s; cin >> s;
  if (s.size() == 2) {
    cout << s << endl;
  } else if (s.size() == 3) {
    reverse(ALL(s));
    cout << s << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

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

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


int main() {
  int N;
  cin >> N;
  map<string, ll> mp;
  REP(i,N) {
    string st; cin >> st;
    sort(ALL(st));
    mp[st]++;
  }
  ll ans = 0;
  for (auto x : mp) {
    if (1 < x.second) {
      ans += x.second * (x.second-1) / 2;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 11136
s = input()
min_change = 100
for char in 'abcdefghijklmnopqrstuvwxyz':
    absence = 0
    max_absence = 0
    for i in s:
        if i != char:
            absence += 1
        else:
            max_absence = max(max_absence,absence)
            absence = 0
    max_absence = max(max_absence,absence)
    min_change = min(min_change,max_absence)
print(min_change)

Measured memory_bytes: 80152
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>

using namespace std;

int main(){
  int c;
  vector<vector<int>> a(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
        cin >> c;
        a[i][j] = c;
    }
  }

  vector<int> x(3);
  vector<int> y(3);
  x[0] = 0; 

  for (int i = 0; i < 3; i++) y[i] = a[0][i]-x[0];
  for (int i = 0; i < 3; i++) x[i] = a[i][0]-y[0];

  bool good = true;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if(x[i]+y[j] != a[i][j]){
        good = false;
      }
    }
  }

  if(good == true){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pii pair<int,int>
const long long MOD=1000000007;

int main(){//愚直にやってみたら
    int n;
    cin>>n;
    vector<int> V(n);
    rep(i,n) cin>>V[i];
    sort(V.begin(),V.end());
    double ans=(double)(V[0]+V[1])/2;
    rep(i,n-2) ans=(double)(ans+V[i+2])/2;
    cout<<fixed<<setprecision(10)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())

def modpow(b,e):
    if e == 0:
        return 1
    elif e%2 == 1:
        return b*modpow(b,e-1)
    else:
        return modpow(b*b,e//2)

total = modpow(10,n)
minus = modpow(9,n)
add = modpow(8,n)

answer = total - minus - minus + add

answer %= 1000000007

print(answer)


Measured memory_bytes: 12016
n = int(input())

pre_num = 0
cur_num = 26
length = 1
while n > cur_num:
  length += 1
  pre_num = cur_num
  cur_num += 26 ** length

n -= pre_num + 1
name = []
a = ord('a')
for _ in range(length):
  c = n % 26
  n //= 26
  name.append(chr(a + c))
print(''.join(name[::-1]))

Measured memory_bytes: 9156
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const ll MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);

const int MAX=200010;


int main() {
    ios_base::sync_with_stdio(false); 

    ll n;
    cin >> n;
    vector<ll> a;
    int p=1;
    while (n!=0) {
        if (abs(n%2)==1) a.push_back(1);
        else a.push_back(0);
        if (n>0) n/=-2;
        else n=(-n+1)/2;
    }
    reverse(a.begin(),a.end());
    if (a.size()==0) a.push_back(0);
    rep(i,a.size()) cout << a[i];
    cout << endl;


    
    return 0;
}


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

play_list = []
for _ in range(N):
    music = input().split(" ")
    play_list.append((music[0], int(music[1])))

X = input()
result = 0
flag = False
for music in play_list:
    if flag:
        result += music[1]
        continue
    if music[0] == X:
        flag = True

print(result)


Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        if(n == 0){
            System.out.println(0);
            return;
        }

        String ans = "";
        int c = 0;
        while(true){
            long pow = 2L << c;
            if(n % pow != 0){
                n -= Math.pow(-2, c);
                ans = "1" + ans;
            }else{
                ans = "0" + ans;
            }
            if(n == 0) break;
            c++;
        }
        System.out.println(ans);
    }
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = 10000000000;
/****** define constant end ********/


/****** define variable start ******/
ll n;
vl p;
/******* define variable end *******/

ll solve(){
    cin >> n;
    p.resize(n);
    REP(i, n){
        cin >> p[i];
    }
    vl lmin(n);
    lmin[0] = p[0];
    for(ll i = 0; i < n-1; i++){
        lmin[i+1] = min(lmin[i], p[i]);
    }
    ll ans = 0;
    REP(i, n){
        if(lmin[i] >= p[i]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}
int main(){
    //clock_t start = clock();
    cout << std::fixed << std::setprecision(10);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll end_solve = solve();
    /*
    clock_t end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    printf("time %lf[ms]\n", time);
    */
    return (int)end_solve;
}


Measured memory_bytes: 3456
#include <iostream>
    #include <cstdio>
    #include <algorithm>
    #include <vector>
    #include <string>
    #include <string.h>
     
    typedef long long ll;
    using namespace std;
    const ll INF = 1000000000000000000ll;
    const ll MOD = 1000000007ll;
     
    const double EPS = 1e-8;
     
    int main()
    {
    	long N=0,T=0;
		long X=0,TT=0;

		cin >> N;
		cin >>T;
		vector<long> t(N,0);

		for(int i=0;i<N;i++){
			cin >> t[i];
		}

		for(int i=1;i<N;i++){
			TT=(t[i]-t[i-1]);
			if(TT<T){
				X+=TT;
			}else if(TT>=T){
				X=X+T;
			}
		}

		cout << X+T << endl;

    	return 0;
    }

Measured memory_bytes: 1792
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(true){
			int H = stdIn.nextInt();
			int W = stdIn.nextInt();
			if(H == 0 && W == 0)
				break;
			for (int i=0; i<H; i++) {
				for (int j=0; j<W; j++) {
					if (((i+j)&1) == 0) {
						System.out.print("#");
					}else{
						System.out.print(".");
					}
				}
				System.out.println();
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 26664
/**
 *    author:  math2do
 *    created: 19.01.2020 00:29:06
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector <double> dp(n + 1);
  dp[0] = 1;

  for (int coin = 1; coin <= n; coin++) {
    double head;
    cin >> head;
    for (int i = coin; i >= 0; i--) {
      dp[i] = (i == 0 ? 0 : dp[i - 1] * head) + dp[i] * (1 - head);
    } 
  }
  
  double ans = 0;
  for (int heads = 0; heads <= n; heads++) {
    int tails = n - heads;
    if (heads > tails) {
      ans += dp[heads];
    } 
  }

  cout << fixed << setprecision(10) << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
	int a,s,d,f,g,h,i,j;
	scanf("%d",&d);
	while(d!=0){
		h=d;
		scanf("%d",&f);
		for(i=1;i<=f;i++){
			scanf("%d %d",&a,&s);
			h=h-(s-a);
		}
		if(h<=0){
			printf("OK\n");
		}
		else{
			printf("%d\n",h);
		}
		scanf("%d",&d);	
	}
	return 0;
}

Measured memory_bytes: 1040
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace Atcoder_Answer
{
    class Program
    {
        const Int32 mod = 1000000007;

        static void Main(string[] args)
        {
            string[] Reader = ReadLine().Split(' ');

            int N = int.Parse(Reader[0]);
            int K = int.Parse(Reader[1]);

            List<int> D = new List<int>();
            List<int> HaveSunukes = new List<int>();

            for (int loop = 0; loop < K; loop++) 
            {
                D.Add(int.Parse(ReadLine()));
                Reader = ReadLine().Split(' ');

                for (int j = 0; j < Reader.Length; j++) 
                {
                    HaveSunukes.Add(int.Parse(Reader[j]));
                }
            }

            WriteLine((N - HaveSunukes.Distinct().ToArray().Length));
            ReadKey();
        }

        #region Functions
        public decimal floor(float d) => Math.Floor((decimal)d);
        #endregion

        class Sunuke 
        {
            public int D { get; set; }
        }
    }

    public static class Extension
    {
        #region 拡張:bool
        #region キャスト関連
        public static int ToInt(this bool Bool)
        {
            if (Bool) return 1;
            else return 0;
        }

        public static string ToString(this bool Bool, string TrueStr, string FalseStr)
        {
            if (Bool) return TrueStr;
            else return FalseStr;
        }
        #endregion
        #endregion

        #region 拡張:int
        #region キャスト関連
        public static char ToAlphaBets(this int Base) => (char)Base;
        #endregion
        #endregion

        #region 拡張:char
        #region 変換関連
        public static char NextAlpha(this char Char) => (char)((Char) + 1); //次の文字を取得
        #endregion
        #endregion

        #region 拡張:int[]
        public static long Sum(this int[] Array)
        {
            int Ret = 0;
            for (int loop = 0; loop < Array.Length; loop++) Ret += Array[loop];
            return Ret;
        }
        #endregion

        #region 拡張: string
        public static string Multi(this string THIS, int Value)
        {
            string RetValue = "";

            for (int loop = 0; loop < Value; loop++) RetValue += THIS;

            return RetValue;
        }
        #endregion

        #region 拡張: List<string>
        public static string Sum(this List<string> THIS, string Split)
        {
            string RetValue = "";

            for (int loop = 0; loop < THIS.Count; loop++)
            {
                RetValue += THIS[loop];
            }

            return RetValue;
        }
        #endregion
    }
}

Measured memory_bytes: 19500
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	string s;
	cin>>s;
	
	REP(i,s.size()){
		if(s[i]=='?') s[i]='D';
	}
	
	cout<<s<<endl;
}

Measured memory_bytes: 3680