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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }

int f[100005], ps[100005];
int n, q;
string s;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	read(n, q, s);
	rep(i, 0, n - 1)
		if (s.substr(i, 2) == "AC")
			f[i] = 1;
	rep(i, 0, n - 1)
		ps[i] = (i ? ps[i - 1] : 0) + f[i];
	rep(i, 0, q) {
		int l, r; read(l, r);
		l--; r--;
		if (l == r) write(0);
		else {
			write(ps[r - 1] - (l ? ps[l - 1] : 0));
		}
	}
}


Measured memory_bytes: 1872
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll ara[100005], b[100005];
int main()
{
    ll n;
    scanf("%lld", &n);
    for(int i=1; i<=n; i++)
    scanf("%lld %lld", &ara[i], &b[i]);
    ll res= 0;
    for(int i=n; i>=1; i--)
    if((res+ara[i])%b[i])
    res+= ((((res+ara[i])/b[i] + 1)*b[i])-(ara[i]+res));
    printf("%lld\n", res);
    return 0;
}


Measured memory_bytes: 1792
a=input()
ct=[0]*10
hantei=0
ct2=0
for i in a:
    if (hantei==1):
        if i in'ACGT':
            ct[ct2]+=1
        else:
            hantei=0
            ct2+=1
    else:
        if i in 'ACGT':
            ct[ct2]+=1
            hantei=1
print(max(ct)) 

Measured memory_bytes: 38384
#include<stdio.h>
#include<math.h>

int main(){
  int i,a[10000],n=0,sosuu=0,t,k=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }

  for(i=0;i<n;i++){
    for(t=2;t<=sqrt(a[i]);t++){
      if(a[i]%t == 0){sosuu--;break;}
    }
    sosuu++;
  }
  printf("%d\n",sosuu);
  return 0;
}

Measured memory_bytes: 632
# 3 つの整数 A , B , C が与えられます。 A , B , C のうち 2 つは 同じ整数であり、残りの 1 つだけ異なる整数です。
# 例えば、 A = 5 , B = 7 , C = 5 の場合、 A , C の 2 つは同じ整数であり、 B は 1 つだけ異なる整数です。
# 3 つの整数のうち、 1 つだけ異なる整数を求めてください。

A,B,C =map(int,input().split())

if A == B:
    print(C)

elif A == C:
    print(B)

elif B == C:
    print(A)

Measured memory_bytes: 9172
#include<bits/stdc++.h>
using namespace std;
int main(){
  string O,E;
  cin>>O;
  cin>>E;
  for(int i=0;i<O.size();i++){
    if(i==O.size()-1 && O.size()!=E.size()) cout<<O[i];
    else  cout<<O[i]<<E[i];
  }
  cout<<endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int y,a,b,d,e;
    cin>>y>>a>>b;
    d=abs(y-a);
    e=abs(y-b);
    if(d<e)
    {
        cout<<"A"<<endl;
    }
    else
    {
        cout<<"B"<<endl;
    }
    return 0;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1
#define j0 gray_cat_j0

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll LL_INF = 1e17 + 16;
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

ll v[MAXN];

void solve(){
	int n;
	scanf("%d", &n);
	ll sum = 0ll;
	REPN(i, 0, n) {
		scanf("%lld", &v[i]);
		sum += v[i];
	}
	ll cur = 1ll;
	ll ans = 0ll;
	REPN(i, 0, n) {
		ans += cur;
		cur -= v[i];
		sum -= v[i];
		if (cur < 0) {
			printf("-1\n");
			return;
		}
		cur = min(cur * 2, sum);
	}
	if (sum > 0) {
		ans = -1;
	}
	cout << ans << endl;
}

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

using namespace std;

#define ll long long
#define ull unsigned long long
#define f(a,b) for(ll i = a; i < b; i++)
#define fr(a,b) for(ll j = a; j >= b; j--)
#define fi(a,b) for(ll j = a; j < b; j++)
#define fii(a,b) for(ll k = a; k < b; k++)
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define pl pair<ll,ll>
#define vll vector<ll>
#define pll vector< pair<ll,ll> >
#define ld long double


void sieve(int n)
{

    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {

        if (prime[p] == true)
        {
              for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
}
ll modpow(ll a,ll b){
    ll rs=1;
    a%=mod;
    while(b>0){
        if(b&1)rs=(rs*a)%mod;

        b=b>>1;
        a=(a*a)%mod;
    }
    return rs;
}


int main()
{

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

int t=1;
//cin>>t;

while(t--){
 string s;
 cin>>s;
 int ck=0;
 if(s[0]==s[1])ck++;
 if(s[1]==s[2])ck++;
 if(s[2]==s[3])ck++;
 if(ck==0)cout<<"Good";
 else cout<<"Bad";

}

    return 0;
}


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

using ll = long long; 

int main() {
  int N, K;
  cin >> N >> K;
  
  vector <ll> H(N);
  for (int i=0; i<N; i++){
    cin >> H.at(i);
  }
  sort(H.begin(), H.end());
  
  ll ans = 0;
  if (N > K) {
    for (int i=0; i<N-K; ++i){
      ans += H.at(i);
    }
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;
long long w[100009],v[100009],dp[109][100009],n,k;
long long sol(long long x,long long y)
{
    if(dp[x][y]!=-1) return dp[x][y];
    if (x==n || y==k) return 0;
    if (y+w[x]<=k) dp[x][y]=max(sol(x+1,y+w[x])+v[x],sol(x+1,y));
    else dp[x][y]=sol(x+1,y);
    return dp[x][y];
}
int main()
{
    cin>>n>>k;
    memset(dp,-1,sizeof(dp));
    for (int i=0;i<n;i++)
    {
        cin>>w[i]>>v[i];
    }
    cout<<sol(0,0);
    return 0;
}


Measured memory_bytes: 86400
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}

using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  
  int n,k;
  cin>>n>>k;
  if(n*(n-1)/2-k<n-1){
    cout<<-1<<endl;
    return 0;
  }
  int m = n-1+(n-1)*(n-2)/2-k;
  int rest = (n-1)*(n-2)/2-k;
  cout<<m<<endl;
  REPP(i,n-1){
    cout<<1<<' '<<i+1<<endl;
  }
  
  int cnt = 0;
  bool flag = true;
  REPP(j,n-1){
    REPP(i,j-1){
      if(cnt==rest){
        flag = false;
        break;
      }
      cout<<i+1<<' '<<j+1<<endl;
      cnt++;
    }
    if(!flag)break;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  string s; cin >> s;
  int l = 0, r = s.size() - 1;
  while (l < s.size() and s[l] != 'C') l++;
  while (r >= 0 and s[r] != 'F')  r--;
  cout << (l < r ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
    long long x;
    mint(long long x=0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) cin >> a[i];
    
    vll p(n, 0), q(n, 0);

    // pはブロック内
    rep(i, n) {
        for (int j = i+1; j < n; ++j) {
            if (a[i] > a[j]) p[i]++;
        }
    }
    // qはブロック外
    rep(i, n) {
        rep(j, n) {
            if (a[i] > a[j]) q[i]++;
        }
    }

    mint ans;
    rep(i, n) {
        mint now = q[i];
        now *= k;
        now *= k-1;
        now /= 2;
        now += p[i] * k;
        ans += now;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
long long gcd(long long a,long long b){
	while(a){b%=a;swap(a,b);}return b;
}
long long p[510];
int n;
int K;
long long tmp[510];
long long L[510];
long long R[510];
bool chk(long long a){
	for(int i=0;i<n;i++){
		tmp[i]=p[i]%a;
	}
	std::sort(tmp,tmp+n);
	long long ret=0;
	for(int i=0;i<n;i++){
		L[i+1]=L[i]+tmp[i];
		R[i+1]=R[i]+(a-tmp[n-1-i]);
	}
	for(int i=0;i<=n;i++){
		if(L[i]==R[n-i]){
			ret=L[i];break;
		}
	}
	if(ret<=K)return true;
	return false;
}
int main(){
	int a,b;scanf("%d%d",&a,&b);n=a;
	K=b;
	for(int i=0;i<a;i++)scanf("%lld",p+i);
	long long sum=0;
	for(int i=0;i<a;i++)sum+=p[i];
	long long ret=0;
	for(int i=1;i*i<=sum;i++){
		if(sum%i==0){
			if(i>ret&&chk(i))ret=i;
			if(sum/i>ret&&chk(sum/i))ret=sum/i;
		}
	}
	printf("%lld\n",ret);
}


Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#define INF 0x3f3f3f3f;

using namespace std;

string s[200005];

bool cmp(string a,string b) {
        return a.compare(b)<0;
}

int main() {
    int n,i;
    scanf("%d",&n);
    for(i=0; i<n; i++)
        cin>>s[i];
    sort(s,s+n,cmp);
    int m=1,cnt=1;
    for(i=1; i<n; i++) {
        if(s[i].compare(s[i-1])==0)
            cnt++;
        else
            cnt=1;
        m=max(cnt,m);
    }
    cnt=1;
    if(m==1)
        cout<<s[0]<<endl;
    for(i=1; i<n; i++) {
        if(s[i].compare(s[i-1])==0)
            cnt++;
        else
            cnt=1;
        if(cnt==m)
            cout<<s[i]<<endl;
    }
}

Measured memory_bytes: 14208
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define Get(x,y) scanf("%I64d%I64d",&x,&y);
#define get(x) scanf("%I64d",&x);
#define Gett(x,y) scanf("%d%d",&x,&y);
#define gett(x) scanf("%d",&x);																																														
#define f(i,a,b) for(int i=a;i<b;i++)
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define print(v,r) f(i,0,r) cout<<v[i]<<" "; cout<<endl;
#define ll long long
#define pb push_back
#define maxm(a,b) a=max(a,b);
#define minm(a,b) a=min(a,b);
#define S second
#define F first
#define mp make_pair
const int N=3e5+20;
ll n,ans,mark[N],a[N],d=2,m;
int main(){
	cin>>n;
	f(i,0,n){
		cin>>a[i];
		mark[a[i]]++;
	}
	f(i,0,n+3)
		ans+=((mark[i]*mark[i])-mark[i])/2;
	f(i,0,n){
		m=ans-mark[a[i]]+1ll;
		cout<<m<<endl;
	}
}

Measured memory_bytes: 6144
//https://www.codechef.com/viewsolution/16639107
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
const int Maxn = 1000005;
 
int t;
int n, a, b;
int seq[Maxn], slen;
 
int main()
{
	//scanf("%d", &t);
	{
		scanf("%d %d %d", &n, &a, &b);
		if (a + b - 1 > n || ll(a) * b < n) printf("-1\n");
		else {
			slen = 0;
			int cur = 1;
			int lft = n - a;
			for (int i = 1; i <= a; i++) {
				int tk = min(lft, b - 1); lft -= tk;
				tk++;
				cur += tk;
				for (int j = cur - 1; j >= cur - tk; j--)
					seq[slen++] = j;
			}
			for (int i = 0; i < slen; i++)
				printf("%d%c", seq[i], i + 1 < slen? ' ': '\n');
		}
	}
	return 0;
}
 


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

int main(){
    int n;
    cin >> n;
    double a[n];
    double ave = 0;
    rep(i,n) {
        cin >> a[i];
        ave += a[i];
    }
    ave /= (double)n;
    int ans = n;
    double d = 1e9;
    for(int i = n-1; i >= 0; i--){
        if(abs(ave-a[i]) <= d){
            ans = i;
            d = abs(ave-a[i]);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//
// Created by Takaaki Hirano on 2018/09/01.
//
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>

using namespace std;
typedef long long ll;
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)


int N, K;

void solve() {
    unordered_map<ll, ll> mp;
    rep(i, N) mp[(i + 1) % K]++;
    ll ans = 0;
    each(a, mp) {
        ll b = (K - a.first) % K;
        ll c = (K - a.first) % K;
        if ((b + c) % K == 0) ans += a.second * mp[b] * mp[c];
    }

    cout << ans << endl;
}

int main() {
    cin >> N >> K;
    solve();
    return 0;
}

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

const int MOD = (int)1e9+7;

int main(){
  long long A,B,C,K;
  cin >> A >> B >> C >> K;

  if(K%2==0){
    if(abs(A-B)<(1e18))  cout << A-B << endl;
    else  cout << "Unfair" << endl;
  }
  else{
    if(abs(B-A)<(1e18))  cout << B-A << endl;
    else  cout << "Unfair" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
n=int(input())
A=list(map(lambda x: int(x)-1,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

ans = 0
last = A[0]
ans += B[last]
#print(ans)
for a in A[1:]:
  if last + 1 == a:
    ans += C[last]
  ans += B[a]
  last = a
  #print(ans,a,B[a],C[a])
print(ans)

Measured memory_bytes: 9168
// Your code here!
use std::io::*;
use std::str::FromStr;

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 read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main(){
    use std::collections::HashMap;
    use std::collections::hash_map::Entry::{Occupied, Vacant};
    
    let mut map: HashMap<String, usize> = HashMap::new();
    let n: usize = read();
    
    for _ in 0..n{
        let s : String = read();

        match map.entry(s) {
            Occupied(mut e) => {
                let value = e.get_mut();
                *value = 1;
            }
            Vacant(e) => { e.insert(1); }
        }
        
    }
    
    println!("{}",map.len())
    
}




Measured memory_bytes: 18072
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;

int main(){
  int n,k;
  cin>>n>>k;
  ll ans=k;
  for(int i=0;i<n-1;i++)ans*=k-1;
  cout<<ans<<endl;
}

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

#define forn(i,n) for(ll i = 0;i<n;i++)
#define forne(i,j,n) for(ll i = j;i<n;i++)
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ll INF = 1000000001;
const ll N = 100001;
const lld PI = 3.141593;
#define F first
#define pb(a) push_back(a)
#define S second
#define pii pair<int,int>
typedef pair<ll,ll> pll;

lld powm(ll base,ll exp) {
	ll ans=1;
	while(exp){
		if(exp&1) ans=(ans*base)%mod;
		exp>>=1,base=(base*base)%mod;
	}
	return ans;
}

// ll dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
// bool valid(ll i, ll j) {
// 	return i >= 1 && i <= n && j >= 1 && j <= m; 
// }
// int maxdepth = INT_MAX;
// vector<int> edgeVector[100000];
// ll minans = 1;
// printf("1 %d D\n",abs(r));
// priority_queue<ll,vector<ll>,greater<ll>> pq;
// ll a[N],b[N];
// vector<vector<ll>> adj(N);
// vector<set<ll>> adjs(N);
// ll adj[1001][1001];
// vector<vector<ll>> ans(1001);
// bool visited[N];
// ll cnt[1001];
// ll h,c,t;
// vector<pair<int, pair<int, int> > > g[300043];


int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output1.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

ll n,q;
cin>>n;
map<ll,ll> m;
ll s = 0;
forn(i,n){
	ll x;
	cin>>x;
	m[x]++;
	s+=x;
}
cin>>q;
forn(i,q){
	ll a,b;
	cin>>a>>b;
	m[b]+=m[a];
	s-=(a*m[a]);
	s+=(m[a]*b);
	m[a] = 0;
	cout<<s<<endl;
}


}

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

vector<char> a,b,c;
string s;

int main() {
	cin>>s;
	long l=s.length();
	for(long i=0;i<l;++i)
		b.push_back(s[i]);
	
	bool positive=1;
	long q,t,f;
	char ch;
	cin>>q;
	for(long i=0;i<q;++i) {
		cin>>t;
		if(t==1) positive=!positive;
		else {
			cin>>f>>ch;
			while(ch<'a' || ch>'z')
				ch=getchar();
			
			if(f==1 && positive==1)
				a.push_back(ch);
			else if(f==1 && positive==0)
				c.push_back(ch);
			else if(f==2 && positive==1)
				c.push_back(ch);
			else
				a.push_back(ch);
		}
	}
	
	vector<char>::iterator it;
	if(positive) {
		for(it=a.end()-1;it!=a.begin()-1;it--)
			printf("%c",*it);
		for(it=b.begin();it!=b.end();it++)
			printf("%c",*it);
		for(it=c.begin();it!=c.end();it++)
			printf("%c",*it);
	}
	else {
		for(it=c.end()-1;it!=c.begin()-1;it--)
			printf("%c",*it);
		for(it=b.end()-1;it!=b.begin()-1;it--)
			printf("%c",*it);
		for(it=a.begin();it!=a.end();it++)
			printf("%c",*it);
	}
	return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n, k; cin >> n >> k;
    if (k > (n-1)*(n-2)/2) {
        cout << -1 << endl;
    } else {
        vector<vector<int>> g(n, vector<int>(n,1));
        int cnt = 0;
        int e = n*(n-1)/2;
        rep(i,n-1) repf(j,i+1,n-1) {
            if (cnt == k) break;
            cnt++;
            e--;
            g[i][j] = 0;
            g[j][i] = 0;
        }
        cout << e << endl;
        rep(i,n) repf(j,i+1,n) {
            if (g[i][j]) cout << i+1 << " " << j+1 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
int d[][3] = {
	{0,1,2},{0,4,8},
	{0,3,6},{1,4,7},
	{2,5,8},{2,4,6},
	{3,4,5},{6,7,8}
};
char check(string str) {
	char ret = 'd';
	for(int i = 0; i < 8; i++) {
		int n1 = d[i][0],n2 = d[i][1], n3 = d[i][2];
		if(str[n1] == str[n2] && str[n2] == str[n3]) {
			if(str[n1] == 's') continue;
			ret = str[n1];
		}
	}
	return ret;
}
int main() {
	string str;
	while(cin >> str) {
		cout << check(str) << endl;
	}
	return 0;
}

Measured memory_bytes: 1176
/*input
3 4
#...
#.#.
..#.
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;

int h, w;
vector<string> grid;
int best = 0;

void bfs(int i1, int i2, int j1, int j2)
{
	vector<vector<bool>> visited(h, vector<bool> (w, 0));
	vector<vector<int>> path(h, vector<int> (w, INT_MAX));
	path[i1][j1] = 0;
	queue<pii> q;
	q.push(make_pair(i1, j1));
	while(!q.empty())
	{
		int i = q.front().first;
		int j = q.front().second;
		q.pop();
		if(visited[i][j]) continue;
		visited[i][j] = 1;
		if(grid[i][j] == '#') continue;
		if(i - 1 > -1)
		{
			path[i][j] = min(path[i][j], path[i - 1][j]);
			q.push(make_pair(i - 1, j));
		}
		if(i + 1 < h)
		{
			path[i][j] = min(path[i][j], path[i + 1][j]);
			q.push(make_pair(i + 1, j));
		}
		if(j - 1 > -1)
		{
			path[i][j] = min(path[i][j], path[i][j - 1]);
			q.push(make_pair(i, j - 1));
		}
		if(j + 1 < w)
		{
			path[i][j] = min(path[i][j], path[i][j + 1]);
			q.push(make_pair(i, j + 1));
		}
		if(i != i1 || j != j1) path[i][j]++;
		if(i == i2 && j == j2)
		{
			best = max(best, path[i2][j2]);
			break;
		}
	}
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> h >> w;
    grid.resize(h);
    for(int i = 0; i < h; i++) cin >> grid[i];
    for(int i1 = 0; i1 < h; i1++) for(int j1 = 0; j1 < w; j1++) for(int i2 = 0; i2 < h; i2++) for(int j2 = 0; j2 < w; j2++)
    	bfs(i1, i2, j1, j2);
    cout << best;

    return 0;
}

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

typedef long long i64;

int main()
{
	int n;
	vector<i64> as;

	scanf("%d", &n);
	as.resize(n);
	for(int i = 0; i < n; i++) {
		scanf("%lld", &as[i]);
	}

	i64 sum = 0;
	for(auto& a : as) {
		sum = sum ^ a;
	}

	for(auto& a : as) {
		a = a & (~sum);
	}

	i64 maxi = 0;

	for(int b = 62; b >= 0; b--) {

		i64 v = -1;

		for(int i = 0; i < n; i++) {
			if((as[i] & (1LL << b)) != 0) {
				v = as[i];
				break;
			}
		}

		if(v == -1) {
			continue;
		}

		for(int i = 0; i < n; i++) {
			if((as[i] & (1LL << b)) != 0) {
				as[i] = as[i] ^ v;
			}
		}

		maxi = max(maxi ^ v, maxi);
	}

	i64 ans = maxi * 2 + sum;
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 1024
n=int(input())
l=list(map(int,input().split()))
c=0
cmax=0
now=l[0]
for i in range(1,n):
  if now>=l[i]:
    c+=1
    now=l[i]
  else:
    if c>cmax:
      cmax=c
    c=0
    now=l[i]
if c>cmax:
  cmax=c
print(cmax)


Measured memory_bytes: 14252
n, m = map(int, input().split())
a = [];b = []
for _ in range(n):
    a.append(list(map(int, input().split())))

for _ in range(m):
    b.append(int(input()))

def seki(x, y):
    return x*y

for i in range(n):
    print(sum(list(map(seki, a[i], b))))


Measured memory_bytes: 6028
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 1000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int N, A, B; cin >> N >> A >> B;
  cout << min(A*N, B) << endl;
}

Measured memory_bytes: 764
#include"stdio.h"

int main(void)
{
  int X,N;
  int i,n=0,ans;
  unsigned int p[101];
  unsigned int check[102] = {0};
  
  //input
  scanf("%d %d",&X,&N);
  for(i=0;i<N;i++)
  {
  	scanf("%d",&p[i]);
    check[p[i]] = p[i];
  }
  //check
	while(1)
    {
    	if(check[X-n]==0){
          ans =X-n;
        	break;
        }else if(check[X+n]==0){
          ans =X+n;
          break;
        }
      n++;
    }
  //output
  printf("%d",ans);

  
  return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,LL> PL;

const int MOD=1000000007;
int INF=100100100;
int main(){
  string s,t;
  cin>>s>>t;
  int ans=0;
  for(int i=0;i<3;i++){
    if(s[i]==t[i])ans++;
  }
  cout<<ans<<endl;
  
  return 0;
}

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

int main() {
	int temp; vector<int> vec(0);
	while (cin >> temp) {
		if (temp == 0) {
			cout << vec[vec.size() - 1] << endl;
			vec.pop_back();
		}
		else vec.push_back(temp);
	}
	return 0;
}


Measured memory_bytes: 2996
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#include <algorithm>
#include <iostream>
 
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define X first
#define Y second
#define pb(x) push_back(x)
#define FOR(k, n) for (int k = 0; k < n; k++)
#define FORN(k, s, n) for (int k = s; k < n; k++)
#define debug(x) printf("x = %d\n", x);
#define debug2(x, y) printf("x = %d, y = %d\n", x, y);
#define debug3(x, y, z) printf("x = %d, y = %d, z = %d\n", x, y, z);
#define debug4(x, y, z, t) printf("x = %d, y = %d, z = %d, t = %d\n", x, y, z, t);
 
#pragma warning(disable : 6031)
#pragma warning(disable : 4101)
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef complex<double> cd;
 
const int INF = 1e9;
const long long LINF = 1e18;
const double PI = acos(-1);
 
// Solution

const int MAXN = 100005;

ll tot, A[205];
int n;
char s[205];
char W[] = {'M', 'A', 'R', 'C', 'H'};
vector<char> S;

void generate_set(int cur) {
    if (sz(S) == 3) {
        tot += A[S[0]] * A[S[1]] * A[S[2]];
        return;
    }

    if (cur == 5) {
        return;
    }

    for (int i = cur; i < 5; i++) {
        S.push_back(W[i]);
        generate_set(i + 1);
        S.pop_back();
    }
}

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

    for (int i = 0; i < n; i++) {
        scanf("%s", s);
        A[s[0]]++;
    }

    generate_set(0);

    printf("%lld\n", tot);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
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;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b;
	cin>>a>>b;
	cout<<max({a+a-1, a+b, b+b-1})<<endl;
	return 0;
}

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

int main() {
  int N,K;
  cin >> N >> K;
  
  if ((N-1)%(K-1)==0) {
    cout << (N-1)/(K-1) << endl;
  }
  else {
    cout << (N-1)/(K-1)+1 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N, K;
  cin >> N >> K;
  ll ans = 0;
  //k == あまり
  for (ll k = K; k <= N - 1; ++k) {
    // ans += N - k;
    ll cnt = 0;
    while (true) {
      if (k + (k + 1) * cnt > N) {
        break;
      }
      ll l = max(1ll, k), r = N + 1;
      while (l + 1 != r) {
        ll m = (l + r) / 2;
        if (k + m * cnt <= N) {
          l = m;
        }
        else {
          r = m;
        }
      }
      ans += l - k;
      // i == b
      // for (ll i = k + 1; i <= N; ++i) {
      //   if (k + i * cnt == 0) {
      //     continue;
      //   }
      //   if (k + i * cnt <= N) {
      //     // cout << "あまり " << k << ' ' << "a:" << k + i * cnt << " b:" << i << endl;
      //     ans += 1;
      //   }
      //   else {
      //     break;
      //   }
      // }
      cnt += 1;
    }
  }
  if (K == 0) {
    ans -= N;
  }
  cout << ans << endl;
}


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


int main(){

    string S;
    cin >> S;

    if(S[0]==S[1] or S[1]==S[2] or S[2]==S[3] or S[3]==S[4]){
        cout << "Bad" << endl;
    }else{
        cout << "Good" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 1001
using namespace std;
int n,p1,p2;
typedef pair<int,int> P;
vector<P> G[N],rG[N];
vector<P> A;
 
int used[N],god,devil;
vector<int> Idx[N];
int Sta[N];
 
void dfs(int pos, int sta){
  Idx[A.size()].push_back(pos);
  Sta[pos] = sta;
 
  for(P nx:G[pos]){
    int npos = nx.first;
    int nsta = sta ^ (!nx.second);
    if(used[npos]) assert(Sta[npos] == nsta);
    if(used[npos]++) continue;
    god += nsta;
    devil += !nsta;
    dfs(npos,nsta);
  }
   
  for(P nx:rG[pos]){
    int npos = nx.first;
    int nsta = sta ^ (!nx.second);
    if(used[npos]) assert(Sta[npos] == nsta);
    if(used[npos]++) continue;
    god += nsta;
    devil += !nsta;
    dfs(npos,nsta);
  }
}
 
 
void Push(vector<int> &res,int sta,int i){
  for(int p:Idx[i])if(sta == Sta[p]) res.push_back(p+1);
}
 
int dp[N][N];
vector<int> DP(){
  memset(dp,0,sizeof(dp));  
  dp[0][0] = 1;
  int n = A.size();
  for(int i=0;i<n;i++){
    int a = A[i].first;
    int b = A[i].second;
    for(int j=0;j<=p1;j++){
      dp[i+1][j+a] += dp[i][j];
      dp[i+1][j+b] += dp[i][j];
      dp[i+1][j+a] = min(2,dp[i+1][j+a]);
      dp[i+1][j+b] = min(2,dp[i+1][j+b]);
 
    }
  }
 
  if(dp[n][p1] != 1) return vector<int>(); 
  vector<int> res;
  int god = p1;
    for(int i=n-1;i>=0;i--){
      int a = A[i].first;
      int b = A[i].second;
      if(god-a>=0 && dp[i][god-a] == 1) Push(res,1,i),god -= a;
      else if(god-b>=0 && dp[i][god-b] == 1)Push(res,0,i),god -= b;
      else exit(1);
    }
    assert(god == 0);
    sort(res.begin(),res.end());
    return res;
}
 
int main(){
  while(1){
  cin>>n>>p1>>p2;
  if(!n&&!p1&&!p2)return 0;
 
  A.clear();
  memset(used,0,sizeof(used));
  memset(Sta,-1,sizeof(Sta));
  for(int i=0;i<N;i++) Idx[i].clear(),G[i].clear(),rG[i].clear();
   
  for(int i=0,x,y;i<n;i++){
    string str;
    cin>>x>>y>>str;
    x--,y--;
    G[x].push_back(P(y,str=="yes"));
    rG[y].push_back(P(x,str=="yes"));
  }
 
  for(int i=0;i<p1+p2;i++){
    if(used[i]++)continue;
    god = 1,devil = 0;
    dfs(i,1);
    A.push_back(P(god,devil));
  } 
 
  vector<int> ans = DP();
  if(p1&&ans.empty()) cout<<"no"<<endl;
  else {
    for(int p:ans)cout<<p<<endl;
    cout<<"end"<<endl;
  }
  }
  return 0;
}

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

typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) { s >> x; } return s;}
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int N, K; cin >>N>>K;
    vector<int> h(N); cin >> h;
    vector<int> cost(N);    

    cost[0] = 0;
    for (int i = 1; i < N; i++) {
        int c = INT_MAX;
        for (int j = max(0, i - 1); j >= max(0, i - K); j--) {
            chmin(c, cost[j] + abs(h[j]-h[i]));
        }
        cost[i] = c;
    }

    cout << cost.back() << endl;
}


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

int main(){
  int n;
  string s;
  cin >> n >> s;
  int ret=0;
  for(int i=0; i<10; i++)for(int j=0; j<10; j++)for(int k=0; k<10; k++){
    int l=0;
    bool f1=false, f2=false, f3=false;
    for(; l<n; l++){
      if(s[l]-'0'==i){
        f1=true;
        l++;
        break;
      }
    }
    for(; l<n; l++){
      if(s[l]-'0'==j){
        f2=true;
        l++;
        break;
      }
    }
    for(; l<n; l++){
      if(s[l]-'0'==k){
        f3=true;
        l++;
        break;
      }
    }
    if(f1&&f2&&f3){
      //cerr << i << j << k << endl;
      ret++;
    }
  }
  cout << ret;
  return 0;
}

Measured memory_bytes: 888
#include<stdio.h>

int main (void)
{
    int A,B,k;
    char c;

    scanf("%d",&k);
    scanf("%c",&c);
    scanf("%d %d",&A,&B);

    if(A/k==B/k){

        if(A%k==0||B%k==0){
            printf("OK");
        }else {
            printf("NG");
        }
    }else{
        printf("OK");
    }


    return 0;
}

Measured memory_bytes: 1712
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int r = sc.nextInt();
        int c = sc.nextInt();
        
        int[][] su = new int[r+1][c+1];
        
        for (int i = 0; i < r; i++) {
            for (int j = 0; j < c; j++) {
                su[i][j] = sc.nextInt();
            }
        }
        
        for (int i = 0; i < r; i++) {
            int tmp = 0;
            
            for (int j = 0; j < c + 1; j++) {
                if (j != c) {
                    tmp += su[i][j];        
                }
                else {
                    su[i][j] = tmp;
                }
            }
        }
        
        for (int i = 0; i < c + 1; i++) {
            int tmp = 0;
            
            for (int j = 0; j < r + 1; j++) {
                if (j != r) {
                    tmp += su[j][i];
                }
                else {
                    su[j][i] = tmp;
                }
            }
        }
        
        for (int i = 0; i < r + 1; i++) {
            for (int j = 0; j < c + 1; j++) {
                if (j != c) {
                    System.out.printf("%d ", su[i][j]);
                }
                else {
                    System.out.printf("%d\n", su[i][j]);
                }
            }
        }
    }
}


Measured memory_bytes: 64972
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){

	int d,sum;
	while(scanf("%d",&d)!=EOF){
		sum = 0;
		for(int i=d;i<=600;i+=d){
			sum += d*(i-d)*(i-d);
		}
		printf("%d\n",sum);
	}

    return 0;
}


Measured memory_bytes: 3156
import math
import itertools
N = int(input())
list = []
for i in range(N):
    a = input().split()
    x = int(a[0])
    y = int(a[1])
    list.append([x, y])
length = 0
count = 0
for v in itertools.permutations(list, len(list)):
    for i in range(len(list)-1):
        tmp = ((v[i][0]-v[i+1][0])*(v[i][0]-v[i+1][0]) + (v[i][1]-v[i+1][1])*(v[i][1]-v[i+1][1]))
        length += math.sqrt(tmp)
    count += 1
print(length/count)

Measured memory_bytes: 3064
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    if i!=0:
        if a[i]>a[i-1]:
            a[i]-=1
    else:
        a[i]-=1
for i in range(n):
    if i!=n-1:
        if a[i]>a[i+1]:
            print('No')
            exit()
print('Yes')

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

int N;
int A[210];
int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];

    int res = 0;
    while (true) {
        bool exist_odd = false;  
        for (int i = 0; i < N; ++i) {
            if (A[i] % 2 != 0) exist_odd = true;  
        }

        if (exist_odd) break;  

        
        for (int i = 0; i < N; ++i) {
            A[i] /= 2;
        }
        ++res;  
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long unsigned int ll;
 
int main() {
	
  
  ll a,b,c,d,i,j,k;
  cin >> a;
  cin >> b;
  
  cout << int(b*pow(b-1,a-1)) <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int x,y;
    cin>>x>>y;
    if(x%y==0){cout<<-1<<endl; return 0;}
    int cnt=0;
    while(1){
        cnt+=x;
        if(cnt%y!=0){
            break;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
from datetime import datetime as dt

def main():
  r = int(readline())
  if r<1200:
    print('ABC')
  elif 1200<=r and r<2800:
    print('ARC')
  else:
    print('AGC')
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 5344
using System;

namespace ABC168A
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Console.ReadLine();
            var ans = "";

            switch (N[N.Length - 1])
            {
                case '2':
                case '4':
                case '5':
                case '7':
                case '9':
                    ans = "hon";
                    break;
                case '0':
                case '1':
                case '6':
                case '8':
                    ans = "pon";
                    break;
                case '3':
                        ans = "bon";
                    break;
                default:
                    break;
            }

            Console.WriteLine(ans);
        }
    }
}


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

int N, A;
int X[55];
long long memo[55][55][3000];

long long f(int i, int n, int sum) {
    if (memo[i][n][sum] != -1) {
        return memo[i][n][sum];
    }
    if (i == N) {
        if (n == 0) return 0;
        memo[i][n][sum] = (sum == A * n ? 1 : 0);
        return memo[i][n][sum];
    }
    
    return memo[i][n][sum] = f(i + 1, n + 1, sum + X[i]) + f(i + 1, n, sum);
}

int main() {
    for (int i = 0; i < 55; i++)
        for (int j = 0; j < 55; j++)
            for (int k = 0; k < 3000; k++) 
                memo[i][j][k] = -1;
    scanf("%d %d", &N, &A);

    for (int i = 0; i < N; i++) scanf("%d", &X[i]);

    printf("%lld\n", f(0, 0, 0));
}

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

LL pow(LL a, LL b) {
  int n = 1;
  for (int i = 0; i < b; i++) {
    n = a * n;
  }
  return n;
}

LL ctoi(char c) {
  if (c == '1') return 1;
  if (c == '2') return 2;
  if (c == '3') return 3;
  if (c == '4') return 4;
  if (c == '5') return 5;
  if (c == '6') return 6;
  if (c == '7') return 7;
  if (c == '8') return 8;
  if (c == '9') return 9;
  if (c == '0') return 0;
}
  

int main() {
  string str; 
  cin >> str;
  LL S = str.size();
  
  LL n[S];
  for (LL i = 0; i < S; i++) {
    n[i] = ctoi(str.at(S-1-i));
  }
  
  LL bits;
  LL ans = 0;
  LL sum[2000];
  LL power[S - 1];
  
  for (bits = 0; bits < (1 << S-1); bits++) {
    for (LL i = 0; i < S-1; i++) {
      if (!((bits >> i) & 1)) {power[i] = 0;}
      if ((bits >> i) & 1) {
        LL p = 1;
        while ((bits >> i-p) & 1) {p++;}
        power[i] = p;
      }
    }
    
    sum[bits] = n[0];
    for (LL i = 0; i < S-1; i++) {
      sum[bits] = sum[bits] + pow(10, power[i]) * n[i + 1];
    }
    
    
    ans = ans + sum[bits];
  }
  
  cout << ans << endl;
}

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

int main() {
  string S;
  cin >> S;

  int ans = 0, cnt = 0;

  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) == 'A' || S.at(i) == 'C' ||S.at(i) == 'G' ||S.at(i) == 'T') {
    cnt++;
    ans = max(ans, cnt);
    }
    else cnt = 0;
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
program sample
    implicit none
   
    integer(16) :: a,b,c
    
  
    read(*,*)a,b,c
    if(b==0)then
        write(*,*)1
    elseif(a==0)then
        write(*,*)b/c+1
    else
        write(*,*)b/c-(a-1)/c
    end if
    stop
end program sample
  



Measured memory_bytes: 2760