akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define loop(k) rep(author_is_masa,k)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/
bool perf(vi p){
	rep(i,p.size()){
		if(i+1==p[i]) return false;
	}
	return true;
}

signed main(){
	int n;
	cin>>n;
	vi p(n);
	rep(i,n) cin>>p[i];

	int ans=0;

	rep(i,n-1){
		if(i+1==p[i]&&i+2==p[i+1]){
			ans++;
			swap(p[i],p[i+1]);
		}
	}
	while(!perf(p)){
		rep(i,n){
			if(i+1==p[i]){
				ans++;
				if(i>0) swap(p[i],p[i-1]);
				else swap(p[i],p[i+1]);
			}
			
		}
	}
	cout<<ans<<endl;


	return 0;
}



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

int main(int argc, char const *argv[]) {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	int a[300000];
	cin>>n;
	for (int i = 0; i < n; i++) {
		cin>>a[i];
	}
	int ans = 0;
	int min = 3e8;
	for (int i = 0; i < n; i++) {
		if (a[i] <= min) {
			min = a[i];
			ans++;
		}
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(){
	int n,l,j,sum,t;
	int a[205];
	while(~scanf("%d%d",&n,&l)){
		for(int i=0;i<n;i++)
		a[i]=l+i;
		if(a[n-1]>=0){
		for(j=0;j<n;j++)
		if(a[j]>=0){
		t=j;
			break;
		}
		}
		else
		t=n-1;
			sum=0;
		for(int i=0;i<n;i++)
		{
			if(i==t)
			continue;
			sum+=a[i];
		}
		printf("%d\n",sum);
	}
	return 0;
}


Measured memory_bytes: 256
module Main (main) where

import qualified Data.ByteString.Char8 as C8
import Data.Maybe

main :: IO ()
main = readInts >>= print . solve

solve :: [Int] -> Int
solve [n] = (n-1) * n `div` 2

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

Measured memory_bytes: 380
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    int n;
    cin >> n;
    vector<int> c(n);
    for (int i = 0; i < n; ++i) {
        cin >> c[i];
        --c[i];
    }

    if (n <= 2) {
        cout << 1 << endl;
        return 0;
    }

    vector<int> idx(200001, -1);
    idx[c[0]] = 0;
    idx[c[1]] = 1;
    vector<ll> dp(n);
    dp[0] = dp[1] = 1;
    constexpr ll mod = 1000000007LL;
    for (int i = 2; i < n; ++i) {
        dp[i] = dp[i - 1];
        if (idx[c[i]] != -1 && idx[c[i]] + 2 <= i) {
            dp[i] += dp[idx[c[i]]];
            dp[i] %= mod;
        }

        idx[c[i]] = i;
    }

    cout << dp.back() << endl;

    return 0;
}

Measured memory_bytes: 3456
#include<cstdio>
#include<set>
#include<algorithm>
#define rep(i, n) for ( int i = 0; i < (int)n; i++ )
using namespace std;
 
#define MAX 10000
#define BEGIN 1
#define END 0
 
class Sheet{
    public:
    int x1, y1, x2, y2;
    Sheet(){}
    Sheet(int x1, int y1, int x2, int y2): x1(x1), y1(y1), x2(x2), y2(y2){}
 
    bool operator < ( const Sheet &s ) const {
    if ( x1 == s.x1 ) return y1 < s.y1;
    return x1 < s.x1;
    }
};
 
class Event{ 
    public:
    int id, mode, x;
    Event(){}
    Event( int id, int mode, int x): id(id), mode(mode), x(x){}
 
    bool operator < ( const Event &e ) const{
    if ( x == e.x ) return mode > e.mode;
    return x < e.x;
    }
};
 
int n, ne;
Sheet S[MAX+1];
Event E[2*MAX+1];
int r;
 
int getHeight( multiset<pair<int, int> > &seg, int &group ){
    group = 1;
    if ( seg.size() == 0 ) return 0;
    int w = 0;
    int s, t;
    multiset<pair<int, int> >::iterator it = seg.begin();
    s = (*it).first;
    t = (*it).second;
    for (++it; it != seg.end(); it++ ){
    if ( (*it).first > t ){
        w += (t - s);
        s = (*it).first;
        t = (*it).second;
        group++;
    } else {
        t = max( t, (*it).second);
    }
    }
    w += (t - s);
    return w;
}
 
void sweep(){
    multiset< pair<int, int> > cur;
    int area = 0, vertical = 0, horizon = 0;
    int height = 0, preH = 0, group = 0, prex = E[0].x;
 
    for ( int e = 0; e < ne; e++ ){
    Event ev = E[e];
    area += (ev.x - prex)*height;
    horizon += (ev.x - prex)*2*group;
 
    if ( ev.mode == BEGIN ) cur.insert( make_pair( S[ev.id].y1, S[ev.id].y2) );
    else  cur.erase( cur.find(make_pair( S[ev.id].y1, S[ev.id].y2)) );
 
    preH = height;
    prex = ev.x;
 
    height = getHeight(cur, group);
 
    if ( ev.mode == BEGIN ) vertical += height - preH;
    else  vertical += preH - height;
    }
 
    printf("%d\n", area);
    if ( r == 2 ) printf("%d\n", vertical + horizon);
}
 
int main(){
    while(1){
    scanf("%d %d", &n, &r);
    if ( n == 0 && r == 0) break;
    ne = 0;
    rep(i, n) scanf("%d %d %d %d", &S[i].x1, &S[i].y1, &S[i].x2, &S[i].y2);
    sort( S, S+n);
    rep(i, n){
        E[ne++] = Event(i, BEGIN, S[i].x1);
        E[ne++] = Event(i, END, S[i].x2);
    }
    sort( E, E + ne );
    sweep();
    }
    return 0;
}

Measured memory_bytes: 1644
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  string s;
  cin >> s;

  cout << s[0] << s.size()-2 << s.back() << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++)
  {
      if(s[i]=='L'&&i%2==0)
      {
          cout<<"No"<<endl;
          return 0;
      }
      if(s[i]=='R'&&i%2!=0)
      {
          cout<<"No"<<endl;
          return 0;
      }
  }
  cout<<"Yes"<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
inline int ceil(double x, double base) {
    return ceil(x / base) * base;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    double s = 100000;
    while (n--) {
        s = ceil(s * 1.05, 1000);
    }
    cout << int(s) << "\n";

    return 0;
}

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

int n;
vector<vector<int>> G;  // 隣接リスト
vector<int> color;

bool dfs(int i, int c) {
    color[i] = c;
    for (auto j : G[i]) {
        if (color[j] == c) {
            return false;
        } else if (color[j] == 0) {
            if (!dfs(j, -c)) return false;
        }
    }
    return true;
}

bool bipartiteCheck() {   
    for (int i = 0; i < n; i++) color[i] = 0;
    return dfs(0, 1);
}



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

    int M;
    scanf("%d %d", &n, &M);
    G.resize(n);
    color.resize(n);
    for (int i = 0; i < M; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    // 二部グラフ判定
    if (bipartiteCheck()) {
        int B = 0, W = 0;
        for (auto c : color) {
            if (c == 1)
                B++;
            else
                W++;
        }
        cout << (int64_t) B * W - M << endl;
    } else {
        cout << (int64_t) n * (n - 1) / 2 - M << endl;
    }

    return 0;
}


Measured memory_bytes: 6528
import java.util.*;

public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        // 整数の入力
        // final int a = sc.nextInt();
        // 文字列の入力
        // final String s1 = sc.next();
        final int k = sc.nextInt();
        final String s = sc.next();
        sc.close();

        String result = s;
        if (s.length() > k) {
            result = result.substring(0, k) + "...";
        }
        System.out.println(result);
    }
}

Measured memory_bytes: 38632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

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

    if(k < a) {
        cout << a-k << " " << b << endl;
    } else if(k < a+b) {
        cout << 0 << " " << b-(k-a) << endl;
    } else {
        cout << 0 << " " << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
int n,X,D,x;
inline int gcd(int a,int b){
	if (b==0) return a;
	return gcd(b,a%b);
}
int main(){
	scanf("%d%d%d",&n,&X,&x);
	D=x-X;
	if (D<0) D=-D;
	fo(i,2,n){
		scanf("%d",&x);
		x-=X;
		if (x<0) x=-x;
		D=gcd(x,D);
	}
	printf("%d\n",D);
	return 0;
} 

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <stdio.h>
#include<vector>
#include<climits>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<functional>
#include <numeric>
#include <map>
#define FORi(N) for(int i=0;i<N;++i)
#define FORj(N) for(int j=0;j<N;++j)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
ll gcd(ll m,ll n){
  if(n==0)return abs(m);
  return(gcd(n,m%n));
}
void putYN(bool b){
  if(b){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}
int main(){
  ll N,K;
  string S;
  cin>>N>>S>>K;
  char a=S[K-1];
  FORi(N){
    if(S[i]!=a)S[i]='*';
  }
  cout<<S<<endl;
  return 0;
}


Measured memory_bytes: 256
class UnionFind:
    #要素数nで初期化
    #インスタンス変数の初期化
    def __init__(self, n):
        #root : 木の要素数
        #rnk : 木の高さ(rank)
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)
    
    """ノードxのrootノードを見つける"""
    def Find_Root(self, x):
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.Find_Root(self.root[x]) 
            return self.root[x]
    
    """木の合併"""
    def Union(self, x, y):
        #入力ノードの親を探索
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        
        #既に同じ木に所属する場合
        if (x==y):
            return 
        
        #異なる木に所属する場合 -> rnkから判断して合併する
        elif (self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x
        
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            
            #rnkが同じ(深さが同じ)場合
            if self.rnk[x]==self.rnk[y]:
                self.rnk[y] += 1
    
    """xとyが同じグループに所属するか"""
    #辺(x,y)が橋の場合 : isSameGroup(self, x, y)=False
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)
    
    """ノードxが属する木のサイズ"""
    def Count(self, x):
        return -self.root[self.Find_Root(x)]     
    
    """木(非連結成分)の数を数える"""
    #全連結成分にするために必要な橋の本数は、cnt - 1
    def Count_Unconnected_Component(self):
        cnt = 0
        for i in range(self.n):
            if self.root[i+1] < 0:
                cnt += 1
        return cnt
    
    def Members(self, x):
        r = self.Find_Root(x)
        return [i for i in range(self.n+1) if self.Find_Root(i) == r]
    
    """xが属する集合の個数"""
    def Size(self, x):
        return -self.root[self.Find_Root(x)]

n,m,k = map(int,input().split())
uf = UnionFind(n)
num = [0]*(n+1)
for _ in range(m):
    a,b = map(int,input().split())
    num[a] += 1
    num[b] += 1
    uf.Union(a,b)
block_edge = [[] for _ in range(n+1)]
for _ in range(k):
    c,d = map(int,input().split())
    block_edge[c].append(d)
    block_edge[d].append(c)
for i in range(1, n+1):
    res = uf.Size(i) - num[i] - 1
    for e in block_edge[i]:
        if uf.isSameGroup(i,e):
            res -= 1
    print(res, end=' ')

Measured memory_bytes: 117464
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <array>

// BEGIN CUT HERE
#ifdef _MSC_VER
#include <agents.h>
#endif
// END CUT HERE 

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) begin(v), end(v)
#define REV(v) rbegin(v), rend(v)
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define MT make_tuple
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef unsigned long long ull;

const int N = 110;

const double EPS = 1e-9;

bool on(double cx, double cy, double x1, double y1, double x2, double y2){
	if (x1 > x2) swap(x1, x2);
	if (y1 > y2) swap(y1, y2);

	return x1 < cx + EPS && cx - EPS < x2 && y1 < cy + EPS && cy - EPS < y2;
}

int main(){
	int T;
	cin >> T;
	while (T--){
		int xa, ya, xb, yb;
		cin >> xa >> ya >> xb >> yb;
		int dx = xb - xa, dy = yb - ya;
		double aa = 0, bb = 0;
		if (dx) aa = 1.*(dy) / dx; bb = ya - aa*xa;

		int n;
		cin >> n;
		vector<tuple<double, double, int>> v;
		rep(i, n){
			int xs, ys, xt, yt, o, l;
			cin >> xs >> ys >> xt >> yt >> o >> l;
			bool vert = xt - xs == 0;

			double a = 0, b = 0;
			if (!vert) a = 1.*(yt - ys) / (xt - xs), b = ys - a*xs;

			double cx, cy;
			if (dx == 0){
				if (vert) continue;
				cx = xa, cy = a*cx + b;
			}
			else{
				if (vert){
					cx = xt, cy = aa*cx + bb;
				}
				else{
					double lb = -1e5, ub = 1e5;

					double a1 = aa, b1 = bb, a2 = a, b2 = b;
					if (a1 * lb + b1 > a2*lb + b2) swap(a1, a2), swap(b1, b2);

					rep(abc, 1000){
						double mid = (lb + ub) / 2;
						if (a1 * mid + b1 > a2 * mid + b2) ub = mid;
						else lb = mid;
					}
					cx = lb, cy = a*cx + b;
				}
			}
			if (on(cx, cy, xs, ys, xt, yt) && on(cx, cy, xa, ya, xb, yb)){
				v.emplace_back(cx, cy, o^l);
			}
		}

		sort(ALL(v));
		int ans = 0, prv = -1;
		for (auto t : v){
			double x, y;
			int type;
			tie(x, y, type) = t;
			//cout << x << ' ' << y << ' ' << type << endl;
			if (prv >= 0 && prv != type) ++ans;
			prv = type;
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
typedef long long int  ll;
const int INF = INT_MAX;
#define pb push_back
#define mp make_pair
#define first X
#define second Y
#define nl cout<<"\n";   
using namespace std;   

int main() {   
    ios::sync_with_stdio(0);   
    cin.tie(0);   
   
    #ifndef ONLINE_JUDGE   
    freopen("input.txt", "r", stdin);   
    freopen("output.txt", "w", stdout);   
    #endif   
    
    int t;cin>>t;
    if(t>=30){cout<<"Yes";}
    else{cout<<"No";}
	       
}   
        

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define eps 1e-7
#define eq(x,y) (fabs((x)-(y)) < eps)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
const int mod = 998244353;
long double PI = acosl(-1);
const ll infl = 1e18+100;
const int inf = 2e9+100;
const int nmax = 2e5+2;
const int MAXLG = log2(nmax)+1;
//mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ost;


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

//    freopen("bajeces.txt", "r", stdin);
//    freopen("mara.txt", "w", stdout);

    ll a,b,n;
    cin>>a>>b>>n;
    ll sodo = min(n, b-1);
    ld bhag = 1.0*sodo/(1.0*b);
    ll ans = (1.0*a*bhag+eps);
    cout<<ans;
}
/*

*/


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

#define check cnt=0;for(j=0;j<6;j++)if(d1[j]==d2[j])cnt++;
#define r tmp=d2[1];d2[1]=d2[3];d2[3]=d2[4];d2[4]=d2[2];d2[2]=tmp;
#define y tmp=d2[0];d2[0]=d2[3];d2[3]=d2[5];d2[5]=d2[2];d2[2]=tmp;

bool same(int d1[],int d2[]){
 int tmp,cnt,j,a=1,i,k;
 check
   if(cnt==6)a=0;

 while(a){
  for(i=0;i<5;i++){
   for(k=0;k<4;k++){
    check
    if(cnt==6)break;
    r
   }
   check
   if(cnt==6)break;
   tmp=d2[0];
   d2[0]=d2[1];
   d2[1]=d2[5];
   d2[5]=d2[4];
   d2[4]=tmp;
  }
  if(cnt==6)break;
  y
  for(k=0;k<4;k++){
   check
   if(cnt==6)break;
   r
  }
  if(cnt==6)break;
  y
  y
  for(k=0;k<4;k++){
   check
   if(cnt==6)break;
   r
  }
  a=0;
 }

 if(cnt==6)return true;
 return false;

}


int main(){
 int d1[6],d2[6],tmp,cnt,j,a=1,i,k,judge;

 for(int i=0;i<6;i++){
  cin >> d1[i] ;
 }
 for(int i=0;i<6;i++){
  cin >> d2[i] ;
 }

 if(same(d1,d2))judge=1;
 else judge=0;

 if(judge==1)cout << "Yes" << endl ;
 else cout << "No" << endl ;

 return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define txt                        \
    freopen("ip.txt", "r", stdin); \
    freopen("op.txt", "w", stdout)
#define a3 INT_MAX
#define i3 INT_MIN
#define a6 INT64_MAX
#define i6 INT64_MIN
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define quickie                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define div2(a) (!(a & 1))
#define deb(x) cout << (#x) << " " << (x) << "\n";
#define newl cout << "\n"
#define all(s) s.begin(), s.end()
#define pi 3.14159265358979323846
#define mod 1000000007
#define fp(x) fixed << setprecision(x) <<
template <class T>
int digit(T a)
{
    vector<long long> dig = {
        0,
        9,
        99,
        999,
        9999,
        99999,
        999999,
        9999999,
        99999999,
        999999999,
        9999999999,
        99999999999,
        999999999999,
        9999999999999,
        99999999999999,
        999999999999999,
        9999999999999999,
        99999999999999999,
        999999999999999999,
        INT64_MAX};
    auto it = lower_bound(dig.begin(), dig.end(), a);
    int idx = (it - dig.begin());
    return idx;
}
template <class T>
void split(char c, T s)
{
    int n = s.size();
    int i = 0;
    while ((cout << s[i], i += 1) && (i < n) && (cout << c << ' '))
        ;
}

vector<ll> primes;
const int NN = 50;
int prime[NN];

void solve()
{
    int N;
    cin >> N;
    ll ans = 1;
    for (int i = 2; i <= N /*upto which u want to find primes */; i++)
    {

        bool isGood = 0;
        for (int j = 2; j <= sqrt(i); j++)
            if (i % j == 0)
            {
                isGood = 1;
                break;
            }

        if (!isGood)
        {
            //primes in increasing orde
            int curr = i;
            int sum = 0;
            while ((N / curr) > 0)
            {
                sum += N / curr;
                curr *= i;
            }
            ans = ans * (sum + 1) % mod;
        }
    }
    cout << ans;
}

int main()
{
    quickie;
    // txt;
    solve();
    return 0;
}

Measured memory_bytes: 3700
i = 0
listx, listy = [], []

while(True):
    x, y = map(int, input().split())
    if x == 0 and y == 0:
        break
    listx.append(x)
    listy.append(y)
    i += 1

for num in range(i):
    if listx[num] < listy[num]:
        print(listx[num], listy[num])
    else:
        print(listy[num], listx[num])


Measured memory_bytes: 6128
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using i64 = int64_t;
#define rep(i, s, n) for (i64 i = (s); i < (n); ++i)

void run() {
  i64 a, b, c, d;
  cin >> a >> b >> c>>d;
  cout << max(max(a*c, a*d), max(b*c, b*d)) << endl;
}

int main() {
  cin.tie(nullptr);
  run();
  return 0;
}


Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;
using i64 = long long;

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

    i64 N, K;
    cin >> N >> K;

    i64 ok = 0;
    i64 ng = K + 1;

    const auto isOK = [&](i64 x) {
        i64 sum = 0;
        i64 tmp = x;
        for (int i = 0; i < N; ++i) {
            sum += tmp;
            tmp /= 2;
            if (tmp <= 0) break;
        }
        return (sum <= K);
    };

    while (ng - ok > 1) {
        i64 mid = (ok + ng)/  2;
        if (isOK(mid)) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    cout << ok << endl;

    return 0;
}



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

int main(){
  int n,c,result = 100000000;
  cin >> n;
  vector<int> w(n);
  for(int i = 0;i < n;i++){
    cin >> w.at(i);
  }
  for(int t = 0;t < n-1;t++){
    int x = 0;
    for(int i = 0;i <= t;i++){
      x += w.at(i);
    }
    int y = 0;
    for(int i = t+1;i < n;i++){
      y += w.at(i);
    }
    c = abs(x - y);
    result = min(c,result);
  }
  cout << result << endl;
}

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

#define	MOD 1000000007;
#define PI 3.14159265358979323846;
#define rep(i,n) for(ll i = 0;i<(ll)n;i++)
using namespace std;
typedef long long ll;
static const int MAX = 50;
static const long long INFTYL = 9223372036854775807;
ll mod = 1000000007;
pair<ll, ll> p[MAX];

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

	int count = 0;
	int count_l = 0;
	int count_r = 0;
	rep(i, n) {
		if (s[i] == '(')
		{
			count++;
		}
		else if (s[i] == ')')
		{
			if (count <= 0) {
				count_l++;
			}
			else {
				count--;
			}
		}
	}

	string l, r;
	rep(i, count_l) {
		l = "(" + l;
	}
	s = l + s;
	rep(i, count) {
		r = r + ")";
	}
	s = s + r;

	cout << s << endl;
	return 0;
}

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

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

    if(a<=0 && b>=0){
        cout<<"Zero"<<endl;
    }else if(a>0){
        cout<<"Positive"<<endl;
    }else{
        if((b-a)%2==0){
            cout<<"Negative"<<endl;
        }else{
            cout<<"Positive"<<endl;
        }
       
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
using namespace std;
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;}
const long long INF=1LL<<60;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int a,b;
	cin>>a>>b;
	if(a*b%2==0)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
X, K, D = map(int, input().split())
b = 1

s = K * D
if X < -s:
  b = X + s
elif X > s:
  b = X - s
else:
  a = X // D
  b = X % D
  if (a - K) % 2 == 1:
    b = b - D
print(abs(b))

Measured memory_bytes: 9208
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        var input = new List<int>(10);
        for (int i = 0; i < 10; i++)
        {
            input.Add(Convert.ToInt32(Console.ReadLine()));
        }

        for (int i = 0; i < 3; i++)
        {
            Console.WriteLine(input.Max().ToString());
            input.Remove(input.Max());
        }
    }
}

Measured memory_bytes: 9960
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000000
#define AMAX 10000
int main(){
  int *A,*B,C[AMAX+1],n,i,j;
   scanf("%d",&n);
  A=malloc(sizeof(int)*(n+1));
  B=malloc(sizeof(int)*(n+1));
 
  for(i=0;i<=AMAX;i++)C[i]=0;
  for(j=1;j<=n;j++){
  scanf("%d",&A[j]);
  C[A[j]]++;
  }
  
 

  for(i=1;i<=AMAX;i++)C[i]+=C[i-1];
  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
      }
  for(i=1;i<=n-1;i++)printf("%d ",B[i]);
    printf("%d\n",B[n]);
  
  return 0;
}



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

using namespace std;
typedef long long int ll;
const int Y = 100003;
int w,h,n;
int x[Y],y[Y],sx[Y],sy[Y],ansx,ansy;
ll ans = 1000000000000000,sumd,maxd;
int main(){
	scanf("%d%d%d",&w,&h,&n);
	for(int i = 0;i < n;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		x[i] = a,y[i] = b,sx[i] = a,sy[i] = b;
	}
	sort(x,x + n);
	sort(y,y + n);
	for(int i = 1;i >= 0;i--){
		for(int j = 1;j >= 0;j--){
			ll a = x[(n-i)/2];
			ll b = y[(n-j)/2];
			sumd = 0,maxd = 0;
			for(int k = 0;k < n;k++){
				ll d = abs(a-sx[k]) + abs(b-sy[k]);
				sumd += d*2;
				maxd = max(maxd,d);
			}
			if(ans > sumd - maxd){
				ans = sumd - maxd;
				ansx = a;
				ansy = b;
			}
		}
	}
	printf("%lld\n%d %d\n",ans,ansx,ansy);
	return 0;
}


Measured memory_bytes: 2768
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

    ll ans = 0;
    //c = A - B
    for(ll c = 1; c < N; c++) {
        ll sc = 0;
        set<ll> st;
        for(ll x = 0; x < 100000000; x++) {
            if(x * c >= N) break;
            ll A = N - 1 - x * c;
            ll B = A - c;
            if(A <= 0 || B <= 0) continue;



            if(st.find(x * c) != st.end() || st.find(N - 1 - x * c) != st.end() || x * c == N - 1 - x * c) {
                break;
            } else {
                st.insert(x * c);
                st.insert(N - 1 - x * c);
                sc += a[x * c];
                sc += a[(N - 1) - x * c];
                ans = max(ans, sc);
            }
        }
    }

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

Measured memory_bytes: 5760
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 0
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

template<typename T1, typename T2>
ostream& operator << (ostream& os, const pair<T1, T2>& p){
  os << "{" << p.first << "," << p.second << "} ";
  return os;
}

int main() {
  int N, M, Q; cin >> N >> M >> Q;
  int p[501][501];
  for (int i = 0; i < M; ++i) {
    int L, R; cin >> L >> R;
    p[L][R]++;
  }

  LL S[501][501] = {};
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= N; ++j) {
      S[i][j] = S[i-1][j] + S[i][j-1] - S[i-1][j-1] + p[i][j];
    }
  }

  for (int i = 0; i < Q; ++i) {
    int L, R; cin >> L >> R;
    cout << S[R][R] - S[R][L-1] - S[L-1][R] + S[L-1][L-1] << endl;
  }
}


Measured memory_bytes: 3840
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm> 
using namespace std;
 
# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

const int limit = 11;

char op[limit];

long long int dfs(int depth,string s){
    if(depth==s.size()-1){

        string s1=s.substr(0,1);
        long long int ans=0;
        for(int i=1;i<s.size();i++){
            if(op[i-1]=='+'){
                ans += stoll(s1);
                s1="";
            }
            s1 += s.substr(i,1);
        }
        ans += stoll(s1);
        return ans;
    }

    long long int ret=0;
    op[depth]='+';
    ret += dfs(depth+1,s);
    op[depth]=' ';
    ret += dfs(depth+1,s);
    return ret;
}

int main()
{
    string s;cin >> s ;
    p(dfs(0,s))
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, m;
	cin >> n >> m;
	ll ans = 0;
	if ((n>=2) && (m>=2)){
		cout << (n-2) * (m-2) << endl;
	} else if ((n==1) && (m==1)){
		cout << 1 << endl;
	} else if (n==1){
		cout << m-2 << endl;
	} else if (m==1){
		cout << n-2 << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//do {
//    print(v);
//  } while (std::next_permutation(v.begin(), v.end()));


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

	string S;
	cin >> S;
	int zero = 0, one = 0,ans=0;
	REP(i, S.size()) {
		if (S[i] == '0')zero++;
		else one++;

		if (zero > 0 && one > 0) {
			one--;
			zero--;
			ans++;
		}
	}
	cout << S.size()-one-zero << endl;

	return 0;
}



Measured memory_bytes: 512
#include<cstdio>

int main(){
	int n,m;
	char s[50][51],t[50][51];
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++) scanf("%s",s[i]);
	for(int i=0;i<m;i++) scanf("%s",t[i]);
	for(int i=0;i+m-1<n;i++){
		for(int j=0;j+m-1<n;j++){
			bool flag = true;
			for(int k=0;k<m;k++){
				for(int l=0;l<m;l++){
					if(s[i+k][j+l]!=t[k][l]) flag = false;
				}
			}
			if(flag){
				printf("Yes\n");
				return 0;
			}
		}
	}
	printf("No\n");
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		LinkedList<Integer> list = new LinkedList<>();
		for (int i = 0; i < Math.pow(2, n) / 2; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (a == b) {
				list.add(a);
			} else {
				list.add(Math.abs(a - b));
			}
		}
		while (list.size() > 1) {
			int a = list.poll();
			int b = list.poll();
			if (a == b) {
				list.add(a);
			} else {
				list.add(Math.abs(a - b));
			}
		}
		System.out.println(list.poll());
	}
}


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

#define rep(i,n) for(signed i=0;i<n;++i)
#define int long long
#define str string
#define debg(a) cout<<#a<<":"<<a<<endl;
#define print(a) cout<<a<<endl;
#define end cout<<endl;
#define elif else if


int a,b,c,i,j,k,n,m,x,y,z;
str s,t;
vector<signed> v;

signed main(){
  
  str a,b,c;
  int n;
  cin>>n>>a>>b>>c;
  int cnt=0;
  rep(i,n){
      if(a[i]==b[i]&&b[i]==c[i])continue;
      else if(a[i]==b[i]&&b[i]!=c[i])cnt++;
      else if(a[i]!=b[i]&&b[i]==c[i])cnt++;
      else if(a[i]==c[i]&&a[i]!=b[i])cnt++;
      else if(a[i]!=b[i]&&a[i]!=c[i])cnt+=2;
  }
  cout<<cnt;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
const ll mod = 1e9 + 7;
const ll p = 137;
int h, w;
char g[55][55], s[1005];
int x[305], y[305];
int main() {
    while(scanf("%d%d", &h, &w) != EOF) {
        if(h == 0 && w == 0) break;
        for(int i = 0; i < h; ++i) {
            scanf("%s", g[i]);
            for(int j = 0; j < w; ++j) {
                int id = (int)g[i][j];
                x[id] = i, y[id] = j;
            }
        }
        scanf("%s", s);
        int len = strlen(s);
        int px = 0, py = 0, ans = 0;
        for(int i = 0; i < len; ++i) {
            int id = (int) s[i];
            ans += abs(px - x[id]) + abs(py - y[id]) + 1;
            px = x[id], py = y[id];
        }
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 3152
import java.util.*;
public class Main {
    //変数定義
    static long [] SumB;
    static int M ;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        M = sc.nextInt();
        long K = sc.nextLong();
        long A[] = new long[N+1];
        long B[] = new long[M+1];
        long SumA[] = new long[N+1];
        SumA[0]=0;
        SumB = new long[M+1];
        SumB[0]=0;
        long Remain = 0;
        int wk=0;
        int ans=0;

        for(int i=1;i<=N;i++){
            A[i]=sc.nextLong();

            SumA[i]=SumA[i-1]+A[i];
        }

        for(int j=1;j<=M;j++){
            B[j]=sc.nextLong();

            SumB[j]=SumB[j-1]+B[j];
        }


        outside:for(int i=0;i<=N;i++){
            Remain = K-SumA[i];
            if (Remain>0) {
                //二分探索

                wk=i+(binarysearch(Remain));

                ans=Math.max(wk,ans);

            }

            else{
                //終了
                if (Remain==0) {
                    wk=i;
                }
                else{
                    wk=i-1;
                }
                ans=Math.max(wk,ans);
                break outside;
            }
        }


        System.out.println(ans);


    }

    //関数定義二分探    
    public static int binarysearch(long key) {
        
        int left = 0;
        
        int right = SumB.length;
        
        while (right - left > 1) {
            
            int mid = left + (right - left) / 2;
            
            if (SumB[mid] > key){
            right = mid;
            
            }
            else{
            left = mid;
            } 
        }
    
        /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
        return left;
    }


}

Measured memory_bytes: 57172
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int n,ans=0;
    cin>>n;
    for(int i=1;i<=n;i+=2){
        int tmp=0;
        for(int j=1;j<=i;j++){
            if(i%j==0)tmp++;
        }
        if(tmp==8)ans++;
    }
    cout<<ans<<endl;
}

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

int main(){
    int A,B,C,D;
    cin >> A >> B >> C >> D ;

    while(1){
        C = C - B;
        if (C <= 0)
        {
            cout << "Yes" << endl;
            return 0;
        }

        A = A - D;
        if (A <= 0 )
        {
            cout << "No" << endl;
            return 0;
        }
        
        
    }

    return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K,buf,ans;
  bool flag;
  cin>>N>>K;
  vector<int> D(K);
  for(int i=0;i<K;i++){
    cin>>D.at(i);
  }
  for(int i=N;;i++){
    buf=i;
    flag=true;
    while(buf!=0){
      for(int j=0;j<K;j++){
		if(D[j]==buf%10){
          flag=false;
          break;
        }
      }
      if(!flag)break;
      
      buf/=10;
    }
    if(flag){
      ans=i;
      break;
    }
  }
  cout<<ans<<endl;
} 

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

int color[100001];

int main(void) {
  long N; cin >> N;
  for (long i = 1; i <= N; i++) color[i] = 2;
  vector<vector<pair<long, long> > > tree(N+1);
  for (long i = 0; i < N-1; i++) {
    long u, v, w; cin >> u >> v >> w;
    tree.at(u).push_back(make_pair(v, w));
    tree.at(v).push_back(make_pair(u, w));
  }

  queue<long> q; q.push(1);
  color[1] = 0;
  while (!q.empty()) {
    long v = q.front();
    for (pair<long, long> i : tree.at(v)) if (color[i.first] == 2) {
      if (i.second%2 == 0) color[i.first] = color[v];
      else color[i.first] = !color[v];
      q.push(i.first);
    }
    q.pop();
  }

  for (long i = 1; i <= N; i++) cout << color[i] << endl;

  return 0;
}


Measured memory_bytes: 8320
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<stack>
#include<iostream>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define vec(a) vector<int>a
using namespace std;
//fibonacci
int binet(int n)
{
	return (pow((1+sqrt(5)),n-1)-pow((1-sqrt(5)),n-1))/(pow(2,n-1)*sqrt(5));
}


int main()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
	fastio
	ll n,k,i,j,l,m;
	cin>>n>>k;
	ll arr[n];
	for(i=0;i<n;i++)
		cin>>arr[i];
	sort(arr,arr+n);
	l=0;
	for(i=0;i<n-k;i++)
		l+=arr[i];
	cout<<l<<"\n";
	return 0;
}

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

#define int long long
#define fi first
#define se second
#define pb push_back

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

int n, a[100005], ind[100005], mxpref[100005], suffix[100005];
ii srt[100005];
stack<int> stk;

signed main(){
	ios_base::sync_with_stdio(0);
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		srt[i] = {a[i], i};
	}
	sort(srt + 1, srt + n + 1);
	for(int i = 1; i <= n; i++) ind[srt[i].se] = i;
	for(int i = n; i >= 0; i--) suffix[i] = (suffix[i + 1] + srt[i].fi); 
	for(int i = 1; i <= n; i++) mxpref[i] = max(mxpref[i - 1], ind[i]);
	int tol = 0;
	for(int i = n; i >= 1; i--){
		if(ind[i] < mxpref[i - 1]){
			stk.push(0);
			continue;
		}
		stk.push(suffix[mxpref[i - 1]] - srt[mxpref[i - 1]].fi * (n - mxpref[i - 1] + 1) - tol);
		tol += stk.top();
	}
	while(!stk.empty()){
		cout << stk.top() << "\n";
		stk.pop();
	}
}


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

int main() {
 string S;
  cin >> S;
  bool ok=true;
  if(S[0]!='A'){
   ok=false;
  }

  if(S[1]<='Z' || S[1]>'z')ok=false;
  int n=S.size(),cnt=0,stl=0;
  for(int i=2;i<n-1;i++){
  if(S[i]=='C'){
  cnt++;
  }
  }
  for(int i=2;i<n;i++){
   if(S[i]>'Z' && S[i]<='z'){
   stl++;
   }
  }

  if(cnt!=1)ok=false;
  if(stl!=n-3)ok=false;

  if(ok){
  cout << "AC" << endl;

  }
  else{
  cout << "WA" << endl;

  }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;

//typedef modint998244353 mint;

const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;

const ll MAX = 1e9 + 5;


int main() {
	int k;
	cin >> k;
	string s = "ACL";
	string ans = "";
	for (int i = 0; i < k; i++) {
		ans += s;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < int(n); i++)
#define rep1(i,n) for (int i = 1; i <= int(n); i++)
#define repR(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep1R(i,n) for (int i = int(n); i >= 1; i--)
#define loop(i,a,B) for (int i = a; i B; i++)
#define loopR(i,a,B) for (int i = a; i B; i--)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define cauto const auto
#ifdef LOCAL
#define dump(...) cerr << "[" << __LINE__ << ":" << __FUNCTION__ << "] ", my_dmp(#__VA_ARGS__, __VA_ARGS__)
void my_dmp(const char*) { cerr << endl; }
template <class T, class... U>
void my_dmp(const char *s, T const& x, U const& ...y) { const char *o = "({[", *e = "]})"; for (int i = 0; *s != '\0'; cerr << *s++) { if (count(o,o+3,*s)) i++; if (count(e,e+3,*s)) i--; if (!i && *s == ',') break; } cerr << " = " << x; if (*s == ',') cerr << ", ", s++; my_dmp(s, y...); }
#else
#define dump(...)
#endif
using ll = long long;
#define int ll
template <class T> using pque_max = priority_queue<T>;
template <class T> using pque_min = priority_queue<T, vector<T>, greater<T> >;
#define OUTPUT(...) ostream& operator<<(ostream& os, __VA_ARGS__ const& v) { os << "{"; for (auto const& x : v) os << " " << x; return os << " }"; }
template <class T> OUTPUT(vector<T>)
template <class T> OUTPUT(deque<T>)
template <class T> OUTPUT(set<T>)
template <class T> OUTPUT(multiset<T>)
template <class T, class U> OUTPUT(map<T,U>)
#undef OUTPUT
template <class T> istream& operator>>(istream& is, vector<T>& v) { for (auto& x : v) is >> x; return is; }
template <class T, class S> ostream& operator<<(ostream& os, pair<T,S> const& p) { return os << "(" << p.first << ", " << p.second << ")"; }
template <class T, class S> istream& operator>>(istream& is, pair<T,S>& p) { return is >> p.first >> p.second; }
struct my_Init { my_Init() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } my_init;

template <class T> void quit(T const& x) { cout << x << endl; exit(0); }
template <class T> bool chmin(T& x, T const& y) { if (x > y) { x = y; return true; } return false; }
template <class T> bool chmax(T& x, T const& y) { if (x < y) { x = y; return true; } return false; }
template <class It> auto sumof(It b, It e) { return accumulate(b,e,typename iterator_traits<It>::value_type{}); }
////////////////////////////////

int32_t main() {
    int n; cin >> n;
    vector<int> a(n); cin >> a;
    vector<int> c(n+1);
    rep (i,n) c[a[i]]++;
    sort(all(c));
    vector<int> d(n+1);
    rep1 (i,n) d[i] = c.end()-lower_bound(all(c), i);
    dump(d);
    rep1 (i,n-1) d[i+1] += d[i];
    dump(d);
    rep1 (k,n) {
        int l = 0, r = n+1;
        while (l+1 < r) {
            int m = (l+r)/2;
            if (d[m] >= k*m) l = m; else r = m;
        }
        cout << l << "\n";
    }
}


Measured memory_bytes: 7936
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1e9 + 7;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    if (N % 2)
        cout << N * 2 << endl;
    else
        cout << N << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 
typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
 
const ll e5 = 1 << 20;
const ll mod = 998244353;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll gcd(ll c, ll d) {
  ll tmp;
  while (c % d != 0) {
    tmp = d;
    d = c % d;
    c = tmp;
  }
  return d;
}
 
int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  ll num_c = (b / c) - ((a - 1) / c);
  ll num_d = (b / d) - ((a - 1) / d);

  ll lcm_cd = c * d / gcd(c, d);
  ll num_cd = (b / lcm_cd) - ((a - 1) / lcm_cd);

  ll result = b - a + 1 - (num_c + num_d - num_cd);

  cout << result << endl;

  return 0;
}

Measured memory_bytes: 256
# AGC033A - Darker and Darker
# https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.distance_transform_cdt.html
from scipy.ndimage import distance_transform_cdt as dist


def main():
    """
    distance_transform_cdt(matric="taxicab"):
        1 1 1    2 1 2
        1 0 1 -> 1 0 1
        1 1 1    2 1 2
    """
    h, w = tuple(map(int, input().rstrip().split()))
    A = tuple(tuple(input()) for _ in range(h))
    B = tuple(tuple(1 if i == "." else 0 for i in a) for a in A)
    D = dist(B, metric="taxicab")
    print(D.max())


if __name__ == "__main__":
    main()

Measured memory_bytes: 53720
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <bitset>
#include <complex>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;



int main(){
    int N,M;
    cin >> N >> M;
    int H[100000];
    for(int i=0; i<N; i++){
        cin >> H[i];
    }

    int bad[100000]={};
    int ans = N;
    for(int i=0; i<M; i++){
        int a,b;
        cin >> a >> b;
        a--; b--;
        if(H[a]<=H[b]){
            if(bad[a]==0){
                ans--;
            }
            bad[a]++;
        }

        if(H[b]<=H[a]){
            if(bad[b]==0){
                ans--;
            }
            bad[b]++;
        }
    }
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 4404
#include<bits/stdc++.h>
using namespace std;
#define ll long long
inline void cmax(ll &a,ll b){if(a<b)a=b;}
const int N=100005;
int a[N],b[N];
int main(){
    ll s=0ll,t=0ll;
    int n,l,r,i;
    scanf("%d",&n);
    for(i=1;i<=n;++i){
        scanf("%d%d",&l,&r);
        a[i]= l;
        b[i]=-r;
    }
    sort(a,a+n+1);
    sort(b,b+n+1);
    for(i=n;~i;--i)cmax(s,t+=a[i]+b[i]);
    printf("%lld",s<<1);
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

typedef long long int lli;

int main() {
	int N;
	vector<lli> a;
	cin >> N;
	lli ans;
	for(int i=1; i<=N; i++) {
		lli ai;
		cin >> ai;
		while(ai % 2 == 0) {
			ans++;
			ai /= 2;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
        int a = sc.nextInt();
      
        for(int i = 1;i <= 9;i++){
       	    for(int j = 1; j <= 9;j++){
              if(i * j == a){
                System.out.println("Yes");
                System.exit(0);
              }
            }
        }
        System.out.println("No");
    }
}

Measured memory_bytes: 35508