akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, p[10], q[10], i, a, b, cnt=1, chp=0, chq=0, ans=0;
    cin >> n;
    vector<int> tmp(n);
    for(i=0;i<n;i++){
        cin >> p[i]; 
    }
    for(i=0;i<n;i++){
        cin >> q[i];
    }
    for(i=0;i<n;i++){
        tmp[i]=i+1;
    }
    do{
    for(int x=0;x<n;x++){
       if(tmp[x]==p[x])  chp++;
       if(tmp[x]==q[x]) chq++;
    }
    if(chp==n) a=cnt;
    if(chq==n) b=cnt;
    cnt++;
    chp=0;
    chq=0;
    }while(next_permutation(tmp.begin(), tmp.end()));

    ans=abs(a-b);
    cout << ans <<endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int a,b,c;

int main(){
    scanf("%d %d %d",&a,&b,&c);
    if(a==5&&b==5&&c==7)printf("YES\n");
    else if(a==5&&b==7&&c==5)printf("YES\n");
    else if(a==7&&b==5&&c==5)printf("YES\n");
    else printf("NO\n");
}


Measured memory_bytes: 128
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;



void main() {
    int a, b;
    scan(a);
    scan(b);
    writeln(6 - a - b);
}

















void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


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

using namespace std;

#define make_unique(a) (a.erase(unique(a.begin(),a.end()),a.end()))
#define allof(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb push_back
#define exists(s, e) (s.find(e)!=s.end())
#define INF 0x3f3f3f3f
#define endl '\n'
#define mp make_pair
#define readln(x) (getline(cin, x))
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))

typedef pair<int, int> pii;
typedef long long ll;

ll gcd(ll a, ll b) {return b == 0 ? a : gcd(b, a % b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

void solve() {
    vector<int> v(3, 0);
    cin >> v[0] >> v[1] >> v[2];
    sort(allof(v));
    cout << ((v[0]*v[1])>>1) << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    solve();
    return 0;
}



Measured memory_bytes: 256
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

n, m = l()
g = [[] for i in range(n)]
for i in range(m):
    a, b = l()
    g[a-1].append(b-1)
    g[b-1].append(a-1)
q = deque([0])
d = [-1] * n
d[0] = 0
while q:
    v = q.popleft()
    for w in g[v]:
        if d[w] != -1:
            continue
        d[w] = v
        q.append(w)
if -1 in d:
    print("No")
else:
    print("Yes")
    for di in d[1:]:
        print(di+1)


Measured memory_bytes: 35184
//BISMILLAHIR RAHMANIR RAHIM
//ALLAH HU AKABR
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long int n;
  cin>>n;
  long int sum=0;
  for(long int i=1;i<=n;i++)
  {
    if(i%3==0 &&i%5==0)
    {
        sum=sum;
    }
    else if(i%3==0)
    {
        sum=sum;
    }
    else if(i%5==0)
    {
        sum=sum;
    }
    else
    {
        sum+=i;
    }
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 3624
while True:
  n = int(input())
  if n == 0:
    break
  pages = list(map(int, input().split()))
  ans = ""
  while pages:
    for i in range(len(pages) - 1):
      if pages[i + 1] - pages[i] != 1:
        s = pages[:i+1]
        if i == 0:
          ans += " " + str(s[0])
        else:
          ans += " " + str(s[0]) + "-" + str(s[-1])
        pages = pages[i+1:]
        break
    else:
      if len(pages) == 1:
        ans += " " + str(pages[0])
      else:
        ans += " " + str(pages[0]) + "-" + str(pages[-1])
      break
  print(ans.strip())




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

int main(){
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int dx = x2 - x1;
    int dy = y2 - y1;

    int x3 = x2 - dy;
    int y3 = y2 + dx;
    int x4 = x3 - dx;
    int y4 = y3 - dy;
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
    return 0;
}

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

int main(){
  int A, B,C,D;
  cin >> A >> B >> C >> D;
  if(A>B){
    swap(A,B);
  }
  if(B>C){
    swap(B,C);
  }
  if(C>D){
    swap(C,D);
  }
  if(B>C){
    swap(B,C);
  }
  if(A>B){
    swap(A,B);
  }
 if(A==1 && B==4 && C==7 && D==9){
   cout << "YES" << endl;
 }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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


Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include<stack>
#include <unordered_map>

using namespace std;

#define MAX(A,B) (A)>(B)?(A):(B)
#define MIN(A,B) (A)<(B)?(A):(B)

int main() {
	int N;
	cin >> N;
	double ans = 0;
	for (int i = 0; i < N; i++) {
		double x;
		string str;
		cin >> x >> str;
		if (str == "JPY") {
			ans += x;
		}
		else {
			ans += x * 380000.0;
		}
	}
	cout << ans;
	return 0;
}



Measured memory_bytes: 256
N, M = map(int, input().split())
H = list(map(int, input().split()))
ans = [1] * N

for i in range(M):
  AB = list(map(int, input().split()))
  if H[AB[0] - 1] > H[AB[1] - 1]:
    ans[AB[1] - 1] = 0
  elif H[AB[1] - 1] > H[AB[0] - 1]:
    ans[AB[0] - 1] = 0
  else:
    ans[AB[0] - 1] = 0
    ans[AB[1] - 1] = 0
  #print(ans)
    
#print(ans)
print(sum(ans))
     
  

Measured memory_bytes: 20048
#include <iostream>
using namespace std;
int main(){
  int n,x;
  cin >> n >> x;
  while(n!=0||x!=0){
    int i,j,k;
    int o=0;
    for(i=1;i<=n;i++){
      for(j=i+1;j<=n;j++){
	for(k=j+1;k<=n;k++){
	  if(i+j+k==x) o++;
	}
      }
    }

    cout << o << endl;

    cin >> n >> x;
  }


  return 0;
}



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

template<typename Con>
auto printContainer(Con container) -> void
{
	for (int i = 0; i < container.size(); i++) {
		cout << container[i];
		if (i != container.size() - 1)
			cout << ' ';
	}
	cout << endl;
}

template<typename Con>
auto insertSort(Con container) -> void
{
	for (int i = 0; i < container.size(); i++) {
		auto key = container[i];
		int j = i - 1;
		while (j >= 0 && container[j] > key) {
			container[j + 1] = container[j];
			j--;
		}
		container[j + 1] = key;

		printContainer(container);
	}
}

auto main(void) -> int
{
	int nItemMax;
	cin >> nItemMax;
	vector<int> container;
	for (int nItem = 0; nItem < nItemMax; nItem++) {
		int n;
		cin >> n;
		container.push_back(n);
	}
	insertSort(container);

	return 0;
}

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

int main() {
  int A;
  int sum = 0;
  cin >> A;
  //cout << A << endl;
  vector<int> tako(A);
  for(int i = 0; i < A; i++){
    cin >> tako.at(i);
  }
  //cout << tako.at(0) << endl;
  //cout << tako.at(1) << endl;
  //cout << tako.at(2) << endl;
  //cout << tako.at(3) << endl;
  
  for(int i = 0; i < A; i++){
    for(int j = 0; j < A ; j++){
      if(i < j){
        sum += tako.at(i)*tako.at(j);
      }
    }
  }
  cout << sum << endl;
}

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

long powmod(long n, long k, long mod) {
  if (k == 0)
    return 1;
  long t = powmod(n, k / 2, mod);
  t = (t * t) % mod;
  if (k % 2 == 1)
    t = (t * n) % mod;
  return t;
}

long fact[200001]; //fact[i] = i! % mod (0<=i<=n)
long fact_rec[200001]; //fact_rec[i] = (i!)^-1 % mod
long rec[200001]; //rec[i] = i^-1 % mod (i > 0)
void factini(long n, long mod) {
  fact[0] = fact_rec[0] = rec[0] = 1;
  fact[1] = fact_rec[1] = rec[1] = 1;
  for (int i = 2; i <= n; i++) {
    fact[i] = (fact[i - 1] * i) % mod;
    rec[i] = (rec[mod % i] * (mod - mod / i)) % mod;
    fact_rec[i] = (fact_rec[i - 1] * rec[i]) % mod;
  }
}

long combmod(long n, long k, long mod) {
  return (((fact[n] * fact_rec[k]) % mod) * fact_rec[n - k]) % mod;
}

long vnummod(long n, long k, long mod) {
  long sum = 0;
  long lim = (n - 1 < k) ? n - 1 : k;
  for (long m = 0; m <= lim; m++) {
    long t = combmod(n, m, mod);
    t = (t * t) % mod;
    t = (t * (n - m)) % mod;
    sum = (sum + t) % mod;
  }
  sum = (sum * rec[n]) % mod;
  return sum;
}
  

int main() {
  long n, k;
  cin >> n >> k;
  long mod = pow(10, 9) + 7;
  factini(n, mod);
  cout << vnummod(n, k, mod) << endl;
  return 0;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector <int> h(n), dp(n+1, 1e9+7);
    for (int i = 0; i < n; ++i) cin >> h[i];
    dp[0] = 0;
    for (int i = 0; i < n; ++i)
        for (int j : {i+1, i+2})
            if (j < n)
                dp[j] = min(dp[j], dp[i]+abs(h[i]-h[j]));
    cout << dp[n-1] << '\n';
}


Measured memory_bytes: 4000
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll dp[1010][22522];

struct block{
	int w,s;
	ll v;
	bool operator<(const block& rhs){
		return (w+s) < (rhs.w+rhs.s);
	}
};

block b[1010];

int main(void){
	int n,i,j;
	ll ans=0ll;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> b[i].w >> b[i].s >> b[i].v;
	}
	sort(b,b+n);
	for(i=0; i<n; ++i){
		for(j=0; j<22522; ++j){
			dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
		}
		for(j=0; j<=b[i].s; ++j){
			dp[i+1][j+b[i].w] = max(dp[i+1][j+b[i].w],dp[i][j]+b[i].v);
		}
	}
	for(j=0; j<22522; ++j){
		ans = max(ans,dp[n][j]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 176256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin >> n;
  vi D(n);
  rep(i,n)cin >> D[i];
  vi cnt(13,0);
  cnt[0]++;
  rep(i,n){
    cnt[D[i]]++;
  }
  int ans = 0;
  
  srep(c,0,(1<<13)){
    vi v;
    rep(i,13){
      if(cnt[i] > 2){
        print(0);
        return 0;
      }
      else if(cnt[i] == 2){
        v.push_back(i);
        v.push_back(24-i);
      }
      else if(cnt[i] == 1){
        if((c>>i)&1)v.push_back(i);
        else v.push_back(24-i);
      }
    }
    int m = sz(v);
    sort(rng(v));
    v.erase(unique(rng(v)),v.end());
    if(m!=sz(v))continue;
    int tmp = 1001001;
    
    rep(j,m){
      srep(k,j+1,m){
        int d = v[k]-v[j];
        mins(tmp,min(d,24-d));
      }
    }
    maxs(ans,tmp);
  }
  print(ans);
  return 0;
}

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

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

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

  if(S.at(2)==S.at(3)&&S.at(4)==S.at(5)) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;
 
int main()
{
    NFS
 	int t;
 	cin>>t;
 	cout<<(t-1)/2+1;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
K, S = map(int, input().split())
ans = 0
for i in range(K + 1):
    if S - i > 2 * K:
        continue
    elif S - i < 0:
        break
    if S - i > K:
        ans += 2 * K + 1 - S + i
    else:
        ans += S - i + 1
print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string.h>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
using namespace std;
typedef unsigned long long ull;
typedef  long long ll;
#define INF  -0x7f7f7f7f//7f7f7f7f
#define M 2000010
#define N 100010
const ll mod = 1e9 + 7;
ll n,x,y,z,ans;
char s[N];
int main(void){
	scanf("%lld\n",&n);
	for(ll i = 1;i <= n;i++){
		scanf("%c",&s[i]);
		if(s[i]=='R')
		x++;
		else if(s[i]=='G')
		y++;
		else if(s[i]=='B')
		z++;
		for(ll j = 1;j*2+1<=i;j++){
			if(s[i]!=s[i-j]&&s[i]!=s[i-2*j]&&s[i-j]!=s[i-2*j])
			ans--;
		}
	}
	ans +=x*y*z;
	printf("%lld\n",ans);
	return 0;
}

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

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

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

int input_A, input_B = 0;
char input_S[11];
char output[4];
bool size, position = false;
bool numbers = true;

int main(){
	cin >> input_A >> input_B;
	cin >> input_S;
	char output[4] = { 'N', 'o', '\0' };

	int count=0;
	for (int i = 0; sizeof(input_S); i++){
		if (input_S[i] == '\0'){
			break;
		}
		else{
			count++;
		}
	}
	if (count== input_A + input_B + 1){
		size = true;
	}

	for (int j=0; sizeof(input_S); j++){
		if (input_S[j] == '\0'){
			break;
		}
		if (input_S[j] == '-'){
			if (j == input_A){
				continue;
			}
			else{
				numbers = false;
			}
		}
	}
	if (input_S[input_A]=='-'){
		position = true;
	}

	if (size&&position&&numbers){
		output[0] = { 'Y'};
		output[1] = { 'e'};
		output[2] = { 's'};
		output[3] = { '\0' };
	}

	cout << output << endl;

	return 0;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();

			if ("SUN".equals(s)) {
				System.out.println(7);
			} else if("MON".equals(s)) {
				System.out.println(6);
			} else if("TUE".equals(s)) {
				System.out.println(5);
			} else if("WED".equals(s)) {
				System.out.println(4);
			} else if("THU".equals(s)) {
				System.out.println(3);
			} else if("FRI".equals(s)) {
				System.out.println(2);
			} else {
				System.out.println(1);
			}
		}
	}
}


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

using namespace std;

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

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

char dif = 'A' - 'a';
int mod = 1e9 + 7;
ll inf = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, ans = 0;
    cin >> a >> b;
    ll c = b + 1;
    ll x = a % 4, y = c % 4;
    for (ll i = a - x + 1; i <= a; i++){
        ans ^= i - 1;
    }
    for (ll i = c - y + 1; i <= c; i++){
        ans ^= i - 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/**
 *    author:  FromDihPout
 *    created: 2020-05-26
**/

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

const int INF = 1e9;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int min_so_far = INF, cnt = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x < min_so_far) {
            min_so_far = x;
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
nn = int(input())
aa = list(map(int, input().split()))
bb = [0]*(nn-1)
mysum = sum(aa)
mydiff = 0

for i in range(1,nn):
    mydiff += aa[i - 1]
    bb[i-1] = mysum - mydiff

finalsum = 0
for i in range(nn-1):
        finalsum += aa[i]*bb[i]
        finalsum = finalsum % (10**9 + 7)

print(finalsum)

Measured memory_bytes: 94116
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	char[] S, T;
	boolean enable = false;

	Main(BufferedReader in) throws IOException {
		S = in.readLine().toCharArray();
		T = in.readLine().toCharArray();
	}

	boolean isMatch(char[] s, char[] t) {
		boolean isMatch = true;
		for (int i = 0; i < t.length; ++i) {
			if (s[i] != '?' && s[i] != t[i]) {
				isMatch = false;
				break;
			}
		}
		return isMatch;
	}

	void calc() {
		for (int i = S.length - T.length; i >= 0; --i) {
			if (enable) {
				if (S[i] == '?') {
					S[i] = 'a';
				}
			} else {
				if (S[i] == '?' || S[i] == T[0]) {
					enable = isMatch(Arrays.copyOfRange(S, i, i + T.length), T);
					if (enable) {
						// 置き換え
						for (int j = 0; j < T.length; ++j) {
							S[i + j] = T[j];
						}
					}
				}
			}
		}
		if (!enable) {
			return;
		}
		// 最後に残った?を置き換える
		for (int i = 0; i < S.length; ++i) {
			if (S[i] == '?') {
				S[i] = 'a';
			}
		}
	}

	void showResult() {
		if (enable) {
			for (int i = 0; i < S.length; ++i) {
				System.out.print(S[i]);
			}
			System.out.println("");
		} else {
			System.out.println("UNRESTORABLE");
		}
	}
}

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

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define inf 100000000000010
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;

bool isprime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)r=(r*a)%m;
        b = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}

struct CustomCompare
{
    bool operator()(const int& lhs, const int& rhs)
    {
        return lhs < rhs;
    }
};


ll builtin_popcount(ll x)
{
    ll cnt = 0;
    for(ll i=60;i>=0;i--)
    {
        if((1LL<<i)&x)cnt++;
    }
    return cnt;
}

ll addmod(ll a,ll b,ll r)
{
    a%=r;
    b%=r;
    return (a+b)%r;
}
ll mulmod(ll a,ll b,ll r)
{
    a%=r;
    b%=r;
    return (a*b)%r;
}
/*
const int mxn = 5*(1e6) +10;
vi spf(mxn);
void sieve()
{
    for(ll i =0;i<mxn;i++)spf[i]  = i;
    for(ll i=2;i<mxn;i+=2)spf[i] = 2;
    for(ll i = 3;i*i<mxn;i++)
    {
        if(spf[i]==i)
        {
            for(ll j = i*i;j<mxn;j+=i)
            {
                if(spf[j]==j)spf[j] = i;
            }
        }
    }
}
*/

ll n,m;
vvi g;
vector<bool>vis;
ll dfs(ll src)
{
    //cout<<src<<endl;
    vis[src] = true;
    ll cnt = 1;
    for(auto x:g[src])
    {
        if(!vis[x])
        {
            cnt+=dfs(x);
        }
    }
    return cnt;
}
int main(){
//ios_base::sync_with_stdio(false);
//cin.tie(0);cout.tie(0);
cin>>n>>m;
g=vvi(n);
set<pi>st;
rep(i,0,m)
{
    ll u,v; cin>>u>>v;
    --u,--v;
    if(st.find({u,v})==st.end())
    {
        g[u].pb(v);
        g[v].pb(u);
        st.insert({u,v});
        st.insert({v,u});
        //cout<<u<<" "<<v<<endl;
    }
}
vis = vector<bool>(n,false);
ll ans = 1;
rep(i,0,n)
{
    if(!vis[i])
    {
        //cout<<i<<endl;
        ans = max(ans,dfs(i));
    }
}
//if(m==0)ans = 0;
cout<<ans<<"\n";
return 0;
}
/*
1
4
1 2
2 3
3 4
2
2 2
*/


Measured memory_bytes: 48596
import sys
import bisect
import math
input = sys.stdin.readline
N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))

A.sort()
F.sort(reverse=True)

B = [(A[i]*F[i], F[i]) for i in range(N)]
B.sort(reverse=True)
L = 0
R = B[0][0]
if sum(A) <= K:
    print(0)
    exit(0)
while(1):
    ans = (L+R) // 2
    flag = True
    tmp = 0
    for i in range(N):
        tmp += math.ceil(max(B[i][0] - ans, 0) / B[i][1])
        if tmp > K:
            flag = False
            break
    if flag:
        R = ans
    else:
        L = ans
    if L == R or L+1 == R:
        print(R)
        break


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

using namespace std;

int main(){

  int x, y;
  //FILE *fp, *op;
  
  // fp = fopen("input.txt","r");
  // op = fopen("output.txt","w");

  while(1){

    //fscanf(fp,"%d %d",&y,&x);
    scanf("%d %d",&y,&x);
    if(y == 0 && x == 0) break;

    int data[y][x];

    for(int i = 0; i < y; i++){
      for(int j = 0; j < x; j++){
	//fscanf(fp,"%d",&data[i][j]);
	scanf("%d",&data[i][j]);
      }
    }
    int sum[x];
    int sub[x];
    for(int i = 0; i < x; i++) sum[i] = 0;

    for(int i = 0; i < x; i++){
      for(int j = 0; j < y; j++){
	sum[i] += data[j][i];
      }
    }
    for(int i = 0; i < x; i++){
      sub[i] = sum[i];
    }

    sort(sum,sum+x);
    reverse(sum,sum+x);

    for(int i = 0; i < x; i++){
      for(int j = 0; j < x; j++){
	if(sum[i] == sub[j]){
	  sub[j] = -1;
	  //fprintf(op,"%d",j+1);
	  printf("%d",j+1);
	  break;
	}
      }
      if(i != x-1) printf(" ");
    }
    //fprintf(op,"\n");
    printf("\n");

  }
  // fclose(fp);
  //fclose(op);
  
  return 0;
}

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

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

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

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int n, p[100];
    int c = 0;
    cin >> n;
    REP(i, n)
    {
        cin >> p[i];
        c += p[i] != i + 1;
    }

    if (c == 2 || c == 0)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    int no = 0;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<list>
using namespace std;
constexpr auto MOD = 1000000007;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VLL;

int d;

long long mod(const long long &a) {
   if (a >= 0)return a % 1000000007;
   return 1000000007 - (-a) % 1000000007;
}
int mod(const int &a) {
   if (a >= 0)return a % 1000000007;
   return 1000000007 - (-a) % 1000000007;
}

int main() {
   string s;
   cin >> s >> d;
   int k = s.size();
   vector<vector<vector<ll>>> dp(k + 1, vector<vector<ll>>(2, vector<ll>(d, 0)));//i桁まで確定、K以下?、%D
   dp[k][0][0] = 1;
   for (int i = k - 1; i >= 0; i--)
   {//s[i]-'0'でその桁の大きさを取り出せる
	  for (int j = 0; j < 2; j++)
	  {
		 for (int p = 0; p < d; p++)
		 {
			if (!dp[i + 1][j][p])continue;//dp[i+1][j][p]をどこに加算するか?
			for (int l = 0; l <= 9; l++)//i桁目の数
			{
			   if (!j&&l == s[k - i - 1] - '0')dp[i][j][(l + p) % d] = mod(dp[i][j][(l + p) % d] + dp[i + 1][j][p]);
			   if (!j&&l < s[k - i - 1] - '0')dp[i][1][(l + p) % d] = mod(dp[i][1][(l + p) % d] + dp[i + 1][j][p]);
			   if (j)dp[i][j][(l + p) % d] = mod(dp[i][j][(l + p) % d] + dp[i + 1][j][p]);
			}
		 }
	  }
   }
   cout << mod(dp[0][1][0] + dp[0][0][0] - 1 + MOD) << endl;
   cin >> s;
}

Measured memory_bytes: 17024
A,B=map(int,input().split())
S=input()
F=S[:A]
B=S[A+1:]
Key=True
if S.count('-')!=1: Key=False
if F.isdigit()==False: Key=False
if B.isdigit()==False: Key=False
if Key==True: print('Yes')
else: print('No')

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
typedef long long ll;
int H,W;
ll dp[1010][1010] = {},inf = 1e9+7;
char F[1010][1010];

int main(){
	cin >> H >> W;
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			cin >> F[i][j];
		}
	}
	dp[1][1] = 1;
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			if(i*j==1) continue;
			if(F[i][j]!='#') dp[i][j] = (dp[i-1][j]+dp[i][j-1])%inf;
		}
	}
	cout << dp[H][W] << endl;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
ll n,m,k;
set<PII> st;
int r[300010],c[300010];
int mr,mc; 
vector<int> v1,v2;
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for (int i=0;i<k;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		st.insert(MP(x-1,y-1));
		r[x-1]++,c[y-1]++;
	}
	mr=*max_element(r,r+n),mc=*max_element(c,c+m);
	for (int i=0;i<n;i++) if (r[i]==mr) v1.push_back(i);
	for (int i=0;i<m;i++) if (c[i]==mc) v2.push_back(i);
	bool fl=1;
	if (v1.size()*v2.size()<=k)
	{
		for (int i=0;i<v1.size();i++)
			for (int j=0;j<v2.size();j++)
				fl&=(*st.lower_bound(MP(v1[i],v2[j]))==MP(v1[i],v2[j]));
	} 
	else fl=0;
	printf("%d",mr+mc-fl);
	return 0;
}

Measured memory_bytes: 23760
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <utility>
#include <stdexcept>
#include <algorithm>
#include <vector>
#include <string.h>
#include <string>

using namespace std;
#define  rep(i,n) for(int i=0;i<n;i++)
#define  rrep(i,n) for(int i=n;i>0;i--)
#define  REP(i,a,b) for(int i=a;i<b;i++)
typedef long long int lld;
typedef vector<lld> vl;
typedef vector<int> vi;
typedef vector<string> vs;


//int arr[N]
////sort(arr,arr +N)
//vector <int> hoge
////sort(hoge.begin(),hoge.end());
///min_element(hoge.begin(),hoge.end();　最小値　　　最大値はmax_element();


int map[100][100];
vi cl(1000);
vi ol(1000);


void print(int n);
void next(int locate);

int main() {
	int k,n;
	string s,tmp;
	 cin>>n>>s>>k;
	 string a;
	 a=s[k-1];
	 rep(i,n){
	 	tmp=s[i];
	 	if(tmp!=a){
	 		cout<<"*";
	 	}
	 	else
	 		cout<<s[i];
	 }
	 return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std ;
int main(int argc, char** argv) {
	string str ;
	cin >> str ;
	int len = str.size() ;
	int cntt = 0 ;
	int cnts = 0 ;
	int cntall = 0 ;
	int bank ;
	for ( int i = 0 ; i < len ; i++ ) {
		if ( str[i] == 'S' ) {
			cnts += 1 ;
		}
		else if ( str[i] == 'T' ) {
			if ( cntt == cnts ) {
				cntall += 1 ;
			}
			if ( cnts > cntt ) {
				cntt += 1 ;
			}
		}
	}
	cout << cntall * 2 ;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,e) for(int i=s;i<=e;++i)
#define REP(i,s,e) for(int i=s;i>=e;--i)

string s;

int main(){
	int sum=0;
	cin>>s;
	if(s[0]=='C') sum++;
	if(s[1]=='O') sum++;
	if(s[2]=='D') sum++;
	if(s[3]=='E') sum++;
	if(s[4]=='F') sum++;
	if(s[5]=='E') sum++;
	if(s[6]=='S') sum++;
	if(s[7]=='T') sum++;
	if(s[8]=='I') sum++;
	if(s[9]=='V') sum++;
	if(s[10]=='A') sum++;
	if(s[11]=='L') sum++;
	if(s[12]=='2') sum++;
	if(s[13]=='0') sum++;
	if(s[14]=='1') sum++;
	if(s[15]=='6') sum++;
	cout<<16-sum<<endl;
	return 0;
}


Measured memory_bytes: 256
n,m = list(map(int, input().split()))
arr = [list(map(int, input().split())) for _ in range(m)]
from collections import defaultdict
city = defaultdict(list)

for road in arr:
  city[road[0]].append(road[1])
  city[road[1]].append(road[0])

for i in range(n):
  print(len(city[i+1]))

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

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final double[] doubles = new double[n];
        for (int i = 0; i < doubles.length; i++) {
            doubles[i] = scanner.nextDouble();
        }

        Arrays.sort(doubles);
        double res = doubles[0];
        for (int i = 1; i < n; i++) {
            res = (res + doubles[i]) / 2;
        }

        System.out.println(res);
    }
}


Measured memory_bytes: 22484
import java.util.*;

public class Main {
	static final long MOD = 1000000007;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] mount = new int[n];
		int[] arr = new int[n];
		boolean[] ok = new boolean[n];
		int prev = 0;
		for (int i = 0; i < n; i++) {
			mount[i] = sc.nextInt();
			if (mount[i] > prev) {
				ok[i] = true;
			}
			prev = mount[i];
		}
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		prev = 0;
		for (int i = n - 1; i >= 0; i--) {
			if (arr[i] > prev) {
				if ((ok[i] && arr[i] != mount[i]) || !ok[i] && arr[i] > mount[i]) {
					System.out.println(0);
					return;
				}
				ok[i] = true;
				mount[i] = arr[i];
			} else {
				if (ok[i] && arr[i] < mount[i]) {
					System.out.println(0);
					return;
				}
				mount[i] = Math.min(arr[i], mount[i]);
			}
			prev = arr[i];
		}
		long total = 1;
		for (int i = 0; i < n; i++) {
			if (!ok[i]) {
				total *= mount[i];
				total %= MOD;
			}
		}
		System.out.println(total);
	}
}


Measured memory_bytes: 86484
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 10;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif 

vvi es;
vi ns;

void dfs(int n, int p) {
    if (p >= 0) ns[n] += ns[p];

    for(int i : es[n]) {
        if (i == p) continue;
        dfs(i, n);
    }
}


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

    int N, Q; cin >> N >> Q;
    vi A(N - 1), B(N - 1);
    REP(i, N - 1) {
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
    }

    vi P(Q), X(Q);
    REP(i, Q) {
        cin >> P[i] >> X[i];
        P[i]--;
    }

    es = vvi(N);
    REP(i, N - 1) {
        es[A[i]].push_back(B[i]);
        es[B[i]].push_back(A[i]);
    }

    ns = vi(N, 0);
    REP(i, Q) {
        ns[P[i]] += X[i];
    }

    dfs(0, -1);

    cout << ns[0];
    FOR(i, 1, N) cout << " " << ns[i];
    cout << endl;

    return 0;
}

Measured memory_bytes: 26624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 998244353;

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

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

VI v(202020);
ll cal(ll i) {
    if (i >= 1)
        return v[i];
    else
        return 0;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i, j;
    int n, k;
    cin >> n >> k;
    int l[k], r[k];
    for (i = 0; i < k; i++) cin >> l[i] >> r[i];
    v[1] = 1;
    for (i = 2; i <= n; i++) {
        v[i] = v[i - 1];
        for (j = 0; j < k; j++) {
            v[i] = v[i] + mod + cal(i - l[j]) - cal(i - r[j] - 1);
            v[i] %= mod;
        }
    }
    cout << (v[n] + mod - v[n - 1]) % mod << endl;
}

Measured memory_bytes: 4700
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scn=new Scanner(System.in);
        int n= scn.nextInt();
        String buf=String.valueOf(n);
        String answer="Yes";
        int total=0;
        for(int i=0;i<buf.length();i++){
            total+=Character.getNumericValue(buf.charAt(i));
        }
        if(n%total!=0) answer="No";
        System.out.println(answer); 
    }
}

Measured memory_bytes: 22612
// B - Christmas Eve Eve
// https://atcoder.jp/contests/abc115/tasks/abc115_b

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

fn main() {
    let n: u64 = read_number();
    let mut v: Vec<u64> = Vec::new();
    for _i in 0..n {
        v.push(read_number());
    }

    let ans = solve(v);
    println!("{}", ans);
}

fn read_number() -> u64 {
    let mut in_str = String::new();
    stdin().read_line(&mut in_str).ok();
    let num = u64::from_str(&in_str.trim_right()).expect("error parsing input");

    num
}

fn solve(ps: Vec<u64>) -> u64 {
    let mut sum = 0;
    let mut biggest = 0;
    for p in ps {
        if p > biggest {
            biggest = p;
        }
        sum += p;
    }
    sum -= biggest / 2;

    sum
}

#[test]
fn test_solve() {
    let v1 = vec![4980, 7980, 6980];
    assert_eq!(solve(v1), 15950);

    let v2 = vec![4320, 4320, 4320, 4320];
    assert_eq!(solve(v2), 15120);
}


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

using namespace std;

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

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

  int ans = 0;
  while(true) {
    bool ok = true;

    for(int i = 0; i < n; i++) {
      if(a[i] % 2 == 0) a[i] /= 2;
      else {
	ok = false;
	break;
      }
    }

    if(!ok) {
      cout << ans << endl;
      return 0;
    }

    ans++;
  }

  cout << ans << endl;
  
    

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
const ll INF = 1LL << 60;

int main(){
	char x, y;
	cin >> x >> y;
	if(x-'A' < y-'A') puts("<");
	else if (x-'A' == y-'A') puts("=");
	else puts(">");
}


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

#define io(F) string t_="";ifstream fin(t_+F+".in");ofstreamfout(t_+F+".out")
#define qio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
#define setm(A, B, C) if(C) A = min(A, B); else A = max(A, B)
#define graph unordered_map<int, unordered_set<int>>
typedef long long ll;

int main() {
	qio; string s; cin >> s;
	if(count(s.begin(), s.end(), '7')) println("Yes");
	else println("No");
}


Measured memory_bytes: 3600
using System;

public class B
{
	public static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		int[] mochi = new int[n];
		for(int i = 0; i < n; i++)
		{
			mochi[i] = int.Parse(Console.ReadLine());
		}
		Array.Sort(mochi);
		int count = 1;
		for(int i = 1; i < n; i++)
		{
			if(mochi[i - 1] < mochi[i])
			{
				count++;
			}
		}
		Console.WriteLine(count);
	}
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define m 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
int main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll x,i,temp;
	cin>>x;
	queue<ll>q;
	for(i=1;i<=9;++i)
		q.push(i);
	for(i=0;i<x;++i)
	{
		temp = q.front();
		if(temp % 10 != 0) q.push(10*temp + temp%10 - 1);
		q.push(10*temp + temp%10);
		if(temp % 10 != 9) q.push(10*temp + temp%10 + 1);
		q.pop();
	}
	cout<<temp;
	return 0;
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

//実行部
void Main()
{
  ll n; cin >> n;
  vll l(n); rep(i, n) cin >> l[i];
  sort(all(l));
  ll flag = 0;
  rep(i, n - 1)
  {
    flag += l[i];
  }
  if(l[n - 1] < flag) fin("Yes");
  else fin("No");
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


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


void solve(long long N, long long K, std::string S){
    if(S[K-1] == 'A') S[K-1] = 'a';
    else if(S[K-1] == 'B') S[K-1] = 'b';
    else if(S[K-1] == 'C') S[K-1] = 'c';
    cout << S << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::string S;
    std::cin >> S;
    solve(N, K, S);
    return 0;
}


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

re_ans = 0
for i in range(1, n):
    ans = 0
    lis = []
    t = s[:i]
    u = s[i:]
    for j in range(len(t)):
        if t[j] in u and t[j] not in lis:
            ans += 1
            lis.append(t[j])
        if re_ans < ans:
            re_ans = ans
print(re_ans)


Measured memory_bytes: 3060
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<complex>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second

int n,m;

struct E {
	int d;
	int index;
};
vector<E> G[100000];
int d[100000];

bool dfs(int i,int dis) {
	if(d[i] > -2000000000) {
		return d[i] == dis;
	}

	d[i] = dis;

	bool ret = true;
	REP(j,G[i].size()) {
		ret = (ret && dfs(G[i][j].index,dis + G[i][j].d));
	}
	return ret;
} 

int main(){
	cin >> n >> m;
	REP(i,m) {
		int l,r,dis;
		cin >> l >> r >> dis;

		l--;r--;
		G[l].pb((E){dis,r});
		G[r].pb((E){-dis,l});
	}
	REP(i,n) {
		d[i] = -2000000000;
	}

	REP(i,n) {
		if(d[i] <= -2000000000) {
			if(!dfs(i,0) ) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 12032
//解説&コピペAC
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll n, m;
	string s, t;
	cin >> n >> m >> s >> t;

	ll k = __gcd(n, m);
	for (ll i = 0, j = 0; i < n && j < m; i += n / k, j += m / k) {
		if (s[i] != t[j]) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << n * m / k << endl;
}


Measured memory_bytes: 3768
#include <cstdio>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

constexpr int MAX_N = 10000;

int H, W;
int N;
int a[MAX_N];
int ans[101][101];

int main()
{
  scanf( "%d%d", &H, &W );
  scanf( "%d", &N );
  rep( i, N )
    scanf( "%d", a+i );

  int col = 0, row = 0;
  int p = 0, dir = 1;

  while( p < N )
  {
    ans[row][col] = p+1;
    col += dir;
    --a[p];
    if( !a[p] )
      ++p;

    if( col == W )
      --col, ++row, dir *= -1;
    if( col == -1 )
      ++col, ++row, dir *= -1;
  }

  rep( i, H ) rep( j, W )
    printf( "%d%c", ans[i][j], j==W-1?'\n':' ' );

  return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  Atcoder1
//
//  Created by Hamske on 2020/09/17.
//  Copyright © 2020 Author. All rights reserved.
//

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>


using namespace std;

//#define pb push_back
//#define mp make_pair
//
//#define F first
//#define S second

typedef long long ll;

#define rept(_i,iv,n,type) for(type _i=(type)(iv);_i<(type)(n);++_i)
//#define repi(_i,iv,n) rept(_i,iv,n,int)
//#define repl(_i,iv,n) rept(_i,iv,n,ll)

#define rept0(_i,n,type) rept(_i,0,n,type)
#define repi0(_i,n) rept(_i,0,n,int)
#define repl0(_i,n) rept(_i,0,n,ll)

//#define repst(_i,iv,n,type) for(type _i=iv;_i<=(type)(n);++_i)
//#define repsi1(_i,n) repst(_i,1,n,int)

#define REPT(_i,iv,_l,n,type) for(type _i=(type)(iv),_l=(type)(n);_i<_l;++_i)
//#define REPI(_i,iv,_l,n) REPT(_i,iv,_l,n,int)
//#define REPL(_i,iv,_l,n) REPT(_i,iv,_l,n,ll)
//
#define REPT0(_i,_l,n,type) REPT(_i,0,_l,n,type)
#define REPI0(_i,_l,n) REPT(_i,0,_l,n,int)
#define REPL0(_i,_l,n) REPT(_i,0,_l,n,ll)


//#define rrept(_i,x,e,type) for(type _i=((type)(x)-1);_i>=e;--_i)
//
//#define rrept0(_i,x,type) rrept(_i,x,0,type)
//
//#define RREPT(_i,x,_e,e,type) for(type _i=((type)(x)-1),_e=(type)(e);_i>=_e;--_i)
//
//#define RREPT0(_i,x,_e,type) RREPT(_i,x,_e,0,type)
//
//#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

//#define all(x) (x).begin(),(x).end()
#define REPV(v,_itr,_end) for(auto _itr=(v).begin(),_end=(v).end();_itr!=_end;++_itr)
#define REPVC(v,_itr,_end) for(auto _itr=(v).cbegin(),_end=(v).cend();_itr!=_end;++_itr)

#define td typedef
//#define tds(stl,type,name) typedef stl<type > name;
#define tdv(type,name) typedef vector<type > name;


typedef vector<bool> vb;
typedef vector<vb > vvb;
typedef vector<int> vi;
typedef vector<vi > vvi;
typedef vector<ll> vll;
//typedef vector<vll > vvll;

void dfs(int idx,vb &used, const vvi &tree, vi &ctr,const vi &plus,const int parCtr){
    ctr[idx]=parCtr+plus[idx];
    used[idx]=true;
    REPI0(i, l, tree[idx].size()){
        if(!used[tree[idx][i]]){
            dfs(tree[idx][i], used, tree, ctr, plus,ctr[idx]);
        }
    }
}

int main(int argc, const char * argv[]) {
    int N,Q;
    cin>>N>>Q;
    
    vvi tree(N);
    repi0(i, N-1){
        int a1,b1;
        cin>>a1>>b1;
        --a1;
        --b1;
        tree[a1].push_back(b1);
        tree[b1].push_back(a1);
    }
    vi plus(N,0);
    repi0(i, Q){
        int p1,x1;
        cin>>p1>>x1;
        --p1;
        plus[p1]+=x1;
    }
    
    vi ctr(N,0);
    vb used(N,false);
    dfs(0, used, tree, ctr, plus, 0);
    repi0(i, N){
        if(i!=0){
            cout<<" ";
        }
        cout<<ctr[i];
    }
    cout<<endl;
    
    return 0;
}


Measured memory_bytes: 31128
unittest
{
//	assert( [ "needed" ].parse.expand.solve == "2 5" );
	assert( [ "needed" ].parse.expand.solve == "2 3" );
	assert( [ "atcoder" ].parse.expand.solve == "-1 -1" );
}



import std.conv;
import std.format;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front.to!( dchar[] );
	return tuple( s );
}

auto solve( dchar[] s )
{
	// アンバランスな文字列には必ず "aa" か "aba" が含まれるので2パターンだけチェックすればよい
	for( auto i = 0L; i + 1 < s.length; i++ )
	{
		if( s[ i ] == s[ i + 1 ] ) return format( "%s %s", i + 1, i + 2 );
	}
	for( auto i = 0L; i + 2 < s.length; i++ )
	{
		if( s[ i ] == s[ i + 2 ] ) return format( "%s %s", i + 1, i + 3 );
	}
	return "-1 -1";
}


Measured memory_bytes: 920