akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

#define debug(x) cout << #x << " = " << x << endl;
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define FOR(it, b, e) for (typeof(b) it = (b); it != (e); ++it)
#define MSET(c, v) memset(c, v, sizeof(c))

const int INF = 0x3F3F3F3F; 
const int NEGINF = 0xC0C0C0C0;
const int NULO = -1;
const double EPS = 1e-10;
const ll mod = 998244353;

inline int cmp(double x, double y = 0) 
{  
  if(fabs(x - y) < EPS)
    return 0;
  return x > y ? 1 : -1;
}

ll exp(ll a, ll b)
{
  ll ans = 1;
  while(b)
  {
    if(b & 1)
      ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}

const int maxn = 100 + 10;
const int maxm = 5000;

int d[maxn], c[maxn];

struct node
{
  int v;
  ll a,b;
};

vector<node>graph[maxn];

struct state
{
  int no;
  ll t, qts;
  state(){}
  state(int no, ll t, ll qts): no(no), t(t), qts(qts){}

  bool operator < (const state &s) const
  {
    return t < s.t;
  }
};

ll dist[maxn][maxm + 10];
bool vis[maxn][maxm];

int main()
{
  MSET(dist, INF);
  int n,m,s;
  cin >> n >> m >> s;
  for(int i = 1 ; i <= m; i++)
  {
    int u,v,a,b;
    cin >> u >> v >> a >> b;
    graph[u].push_back({v,a,b});
    graph[v].push_back({u,a,b});
  }

  for(int i = 1; i <= n ; i++)
  {
    cin >> c[i] >> d[i];
  }
  s = min(s, maxm);
  multiset<state>q;
  q.insert(state(1,0,s));
  dist[1][s] = 0;
  while(q.size())
  {
    auto at = *q.begin();
    q.erase(q.begin());
    if(at.t != dist[at.no][at.qts])
      continue;
    if(vis[at.no][at.qts])
      continue;
    vis[at.no][at.qts] = true;
    int u = at.no;
    ll t = at.t;
    ll qts = at.qts;
    // debug(u);
    // debug(t);
    // debug(qts);
    // cout << "\n\n\n";
    for(const auto &e: graph[u])
    {
      ll a = e.a;
      ll b = e.b;
      int v = e.v;
      if(qts >= a && dist[v][qts - a] > t + b)
      {
        dist[v][qts - a] = t + b;
        q.insert(state(v, t + b, qts - a));
      }
    }
    if(t + d[u] < dist[u][min(ll(maxm), qts + c[u])])
    {
      dist[u][min(ll(maxm), qts + c[u])] = t + d[u];
      q.insert(state(u, t + d[u], min(ll(maxm), qts + c[u])));
    }
  }

  for(int i = 2; i <= n ; i++)
  {
    cout << *min_element(dist[i], dist[i]+ maxm + 2) << endl;
  }


  return 0;
} 

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

int main() {
	long long int N, K, Q;
	cin >> N >> K >> Q;
	if (K > Q) {
    	for (int i = 0; i < N; ++i) {
        	cout << "Yes" << endl;
        }
    	return 0;
    }
	
    long long int ans[N] = { 0 };
	for (int i = 0; i < Q; ++i) {
    	long long int A_i;
    	cin >> A_i;
    	++(ans[A_i-1]);
    }
	for (int i = 0; i < N; ++i) {
    	if (ans[i] > Q - K)
        	cout << "Yes" << endl;
    	else 
        	cout << "No" << endl;
    }
}

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

int main(){
  int N, Y;
  cin >> N >> Y;
  Y /= 1000;
  int x,y,z;
  for(y = 0; y <= N; ++y){
    int z_9 = 10 * N - Y - 5 * y;
    if(z_9 >= 0 && z_9 % 9 == 0 && z_9 / 9 <= N){
      z = z_9 / 9;
      x = N - y - z;
      if(x < 0 || x > N || 10 * x + 5 * y + z != Y) continue;
      printf("%d %d %d\n", x, y, z);
      return 0;
    }
  }
  cout << "-1 -1 -1\n";
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int inputa = sc.nextInt();
		int inputb = sc.nextInt();
		int inputc = sc.nextInt();

		int space = inputa;
		inputa = inputb;
		inputb = space;

		space = inputa;
		inputa = inputc;
		inputc = space;

		System.out.println(inputa + " " + inputb + " " + inputc);
	}
}

Measured memory_bytes: 39300
IDENTIFICATION DIVISION.
PROGRAM-ID. Main.
DATA DIVISION.
WORKING-STORAGE       SECTION.
01  N  PIC 9(01).
01  A  PIC X(01) VALUE SPACE.
01  B  PIC X(01) VALUE SPACE.
01  C  PIC X(02) VALUE SPACE.
01  A-9  PIC 9(01).
01  B-9  PIC 9(01).
01  C-9  PIC 9(02).
01  D-9  PIC 9(01).
procedure division.
ACCEPT N.
if N = 1
then
 display 'Hello World'
else
 if N = '2'
 then
  ACCEPT A
  ACCEPT B
  MOVE A to A-9 
  MOVE B to B-9
  compute C-9 = A-9 + B-9
  if C-9 > 9
  then
  display C-9
  else
  MOVE C-9 to D-9
  display D-9
  end-if
  
 else
  display "ERR!"
 end-if
end-if.
stop run.



Measured memory_bytes: 384
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			long n = cin.Long();
			long m = cin.Long();
			long d = cin.Long();

			long one = d == 0 ? n : Math.Min(n, 2 * d);
			long two = n - one;
			double r = (one + 2 * two) / (double)(n * n);
			double ans = r * (m - 1);
			Console.WriteLine(ans);
		}
	}

	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private string[] buf_;
		private int index_;
		Func<string> reader_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll X;cin>>X;
    ll ans=0;
    ans+=X/500*1000+(X%500)/5*5;
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{   
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    for(int& x:a){
        cin>>x;
    }
    int dp[k+1];
    dp[0] =0;
    for(int i=1;i<=k;i++){
        dp[i] = 0;
        for(int x:a){
            if(i>=x && dp[i-x]==0){
                dp[i] =1;
                break;
            }
        }
    }
    if(dp[k]==1) cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}

Measured memory_bytes: 3996
#include <algorithm>
#include <array>
#include <bitset>
#include <cstdint>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <memory>
#include <vector>

constexpr std::int64_t INF = 1ull << 50;

auto main() -> int {
  int N, M;
  std::cin >> N >> M;

  std::vector<int> t(M, 0);
  for (auto i = 0; i < N; ++i) {
    int Ki;
    std::cin >> Ki;
    for (auto j = 0; j < Ki; ++j) {
      int Aij;
      std::cin >> Aij;
      t[Aij - 1]++;
    }
  }

  const auto ans = std::count(t.cbegin(), t.cend(), N);
  std::cout << ans << '\n';
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a, b;
    cin >> a >> b;
    if(a < b){
        cout << "a < b" << endl;
    }
    else if(a > b){
        cout << "a > b" << endl;
    }
   else{
       cout << "a == b" << endl;
   } 
    
    
    
}



Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	
	cout << 3*N*N << endl;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
  }
  vector<int> ret(N, 0);
  for(int i = 0; i < N; ++i) {ret[a[i]-1] = i+1;}
  for(auto& r : ret) cout << r << " ";
  return 0;
}

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

// DAME:

/*
    最大公約数の素因数の個数+1

    a, bの公約数　＝ GCD(a, b)の約数
*/

// ユークリッドの互除法: x>y
ll gcd(ll x, ll y){
    if(y==0) return x;
    return gcd(y, x%y);
}

// 素因数分解: vector(素因数, 数)
vector<pair<ll, int> > factorize(ll n){
    vector< pair<ll, int> > res;
    // nが変化していく
    for(ll i=2; i*i <= n; ++i){
        if(n%i){
            continue;
        }
        res.emplace_back(i, 0);
        while(n%i==0){
            n/=i;
            res.back().second++;
        }
    }
    if(n != 1){
        res.emplace_back(n, 1);
    }
    return res;
}

int main() {
    ll a, b;
    cin >> a >> b;
    ll g = gcd(a, b);

    auto f = factorize(g);
    int ans = f.size()+1;
    cout << ans << endl;
    return 0;
}




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

const int M = 5;
long long sum;

long long dfs(vector<long long> A, vector<long long> B){
  if(A.size() == 3){
    sum += B.at(A.at(0)) * B.at(A.at(1)) * B.at(A.at(2));
  }
  int prev_last;
  if(A.empty()) prev_last = 1;
  else prev_last = A.back() + 1;

  for(int i = prev_last; i <= M; i++){
    A.push_back(i);
    dfs(A, B);
    A.pop_back();
  }
  return sum;
}

int main(){
  long long N;
  cin >> N;
  long long cntM, cntA, cntR, cntC, cntH;
  cntM = 0;
  cntA = 0;
  cntR = 0;
  cntC = 0;
  cntH = 0;
  for(auto i = 0; i < N; i++){
    string S;
    cin >> S;
    if(S.at(0) == 'M') cntM++;
    else if(S.at(0) == 'A') cntA++;
    else if(S.at(0) == 'R') cntR++;
    else if(S.at(0) == 'C') cntC++;
    else if(S.at(0) == 'H') cntH++;
  }
  vector<long long> A;
  vector<long long> B(6);
  B.at(1) = cntM;
  B.at(2) = cntA;
  B.at(3) = cntR;
  B.at(4) = cntC;
  B.at(5) = cntH;
  long long ans = dfs(A, B);
  cout << ans << endl;
}


Measured memory_bytes: 256
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N = sc.nextInt()
    val S = Array.fill(N)(sc.nextInt())
    val SUM = S.sum
    val NONZERO = S.filter(_ % 10 != 0)

    val r = if (SUM % 10 == 0) (if (NONZERO.length > 0) SUM - NONZERO.min else 0) else SUM
    println(r)
  }

}


Measured memory_bytes: 25660
#include <iostream>
#include <stdlib.h>

using namespace std;

int main(void){
  char S[11];
  char str[3];
  cin >> S;

  int i;
  int num;
  int min = 753; //とりうる絶対値の最大値
  for(i=0; S[i+2] != '\0'; i++){
    //strに3文字を格納
    str[0] = S[i];  str[1] = S[i+1];  str[2] = S[i+2];
    //strをintegerに変換
    num = atoi(str);
    //絶対値をとる
    num = abs(753-num);
    //最小値の更新
    if(min > num)
      min = num;
  }

  cout << min << endl;
  
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/perl

use strict;
use warnings;

my ($n1, $n2);
{
    my $in = <STDIN>;
    ($n1, $n2) = split(" ", $in);
}
my $gcd = gcd($n1, $n2);
my $ans = $n1/$gcd*$n2;

print "$ans\n";

sub gcd {
    my @n = sort {$a <=> $b} @_;
    my $remainder = $n[1] % $n[0];
    return $n[0] if $remainder == 0;
    return gcd($n[0], $remainder);
}

Measured memory_bytes: 640
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        a: u64,
        p: u64,
    }

    let ans = (a * 3 + p) / 2;
    println!("{}", ans);
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n;
  cin>>n;
  vector<int> a(n);
  vector<int> rev(n+1);
  rep(i,n) {
    cin>>a[i];
    rev[a[i]]=i+1;
  }
  set<int> idxs;
  idxs.insert(0);
  idxs.insert(n+1);
  ll ans=0;
  repeat(a, 1, n+1){
    ll l = *(--idxs.lower_bound(rev[a]));
    ll r = *(idxs.lower_bound(rev[a]));
    ans+=1LL*a*(rev[a]-l)*(r-rev[a]);
    //cout << a << " " << rev[a] << " " << l << " " << r << endl;
    idxs.insert(rev[a]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define pb push_back
#define f first
#define s second
using namespace std;


ll gcd(ll a, ll b)   //Function to find gcd of two numbers
{
    if (a == 0)
    return b;
    return gcd(b % a, a);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int k;
    cin>>k;
    
    if(k%2==0 || k%5==0)
    cout<<-1<<endl;
    else
    {
        int curr = 7%k;
        
        int ans=1;
        
        while(curr!=0)
        {
            curr = curr*10 + 7;
            curr = curr%k;
            
            ans++;
        }
        
        cout<<ans<<endl;
    }
    
    return 0;
}


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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    string S;
    cin >> S;
    cout << (S[1] == 'B' ? "ARC" : "ABC") << endl;
    return 0;
}


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

import sys


def prob_b(n, a, b):
    x = int(n / (a + b)) * a
    y = min(n % (a + b), a)
    print(x+y)


if __name__ == '__main__':
    #args = sys.argv
    #n = args[1]
    #a = args[2]
    #b = args[3]
    n, a, b = map(int, input().split())
    prob_b(n,a,b)


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

int main(){
  string s;
  getline(cin,s);
  string a;
  for(string::iterator it=s.begin();it!=s.end();it++){
    if(*it==' '||*it=='.'){
      a.push_back(*it);
      continue;
    }
    a.push_back((char)(*it+'A'-'a'));
  }
  cout<<a<<endl;
  return 0;
}

Measured memory_bytes: 1176
#include <cctype>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

int convert[255];
const string str = "ixcm";

int next() {
	string s;
	cin >> s;

	int res = 0, coefficient = 1;
	for(int i = 0; i < (int)s.size(); ++i) {
		if(isdigit(s[i])) {
			coefficient = s[i] - '0';
		}
		else {
			res += convert[s[i]] * coefficient;
			coefficient = 1;
		}
	}

	return res;
}

string to_mcxi(int n) {
	string res;
	for(int i = 0; i < 4; ++i) {
		int tmp = n % 10;
		if(tmp) {
			res = str[i] + res;
			if(tmp > 1)
				res = string(1, tmp + '0') + res;
				
		}

		n /= 10;
	}

	return res;
}

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

	int num = 1;
	for(int i = 0; i < (int)str.size(); ++i) {
		convert[str[i]] = num;
		num *= 10;
	}

	int n;
	cin >> n;

	for(int i = 0; i < n; ++i) {
		int a = next(), b = next();
		cout << to_mcxi(a + b) << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef std::pair<int,int> pair2;
typedef std::pair<int,pair2> pair3;
const ll INF = 1LL<<60;
const  ll NUM=10e8+7;


int main(){
  ll N;
  cin>>N;
  ll D[N][2];
  ll count=0;
  ll ans=0;
  for(ll i=0;i<N;i++){
  cin>>D[i][0]>>D[i][1];
  if(D[i][0]==D[i][1]){
 	 count++;
  }
    else{
    count=0;
    }
    if(count>=3){
    ans=1;
      break;
    }
  }

if(ans==1){
cout<<"Yes"<<endl;
}
  else{
  cout<<"No"<<endl;
  }
  
 
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 
#define BOOST        ios::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define AZ(x)        x.begin(),x.end()
#define fi           first
#define se           second
#define pb           push_back
#define emp          emplace_back
#define mp           make_pair
#define mt           make_tuple
#define debug(x)     cerr << #x << " : " << x << endl;


template<typename T> using V = vector<T>;
template<typename T, typename U> using P = pair<T,U>;

typedef long long ll;
typedef long double ld;


template<typename T>
// for super_map add a parameter Y above and replace "null_type" with "Y"

// set with two additional super powers
    // find_by_order(int k) - returns k'th smallest element (0-indexed)
    // order_of_key(int k) - returns number of elements strictly smaller than k.
using super_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


const int mod=1e9+7,N=1e5+5;
const ll INF = 1e18;



ll power(ll a,ll b)
{
    ll result = 1;

    while(b)
    {
        if(b&1)
            result = (result*a);
        b >>= 1, a = (a*a);
    }
    return result;
}

ll super_rand(ll n) // Random number from set [0,n-1]
{
    uniform_int_distribution<ll> uid(0, n - 1);
    return uid(rng);
}



/*

1. Make sure you're taking all the inputs.
2. In case of nested loops, remember to use different variables.
3. If in doubt, do int -> ll
4. Don't fight the question, try solving the next one.
5. ffs (positon of first set bit), clz (leading 0s, max->32), ctz (trailing 0s), popcount (set bits). Don't use any of these on 0;
*/



//  Don't code anything above this //



        
int main() 
{ 
    BOOST

    int n;
    cin>>n;

    map<string,ll> m;
    string s;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        sort(begin(s),end(s));
        m[s]++;
    }

    ll ans = 0;
    for(auto i : m)
    { 
        ll cur = i.se * (i.se-1);
        cur/=2ll;  
        ans += cur;
    }
    cout<<ans<<"\n";
    return 0;    
}

 
  

Measured memory_bytes: 11264
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{ll n,i;
cin>>n;
ll a[n],b[n];
for(i=0;i<n;i++){
    cin>>a[i];
    cin>>b[i];
}
ll flag=0;
for(i=0;i<n;i++){
    if(a[i]==b[i]){
        if(a[i+1]==b[i+1]){
            if(a[i+2]==b[i+2]){
                flag++;
                break;
            }
        }
    }
}
  
  if(flag==0){
      cout<<"No";
  }  
  else{
      cout<<"Yes";
  }
    return 0;
}



Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main{

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		String xx = sc.next();
		String yy = sc.next();
		char[] x = xx.toCharArray();
		char[] y = yy.toCharArray();
		int[][] L = new int[x.length + 1][y.length + 1];

		for (int i = 1; i <= x.length; i++)
			for (int j = 1; j <= y.length; j++) {
				if (x[i - 1] == y[j - 1]) 
					L[i][j] = L[i - 1][j - 1] + 1;
				else
					L[i][j] = Math.max(L[i][j - 1], L[i - 1][j]);

//				System.out.println("   "+Arrays.toString(y));
				
//			for (int i1 = 0; i1 <= x.length; i1++)
//				System.out.println(Arrays.toString(L[i1]));
//			System.out.println();
			}
//		System.out.println("-------------------");
		boolean[] take = new boolean[x.length];

		int i = x.length;
		int j = y.length;

		
		while (i > 0 && j > 0) {

			while (j > 0 && L[i][j] == L[i][j - 1])
				j--;

			while (i > 0 && L[i][j] == L[i - 1][j])
				i--;

			
			if(i>0)
				take[i - 1] = true;
			i--;
			j--;
//			for (int i1 = 0; i1 <= x.length; i1++)
//				System.out.println(Arrays.toString(L[i1]));
//			System.out.println();
		}
//		System.out.println("   "+Arrays.toString(y));
		
//		for (int i1 = 0; i1 <= x.length; i1++)
//			System.out.println(Arrays.toString(L[i1]));
		int ctr = 0;
		for (Boolean b : take) {
			if (b)
				System.out.print(x[ctr]);
			ctr++;
		}
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}


Measured memory_bytes: 83672
import java.util.*;
 
public class Main {
    static Scanner scanner = new Scanner(System.in);
 
    public static void main(String[]$) {
        String a = scanner.next();
        String b = scanner.next();
        String c = scanner.next();
        System.out.println(a.charAt(a.length() - 1) == b.charAt(0) && b.charAt(b.length() - 1) == c.charAt(0) ? "YES" : "NO");
    }
}

Measured memory_bytes: 23252
#include<iostream>
#include<string>
#include<cstring>
#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;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

int main(){
  int N, M; cin >> N >> M;
  if(N==M) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main(){
  int n;
  cin >> n;
  n = n % 10;
  if(n == 2 || n == 4){
    cout << "hon" << endl;
  }
  if(n == 5 || n == 7){
    cout << "hon" << endl;
  }
  if(n == 9){
    cout << "hon" << endl;
  }
  if(n == 0 || n == 1){
    cout << "pon" << endl;
  }
  if(n == 6 || n == 8){
    cout << "pon" << endl;
  }
  if(n == 3){
    cout << "bon" << endl;
  }
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1e9)
#define LINF (long long int)(1e18)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}



int main(void){
  fast_io
  cout<<fixed<<setprecision(15);
  int n;
  cin >> n;
  int ans = 8;
  int s = 600;
  rep(i, 8){
	  if(s > n){
		  cout << ans << endl;
		  break;
	  }
	  s += 200;
	  ans--;
  }

  return 0;
}


Measured memory_bytes: 3656
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int N;

int main() {
	cin >> N;
	N %= 10;
	switch (N) {
	case 0:
	case 1:
	case 6:
	case 8:
		cout << "pon" << endl;
		break;
	case 3:
		cout << "bon" << endl;
		break;
	default:
		cout << "hon" << endl;
		break;
	}
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 1e8;
typedef long long ll;
ll mod = 1e9+7;
long long fast_exp(long long a, long long b)
{
    if(b == 0)
	   return 1;
    else
    {
	   long long res = 1;
	   res = fast_exp(a,b/2);
	   res = (res*res)%mod;
	   if(b%2 == 1)
		  res = (res*a)%mod;
	   return res;
 
    }
}
const ll N = 1e5;

 

 
int main()
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);
	ll n;
	cin>>n;
	if(n%2 == 0)
	{
		ll ans = 0;
		n = n/2;
		ll p5 = 5;
		while(p5 <= n)
		{
			ans += n/p5;
			p5 = p5 * 5;
		}
		cout<<ans<<endl;
	}
	else
		cout<<0<<endl;
	return 0;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;
static const long long INF = 1<<31;

ll ans;
string s;
map<ll, ll> m;
 
int main(void) {
    cin >> s;
    int n = sz(s);
    
    ll r = 0, t = 1;
    m[0]++;
    for (int i=n-1; i>=0; i--) {
      r = (r + (s[i]-'0')*t)%2019;
      ans += m[r];
      m[r]++;
      t = (t*10) %2019;
    }
 
    cout << ans << endl;
 
	return 0;
}


Measured memory_bytes: 3688
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		for (int i = 0; i < 3; i++) {
			sc.next();
		}
		int e = sc.nextInt();
		int k = sc.nextInt();
		if (k >= e - a) {
			System.out.println("Yay!");
		} else {
			System.out.println(":(");
		}
	}
}


Measured memory_bytes: 22228
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>

using namespace std;
typedef long long ll;

char S[20] = {};
ll k = 0, point = 0;

int main() {
	cin >> S;
	for (int i = 0; i < 20; i++) {
		if (S[i] == 'o')point++;
		if (S[i] == NULL) {
			k = i;
			break;
		}
	}
	if (15 - k + point >= 8) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
/**
 *   Praveen Fulera    
**/


// #pragma GCC optimize("O3", "unroll-loops")
// #pragma GCC target("avx2")

#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;

#define endl '\n'
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define point pair <double, double>
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl

void __print(int x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "\n[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

const int mod = 1e9 + 7;
//const int mod = 998244353;

void solve(){
  set <int> s;
  int x, y, z; cin >> x >> y >> z;
  s.insert(x); s.insert(y); s.insert(z);
  cout << ((s.size() == 2)?"Yes\n" : "No\n");
}

signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
        clock_t t1 = clock();
  int t = 1; //cin >> t;
  while(t--){      
     solve();
  }
        clock_t t2 = clock();
  //cout << "Time-Taken: " << ((t2 - t1) / (double)CLOCKS_PER_SEC) << endl;      
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <vector>
using namespace std;

int insertionSort(int *A, int n, int g, long cnt) {
    for (int i=g; i<n; i++) {
        int v = A[i];
        int j = i - g;
        
        while(j>=0 && A[j]>v) {
            A[j+g] = A[j];
            j = j - g;
            cnt++;
        }
        A[j+g] = v;
    }
    
    return cnt;
}


void shellSort(int *A, int n) {
    long cnt = 0;
    // int m = (int)sqrt(n);
    // int G[m];
    vector<int> G;
    
    for (int h=1; ; ) {
        if (h > n) break;
        G.push_back(h);
        h = 3*h + 1;
    }
    
    // G[0] = (int)(n/3);
    // for (int i=0; i<m; i++) {
    //     if(i>0) G[i] = (int)(G[i-1]/3);
    //     if(i>=m-1) G[i] = 1;
    //     cnt = insertionSort(A, n , G[i], cnt);
    // }
    
    for (int i=G.size()-1; i>=0; i--) {
        cnt = insertionSort(A, n , G[i], cnt);
    }
    
    printf("%d\n", G.size());
    printf("%d", G[G.size()-1]);
    for (int i=G.size()-2; i>=0; i--) printf(" %d", G[i]);
    printf("\n");
    printf("%d\n", cnt);
}


int main() {
    int n;
    scanf("%d", &n);
    int a[n];
    for (int i=0; i<n; i++) scanf("%d", &a[i]);
    
    shellSort(a, n);
    
    for (int i=0; i<n; i++) printf("%d\n", a[i]);
    
    return 0;
}





Measured memory_bytes: 6680
/* ex3_2 
　　　　　sachiyan*/

#include <stdio.h>
int main(void){
    int N; //Nを定義
    scanf("%d", &N); //入力値Nの読み取り
    if(N%10 == 3){ //Nを10で割った余りでNの一の位を与える。一の位が３のとき
        printf("bon\n"); //bonを出力
    }
    else if(N%10 == 0 || N%10 == 1 || N%10 == 6 || N%10 == 8){ //一の位が0,1,6,8のとき
        printf("pon\n"); //ponを出力
    }
    else{ //一の位が3,0,1,6,8以外のとき、つまり2,4,5,7,9のとき
        printf("hon\n"); //honを出力
    }
    return 0;
}


Measured memory_bytes: 1624
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using System.Text;
 
class DandA {
    static void Main(string[] args) {
        int n = ReadLineInt();
        int[] xList = ReadLineIntArray();
        int wk = 0;
        int wk_p = 0;
        double rtn = 0;
        for (int i = 0;i < n; i++) {
            wk += xList[i];
        }
        wk_p = wk / n;
        if ((wk % n) > n / 2) {wk_p++;}
        for (int i = 0;i < n; i++) {
            rtn += Math.Pow((double)(xList[i] - wk_p), 2);
        }
        Console.WriteLine(rtn);
    }
 
    static string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
    static string[] strAry = new string[] {"L", "R", "U", "D"}; 
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private long ReadLineLong() {return long.Parse(Console.ReadLine());}
    static private double ReadLineDouble() {return double.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private double[] ReadLineDoubleArray() {return Console.ReadLine().Trim().Split().Select(a => double.Parse(a)).ToArray();}
    static private decimal[] ReadLineDecimalArray() {return Console.ReadLine().Trim().Split().Select(a => decimal.Parse(a)).ToArray();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}
 
    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
public static string IntToNString(int x, int n)
{
    var nstring = "";
    var numbers = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
    int r = 1;  // 余り
    int q = x;  // 商

    // 商が0になるまでループ
    while (q > 0)
    {
        r = q % n;
        nstring += numbers[r];
        q = q / n;
    }
    return string.Join("",nstring.Reverse());
}
}

Measured memory_bytes: 11348
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

int main()
{
    int sx, sy, tx, ty, back_x = 0, back_y = 0;
    std::cin >> sx >> sy >> tx >> ty;
    for (int i = 0; i < std::abs(ty - sy); i++)
    {
        std::cout << "U";
        back_y++;
    }
    for (int i = 0; i < std::abs(tx - sx); i++)
    {
        std::cout << "R";
        back_x++;
    }
    for (int i = 0; i < back_y; i++) { std::cout << "D"; }
    for (int i = 0; i < back_x; i++) { std::cout << "L"; }
    std::cout << "L";
    for (int i = 0; i < std::abs(ty - sy) + 1; i++) { std::cout << "U"; }
    for (int i = 0; i < std::abs(tx - sx) + 1; i++) { std::cout << "R"; }
    std::cout << "D";
    std::cout << "R";
    for (int i = 0; i < back_y + 1; i++) { std::cout << "D"; }
    for (int i = 0; i < back_x + 1; i++) { std::cout << "L"; }
    std::cout << "U";
    std::cout << std::endl;

    return 0;
}

Measured memory_bytes: 256
input1 = list(map(int,input().split()))
input2 = list(map(int,input().split()))
m1 = input1[0]
d1 = input1[1]
m2 = input2[0]
d2 = input2[1]
if m1 == m2:
  print(0)
else:
  print(1)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int64_t x;
    cin >> x;
    vector<int64_t> as(n);
    for (auto &a: as) {
        cin >> a;
    }

    vector<vector<int64_t>> tbl(n, vector<int64_t>(n, -1));

    for (int i = 0; i < n; i++) {
        tbl[i][0] = as[i];
        for (int j = 1; j < n; j++) {
            tbl[i][j] = min(tbl[i][j - 1], as[(i - j + n) % n]);
        }
    }

    int64_t ans = 0x7fffffffffffffffLL;
    for (int ma = 0; ma < n; ma++) {
        int64_t cur = 0;
        for (int i = 0; i < n; i++) {
            cur += tbl[i][ma];
        }
        ans = min(ans, cur + x * ma);
    }
    cout << ans << endl;

    // for (int i = 0; i < n; i++)
    // {
    //     int64_t inc = 0x7fffffffffffLL;
    //     for (int j = 0; j < n; j++)
    //     {
    //         int64_t cur = 0;
    //         cur += as[j] + x * ((i - j + n) % n);
    //         inc = min(inc, cur);
    //     }
    //     cout << i << ": " << inc << endl;
    //     ans += inc;
    //     }

    // cout << ans << endl;

    return 0;
}

Measured memory_bytes: 31616
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)

int main() {
    string s;
    while (cin >> s) {
        stack<char> stk;
        for (char &c : s) {
            if (stk.size() && stk.top() == 'S' && c == 'T') {
                stk.pop();
            } else {
                stk.push(c);
            }
        }
        cout << stk.size() << endl;
    }
}

Measured memory_bytes: 644
#include<stdio.h>
#define N 8
#define FREE -1
#define NOTFREE 1
void rec(int);
void print();

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
int x[N][N];
int main(){
  int i,j;
  int k,r,c;
  /* 初期化 */
  for(i=0;i<N;i++){
    row[i]=FREE;
    col[i]=FREE;
  }
  for(i=0;i<N;i++){
    dpos[i]=FREE;
    dneg[i]=FREE;
  }
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      x[i][j] = 0;
    }
  }

  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d%d",&r,&c);
    x[r][c] = 1;
  }
      rec(0);
  return 0;
}

void rec(int i){
  int j;
  if(i==N){
    print();
    return;
  }
  for(j=0;j<N;j++){
    if(NOTFREE == col[j] || NOTFREE == dpos[i+j] || NOTFREE == dneg[i-j+N-1]) continue;
     row[i]=j;
     col[j]=dpos[i+j]=dneg[i-j+N-1]=NOTFREE;

    rec(i+1);

    row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
  }
}
void print(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(x[i][j]!=0){
        if(row[i]!=j) return;
      }
    }
          }
          for(i=0;i<N;i++){
            for(j=0;j<N;j++){
                  if(row[i]==j) printf("Q");
              else printf(".");
            }
            printf("\n");
          }
        }


Measured memory_bytes: 2104
import java.util.*

fun main() {
    val sc = Scanner(System.`in`)
    val d = sc.nextInt()
    val t = sc.nextInt()
    val s = sc.nextInt()
    val result = calc(d, t, s)
    println(result)

}

fun calc(d: Int, t: Int, s: Int): String {
    return if(d <= t * s) "Yes" else "No"
}

Measured memory_bytes: 36212
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define maxn 2005
#define _x1 x1
#define _x2 x2
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
int n,m;
ll v;
int fa[maxn],id[maxn],x[maxn],y[maxn];
ll w[maxn];
int getfa(int now)
{
	return fa[now]==now ? now : fa[now]=getfa(fa[now]);
}
int cmp(int i,int j)
{
	return w[i]<w[j];
}
ll kruskal(int now)
{
	for(int i=1;i<=n;i++) fa[i]=i;
	ll ans=0;
	if(now)
		fa[x[now]]=y[now],ans+=w[now];
	for(int i=1;i<=m;i++)
	{
		int pos=id[i];
		int x1=getfa(x[pos]),y1=getfa(y[pos]);
		if(x1!=y1)
		{
			ans+=w[pos];
			fa[x1]=y1;
		}
	}
	return ans;
}
ll quickpow(ll p,ll k)
{
	ll ans=1;
	while(k)
	{
		if(k&1)
			ans=(ans*p)%mod;
		p=(p*p)%mod;
		k>>=1;
	}
	return ans;
}
int main()
{
	scanf("%d%d%lld",&n,&m,&v);
	for(int i=1;i<=m;i++)
		scanf("%d%d%lld",&x[i],&y[i],&w[i]),id[i]=i;
	sort(id+1,id+1+m,cmp);

	ll temp=kruskal(0);

	if(temp>v)
	return printf("0\n"),0;

	if(temp==v)
	{
		int cnt1=0,cnt2=0;
		for(int i=1;i<=m;i++)
		{
			if(kruskal(i)==temp)
				cnt1++;
			else
				cnt2++;
		}
		ll res1=(quickpow(2,cnt1)-2+mod)%mod;
		ll res2=quickpow(2,cnt2)%mod;
		return printf("%lld\n",res1*res2%mod),0;
	}
	else
	{
		int cnt1=0,cnt2=0;
		for(int i=1;i<=m;i++)
		{
			ll res1=kruskal(i);
			if(res1==v)
				cnt1++;
			else if(res1>v)
				cnt2++;
		}
		ll res1=2ll*((quickpow(2,cnt1)-1+mod)%mod)%mod;
		ll res2=quickpow(2,cnt2);
		printf("%lld\n",res1*res2%mod);
	}
}


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

namespace AtCoder
{
    partial class Program
    {
        static void Main(string[] args)
        {
       
            var n = int.Parse(Console.ReadLine());
            var aa = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var flag = 1;
            var x1 = 0;

            for (int i = 0; i < n; i++)
            {
                x1 += aa[i] * flag;
                flag *= -1;
            }

            Console.Write(x1);

            var xi = x1;
            for (int i = 0; i < n-1; i++)
            {
                xi = 2 * aa[i] - xi;
                Console.Write(" " + xi);
            }
        }

    }
}

Measured memory_bytes: 27860
#if 1

#include <bits/stdc++.h>
long long n,i,d = 1,s;
long long f(long long p)
{
	for(s = 0;p >= 1;p /= 10) s += p % 10;
	return s;
}

int main()
{
	scanf("%lld", &n);
	while(n--)
    {
		if((i+d) * f(i+d*2) > (i+d*2) * f(i+d)) d *= 10;
		i += d;
		printf("%lld\n",i);
	}
    return 0;
}

#endif // 1++


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

class UnionFindTree {
public:
    this(size_t n) {
        parent = iota(n).array();
        rank = new size_t[](n);
    }
    size_t find(size_t n) {
        if(n == parent[n]) {
            return n;
        } else {
            parent[n] = find(parent[n]);
            return parent[n];
        }
    }
    void unite(size_t n, size_t m) {
        auto p1 = find(n);
        auto p2 = find(m);
        if(n == m) {
            return;
        }
        if(rank[p1] < rank[p2]) {
            swap(p1, p2);
        }
        if(rank[p1] == rank[p2]) {
            ++rank[p1];
        }
        parent[p2] = p1;
    }
private:
    size_t[] parent;
    size_t[] rank;
}
unittest {
    auto uft = new UnionFindTree(10);
    foreach(i; iota(10)) {
        assert(uft.find(i) == i);
    }
    foreach(i; iota(10).filter!(a => a%3 == 0).drop(1)) {
        uft.unite(i, i-3);
    }
    foreach(i; iota(10).filter!(a => a%3 == 0)) {
        assert(uft.find(0) == uft.find(i));
    }
    foreach(i; iota(10).filter!(a => a%3 != 0)) {
        assert(uft.find(0) != uft.find(i));
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;

BigInt f(BigInt b, BigInt n) {
    if(n < b) {
        return n;
    }
    return f(b, n/b) + (n%b);
}

void main(){
    BigInt n = readLong();
    BigInt s = readLong();
    if(s > n) {
        writeln(-1);
        return;
    }
    if(s == n) {
        writeln(n+1);
        return;
    }
    for(BigInt i = 2; i * i <= n; ++i) {
        if(f(i, n) == s) {
            writeln(i);
            return;
        }
    }
    BigInt ans = -1;
    for(BigInt i = 1; i*i < n; ++i) {
        BigInt k0 = s-i;
        if(k0 < 0) {
            continue;
        }
        if((n-k0)%i == 0) {
            auto b = (n-k0)/i;
            if(b*b <= n) {
                continue;
            }
            if(k0 >= b) {
                continue;
            }
            if(i >= b) {
                continue;
            }
            ans = b;
        }
    }
    writeln(ans);
}



Measured memory_bytes: 1404
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll c[105]; 

ll gcd(ll a, ll b){
    return(a%b!=0 ? (gcd(b,a%b)) : b);  
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}
int main(){
	int n;
	cin >> n;
	ll ans = 1;
	ll tmp;
	for(int i=0; i<n; i++){
		cin >> tmp;
		ans = lcm(ans, tmp);
	} 
	printf("%lld", ans);
	return 0;
} 


Measured memory_bytes: 256
import sys;sys.setrecursionlimit(int(1e7))

N = int(input())
ABC = [tuple(map(int,input().split())) for _ in range(N-1)]
Q,K = map(int,input().split())
XY = [tuple(map(int,input().split())) for _ in range(Q)]

tree = [[] for _ in range(N+1)]
depth = [None]*(N+1)
for abc in ABC:
    tree[abc[0]].append((abc[1],abc[2]))
    tree[abc[1]].append((abc[0],abc[2]))

def DFS(v,p,d):
    depth[v] = d
    for e in tree[v]:
        if e[0] != p:
            DFS(e[0], v, d + e[1])

DFS(K,0,0)

for i in range(Q):
    print(depth[XY[i][0]] + depth[XY[i][1]])

Measured memory_bytes: 153060
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;
 
int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}
 
ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

bool is_prime(long long N){
    if (N == 1) return false;
    for (long long i = 2;i * i <= N;i++){
        if (N % i == 0) return false;
    }
    return true;
}
 
ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}
 
double DegreeToRadian(double degree){
    return degree * M_PI / 180.0;
}
 
 
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
 
 
///////////////////////////////////////////////////////////////////////////////////

int main(){
    map<long long, int> mp;
    int n;
    cin >> n;
    for (int i = 0;i < n;i++){
        int a;
        cin >> a;
        mp[a]++;
    } 

    int cnt = 0;
    for (auto v : mp){
        if (v.second % 2 != 0){
            cnt++;
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 9764