akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int dataSize = Integer.parseInt(sc.nextLine());
		int[][] data = new int[dataSize][3];
	
		for(int i = 0; i < dataSize; ++i)
		{
			String[] splitted = sc.nextLine().split("\\s+");
			data[i][0] = Integer.parseInt(splitted[0]);
			data[i][1] = Integer.parseInt(splitted[1]);
			data[i][2] = Integer.parseInt(splitted[2]);
		}
		
		for(int i = 0; i < dataSize; ++i)
		{
			if(IsRight(data[i][0],data[i][1],data[i][2]))
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		
	}
	
	public static boolean IsRight(int a, int b, int c)
	{
		if((a*a == b*b + c*c) || (b*b == a*a + c*c ) || (c*c == a*a + b*b))
			return true;
		else 
			return false;	
	}
	
	
	
	

	
} 

Measured memory_bytes: 25956
#include<bits/stdc++.h>
using namespace std;
 
#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000000000
#define MAXN        1000005
#define mod         1000000007  
#define pi          3.1415926535897932384626433
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,i,sum=0,x,mx=0;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>x;
        mx=max(mx,x);
        sum+=(mx-x);
    }
    cout<<sum;
}

Measured memory_bytes: 3660
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
s,t = map(str, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]
a,b = map(int, stdin.readline().rstrip().split())
u = str(stdin.readline().rstrip())

if u == s:
    a = a-1
else:
    b = b-1
print(a,b)


Measured memory_bytes: 2940
// 標準入力から一行を読み取り、指定の型に変換する
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

// 4つの値の最小値を求める
fn min4(a: i64, b: i64, c: i64, d: i64) -> i64 {
    let mut vec = vec![a, b, c, d];
    vec.sort();

    return vec[0];
}

// 再帰関数(深さ優先探索)
fn dfs(nabc: &Vec<i64>, l: &Vec<i64>, i: usize, a: i64, b: i64, c: i64) -> i64 {
    // 最後の竹を選択済み
    if i == nabc[0] as usize {
        // 一本も選択しないパターンがABCそれぞれに存在する組み合わせは極端に大きな値を返す(除外する)
        if a == 0 || b == 0 || c == 0 { return 10_i64.pow(9); }
        // 絶対値の和がコストになる。後述する理由により、ABCのコストの和から30を差し引いた値を返す.
        return (a - nabc[1]).abs() + (b - nabc[2]).abs() + (c - nabc[3]).abs() - 30;
    }

    // 使用しない場合: ret0
    // 合成した場合: ret1-3
    // 1本目でも合成扱いになるため、最終的にこの分は引いておかなければならない(上で-30する理由).
    let ret0 = dfs(&nabc, &l, i + 1, a, b, c);
    let ret1 = dfs(&nabc, &l, i + 1, a + l[i], b, c) + 10;
    let ret2 = dfs(&nabc, &l, i + 1, a, b + l[i], c) + 10;
    let ret3 = dfs(&nabc, &l, i + 1, a, b, c + l[i]) + 10;

    // 最終的に最も低いコストで収まるパターンを返す.
    return min4(ret0, ret1, ret2, ret3);
}

fn main() {
    let nabc: Vec<i64> = read_vec();
    let mut l: Vec<i64> = Vec::new();

    for _ in 0..nabc[0] as usize
    {
        let li: i64 = read();
        l.push(li);
    }

    // 全探索
    // 各竹には、Aの素材、Bの素材、Cの素材、使わないの4パターン存在するから、これを再帰関数で全探索する.
    // 添字0、ABC全て未選択の状態でスタート
    println!("{}", dfs(&nabc, &l, 0, 0, 0, 0));
}


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

int main() {
    // ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    
    int a, b; scanf("%2d %2d", &a, &b);
    
    if (a >= 1 && a <= 12) {
        if (b >= 1 && b <= 12) printf("AMBIGUOUS\n");
        else printf("MMYY\n");
    } else if (a >= 0) {  // yymm / na
        if (b >= 1 && b <= 12) printf("YYMM\n");
        else printf("NA\n");
    }
    
    return 0;
}


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

int main(){
    int h, w;
    while(true){
        cin >> h >> w;
        if(h == 0 && w == 0) break;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


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

int main(){
    int a,b,c,tmp;
    cin >> a;
    cin >> b;
    cin >> c;

    if(a > b){
        tmp = b;
        b = a;
        a = tmp;
    }if(a > c){
        tmp = c;
        c = a;
        a = tmp;

    }if(b > c){
        tmp = c;
        c = b;
        b = tmp;
    }
    cout << a << " " << b << " " << c << endl;
    return 0;
}


Measured memory_bytes: 3092
#include<cstdio>

int main(){
  int N=0;
  scanf("%d",&N);
  int a=static_cast<int>(N/100);
  int b=static_cast<int>(N%100/10);
  int c=N%10;

  if(a==7 or b==7 or c==7)
    printf("Yes\n");
  else
    printf("No\n");
}

Measured memory_bytes: 1644
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,ans=0;
  cin>>n;
 vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  for (int i = 0; i < n; i+=2) {
    if(vec.at(i)%2==1){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <set>

#define PI 3.1415926535897

typedef long long ll;

using namespace std;

int main() {
	ll a, b, c, k;
	cin >> a >> b >> c >> k;

	ll count = 0;
	ll ans = 0;
	for (ll i = 0; i < a && count < k; i++) {
		count++;
		ans++;
	}
	for (ll i = 0; i < b && count < k; i++) {
		count++;
	}
	for (ll i = 0; i < c && count < k; i++) {
		count++;
		ans--;
	}
	cout << ans;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
int n;
string s;
cin >> n >> s ;


int count = 0;
for (int i=0; i <= n-3; i++){
    if(s.at(i)=='A' && s.at(i+1)=='B' && s.at(i+2)=='C' ){
        count++;
    }
    
}
cout << count << endl;
return 0;
}

Measured memory_bytes: 256
def count(n):
    k = 0
    for j in range(1, n+1):
        if n%j == 0:
            k+=1
    return k

def main():
    N = int(input())
    output = 0
    for i in range(1, N+1, 2):
        if count(i) == 8:
            output += 1
    return output

if __name__ == '__main__':
    print(main())



Measured memory_bytes: 2940
# 入力の取得
# 数値:1行1件
n = int(input())

# 処理
# 辞書オブジェクト生成
dictionary = dict()

# 文字:N行_1件_1行ずつ取得
for i in range(n):
    data = input()

    # 辞書オブジェクトに存在する場合は対象キーの値を加算
    if data in dictionary:
        dictionary[data] += 1
    else:
        dictionary[data] = 0

# データソート
# ソートは、 安定 (stable) であることが保証されている。https://docs.python.org/ja/3/howto/sorting.html
# 複数のキーで並べ替えしたい場合、優先度の低いキーから順番にソートすれば良い。
# ソート1(キーの昇順)
data_sorted = sorted(dictionary.items(), key=lambda x: x[0])
# ソート2(値の降順)
data_sorted = sorted(data_sorted, key=lambda x: x[1], reverse=True)

# データ出力
count = data_sorted[0][1]
for key, val in data_sorted:
    if count == val:
        print(key)
    else:
        exit


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

// 辺に重みをつける場合
/* 
struct Edge{
  int to;
  int weight;
  Edge(int t,int w) : to(t). weight(w) { }
};
*/

using Graph = vector<vector<int>>;
// using Graph = vector<vector<Edge>>;

int A[100050], B[100050];
int N, taka, ao;

//深さ優先探索
vector<bool> seen, seen1;
void dfs(const Graph &G, int v){
  seen[v] = true; // v を訪問済みにする

  // vから行ける各頂点 next_v について
  for(auto next_v : G[v]){
    if (seen[next_v]) continue; // next_v が探索済みだったらスルー
    A[next_v] = A[v] + 1;
    dfs(G, next_v); // 再帰的に探索
  } 
}

void dfs1(const Graph &G, int v){
  seen1[v] = true; // v を訪問済みにする

  // vから行ける各頂点 next_v について
  for(auto next_v : G[v]){
    if (seen1[next_v]) continue; // next_v が探索済みだったらスルー
    B[next_v] = B[v] + 1;
    dfs1(G, next_v); // 再帰的に探索
  } 
}


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

  cin >> N >> taka >> ao;
  A[taka] = 0;
  B[ao] = 0;

  Graph G(N+1);
  for(int i=0;i<N-1;i++){
    int A, B;
    cin >> A >> B;
    G[A].push_back(B);
    G[B].push_back(A);
  }

  seen1.assign(N+1, false);
  dfs1(G, ao);

  seen.assign(N+1, false); // 全頂点を「未訪問」にして初期化
  dfs(G, taka);

  int ans1 = 0;
  for(int i=1;i<=N;i++){
    int Z = 0;
    if(A[i] < B[i]){
      Z = B[i]-1;
    }
    ans1 = max(ans1, Z);
  }

  cout << ans1 << endl;

  /* for(int i=1;i<=N;i++){
    cout << B[i] << endl;
  }
  */

}


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

int main()
{
	std::string s;
	std::string t;
	std::cin >> s >> t;
	int ans = 0;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] != t[i])
			++ans;
	}
	std::cout << ans << '\n';
}

Measured memory_bytes: 3916
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),n.end()
#define PI acos(-1)
using namespace std;
int main(){
  int n;
  cin>>n;
  rep(i,n){
    int a,b,c;
    int co=0;
    cin>>a>>b>>c;
    while(a&&b&&c){co++;a--;b--;c--;}
    while(a>=2&&b){co++;a--;a--;b--;}
    while(a>=3){co++;a-=3;}
    cout<<co<<endl;
  }

}

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

typedef int i32;
typedef long long i64;
typedef unsigned int u32;
typedef unsigned long long u64;


template<typename First, typename Second, typename Third>
struct triple {
   First first;
   Second second;
   Third third;
};


#define debug(x)  cerr<<x<<"\n";
#define loop(i,n) for(i32 i = 0; i < n; ++i)
#define pi  pair<i32,i32>
#define ti  triple<i32,i32,i32>
#define mk  make_pair
#define vi  vector<i32>
#define vll vector<i64>
#define fastInOut ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pr(a) for(auto x:a) cout<<x<<" ";
#define prmap(m) for(auto x:m) cout<<x.first<<" "<<x.second<<"\n";
using namespace std;

bool isPrime(i64 x){
	
	for(i64 i=2;i*i<=x;i++)
		if(x%i==0)
			return false;
	return true;
}

vi V;
const i32 N=7e7+9;
bool prime[N]; 
void SieveOfEratosthenes() 
{
    for (int  p=2; p*p<=N; p++){ 
        if (prime[p] == false){ 
            for (int  i=p*p; i<=N; i += p) 
                prime[i] = true; 
        } 
    } 
    int u=0,mx=0;
    for (int p=2; p<=N; p++) 
      if (!prime[p]) {
          V.push_back(p);
    }
   
}

i64 q,x,t;
i64 a,b,w;
void solve(){
    cin>>w>>a>>b;
  cout<<max(max(0LL,a-(b+w)),max(0LL,b-(a+w)));
}

int main(){
   	fastInOut
    solve();
    return 0;
}


Measured memory_bytes: 256
from fractions import gcd
def lcm(a, b):
    return (a*b)//gcd(a, b)
N,M = map(int, input().split())
S = input()
T = input()
L = gcd(N,M)

if all([S[i*N//L] == T[i*M//L] for i in range(L)]):
    print(lcm(N,M))
else:
    print('-1')
    


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

typedef long long ll;
#define REP(i, n, m) for(int i = n; i < m; i++)
#define REPR(i, n, m) for(int i = n; i >= m; i--)
#define LREP(i, n, m) for(ll i = n; i < m; i++)
#define LREPR(i, n, m) for(ll i = n; i >= m; i--)

#define P pair<int, int >


const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;



//---functions---//
int gcd(int a, int b){
    if(a < b) swap(a, b);
    return b?gcd(b, a%b):a;
}

int s2i(string num){stringstream ss; ss << num << flush; int n; ss >> n; return n;}
string i2s(int n){stringstream ss; ss << n << flush; return ss.str();}

bool firstCompare(const P& firstElof, const P& secondElof){
    return firstElof.first < secondElof.first;
}
bool secondCompare(const P& firstElof, const P& secondElof){
    return firstElof.second < secondElof.second;
}
//---------------//

ll N;
int main(){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    vector<ll> a(N + 1);
    vector<int> isIN(N + 1);
    LREP(i, 1, N + 1) cin >> a[i];
    ll M = 0;
    LREPR(i, N, 1){
        ll div;
        div = N / i;
        ll mod = 0;
        LREPR(j, div, 2){
            mod += isIN[j * i];
            mod %= 2;
        }
        if(mod == a[i]) continue;
        else{
            isIN[i] = 1;
            M += 1;
        }
    }
    cout << M << '\n';
    LREP(i, 1, N + 1){
        if(isIN[i] == 1) cout << i << '\n';
    }

}


Measured memory_bytes: 3200
import numpy as np
v = list(map(int,input().split()))
v = v[0]
a = [int(e) for e in input().split()]
r = [0 for _ in range(v)]
r[0] = sum(a[0:v:2]) - sum(a[1:v:2])
for i in range(v -1):
     r[i +1] = -r[i] +2*a[i]
print(*r)

Measured memory_bytes: 23108
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

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

    int n,k;

    cin >> n >> k;
vector<int> a(n),b(n);

    for(int i = 0;i < n;i++) cin >> a[i] >> b[i];

    bool t[10];
    int ans = INT_MAX;

    for(int i = 0;i < (1<<n);i++)
    {
        int tmp = i;
        int cnt = 0;
        for(int j = 0;j < n;j++) t[j] = false;
        while(tmp)
        {
            t[cnt] = tmp%2;
            tmp/=2;
            cnt++;
        }
        int each = 0,cn = 0;
        for(int j = 0;j < n;j++)
        {
            if(t[j])
            {
                cn+=a[j];
                each+=(j+1)*a[j]*100+b[j];
            }
        }
        if(cn>ans) continue;
        if(each>=k){ ans = min(ans,cn); continue; }
        for(int j = n-1;j >= 0;j--) if(!t[j])
        {
            for(int l = 0;l < a[j];l++)
            {
                each+=(j+1)*100;
                cn++;
                if(each>=k){ ans = min(ans,cn); break; }
            }
            break;
        }
    }

    cout << ans;
    cout << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<climits>
#define ll long long
using namespace std;
int main() {
	ll a, b, k;
	cin >> a >> b >> k;
	if (b - k+1 > a + k-1) {
		for (ll i = 0; i < k; i++) {
			cout << a + i << endl;
		}
		for (ll i = k - 1; i >= 0; i--) {
			cout << b - i << endl;
		}
	}
	else {
		for (ll i = a; i <= b; i++) {
			cout << i << endl;
		}
	}



}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
	int q,n;
	cin>>q;
	for(int i=0;i<q;i++){
		cin>>n;
		int ct=0,keta=1;
		while(n>9){
			for(int k=6;k>=1;k--){
				if(n/pow(10,k)>=1){
					keta=k;
					break;
				}
			}
			int ma=0;
			for(int j=1;j<=keta;j++){
				int a=pow(10,j);
				ma=max(ma,(n/a)*(n%a));
			}
			if(n==ma){
				ct=-1;
				break;
			}
			n=ma;
			ct++;
		}
		cout<<ct<<endl;
	}
    return 0;
}

Measured memory_bytes: 1208
N,M = map(int,input().split())
sc=[list(map(int,input().split()))for _ in range(M)]

ans = -1
for i in range(1000):
  s = str(i)
  if len(s) == N:
    flg = 0
    for a,b in sc:
      if int(s[a-1]) != b:
        flg = 1
    if flg == 0:
      ans = i
      break
print(ans)

Measured memory_bytes: 3060
import std.stdio, std.conv, std.array, std.string;
import std.algorithm;

void main() {
  string s = readln.chomp;

  string prev;
  uint count = 0;
  auto n = s.length;
  for(uint i=0; i<n; i++) {
    if (s[i..i+1] == prev) {
      if (i+1 == n) break;
      prev = s[i..i+2];
      count++;
      i++;
      continue;
    }
    prev = s[i..i+1];
    count++;
  }

  writeln(count);
}


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

int main(void)
{
	string s;
	cin >> s;
	
	int *child = new int[s.size()];
	int *child_next = new int[s.size()];
	for(int i = 0; i < s.size(); ++i){
		child[i] = 1;
		child_next[i] = 1;
	}
		
	// 移動処理
	for(int i = 0; i < s.size(); ++i){
		if(s.substr(i, 2) == "RL"){
			// L
			int l = 0;
			for(int j = 1; j < s.size() - i; ++j){
				if(i + 1 + j >= s.size()){
					break;
				}
				if(s.at(i + 1 + j) == 'L'){
					++l;
				}else{ break; }
			}
			// R
			int r = 0;
			for(int j = 1; j <= i; ++j){
				if(s.at(i - j) == 'R'){
					++r;
				}else{ break; }
			}
			
			child_next[i] = (l + 1) / 2 + r / 2 + 1;
			child_next[i+1] = l / 2 + (r + 1) / 2 + 1;
			
			++i;
		}else{
			child_next[i] = 0;
		}
	}
	
	// 出力
	for(int i = 0; i < s.size() - 1; ++i){
		cout << child_next[i] << " ";
	}
	cout << child_next[s.size() - 1] << endl;
	
	return 0;
}

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

void solveA(){
  int n,a,b;
  cin >> n;

  if (n==1) cout << "Hello World" << endl;
  else {
    cin >> a >> b;
    cout << a+b << endl;
  }
}
void solveB(){
  int n,t,ci,ti;
  cin >> n >> t;
  int ans = 2000;
  
  for(int i=0;i<n;i++){
    cin >> ci >> ti;
    if (ci<=ans && ti<=t) ans = ci;
  }
  if (ans==2000) cout << "TLE" << endl;
  else cout << ans << endl;  
}

void solveC(){
  int n;
  cin >> n;
  int x[n],y[n],h[n];
  int xt,yt,ht;
  int flg=1;

  for(int i=0;i<n;i++){
    cin >> x[i] >> y[i] >> h[i];
    if(h[i]!=0 && flg) xt=x[i],yt=y[i],ht=h[i];
  }

  int cx,cy,ch;
  for(int i=0;i<=100;i++){
    for(int j=0;j<=100;j++){
      ch = ht + abs(xt-i) + abs(yt-j);
      for(int k=0;k<n;k++){
	if (max(ch-abs(x[k]-i)-abs(y[k]-j),0)==h[k]){
	  if (k==n-1){
	    cx = i;
	    cy = j;
	    i=100;
	    j=100;
	    break;
	  }
	}
	else break;
      }
    }
  }
  cout << cx << " " << cy << " " << ch << endl;  
}
void solveD(){
  int n,m;
  cin >> n >> m;

  int ans = 1;
  for(int i=m/n;;i--){
    if (m%i==0) {
      ans=i;
      break;
    }
  }
  cout << ans << endl;
}

int main(){
  solveD();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, a, b, s;
  s = 0;
  in3(n, a, b);
  vector<ll> c(n);
  rep(i, n)
    in(c[i]);
  rep(i, n - 1){
    if((c[i + 1] - c[i]) * a < b)
      s = s + (c[i + 1] - c[i]) * a;
    else
      s = s + b;
  }
  out(s);
  memi;
}

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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

#define roop(i, n) for(int i = 0;i < n;i++)
int n, m, q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> A){
    if(A.size() == n+1){
        int now = 0;
        roop(i, q){
            if(A[b[i]] - A[a[i]] == c[i]) now += d[i];
        }
        ans = max(ans, now);
        return;
    }

    A.push_back(A.back());
    while(A.back() <= m){
        dfs(A);
        A.back()++;
    }
}

int main(void){

    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    roop(i, q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs(vector<int> (1, 1));

    cout << ans << endl;

    return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<double,double> P;
typedef pair<P,ll> PP;

//-----------------------------------------------------------------------------

int n;
ll a[100000],sum;
ll cnt;

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

	cin>>n;
	REP(i,n) {
		cin>>a[i];
		sum+=a[i];
	}
	if(sum%((1LL+n)*n/2)!=0) {
		cout<<"NO"<<endl;
		return 0;
	}
	ll times=sum/((1LL+n)*n/2);
	REP(i,n) {
		ll dif=a[(i+1)%n]-a[i];
		dif-=times;
		//cout<<"dif,cnt "<<dif<<' '<<cnt<<endl;
		if(dif==0) continue;
		if(dif>0||dif%n!=0) {
			cout<<"NO"<<endl;
			return 0;
		}
		dif=-dif;
		cnt+=dif/n;
	}
	if(cnt==times) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;

	return 0;
}


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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

/*最小公倍数*/
ll lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

/*最大公約数*/
ll gcd(ll a, ll b){
    return __gcd(a,b);
}

int main(){

    ll n; cin >> n;

    vll ans(n, 0);
    rep2(x, 1, sqrt(n)){
        rep2(y, 1, sqrt(n)){
            rep2(z, 1, sqrt(n)){
                ll a = (x*x + y*y + z*z + x*y + y*z + z*x)-1;
                if(a>=0 && a<n){
                    ans[a]++;
                }
            }
        }
    }

    rep(i, n){
        cout << ans[i] << endl;
    }


    return 0;
}

Measured memory_bytes: 3620
import java.util.Scanner;

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

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <functional>
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
int main(){
    int a,b;
    cin >> a >> b;

    int ans = -1;

    for(int i = 0;i <= 2000;i++){
        if(i * 8 / 100 == a && i / 10 == b){
            ans = i;
            break;
        }
    }

    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;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

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

  string A ,  B, C  ; cin >> A >> B >> C; 
  cout << A[0] << B[1] << C[2] << endl;
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
 
 
class UnionFind {
public:
	vector<int> s, p, es;
	map<int, int>sizemp;
 
	UnionFind() {}
	UnionFind(int size) {
		s.resize(size, 0);
		p.resize(size, 0);
		es.resize(size, 0);
		sizemp[1] = size;
		rep(i, 0, size)makeSet(i);
	}
 
	void makeSet(int x) {
		p[x] = x;
		s[x] = 1;
		es[x] = 0;
	}
 
	bool same(int x, int y) {
		return findSet(x) == findSet(y);
	}
 
	void unite(int x, int y) {
		x = findSet(x);
		y = findSet(y);
		es[x]++;
		if (x == y)return;
		if (s[x] < s[y])swap(x, y);
		int szx = size(x);
		int szy = size(y);
		sizemp[szx]--;
		sizemp[szy]--;
		sizemp[szx + szy]++;
		if (sizemp[szx] == 0)sizemp.erase(szx);
		if (sizemp[szy] == 0)sizemp.erase(szy);
		p[y] = x;
		s[x] += s[y];
		es[x] += es[y];
	}
 
 
	int findSet(int x) {
		if (x == p[x]) {
			return x;
		}
		else {
			return p[x] = findSet(p[x]);
		}
	}
 
	int size(int x) {
		return s[findSet(x)];
	}
	int esize(int x) {
		return es[findSet(x)];
	}
	int minsz() {
		auto beg = sizemp.begin();
		return beg->first;
	}
};
 
vector<int>E[101010];
int col[101010];
int fl = 0;
void dfs(int now){
	fore(x, E[now]) {
		if (col[x] == -1) {
			col[x] = 1 - col[now];
			dfs(x);
		}
		else if (col[x] == col[now])fl = 0;
	}
}
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
 
	int N, M;
	cin >> N >> M;
	UnionFind un = UnionFind(N);
	for (int i = 0; i < M; i++) {
		int u, v;
		cin >> u >> v;
		u--, v--;
		un.unite(u, v);
		E[u].pb(v);
		E[v].pb(u);
	}
 
	for (int i = 0; i < N; i++)col[i] = -1;
 
	ll ans = 0;
	ll one = 0;
	ll bi = 0;
	ll ot = 0;
	for (int i = 0; i < N; i++) {
		if (un.size(i) == 1) { one++; continue; }
		if (col[i] != -1)continue;
		fl = 1;
		col[i] = 0;
		dfs(i);
		if (fl)bi++;
		else ot++;
	}
  	puts(2LL*N*one - one*one + 2LL*bi*bi + 2LL*ot*bi + ot*ot);
 
	return 0;
}

Measured memory_bytes: 11136
#include <stdio.h>

#define MAX_LENGTH 100

void swap(int *, int *);

int main(void) 
{
	int i, j;
	int n;
	int value[MAX_LENGTH], count;

	while (scanf("%d", &n), n != 0) {
		count = 0;
		for (i = 0; i < n; i++) {
			scanf("%d", &value[i]);
		}

		for (i = 0; i < n; i++) {
			for (j = 0; j < n - (i + 1); j++) {
				if (value[j] > value[j + 1]) {
					swap(&value[j], &value[j + 1]);
					count++;
				}
			}
		}
		printf("%d\n", count);
	}
	return 0;
}

void swap(int *x, int *y) 
{
	int tmp;
	tmp = *x;
	*x  = *y;
	*y  = tmp;
}

Measured memory_bytes: 596
#include<cstdio>
using namespace std;
int main(){
  int T,h,m,s;
  scanf("%d",&T);
  h = T / 3600;
  T %= 3600;
  m = T / 60;
  T %= 60;
  s = T;
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}

Measured memory_bytes: 2728
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s == "SUN") cout << 7;
  if (s == "MON") cout << 6;
  if (s == "TUE") cout << 5;
  if (s == "WED") cout << 4;
  if (s == "THU") cout << 3;
  if (s == "FRI") cout << 2;
  if (s == "SAT") cout << 1;
  
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,s,t) for(int i=s ; i<t ; i++)
typedef long long ll;
typedef pair<ll,ll> P;
const int max_n = 1e5;

int main(){
  ll n; cin >> n;
  vector<ll> v(n);
  rep(i,0,n){
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  ll cnt = 0;
  rep(i,0,n)rep(j,i+1,n)rep(k,j+1,n){
    if(v[i]+v[j]>v[k] && v[i]+v[k]>v[j] && v[j]+v[k]>v[i]){
      cnt++;
    }else{
      break;
    }
  }
  cout << cnt <<endl;
  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define e "\n"
#define MaRiaMa { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
#define fix(n) cout << fixed << setprecision(n);
using namespace std;
int main()
{
	MaRiaMa;
	int n, d, x, m = 0;
	int ar[100];
	cin >> n >> d >> x;
	for (int i = 0; i < n; i++)
	{
		cin >> ar[i];
	}
	for (int i = 0; i < n; i++)
	{
		ll sum = 0;
		int k = 1;
		while (1)
		{
		    sum += ((k*ar[i]) + 1);
			if (sum <= d)
			{
				m++;
				k++;
				sum = 0;
			}
			else
			{
				break;
			}
			
		}
	}
	cout << m + x + n;
}





Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
using namespace std;

using INT = long long;
using UINT = unsigned long long;

int main()
{
	double n, m;

	cin >> n >> m;
	cout << (n / m) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <utility>
#include <vector>
#include <algorithm>

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

typedef long long ll;

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

    vector<int> L(n);

    REP(i, n)
    {
        cin >> L[i];
    }
    sort(L.begin(), L.end());
    int ans = 0;
    REP(b, n)
    REP(a, b)
    {
        int ab = L[a] + L[b];
        int r = lower_bound(L.begin(), L.end(), ab) - L.begin();
        int l = b + 1;
        ans += max(0, r - l);
    }

    cout << ans;
    return 0;
}

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

int main() {
	int n, m;
	cin >> n >> m;
	bool p[200000] = {}, q[200000] = {};
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		if (a == 0) {
			p[b] = true;
		}
		if (b == n - 1) {
			q[a] = true;
		}
	}
	bool r = false;
	for (int i = 0; i <n; i++) {
		r |= p[i] && q[i];
	}
	cout << (r ? "POSSIBLE" : "IMPOSSIBLE") << endl;
	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <limits.h>
#define N 1000
#define WHITE 0
#define BLACK 1
#define NILL -1

int a[N];
int b[N][N];
int color[N];
int v;

int main(void){

  int n,i,j,mincost,u,k;
  int s=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      b[i][j] = INT_MAX;
    }
  }

  for(i=0;i<n;i++){
    a[i] = INT_MAX;
    color[i] = 0;
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      scanf("%d",&b[u][v]);
    }
  }

  a[s] = 0;

  while(1){
    mincost = INT_MAX;
      for(i=0;i<n;i++){
	if(a[i] < mincost && color[i] == WHITE){
	  mincost = a[i];
	  u = i;
	}
      }

    if(mincost == INT_MAX) {
        break;
    }

    color[u] = BLACK;

    for(v=0;v<=n;v++){
      if(b[u][v] == INT_MAX) continue;
      if(a[v] > a[u]+ b[u][v]){
	a[v] = a[u] + b[u][v];
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d %d\n",i,a[i]);
  }
  return 0;
}



Measured memory_bytes: 2104
#include<iostream>
#include<cstdio>
#include<map>
#include<vector>
#include<set>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#define Max zhi5968
typedef long long ll;
using namespace std;
 
ll a[100000+50],b[100000+50];
 
int main ()
{
	ll n,k,i;
	cin>>n>>k;
	for(i=0;i<n;i++)
		scanf("%lld %lld",&a[i],&b[i]);
	ll r=2999999999999999999,l=0,now;
	while(l+1<r)
	{
		now=(r+l)/2;
		ll ans=0;
		for(i=0;i<n;i++)
			if(now>=a[i])
				ans+=(now-a[i]+b[i])/b[i];
		if(ans>=k)
			r=now;
		else
			l=now;
	}
	printf("%lld\n",r);
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

const lint MOD = pow(10, 9) + 7;

lint gcd(lint a, lint b) {
	//aとbの最大公約数を返す
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(a % b, b);
}

lint lcm(lint a, lint b) {
	//aとbの最小公倍数を返す
	return a / gcd(a, b) * b;
}

/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/


int main() {
	int N;
	string S;
	cin >> N >> S;
	int cntr = 0;
	int cntb = 0;
	rep(i, N) {
		if (S[i] == 'R') {
			cntr++;
		}
		else {
			cntb++;
		}
	}
	if (cntr > cntb) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define mod 1e9+7
using namespace std;
double dp[3000];
int main()
{
    dp[0]=1.0;
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        double x;
        cin>>x;
        for(int j=i; j>=0; j--)
        {
            if(j>0)
                dp[j]=(dp[j-1]*x)+(dp[j]*(1-x));
            else
                dp[j]=dp[j]*(1-x);
        }
    }
    double ans=0;
    for(int i=n; i>n/2; i--)
    {
        //cout<<dp[i]<<endl;
        ans+=dp[i];
    }
   // cout<<ans<<endl;
    printf("%.10f\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long 
#define rep(i,a,b) for(signed i=a;i<(b);++i)
#define erep(i,a,b) for(signed i=a;i<=(b);++i)
#define per(i,a,b) for(signed i=(a);i>(b);--i)
#define eper(i,a,b) for(signed i=(a);i>=b;--i)
#define fore(i, x, a) for(auto &&x:a) 
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define pb emplace_back
#define mp make_pair
#define ALL(x) begin(x),end(x)
#define F first
#define S second
#define debug(x)  cout << #x << ": " << (x) << '\n';
const long long INF=1001001001001001001;
const int MOD=(int)1e9 + 7;
const double EPS=1e-9;
using namespace std;
using Pii = pair<int,int>;
using vii = vector<int>;
template<class T>using  PS_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>using vv = vector<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> ostream& operator<<(ostream &os,const vector<vector<T> > &v) {
    ITR(u,begin(v),end(v))ITR(w,begin(*u),end(*u))os<<*w<<(w==end(*u)-1?"\n":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct edge { int from, to, cost; };
int dy[]={0, 1, -1, 0}; int dx[]={1, 0, 0, -1};
// cout << fixed << setprecision(10) << val;

string s;
signed main() {
 cin.tie(0);
 ios::sync_with_stdio(false);
  cin >> s;
  map<char, int> m;
  rep(i, 0, 4) {
    m[s[i]]++;
  }
  if (m.size() == 2)  {
    bool flag = true;
    for (auto itr = m.begin(); itr != m.end(); ++itr) {
      if (itr->second != 2) flag = false;
    }
    if (flag)
      cout << "Yes" << endl;
  }
  else 
    cout << "No" << endl;
  return 0;
}




Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#pragma warning(disable : 4996)

#define MAX_N 100000+1
#define INF 100000+1

int N;
int C[MAX_N];

int abs(int v) {
	if (v < 0) return -v;
	return v;
}
int min(int a, int b) {
	if (a < b) return a;
	return b;
}

template<class T> void chmin(T &a, T b) {
	if (b < a) a = b;
}

int GetCost(int n) {
	if (n == 0) return 0;
	if (C[n] >= 0) return C[n];
	int val = 1;
	int c = INF;
	while (1) {
		val *= 6;
		if (n - val < 0) break;
		chmin(c, 1 + GetCost(n - val));
	}
	val = 1;
	while (1) {
		val *= 9;
		if (n - val < 0) break;
		chmin(c, 1 + GetCost(n - val));
	}
	chmin(c, 1 + GetCost(n - 1));
	C[n] = c;
	return c;
}

int main(void) {
	scanf("%d", &N);
	for (int i = 0; i <= N; ++i) {
		C[i] = -1;
	}
	printf("%d", GetCost(N));
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
ll D;
ll c[26];
ll s[366][26];
ll t[366];
ll score(ll days){
	ll ans=0;
	ll last[26];
	rep(i,26)last[i]=0;
	for(ll d=1;d<=days;d++){
		ans+=s[d][t[d]];
		last[t[d]]=d;
		rep(i,26){
			ans-=c[i]*(d-last[i]);
		}
	}
	return ans;
}
int main(){
	cin>>D;
	rep(i,26)cin>>c[i];
	for(ll d=1;d<=D;d++)rep(j,26)cin>>s[d][j];
	for(ll d=1;d<=D;d++){
		ll ma=-1e17,pt=0;
		rep(i,26){
			t[d]=i;
			ll res=score(d);
			if(ma<res){
				ma=res;
				pt=i;
			}
		}
		t[d]=pt;
	}
	for(ll d=1;d<=D;d++){
		cout<<t[d]+1<<"\n";
	}
}


Measured memory_bytes: 3712
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	int a, b = 0, d = 0, e;
	char c;
	cin >> a;
	for (int h = 1; h <= a; h++) {
		cin >> c;
		if (c == 'I') {
			b++;
		}
		else {
			b--;
		}
		d = max(b, d);
	}
	cout << max(d, 0) << "\n";
	cin >> e;
}

Measured memory_bytes: 256
# 7
# 100 130 130 130 115 115 150
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
m = 1000
kabu = 0
buy = True
buy_val = 100000

for i in range(len(a)):
    if i == len(a)-1:
        m += kabu * a[i]
        kabu = 0

    elif not buy and a[i] > a[i+1]:
        m += kabu * a[i]
        kabu=0
        buy=True
    elif buy and a[i] < a[i+1]:
        kabu=int(m/a[i])
        m -= kabu * a[i]
        buy=False

print(m)


Measured memory_bytes: 27172
import java.util.Scanner;

public class Main {
	
	public static void  main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = -999999999;
		int num;
		int sans;
		int minn = sc.nextInt();
		
		for (int i=0; i<N-1; i++) {
			num = sc.nextInt();
			sans = num - minn;
			if(ans < sans) ans = sans;
			if(minn > num) minn = num;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 100076
#include<iostream>
#include<string.h>
#include<string>
#include<stack>
#include<stdlib.h>
#include<algorithm>
#include<utility>
using namespace std;
int check_v1[100010],check_v2[100010];
int main(){
	int n;
	int v1[100050],v2[100050];//1=奇数、2＝偶数
	cin>>n;
	int cnt_v1=0,cnt_v2=0;
	for(int i=1;i<=n;i++){
		if(i%2==1){
			cin>>v1[cnt_v1];
			check_v1[v1[cnt_v1]]++;
			cnt_v1++;
		}
		else{
			cin>>v2[cnt_v2];
			check_v2[v2[cnt_v2]]++;
			cnt_v2++;
		}
	}
	int first_v1=0,first_v2=0,second_v1=0,second_v2=0;
	for(int i=1;i<=100000;i++){
		if(check_v1[first_v1]<=check_v1[i]){
			second_v1=first_v1;
			first_v1=i;
		}
                else if(check_v1[second_v1]<=check_v1[i]){
			second_v1=i;
		}
		if(check_v2[first_v2]<=check_v2[i]){
			second_v2=first_v2;
			first_v2=i;
		}
		else if(check_v2[second_v2]<=check_v2[i]){
			second_v2=i;
		}
	}
	long long ans;
	long long ans1=(cnt_v1-check_v1[first_v1])+(cnt_v2-check_v2[second_v2]);
	long long ans2=(cnt_v1-check_v1[second_v1])+(cnt_v2-check_v2[first_v2]);

	if(first_v1!=first_v2){
		ans=(cnt_v1-check_v1[first_v1])+(cnt_v2-check_v2[first_v2]);
		cout<<ans<<endl;
	}
	else {
		ans=min(ans1,ans2);
		cout<<ans<<endl;
	}
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define u128 __int128
#define pb push_back

#define N 100010
#define MOD 1000000007
int n;
int a[100], b[100];

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

	int c = 0;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		b[i] = a[i];
	}
	sort(a, a + n);

	for (int i = 0; i < n; ++i)
	{
		if(a[i] != b[i])
			c++;
	}
	if(c == 2 || c == 0)
		cout << "YES\n";
	else
		cout << "NO\n";
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n; scanf("%d", &n);
	REP(i, 112345){
		int j = i * 108 / 100;
		if(j == n){
			printf("%d\n", i);
			return 0;
		}
	}
	printf(":(\n");
}


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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES\n")
#define Yes puts("Yes\n")
#define NO  puts("NO\n")
#define No  puts("No\n")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }



signed main() {

	int N, K;
	cin >> N >> K;
	vector<int> a(N);
	rep(i, N) cin >> a[i];

	int ans = 0;
	rep(i, N) rep(j, N) {
		if (i == j) continue;
		if (i < j && a[i] < a[j]) ans += K * (K-1)/2;
		if (i > j && a[i] < a[j]) ans += K*(K+1)/2;
		ans %= mod;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
N = input()
N = int(N)
N1 = N % 10
num = {2:"hon",4:"hon",5:"hon",7:"hon",9:"hon",\
        0:"pon",1:"pon",6:"pon",8:"pon",\
        3:"bon"}
if N1 in num:
    val = num[N1]
    print(val)
else:
    print("エラー")


Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
int main() {
  string N;
  cin >> N;
  sort(N.begin(),N.end());
  if(N.at(0)==N.at(1)&&N.at(2)!=N.at(1)&&N.at(2)==N.at(3)){
    cout << "Yes" <<endl;
  }else{
        cout << "No" <<endl;
  }

}


Measured memory_bytes: 256
n = gets.to_i
a = gets.chomp.split("")
b = []
d = []
for j in 0..a.length-1 do
  c = (a[j].ord-65 + n ) % 26
  b << c
end
for k in 0..a.length-1 do
  e = (b[k] + 65).chr
  d << e
end
puts d.join("")

Measured memory_bytes: 4860
import std.stdio;
import std.algorithm;
import std.math;
import std.conv;
import std.string;

int readInt(){
  return readln.chomp.to!int;
}

int[] readInts(){
  return readln.chomp.split.to!(int[]);
}

void main(){
  int[] nk = readInts();
  real ret = 0;

  foreach(i; 1 .. nk[0]+1){
    int k;
    for(int j = i; j < nk[1]; j*=2, k++){}
    ret += (1.to!real / (nk[0] * (2 ^^ k)));
  }

  writef("%.12s\n", ret);
}


Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

struct p {
    double x;
    double y;
};

void kock(int n, p p1, p p2) {
    if (n == 0) {
        return;
    }

    p s = {(2.0 * p1.x + p2.x) / 3.0, (2.0 * p1.y + p2.y) / 3.0};
    p t = {(p1.x + 2.0 * p2.x) / 3.0, (p1.y + 2.0 * p2.y) / 3.0};
    p u = {(t.x - s.x) * cos(60 * M_PI / 180) -
               (t.y - s.y) * sin(60 * M_PI / 180) + s.x,
           (t.x - s.x) * sin(60 * M_PI / 180) +
               (t.y - s.y) * cos(60 * M_PI / 180) + s.y};
    kock(n - 1, p1, s);
    cout << fixed << setprecision(10) << s.x << " " << s.y << endl;
    kock(n - 1, s, u);
    cout << fixed << setprecision(10) << u.x << " " << u.y << endl;
    kock(n - 1, u, t);
    cout << fixed << setprecision(10) << t.x << " " << t.y << endl;
    kock(n - 1, t, p2);
}

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

    int N;
    cin >> N;
    cout << fixed << setprecision(10) << 0.0 << " " << 0.0 << endl;
    kock(N, {0, 0}, {100, 0});
    cout << fixed << setprecision(10) << 100.0 << " " << 0.0 << endl;
    return 0;
}



Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) {sort(all(a));a.erase(unique(all(a)),a.end());}
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

int main(){
    ll n,k;cin>>n>>k;
    vi v(n);
    rep(i,n)cin>>v[i];
    rep(i,n-k){
        YesNo(v[i+k]>v[i]);
    }
}

Measured memory_bytes: 4840