akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;

bool f(int a, int b, int c){
    return (a == 0 && b == 1 && c == 2);
}

int dp[110][4][4][4] = {};
signed main(){
    
    int n; cin >> n;
    dp[0][0][3][3] = 1;
    for(int i = 0; i < n; i++){
        for(int a = 0; a < 4; a++){
            for(int b = 0; b < 4; b++){
                for(int c = 0; c < 4; c++){
                    for(int d = 0; d < 4; d++){
                        if(dp[i][a][b][c] == 0) continue;

                        if(f(a, b, c)) continue;
                        if(f(a, b, d)) continue;
                        if(f(a, c, d)) continue;
                        if(f(b, c, d)) continue;

                        if(f(b, a, c)) continue;
                        if(f(a, b, c)) continue;
                        if(f(c, b, d)) continue;
                        if(f(b, d, c)) continue;
                        dp[i + 1][b][c][d] += dp[i][a][b][c];
                        dp[i + 1][b][c][d] %= MOD;
                    }
                }
            }
        }
    }

    int ans = 0;
    for(int a = 0; a < 4; a++){
        for(int b = 0; b < 4; b++){
            for(int c = 0; c < 4; c++){
                ans += dp[n][a][b][c];
                ans %= MOD;
            }
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int power(int x){
  int i=0, ans=1;
  while(i<x){
    ans*=100;
    i++;
  }
  return ans;
}
  
int main() {
  int d,n;
  cin >> d >> n;
  if(n!=100){
    cout << power(d)*n << endl;
    return 0;
  }
  else{
    cout << power(d)*(101) << endl;
    return 0;
  }
  
}

Measured memory_bytes: 256
from itertools import permutations

n, m = map(int, input().split())
g = [[] for _ in range(n)]

for _ in range(m):
    a, b = map(lambda x: int(x)-1, input().split())
    g[a].append(b)
    g[b].append(a)

ans = 0

for p in permutations(range(1, n)):
    if p[0] not in g[0]: continue
    for i in range(n-2):
        if p[i+1] not in g[p[i]]: break
    else: ans += 1

print(ans)


Measured memory_bytes: 9196
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<cstdio>
#include<iomanip>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int INF = 1e9 + 7;
int main() {
	bool canone = false;
	bool cannine = false;
	bool canseven = false;
	bool canfour = false;
	for (int i = 0; i < 4; ++i) {
		int a;
		cin >> a;
		if (a == 1)canone = true;
		if (a == 9)cannine = true;
		if (a == 7)canseven = true;
		if (a == 4)canfour = true;
	}
	if (canone&&cannine&&canseven&&canfour) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
ll S,p,a,b,c,d,t;
void init(){
	if(p*p==S)return a=b=p,void();
	a=b=p+1;
}
int main(){
	cin>>S,p=sqrt(S);init(),t=a*b-S;
	fp(i,1,1e9)if(t%i==0&&t/i<=1e9){c=i,d=t/i;break;}
	printf("%lld %lld %lld %lld %lld %lld\n",0ll,0ll,a,c,d,b);
	return 0;
}

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

int main (){
  int n,m;
  cin >> n >> m;
  vector<int>s[m];
  rep(i,m){
    int k;
    cin >> k;
    rep(j,k){
      int t;
      cin >> t;
      t--;
      s[i].push_back(t);
    }
  }
  int p[m];
  rep(i,m)cin >> p[i];
  int ans=0;
  for(int i=0;i<pow(2,n);i++){
    bool ok = 1;
    rep(mm,m){
      int a = 0;
      for(int l:s[mm]){
        if(i & (1<<l))a += 1;
      }
      if(a%2!=p[mm])ok = 0;
    }
    if(ok==1)ans += 1;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int H,N;
    int c=0;
    cin >>H>>N;

    vector<int> a(N);

  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
    c=c+a.at(i);}

    if(H<=c){
      cout<<"Yes"<<endl;
     
    }
     else {cout<<"No"<<endl;}

    

}


Measured memory_bytes: 640
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
	int N;
	long long H, W;
	cin >> N >> H >> W;

	int ans = 0;
	for(int i=0; i<N; i++){
		long long A, B;
		cin >> A >> B;

		if(A>=H && B>=W)
			ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
/**
 * Worst Sportswriter
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;

import static java.lang.Integer.parseInt;

public class Main {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		int n = parseInt(br.readLine());
		int m = parseInt(br.readLine());
		List<Integer>[] indeg = new List[n + 1];
		List<Integer>[] outdeg = new List[n + 1];
		List<Integer> idx = new ArrayList<Integer>();
		Deque<Integer> rank = new ArrayDeque<Integer>();
		boolean alt = false;

		for (int i = 1; i <= n; i++) {
			indeg[i] = new ArrayList<Integer>();
			outdeg[i] = new ArrayList<Integer>();
			idx.add(i);
		}
		for (int i = 0; i < m; i++) {
			line = br.readLine();
			int a = parseInt(line.substring(0, line.indexOf(' ')));
			int b = parseInt(line.substring(line.indexOf(' ') + 1));
			indeg[b].add(a);
			outdeg[a].add(b);
		}
		//solve
		while (!idx.isEmpty()) {
			if (!alt) {
				int winners = 0;
				for (Integer winner : idx) {
					if (indeg[winner].size() == 0) winners++;
					if (winners > 1) {
						alt = true;
						break;
					}
				}
			}
			for (Integer winner : idx) {
				if (indeg[winner].size() == 0) {
					rank.add(winner);
					for (int loser : outdeg[winner]) {
						indeg[loser].remove(winner);
					}
					break;
				}
			}
			idx.remove(rank.peekLast());
		}
		rank.add(alt ? 1 : 0);
		for (int i : rank) {
			System.out.println(i);
		}
	}
}

Measured memory_bytes: 46668
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
  int n;
  cin>>n;
  while(n--){
    int a,b;
    cin>>a>>b;
    if(a==b){
      printf("%d\n",a);
      continue;
    }
    if(a>5){
      if(a<b){
        for(int i=a;i<=b;i++){
          printf("%d%c",i,i==b?'\n':' ');
        }
        continue;
      }
      for(int i=a;i<=9;i++)printf("%d ",i);printf("5");
      if(b==5){
        printf("\n");
        continue;
      }else printf(" ");
      if(b<5){
        for(int i=4;i>=b;i--)printf("%d%c",i,i==b?'\n':' ');
        continue;
      }
      for(int i=4;i>=0;i--)printf("%d ",i);
      for(int i=1;i<=5;i++)printf("%d ",i);
      for(int i=6;i<=b;i++)printf("%d%c",i,i==b?'\n':' ');
    }else{
      if(b<=5){
        if(a<b)for(int i=a;i<=b;i++)printf("%d%c",i,i==b?'\n':' ');
        else for(int i=a;i>=b;i--)printf("%d%c",i,i==b?'\n':' ');
        continue;
      }else{
        for(int i=a;i<=5;i++)printf("%d ",i);
        for(int i=6;i<=b;i++)printf("%d%c",i,i==b?'\n':' ');
      }
    }
  }
}

Measured memory_bytes: 1148
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
 	int w[n],v[n];
 	for(int i=0;i<n;i++)
 	cin>>w[i]>>v[i];
 	vector<vector<long long int>>dp(n+1,vector<long long int>(k+1,0));
 
 	for(int i=1;i<=n;i++){
 		for(int j=1;j<=k;j++){
 			if(j>=w[i-1])
 			dp[i][j]=max(dp[i-1][j-w[i-1]]+v[i-1],max(dp[i][j-1],dp[i-1][j]));
 			else 
 			dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		 }
		 
	 }

	 cout<<dp[n][k];
}

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

using namespace std;
 
typedef vector<int> V;
 
typedef struct{
    int t,n,m,s;
} Record;
 
int main(){
    int n,m,r,q;
   
    while(cin >> n >> m ,n + m){
	const int MAX = 1260-540;
 
	cin >> r;
	Record d[r];
	vector<V> v(m,V(MAX+1,-1)),cnt(m,V(MAX+1,0));
	int use[1001] = {0};
 
	for(int i = 0 ; i < r ; i++){
	    cin >> d[i].t >> d[i].n >> d[i].m >> d[i].s;
	    if(d[i].s){
		use[d[i].n-1] = d[i].t;
	    }
	    else{
		for(int j = use[d[i].n-1] ; j < d[i].t ; j++){
		    cnt[d[i].m-1][j-540] = 1;
		}
 
	    }
	}
 
	int ts,tt,sn;
	cin >> q;
	for(int i = 0 ; i < q ; i++){
	    cin >> ts >> tt >> sn;
 
	    sn--;
	    bool flg = true;
	    int ans = 0;
	    for(int i = ts ; i < tt ; i++){
		if(cnt[sn][i-540] != 0){
		    ans++;
		}
	    } 
	    cout << ans << endl;
	}
    }
    return 0;
}

Measured memory_bytes: 57996
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <math.h>
#include <algorithm>
#include <iomanip>
typedef long long ll;
using namespace std;

long double func1(long double a, long double b)
{
	long double ret = 0;

	while (1)
	{
		if (a < b)
		{
			a = a * 2;
			ret++;
		}
		else break;
	}

	return ret;
}

int main(void)
{
	long double n, k;
	cin >> n >> k;
	long double ans = 0;

	for (long double i = 1; i <= n; i++)
	{
		long double x = func1(i, k);
		long double tmp = (1 / n) * pow((0.5), x);
		ans += tmp;
	}

	cout << setprecision(12) << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double ans = 0.0, ang = 0.0;
    ang = abs(0.5 * (h * 60 + m) - 6.0 * m);
    ang = min(ang, abs(360.0 - ang));
    ans = a * a + b * b - 2.0 * a * b * cos(M_PI * ang / 180);
    ans = pow(ans, 0.5);
    cout << fixed << setprecision(13);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4228
def distance(a, b):
    s = 0
    for i in range(len(a)):
        s += (a[i] - b[i]) ** 2

    return s ** 0.5

N,D = map(int,input().split())

X = []

for i in range(N):
    X.append([int(x) for x in input().split()])

count = 0

for i in range(N):
    for j in range(i+1, N):
        if distance(X[i], X[j]).is_integer():
            count += 1

print(count)






Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] input = Console.ReadLine().Split(' ');

            int X= int.Parse(input[0]);
            int A = int.Parse(input[1]);
            int ans=1;//答え
            if (X < A)
            {
                ans = 0;
            }
            else if (X >= A)
            {
                ans = 10;
            }
            
            Console.WriteLine(ans);           
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
void chmin(int &a, int b) {if(a > b) a = b;}
void chmax(int &a, int b) {if(a < b) a = b;}

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int v, e;
    cin >> v >> e;
    int dis[v][v];
    rep(i,v) fill(dis[i], dis[i]+v, inf);
    while(e--){
        int a, b, c;
        cin >> a >> b >> c;
        dis[a][b] = c;
    }
    int dp[(1<<v)][v];
    rep(i,1<<v) fill(dp[i], dp[i]+v, inf);
    dp[1][0] = 0;
    for(int i = 0 ; i < (1<<v) ; i++){
        for(int j = 0 ; j < v ; j++){
            if(dp[i][j]==inf) continue;
            for(int k = 0 ; k < v ; k++){
                if(!(1&(i>>k))&&dis[j][k]!=inf){
                    int nexti = (1 << k) | i;
                    int nextd = dp[i][j] + dis[j][k];
                    dp[nexti][k] = min(dp[nexti][k], nextd);
                }
            }
        }
    }
    int ans = inf;
    for(int i = 0 ; i < v ;i++){
        if(dis[i][0] != inf){
            chmin(ans, dp[(1<<v)-1][i] + dis[i][0]);
        }
    }
    if(ans == inf) cout << -1 << endl;
    else cout << ans << endl;

}


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

int main(){
    int n;
    cin >> n;
    int s = 0;
    int tmp = n;
    while(tmp){
        s += tmp % 10;
        tmp /= 10;
    }

    if(n % s == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3604
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{max, min};
use std::collections::*;
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, $var:ident $($r:tt)*) => {
        let $var = parse_val!($it, usize);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

#[cfg(debug_assertions)]
macro_rules! debug {
    ($( $args:expr ),*) => { eprintln!( $( $args ),* ); }
}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($( $args:expr ),*) => {
        ()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    let n: Vec<usize> = it
        .next()
        .unwrap()
        .chars()
        .map(|x| x.to_digit(10).unwrap() as usize)
        .collect();
    let d = n.len();
    parse!(it, k: usize);
    let mut dp = vec![vec![vec![0; k + 1]; 2]; d + 1];
    dp[0][0][0] = 1usize;
    for i in 0..d {
        for j in 0..=9 {
            if j == 0 && n[i] == 0 {
                for l in 0..=k {
                    dp[i + 1][0][l] += dp[i][0][l]
                }
            } else if j == 0 {
                for l in 0..=k {
                    dp[i + 1][1][l] += dp[i][0][l]
                }
            } else if j == n[i] {
                for l in 0..k {
                    dp[i + 1][0][l + 1] += dp[i][0][l]
                }
            } else if j < n[i] {
                for l in 0..k {
                    dp[i + 1][1][l + 1] += dp[i][0][l]
                }
            }
            if j == 0 {
                for l in 0..=k {
                    dp[i + 1][1][l] += dp[i][1][l]
                }
            } else {
                for l in 0..k {
                    dp[i + 1][1][l + 1] += dp[i][1][l]
                }
            }
        }
    }
    println!("{}", dp[d][0][k] + dp[d][1][k]);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


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

int main()
{
  int r;
  cin >> r;
  if (r < 1200)
  {
    cout << "ABC" << endl;
  }
  else if (r < 2800)
  {
    cout << "ARC" << endl;
  }
  else
  {
    cout << "AGC" << endl;
  }
}


Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	int v[3][3];
	int i, j, k, n, x;
	bool match = false;

	for (i = 0; i < 3; i++) {
		for (j = 0; j < 3; j++) cin >> v[i][j];
	}
	cin >> n;
	while (n--) {
		cin >> x;
		for (i = 0; i < 3; i++) {
			for (j = 0; j < 3; j++) {
				if (v[i][j] == x) v[i][j] = -1;
			}
		}
	}

	for (i = 0; i < 3; i++) {
		if (v[i][0] + v[i][1] + v[i][2] == -3) match = true;
		if (v[0][i] + v[1][i] + v[2][i] == -3) match = true;
	}

	if (v[0][0] + v[1][1] + v[2][2] == -3)match = true; 
	if (v[0][2] + v[1][1] + v[2][0] == -3)match = true;

	if (match) cout << "Yes\n";
	else cout << "No\n";


	return 0;
}


Measured memory_bytes: 256
def show (nums):
    for i in range(len(nums)):
        if i!=len(nums)-1:
            print(nums[i],end=' ')
        else :
            print(nums[i])
 
n=int(input())
nums=list(map(int,input().split()))
show(nums)
for i in range(1,n):
    v=nums[i]
    j=i-1
    while (j>=0 and nums[j]>v):
        nums[j+1]=nums[j]
        j-=1
    nums[j+1]=v
    show(nums)


Measured memory_bytes: 5984
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n, m = map(int, input().split())
uf = UnionFind(n)
ans = n*(n-1)/2
l = [ans]
ab = []
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    ab.append([a, b])

for a, b in ab[::-1]:
    if uf.same(a, b):
        pass
    else:
        ans -= uf.size(a) * uf.size(b)
    uf.union(a, b)
    l.append(ans)
l.pop()
for i in l[::-1]:
    print(int(i))




Measured memory_bytes: 112984
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60 ;
constexpr ll mod=1e9+7 ;


int nxt[202020][20], pre[202020][20];
ll nsum[202020][20], psum[202020][20];
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    int j=0;
    rep(i,n){
        while(j < n && a[i]+k>a[j])j++;
        nxt[i][0]=j;
        nsum[i][0]=j;
    }
    j=n-1;
    for(int i=n-1;i>=0;--i){
        while(j>=0 && a[j]+k>a[i])j--;
        pre[i][0]=j;
        psum[i][0]=j;
    }
    rep(j,19)rep(i,n){
        if(nxt[i][j]!=n){
            nxt[i][j+1]=nxt[nxt[i][j]][j];
            nsum[i][j+1]=nsum[i][j]+nsum[nxt[i][j]][j];
        } else {
            nxt[i][j+1]=n;
        }
        if(pre[i][j]!=-1){
            pre[i][j+1]=pre[pre[i][j]][j];
            psum[i][j+1]=psum[i][j]+psum[pre[i][j]][j];
        } else {
            pre[i][j+1]=-1;
        }
    }
    int q;
    cin>>q;
    while(q--){
        int l,r;
        cin>>l>>r;
        --l;--r;
        ll lcnt = 1, rcnt = 1, lsum = l, cl = l, rsum = r, cr = r;
        for(int i=19;i>=0;i--){
            if(nxt[cl][i]<=r){
                lcnt += 1<<i;
                lsum += nsum[cl][i];
                cl = nxt[cl][i];
            }
        }
        for(int i=19;i>=0;i--){
            if(pre[cr][i]>=l){
                rcnt += 1<<i;
                rsum += psum[cr][i];
                cr = pre[cr][i];
            }
        }
        //assert(lcnt == rcnt);
        //cout << lcnt << " " <<lsum << " " << rsum <<endl;
        cout << rsum - lsum + lcnt << endl;
    }
    return 0;
}

Measured memory_bytes: 97716
#include<bits/stdc++.h>
using namespace std;
char s[100005];
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1);
	if(s[1]=='0'||s[n]=='1'){
		puts("-1");
		return 0;
	}
	for(int i=1;i<n;i++)
		if(s[i]!=s[n-i]){
			puts("-1");
			return 0;
		}
	int m=1;
	for(int i=1;i<n;i++){
		printf("%d %d\n",i+1,m);
		if(s[i]=='1')m=i+1;
	}
	return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>


using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

int main() {
	ll n,a,b;

	cin >> n >> a >> b; 

	ll cur;
	cin >> cur;
	ll ans = 0;

	rep(i, n - 1) {
		ll prev = cur;
		cin >> cur;

		ll d = cur - prev;
		ll w = d * a;
		if (w > b) {
			ans += b;
		} else {
			ans += w;
		}
	}	

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  cin>>h>>w;
  int m[h][w]={};
  for (int i=0;i<h;i++){
    for (int j=0;j<w;j++){
      char c;
      cin>>c;
      if (c=='#') m[i][j]=1;
      }
  }
  string ans="Yes";
  for (int y=0;y<h;y++){
    for (int x=0;x<w;x++){
      if (m[y][x]==1){
        bool chkflg=true;
        if ((y>0)&&(m[y-1][x]==1)) chkflg=false;
        if ((y<h-1)&&(m[y+1][x]==1)) chkflg=false;
        if ((x>0)&&(m[y][x-1]==1)) chkflg=false;
        if ((x<w-1)&&(m[y][x+1]==1)) chkflg=false;
        if (chkflg) ans="No";
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fr(i,a,n) for(i=a;i<n;i++)
#define frn(i,a,n) for(i=a;i<=n;i++)
#define vll vector<ll>
#define pll pair<ll,ll>
#define vp vector<pll>
#define ub upper_bound
#define lb lower_bound
//#define map map<ll,ll>
#define mem(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(),v.end()
#define bs binary_search
#define qll queue<ll>
#define sll set<ll>
#define ma 500000


int main()
{
    fastio;
    string s;
    cin>>s;
    int n =  s.length();
    if(s[n-1]=='s')
    cout<<s+"es";
    else
    cout<<s+'s';
}


Measured memory_bytes: 3652
N, Y = map(int, input().split())
for x in range(N+1):
  for y in range(N+1-x):
    z = N - x - y
    if 10000 * x + 5000 * y + 1000 * z == Y:
      print(x, y, z)
      exit()
else:
  print(-1, -1, -1)

Measured memory_bytes: 40684
using System;
using System.Collections.Generic;

namespace Elementary_data_structures
{
    class AOJ_Stack
    {
        static void Main(string[] args)
        {
            var token = Console.ReadLine().Split(' ');
            var stack = new Stack<int>();
            var num = 0;
            for (int i = 0; i < token.Length; i++)
            {
                if (int.TryParse(token[i], out num))
                    stack.Push(num);
                else
                    switch (token[i])
                    {
                        case "+":
                            stack.Push(stack.Pop() + stack.Pop());
                            break;
                        case "-":
                            var sub = stack.Pop();
                            stack.Push(stack.Pop() - sub);
                            break;
                        case "*":
                            stack.Push(stack.Pop() * stack.Pop());
                            break;
                        case "/":
                            var den = stack.Pop();
                            stack.Push(stack.Pop() / den);
                            break;
                    }
            }
            Console.WriteLine(stack.Pop());
        }
    }
}

Measured memory_bytes: 10164
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N,K;
    cin >> N >> K;
    vector<ll> A(N),accum(N+1),accumMax(N+1);
    for(int i = 0;i < N;i++){
        cin >> A[i];
        accum[i+1] = accum[i] + A[i];
        accumMax[i+1] = accumMax[i] + max(A[i],0LL);
    }
    ll maxi = 0;
    for(int i = 0;i < N-K+1;i++){
        //[a,b] -> [b+1] - [a]
        int a = i,b = i+K-1;
        ll maxSub = accumMax[N] - accumMax[b+1] + accumMax[a];
        ll accumSub = accum[b+1] - accum[a];
        maxi = max(maxi, maxSub + max(accumSub,0LL));
    }
    cout << maxi << endl;
}

Measured memory_bytes: 2560
fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val a = readLine()!!.split(" ").map { it.toInt() }
  var base = 1
  for (i in 1..100) {
    base *= 2
    if (a.map { it % base }.firstOrNull { it != 0 } != null) {
      println(i - 1)
      break
    }
  }
}


Measured memory_bytes: 38028
N, M = map(int, input().split())
for i in range(M, 0, -2):
    cur_start = (M - i) // 2
    print(cur_start + 1, cur_start + i + 1)
start = M + 2
for i in range(M -1, 0, -2):
    cur_start = start + (M -  1 - i) // 2
    print(cur_start, cur_start + i)

Measured memory_bytes: 9268
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
char a[N],b[N];
int main() {
  ios::sync_with_stdio(false);
  cin>>a+1>>b+1;
  int l=strlen(a+1),r=strlen(b+1);
  if(l<=r){
  	for(int i=1;i<=l;i++){
  		if(a[i]!=b[i])return cout<<"No\n",0;
  	}
  	cout<<"Yes\n";
  }else cout<<"No\n";
 	return 0;
}

Measured memory_bytes: 3604
#include <stdio.h>

int main(void) {
    int N, V[20], C[20];
    int X = 0, Y = 0;

    scanf("%d\n", &N);

    for (int i = 0; i < N; ++i) {
        scanf("%d", &V[i]);
    }
    for (int i = 0; i < N; ++i) {
        scanf("%d", &C[i]);
        if (V[i] > C[i]) {
            X += V[i];
            Y += C[i];
        }
    }

    printf("%d\n", (X - Y));

    return 0;
}


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

using namespace std;

int main(void)
{
    int N;
    cin >> N;
    vector<int> H(N);
    for (auto &i : H) cin >> i;
    int start = 0;
    int end = N; 
    bool flag;
    int ans = 0;
    while(start < end)
    {
        int min = 200;
        flag = false;
        end = N;
        for (int i = start; i < end; i++)
        {
            if (H[i] == 0)
            {
                if (flag)
                {
                    end = i;
                    break;
                }
                else start++;
            }
            else flag = true;
            if (min > H[i]) min = H[i];
        }
        for (int i = start; i < end; i++) H[i] -= min;
        ans += min;
        for (auto i : H) cerr << i << " ";
        cerr << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;

int main(){
    int A,B,K;cin>>A>>B>>K;
    REP(i,K){
        if(i&1){
            if(B&1) B--;
            A+=B/2;
            B/=2;
        }
        else{
            if(A&1) A--;
            B+=A/2;
            A/=2;
        }
    }
    cout<<A<<" "<<B<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define repe(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF 100000000

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    IO;

    ll N, M; cin >> N >> M;
    vector<pair<ll, ll> > pa(M);
    ll p, y;
    map<ll, pair<ll, ll> > ma;
    map<pair<ll, ll>, string> ma2;

    rep(i, M) {
        cin >> p >> y;
        pa[i] = make_pair(p, y);
        ma[i] = pa[i];
    }

    sort(all(pa));

    ll jj = 0;

    rep(i, M) {
        ++jj;
        string a=to_string(pa[i].first);
        if (a.size() == 1) { a = "00000"+a; }
        else if (a.size() == 2) { a = "0000" + a; }
        else if (a.size() == 3) { a = "000" + a; }
        else if (a.size() == 4) { a = "00" + a; }
        else if (a.size() == 5) { a = "0" + a; }
        string b = to_string(jj);
        if (b.size() == 1) { b = "00000" + b; }
        else if (b.size() == 2) { b = "0000" + b; }
        else if (b.size() == 3) { b = "000" + b; }
        else if (b.size() == 4) { b = "00" + b; }
        else if (b.size() == 5) { b = "0" + b; }
        ma2[pa[i]]=a + b;
        if (i < pa.size() - 1 && pa[i].first != pa[i + 1].first) jj = 0;
    }

    rep(i, M) {
        cout << ma2[ma[i]] << endl;
    }

}

Measured memory_bytes: 18468
#include <iostream>
using namespace std;
int main (void) {
    string s;

    cin >> s;

    int pcnt = 0;
    int gcnt = 0;
    for (int i = 0, len = s.length(); i < len; i++) {
        if (s[i] == 'g') {
            gcnt++;
        } else {
            pcnt++;
        }
    }

    cout << (gcnt - pcnt) / 2 << endl;

    return 0;
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main() {
  int h, w;
  while (true) {
    cin >> h >> w;
    if (h == 0 && w == 0) break;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 998244353
#define int long long
#define ll long long
#define EPS 0.000000001
#define ld long double
#define inf 5e18
#define N 500000
#define K 17



int32_t main()
{
    IOS;
    #ifndef ONLINE_JUDGE
    freopen("int.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
    int n;
    cin >> n;
    vector<int> v(n + 1);
    int sum = 0;
    for(int i = 1;i <= n;i++)
    {

        cin >> v[i];
        sum ^= v[i];
    }
    for(int i = 1;i <= n;i++)
    {
        cout << (sum ^ v[i]) << " ";
    }
    return 0;
    
}   

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

int N ;
int x,y,z ;

int main()
{
	cin >> N ;

	for( int i = 0 ; i < N ; i ++ )
	{
		cin >> x >> y >> z ;

		if( ((x*x) == ((y*y) + (z*z))) || ((y*y) == ((x*x) + (z*z))) || ((z*z) == ((x*x) + (y*y))) )
		{
			cout << "YES" << endl ;
		}
		else
		{
			cout << "NO" << endl ;
		}
	}
}

Measured memory_bytes: 1152
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <functional>
#include <cmath>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
typedef long long ll;
//必要な宣言

void solve();

int a, b, h;

int main() {
  cin >> a >> b >> h;

  solve();

  return 0;
}

void solve() {

  cout << (a+b)*h/2 << endl;

  return;
}


Measured memory_bytes: 256
import math


class Point:
    def __init__(self, x=None, y=None):
        self.x = x
        self.y = y

    def print(self):
        print(round(self.x, 8), round(self.y, 8))


def koch(d, p1, p2):
    if d == 0:
        return

    s = Point()
    u = Point()
    t = Point()

    theta = math.radians(60.0)

    s.x = p1.x * 2.0/3.0 + p2.x * 1.0/3.0
    s.y = p1.y * 2.0/3.0 + p2.y * 1.0/3.0

    t.x = p1.x * 1.0/3.0 + p2.x * 2.0/3.0
    t.y = p1.y * 1.0/3.0 + p2.y * 2.0/3.0

    u.x = (t.x - s.x) * math.cos(theta) - (t.y - s.y) * math.sin(theta) + s.x
    u.y = (t.x - s.x) * math.sin(theta) + (t.y - s.y) * math.cos(theta) + s.y

    koch(d-1, p1, s)
    s.print()
    koch(d-1, s, u)
    u.print()
    koch(d-1, u, t)
    t.print()
    koch(d-1, t, p2)


N = int(input())

p1 = Point(0, 0)
p2 = Point(100, 0)

p1.print()
koch(N, p1, p2)
p2.print()



Measured memory_bytes: 5856
n = int(input())
tango = []
count = 0
kaburi = 0
for i in range(n):
    tango.append(input())

for i in range(n-1):
    if tango[i][-1] != tango[i+1][0]:
            count = 1

for i in range(n):
    for j in range(n):
        if tango[i] == tango[j]:
            kaburi += 1



if count == 0 and kaburi == n:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    h,w,d = map(int,ipt().split())
    pl = [(-1,-1)]*(h*w+1)
    for i in range(h):
        a = [int(i) for i in ipt().split()]
        for j,aj in enumerate(a):
            pl[aj] = (i,j)
    ssl = [0]*(h*w+1)
    for i in range(d+1,h*w+1):
        ssl[i] = ssl[i-d]+abs(pl[i-d][0]-pl[i][0])+abs(pl[i-d][1]-pl[i][1])
    q = int(ipt())
    for _ in range(q):
        l,r = map(int,ipt().split())
        print(ssl[r]-ssl[l])

    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 77636
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    A, B, C = map(int, input().split())
    if A < C < B or B < C < A:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()


Measured memory_bytes: 9460
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
#define endl '\n'
#define pb push_back
#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

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

  int n; cin >> n;

  int sum = 0;
  int a[110];

  rep(i, n) {
    cin >> a[i];
    sum += a[i];
  }

  double average = double(sum) / n;
  double tmp = INF;

  rep(i, n) {
    tmp = min(tmp, abs(average - a[i]) );
  }

  rep(i, n) {
    if( abs(average - a[i]) == tmp ) {
      cout << i << endl;
      return 0;
    }
  }

}

Measured memory_bytes: 256
# じょえチャンネルおもしろいよ～～～
# https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ

s=input()
t=input()
ans=0
for i in range(len(s)):
  if s[i]!=t[i]:ans+=1
print(ans)


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll A, B, C;
	cin >> A >> B >> C;
	if (B<C) swap(B, C);
	if (A<B) swap(A, B);
	cout << 10*A + B + C << endl;
    return 0;
}

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

using namespace std;

using ll = long long;

bool is_prime(int n) {
    if (n % 2 == 0) return false;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

vector<int> divisor(int n) {
    vector<int> res;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            res.emplace_back(i);
            if (i != n / i) res.emplace_back(n / i);
        }
    }
    return res;
}

map<int, int> prime_factor(int n) {
    map<int, int> res;
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}

vector<int> sieve(int n) {
    vector<int> res;
    vector<bool> is_prime(n + 1, true);
    is_prime[0] = false;
    is_prime[1] = false;
    for (int i = 2; i <= n; i++) {
        if (!is_prime[i]) continue;
        res.emplace_back(i);
        for (int j = 2 * i; j <= n; j += i) is_prime[j] = false;
    }
    return res;
}

bool judge(vector<int>& hoge) {
    int sum = 0;
    for (int i = 0; i < 5; i++) {
        sum += hoge[i];
    }
    return !is_prime(sum);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> hoge = sieve(55555);
    vector<int> ans;
    for (int x : hoge) {
        if (x % 5 == 1) {
            ans.push_back(x);
            if (ans.size() == n) break;
        }
    }
    cout << ans[0];
    for (int i = 1; i < n; i++) {
        cout << " " << ans[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int parent(int i) { return i / 2; }
int left(int i)   { return 2 * i; }
int right(int i)  { return 2 * i + 1; }

int main(){
  int A[250], H, i;

  scanf("%d", &H);
  for(i = 1; i <= H; i++){
    scanf("%d", &A[i]);
  }

  for(i = 1; i <= H; i++){
    printf("node %d: key = %d, ", i, A[i]);
    
    if(i/2 >= 1){
      printf("parent key = %d, ", A[i/2]);
    }
    
    if(2*i <= H){
      printf("left key = %d, ", A[2*i]);
    }
	
    if(2*i+1 <= H){
      printf("right key = %d, ", A[2*i+1]);
    }
      
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2052
#include <iostream>

int main() {
  std::string s, t;
  std::cin >> s >> t;
  std::sort(s.begin(), s.end());
  std::sort(t.begin(), t.end(), std::greater<int>());
  if (s < t) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
}


Measured memory_bytes: 256
def bellman_ford(edges, start, n):
    inf = float('INF')
    costs = [inf] * n
    predecessors = [-1] * n
    costs[start]= 0

    for _ in range(n-1):
        for e in edges:
            u,v,c = e
            if costs[v] > costs[u] + c:
                costs[v] = costs[u] + c
                predecessors[v] = u

    ans = costs[-1]
    for u,v,c in edges:
        if costs[v] > costs[u] + c:
            costs[v] = costs[u] + c

    return -ans if costs[-1] == ans else 'inf'

n,m = map(int, input().split())
edges = []
for _ in range(m):
    a,b,c = map(int, input().split())
    edges.append((a-1,b-1,-c))
print(bellman_ford(edges, 0, n))


Measured memory_bytes: 3316
#!/usr/bin/env python3


def main():
    S = list(input())
    judge = True
    if S[0] == "A":
        S[0] = S[0].lower()
    else:
        judge = False
    if S[1] == "C":
        judge = False
    if S[2:-1].count("C") == 1:
        for n, i in enumerate(S):
            if 2 <= n <= len(S) - 1:
                if i == "C":
                    S[n] = S[n].lower()
    else:
        judge = False
    if S[-1] == "C":
        judge = False
    S = "".join(S)
    if S.islower() == False:
        judge = False
    if judge:
        print("AC")
    else:
        print("WA")


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
int n;
ll x;
ll a[2048];
ll md[2048][2048];
int main()
{
	scanf("%d%lld", &n, &x);
	for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
	for (int i = 0; i < n; i++)
	{
		md[i][i] = a[i];
		for (int j = 1; j < n; j++)
			md[i][(i + j) % n] = min(a[(i + j) % n], md[i][(i + j - 1) % n]);
	}
	ll ans = -1;
	for (int y = 0; y < n; y++)
	{
		ll tot = x * y;
		for (int i = 0; i < n; i++)
		{
			tot += md[i][(i + y) % n];
		}
		if (ans<0 || ans>tot) ans = tot;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 33152
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
int main()
{
    ll a,b,c,d ;
    while(cin >>a >> b >> c >> d)
    {
       ll aa = a*b ;
        ll bb = c*d ;
        cout << max(aa,bb) << endl ;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
//printf("%.12Lf\n",c);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int max(int a,int b){
	if(a>=b)return a;
	else return b;
}
int min(int a,int b){
	if(a>=b)return b;
	else return a;
}	
int n2[41];		
int nis[41]; 
int nia[41];
int mody[41];
int nn;
int com(int n,int y){
	int ni=1;
	for(int i=0;i<41;i++){
		n2[i]=ni;
		ni*=2;
	}
	int bunsi=1,bunbo=1;
	rep(0,i,y)bunsi=(bunsi*(n-i))%mod;
	rep(0,i,y)bunbo=(bunbo*(i+1))%mod;
	mody[0]=bunbo;
	rep(1,i,41){
		bunbo=(bunbo*bunbo)%mod;
		mody[i]=bunbo;
	}
	rep(0,i,41)nis[i]=0;
	nn=mod-2;
	for(int i=40;i>=0;i-=1){
		if(nn>n2[i]){
			nis[i]++;
			nn-=n2[i];
		}
	}
	nis[0]++;
	rep(0,i,41){
		if(nis[i]==1){
			bunsi=(bunsi*mody[i])%mod;
		}
	}
	return bunsi;
}
int yakuwa(int n){
	int sum=0;
	rep(1,i,sqrt(n+1)){
		if(n%i==0)sum+=i+n/i;
		if(i*i==n)sum-=i;
	}
	return sum;
}	
bool hei(int n){
	rep(0,i,100){
		if(i*i==n){
			return true;
		}
	}
	return false;
}
int pow(int b,int a){
	int aa=1;
	rep(0,i,a)aa*=b;	
	return aa;
}		
int a[114514],b[114514];
int x[114514],y[114514],c[114514];
signed main(){
	ic(n) ic(m) ic(k)
	rep(0,i,n)cin>>a[i];
	rep(0,i,m)cin>>b[i];
	rep(0,i,k){
		cin>>x[i];
		cin>>y[i];
		cin>>c[i];
	}
	int ans=mini(a,0,n)+mini(b,0,m);
	rep(0,i,k){
		if(a[x[i]-1]+b[y[i]-1]-c[i]<ans){
			ans=a[x[i]-1]+b[y[i]-1]-c[i];
		}
	}
	c(ans)
}	

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
double n, a, b;

int main(){
	cin >> n;
	string ans = "";
	cin >> a >> b;
	if(a > b){
		swap(a,b);
	}
	if(n > b){
		ans = "NG";
	}
	else{
		if(n >= a){
			ans = "OK";
		}
		else{
			double aux = ceil(a/n);
			if(aux * n <= b){
				ans = "OK";
			}else{
				ans = "NG";
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3756
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int ans = 0;
		int outlet = 1;
		while (outlet < B) {
			--outlet;
			outlet += A;
			ans++;
		}
		System.out.println(ans);
		sc.close();
	}
}

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

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]


    token = lines[0].split(" ")
    a = int(token[0])
    b = int(token[1])
    c = int(token[2])

    return (a, b, c)


def solve(a, b, c):


    

    return max(0, c - (a -b))


def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()
	

Measured memory_bytes: 3064
#include<cmath>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<functional>
#define INF 1e16
#define N (1000000007)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,P> Q;


ll sum[200010];

int A(int x){
    if(x>=0)return x;
    else return -x;
}

int main(void){
    int n;
    cin>>n;
    vector<int>a(n),sing;
    map<int,ll>m1,m2;
    for(int i=0;i<n;i++){
        cin>>a[i];
        m1[a[i]]++;
    }
    for(auto itr = m1.begin();itr!=m1.end();++itr){
        int x = itr->first;
        ll y = itr->second;
        if(y==1){
            sing.push_back(x);
        }
        else m2[x]++;
    }
    sort(sing.begin(),sing.end());
    ll ans = 0;
    for(int i=0;i<sing.size();i++){
        bool flag = true;
        for(int j=1;j*j<=sing[i];j++){
            if(sing[i]%j==0){
                int t = sing[i]/j;
                if(m2[j]!=0)flag =false;
                if(m2[t]!=0)flag = false;
            }
        }
        if(flag)ans++;
        m2[sing[i]]++;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 55736