akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr<<"hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

using ll=long long; 
using ld=long double;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; 

#define LLINF ((long long)1e18)
#define INF int(1e9+1e6)
#define MAXN (100006)
ll n;
pi dp[MAXN];
vector<int>v[MAXN];
bool tryy(ll i){
	function<void(ll,ll,ll)>dfs=[&](ll x,ll p,ll d){
		dp[x]=pi(0,0);
		multiset<ll,greater<ll>> s;
		for(auto i:v[x]) if(i^p) {
			dfs(i,x,d), dp[x].f += dp[i].f;
			if(dp[i].s+1==d){
				++ dp[x].f;
			}else{
				s.ins(dp[i].s);
			}
		}
		while(s.size()){
			ll y=*s.begin();
			auto other=s.lower_bound(d-y-1);
			if(s.size() == 1 || other==s.end()) {
				dp[x].f += dp[x].s > 0;
				dp[x].s = y;
				s.erase(s.begin());
				continue;
			}
			if(other==s.begin())++other;
			assert(y+*other+1 <= d);
			s.erase(other), s.erase(s.begin());
			++dp[x].f;
		}
		dp[x].s += x != 1;
		if(x==1){
			if(dp[x].s) ++ dp[x].f, dp[x].s=0;
		}
	};
	auto bstar=[&](ll x){
		dfs(1,1,x);
		return dp[1].f <= i;
	};
	ll st=1, en=n+1;
	while(en-st>1){
		ll mid=(st+en)>>1;
		if(bstar(mid))en=mid;
		else st=mid;
	}
	if(en==n+1) return 0;
	cout<<i<<' '<<en-1<<'\n';
	return 1;
}
int main(){
	FAST
	cin>>n;
	FOR(i,0,n-2){
		ll a,b;
		cin>>a>>b;
		v[a].eb(b), v[b].eb(a);
	}
	ll ans=0;
	FOR(i,1,n)ans+=v[i].size()&1;
	ans /= 2;
	assert(tryy(ans));
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int n,a,b;
    string s;
    cin >> n >> a >> b >> s;
    int x=0,y=0;
    rep(i,0,n){
        if(s[i]=='a'){
            if(x<a+b){
                cout << "Yes" << endl;
                ++x;
            }else cout << "No" << endl;

        }
        if(s[i]=='b'){
            ++y;
            if(x<a+b and y<=b){
                cout << "Yes" << endl;
                ++x;
            }else cout << "No" << endl;
        }
        if(s[i]=='c') cout << "No" << endl;
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 848
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
const int N = 1e5+9;
int a[200005];

int32_t main()
{
    int n, k;
    cin >> n >> k;
    int pos = n+1;
    int m = 0;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
        if(a[i] >= 0 && pos == (n+1))
        {
            pos = i;
        }
    }
  //  cout << pos << endl;
    int rsum = 0, lsum = 0;
    stack<int>st;
    int cur = 0;
    int c = 0;
    m = 0;
    int ans = 9999999999999999;

    for(int i = pos; i <= n; i++)
    {
        rsum = a[i];
        st.push(abs(cur-a[i]));
        c++;
        if(c>=k)
        {
          ans = rsum;
            break;
        }
        cur = a[i];
    }
 //   cout << rsum << endl;
    int sum = rsum, r = 0;


    for(int i = pos-1; i >=1; i--)
    {
        if(c<k)
        {
            c++;
            if(c==k){
               sum += abs(a[i]*2);
               m = abs(a[i])*2;
               ans  = min(sum, ans);
            }

        }
        else
        {
            ans = min(ans, sum);
            if(!st.empty())
            {
                r = st.top();
                st.pop();
            }
            else
            {
                r = 0;
            }
            sum -= r;
            sum -= m;
            sum += (abs(a[i])*2);
            m = abs(a[i])*2;
            ans = min(ans, sum);
        }
    }

    //cout << ans << endl;
    lsum = 0;
    cur = 0;
    stack<int>sst;
    c = 0;
    m = 0;
    for(int i = pos-1; i >= 1; i--)
    {
        lsum = abs(a[i]);
     //   cout << "lsum: "<<lsum << endl;
        a[i] *= -1;
        sst.push(abs(cur - a[i]));
        c++;
        if(c>=k)
        {
             ans = min(ans, lsum);
            break;
        }
        cur = a[i];
    }
   // cout <<"lsum : "<< lsum << endl;
    sum = lsum;
    for(int i = pos; i <= n; i++)
    {
        if(c<k)
        {
            c++;

             if(c==k){
               sum += (abs(a[i])*2);
               m = abs(a[i])*2;
               ans  = min(sum, ans);
            }

        }
        else
        {
            ans = min(ans, sum);
            if(!sst.empty())
            {
                r = sst.top();
                sst.pop();
            }
            else
            {
                r = 0;
            }
            sum -= r;
            sum -= m;
            sum += (abs(a[i])*2);
            m = abs(a[i])*2;
            ans = min(ans, sum);
        }
      //  cout <<"sum: "<< sum << " "<<c<<endl;
    }
   // cout << "last: "<<sum << endl;
    cout << ans;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

struct point{
	double x,y;
	point operator+(point p){
		return point{x+p.x,y+p.y};
	}
	point operator-(point p){
		return point{x-p.x,y-p.y};
	}
	point operator*(double p){
	return point{x*p,y*p};
	}
	point operator/(double p){
		if(!p) return point{0,0}; 
		return point{x/p,y/p};
	}
	bool operator==(point p){
		return fabs(x-p.x)<eps&&fabs(y-p.y)<eps;
	}
};

typedef pair<point,point> pp;
const point O{0,0};

class Geom{
	public:
	double Length(point x,point y){
		point z=y-x;
		return sqrt(z.x*z.x+z.y*z.y);
	}
	double IP(point p,point q){
		return p.x*q.x+p.y*q.y;
	}
	double CP(point p,point q){
		return p.x*q.y-q.x*p.y;
	}
	string Counter_Clockwise(pp a,point x){
		point A=a.second-a.first;
		point X=x-a.first;
		double cp=CP(A,X),ip=IP(A,X),Al=Length(O,A),Xl=Length(O,X);
		if(cp>eps) return "COUNTER_CLOCKWISE";
		if(cp<-eps) return "CLOCKWISE";
		if(ip<-eps) return "ONLINE_BACK";
		if(Xl<Al||fabs(Xl-Al)<eps) return "ON_SEGMENT";
		return "ONLINE_FRONT";
	}
};

int Q;
double x,y,X1,Y1,X2,Y2;

int main(){
	Geom geo;
	cin>>X1>>Y1>>X2>>Y2>>Q;
	for(int i=0;i<Q;i++){
		cin>>x>>y;
		cout<<geo.Counter_Clockwise(pp(point{X1,Y1},point{X2,Y2}),point{x,y})<<endl;
	}
}

Measured memory_bytes: 1236
#include <algorithm>
#include <stdio.h>
using namespace std;

struct Int2 {
	int x, y;
	Int2() :x(0), y(y) {};
	Int2(int x, int y) :x(x), y(y) {};
	Int2(const Int2& other) :x(other.x), y(other.y) {};

	bool operator<(const Int2& other) const {
		if (x != other.x)
			return x < other.x;
		return y < other.y;
	}
	bool operator>(const Int2& other) const {
		if (x != other.x)
			return x > other.x;
		return y > other.y;
	}
};
int A[301][301];
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			scanf("%d", &A[i][j]);

	bool valid = true;
	for (int i = 1; i <= n - 1; i++)
		for (int j = i + 1; j <= n; j++)
			for (int k = 1; k <= n; k++)
				if (i != k && j != k && A[i][k] + A[k][j] < A[i][j]) {
					valid = false;
					k = n;
					j = n;
					i = n - 1;
				}

	if (valid) {
		int index = 0, newA[301][301];
		long long total = 0;
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
				newA[i][j] = 1000000001;
		Int2 ED[89850];
		for (int i = 1; i <= n; i++)
			for (int j = i + 1; j <= n; j++)
				ED[index++] = Int2(i, j);
		sort(ED, ED + index, [](const Int2& x, const Int2& y) {
			return A[x.x][x.y] < A[y.x][y.y];
		});
		for (int i = 0; i < index; i++) {
			if (A[ED[i].x][ED[i].y] < newA[ED[i].x][ED[i].y]) {
				bool lroot = false;
				for (int j = 1; j <= n; j++)
					if (ED[i].x != j && ED[i].y != j && newA[ED[i].x][j] + newA[j][ED[i].y] <= A[ED[i].x][ED[i].y]) {
						lroot = true;
						j = n;
					}

				if (!lroot)
					total += A[ED[i].x][ED[i].y];
				newA[ED[i].x][ED[i].y] = newA[ED[i].y][ED[i].x] = A[ED[i].x][ED[i].y];

				for (int j = 1; j <= n; j++)
					if (ED[i].x != j && ED[i].y != j)
						newA[ED[i].x][j] = newA[j][ED[i].x] = min(newA[ED[i].x][j], newA[ED[i].x][ED[i].y] + newA[ED[i].y][j]);
				for (int j = 1; j <= n; j++)
					if (ED[i].x != j && ED[i].y != j)
						newA[j][ED[i].y] = newA[ED[i].y][j] = min(newA[j][ED[i].y], newA[j][ED[i].x] + newA[ED[i].x][ED[i].y]);
			}
		}
		printf("%lld\n", total);
	} else {
		printf("%d\n", -1);
	}
}

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

int main() {
    int N;
    cin >> N;
    string s;
    cin >> s;
    int maxv = 0, c;
    for (int i = 1; i < s.size(); i++) {
        set<char> a, b;
        for (int p = 0; p < i; p++) {
            a.insert(s[p]);
        }
        for (int q = i; q < s.size(); q++) {
            b.insert(s[q]);
        }
        c = 0;
        for (auto A : a) {
            if (b.find(A) != b.end()) {
                c++;
            }
        }
        maxv = max(c, maxv);
    }

    cout << maxv << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int INF = 1000000010;

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

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

int search(int idx, std::vector<std::vector<int>> vec, std::vector<int>& s, std::vector<int>& d, int t) {
	if (d[idx] != 0 || s[idx] != 0) return t - 1;
	if (s[idx] == 0) s[idx] = t;
	for (int i = 0; i < vec[idx].size(); i++) {
		if (idx == vec[idx][i] - 1) continue;
		t = search(vec[idx][i] - 1, vec, s, d, t + 1);
	}
	d[idx] = ++t;
	return t;
}

int main() {
	int n;
	std::cin >> n;
	std::vector<std::vector<int>> vec(n);
	std::vector<int> s(n, 0);
	std::vector<int> d(n, 0);
	for (int i = 0; i < n; i++) {
		int u, k;
		std::cin >> u >> k;
		for (int j = 0; j < k; j++) {
			int a;
			std::cin >> a;
			vec[u - 1].push_back(a);
		}
	}

	int t = 0;
	for (int i = 0; i < n; i++) {
		t = search(i, vec, s, d, t + 1);
	}
	// output
	for (int i = 0; i < n; i++) {
		std::cout << i + 1 << " " << s[i] << " " << d[i] << std::endl;
	}
}


Measured memory_bytes: 3700
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int r=scn.nextInt();
		int d=scn.nextInt();
		int x=scn.nextInt();
		
		for(int i=1;i<=10;i++) {
			x=r*x-d;
			System.out.println(x);
		}
	}

}


Measured memory_bytes: 21972
# coding: utf-8
N = int(input())
A = list(map(int,input().split()))
flg = True
ans = 1
A.sort()
for a in A:
    ans *= a
    if ans > 10**18:
        flg = False
        break
    if ans == 0:
        break
if flg:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 88576
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
ba = -1
ans = 0
for a in A:
	if ba + 1 == a:
		ans += C[ba-1]
	ba = a
print(sum(B)+ans)


Measured memory_bytes: 3060
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    if(n == 1) {
      System.out.println("Hello World");
    } else {
      int a = sc.nextInt();
      int b = sc.nextInt();
      System.out.println(a + b);
    }
  }
}

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

typedef pair<int,int> P;

int main(){
    int H,W; cin >> H >> W;
    int a[H][W];
    vector<P> prev;
    vector<P> next;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> a[i][j];
        }
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W-1;j++){
            if(a[i][j]%2==1){
                a[i][j+1]++;
                prev.push_back({i,j});
                next.push_back({i,j+1});
            }
        }
    }
    for(int i=0;i<H-1;i++){
        if(a[i][W-1]%2==1){
            a[i+1][W-1]++;
            prev.push_back({i,W-1});
            next.push_back({i+1,W-1});
        }
    }
    int N=prev.size();
    cout << N << endl;
    for(int i=0;i<N;i++){
        cout << prev[i].first+1 << " " << prev[i].second+1 << " ";
        cout << next[i].first+1 << " " << next[i].second+1 << endl;
    }
}

Measured memory_bytes: 5356
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam))
  #-swank (set-dispatch-macro-character #\# #\> (lambda (s c p) (declare (ignore c p)) (read s nil (values) t))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro xor (form1 form2)
  (let ((f1 (gensym)) (f2 (gensym)))
    `(let ((,f1 ,form1)
           (,f2 ,form2))
       (if ,f1 (not ,f2) ,f2))))

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

(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (gc :full t)
  (let* ((n (read))
         (table (make-array n :element-type 'bit)))
    (labels ((query (pos)
               (println pos)
               (let ((answer (read-line)))
                 (cond ((string= answer "Male")
                        (setf (aref table pos) 1))
                       ((string= answer "Female")
                        (setf (aref table pos) 0))
                       ((string= answer "Vacant")
                        (return-from main))
                       (t (error "Huh?"))))))
      (query 0)
      (nlet bisect ((l 0) (r n))
        (let ((mid (ash (+ l r) -1)))
          (query mid)
          (if (xor (evenp (- mid l))
                   (= (aref table l) (aref table mid)))
              (bisect l mid)
              (bisect mid r)))))))

#-swank(main)


Measured memory_bytes: 11196
N=int(input())

def digit(x):
    digit=1
    while x>0:
        if x//10>0:
            digit+=1
            x//=10
        else:
            break
    return digit

for i in range(int(N**(1/2)),-1,-1):
    if N%i!=0:
        pass
    else:
        print(digit(N//i))
        break

        


Measured memory_bytes: 9424
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
typedef long long ll;

int main(){
    fastio;
    int k, a, b, flag = 0;
    cin >> k >> a >> b;
    for(int i = a; i <= b; ++i){
        if(i % k == 0){
            flag = 1;
            break;
        }
    }
    if(flag == 1) cout << "OK\n";
    else cout << "NG\n";
    return 0;
}


Measured memory_bytes: 3652
/******************************************
*    AUTHOR:         julianferres         *
******************************************/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define show(v,n) cerr << #v << " = "; forn(i,n) cerr << v[i] << " "; cerr << endl;
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl
const int inf = 1<<30; // const ll inf = 1LL<<62;
const int mod = 1e9+7; // 998244353
const int N  = 2e5+5;

ll n;
vi t(2 * N,0), h(N), a(N);
vi dp(N, 0); //dp[i]: Best answer finishing in a[i]

//Sum iterative segment tree
void build()
{ // build the tree
  for (ll i = n - 1; i > 0; --i)
    t[i] = max(t[i << 1], t[i << 1 | 1]);
}
void modify(ll p, ll value)
{ // set value at position p
  for (t[p += n] = value; p > 1; p >>= 1)
    t[p >> 1] = max(t[p],t[p ^ 1]);
}
ll query(ll l, ll r)
{ // sum on interval [l, r)
  ll res = 0;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1)
  {
    if (l & 1)
        res = max(res, t[l++]);
    if (r & 1)
      res = max(res,t[--r]);
  }
  return res;
}



int main(){
    FIN;
    cin >> n;
    forn(i, n) cin >> h[i];
    forn(i, n) cin >> a[i];

    dp[0] = a[0];
    modify(h[0] - 1, dp[0]);

    forr(i,1,n){
        // dp[i] = max(dp[j])+a[i], j<i and h[j]<h[i]
        dp[i] = query(0, h[i]) + a[i];
        modify(h[i] - 1, dp[i]);
    }

    ll ans = 0;
    forn(i, n) ans = max(ans, dp[i]);
    show(dp, n);
    show(t, 2*n);
    cout << ans << endl;

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int i = 1;
  int ans = 0;
  while (i < 10) {
    ans = i * 111;
    if (ans >= n) {
      break;
    } else {
      i++;
    }
  }
  cout << ans << endl;
  return 0;
}
  

Measured memory_bytes: 256
N = gets.to_i
A = gets.split(' ').map(&:to_i)

ans = 0
while A[0] > 1 do
    for i in 0..N-1 do
        if A[i] % 2 == 0 then
            A[i] /= 2
        else
            puts ans
            exit
        end
    end
    ans += 1
end

puts ans

Measured memory_bytes: 14132
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define N 200000

int main() {
  int i, j;
  short int *x = (short int *)malloc(sizeof(short int) * N);
  short int *y = (short int *)malloc(sizeof(short int) * N);
  //int countx = 0, county = 0;
  int tempx, tempy;
  int flag = 0;

  for (i = 0; i < N;i++) {
    x[i] = 0;
    y[i] = 0;
  }
  int n, m;
  scanf("%d %d", &n, &m);

  for (i = 0; i < m;i++) {
    scanf("%d %d", &tempx, &tempy);
    if (tempx == 1) {
      x[tempy] = 1;
    }
    if (tempy == n) {
      y[tempx] = 1;
    }
  }

  for (i = 0; i < N;i++) {
    if (x[i] == 1) {
      if (y[i] == 1) {
        flag = 1;
        break;
      }
    }
  }
  
  if (flag == 1) {
    printf("POSSIBLE");
  }
  else {
    printf("IMPOSSIBLE");
  }

  return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
int main(void){
    float x1,y1,x2,y2,x3,y3,x4,y4;
    double grada,gradb;
    int i,n;
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        scanf("%f %f %f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        grada=(y2-y1)/(x2-x1);
        gradb=(y4-y3)/(x4-x3);
        
        if(grada==gradb){
            printf("YES\n");
        }
        else{
            printf("NO\n");
        }
        
    }
    
    return 0;
}

Measured memory_bytes: 616
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
		    arr[i] = sc.nextInt();
		}
		Arrays.sort(arr);
		int max = (arr[n - 1] + b - 1) / b;
		int left = 0;
		int right = max;
		while (right - left > 1) {
		    int m = (left + right) / 2;
		    int nom = b * m;
		    int count = 0;
		    for (int i = n - 1; i >= 0 && arr[i] > nom && count <= m; i--) {
		        count += (arr[i] - nom + (a - b) - 1) / (a - b);
		    }
		    if (count > m) {
		        left = m;
		    } else {
		        right = m;
		    }
		}
	    System.out.println(right);
   }
}




Measured memory_bytes: 50472
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]


N, M = Is()
H = LI()
AB = [set() for _ in range(N)]
for i in range(M):
    a, b = Is()
    a -= 1
    b -= 1
    AB[a].add(b)
    AB[b].add(a)

ans = 0
notgood = [False]*N

# print(AB)

for i in range(N):
    # print("{} start".format(i))
    # print(AB[i])
    if notgood[i]:
        continue
    if len(AB[i]) == 0:
        ans += 1
        continue
    for x in AB[i]:
        # print(H[x], H[i])
        if H[x] > H[i]:
            notgood[i] = True
            break
        elif H[x] == H[i]:
            notgood[x] = True
            notgood[i] = True
            break
        else:
            notgood[x] = True
    else:
        ans += 1
        # print("{} is GOOD!!!".format(i))

print(ans)

Measured memory_bytes: 108264
function Main(input) {
  var tmp = input.trim().split(' ')
  var A = parseInt(tmp[0])
  var B = parseInt(tmp[1])

  var result = -1

  for (var i = 0; i < 10000; i++) {
    if (Math.floor(i * 0.08) === A && Math.floor(i * 0.1) === B) {
      result = i
      break
    }
  }

  console.log(result)
  return result
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 11596
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        Set<String> dict = new HashSet<>();
        int n = Integer.parseInt(br.readLine());

        for(int i = 0; i < n; i++){
            String[] input = br.readLine().split(" ");

            if(input[0].charAt(0) == 'i'){
                dict.add(input[1]);
            }else if(input[0].charAt(0) == 'f'){
                if(dict.contains(input[1])){
                    System.out.println("yes");
                }else{
                    System.out.println("no");
                }
            }
        }

    }
}


Measured memory_bytes: 189896
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  vi v(3);
  while(1){
    cin>>v[0]>>v[1]>>v[2];
    if(v[0]==0 && v[1]==0 && v[2]==0)break;
    sort(all(v));
    int n;
    cin>>n;
    double len=hypot(v[0],v[1])/2;
    rep(i,n){
      int r;
      cin>>r;
      if(r>len)cout<<"OK"<<endl;
      else cout<<"NA"<<endl;
    }
  }
}

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

int main(){
	int n,m;
	cin>>n>>m;
	ll a[n];
	pair<ll,ll> bc[m];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	ll s=0;
	ll cumul[n];
	for(int i=0;i<n;i++){
		s+=a[i];
		cumul[i]=s;
	}
	for(int i=0;i<m;i++){
		ll x,y;
		cin>>x>>y;
		bc[i]={-y,-x};
	}
	sort(bc,bc+m);
	ll sum=cumul[n-1];
	ll num=0;
	for(int i=0;i<m;i++){
		ll b,c;
		b=-bc[i].second;
		c=-bc[i].first;
		int ind=upper_bound(a,a+n,c)-a-num;
		if(ind<=0){
			break;
		}
		if(ind<=b){
			num+=ind;
			sum+=c*ind;
		}
		else{
			num+=b;
			sum+=b*c;
		}
	}
	if(num>0){
		sum-=cumul[num-1];
	}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long ans = -100100100100L;
		for(long i = 0 ; i <= n ; i++) {
			if(i * i <= n) {
				ans = Math.max(ans, i * i);
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
#define oo (long long)1e18
#define ll long long
#define setdp memset(dp,-1,sizeof(dp))
const ll mod = 1e9+7;
void _IOS(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);}
#define PI 3.14159265359
int sx,sy,tx,ty;

struct threeElements{
int _1st,_2nd,_3rd;
};
vector<vector<int>>adj(10);
int sum,n,m,visited[11];
void dfs(int i){
    visited[i]=1;
    int flag=1;
    for(int j=1;j<=n;++j){
        if(!visited[j]){
            flag=0;
        }
    }
    if(flag){
        sum++;
        return;
    }
    for(auto x:adj[i]){
        if(!visited[x]){
            dfs(x);
            visited[x]=0;
        }
    }
}
int main()
{
   // freopen ("jumping.in","r",stdin);
   _IOS();
   //18:17
   ll n,m,ans=0;
   cin>>n>>m;
   if(n*2>m)
   {
        ans=m/2;
   }else
   {
       ans=n;
       m-=n*2;
       ans+=m/4;
   }
   cout<<ans;

}


Measured memory_bytes: 3632
n,a,b = [int(x) for x in input().split()]
mod = 10**9 + 7
def comb(x,y):
    child = 1
    mother = 1
    for i in range(y):
        child = child * (x-i)%mod
        mother = mother * (i+1)%mod
    return child * pow(mother,mod-2,mod) % mod
ans = pow(2,n,mod) - 1 - comb(n,a) - comb(n,b)
print(ans%mod)

Measured memory_bytes: 3064
#include<iostream>
#include<map>

using namespace std;

int main(){

  char a,b,c;

  int n;

  for( ; ; ){

  cin>> n;

  if(n==0)break;

  map<char,char> a2b;

   for(int i=0;i<n;i++){

     cin>>a>>b;

     a2b[a]=b;
   }
   cin>>n;
   for(int i=0;i<n;i++){
     cin>>c;
     if(a2b.count(c)==0)
       cout<<c;
     else cout<<a2b[c];
   }
   cout<<endl;
  }
  return 0;
}

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

using namespace std;

const int max_n = 200222, inf = 1000111222;

struct state {
    int a, b;
};

int n, t;
vector<int> p, zero;
state a[max_n];

long long get_time(const state &a, const state &b) {
    long long res = 1 + a.a + a.b;
    res += 1;
    res *= b.a + 1;
    res += b.b;
    return res;
}

bool cmp(int x, int y) {
    return get_time(a[x], a[y]) < get_time(a[y], a[x]);
}

int solve(int p[]) {
    long long res = 0;
    for (int i = 0; i < n; ++i) {
        const int id = p[i];
        res = (res + 1) * (a[id].a + 1) + a[id].b;
        if (res > t) {
            return i;
        }
    }
    return n;
}

const int max_cnt = 33;

long long dp[2][max_cnt];

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    scanf("%d%d", &n, &t);
    for (int i = 0; i < n; ++i) {
        scanf("%d%d", &a[i].a, &a[i].b);
        if (a[i].a) {
            p.push_back(i);
        } else {
            zero.push_back(a[i].b + 1);
        }
    }
    sort(p.begin(), p.end(), cmp);
    int q1 = 0, q2 = 1;
    fill(dp[q1], dp[q1] + max_cnt, inf);
    dp[q1][0] = 0;
    for (int id : p) {
        //cout << "#" << id << endl;
        copy(dp[q1], dp[q1] + max_cnt, dp[q2]);
        for (int i = 0; i + 1 < max_cnt; ++i) {
            if (dp[q1][i] == inf) {
                continue;
            }
            long long nres = (dp[q1][i] + 1) * (a[id].a + 1) + a[id].b;
            if (nres <= t) {
                dp[q2][i + 1] = min(dp[q2][i + 1], nres);
            }
        }
        swap(q1, q2);
        /*for (int i = 0; i <= n; ++i) {
            cout << dp[q1][i] << " ";
        }
        cout << endl;*/
    }
    sort(zero.begin(), zero.end());
    int ans = 0;
    for (int i = 0; i < max_cnt; ++i) {
        if (dp[q1][i] == inf) {
            continue;
        }
        int res = i;
        //cout << i << ": " << res << endl;
        long long sum = dp[q1][i];
        for (int x : zero) {
            if (sum + x <= t) {
                sum += x;
                ++res;
            } else {
                break;
            }
        }
        ans = max(ans, res);
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 2804
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define poly vector<ll>
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
inline ll read(){
	ll x=0;char ch=getchar();bool d=1;
	for(;!isdigit(ch);ch=getchar()) if(ch=='-') d=0;
	for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return d?x:-x;
}
inline void write(ll x){
	if(x<0) x=-x,putchar('-');
	if(x>=10) write(x/10);
	putchar('0'+x%10);
}
inline void writeln(ll x){write(x);puts("");}
inline void writep(ll x){write(x);putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=105;
int a[N][N][2];
short f[N][N][N][N];
int main(){
	int n=read(),m=read(),x,y;
	For(i,1,n){
		char s[N];
		scanf("%s",s+1);
		For(j,1,m){
			if(s[j]=='E') x=i,y=j;
			a[i][j][0]=a[i-1][j][0]+(s[j]=='o');
			a[i][j][1]=a[i][j-1][1]+(s[j]=='o');
		}
	}
	int ans=0;
	For(l,0,y-1) For(r,0,m-y){
		For(u,0,x-1) For(d,0,n-x){
			ans=max(ans,(int)f[l][r][u][d]);
			if(l+r<y-1) f[l+1][r][u][d]=max((int)f[l+1][r][u][d],(int)f[l][r][u][d]+a[min(x+d,n-u)][y-l-1][0]-a[max(x-u-1,d)][y-l-1][0]);
			if(l+r<m-y) f[l][r+1][u][d]=max((int)f[l][r+1][u][d],(int)f[l][r][u][d]+a[min(x+d,n-u)][y+r+1][0]-a[max(x-u-1,d)][y+r+1][0]);
			if(u+d<x-1) f[l][r][u+1][d]=max((int)f[l][r][u+1][d],(int)f[l][r][u][d]+a[x-u-1][min(y+r,m-l)][1]-a[x-u-1][max(y-l-1,r)][1]);
			if(u+d<n-x) f[l][r][u][d+1]=max((int)f[l][r][u][d+1],(int)f[l][r][u][d]+a[x+d+1][min(y+r,m-l)][1]-a[x+d+1][max(y-l-1,r)][1]);
		}
	}
	cout<<ans;
}


Measured memory_bytes: 55160
//RE
#include <stdio.h>
#include <stdlib.h>
//#include <string.h>
#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

#define max(a,b) (a > b ? a : b)

typedef struct queue{
  int a;
  int b;
  struct queue *next;
} queue;

char s[22][22];
int t[22][22];

void grid_init(int h) {
  for (int i=0; i<h; i++) scanf("%s", s[i]);
  for (int i=0; i<22; i++) {
    for (int j=0; j<22; j++) {
      if (s[i][j] == '.') continue;
      else s[i][j] = '#';
    }
  }
  return ;
}

//first element
queue *queue_init() {
  queue *q = malloc(sizeof(queue));
  q->next = NULL;
  return q;
}

queue *queue_create(int a, int b) {
  queue *q = malloc(sizeof(queue));
  q->a = a;
  q->b = b;
  q->next = NULL;
  return q;
}

void queue_free(queue *q) {
  if (q != NULL) free(q);
  return ;
}

bool queue_empty(queue *q) {
  if (q->next == NULL) return true;
  return false;
}

queue *queue_back(queue *q) {
  if (queue_empty(q)) return q;
  return queue_back(q->next);
}

queue *queue_front(queue *q) {
  if (queue_empty(q)) return NULL;
  return q->next;
}

void queue_pop(queue *q) {
  if (queue_empty(q)) return ;
  queue *qnext = q->next;
  q->next = qnext->next;
  queue_free(qnext);
  return ;
}

void queue_push(queue *q, int a, int b) {
  queue_back(q)->next = queue_create(a, b);
  return ;
}

void bfs_init() {
  for (int i=0; i<22; i++)
    for (int j=0; j<22; j++) t[i][j] = -1;
  return ;
}

void enqueue(queue *q, int a, int b)
{
  if (a > 0 && s[a - 1][b] == '.' && t[a - 1][b] == -1)
  {
    queue_push(q, a - 1, b);
    t[a - 1][b] = t[a][b] + 1;
  }
  if (s[a + 1][b] == '.' && t[a + 1][b] == -1)
  {
    queue_push(q, a + 1, b);
    t[a + 1][b] = t[a][b] + 1;
  }
  if (b > 0 && s[a][b - 1] == '.' && t[a][b - 1] == -1)
  {
    queue_push(q, a, b - 1);
    t[a][b - 1] = t[a][b] + 1;
  }
  if (s[a][b + 1] == '.' && t[a][b + 1] == -1)
  {
    queue_push(q, a, b + 1);
    t[a][b + 1] = t[a][b] + 1;
  }
  return ;
}

void bfs(queue *q ,int a,  int b) {
  enqueue(q, a, b);
  while (!queue_empty(q)) {
    queue *front = queue_front(q);
    int fa = front->a;
    int fb = front->b;
    queue_pop(q);
    enqueue(q, fa, fb);
  }
  return ;
}

int main() {
  int h, w;
  scanf("%d %d", &h, &w);
  grid_init(h);
  /*
  for (int i=0; i<25; i++) {
    for (int j=0; j<25; j++) printf("%c", s[i][j]);
    printf("\n");
  }
  */
  int ans = 0;
  queue *q = queue_init();
  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
      if (s[i][j] != '.') continue;
      bfs_init();
      t[i][j] = 0;
      bfs(q, i, j);
      for (int k=0; k<h; k++) {
        for (int l=0; l<w; l++) {
          if (s[k][l] == '.') ans = max(ans, t[k][l]);
          //printf("%d ", t[k][l]);
        }
        //printf("\n");
      }
      //printf("\n");
    }
  }
  queue_free(q);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
program test
implicit none
integer::N
integer::A(3,3)
integer,allocatable::B(:)
integer::i,ans
ans=0
!fortranは縦が速い
do i=1,3
	read*,A(:,i)
end do
!ビンゴの読み込み
read*,N
allocate(B(N))
do i=1,N
	read*,B(i)
end do
!ビンゴヒットしたところを0
do i=1,N
	where(A==b(i))
    	A=0
    end where
end do
!ビンゴチェック
do i=1,3
if(A(i,1)==0 .and. A(i,2)==0 .and. A(i,3)==0)then
	ans = 1
end if
end do

do i=1,3
if(A(1,i)==0 .and. A(2,i)==0 .and. A(3,i)==0)then
	ans = 1
end if
end do

if(A(1,1)==0 .and. A(2,2)==0 .and. A(3,3)==0)then
	ans=1
end if

if(A(1,3)==0 .and. A(2,2)==0 .and. A(3,1)==0)then
	ans=1
end if

if(ans==1)then 
	print*,'Yes'
else
	print*,'No'
end if
end program test

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
    char S[4];
    cin >> S;

    int ans = 0;
    for (int i = 0; i < 4; i++) {
        if (S[i] == '+') {
            ans++;
        }
        else {
            ans--;
        }
    }

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        for(int i=0;;i++){
        int m,f,r;
        m=sc.nextInt();
        f=sc.nextInt();
        r=sc.nextInt();
if(m==-1&&f==-1&&r==-1){
break;
} else if(m==-1||f==-1){
System.out.println("F");
    }else{

        int g=m+f;
             if(g>=80){
                System.out.println("A");
            }else if(g>=65){
                System.out.println("B");
            }else if(g>=50){
                System.out.println("C");
            }else if(g>=30&&r<50){
                System.out.println("D");
            }else if(g>=30&&r>=50){
                System.out.println("C");
        }else if(g<30){
                System.out.println("F");
        }
    }

}    sc.close();
        }

}



Measured memory_bytes: 26184
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
int main(){
	int n,p,k;
	cin>>n;
	while(n--){
		cin>>k>>p;
		int ans=k%p;
		if(ans==0)ans=p;
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define lol long long
#define pb push_back
//#define mp make_pair
#define fr first
#define sc second
#define MAX ((lol)(1e17+100))
#define MX ((lol)(4e9+100))
#define ARRS ((lol)(1e6+100))
#define ARS ((lol)(1e3+100))
#define MOD ((lol)(1e9+9))
#define EP ((double)(1e-9))
#define EPS ((double)(1e-8))
#define pb push_back
#define PI ((double)3.141592653)
#define LG 21

ll n,m;
ll pas=0,k,p;
ll a[ARRS];
map<ll,ll> mp;
int main(){
	cin>>n;
	ll p=0;
	mp[0]=1;
	for(int i=0; i<n; i++){
		cin>>k;
		p+=k;
		pas+=mp[p];
		mp[p]++;
	}
	cout<<pas;

}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    set<string> s;
    for(int i=0;i<n;i++){
        string a;
        cin>>a;
        s.insert(a);
    }
    cout<<s.size()<<endl;
}

Measured memory_bytes: 19200
// AOJ ALDS1_3_B Queue
// 2018.4.30 bal4u

#include <stdio.h>

#define MAX_N 100002

typedef struct { char *p; int tm; } Q;
Q que[(MAX_N<<1)+2]; int top, end;
char name[MAX_N][20];

char buf[20], *p;
int in()
{
	int n = 0;
	while (*p >= '0') n = 10*n + (*p++ & 0xf);
	p++;
	return n;
}

int main()
{
	int  n, q, tm, i;
	Q  t;

	fgets(p=buf, 20, stdin);
	n = in(), q = in();
	for (i = 0; i < n; i++) {
		fgets(p=name[i], 20, stdin);
		while (*p > ' ') p++; *p++ = 0;
		que[i].p = name[i], que[i].tm = in();
	}

	tm = 0, top = 0, end = n;
	while (top != end) {
		t = que[top]; if (++top == MAX_N) top = 0;
		if (t.tm <= q) {
			printf("%s %d\n", t.p, tm+t.tm);
			tm += t.tm;
		} else {
			t.tm -= q;
			que[end] = t; if (++end == MAX_N) end = 0;
			tm += q;
		}
	}
	return 0;
}



Measured memory_bytes: 4224
#include <stdio.h>
int main(void){
    int a;
    int b;
    scanf("%d %d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }else if(a>b){
        printf("a > b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}


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

using namespace std;

#define INF 9999999

int main() {

	int n, an;
	vector<int> vec;
	int ans = INF;

	while (1) {

		cin >> n;
		if (n == 0) break;
		//??\???
		for (int i = 0; i < n; i++) {
			cin >> an;
			vec.push_back(an);
		}
		//?????????
		sort(vec.begin(), vec.end());
		//??????????°?????¨????
		for (int i = 0; i < n - 1; i++) {
			if (vec[i + 1] - vec[i] < ans) {
				ans = vec[i + 1] - vec[i];
			}
			if (ans == 0) break; //????°?????????¢?´¢????????¢???
		}
		//??????
		cout << ans << endl;
		//?????????
		vec.clear();
		ans = INF;
	}
	return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  rep(i,m) {
    int a;
    cin >> a;
    n -= a;
  }

  if (n >= 0) {
    cout << n << endl;
  } else {
    cout << -1 << endl;
  }

}


Measured memory_bytes: 3636
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::{BufWriter, Write};

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    input!(
        n: usize,
        s: chars,
        t: chars,
    );


    for i in 0..n {
        print!("{}", s[i]);
        print!("{}", t[i]);
    }
    println!("");
}

fn main() {
    let stack_size = 1 << 28;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

Measured memory_bytes: 8572
package main

import "fmt"

func main(){
	var N int
	var a, b, c int
	fmt.Scan(&N)

	tmp := N / 100
	a = tmp % 10

	tmp = N / 10
	b = tmp % 10

	c = N % 10
	
	// fmt.Println(a, b, c);
	if a == 7 || b == 7 || c == 7 {
		fmt.Println("Yes");
	}else{
		fmt.Println("No");
	}
}

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

int main() {
    int N;
    int a[110];  // 最大 100 個ですが余裕をもたせます
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> a[i];

    sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート
    int Alice = 0;
    int Bob = 0;
    for (int i = 0; i < N; ++i) {
        if (i % 2 == 0) { // Alice のターン
            Alice += a[i];
        }
        else { // Bob のターン
            Bob += a[i];
        }
    }
    cout << Alice - Bob << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
P dp[1005];
int main(){
  for(int i=0;i<1005;i++) dp[i]=P(-17441744174417,0);
  dp[0]=P(0,0);
  ll n;
  cin>>n;
  vector<ll> vec;
  vec.push_back(0);
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    vec.push_back(a);
  }

  dp[1]=P(vec[1],0);
  for(int i=2;i<=n;i++){
    dp[i].first=vec[i];
    dp[i].second=0;
    for(int j=i-2;j>=0;j-=2){
      if(dp[i].first<dp[j].first+vec[i]){
        dp[i].first=dp[j].first+vec[i];
        dp[i].second=j;
      }
    }
  }
  ll pos=n,mv=dp[n].first;
  for(int i=n-1;i>0;i--) {
    if(dp[i].first>mv){
      mv=dp[i].first;
      pos=i;
    }
  }
  stack<ll> kuse;
  while(pos>0){
    kuse.push(pos);
    pos=dp[pos].second;
  }
  vector<ll> use;
  while(!kuse.empty()){
    use.push_back(kuse.top());
    kuse.pop();
  }


  cout<<mv<<endl;
  vector<ll> ans;
  for(int i=n;i>use[use.size()-1];i--) ans.push_back(i);
  for(int i=use.size()-1;i>0;i--){
    ll f1=use[i-1],f2=use[i];
    for(int i=0;i<(f2-f1-1)/2;i++) ans.push_back(f1+2);
    ans.push_back(f1+1);
  }
  for(int i=1;i<use[0];i++) ans.push_back(1);
  cout<<ans.size()<<endl;
  for(int i=0;i<ans.size();i++) cout<<ans[i]<<endl;
}


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

public class Main {
    public static void main(String[] args) throws IOException {
        FastReader scan = new FastReader();
        //PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("taming.out")));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        Task solver = new Task();
        //int t = scan.nextInt();
        int t = 1;
        for(int i = 1; i <= t; i++) solver.solve(i, scan, out);
        out.close();
    }
    static class Task {
        public void solve(int testNumber, FastReader sc, PrintWriter pw) {
        	String str =  sc.nextLine();
        	if(str.matches("(hi)+")){
        		pw.println("Yes");
        	}else
        	{
        		pw.println("No");
        	}
        }

    }
    static class tup implements Comparable<tup>{
        int a, b,c;
        tup(){};
        tup(int a, int b, int c){
            this.a=a;
            this.b=b;
            this.c=c;
        }

        @Override
        public int compareTo( tup o2) {
            return o2.b!=b?Integer.compare(o2.b,b):Integer.compare(o2.a,a);
        }
    }
    static void shuffle(long[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            long temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(new File(s)));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
typedef pair<ll, ll> P;

int main() {
    ll N, X, D;
    cin >> N >> X >> D;

    if (D == 0) {
        if (X == 0) {
            cout << 1 << endl;
        } else {
            cout << N + 1 << endl;
        }
        return 0;
    }

    map<int, vector<P>> mp;
    rep(i, N + 1) { // A1 ～ An のうちi個使うとする
        // i個使って出来る数は i*X + j*Dの形 (l<=j<=r)
        ll s = i * X;
        ll l = (ll) i * (i - 1) / 2; // A1+A2+…+Ai で出来るjの値( 0+1+2+…+(i-1)=i*(i-1)/2 )
        ll r = l + (ll) i * (N - i); // Anから降順にi個取って出来るjの値( (N-i)+(N-i+1)+…(N-1) = 0+1+2+…+(i-1) + i*(N-i) )
        // i*X + l*D ～ i*X + r*D までの異なる整数がつくれる
        s += l * D; // 作れる最小の整数
        r -= l; // 作れる個数 [0, r]
        mp[(s % D + D) % D].emplace_back(s, r); // sのmod D でグループ分け
    }

    ll ans = 0;
    for (auto p: mp) {
        auto a = p.second;
        int m = a.size();
        rep(i, m) a[i].first = (a[i].first - p.first) / D;
        vector<P> ev;
        rep(i, m) {
            ev.emplace_back(a[i].first, 1);
            ev.emplace_back(a[i].first + a[i].second + 1, -1);
        }
        sort(ev.begin(), ev.end());
        ll cnt = 0, pre = -INF;
        for (auto e: ev) {
            ll len = e.first - pre;
            if (cnt) ans += len;
            cnt += e.second;
            pre = e.first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 22144