akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

int main()
{
    ll N;
    cin >> N;
    vector<vector<pair<ll, ll>>> a(N);

    for (int i = 0; i < N; i++)
    {
        ll A;
        cin >> A;
        for (int j = 0; j < A; j++)
        {
            ll x, y;
            cin >> x >> y;
            --x;
            a[i].push_back(make_pair(x, y));
        }
    }
    ll ans = 0;
    for (int bit = 0; bit < (1 << N); bit++)
    {
        // bitが立っている時正直者
        bool flag = true;
        ll cnt = 0;
        for (int i = 0; i < N; i++)
        {
            if (bit & (1 << i))
            {
                cnt++;
                for (auto &&j : a[i])
                {
                    if (j.second == 1)
                    {
                        if (bit & (1 << j.first))
                        {
                        }
                        else
                        {
                            flag = false;
                        }
                    }
                    else
                    {
                        if (bit & (1 << j.first))
                        {
                            flag = false;
                        }
                    }
                }
            }
        }
        if (flag)
        {
            ans = max(ans, cnt);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;

int main(){
	int N;
	int num[100000];
	for(int i=0;i<100000;i++){
		num[i] = 0;
	}

	scanf("%d",&N);
	for(int i=0;i<N;i++){
		int A;
		scanf("%d",&A);
		num[A]++;
	}

	bool ok = true;
	if(N%2==0){
		for(int i=1;i<N;i+=2){
			if(num[i]!=2){
				ok = false;
			}
		}
	}else{
		if(num[0]!=1) ok = false;
		for(int i=2;i<N;i+=2){
			if(num[i]!=2){
				ok = false;
			}
		}
	}

	if(ok){
		long long ans = 1;
		for(int i=0;i<N/2;i++){
			ans *= 2;
			ans %= 1000000000+7;
		}
		printf("%lld\n",ans);
	}else{
		printf("0\n");
	}

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;

int counto = 0;
int count = 0;

for(int i=0;i < s.size();i++){
    if (s.at(i) == 'o'){
        counto++;
    }
}

int num = 15-s.size();

if((num+counto) >= 8){
    cout << "YES" << endl;
}else{
    cout << "NO" << endl;
}

return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using v = vector<T>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

inline ll inl() {
    ll x;
    cin >> x;
    return x;
}

inline string ins() {
    string x;
    cin >> x;
    return x;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        ll n = inl();
        vl a(n);

        rep(i, n) cin >> a[i];

        deque<ll> dq;
        rep(i, n) {
            ll idx = lower_bound(all(dq), a[i]) - dq.begin();
            if (idx == 0) dq.push_front(a[i]);
            else dq[idx - 1] = a[i];
        }
        cout << dq.size() << endl;
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 1792
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str,sub;

       cin>>str>>sub;

       n=str.size();

       ans=sub.size();

         for(i=0; i+sub.size()<=n; i++)
         {

             cnt=0;


              for(j=0; j<sub.size(); j++)
                if(str[j+i]!=sub[j])cnt++;

              ans=min(ans,cnt);
         }

         cout<<ans<<endl;


}



Measured memory_bytes: 3620
N, K = map(int, input().split())
H = list(map(int, input().split()))
INF = float('inf')
dp = [INF]*N
dp[0] = 0

for i in range(N):
    for j in range(1, K+1):
        if i+j > N-1:
            break
        dp[i+j] = min(dp[i+j], dp[i]+abs(H[i+j]-H[i]))
print(dp[N-1])


Measured memory_bytes: 55136
#include <stdio.h>

int main( void ) {
  int sec,h,m,s;
  scanf( "%d", &sec );
  h = sec / 3600;
  m = ( sec % 3600 ) / 60;
  s = sec % 60;
  printf( "%d:%d:%d\n", h, m, s );

  return 0;
}

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

/*int yakusucount(int n)
{
    int count = 1, icou;
    for(int i = 2; i <= n; i++){
        icou = 0;
        while(n % i == 0){
            icou += 1;
            n /= i;
        }
        count *= icou + 1;
    }
    return count;
}*/

int main()
{
    int count[1001] = {0};
    int n;
    long long ans = 1;
    const long long m = pow(10, 9) + 7;
    cin >> n;
    for(int i = 2; i <= n; i++){
        int k = i;
        for(int j = 2; j <= i; j++){
            while(k % j == 0){
                count[j] += 1;
                k /= j;
            }
        }
    }
    for(int i = 1; i <= n; i++){
       ans = (ans * (count[i] + 1)) % m;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <complex>

using namespace std;

int main() {
	int d,n;
  int t = 1;
  int ans = 0;
	
	cin >> d >> n; 


  for (int i = 0; i < d; i++) {
    t *= 100;
  }

  for (int i = 0; i < n; i++) {
    if (i == 99) {
      ans += t;
    }

    ans += t;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A,B,C;
		A = sc.nextInt();
		B = sc.nextInt();
		C= sc.nextInt();
		System.out.println(C+" "+A+" " +B);
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f
#define pi 3.1415926535898
using namespace std;
const int mod=1e9+7;
const int N=1e6+10;
ll n,m;
char str[N];
ll dp[N],p[N];
ll pre[N];
void ps(int x)
{
    if(pre[x]==-1)
    {
        cout<<x;
        return ;
    }
    ps(pre[x]);
    cout<<" "<<x-pre[x];
}
int main()
{
    memset(pre,-1,sizeof(pre));
    cin>>n>>m;
    cin>>str;
    int s=1,e=0;
    for(int i=0; i<=m; i++)
    {
        if(str[i]=='0')
            dp[i]=1;
        else
        {
            dp[i]=inf;
        }
        while(s<=e&&dp[i]<dp[p[e]])
            e--;
        p[++e]=i;
    }
    s++;
    for(int i=m+1; i<=n; i++)
    {
        dp[i]=inf;
        if(str[i]=='0')
        {
            dp[i]=min(dp[p[s]]+1,dp[i]);
            if(!dp[i]!=inf)
                pre[i]=p[s];
        }
        while(s<=e&&dp[i]<dp[p[e]])
            e--;
        p[++e]=i;
        while(s<=e&&p[s]<i+1-m)
            s++;
    }
    if(dp[n]==inf)
        cout<<-1<<endl;
    else
        ps(n);
    return 0;
}


Measured memory_bytes: 15984
#include<bits/stdc++.h>
using namespace std;
int N;
int s[100];
char t[100][10];
int u[100],v[100],w[100];

int num[1000];

int s2i(string str){
  stringstream ss;
  ss<<str;
  int res;
  ss>>res;
  return res;
}

int change(int x){
  if(0<=x){
    return x;
  }else{
    return num[-x];
  }
}

void setvalue(int x,int y){
  assert( x<0 );
  num[-x]=y;
}

int main(){

  set<char> st;
  map<int,int> lp;  
  scanf("%d",&N);
  for(int i=0;i<N;i++){
    scanf("%d",&s[i]);
    assert( lp.count(s[i]) == 0 );
    lp[ s[i] ] = i;
    
    scanf("%s",t[i]);
    char a[20],b[20],c[20];
    
    if(t[i][0]=='A'){
      scanf("%s %s %s",a,b,c);
      if('a'<=a[0]&&a[0]<='z')u[i]=-1*(int)a[0],st.insert(a[0]);
      else assert(0);
      
      if('a'<=b[0]&&b[0]<='z')v[i]=-1*(int)b[0],st.insert(b[0]);
      else v[i]=s2i(b);

      if('a'<=c[0]&&c[0]<='z')w[i]=-1*(int)c[0],st.insert(c[0]);
      else w[i]=s2i(c);

    }else if(t[i][0]=='S'&&t[i][1]=='U'){
      scanf("%s %s %s",a,b,c);
      if('a'<=a[0]&&a[0]<='z')u[i]=-1*(int)a[0],st.insert(a[0]);
      else assert(0);
      
      if('a'<=b[0]&&b[0]<='z')v[i]=-1*(int)b[0],st.insert(b[0]);
      else v[i]=s2i(b);

      if('a'<=c[0]&&c[0]<='z')w[i]=-1*(int)c[0],st.insert(c[0]);
      else w[i]=s2i(c);

      
    }else if(t[i][0]=='S'&&t[i][1]=='E'){
      scanf("%s %s",a,b);
      if('a'<=a[0]&&a[0]<='z')u[i]=-1*(int)a[0],st.insert(a[0]);
      else assert(0);

      if('a'<=b[0]&&b[0]<='z')v[i]=-1*(int)b[0],st.insert(b[0]);
      else v[i]=s2i(b);
      
    }else if(t[i][0]=='I'){
      scanf("%s %s",a,b);
      if('a'<=a[0]&&a[0]<='z')u[i]=-1*(int)a[0],st.insert(a[0]);
      else assert(0);

      if('a'<=b[0]&&b[0]<='z')assert(0);
      else v[i]=s2i(b);

      
    }else if(t[i][0]=='H'){
      
    }else assert(0);
  }

  int mx=30000000;
  int p=0,cc=0;
  while(cc < mx){
    
    if(t[p][0]=='A'){
      int value=change(v[p])+change(w[p]);
      if(value<0 || 16<=value)break;
      setvalue(u[p],value);
      p++;
    }else if(t[p][0]=='S'&&t[p][1]=='U'){
      int value=change(v[p])-change(w[p]);
      if(value<0 || 16<=value)break;
      setvalue(u[p],value);
      p++;
    }else if(t[p][0]=='S'&&t[p][1]=='E'){
      int value=change(v[p]);
      if(value<0 || 16<=value)break;
      setvalue(u[p],value);
      p++;
    }else if(t[p][0]=='I'){
      int value=change(u[p]);
      if(value > 0 ){
        int next=change(v[p]);
        if( lp.count( next ) == 0 )break;
        p=lp[next];
      }else{
        p++;
      }


    }else if(t[p][0]=='H'){
      break;
    }else assert(0);

    
    cc++;
    if(p==N)break;
  }
  
  if(cc<mx){
    set<char> :: iterator it;
    for(it=st.begin();it!=st.end();it++){
      int f=*it;
      printf("%c=%d\n", *it, change(-f) );
    }
  }else{
    printf("inf\n");
  }
  
  return 0;
}

Measured memory_bytes: 3312
n = int(input())
a = list(map(int,input().split()))
count = {}
for i in a:
    if i in count:
        count[i] += 1
    else:
        count[i] = 1

ans = 0
for i in count:
    ans += count[i]*(count[i] - 1) // 2

for i in a:
    if count[i] == 1:
        print(ans)
    else:
        o = count[i]
        pi = ans - o*(o-1)//2
        pi += (o-1)*(o-2)//2
        print(pi)

Measured memory_bytes: 88140
#include<bits/stdc++.h>
using namespace std;
struct matrix{
	long long x,y;
}m[110];
int n;
long long dp[110][110];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&m[i].x,&m[i].y);
	}
	for(int i=1;i<=n;i++){
		dp[i][i]=0;
	}
	for(int l=2;l<=n;l++){
		for(int i=1;i<=n-l+1;i++){
			int j=i+l-1;
			dp[i][j]=1<<20;
			for(int k=i;k<j;k++){
			    dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+m[i].x*m[k].y*m[j].y);
			}
		}
	}
	//cout<<"i: "<<i<<" j: "<<j<<" dp: "<<dp[i][j]<<endl; 
	printf("%lld\n",dp[1][n]);
	return 0;
} 



Measured memory_bytes: 3300
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
  int a,b,k;
  cin >> a >> b >> k;
  set<int> s;
  for(int i = a; i < a + k; i++){
    if(i <= b)s.insert(i);
  }
  for(int i = b; i > b-k; i--){
    if(i >= a)s.insert(i);
  }
  while(!s.empty()){
    int m = *begin(s);
    cout << m << endl;
    s.erase(m);
  }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define SORT(v) sort(all(v))
#define REV(v) sort((v).begin(), (v).end(), greater<int>())
#define INF 1000000007
#define fcout cout << fixed << setprecision(15)
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){std::fill( (T*)array, (T*)(array+N), val );};
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;};



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

  string s, t;
  cin >> s >> t;
  int a = 0;
  rep(i, 3) {
    if(s[i] == t[i]) a++;
  }
	cout << a << endl;
  return 0;
}


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

int main(){
		
	int n;
	cin>>n;
	int dp[n][3];
	for(int i=0;i<n;++i){
		for(int j=0;j<3;++j)
			cin>>dp[i][j];
	}
	
	for(int i=1;i<n;++i){
		dp[i][0] += max(dp[i-1][1],dp[i-1][2]);
		dp[i][1] += max(dp[i-1][0],dp[i-1][2]);
		dp[i][2] += max(dp[i-1][0],dp[i-1][1]);
	}
	
	cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
	return 0;
}


Measured memory_bytes: 4776
#include<bits/stdc++.h>
using namespace std;
#define int long long
int abs(int a,int b){
  int c=max(a,b)-min(a,b);
  return c;
}
int c[10000000];
signed main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int a,b,c,q=0;
  cin>>a>>b>>c;
  for(int i=1;i<=b;i++){
    if(((b*i)+c)%a==0) q=1;
  }
  if(q) cout<<"YES";
  else cout<<"NO";
  cout<<"\n";
  }

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <iomanip>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll

using namespace std;
using Graph = vector<vector<int> >;


map<string, int> Input;

int main() {
  int N; cin >> N;
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    Input[S]++;
  }
  int M; cin >> M;
  for (int i = 0; i < M; i++) {
    string S;
    cin >> S;
    Input[S]--;
  }

  int ans = -1;
  for (auto e: Input) {
    ans = max(ans, e.second);
  }
  if (ans == -1) {
    cout << 0 << endl;
  } else {
    cout << ans << endl;    
  }
}


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;

const int dy[] = {0,0,1,-1};
const int dx[] = {1,-1,0,0};
int pop(int x){
	return __builtin_popcount(x);
}
int fc(int x){
	if(x == 0) return 0;
	int pc = pop(x);
	return fc(x % pc) + 1;
}
int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<int> x(n);
	rep(i,n) x[i] = s[i] - '0';

	// まず、元の数の1の数を数える
	int pc = 0;
	rep(i,n) pc += x[i];

	vector<int> ans(n,0);
	//debug(pc);
	rep(b,2){
		// x[i] == bの時の答えを作る。
		// まず x % npc の値を求める
		int npc;
		if(b == 0) npc = pc + 1;
		else npc  = pc - 1;
		
		int r = 0; // x % npc
		int tmp = 1;
		if(npc <= 0) continue;
		for(int i = n-1; i >= 0; i--){
			r += (x[i] * tmp) % npc;
			r %= npc;
			tmp *= 2; tmp %= npc;
		}
		//debug(r);
		int nr = r;
		tmp = 1;
		for(int i = n-1; i >= 0; i--){
			tmp %= npc;
			if(x[i] != b){
				tmp *= 2;
				continue;
			}
			// 2 ^(n-i) *x[i] をr に足すなり引くなりする
			int nr = r;
			if(b == 0){
				nr += tmp;
				nr %= npc;
			} else {
				nr = (r-tmp+npc) % npc;
			}
			ans[i] = fc(nr) + 1;
			tmp *= 2;
		}
	}
	rep(i,n) cout << ans[i] << endl;
}


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

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif

#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000000
#define ll long long
#define db double
#define str string
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Forrev(i,s,e) for (ll i=(s); i>=(e); i--)
#define all(v) v.begin(),v.end()

#define vll vector<ll>
#define vs vector<string>
#define mapll map<ll,ll>
#define pll pair<ll,ll>
#define initialise(a, x) memset(a, x, sizeof(a))
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll> ,greater<ll>>

#define ff first
#define ss second
#define endl "\n"
#define mp make_pair
const ll mod=1e9 + 7;

ll takemod(ll a) {
    return ((a%mod)+mod)%mod;
}

ll gcd(ll a, ll b) { 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);        
}

ll fast_exp(ll base, ll expo) {
    ll res=1;
    while(expo>0) {
        if(expo&1) res=(res*base)%mod;
        base=(base*base)%mod;
        expo>>=1;}
    return res;
}

ll modinv(ll a) {
    return takemod(fast_exp(takemod(a), mod-2));
}

void solve()
{
    ll n,m;
    cin>>n>>m;

    ll ans=(n*(n-1))/2;
    ans+=(m*(m-1))/2;
    cout<<ans<<endl;
}

signed main() 
{
    fast_cin();
    // #ifndef ONLINE_JUDGE
    // freopen("C:/IO/in.txt", "r", stdin);
    // freopen("C:/IO/out.txt", "w", stdout);
    // #endif
    
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    
    
    return 0;    
}

Measured memory_bytes: 256
#include<stdio.h>
char map[60][60];
int book[60][60];
int black=0;
struct Queue{
   int x;
   int y;
   int step;
};
int front=-1,back=-1;
int main(){
   int h,w;
   int i,j;
   int pop,mx,my;
   int num[4][4]={{1,0},{-1,0},{0,1},{0,-1}};
   struct Queue Q[50000];
   scanf("%d%d",&h,&w);
   getchar();
   for(i=0;i<h;i++){
      for(j=0;j<w;j++){
          scanf("%c",&map[i][j]);
          if(map[i][j]=='#'){
            black++;
          }
      }
      getchar();
   }
   book[0][0]=1;
   back++;
   Q[back].x=0;
   Q[back].y=0;
   Q[back].step=0;
   //printf("1\n");
   while(front!=back){
       front++;
       pop=front;
       for(i=0;i<4;i++){
               mx=Q[pop].x+num[i][0];
               my=Q[pop].y+num[i][1];
               if(mx<0||mx>=h||my<0||my>=w)continue;
               if(book[mx][my]==0&&map[mx][my]=='.'){
                   book[mx][my]=1;
                   back++;
                   Q[back].x=mx;
                   Q[back].y=my;
                   Q[back].step=Q[pop].step+1;
                  // printf("mx=%d  my=%d   step=%d\n",mx,my,Q[back].step);
               }
               if(mx+1==h&&my+1==w){
                   break;
               }
       }
       if(mx+1==h&&my+1==w){
            break;
       }
   }
  // printf("2\n");
   if(mx+1==h&&my+1==w){//成功
       printf("%d\n",h*w-black-Q[back].step-1);
   }
   else{
       printf("-1\n");
   }
    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
march = Array.new(5,0)
n.times do
  name = gets.chomp
  case name[0]
  when "M"
    march[0] += 1
  when "A"
    march[1] += 1
  when "R"
    march[2] += 1
  when "C"
    march[3] += 1
  when "H"
    march[4] += 1
  end
end
ans = 0
i = 0
while i < march.size - 2
  j = i + 1
  while j < march.size - 1
    k = j + 1
    while k < march.size
      ans += march[i] * march[j] * march[k]
      k += 1
    end
    j += 1
  end
  i += 1
end
puts ans

Measured memory_bytes: 14260
S = input()

A = int(S[:2])
B = int(S[2:])

if  1 <= A and A <= 12:
    if  1 <= B and B <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if  1 <= B and B <= 12:
        print("YYMM")
    else:
        print("NA")


Measured memory_bytes: 61364
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	string s; cin>>s;
	int n=s.size();
	rep(i,0,n)cout<<'x';
	
	return 0;
}

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

using namespace std;

int main()
{
  vector<vector<int>> g(3, vector<int>());

  g[0] = {1, 3, 5, 7, 8, 10, 12};
  g[1] = {4, 6, 9, 11};
  g[2] = {2};

  int x, y; cin >> x >> y;

  for (int i = 0; i < 3; ++i) {
    if (find(g[i].begin(), g[i].end(), x) != g[i].end() and
        find(g[i].begin(), g[i].end(), y) != g[i].end()) {
      cout << "Yes";
      return 0;
    }
  }

  cout << "No";
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 5100000;
const int MOD = 1000000007;

int main(){
  ll N,K;cin>>N>>K;
  vector<ll> a(N);
  rep(i,N) cin>>a[i];

  ll amax = 0;
  rep(i,N) amax=max(amax,a[i]);

  ll sum = 0;
  rep(i,N) sum+=a[i];

  if(K>=(sum-amax)){
    cout<<sum<<endl;
    return 0;
  }
  vector<ll> ret;

  ll i,j,k,l;
  for(i=2;i<sum;i++){
    //約数の列挙
    if(i*i > sum) break;
    if(sum%i==0){
      ret.pb(i);
      ret.pb(sum/i);
    }
  }
  sort(ret.begin(),ret.end(),greater<ll>());


  rep(i,ret.size()){
    //約数を大きい順に見ていく

    vector<ll> d;
    rep(j,N){
      if(a[j]%ret[i]!=0){
        d.pb(a[j]%ret[i]);
      }
    }
    sort(d.begin(),d.end());

    ll tmp1  = 0, tmp2 = 0;
    ll x = d.size();
    rep(j,x){
      tmp2 += (ret[i] - d[j]);
    }
    rep(j,x){
      tmp1 += d[j];
      tmp2 -= ret[i] - d[j];
      if(tmp1 == tmp2 and tmp1 <= K){
        cout<<ret[i]<<endl;
        return 0;
      }
    }
  }
  cout<<1<<endl;
}


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

int main() {
    int n;
    cin >> n;
    const int inf = 1 << 30;
    vector<vector<int>> a(n, vector<int>(3)), dp(n,vector<int>(3, -inf));
    rep(i,n) rep(j,3) cin >> a.at(i).at(j);
    dp.at(0) = a.at(0);
    for (int i = 1; i < n; ++i) {
        dp.at(i).at(0) = max(dp.at(i-1).at(1), dp.at(i-1).at(2)) + a.at(i).at(0);
        dp.at(i).at(1) = max(dp.at(i-1).at(2), dp.at(i-1).at(0)) + a.at(i).at(1);
        dp.at(i).at(2) = max(dp.at(i-1).at(0), dp.at(i-1).at(1)) + a.at(i).at(2);
    }
    cout << *max_element(dp.at(n-1).begin(), dp.at(n-1).end()) << endl;
    return 0;
}

Measured memory_bytes: 14340
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	int n;
	cin >>n;
	for(int i=0; i<n; i++){
		char num[2][900];
		int ans[900],up=0,t,l;
		cin >>num[0]>>num[1];
		int a = strlen(num[0]), b = strlen(num[1]), max = (b>a)? b:a, min = (b>a)? a:b;
		for(l=0; l<max; l++){
			if(l<min){t = (int)num[0][a-l-1]+(int)num[1][b-l-1]-48*2+up;}
			else if(a<b){t = (int)num[1][b-l-1]-48+up;}
			else{t = (int)num[0][a-l-1]-48+up;}
			if(t>9){t-=10;up = 1;}
			else{up = 0;}
			ans[l] = t;
		}
		if(up == 1){ans[max] = 1;l++;}
		if(l<=80)for(int m=l-1; m>=0; m--){cout <<ans[m];}
		else{cout<<"overflow";}
		cout <<endl;
	}
	return 0;
}

Measured memory_bytes: 0
a,b,k=map(int,input().split())
list=[]
if k>b-a+1:
    k=b-a+1
for i in range(k):
    print(a+i)
    list.append(a+i)
for i in range(k):
    if not b-k+i+1 in list:
        print(b-k+i+1)

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

#define endl '\n'

void solve(){
    int a,b,h,m; cin >> a >> b >> h >> m;
    double x = 6*m, y = 30*h + 0.5*m, ang;
    int xx = 6*m, yy = 30*h + m/2;
    cout << fixed << setprecision(12);
    if (x == y) cout << abs(b - a);
    else if (m % 2 == 0 && ((xx + 180)%360 == yy || (yy + 180)%360 == xx)) cout << a + b;
    else{
        if (x < y){
            if (x + 180 < y) ang = x + 360 - y;
            else ang = y - x;
        } else{
            if (y + 180 < x) ang = y + 360 - x;
            else ang = x - y;
        }
        ang = ang*acos(-1)/180.0;
        cout << sqrt(a*a + b*b - 2*a*b*cos(ang));
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1; //cin >> t;
    while(t--) solve();
}

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

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  int n;
  cin>>n;
  using P = pair<int, int>;
  vector<vector<P> > G(n);
  for(int i=1;i<n;i++){
    int u,v,w;
    cin>>u>>v>>w;
    G[u].emplace_back(v,w);
    G[v].emplace_back(u,w);
  }

  /*
  auto dfs=[&](auto &&f,int v,int p,int d)->P{
    P res(d,v);
    for(auto e:G[v]){
      int u,c;
      tie(u,c)=e;
      if(u==p) continue;
      chmax(res,f(f,u,v,d+c));
    }
    return res;
  };
  
  int pos=dfs(dfs,0,-1,0).second;
  cout<<dfs(dfs,pos,-1,0).first<<endl;
  */
  
  function<P(int,int,int)> dfs=[&](int v,int p,int d){
    P res(d,v);
    for(auto e:G[v]){
      int u,c;
      tie(u,c)=e;
      if(u==p) continue;
      chmax(res,dfs(u,v,d+c));
    }
    return res;
  };
  
  int pos=dfs(0,-1,0).second;
  cout<<dfs(pos,-1,0).first<<endl;
  
  return 0;
}



Measured memory_bytes: 19196
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    int n; cin >> n;
    string s; cin >> s;

    if(s.size()%2 == 1) { cout << "No\n"; return 0; }

    string t1 = s.substr(0, n/2);
    string t2 = s.substr(n/2, n/2);
    if(t1 == t2) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//System.out.println("a");
		int n = sc.nextInt();
		int[] a = new int[n];
		int count = 0;
		for(int i=0;i<n;i++) {
			//System.out.println("a");
			a[i] = sc.nextInt();
		}
		tp:while(true) {
			for(int i = 0;i<a.length;i++) {
				if((a[i]%2)!=0) {
					break tp;
				}
			}
			for(int i = 0;i<a.length;i++) {
				a[i] = a[i]/2;
			}
			count++;
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace _gnu_pbds;
#define vb __int128
#define ll long long
#define ld long double
#define full(a) a.begin(),a.end()
#define fr(i,a,b) for(ll i = a ; i < b ; i++)
#define stoink stack<ll>
#define quu queue<ll>
#define quee queue<pair<ll,ll>>
#define vec vector <ll>
#define vecd vector<ld>
#define vg vector<vector<ll> >
#define eg vector<pair<ll,ll>>
#define vgw vector<vector<pair<ll,ll> > >
#define pa pair<ll,ll>
#define pb push_back
#define ff first
#define ss second
// #define pre 0.00000000000000000001
#define inf 100000000
#define mod 1000000007
#define endl '\n'
string s;
ll n;
ll dp[3005][3005];
ll pre[3005][3005];
int main()
{	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> n;
    cin >> s;
    memset(pre,0,sizeof(pre));
    pre[1][1] = 1;
    fr(i,2,n+1) {
        fr(j,1,i+1) {
            ll l,r;
            if(s[i - 2] == '<') {
                l = 1;r = j - 1;
            }
            else {
                l = j;
                r = i - 1;
            }
            dp[i][j]=(dp[i][j] + pre[i - 1][r] - pre[i - 1][l -1]) % mod;
            //     fr(k,1,i) {
            //         ll num = k;
            //         if(k == j)
            //             num++;
            //         if((num < j) != (s[i - 2] == '<'))
            //             continue;
            //         dp[i][j] = (dp[i][j] + dp[i - 1][k]) % mod;
            // }
        pre[i][j] = pre[i][j - 1] + dp[i][j];
        }
    }
    ll ans = 0;
    fr(i,1,n+1)
        ans = (ans + dp[n][i]) % mod;
    cout << ans;
    return 0;
}	

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

int main(){
  int k,x;
  cin >> k >> x;
  
  for(int i=x-k+1; i<=x+k-1; i++){
    cout << i << " ";
  }
}

Measured memory_bytes: 256
using System;
using System.Linq;

class C
{
	static void Main()
	{
		Console.ReadLine();
		var a = Console.ReadLine().Split().Select(int.Parse).GroupBy(x => x).SelectMany(g => g.Take(2)).ToArray();
		var n = a.Length;

		var l = new int[n];
		var r = new int[n];
		l[0] = a[0];
		r[n - 1] = a[n - 1];
		for (int i = 1; i < n; i++)
		{
			l[i] = Gcd(l[i - 1], a[i]);
			r[n - 1 - i] = Gcd(r[n - i], a[n - 1 - i]);
		}

		var M1 = Math.Max(r[1], l[n - 2]);
		var M2 = n <= 2 ? 1 : Enumerable.Range(1, n - 2).Max(i => Gcd(l[i - 1], r[i + 1]));
		Console.WriteLine(Math.Max(M1, M2));
	}

	static int Gcd(int x, int y) { for (int r; (r = x % y) > 0; x = y, y = r) ; return y; }
}


Measured memory_bytes: 29020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
  
int main(void){
    int n;
    cin >> n;
    
    int a[100005];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }

    int i = 0;    
    int state[100005] = {0};
    state[0] = 1;
    

    while(state[i] != 2){

        //cout << "while " << i << " " << state[i] << endl;
        
        ++i;
        
        state[i] = a[state[i-1]-1];
        
        //cout << i << " " << a[state[i-1]-1] << " " << state[i] << endl;
        
        if(state[i] == 2) break;
 
        if(state[i] == 1) {
            cout << -1 << endl;
            return 0;
        }       
        
        /*
        for(int j=0; j<i; j++){
            //cout << "for" << endl;
            if(state[i] == state[j]) {
                cout << -1 << endl;
                return 0;
            }
        }
        */
        if(i>n) {
            cout << -1 << endl;
            return 0;
        }
        
           
    }
    
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    string s;
    int key_place,k_len;
    cin>>s>>key_place;
    k_len=key_place;
    vector<int>str_map('z'-'a'+1,0);
    map<string,int>duplication,search_str;
    for(int i=0;i<k_len;i++){
        for(int k=0;k<s.length()-i;k++){
            string key=s.substr(k,i+1);
            if(duplication[key]==0){
                str_map[key[0]-'a']++;//先頭文字によって場合分け
                duplication[key]++;
            }
        }
    }
    char ans;
    int key_num;
    for(key_num=0;key_num<'z'-'a'+1;key_num++){
        if(key_place>str_map[key_num]){
            key_place-=str_map[key_num];
        }
        else{
            ans='a'+key_num;
            break;
        }
    }
    vector<string>s_array;
    for(int i=0;i<k_len;i++){
        for(int k=0;k<s.length()-i;k++){
            string key=s.substr(k,i+1);
            if(key[0]==ans){
                if(search_str[key]==0){
                    s_array.push_back(key);
                    search_str[key]++;
                }
            }
        }
    }
    sort(s_array.begin(),s_array.end());
    cout<<s_array[key_place-1]<<endl;

}

Measured memory_bytes: 2048
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;cin>>s;
  for(int i=0;i<=2;i++){
    if(s[i]==s[i+1]){
      cout<<"Bad"<<endl;
      return 0;
    }
  }
  cout<<"Good"<<endl;
  return 0;
}

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

int main() {
int A,B,C,X ;
    cin >> A >> B >> C >> X ;
int count=0;
  
  for (int i=0; i<=A; i++){
   for (int j=0; j<=B; j++){
    if ((X-500*i-100*j)/50 <=C && X-500*i-100*j>=0)
      count ++;
   }
  }
  cout <<  count << endl;  
}


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

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

map< ll, int > prime_factor(ll n) {
  map< ll, int > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}


int main(){

    ll N;cin>>N;


    ll min_movement = pow(10,13);
    for(ll i=1; i*i <= N ;i++){
        if(N%i==0){
            if(min_movement>i+N/i)min_movement = i+N/i-2;
        }
    }
    cout<<min_movement<<endl;





    return 0;
}

Measured memory_bytes: 256
using System;
using static System.Console;
using static System.Math;
using System.IO;
using System.Collections.Generic;
namespace I_am_the_green_coder{
    class Inonoa{
        static void Main(){
            long[] ab = ILongs();

            long d = 1;
            int ans = 0;
            while(d<ab[1]){
                ans ++;
                d+= ab[0]-1;
            }

            WriteLine(ans);
        }

        static readonly long MOD = 1000000007;

        ///<summary>a_1, a_2, a_3, ...みたいなの</summary>
        static long[] ILongs(){
            string[] s = ReadLine().Split();
            long[] re = new long[s.Length];
            for(long i=0;i<s.Length;i++){
                re[i] = long.Parse(s[i]);
            }
            return re;
        }

        ///<summary>xooxoxoxxoxo...みたいなの</summary>
        static char[] IChars(){
            return ReadLine().ToCharArray();
        }

        ///<summary>n m とかをちょっとはやくかくだけ</summary>
        static string[] IStrings(){
            return ReadLine().Split();
        }

        ///<summary>n行の入力を取ったり</summary>
        static long[][] ILongLongs(long n){
            long[][] re = new long[n][];
            for(long i=0;i<n;i++){
                string[] s = ReadLine().Split();
                re[i] = new long[s.Length];
                for(long j=0;j<s.Length;j++){
                    re[i][j] = long.Parse(s[j]);
                }
            }
            return re;
        }

        ///<summary>n行の文字列を取ったり</summary>
        static char[][] ICharsChars(long n){
            char[][] re = new char[n][];
            for(long i=0;i<n;i++){
                re[i] = ReadLine().ToCharArray();
            }
            return re;
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

class Graph
{
public:
    Graph() {}
    Graph(int n)
    : con(vs32(n, -1))
    {}
    ~Graph() {}

    bool path(int u, int v)
    {
        bool ret;

        int repu = getRep(u);
        int repv = getRep(v);
        if (repu != repv) ret = false;
        else /*if (repu == repv)*/ ret = true;

        return ret;
    }

    void setPath(int u, int v)
    {
        int repu = getRep(u);
        int repv = getRep(v);


        if (repu == repv) return;
        if (con[repu] > con[repv])
        {
            swap(repu, repv);
        }
        con[repu] += con[repv];
        con[repv] = repu;
    }

    int getRep(int u)
    {
        int ret;
        if (con[u] >= 0)
        {
            con[u] = getRep(con[u]);
            ret = con[u];
        }
        else
        {
            ret = u;
        }
        return ret;
    }

    vs32 con;
};

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

    int n;
    cin >> n;

    Graph g(n);
    int m;
    cin >> m;
    int u, v;
    rep (i, m)
    {
        cin >> u >> v;
        g.setPath(u, v);
    }

    int q;
    cin >> q;
    rep (i, q)
    {
        cin >> u >> v;
        if (g.path(u, v))
        {
            cout << "yes\n";
        }
        else
        {
            cout << "no\n";
        }
    }
    return 0;
}



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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>x>>y;
	if(x*y%2) cout<<"Odd"<<endl;
	else cout<<"Even"<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
n = int(input())
ans, a, b = 0, [], []
for _ in range(n):
    x, y = map(int, input().split())
    a.append(x+y)
    b.append([x, y])
num = [x for x in range(n)]
a, a0 = zip(*sorted(zip(a, num)))
a, a0 = list(a), list(a0)

for i in range(n):
    val = a0.pop()
    a.pop()
    if i%2 == 0:
       ans += b[val][0]
    else:
       ans -= b[val][1]
print(ans)


Measured memory_bytes: 46096
import java.util.ArrayList;
import java.util.Scanner;

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 a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		sc.close();

		long[] fact = new long[n];
		long[] ifact = new long[n];
		long mfact = 1;
		long mifact = 1;
		for(int i=1; i<=n; i++){
			mfact *= i;
			mfact %= MOD;
			fact[i-1] = mfact;
			mifact *= inverseElement(i, MOD);
			mifact %= MOD;
			ifact[i-1] = mifact;
		}
		long[][] xfact = new long[n][n];
		for(int i=0; i<n; i++){
			long tfact = 1;
			for(int j=0; j<n; j++){
				tfact *= ifact[i];
				tfact %= MOD;
				xfact[i][j] = tfact;
			}
		}

		// long[][] dp = new long[b-a+2][n+1];
		// for(int i=1; i<b-a+2; i++){
		// 	int mab = i + a - 1;
		// 	for(int j=1; j<n+1; j++){
		// 		dp[i][j] = dp[i-1][j];
		// 		for(int k=c; k<=d; k++){
		// 			int mabcd = mab*k;
		// 			if(mabcd > n) continue;
		// 			long tfact = fact[k-1];
		// 			for(int l=0; l<k; l++){
		// 				tfact *= fact[mab-1];
		// 			}
		// 			if(mabcd == j){
		// 				dp[i][j] += fact[n-1] / tfact;
		// 			}else if(mabcd < j){
		// 				dp[i][j] += dp[i-1][j-mabcd] / tfact;
		// 			}
		// 		}
		// 	}
		// }
		
		long[][] dp = new long[b-a+2][n+1];
		for(int i=1; i<b-a+2; i++){
			int mab = i + a - 1;
			out: for(int j=1; j<n+1; j++){
				dp[i][j] = dp[i-1][j];
				for(int k=c; k<=d; k++){
					int mabcd = mab*k;
					if(mabcd > n) continue out;
					long tfact = ifact[k-1];
					tfact *= xfact[mab-1][k-1];
					tfact %= MOD;
					// for(int l=0; l<k; l++){
					// 	tfact *= ifact[mab-1];
					// 	tfact %= MOD;
					// }
					if(mabcd == j){
						dp[i][j] += fact[n-1] * tfact;
					}else if(mabcd < j){
						dp[i][j] += dp[i-1][j-mabcd] * tfact;
					}
					dp[i][j] %= MOD;
				}
			}
		}

		System.out.println(dp[b-a+1][n]);
	}

	public static long inverseElement(long a, long n){
        long b = n, u=1, v=0;
        while(b > 0) {
            long t = a/b;
            a -= t*b;
            u -= t*v;
            //swap
            t = a;
            a = b;
            b = t;
            t = u;
            u = v;
            v = t;
        }
        u = u % n;
        if(u < 0) u += n;
        return u;
    }

}


Measured memory_bytes: 53072
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main(){
    string N;
    cin >> N;
    int len = N.length();
    int ans = 0;
    int num = atoi(N.c_str());
    if(len%2==0){
        for(int i=1;i<len;i++){
            ans *= 10;
            if(i%2!=0) ans += 9;
        }
    }
    if(len%2!=0){
        for(int i=1;i<len-1;i++){
            ans *= 10;
            if(i%2!=0) ans += 9;
        }
        ans += num - pow(10,len-1) + 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256