akhauriyash/Code-Regression huggingface dataset:
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const long long MOD = 1000000000 + 7;//1000000000 + 7 998244353 924844033 1000000000 + 9;
constexpr long long INF = 1LL << 60;//numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<Edge>>g;
vector<edge>ed;
vector<Pll>pv;
set<LL>st;
map<Pll, LL>ma;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
string str, ss;
bool f;
LL n, m, s, t, h, w, k, q, p, ans, sum, cnt, a[210000], b[210000];
Pll pos[210000];
int main() {
	cin >> n;
	rep(i, n) {
		cin >> pos[i].fir >> pos[i].sec;
		if (i)
			if ((pos[i].fir + pos[i].sec+10000000000) % 2 != (pos[i - 1].fir + pos[i - 1].sec + 10000000000) % 2)
				f = 1;
	}

	if (f) {
		cout << -1 << endl;
		return 0;
	}
	vector<LL>v;
	if ((pos[0].fir + pos[0].sec) % 2==0) {
		v.push_back(1);
	}
	rep(i, 37) {
		if ((1LL << i) < 100000000000000)
			v.push_back((1LL << i));
	}
	sort(v.begin(), v.end(), [](LL x, LL y) {return x > y; });
	cout << v.size() << endl;
	rep(i, v.size()) {
		if (i)cout << " ";
		cout << v[i];
	}
	cout << endl;
	rep(i, n) {
		str.clear();
		LL x = pos[i].first + pos[i].second, y = pos[i].first - pos[i].second;
		rep(j, v.size()) {
			if (x >= 0 && y >= 0) {
				str.push_back('R');
				x -= v[j], y -= v[j];
			}
			else if (x >= 0 && y < 0) {
				str.push_back('U');
				x -= v[j], y += v[j];
			}
			else if (x < 0 && y >= 0) {
				str.push_back('D');
				x += v[j], y -= v[j];
			}
			else {
				str.push_back('L');
				x += v[j], y += v[j];
			}
		}
		cout << str << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;
typedef long long ll;

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

int main(){
    int N;
    cin>>N;
    int A[N-1];
    int B[N+1];
    rep(i,N+1)B[i]=0;
    rep(i,N-1)cin>>A[i];
    for(int i=0;i<N-1;i++){
        B[A[i]]++;
    }
    
    rep(i,N)cout<<B[i+1]<<endl;
    return 0;


}

Measured memory_bytes: 5152
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};
 
 
void solve(){
    ll x,y;
    cin>>x>>y;
    if(x==4||x==6||x==9||x==11) x=0;
    else if(x==2) x=1;
    else x=2;
    if(y==4||y==6||y==9||y==11) y=0;
    else if(y==2) y=1;
    else y=2;
    if(x==y) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
} 
 
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
     
    ll Q=1;
    // cin>>Q;
    rep(_,Q){
 
        solve();
 
    }
   
 
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
ll n;
string s;
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	while(n){
		int x=n%26;
		n/=26;
		if(x==0){
			x=25;
			n--;
		}else
		x--;
		s+=x+'a';
	}
	reverse(all(s));
	cout<<s;
	re 0;
}

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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

signed main(){
	// your code goes here
	int N=read(),T=read();
	int sum=0;
	int t[N];
	for(int i=0;i<N;i++){
		t[i] = read();
	}
	for(int i=0;i<N-1;i++){
		int dif = t[i+1] - t[i];
		if(T > dif) sum += dif;
		else{
			sum+=T;
		}
	}
	sum+=T;
	cout << sum;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main(){
  int n, k;
  cin >> n >> k;
  long long int a = n / k;
  long long int b;
  long long int ans = a * a * a;
  if(k % 2 == 0){
    if(n % k >= k / 2){
      b = a + 1;
    }else{
      b = a;
    }
    ans += (b * b * b);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define endl "\n"
#include <map>
#include <numeric>
#include <stack>
#define ll long long int
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n;
    cin >> n;
    int sum=n+n*n+n*n*n;
    cout << sum;

    //1 3 1 5 3 6
    //2 6 5 4 2 4//

	return 0;
}


Measured memory_bytes: 3592
import java.util.*;
     
    class Main {
       public static void main(String[] args)
       {
          Scanner scan = new Scanner(System.in);
     
          int Y500 = scan.nextInt();
          int Y100 = scan.nextInt();
          int Y50  = scan.nextInt();
     
          int N = scan.nextInt();
          int count = 0;
          int S, U, V;
     
     
          for(int i = Y500; i >= 0; i--){
              S = N;
              S = N - (500 * i);
              if(S == 0){
                 count++;
                 }
              if(S != 0){
                 for(int j = Y100; j >= 0; j--){
                     U = S;
                     U = S - j * 100;
                     if(U == 0){
                        count++;
                        }
                     if(U != 0){
                        for(int k = Y50; k >= 0; k--){
                            V = U;
                            V = V - (50 * k);
                            if(V == 0){
                               count++;
                               }
                            }
                        }
                     }
                 }
              }
          System.out.println(count);
       }
    }

Measured memory_bytes: 21972
using System;
using System.Linq;

namespace abc093_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            for (int i = 0; i < x[2]; i++)
            {
                if (x[0] + i <= x[1]) Console.WriteLine(x[0] + i);
            }
            for (int i = x[2] - 1; i >= 0; i--)
            {
                if (x[0] <= x[1] - i && x[0] + x[2] - 1 < x[1] - i) Console.WriteLine(x[1] - i);
            }
        }
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <vector>
#include <cmath>
#include <typeinfo>
#include <set>
#include <bitset>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
using namespace std;
typedef long long ll;



int main(){
  long long x, a, b;
  cin >> x;
  for(int a = -1000; a<1001; a++){
    for(int b=-1000; b<1001; b++){
      if(pow(a,5)-pow(b,5)==x){
        cout << a << " " << b << endl;
        exit(0);
      }
    }
  }

}

Measured memory_bytes: 4100
#include <bits/stdc++.h>
#define fr(x) scanf("%lld", &x)
#define int long long
using namespace std;

string str;

signed main(){
	int a, b;
	int flag = 1;
	fr(a);
	fr(b);
	cin>>str;
	if(str.size() != a + b + 1) {
		flag = 0;
	}
	else if(str[a] != '-') {
		flag = 0;
	}
	for(int i=0; i<str.size(); ++i) {
		if(i==a) continue;
		if(str[i] < '0' || str[i] > '9') flag = 0;
	}
	if(flag) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

ll cutting(vector<ll> A, ll K){
  if(K == 0){
    return INF;
  }
  ll c = 0;
  rep(i, sz(A)){
    if(A.at(i) % K == 0){
      c += A.at(i) / K - 1;
    }
    else{
      c += A.at(i) / K;
    }
  }
  return c;
}

int main()
{
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A.at(i);
    ll l = 0;
    ll r = 1000000000;
    while(r-l > 1){
      ll c = (l+r) / 2;
      if(cutting(A, c) <= K){
        r = c;
      }
      else{
        l = c;
      }
    }
    cout << r << endl;
}

Measured memory_bytes: 6304
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int K = ni();
        long num[] = new long[K];
        for (int i = 1; i <=N; i++) {
            num[i%K] ++;
        }
        long ans = 0;
        for (int a = 0; a < K; a++) {
            int b = (K - a) % K;
            int c = (K - a) % K;
            if((b+c)%K == 0){
                ans += num[a] * num[b] * num[c];
            }
        }
        out.println(ans);
    }

 
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

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

// コンテスト中のみ
#define int long long

#define ll long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define P pair<ll,ll>
int MOD = 1000000007;
const ll INF = 1LL << 60;


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s, t; cin >> s >> t;
	int cnt = 0;
	rep(i, s.size()) {
		if (s[i] != t[i]) {
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3764
#include <iostream>
using namespace std;
long long LCM(long long x,long long y){
  long long r = x % y;
  if(r == 0)return y;
  else return LCM(y,r);
}
int main(){
  int N;
  long long t,M;
  cin >> N;
  cin >> M;
  for(int i=0;i<N-1;i++){
    cin >> t;
    M = M/LCM(t,M)*t;
  }
  cout << M;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define pb push_back
#define mod 1000000007
#define pll pair<long long,long long>
using namespace std;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}
bool prime(int n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return true;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    char s;
    cin>>s;
    if(s>='a'&&s<='z')cout<<"a";
    else if(s>='A'&&s<='Z')cout<<"A";
    return 0;
}

Measured memory_bytes: 3608
import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
  [n, m] <- getIntList
  as <- getIntList

  let th = fromIntegral (sum as) / fromIntegral (4*m) :: Double
      as' = filter (>= th) $ map fromIntegral as
      ans = if length as' >= m then "Yes" else "No"

  putStrLn ans

Measured memory_bytes: 508
#define _CRT_SECURE_NO_WARNINGS
#include <cassert>
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <climits>
using namespace std;

#define int long long
#define pii pair<int, int>
#define ld long double

#define form(i, n) for (int i = 0; i < (n); ++i)
#define form2(i, a, b) for (int i = (a); i < (b); ++i)
#define ford(i, n) for (int i = (n-1); i >= 0; --i)
#define ford2(i, a, b) for (int i = (a-1); i >= (b); --i)

#define chmax(x, v) x = max(x, (v));

void solve();
signed main()
{
#ifdef LOCAL_HUGO
	freopen("in.txt", "r", stdin);
#else
	ios::sync_with_stdio(false);
	cin.tie(0);
#endif
	solve();
}

const int e2 = 18;
const int p2 = 1 << e2;
const int ph = 2 * p2;
const int inf = LLONG_MAX / 2LL;
int lazyadd[ph];
int segmax[ph];
pii inv[ph];

void build()
{
	form2(i, p2, ph) inv[i] = { i - p2, i - p2 };
	ford(i, p2) inv[i] = { inv[2 * i].first, inv[2 * i + 1].second };
}

void apply(int nod)
{
	segmax[nod] += lazyadd[nod];
	if (nod < p2) {
		lazyadd[2 * nod] += lazyadd[nod];
		lazyadd[2 * nod + 1] += lazyadd[nod];
	}
	lazyadd[nod] = 0;
}

int bg, bd, val;
void add(int nod)
{
	apply(nod);
	if (bd < inv[nod].first || inv[nod].second < bg) {}
	else if (bg <= inv[nod].first && inv[nod].second <= bd) { lazyadd[nod] += val; apply(nod); }
	else if (nod < p2) { add(2 * nod); add(2 * nod + 1); segmax[nod] = max(segmax[2 * nod], segmax[2 * nod + 1]); }
}

int gmax(int nod)
{
	apply(nod);
	if (bd < inv[nod].first || inv[nod].second < bg) { return -inf; }
	else if (bg <= inv[nod].first && inv[nod].second <= bd) { return segmax[nod]; }
	else if (nod < p2) { return max(gmax(2 * nod), gmax(2 * nod + 1)); }
	else { return -inf; }
}

void add2(int gauche, int droite, int valeur)
{
	bg = gauche;
	bd = droite;
	val = valeur;
	add(1);
}

int smax(int gauche, int droite)
{
	bg = gauche;
	bd = droite;
	return gmax(1);
}
const int borne = 2 * (int)(1e5) + 5;
int l[borne];
int r[borne];
int a[borne];
int n, k;
vector<int> al[borne];
vector<int> ar[borne];

void solve()
{
	build();
	cin >> n >> k;
	form(i, k)
	{
		cin >> l[i] >> r[i] >> a[i];
		al[l[i]].push_back(i);
		ar[r[i]+1].push_back(i);
	}

	int rep = 0;
	form2(i, 1, n+1)
	{
		for (int x : al[i]) {
			add2(0, l[x] - 1, a[x]);
		}
		for (int x : ar[i]) {
			add2(0, l[x] - 1, -a[x]);
		}
		int ss = smax(0, i - 1);
		chmax(rep, ss);
		add2(i, i, ss);
	}

	cout << rep << '\n';
}

Measured memory_bytes: 42752
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static final Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	int H,W,K;

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		H = nextInt();
		W = nextInt();
		K = nextInt();

		char[][] cake = new char [H][W];
		int[][] map = new int [H][W];
		for(int i=0;i<H;i++) {
			cake[i] = next().toCharArray();
		}

		int num = 1;
		for(int i=0;i<H;i++) {
			for(int j=0;j<W;j++) {
				if(cake[i][j] == '#') {
					map[i][j]=num;
					int _j = j-1;
					while(_j >= 0&&map[i][_j]==0) {
						map[i][_j] = num;
						_j--;
					}
					num++;
				}else if(j == W-1) {
					int _j = j;
					while(_j >= 0&&map[i][_j] == 0) {
						_j--;
					}
					if(_j >= 0) {
						int _num = map[i][_j];
						_j++;
						for(;_j<=j;_j++) {
							map[i][_j] = _num;
						}
					}
				}
			}
		}

		for(int i=0;i<W;i++) {
			for(int j=0;j<H;j++) {
				if(map[j][i] != 0) {
					int _j = j-1;
					num = map[j][i];
					while(_j >= 0&&map[_j][i]==0) {
						map[_j][i] = num;
						_j--;
					}
				}else if(j == H-1 && map[j][i] == 0) {
					int _j = j;
					while(_j >= 0&&map[_j][i] == 0) {
						_j--;
					}
					if(_j >= 0) {
						int _num = map[_j][i];
						_j++;
						for(;_j<=j;_j++) {
							map[_j][i] = _num;
						}
					}
				}
			}
		}


		for(int i=0;i<H;i++) {
			for(int j=0;j<W;j++) {
				if(j != 0)out.print(" ");
				out.print(map[i][j]);
			}
			out.println();
		}

	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

	long gcd(long m,long n) {
		if (m<n) return gcd(n,m);
		if (n==0)return m;
		return gcd(n,m%n);
	}
}

Measured memory_bytes: 43072
import sys
H,W=map(int,input().split())
L = [[0 for j in range(W)] for i in range(H)]
c=0
for i in range(H):
  a=list(input())
  c+=a.count(".")
  L[i]=a
#幅優先探索？
subete=[[0,0]]
ans = [[] for i in range(H*W+1)]
ans[0].append([0,0])
for i in range(H*W+1):
  for j in range(len(ans[i-1])):
    a,b=ans[i-1][j][0],ans[i-1][j][1]
    if a+1!=H:
      if [a+1,b] not in subete and L[a+1][b]==".":
        ans[i].append([a+1,b])
        subete.append([a+1,b])
    if a!=0:
      if [a-1,b] not in subete and L[a-1][b]==".":
        ans[i].append([a-1,b])
        subete.append([a-1,b])
    if b+1!=W:
      if [a,b+1] not in subete and L[a][b+1]==".":
        ans[i].append([a,b+1])
        subete.append([a,b+1])
    if b!=0:
      if [a,b-1] not in subete and L[a][b-1]==".":
        ans[i].append([a,b-1])
        subete.append([a,b-1])
  if [H-1,W-1] in subete:
    print(c-i-1)
    sys.exit()
print(-1)

Measured memory_bytes: 9496
MAX = float('inf')

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

min_a = [MAX]*n
min_a[0] = pp[0]

for i in range(1,n):
  min_a[i] = min(min_a[i-1],pp[i])
  
ans = 0
for i in range(n):
  if min_a[i]>= pp[i]:
    ans += 1

print(ans)    

Measured memory_bytes: 24744
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;

  int answer = 0;
  for (int i = 1; i <= N / 2; ++i) {
    if (N - i != i) answer++;
  }
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define fa(i, a, b) for (int i = a; i < b; ++i)
#define f(i, n) fa(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define pr(x) cout << x << endl;
#define printv(v) f(i, v.size()) cout << v[i] << ' '; cout << '\n';
#define printa(a) f(i, sizeof(a)/sizeof(a[0])) cout << a[i] << ' '; cout << '\n';
#define printm(m) for(auto x:m) cout << x.fi << "--> " << x.se << '\n';
#define printadj(adj) fa(i,1,n+1){cout << i << ":";f(j,adj[i].size()) cout << adj[i][j] << "-->";cout << '\n';}
#define vi vector<int>
typedef long long int ll;
typedef long double ld;
#define vl vector<ll>
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
using namespace std;
const int mod=1e9+7;
const int inf = (1<<30);


void solve()
{
    int i, j, n;
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll x = max(a*c,max(a*d,max(b*c,b*d)));
    cout << x;
}
int main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    
    //OJ;
    int t=1;
    //scanf("%d", &t);
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3640
from string import ascii_lowercase
def inpl(): return list(map(int, input().split()))
tkao = [0, 0]
t = 0

N = int(input())
A = [0]*N
B = [0]*N
for i in range(N):
    A[i], B[i] = inpl()
C = [A, B]

S = sorted([((B[i] + A[i]), i) for i in range(N)], key=lambda x: x[0])

for i in range(N):
    tkao[i%2] += C[i%2][S.pop()[1]]

print(tkao[0] - tkao[1])

Measured memory_bytes: 27460
#include<iostream>
#include <iomanip>
#include <ios>
#include <vector>
#include <string>
#include <algorithm>
#include <string>
#include<limits>
#include<cstdlib>
#include<functional>
#include<cassert>
#include <cstdio>
#include <stack>
#include <queue>
#include <map>
#define fi(p) for(int i=0;i<(p);i++)
#define ce(d) cout<<d<<endl;
#define ll long long
#define sorts(c) sort((c).begin(),(c).end());

using namespace std;

void solve() {
	ll sum=0;
	int N;
	cin >> N;
	vector<int> L(N);

	fi(N) {
		cin >> L[i];
	}

	sorts(L);

	for (int i = 0; i < N - 2; i++) {
		int a = L[i];
		for (int n = i+1; n < N - 1; n++) {
			int b = L[n];
			for (int l = n + 1; l < N; l++) {
				int c = L[l];
				if (a + b > c) {
					sum++;
				}
				else {
					break;
				}
			}
		}
	}

	ce(sum);
}

int main()
{

	solve();

	int a;//止める用
	cin >> a;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace kupc2016_c
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			for (int i = 0; i < n; i++)
			{
				int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
				if (x[0] == 1) Console.WriteLine(x[1]);
				else Console.WriteLine(x[0] % 2 == 1 ? 127 * (x[0] - 1) + x[1] : 127 * (x[0] - 1) + (127 ^ x[1]));
			}
		}
	}
}

Measured memory_bytes: 13268
import sys
input = sys.stdin.readline
M = 10**5

n = int(input())
G = [[] for _ in range(2*M+1)]
for _ in range(n):
  x, y = map(int, input().split())
  G[x].append(y+M)
  G[y+M].append(x)
seen = [False]*(2*M+1)
def dfs(v):
  stack = [v]
  seen[v] = True
  cnt_x, cnt_y = 0, 0
  while stack:
    v = stack.pop()
    if v <= M:
      cnt_x += 1
    else:
      cnt_y += 1
    for nv in G[v]:
      if seen[nv]:
        continue
      seen[nv] = True
      stack.append(nv)
  return cnt_x*cnt_y
ans = 0
for i in range(2*M+1):
  if not seen[i]:
    ans += dfs(i)
ans -= n
print(ans)

Measured memory_bytes: 34528
#include<iostream>
#include<vector>
using namespace std;
int main() {
    string s, t;
    cin >> s >> t;
    vector<int> start(26, -1); //-1埋め
    vector<int> goal(26, -1);
    for (int i = 0; i < s.size(); ++i) {
        int a = s[i] - 'a';
        int b = t[i] - 'a';
        if (start[a] != -1 || goal[b] != -1) { //すでに埋められてる
            if (start[a] != b || goal[b] != a) { //違う値
                cout << "No" << endl;
                return 0;
            }
        } else {
            start[a] = b; //sに対応するt
            goal[b] = a;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 776
n = list(map(int, list(input())))
k = int(input())

# 上の桁からDP
# 大きさが微妙な場合は分ける
# dp[桁][0の個数]

def solve(n, k):
    if k == 0:
        return 1
    if n == []:
        return 0
    dp = [[0 for _ in range(k+1)] for _ in range(len(n))]
    dp[0][0] = 1
    dp[0][1] = n[0] - 1
    for i in range(len(n) - 1):
        for j in range(k + 1):
            if j == 0:
                dp[i+1][0] = dp[i][0]
            else:
                dp[i+1][j] = dp[i][j-1] * 9 + dp[i][j]
    # first non-0
    i = 1
    while i < len(n) and n[i] == 0:
        i += 1
    return dp[len(n) - 1][k] + solve(n[i:], k-1)

print(solve(n, k))

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	rep(i, h)cin>>s[i];

	vector<vector<ll>> yoko(h,vector<ll>(w,0));
	vector<vector<ll>> tate(h,vector<ll>(w,0));

	rep(i,h){
		ll count = 0;
		rep(j,w){
			if(s[i][j] == '#') count = 0;
			else {
				count++;
			}
			yoko[i][j] = count;
		}
	}

	rep(j,w){
		ll count = 0;
		rep(i,h){
			if(s[i][j] == '#') count = 0;
			else count ++;
			tate[i][j] = count;
		}
	}
	for(ll i = h - 1; i >= 0; i--){
		for(ll j = w - 2; j >= 0; j--){
			if(s[i][j] == '#') continue;
			yoko[i][j] = max(yoko[i][j],yoko[i][j+1]);
		}
	}
	for(ll j = w - 1; j >= 0; j--){
		for(ll i = h - 2; i >= 0; i--){
			if(s[i][j] == '#') continue;
			tate[i][j] = max(tate[i][j],tate[i+1][j]);
		}
	}

	ll ans = 0;
	rep(i,h){
		rep(j,w){
			chmax(ans, tate[i][j] + yoko[i][j]);
		}
	}
	cout << ans - 1 << endl;
}


Measured memory_bytes: 73476
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define MAX (1 << 29)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using Pi = pair<int, int>;
using ll = long long;
const int INF = 1 << 28;

string to_string(string s) {
  return s;
}

template <class S, class T>
string to_string(pair<S, T> p) {
  return "{" + to_string(p.first) + "," + to_string(p.second) + "}";
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

void get() {}

template <class Head, class... Tail>
void get(Head& head, Tail&... tail) {
  cin >> head;
  get(tail...);
}

template <class T>
void getv(vector<T>& vec) {
  for (int i = 0; i < vec.size(); ++i)
    cin >> vec[i];
}

int main() {
  int N;
  cin >> N;
  int ans = 1;
  FOR(i, 3) ans *= N;
  print(ans);
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

l = []
r = []

for i in range(n):
    if i == 0:
        l.append(a[0])
        r.append(a[n-1])
    else:
        l.append(gcd(l[i-1],a[i]))
        r.append(gcd(r[i-1],a[n-i-1]))

r.reverse()
ans = max(l[n-2],r[1])

for i in range(1,n-1):
    if ans < gcd(l[i-1],r[i+1]):
        ans = gcd(l[i-1],r[i+1])

print(ans)

Measured memory_bytes: 14452
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void) {
  int n, x, t;
  scanf("%d %d %d", &n, &x, &t);
  int div = n / x, sur = n % x;
  if (!sur) {
    printf("%d\n", div * t);
  } else {
    printf("%d\n", (div + 1) * t);
  }

  return 0;
}


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

int main() {
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;

	if (x - r < 0 || x + r > W || y - r < 0 || y + r > H) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}

	return 0; 
}


Measured memory_bytes: 3124
#define _USE_MATH_DEFINES
#define INF 100000000

#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;

static const double EPS = 1e-8;

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

class Node{
public:
	int x;
	int y;
	Node(int _x,int _y){
		x = _x;
		y = _y;
	}
};

bool check(const vector<Node>& s1,const vector<Node>& s2){
	if(s1.size() != s2.size()) return false;

	int isok = 0;
	int dX = s2.begin()->x - s1.begin()->x;
	int dY = s2.begin()->y - s1.begin()->y;


	for(int i=0;i<s1.size();i++){
		if((s2[i].x - s1[i].x) != dX || (s2[i].y - s1[i].y) != dY) isok |= 1;
	}

	dX = (s2.begin())->x - (s1.end()-1)->x;
	dY = (s2.begin())->y - (s1.end()-1)->y;

	for(int i=0,j=s1.size()-1;i<s1.size();i++,j--){
		if((s2[i].x - s1[j].x) != dX || (s2[i].y - s1[j].y) != dY) isok |= (1<<1);
	}

	return (isok != (1<<2)-1);
}
int main(){

	int n;
	while(~scanf("%d",&n)){
		if(n==0) break;
		int m;
		scanf("%d",&m);

		vector<Node> L0;
		for(int i=0;i<m;i++){
			int x,y;
			scanf("%d %d",&x,&y);
			L0.push_back(Node(x,y));
		}

		vector< vector<Node> > Ls;

		Ls.push_back(L0);

		for(int i=1;i<=3;i++){
			vector<Node> L;
			for(int j=0;j<L0.size();j++){
				double dx = L0[j].x * cos(i*90.0*(M_PI/180.0)) - L0[j].y * sin(i*90.0*(M_PI/180.0));
				double dy = L0[j].x * sin(i*90.0*(M_PI/180.0)) + L0[j].y * cos(i*90.0*(M_PI/180.0));
				dx = (dx <= 0 ? dx - EPS : dx + EPS);
				dy = (dy <= 0 ? dy - EPS : dy + EPS);
				L.push_back(Node(dx,dy));
			}
			Ls.push_back(L);
		}

		
		for(int i=0;i<n;i++){
			vector<Node> L;
			scanf("%d",&m);
			for(int j=0;j<m;j++){
				int x,y;
				scanf("%d %d",&x,&y);
				L.push_back(Node(x,y));
			}

			for(int j=0;j<4;j++){
				if(check(Ls[j],L)){
					printf("%d\n",i+1);
					break;
				}
			}

		}
		printf("+++++\n");
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
const ll INF = 1001001001001;

int main(){
    string s,t; cin >> s >> t;
    bool ok = 0;
    rep(i,s.size()){
        string ss = s.substr(i) + s.substr(0,i);
        if(ss == t) ok = 1;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
template <typename T> using posteriority_queue = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
// const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
template <typename T> void unique(vector<T> &a) { a.erase(unique(ALL(a)), a.end()); }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; cin >> n;
  vector<int> p(n), q(n);
  REP(i, n) {
    cin >> p[i]; --p[i];
  }
  REP(i, n) {
    cin >> q[i]; --q[i];
  }
  int a, b;
  vector<int> per(n);
  iota(ALL(per), 0);
  int cnt = 0;
  do {
    bool same = true;
    REP(i, n) same &= p[i] == per[i];
    if (same) a = cnt;
    same = true;
    REP(i, n) same &= q[i] == per[i];
    if (same) b = cnt;
    ++cnt;
  } while (next_permutation(ALL(per)));
  cout << abs(a - b) << '\n';
  return 0;
}


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

int main() {
  int a,b;
  cin>>a;
  for(int i=1;i<10;i++){
    if((a%i)==0&&(a/i)<10){
      b++;
    }
  }
  if(b==0){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
} 

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"
*/

int main()
{
    int N; cin >> N;
    ll A[N];
    rep(i, N){
        ll Ai; cin >> Ai;
        A[i] = Ai;
    }
    rep(i, N){
        printf("node %d: key = %ld, ", i+1, A[i]);
        if(i != 0) printf("parent key = %ld, ", A[(i-1)/2]);
        int l_ind, r_ind;
        l_ind = 2*i+1; r_ind = 2*(i+1);
        if(l_ind < N) printf("left key = %ld, ", A[l_ind]);
        if(r_ind < N) printf("right key = %ld, ", A[r_ind]);
        cout << endl;
    }
}


Measured memory_bytes: 3208
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<cstdlib>
#include<cstdio>
#include<string>

using namespace std;
//long long dis[100005];
//long long vis[100005];
//long long p[100005];
//long long q[100005];

int main()
{
    long long  dis[100005],vis[100005],p[100005],q[100005];
    long long  temp,before,i,n,a,c,you,zuo,ymax,zmax;
    cin>>n>>c;
    for(i=0,temp=zmax=zuo=before=0; i<n; i++)
    {
        cin>>dis[i]>>vis[i];
        temp=vis[i]+temp-(dis[i]-before);
        before=dis[i];
        if(zmax<temp-dis[i])
            zmax=temp-dis[i];
        q[i+1]=zmax;
        if(zuo<temp)
            zuo=temp;
    }
    q[0]=0;
    for(i=n-1,temp=ymax=you=0,before=c; i>=0; i--)
    {
        temp=vis[i]+temp-(before-dis[i]);
        before=dis[i];
        if(ymax<temp-(c-dis[i]))
            ymax=temp-(c-dis[i]);
        p[i]=ymax;
        if(you<temp+q[i])
            you=temp+q[i];
    }
    p[n]=0;
    for(i=0,temp=before=0; i<n; i++)
    {
        temp=vis[i]+temp-(dis[i]-before);
        before=dis[i];
        if(zuo<temp+p[i+1])
            zuo=temp+p[i+1];
    }
    a=zuo>you?zuo:you;
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 3328
#include<iostream>
using namespace std;
#define MOD 1000000007ULL
unsigned long long PascalsTriangle[2000+1][2000+1]={};

unsigned long long combination(int n,int k){
	if(PascalsTriangle[n][k])return PascalsTriangle[n][k];
    PascalsTriangle[0][0]=1ULL;
    for(int step=1;step<=n;step++){
        for(int i=0;i<=n;i++){
            PascalsTriangle[step][i]=(i||i==n?(PascalsTriangle[step-1][i-1]+PascalsTriangle[step-1][i])%MOD:PascalsTriangle[step-1][i]%MOD);
        }
    }
    return PascalsTriangle[n][k];
}

int n,k;
int main(){
	cin>>n>>k;
	for(int i=1;i<=k;i++)cout<<combination(n-k+1,i)*combination(k-1,i-1)%MOD<<endl;
	return 0;
}

Measured memory_bytes: 31488
#include <iostream>
#include<string>
using namespace std;
string s,a,b,c;
int r;
int main()
{
	cin>>s;
	a=s;
	b=s;
	c=s;
	for(int q=0;q<a.size();q++)
	   {
	   	if(a[q]=='b')a[q]='d';
	   	if(a[q]=='p')a[q]='q';
	   	if(a[q]=='q')a[q]='p';
	   	if(a[q]=='d')a[q]='b';
	   	b[a.size()-1-q]=s[q];
	   }
	for(int q=0;q<a.size();q++)
	{
		if(b[q]=='b')c[q]='d';
	   	if(b[q]=='p')c[q]='q';
	   	if(b[q]=='q')c[q]='p';
	   	if(b[q]=='d')c[q]='b';
	}
	   if(b==s||a==s||c==s)r=1;
	   if(r==1)cout<<"Yes";
	   if(r==0)cout<<"No";
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
using namespace std;
int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a>b)printf("a > b\n");
    else if(a<b)printf("a < b\n");
    else if(a==b)printf("a == b\n");
    return 0;
    
}

Measured memory_bytes: 2584
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<string> vstring;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define mod llint(1e9+7)

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

//aのb乗をmodで割った余りを求める
llint power(llint a, llint b) {
	if (b == 1)return a;
	if (b == 0)return 1;
	llint tmp = power(a, (llint)b / 2);
	tmp *= tmp;
	tmp %= mod;
	if (b % 2 == 1) {
		tmp *= a;
		tmp %= mod;
	}
	return tmp;
}

int main() {
	int h, n;
	int cnt = 0;
	cin >> h >> n;
	rep(i, n) {
		int x;
		cin >> x;
		cnt += x;
	}
	Yes(cnt >= h);
	return 0;
}

Measured memory_bytes: 256
from math import ceil

n = int(input())
data = []
for i in range(n):
    elems = input().split()
    t, a = int(elems[0]), int(elems[1])
    data.append((t, a))

t, a = data[0]

def calcn(r, x):
    n = int(x / r)
    while n * r > x:
        n -= 1
    while n * r < x:
        n += 1
    return n

for i in range(1, n):
    rt, ra = data[i][0], data[i][1]
    na = int(calcn(ra, a))
    nt = int(calcn(rt, t))
    n = max(na, nt)
    t = n * rt
    a = n * ra

print(t + a)


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

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;

using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using vll = V<ll>;
using vvll = V<V<ll>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vst = V<str>;
using vch = V<char>;

#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl
#define ci(a) cin>>a
#define pb(a) push_back(a)
#define pob pop_back()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,b) substr(a,b)
#define cfs(a) cout<<fixed<<setprecision(a)
#define INF 1e16
#define mod 1e9+7
//vvll v(n,vll(m)) n行m列
//A.erase(A.begin()+i) 配列Aのi番目を消せる
//std::binary_search(v.bgn,v.en,a);
//abs(a,b)   pow(a,n)  to_string  stoll
//auto Iter=lower_bound(v.bgn,v.en,a);
//lower//upper  co(*Iter)co(Iter-v.bgn);

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
#define comuse Comuse()
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  ll a,b;
  cin>>a>>b;
  for(ll i=b-a+1;i<b+a;i++){
    co(i);
  }
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s == "AAA" or s == "BBB") {
    cout << "No";
  } else {
    cout << "Yes";
  }
}

// g++ lo.cpp
// ./a.exe
// g++ -o つくりたいふぁいるめい　もとのふぁいる.cpp

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

void print(int x, int y, int z){
	if(x<10) printf("0");
	printf("%d:", x);
	if(y<10) printf("0");
	printf("%d:", y);
	if(z<10) printf("0");
	printf("%d\n", z);
}


int main(){
	while(1){
		int h, m, s;

		scanf(" %d %d %d", &h, &m, &s);
		if(h==-1) break;
		
		int sum = h*3600+m*60+s;
		int ans = 2*3600-sum;
		int a=0, b=0, c=0;
		
		while(ans/3600>0){
			++a;
			ans-=3600;
		}
		while(ans/60>0){
			++b;
			ans-=60;
		}
		c=ans;	
		print(a,b,c);
		
		ans = 3*(2*3600-sum);
		a=0;
		b=0; 
		c=0;
	
		while(ans/3600>0){
			++a;
			ans-=3600;
		}
		while(ans/60>0){
			++b;
			ans-=60;
		}
		c=ans;
		
		print(a,b,c);
	
	}

	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n;
vector<i64> h;
int main() {
  cin >> n;
  read_n(h, n);
  bool f = true, ok = true;
  for (i64 i = n - 2; i >= 0; --i) {
    if (h[i] > h[i + 1]) {
      if (h[i] - h[i + 1] == 1) {
        h[i]--;
      } else {
        ok = false;
      }
    }
  }
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}


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

using namespace std;

int ans;

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


Measured memory_bytes: 256