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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main()
{
    int N;
    cin >> N;

    vector<int> d(N);

    REP(i, N){
        cin >> d[i];
    }
    sort(d.begin(), d.end());
    
    cout << d[N/2] - d[N/2-1] << endl;
    return 0;
}

Measured memory_bytes: 640
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

N = int(input())
A = list(map(lambda s: int(s) - 1, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
for i, a in enumerate(A):
    ans += B[a]
    if i > 0 and A[i - 1] == a - 1:
        ans += C[a - 1]
print(ans)


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

using namespace std;

const int maxn = 1e5 + 5;

int a[maxn];

int main(int argc, char const *argv[]) {

    int n; cin >> n;

    for (int i = 1; i <= n; i ++)
        scanf("%d", a + i);

    int res = 0;
    for (int i = 1; i <= n; i ++) {
        if (a[i] == i) {
            if (i == 1) 
                swap(a[1], a[2]);
            else if (i == n)
                swap(a[n - 1], a[n]);
            else
                swap(a[i], a[i + 1]);
            res ++;
        }
    }
    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)

using namespace std;

int main() {
	string S;
	cin >> S;
	if (S.length() == 2) {
		cout << S << endl;
	}
	else {
		cout << S[2] << S[1] << S[0] << endl;
	}


	return 0;
}

Measured memory_bytes: 256
a, b, c = gets.chomp.split(" ").map(&:to_i)

ans = 0

if c >= a
  ans += a
  c -= a
  if c >= b
    ans += b * 2
    c -= b
    if c > 0
      ans += 1
    end
  else
    ans += c
    ans += b
  end
else
  ans += c
  c = 0
  ans += b
end

puts ans

Measured memory_bytes: 1788
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tihs if(fopen("inp.txt","r"))freopen("inp.txt", "r", stdin),freopen("out.txt", "w", stdout);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 

#define M 1010

ll a[M],b[M],c[M];
ll x,y,z,k;

int main(){
	IOS;
	tihs;
	
	
	cin>>x>>y>>z>>k;
	rep(i,0,x)cin>>a[i];
	rep(i,0,y)cin>>b[i];
	rep(i,0,z)cin>>c[i];
	sort(a,a+x,greater<ll>());
	sort(b,b+y,greater<ll>());
	sort(c,c+z,greater<ll>());
	vll v;
	bool ok=0;
	rep(i,0,x)rep(j,0,y)rep(k1,0,z){
		ll ways=(i+1)*(j+1)*(k1+1);
		if(ways>k){ok=1;break;}
		v.pb(a[i]+b[j]+c[k1]);
	}
	sort(v.rbegin(),v.rend());
	rep(i,0,k)cout<<v[i]<<"\n";	
	return 0;
}

Measured memory_bytes: 1400
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };



int main() {
	int H,W;
	scanf("%d%d", &H,&W);
	char a[120][120];

	int delW = 0;
	int delH = 0;

	for(int i=0;i<H;i++)
		scanf("%s", &a[i]);
	
	for (int i = 0; i < W; ) {
		int count = 0;
		for (int j = 0; j < H; j++) {
			if (a[j][i] == '.')count++;
		
		}
		if (count == H) {
			for (int j = i; j < W-1; j++)
				for (int k = 0; k < H; k++)
					a[k][j] = a[k][j+1];
			W--;
		}
		else i++;
	}
	
	for (int i = 0; i < H;) {
		int count = 0;
		for (int j = 0; j < W; j++){
			if (a[i][j] == '.')count++;
		}
		if (count == W) {
			for (int j = i; j < H-1; j++)
				for (int k = 0; k < W; k++)
					a[j][k] = a[j+1][k];
			H--;
		}
		else
		{
			i++;
		}
	}

	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			printf("%c", a[i][j]);
		}
		printf("\n");
	}
}



/*         提出前の確認事項

・デバッグ用の関数は＜＜コメント化＞＞しているか？
・すべての＜＜入力例＞＞は試したか？
・＜＜限界値分析＞＞はしたか？
・＜＜出力の改行＞＞の有無は確認したか？
・文字列の＜＜スペル＞＞は確認したか？
・＜＜解の存在性＞＞は確認したか？
　　　　　　　　↓
	 ＜＜提出先＞＞に注意して提出！！
*/

Measured memory_bytes: 128
#pragma comment (linker, "/STACK:256000000")
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long a = 0;a < b;++a)
#define ALL(x) (x).begin(),(x).end()
void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}
void solve() {
    long double a, b, p, q, r;
    cin >> a >> b >> p >> q >> r;
    long double dist = p * b - (b-a) * q;
    cout << b + dist / (q + r) << endl;
}
int main() {
    init();
    solve();
}


Measured memory_bytes: 3312
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <iomanip>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define outD(fpv) cout << setprecision(20) << fpv << endl;
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
inline void YES(bool cond) { cond ? puts("YES") : puts("NO"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
template<typename Type> inline void unique(Type& arr) { sort(arr); arr.erase(unique(arr.begin(), arr.end()), arr.end()); }
constexpr ll INF_I = std::numeric_limits<ll>::max();
constexpr ll BIGP = 1000000007L;
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    ll E = lcm(C, D);
    ll ac = (A-1) / C;
    ll bc = (B) / C;
    ll ad = (A-1) / D;
    ll bd = (B) / D;
    ll ae = (A-1) / E;
    ll be = (B) / E;
    //
    ll ans = (B- A + 1) - ((bc - ac) + (bd - ad) - (be- ae));
    cout << ans;
    //
    return 0;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> pll;
using mp = map<int,int>;
const int MN = 1e5+2, MOD = 1e9+7;
int main () {
	string s;
	cin >> s;
	if (s[0] == 'S') {
		if (s[1] == 'U') printf ("7\n");
		else printf ("1\n");
	} else if (s[0] == 'M') printf ("6\n");
	else if (s[0] == 'T') {
		if (s[1] == 'H') printf ("3\n");
		else printf ("5\n");
	} else if (s[0] == 'W') printf ("4\n");
	else printf ("2\n");
    return 0; 
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 500005
struct Edge{
	int next,to;
}edge[maxn*2];
int fi[maxn],se,in[maxn],day[maxn],vis[maxn],sum,ans;
inline void add_edge(int u,int v){
	edge[++se].to=v,edge[se].next=fi[u],fi[u]=se,in[v]++;
}
void dfs(int x){
	if(vis[x])return;
	ans=max(ans,day[x]),sum++,vis[x]=1;
	for(int i=fi[x];i;i=edge[i].next){
		int v=edge[i].to;
		in[v]--,day[v]=max(day[v],day[x]+1);
		if(!in[v])dfs(v);
	}
}
int main(){
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int u,v,pre=0;
		for(int j=1;j<n;j++){
			u=i;scanf("%d",&v);if(v<u)swap(u,v);
			v=(u-1)*(n+n-u)/2+v-u;
			if(pre)add_edge(pre,v);
			pre=v;
		}
	}
	n=(n-1)*n/2;
	for(int i=1;i<=n;i++)if(!in[i])dfs(i);
	if(sum==n)printf("%d\n",ans+1);
	else puts("-1");
	return 0;
}

Measured memory_bytes: 15872
import java.io.*;
import java.lang.*;
import java.util.*;

public class Main
{
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt(); 
        }
        int count = 0;
        while (true) { 
            boolean foundAdd = false;
            boolean foundSub = false;
            for (int i = 0; i < nums.length; i++) {
                if (x + count == nums[i]) {
                    foundAdd = true;
                }
                if (x - count == nums[i]) {
                    foundSub = true;
                }
            }
            if (!(foundSub)) {
                System.out.println(x - count);
                break;
            }
            else if (!(foundAdd)) {
                System.out.println(x + count);
                break;
            }
            count++;
        }
    }
}


Measured memory_bytes: 35784
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n, a[100005],x=0,y=0,d,e,count=0, cnt=0;
    vector<int> b(100001,0), c(100001,0);
    cin >>n;
    for(int i=1; i<=n; i++) cin >> a[i];
    for(int i=1; i<=n; i++) {
        if(i%2==1) b[a[i]]++;
        else c[a[i]]++;
    }
    for(int i=1; i<=100000; i++) {
        if(x<b[i]) {
            x=b[i];
            d=i;
            count=0;
        }
        else if(x==b[i]) count++;
        if(y<c[i]) {
            y=c[i];
            e=i;
            cnt=0;
        }
        else if(y==c[i]) cnt++;
    }
    if(count>=1 || cnt>>1) cout << n-x-y;
    else if(e==d) {
        sort(b.begin(),b.end(),greater<int>());
        sort(c.begin(),c.end(),greater<int>());
        cout << n-x-max(b[1],c[1]);
    }
    else cout << n-x-y; 
}

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

vector<vector<int>> to;

int main()
{
	int n,m;
	cin >> n >> m;
	to=vector<vector<int>>(n);
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin >> a >> b;
		a--;b--;
		to[a].push_back(b);
		to[b].push_back(a);
	}

	queue<int> que;
	que.push(0);

	vector<bool> done(n,false);
	vector<int> ans(n,-1);

	while(!que.empty())
	{
		int id=que.front();
		que.pop();
		done[id]=true;

		for(int i=0;i<to[id].size();i++)
		{
			int nx=to[id][i];
			if(done[nx])continue;
			if(ans[nx]==-1)ans[nx]=id;
			que.push(nx);
			done[nx]=true;
		}
	}

	cout << "Yes" << endl;
	for(int i=1;i<n;i++)
		cout << ans[i]+1 << endl;


}

Measured memory_bytes: 9728
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var md = "";
			while (!(md = Console.ReadLine()).StartsWith("0 "))
			{
				Console.WriteLine(DateTime.Parse(string.Format("2004 {0}", md)).DayOfWeek.ToString());
			}
		}
	}
}

Measured memory_bytes: 6940
use std::io::*;

use std::str::FromStr;

 

fn read<T: FromStr>() -> T {

    let stdin = stdin();

    let stdin = stdin.lock();

    let token: String = stdin

        .bytes()

        .map(|c| c.expect("failed to read char") as char)

        .skip_while(|c| c.is_whitespace())

        .take_while(|c| !c.is_whitespace())

        .collect();

    token.parse().ok().expect("failed to parse token")

}

fn main() {
    let s: String = read();

    let yes = s
        .chars()
        .enumerate()
        .all(|(i, c)| (i % 2 == 0 && c != 'L') || (i % 2 != 0 && c != 'R'));

    println!("{}", if yes { "Yes" } else { "No" });

}

Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().compute();
    }

    void compute() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        int[] h = new int[N];
        for (int i = 0; i < N; i++) {
            h[i] = sc.nextInt();
        }
        int lb = 0;
        int ub = (int) Math.pow(10, 9) + 1;
        while (ub - lb > 1) {
            int mid = (ub + lb) / 2;
            long sum = 0;
            for (int i = 0; i < N; i++) {
                long rest = h[i] - (long) mid * B;
                if (rest > 0) {
                    if (rest % (A - B) == 0) {
                        sum += rest / (A - B);
                    } else {
                        sum += rest / (A - B) + 1;
                    }
                }
            }
            if (sum <= mid) {
                ub = mid;
            } else {
                lb = mid;
            }
        }
        System.out.println(ub);
    }
}


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

struct Data {
	int u, v, w;
	Data(int u = 0, int v = 0, int w = 0) : u(u), v(v), w(w) {}
};

int main() {
	
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	int L; cin >> L;
	int n = 32 - __builtin_clz(L);
	vector<Data> edges;
	
	for (int i = 1; i < n; i++) {
		edges.emplace_back(i, i + 1, 1 << i - 1);
		edges.emplace_back(i, i + 1, 0);
	}
	int cur = 1 << n - 1;
	for (int i = n - 2; i >= 0; i--) if (L >> i & 1) {
		edges.emplace_back(i + 1, n, cur);
		cur |= 1 << i;
	}
	
	cout << n << " " << edges.size() << "\n";
	for (auto it : edges) cout << it.u << " " << it.v << " " << it.w << "\n";
	
	return 0;
}


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

#define REP(i,n) for(ll i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(ll i = (m); i < (n); ++i)

#define INF 1e9


int main(){
  int N;
  cin >> N;
  vector<int> P(N), Q(N);
  REP(i, N){
    cin >> P[i];
  }
  REP(i, N){
    cin >> Q[i];
  }
  REP(i, N){
    if(P[i] == Q[i]){
      continue;
    }
    else if(P[i] < Q[i]){
      break;
    }
    else{
      REP(i, N){
        swap(P[i], Q[i]);
      }
      break;
    }
  }
  
  int cnt = 0;
  do{
    // REP(i, N){
    //   cout << P[i];
    // }
    // cout << endl;
    bool flag = true;
    REP(i, N){
      if(P[i] != Q[i]){
        flag = false;
        break;
      }
    }
    if(flag){
      break;
    }
    cnt++;
  }while(next_permutation(P.begin(), P.end()));
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
t,a = gets.split.map(&:to_f)
line = gets.split.map(&:to_f)

line = line.map{ |i| t - i * 0.006}
 tmp = (line[0] - a).abs
cnt = 0
for i in (1..(line.size-1))
    if tmp > (line[i] - a).abs
        tmp = (line[i] - a).abs #差の絶対値のを比較する。
        cnt = i
    end
end
puts cnt + 1

Measured memory_bytes: 1788
#include <iostream>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
typedef long long ll;
using namespace std;
int main() {
    string s; cin >> s;
    ll ans = 0;
    int n = s.size();
    repeat (x, 1<<(n-1)) {
        ll acc = 0;
        repeat (i,n) {
            acc *= 10;
            acc += s[i] - '0';
            if ((x&(1<<i)) == 0) {
                ans += acc;
                acc = 0;
            }
        }
        ans += acc;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int c1, c2, c3, c4;
int x1, x2;
int main() {
	VI a(9), b(9);
	rep(i, 3)cin >> a[i] >> b[i];

	rep(i, 3) {
		if (a[i] == 1)c1++;
		if (a[i] == 2)c2++;
		if (a[i] == 3)c3++;
		if (a[i] == 4)c4++;
	}
	rep(i, 3) {
		if (b[i] == 1)c1++;
		if (b[i] == 2)c2++;
		if (b[i] == 3)c3++;
		if (b[i] == 4)c4++;
	}
	if (c1 == 1)x1++;
	if (c2 == 1)x1++;
	if (c3 == 1)x1++;
	if (c4 == 1)x1++;
	if (c1 == 2)x2++;
	if (c2 == 2)x2++;
	if (c3 == 2)x2++;
	if (c4 == 2)x2++;

	puts((x1 == 2 && x2 == 2) ? "YES" : "NO");
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100
#define W 0
#define G 1
#define B 2

int INFTY = 1<<21;
int n,A[MAX][MAX];

void dijkstra(){
  int min,i,v,u;
  int d[MAX],color[MAX];

  for(i=0;i<n;i++){
    d[i]=INFTY; 
    color[i]=W;
}
  d[0]=0;
  color[0]=G;
  while(1){
    min = INFTY;
    u=-1;
    for(i=0;i<n;i++){
      if(min>d[i]&&color[i]!=B){
	u=i;
	min= d[i];
      }
    }
    if(u==-1) break;
    color[u]=B;
    for(v=0;v<n;v++){
      if(color[v]!=B&&A[u][v]!=INFTY){
	if(d[v]>d[u]+A[u][v]){
	  d[v]=d[u]+A[u][v];
	  color[v]=G;
      }
    }
  }
}
for(i=0;i<n;i++){
    printf("%d ",i);
    if(d[i]==INFTY){
         printf("%d\n",-1);
    }
    else{
         printf("%d\n",d[i]);
    }
    }
}
int main(){
  int i,j,k,c,u,v;
  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
        A[i][j]=INFTY;
    }
  }
    for(i=0;i<n;i++){
        scanf("%d%d",&u,&k);
        for(j=0;j<k;j++){
            scanf("%d%d",&v,&c);
        A[u][v]=c;
    }
}
dijkstra();
return 0;
}
  



Measured memory_bytes: 2052
/**************************************************************************
Coded by: Saba Karimi(_VINTAGE)
Institution: AIT PUNE
***************************************************************************/
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back 
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define ld long double
#define int long long int 
#define F first 
#define S second
/**************************************************************************/
signed main() 
{
    fast;
    string s;
    cin>>s;
    int k;
    cin>>k;
    int n = s.size();
    set<string> st;
    for(int i=1;i<=k;i++)
    {
        for(int j=0;j<=n-i;j++)
        {
            string sub = s.substr(j,i);
            st.insert(sub);
        }
    }
    int i=1;
    auto it = st.begin();
    while(i!=k)
    {
        i++;
        it++;
    }
    cout<<(*it);
    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
    int N;
    
    cin >> N;

    vector<ll> L(N);

    for(int i = 0 ; i < N ; ++i) cin >> L[i];
    sort(L.begin(), L.end());
    
    int cnt = 0;
    
    for(int i = 0 ; i < N ; ++i){
        for(int j = 0 ; j < i ; ++j){
            for(int k = 0 ; k < j ; ++k){
                if((L[k] != L[j]) and (L[i] != L[j]) and (L[k] + L[j] > L[i])) cnt++;
            }
        }
    }
    
    cout << cnt << endl;
    
    return 0;
    
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define dame {cout<< "No" <<"\n"; return;}
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {

    ll H,W,h,w; cin>>H>>W>>h>>w;
    if(h==1 and w==1) dame;
    ll a=510;
    ll b=a*(h*w-1)+1;
    b=-b;
    ll ans[H][W];
    ll sum=0;
    rep(i,H){
        rep(j,W){
            if(i%h==h-1 and j%w==w-1) ans[i][j]=b;
            else ans[i][j]=a;
            sum+=ans[i][j];
        }
    }
    if(sum<=0) dame;
    cout<< "Yes" <<"\n";
    rep(i,H){
        rep(j,W){
            cout<< ans[i][j] <<" ";
        }
        cout<<"\n";
    }
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n, k; cin >> n >> k;
	vector<ll> a(n + 1);
	rep(i, 1, n)
	{
		cin >> a[i];
		--a[i];
	}
	rep(i, 0, n - 1) 
	{ 
		a[i + 1] += a[i]; 
		a[i + 1] %= k;
	}
	map<ll, int> mp;
	int right = 1;
	ll ans = 0;
	++mp[0];
	rep(left, 0, n - 1)
	{
		while (right <= n && right - left < k)
		{
			ans += mp[a[right]];
			++mp[a[right]];
			++right;
		}
		--mp[a[left]];
	}
	cout << ans << endl;
}


Measured memory_bytes: 14336
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt(), w = sc.nextInt(), k = sc.nextInt();
        boolean[][] b = new boolean[h][w];
        for(int i=0;i<h;i++){
            char[] c = sc.next().toCharArray();
            for(int j=0;j<w;j++){
                b[i][j] = c[j] == '#';
            }
        }
        int i_max = (int) Math.pow(2, h);
        int j_max = (int) Math.pow(2, w);
        int count = 0;
        int ans = 0;
        for(int i=0;i<i_max;i++){
            for(int j=0;j<j_max;j++){
                count = 0;
                for(int x=0;x<h;x++){
                    for(int y=0;y<w;y++){
                        int x_ = (int) Math.pow(2, x);
                        int y_ = (int) Math.pow(2, y);
                        if(b[x][y] && ((i & x_) == 0) && ((j & y_) == 0)){
                            count++;
                        }
                    }
                }
                if(count == k){
                    ans++;
                }
            }
        }
        System.out.println(ans);
    }
}


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

int main()
{
    ll n, c, k;
    cin >> n >> c >> k;
    vector<ll> T(n);
    rep(i, n) cin >> T[i];

    sort(T.begin(), T.end());
    ll ans = 1, z = 0, v; //バスの数と客の人数と今のバスの一人目の乗客の乗車時間
    rep(i, n)
    {
        if (i == 0)
            v = T[i];
        if (z == c)
        {
            ans++;
            v = T[i];
            z = 1;
            continue;
        }
        if (v + k < T[i])
        {
            ans++;
            v = T[i];
            z = 1;
            continue;
        }
        z++;
    }
    cout << ans << endl;
}

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

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

int Result_int;
long Result_lng;
string Result_str = "";
//int A,B,C;
int N,K,n;
string S;

int main() {
    int r_min,r_max;
    char target;
    cin >> N >> S >> K;
    n = N;
    target = S[K-1];
    REP(i,n) {
        if (S[i] != target) {
            Result_str += "*";
        } else {
            Result_str += S[i];
        }
    }

    cout << Result_str << endl;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
int main()
{
    int N, K;
    cin >> N >> K;
    cout << K*(ll)pow((K-1),(N-1)) <<  endl;
    return 0;
}


Measured memory_bytes: 4012
#include <stdio.h>

int main(void){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a<b){
    printf("a < b\n");
  } else if(a>b){
    printf("a > b\n");
  } else {
    printf("a == b\n");
  }
  return 0;
}

Measured memory_bytes: 580
/* ****TCIITB**** */

#include<bits/stdc++.h>
#define io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

#define N  100005

int main()
{
	
	io
	
	ll n;
	cin>>n;
	std::vector<ll> a(n);
	rep(i,0,n)
	{
		cin>>a[i];
	}
	ll res=0;
	ll cc=a[0];
	rep(i,0,n)
	{
		if(a[i]==cc)
		{
			continue;
		}
		if(a[i]<cc)
		{
			res+=cc-a[i];
		}
		else
		{
			// res+=a[i]-cc;
			cc=a[i];
		}
	}
	cout<<res;
}


Measured memory_bytes: 4760
package main

import "fmt"

func main(){
	var x,n int
	fmt.Scan(&x,&n)
	p := make([]int,n)
	for i:=0 ; i<n ; i++ {
		fmt.Scan(&p[i])
	}
	//x in p?
	flag := true
	for i:=0 ; i<n ; i++ {
		if x == p[i] {
			flag = false
			break
		}
	}
	if flag {
		fmt.Println(x)
	} else {
		for j:=1;;j++ {
			flag = true
			for i:=0 ; i<n ; i++ {
				if (x-j) == p[i] {
					flag = false
					break
				}
			}
			if flag {
				fmt.Println(x-j)
				break
			} else {
				flag = true
				for i:=0 ; i<n ; i++ {
					if (x+j) == p[i] {
						flag = false
						break
					}
				}
				if flag {
					fmt.Println(x+j)
					break
				}
			}
		}
	}
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	cin >>n >>k;
	VL a(n), sm(n+1);
	rep(i, n) cin >>a[i];
	rep2(i, k, n){
		if(a[i] > a[i-k]) cout<<"Yes\n";
		else cout <<"No\n";
	}
	
	return 0;
}


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

const int INF = 1e9;

int solve(long long a, long long sum)
{
	int cnt = 0;
	set<long long> st;
	for (int i = 1; ; i++) {
		if ((sum-a)&1) return i-1;
		if (st.count(a)) return INF;
		st.insert(a);
		a = (sum-a)>>1;
	}
}

int main()
{
	long long a, b, c, sum;
	cin >> a >> b >> c;
	if ((a&1)||(b&1)||(c&1)) {
		cout << 0 << endl;
		return 0;
	}
	sum = a+b+c;
	int ans = min(solve(a, sum), min(solve(b, sum), solve(c, sum)));
	if (ans == INF)cout << -1 <<endl;
	else cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Keep_calmYou_are_still_learning ios_base::sync_with_stdio(false);cin.tie(NULL);//freopen("out.txt","w",stdout);
typedef long long ll;
typedef long double ld;
using namespace std;



int main()
{
   Keep_calmYou_are_still_learning;
    ll n , k;
    cin>>n>>k;
    for (ll x,i=0;i<n;i++)
        cin>>x;
    cout<<(n-3+k)/(k-1)<<'\n';

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<double, double> P;
//typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

const ll mod = 1000000007;
const ll INF = 100000000000010000;

//ll bit[200010];
//ll kai[1000010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

/*ll sum(ll i)
{
	i += 1;
	ll t = 0;
	while (i > 0)
	{
		t = max(bit[i], t);
		i -= i & -i;
	}
	return t;
}

void update(ll i, ll x)
{
	i += 1;
	while (i <= 200005)
	{
		bit[i] = max(bit[i], x);
		i += i & -i;
	}
}*/

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll y) {
	if (y == 0) return 1;
	if (y % 2 == 1) {
		return x * pow_mod(x, y - 1) % mod;
	}
	else {
		ll half = pow_mod(x, y / 2);
		return half * half % mod;
	}
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

/*ll com(ll x, ll y) {
	return kai[x] * div_mod(kai[y] * kai[x - y] % mod) % mod;
	//毎回オーダーlog(n)かかる
}

void kaijo() {
	kai[0] = 1;
	for (ll i = 1; i <= 1000005; i++) {
		kai[i] = kai[i - 1] * i % mod;
	}
}*/

string K;
ll D;
ll dp[10010][101];

void solve() {
	cin >> K >> D;
	ll sum = 0;
	for (int i = 0; i < K.length(); i++) {
		rep(j, D)rep(k, 10) (dp[i + 1][(j + k) % D] += dp[i][j]) %= mod;
		rep(j, (K[i] - '0')) (dp[i + 1][(sum + j) % D] += 1) %= mod;
		(sum += K[i] - '0') %= D;
	}
	if (sum % D == 0) cout << dp[K.length()][0] << endl;
	else cout << (mod + dp[K.length()][0] - 1) % mod << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	ll N;
	cin >> N;
}

Measured memory_bytes: 8192
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

void printAns(int a) { cout << a << endl; }

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

ll INF = 10000000;
ll mod = 1000000007;//10^9+7


//番号ズレ注意！！
int main() {
    int a[5], k;
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> k;
    bool ans = true;
    REP(i, 4) {
        REP2(j, i + 1, 5) {
            if (a[j] - a[i] > k)ans=false;
        }
    }
    if(ans){cout<<"Yay!"<<endl;}
    else{cout<<":("<<endl;}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<cstdio>
using namespace std;
const int N=2e5+5;
int inf=0x3f3f3f3f;
typedef pair<int,int> pa;

double PI=3.141592654;

int main()
{
   int n,m;
   scanf("%d%d",&n,&m);
   int sum=0,x;
   for(int i=1;i<=m;i++){
     scanf("%d",&x);
     sum+=x;
   }
   if(sum>n) cout<<-1<<endl;
   else cout<<n-sum<<endl;
   return 0;
}


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

using namespace std;

int n, m;

int main(){
    cin >> n >> m;
    int ans = 0;
    for (int i = 1; i * i <= m; ++i) {
        if (m % i != 0) continue;
        if (m / i >= n) ans = max(ans, i);
        if (i >= n) ans = max(ans, m / i);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}
ll dx[]={0, 0, -1, 1};
ll dy[]={1, -1, 0, 0};// up,down,left right


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string a, b;
    cin >> a >> b ;
    
    ll ans = MOD;
    
    rep(i, a.size()){
        if(i + b.size() > a.size()){
            break;
        }
        ll tmp = 0;
        rep(j, b.size()){
            if(a[i + j] != b[j]) tmp ++;
        }
        ans = min(tmp, ans);
    }
    cout << ans << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
import java.util.*;
class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        //System.out.print(b-a-1);
        if((b-a-1) % 2 == 0){
          System.out.print("Borys");
        }else{
          System.out.print("Alice");
        }
	}
}

Measured memory_bytes: 21972
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	n, k := r.nextInt(), r.nextInt()
	oka := map[int]int{}
	for i := 0; i < k; i++ {
		r.Scan(true)
		r.Scan(true)
		for _, j := range r.nextStringArray().toInts() {
			oka[j]++
		}
	}
	ans := 0
	for i := 1; i <= n; i++ {
		if oka[i] == 0 {
			ans++
		}
	}

	fmt.Fprintln(stdout, ans)
}


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

int main(){
  int A, B;
  cin >> A >> B;
  if(A%3==0 || B%3==0 || (A+B)%3==0){
    cout << "Possible" << endl;
  }
  else{
    cout << "Impossible" << endl;
  }
}

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

#define ll long long
#define db double
#define f first
#define s second
const int mod=1e9+7;
int a[399][4];
priority_queue<int>q;
bool check(int a1,int a2,int a3,int b1,int b2,int b3)
{
    if(a2+b1==a[2][1]&&a2+b2==a[2][2]&&a2+b3==a[2][3]&&a3+b1==a[3][1]&&a3+b2==a[3][2]&&a3+b3==a[3][3])return 1;
    return 0;
}
int main()
{
    for(int i=1;i<=3;i++)
    {
        for(int j=1;j<=3;j++)cin>>a[i][j];
    }
    for(int a1=-10000000;a1<=10000000;a1++)
    {
        int b1=a[1][1]-a1,b2=a[1][2]-a1,b3=a[1][3]-a1;
        int a2=a[2][1]-b1,a3=a[3][1]-b1;
        if(a2+b1==a[2][1]&&a2+b2==a[2][2]&&a2+b3==a[2][3]&&a3+b1==a[3][1]&&a3+b2==a[3][2]&&a3+b3==a[3][3]){cout<<"Yes";return 0;}
    }
    cout<<"No";
    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 a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  if(a<b){
   if(b<c){
   System.out.println("Yes");
   }
   else{
    System.out.println("No");
   }
  }
  else{
   System.out.println("No");
  }
 }
}

Measured memory_bytes: 26152
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
  	cin >> n;
  	int a[n];
  	for(int i = 0 ; i < n ; i++){
     	cin >> a[i]; 
    }
  	int ans = 0;
  	for(int i = 0 ; i < n ; i++){
		for(int j = i + 1 ; j < n ; j++){
         	ans += (a[i]*a[j]); 
        }
    }
  	cout << ans << endl;
 	return 0; 
}

Measured memory_bytes: 256
echo H,W,A,B=`tr \  ,`\;M,C,Z=10**9+7,1,0 '
for I in range(1,H'{'):C=C*(W+H-B+~I)*pow(','-A):Z+=C;C=C*(B-1+I)*(H-I)*pow((W+H-B+~I)*'}I,M-2,M\)%M '
print(Z+C)%M'|python

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long N, M, K;
  cin >> N >> M >> K;
  vector<long> A(N);
  for (long i = 0; i < N; i++) cin >> A.at(i);
  vector<long> B(M);
  for (long i = 0; i < M; i++) cin >> B.at(i);
  vector<long> X(N + 1);
  for (long i = 1; i < N + 1; i++) {
    X.at(i) = X.at(i - 1) + A.at(i - 1);
  }
  vector<long> Y(M + 1);
  for (long i = 1; i < M + 1; i++) {
    Y.at(i) = Y.at(i - 1) + B.at(i - 1);
  }
  long ans = 0;
  for (long i = 0; i < N + 1; i++) {
    if (X.at(i) > K) break;
    long tmp = K - X.at(i);
    long tmp2 = upper_bound(Y.begin(), Y.end(), tmp) - Y.begin() - 1;
    ans = max(ans, i + tmp2);
  }
  cout << ans << "\n";
}

Measured memory_bytes: 9536
n, m, k = map(int, input().split())
 
mod = 998244353
 
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
 
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
 
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
 
ans = 0
for i in range(k+1):
    col = m * pow(m-1,n-i-1,mod)
    match = cmb(n-1,i,mod)
    ans += col * match
 
print(ans % mod)

Measured memory_bytes: 128068
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <queue>
#include <random>

using namespace std;

#define min(a,b) ((a)<(b) ? (a):(b))
#define max(a,b) ((a)>(b) ? (a):(b))

int gcd(int a, int b){
    while( b ){
        int m = a % b;
        a = b;
        b = m;
    }
    return a;
}

int lcm(int a, int  b){
    return (a*b)/gcd(a,b);
}

int isPrim(int a){
    if(a==1){
        return 0;
    }
    for(int i=2;i<=(a+1)/2;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}

long long mod_pow(long long x, long long n, long long mod){
    //xのn乗を計算するのにn乗を2進表記にして計算
    //x^22 = x^16 + x^4 + x^2
    long long ret=1;
    while(n>0){
        if(n%2==1){
            ret=(ret*x)%mod;//答えに付加
        }
        x=(x*x)%mod;//2乗
        n=n/2;
    }
    return ret;
}

struct VV{
    int x;
    int y;
    int z;
};

class LessInt {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        if(riLeft.x == riRight.x){
            return riLeft.y > riRight.y;
        }
        return riLeft.x > riRight.x;
        
    }
};

class indInt {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        return riLeft.x < riRight.x;
        
    }
};

struct XX{
    string a;
    int b;
    string c;
};

class xxIntu {
public:
    bool operator()(const XX& riLeft, const XX& riRight) const {
        //第1条件
        if(riLeft.a != riRight.a){
            return riLeft.a > riRight.a;//<:昇順(小さい順)、>:降順(大きい順)
        }
        //第2条件
        return riLeft.b > riRight.b;
    }
};
bool operator< (const XX &riLeft, const XX &riRight){
    return riLeft.a < riRight.a;
};
bool operator> (const XX &riLeft, const XX &riRight){
    return riLeft.a > riRight.a;
};


int main(int argc, const char * argv[])
{
    //std::ios::sync_with_stdio(false);
    //scanf("%s",S);
    //scanf("%d",&N);
    //getline(cin, target);
    //cin >> x >> y;
    //ここから
    
    int N,M;
    cin >> N >> M;
    int x[100000];
    int y[100000];
    int hako[100000];
    int aka[100000];
    for(int i=0;i<M;i++){
        cin >> x[i]>> y[i];
        
    }
    for(int i=0;i<N;i++){
        hako[i]=1;
        if(i!=0){
            aka[i]=0;
        }else{
            aka[0]=1;
        }
    }
    
    for(int i=0;i<M;i++){
        if(hako[x[i]-1]==1 && aka[x[i]-1]!=0){
            aka[x[i]-1]=0;
            aka[y[i]-1]++;
        }else if(aka[x[i]-1]!=0){
            aka[y[i]-1]++;
        }
        hako[x[i]-1]--;
        hako[y[i]-1]++;
    }
    int ans=0;
    for(int i=0;i<N;i++){
        if(aka[i]!=0){
            ans++;
        }
    }
    
    cout << ans << endl;
    
    
    
    //ここまで
    //cout << "ans" << endl;改行含む
    //printf("%.0f\n",ans);//小数点以下表示なし
    //printf("%.7f\n",p);
    //printf("%f\n",pow(2,ans.size()));
    
    return 0;
}

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

int n,a[55];

int main(){
	cin>>n;
	cout<<2*n-1<<endl;
	int t=0,tag=1;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		if(abs(a[i])>abs(t)) t=a[i],tag=i;
	}
	for(int i=1;i<=n;++i) cout<<tag<<' '<<i<<endl;
	if(t<0) for(int i=n-1;i>0;--i) cout<<i+1<<' '<<i<<endl;
	else for(int i=2;i<=n;i++) cout<<i-1<<' '<<i<<endl;
	return 0;
}

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

#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair

using namespace std;

typedef long long ll;

const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 7;

string a,b,c,d;
int cnt = 0;

int main () {
        cin >> a;

        b = "AKIHABARA";
        d = "AKIHABAR";

        if (a.size() > b.size()) {
                cout << "NO";
                return 0;
        }
        for (int i = 0; i < a.size();) {
                if (a[i] == b[cnt])
                        c += a[i],cnt ++,i ++;
                else if (b[cnt] == 'A') {
                        c += "A";
                        cnt ++;
                }
                else {
                        cout << "NO";
                        return 0;
                }
        }
        if (c == b || c == d) {
                cout << "YES";
        }
        else {
                cout << "NO";
        }
}


Measured memory_bytes: 256
/*
Cerberus97
Hanit Banga
*/

#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

int f(int i, int k);

int main() {
	int n, k, p;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i) {
		int a; cin >> a;
		if (a == 1) {
			p = i;
		}
	}
	int best = n;
	for (int i = max(1, p - k + 1); i <= p; ++i) {
		best = min(best, 1 + f(i - 1, k) + f(n - i - k + 1, k));
	}
	cout << best << endl;
}

int f(int i, int k) {
	if (i <= 0) {
		return 0;
	}
	return (i - 1) / (k - 1) + 1;
}

Measured memory_bytes: 256
import sys
import string

text = ""
for line in sys.stdin:
    text += line

character_count_map = {}

for c in text.lower():
    if c not in character_count_map:
        character_count_map[c] = 0
    character_count_map[c] += 1

for c in string.ascii_lowercase:
    if c in character_count_map:
        print(c, ":", character_count_map[c])
    else:
        print(c, ":", 0)

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

int main() {
    int n; cin >> n;
    vector<int> a(n);
    int alice = 0;
    int bob = 0;
    for(int i = 0; i < n; i ++) cin >> a.at(i);
    sort(a.begin(), a.end(), greater<int>());
    for(int i = 0; i < n; i ++) {
        if(i%2==0) alice += a.at(i);
        else bob += a.at(i);
    }
    cout << alice - bob << endl;
}

Measured memory_bytes: 256