akhauriyash/Code-Regression huggingface dataset:
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int a, b;
  cin >> a >> b;
  cout << (a == b ? "Yes" : "No") << endl;
  return (0 ^ _ ^ 0);
}



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

int main() {
	vector<char> S(4);
	for (int i = 0; i < 4; i++) {
		cin >> S.at(i);
	}

	for (int i = 1; i < 4; i++) {
		if (S.at(i) == S.at(i - 1)) {
			cout << "Bad" << endl;
			return 0;
		}
	}
	   
	cout << "Good" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#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 n,m;
    cin >> n >> m;
    vector<int> h(n);
    vector<bool> ok(n,true);
    rep(i,n) cin >> h[i];
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        a--; b--;
        if(h[a] <= h[b]) ok[a] = false;
        if(h[b] <= h[a]) ok[b] = false;
    }
    int ans = 0;
    rep(i,n) {
        if(ok[i]) ans++;
    }
     cout << ans << endl;
    
return 0;
}


Measured memory_bytes: 3776
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define scan2() int n,k; cin>>n>>k ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005

int f[N];
void solve(){
    
    int n;
    cin >> n;
    int s=0;
    int i,a[n+1],j,k;
    for(i=1; i<=n; i++){
        cin >> a[i];
        s+=a[i];
        f[a[i]]++;
    }
    int q;
    cin >> q;
    while(q--){
        int x,y;
        cin >> x >> y;
        int r=f[x];
        f[y]+=r;
        f[x]=0;
        s+=(y*r-x*r);
        cout << s << '\n';
    }

}




int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);

        int tt;
        tt=1;
        //cin >> tt;
        while(tt--){
            solve();
        }
        

}

Measured memory_bytes: 5168
using System;
class Program
{
	static void Main()
	{
	string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
	int n = int.Parse(input[0]);
	int a = int.Parse(input[1]);
    int b = int.Parse(input[2]);
    int sum = 0;

	for(int i = 1; i <= n; i++)
    {
      int numSum = i/10000 + (i/1000)%10 + (i/100)%10 +(i/10)%10 + i%10;//各桁の数の和
      if(numSum >= a && numSum <= b)
      {
        sum += i;
      }
    }
	Console.WriteLine(sum);
	}
}

Measured memory_bytes: 13140
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
	for (int i = 1; i < 10;i++){
		for (int j = 1; j < 10; j++){
			cout << i << "x" << j << "=" << i*j << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 2992
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
int main() {
  int n,s=0,ans=0;
  cin>>n;
  rep(i,((n+1)/2)){
    for(int j=1;j<=n;j++){
      if((2*i+1)%j==0){
        s++;
      }
    }
    if(s==8){
      ans++;
      
    }
    s=0;
  }
  cout<<ans<<endl;
}


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

int main()
{
  int n,m,l,r,ans;
  vector<vector<int>> all;
  int left=-11,right=114514;
    cin>>n>>m;
  for(int i = 0;i<m;i++)
  {
    cin>>l>>r;
    if(l>left)
      left=l;
    if(r<right)
      right=r;
  }
  ans=right-left+1;
  if(ans<0)
    ans=0;
  cout<<ans<<endl;
  return 0;
}


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

// using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  int n, k;
  cin >> n >> k;
  int max_in = 0;
  int G = 0;
  REP(i,n) {
    int t_in;
    cin >> t_in;
    if(G == 0) {
      G = t_in;
    } else {
      G = __gcd(G, t_in);
    }
    max_in = max(max_in, t_in);
  }
  if(k > max_in) {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
  if(k % G) {
    cout << "IMPOSSIBLE";
  } else {
    cout << "POSSIBLE";
  }

  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
#include<bits/stdc++.h>	
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;
const ll maxsize = 100000009;


ll arr[maxsize];
vector<ll> v(maxsize);
map<ll, ll> m;	

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

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

bool is_palindrome(string s) {
	string t(s.rbegin(), s.rend());
	return t == s;
}
 
 
void solve() {
	string s;
	bool flag = true;
	cin >> s;
	int n = s.length();
	if(is_palindrome(s) && is_palindrome(s.substr(0, (n - 1) / 2)) && is_palindrome(s.substr((n + 1) / 2)))
	cout << "Yes" << endl;
	else cout << "No" << endl;
}


	

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






Measured memory_bytes: 784220
#if 1

#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
int n,m;
int d[1005][1005];
char a[1005][1005];

int main()
{
    scanf("%d %d", &n, &m);
    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= m;j++)
        {
            scanf(" %c",&a[i][j]);
        }
    }
    d[1][1] = 1;
    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= m;j++)
        {
            if(a[i][j+1] == '.')
            {
                d[i][j+1] += d[i][j];
                d[i][j+1] %= mod;
            }
            if(a[i+1][j] == '.')
            {
                d[i+1][j] += d[i][j];
                d[i+1][j] %= mod;
            }
        }
    }
    printf("%d",d[n][m]);
}

#endif // 1++


Measured memory_bytes: 5120
import math
inputnum = input()
a, b, x = inputnum.split(" ")
a, b, x = int(a), int(b), int(x)
if x <= a**2*b/2:
    theta = math.atan2(a*b**2,2*x)
    print(math.degrees(theta))
else:
    theta = math.atan2(2*(a**2*b-x), a**3)
    print(math.degrees(theta))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979

//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
//const int64_t MOD = 1000000007;
//const int64_t INF = 998244353;
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; }
using namespace std;
//#define P pair<int, int>
typedef pair<int, int> P;

int main(){
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H, vector<char>(W));
    rep(i, 0, H){
        rep(j, 0, W){
            cin >> S.at(i).at(j);
        }
    }
    vector<int> dx = {-1, 0, 1, 0};
    vector<int> dy = {0, 1, 0, -1};
    int distance = 0;
    rep(sy, 0, H){
        rep(sx, 0, W){
            if (S.at(sy).at(sx) == '#') continue;
            vector<vector<int>> D(H, vector<int>(W, INF));
            //cout << "START " << sy << " " << sx << endl;
            int sdis = 0;
            queue<P> q;
            q.push(make_pair(sx, sy));
            D.at(sy).at(sx) = 0;
            while (!q.empty()){
                P p = q.front();
                q.pop();
                int x = p.first;
                int y = p.second;
                rep(i, 0, 4){
                    if(x + dx.at(i) >= 0 && x + dx.at(i) < W && y + dy.at(i) >= 0 && y + dy.at(i) < H){
                        int X = x + dx.at(i);
                        int Y = y + dy.at(i);
                        if (S.at(Y).at(X) == '.' && D.at(Y).at(X) == INF){
                            q.push(make_pair(X, Y));
                            D.at(Y).at(X) = D.at(y).at(x) + 1;
                            //cout << "YX " << Y << " " << X << " yx " << y << " " << x << endl;
                            //cout << "D  " << D.at(Y).at(X) << " " << D.at(y).at(x) << endl;
                            distance = max(distance, D.at(Y).at(X));
                            sdis = max(sdis, D.at(Y).at(X));
                            
                        }
                    }
                }
            }
            //cout << sy << " " << sx << " " << sdis << endl;
        }
    }
    cout << distance << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int flag=0,f=0;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
          if(s[i]=='A')
          {
               flag++;
          }
          else
          {
                f++;
          }
    }

    if(f==0||flag==0)
      cout<<"No"<<endl;
        else
      cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b;
  char op;
  while(1){
    scanf("%d %c %d",&a,&op,&b);
 if (op =='+') printf("%d\n",a + b);
  else if (op == '-' )printf("%d\n",a - b);
  else if (op == '*') printf("%d\n",a * b);
  else if (op == '/') printf("%d\n",a / b );
 else break; }
  return 0;
 }



Measured memory_bytes: 2036
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  ll i, o, t, j, l, s, z;
  cin >> i >> o >> t >> j >> l >> s >> z;
  // 使うのはi, o, j, lのみ
  ll ans = (i / 2 + j / 2 + l / 2) * 2;
  if (i && j && l) {
    ans = max(ans, ((i - 1) / 2 + (j - 1) / 2 + (l - 1) / 2) * 2 + 3);
  }
  ans += o;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int mask;
int a[4];
int ans;
string s;
int main() {
    cin >> s;
    for (int i = 0; i < 4; i++) a[i] = s[i] - '0';
    for (int mask = 0; mask < 8; mask++) {
        ans = a[0];
        int t = mask;
        for (int cur = 1; cur <= 3; cur++) {
            if (t & 1) {
                ans += a[cur];
            }
            else ans -= a[cur];
            t = t >> 1;
        }
        //cout << ans << '\n';
        if (ans == 7) {
            cout << a[0];
            for (int cur = 1; cur <= 3; cur++) {
                if (mask & 1) {
                    cout << "+" << a[cur];
                }
                else cout << "-" << a[cur];
                mask >>= 1;
            }
            cout << "=7";
            return 0;
        }
    }
    return 0;
}


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

using namespace std;

const int mod = 1e9 + 7;

struct modint {
	int n;
	modint(int n = 0) : n(n) {}
};

modint operator+(modint a, modint b) { return modint((a.n += b.n) >= mod ? a.n - mod : a.n); }
modint operator-(modint a, modint b) { return modint((a.n -= b.n) < 0 ? a.n + mod : a.n); }
modint operator*(modint a, modint b) { return modint(1LL * a.n * b.n % mod); }
modint &operator+=(modint &a, modint b) { return a = a + b; }
modint &operator-=(modint &a, modint b) { return a = a - b; }
modint &operator*=(modint &a, modint b) { return a = a * b; }

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> x(n);
	vector<int> y(m);
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> y[i];
	}
	modint unit;
	for (int i = 0; i + 1 < n; i++) {
		unit += modint(i + 1) * modint(n - i - 1) * (x[i + 1] - x[i]);
	}
	modint ans;
	for (int i = 0; i + 1 < m; i++) {
		ans += modint(i + 1) * modint(m - i - 1) * unit * (y[i + 1] - y[i]);
	}
	cout << ans.n << endl;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = (1e9)+7;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}


int main(){
  fastIO();
  int A,B,C,ans=0;
  cin>>A>>B>>C;
  int odd=0,even=0;
  bool a = A%2==0;
  bool b = B%2==0;
  bool c = C%2==0;
  A%2==0?even++:odd++;
  B%2==0?even++:odd++;
  C%2==0?even++:odd++;
  if(even!=3&&odd!=3){
  	if((a&&b)||(!a&&!b)){
  		A++;
  		B++;
  	}else if((a&&c)||(!a&&!c)){
  		A++;
  		C++;
  	}else{
  		B++;
  		C++;
  	}
  	int big = max({A,B,C});
  	ans+=(big-A)/2,ans+=(big-B)/2,ans+=(big-C)/2,ans++;
  }else{
  	int big = max({A,B,C});
  	ans+=(big-A)/2,ans+=(big-B)/2,ans+=(big-C)/2;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int m, f, r;
    while(1){
        cin>>m>>f>>r;
        if(m == -1 && f == -1 && r == -1) break;
        else if(m == -1 || f == -1) cout<<"F"<<endl;
        else if(m + f >= 80) cout<<"A"<<endl;
        else if(m + f >= 65 && m + f < 80) cout<<"B"<<endl;
        else if(m + f >= 50 && m + f < 65) cout<<"C"<<endl;
        else if(m + f >= 30 && m + f < 50) {
            if(r >= 50) cout<<"C"<<endl;
            else cout<<"D"<<endl;
        }
        else if(m + f < 30) cout<<"F"<<endl;
    }
    return 0;
}



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

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

    map<int, int> cnt;
    int right = 0;
    int res = N + 1;
    for(int left = 0; left < N; ++left) {
        while(right < N && cnt.size() < K) {
            if(A[right] >= 1 && A[right] <= K) cnt[A[right]] += 1;
            ++right;
        }

        if(cnt.size() < K) break;
        else res = min(res, right - left);

        if(left == right) {
            ++right;
        } else if(A[left] >= 1 && A[left] <= K) {
            cnt[A[left]] -= 1;
            if(cnt[A[left]] == 0) cnt.erase(A[left]);
        } 
    }
    
    cout << (res < N + 1 ? res : 0) << endl;
}


Measured memory_bytes: 7808
//DUEL
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#pragma GCC optimize("unroll-loops")
#define shandom_ruffle(a, b) shuffle(a, b, rng)
#define vi vector<int>
#define vl vector<ll>
#define popcnt __builtin_popcount
#define popcntll __builtin_popcountll

using namespace std;
using namespace __gnu_pbds;

using ll=long long;
using ull=unsigned long long;
using ld=long double;
int MOD=1000000007;
int MOD2=998244353;
vector<int> bases;
const ll LLINF=1ll<<60;
const char en='\n';

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void yes() {cout<<"YES"<<en; exit(0);}
void no() {cout<<"NO"<<en; exit(0);}
inline int rund() {int x576363482791fuweh=rng();return abs(x576363482791fuweh)%RAND_MAX;}
template<class T>
void prVec(vector<T> w,bool fl=false)
{
	cout<<w.size()<<en;
	for (int i=0;i<int(w.size())-1;++i) cout<<w[i]<<' ';
	if (w.size()) cout<<w[w.size()-1]<<en;
	if (fl) cout<<flush;
}

void M998()
{
	swap(MOD,MOD2);
}

ll raand()
{
	ll a=rund();
	a*=RAND_MAX;
	a+=rund();
    return a;
}

#define rand raand

ll raaand()
{
	return raand()*(MOD-7)+raand();
}

string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}

string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

ll sti(string a,int base=10)
{
	ll k=0;
	for (int i=0;i<(int)a.size();++i)
	{
		k*=base;
		k+=a[i]-'0';
	}
	return k;
}

template<class T>
void eras(vector<T>& a,T b)
{
	a.erase(find(a.begin(),a.end(),b));
}

string its(ll k,int base=10)
{
	if (k==0) return "0";
	string a;
	while (k)
	{
		a.push_back((k%base)+'0');
		k/=base;
	}
	reverse(a.begin(),a.end());
	return a;
}

ll min(ll a,int b)
{
	if (a<b) return a;
	return b;
}

ll min(int a,ll b)
{
	if (a<b) return a;
	return b;
}

ll max(ll a,int b)
{
	if (a>b) return a;
	return b;
}

ll max(int a,ll b)
{
	if (a>b) return a;
	return b;
}

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

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

template<class T,class K>
pair<T,K> mp(T a,K b)
{
	return make_pair(a,b);
}

inline int mult(ll a,ll b)
{
	return (a*b)%MOD;
}

inline int pot(int n,int k)
{
	if (k==0) return 1;
	ll a=pot(n,k/2);
	a=mult(a,a);
	if (k%2) return mult(a,n);
	else return a;
}

int divide(int a,int b)
{
	return mult(a,pot(b,MOD-2));
}

inline int sub(int a,int b)
{
	if (a-b>=0) return a-b;
	return a-b+MOD;
}

inline int add(int a,int b)
{
	if (a+b>=MOD) return a+b-MOD;
	return a+b;
}

bool prime(ll a)
{
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i)
	{
		if (a%i==0) return 0;
	}
	return 1;
}

const int N=300010;
int n,m;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	for (int i=0;i<10;++i) bases.push_back(rand()%(MOD-13893829*2)+13893829);
	cin>>n>>m;
	cout<<(n+m-1)/m;
}





Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include <iomanip>
#include <regex>
#include <initializer_list>
#define DBL_MIN 0.000000000000001
#define A_P(n,a,d) (n/2)*(2*a + (n-1)*d)
using namespace std;

int main(void){
  int N;
  cin >> N;
  int cnt = 0;
  for(int i = 0; i < N; i++){
    int a,b;
    cin >> a >> b ;
    if(a == b){
      cnt++;
      if(cnt == 3){
        cout << "Yes" << endl;
        return 0;
      }
    }else{
      cnt = 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define IOS ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define AfterDecimal(n) cout << fixed << setprecision(n);
#define ll long long int
#define ld long double
#define all(a) a.begin(), a.end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define bits(x) __builtin_popcount(x)

using namespace __gnu_pbds;
using namespace std;

// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")

//template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

#ifdef LOCAL
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << "# "<< name << " = " << arg1 << '\n';
}
template<typename Arg1, typename... Args>
void __f(const char* names, Arg1 && arg1, Args &&... args){
        const char* comma = strchr(names + 1 ,',');
        cout << "# ";
        cout.write(names, comma - names)<< " = " << arg1 << " | ";
        __f(comma + 1, args...);
}
#else
#define debug(...) 36
#endif


std::mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int ri(int a, int b) {
    return uniform_int_distribution<int>(a, b)(rng);
}

ll power(ll x, ll y, ll p){
   ll res = 1;
   x = x % p;
   while (y > 0) {
      if (y & 1)
         res = (res * x) % p;
      y = y >> 1;
      x = (x * x) % p;
   }
   return res;
}

const ll INF = (ll)(8e18);
const ll MOD = (ll)(1e9 + 7);
const ll HMOD = (ll)4222234727;
const ll Hashprime = (ll)31;

const int maxn = 100100;

int32_t main(){
    IOS;
    #ifndef ONLINE_JUDGE
    //  freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);
    #endif
    int t = 1; // cin >> t;
    while(t--){
      ll n; cin >> n;
      ll ans = 0;
      std::vector<pll> v;
      for(ll i = 1; i <= n; i++){
         ll x,y; cin >> x >> y;
         v.push_back({x, y});
      }
      sort(all(v));
      set <ll> a,b;
      for(auto i : v){
         if(!a.empty()){
           ll vala = *a.rbegin();
           ll valb = *b.rbegin();
           ans = max(ans, i.second + i.first + vala);
           ans = max(ans, i.first - i.second + valb); 
         }
         a.insert(-i.second - i.first);
         b.insert(i.second - i.first);
      }
      cout << ans << '\n';
    }
    #ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}
//g++ -DLOCAL -std=c++17 -Wshadow -Wall -o "c" "comp.cpp" -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g


Measured memory_bytes: 25100
//{{{
#include <bits/stdc++.h>
using namespace std;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
#define foreach(x,a) for(auto &x:a)
typedef long long ll;
const int MOD = 1e9+7;
//}}}

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans = 0;
  rep(i, N){
    set<char> st1;
    set<char> st2;
    rep(j, i){
      st1.insert(S[j]);
    }
    rep(j, i, N){
      st2.insert(S[j]);
    }
    int num = 0;
    for(auto x: st1){
      if(st2.count(x)) num++;
    }
    ans = max(ans, num);
  }
  cout << ans << endl;
  return 0;
}


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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) {
        ll d = euclid(b, a % b, y, x);
        return y -= a / b * x, d;
    }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1)
            ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1);
        return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e)
            return Mod(1);
        Mod r = *this ^ (e / 2);
        r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

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

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

        if (!n) break;

        vector<pair<int, pair<int, int>>> v(m);
        rep(i, 0, m) cin >> v[i].first >> v[i].second.first >> v[i].second.second;

        sort(all(v));

        vector<int> inf(n + 1);
        inf[1] = 1;

        rep(i, 0, m) {
            if (inf[v[i].second.first])
                inf[v[i].second.second] = true;
        }

        int ans = 0;
        rep(i, 1, n + 1) if (inf[i] == 1) ans++;
        cout << ans << endl;
    }
}



Measured memory_bytes: 3360
#include <bits/stdc++.h>     // [PRIMES]               1777 ~2^10.80  
using namespace std;                     //                       10333 ~2^13.33
using ll=long long;                      // seq 1 128 | factor   100333 ~2^16.61
using vl=vector<ll>;                     //   | grep -v ' .* '  1300111 ~2^20.31
using vvl=vector<vl>;                    //                    10300777 ~2^23.30
using vb=vector<bool>;                   //                   100400999 ~2^26.58
using vs=vector<string>;                 //                  1300400999 ~2^30.28
using pll=pair<ll,ll>;                   //                 10200500333 ~2^33.25
const ll oo =0x3f3f3f3f3f3f3f3fLL;       //                100200400777 ~2^36.54
const double eps=1e-9;                   //               1200300700111 ~2^40.13
#define sz(c) ll((c).size())             //              10200300500777 ~2^43.21
#define all(c) begin(c),end(c)           //             100200300400777 ~2^46.51
#define mp make_pair                     //            1200300400600999 ~2^50.09
#define mt make_tuple                    //           10200300400600111 ~2^53.18
#define pb push_back                     //          100200300400600333 ~2^56.48
#define eb emplace_back                  //         1200300400500800999 ~2^60.06
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

using namespace std;

int main(){
	cin.sync_with_stdio(0);

	string s; cin >> s;
	
	if(s == "Sunny") cout << "Cloudy" << endl;
	else if (s == "Cloudy") cout << "Rainy" << endl;
	else cout << "Sunny" << endl;
	
	return 0;
}

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


int main()
{
	long long n,a,b,x,y;
	cin>>n;
	cin>>a>>b;
	if(n==1){
		cout<<(a==b);
		return 0;
	}
	if(a>b){
		cout<<0;
		return 0;
	}
	n-=2;
	x = b-a;
	x*=n;
	x+=1;
	cout<<x;
	return 0;
}

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

int main(){

  int i,j,n,cnt,flag,num;

  scanf("%d",&n);

  for(i = 0;i < n;i++) {
    flag = 0;
    scanf("%d",&num);
    for(j = 2;j * j <= num;j++) {
      if(num % j == 0) {
	     flag = 1;
	     break;
	  }
	}
      if(flag != 1) cnt++;
  }
  printf("%d\n",cnt);
  return 0;
}


Measured memory_bytes: 2104
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());
        int K = Integer.parseInt(scanner.next());

        List<Integer> dislikeList = new ArrayList<>();
        for (int i = 0; i < K; i++) {
            dislikeList.add(Integer.parseInt(scanner.next()));
        }

        scanner.close();

        // n 以上の整数
        for (int i = N; i < 100000; i++) {
            boolean isCompleted = true;
            String tmp = String.valueOf(i);

            for (int j = 0; j < tmp.length(); j++) {
                int d = Integer.parseInt(String.valueOf(tmp.charAt(j)));
                if (dislikeList.contains(d)) {
                    isCompleted = false;
                    break;
                }
            }

            if (isCompleted) {
                System.out.println(i);
                return;
            }
        }
    }
}


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

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;

//少数点表示
//cout <<std::fixed << std::setprecision(14)

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

    ll n;
    vector<ll> a(5);
    cin >> n;
    rep(i,5) cin >> a[i];
    ll min_=1000000000000001;
    int I=0;
    rep(i,5){
        if(a[i]<=min_) I=i+1;

        min_=min(min_,a[i]);
    }
    ll kumi=0;
    if(min_>=n){
        cout << 5;
        return 0;
    }else{
        if(n%min_!=0){
            kumi=(n/min_)+1;
        }else{
            kumi=(n/min_);
        }
        cout << kumi-1+5;
        return 0;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
	string S;
	cin >> S;
	REP( i, (int)S.size() )
	{
		if( S[i] == ',' ){
			cout << " ";
			continue;
		}
		cout << S[i];
	}
	cout << endl;
	return 0;
}

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

int main() {
  int N,M;
  cin>>N>>M;
  vector<pair<int,int>> p;
  vector<int> q(N,1);
  map<pair<int,int>,int> m;
  vector<int> x(M);
  vector<int> y(M);
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    p.push_back(make_pair(b,a));
    m[make_pair(b,a)]=i;
    x.at(i)=a;
  }
  sort(p.begin(),p.end());
  for(int i=0;i<M;i++){
    y.at(m[p.at(i)])=q.at(p.at(i).second-1);
    q.at(p.at(i).second-1)++;
  }
  for(int i=0;i<M;i++){
    if(x.at(i)<10){
      cout<<"00000"<<x.at(i);
    }
    else if(x.at(i)<100){
      cout<<"0000"<<x.at(i);
    }
    else if(x.at(i)<1000){
      cout<<"000"<<x.at(i);
    }
    else if(x.at(i)<10000){
      cout<<"00"<<x.at(i);
    }
    else if(x.at(i)<100000){
      cout<<"0"<<x.at(i);
    }
    else{
      cout<<x.at(i);
    }
    
    if(y.at(i)<10){
      cout<<"00000"<<y.at(i);
    }
    else if(y.at(i)<100){
      cout<<"0000"<<y.at(i);
    }
    else if(y.at(i)<1000){
      cout<<"000"<<y.at(i);
    }
    else if(y.at(i)<10000){
      cout<<"00"<<y.at(i);
    }
    else if(y.at(i)<100000){
      cout<<"0"<<y.at(i);
    }
    else{
      cout<<y.at(i);
    }
    cout<<endl;
  }
}

Measured memory_bytes: 9716
x = []
count = 0
ans = []
while True:
  x.append(input().split())
  if x[count][1] == "?":
    break
  count += 1
for i in range(count + 1):
  if x[i][1] == "+":
    ans.append(int(x[i][0]) + int(x[i][2]))
  elif x[i][1] == "-":
    ans.append(int(x[i][0]) - int(x[i][2]))
  elif x[i][1] == "*":
    ans.append(int(x[i][0]) * int(x[i][2]))
  elif x[i][1] == "/":
    ans.append(int(x[i][0]) // int(x[i][2]))
  else:
    for j in ans:
      print(j)


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int x;
    cin >> x;
    yns(x>=30);
    return 0;
}

Measured memory_bytes: 3580
N, K = map(int, input().split())
x = list(map(int, input().split()))

x.insert(0, 0)

minimum = 2**31

for left in range(1, N-K+2):
    right = left + K - 1
    lefttime = abs(x[left]) + abs(x[right] - x[left])
    righttime = abs(x[right]) + abs(x[right] - x[left])
    minimum = min(minimum, min(lefttime, righttime))
    
print(minimum)

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

using std::vector;
using std::string;
using std::cin;
using std::cout;
using std::endl;


int solve()
{
    long long result = 0;
    int n,x;
    cin >> n >> x;
    int a = 0;
    cin >> a;
    if (a > x)
    {
        result += a - x;
        a = x;
    }
    for(int i = 1, b = 0; i<n;++i, a = b)
    {
        cin >> b;
        if (b > x)
        {
            result += b - x;
            b = x;
        }
        if (a + b > x)
        {
            int diff = a + b  - x;
            result += diff;
            b -= diff;
        }
    }

    cout << result << endl;
    return 0;
}
int main(int argc, char **argv)
{

    ::std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
    solve();
    return 0;
}



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

void printarray(int A[], int len) {
	for (int i = 0; i < len - 1; i++) {
		cout << A[i] << " ";
	}
	cout << A[len - 1] << endl;
}

int main() {
	int N;
	cin >> N;
	int A[N];
	for (int i = 0; i < N; i++)
		cin >> A[i];
	int cnt = 0, flg = 1;
	while (flg) {
		flg = 0;
		for (int i = N - 1; i > 0; i--) {
			if (A[i] < A[i - 1]) {
				swap(A[i], A[i-1]);
				cnt++;
				flg = 1;
			}

		}
	}
	printarray(A, N);
	cout << cnt << endl;
	return 0;
}



Measured memory_bytes: 3096
S = raw_input()
n = len(S)

A = range(n)
for i in range(n):
  if S[i]=="L" and S[i-1]=="L":
    A[i] = A[i-1]
for i in range(n)[::-1]:
  if S[i]=="R" and S[i+1]=="R":
    A[i] = A[i+1]

C = [0]*n
for i in range(n):
  if (i-A[i])%2==0:
    p = A[i]
  else:
    if S[i]=="L":
      p = A[i]-1
    else:
      p = A[i]+1
  C[p] += 1

print " ".join(map(str, C))


Measured memory_bytes: 10332
#include<cstdio>

typedef long long ll;
const int N=100005;
ll sum=0,a[N],t=0;
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%I64d",&a[i]);
        sum+=a[i];
        t+=i;
    }
    if(sum%t)   printf("NO\n");
    else{
        ll tmp=a[1];
        for(int i=1;i<n;i++)
            a[i]=a[i+1]-a[i];
        a[n]=tmp-a[n];
        ll r=sum/t;
        bool flag=true;
        for(int i=1;i<=n;i++){
            a[i]-=r;
            if(a[i]%n || a[i]>0){
                flag=false;
                break;
            }
        }
        if(flag)    printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}



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

#include <fstream>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  /*
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
  //*/
  int A, B;
  cin >> A >> B;
  if(A == 2 || B == 2){
    cout << "No" <<endl;
  } else{
    cout << "Yes" <<endl;
  }
}


Measured memory_bytes: 3628
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long ll;
typedef long double ld;
#define INF (1LL<<60)
/*swap 交換*/
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
/*2つのうち大きい数を返す*/
ll max2(ll a,ll b){return a>=b?a:b;}
/*2つのうち小さい数を返す*/
ll min2(ll a,ll b){return a>=b?b:a;}
/*絶対値*/
ll ABS(ll a){return a>=0?a:(-a);}
typedef struct{
    ll aa;
    ll bb;
}frequent;
// 小大
int compare(const void *a, const void *b){return *(ll *)a - *(ll *)b;}

int main(void){
    ll n,y,i,j;
    scanf("%lld%lld",&n,&y);
    if( y<n*1000 || y>n*10000){
        printf("-1 -1 -1\n");
        return 0;
    }
    for(i=0;i<n+1;i++){
        if( i*10000+(n-i)*5000 < y ) continue;
        for(j=i;j<n+1;j++){
            if( i*10000 + (j-i)*5000 +(n-j)*1000 == y ){
                printf("%lld %lld %lld\n",i,j-i,n-j);
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll MAX = 510000;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
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;}

int main()
{
    int d;
    cin >> d;
    vector<int> c(26);
    REP(i,26){
        cin >> c[i];
    }
    vector<vector<int>> s(d,vector<int>(26));
    REP(i,d){
        int max=0;
        int ans=0;
        REP(j,26){
            cin >> s[i][j];
            if(max<s[i][j]){
                max=s[i][j];
                ans=j+1;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3680
#4問目
import sys
N, K = map(int, input().split())
A = list(map(int, input().split()))

#すでに移動したことのある場所
already = [False] * N
step = 0
now = 1
count = 0
while(already[now-1] != True):
    already[now - 1] = True
    now = A[now - 1]
    count += 1
    if count == K: # ループに入る前にKになったらそれで終了
      print(now)
      exit(0)
# now := ループの開始地点
# count :=  地点 1 から now までの移動数
# step := ループに入るまでにワープする回数
# cycle := ループに含まれる辺の個数
# loop := (K-step) % cycle 
#        （残りの(K-step)回ループの中で回したときに ループしないで終わる回数）  
loop = 0
cycle = 0
if(now == 1):
    step = 0
    cycle = count
    loop = K % cycle
else:
    step = 0
    temp = 1
    while(temp != now):
        temp = A[temp - 1]
        step += 1
    cycle = count - step
    loop= (K - step) % cycle

temp = 1
for i in range(step + loop):
    temp = A[temp - 1]
print(temp)

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    // convinationの固定する左側見つける
    int a_max = *max_element(a.begin(), a.end());
  	int a_min = *min_element(a.begin(), a.end());
    // 全探索
    int target = a_max;
    int ans_right = a_min;
    for(int i = 0;i < n;i++) {
        int a_bin = abs(a[i] * 2 - target);
        int a_bin2 = abs(ans_right * 2 - target);
        if(a_bin < a_bin2){
            ans_right = a[i];
        }
    } 
    cout << a_max << " " << ans_right << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long int
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define test(t) int t; cin >> t; while(t--)
#define endl "\n"
#define debug(x) cout << x << "\n"
#define pb push_back
#define mp make_pair
#define MEMS(x,t) memset(x, t, sizeof(x))
#define mod 1000000007
#define forn(i,n) for (ll i = 0; i < n; i++)
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define rrep(i,a,b) for( int i = a; i >= b; i--)
// #define map map<ll,ll>
#define fi first
#define se second
#define set set<ll>
#define pp pair<ll,ll>
using namespace std;
bool sortbysec(const pp &a,
              const pp &b)
{
    return (a.second < b.second);
}
// ll r[h], c[w];
// ll mat[300000][300000];
int main()
{
    fastio;
    ll h, w, m;
    cin >> h >> w >> m;
    ll r[h], c[w];
    // mat[h][w];
    map< pp, ll> mat;
    forn(i,h) r[i] = 0;
    forn(i,w) c[i] = 0;
    ll x, y, mr = 0, mc = 0, ir, ic;
    forn(i,m)
    {
        cin >> x >> y;
        x--;
        y--;
        mat[{x,y}] = 1;
        r[x]++,
        c[y]++;
        mr = max( r[x], mr);
        mc = max( c[y], mc);
    }
    bool f = false;
    vector<ll> vr, vc;
    forn(i,h)
    {
        if ( r[i] == mr ) vr.pb(i);
    }
    forn(i,w)
    {
        if ( c[i] == mc) vc.pb(i);
    }
    ll ans = mr + mc;
    for( ll i = 0; i < vr.size(); i++ )
    {
        for( ll j = 0; j < vc.size(); j++ )
        {
            if ( mat[{vr[i],vc[j]}] != 1)
            {
                // ans = mr + mc;
                f = true;
                break;
            }
        }
    }
    if (f) cout << ans;
    else cout << ans - 1;

}


Measured memory_bytes: 50032
# -*- coding: utf-8 -*-
"""
A - Grouping 2
https://beta.atcoder.jp/contests/abc089/tasks/abc089_a

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    N = int(input())
    print(N//3)


if __name__ == '__main__':
    main(sys.argv[1:])
    


Measured memory_bytes: 2940
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );

	while ( true ) {

	    final int n = stdin.nextInt();
	    if ( n == 0 ) {
		break;
	    }

	    final int[] ns = new int[ n - 1 ];
	    for ( int i = 1; i <= n - 1; i++ ) {
		ns[i - 1] = ( i * i ) % n;
	    }
	    Set<Integer> set = new HashSet<Integer>();
	    for ( int i : ns ) {
		if ( !set.contains( i ) ) {
		    set.add( i );
		}		    
	    }		

	    int[] ans = new int[ n / 2 ];

	    for ( final int i : set ) {
		for ( final int j : set ) {
		    if ( i != j ) {
			int diff = ( i - j + n ) % n;
			if ( diff > n / 2 ) {
			    diff = n - diff;
			}
			//System.err.printf( "(i, j, diff) = (%d, %d, %d)\n", i, j, diff );
			ans[ diff - 1 ]++;
		    }
		}		    
	    }
	    for ( int i : ans ) {
		System.out.println( i );
	    }
	}	
    }
}

Measured memory_bytes: 35928
#include <bits/stdc++.h>
using namespace std;
//to set precision use fixed,setprecision(number_of_points_after_decimal)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define mod 1000000007
#define sz(x) (int)(x).size()
#define ff first
#define ss second
#define pb push_back
#define debugvector(h) for(auto &l:h)cout<<l<<" "
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef map<int,int> mii;
typedef long double ld;
void solution(){
  int n;cin>>n;
  ll dp[n];
  int nums[n];
  rep(i,0,n) cin>>nums[i];
  dp[0]=0,dp[1]=abs(nums[1]-nums[0]+dp[0]);
  rep(i,2,n){
    ll temp1=(abs(nums[i]-nums[i-2]) + dp[i-2] );
    ll temp2=(abs(nums[i]-nums[i-1]) + dp[i-1] );
    dp[i]=min(temp1,temp2);
  }
  cout<<dp[n-1]<<endl;

}



int main() {
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
  #endif
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);
  //int t;cin>>t;
 //while(t--){
  solution();
  //}
  return 0;
}

Measured memory_bytes: 4752
#include <stdio.h>
 
int stack[1000],point=0;
 
 
int fstack(int com,int num){
    int data;
    if(com==0){
        data=stack[point];
        stack[point]=num;
        point--;
        return data;
    }
    if(com==1){
        point++;
        stack[point]=num;
        return 0;
    }else{
        return -1;
    }
}
 
int main(){
    int a;
 
    while(scanf("%d",&a)!=EOF){
        if(a==0){
            a=fstack(0,0);
            printf("%d\n",a);
        }else{
            fstack(1,a);
        }
    }
 
    return 0;
}

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

string s,t;

template<typename Drake>
void read(Drake &x){
	x=0;char ch=getchar();bool f=1;
	while(!isdigit(ch)){
		if(ch=='-')f^=1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	x*=(2*f-1);
}

template<typename Drake>
void write(Drake x){
	if(x<0){x=-x;putchar('-');}
	if(x>9)write(x/10);
	putchar(x%10+'0');
}

template<typename Drake>
void writeln(Drake x){
	write(x);
	puts("");
}

void init(){
	cin>>s>>t;
}

int main(){
	init();
	for(int i=0;i<s.size();++i){
		int s1=i,t1=0;bool tag=1;
		for(int j=0;j<s.size();++j)
		if(s[s1]!=t[t1]){
			tag=false;break;
		}
		else s1=(s1+1)%s.size(),t1=(t1+1)%t.size();
		if(tag){
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<ctime>
#include<random>
#include<set>
#include<map>
#define ll long long
using namespace std;
int n;
ll a[300000];
ll t[50];
map<ll,int> s1;


void init()
{
    t[0]=1;
    for (int i=1; i<40; ++i)
        t[i]=t[i-1]*2;
}

bool cmp(ll a,ll b)
{
    return (a>b);
}

int main()
{
    init();
    int an=0;
    cin>>n;
    for (int i=0; i<n; ++i)
        scanf("%lld",&a[i]);
    sort(a,a+n,cmp);
    for (int i=0; i<n; ++i)
    {
        bool flag=0;
        for (int j=32; j>=1; --j)
            if (s1.find(t[j]-a[i])!=s1.end() &&((s1[t[j]-a[i]])>0) )
            {
                s1[t[j]-a[i]]-=1;
                flag=1;
                an++;
                break;
            }
        if (!flag)
        {
            if (s1.find(a[i])!=s1.end())
            s1[a[i]]+=1;else s1[a[i]]=1;
        }
    }
    cout<<an<<endl;

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> pi;
typedef pair<int,int> vi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


int main() {
	ll N, K;
	cin >> N >> K;
	pi visited = {N};
	N %= K;
	ll result = N;
	while(N > 0){
		N = abs(N-K);
		if(result < N) N = 0;
		else result = N;
	}
	cout << result << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
#define PI 3.14159265358979323846
using namespace std;
//
int main(){
  int M;
  cin>>M;
  cout<<48-M<<endl;
  return 0;
}


Measured memory_bytes: 764