akhauriyash/Code-Regression huggingface dataset:
//       THIS IS MY NINJA WAY
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ctime>
#include<vector>
#include<algorithm>

#define str string
#define dbl double
#define ll long long int
#define ull unsigned long long int
#define vl vector<ll> 
#define vs vector<str>
#define pll pair<ll,ll> 
#define vll vector<pll>
#define sl set<ll>
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define BS binary_search
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define fr(i,a,b) for(long long i=a; i<b; i++)
#define nfr(i,a,b) for(long long i=a; i<=b; i++)
#define psl pair<str,ll>
#define pls pair<ll,str>
#define pss pair<str,str>
#define lcm(a,b) (a*b)/__gcd(a,b)
#define ALL(a) a.begin(),a.end()
#define stl stack<ll>
#define coml complex<ll>
#define INF 0x3f3f3f3f3f3f3f3f
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define read(v,n) fr(i,0,n)cin>>v[i];
#define print(x) fr(i,0,x.size())cout<<x[i]<<" ";cout<<"\n";
const ll MOD = 1e9+7;
const ll N = 2e5 + 5;
using namespace std;
using namespace __gnu_pbds;
void solve(){
	ll n;
	cin>>n;
	vector<vl> v(n,vl(3));
	fr(i,0,n){
		fr(j,0,3)cin>>v[i][j];
	}
	vector<vl> dp(n,vl(3,0));
	dp[0]=v[0];
	fr(i,1,n){
		fr(j,0,3){
			fr(k,0,3){
				if(j!=k)dp[i][k]=max(dp[i][k],dp[i-1][j]+v[i][k]);
			}
		}
	}
	cout<<*max_element(ALL(dp[n-1]));
}
int main()
{
	fast
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r" , stdin);
		freopen("output.txt", "w" , stdout);
	#endif

	ll t;
	t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 14236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200005;
ll cmp(ll A,ll B)
{
	return A>B;
}
ll a[N];
int main()
{
	int n,m;
	ll sum=0;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	sort(a+1,a+n+1,cmp);
	for(int i=m+1;i<=n;i++)
	{
		sum+=a[i];
	}
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 1792
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;

void main()
{
  auto nl = readln.chomp.split.map!(to!int);
  string[] str;
  foreach (_; 0..nl[0]) {
    str ~= readln.chomp;
  }
  str = sort(str).array;
  foreach (s; str) s.write;
  writeln("");
}


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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
#define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define dbg(x)                       cout << #x << " is " << x << endl;
#define endl                           '\n'



using namespace std;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	 float t,x;
	 cin>>t>>x;
	 cout<<setprecision(9)<<t/x;
return 0;
}

Measured memory_bytes: 256
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( [ $ t : ty ] ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( [ $ t : ty ] ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( [ $ t ] ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let (k, a, b) = get!(u64, u64, u64);

    let ans = if b > a && b - a > 2 {
        if k >= a - 1 {
            let rest = k + 1 - a;
            let ex = rest / 2 * (b - a);
            a + ex + rest % 2
        } else {
            k + 1
        }
    } else {
        k + 1
    };

    println!("{}", ans);
}


Measured memory_bytes: 8572
#include <iostream>
#include <utility>
#include <tuple>
#include <string>
#include <cstdint>
#include <vector>
#include <array>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <cassert>
using namespace std;
using i64 = int64_t;
i64 n, a[16][16], dp[1 << 16];
bool fix[1 << 16];
i64 cnt = 0;
i64 f(int s) {
    ++cnt;
    if (fix[s]) return dp[s];
    for (int i = 0; i < n; ++i) {
        if (!(s & (1 << i))) continue;
        for (int j = 0; j < i; ++j) {
            if (!(s & (1 << j))) continue;
            dp[s] += a[i][j];
        }
    }
    for (int t = (s - 1) & s; t > 0; t = (t - 1) & s) {
        int u = s & ~t;
        dp[s] = max(dp[s], f(t) + f(u));
    }
    fix[s] = true;
    return dp[s];
}
int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cin >> a[i][j];
        }
    }
    cout << f((1 << n) - 1) << endl;
    cerr << cnt << endl;
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
    int ret=0,pos=1;char c=getchar();
    while(!isdigit(c) && c!='-' )c=getchar();
    if(c=='-')	pos=-1,c=getchar();
    while(isdigit(c))ret=(ret<<3)+(ret<<1)+c-48,c=getchar();
    return pos*ret;
}
int n,k;
int a[200010];
int s[200010];
int m;
signed main(){
	n=read(),k=read();
	for(int i=1;i<=n;++i){
		a[i]=read()+1;
		s[i]=s[i-1]+a[i];
	}
	for(int i=k;i<=n;++i){
		m=max(m,s[i]-s[i-k]);
	}
	printf("%lf",m*0.5);
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define ll long long
const int maxn=1e6+10;
const ll inf=1e12+10;
using namespace std;

ll a[maxn];
ll b[maxn],b1[maxn];
ll gcd(ll a,ll b)
{
	return b==0?a:gcd(b,a%b);
}
int fastpow(int a,int b)
{
	int ans=1;
	while(b)
	{
		if(b&1) ans*=a;
		b>>=1;a*=a;
	}
	return ans;
}
int main()
{
	int T;
	T=1;
	while(T--)
	{
		int k,s;
		cin>>k>>s;
		if(k*500>=s) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}

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

int n;
bool f;
string w[110];

int main(){
	cin >> n;
	f = true;
	for (int i = 0; i < n; ++i){
		cin >> w[i];
		if (i > 0){
			if (w[i-1].back() != w[i].front()){
				f = false;
			}
			for (int j = 0; j < i; ++j){
				if (w[j] == w[i]){
					f = false;
					break;
				}
			}
		}
		if (!f) break;
	}
	cout << (f?"Yes":"No");
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N;
  cin>>N;
  if(N%2==1) {
    cout<<0<<endl;
    return 0;
  }
  N -= N%10;
  ll ans=0;
  ll tmp = 1;
  while(tmp<N) {
    ans += N/10/tmp;
    tmp *= 5;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define INF 1e9
#define endl '\n'
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define FORE(i, a, b) for (int i = (a), e = (b); i < e; ++i)
#define RFORE(i, a, b) for (int i = (b)-1, e = (a); i >= e; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())
using namespace std;
typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    int zoro = 0;
    for (int i = 0; i < N; i++) {
        int Di1, Di2;
        cin >> Di1 >> Di2;
        if (Di1 == Di2) {
            ++zoro;
        } else {
            zoro = 0;
        }
        if (zoro == 3) {
            cout << "Yes" << endl;
            exit(0);
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3652
/*
 _    _    _______   _    _
| |  / /  |  _____| | |  / /
| | / /   | |       | | / /
| |/ /    | |_____  | |/ /
| |\ \    |  _____| | |\ \
| | \ \   | |       | | \ \
| |  \ \  | |_____  | |  \ \
|_|   \_\ |_______| |_|   \_\

*/
#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <cstring>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <assert.h>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define right(x) x << 1 | 1
#define left(x) x << 1
#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)
#define mkp make_pair
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define y1 kekekek

const ll ool = 1e18 + 9;
const int oo = 1e9 + 9, base = 1e9 + 7;
const ld eps = 1e-7;
const int N = 2e6 + 6;

int n;
ll a[N];

int main() {
	ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

    cin >> n;
    forn(i, 1, n * 2) {
        cin >> a[i];
    }
    
    sort(a + 1, a + 2 * n + 1);
    
    ll sum = 0;
    forn(i, 1, n) sum += a[i * 2 - 1];
    
    cout << sum << "\n";
    
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
using namespace std;
typedef long long ll;
const int maxn = 105;

int a[maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
#endif
  int n;
  cin>>n;
  int ret = 0;
  int mx = -1;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    if(x>=mx)ret++;
    mx=max(x,mx);
  }
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;cin >> n;
    vector<int> a(n);
    int s=0;
    int t=0;
    for(int i=0;i<n;i++){
        cin >> a.at(i);
    }
    sort(a.begin(),a.end());
    for(int i=n-1;i>=0;i--){
        if((i-n+1)%2==0) s+=a.at(i);
        else t+=a.at(i);
    }
    cout << s-t << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define fcout(n) cout << fixed << setprecision(n)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acosl(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> inline bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int D, N;
int T[210];
int A[210];
int B[210];
int C[210];
int dp[210][210];


signed main(){
    cin >> D >> N;
    rep(i, 0, D) cin >> T[i];
    rep(i, 0, N) cin >> A[i] >> B[i] >> C[i];

    rep(i, 0, N) if(!isin(T[0], A[i], B[i]+1)) dp[1][i] = -INF;
    rep(i, 1, D) rep(j, 0, N) rep(k, 0, N) if(isin(T[i], A[j], B[j]+1)) chmax(dp[i+1][j], dp[i][k]+abs(C[j]-C[k]));

    cout << *max_element(dp[D], dp[D]+N) << endl;

    return 0;
}


Measured memory_bytes: 3424
#include<stdio.h>
#include<map>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
int n,s[110000],A,B;
long long ans,sum;
map<int,bool> vis;
int main(){
	scanf("%d",&n);
	fo(i,0,n-1) scanf("%d",&s[i]);
	fo(C,1,n-2){
		vis.clear();
		sum=0;//!!!! 
		for(int kC=C;kC<n-1;kC+=C){
			A=n-1-kC;
			B=A-C;
			if (A<=B||B<=0) break;
			if (A==kC||vis[A]||vis[kC]) break;
			sum+=s[A]+s[kC];
			vis[A]=1;vis[kC]=1;
			if (sum>ans) ans=sum;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main() {
    int n;
    while(cin >> n, n) {
        string s;
        cin >> s;
        for(int i=0; i<n; ++i) {
            string next;
            int cnt = 1;
            for(int i=0; i<s.size()-1; ++i) {
                if(s[i] != s[i+1]) {
                    next += to_string(cnt);
                    next += s[i];
                    cnt = 1;
                } else {
                    cnt++;
                }
            }
            next += to_string(cnt);
            next += s[s.size()-1];
            s = next;
        }
        cout << s << endl;
    }
}


Measured memory_bytes: 3372
#include <stdio.h>

int main(){
	double a,b,c,d,e,f;
	double x,y;
	double det;
	double inv[2][2];
	while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d,&e, &f) != EOF) {
		det = a*e-b*d;
		inv[0][0] =  e/det;
		inv[0][1] = -b/det;
		inv[1][0] = -d/det;
		inv[1][1] =  a/det;
		x = inv[0][0] * c + inv[0][1] * f;
		y = inv[1][0] * c + inv[1][1] * f;
		printf("%.3f %.3f\n", x+0.0004, y+0.0004);
	}
	return 0;
}

Measured memory_bytes: 656
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools

def main():
    k = int(input())
    x = 7%k
    y = set()
    cnt = 1
    for i in range(k+1):
        if x == 0:
            print(cnt)
            exit()
        if x in y:
            print(-1)
            exit()
        y.add(x)
        x = (x*10+7)%k
        cnt += 1




if __name__=="__main__":
    main()


Measured memory_bytes: 200880
import Control.Applicative ((<$>))
import Control.Monad (unless)
import Data.List (unfoldr)

main :: IO ()
main = do
  n <- readLn
  unless (n == 0) $ do
    solve n >>= print
    main

solve :: Int -> IO Int
solve = return . g . map tr . f
  where f = unfoldr (\x -> if x == 0 then Nothing
                           else let (q, r) = divMod x 8 in Just (r, q))
        tr x | x == 4 = 5
             | x > 4 = x + 2
             | otherwise = x
        g = foldr (\x y -> x + 10 * y) 0



Measured memory_bytes: 4120
#include <iostream>
int main()
{
    int N;
    long long p;
    std::cin>>N;
    long long x=1;
    long double y=1;
    for(int i=0;i<N;i++)
    {
      std::cin>>p;
       x=x*p;
       y=y*p;
     }
     if(y>1000000000000000000)
     std::cout<<"-1";
     else {
     std::cout<<x<<std::endl;
     }
}

Measured memory_bytes: 3620
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int a = sc.nextInt(); int b = sc.nextInt();
		if (a == b) System.out.println("a == b");
		else System.out.println(a>b?"a > b":"a < b");
		
	}
}


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

using namespace std;
#define ll long long

ll INF = 1e9 + 7;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll a,res=0;

    string s,t;
    cin>>s;
    cin>>t;

    for(int i=0;i<s.size();i++)
    {
        if(s[i] != t[i])
            res++;
    }

    cout<<res<<endl;

    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
const int INF = 1e9;

int main() {
  int d, g, t;
  cin >> d >> g;
  vector<int> p(d), c(d);

  rep(i, d) cin >> p[i] >> c[i];

  int ans = INF;
  for (int i = 0; i < 1 << d; ++i) {
    int cnt = 0, po = 0, id = -1;
    for (int j = 0; j < d; ++j) {
      if (i & 1 << j) {
        cnt += p[j];
        po += p[j] * 100 * (j + 1) + c[j];
      } else
        id = j;
    }

    if (po < g) {
      int tcnt = ceil((g - po) / (double)(id + 1) / 100.0);
      if (tcnt > p[id]) continue;
      cnt += tcnt;
    }
    ans = min(ans, cnt);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
struct edge{ll to,cost;};
const int inf = 1<<28;
const ll INF = 1LL<<53;
const int COMBMAX = 500005;
const ll MOD = 1e9+7;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;++i)
#define repf(i,n) for(int i=0;i<=n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define eachdo(v, e) for(const auto& e : v)
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (ll)distance(v.begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (ll)distance(v.begin(), upper_bound((v).begin(), (v).end(), e))
ll mpow(ll a, ll n,ll mod=MOD){ll res=1;while(n>0){if(n&1)res=res*a%mod;a=a*a%mod;n>>=1;}return res;}
template<class T1, class T2> ll bcount(T1 v, T2 a){return upper_index(v,a)-lower_index(v,a);} 
template<class T> bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
template<class T> void debug2(T v){rep(i,v.size()){rep(j,v[i].size())cout<<v[i][j]<<" ";cout<<endl;}}
template<class T> void rdv(T &v){rep(i,v.size())cin>>v[i];}
template<class T> void rdvv(T &v){rep(i,v.size()){rep(j,v[i].size())cin>>v[i][j];}}
// multimap
// mmap.emplace(key,value);
// auto ngw = list.equal_range("");
// for(auto e = ngw.first; it != ngw.second ; ++e)


int main(){
    ll N ,L; cin >> N >> L;
    vl a(N); rdv(a);
    ll lst = -1;
    rep(i,N-1){
        if(a[i]+a[i+1]>=L){
            lst = i;
            break;
        }
    }
    if (lst == -1){
        cout << "Impossible" << endl;
        return 0;
    }
    cout << "Possible" << endl;
    rep(i, lst) cout << i + 1 << endl;
    for(ll i = N-1;lst+1<=i;i--) cout << i << endl;
    return 0;
}

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

int main(){
    int N, M; cin >> N >> M;
    vector<int> A(M);
    for(auto &x : A) cin >> x;
    int ans=N;
    for(auto x : A) ans-=x;
    if(ans >= 0) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;
void Main()
{
    ll A, B, Q;
    cin >> A >> B >> Q;
    vector<ll> s(A);
    rep(i, A) cin >> s[i];
    vector<ll> t(B);
    rep(i, B) cin >> t[i];
    vector<ll> x(Q);
    rep(i, Q) cin >> x[i];
    
    sort(all(s));
    sort(all(t));
    
    rep(i, Q) {
        auto si = lower_bound(all(s), x[i]) - s.begin();
        auto ti = lower_bound(all(t), x[i]) - t.begin();

        ll res = 1e18;
        if (1 <= si && 1 <= ti) {
            res = min(res, max(abs(x[i] - s[si-1]), abs(x[i] - t[ti-1])));
        }
        if (si < s.size() && ti < t.size()) {
            res = min(res, max(abs(x[i] - s[si]), abs(x[i] - t[ti])));
        }
        if (1 <= si && ti < t.size()) {
            res = min(res, 2 * abs(x[i] - s[si-1]) + abs(x[i] - t[ti]));
            res = min(res, abs(x[i] - s[si-1]) + 2 * abs(x[i] - t[ti]));
        }
        if (si < s.size() && 1 <= ti) {
            res = min(res, 2 * abs(x[i] - s[si]) + abs(x[i] - t[ti-1]));
            res = min(res, abs(x[i] - s[si]) + 2 * abs(x[i] - t[ti-1]));
        }

        put(res);
    }
}
signed main(){ Main();return 0;}

Measured memory_bytes: 5636
#include<stdio.h>
#include<stdlib.h>
#include<bits/stdc++.h>
#define ll long long
#define fast_io cin.tie(0);cout.tie(0);ios::sync_with_stdio(0)
#define MOD 1000000007
using namespace std;

int main(){
	fast_io;
	ll n,x;
	cin>>n>>x;
	vector<ll> l;
	for(int i=0;i<n;i++){
        ll a;
        cin>>a;
        l.push_back(a);
	}
	ll cnt=0;
	vector<ll> d;
	d.push_back(0);
	for(int i=1;i<=n;i++){
        ll a;
        a = d[i-1]+l[i-1];
        d.push_back(a);
	}
	for(int i=0;i<d.size();i++){
        if(d[i]<=x){
            cnt++;
        }
	}
	cout<<cnt;
	return 0;
}


Measured memory_bytes: 256
n, m=map(int, input().split())
ab=[list(map(int, input().split())) for _ in range(n)]
cd=[list(map(int, input().split())) for _ in range(m)]
for i in range(n):
  k=float('inf')
  for j in range(m):
    l=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
    if l<k:
      k=l
      out=j+1
  print(out)

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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
using namespace std;
int main(){
  string s;cin>>s;
  bool flag=true;
  int cnt=0;
  for(int i=0;i<s.size();i++){
    if(i==0){
      if(s[i]!='A')flag=false;
    }else if(i>1&&i<s.size()-1){
      if(s[i]=='C'){cnt++;
      }else if(s[i]>='A'&&s[i]<='Z')flag=false;
    }else{
      if(s[i]>='A'&&s[i]<='Z')flag=false;
    }
  }
  if(flag&&cnt==1)cout<<"AC"<<endl;
  else cout<<"WA"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int a[111111];

int main()
{
  int n, x;
  ll ans = 0;
  cin>>n>>x;
  REP(i,n) {
    cin>>a[i];
    //a2[i] = a[i];
  }

  for (int i = 0; i < n-1; i++) {
    int tmp = a[i] + a[i+1];
    if (tmp > x) {
      ans += tmp - x;
      a[i+1] -= min(tmp - x, a[i+1]);
    }
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 640
program three_variables_game
  implicit none
  integer :: n, r(4) = 0, t(4) = 0, x(100001) = 0, i, j, p(2) = 0
  character(1) :: c(4) = (/ "A", "B", "X", "C" /)
  character(2) :: s
  logical :: tmp
  read(*,*) n, r(1), r(2), r(4)
  if (sum(r) == 0) then
    write(*,'(a)') "No"
    stop
  end if
  do i = 1, n
    read(*,*) s
    x(i) = hash(s)
  end do
  if (sum(r) == 1) then
    t = r
    if (simulate(.false.)) then
      write(*,'(a)') "Yes"
      r = t
      tmp = simulate(.true.)
    else
      write(*,'(a)') "No"
    end if
    stop
  end if
  call get_index(x(1),p)
  if (r(p(1)) == 0 .and. r(p(2)) == 0) then
    write(*,'(a)') "No"
    stop
  else
    write(*,'(a)') "Yes"
  end if
  do i = 1, n
    call get_index(x(i),p)
    if (r(p(1)) == 0) then
      r(p(1)) = r(p(1))+1
      r(p(2)) = r(p(2))-1
      write(*,'(a)') c(p(1))
    else if (r(p(2)) == 0) then
      r(p(1)) = r(p(1))-1
      r(p(2)) = r(p(2))+1
      write(*,'(a)') c(p(2))
    else if (sum(r) == 2 .and. r(p(1))*r(p(2)) == 1 .and. i < n .and. x(i) /= x(i+1)) then
      j = 1
      if (p(2) == and(x(i),x(i+1))) j = 2
      r(p(j)) = r(p(j))+1
      r(p(3-j)) = r(p(3-j))-1
      write(*,'(a)') c(p(j))
    else if (r(p(1)) > r(p(2))) then
      r(p(1)) = r(p(1))-1
      r(p(2)) = r(p(2))+1
      write(*,'(a)') c(p(2))
    else
      r(p(1)) = r(p(1))+1
      r(p(2)) = r(p(2))-1
      write(*,'(a)') c(p(1))
    end if
  end do
contains
  integer function hash(s)
    character(2), intent(in) :: s
    select case (s)
      case ("AB")
        hash = 3
      case ("AC")
        hash = 5
      case ("BC")
        hash = 6
    end select
  end
  subroutine get_index(x,p)
    integer, intent(in) :: x
    integer, intent(out) :: p(2)
    integer :: i, k
    i = 0
    do k = 0, 2
      if (btest(x,k)) then
        i = i+1
        p(i) = lshift(1,k)
      end if
    end do
  end
  logical function simulate(out)
    logical, intent(in) :: out
    simulate = .true.
    do i = 1, n
      call get_index(x(i),p)
      if (r(p(1)) /= 0) then
        r(p(1)) = r(p(1))-1
        r(p(2)) = r(p(2))+1
        if (out) write(*,'(a)') c(p(2))
      else if (r(p(2)) /= 0) then
        r(p(1)) = r(p(1))+1
        r(p(2)) = r(p(2))-1
        if (out) write(*,'(a)') c(p(1))
      else
        simulate = .false.
        return
      end if
    end do
  end
end program three_variables_game

Measured memory_bytes: 3332
#include <stdio.h>
 
int main() {
    int n, a;
    int x[7];
    while(scanf("%d", &n)) {
        if (n == 0) break;
        for(int i=0; i<7; i++) x[i] = 0;
        while(n--) {
            scanf("%d", &a);
            x[(a/10 > 6) ? 6 : a/10]++;
        }
        for(int i=0; i<7; i++)
            printf("%d\n", x[i]);
    }
}



Measured memory_bytes: 1980
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int a, b, q;
  cin >> a >> b >> q;
  vector<ll> s(a), t(b);
  rep(i,a) cin >> s[i];
  rep(i,b) cin >> t[i];
  auto s_get = [&](int i) {
    if (i == (int)s.size()) return 1LL<<60; //INF
    if (i == -1) return -(1LL<<60);
    return s[i];
  };
  auto t_get = [&](int i) {
    if (i == (int)t.size()) return 1LL<<60;
    if (i == -1) return -(1LL<<60);
    return t[i];
  };
  rep(i,q) {
    ll x;
    cin >> x;
    int ind1 = lower_bound(all(s), x) - s.begin();
    int ind2 = lower_bound(all(t), x) - t.begin();
    vector<ll> ss = {s_get(ind1-1), s_get(ind1)};
    vector<ll> tt = {t_get(ind2-1), t_get(ind2)};
    ll dist = 1LL<<60;
    rep(i,2) rep(j,2) { //全通り
      chmin(dist, llabs(x-ss[i]) + llabs(tt[j] - ss[i]));
      chmin(dist, llabs(x-tt[i]) + llabs(ss[j] - tt[i]));
    }
    cout << dist << endl;
  }
  return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<string> data(N);
  for(int i = 0;i < N;i++){
    cin >> data.at(i);
  }
  sort(data.begin(), data.end());
  int count = N;
  for(int i = 0;i < N-1;i++){
      if(data.at(i)==data.at(i+1)){
        count--;
    }
  }
  cout << count <<endl;
}

Measured memory_bytes: 9552
#include<stdio.h>
void answer();
int main()
{
    answer();
    return 0;
}
void answer()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a==5&&b==5&&c==7||a==5&&b==7&&c==5||a==7&&b==5&&c==5)
    {
        printf("YES");
    }
    else
        printf("NO");
}


Measured memory_bytes: 128
import java.util.Scanner;

class Dice{
	int front,back,top,bottom,right,left;

	public Dice(int[] n){
		front=n[1];
		back=n[4];
		top=n[0];
		bottom=n[5];
		right=n[2];
		left=n[3];
	}

	public void Turnx(){
		int swap;
		swap=top;
		top=front;
		front=bottom;
		bottom=back;
		back=swap;
	}

	public void Turny(){
		int swap;
		swap=front;
		front=left;
		left=back;
		back=right;
		right=swap;
	}

	public void Turnz(){
		int swap;
		swap=top;
		top=right;
		right=bottom;
		bottom=left;
		left=swap;
	}

	public int Check(Dice a){
		int c=0;
		if(this.top==a.top){
			c++;
		}
		if(this.bottom==a.bottom){
			c++;
		}
		if(this.front==a.front){
			c++;
		}
		if(this.back==a.back){
			c++;
		}
		if(this.right==a.right){
			c++;
		}
		if(this.left==a.left){
			c++;
		}

		if(c==6){
			return 1;
		}else{
			return 0;
		}
	}

	public void Show(){
		System.out.printf("%d %d %d %d %d %d\n",top,front,right,left,back,bottom);
	}

}

public class Main{

	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int n,i,j,k,l,f=0;
		int[] num=new int[6];

		n=scan.nextInt();
		Dice[] dice=new Dice[n];

		for(i=0;i<n;i++){
			for(j=0;j<6;j++){
				num[j]=scan.nextInt();
			}
			dice[i]=new Dice(num);
		}

		for(i=0;i<n-1;i++){
			for(j=i+1;j<n;j++){
				for(k=0;k<6;k++){
					if(dice[i].top==dice[j].top&&dice[i].bottom==dice[j].bottom){
						for(l=0;l<4;l++){
							f=dice[i].Check(dice[j]);
							if(f==1){
								break;
							}
							dice[j].Turny();
						}
					}
					if(k%2==0){
						dice[j].Turnx();
					}else{
						dice[j].Turnz();
					}
				}

				if(f==1){
					break;
				}
			}
			if(f==1){
				break;
			}
		}

		if(f==1){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}

		scan.close();
	}
}


Measured memory_bytes: 28480
<?php

$n = trim(fgets(STDIN));

for($i=0; $i<$n; $i++){
  $xy = explode(' ', trim(fgets(STDIN)));
  $x[$i] = $xy[0];
  $y[$i] = $xy[1];
}

$d = 0;
for($i=0; $i<$n; $i++){
  for($j=1; $j<$n; $j++){
    $jj = ($i+$j)%$n;
  	$d += sqrt(($x[$i]-$x[$jj])**2 + ($y[$i]-$y[$jj])**2);
  }
}
  
echo $d/$n;
  
?>

Measured memory_bytes: 4604
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int[][][] num=new int[4][3][10];
        int[] a=new int[4];
        for(int i=0;i<n;i++){
            for(int j=0;j<4;j++) a[j]=scan.nextInt();
            num[a[0]-1][a[1]-1][a[2]-1]+=a[3];
        }

        for(int i=0;i<4;i++){
            for(int j=0;j<3;j++){
                for(int k=0;k<10;k++){
                    if(k==9) System.out.println(" "+num[i][j][k]);
                    else System.out.printf(" %d",num[i][j][k]);
                }
            }
            if(i!=3) System.out.println("####################");
        }
    }
}


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

using namespace std;

int main(void) {
    int n, k;
    string s;
    cin >> n >> s >> k;
    for (int i = 0; i < n; ++i) {
        if (s[i] != s[k-1]) {
            s[i] = '*';
        }
    }

    cout << s << endl;
}

Measured memory_bytes: 256
// 2011/09/09 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==0)
			break;

		n = 1000-n;

		int sum = 0;

		sum += n/500;
		n %= 500;

		sum += n/100;
		n %= 100;

		sum += n/50;
		n %= 50;

		sum += n/10;
		n %= 10;

		sum += n/5;
		n %= 5;

		sum += n;

		cout << sum << endl;
	}

	return 0;
}

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

int main(){
  vector<int> n(3);
  for(int i=0;i<3;i++){
    cin >> n.at(i);
  }
  sort(n.begin(),n.end());
  cout << n.at(0)+n.at(1) <<endl;
  
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n,k,i,x,y;
int main(){
      cin>>n>>k;
      for(i=0;i<k;i++){
            cin>>x>>y;
            if(x+y<=n)cout<<(x<y?(x+2)%3+1:(y+2)%3+1)<<endl;
            else cout<<(x<y?(n-y)%3+1:(n-x)%3+1) << endl;
      }
}

Measured memory_bytes: 1160
import sys
input = sys.stdin.readline

s = input().rstrip()
t = input().rstrip()
ls = len(s)
lt = len(t)
dp = [[0]*(lt+1) for _ in range(ls+1)]
for i in range(ls):
  for j in range(lt):
    if s[i] == t[j]:
      dp[i+1][j+1] = dp[i][j] + 1
    else:
      dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])
ans = ""
while ls > 0 and lt > 0:
  if dp[ls][lt] == dp[ls-1][lt]:
    ls -= 1
  elif dp[ls][lt] == dp[ls][lt-1]:
    lt -= 1
  else:
    ans = s[ls-1] + ans
    ls -= 1
    lt -= 1
print(ans)

Measured memory_bytes: 112220
#include <cstdio>
#include <numeric>
#include <vector>

using namespace std;

int main()
{
    int t = 0;
    while (true) {
        // if (t == 4) {
        //    break;
        //}
        int n;
        int p;
        scanf("%d %d", &n, &p);

        if (n == 0 && p == 0) {
            break;
        }

        vector<int> v;
        v.resize(n);
        for (auto&& i : v) {
            i = 0;
        }
        int c = p;
        int nn = 0;
        while (true) {
            // printf("c: %d nn: %d\n", c, nn);
            // printf("v %d: ", v.size());
            // for (auto&& i : v) {
            //    printf("%d ", i);
            //}
            // putchar('\n');
            if (c != 0) {
                c -= 1;
                v[nn] += 1;
                if (c == 0) {
                    auto s = accumulate(begin(v), end(v), 0) - v[nn];
                    if (s == 0) {
                        printf("%d\n", nn);
                        break;
                    }
                }
            }
            else {
                if (v[nn] != 0) {
                    c += v[nn];
                    v[nn] = 0;
                }
            }
            nn = (nn + 1) % n;
        }
        ++t;
    }
}

Measured memory_bytes: 2652
x,n = map(int, input().split())
al = list(map(int, input().split()))

if n ==0:
    print(x)
    exit()

aln = list(map(lambda y: abs(y-x),al))

if 0 in aln:
    pass
else:
    print(x)
    exit()

for i in range(1,300):
    if aln.count(i) ==2:
        pass
    else:
        if x-i in al:
            print(x+i)
            exit()
        else:
            print(x-i)
            exit()

Measured memory_bytes: 9148
#include <bits//stdc++.h>
using namespace std;
#define int long long
#define rep(i,n,k) for(int i=n;i<k;i++)
#define P make_pair
#define F first
#define S second
#define M LLONG_MAX
signed main(void){
    int n,m,ans,p,q,c;
    ans=LLONG_MAX;
    string s1,s2;
    vector<int> v;
    cin>>n>>m;
    int a[n];
    rep(i,0,n){cin>>a[i];a[i]--;}
    int b[n];
    rep(i,0,n)b[i]=0;
    p=0;
    v.push_back(0);
    while(1){
        if(b[a[p]]==0){
        b[a[p]]=b[p]+1;
        if(a[p]!=0)
        v.push_back(a[p]);
        }
        else{
            q=b[p]+1-b[a[p]];
            cout<<v[(b[a[p]]+(m-b[a[p]])%q)]+1<<endl;
          
            return 0;
        }
        if(a[p]==0){
            cout<<v[m%(b[a[p]])]+1<<endl;
            
            return 0;
        }
        if(b[a[p]]==m){
            cout<<a[p]+1<<endl;
            return 0;
        }
        p=a[p];
        
    }
    
    
    
}


Measured memory_bytes: 8392
using System;
using System.Linq;
using System.Collections.Generic;
public class DFS
{
public static void Main()
{
	var n = int.Parse(Console.ReadLine());
	var u = Enumerable.Range(0, n)
		.Select(_ => Console.ReadLine());
	
	var builtupNodes = Build(u);
	var explorer = new Explorer();
	do 
	{
		explorer.Explore(builtupNodes.First(x => x.FoundTime == 0));
	} while (builtupNodes.Any(x => x.FoundTime == 0));
	
	builtupNodes.ToList().ForEach(x => Console.WriteLine(x.Id + " " + x.FoundTime + " " + x.FinishedTime));
}

public static IEnumerable<Node> Build(IEnumerable<string> u)
{
	var nodeAndInputs = u.Select(x => x.Split(' '))
		.Select(x => x.Select(int.Parse))
		.Select(x => new 
		{ 
			node = new Node
			{
				Id = x.First(),
				Children = new Node[0]
			},
			input = x
		})
		.ToList();
		
	return nodeAndInputs.Select(nodeinput => 
	{
		nodeinput.node.Children = nodeAndInputs
			.Select(x => x.node)
			.Where(x => nodeinput.input.Skip(2).Contains(x.Id));
		return nodeinput.node;
	})
	.OrderBy(x => x.Id);
}

public class Explorer
{
	private int time = 0;
	public void Explore(Node node)
	{
		node.FoundTime = ++time;
		foreach (var n in node.Children.Where(x => x.FoundTime == 0))
		{
			Explore(n);
		}
		node.FinishedTime = ++time;
	}
}
}
public class Node
{
	public int Id { get; set; }
	public IEnumerable<Node> Children { get; set; }
	public int FoundTime { get; set; }
	public int FinishedTime { get; set; }
}

Measured memory_bytes: 12808
n = int(input())
ds1 = []
ds2 = []
for _ in range(n):
    d1,d2 = list(map(int, input().split()))
    ds1.append(d1)
    ds2.append(d2)

matched = [d1 == d2 for d1,d2 in zip(ds1,ds2)]
cnt = 0
for m in matched:
    cnt = cnt+1 if m else 0
    if cnt == 3:
        break

if cnt == 3:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9160
#include <iostream>
#define REP(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,a) REP(i,0,a)
using namespace std;
const int R = 20010;
int N,M,C[16],x[R],dp[R][256], inf = 1 << 28;

int main(void){
    while (1) {
        cin >> N >> M;
        if (N == 0) break;
        rep(i,R) rep(j,256) dp[i][j] = inf;
        rep(i,M) cin >> C[i];
        rep(i,N) cin >> x[i];
        
        dp[0][128] = 0;
        rep(i,N) rep(j,256) rep(k,M) {
                    int nxt = max(0, min(255,j+C[k]));
                    int cost = (x[i]-nxt)*(x[i]-nxt);
                    dp[i+1][nxt] = min(dp[i+1][nxt], dp[i][j]+cost);
        }
        
        int ans = inf;
        rep(i,256) ans = min(ans, dp[N][i]);
        cout << ans << endl;
    }
    return 0;    
}

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

namespace abc164_d
{
  class Program
  {
    static void Main(string[] args)
    {
      var S = Console.ReadLine().Select(e => e - '0').ToArray();

      var a = new int[S.Length + 1];
      var mul = 1;

      for (int i = a.Length - 2; i >= 0; i--)
      {
        a[i] = (a[i + 1] + S[i] * mul) % 2019;
        mul = mul * 10 % 2019;
      }

      var b = new int[2019];

      foreach (var e in a)
      {
        b[e]++;
      }

      var ans = 0L;

      for (int i = 0; i < 2019; i++)
      {
        ans += (long)b[i] * (b[i] - 1) / 2;
      }

      Console.WriteLine(ans);
    }
  }
}


Measured memory_bytes: 29852
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  UnionFind uf(n);
  rep(i,m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    uf.unite(a, b);
  }
  int ans = 0;
  rep(i,n) ans = max(ans, uf.size(i));
  cout << ans << endl;
}

Measured memory_bytes: 3972
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
#define all(n) (n).begin(),(n).end()
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}

int main(){
	int n;
	cin >> n;
	int x,y;
	cin >> x >> y;
	vector<int> g[2010];
	FOR(i,n-1){
		g[i+2].push_back(i+1);
		g[i+1].push_back(i+2);
	}
	g[x].push_back(y);
	g[y].push_back(x);

	int dis[2010][2010];
	FOR(i,2010)FOR(j,2010)dis[i][j]=0;
	bool reached[2010];

	for(int i=1;i<=n;i++){
		
		FOR(j,2010)reached[j]=0;
		queue<int> q;
		q.push(i);
		reached[i]=1;

		while(!q.empty()){
			int x=q.front();
			q.pop();
			FOR(j,g[x].size()){
				if(!reached[g[x][j]]){
					dis[i][g[x][j]]=dis[i][x]+1;
					reached[g[x][j]]=1;
					q.push(g[x][j]);
				}
			}

		}
	}

	int ans[2010];
	FOR(i,2010)ans[i]=0;

	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			ans[dis[i][j]]++;
		}
	}

	for(int i=1;i<=n-1;i++){
		cout << ans[i]/2 << endl;
	}
	
}

Measured memory_bytes: 16128
function main(input) {
    const lines = input.split("\n");
    const ND = new Int32Array(lines[0].split(" "));
    const D2 = ND[1] * ND[1];
    let cnt = 0;
    for (let i = 1; i < lines.length; i++) {
        const arr = new Int32Array(lines[i].split(" "));
        const x = arr[0];
        const y = arr[1];
        const d2 = x * x + y * y;
        cnt += (d2 <= D2) ? 1 : 0;
    }
    return cnt
}

//******************************
exports.main = main;

function Main(input) {
    console.log(main(input.trim()));
}

if (process.argv[2] !== "test") {
    Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}

Measured memory_bytes: 62620
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<cctype>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

int main(){
double x[2], y[2] , length;
for(int i =0; i<2; i++){
  cin >> x[i] >> y[i];
}
length = sqrt( pow( x[0] - x[1] , 2 ) + pow( y[0] - y[1], 2 ));
printf("%.8f\n", length);
return 0;
}


Measured memory_bytes: 3200
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(int i = (int)(b); i < (int)(e); ++i)
#define RFOR(i, b, e) for(int i = (int)(e-1); i >= 0; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<int,int>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;

using namespace std;

ll conb(ll n, ll r) {
	if (n - r < r) { return conb(n, n - r); }
	ll tmp = 1;
	FOR(i, n - r + 1, n + 1) {
		tmp *= i;
	}
	FOR(i, 1, r + 1) {
		tmp /= i;
	}
	return tmp;
}

int main() {
	VVI v;
	v.reserve(3);
	REP(i, 3) {
		VI u(3);
		REP(j, 3) {
			cin >> u[j];
		}
		v.emplace_back(u);
	}

	REP(j, 2) {
		int k = v[0][j + 1] - v[0][j];
		FOR(i, 1, 3) {
			if (v[1][j + 1] - v[1][j] != k) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	REP(j, 2) {
		int k = v[j + 1][0] - v[j][0];
		FOR(i, 1, 3) {
			if (v[j + 1][i] - v[j][i] != k) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<cmath>

using namespace std;

#define ll long long int
#define ld long double
#define loop(i, n) for (int i = 0; i < n; i++)
#define loops(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define deb(x) cout<< #x << '=' << x <<endl
#define MOD 1000000007
const int N = 2e5 + 5;
ll a[N],b[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n,m,k;
    cin>>n>>m>>k;
    for(int i = 1; i<=n ;i++){
        cin>>a[i];
        a[i]+=a[i-1];
    }
    for(int i = 1; i<=m; i++){
        cin>>b[i];
        b[i]+=b[i-1];
    }
    ll ans = 0;
    ll j = m;
    for(ll i = 0; i<=n; i++){
        if(a[i] > k){
            break;
        }
        while(a[i] + b[j] > k){
            j--;
        }
        ans = max(ans , i + j);
    }
    cout<<ans;

}


Measured memory_bytes: 6760