akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define   ipr         	pair<int, int>
#define   pb            push_back
#define   ff            first
#define   ss            second
#define   fr(i, j, k)   for (int i = j; i < k; i++)
#define   rf(i, j, k)   for (int i = j; i >= k;i--)
#define   int           long long
#define   ll 			unsigned long long
#define   ld            long double
#define   all(x)        x.begin(), x.end()
#define   rall(x)       x.rbegin(),x.rend()
#define   mp            make_pair
#define   inf           INT_MAX
#define   read_file();	freopen("input.txt", "r", stdin);	freopen("output.txt", "w", stdout);
#define   IOS           std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const int Maxn  =  10000;
const ld  pi   =  acos(-1);
const int mod =  1000000007;
 
 
template<class T> ostream& operator <<(ostream &out,vector<T> &A){for(auto x:A) out<<x;return out;}
template<class T> ostream& operator <<(ostream &out,set<T> &A){for(auto x:A) out<<x<<" ";return out;}
template <class T1,class T2>T1 powr(T1 a,T2 b){T1 res = 1;fr(i,1,b+1)res = res*a;return res;}
int roundUp(int numToRound, int multiple)
{
 if(multiple == 0)
 {
  return numToRound;
 }

 int roundDown = ( (int) (numToRound) / multiple) * multiple;
 int roundUp = roundDown + multiple; 
 int roundCalc = roundUp;
 return (roundCalc);
}
 

 
int32_t main(){IOS
string s;
cin>>s;
if(s[2]==s[3] && s[4]==s[5])cout<<"Yes"<<endl;
else cout<<"No"<<endl;

}

Measured memory_bytes: 256
// Vicfred
// https://atcoder.jp/contests/abc178/tasks/abc178_e
// math
import std.algorithm;
import std.stdio;

void main() {
    long n;
    readf("%s\n", &n);
    long[] x = new long[n];
    long[] y = new long[n];

    foreach(i; 0..n)
        readf("%s %s\n", &x[i], &y[i]);

    long[] plus = new long[n];
    long[] minus = new long[n];

    foreach(i; 0..n) {
        plus[i] = x[i] + y[i];
        minus[i] = x[i] - y[i];
    }

    plus.sort;
    minus.sort;

    long ans = max(plus[$-1] - plus[0],
                   minus[$-1] - minus[0]);

    ans.writeln;
}



Measured memory_bytes: 9100
s=input()
t=input()
ds={}
for i in range(len(s)):
  if s[i] in ds:
    ds[s[i]].append(i+1)
  else:
    ds[s[i]]=[i+1]
n=len(s)
now=0 # mod n
ans=0
from bisect import bisect_right
for ti in t:
  if ti not in ds:
    print(-1)
    exit()
  tmp=bisect_right(ds[ti],now)
  if tmp==len(ds[ti]):
    get=n+ds[ti][0]
  else:
    get=ds[ti][tmp]
  ans+=get-now
  #print(now,get)
  now=(get)%n
print(ans)
#print(ds)


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

signed main () {
	string s, t, u;
	cin >> s >> t;
	int a, b;
	cin >> a >> b >> u;
	if (u == s)
		cout << a - 1 << ' ' << b << '\n';
	else
		cout << a << ' ' << b - 1 << '\n';
}


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

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;

  map<int, int> m;
  for (int i = 2; i <= N; ++i) {
    int x = i;
    for (int j = 2; j * j <= i; ++j) {
      if (x % j == 0) {
        if (m.find(j) == m.end())
          m[j] = 0;
        ++m[j];
        x /= j;
        while (x % j == 0) {
          ++m[j];
          x /= j;
        }
      }
    }
    if (x > 1) {
      if (m.find(x) == m.end())
        m[x] = 0;
      ++m[x];
    }
  }

  long long ret = 1;
  for (map<int, int>::iterator i = m.begin(); i != m.end(); ++i) {
    ret *= i->second + 1;
    ret %= 1000000007;
  }

  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  ll n; cin >> n;
  vector<ll> ans(n+1);
  for(int x=1;x<=100;x++){
    for(int y=1;y<=100;y++){
      for(int z=1;z<=100;z++){
        if(x*x+y*y+z*z+x*y+y*z+z*x<=n) ans[x*x+y*y+z*z+x*y+y*z+z*x]++;
      }
    }
  }
  rep1(i,n){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 3592
n = int (input ())
cnt = [[0 for i in range (10)] for i in range (10)]
for i in range (1, n + 1) :
    p = int (str (i)[0])
    q = i % 10
    cnt[p][q] += 1
    ans = 0
for i in range (1, 10) :
    for j in range (1, 10) :
        ans += cnt[i][j] * cnt[j][i]
print (ans)

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<pair<ll, int>> bc(m);
    rep(i, m) {
        int b;
        ll c;
        cin >> b >> c;
        bc[i] = make_pair(c, b);
    }
    sort(bc.begin(), bc.end());
    reverse(bc.begin(), bc.end());
    sort(a.begin(), a.end());
    int min_num = 0;
    ll ans = 0;
    rep(i, m) {
        if ( min_num >= n ) {
            break;
        }
        int itr = distance(a.begin()+min_num, lower_bound(a.begin()+min_num, a.end(), bc[i].first));
        ans += bc[i].first * min(itr, bc[i].second);
        min_num += min(itr, bc[i].second);
//        cout << ans << " " << min_num << endl;
    }
    if ( min_num > n ) {
        cout << ans << endl;
    }
    else {
        for ( int i = min_num; i < n; ++i ) {
            ans += a[i];
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
int main( )
{
	int a;
	scanf("%d",&a);
	int x,y,z,o;
	x=a/1000;
	y=(a-x*1000)/100;
	z=(a-x*1000-y*100)/10;
	o=(a-x*1000-y*100-z*10);
	if(x==y||y==z||z==o)
	{
		printf("Bad\n");
	}
	else
	{
		printf("Good\n");
	}
}

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

class Dice {
public:
    int upside() {
        return faces[0];
    }
    int frontside() {
        return faces[1];
    }
    int rightside() {
        return faces[2];
    }
    int backside() {
        return faces[4];
    }
    int leftside() {
        return faces[3];
    }
    int downside() {
        return faces[5];
    }

    void E() {
        int tmp = faces[0];
        faces[0] = faces[3];
        faces[3] = faces[5];
        faces[5] = faces[2];
        faces[2] = tmp;
    }

    void N() {
        int tmp = faces[0];
        faces[0] = faces[1];
        faces[1] = faces[5];
        faces[5] = faces[4];
        faces[4] = tmp;
    }

    void S() {
        int tmp = faces[0];
        faces[0] = faces[4];
        faces[4] = faces[5];
        faces[5] = faces[1];
        faces[1] = tmp;
    }

    void W() {
        int tmp = faces[0];
        faces[0] = faces[2];
        faces[2] = faces[5];
        faces[5] = faces[3];
        faces[3] = tmp;
    }

    void rotate() {
        int tmp = faces[1];
        faces[1] = faces[2];
        faces[2] = faces[4];
        faces[4] = faces[3];
        faces[3] = tmp;
    }

private:
    int faces[6] = {0, 1, 2, 3, 4, 5};
};

bool isSameDice(int a[6], int b[6]) {
    Dice diceA, diceB;
    if (a[diceA.frontside()] == b[diceB.upside()]) {
        diceA.N();
    } else if (a[diceA.rightside()] == b[diceB.upside()]) {
        diceA.W();
    } else if (a[diceA.backside()] == b[diceB.upside()]) {
        diceA.S();
    } else if (a[diceA.leftside()] == b[diceB.upside()]) {
        diceA.E();
    } else if (a[diceA.downside()] == b[diceB.upside()]) {
        diceA.N();
        diceA.N();
    }

    bool isSame = false;
    for (int i = 0; i < 4; i++) {
        if (a[diceA.upside()] == b[diceB.upside()] &&
            a[diceA.frontside()] == b[diceB.frontside()] &&
            a[diceA.rightside()] == b[diceB.rightside()] &&
            a[diceA.backside()] == b[diceB.backside()] &&
            a[diceA.leftside()] == b[diceB.leftside()] &&
            a[diceA.downside()] == b[diceB.downside()]) {
            isSame = true;
            break;
        }
        diceA.rotate();
    }

    return isSame;
}

int main() {
    int a[100][6];
    int n; cin >> n;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 6; j++) {
            cin >> a[i][j];
        }
    }

    bool isAllDifferent = true;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            if (isSameDice(a[i], a[j])) {
                isAllDifferent = false;
                break;
            }
        }
        if (!isAllDifferent) {
            break;
        }
    }

    cout << (isAllDifferent ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 3100
from collections import deque
n, m = [int(i) for i in input().split()]
rooms = [[] for i in range(n)]
dist = [-1] * n
for i in range(m):
    a, b = [int(i) for i in input().split()]
    rooms[a-1].append(b)
    rooms[b-1].append(a)

que = deque()
que.append(1)
dist[0] = 0
ans = [0] * n
while(len(que) != 0):
    v = que.popleft()
    for i in rooms[v-1]:
        if dist[i-1] == -1:
            dist[i-1] = dist[v-1] + 1
            que.append(i)
            ans[i-1] = v
print("Yes")
for i in ans[1:]:
    print(i)

Measured memory_bytes: 35492
#include <stdio.h>

int main()
{
    int maxa = 0;
    int b = 0, i,tmpa, tmpb, N;
    scanf("%d", &N);

    for(i = 0; i < N; i++)
    {
        scanf("%d %d", &tmpa, &tmpb);
        if(tmpa > maxa)
        {
            maxa = tmpa;
            b = tmpb;
        }
    }
    printf("%d", maxa + b);
}

Measured memory_bytes: 128
#include<queue>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
inline void read(int &x)
{
	x=0;
	int p=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')p=-1;c=getchar();}
	while(isdigit(c)) {x=(x<<1)+(x<<3)+(c^'0');c=getchar();}
	x*=p;
}
map<int,int>d;
int n;
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	for(int i=1;i<=n;i++){int x;read(x);d[x]++;}
	int m;
	read(m);
	for(int i=1;i<=m;i++)
	{
		int x;
		read(x);
		if(d[x]==0)return printf("NO\n"),0;
		d[x]--;
	}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,y,c=0,k=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>x>>y;
        if(x==y) {
            c++;
            if(c>=3)
                k=1;
        }
        if(x!=y) c=0;
    }
    if(k==1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdlib>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <cmath>

#define rep(i, n) for (int i = 0; i < (int)n; i++)

using namespace std;
typedef pair<int, int> pint;

int main() {
    int a, b, c; cin >> a >> b >> c;
    if (a + b + c >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a=sc.nextInt(),b=sc.nextInt();
    if(a%3==0 || b%3==0 || (a+b)%3==0){
      System.out.println("Possible");
    }else{
      System.out.println("Impossible");
    }
  }
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

/* Dinic */

// (行き先,容量,逆辺)
struct edge{ int to,cap,rev; };

const int MAX_V = 222; // TODO:initialize
const int F_INF = 555555; // TODO:initialize
vector<edge> G[MAX_V];
int level[MAX_V]; // sからの距離
int iter[MAX_V]; // どこまで調べ終わったか

void add_edge(int from, int to, int cap){
    G[from].pb({to,cap,(int)G[to].size()});
    G[to].pb({from,0,(int)G[from].size()-1});
}

void dinic_bfs(int s){
    memset(level,-1,sizeof(level));
    queue<int> que;
    level[s]=0;
    que.push(s);
    while(!que.empty()){
        int v = que.front();
        que.pop();
        rep(i,G[v].size()){
            edge &e = G[v][i];
            if(e.cap>0 && level[e.to]<0){
                level[e.to] = level[v]+1;
                que.push(e.to);
            }
        }
    }
}

// 増加パスをdfsで探す
int dinic_dfs(int v, int t, int f){
    if(v==t) return f;
    for(int &i=iter[v]; i<(int)G[v].size(); ++i){
        edge &e=G[v][i];
        if(e.cap>0 && level[v]<level[e.to]){
            int d = dinic_dfs(e.to,t,min(f,e.cap));
            if(d>0){
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

// sからtへの最大流
int max_flow(int s, int t){
    int flow = 0;
    while(1){
        dinic_bfs(s);
        if(level[t]<0) return flow;
        memset(iter,0,sizeof(iter));
        int f;
        while( (f=dinic_dfs(s,t,F_INF)) > 0 ) flow+=f;
    }
}


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

    vector<int> w(n),h(n);
    rep(i,n) cin >>w[i] >>h[i];

    auto OK = [&](int x, int y){
        int xi = min(w[x],h[x]), xj = max(w[x],h[x]);
        int yi = min(w[y],h[y]), yj = max(w[y],h[y]);
        return xi<yi && xj<yj;
    };

    int S = 2*n, T = S+1;
    rep(i,n)rep(j,n){
        if(OK(i,j)) add_edge(i,n+j,1);
    }
    rep(i,n){
        add_edge(S,i,1);
        add_edge(n+i,T,1);
    }

    cout << n - max_flow(S,T) << endl;
    return 0;
}



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

int main(){
    
    // 1. 入力情報.
    LL K, A, B, ans = 0;
    scanf("%lld %lld %lld", &K, &A, &B);
    
    // 2. 皆伝になるには？
    if(K <= A){
        puts("1");
    }else{
        if(A - B <= 0){
            puts("-1");
        }else{
            ans = (K - A) / (A - B);
            if(ans * (A - B) == (K - A)) printf("%lld\n", 2 * ans + 1);
            else                         printf("%lld\n", 2 * ans + 3);
        }
    }
    return 0;
    
}

Measured memory_bytes: 256
// In the name of Allah the Most Merciful.

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(void)
{
    ll n , a , b;
    cin >> n >> a >> b;

    ll ar[n];

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

    ll ans = 0;

    for(int i=0;i<n-1;i++){

        ll temp = ar[i+1] - ar[i];
        ans+=min(temp*a , b);
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
  int N , m = -1, sum = 0;
  cin >> N;
  int A[N];
  for(int i=0;i<N;i++) cin >> A[i];
  sort(A,A+N);
  for(int i=0;i<N;i++) { 
    m = -m;
    sum += m*A[N-1-i];
  }
  cout << sum;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N;
	in >> N;
	std::vector<std::string>S(N);
	std::vector<LL>P(N);
	rep(i, N) in >> S[i] >> P[i];

	std::map<std::string, std::vector<std::pair<LL, LL>>>shop;
	rep(i, N) shop[S[i]].push_back(std::make_pair(P[i], i + 1));
	std::sort(S.begin(), S.end());
	S.erase(std::unique(S.begin(), S.end()), S.end());
	rep(i, S.size())
	{
		auto vec = shop[S[i]];
		std::sort(vec.rbegin(), vec.rend());
		rep(j, vec.size()) out << vec[j].second << std::endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int n, r;
    cin >> n >> r;
    if (n >= 10)
        cout << r << endl;
    else
        cout << r + 100 * (10 - n) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long mod=2019;

int main(){
	long long l,r;
	scanf("%lld %lld",&l,&r);
	if(l%mod==0 || r%mod==0 || l/mod<r/mod) puts("0");
	else{
		long long a=l%mod,b=r%mod,ans=mod;
		for(long long i=a; i<b; i++)
			for(long long j=i+1; j<=b; j++) ans=min(ans,i*j%mod);
		printf("%lld\n",ans);
	}
	return 0;
}

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

map<int, int> name;
map<int, int>::iterator p;

const int MAXN = 100005;
int arr[MAXN];
	
	
int N;

int main()
{
  cin>>N;
  for(int i = 1; i <= N; i++)
    cin>>arr[i];

  // odd
  for(int i = 1; i <= N; i+=2)
    name[arr[i]]++;

  int mx = 0;
  int u = -1;
  for(p = name.begin(); p != name.end(); ++p)
    {
      if(p->second > mx)
	mx = p->second, u = p->first;
    }

  int cnt = 0;
  
  for(int i = 1; i <= N; i+=2)
    {
      if(arr[i] != u)
	cnt++;
    }

  name.clear();
  
  for(int i = 2; i <= N; i+=2)
    name[arr[i]]++;
  
  int u0 = u;
  mx = 0;
  u = -1;
  for(p = name.begin(); p != name.end(); ++p)
    {
      if(p->second > mx && p->first != u0)
	mx = p->second, u = p->first;
    }
  //SPJ!
  if(u == -1)
    cnt += N / 2;
  else
    {
      //
      for(int i = 2; i <= N; i+=2)
	{
	  if(arr[i] != u)
	    cnt++;
	}
    }
  int ans = cnt;


  
  // even
  name.clear();
  cnt = 0;
  
  for(int i = 2; i <= N; i+=2)
    name[arr[i]]++;

  mx = 0;
  u = -1;
  for(p = name.begin(); p != name.end(); ++p)
    {
      if(p->second > mx)
	mx = p->second, u = p->first;
    }

  cnt = 0;
  
  for(int i = 2; i <= N; i+=2)
    {
      if(arr[i] != u)
	cnt++;
    }

  name.clear();
  
  for(int i = 1; i <= N; i+=2)
    name[arr[i]]++;

  u0 = u;
  mx = 0;
  u = -1;

  for(p = name.begin(); p != name.end(); ++p)
    {
      if(p->second > mx && p->first != u0)
	mx = p->second, u = p->first;
    }
  if(u == -1)
    cnt += N / 2;
  else
    {
      for(int i = 1; i <= N; i+=2)
	{
	  if(arr[i] != u)
	    cnt++;
	}
    }

  ans = min(ans,cnt);
  cout<<ans;
    
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define hyperspeed ios::sync_with_stdio(false);cin.tie(NULL);
#define ll long long  
#define ull unsigned long long
#define ui unsigned int
#define li long int
#define uli unsigned long int
#define pb push_back
#define ld long double
#define vi vector<int>
#define vvi vector<vector<int>>
#define vli vector<li>
#define vll vector<ll>
#define all(v) v.begin(),v.end()
#define pi pair<int,int>
#define FOR(i,s,n) for(auto i=s;i<n;++i)
#define FORN(i,s,n) for(auto i=s;i<=n;++i)
#define FORR(i,s,n) for(auto i=s;i>=n;--i)
#define FORE(i,a) for(auto i : a)
#define mp make_pair
const int MOD = 1e9+7;

void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if(s.size()&1) {
        cout << "No\n";
        return;
    }
    if(s.substr(0,s.size()/2)==s.substr(s.size()/2,s.size()-1)) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }
}

int32_t main()
{
    hyperspeed
    int test=1;
    // cin >> test;
    while(test--) {
        solve();
    }
    return 0;
}

//--n1m5


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

#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9

using namespace std;

/**
 * calculate GCD(greatest common divisor)
 * @param a
 * @param b
 * @return
 */
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

/**
 * change minimum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMinimum(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * change maximum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMaximum(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * output answer
 * @tparam T
 * @param answer
 * @return
 */
template<typename T>
T output(T answer) {
    cout << answer << endl;
    return 0;
}

/** ----from here ---------------------------------------------------------- */

int main() {

    int N;
    int M;
    cin >> N >> M;
    vector<int> a(M);
    for (int i = 0; i < M; ++i) {
        cin >> a.at(i);
    }
    int sum = 0;
    for (int i = 0; i <M ; ++i) {
        sum += a.at(i);
    }
    int aa =-1;
    if(N>= sum){
        aa = N-sum;
    }

    cout << aa << endl;
}

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

flag = 0
words = set()
for i in range(n):
    x = input()
    if i==0:
        y = x[0]
    words.add(x)

    #print(x,y, words)
    #print(":", y[-1], x[0])
    if not(y[-1] == x[0] and i < len(words)):
        flag = 1
        break
    y = x

if flag == 0:
    print("Yes")
else :
    print("No")


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

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

  if (n % 2 == 1) {
    for (int l = 2, r = n; l <= m + 1; l++, r--) {
      cout << l << " " << r << '\n';
    }
  } else {
    bool flag = true;
    for (int l = 2, r = n; l <= m + 1; l++, r--) {
      if(flag && (r - l) <= n / 2) --r, flag = false;
      cout << l << " " << r << '\n';
    }
  }

  return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

struct UnionFind{
    vector<int> par;
    vector<int> siz;

    UnionFind(int n){
        init(n);
    }

    //n要素で初期化
    void init(int n){
        par.resize(n);
        siz.resize(n);
        for(int i = 0; i < n; i++){
            par[i] = i;
            siz[i] = 1;
        }
    }

    //木の根を求める
    int root(int x){
        if(par[x] == x) return x;
        else return par[x] = root(par[x]);
    }

    //xとyの属する集合を併合
    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
    }

    bool same(int x, int y){
        return root(x) == root(y);
    }

    int size(int x){
        return siz[root(x)];
    }
};

signed main(){
    int n,m;
    cin >> n >> m;
    UnionFind uf(n);
    int x,y,z;
    REP(i,m){
        cin >> x >> y >> z;
        x--;
        y--;
        uf.unite(x, y);
    }
    int ans = 0;
    REP(i,n){
        if(uf.root(i) == i){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#define P 1000000007
using namespace std;
typedef long long ll;
int mod_power(ll,int);

int main(){
  int m,n;
  cin>>m>>n;
  cout<<mod_power((ll)m,n)<<endl;
  return 0;
}

int mod_power(ll x,int y){
  ll res=1;
  for(int i=0;i<=30;i++){
    if(y&(1<<i)) res=res*x%P;
    (x*=x)%=P;
  }
  return res%P;
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <map>
#include <sstream>
using namespace std;
 
void solve() {
	int x;
	cin >> x;
	if(x == 0) {
		cout << 1 << endl;
	}else {
		cout << 0 << endl;
	}
}
 
int main () {
	int t = 1;
	for(int tt = 0; tt < t; tt++) solve();
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main(int argc, char const *argv[])
{
    ll n, t;
    cin >> n >> t;
    ll ans = 0;
    ll a[n];
    rep(i, n) cin >> a[i];
    rep(i, 1, n)
    {
        ans += min(t, a[i] - a[i - 1]);
    }
    cout << ans + t << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>

using namespace std;

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

    if(a+b<10){
        cout<<a+b<<endl;
    }else{
        cout<<"error"<<endl;
    }
    return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <stdint.h>

using namespace std;

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

  int ans = 0;

  for (int n=0; n<N; ++n) {
    int h;
    cin >> h;
    if (h >= K)
      ++ans;
  }
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 998244353;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;


int main(){
    ll N;
    cin >> N;
    vector<ll> mem(N+1);
    REP(i,1,N+1){
        ll cur = i;
        while(cur<=N){
            mem[cur]++;
            cur += i;
        }
    }
    ll ans = 0;
    REP(i,1,N+1){
        ans += i*mem[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 81400
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = Integer.parseInt(in.nextLine());
		List<String> words = new ArrayList<>();
		for (int i = 0; i < N; ++i) {
			words.add(in.nextLine());
		}
		boolean valid = true;
		Set<String> saidWords = new HashSet<>();
		saidWords.add(words.get(0));
		for (int i = 1; i < N; ++i) {
			String prevWord = words.get(i - 1);
			String currentWord = words.get(i);
			if (saidWords.contains(currentWord)) {
				valid = false;
				break;
			}
			if (prevWord.charAt(prevWord.length() - 1) != currentWord.charAt(0)) {
				valid = false;
				break;
			}
			saidWords.add(currentWord);
		}
		if (valid) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		in.close();
	}

}

Measured memory_bytes: 22612
// ================
// Himanshu Lal
// MNIT Jaipur
// ================
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define TEZ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define INF 1e18
#define vi vector<pair<ll,ll>>
#define ff first
#define ss second
#define mp map<ll,ll>
#define test ll tp; cin>>tp; while(tp--)
#define srt(v) sort(v.begin(),v.end())
double pi=acos(-1);
void OJ(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
}
int main(){
    TEZ;
    ll n;
    cin>>n;
    map<string,ll> m;
    f(i,0,n){
        string s;
        cin>>s;
        m[s]++;
    }
    cout<<"AC x "<<m["AC"]<<endl;
    cout<<"WA x "<<m["WA"]<<endl;cout<<"TLE x "<<m["TLE"]<<endl;cout<<"RE x "<<m["RE"]<<endl;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

const int MD = 1e9+7;
struct Mint {
    typedef Mint M;
    int v;
    Mint(int _v = 0) : v(_v) {}
    M& operator += (const M &r) {
        if ((v += r.v) >= MD) v -= MD;
        return *this;
    }
    M& operator -= (const M &r) {
        if ((v -= r.v) < 0) v += MD;
        return *this;
    }
    M& operator *= (const M &r) {
        v = ll(v)*r.v%MD;
        return *this;
    }
    M operator + (const M &r) const { return M(*this) += r; }
    M operator - (const M &r) const { return M(*this) -= r; }
    M operator * (const M &r) const { return M(*this) *= r; }
    M pow(int n) const {
        M x = *this, r = 1;
        while (n) {
            if (n&1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return this->pow(MD-2); }
};

const int B = 999999;
int N, M, K;
Mint fac[B], ifac[B];

Mint C(int n, int m) {
    if (n < 0 || m < 0 || n < m) return Mint(0);
    return fac[n]*ifac[m]*ifac[n-m];
}

void first() {
    fac[0] = 1;
    for (int i = 1; i < B; i++) fac[i] = fac[i-1]*Mint(i);
    ifac[B-1] = fac[B-1].inv();
    for (int i = B-2; i >= 0; i--) ifac[i] = ifac[i+1]*Mint(i+1);
}

int main() {
    first();
    cin >> N >> M >> K;
    if (M > K) swap(M, K);

    Mint ans = 0;

    for (int i = 0; i <= M; i++) {
        ans += C(N-1+i, N-1) * Mint(2).pow(i) * Mint(3).pow(M+K-i);
    }
    Mint sm = Mint(2).pow(M);
    for (int i = M+1; i <= K; i++) {
        sm = Mint(2) * sm - C(i-1, M);
        ans += C(N-1+i, N-1) * sm * Mint(3).pow(M+K-i);
    }
    for (int i = K+1; i <= M+K; i++) {
        sm = Mint(2) * sm - C(i-1, M) + C(i-1, i-2-K) - C(i, i-1-K);
        ans += C(N-1+i, N-1) * sm * Mint(3).pow(M+K-i);
    }

    cout << ans.v << endl;

    return 0;
}

Measured memory_bytes: 8064
N, K = map(int,input().split())
cmb = (N-1)*(N-2)//2

if K > cmb:
    print('-1')
else:
    print(N-1+cmb-K)
    for i in range(N-1):
        print(1,i+2)
    cnt = 0
    i = 2
    j = 3
    while cnt < cmb-K:
        print(i,j)
        if j == N:
            i += 1
            j = i + 1
        else:
            j += 1
        cnt += 1

Measured memory_bytes: 3608
n = int(input())
for i in range(n):
    xa, ya, ra, xb, yb, rb, = map(float, input().split())
    dsq = (xa - xb)**2 + (ya -yb)**2
    if dsq > (ra + rb)**2:
        print('0')
    elif dsq < (ra - rb)**2:
        if ra > rb:
            print('2')
        else:
            print('-2')
    else:
        print('1')

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

typedef pair<int,int> point_t;
const vector<point_t> points={{1,0},{-1,0},{0,1},{0,-1}};

int main(){
    //入力
    int H,W;
    cin >> H >> W;
    vector<vector<char>> s(H,vector<char> (W,'#'));

    int num_b=0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> s.at(i).at(j);
            if(s.at(i).at(j)=='#') num_b++;
        }
    }    

    point_t a,g,cur,next;
    a.first=0;
    a.second=0;
    g.first=H-1;
    g.second=W-1;

    //WFS
    vector<vector<int>> dist(H,vector<int> (W,-1));//-1は未訪問
    queue<point_t> que;//次の行き先
    que.push(a);
    dist.at(a.first).at(a.second)=0;

    int min=H*W-num_b;
    while(!que.empty()){
        cur = que.front();
        que.pop();

        if(cur==g){
            min=dist.at(cur.first).at(cur.second);
            break;
        }
        
        for(const auto &p:points){
            next.first=cur.first+p.first;
            next.second=cur.second+p.second;
            if(next.first>=0&&next.first<H&&next.second>=0&&next.second<W){
                if((s.at(next.first).at(next.second)=='.')&&(dist.at(next.first).at(next.second)==-1)){
                    que.push(next);
                    dist.at(next.first).at(next.second)=dist.at(cur.first).at(cur.second)+1;
                }   
            }
        }
    }

    //出力
    cout << H*W - (min+1)-num_b << endl;
}

Measured memory_bytes: 256
N = int(input())
S = []

for i in range(N):
  S.append(input())
  
import collections
c = collections.Counter(S).most_common()
a=c[0][1]
ans=[]
for i in range(len(c)):
  if a==c[i][1]:
    ans.append(c[i][0])
  else:
    break
ans.sort()
for i in range(len(ans)):
  print(ans[i])

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

int main(){
	string s;
	cin >> s;
	int ans = 1000;
	for(int i = 0; i < (int)s.size() - 2; i++) {
		int n = (s[i]-'0')*100 + (s[i+1]-'0')*10 + (s[i+2]-'0');
		ans = min(ans, abs(753 - n));
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 256
package main

import "fmt"

const (
	// MOD is .
	MOD = 1000000000 + 7
	// MOD = 13
)

func main() {
	var n, a, b int
	fmt.Scanf("%d %d %d", &n, &a, &b)
	res := modPow(2, n) + 2*MOD - combMod(n, a) - combMod(n, b) - 1
	fmt.Println(res % MOD)
	// fmt.Println(combMod(n, a))
}

func combMod(n, k int) int {
	if k == 0 {
		return 1
	}
	res := n
	div := k
	for i := 1; i < k; i++ {
		res = res * (n - i) % MOD
		div = div * (k - i) % MOD
	}
	div = modPow(div, MOD-2)
	return res * div % MOD
}

func modPow(a, n int) int {
	if n == 0 {
		return 1
	}
	res := 1
	for p := n; p > 0; p >>= 1 {
		if p&1 == 1 {
			res = res * a % MOD
		}
		a = a * a % MOD
	}
	return res
}


Measured memory_bytes: 512
#include <stdio.h>

int main(void){
  int n,d,x,b=0;
  int a[105];
  scanf("%d", &n);
  scanf("%d %d", &d, &x);
  for(int i=0;i<n;i++){
    scanf("%d", &a[i]);
    b+=(d-1)/a[i]+1;
  }

  
  printf("%d", b+x);
  return 0;
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll r;
    cin>>r;
    string s,s1,s2,s3;
    cin>>s;
    if(r==1) {cout<<"No"<<endl; return 0;}
    s1=s.substr(0,r/2);
    //cout<<s1<<endl;
    s2=s.substr((r/2),r-1);
    //cout<<s2<<endl;
//    s3=s1+s2;
//    cout<<s3<<endl;
    if(s1==s2) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 256
# ####################################################################
# import io
# import sys

# _INPUT = """\
# 10
# 9 4 6 1 9 6 10 6 6 8
# """
# sys.stdin = io.StringIO(_INPUT)
# ####################################################################
####################################################################
import sys
def _p(*_a):
  #return
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
####################################################################
def _pa(_aa):
  #return
  for _a in _aa: _p(_a)
####################################################################
N = int(input())
L = [int(i) for i in input().split()]

L.sort()

from collections import Counter
A = Counter(L)
K = list(A.keys())

# _p(K)
# for k,v in A.items():
#   _p(k,v)

ans = 0

for i in range(len(K)):
  # _p(K[i], A[K[i]])
  for j in range(i+1,len(K)):
    # _p("  ",K[j], A[K[j]])
    for k in range(j+1,len(K)):
      # _p("    ",K[k], A[K[k]])
      if K[i] + K[j] > K[k]:
        # _p(A[K[i]] , A[K[j]] , A[K[k]])
        # _p(K[i] , K[j] , K[k])
        ans += A[K[i]] * A[K[j]] * A[K[k]]

print(ans)



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

int wsum[300001];
int esum[300001];

int main(int argc, const char * argv[]) {
 
    int n;
    string h;
    
    cin >> n;
    cin >> h;
    
    
    int sz = (int)h.size();
    for(int i=1;i<=sz;i++){
        if(h[i-1]=='W'){
            wsum[i] = wsum[i-1]+1;
            esum[i] = esum[i-1];
        }else{
            wsum[i] = wsum[i-1];
            esum[i] = esum[i-1]+1;
        }
       // printf("#%d %d %d\n",i,wsum[i],esum[i]);
    }
    int ans = 987654321;
    
    
    
    for(int i=1;i<=sz;i++){
        
        //현재 0번째를 고른다.
        if(ans > wsum[i-1] + esum[sz]-esum[i]){
            ans = wsum[i-1] + esum[sz]-esum[i];
        }
    }
    
    printf("%d\n",ans);
    
    
    
    return 0;
}


Measured memory_bytes: 3076
import bisect
n=int(input())
a=sorted(list(map(int,input().split())))
b=list(map(int,input().split()))
c=sorted(list(map(int,input().split())))
cnt=0
for i in b:
	#print(i)
	#print(bisect.bisect_left(a,i),n-bisect.bisect_right(c,i))
	cnt+=bisect.bisect_left(a,i)*(n-bisect.bisect_right(c,i))
print(cnt)

Measured memory_bytes: 23744
S = input()

c=[0,0,0,0]
h=[]
h.append(S[0])
c[0]+=1

for i in range(1,len(S)):
	cnt=0
	for k in range(len(h)):
		if h[k] ==S[i]:
			c[k]+=1
		elif h[k]!=S[i]:
			cnt+=1
	if cnt == len(h):
		h.append(S[i])
		c[len(h)-1]+=1
if 2==c[0] and 2==c[1]:
	print("Yes")
else:
	print("No")

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

int main(void)
{
  string s;
  cin >> s;
  
  int y = 700;
  if (s[0] == 'o') y += 100;
  if (s[1] == 'o') y += 100;
  if (s[2] == 'o') y += 100;
  
  cout << y << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<stack>
#include<queue>

using namespace std;

typedef long long int ll;
const ll MOD=1000000007;

ll n,k;
ll C[1001][1001]={};

int main(){
	scanf("%lld %lld",&n,&k);
	if(n>k) printf("0\n");
	else{
		for(int i=0;i<1001;i++){
			C[i][0]=1;
			C[i][i]=1;
			for(int j=1;j<i;j++){
				C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;
			}
		}
		printf("%lld\n",C[k][n]);
	}
}


Measured memory_bytes: 10108
N = input()
Nlist = list(N)
NN = int(N)
count = 0
for a in Nlist:
  count += 1




if count == 1:
  print(int(NN))
if count == 2:
  print(9)
if count == 3:
  print(int(NN) - 90)
if count == 4:
  print(909)
if count == 5:
  print(int(NN) -9090)
if count == 6:
  print(90909)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i++; i<N)
#define RVROOP(i, N) for(int i=N; i--; i>=0)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const double PI=3.14159265358979323846;
int main() {
  double a,b,x; cin>>a>>b>>x;
  double h=2*(a*a*b-x)/a/a;
  if(h<=b){
    double th=h/a;
    double ans=atan(th)*180/PI;
    cout<<fixed<<setprecision(13);
    cout<<ans<<endl;
  }
  else{
    double hh=2*x/a/b;
    double th=b/hh;
    double ans=atan(th)*180/PI;
    cout<<fixed<<setprecision(13);
    cout<<ans<<endl;
  }
  return 0;
}

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

int solve() {
    int A, B, C;
    cin >> A >> B >> C;
    vector<int> X{A,B,C};
    sort(X.begin(), X.end());
    int ans = (X[2] - X[0]) / 2 + (X[2] - X[1]) / 2;
    int d = ((X[2] ^ X[0]) & 1) + ((X[2] ^ X[1]) & 1);
    if ( d == 1 ) ans += 2;
    else if ( d == 2 ) ans += 1;
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
string r;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin>>s;
  forv(i,s){
    if(sz(r)==0 || r.back()=='T' || s[i]=='S')
      r.PB(s[i]);
    else
      r.pop_back();
  }
  cout<<sz(r)<<endl;
  return 0;
}


Measured memory_bytes: 916
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i = (int)(n)-1; i>=0; --i)
#define For(i,a,b) for(auto i=(a);i<=(b);++i)
#define rFor(i,a,b) for(auto i=(b);i>=(a);--i)
#define call(var) cerr<<#var<<"="<<var<<"\n";
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const double pi = acos(-1);
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}
template<class T> istream& operator>>(istream& is, vector<T>& a){rep(i,a.size()) is >> a[i]; return is;}
template<class T> ostream& operator<<(ostream& os, vector<T>& a){rep(i,a.size()) os << a[i] << " "; return os;}
template<class T, class U> istream& operator>>(istream& is, pair<T,U>& p){is >> p.first >> p.second; return is;}
template<class T, class U> ostream& operator<<(ostream& os, const pair<T,U>& p){os << "("<< p.first << "," << p.second << ")"; return os;}
template<class T, class U> ostream& operator<<(ostream& os, const map<T,U>& mp){for(auto& t : mp) os << t.first << " " << t.second << "\n"; return os;}

struct UnionFind {
    vector<int> d;
    UnionFind(int n): d(n,-1) {}
    int root(int x) {
        if (d[x] < 0) return x;
        return d[x] = root(d[x]);
    }
    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x, int y) { return root(x) == root(y);}
    int size(int x) { return -d[root(x)];}
};

int main(){
    int n,m;cin >> n >> m;
    UnionFind uf(n);
    rep(i,m){
        int a,b;cin >> a >> b;
        --a;--b;

        uf.unite(a, b);
    }

    int ans = 0;
    rep(i,n){
        chmax(ans, uf.size(i));
    }
    cout << ans << endl;
}


Measured memory_bytes: 3996
n = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0

for i in range(n):
  s = input()
  if s=="AC":
    AC+=1
  elif s=="WA":
    WA+=1
  elif s=="TLE":
    TLE+=1
  else:
    RE+=1

print(f"AC x {AC}")
print(f"WA x {WA}")
print(f"TLE x {TLE}")
print(f"RE x {RE}")


Measured memory_bytes: 9196
def insertionSort(A, g):
    cnt = 0

    for i in range(g, len(A)):
        v = A[i]
        j = i - g
        
        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j -= g
            cnt += 1

        A[j + g] = v

    return cnt


def shellSort(A):
    cnt = 0

    m = 0
    G = []
    gap = len(A) // 2

    while gap > 0:

        G.append(gap)

        cnt += insertionSort(A, gap)

        m += 1
        gap //= 2

    if not G:
        m = 1
        G.append(1)

    return m, G, cnt



# INPUT
n = int(input())

A = [int(input()) for _ in range(n)]

# SORT
m, G, cnt = shellSort(A)

# OUTPUT
print(m)

print(*G)

print(cnt)

for i in range(n):
    print(A[i])






Measured memory_bytes: 45524
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];
    int sum=0,a,b;
    for(int x:arr)
        sum+=x;
    a=sum/n;
    b=sum/n+1;
    int an1=0,an2=0;
    for(int x:arr)
    {
        an1+=pow((a-x),2);
        an2+=pow((b-x),2);
    }
    if(an1>an2)
        swap(an1,an2);
    cout<<an1;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;



int main(){
  int n;
  cin >> n;
  bool ok = false;
  REP2(i,1,10){
    REP2(j,1,10){
      if(n == i*j) {
        ok = true;
        break;
      }
    }
  }

  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

void solve()
{
    int n;
    cin >> n;
    cout << n + n * n + n * n * n;
}

int main()
{
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


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

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

    vector<int> h(n);
    for(int i = 0; i < n; i++) {
        cin >> h.at(i); 
    }

    vector<int> dp(n);
    dp.at(0) = 0;
    dp.at(1) = abs(h.at(1) - h.at(0));
    for (int i = 2; i < n; i++) {
        int a = dp.at(i - 2) + abs(h.at(i) - h.at(i - 2));
        int b = dp.at(i - 1) + abs(h.at(i) - h.at(i - 1));

        dp.at(i) = min(a, b);

        //printf("dp[%d] = %d", i, dp.at(i));
    }

    cout << dp.at(n - 1) << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>

int n,m;

void proc(){
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++)
      printf("#");
    printf("\n");
  }
  printf("\n");
}

int main(){
  while(true){
    scanf("%d%d", &n, &m);
    if(!n&&!m)return 0;
    proc();
  }
}

Measured memory_bytes: 1000
#include <bits/stdc++.h>
using namespace std ;
using ll=long long ;
int main(){
int n ;
cin >> n ;
ll cont1=0 ,cont2=0 ,cont3=0 ,cont4=0 ;
while(n--)
{
  string s ;
  cin >>s ;
  if(s=="AC") cont1++ ;
  else if(s=="WA") cont2++ ;
  else if(s=="TLE") cont3++ ;
  else if(s=="RE") cont4++ ;

}
cout<< "AC"<<' '<<'x'<<' '<<cont1<<endl ;
cout<< "WA"<<' '<<'x'<<' '<<cont2<<endl ;
cout<< "TLE"<<' '<<'x'<<' '<<cont3<<endl ;
cout<< "RE"<<' '<<'x'<<' '<<cont4<<endl ;
 return 0 ;
}


Measured memory_bytes: 3600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var Instance = new Question();
			Instance.Exec();
		}
	}

	public class Question
	{
		public void Exec()
		{
			string str = "";
			List<int> sumList = new List<int>();
			while (str != "0") {
				str = Console.ReadLine();
				if (str == "0") {
					break;
				}

				int sum = 0;
				foreach (var item in str) {
					sum += int.Parse(item.ToString());
				}

				sumList.Add(sum);
			}

			foreach (var item in sumList) {
				Console.WriteLine($"{item}");
			}

			Console.ReadKey();
		}
	}
}


Measured memory_bytes: 15980
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(), v.end()
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define um unordered_multiset
#define us unordered_set
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define cc continue
#define bb break
#define rem 1000000007
#define debug(n1) cout<<"debug... "<<n1<<"\n"
#define PI 3.141592653589793238462643383279502
//fflush(stdin);
// do {
// // process permutation
// } while (next_permutation(permutation.begin(),permutation.end()));
class abc
{
    public:
    ll x,y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    char x;
    cin>>x;
    cout<<char(int(x)+1);
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

using namespace std;

const int MAXN = 100000;
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define abs(x) ((x) > 0 ? (x) : (-(x)))

int f[MAXN + 5], h[MAXN + 5];
int main() {
	memset(f, 0x3f, sizeof (f));
	int n, k;
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; ++ i) {
		scanf("%d", &h[i]);
	}
	f[1] = 0;
	for (int i = 1; i <= n; ++ i) {
		for (int j = 1; j <= k; ++ j) {
			if (i + j <= n) {
				f[i + j] = min(f[i] + abs(h[i + j] - h[i]), f[i + j]);
			}
		}
	}
	printf("%d\n", f[n]);
	return 0;
}

Measured memory_bytes: 896
n = int(input())
h = list(map(int,input().split()))
cnt = 0
cnt_ = 0
for i in range(n-1):
    if h[i] < h[i+1]:
        cnt_ = 0
    else:
        cnt_ += 1
        if cnt < cnt_:
            cnt = cnt_
print(cnt)

Measured memory_bytes: 14224