akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(i=0;i<n;i++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max(a,b)-min(a,b))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1; rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)n,(int)n)
#define nHr(n,r) nCr((int)(n+r+1),(int)r)
#define sankaku(x) ((1+x)*x)/2
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
void initialize(){
  
}
int main(void){
  initialize();
  int n,m,i,j;
  double result=0;
  int a[LIMIT2]={0};
  char s[LIMIT1];

  scanf("%d",&n);
  result = (double)2*n * M_PI;
  printf("%.12f ", result);

  return 0;
}



Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;cin>>n;
	int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	int f=1;
	a[0]=a[0]-1;
	for(int i=1;i<n;i++){
		if(a[i-1]<a[i])a[i]=a[i]-1;
	}
	for(int i=1;i<n;i++){
		if(a[i-1]<=a[i]);
		else f=0;
	}
	if(f)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl
#define dd(x) cout<<#x<<"="<<x<<" "
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;

const ll mod = 1000000007;
const int N = 5e5+6;
const int M = 2e6+6;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;

bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==0?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=1;a%=mod; if(b<0) return 1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//inv[1]=1;
//for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
int n;
int main() {
	string s, t;
	while(cin>>s>>t) {
		string ret = t + s;
		cout<<ret<<endl;
	}
    return 0;
}


Measured memory_bytes: 256
program d
  implicit none
  integer,allocatable :: A(:),B(:)
  integer :: N,i,j,M,sm

  read(*,*) N
  allocate(A(N))
  read(*,*) A

  allocate(B(N))
  B=666
  do i=((N+1)/2),N
     B(i)=A(i)
  enddo
  do i=(N/2),1,-1
     sm=0
     do j=2,(N/i)
        sm=sm+B(j*i)
     enddo
     B(i)=mod(mod(A(i)-sm,2)+2,2)

  enddo
  !write(*,*) B                                                                 
  M=sum(B)
  write(*,'(i0)') M
  do i=1,N
     if(B(i).eq.1) then
        write(*,'(i0)',advance='no') i
        write(*,'(a)',advance='no') ' '
     endif
  enddo
  write(*,*)

end program d



Measured memory_bytes: 2816
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N,K;

const ll MAX = 1000000;
ll fac[MAX], finv[MAX], inv[MAX];
// nCk初期化
void nCkInit(const ll MOD) {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll nCk(ll n, ll k,const ll MOD){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
    cin>>N>>K;
    nCkInit(MOD);
    ll ans=0;
    for(ll i=0;i<=min(N,K);i++){
        ans=(ans+nCk(N,N-i,MOD)*nCk(N-1,i,MOD))%MOD;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 23680
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}
#define DEBUG_VLL(vec) REP(i, vec.size()) cerr<<vec[i]<<(i==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k; cin >> n >> k;
    ll ans = 0;
    REP(i, n) {
        ll h; cin >> h;
        if (h>=k) ans++;
    }
    cout << ans << '\n';
    return 0;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> x(n);
  int sum = 0;
  for(int i=0; i<n; i++) {
    cin >> x.at(i);
    if(2 * x.at(i) < 2*(k - x.at(i))) sum += 2 * x.at(i); 
    else sum += 2 * (k - x.at(i));
  }
  
  cout << sum << endl;
  
}

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

int n;
int A[N],B[N],C[N];

void Countingsort(int k);

int main(){

  int i,max = 0;

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    scanf("%d",&A[i]);
    
    if(max <= A[i]){
      max = A[i];
    }

  }

  Countingsort(max);

  for(i = 0; i < n; i++){

    if(i == n-1){
      printf("%d\n",B[i]);
    } else {
      printf("%d ",B[i]);
    }
    
  }

  return 0;

}

void Countingsort(int k){
  
  int i,j;

  for(i = 0; i <= k; i++){
    C[i] = 0;
  }
  for(j = 0; j < n; j++){
    C[A[j]] = C[A[j]]+1;
    /* C[i]にはiの出現数が記録されている*/
  }
  for(i = 1; i <= k; i++){
    C[i] = C[i] + C[i-1];
  }
  /* C[i]にはi以下の数の出現数が記録されている*/
  for(j = n-1; j >= 0; j--){
    //    printf("%d: \n", j);
    //for(i=0;i<n;i++) printf("%d ", C[i]);
    //printf("\n");
    B[C[A[j]]-1] = A[j];
    C[A[j]] = C[A[j]]-1;
  }

}

Measured memory_bytes: 15000
#include <iostream>
 
const int NOT = -10000000000;
int num;
int* data;
 
int fun()
{
    int out,d=NOT;
    int j2;
    bool flag=false;
    for(int i=0;i<num;i++){
        out=data[i];
        for(int j=0;j<num;j++){
            if(i==j){
                j2=j-1;
                continue;
            }
            if(d==NOT){
                if(j+1!=i){
                    d=data[j+1]-data[j];
                }else{
                    d=data[j+2]-data[j];
                }
            }else{
                if(d!=data[j]-data[j2]){
                    d=NOT;
                    break;
                }
            }
            j2=j;
        }
        if(d!=NOT){
            break;
        }
    }
    return out;
}
 
int main ()
{
        std::cin>>num;
        while(num){
                num++;
                data=new int[num];
                for(int i=0;i<num;i++){
                        std::cin>>data[i];
                }
                std::cout<<fun()<<std::endl;
                delete[] data;
                std::cin>>num;
        }
}

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

using namespace std;
using ll = long long;

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

  int n, w;
  cin >> n >> w;
  vector<ll> ws(n);
  vector<ll> vs(n);
  for (int i = 0; i < n; i++)
    cin >> ws[i] >> vs[i];

  vector<vector<ll>> dp(n + 1, vector<ll>(w + 1, 0ll));

  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= w; j++) {
      if (j - ws[i] >= 0) {
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - ws[i]] + vs[i]);
      }
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
    }
  }

  cout << dp[n][w] << endl;

  return 0;
}


Measured memory_bytes: 83076
#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=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;



int main() {

	int n;
	cin >> n;

	int ans = 0;

	FOR(i, 1, n + 1) {
		int j = i;
		int k = 0;
		while (j) {
			j /= 10;
			k++;
		}
		if (k % 2)ans++;

	}
	cout << ans << endl;
	
}

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

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

    vector<int> h(n);
    rep(i,n){
        cin >> h.at(i);
    }

    // 各展望台の繋がり情報
    bitset<10000000> good;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        if(h.at(a-1) == h.at(b-1)){
            good.set(a-1,1);
            good.set(b-1,1);
        }
        else if(h.at(a-1) < h.at(b-1)){
            good.set(a-1,1);
        }
        else if (h.at(a-1) > h.at(b-1))
        {
            good.set(b-1,1);
        }
        
    }
    cout << n - good.count() << endl;

    return 0;
}

Measured memory_bytes: 4852
#include <stdio.h>
#include <string.h>
int main(void)
{
char a[20];
char l;
int i;
while(scanf("%s", a)!=EOF)
{
    l = strlen(a);
    for( i=l-1;i>=0;i--)
    {
        printf("%c",a[i]);
    }
    printf("\n");
}
{
}
return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,i=1;
  string c = "NO";
  cin >> A >> B >> C;
  int rem[B]={};
  while(1){
  	rem[(A*i)%B]++;
    if(rem[(A*i)%B]>1)
      break;
    i++;
  }
  if(rem[C]>0)
  	c= "YES";
  cout << c << endl;
}

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

Measured memory_bytes: 3620
# include <bits/stdc++.h>
# define lnode (node << 1)
# define rnode (lnode | 1)
# define int long long
using namespace std;
const int N = 1e5 + 10;
int Smin[4 * N] , Smax[4 * N] , a[N] , L[N] , R[N] , LL[N] , RR[N] , INF; 
long long res = 0; 
void upd_min(int l , int r , int x , int v , int node){
	if(l > x || r < x) return;
	if(l == r && x == l){
		Smin[node] = v; 
	}
	else{
		int m = (l + r) >> 1;
		upd_min(l , m , x , v , lnode); ++ m;
		upd_min(m , r , x , v , rnode);
		Smin[node] = min(Smin[lnode] , Smin[rnode]);
	}
}
void upd_max(int l , int r , int x , int v , int node){
	if(l > x || r < x) return;
	if(l == r && x == l){
		Smax[node] = v;
	}
	else{
		int m = (l + r) >> 1;
		upd_max(l , m , x , v , lnode); ++ m;
		upd_max(m , r , x , v , rnode);
		Smax[node] = max(Smax[lnode] , Smax[rnode]);
	}
}
int query_min(int l , int r , int L , int R , int node){
	if(l > r || L > R || l > R || L > r) return INF;
	if(L <= l && R >= r)return Smin[node];
	int m = (l + r) >> 1;
	return min(query_min(l , m , L , R , lnode) ,  query_min(m + 1 , r , L , R , rnode));
}
int query_max(int l , int r , int L , int R , int node){
	if(l > r || L > R || l > R || L > r) return 0;
	if(L <= l && R >= r)return Smax[node];
	int m = (l + r) >> 1;
	return max(query_max(l , m , L , R , lnode) , query_max(m + 1 , r , L , R , rnode));  
}
main(){
	int n;
	cin >> n; INF = n + 1;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++){
		L[i] = query_max(1 , n , a[i] + 1 , n , 1);
		upd_max(1 , n , a[i] , i , 1);
	}
	for(int i = 0; i <= 4 * n; i ++) Smin[i] = INF;
	for(int i = n; i >= 1; i --){
		R[i] = query_min(1 , n , a[i] + 1 , n , 1);
		upd_min(1 , n , a[i] , i , 1); 
	}
	for(int i = 0; i <= 4 * n; i ++) Smin[i] = INF , Smax[i] = 0;
	for(int i = 1; i <= n; i ++){
		int m = L[i];
		if(m) m = a[m] , LL[i] = max(query_max(1 , n , a[i] + 1 , m - 1 , 1) , query_max(1 , n , m + 1 , n , 1));
		upd_max(1 , n , a[i] , i , 1); 
	}
	for(int i = n; i >= 1; i --){
		int m = R[i];
		RR[i] = n + 1; 
		if(m != n + 1)m = a[m] ,
		RR[i] = min(query_min(1 , n , a[i] + 1 , m - 1 , 1) , query_min(1 , n , m + 1 , n , 1));
		upd_min(1 , n , a[i] , i , 1);
	}
	for(int i = 1; i <= n; i ++){
		int l , r;
		if(L[i]) l = LL[i] + 1 , r = R[i] - 1 , res += (L[i] - l + 1) * (r - i + 1) * a[i];
		if(R[i] <= n) l = L[i] + 1 , r = RR[i] - 1 , res += (r - R[i] + 1) * (i - l + 1) * a[i];
	}
	cout << res << "\n";
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    map<string, int> mp;
    rep(i, n) {
        string s;
        cin >> s;
        mp[s]++;
    }

    cout << mp.size() << endl;

    return 0;
}

Measured memory_bytes: 19208
package main

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

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

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

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

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

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 readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

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 eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	N := readInt()

	G := make([][]Edge, N)
	for i := 0; i < N-1; i++ {
		u := readInt() - 1
		v := readInt() - 1
		w := readInt()
		G[u] = append(G[u], Edge{v, w})
		G[v] = append(G[v], Edge{u, w})
	}

	C := make([]int, N)
	for i := range C {
		C[i] = -1
	}

	dfs(C, G, 0, 0)

	for _, c := range C {
		println(c)
	}
}

func dfs(C []int, G [][]Edge, n, c int) {
	C[n] = c
	for _, e := range G[n] {
		v := e.to
		w := e.cost
		if C[v] != -1 {
			continue
		}
		if w%2 == 0 {
			dfs(C, G, v, c)
		} else {
			dfs(C, G, v, 1-c)
		}
	}
}

type Edge struct {
	to, cost int
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 25216
#include<stdio.h>
#include<stdlib.h>
int compara(const void *x, const void *y){
    int a = *((int *)x),b = *((int *)y);
    if(a>b)
        return -1;
    if(a<b)
        return 1;
}

int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    long int vetor[n+1],val=0;
    for(int x=0;x<n;++x)
        scanf("%ld",&vetor[x]);
    qsort(vetor,n,sizeof(vetor[0]),compara);
    for(int l=0;l<m;++l)
        val+=vetor[l];
    printf("%ld\n",val);
    return 0;
}


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

const int MOD = 1000000007;

int main() {
    ll a, b, c, d,e,f,g,h;
    cin >> a >> b >> c >>d;
    e = a * c;
    f = a * d;
    g = b * c;
    h = b * d;
    cout << max({ e,f,g,h }) << endl;
    return 0;
}

Measured memory_bytes: 3648
s = input()

ans = 0
i = 1
memo = ""
while s:
    if memo == s[:i] and memo == s:
        break
    elif memo == s[:i]:
        i += 1
    else:
        memo = s[:i]
        s = s[i:]
        ans += 1
        i = 1

print(ans)

Measured memory_bytes: 3500
#include<bits/stdc++.h>
using namespace std;
const int maxn=100005;
struct SHIT
{
    int one,two;
    bool operator<(const SHIT  &b)const {
        if(this->one!=b.one) return (this->one<b.one);
        return (this->two<b.two);
    }
}shit[maxn];
bool cmp(SHIT a,SHIT b)
{
    if(a.one+a.two!=b.one+b.two)
        return a.one+a.two<b.one+b.two;
    return a.one<b.one;
}
map<SHIT,bool>mp;
int main()
{
    int n;
    mp.clear();
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&shit[i].one,&shit[i].two);
        mp[shit[i]]=1;
    }
    if(!(shit[1].one==shit[2].two&&shit[1].two==shit[2].one&&shit[1].one==0&&shit[1].two!=0)){
        puts("-1");
        return 0;
    }
    int mn=shit[1].two;
    int ans=2*n-2;
    for(int i=3;i<=n;i++)
    {
        if(shit[i].one==0||shit[i].two==0||shit[i].one+shit[i].two<mn){
            puts("-1");
            return 0;
        }
    }
    sort(shit+1,shit+n+1,cmp);
    for(int i=1,j;i<=n;i=j)
    {
        j=i+1;
        while(j<=n&&shit[j].one+shit[j].two==shit[i].one+shit[i].two)
            j++;
        for(int k=i;k<j;k++)
            mp[shit[k]]=1;
        int last=0,left=0;
        for(int k=i,tk;k<j;k=tk)
        {
            tk=k+1;
            while(tk<j&&shit[tk].one==shit[k].one){
                tk++;
            }
            int now=tk-k;
            bool one=0,two=0;
            SHIT tmp1,tmp2;
            tmp1.one=shit[k].one-1;
            tmp1.two=shit[k].two-1;
            if(mp.count(tmp1)){
                ans-=now;
                if(last+1!=shit[k].one)
                    now=0;
                else now=min(now,left);
                last=shit[k].one;
                left=now;

                continue;
                one=1;two=1;
            }


            tmp1.one=shit[k].one-1;
            tmp1.two=shit[k].two+1;
            tmp2.one=shit[k].one+1;
            tmp2.two=shit[k].two-1;



            one=one|mp.count(tmp1);
            two=two|mp.count(tmp2);

            tmp1.two--;
            tmp2.one--;
            one=one|mp.count(tmp1);
            two=two|mp.count(tmp2);

            if(shit[k].one==0)one=1;
            if(shit[k].two==0) two=1;
            if(one==0||two==0){
                puts("-1");
                return 0;
            }
            int del=0;
            if(last+1==shit[k].one){
                del=min(now,left);
                ans-=del;
            }
            tmp1.two--;

            last=shit[k].one;
            left=now;
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
////////////////////////////////////////////////////////////////////////////<editor-fold desc="macros">
#define endl "\n"
#define long long long
#define all(v) (v).begin(),(v).end()
#define makeset(v) (v).resize(unique((v).begin(),(v).end())-(v).begin())
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define filein freopen("input.txt", "r", stdin);
#define fileout freopen("output.txt", "w", stdout);
#define getline(x) getline(cin,x)
#define makelower(s) transform(s.begin(),s.end(),s.begin(),::tolower)
bool sortby(string a,string b){makelower(a);makelower(b);return a<b;}
#define printcase(x)  cout<<"Case "<<in++<<": "<<x<<endl
#define memset(a,b) memset(a,b,sizeof(a))
#define print1d(ary) cout<<"[";for(auto x:(ary)){cout<<x<<",";}cout<<"]"<<endl;
#define print2d(x) for(int m = 0; m <sizeof(x)/sizeof(x[0]) ; ++m){for(int l = 0; l <sizeof(x[0])/sizeof(x[0][0]) ; ++l){cout<<x[m][l]<<" ";}cout<<endl;}
#define pi acos(-1)
////////////////////////////////////////////////////////////////////////////</editor-fold>


int main() {
///<editor-fold desc="ios">
  //  IOS
#ifdef _AD_
    filein //fileout
#endif
///</editor-fold>
    long in=1,o;
    //cin>>o;
    int n;
    cin>>n;
    string s="ACL";
    string ans;
    for(long i = 0; i < n; ++i){
        ans+=s;
    }
    cout<<ans<<endl;



}

Measured memory_bytes: 3628
from bisect import bisect
from collections import defaultdict

n = int(input())
up = [defaultdict(list), defaultdict(list), defaultdict(list)]
dp = [defaultdict(list), defaultdict(list), defaultdict(list)]
lp = [defaultdict(list), defaultdict(list), defaultdict(list)]
rp = [defaultdict(list), defaultdict(list), defaultdict(list)]

for _ in range(n):
    x, y, u = input().split()
    x = int(x)
    y = int(y)
    if u == 'U':
        up[0][x].append(y)
        up[1][x + y].append(x)
        up[2][x - y].append(x)
    elif u == 'D':
        dp[0][x].append(y)
        dp[1][x + y].append(x)
        dp[2][x - y].append(x)
    elif u == 'L':
        lp[0][y].append(x)
        lp[1][x + y].append(x)
        lp[2][x - y].append(x)
    else:
        rp[0][y].append(x)
        rp[1][x + y].append(x)
        rp[2][x - y].append(x)


def crush_time(planes1, planes2, idx):
    result = INF
    for xy in planes1[idx]:
        if xy not in planes2[idx]:
            continue
        s = planes1[idx][xy]
        s.sort()
        for x in planes2[idx][xy]:
            i = bisect(s, x)
            if i > 0:
                result = min(result, x - s[i - 1])
    return result


INF = 10 ** 18

ans = min(
    crush_time(up, dp, 0) * 5,
    crush_time(rp, lp, 0) * 5,
    crush_time(rp, up, 1) * 10,
    crush_time(dp, lp, 1) * 10,
    crush_time(up, lp, 2) * 10,
    crush_time(rp, dp, 2) * 10,
)

if ans == 5 * INF:
    print('SAFE')
else:
    print(ans)


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

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

    if(N > 1){
        ans_1 = N*(N-1)/2;
    }else{
        ans_1 = 0;
    }

    if(M > 1){
        ans_2 = M*(M-1)/2;
    }else{
        ans_2 = 0;
    }

    cout << ans_1+ans_2 << endl;

    return 0;
}

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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int A, B, X;
    cin >> A >> B >> X;
    if(A <= X && X <= A + B) {
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map(String::toLong)
    val nn = n shl 1
    val scc = if (nn <= m) {
        n + (m - nn) / 4
    } else {
        m / 2
    }
    println(scc)
}


Measured memory_bytes: 38120
#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);
	string s;cin >> s;
	int ans=0;
	rep(i,s.size()-1) if(s.at(i)!=s.at(i+1)) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 512
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""043-c"""


import sys

from functools import reduce


def main():
    """Main function."""
    N = int(input())
    a_list = list(map(int, input().split()))

    # print(N, a_list)

    x = sum(a_list) / N

    def sumOfProd(n,l):
        """Sum of product."""
        return reduce(lambda a,b: a + b,
                      map(lambda v: (v - n) * (v - n), l))

    res1 = sumOfProd(int(x), a_list)
    res2 = sumOfProd(int(x) + 1, a_list)

    print(min(res1, res2))


if __name__ == '__main__':
    sys.exit(main())

Measured memory_bytes: 3828
# -*- coding: utf-8 -*-
import sys 
from collections import Counter,deque,defaultdict
from itertools import combinations,permutations,accumulate
from bisect import bisect_left,bisect
sys.setrecursionlimit(10**6)
INF = 10**9+7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, X, T = map(int, readline().split())
cnt = -(-N//X)
print(cnt*T)

Measured memory_bytes: 64792
#include<iostream>
#include<cstdio>
#include<map>
using namespace std;
long long n,a[111111],mx,mxx,kp;
map<long long,long long> cnt;
int main()
{
	scanf("%lld",&n);
	for (int i=1;i<=n;i++) scanf("%lld",&a[i]);
	for (int i=1;i<=n;i++)
	{
		cnt[a[i]]++;
		if (cnt[a[i]]==2)
		{
			if (a[i]>mx) 
			{
				mxx=mx;
				mx=a[i];
			}
			else if (a[i]>mxx) mxx=a[i];
		}
		if (cnt[a[i]]==4)
		{
			kp=max(kp,a[i]*a[i]);
		}
	}
	printf("%lld\n",max(mxx*mx,kp));
	return 0;
}

Measured memory_bytes: 7296
#include <cmath>
#include <queue>
#include <cstdio>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define N 200010
#define ll long long
#define inf 1000000000000000ll
using namespace std;
inline int read() 
{ 
    int x=0,f=1;char ch=getchar(); 
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} 
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} 
    return x*f; 
}
int n,a[N];
ll sum[N];
ll ans;
int main()
{
	ans=inf;
	n=read();
	for(int i=1;i<=n;i++)a[i]=read(),sum[i]=sum[i-1]+a[i];
	for(int i=1;i<n;i++)
	{
		ll x=sum[i],y=sum[n]-sum[i];
		ans=min(ans,abs(x-y));
	}
	printf("%lld",ans);
}

Measured memory_bytes: 2688
/**
 * auther: moririn_cocoa
 */
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_)

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define fi first
#define se second

int main(int argc, char* argv[]) {
  
  int N;
  int i;
  
  cin >> N;
  cin >> i;
  
  cout << N - i + 1 << endl;
  
  return 0;
}

Measured memory_bytes: 3600
#include "bits/stdc++.h"
#define ll long long int
#define all(x) x.begin(), x.end()
#define pb push_back
#define se second
#define fi first
using namespace std;
typedef pair<ll,ll> pll;

const ll N = 303;
ll d[N][N];
pll mat[N][N];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll n; cin>>n;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=n;j++) cin>>d[i][j];
    }
    bool ok=true;
    for(ll k=1;k<=n;k++){
        for(ll i=1;i<=n;i++){
            for(ll j=1;j<=n;j++){
                ll dis=d[i][k]+d[k][j];
                if(dis<d[i][j]) ok=false;
            }
        }
    }
    if(!ok){
        cout<<-1;
        return 0;
    }
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=n;j++){
            mat[i][j].fi=d[i][j];
            mat[i][j].se=j;
        }
        sort(mat[i]+1,mat[i]+1+n);
    }
    vector<ll> v(n+1);
    for(ll i=1;i<=n;i++){
        v[i]=mat[1][i].se;
    }
    map<pll,ll> mp;
    for(ll i=1;i<=n;i++){
        ll a=v[i];
        for(ll j=1;j<=n;j++){
            ll node=mat[a][j].se;
            bool found=false;
            for(ll k=1;k<=n;k++){
                if(k==a or k==node) continue;
                ll val=d[a][k]+d[k][node];
                if(val==d[a][node]){
                    /*if(!mp[{a,k}]){
                        mp[{a,k}]=d[a][k];
                    }
                    if(!mp[{k,node}]){
                        mp[{k,node}]=d[k][node];
                    }*/
                    found=true;
                    break;
                }
            }
            if(!found){
                if(!mp[{a,node}]){
                    mp[{a,node}]=d[a][node];
                }
            }
        }
    }
    ll ans=0;
    for(auto m:mp){
        ans+=m.se;
    }
    cout<<ans/2;
    return 0;
}


Measured memory_bytes: 2560
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;

int h, w, n;
char A[200002], B[200002];
int main(){
    cin >> h >> w >> n;
    int x, y;
    cin >> x >> y;
    int x0 = x, y0 = y;
    cin >> A >> B;
    bool ans = true;
    for(int i=0;i<n;i++){
        if(A[i] == 'U'){
            x--;
            if(x == 0){
                ans = false;
                break;
            }
        }
        if(B[i] == 'D'){
            x = min(x+1, h);
        }
    }
    x = x0;
    for(int i=0;i<n;i++){
        if(A[i] == 'D'){
            x++;
            if(x == h+1){
                ans = false;
                break;
            }
        }
        if(B[i] == 'U'){
            x = max(x-1, 1);
        }
    }
    for(int i=0;i<n;i++){
        if(A[i] == 'L'){
            y--;
            if(y == 0){
                ans = false;
                break;
            }
        }
        if(B[i] == 'R'){
            y = min(y+1, w);
        }
    }
    y = y0;
    for(int i=0;i<n;i++){
        if(A[i] == 'R'){
            y++;
            if(y == w+1){
                ans = false;
                break;
            }
        }
        if(B[i] == 'L'){
            y = max(y-1, 1);
        }
    }
    cout << (ans?"YES":"NO");
}


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

int main() {
  char c;
  cin >> c;
  
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>

int main()
{
    std::string str;
    std::cin >> str;
    std::size_t r = 0;
    std::size_t m = 0;
    for( char c : str )  {
        switch( c ) { case 'A':case 'T':case 'C':case 'G': ++r; break; default: m = std::max(r,m); r = 0; }
    }
    std::cout << std::max(r,m);
}

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

int main(){
  int a,b;
  cin>>a>>b;
  if(a*b == 15){
    cout << "*" << endl;
  }
  else if(a+b == 15){
    cout << "+" << endl;
  }
  else cout <<"x" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int c[3][3];
    for (int i = 0; i < 3;i++){
        for (int j = 0; j < 3;j++){
            cin >> c[i][j];
        }
    }
    int a = c[0][1] - c[0][0], b = c[0][2] - c[0][1];
    bool flag = true;
    for (int i = 1; i < 3;i++){
        if(c[i][1]-c[i][0]!=a)
           flag = false;
        if(c[i][2]-c[i][1]!=b)
            flag = false;
    }
    if(flag)
        cout << "Yes" << endl;
        else
            cout << "No" << endl;
    return 0;
}

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

using namespace std;

int main() {
    int r, g, b, n;
    cin >> r >> g >> b >> n;
    
    int ans = 0;
    for(int i = 0; i <= n / r; i++) {
        for(int j = 0; j <= n / g; j++) {
            if(i * r + j * g <= n) {
                if((n - (i * r + j * g)) % b == 0) {
                    ans++;
                }
            }
        }
    }
    
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 256
// atcoder 175

//A
#include <iostream>
using namespace std;
#define ll  long long
#define M 1000000007
#define tc int t; cin>>t; while(t--)
#include <cstring>
int main(){
	string s;
	cin>>s;
	int l = 0, maxL = 0;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == 'R' && maxL <= l){
			l++;
			maxL = l; 
		}
		else if(s[i] == 'S'){
			l = 0; 
		}
	}
	cout << maxL << endl;
	return 0;
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
int main(){
  string q;
  int l;
  vector<int> b(3);
  cin>>q;
  for(l=0;l<3;l++) b.at(q.at(l)-'a')=1;
  if(b.at(0)==1&&b.at(1)==1&&b.at(2)==1) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3632
n = gets.to_i
while n != 0 do
	max = -999999
	a = Array.new(n,0)
	n.times do |i|#input data
		a[i] = gets.to_i
		max = a[i] if a[i] > max
	end

	n.times do |i|#calc sum
		ans = a[i]
		(n-i-1).times do |j|
			ans = a[j+i+1] + ans
			max = ans if max < ans 
		end
	end
	puts max
	n = gets.to_i
end

Measured memory_bytes: 6100
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

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

int t[int(2e5)+5];

int main(){

    int n, T;
    cin >> n >> T;
    for(int i=0; i<int(2e5+5); i++) t[i] = 2*INF;
    for(int i=0; i<n; i++) cin >> t[i];

    ll sum = 0;

    for(int i=0; i<n; i++){
        sum += min(T, t[i+1]-t[i]);
    }

    cout << sum << endl;

}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(int argc, char **argv) {
    int n;

    cin >> n;

    for (int i = 0; i < n; i++) {
        int a, b, c;
        cin >> a >> b >> c;

        if (a * a == b * b + c * c || b * b == a * a + c * c || c * c == a * a + b * b) {
           cout << "YES" << endl;
        }
        else {
            cout << "NO" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3080
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.Scanner;
public class Main {
	static PrintWriter out = new PrintWriter(System.out);
	static Scanner stdIn = new Scanner(System.in);
	static FastScanner sc = new FastScanner();

	
	public static void main(String[] args) {
		while(sc.hasNext()) {
			int p = sc.nextInt();
			int q = sc.nextInt();
			ArrayList<Integer> list = new ArrayList<Integer>();
			list.add(p);
			while(true) {
				p *= 10;
				out.print(p / q);
				p %= q;
				if(p == 0 || list.contains(p)) {
					break;
				}
				list.add(p);
			}
			out.println();
			if(p != 0&& list.contains(p)) {
				char a = ' ';
				for(int i = 0; i < list.size(); i++) {
					if(list.get(i) == p) a = '^';
					out.print(a);
				}
				out.println();
			}
		} 
		out.flush();
		
		
	}

}

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 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();
        }
    }
     
    public int nextInt() {
        return (int)nextLong();
    }
     
    public double nextDouble() {
        return Double.parseDouble(next());
    }
     
 
}

Measured memory_bytes: 19384
#include <cstdio>

typedef long long ll;

const int INF=0x3fffffff;

ll n;

int min(int a, int b)
{
    return a < b ? a : b;
}

// 欧拉函数的板子，返回 phi(x)
int get_phi(int x)
{
    int res = x;
    for (int i = 2; i <= x / i; i ++ )
        if (x % i == 0)
        {
            res -= res / i;
            while (x % i == 0) x /= i;
        }
    if (x > 1) res -= res / x;
    return res;
}

// 快速幂板子，求 10 的 k 次方模 mod 的结果
int qmi(int k, int mod)
{
    int res = 1, a = 10;
    while (k)
    {
        // mod 即 c，最大是 n * 9 = 9e6，乘法就可能会爆 int，要转 long long 
        if (k & 1) res = res * 1ll * a % mod;
        a = a * 1ll * a % mod;
        k >>= 1;
    }
    return res;
}

int main()
{
    scanf("%d", &n);
    // 让 n 变成 c
    if (n % 7 == 0) n /= 7; // 由于 7 是质数，所以这里不用再求一遍最大公约数，直接判断是否有因子 7 即可
    n *= 9;
    // phi 存 phi(c) 的值。res 记录答案，初始化为正无穷
    int phi = get_phi(n), res = INF;
    for (int i = 1; i <= phi / i; i ++ )
        if (phi % i == 0) // 如果 i 是 phi 的因子，那么分别判断 i 和 phi / i 是否是合法解，如果是，则更新答案
            if (qmi(i, n) == 1) res = min(res, i); // 由于 i <= phi / i，所以如果 i 是合法解，就不用再判断 phi / i 了
            else if (qmi(phi / i, n) == 1) res = min(res, phi / i);
    printf("%d\n", res == INF ? -1 : res); // 如果 res == INF，说明无解，输出 -1，否则输出 res
    return 0;
}

Measured memory_bytes: 1704
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

use std::io::*;
use std::str::FromStr;

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn readu() -> usize {
    read::<usize>()
}

fn readi() -> i32 {
    read::<i32>()
}

fn main() {
    input! {
        n: usize,
        m: usize,
        a: [usize; n],
        bc: [(usize, usize); m],
    }
    let mut v: Vec<(usize, usize)> = bc.into_iter().collect();
    v.sort_by_key(|&a| -(a.1 as i32));
    let mut cards: Vec<usize> = a.into_iter().collect();

    'outer: for &(bi, ci) in &v {
        for _ in 0..bi {
            cards.push(ci);
            if cards.len() > 3 * n {
                break 'outer;
            }
        }
    }

    cards.sort_by_key(|&a| -(a as i32));
    println!("{}", cards.iter().take(n).fold(0, |sum, &a| sum + a));
}

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

int ans[8] = {1,2,4,8,16,32,64,128};

int main(){

    int n;

    cin >> n;

    for(int i=0;i<8;i++){
        if(ans[i] > n){
            cout << ans[i-1] << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string s;
    while (true){
        cin >>s;
        if (s=="0"){
            break;
        } 
        int sum =0;
        for (int i=0;i<s.size(); i++) {
            int n=s[i]-48;
            
            sum +=n;
        }
    
        cout << sum << endl;
    }
    
}



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

const int MAX_N = 110;
int graph[MAX_N][MAX_N];
const int MAX_M = 1010;
int a[MAX_M], b[MAX_M], c[MAX_M];
int N, M;
typedef pair<int, int> P;
int d[MAX_N][MAX_N];
const int INF = 1e9 + 7;

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    REP(i, 0, N) d[s][i] = INF;
    que.push(P(0, s));
    d[s][s] = 0;

    while(!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if(d[s][v] < p.first) continue;
        REP(to, 0, N) 
            if(d[s][to] > d[s][v] + graph[v][to]) {
                d[s][to] = d[s][v] + graph[v][to];
                que.push(P(d[s][to], to));
            }
    }
}

int main()
{
    scanf("%d %d", &N, &M);

    REP(i, 0, N) REP(j, 0, N) {
        if(i == j) graph[i][j] = 0; else graph[i][j] = INF;
    }

    REP(i, 0, M) {
        scanf("%d %d %d",&a[i], &b[i], &c[i]);
        --a[i], --b[i];
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = c[i];
    }

    //最短距離をd[MAX_N][MAX_N]に保存する。
    REP(i, 0, N) dijkstra(i);

    int ans = M;
    REP(i, 0, M) {
        bool shortest = false;
        REP(j, 0, N) if(d[j][a[i]] + c[i] == d[j][b[i]]) shortest = true;
        if(shortest) ans -= 1;
    }

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

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    if(n < 1000) puts("ABC");
    else puts("ABD");
    return 0;
}

Measured memory_bytes: 256
def paint():
    s = input()
    slist = s.split(' ')

    a = int(slist[0])
    b = int(slist[1])
    c = int(slist[2])
    count = 1
    if a != b:
        count += 1
    if a != c and b != c:
        count += 1

    print(count)

paint()

Measured memory_bytes: 9116
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;

using namespace std;
using Graph = vector<vector<int>>;
Graph G;
const int AMAX = 100000;
/*int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}

int n;
vll a;

ll solve(bool isp)
{
	ll sum = 0ll;
	ll ret = 0ll;

	for (int i = 0; i < n; i++)
	{
		sum += a[i];
		if (isp and sum <= 0)
		{
			ret += -sum + 1;
			sum = 1ll;
		}
		if (not isp and sum >= 0)
		{
			ret += sum + 1;
			sum = -1ll;
		}
		isp ^= 1;
	}
	return ret;
}

*/
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	
	/*ll N, K;
	cin >> N >> K;
	ll t1 = N%K;
	ll t2 = abs(t1 - K);

	ll ans = min(t1, t2);
	

	cout << ans << endl;*/
	string N;
	//vector<ll> S(AMAX + 1);
	cin >> N;
	sort(N.begin(), N.end());
	int S = N.size();
	bool ans = true;
	for (int i = 0; i < S-1; i++)
	{
		if (N[i] == N[i + 1])
		{
			ans = false;
		}
	}

	if (ans)cout << "yes" << endl;
	else cout << "no" << endl;

	

	
	
	/*bool ans = false;
	vector<int> data();
	for (int i = 0; i < S.length(); i++)
	{
		for (char c = 'a'; c <= 'z'; c++)
		{
			if (c == S.at(i))
			{

			}
		}
	}
	for(char c = 'a';c<='z';c++)*/
	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = 100100100;
const double PI = 3.14159265358979323846;
typedef long long ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) for (ll i = 0; i < (n); ++i)

int main() {
  ll counter = 0, maxCounter = 0;
  string s;
  cin >> s;
  REP(i, s.size()) {
    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
      ++counter;
    } else {
      maxCounter = max(maxCounter, counter);
      counter = 0;
    }
  }
  maxCounter = max(maxCounter, counter);
  cout << maxCounter << endl;
  return 0;
}

Measured memory_bytes: 256