akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include <fstream>
#include<unordered_set>
#include<stack>
#include <map>
#include<unordered_map>
#include<time.h>
#include <chrono>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define all(x) x.begin(),x.end()
using namespace std;
#define MAX 1000001 
#define M 998244353
ll inverse(ll n)
{
	ll modu = M;
	ll m = modu;
	ll a = 0, b = 1;
	if (modu == 1)
		return 0;
	while (n > 1)
	{
		ll quo = n / modu;
		ll temp = modu;
		modu = n % modu, n = temp;
		temp = a;
		a = b - (quo * a);
		b = temp;
	}
	if (b < 0)
		b += m;
	return b;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n;
	cin >> n;
	if (n == 2)
	{
		cout << "2";
		return 0;
	}
	if (n % 2 == 0)
	{
		n += 1;
	}
	
	for (ll i = n; i < INF; i += 2)
	{
		char ans = 'Y';
		f(j, 3, sqrt(i) + 1)
		{
			if (i % j == 0)
			{
				ans = 'N';
				break;
			}
		}
		if (ans == 'Y')
		{
			cout << i;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void) {
    while(1) {
        // ???????????????????????????
        int m, f, r;
        cin >> m >> f >> r;
        if (m == -1 && f == -1 && r == -1) break;
        // ?????°????¨????
        int result = 0;
        if (m != -1)
            result += m;
        if (f != -1)
            result += f;
        // ???????????¨???
        char grade;
        if (result < 30 || m == -1 || f == -1)
            grade = 'F';
        else if (result < 50 && r < 50)
            grade = 'D';
        else if (result < 65 || r >= 50)
            grade = 'C';
        else if (result < 80)
            grade = 'B';
        else
            grade = 'A';
        cout << grade << endl;
    }
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n,m;
  cin>>n>>m;
  int a[m],b[m];
  ll c[m];
  rep(i,0,m){
    cin>>a[i]>>b[i]>>c[i];
    a[i]--;
    b[i]--;
  }
  ll d[n];
  rep(i,0,n){
    d[i]=-1e12;
  }
  d[0]=0;
  rep(j,0,n){
    rep(i,0,m){
      if(d[a[i]]!=-1e12 && d[b[i]]<d[a[i]]+c[i]){
        d[b[i]]=d[a[i]]+c[i];
      }
    }
  }
  ll ans=d[n-1];
  rep(i,0,m){
    if(d[a[i]]!=-1e12 && d[b[i]]<d[a[i]]+c[i]){
      d[b[i]]=d[a[i]]+c[i];
    }
  }
  if(ans==d[n-1]) cout<<d[n-1]<<endl;
  else cout<<"inf"<<endl;
}

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

namespace AtCoder.Abc
{
    class QuestionD
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            //入力の受け取り
            
            var inputlongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            long N = inputlongArray[0];
            long K = inputlongArray[1];
            long[] A = new long[N];

            var inputA = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            for (long i=0; i<N; i++)
            {
                A[i] = inputA[i];
            }

            //テレポートの処理

            long[] visit = new long[N];           // 訪問回数
            var teleporter = new List<long>();   // 数列の定義 
            long next = 0;                       //次に訪問する町
            int flag = 0;                       //例外フラグ

            //最初は村１からスタート
            next = 1;

            //テレポート処理
            while (visit[next-1] == 0)
            {
                //町を訪れて記録
                teleporter.Add(next);
                visit[next - 1]++;//訪問記録

                //次の町へ
                next = A[next-1];

                //循環前に終了//////////////
                if (teleporter.Count() == K + 1)
                {
                    break;
                    flag = 1;
                }
                ////////////////////////////
            }

            if(flag == 0)
            {
                //数列の数は
                int cnt = teleporter.Count();   //訪問履歴数
                int savepoint = teleporter.IndexOf(next);   //繰り返し以外の数列数
                int rep = cnt - savepoint;  //繰り返し塊列数

                //K+1個目の数列の計算
                int amari = (int)((K - savepoint) % rep);
                long result = teleporter[savepoint + amari];

                Console.WriteLine(result);
            }

            else
            {
                Console.WriteLine(next);
            }


            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 50236
n = int(input())
h = [int(_) for _ in input().split()]
# a,b = 0, h[0]
OK = False
reach = False

if n == 1:
    OK = True

d = []
for i in range(n-1):
    d.append(h[i] - h[i+1])

for i in range(n-1):
    if d[i] >= 2 or (d[i] == 1 and reach == True):
        break
    elif d[i] == 1:
        reach = True
    elif d[i] < 0:
        reach = False

    if i == n-2:
        OK = True

print("Yes" if OK else "No")

Measured memory_bytes: 14396
#include<bits/stdc++.h>
using namespace std;
#define fr(x,i,n) for(int x = i; x < n; ++x)
#define fb(x,i,n) for(int x = i; x >= n; --x)
#define pr pair<int,int>
#define ll long long int
const int mod=1e9+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a[3];
    fr(i,0,3)
    cin>>a[i];
    sort(a,a+3);
    cout<<(a[0]*a[1])/2;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::io::{self, Write};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
     };
     ($next:expr, $t:ty) => {
         $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(dead_code)]
const MOD: u64 = 1000000007;

#[allow(dead_code)]
fn to_num(c: char) -> i64 {
    c as i64 - 48
}

fn main() {
    input!{
        S: chars
    }
    let mut ans = 0;

    for i in 0..(1 << (S.len()-1)) {
        let mut bit = i;
        let mut ret = to_num(S[0]);
        let mut ord = 1;
        for _ in 1..S.len() {
            if bit & 1 == 1 {
                ans += ret;
                ret = to_num(S[ord]);
                bit >>= 1;
                ord += 1;
            } else {
                ret *= 10;
                ret += to_num(S[ord]);
                bit >>= 1;
                ord += 1;
            }
        }
        ans += ret;
    }

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

Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<map>
#define MAX_W 10
#define INF 1E9

using namespace std;
typedef unsigned long long ull;

const ull B = 100000007;
int w, h; 
int s[MAX_W][MAX_W]; //可延伸的最大正方形邊長
int contain[MAX_W][MAX_W];
bool same[MAX_W][MAX_W][MAX_W][MAX_W];
int limit;
int ct;

struct P{
	int x, y, size;
	P() {}
	P(int x, int y, int size) : x(x), y(y), size(size) {}
	bool operator < (const P& other) const{
		return size < other.size;
	}
};
void init(vector<int>& f){
	memset(contain, 0, sizeof(contain));
	memset(same, false, sizeof(same));
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			s[i][j] = (f[i] >> (w - 1 - j)) & 1;
		}
	}
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			for(int k = 0;; k++){
				bool ok = true;
				if(i + k < h && j + k < w){
					for(int l = 0; ok && l <= k; l++){
						if(s[i + k][j + l] == 0 || s[i + l][j + k] == 0) ok = false;
					}
				}else{
					ok = false;
				}
				if(!ok){
					s[i][j] = k;
					break;
				}
			}
			for(int a = 0; a < s[i][j]; a++){
				for(int b = 0; b < s[i][j]; b++){
					contain[i + a][j + b]++;
				}
			}
			for(int a = 0; a < s[i][j] * s[i][j]; a++){
				int x1 = i + a / s[i][j], y1 = j + a % s[i][j];
				for(int b = 0; b < s[i][j] * s[i][j]; b++){
					int x2 = i + b / s[i][j], y2 = j + b % s[i][j];
					same[x1][y1][x2][y2] = same[x2][y2][x1][y1] = true;
				}
			}
		}
	}
}
int hstar(vector<int> f){
	//選取盡量多的點，其中每個集合最多只能有一個點被選中
	vector<P> ps, X;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if((f[i] >> (w - 1 - j)) & 1){
				ps.push_back(P(i, j, contain[i][j]));
			}
		}
	}
	sort(ps.begin(), ps.end());
	for(int i = 0; i < ps.size(); i++){
		bool ok = true;
		int x1 = ps[i].x, y1 = ps[i].y;
		for(int j = 0; j < X.size() && ok; j++){
			int x2 = X[j].x, y2 = X[j].y;
			if(same[x1][y1][x2][y2]) ok = false;
		}
		if(ok) X.push_back(ps[i]);
	}
	return X.size();
}
int dfs(int num, vector<int> f, int idx){
	if(num + hstar(f) > limit) return INF;
	
	ct++;
	vector<int> reset(f.begin(), f.end());
	for(; idx < w * h; idx++){
		int i = idx / w, j = idx % w;
		int k = s[i][j];
		if(k > 0){
			int tmp = ((1 << k) - 1) << (w - j - k), n = 0;
			for(int m = 0; m < k; m++){
				if((f[i + m] & (~tmp)) == f[i + m]) n++;
				f[i + m] &= ~tmp;
			}
			if(n < k){
				if(dfs(num + 1, f, idx + 1) < INF) return num;
			}
			for(int m = 0; m < k; m++) f[i + m] = reset[i + m];
			if(((f[i] >> (w - 1 - j)) & 1) && n < k) break;
		}
	}	
	bool check = true;
	for(int i = 0; i < h && check; i++) check &= (f[i] == 0);
	return (check ? num : INF);
}
int solve(vector<int>& f){
	init(f);
	ct = 0;
	for(limit = hstar(f);; limit++){
		if(dfs(0, f, 0) < INF) return limit;
	}
}
int main(){
	while(cin >> w >> h && (w || h)){
		vector<int> f(h, 0);
		for(int i = 0; i < h; i++){
			f[i] = 0;
			int a;
			for(int j = 0; j < w; j++){
				cin >> a;
				f[i] = (f[i] << 1) | a;
			}
		}
		cout << solve(f) << endl;
		// cout << "ct = " << ct << "\n\n";
	}
	return 0;
}


Measured memory_bytes: 3104
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] pos = new int[n + 1];
    for (int i = 0; i < n - 1; i++) {
      pos[sc.nextInt()]++;
    }
    for (int i = 1; i <= n; i++) {
      System.out.println(pos[i]);
    }
  }
}



Measured memory_bytes: 69968
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int x, a, b;
    io.read(x, a, b);
    char ans = 'A';
    if(abs(x - a) > abs(x - b)){
        ans = 'B';
    }
    cout << ans;
    return 0;
}

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

using namespace std;

using ll = long long;

ll mod_pow(ll x, ll n, ll mod)
{
    if (n == 0) return 1;
    ll res = mod_pow(x * x % mod, n / 2, mod);
    if (n & 1) res = res * x % mod;
    return res;
}

int main()
{
    int N;
    cin >> N;
    vector<int> cnt(N);
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        cnt[a]++;
    }
    
    bool ok = 1;
    if (N % 2 && cnt[0] != 1) ok = 0;
    for (int i = N - 1; i > 0; i -= 2) {
        if (cnt[i] != 2) {
            ok = 0;
            break;
        }
    }

    if (ok) {
        cout << mod_pow(2, N / 2, (1e9) + 7) << endl;
    } else {
        cout << 0 << endl;
    }   
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  scanf("%d", &n);
  vector<int> a(n),b(n);
  queue<int> ans;
  int count=0;
  for(int i=0;i<n;i++){
    int tmp;
    scanf("%d", &tmp);
    a.at(i)=tmp;
  }
    
  for(int i=n; i>0; i--){
    int ai=a.at(i-1);
    int tmpsum=0;
    for(int j=1; j*i<n+1; j++){
      tmpsum +=b.at(j*i-1);
    }
    if(tmpsum%2==ai) b.at(i-1)=0;
    else{
      b.at(i-1)=1;
      count++;
      ans.push(i);
    }
  }
  cout<<count<<endl;
  while(!ans.empty()){
    cout<<ans.front();
    ans.pop();
    if(!ans.empty()) cout<<' ';
  }
}

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

int H, W;
vector<string> S(50);
bool dp[51][51] = {{false}};

int rec(int i, int j){
    
    if(0 > i || i >= H || 0 > j || j >= W) return 0;
    if(S[i][j] == '.') return 0;
    
    if(dp[i][j]) return 0;
    dp[i][j] = true;
    
    int res = 1;
    res += rec(i, j - 1);
    res += rec(i - 1, j);
    res += rec(i, j + 1);
    res += rec(i + 1, j);
    
    S[i][j] = '.';
    
    return res;
}

int main(void){
    
    cin >> H >> W;
    for(int i = 0; i < H; ++i) cin >> S[i];
    
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j){
            if(S[i][j] == '#'){
                if(rec(i, j) < 2){
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
    
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
#define endl '\n'
#define pb push_back
#define mp make_pair
const int mx=1e5+5;
ll mod=1e9+7;
ll n,k;
ll a[2005];
int main(){
	/*freopen(".gir", "r", stdin);
	freopen(".cik", "w", stdout); 
    */ios_base::sync_with_stdio(false);cin.tie(NULL);
	cin >> n >> k;
	ll facb=((k*(k+1))/2)%mod;
	ll fac=(((k-1)*k)/2)%mod;
	rep(i,n)cin >> a[i];
	ll ans=0;
	for(int i=0;i<n;++i){
		ll bas=0;
		ll son=0;
		for(int l=i-1;l>-1;--l){
			if(a[i]>a[l])++bas;
		}
		for(int r=i+1;r<n;++r){
			if(a[i]>a[r])++son;
		}
		ans=(ans+bas*(fac))%mod;
		ans=(ans+son*(facb))%mod;
	}
	cout << ans%mod << endl;
}
	

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
class Solve{
    int N;
    long[] a,b;
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Read();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        Array.Sort(a);
        Array.Sort(b);
        int pa = 0;
        int pb = 0;
        int acount = 0;
        int bcount = 0;
        long count = 1;
        while(pa != N || pb != N){
            if(pa != N && (pb == N || a[pa] < b[pb])){
                pa++;
                if(bcount != 0){
                    count = count * bcount % Define.mod;
                    bcount--;
                }
                else{
                    acount++;
                }
            }
            else{
                pb++;
                if(acount != 0){
                    count = count * acount % Define.mod;
                    acount--;
                }
                else{
                    bcount++;
                }
            }
        }
        sb.Append(count+"\n");
    }
    void Read(){
        N = int.Parse(Console.ReadLine());
        a = new long[N];
        b = new long[N];
        for(int i=0;i<N;i++){
            a[i] = Int64.Parse(Console.ReadLine());
        }
        for(int i=0;i<N;i++){
            b[i] = Int64.Parse(Console.ReadLine());
        }
    }    
}
public static class Define{
    public const long mod = 1000000007;
}

Measured memory_bytes: 8528
#include <array>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <tuple>
#include <utility>
#include <limits>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

template<typename T, size_t N>
constexpr size_t NELEMS(T (&)[N]) { return N; }

template<typename InputIt>
void PRINT_RANGE(InputIt first, InputIt last)
{
    for(; first != last; ++first)
        cout << *first << (first==last ? "" : " ");
    cout << "\n";
}

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define DEBUG
#undef DEBUG

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

int N;
ll A[100000];

void solve()
{
    int cnt_2n = 0;
    int cnt_4n = 0;

    REP(i, N) {
        ll a = A[i];
        if(a % 4 == 0) {
            ++cnt_4n;
        }
        else if(a % 2 == 0) {
            ++cnt_2n;
        }
    }

    bool ok;
    if(cnt_2n <= 1) {
        ok = cnt_4n >= (N-cnt_4n-1);
    }
    else {
        ok = cnt_4n >= (N-cnt_4n-cnt_2n);
    }

    cout << (ok ? "Yes" : "No") << "\n";
}

int main()
{
    cin >> N;
    REP(i, N) {
        cin >> A[i];
    }

    solve();

    return 0;
}


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, x, y;
vector<pair<int, int> > vec;
double ans;

double fun(int i, int j)
{
	double t1 = abs(vec[i].fi - vec[j].fi);
	double t2 = abs(vec[i].se - vec[j].se);
	double ret = t1 * t1 + t2 * t2;
	ret = sqrt(ret);
	return ret;
}

int main()
{
	//ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	//cin >> n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		//cin >> x >> y;
		scanf("%d%d", &x, &y);
		vec.pb({ x, y });
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			ans += fun(i, j);
		}
	}
	//ans *= 2;
	ans /= n;
	//cout << ans << E;
	printf("%.8f\n", ans);
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
// C - Five Transportations
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
	ll N; cin>>N;
	ll mini = LLONG_MAX;
	for(int i=0; i<5; ++i){
		ll t; cin>>t;
		mini = min(mini, t);
	}
	cout<< (N+mini-1)/mini + 4 <<endl;//⌈N/mini(A,B,C,D,E)⌉ + (5-1)
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define all(x) x.begin(),x.end()
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define PI 3.1415926535897932384626
#define mod 1000000007
#define modd 998244353

void io() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
}

int powm(int x, int n) {
	ll res=1;
	while(n) {
		if(n%2) (res*=x)%=mod;
		x=(1LL*x*x)%mod;
		n/=2;
	}
	return res;
}

int main() {
	io();
	
	int n;
	cin>>n;
	ll sum = 0, sq = 0;
	for(int i=0;i<n;i++) {
		ll a; cin>>a;
		(sum+=a)%=mod;
		(sq+=a*a)%=mod;
	}
	(sum*=sum)%=mod;
	ll ans = (sum-sq+mod)%mod;
	ans = (ans*powm(2,mod-2))%mod;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3620
import java.util.*;
public class Main{
	public static void main(String[] args) { 
		Scanner sc = new Scanner(System.in);
		double a,b,c,d,e,f;
		double x=0.0,y=0.0;
		while(sc.hasNext()){
			a=sc.nextInt();
			b=sc.nextInt();
			c=sc.nextInt();
			d=sc.nextInt();
			e=sc.nextInt();
			f=sc.nextInt();
			x=(c*e-f*b)/(a*e-d*b);
			y=(c*d-f*a)/(b*d-e*a);
			if(x==0)x=0;
			if(y==0)y=0;
			System.out.printf("%.3f %.3f\n", x, y);
		}
	}
}

Measured memory_bytes: 18168
#include <bits/stdc++.h>
typedef long long ll;
#define MOD 1000000007
#define INF -99999999 
using namespace std;
 
int main()
{
    int R,G,B,N; cin >> R >> G >> B >> N;
    ll ans = 0;
    for (int r = 0; r <= N; r++)
    {
        for (int g = 0; g <= N; g++)
        {
            int b = N-r*R-g*G;
            if(b >= 0 and b%B == 0){
                ans++;
            }
        }
        
    }
    cout << ans << endl;
}


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

count = 0
backslash_index = []
area_pond = []
pending_area=[]
for index,symbol in enumerate(input()):
	if symbol == "\\":
		backslash_index += [index]
	elif symbol == '/' and backslash_index:
		last_bs_index = backslash_index.pop()
		diff = index - last_bs_index 
		count += diff 
		while area_pond and area_pond[-1] > last_bs_index:
			diff += pending_area.pop()
			area_pond.pop()

		area_pond += [last_bs_index]
		pending_area += [diff]

print(count)
print(len(area_pond),*(pending_area))



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

int func(int a)
{
	int hit=0;
	while(a%2==0 && a!=0)
	{
		a/=2;
		hit++;
	}
	return hit;
}

int main()
{
	int n,res=INT_MAX;
	scanf("%d",&n);
//	int has;
	for(int i=1;i<=n;i++)
	{
		int ang;
		scanf("%d",&ang);
//		cout<<func(ang)<<endl;
		res=min(res,func(ang));
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<string>
#include<cmath>
#include<algorithm>
#include<complex>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef pair<int,int> pa;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
int n,k,a[500010],ans,x;
int main(){
	cin>>n>>k;
	if ((n-1)%(k-1)==0) cout<<(n-1)/(k-1)<<endl;
	else cout<<(n-1)/(k-1)+1<<endl;
	return 0;
	if (n==k) return puts("1"),0;
	FOR(i,1,n){
		getint(a[i]);
		if (a[i]==1) x=i;
	}
	int t=x-1;
	if (t%(k-1)==0) ans+=t/(k-1); else ans+=t/(k-1)+1;
	t=n-x;
	if (t%(k-1)==0) ans+=t/(k-1); else ans+=t/(k-1)+1;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll n,d,x;

int main(){
	cin>>n>>d>>x;
	vp a(n);
	for(int i=0;i<n;i++){
		int y;
		cin>>a[i].first>>y;
		a[i].second=(y+x-1)/x;
	}
	sort(a.begin(),a.end());
	vi b(n),c(n);
	for(int i=0;i<n;i++) b[i]=a[i].first;
	ll res=0,t=0;
	for(int i=0;i<n;i++){
		t+=c[i];
		if(a[i].second>t){
			ll y=a[i].second-t;
			res+=y;
			t+=y;
			int it=upper_bound(b.begin(),b.end(),a[i].first+2*d)-b.begin();
			if(it<n) c[it]-=y;
		}
	}
	cout<<res<<endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<PII,int> PPIII;
typedef vector<PPIII> VPPIII;
VPPIII es;
void ae(int u,int v,int w){
	es.push_back(PPIII(PII(u,v),w));
}
int n=1;
void print(){
	printf("%d %d\n",n,(int)es.size());
	// sort(es.begin(),es.end());
	for(VPPIII::iterator it=es.begin();it!=es.end();++it){
		printf("%d %d %d\n",it->first.first,it->first.second,it->second);		
	}
}
int main(){
	int l;
	scanf("%d",&l);
	for(n=0;(2<<n)<=l;){
		n++;
		ae(n,n+1,1<<(n-1));
		ae(n,n+1,0);
	}
	int c=1<<n;
	for(int i=n-1;i>=0;i--){
		if((1<<i)&l){
			ae(i+1,n+1,c);
			c+=1<<i;
		}
	}
	n++;
	print();
}

Measured memory_bytes: 256
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
#文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
#文字列として取得
def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

H,W = MI()
V = [list(ST()) for _ in range(H)]
dp = FILL2(0,H+1,W+1)
dp[1][1]=1
for i in range(1,H+1):
    for j in range(1,W+1):
        if V[i-1][j-1] == '.' and (i!=1 or j!=1):
            dp[i][j] = (dp[i-1][j] + dp[i][j-1])%MOD
print(dp[H][W])


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

int main(){
  int n; cin >> n;
  int cnt = 0;
  for(int i = 1; i <= n; i++){
    string tmp = to_string(i);
    if((int)tmp.size()%2 == 1){
      cnt++;
    }
  }
  cout << cnt << endl;
}

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

int main() {
	int num; cin>>num;
	
	vector<int> heig;
	for(int i=0;i<num;i++){
	    int t; cin>>t;
	    heig.push_back(t);
	}
	
	vector<int> dp(heig.size(),0);
	dp[0] = 0;
	dp[1] = abs(heig[0]-heig[1]);
	
	for(int i=2;i<dp.size();i++){
	    dp[i] = min(dp[i-1]+abs(heig[i]-heig[i-1]), dp[i-2]+abs(heig[i]-heig[i-2]));
	}
	
	cout<<dp[dp.size()-1];
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e9)
using namespace std;
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

ll gcd( ll m, ll n )
{
    if (n == 0){
        return m;
    }else{
        return gcd(n, m % n);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    string S,T;
    cin >> N >> M;
    cin >> S >> T;
    ll gval = gcd(N,M);
    ll lval = N / gval;
    lval *= M;
    ll v1 = lval/N;
    ll v2 = lval/M;
    bool is_ok = true;
    if(S[0] != T[0]){
        is_ok = false;
    }
    vector<char> s_char;
    vector<char> t_char;
    rep(i,1,N){
        if(i % v2 == 0){
            s_char.push_back(S[i]);
        }
    }
    rep(i,1,M){
        if(i % v1 == 0){
            t_char.push_back(T[i]);
        }
    }
    rep(i,0,s_char.size()){
        if(s_char[i] != t_char[i]){
            is_ok = false;
        }
    }
    if(is_ok){
        print(lval);
    }else{
        print(-1);
    }

}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <functional>
#include <vector>

using namespace std;

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

int manju[10000], c[10000], e[10000];
int m, n;
int sum[10001], dp[501][10001];

int main() {
	cin >> m >> n;
	REP(i, m) scanf("%d", &manju[i]);
	REP(i, n) scanf("%d %d", &c[i], &e[i]);
	
	sort(manju, manju + m, greater<int>());
	sum[0] = 0;
	REP(i, m) sum[i + 1] = sum[i] + manju[i];
	
	fill(dp[0], dp[501], INF);
	dp[0][0] = 0;
	
	REP(i, n) {
		REP(j, m + 1) {
			dp[i + 1][j] = dp[i][j];
			if (j >= c[i]) dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - c[i]] + e[i]);
			else dp[i + 1][j] = min(dp[i + 1][j], dp[i + 1][0] + e[i]);
		}
	}
	
	int ans = 0;
	REP(i, m + 1) ans = max(ans, sum[i] - dp[n][i]);
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 22880
import sys

N = int(input())
A = list(map(int, input().split()))
A.sort()
if A[0] == 0:
    print(0)
    sys.exit()
    
ans = 1
cond = 0
for a in A:
    ans *= a
    if ans > 10**18:
        cond = 1
        break

if cond:
    print(-1)
else:
    print(ans)

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

int main(){
    string s; 
    int flg = 0; 
    cin >> s;

    if(s[0] == s[1]) flg = 1;
    if(s[1] == s[2]) flg = 1;
    if(s[2] == s[3]) flg = 1;

    if(flg == 1) cout << "Bad" << endl;
    if(flg == 0) cout << "Good" << endl;
}

Measured memory_bytes: 256
def getMinNum(N,nums):
	if N % min(nums) == 0:
		return N // min(nums)
	else:
		return N // min(nums) + 1

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

nums = [A,B,C,D,E]
	
print(len(nums)-1+getMinNum(N,nums))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long 
#include<vector>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int mod=1e9+7;
int main(){
	IOS;
	int a,b,c;
	cin>>a>>b>>c;
set<int> s;
s.insert(a);
s.insert(b);
s.insert(c);

 if(s.size()==2)
cout<<"Yes";
else
cout<<"No";
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 1e-10;
const int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    char c,d;
    cin >> c;
    if(c == 'A') d = 'T';
    else if(c == 'T') d = 'A';
    else if(c == 'G') d = 'C';
    else d = 'G';

    cout << d << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    string s; cin >> s;
    int n = s.size();
    vector<int> ans(n);

    for(int i = 0; i < 2; i++) {
        int cnt = 0;
        for(int j = 0; j < n; j++) {
            if(s[j] == 'R') cnt++;
            else {
                ans[j] += cnt / 2;
                ans[j - 1] += (cnt + 1) / 2;
                cnt = 0;
            }
        }

        reverse(ans.begin(), ans.end());
        reverse(s.begin(), s.end());

        for(int j = 0; j < n; j++) {
            if(s[j] == 'L') s[j] = 'R';
            else s[j] = 'L';
        }
    }

    for(int i = 0; i < n; i++) {
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1408
from collections import defaultdict
from heapq import heappop, heappush

YEN = 10**15
INF = float('inf')


class Graph:
    def __init__(self):
        self.__graph = defaultdict(list)

    def add_edge(self, source, destination, cost):
        self.__graph[source].append((destination, cost))
        self.__graph[destination].append((source, cost))

    @property
    def graph(self):
        return self.__graph


class Dijkstra:
    def __init__(self, graph, source):
        self.__costs = defaultdict(lambda: INF)
        costs = self.__costs
        costs[source] = 0
        g = graph.graph
        q = []
        heappush(q, (costs[source], source))

        while q:
            cp, p = heappop(q)
            if costs[p] < cp:
                continue
            for dst, cost in g[p]:
                alternative = cp + cost
                if costs[dst] > alternative:
                    costs[dst] = alternative
                    heappush(q, (alternative, dst))

    @property
    def costs(self):
        return self.__costs


def spline(func_=int, iter_=None):
    if iter_ is None:
        iter_ = input().split()
    return map(func_, iter_)


def main():
    n, m, s, t = spline()
    g_yen = Graph()
    g_snuuk = Graph()
    for _ in range(m):
        u, v, cost, b = spline()
        g_yen.add_edge(u, v, cost)
        g_snuuk.add_edge(u, v, b)
    d_s = Dijkstra(g_yen, s).costs
    d_t = Dijkstra(g_snuuk, t).costs
    costs = [INF] * n
    min_cost = INF
    for i in range(n, 0, -1):
        min_cost = min(min_cost, d_s[i] + d_t[i])
        costs[i - 1] = min_cost
    for cost in costs:
        print(YEN - cost)


if __name__ == "__main__":
    main()

Measured memory_bytes: 102596
#include <cstring>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <map>
#include <unordered_set>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
const int MAXN = (int)1e5 + 5;

P td[MAXN];
int cnts[MAXN];

int main() {
  int n, k;
  cin >> n >> k;

  for (int i = 0; i < n; ++i) {
    int t; ll d;
    cin >> t >> d;
    td[i] = P(d, t);
  }

  sort(td, td + n, greater<P>());

  ll ans = 0, cnt = 0, tmp = 0;
  priority_queue<P, vector<P>, greater<P> > q;
  for (int i = 0; i < k; ++i) {
    tmp += td[i].first;
    if (!cnts[td[i].second])  {
      cnt++;
    } else {
      q.push(td[i]);
    }
    cnts[td[i].second]++;
  }

  ans = tmp + cnt * cnt;
  for (int i = k; i < n; ++i) {
    if (q.empty()) break;
    if (cnts[td[i].second]) continue;
    P c = q.top(); q.pop();
    ll d = c.first;
    int idx = c.second;
    tmp = tmp - d + td[i].first;
    cnt++;
    cnts[idx]--;
    cnts[td[i].second]++;
    ans = max(ans, tmp + cnt * cnt);
  }

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


Measured memory_bytes: 3320
#include <bits/stdc++.h> 
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define each(it,o) for(auto it= (o).begin(); it != (o).end(); ++ it)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define inrep(t) int t;cin>>t; while(t--)
#define pb push_back
#define mp make_pair 
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi; 
typedef pair<int,int> pii;
typedef vector<pii > vpii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pll > vpll; 
typedef vector<string> vs;
typedef long double ld;


int main(){
	ios_base::sync_with_stdio(false); 
	ll k; cin>>k; 
	ll a[k]; 
	reu(i,0,k) cin>>a[i]; 
	ll mi=2,mx=2;
	bool notp=0;  
	for(int i=k-1;i>=0;i--){
		mi=ceil((long double)mi/a[i])*a[i]; 
		mx=(mx/a[i])*a[i]+a[i]-1; 
		if(mi>mx) notp=1; 
		else if(mx<2) notp=1; 
	}
	if(notp) cout<<-1; 
	else 
	cout<<mi<<" "<<mx; 
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <boost/math/constants/constants.hpp>
using namespace std;
typedef long long ll;
long double e = boost::math::constants::e<long double>();
long double pi = boost::math::constants::pi<long double>();
// 条件を見落としていませんか？

int main () {
    ll a, b, c;
    cin >> a >> b >> c;
    if (c-a-b < 0) {
        puts("No");
        return 0;
    }
    if (4*a*b < (c-a-b)*(c-a-b)) {
        puts("Yes");
    }
    else {
        puts("No");
    }
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    ll res = 0;
    ll tmp = 0;
    for (int i = 0; i < N; ++i) {
        if (A[i] >= tmp) tmp = A[i];
        else {
            res += tmp - A[i];
        }
    }
    cout << res << endl;
    return 0;
}

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

#define ll long long int
#define fi first
#define se second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define debug(a) cout << #a << " = " << a << " ";
#define endl "\n"
#define MOD (int) 1000000007
#define inf (int) (1e18)
#define Pii pair<ll,ll>
#define elp 1e-7

void solve() {
    int n;
    cin >> n;
    map<pair<int, int>, int> cnt;
    for (int j = 0; j < n; j++) {
        double x;
        cin >> x;
        ll i = llround(x * 1e9);
        ll tw = 0, fv = 0;
        while (i % 2 == 0) {
            tw++;
            i /= 2;
        }
        while (i % 5 == 0) {
            fv++;
            i /= 5;
        }
        cnt[{tw, fv}]++;
    }
    ll ans = 0;
    for (auto p1:cnt) {
        for (auto p2:cnt) {
            if (p1.fi.fi + p2.fi.fi >= 18 && p1.fi.se + p2.fi.se >= 18) {
                if (p1 < p2) {
                    ans += (ll) p1.se * p2.se;
                } else if (p1 == p2) {
                    ans += (ll) p1.se * (p1.se - 1) / 2;
                }
            }
        }
    }
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long int t=1;
    // cin >> t;
    for(long int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}

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

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


Measured memory_bytes: 256
def main():
    sa = list(input())
    sb = list(input())
    sc = list(input())
    nex = 'a'
    while True:
        if nex == 'a':
            if sa:
                nex = sa.pop(0)
            else:
                print('A')
                break
        if nex == 'b':
            if sb:
                nex = sb.pop(0)
            else:
                print('B')
                break
        if nex == 'c':
            if sc:
                nex = sc.pop(0)
            else:
                print('C')
                break
        

if __name__ == '__main__':
  main()

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

int main(void) {
    using namespace std;
    string n;
    cin >> n;
    bool flg = false;
    for (char ch : n) {
        if (ch == '7') {
            flg = true;
        }
    }

    if (flg) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	cin>>a;
	string b=a;
	reverse(a.begin(),a.end());
	for(int i=0;i<a.size();i++)
	{
		if(a[i]=='b')a[i]='d';
		else if(a[i]=='d')a[i]='b';
		else if(a[i]=='p')a[i]='q';
		else if(a[i]=='q')a[i]='p';
	}
	if(a==b)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    String s=gs();
	    //int m=gi();
	    
	    //System.out.print(a/2);

	    if (s.charAt(2)==s.charAt(3) && s.charAt(4)== s.charAt(5)) {
        	System.out.print("Yes");
        }else {
        	System.out.print("No");
        }


	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

  ll n;
  cin >> n;
  vector<ll> a(n);
  REP(i, n) cin >> a[i];

  ll g = a[0];
  FOR(i, 1, n) g = __gcd(g, a[i]);
  cout << g << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MAX(ll a,ll b){
    if(a>b) return a;
    return b;
}
int main(void){
    ll n,k;
    cin>>n>>k;
    ll a[200000],f[200000];
    for(int i=0;i<n;i++) scanf("%lld",&a[i]);
    for(int i=0;i<n;i++) scanf("%lld",&f[i]);
    sort(a,a+n,greater<ll>());
    sort(f,f+n);
    ll left=-1,right=100000000000000;
    while(right-left>1){
        ll mid=(left+right)/2;
        ll count=0;
        for(int i=0;i<n;i++){
            count+=MAX(0,a[i]-mid/f[i]);
        }
        if(count<=k) right=mid;
        else left=mid;
    }
    cout<<right<<endl;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int k,n;
  cin >> k >> n;
  vector<int> l(k);
  int i;
  for(i=0;i<k;i++) cin >> l[i];
  sort(l.begin(),l.end());
  int cnt = 0;
  for(i=0;i<n;i++) cnt += l[k-i-1];
  cout << cnt << "\n";
  return 0;
}

Measured memory_bytes: 3552
n, a, b = map(int, input().split())
s = list(input())

all_cnt, for_cnt = 0, 0
for i in s:
    if i == 'a':
        if all_cnt < a+b:
            print('Yes')
            all_cnt += 1
        else:
            print('No')
    elif i == 'b':
        if all_cnt < a+b:
            if for_cnt < b:
                print('Yes')
                all_cnt += 1
                for_cnt += 1
            else:
                print('No')
        else:
            print('No')
    else:
        print('No')


Measured memory_bytes: 4704
n,m = gets.chomp.split(' ').map(&:to_i)
count = 0
money = 0
shops = []
n.times do
  shops.push(gets.chomp.split(' ').map(&:to_i))
end
shops.sort!
while count < m
  if count + shops[0][1] > m
      money += shops[0][0] * (m - count)
      break
  else
    money += shops[0][0] * shops[0][1]
    count += shops[0][1]
  end
  shops.delete_at(0)
end
puts money


Measured memory_bytes: 22012
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=3005;
char ch[2*MAXN];int n;
vector<char> ans[MAXN];int id;
vector<char> temp,N;
int id1[2*MAXN],id2[2*MAXN],p1[2*MAXN],p2[2*MAXN];
void insert_a(int l,int r)
{
	for(int i=l,mx=0;i<=r;i++)if(ch[i]=='a'&&i>mx)
	{
		ans[id].emplace_back('a');ans[id].emplace_back('b');
		mx=p2[id1[i]];
	}
}
vector<char> check(vector<char> A,vector<char> B)
{
	int l1=SZ(A),l2=SZ(B),lm=min(l1,l2);
	for(int i=0;i<lm;i++)
	{
		if(A[i]-'a'<B[i]-'a')return B;
		if(A[i]-'a'>B[i]-'a')return A;
	}return l1>l2?A:B;
}
void insert_b(int l,int r)
{
	for(int i=l;i<=r;i++)ans[id].emplace_back(ch[i]);
	for(int i=l+1;i<=r;i++)if(ch[i]=='b')
	{
		temp.clear();
		for(int j=i;j<=r;j++)if(id1[j]>=id2[i]||id2[j]>=id2[i])
			temp.emplace_back(ch[j]);
		ans[id]=check(ans[id],temp);
	}
}
void solve(int l,int r)
{
	++id;
	if(ch[l]=='a')insert_a(l,r);
	else insert_b(l,r);
}
int main()
{
	n=read();scanf("%s",ch+1);
	for(int i=1,c1=0,c2=0;i<=2*n;i++)
	{
		if(ch[i]=='a')id1[i]=++c1,p1[c1]=i;
		else id2[i]=++c2,p2[c2]=i;
	}int cnt=0;
	for(int i=1,nxt;i<=2*n;i=nxt+1)
	{
		nxt=i;int cnt=(ch[i]=='a'?1:-1);
		while(nxt+1<=2*n&&cnt)
		{
			++nxt;
			cnt+=(ch[nxt]=='a'?1:-1);
		}
		solve(i,nxt);
	}temp.clear();
	temp=ans[id];
	for(int i=id-1;i>=1;i--)
	{
		N.clear();
		for(auto p:ans[i])N.emplace_back(p);
		for(auto p:temp)N.emplace_back(p);
		temp=check(temp,N);
		temp=check(temp,ans[i]);	
	}
	for(auto p:temp)putchar(p);puts("");
	return 0;
}


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

int main()
{
    long long int N, i,AC=0,WA=0, TLE=0,RE=0;
    char str[1000];
    cin>>N;
    for(i=0; i<N ;i++)
    {
        cin>>str;
        if(!strcmp(str, "AC"))
        {
            AC++;
        }
        if(!strcmp(str,"WA"))
        {
            WA++;
        }
         if(!strcmp(str, "TLE"))
        {
            TLE++;
        }
         if(!strcmp(str, "RE"))
        {
            RE++;
        }
        
    }
    
cout<<"AC x "<< AC<<endl;
cout<<"WA x "<< WA<<endl;
cout<<"TLE x "<< TLE<<endl;
cout<<"RE x "<< RE<<endl;
 
return 0;
}

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

using namespace std;

int main()
{
    while(true)
    {
        char raw[300]={};
        int h, w;    

        scanf("%d %d", &h, &w);
        if(h == 0 && w == 0) break;
        else if(h == 0 || w == 0) { cout << "\n"; continue; };
        for(int i=0; i<w; i++){raw[i] = '#';}
        for(int j=0; j<h; j++){printf("%s\n", raw);}
        cout << "\n";
    }
}


Measured memory_bytes: 3148
#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, x;
  cin >> n >> x;

  int a, ans = 1, sum = 0;
  REP(i,n) {
    cin >> a;
    sum += a;
    if (sum <= x) ans++;
  }
    
  cout << ans << endl;
}

Measured memory_bytes: 256