akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<vector>
#include<cstdlib>
#define range(i,a,b) for(int i = (a); i <= (b); i++)
#define rrange(i,a,b) for(int i = (a); i >= (b); i--)
#define rep(i,b) for(int i = 1; i <= (b); i++)
#define rrep(i,b) for(int i = (b); i >= 1; i--)
#define all(a) (a).begin(), (a).end()
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
typedef long long ll;
const int N=1e5+11;
const int INF = 1001001001;
const ll LLINF = 1001001001001001001LL;
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
char s[N],ans[N];
int read(){
	int x=0,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();}
	return f*x;
}
int main(){
//	freopen("ex.in","r",stdin);
	ans[0]='Y';ans[1]='A';ans[2]='K';ans[3]='I';
	scanf("%s",s);
	int flag=0;
	range(i,0,3) if(ans[i]!=s[i]) flag=1;
	if(flag) printf("No");
	else printf("Yes");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int max;
    scanf("%d", &max);
    int H[max];
    int H_max=0;
    int count = 0;
    
    for(int i=0; i<max; i++){
        scanf("%d", &H[i]);
        if(H_max<=H[i]){
            H_max=H[i];
            count++;
        }
    }
    printf("%d",count);
    
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n;
    cin >> n;
    int a = n%10;
    if(a == 1 || a == 0 || a== 6 || a == 8){
        cout << "pon" << endl;
    }
    else if(a == 3){
        cout << "bon" <<endl;
    }
    else{
        cout << "hon" <<endl;
    }
    return 0;
}

Measured memory_bytes: 3672
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)    (x).begin(),(x).end()
# define UNIQ(c)   (c).erase(unique(ALL((c))), end((c)))
# define mp        make_pair
# define eb        emplace_back
# define REP(i, a) for (int i = 0; i < (a); i++)
# define INIT      std::ios::sync_with_stdio(false);std::cin.tie(0);


int main() {
	char c[100][100];
	int h, w;
	int ans[100][100];
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> c[i][j];
		}
	}
	for (int i = 0; i < h; i++) {
		if (c[i][0] == 'c')ans[i][0] = 0;
		else ans[i][0] = -1;
	}
	for (int i = 0; i < h; i++) {
		for (int j = 1; j < w; j++) {
			if (c[i][j] == 'c')ans[i][j] = 0;
			else if (ans[i][j - 1] == -1)ans[i][j] = -1;
			else ans[i][j] = ans[i][j - 1] + 1;
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cout << ans[i][j];
			if (j != w - 1)cout << " ";
		}
		cout << endl;
	}
}

Measured memory_bytes: 3120
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
typedef long long int LL;
typedef unsigned long long int ULL;

const LL INF = 1LL << 60;
vector<LL> h(100000 + 1);
vector<LL> dp(100000 + 1);

int main() {
    int n, k;
    cin >> n >> k;
    rep(i, n) {
        cin >> h[i];
    }
    dp[0] = 0;
    for (int i = 1; i < n; i++) {
        LL min_step = INF;
        rep(j, min(k, i)) {
            min_step = min(min_step, dp[i - j - 1] + abs(h[i] - h[i - j - 1]));
        }
        dp[i] = min_step;
    }
    cout << dp[n - 1] << endl;

    return 0;
}


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

int N;
int A[200001];

int main(){
	cin>>N;
  
  	for (int i=0;i<N;i++) cin>>A[i];
  
  	int prev = 1e10;
  	int ans = 0;
  	for (int i=0;i<N;i++){
		prev = min(prev,A[i]);
      	if (A[i] == prev) ans++;
    }
  	cout<<ans;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
using namespace std;

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

const int INF = 1 << 29;

typedef pair<int, int> P;

int main()
{
	int w, h;
	while(cin >> w >> h, w || h) {
		vector<vector<vector<int>>> maze(h, vector<vector<int>>(w));
		//vector<vector<int>> edge(h, vector<int>(w));

		for(int i = 0; i < 2 * h - 1; ++i) {
			if(!(i & 1)) {
				for(int j = 0; j < w - 1; ++j) {
					int t;
					cin >> t;
					if(t == 0) {
						maze[i / 2][j].push_back(2);
						maze[i / 2][j + 1].push_back(0);
					}
				}
			} else {
				for(int j = 0; j < w; ++j) {
					int t;
					cin >> t;
					if(t == 0) {
						maze[i / 2][j].push_back(1);
						maze[i / 2 + 1][j].push_back(3);
					}
				}
			}
		}

		vector<vector<int>> dest(h, vector<int>(w, INF));

		dest[0][0] = 0;
		queue<P> que;
		que.emplace(0, 0);

		while(!que.empty()) {
			P cur = que.front(); que.pop();
			if(cur == P(w - 1, h - 1)) break;

			for(int k = 0; k < 4; ++k) {
				if(!count(maze[cur.second][cur.first].begin(),
						  maze[cur.second][cur.first].end(), k)) continue;

				int nx = cur.first + dx[k], ny = cur.second + dy[k];
				if(0 <= nx && nx < w && 0 <= ny && ny < h && dest[ny][nx] == INF) {
						dest[ny][nx] = dest[cur.second][cur.first] + 1;
						que.emplace(nx, ny);
				}
			}
		}

		/*for(int i = 0; i < h; ++i) {
			for(int j = 0; j < w; ++j) {
				cout << dest[i][j] << ' ';
			}
			cout << endl;
		}*/

		if(dest[h - 1][w - 1] == INF) {
			cout << 0 << endl;
		} else {
			cout << dest[h - 1][w - 1] + 1 << endl;
		}
	}
}

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

#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using namespace atcoder;
using ll = long long;
using P = pair<int, int>;

const int MAX = 300005;

int op(int a, int b) { return max(a, b); }

int e() { return (int)(0); }

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

    segtree<int, op, e> seg(MAX);

    rep(i, N) {
        int x = seg.prod(max(0, A[i] - K), min(MAX, A[i] + K + 1));
        seg.set(A[i], max(seg.get(A[i]), x + 1));
    }

    cout << seg.all_prod() << endl;
}

Measured memory_bytes: 9576
class Edge
  def initialize arr
    @x, @y, @cost = arr
  end
  attr_reader :x, :y, :cost
end

class Graph
  def initialize v, es
    @v, @es = v, es
    @inf = 1.0 / 0
  end

  def toAdjacencyMatrix
    return if @m
    @m = Array.new(@v).map{Array.new(@v, @inf)}
    @es.each{|e| @m[e.x][e.y] = @m[e.y][e.x] = [@m[e.y][e.x], e.cost].min}
  end

  def floydWarshall
    @dist = Marshal.load(Marshal.dump(@m))
    @v.times{|i| @dist[i][i] = 0}
    @v.times{ |i| @v.times{ |j| @v.times{ |k|
      @dist[j][k] = [@dist[j][k], @dist[j][i] + @dist[i][k]].min if @dist[j][k] > x = @dist[j][i] + @dist[i][k]
    }}}
    return @dist
  end
end

n, m, r_ = gets.split.map(&:to_i)
r = gets.split.map{|i| i.to_i.pred}
e = m.times.map {
  a, b, c = gets.split.map(&:to_i)
  Edge.new([a.pred, b.pred, c])
}

g = Graph.new n, e
g.toAdjacencyMatrix()
d = g.floydWarshall
p r.permutation.map{|perm|
  perm.each_cons(2).map{|a,b|d[a][b]}.inject:+
}.min




Measured memory_bytes: 5624
n = int(input())
s = input()
writtenC = 0
writtenD = 0
for i in range(n):
    if s[i] == ")" and writtenC == 0:
        writtenD += 1
    elif s[i] == ")":
        writtenC -= 1
    else:
        writtenC += 1
print("(" * writtenD + s + ")"*writtenC)


Measured memory_bytes: 61444
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int x, y;
		while (true) {
			x = scanner.nextInt();
			y = scanner.nextInt();
			if (x == 0 && y == 0)
				break;
			if (x < y)
				System.out.println(x + " " + y);
			else
				System.out.println(y + " " + x);
		}
		scanner.close();
	}
}


Measured memory_bytes: 36052
#include <stdio.h>
#include <algorithm>
#include <tuple>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

ll GCD(ll a, ll b) {
	if (a < b)
		swap(a, b);
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}
ll a, b;
int main() {
	scanf("%lld %lld", &a, &b);
	ll G = GCD(a, b), d = G;
	int count = 1;
	for (ll i = 2; i * i <= G && d != 1; i++) {
		if (d % i)
			continue;
		count++;
		while (!(d % i))
			d /= i;
	}
	count += d != 1;
	printf("%d\n", count);
}

Measured memory_bytes: 128
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int a = sc.nextInt();
		int b = sc.nextInt();

		if (b < a) {
			a--;
		}

		pr.println(a);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes()));
		pr = new Printer(System.out);

		solve();

//		pr.close();
		pr.flush();
//		sc.close();
	}

	static String INPUT = null;

	private static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 21844
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 1))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (ql:quickload '(:cl-debug-print :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defun ensure-list (x) (if (listp x) x (list x)))
(defmacro nlet (name args &body body)
  (let ((args (mapcar #'ensure-list args)))
    `(labels ((,name ,(mapcar #'car args) ,@body))
       (,name ,@(mapcar #'cadr args)))))

(defun split-to-list (str size)
  (declare (optimize (speed 3) (safety 1))
           (fixnum size)
           (string str))
  (loop for idx below size
        for pos1 = 0 then (1+ pos2)
        for pos2 = (position #\space str :start pos1 :test #'char=)
        collect (parse-integer str :start pos1 :end pos2)))

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

;; Hauptteil
(defun extract-available-bars (list)
  (nlet recurse ((list list) (hash (make-hash-table)) res)
    (cond ((null list) res)
          ((gethash (car list) hash)
           (setf (gethash (car list) hash) nil)
           (recurse (cdr list) hash (cons (car list) res)))
          (t (setf (gethash (car list) hash) t)
             (recurse (cdr list) hash res)))))

(deftype uint nil `(integer 0 ,(expt 10 9)))
(defun main ()
  (let* ((n (read))
         (bars (split-to-list (read-line) n))
         (available-bars (extract-available-bars bars)))
    (if (null (cdr available-bars))
        (println 0)
        (let* ((longest (reduce #'max available-bars))
               (second-longest (reduce #'max (delete longest available-bars :count 1))))
          (println (* longest second-longest))))))

#-swank(main)


Measured memory_bytes: 37092
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int a, b;
      cin >> a >> b;
     
      if ((a*b)%2 == 0) {
        cout << "Even" << endl;
      }else{
        cout << "Odd" << endl;
      }
          
    }

Measured memory_bytes: 3592
#include<stdio.h>

int search(int A[],int n,int key){
int i=0;
A[n]=key;
while(A[i]!=key) i++;
return i!=n;
}

int main(){
int i,n,A[10000+1],q,key,sum=0;

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

scanf("%d",&q);
for(i=0;i<q;i++){
 scanf("%d",&key);
 if(search(A,n,key)) sum++;
 }
 printf("%d\n",sum);
 
 return 0;
}

Measured memory_bytes: 636
from heapq import heappush, heappop
from copy import deepcopy

n = int(input())
s = list(map(int, input().split()))

left = []
for e in s:
    heappush(left, -e)
mx = heappop(left)

made = []
heappush(made, mx)

for _ in range(n):
    made_nxt = deepcopy(made)
    tmp = []

    while made:
        made_val = heappop(made)
        while left and left[0] <= made_val:
            pp = heappop(left)
            tmp.append(pp)

        if not left:
            print("No")
            exit()

        left_val = heappop(left)
        heappush(made_nxt, left_val)

    made = made_nxt

    for e in tmp:
        heappush(left, e)

print("Yes")


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

typedef unsigned long long uLL;
typedef long long int LL;
typedef pair <int,int> pii;
typedef pair <int,pii> piii;
typedef pair <long long,long long> pll;
typedef pair <long long,pll> plll;
const int N = 1e5 + 5;
const int inf = 1e9;
const long long INF = 1e18;
const double PI = acos(-1.0);
const double EPS = 1e-8;
const int MOD = 1000000007;

string s;
int d;
vector <int> V;
int len;
LL dp[ N ][ 2 ][ 105 ][ 2 ];

LL go( int idx , int smaller , int sod , int zero  ) {
        if( idx >= len ) return ( !zero && sod%d == 0 );
        if( dp[idx][smaller][sod][zero] != -1 ) return dp[idx][smaller][sod][zero];
        LL ret = 0;
        if( smaller ) {
                for( int i = 0; i <= 9; i++ ) {
                        ret += go( idx + 1 , 1 , (sod+i)%d , (zero && ( i == 0 )) );
                        ret %= MOD;
                }
        }
        else {
                for( int i = 0; i < V[idx]; i++ ) {
                        ret += go( idx + 1 , 1 , (sod+i)%d , (zero && ( i == 0 )) );
                        ret %= MOD;
                }
                ret += go( idx + 1 , 0 , (sod+V[idx])%d , (zero && ( V[idx] == 0 )) );
                ret %= MOD;
        }
        return dp[idx][smaller][sod][zero] = ret%MOD;
}
LL solve( string s ) {
        V.clear();
        for( int i = 0; i < s.size(); i++ ) V.push_back( s[i]-'0' );
        len = V.size();
        memset( dp , -1 , sizeof( dp ) );
        return go( 0 , 0 , 0 , 1 );
}
int main( int argc , char const *argv[] ) {
        ios_base::sync_with_stdio( false ); cin.tie( NULL );
        cin >> s >> d;
        cout << solve( s )%MOD << endl;
        return 0;
}


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

using namespace std;

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

    for(int i=0; i<line.size(); i++)
    {
        if(line[i]=='7')
        {
            cout<<"Yes\n";
            return 0;
        }
    }

    cout<<"No\n";

    return 0;

}


Measured memory_bytes: 3532
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int sum=0;
    for(int i=1;i<=n;i++){
        if(i%3!=0&&i%5!=0)sum+=i;
    }
    cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n;
    cin>>n;
    long long int x=26;
    int len=1;
    while(n>x){
        n-=x;
        x*=26;
        len++;
    }
    string s(len,'0');

    n--;
    for(int i=len-1;i>=0;i--){
        s[i]='a'+n%26;
        n/=26;
    }
    for(auto it=s.begin();it!=s.end();it++){
        cout<<*it;
    }
    cout<<endl;
}

Measured memory_bytes: 3604
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

ll N, K;
ll P[5005];
ll C[5005];

int main() {
  cin>>N>>K;
  for(ll i=0;i<N;++i) {
    cin>>P[i];
    P[i]--;
  }
  for(ll i=0;i<N;++i) cin>>C[i];
  pair<ll, ll> cycle[N];
  ll now;
  ll tmpans;
  ll ans = -big;
  bool modoru;
  for(ll i=0;i<N;++i) {
    now = i;
    tmpans = 0;
    modoru = false;
    for(ll j=0;j<min(2*N, K);++j) {
      now = P[now];
      tmpans += C[now];
      ans = max(ans, tmpans);
      if(now==i) {
        modoru = true;
        cycle[i] = mp(j+1, tmpans);
        break;
      }
    }
    if(!modoru) cycle[i] = mp(-1, -1);
  }
  ll num;
  for(ll i=0;i<N;++i) {
    if(cycle[i].se<=0) continue;
    if(cycle[i].fi==-1) continue;
    num = cycle[i].fi;
    num = K/num-1;
    tmpans = cycle[i].se*num;
    ans = max(ans, tmpans);
    now = i;
    for(ll j=0;j<K-num*cycle[i].fi;++j) {
      now = P[now];
      tmpans += C[now];
      ans = max(ans, tmpans);
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3784
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);
const nin=()=>{const r = input[0];input.shift();return Number(r)};
const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};
const sin=()=>{const r = input[0];input.shift();return String(r)}
const out=(...a)=>{console.log(...a)}
const floor=(a)=>{return Math.floor(a)}
const min=(...a)=>{return Math.min(...a)}
const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}}
const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};
const main = ()=>{
  let [a, b, t] = [...nrin(3)];
  out(floor(t/ a)*b);
}
main();

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

using namespace std;

using ll = long long;

ll gcd(ll a, ll b)
{
    if (a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    
    return b ? gcd(b, a % b) : a;
}

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

int main()
{
    ll A, B;
    cin >> A >> B;
    cout << lcm(A, B) << endl;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String args[]) {

		FastScanner sc = new FastScanner();

		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");
					return;
				}
			}
		}
		System.out.println("No");
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
            }

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 22996
from collections import deque
n = int(input())
num = []

q = deque([3,5,7])
while q:
    tar = q.popleft()
    num.append(tar)
    if len(str(tar)) >= 9:
        pass
    else:
        q.append(tar*10+3)
        q.append(tar*10+5)
        q.append(tar*10+7)
ans = 0
for i in num:
    s = set(list(str(i)))
    if len(s) != 3:
        pass
    elif i <= n:
        ans += 1
print(ans)






Measured memory_bytes: 44268
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> A(H);
    vector<vector<int> > V(H, vector<int>(W));
    for (auto &a : A) cin >> a;
    vector<bool> line(H, false);
    int fst = -1;
    for (int i = 0; i < H; ++i) {
        for (auto a : A[i]) {
            if (a == '#') {
                line[i] = true;
                if (fst == -1) fst = i;
            }
        }
    }
    int cnt = 0;
    bool enc = true;
    for (int i = fst; i < H; ++i) {
        if (line[i]) {
            cnt++;
            enc = false;
        }
        for (int j = 0; j < W; ++j) {
            if (A[i][j] == '#') {
                if (enc) cnt++;
                else enc = true;
            }
            V[i][j] = line[i] ? (cnt == 0 ? 1 : cnt) : V[i][j] = V[i-1][j];
        }
    }
    for (int i = fst-1; i >= 0; --i) {
        for (int j = 0; j < W; ++j) {
            V[i][j] = V[i+1][j];
        }
    }
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            printf("%d%c", V[i][j], j == W-1 ? '\n' : ' ');
        }
    }
    return 0;
}


Measured memory_bytes: 1280
#!/usr/bin/env python3
import sys
import math

def solve(S: str):
    s0 = [0,1]*math.ceil(len(S)/2)
    s1 = [1,0]*math.ceil(len(S)/2)

    d0 = 0
    for i in range(len(S)):
        if(S[i] != str(s0[i])):
            # print(S[i],s0[i])
            d0 += 1

    d1 = 0
    for i in range(len(S)):
        if(S[i] != str(s1[i])):
            d1 += 1

    # print(d0)
    # print(d1)
    print(min(d1,d0))
    
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  # type: int
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 4852
// --------------
// Tejas Pandey  |
// 05 - 07 - 20  |
// Atcoder BC 173|
// --------------

#include <bits/stdc++.h>
using namespace std;
     
#define mod 1000000007
#define vi vector<int>
typedef long long int ll;
     
int main (void){
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  //cin >> t;
  while(t--){
	int n;
	cin >> n;
	int a[4];
	a[0] = a[1] = a[2] = a[3] = 0;
	for(int i = 0;i < n;i++){
		string s;
		cin >> s;
		if(s == "AC") a[0]++;
		else if(s == "WA") a[1]++;
		else if(s == "TLE") a[2]++;
		else a[3]++; 
	}
	cout << "AC x " << a[0] << "\n";
	cout << "WA x " << a[1] << "\n";
	cout << "TLE x " << a[2] << "\n";
	cout << "RE x " << a[3] << "\n";
  }
  return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <cstring>
#include <algorithm>
int main()
{
	int N;
	int memo[10000];
	int puyo[10000];
	while(std::cin>>N,N){
		int c = 0;
		int k = -1;
		memset(memo,0,sizeof(memo));
		for(int i=0; i<N; i++){
			int a; std::cin>>a;
			if( c==a )memo[k]++;
			else{ k++; memo[k]++; c=a; puyo[k]=c; }
		}
		k++;
		/*
		for(int i=0; i<k; i++){
			printf("memo[%d]:%d  puyo[%d]:%d\n",i,memo[i],i,puyo[i]);
		}*/
		
		int ans = N;
		for(int i=0; i<k; i++){
			if( i>0 && i+1<k && memo[i]==1 && puyo[i-1]==puyo[i+1] &&
				 memo[i-1]+memo[i+1]+1>=4 ){
				 
				 int l = i-2;
				 int r = i+2;
				 for(; l>=0 && r<k; ){
					if( !(puyo[r]==puyo[l] && memo[r]+memo[l]>=4) )
						break;
					l--; r++;
				 }
				 int sum = 0;
				 while(l>=0)sum += memo[l--];
				 while(r<k)sum += memo[r++];
				 ans = std::min(sum,ans);
				 continue;
			}
			
			if( i>0 && memo[i-1]+1>=4 ){
				int l = i-2;
				int r = memo[i]==1 ? i+1 : i;
				for(;l>=0 && r<k;){
					if( !(puyo[r]==puyo[l] && memo[r]+memo[l]>=4) )
						break;
					l--; r++;
				}
				int sum = 0;
				while(l>=0)sum += memo[l--];
				while(r<k)sum += memo[r++];
				ans = std::min(sum,ans);
			}
			
			if( i+1<k && memo[i+1]+1>=4 ){
				int l = memo[i]==1 ? i-1 : i;
				int r = i+2;
				for(;l>=0 && r<k;){
					if( !(puyo[r]==puyo[l] && memo[r]+memo[l]>=4) )
						break;
					l--; r++;
				}
				int sum = 0;
				while(l>=0)sum += memo[l--];
				while(r<k)sum += memo[r++];
				ans = std::min(sum,ans);
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 0
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long N = scan.nextLong();
        List<Long> divisors = divisors(N);
        long answer = Long.MAX_VALUE;
        for (long x : divisors) {
            long y = N / x;
            answer = Math.min(answer, x - 1 + y - 1);
        }
        System.out.println(answer);
    }
    private List<Long> divisors(long N) {
        List<Long> divisors = new ArrayList<>();
        for (long i = 1; i * i <= N; i++) {
            if (N % i == 0) {
                divisors.add(i);
                if (i * i != N) {
                    divisors.add(N/i);
                }
            }
        }
        divisors.sort(Comparator.naturalOrder());
        return divisors;
    }
}


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

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

using namespace std;

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

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

int A, B, C;

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

    if (A != B && A != C && B == C) {
        // Aがかわいそう
        cout << "Yes" << endl;
    } else if (A != B && A == C && B != C) {
        // Bがかわいそう
        cout << "Yes" << endl;
    } else if (A == B && A != C && B != C) {
        // Cがかわいそう
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}



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

#define what_is(x) cerr << #x << " is " << x << endl;

const int N = 1e5+1;

ll n, X, x[N];

int main () {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	// cout.precision(1); cout << fixed;
	cin >> n >> X;
	for (int i = 0; i < n; i++) {
		ll t; cin >> t;
		x[i] = abs(X-t);
	}
	ll d = x[0];
	for (int i = 1; i < n; i++)
		d = __gcd(x[i],d);
	cout << d << endl;
	return 0;
}

Measured memory_bytes: 1024
def land(mapdata)
  count = 0
  mapdata.each_with_index{|item, idx|
    item.each_with_index{|item2, idx2|
      if item2 == 1
        mark(mapdata, idx, idx2)
        count += 1
      end
    }
  }
  return count
end
def mark(mapdata, x, y)
  if x.between?(0, 11) and y.between?(0,11) and mapdata[x][y] == 1
    mapdata[x][y] = 2
    mark(mapdata, x + 1, y)
    mark(mapdata, x - 1, y)
    mark(mapdata, x, y + 1)
    mark(mapdata, x, y - 1)
  end
end
mapdata = []
12.times do
  mapdata << gets.split(//).map(&:to_i)
end
puts land(mapdata)
while gets
  mapdata = []
  12.times do
    mapdata << gets.split(//).map(&:to_i)
  end
  puts land(mapdata)
end

Measured memory_bytes: 6112
#!usr/bin/env pypy3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)


def main():
    tmp = ""
    N = I()
    while N != 0:
        amari = (N % 26 - 1) % 26
        N = (N - 1) // 26
        tmp = chr(ord("a") + amari) + tmp

    print(tmp)


main()


Measured memory_bytes: 9496
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;
int i = 0 ;
vector<int> to[200005] ;
int N , M ;
bool can = false ;
void dfs( int x, int i ){
	i++ ;
  	if( i == 3 ) return ;
    for(int p : to[x] ){
      if( p == N-1 ) can = true ;
      dfs(p,i) ;
    }
}
 
int main(){
	cin >> N >> M ;
  	rep(i,M){
		int a ,b ;
      	cin >> a >> b ;
      	a-- ; b-- ;
      	to[a].push_back(b) ;
    }
    //cout << to[0][0] << endl ;
  	dfs(0,0) ;
  	if(can) cout << "POSSIBLE" << endl;
 	else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 8576
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};

int main(){
    while(1){
        int n,m;
        cin>>n>>m;
        if(n==0 && m==0) break;
        UnionFind<int> uf(n);
        rep(i,m){
            char s;
            cin>>s;
            if(s=='!'){
                int a,b,w;
                cin>>a>>b>>w;
                a--,b--;
                uf.merge(a,b,w);
            }
            else{
                int a,b;
                cin>>a>>b;
                a--,b--;
                if(!uf.issame(a,b)) cout<<"UNKNOWN"<<endl;
                else cout<<uf.diff(a,b)<<endl;
            }
        }
    }
}


Measured memory_bytes: 3960
n = int(input())
a_list = []
b_list = []
for _ in range(n):
  a, b = map(int, input().split())
  a_list.append(a)
  b_list.append(b)
a_list.sort()
b_list.sort()

if n & 1:
  min_medium = a_list[n // 2]
  max_medium = b_list[n // 2]
  print(max_medium - min_medium + 1)
else:
  min_medium_x2 = a_list[n // 2 - 1] + a_list[n // 2]
  max_medium_x2 = b_list[n // 2 - 1] + b_list[n // 2]
  print(max_medium_x2 - min_medium_x2 + 1)

Measured memory_bytes: 25392
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ll a,b,c,k,s;
	cin>>a>>b>>c>>k;
	s=a;
	if(k%2==1){
		a=b+(k*1ll*c);
		b=s+(k*1ll*c);
	}
	else{
		a=a+(k*1ll*c);
		b=b+(k*1ll*c);
	}
	if(a-b>1000000000000000000){
		cout<<"Unfair";
	}
	else{
		cout<<a-b;
	}
}

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

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

  int ans = (1U << 31) - 1;
  int left = 0;
  for (int i = 0; i < n - 1; i++) {
    left += w[i];
    ans = min(ans, abs(sum - left - left));
  }

  cout << ans << endl;
}

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

int main(){
  long long X;
  cin>>X;
  
  long long en = 100;
  
  long long res = 0;
  
  while(en < X){
    
    res++;
    
    en += en/100; 
  
  
  }
  
  cout<<res;
  
	return 0;
}

Measured memory_bytes: 3628
import sys
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

n=int(input())
Arr=get_array()
new_Arr=[0]*n
new_Arr[-1]=Arr[-1]
new_Arr[-2]=Arr[-1]
for i in range(n-3,-1,-1):
    if Arr[i]>=Arr[i+1]:
        new_Arr[i]=Arr[i]
    elif Arr[i]<Arr[i+1]:
        new_Arr[i]=Arr[i]
        new_Arr[i+1]=Arr[i]
print(sum(new_Arr))

Measured memory_bytes: 3064
S = list(input())
N = len(S)
judge1 = False
judge2 = False
n = (N - 1) // 2
for i in range(n):
    if S[i] != S[-i - 1]:
        break
    if i == n - 1:
        judge1 = True
for i in range(-(-n // 2)):
    if S[i] != S[n - i - 1]:
        break
    if S[n + 1 + i] != S[n + n - i]:
        break
    if i == -(-n // 2) - 1:
        judge2 = True
if judge1 and judge2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
s = int(input())
if s <= 104:
  print(0)
elif 105<= s <135:
  print(1)
elif 135<= s <165:
  print(2)
elif 165 <= s <189:
  print(3)
elif 189<= s <195:
  print(4)
else:
  print(5)

Measured memory_bytes: 2940
<?php


$s = fgets(STDIN);
$s = str_split($s);


for($i=0; $i < count($s); $i++) {
    if ($i % 2 == 0 && $s[$i] == 'L') {
        echo "No";
        return;
    } elseif ($i % 2 == 1 && $s[$i] == 'R') {
        echo "No";
        return;
    }
}
echo "Yes";

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

int main(){
    int n ,m,sum,res;
    cin >> n >> m;
    vector<int> a(n);
    sum=0;
    res=0;
    for (int i=0;i<n;i++){
        cin >> a[i];
        sum+=a[i];
    }
    for (int i=0;i<n;i++){
        if(4*m*a[i]>=sum){
            ++res;
        }
    }
    if(res>=m){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}

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

using namespace std;

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

    string r = n;
    reverse(n.begin(), n.end());
    string result = (n == r) ? "Yes" : "No";
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
import bisect
n=int(input())
L=sorted(list(map(int,input().split())))
c=0
for i in range(n-1,1,-1):
    for j in range(i-1,0,-1):
        a=j-bisect.bisect(L,L[i]-L[j])
        if a>0:
            c+=a
print(c)

Measured memory_bytes: 3188
import sys

n = int(input())
a = list(map(int,input().split()))
s = ((sum(a))//n)+1
t = sum(a)//n
u = ((sum(a))//n)-1
l = []
l.append(s)
l.append(t)
l.append(u)
ans = []
ans2 = []
aa = set(a)

if len(aa) == 1:
    print(0)
    sys.exit()

for j in range(len(l)):
    ans = []
    for i in range(n):
        if a[i] == l[j]:
            continue
        else:
            b = (a[i]-l[j])**2
            ans.append(b)
    ans2.append(sum(ans))


print(min(ans2))


Measured memory_bytes: 3064
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

n = int(input())
a = [list(map(int, input().split())) for i in range(n)]

max_mask = 1<<n
DP = [0]*max_mask

for state in range(1, max_mask):
    flag = []
    for i in range(n):
        if (state>>i)&1:
            flag.append(i)
    tmp = 0
    for i in flag:
        for j in flag:
            tmp += a[i][j]
    DP[state] = tmp//2

    j = (state-1)&state
    while j:
        k = state^j
        DP[state] = max(DP[state], DP[j]+DP[k])
        j = (j-1)&state
print(DP[-1])

Measured memory_bytes: 44860
#include <stdio.h>

int euclide(int a,int b){
    int division;
    
    division = a % b;
    a = b;
    b = division;
    
    if(b != 0) euclide(a,b); 
    else return a;
    
}
int main(){
    
    int a,b,tmp;
    while(1){
        if ((scanf("%d%d",&a,&b)) == EOF) break;
        
        if(a < b)
        {
             tmp = a;
             a = b;
             b = tmp;
        }
        printf("%d\n",euclide(a,b));
    }
    return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll> ;
#define all(v) v.begin(),v.end()
using P = pair<int,int>;

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};


int main(){
  ll N,M;cin>>N>>M;
  vll ans;
  vector<pair<int,int>> vp;
  ll tmp = N*(N-1)/2;
  rep(i,M){
    int a,b;cin>>a>>b;a--,b--;
    vp.push_back(make_pair(a,b));
  }
  UnionFind tree(N);
  for(int i=M-1;i>=0;i--){
    ans.push_back(tmp);
    if(tree.issame(vp[i].first,vp[i].second)) continue;
    ll a = tree.size(vp[i].first);
    ll b = tree.size(vp[i].second);
    tmp -= a * b;
    tree.merge(vp[i].first,vp[i].second);
  }
  reverse(all(ans));
  rep(i,ans.size()) cout << ans[i] << endl;
}

Measured memory_bytes: 3444
#include <iostream>
using namespace std;
int main(void){int y,m,d;int a[4]={18680908,19120730,19261225,19890108};int b[4]={1868,1912,1926,1989};char c[4][9]={"meiji","taisho","showa","heisei"};while(cin>>y>>m>>d){int j=10000*y+100*m+d;if(j<a[0]){cout<<"pre-meiji"<<endl;}if(j>=a[3]){printf("%s %d %d %d\n",c[3],y-b[3]+1,m,d);}else{for(int i=0;i<3;i++){if(a[i]<= j&&j<a[i+1]){printf("%s %d %d %d\n",c[i],y-b[i]+1,m,d);break;}}}}return 0;}

Measured memory_bytes: 0
def solve():
    N = int(input())
    t = [0] * (N + 1)
    x = [0] * (N + 1)
    y = [0] * (N + 1)

    t[0], x[0], y[0] = 0,0,0
    for i in range(1,N + 1):
        t[i], x[i], y[i] = map(int, input().split())

    for i in range(N):
        dt = t[i + 1] - t[i]
        dist = abs((x[i + 1] - x[i])) + abs((y[i + 1] - y[i]))
        if dist > dt:
            print('No')
            return
        if ((dt % 2 == 0) != (dist % 2 == 0)):
            print('No')
            return
    
    print('Yes')


def main():
    solve()

if __name__ == '__main__':
    main()    


Measured memory_bytes: 11636
#include <stdio.h>

void rev_str(char str[1024]) {
	int length = 0;
	char str2[1024];
	int temp;

	int i;

	for(i = 0; i < 1024; i++)
		str2[i] = '\0';

	while(str[length])
		length++;

	temp = length;
	i = 0;
	while(temp) {
		str2[temp - 1] = str[i];
		i++;
		temp--;
	}

	for(i = 0; i < length; i++)
		str[i] = str2[i];
}

int exor(int a, int b) {
	if(a && b)
		return 0;
	else if(a || b)
		return 1;
	else
		return 0;
}

int main() {
	char input_a[1024];
	char input_b[1024];
	char ans[286][1024];
	char kuriagari;
	int temp;
	int n;

	int i, j;

	scanf("%d", &n);

	for(j = 0; j < n; j++) {
		for(i = 0; i < 1024; i++) {
			input_a[i] = '\0';
			input_b[i] = '\0';
			ans[j][i] = '\0';
		}

		kuriagari = 0;

		scanf("%s", input_a);
		scanf("%s", input_b);

		rev_str(input_a);
		rev_str(input_b);

		i = 0;
		while(input_a[i] && input_b[i]) {
			temp = input_a[i] + input_b[i] - 2 * '0' + kuriagari;
			ans[j][i] = temp % 10 + '0';
			kuriagari = temp / 10;
			i++;
		}

		if(kuriagari && !input_a[i] && !input_b[i]) {
			ans[j][i] = kuriagari + '0';
		}

		else {
			while (kuriagari && exor((int)input_a[i], (int) input_b[i])) {
				temp = input_a[i] + input_b[i] - '0' + kuriagari;
				ans[j][i] = (char)(temp % 10 + '0');
				kuriagari = temp / 10;
				i++;
			}

			if (kuriagari)
				ans[j][i] = kuriagari + '0';
		}

		while(input_b[i]) {
			ans[j][i] = input_b[i];
			i++;
		}

		while(input_a[i]) {
			ans[j][i] = input_a[i];
			i++;
		}

		rev_str(ans[j]);
		
		if(ans[j][80])
			printf("overflow");
		else
			printf("%s", ans[j]);

		putchar('\n');

	}

	return 0;
}

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

int main()
{
	long long hit=0;
	long long st,en;
	scanf("%lld%lld",&st,&en);
	while(st<=en)
	{
		st*=2;
		hit++;
	}
	printf("%lld\n",hit);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef double db;

#define rep_it(it,x) for (__typeof((x).begin()) it=(x).begin(); it!=(x).end(); it++)
#define ____ puts("\n_______________\n\n") 
#define debug(x) ____; cout<< #x << " => " << (x) << endl
#define debug_pair(x) cout<<"\n{ "<<(x).fir<<" , "<<(x).sec<<" }\n"
#define debug_arr(x,n) ____; cout<<#x<<":\n"; rep(i,0,n+1) cout<<#x<<"["<<(i)<<"] => "<<x[i]<<endl
#define debug_arr2(x,n,m) ____; cout<<#x<<":\n"; rep(i,0,n+1) rep(j,0,m+1) cout<<#x<<"["<<(i)<<"]["<<(j)<<"]= "<<x[i][j]<<((j==m)?"\n\n":"    ")
#define debug_set(x) ____; cout<<#x<<": \n"; rep_it(it,x) cout<<(*it)<<" "; cout<<endl
#define debug_map(x) ____; cout<<#x<<": \n"; rep_it(it,x) debug_pair(*it)

void file_put() {
    freopen("filename.in", "r", stdin);
    freopen("filename.out", "w", stdout);
}

const int N=20000+5,P=924844033;
ll inv[N],fac[N],dp[N],f[N],ret=0; int n,cnt=0,len[N],k; bool v[N<<1]; vi V[N<<1];

void init() {
	fac[0]=1; rep(i,1,N) fac[i]=fac[i-1]*i%P;
	inv[0]=inv[1]=1; rep(i,2,N) inv[i]=(P-P/i)*inv[P%i]%P;
	rep(i,1,N) inv[i]=inv[i-1]*inv[i]%P;
}

ll C(int n,int k) {
	if (n<0 || k<0 || n<k) return 0;
	return fac[n]*inv[k]%P*inv[n-k]%P;
}

void dfs(int x,int k) {
	len[k]++; v[x]=1;
	if (V[x].empty()) return;
	if (!v[V[x][0]]) dfs(V[x][0],k);
}

int main() {
//	file_put();
	
	init();
	scanf("%d%d",&n,&k);
	rep(i,1,n+1) {
		if (i+k<=n) V[i].pb(i+k+n);
		if (i-k>0) V[i-k+n].pb(i);
	}
	rep(i,1,k+1) {
		if (v[i]) continue;
		dfs(i,++cnt); len[cnt]--;
	}
	rep(i,n+1,n+k+1) {
		if (v[i]) continue;
		dfs(i,++cnt); len[cnt]--;
	}
	dp[0]=1;
	rep(i,1,cnt+1) {
		memset(f,0,sizeof(f));
		rep(j,0,len[i]+1) per(k,0,n-j+1) (f[k+j]+=dp[k]*C(len[i]-j+1,j)%P)%=P;
		swap(f,dp);
	}
	for (int i=0,op=1; i<=n; i++,op=-op) ret+=dp[i]*op*fac[n-i]%P,ret%=P;
	printf("%lld\n",(ret+P)%P);
	
	return 0;
}



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

int main()
{
    string s;
    cin>>s;
    
    if(s[3]==s[2])
    {
        if(s[4]==s[5])
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    
    cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 256
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if A < B:
  moveA = A + V*T
  moveB = B + W*T
  if moveA >= moveB:
    print('YES')
  else:
    print('NO')
else:
  moveA = A - V*T
  moveB = B - W*T
  if moveA <= moveB:
    print('YES')
  else:
    print('NO')

Measured memory_bytes: 9192
class UnionFind:
    def __init__(self,n):
        super().__init__()
        self.par = [-1]*n
        self.rank = [0]*n
        self.tsize = [1]*n
    
    def root(self,x):
        if self.par[x] == -1:
            return x 
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x_r = self.root(x)
        y_r = self.root(y)
        
        if self.rank[x_r]>self.rank[y_r]:
            self.par[y_r] = x_r

        elif self.rank[x_r]<self.rank[y_r]:
            self.par[x_r] = y_r

        elif x_r != y_r:
            self.par[y_r] = x_r
            self.rank[x_r] += 1

        if x_r != y_r:
            size = self.tsize[x_r]+self.tsize[y_r]
            self.tsize[x_r] = size
            self.tsize[y_r] = size

    def isSame(self,x,y):
        return self.root(x) == self.root(y)

    def size(self,x):
        return self.tsize[self.root(x)]
      
n,m = tuple(map(int,input().split()))

ll = []
uf = UnionFind(m)
for _ in range(n):
  k, *l = tuple(map(int,input().split()))
  for i in range(k-1):
    uf.unite(l[i]-1,l[i+1]-1)
  ll.append(l[0]-1)

for lang in ll:
  if not uf.isSame(lang,ll[-1]):
    print("NO")
    exit()
print("YES")


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

int main(){
  int N;
  cin >> N;
  vector<int> A(6);
  A.at(0)=105;
  A.at(1)=135;
  A.at(2)=165;
  A.at(3)=189;
  A.at(4)=195;
  A.at(5)=201;
  for(int i = 0;i<6;i++){
    if(A.at(i)>N){
      cout << i << endl;
      break;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)


int main() {
	ll N,K;
  	cin>>N>>K;
  	long double a[N];
  	rep(i,N) cin>>a[i];
  
  	for(int i=K;i<N;i++){
     	 long double ptmp=1000000;
      	 ptmp/=a[i-K];
      	 ptmp*=a[i];
      	 if(ptmp>1000000) cout<<"Yes"<<endl;
      	 else cout<<"No"<<endl;
    }
  
  	
}

Measured memory_bytes: 6848
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
a = sum(x <= A for x in P)
b = sum((A + 1) <= x and x <= B for x in P)
c = sum(B + 1 <= x for x in P)
print(min([a, b, c]))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>

using namespace std;

static const int MAX = 100001;
map<int, int> dictionary;
vector<int> num(MAX, 0);

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


    for (int i = 0; i < MAX; i++) num[a] %= 3;

    vector<int> cnt(2, 0);
    for (auto& value:dictionary){
        int last = value.second % 2;
        cnt[last]++;
    }

    if (cnt[0] % 2 == 1) {
        cnt[1]--;
    }
    cout << accumulate(cnt.begin(), cnt.end(), 0) << '\n';
}


Measured memory_bytes: 5376