akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
ll n,a[100009],dp[100009];
int main (){
	cin >> n;
	for (int i=1; i<=n; i++){
		cin >> a[i];
		if (a[i]<=a[i-1])dp[i]=dp[i-1]+1;
	}
	ll jwb=-1e15;
	for (int i=1; i<=n; i++)jwb=max(jwb,dp[i]);
	cout << jwb << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <unordered_set>

using namespace std;

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

  unordered_set<int> D;
  for (int i = 0; i < K; ++i) {
    int tmp;
    cin >> tmp;
    D.insert(tmp);
  }

  int n = N;
  for ( ; ; ) {
    int tmp = n;
    while (tmp) {
      int div = tmp % 10;
      if (D.find(div) != D.end()) break;
      tmp /= 10;
    }
    if (tmp) ++n; else break;
  }

  cout << n << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=200005;
int head[maxn],t[maxn<<1],ne[maxn<<1],num,n;
int dp[maxn],nr[maxn];
char s[maxn];
i64 ans=0;
inline void dfs1(int x,int f){
	dp[x]=0;nr[x]=n;if(s[x]=='1')nr[x]=0;
	forE(i,x)if(t[i]!=f){
		dfs1(t[i],x);
		dp[x]=max(dp[x],dp[t[i]]+1);
		nr[x]=min(nr[x],nr[t[i]]+1);
	}
}
inline void dfs2(int x,int f,int n1,int dp1){
	int maxi1=0,nd1=0,maxi2=0,nd2=0,tot=0,low=n;
	maxi1=dp1;nd1=n1;vector<int> son;
	if(nd1<n)low=min(low,maxi1);
	forE(i,x)if(t[i]!=f){
		tot++;son.pb(t[i]);
		if(nr[t[i]]!=n)low=min(low,dp[t[i]]+1);
		if(dp[t[i]]+1>maxi1){
			maxi2=maxi1;nd2=nd1;
			maxi1=dp[t[i]]+1;nd1=nr[t[i]]+1;
		}else if (dp[t[i]]+1>maxi2){
			maxi2=dp[t[i]]+1;nd2=nr[t[i]]+1;
		}
	}if(s[x]=='1')low=0;
	ans+=max(0,min(maxi1-1,maxi2+1)-low+1);
	vector<int> dpprmax(tot+2,0),dpsfmax(tot+2,0),nrprmin(tot+2,n),nrsfmin(tot+2,n);
	rep(i,1,tot){
		dpprmax[i]=max(dpprmax[i-1],dp[son[i-1]]+2);
		nrprmin[i]=min(nrprmin[i-1],nr[son[i-1]]+2);
	}	
	per(i,tot,1){
		dpsfmax[i]=max(dpsfmax[i+1],dp[son[i-1]]+2);
		nrsfmin[i]=min(nrsfmin[i+1],nr[son[i-1]]+2);
	}if(s[x]=='1')n1=0;
	rep(i,1,tot){
		dfs2(son[i-1],x,min(n1+1,min(nrprmin[i-1],nrsfmin[i+1])),max(max(dp1+1,dpprmax[i-1]),dpsfmax[i+1]));
	}
}
inline void addedge(int x,int y){
	ne[++num]=head[x];head[x]=num;t[num]=y;
	ne[++num]=head[y];head[y]=num;t[num]=x;
}
int main(){
	read(n);
	rep(i,1,n)head[i]=-1;
	rep(i,1,n-1){
		int x,y;read(x);read(y);
		addedge(x,y);
	}scanf("%s",s+1);
	dfs1(1,-1);
	dfs2(1,-1,n,0);
	ans++;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 51200
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stdio.h>
#include<deque>
#include<map>
#include<queue>

typedef long long ll;

#define debug(x) cout << #x << "=" << x << endl;
#define debug_arr(a, n) for(ll i = 0; i < n; i++)cout << a[i] << " "
#define inf 100000000000
#define loop(i,n) for(ll i = 0; i < n; i++)
#define graph vector<vector<ll>>
#define P pair<ll,ll>

using namespace std;

int main(){
    ll n, tmp, result = 0, pow = 1;
    ll mod = 1000000007;
    cin >>n;

    vector<ll> a(n);
    loop(i,n) cin >>a[i];

    loop(i,60){
        tmp = 0;
        loop(j,n){
            tmp += a[j] % 2;
            a[j] >>= 1;
        }
        ll add = tmp * (n - tmp) % mod;
        result += (add * pow);
        result %= mod;
        pow *= 2;
        pow %= mod;
    }

    cout << result << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int A, B;
  cin >> A >> B;
  if ( A == B ) cout << A + B << endl;
  else if ( A >= B ) cout << A + A - 1 << endl;
  else cout << B + B - 1 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
#include<climits>
#include<cfloat>
#include<cmath>
#include<map>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define DBL(x) ((x)*(x))

typedef unsigned int uint;
typedef long long ll;

using namespace std;

int main(){
  double x, h;
  while(cin>>x>>h, x+h){
    double hh;
    hh = sqrt(DBL(x/2.0)+DBL(h));
    printf("%.6f\n", x*x + 2*hh*x);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

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;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    int n = s.length();
    int ans = 0;
    REP(i,n/2) {
        if(s[i]!=s[n-1-i]) ++ ans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long  long
#define double long double
int t,n,a[100005];
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    t=1;
   // cin>>t;
    while(t--)
    {
        cin>>n;
        for(int i=1;i<=100;i++)
        {
            for(int j=1;j<=100;j++)
            {
                for(int k=1;k<=100;k++)
                {
                    int v=i*i+j*j+k*k+i*j+i*k+j*k;
                    a[v]++;
                }
            }
        }
        for(int i=1;i<=n;i++)
        {
            cout<<a[i]<<endl;
        }
    }
    
}


Measured memory_bytes: 4108
D = int(input())
c = list(map(int, input().split()))
last = [0] * 26
ans = []
S = []
prev_score = 0
maxsi_list = []

for d in range(1, D+1):
    s = list(map(int, input().split()))
    S += [s]
    maxs = float('-inf')
    maxss = float('-inf')
    maxi = -1
    maxii = -1
    cumsump = 0
    for i in range(26):
        tmp = -c[i] * (d - last[i])
        cumsump += tmp
    for i in range(26):
        tmp = -c[i] * (d - last[i])
        tmp2 = s[i] + cumsump - tmp
        if tmp2 > maxs:
            maxs = tmp2
            maxi = i
        if s[i] > maxss:
            maxii = i
            maxss = s[i]
    ans += [maxi+1]
    last[maxi] = d
    prev_score += maxs
    maxsi_list += [maxii+1]
best_ans = ans
best_score = prev_score
mergin = 1300
for tt in range(31):
    for dd in range(D):
        last = [0] * 26
        score = 0
        for d in range(1, D+1):
            if dd == (d-1):
                maxc = 0
                maxci = -1
                for i in range(26):
                    cost = c[i] * (d - last[i])
                    if maxc < cost:
                        maxc = cost
                        maxci = i+1
                prev_a = ans[dd]
                ans[dd] = maxci
            td = ans[d-1] - 1
            cumsump = 0
            for i in range(26):
                if td != i:
                    tmp = -c[i] * (d - last[i])
                    cumsump += tmp
            last[td] = d
            score += S[d-1][td]+cumsump
        if score <= prev_score-mergin:
            ans[dd] = prev_a
        elif best_score < score:
            best_ans = ans
            best_score = score
            prev_score = score
        else:
            prev_score = score

    for dd in range(D):
        last = [0] * 26
        score = 0
        prev_a = ans[dd]
        ans[dd] = maxsi_list[dd]
        for d in range(1, D+1):
            td = ans[d-1] - 1
            cumsump = 0
            for i in range(26):
                if td != i:
                    tmp = -c[i] * (d - last[i])
                    cumsump += tmp
            last[td] = d
            score += S[d-1][td]+cumsump
        if score <= prev_score-mergin:
            ans[dd] = prev_a
        elif best_score < score:
            best_ans = ans
            best_score = score
            prev_score = score
        else:
            prev_score = score

for a in best_ans:
    print(a)

Measured memory_bytes: 73500
#include <iostream>
using namespace std;
typedef long long ll;
int main(){
    ll n;
    cin >> n;
    ll p[n];
    ll q[n];
    for (ll i=0; i<n; i++){
        cin >> p[i];
        q[p[i]-1]=i;
    }
    ll a[n],b[n];
    for (ll i=0; i<n; i++){
        a[i]=i*30000+1;
        b[i]=-1*a[i]+1e9;
        a[i]+=q[i];
    }
    for (ll i=0; i<n; i++){
        cout << a[i] << " " ;
    }
    cout << endl;
    for (int i=0; i<n; i++){
        cout << b[i] << " " ;
    }
    cout << endl;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,ans=1;
	cin>>n;
	for(int i=2;i<=35;i++)
	{
		int a=i*i;
		if(a>n)
		   break;
		while(a*i<=n)
		   a*=i;
		if(a>ans)
		   ans=a;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
	
	int a, b;
	a = 0;
	b = 0;
	scanf("%d %d", &a, &b);



	if (a < b){ 
		printf("a < b\n"); 
	}
	if (a == b) {
		printf("a == b\n");
	}
	if (a > b)
	{
		printf("a > b\n");
	}
	return 0;
}


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

int main() {
    int A=0;
    int B=0;
    int C=0;
    
    cin>>A>>B>>C;
    
    if(C<A+B||C==A+B){
        cout<<B+C<<endl;
    }else{
        int cm=A+B+1;
        cout<<cm+B<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MX 100010
#define pb push_back
typedef long long ll;

vector <int> v[3*MX];
int n,m;
bool dfs( int x , int p , int c )
{
    int ret=0;
    if ( c==2 && x==n ) { return 1; }
    if ( c>=2 ) { return 0; }
    for ( auto g : v[x] )
    {
        if ( g==p ) { continue; }
        ret |= dfs( g , x , c+1 );
    }
    return ret;
}


int main()
{
    cin>>n>>m;
    for ( int i=0 ;i<m ; i++ )
    {
        int a,b;
        scanf ( "%d%d" , &a , &b );
        v[a].push_back(b);
        v[b].push_back(a);
    }

    if ( dfs( 1 , -1 , 0 ) ) { puts("POSSIBLE"); }
    else { puts("IMPOSSIBLE"); }


    return 0;
}


Measured memory_bytes: 14320
#include <bits/stdc++.h>
using namespace std;
const int MAX=30;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<int> a(N);
    for (int i=0;i<N;++i) cin >> a[i];
    int sum=0;
    vector<int> cnt(MAX,0);
    for (int i=0;i<N;++i){
        sum^=a[i];
        for (int j=0;j<MAX;++j) if (a[i]&1<<j){
            ++cnt[j]; break;
        }
    }
    int ans=0;
    for (int i=MAX-1;i>=0;--i) if (sum&1<<i){
        if (!cnt[i]){cout << -1 << '\n'; return 0;}
        ++ans; sum^=(1<<(i+1))-1;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 640
#include <iostream>
#include <map>
using namespace std;
int main(){
    int x, y, z, xx, yy, zz;
    scanf("%d%d%d", &x, &y, &z);
    int ma = 1e7;
    for(int i = 0; i < ma; ++i){
        if(x&1||y&1||z&1) return printf("%d\n", i), 0;
        else{
            xx = y/2+z/2;
            yy = x/2+x/2;
            zz = x/2+y/2;
            x = xx, y = yy, z = zz;
        }
    }
    printf("-1\n");
    return 0;
}


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

using namespace std;
using ll = long long;

const int INF = 1e9+10;

char g[30][30];
vector<pair<int,int>> s,e;
int r,c;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

bool ok(int posX,int posY){
	return posX>=0&&posX<r&&posY>=0&&posY<c&&g[posX][posY]=='.';
}

void solve(){
	int ans = 0;
	cin >> r >> c;
	for(int i=0;i<r;++i){
		for(int j=0;j<c;++j){
			cin >> g[i][j];
		}
	}
	for(int i=0;i<r;++i){
		for(int j=0;j<c;++j){
			if(g[i][j]=='.'){
				s.push_back({i,j});
				e.push_back({i,j});
			}
		}
	}
	for(int i=0;i<s.size();++i){
		for(int j=0;j<e.size();++j){
			if(s[i]==e[j]) continue;
			queue<pair<int,int>> q;
			vector<vector<int>> d(30,vector<int>(30,INF));
			d[s[i].first][s[i].second]=0;
			q.push(s[i]);
			while(!q.empty()){
				int x = q.front().first;
				int y = q.front().second;
				q.pop();
				for(int i=0;i<4;++i){
					int n_x = x+dx[i];
					int n_y = y+dy[i];
					if(ok(n_x,n_y)&&d[x][y]+1 < d[n_x][n_y]){
						q.push({n_x,n_y});
						d[n_x][n_y] = d[x][y]+1;
					}
				}
			}
			//cout << "dist = " << d[e[j].first][e[j].second] << '\n';
			ans = max(ans,d[e[j].first][e[j].second]);
		}
	}
	cout << ans << '\n';
}

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

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define vi vector <int>
#define vvi vector <vi>
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
#define MOD 1000000007
using namespace std;

int main(){

#ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout); 
#endif
    
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n; cin>>n;
    if (n<=599 && n>=400) cout<<8<<endl;
    if (n<=799 && n>=600) cout<<7<<endl;
    if (n<=999 && n>=800) cout<<6<<endl;
    if (n<=1199 && n>=1000) cout<<5<<endl;
    if (n<=1399 && n>=1200) cout<<4<<endl;
    if (n<=1599 && n>=1400) cout<<3<<endl;
    if (n<=1799 && n>=1600) cout<<2<<endl;
    if (n<=1999 && n>=1800) cout<<1<<endl;

    // cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms\n";
    return 0;
}


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

int main(){
    int K,S;
    cin>>K>>S;
    int count=0;
    for(int i=0;i<=K;i++){
        for(int j=0;j<=K;j++){
            if(0<=S-i-j && S-i-j<=K){
                count++;
            }
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256
import sys

A, B, C, D, E, F = map(int, sys.stdin.readline().split())
E = 100 * E / (100 + E)

def main():
    w = set()
    for w1 in range(0, F+1, 100*A):
        for w2 in range(0, F-w1+1, 100*B):
            w.add(w1 + w2)

    s = set()
    for s1 in range(0, F+1, C):
        for s2 in range(0, F-s1+1, D):
            s.add(s1 + s2)
            
    w = sorted(w)
    s = sorted(s)

    res = set()
    for i in w[1:]:
        for j in s:
            if i + j > F:
                break
            sol = 100 * j / (i + j)
            if sol <= E:
                res.add((sol, i+j, j))

    res = sorted(res, reverse=True)
    return res[0][1], res[0][2]

if __name__ == '__main__':
    ans = main()
    print(*ans, sep=' ')

Measured memory_bytes: 4804
#include<cstdio>
using ull = unsigned long long;
const static unsigned MOD = 1000000007;

ull RepeatSquaring(ull N, ull P){
	if(P == 0 || N == 1) return 1;
	if(!(P & 1)){
		ull t = RepeatSquaring(N, P >> 1);
		return t*t %MOD;
	}
	return N*RepeatSquaring(N, P - 1) % MOD;
}

int main(){
    ull N, K;
    scanf("%llu %llu", &N, &K);
    ull dp[K+1], answer = 0;
    for (ull i = K; i > 0; i--){
        dp[i] = RepeatSquaring(K/i, N);
        for (ull j = i*2; j <= K; j += i){
            dp[i] = (MOD + dp[i] - dp[j]) %MOD;
        }
        answer = (answer + i*dp[i]) %MOD;
    }
    printf("%llu\n", answer);
	return 0;
}

Measured memory_bytes: 2448
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

class CumulativeSum {
    vector<ll> numbers;
    vector<ll> sums;

public:
    CumulativeSum(int n) {
        numbers.resize(n);
        sums.resize(n);
    }

    void set(int i, ll value) {
        numbers[i] = value;
    }

    ll getSum(int i) {
        if (i == -1) return 0;
        if (i == sums.size()) return sums.back();
        return sums[i];
    }

    ll getSectionSum(int start, int end) {
        return getSum(end) - getSum(start - 1);
    }

    void calculate() {
        for (int i = 0; i < numbers.size(); i++) {
            sums[i] = getSum(i - 1) + numbers[i];
        }
    }

};
// 237821842426978
int main() {
//    ifstream file("C:\\Users\\riku\\Downloads\\08 (2).txt");

    int n;
    ll m;
    cin >> n >> m;


    vector<ll> people(n);
    rep(i, n) cin >> people[i];

    sort(people.begin(), people.end());


    ll floor = -1, ceil = INF;

    auto count_over = [&](ll mid) {
        ll sum = 0;
        for (ll p : people) {
            ll k = mid - p;
            auto it = lower_bound(people.begin(), people.end(), k);
            int c = distance(it, people.end());
            sum += c;
        }
        return sum;
    };

    while (floor + 1 < ceil) {
        ll mid = (floor + ceil) / 2;
        ll c = count_over(mid);
        if (m < c) floor = mid;
        else ceil = mid;
    }


    auto count_over_h = [&](ll over) {
        CumulativeSum cs(n);
        rep(i, n) cs.set(i, people[i]);
        cs.calculate();

        ll sum = 0;
        for (ll p : people) {
            ll k = over - p;
            auto it = lower_bound(people.begin(), people.end(), k);
            int c = distance(it, people.end());
            ll lh = c * p;
            ll rh = cs.getSectionSum(n - c, n);
            ll now = lh + rh;
            sum += now;
        }
        return sum;
    };

    ll over = count_over(ceil);
    ll ext = m - over;
    ll eq_h = floor * ext;
    ll over_h = count_over_h(ceil);

    ll ans = eq_h + over_h;
    cout << ans << endl;

}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int x = scan.nextInt();
		int y = scan.nextInt();

		x--;
		y--;

		int s = y - x - 1;

		int[] g = new int[n];
		int i,j,k;

		int temp = 0;
		for(i = 0; i < n - 1; i++) {
			for(j = i + 1; j < n; j++) {
				temp = Math.min(j - i, Math.abs(x - i) + 1 + Math.abs(y - j));
				g[temp]++;
			}
		}

		for(k = 1; k <= n - 1; k++) {
			System.out.println(g[k]);
		}
	}
}


Measured memory_bytes: 22740
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def lcm(a, b):
    return a // gcd(a, b) * b

N = input()
V = 1
for i in range(int(N)):
    T = input()
    V = lcm(V, int(T))

print(V)

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

using namespace std;

#define int long long
#define forn(i,n) for(int i = 0; i <(int)n; ++i)
const int MOD = 1000000007; // opsi : 998244353, 1000000007,

int32_t main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int arr[n];
    map<int,int> mp;
    int jml = 0;
    forn(i,n){
        cin >> arr[i];
        if(mp.count(arr[i]) == 0){
            mp[arr[i]] = 1;
        }
        else mp[arr[i]]++;
        jml+=arr[i];
    }

    int q;
    cin >> q;
    while(q--)
    {
        int b,c;
        cin >> b >> c;

        if(mp.count(b) == 0){
            mp[b] = 0;
        }
        jml = jml + c*(mp[b]) - b*mp[b];

        if(mp.count(c) == 0) mp[c] = mp[b];
        else mp[c] = mp[c] + mp[b];

        mp[b] = 0;
        cout << jml << '\n';

    }
    return 0;
}


Measured memory_bytes: 10304
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 1000000000
#define MOD 1000000007
#define ll long long int
using namespace std;


int main(){
 int N; cin>>N;
 vector <int> h; h.resize(N+1,0);
 for(int i=1;i<=N;i++) cin>>h[i];
 int ans = 1;
 for(int i=2;i<=N;i++){
   for(int j=1;j<i;j++){
     if(h[j] <= h[i]){
       if(j==i-1) ans++;
     }
     else break;

   }
 }

cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int intSort(const void* a, const void *b){
  if(*(int *)a < *(int *)b)
    return 1;
  else if(*(int *)a == *(int*)b)
    return 0;
  
  return -1;
}

int main(void){
  int n,k;
  int *l;

  scanf("%d %d",&n,&k);

  l = (int*)malloc(sizeof(int) * n);

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

  qsort(l,n,sizeof(int),intSort);

  int res = 0;

  for(i = 0; i < k;i++)
    res += l[i];

  printf("%d\n",res);
  free(l);
  return 0;

}

Measured memory_bytes: 128
n = int(input())
number_list = list(map(int, input().split()))
number_list.sort(reverse=True)

number = iter(number_list)

a = 0
b = 0

for i in range(int(n)):
    if i % 2 == 0:
        a += int(next(number))
    else:
        b += int(next(number))

print(a-b)



Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;

//ここから
vector<ll>a;
ll n,m;

bool C(ll mid){
  ll sum=0;
  rep(i,n){
    sum+=a.end()-lower_bound(all(a),mid-a[i]);
  }
  return sum>=m;
}

void solve(){
  cin>>n>>m;
  a.resize(n);
  rep(i,n)cin>>a[i];
  sort(a.begin(),a.end());
  ll l=0,r=INF;
  while(r-l>1){
    ll mid=(l+r)/2;
    if(C(mid))l=mid;
    else r=mid;
  }
  ll ans=0;
  vector<ll>sum(n+1);
  rep(i,n)sum[i+1]=sum[i]+a[i];
  ll cnt=0;
  rep(i,n){
    ll x=l-a[i];
    int pos=lower_bound(all(a),x)-a.begin();
    ans+=sum[n]-sum[pos];
    ans+=(n-pos)*a[i];
    cnt+=(n-pos);
  }
  //cerr<<cnt<<endl;
  cout<<ans-(cnt-m)*l;
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
s = input()

l = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

if s == l[0]:
    print('7')
elif s == l[1]:
    print('6')
elif s == l[2]:
    print('5')
elif s == l[3]:
    print('4')
elif s == l[4]:
    print('3')
elif s == l[5]:
    print('2')
else:
    print('1')

Measured memory_bytes: 3064
S = input()
T = input()

L = len(S) - len(T) + 1
c = [0 for i in range(L)]
for i in range(L):
    X = S[i:i+len(T)]
    for j in range(len(X)) :
        if X[j] != T[j] :
            c[i] = c[i] + 1
   
ans = min(c)

print(ans)

Measured memory_bytes: 9128
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int a500 = sc.nextInt();
        int b100 = sc.nextInt();
        int c50 = sc.nextInt();
        int sum = sc.nextInt();

        int count = 0;
        for (int i = 0; i <= a500; i++) {
            for (int j = 0; j <= b100; j++) {
                int r = (sum - 500 * i - 100 * j) / 50;
                if (r >= 0 && r <= c50) {
                    count++;
                };
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 23764
//https://beta.atcoder.jp/contests/tenka1-2018/tasks/tenka1_2018_d
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

int a[1123][1123];
int main(){
    int N;
    cin>>N;
    int K=-1;
    for(int i:range(2,1123)){
        if(i*(i-1)/2==N){
            K=i;
            break;
        }
    }
    if(K==-1)cout<<"No"<<endl;
    else {
        cout<<"Yes"<<endl;
        cout<<K<<endl;
        int p=1;
        string sp(K-1,' ');
        sp.back()='\n';
        for(int i:range(K)){
            for(int j:range(i+1,K)){
                a[i][j]=a[j][i]=p++;
            }
            int id =0;
            cout<<K-1<<" ";
            for(int j:range(K)){
                if(i!=j)cout<<a[i][j]<<sp[id++];
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3328
using System;

namespace _2_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var abc = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var a = abc[0];
            var b = abc[1];
            var c = abc[2];
            if (a < b && b < c)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}



Measured memory_bytes: 15956
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
int main()
{
    //freopen("C.01.in","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int dif;
    vii mat(3, vi(3));
    rep(i, 0, 3)
    {
        rep(j, 0, 3)
        {
            cin >> mat[i][j];
        }
    }
    rep(i, 1, 3)
    {
        dif = mat[i][0] - mat[i - 1][0];
        rep(j, 1, 3)
        {
            if (mat[i][j] - mat[i - 1][j] != dif)
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    rep(j, 1, 3)
    {
        dif = mat[0][j] - mat[0][j-1];
        rep(i, 1, 3)
        {
            if (mat[i][j] - mat[i][j-1] != dif)
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define fi first
#define se second
 
priority_queue<P> q,v;
priority_queue<P,vector<P>,greater<P> > q2;
 
signed main(){
  int sum=0,PPP=0;
  int n,k;
  cin>>n>>k;
  int t[n],d[n];
  r(i,n)cin>>t[i]>>d[i];
  r(i,n){
    q.push(P(d[i],t[i]));
  }
  map<int,int>st;
  r(i,n){
    P p=q.top();q.pop();
    if(st[p.se]||PPP==k)v.push(p);
    else{
      q2.push(p);
      st[p.se]++;
      sum+=p.fi;
      PPP++;
    }
  }
  int x=n-v.size();
  int ans= sum+x*x;
  while(!v.empty()){
    P p=v.top();v.pop();
    if((int)q2.size()==k){
      P a=q2.top();q2.pop();
      st[a.se]--;
      if(st[a.se]==0)x--;
      sum-=a.fi;
    }
    int A=p.fi;
    int B=p.se;
    sum+=A;
    st[B]++;
    if(st[B]==1)x++;
    q2.push(p);
    ans=max(ans,sum+x*x);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 11248
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second   
#define rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define setval(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define trav(x , a) for(auto &x : a)
#define sz(a) ((int)a.size())
typedef long long ll ; 
#define int ll
using namespace std;

const int N = 3e5 + 5 ;
const int mod = 1e9 + 7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const long double eps = 1e-9 ;

using namespace __gnu_pbds;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

typedef pair<int, int> pii; 
typedef pair<int , pii> ipii ;
typedef pair<pii , int> piii ; 
typedef unsigned long long ull ;
typedef long double ld;

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

void solve()
{
  int n ;
  cin >> n;
  int p[n];
  int ans =0 ; 
  rep(i , n) cin >> p[i];
  for(int i = 1; i < n - 1 ; ++i){
    vector<int> tmp({p[i-1] , p[i] , p[i + 1]});
    sort(all(tmp));
    if(tmp[1] == p[i]) ans++ ;
  }
  cout << ans ;
}
     
int32_t main(int32_t argc, char *argv[])
{
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}


Measured memory_bytes: 3652
n = int(input())
h_list = input().split(' ')
h_list = [int(h) for h in h_list]

score = 1

h1 = h_list[0]
max_h = h_list[0]
for i in range(1, n):
    h_i = h_list[i]
    if h_i >= h1 and h_i >= max_h:
        score += 1
        max_h = h_i
print(score)

Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n, m := scanInt(), scanInt()
	a, b, c := make([]int, n), make([]int, n), make([]int, n)
	d, e, f := make([]int, m), make([]int, m), make([]int, m)
	x := map[int]int{}
	y := map[int]int{}
	for i := 0; i < n; i++ {
		a[i], b[i], c[i] = scanInt(), scanInt(), scanInt()
		x[a[i]], x[b[i]], y[c[i]] = 0, 0, 0
	}
	for i := 0; i < m; i++ {
		d[i], e[i], f[i] = scanInt(), scanInt(), scanInt()
		x[d[i]], y[e[i]], y[f[i]] = 0, 0, 0
	}
	x[0], y[0] = 0, 0

	xs, ys := []int{}, []int{}
	for i := range x {
		xs = append(xs, i)
	}
	for i := range y {
		ys = append(ys, i)
	}

	sort.Ints(xs)
	sort.Ints(ys)

	for i := 0; i < len(xs); i++ {
		x[xs[i]] = i
	}
	for i := 0; i < len(ys); i++ {
		y[ys[i]] = i
	}

	h, w := len(xs)*2, len(ys)*2
	g := make([][]bool, h)
	done := make([][]bool, h)
	for i := 0; i < h; i++ {
		g[i] = make([]bool, w)
		done[i] = make([]bool, w)
	}

	for i := 0; i < n; i++ {
		aa, bb, cc := x[a[i]]<<1, x[b[i]]<<1, y[c[i]]<<1
		for j := aa; j <= bb; j++ {
			g[j][cc] = true
		}
	}

	for i := 0; i < m; i++ {
		dd, ee, ff := x[d[i]]<<1, y[e[i]]<<1, y[f[i]]<<1
		for j := ee; j <= ff; j++ {
			g[dd][j] = true
		}
	}

	q := []pair{pair{x[0] << 1, y[0] << 1}}
	done[x[0]<<1][y[0]<<1] = true
	for len(q) != 0 {
		xx, yy := q[0].a, q[0].b
		q = q[1:]
		for i := 0; i < 4; i++ {
			nx, ny := xx+dx[i], yy+dy[i]
			if nx < 0 || nx >= h || ny < 0 || ny >= w {
				continue
			}
			if g[nx][ny] || done[nx][ny] {
				continue
			}
			done[nx][ny] = true
			q = append(q, pair{nx, ny})
		}
	}

	ans := 0
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if !done[i][j] {
				continue
			}
			if i == 0 || i == h-1 || j == 0 || j == w-1 {
				fmt.Fprintln(wr, "INF")
				return
			}
			if i&1 == 0 || j&1 == 0 {
				continue
			}
			ans += (xs[i>>1+1] - xs[i>>1]) * (ys[j>>1+1] - ys[j>>1])
		}
	}
	fmt.Fprintln(wr, ans)

}

type pair struct{ a, b int }

var dx, dy = []int{0, 1, 0, -1}, []int{1, 0, -1, 0}


Measured memory_bytes: 195528
X=int(input())
ans = 0
if 400<=X<=599:
  ans = 8
elif 600 <= X <= 799:
  ans = 7
elif 800 <= X <= 999:
  ans = 6
elif 1000 <= X <= 1199:
  ans = 5
elif 1200 <= X <= 1399:
  ans = 4
elif 1400 <= X <= 1599:
  ans = 3
elif 1600 <= X <= 1799:
  ans = 2
elif 1800 <= X <= 1999:
  ans = 1
print(ans)


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

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

    int N, M;
    cin >> N >> M;

    if (N == M){
        cout << "Yes" << "\n";
    }
    else {
        cout << "No" << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
//わからん
int main() {
    int n;
    cin >> n;
    long long a[100001];
    long long sum1 = 0;
    long long sum2 = 0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }

    long long ans1 = 0;
    long long ans2 = 0;

    for(int i = 0; i < n; i++){
        sum1 += a[i];
        if(i % 2 == 0 && sum1 <= 0){
            ans1 += (1 - sum1); 
            sum1 += (1 - sum1);
            if(sum1 == 0) {
                sum1++;
                ans1++;
            }
        }

        else if(i % 2 == 1 && sum1 >= 0){
            ans1 += (sum1 + 1);
            sum1 -= (1 + sum1);
            if(sum1 == 0) {
                sum1--;
                ans1++;
            }
        }
    }


    for(int i = 0; i < n; i++){
        sum2 += a[i];

        if(i % 2 == 0 && sum2 >= 0){
            ans2 += (sum2 + 1); 
            sum2 -= (1 + sum2);
            if(sum2 == 0) {
                sum2--;
                ans2++;
            }
        }
        else if(i % 2 == 1 && sum2 <= 0){
            ans2 += (1 - sum2);
            sum2 += (1 - sum2);
            if(sum2 == 0) {
                sum2++;
                ans2++;
            }
        }
    }

    if(sum2 == 0) ans2++;
    
    if(ans1 >= ans2) cout << ans2 << endl;
    else cout << ans1 << endl;

    return 0;
}

Measured memory_bytes: 4368
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    int count = 0;
    if (s[0] == '1') {
        count++;
    }
    if (s[1] == '1') {
        count++;
    }
    if (s[2] == '1') {
        count++;
    }
    cout << count;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    cout << min(a+b,min(b+c,c+a)) << endl;
}

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

int main()
{
  int N, M;
  cin >> N;
  vector<string> bluevec(N);
  for (int i = 0; i < N; i++) {
    cin >> bluevec.at(i);
  }
  
  cin >> M;
  vector<string> redvec(M);
  for (int i = 0; i < M;i++) {
    cin >> redvec.at(i);
  }
  int ans = 0;
  string word;
  int point;
  for (int i = 0; i < N; i++) {
    word = bluevec.at(i);
    point = 0;
    for (int i = 0; i < N; i++){
      if(word == bluevec.at(i)){
        point++;
      }
    }
    for (int i = 0; i < M; i++){
      if(word == redvec.at(i)) {
        point--;
      }
    }
    
    if (point > ans) {
      ans = point;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d))
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 256
n,m = gets.chomp.split().map(&:to_i)
x = gets.chomp.split().map(&:to_i)

if n>=m
  puts 0
  exit
end

x.sort!

diffs = Array.new(m-1)
(m-1).times do |i|
  diffs[i] = x[i+1] - x[i]
end

diffs.sort!

#p diffs
puts diffs.slice(0, m-n).inject(:+)

Measured memory_bytes: 10352
#include <bits/stdc++.h>
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

//定数
//円周率
const double pi = 3.141592653589793238462643383279;
//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 100000000000000000; // = 10^17
//ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnopqrstuvwxyzabc";
//よくあるmodくん
const ll MOD = 1000000007; // = 10^9 + 7
//前処理テーブルの大きさ指定
const int MAX = 1200000; // = 10^6 + 2*(10^5)
//ちなみに、1024MBで持てる最大長の配列は10^8程度

//データ構造
//隣接リスト用構造体（有向グラフ向け）
struct edge {
  ll to; // E.toでその辺の終点へアクセスできる。
  ll cost; // e.costでその辺の重みにアクセスできる。
};
//Union_Find木
struct UnionFind {
  vector<int> UF; // UF.at(i) : iの親の番号
  vector<int> SIZE; // SIZE.at(root(i)) : iと連結されてる要素の数
  UnionFind(int N) : UF(N), SIZE(N, 1) { // 最初は全てが根であるとして初期化
    for(int i = 0; i < N; i++) {
      UF.at(i) = i;
    }
  }
  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (UF.at(x) == x) {
      return x;
    }
    return UF.at(x) = root(UF.at(x));
  }
  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); // xの根をrx
    int ry = root(y); // yの根をry
    if (rx == ry) {
      return; // xとyの根が同じ(=同じ木にある)時はそのまま
    }
    // xとyの根が同じでない(=同じ木にない)時：小さい方の根を大きい方の根につける。
    if (SIZE.at(rx) < SIZE.at(ry)) {
      UF.at(rx) = ry;
      SIZE.at(ry) += SIZE.at(rx);
      SIZE.at(rx) = 0;
    }
    else {
      UF.at(ry) = rx;
      SIZE.at(rx) += SIZE.at(ry);
      SIZE.at(ry) = 0;
    }
  }
  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す。
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
  int size(int x) { // xと連結されてる要素の数を返す。
    return SIZE.at(root(x));
  }
};

//関数 (計算量)
//ctoi (O(1))
int ctoi(char c){
  if (c == '0') return 0;
  if (c == '1') return 1;
  if (c == '2') return 2;
  if (c == '3') return 3;
  if (c == '4') return 4;
  if (c == '5') return 5; 
  if (c == '6') return 6;
  if (c == '7') return 7;
  if (c == '8') return 8;
  if (c == '9') return 9;
  return -1;  
}
//to_char (O(1))
char to_char(int i){
  if (i == 0) return '0';
  if (i == 1) return '1';
  if (i == 2) return '2';
  if (i == 3) return '3';
  if (i == 4) return '4';
  if (i == 5) return '5';
  if (i == 6) return '6';
  if (i == 7) return '7';
  if (i == 8) return '8'; 
  if (i == 9) return '9';
  return ' ';  
}

// A^N mod M を計算する。modしたくなかったらM = LINFとかにすればよい。(O(√N))
ll modpow(ll A, ll N, ll M) {
  ll ans = 1;
  while (N > 0) {
    if (N & 1) ans = ans * A % M;
      A = A * A % M;
      N >>= 1;
   }
  return ans;
}

//メイン処理
int main() {
  cout << fixed << setprecision(16); //精度向上
  //ここまでテンプレ
  int D, T, S;
  cin >> D >> T >> S;
  if (D <= T * S) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}
  

Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] inputs;
		inputs = br.readLine().split(" ");
		int n = Integer.parseInt(inputs[0]), m = Integer.parseInt(inputs[1]);

		// ノード配列作成
		Node[] nodes = new Node[n];
		for ( int i = 0; i < n; i++ ) {
			nodes[i] = new Node();
		}
		for ( int i = 0; i < m; i++ ) {
			inputs = br.readLine().split(" ");
			int x = Integer.parseInt(inputs[0]) - 1, y = Integer.parseInt(inputs[1]) - 1;
			nodes[x].chldList.add(nodes[y]);
			nodes[y].prntCnt++;
		}

		// 始点サーチ
		ArrayDeque<Node> toCheck = new ArrayDeque<>();
		for ( Node node : nodes ) {
			if ( node.prntCnt == 0 ) toCheck.add(node);
		}

		// BFSで距離計算開始
		int lenMax = 0;
		while ( toCheck.size() > 0 ) {
			Node node = toCheck.pollFirst();
			for ( Node chld : node.chldList ) {
				chld.prntCnt--;
				chld.len = Math.max(node.len + 1, chld.len);
				lenMax = Math.max(lenMax, chld.len);
				// 全返をチェックした子はチェックリストへ
				if ( chld.prntCnt == 0 ) {
					toCheck.add(chld);
				}
			}
		}
		System.out.println(lenMax);
	}
}

class Node{

	int				len			= 0;
	int				prntCnt		= 0;
	ArrayList<Node>	chldList	= new ArrayList<>();

}


Measured memory_bytes: 54136
import java.util.*;

public class Main {
	
	static final long MOD = 1000000007L;
	
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int x;
		int y;
		if (n % 2 == 0) {
			x = 0;
			y = 1;
		} else {
			x = 1;
			y = 0;
		}
		Arrays.sort(arr);
		for (int i = 0; i < n; i++) {
			if (arr[i] != ((i + x) / 2) * 2 + y) {
				System.out.println(0);
				return;
			}
		}
		System.out.print(pow2(n / 2));
	}
	
	static long pow2(int times) {
		if (times == 0) {
			return 1;
		} else {
			return (2 * pow2(times - 1)) % MOD;
		}
	}
}


Measured memory_bytes: 50540
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

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

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair

typedef long long ll;
typedef long double ld;

void solve(){
    string s, t;
    cin >> s >> t;
    int n = (int)s.size(), m = (int)t.size();
    int res = m;
    for(int i = 0; i < n - m + 1; i++){
        int curr = 0;
        for(int j = i; j < i + m; j++){
            if(t[j - i] != s[j]){
                curr++;
            }
        }
        res = min(res, curr);
    }
    cout << res << "\n";
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <string>
#include <vector>
#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;

    int MAX = 1000005;
    int count = 0;
    vector<int> s(MAX);
    vector<int> a(n);
    rep(i,n){
        int temp;
        cin >> temp;
        a[i] = temp;
        if(s[temp] > 0){
            s[temp] = 2;
            continue;
        }

        for(int j = temp;j < MAX; j += temp){
            s[j]++;
        }

    }

    rep(i,n){
        if(s[a[i]] == 1) count++;
    }

    cout << count << endl;
    }

Measured memory_bytes: 8008
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] c = new char[h][w];
        int[] dx = {1,0,-1,0,1,-1,-1,1};
        int[] dy = {0,1,0,-1,1,1,-1,-1};
        for (int i=0;i<h;i++){
            c[i]=sc.next().toCharArray();
        }
        for (int i=0;i<h;i++){
            for (int j=0;j<w;j++){
                if (c[i][j]!='#'){
                    int num = 0;
                    for (int d=0;d<8;d++){
                        int ni = i +dy[d];
                        int nj = j +dx[d];
                        if (ni<0||h<=ni)continue;
                        if (nj<0||w<=nj)continue;
                        if (c[ni][nj]=='#')num++;
                    }
                    c[i][j] = (char)(num+'0');
                }
                System.out.print(c[i][j]);
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 36324
#include <bits/stdc++.h>
using namespace std;
int main(){
    long n,ans=0;
    cin >> n;
    long a[n],b[300000]={};
    map<long,long> c;
    for(int i=0;i<n;i++) cin >> a[i];
    for(int i=0;i<n;i++){
        b[i+1] = b[i] + a[i];
        c[b[i+1]]++;
    } 
    for(auto i:c){
        long y=i.second;
        if(i.first==0) ans += (y*(y+1))/2;
        else ans += (y*(y-1))/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 15872
#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];

	int q;cin>>q;
	while(q--){
		int b,m,e;cin>>b>>m>>e;
		rotate(next(a.begin(),b), next(a.begin(),m), next(a.begin(),e));
	}

	bool isFirst=true;
	for(auto &&ai: a){
		if(!isFirst) cout<<" ";
		cout<<ai;
		isFirst &= false;
	}
	cout<<endl;
  return 0;
}



Measured memory_bytes: 3116
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll N;
    cin >> N;
    vector<ll> L(N);
    rep(0, i, N)
    {
        cin >> L.at(i);
    }

    ll ans = 0;

    rep(0, i, N)
    {
        rep(i + 1, j, N)
        {
            rep(j + 1, k, N)
            {
                // 同じ長さがあるならスルー
                if (L.at(i) == L.at(j) || L.at(i) == L.at(k) || L.at(j) == L.at(k))
                {
                    continue;
                }

                // 三角不等式を満たすか？
                if (L.at(i) + L.at(j) <= L.at(k))
                {
                    continue;
                }
                if (L.at(j) + L.at(k) <= L.at(i))
                {
                    continue;
                }
                if (L.at(k) + L.at(i) <= L.at(j))
                {
                    continue;
                }

                ans++;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3576
N = int(input())
D = [list(map(int, input().split())) for i in range(N)]

flg = False
cnt = 0
ans = 0
for d1, d2 in D:
    if d1 == d2:
        if not flg:
            cnt += 1
        if flg:
            cnt += 1
        flg = True
    else:
        flg = False
        ans = max(ans, cnt)
        cnt = 0
ans = max(ans, cnt)

if ans >= 3:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 62576
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>

using namespace std;

#define REP(var, count) for(int var=0; var<count; var++)

int DP[22][50010];

int main(void) {
	int N, M;
	cin >> N >> M;
	
	REP(y, N+1) {
		DP[0][y] = y;
	}
	
	REP(i, M) {
		int c;
		cin >> c;
		
		REP(y, N+1) {
			if ( y < c ) {
				DP[i+1][y] = DP[i][y];
			} else {
				DP[i+1][y] = min( { DP[i][y], DP[i][y-c] + 1, DP[i+1][y-c] + 1 } );
			}
			
		}
	
	}
	
	cout << DP[M][N] << endl;
}

Measured memory_bytes: 7184