akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define INF 1e12
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int power(int b,int p)
{
	if(p==0) return 1;
	if(p==1) return b;
	int tmp=power(b,p/2);
	if(p%2) return tmp*tmp*b;
	return tmp*tmp;
}

int gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s; cin>>s;
	int a=0,b=0;
	For(i,0,sz(s)-1)
	{
		if(s[i]=='0') a++;
		else b++;
	}
	cout<<min(a,b)*2<<"\n";
	return 0;
}











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

const double eps = 1e-8;
int x1, y1, x2, y2, x3, y3, x4, y4, r;

double distDbl(double ax, double ay, double bx, double by) {
    return (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
}

int distDbl(int ax, int ay, int bx, int by) {
    return (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
}

double getPerpDistDbl(double ax, double ay, double bx, double by, double cx, double cy) {
    double a, b, res;
    if (ax == bx) {
        res = (cx - ax) * (cx - ax);
    } else {
        a = (by - ay) / (bx - ax);
        b = ay - a * ax;
        res = (a * cx - cy + b) * (a * cx - cy + b) / (1 + a * a);
    }
    return res;
}

double getPerpDistSegDbl(double ax, double ay, double bx, double by, double cx, double cy) {
    double a, b, x, y, res;
    if (ax == bx) {
        y = cy;
        if (min(ay, by) <= y && y <= max(ay,by)) {
            res = (cx - ax) * (cx - ax);
        } else {
            res = min(distDbl(ax,ay,cx,cy), distDbl(bx,by,cx,cy));
        }
    } else {
        a = (by - ay) / (bx - ax);
        b = ay - a * ax;
        x = (cx + a * (cy - b)) / (1 + a * a);
        y = a * x + b;
        if (min(ax, bx) <= x && x <= max(ax,bx) &&
            min(ay, by) <= y && y <= max(ay,by)) {
            res = distDbl(x,y,cx,cy);
        } else {
            res = min(distDbl(ax,ay,cx,cy), distDbl(bx,by,cx,cy));
        }
    }
    return res;
}

bool isA() {
    int c = 0;
    if (0 <= (x2-x1)*(y4-y1)-(y2-y1)*(x4-x1)) ++c;
    if (0 <= (x3-x2)*(y4-y2)-(y3-y2)*(x4-x2)) ++c;
    if (0 <= (x1-x3)*(y4-y3)-(y1-y3)*(x4-x3)) ++c;
    if (c % 3 != 0) return false;
    if (getPerpDistDbl(x1, y1, x2, y2, x4, y4) + eps < r*r) return false;
    if (getPerpDistDbl(x2, y2, x3, y3, x4, y4) + eps < r*r) return false;
    if (getPerpDistDbl(x3, y3, x1, y1, x4, y4) + eps < r*r) return false;
    return true;
}

bool isB() {
    if (distDbl(x1,y1,x4,y4) <= r*r && distDbl(x2,y2,x4,y4) <= r*r && distDbl(x3,y3,x4,y4) <= r*r) {
        return true;
    }
    return false;
}

bool isC() {
    if (getPerpDistSegDbl(x1,y1,x2,y2,x4,y4) <= r*r + eps) return true;
    if (getPerpDistSegDbl(x2,y2,x3,y3,x4,y4) <= r*r + eps) return true;
    if (getPerpDistSegDbl(x3,y3,x1,y1,x4,y4) <= r*r + eps) return true;
    return false;
}

int main() {
    while (cin >> x1 >> y1, (x1 || y1)) {
        cin >> x2 >> y2 >> x3 >> y3 >> x4 >> y4 >> r;
        if (isB()) cout << "b" << endl;
        else if (isA()) cout << "a" << endl;
        else if (isC()) cout << "c" << endl;
        else cout << "d" << endl;
    }
    return 0;
}

Measured memory_bytes: 1156
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
            int a = ab[0], b = ab[1];
            string kq = "";
            for (int i = b - a + 1; i < b + a; i++) kq += i + " ";
            Console.WriteLine(kq);
        }
    }
}

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

const int INF = 1001001001;
int dist[100005][3];

int main()
{
  int n, m;
  cin >> n >> m;
  vector<vector<int>> to(n);
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
  }
  int sv, tv;
  cin >> sv >> tv;
  --sv; --tv;
  rep(i,n)rep(j,3) dist[i][j] = INF;
  queue<P> q;
  q.push(P(sv,0));
  dist[sv][0] = 0;
  while (!q.empty()) {
    int v = q.front().first;
    int l = q.front().second;
    q.pop();
    for (int u : to[v]) {
      int nl = (l+1)%3;
      if (dist[u][nl] != INF) continue;
      dist[u][nl] = dist[v][l]+1;
      q.push(P(u,nl));
    }
  }
  int ans = dist[tv][0];
  if (ans == INF) ans = -1;
  else ans /= 3;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6912
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	string s;
	cin >> s;
	
	int ans = 0;
	for(int i = 0; i < s.size(); ++i) {
		if( s[i] == '+' ) ans++;
		if( s[i] == '-' ) ans--;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
	"unsafe"
)

func main() {
	S := sc.next()
	if S == "AAA" || S == "BBB" {
		no()
	} else {
		yes()
	}
}

var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}

// Pair a
type Pair struct {
	first  int
	second int
}

// Queue a
type Queue struct {
	v []Pair
}

// Push for queue
func (q *Queue) Push(v Pair) {
	q.v = append(q.v, v)
}

// Pop for queue
func (q *Queue) Pop() Pair {
	r := q.v[0]
	q.v = q.v[1:]
	return r
}

// Front for queue
func (q Queue) Front() Pair {
	return q.v[0]
}

// Empty return true if empty
func (q Queue) Empty() bool {
	return len(q.v) == 0
}


Measured memory_bytes: 640
module IntSet = Set.Make (struct
  type t = int
  let compare = compare
end)

let () =
  let n, m = Scanf.scanf "%d %d\n" (fun n m -> n, m) in
  let abs = Array.init m (fun _ -> Scanf.scanf "%d %d\n" (fun a b -> a, b)) in
  let e = Array.make n IntSet.empty in
  Array.iter (fun (a, b) ->
    e.(a - 1) <- IntSet.add (b - 1) e.(a - 1);
    e.(b - 1) <- IntSet.add (a - 1) e.(b - 1)) abs;
  if IntSet.is_empty (IntSet.inter e.(0) e.(n - 1)) then
    print_endline "IMPOSSIBLE"
  else
    print_endline "POSSIBLE"

Measured memory_bytes: 39804
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
string S;
int main() {

	cin>>S;

	int A0,A1,A2,A3;
	int J=0;
	int O=0;
	int I=0;
	int ans=0;
	for(int A0=0;A0<S.size();A0=A3){
		for(A1=A0;S[A1]=='J';A1++);
		for(A2=A1;S[A2]=='O';A2++);
		for(A3=A2;S[A3]=='I';A3++);
		J=A1-A0;
		O=A2-A1;
		I=A3-A2;
		if(J>=O&&O<=I)ans=max(ans,O);
	}

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



Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/
 

// void chmod(ll &M){
//     if(M >= mod) M %= mod;
//     else if(M < 0){
//         M += (abs(M)/mod + 1)*mod;
//         M %= mod;
//     }
// }

const ll mod = 1e9+7;


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
 
    int n; cin >> n;
    vector<int> a(n+1);
    for(int i=1; i<=n; ++i) cin >> a[i];

    int sum = 0;
    vector<int> ans(n+1, 0);
    for(int i=n; i>0; --i){
        int cnt = 0;
        for(int j=2*i; j<=n; j+=i) cnt += ans[j];
        if(cnt%2 == 0 && a[i] == 0) ans[i] = 0;
        if(cnt%2 == 0 && a[i] == 1) ans[i] = 1;
        if(cnt%2 == 1 && a[i] == 0) ans[i] = 1;
        if(cnt%2 == 1 && a[i] == 1) ans[i] = 0;
        if(ans[i]) ++sum; 
    }

    cout << sum << endl;
    bool flg = true;
    if(sum){
        for(int i=1; i<=n; ++i){
            if(ans[i] && flg){
                cout << i;
                flg = false;
            }
            else if(ans[i] && !flg){
                cout << ' ';
                cout << i;
            }

        }
        cout << endl;
    }
    

    return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

// https://atcoder.jp/contests/abc159/tasks/abc159_b
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();


		StringBuffer sb = new StringBuffer(s);
		String rvs = sb.reverse().toString();

		if(!(s.equals(rvs))) {
			System.out.println("No");
			return;
		}

		int n = s.length();

		String s2 = s.substring(0,(n-1)/2);
		StringBuffer sb2 = new StringBuffer(s2);
		String rvs2 = sb2.reverse().toString();
		if(!(s2.equals(rvs2))) {
			System.out.println("No");
			return;
		}

		String s3 = s.substring((n+3)/2-1,n);
		StringBuffer sb3 = new StringBuffer(s3);
		String rvs3 = sb3.reverse().toString();
		if(!(s3.equals(rvs3))) {
			System.out.println("No");
			return;
		}


		System.out.println("Yes");

	}
}


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

//#pragma gcc optimize("O3,unroll-loop")
//#pragma gcc target("sse,sse2,sse3,ssse3,sse4,avx,avx2,fma,abm,mmx,popcnt,tune=native")
//#define int long long
//#define double long double

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

    int a, b;
    cin >> a >> b;
    
    for (int i = 0; i <= a; i++)
        if (i * 2 + (a - i) * 4 == b)
            cout << "Yes\n", exit(0);
    cout << "No\n";

    return 0;
}

//      *   *  *****  *   *  *   *   ****  ****    ****     **    **
//     *   *  *      **  *  *   *  *      *   *  *        * *   * *
//    *****  *****  * * *  *   *  *      ****   *       *  *     *
//   *   *      *  *  **  *   *  *      *  *   *       *****    *
//  *   *  *****  *   *   ***    ****  *   *    ****     *   *****

//      *****  *****  *   *  *      *****  *   *  *****  *****
//        *   *   *  *   *  *        *    **  *    *    *   *
//       *   *   *  *****  *        *    * * *    *    *****
//   *  *   *   *    *    *        *    *  **    *    *
//  ****   *****    *    *****  *****  *   *    *    *


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

#define llint long long int

using namespace std;
vector<int> kmp(string text, string word)
{
    // make table
    vector<int> table(word.length() + 1);

    table[0] = -1;

    for (int i = 0, j = -1; i < word.length(); i++)
    {
        while (j >= 0 && word[i] != word[j])
        {
            j = table[j];
        }
        table[i + 1] = ++j;
    }
    // search word from text
    vector<int> ret;
    int m = 0, i = 0;

    while (m + i < text.length())
    {
        if (word[i] == text[m + i])
        {
            if (++i == (int)(word.size()))
            {
                ret.push_back(m);
                m = m + i - table[i];
                i = table[i];
            }
        }
        else
        {
            m = m + i - table[i];
            if (i > 0)
                i = table[i];
        }
    }
    return ret;
}
int main()
{
    string s, t;

    cin >> s >> t;

    string ss = "";

    for (int i = 0; i < 5 * (t.length() / s.length() + 1); i++)
    {
        ss += s;
    }

    vector<int> hits = kmp(ss, t);
    vector<bool> hit(ss.length(), false);

    for (int i : hits)
    {
        hit[i] = true;
    }
    int ans = 0;

    for (int i = 0; i < ss.length(); i++)
    {
        int j = 0;

        for (; i + j * t.length() < ss.length(); j++)
        {
            if (hit[i + j * t.length()] == false)
            {
                break;
            }
            hit[i + j * t.length()] = false;
        }
        if (j > ans)
        {
            ans = j;
        }
    }
    if (s.length() > t.length())
    {
        if (ans >= 3 * s.length() / t.length())
        {
            ans = -1;
        }
    }
    else
    {
        if (ans >= 4)
        {
            ans = -1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 53276
#include <iostream>
#include <algorithm>

using namespace std;

const int MAX_N = 210;
const int MAX_R = 1010;
const int INF = 100000;
int N, M, R;
int dS[MAX_N][MAX_N];  // 海路
int dL[MAX_N][MAX_N];  // 陸路
// dp[i][j] := 船がjの場所にあって，z[0], z[1], ..., z[i]までの経過時間
int dp[MAX_R][MAX_N];
int z[MAX_R];

void warshall_floyd(int d[MAX_N][MAX_N])
{
    for (int k = 0; k < N; k++)
        for (int i = 0; i < N; i++)
            for (int j = 0; j < N; j++)
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}

int main()
{
    while (cin >> N >> M, N || M) {
        // dL,dSの初期化
        for (int i = 0; i < N; i++)
            for (int j = 0; j < N; j++) {
                dp[i][j] = INF;
                if (i == j)
                    dL[i][j] = dS[i][j] = 0;
                else
                    dL[i][j] = dS[i][j] = INF;
            }

        // Input
        for (int i = 0; i < M; i++) {
            int x, y, t;
            char c;

            cin >> x >> y >> t >> c;
            x--, y--;

            if (c == 'S' && dS[x][y] > t) // 海路
                dS[x][y] = dS[y][x] = t;
            else if (c == 'L' && dL[x][y] > t) // 陸路
                dL[x][y] = dL[y][x] = t;
        }

        cin >> R;
        for (int i = 0; i < R; i++) {
            cin >> z[i];
            z[i]--;
        }

        // Warshall-Floyd
        warshall_floyd(dL);
        warshall_floyd(dS);

        // dpの初期化
        for (int i = 0; i < R; i++)
            for (int j = 0; j < N; j++)
                dp[i][j] = INF;

        dp[0][z[0]] = 0;
        for (int i = 0; i < R - 1; i++) {
            for (int j = 0; j < N; j++) {
                int from = z[i], to = z[i + 1];

                // とりえない状態
                if (dp[i][j] == INF)
                    continue;

                // 陸路のみを使う場合
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + dL[from][to]);

                // 陸路+海路を使う場合
                for (int k = 0; k < N; k++)
                    dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + dL[from][j] +
                                       dS[j][k] + dL[k][to]);
            }
        }

        int ans = INF;
        for (int i = 0; i < N; i++)
            ans = min(ans, dp[R - 1][i]);
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 2324
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<ll>>;
using P = pair<int,int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define MOD 1000000007
#define INF 1000000
#define PI 3.14159265358979323846264338327950L
#define MAX_N 200010
#define lb lower_bound //[2,4)=lb(4)-lb(2)

int main()
{
  string s;cin>>s;
  reverse(s.begin(), s.end());
  int n = s.size();
  map<ll,ll> m;
  
  ll now = s[0]-'0';
  ll p=1;
  m[now]++;
  m[0]++;
  for (int i=1;i<n;i++)
  {
    p *= 10;
    p %= 2019;
    now += (s[i]-'0')*p;
    now %= 2019;
    m[now]++;
  }
  
  ll ans=0;
  for (auto i=m.begin();i!=m.end();i++){
    ans += (i->second)*(i->second-1)/2;//二つ選ぶ組み合わせ
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define inf 1000000000
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#define meM(y,a) memset(y,a,sizeof y)
#define sC(a) scanf("%d",&a)
#define alL(a) a.begin(),a.end()
#define prinT(a,sz)  cout<<a[0];for(int i=1;i<sz;i++)cout<<" "<<a[i];cout<<endl
#define ranD srand(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int>pi;
typedef pair<ll,ll>pll;
//int fx[]={0,0,1,-1};
//int fy[]={1,-1,0,0};
//int gx[]={0,0,1,1,1,-1,-1,-1};
//int gy[]={1,-1,0,1,-1,0,1,-1};
const int N=100010;
int vis[N],low[N],dis[N];
int bd=0;
vector<int>adj[N];
int t=0;
void dfs(int node,int par)
{
//    cout<<node<<" vis "<<par<<endl;
    low[node]=dis[node]=++t;
    for(int i=0;i<adj[node].size();i++)
    {
        int chi=adj[node][i];
        if(chi==par)continue;
        if(dis[chi]==0){
            dfs(chi,node);
            low[node]=min(low[node],low[chi]);
        }
        else low[node]=min(low[node],dis[chi]);
        if(dis[node]<low[chi]){
            bd++;
//            cout<<node<<" here "<<chi<<endl;
        }
    }
}
int main()
{
    IOS;
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int u,v;
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    dfs(1,-1);
    cout<<bd<<endl;
}
/*
7 7
1 3
3 4
4 5
4 6
5 6
6 7
2 7

*/







Measured memory_bytes: 5924
def main():
    #n = int(input())
    #x = list(map( int, input().split()))
    x,y = map( int, input().split())
    turuka = (4*x-y)/2
    if turuka > x:
        print("No")
    elif turuka % 1 == 0 and turuka >= 0:
        print("Yes")
    else:
        print("No") 
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 9244
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ARC85_D
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            long h = long.Parse(s[1]);
            long amax = 0;
            long bsum = 0;
            var b = new long[n];
            long count = n;
            for (int i = 0; i < n; i++)
            {
                var p = Console.ReadLine().Split(' ');
                amax = Math.Max(amax, long.Parse(p[0]));
                b[i] = long.Parse(p[1]);
                bsum += b[i];
            }
            Array.Sort(b);
            bsum = 0;
            count = 0;
            for (int i = 0; i < n; i++)
            {
                if (b[n - i - 1] > amax)
                {
                    bsum += b[n - i - 1];
                    count++;
                }
                else
                {
                    break;
                }
                if (bsum >= h)
                {
                    Console.WriteLine(i + 1);
                    return;
                }
            }

            Console.WriteLine((h - bsum) % amax == 0 ? (h - bsum) / amax + count : (h - bsum) / amax + count + 1);
        }
    }
}


Measured memory_bytes: 15948
# -*- coding: utf-8 -*-

def assignColor(G):
    n = len(G)
    C = [-1 for i in range(n)]
    for i in range(n):
        if C[i] == -1:
            C = BFS(G, i, C)
    return C

#@profile
def BFS(G, start, C):
    n = len(G)
    Q = []

    Q.append(start)
    C[start] = start

    while len(Q) != 0:
        u = Q.pop(0)
        v = [i for i in G[u] if C[i] == -1] # v := ??£??\???????????????????????¢?´¢??????????????????
        
        for i in v:
            Q.append(i)
            C[i] = C[start]
    
    return C

def main():
    
    n, m = list(map(int, input().split()))
    G = [[] for i in range(n)]

    for i in range(m):
        s, t = list(map(int, input().split()))
        G[s].append(t)
        G[t].append(s)

    C = assignColor(G)
        
    q = int(input())
    
    for i in range(q):
        s, t = list(map(int, input().split()))
        if C[s] == C[t]:
            print("yes")
        else:
            print("no")
            
if __name__ == "__main__":
    main()    

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

int main(){
  ll a,b,v,w,t;
  cin >> a >> v >> b >> w >> t;
  ll a_len, b_len;
  if(a<b){
    a_len=v*t+a;
  	b_len=w*t+b;
  	if(b_len-a_len>0){
    	cout << "NO" << endl;
  	}
  	else{
    	cout << "YES" << endl;
  	}
  }
  else if(a>b){
    a_len=-v*t+a;
    b_len=-w*t+b;
    if(a_len-b_len>0){
      cout << "NO" << endl;
  	}
  	else{
    	cout << "YES" << endl;
  	}
  }
  return 0;
}

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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s,t,ret;
	cin >> s >> t;
	int N=s.size(),M=t.size();
	vector<vector<int>> cnt(N,vector<int>(M));
	for (int i=0; i<N; ++i){
		for (int j=0; j<M; ++j){
			if (s[i] == t[j] and (i == 0 or j == 0)) cnt[i][j] = 1;
			else if (s[i] == t[j]) cnt[i][j] = cnt[i-1][j-1]+1;
			else{
				if (j > 0) cnt[i][j] = max(cnt[i][j],cnt[i][j-1]);
				if (i > 0) cnt[i][j] = max(cnt[i][j],cnt[i-1][j]);
			}
		}
	}
	int x=N-1,y=M-1;
	while (x >= 0 and y >= 0){
		if (s[x] == t[y]){
			ret += s[x];
			x--; y--;
		}
		else if (x == 0) y--;
		else if (y == 0) x--;
		else if (cnt[x-1][y] > cnt[x][y-1]) x--;
		else y--;
	}
	reverse(ret.begin(),ret.end());
	cout << ret;
	return 0;
}

Measured memory_bytes: 35584
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

static constexpr int mod = (int)1e9 + 7;
static constexpr int inf = 100100100;
static constexpr ll linf = 1e18;
static constexpr double eps = 1e-9;
static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, a) for (ll i = a; i >= 0; --i)
#define all(obj) begin(obj), end(obj)
#define rall(obj) rbegin(obj), rend(obj)
#define pb push_back
#define fst first
#define snd second


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll N;
    cin >> N;
    --N;
    vector<tuple<ll, ll, ll>> v;
    rep (i, N) {
        ll c, s, f;
        cin >> c >> s >> f;
        v.pb({c, s, f});
    }
    rep (i, N) {
        ll ans = 0;
        for (ll j = i; j < N; ++j) {
            ll c, s, f;
            tie(c, s, f) = v[j];
            if (ans <= s) {
                ans = s;
            }
            if (ans % f != 0) {
                ans += (f * (ans / f + (ans % f != 0))) - ans;
            }
            ans += c;
        }
        cout << ans << endl;
    }
    cout << 0 << endl;
}



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


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


int main() {
  ll h, w,s1, s2, g1, g2;
  vector<ll> dh={-1,0,1,0};
  vector<ll> dw={0,-1,0, 1};

  cin >> h >> w>>s1>>s2>>g1>>g2;
  s1--;s2--;g1--;g2--;
  vector<string> s(h);
  rep(i,h)cin>>s[i];
  vector<vector<ll>> v(h, vector<ll>(w,INF));
  deque<P> q;
  q.push_front(make_pair(s1,s2));
  v[s1][s2]=0;
  while(!q.empty()){
//    P pnow=q.front();
   ll hnow=q.front().first;
    ll wnow=q.front().second;
    q.pop_front();
    ll d=v[hnow][wnow];
    rep(i,4){
      ll hn=hnow+dh[i];
      ll wn=wnow+dw[i];
      if (hn<0|hn>=h|wn<0|wn>=w)continue;
      if (v[hn][wn]<=d)continue;

      if (s[hn][wn]=='#')continue;

      v[hn][wn]=d;
      q.push_front(make_pair(hn,wn));

    }
    for(ll i=-2;i<=2;i++)for(ll j=-2;j<=2;j++){
      ll hn=hnow+i;
      ll wn=wnow+j;
      if (hn<0|hn>=h|wn<0|wn>=w)continue;

      if (v[hn][wn]<=d+1)continue;
      if (s[hn][wn]=='#')continue;

      v[hn][wn]=d+1;
      q.push_back(make_pair(hn,wn));
    }

  }
  if (v[g1][g2]==INF)cout<<-1;
  else cout<<v[g1][g2];

}


Measured memory_bytes: 13524
n = gets.to_i
intervals = []
(n - 1).times do
  intervals << gets.split.map(&:to_i)
end

(n - 1).times do |start|
  time = 0
  intervals[start..n - 1].each do |interval|
    time = [time, interval[1]].max
    mod = time % interval[2]
    time += interval[2] - mod if mod != 0
    time += interval[0]
  end
  puts time
end
puts 0


Measured memory_bytes: 1788
N = int(input())
S = input()
maxi = 0
for i in range(1,N):
  a = S[0:i]
  b = S[i:]
  aa = set(a)
  bb = set(b)
  ans = bb&aa
  if len(ans) > maxi:
    maxi = len(ans)
print(maxi)

Measured memory_bytes: 9040
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long t = sc.nextLong();
        long s = sc.nextLong();
        if(t * s < n)
            System.out.println("No");
        else
            System.out.println("Yes");
    }
}

Measured memory_bytes: 35652
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

// Lost Number
// 2012/10/09
public class Main{
	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-12;

	final char[] op={'0', '1', '+', '-', '*', '(', ')'};
	String s;
	char[] cs;
	int max;

	void run(){
		s=sc.nextLine();
		solve();
	}

	void solve(){
		s+="$";
		cs=s.toCharArray();
		max=-1;
		dfs(0);
		println(max+"");
	}

	void dfs(int i){
		if(i==cs.length){
			max=max(max, calc());
			return;
		}
		if(cs[i]=='.'){
			for(char c : op){
				cs[i]=c;
				dfs(i+1);
				cs[i]='.';
			}
		}else{
			dfs(i+1);
		}
	}

	int calc(){
		Result r=E(0);
		r.good&=r.p==cs.length-1;
		if(r.good){
			for(int i=0; i<cs.length; i++){
				if(cs[i]!='('){
					continue;
				}
				int stack=0;
				boolean op=false;
				for(int j=i+1; cs[j]!=')'||stack!=0; j++){
					if(cs[j]=='('){
						stack++;
					}else if(cs[j]==')'){
						stack--;
					}
					if(stack==0){
						op|=cs[j]=='+'||cs[j]=='-'||cs[j]=='*';
					}
				}
				r.good&=op;
			}
		}
		return r.good?r.value:-1;
	}

	Result E(int p){
		Result r=F(p);
		if(!r.good){
			return r;
		}
		for(; cs[r.p]=='+'||cs[r.p]=='-';){
			Result r2=F(r.p+1);
			if(!r2.good){
				return r2;
			}
			if(cs[r.p]=='+'){
				r.value+=r2.value;
			}else{
				r.value-=r2.value;
			}
			if(!r.update()){
				return r;
			}
			r.p=r2.p;
		}
		return r;
	}

	Result F(int p){
		Result r=T(p);
		if(!r.good){
			return r;
		}
		for(; cs[r.p]=='*';){
			Result r2=T(r.p+1);
			if(!r2.good){
				return r2;
			}
			r.value*=r2.value;
			if(!r.update()){
				return r;
			}
			r.p=r2.p;
		}
		return r;
	}

	Result T(int p){
		if(cs[p]=='('){
			Result r=E(p+1);
			if(!r.good||cs[r.p]!=')'){
				r.good=false;
				return r;
			}
			r.p++;
			return r;
		}else if(cs[p]=='0'||cs[p]=='1'){
			Result r=new Result(p, 0);
			for(; Character.isDigit(cs[r.p]); r.p++){
				r.value=r.value*2+cs[r.p]-'0';
				r.update();
			}
			return r;
		}else{
			return new Result(0, -1);
		}
	}

	class Result{
		int p, value;
		boolean good;

		Result(int p, int value){
			this.p=p;
			this.value=value;
			good=true;
			update();
		}

		boolean update(){
			return good&=0<=value&&value<1024;
		}
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    int s, w;
    cin >> s >> w;
    if(s <= w) {
        cout << "unsafe" << endl;
    } else {
        cout << "safe" << endl;
    }
    return 0;
}
/** atcoder **/


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define int long long
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int lcm(int a,int b){return a/__gcd(a,b)*b;}
main(){
  int n,x,ans=1;
  cin>>n>>ans;
  r(i,n-1){
    cin>>x;
    ans=lcm(ans,x);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
from operator import itemgetter

N=int(input())
XL=[list(map(int,input().split())) for _ in range(N)]

for xl in XL:
    xl.append(xl[0]+xl[1])

XL.sort(key=itemgetter(2))
#print(XL)
count=0
j=0

for i in range(1,N):
    if XL[j][2]>XL[i][0]-XL[i][1]:
        count+=1
    else:
        j=i

print(N-count)


Measured memory_bytes: 32296
#include<bits/stdc++.h>
#define S second
#define F first
#define ll long long
using namespace std;
int x[300009];
main(){
    int n,a,b;
    cin >>n >> a >> b;
    if(!((ll)a*(ll)b >= (ll)n && a+b-1 <=n)){
        cout <<-1<<endl;
        return 0;
    }
    int S = n - a;
    for (int i = 0; i < a; i++){
        x[i] = 1+ min(S,b-1);
        S -= min(S,b-1);
    }
    int s = 0;
    for (int i = 0; i < a; i++)
       {
        for (int j =s + x[i]; j >s; j--)
        cout <<j <<" ";
        s+=x[i];}
    cout<<endl;
}
//


Measured memory_bytes: 2944
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

#define rep(i,a,n) for(ll i = a;i < n;i++)

signed main(){
    ll n,s[1000] = {},p[1000] = {},q[1000] = {},r[1000] = {},cal_memo;
    ll P,Q,R,C;
    bool flag = false;
    
    
    while(1){
        flag = false;
        cin >> n;
        if(!n) break;
        
        
        rep(i,0,n){
            cin >> s[i] >> p[i] >> q[i] >> r[i];
        }
        
        cin >> P >> Q >> R >> C;
        
        rep(i,0,n){
            cal_memo = 4 * p[i] + 9 * q[i] + 4 * r[i];
            
            if(cal_memo <=  C && p[i] <=  P && q[i] <= Q && r[i] <= R){
                cout << s[i] << endl;
                flag = true;
            }
        }
        
        if(!flag) cout << "NA" << endl;
        
        
        
    }
    
    
    return 0;
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
#define sz(a) int(a.size())

int main(){
	string s; cin>>s;
	const int n = s.size();
	int ans = 1e9 + 7;
	for(int i = 0; i <= n - 3; i++){
		string tmp = s.substr(i, 3);
		//cout<<tmp<< " ";
		int t = stoi(tmp);
		ans = min(ans, abs(t - 753));
	}
	cout<<endl<<ans<<endl;
}


Measured memory_bytes: 256
import itertools

N = int(input())
S = input()

r = 0
g = 0
b = 0

RGBs = list(itertools.permutations(['R', 'G', 'B'], 3))
for s in S:
  if s == 'R': r += 1
  if s == 'G': g += 1
  if s == 'B': b += 1
out = r * g * b
for i in range(1, N):
  for j in range(N-i*2):
    if (S[j], S[j+i], S[j+i*2]) in RGBs:
      out -= 1
print(out)


Measured memory_bytes: 9232
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t n;
  cin >> n;
  int64_t m=26;
  if(n==1){
    cout << 'a' << endl;
    return 0;
  }
  int a=12; 
  vector<char>x(a);
  for (int i=0;i<a;i++) {
    if(n==0){
      break;
    }
    if(n%m!=0){
    x.at(i)=n%m+96;
    n=(n-n%m)/m;
    }
    else{
    x.at(i)=n%m+96;
    n=(n-26)/m;  
    }
   
  }
  for(int i=0;i<a;i++){
    if(x.at(a-i-1)=='`'){
      x.at(a-i-1)='z';
    }
    if(x.at(a-i-1)!=0){
    cout << x.at(a-i-1);
    }  
  }  
}

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

int main() {
	int n; cin>>n;
	bool four = false;
	for (int i=0; i<n; i++) {
		string s; cin>>s;
		if (s == "Y") {
			four = true;
			cout << "Four" << endl;
			break;
		}
	}
	if (!four)
		cout << "Three" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<double> vec(N);
    for(int i=0; i<N; i++){
        cin >> vec.at(i);
    }
    double S=0;
    for(int i=0; i<N; i++){
        S += 1 / vec.at(i);
    }
    cout << 1 / S << endl;
}

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

int main(){
    char i[10];
    int len;
    int a,b,c = 0;

    scanf("%s" ,i);

    len = strlen(i);

    for(a = 0; a < len; a++){
        if(i[a]=='A'|| i[a]=='C' || i[a]=='G' || i[a]=='T'){
            b++;
        }
        else{
             if(b > c){
                 c = b;
            }
            b = 0;
        }
    } 

    if(b > c){
        c = b;
    }  
    printf("%d\n", c);
    return 0;  
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int double
const int INF = 1LL << 60;

struct edge{ int to,cost; };
vector<int> dikstra(int s,vector<vector<edge>> G){
  typedef pair<int, int> P;
  const int INF = 1LL << 60;

  priority_queue<P,vector<P>,greater<P>> que;
  vector<int> d(G.size(),INF); //sからの最短距離
  d[s] = 0;
  que.push({0,s}); //{最短距離,頂点}

  while( !que.empty() ){
    P p = que.top(); que.pop();
    int v = p.second;
    if(d[v] < p.first) continue;
    for(auto e : G[v]){
      if(d[e.to] > d[v] + e.cost){
        d[e.to] = d[v] + e.cost;
        que.push( {d[e.to],e.to} );
      }
    }
  }
  return d;
}

signed main(){

  int n, a, b, c, d; cin >> a >> b >> c >> d >> n;

  vector<int> x(n), y(n), r(n);
  map<pair<int, int>, int> mp;
  for(int i = 0; i < n; i++){
    cin >> x[i] >> y[i] >> r[i];
    mp[{x[i], y[i]}] = i;
  }
  mp[{a, b}] = n;
  mp[{c, d}] = n+1;

  vector<vector<edge>> G(n+2);
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      int dist = max((double)0, sqrt( (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) ) - r[i] - r[j]);
      G[mp[{x[i], y[i]}]].push_back({mp[{x[j], y[j]}], dist});
      G[mp[{x[j], y[j]}]].push_back({mp[{x[i], y[i]}], dist});
    }
  }
  for(int i = 0; i < n; i++){
    int dist = max((double)0, sqrt( (x[i] - a) * (x[i] - a) + (y[i] - b) * (y[i] - b) ) - r[i]);
    G[mp[{x[i], y[i]}]].push_back({mp[{a, b}], dist});
    G[mp[{a, b}]].push_back({mp[{x[i], y[i]}], dist});
    dist = max((double)0, sqrt( (x[i] - c) * (x[i] - c) + (y[i] - d) * (y[i] - d) ) - r[i]);
    G[mp[{x[i], y[i]}]].push_back({mp[{c, d}], dist});
    G[mp[{c, d}]].push_back({mp[{x[i], y[i]}], dist});
  }
  int dist = sqrt( (a - c) * (a - c) + (b - d) * (b - d) );
  G[mp[{a, b}]].push_back({mp[{c, d}], dist});
  G[mp[{c, d}]].push_back({mp[{a, b}], dist});

  auto dp = dikstra(mp[{a, b}], G);
  printf("%.10f\n", dp[mp[{c, d}]]);

  return 0;
}


Measured memory_bytes: 70128
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
	int X, A;

	cin >> X >> A;

	if (X < A)
	{
		cout << "0" << endl;
	}
	else
	{
		cout << "10" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var counts = new int[N + 1];
            for (var x = 1; x * x <= N; x++)
            {
                for (var y = 1; y * y <= N; y++)
                {
                    for (var z = 1; z * z <= N; z++)
                    {
                        var tmp = x * x + y * y + z * z + x * y + y * z + z * x;
                        if (tmp > N) continue;
                        counts[tmp]++;
                    }
                }
            }

            for (var n = 1; n <= N; n++)
            {
                Console.WriteLine(counts[n]);
            }
        }
    }
}


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

using namespace std;

typedef long long ll;

  int main() {
  int n, m, sum=0, ai, b =0;
  cin >> n >> m;
  vector<ll> v;

  for( int i =  0; i < n; i++) {
    cin >> ai;
    sum += ai;
    v.push_back(ai);
  }
  sort(v.begin(),v.end(),greater<int>());
  for(int i =  0; i < m; i++){
    if(v[i] < sum/4.0/m ){
      b = 1;
    }
  }
  if(b == 0){
    cout << "Yes" << endl;
}
  if(b == 1){
    cout << "No" << endl;
}
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end(),greater<int>())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000000000000003 //1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

struct edge{ll to;};
struct graph{
  ll N; //ノードの個数
  vector<vector<edge> > G;
  vector<ll> depth;

  graph(ll n){
    N = n;
    G.resize(N);
    depth.resize(N);
    rep(i,N){depth[i] = -1;}
  }
  void add_edge(ll s, ll t){
    G[s].emplace_back((edge){t});
  }

  int bfs(ll s, ll g) {
    deque<ll> dq; //探索予定地 必要ならpairにしてどこから来たのか記録
    dq.push_back(s); // 始点を探索予定地に
    depth[s]=0; // 始点の深さを0に
    while(!dq.empty()) {
      ll v = dq.front();// vは行く元
      dq.pop_front();
      for(auto E : G[v]){ // E つなぐエッジ
        if(depth[E.to]==-1) { // まだ行ってないなら
          depth[E.to]=depth[v]+1;
          dq.emplace_back(E.to);
        }
      }
    }
    return depth[g];
  }
};


void Main(){

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

  graph g(N);

  rep(i,M){
    int a,b;
    cin>>a>>b;
    g.add_edge(a-1,b-1);
    g.add_edge(b-1,a-1);
  }

  cout<< ( g.bfs(0,N-1)==2 ? "POSSIBLE" : "IMPOSSIBLE" )<<"\n";

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(0);
  Main();
}
//-----------------------------------


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

using namespace std;

int main(){
    long long num;
    cin >> num;
    long long base = num/11;
    long long place = num%11;
    if(place==0){
        cout << base*2;
    }
    else if(place<=6){
        cout << base*2+1;
    }
    else{
        cout << base*2+2;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	class Pair{
		int h;
		int w;
		Pair(int h, int w){
			this.h=h;
			this.w=w;
		}
	}
	public void run() {
		Scanner sc = new Scanner(System.in);
		int H=sc.nextInt();
		int W=sc.nextInt();
		int D=sc.nextInt();
		int a[][] = new int[H][W];
		Map<Integer, Pair> m = new HashMap<>();
		for(int i=0; i<H; i++) {
			for(int j=0; j<W; j++) {
				int v=sc.nextInt();
				v--;
				a[i][j]=v;
				m.put(v, new Pair(i,j));
			}
		}
		int sum[] = new int[H*W+1];
		for(int i=0; i<H*W; i++) {
			if(i<D) {
				sum[i+1] = 0;
			}else {
				Pair p1 = m.get(i-D);
				Pair p2 = m.get(i);
				sum[i+1] = sum[i-D+1] + Math.abs(p1.h-p2.h)+Math.abs(p1.w-p2.w);
			}

		}

		int Q = sc.nextInt();
		for(int i=0; i<Q; i++) {
			int l = sc.nextInt();
			int r =sc.nextInt();
			int ans = sum[r]-sum[l];
			System.out.println(ans);
		}
		sc.close();
	}

}


Measured memory_bytes: 107424
#include <stdio.h>
#include <string.h>
int main(){
  char s[10],t[10],u[10];
  int a,b;
  
  scanf("%s %s",s,t);
  scanf("%d %d",&a,&b);
  scanf("%s",&u);
  
  if( strcmp(s,u)==0 ){
    a--;
  } else if( strcmp(t,u)==0 ){
    b--;
  }
  
  printf("%d %d",a,b);
}
  

Measured memory_bytes: 128
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

int n, w[100], s = 0;
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", w + i), s += w[i];
	int cur = 0, dif = s;
	for (int i = 0; i < n; i++)
		cur += w[i], s -= w[i], dif = min(dif, abs(s - cur));
	printf("%d\n", dif);
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
int main() {

	std::vector<int> ant(5);
	int k;

	for (int i = 0; i < 5; i++) std::cin >> ant[i];

	std::cin >> k;

	if (ant[4] - ant[0] > k) std::cout << ":(" << std::endl;
	else std::cout << "Yay!" << std::endl;

	return 0;
}

Measured memory_bytes: 256
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 10 ** 9 + 7
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rf(): return float(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
def rf_(): return [float(_) for _ in rs().split()]
def divisors(n, sortedresult=True):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i != n // i:
                div.append(n//i)
    if sortedresult:
        div.sort()
    return div
# endregion
A, P = ri_()
print((P + 3 * A) // 2)

Measured memory_bytes: 63596
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N = in.next().toInt

  val ans = Array.fill[List[Int]](N+1)(List[Int]())
  var cnt = 0
  if(N % 2 == 0) {
    for (i <- 1 to N) {
      for (k <- i+1 to N) {
        if (k != N+1 - i){
          ans(i) = k :: ans(i)
          cnt += 1
        }
      }
    }
  }
  else {
    for (i <- 1 to N-1) {
      for (k <- i+1 to N) {
        if (k != N - i) {
          ans(i) = k :: ans(i)
          cnt += 1
        }
      }
    }
  }

  pw.println(cnt)
  for (i <- 1 to N) {
    for (e <- ans(i)) {
      pw.println(s"$i $e")
    }
  }
  pw.flush()
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}



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

using namespace std;

int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   long long a, b, c, d;
   cin >> a >> b >> c >> d;
   long long ans = max({a * c, a * d, b * c, b * d});
   cout << ans << endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
 
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b,a%b);
}
 
int main() {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    
    ll divide = 0;
    
    if (A % C == 0) {
        divide += B/C - A/C + 1;
    } else {
        divide += B/C - A/C;
    }
    
    if (A % D == 0) {
        divide += B/D - A/D + 1;
    } else {
        divide += B/D - A/D;
    }
    
    //あとはダブって引いてるとこ考える
    ll GCD = gcd(C, D);
    ll LCM = C / GCD * D;
    
    if (A % LCM == 0) {
        divide -= B/LCM - A/LCM + 1;
    } else {
        divide -= B/LCM - A/LCM;
    }
    
    ll ans;
    
    ans = B - A + 1 - divide;
    
    cout << ans << endl;
    
}

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

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define w(t) int t;cin>>t;while(t--)
#define mod 1000000007



int main(){
	
		fast
		ll a,b,c,d;
		cin>>a>>b>>c>>d;
		cout<<max(max(a*c,a*d),max(b*c,b*d));


	return 0;
}





Measured memory_bytes: 3648