akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
 
ll A(ll x){
    if(x>=0)return x;
    else return -x;
}
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}
 
const double PI=3.14159265358979323846;

const ll X = 1000000000000001;

ll num[100010];

int main(void){
    ll n;
    cin>>n;
    vector<ll>a(n);
    ll ans = 0;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        num[a[i]]++;
        ans+=a[i];
    }
    ll q;
    cin>>q;
    //cout<<ans<<endl;
    for(ll i=0;i<q;i++){
        ll b,c;
        cin>>b>>c;
        if(num[b]==0)cout<<ans<<endl;
        else{
            ans -= b*num[b]+c*num[c];
            num[c]+=num[b];
            num[b]=0;
            cout<<ans+c*num[c]<<endl;
            ans+=c*num[c];
        }
    }
    return 0;
}

Measured memory_bytes: 4788
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <vector>
#include <numeric>
#include<string>
#include <map>
#include <chrono>
#include <cstdlib>
#include <ctime>

using namespace std;

#define ll long long
#define rep(cnt,a,n) for(ll cnt=a;cnt<n+a;cnt++) //aから始めてn回ループ
#define vector2(type,name,a,b) vector<vector<type>> name(a, vector<type>(b))
#define PI 3.141592653589793


ll blackcount(vector<vector<ll>> mass,ll h, ll w, vector<ll> yoko, vector<ll> tate,ll blacksum, ll hnum, ll wnum){
    vector<ll>x;
    vector<ll>y;
    rep(cnt, 0, w) {
        if (wnum % (ll)2 == 1) {
            x.push_back(cnt);
        }
        wnum /= 2;
    }
    rep(cnt, 0, h) {
        if (hnum % (ll)2 == 1) {
            y.push_back(cnt);
        }
        hnum /= 2;
    }
    //cout << blacksum << endl;
    rep(cnt, 0, x.size()) {
        blacksum -= yoko.at(x.at(cnt));
    }
   // cout << blacksum << endl;
    rep(cnt, 0, y.size()) {
        blacksum -= tate.at(y.at(cnt));
    }
    //cout << blacksum << endl;
    rep(i, 0, y.size()) {
        rep(j, 0, x.size()) {
            blacksum += mass.at(y.at(i)).at(x.at(j));
        }
    }
    //cout << blacksum << endl;
    return blacksum;
}

int main() {
    ll h, w, k;
    cin >> h >> w >> k;
    vector2(ll, mass, h, w);
    char c;
    vector<ll> yoko(w, 0);
    vector<ll> tate(h, 0);
    rep(i, 0, h) {
        rep(j, 0, w) {
            cin >> c;
            if (c == '#') {
                mass.at(i).at(j) = 1;
                tate.at(i)++;
                yoko.at(j)++;
            }
            else {
                mass.at(i).at(j) = 0;
            }
        }
    }
    ll blacksum=0;
    rep(cnt, 0, w) {
        blacksum += yoko.at(cnt);
    }
    ll ans = 0;
    rep(i, 0, pow(2, h)) {
        rep(j, 0, pow(2, w)) {
            //cout << blackcount(mass, h, w, yoko, tate, blacksum, j, i) << endl;
            //cout << j << endl;
            if (blackcount(mass, h, w, yoko, tate, blacksum,i,j) == k) {
                ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 4044
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

long long t[233];

long long gcd(long long a, long long b) {
	return !b ? a : gcd(b, a%b);
}
long long lcm(long long a, long long b) {
	return a/gcd(a, b)*b;
}
int main(void) {
	int n;
	long long t;
	long long l=1;
	cin>>n;
	while (n--) {
		cin>>t;
		l=lcm(t, l);
	}
	cout<<l;
}

Measured memory_bytes: 256
s = gets.strip.split('').reverse.map {|c| c=='?' ? nil : c.to_i}
N=13
MOD = 10**9+7

dp = Array.new(13,0)
dp[0]=1

mul = 1
s.each do |num|
  ndp = Array.new(13,0)
  if num.nil?
    (0..9).each do |candidate|
      bigger = mul*candidate
      N.times do |pre|
        ndp[(bigger + pre)%N] += dp[pre]
      end
    end
  else
    bigger = mul*num
    N.times do |pre|
        ndp[(bigger + pre)%N] += dp[pre]
      end
  end
  mul = 10 * mul % N
  dp=ndp.map {|e| e%MOD }

end

p dp[5]%MOD

Measured memory_bytes: 18684
#include<iostream>
#include<algorithm>

int main(){
    long long q, h, s, d, n;
    std::cin >> q >> h >> s >> d >> n;
    h = std::min(q * 2, h);
    s = std::min(h * 2, s);
    d = std::min(s * 2, d);
    
    long long ans = 0;
    ans += d * (n / 2);
    n %= 2;
    ans += s * n;

    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  static int[] par;
  static int[] rank;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    par = new int[n];
    rank = new int[n];

    int M = sc.nextInt();
    init(n);
    int[] p = new int[n];
    for(int i = 0; i < n; i++) {
      p[i] = sc.nextInt() - 1;
    }
    int[] pos = new int[n];
    for(int i = 0; i < n; i++) {
      pos[p[i]] = i;
    }
    for(int i = 0; i < M; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;
      unite(a, b);
    }
    int ans = 0;
    for(int i = 0; i < n; i++) {
      if(same(i, pos[i])) ans++;
    }
    System.out.println(ans);
  }
  static void init(int m) {
      for(int i = 0; i < m; i++) {
        par[i] = i;
        rank[i] = 1;
      }
  }
  static int find(int x) {
      if(par[x] == x) {
        return x;
      } else {
        return par[x] = find(par[x]);
      }
  }
  static void unite(int x, int y) {
      x = find(x);
      y = find(y);
      if(x == y) return;

      if(rank[x] < rank[y]) {
        par[x] = y;
      } else {
        par[y] = x;
        if(rank[x] == rank[y]) rank[x]++;
      }
  }
  static boolean same(int x, int y) {
      return find(x) == find(y);
  }
}

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

int main()
{
	int a1, a2, a3;
	cin >> a1 >> a2 >> a3;

	if (a1 + a2 + a3 >= 22) {
		cout << "bust" << endl;
	}
	else
	{
		cout << "win" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
int const M=2e5+10,mod=1e9+7,inf=1e9+10;
set<int>st;
int a[M];
int32_t main()
{
	int n;
	cin>>n;
	bool flag=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]>=i)flag=1;
	}
	int ans=0,res=0;
	for(int i=n;i>=1;i--)
	{
		st.insert(a[i]+res);
		int tmp=*st.rbegin();
		if(tmp-res>a[i])return cout<<-1,0;
		while(st.size())
		{
			int now=*st.begin();
			if(now-res==0)st.erase(now);
			else break;
		}
		res++;
		ans+=(int)st.size();
	}
//	int t=*st.begin();
//	cout<<t-res;
	if(st.size()!=0 || flag)cout<<-1;
	else cout<<ans;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD =  1000000007;

     signed main(){
     
    int n,a;
    cin>>n>>a;
    if(n%500<=a)cout<<"Yes";
    else cout<<"No";
      }

        


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

signed main() {
    int h, w;
    while (cin >> h >> w and h and w) {
        for (int i = 0; i < h; ++i) {
            for (int j = 0; j < w; ++j) {
                if ((i + j) % 2 == 0) cout << '#';
                else cout << '.';
            }
            cout << endl;
        }
        cout << endl;
    }
}



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

const int N = 200005;
const int inf = 1e9;

struct edge_t {
	int to, cap, flow;
	edge_t(int to = 0,int cap = 0) : to(to), cap(cap), flow(0) {}
};

int n;
vector<edge_t> ed;
vector<int> g[N];
int src, snk;
int d[N];
int now[N];
int par[N], match[N];
bool visit[N];
vector<int> has[N];

void add(int u,int v,int cap) {
	g[u].push_back(ed.size()); ed.push_back(edge_t(v, cap));
	g[v].push_back(ed.size()); ed.push_back(edge_t(u, 0));
}

bool bfs() {
	fill(d, d + 2 * n + 5, -1);
	fill(now, now + 2 * n + 5, 0);
	queue<int> q;	 
	d[src] = 0; q.push(src);
	while (!q.empty()) {
		int u = q.front(); q.pop();
		for (int id : g[u]) {
			int v = ed[id].to;
			if (d[v] == -1 && ed[id].cap > ed[id].flow) {
				d[v] = d[u] + 1;
				q.push(v);
			}
		}
	}
	return d[snk] != -1;
}

int dfs(int u,int flow) {
	if (u == snk) return flow;
	for (int& i = now[u]; i < int(g[u].size()); ++i) {
		int id = g[u][i];
		int v = ed[id].to;
		if (d[v] != d[u] + 1 || ed[id].cap <= ed[id].flow) continue;
		int nxt = dfs(v, min(ed[id].cap - ed[id].flow, flow));
		if (nxt) {
			ed[id].flow += nxt;
			ed[id ^ 1].flow -= nxt;
			return nxt;
		}
	}
	return 0;
}

int max_flow() {
	int ans = 0;
	while (bfs()) {
		while (true) {
			int now = dfs(src, inf);
			if (now) {
				ans += now;
			} else {
				break;
			}
		}
	}
	return ans;
}

void solve(int u) {
	visit[u] = true;
	for (int v : has[u]) if (visit[match[v]] == false) {
		par[v] = u;
		solve(match[v]);
	}
}

int main() {
	scanf("%d", &n);
	src = 0, snk = n + n + 1;
	for (int i = 2; i <= n; ++i) {
		int u; scanf("%d", &u);
		while (u--) {
			int v; scanf("%d", &v);
			has[v].push_back(i);
			if (v > 1) {
				add(v, i + n, 1);
			}
		}
	}
	for (int i = 2; i <= n; ++i) {
		add(src, i, 1);
		add(i + n, snk, 1);
	}
	if (max_flow() != n - 1) {
		puts("-1"); return 0;
	}
	for (int u = 2; u <= n; ++u) {
		for (int id : g[u]) {
			int v = ed[id].to;
			if (v && ed[id].cap == ed[id].flow) {
				match[v - n] = u; 
			}
		}
	}
	solve(1);
	if (accumulate(visit + 1, visit + n + 1, 0) < n) {
		puts("-1"); return 0;
	}
	for (int i = 2; i <= n; ++i) {
		printf("%d %d\n", par[i], match[i]);
	}
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n, t;
  cin >> n >> t;
  int a[200001];
  rep(i, 0, n) cin >> a[i];

  int z = a[0];
  int ans = 0;
  rep(i, 1, n) {
    ans += min(a[i] - z, t);
    z = a[i];
  }
  cout << ans + t << endl;
}


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

int main()
{
        int k;
        cin >> k;
        queue<ll> q;
        rep(i,9) q.push(i+1);
        while (--k) {
                ll tmp = q.front();
                if (tmp % 10 == 0) {
                        q.push(tmp*10);
                        q.push(tmp*10 + 1);
                } else if (tmp % 10 == 9) {
                        q.push(tmp*10 + 8);
                        q.push(tmp*10 + 9);
                } else {
                        q.push(tmp*10 + (tmp%10) - 1);
                        q.push(tmp*10 + (tmp%10));
                        q.push(tmp*10 + (tmp%10) + 1);
                }
                q.pop();
                //cout << q.front() << " " << q.back() << endl;
        }

        cout << q.front() << endl;

        return 0;
}


Measured memory_bytes: 1792
// Example program
#include <iostream>
#include <string>
using namespace std;

int main()
{
    string s;
    cin >> s;
    if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]||s[3]==s[4]) cout << "Bad" << endl;
    else cout << "Good" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
using P = pair<int, int>;

template <class T>
T gcd(T x, T y)
{
    if (x < y)
    {
        std::swap(x, y); //小さい方をyとする
    }
    int r = x % y;
    while( r != 0 )
    {
        x = y;
        y = r;
        r = x % y;
    }
    return y;
}

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    int g = gcd(a, b);
    if (c % g == 0)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        char S0 = '0';
        int S0mas = 0;
        for(char str : S.toCharArray()){
            if(str == S0){
                ++S0mas;
            }
        }
        int S1mas = S.length() - S0mas;
        if(S0mas < S1mas){
            System.out.println(S0mas * 2);
        }else{
            System.out.println(S1mas * 2);
        }
    }
}

Measured memory_bytes: 28408
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=(a);i<(b);++i)

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

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}";
  return o;
}

ll const mod =1e9+7;
int main() {
  int N,M;
  ll ans=1;
  cin >> N >> M;
  if (abs(N-M)>1) {
    ans=0;
  }
  else if (M==N) {
    rep2(i,1,N+1) {
      ans *= i*i%mod;
      ans%=mod;
    }
    ans*=2;ans%=mod;
  }
  else {
    if (N>M) swap(N,M);
    rep2(i,1,N+1) {
      ans*=i*i%mod;
      ans%=mod;
    }
    ans = ans*M%mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def gcd(a,b):
        if a == 0:
            return b
        return gcd(b%a, a)
    a,b = LI()
    g = gcd(a,b)
    l = a*b//g
    print(l)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 39024
n, m = tuple(map(lambda x: int(x), input().split(" ")))
a = tuple(map(lambda x: int(x), input().split(" ")))
s = sum(a)
r = 4 * m
c = 0
for v in a:
    if v * r >= s:
        c += 1
print("No" if c < m else "Yes")

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

int main() {
  int N,M;
  scanf("%d %d", &N,&M);
  int a[M];
  for (int i = 0; i < M; ++i) {
    scanf("%d", &a[i]);
  }
  

  sort(a,a+M);
  int b[M-1];
  for (int i = M-1; i > 0; --i){
    b[i-1] = a[i] - a[i-1];
  }
  sort(b,b+M-1);


  if(N>=M) cout << 0 << endl;
  else{
    int sum = 0;
    for (int i = 0; i < M-N; ++i){
      sum += b[i];
    }
    cout << sum << endl;
  }

}

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

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

    int M, D;
    cin >> M >> D;
    int ans = 0;
    for (int m = 4; m <= M; m++) {
        for (int d = 22; d <= D; d++) {
            int d1 = d % 10, d10 = d / 10 % 10;
            if (d1 < 2 || d10 < 2) continue;

            if (m == d1 * d10) ans++;
        }    
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        x: usize,
    }
    if x<1200 {
        println!("ABC");
    } else {
        println!("ARC");
    }
}


Measured memory_bytes: 2072
// #includes {{{
#ifdef MY_DEBUG
#include "header/header.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

template<class T>
T inf(){
	return numeric_limits<T>::has_infinity?numeric_limits<T>::infinity():(numeric_limits<T>::max()/2);
}

typedef pair<int,int> pii;

#ifdef MY_DEBUG
#include"print.hpp"
#include"debug.hpp"
#endif
// }}}

int M,K;

void check(const deque<int> &d){
	assert(d.size()==(1<<(M+1)));
	vector<uint> s(d.size()+1);
	unordered_map<uint,vector<int> > pos;
	s[0] = 0;
	for(int i = 0;i < d.size();i++){
		s[i+1] = s[i] ^ d[i];
		pos[d[i]].push_back(i);
	}
	for(auto &&p:pos){
		auto &&val = p.first;
		auto &&v = p.second;
		assert(0<=val and val<(1<<M));
		assert(v.size()==2);
		int i = v[0], j = v[1];
		assert((s[j+1] ^ s[i])==K);
	}
}

int main(){
	cin>>M>>K;
	if(M==0){
		if(K==0){
			cout<<0<<" "<<0<<endl;
		}else{
			cout<<-1<<endl;
		}
		return 0;
	}else if(M==1){
		if(K==0){
			cout<<0<<" "<<0<<" "<<1<<" "<<1<<endl;
		}else{
			cout<<-1<<endl;
		}
		return 0;
	}
	if(K>=(1<<M)){
		cout<<-1<<endl;
		return 0;
	}
	deque<int> d;
	d.push_back(K);
	for(int i = 0;i<(1<<M);i++){
		if(i==K)continue;
		d.push_front(i);
	}
	for(int i = 0;i<(1<<M);i++){
		if(i==K)continue;
		d.push_back(i);
	}
	d.push_back(K);
	REP(i,d.size()){
		cout<<d[i];
		if(i+1<d.size())cout<<" ";
	}
	cout<<endl;
//	check(d);
	return 0;
}


Measured memory_bytes: 2944
#include <iostream>
#include <string>
#include <cmath>
#include <bits/stdc++.h>
#include <numeric>
#include <vector>
#include <functional>
using namespace std;
typedef long long int ll;
#define ALL(v) v.begin(), v.end()

int N,K;
const int MAX = 2000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(void){
    cin >> N >> K;
    // 前処理
    COMinit();
    // 計算例
    for(int i=1;i<=K;i++){
      cout << COM(K-1, i-1)*COM(N-K+1, i)% MOD << endl;
    }

    return 0;
 }


Measured memory_bytes: 256
N=int(input())
S=[]
T=[]
for i in range(N):
    R=int(input())
    S.append(R)
    T.append(R)

T.sort()
T.reverse()

first=T[0]
second=T[1]

for i in range(N):
    if S[i]==T[0]:
        print(T[1])
    else:
        print(T[0])



Measured memory_bytes: 82136
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int h = in.nextInt(), w = in.nextInt(), d = in.nextInt();
			P[] p = new P[h*w+1];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					int a = in.nextInt();
					p[a] = new P(i, j);
				}
			}

			int[] c = new int[h*w+1];
			int[] sum = new int[h*w+1];

			for (int i = 1; i <= d; i++) {
				for (int j = 1; j <= h*w/d; j++) {
					if (i+j*d > h*w) break;
					int f = i+j*d;
					int b = i+(j-1)*d;
					c[f] = Math.abs(p[f].h-p[b].h)+Math.abs(p[f].w-p[b].w);
					sum[f] = sum[b]+c[f];
				}
			}

			int q = in.nextInt();
			for (int i = 0; i < q; i++) {
				int l = in.nextInt(), r = in.nextInt();
				out.println(sum[r]-sum[l]);
			}


		}
	}
	static class P {
		int h, w;

		public P(int x, int y) {
			super();
			this.h = x;
			this.w = y;
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 47956
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(k):
  l=[0]*(n+1)
  for j in range(n):
    l[max(0,j-a[j])]+=1
    l[min(n-1,j+a[j])+1]-=1
  b=0
  for j in range(n):
    b+=l[j]
    a[j]=b
  if l[0]==n:
    break
print(*a,sep=' ')

Measured memory_bytes: 157200
#define ll long long int
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    ll prev,total=0;
    cin>>prev;
    for(int i=1;i<n;i++)
    {
        ll val;
        cin>>val;
        if(val>=prev)
        {
            prev=val;
            continue;
        }
        else
        {
            total+=(prev-val);
        }
    }
    cout<<total<<endl;

    return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    string s;cin>>s;
    cout<<s[0]<<s.size()-2<<s[s.size()-1];
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';
int mod = 1e9 + 7;
ll inf = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, t;
    cin >> a >> b >> t;
    cout << t / a * b << endl;
    return 0;
}

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

int main()
{
    int n;
    cin>>n;
    vector<vector<int>> G(n);
    vector<pair<int,int>> vp;
    for (int i=1;i<n;i++){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
        vp.emplace_back(a,b);
    }

    int k=0;
    vector<int> c(n,0);
    map<pair<int,int>,int> i;
    queue<int> que;
    vector<int> seen(n,0);
    seen[0]=1;
    que.push(0);

    while(!que.empty()){
        int v=que.front();
        que.pop();
        k=max(k,(int)G[v].size());
        int col=1;
        for (int nv:G[v]){
            if (seen[nv]==1) continue;
            if (col==c[v]) col++;
            c[nv]=i[make_pair(v,nv)]=i[make_pair(nv,v)]=col;
            col++;
            seen[nv]=1;
            que.push(nv);
        }
    }
    cout<<k<<endl;
    for (auto p:vp) cout<<i[p]<<endl;
    return 0;

}

Measured memory_bytes: 22700
N, M = map(int,input().split())
cnt = 0
#cが余る（Sが使い切れる）とき
if 2*N <= M:
  cnt += N
  M -= 2*N
  cnt += M//4
  print(cnt)
#cが足りない（Sが余る）とき
else:
  print(M//2)




Measured memory_bytes: 9176
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		int N = 999999;
		boolean[] primes = new boolean[N + 1];
		int[] counts = new int[N + 1];

		for (int i = 2; i < N / 2 + 1; i++) {
			if (!primes[i]) {
				for (int j = 2; j < N / i + 1; j++) {
					primes[i * j] = true;
				}
			}
		}
		int count = 0;
		for (int i = 2; i < N + 1; i++) {
			if (!primes[i]) {
				count++;
			}
			counts[i] = count;
		}

		while ((line = br.readLine()) != null && !line.isEmpty()) {
			System.out.println(counts[Integer.parseInt(line)]);
		}
	}
}

Measured memory_bytes: 27296
import java.util.Scanner;

public class Main {

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

		String S = sc.next();
		char[] C = S.toCharArray();
		int len = C.length;
		int[] childs = new int[len];
		int Rstart = 0;
		int Rend = 0;
		int Lstart = 0;
		int idx;

		char prevChar = 'R';
		for (idx = 1; idx <= len; idx++) {

			if (idx == len || C[idx] == 'R') {
				//R
				if (prevChar == 'L') {
					//(L→)R
					childs[Lstart - 1] += (idx - Lstart) / 2;
					childs[Lstart] += (idx - Lstart + 1) / 2;

					//
					Rstart =  idx;
				}
				prevChar = 'R';
			} else {
				//L
				if (prevChar == 'R') {
					//(R→)L
					childs[idx - 1] = (idx - Rstart + 1) / 2;
					childs[idx] = (idx - Rstart) / 2;

					Rend = idx - 1;
					Lstart = idx;
				}
				prevChar = 'L';
			}
		}

		// output
		for (idx = 0; idx < len; idx++) {
			System.out.print(childs[idx] + " ");

		}

	}

}


Measured memory_bytes: 43320
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < (n); i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, k, n) for (int i = (k); i < (n); i++)
#define REPEACH(itr, k) for (auto &&itr : k)
#define MOD 1000000007

using namespace std;
typedef long long ll;

const ll INF = 1LL<<60;
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;}

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    map<ll,int> m;
    REP(i,n){
        cin >> a[i];
        m[a[i]]++;
    }
    ll mfir=0;
    ll msec=0;
    for(auto const& i : m){
        if(i.second>=4){
            mfir=i.first;
            msec=i.first;
        }
        else if(i.second>=2){
            msec=mfir;
            mfir=i.first;
        }
    }
    cout << mfir*msec << endl;
}

Measured memory_bytes: 7296
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		sc.close();
		int s = N*(N-1)/2 + M*(M-1)/2;
		System.out.println(s);
	}

}

Measured memory_bytes: 21972
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main (void)
{
	int N;
	long long K;
	cin >> N >> K;
	

	vector<int> P;
	vector<long long> C;

	P.resize (N);
	C.resize (N);

	long long highscore, score;
	
	for (auto &e: P)
		cin >> e;

	for (auto &e: C)
		cin >> e;

	highscore = C [0];

	vector <long long> loop, loopLength;
	loop.resize (N);
	loopLength.resize (N);
	
	int i;
	for (int initial = 0; initial < N; initial++)
	{
		i = initial;
		loop [initial] = C [i];
		loopLength [initial] = 1;
		i = P[i] - 1;
		
		for (long long k = 1; i != initial; k++)
		{
			loop [initial] += C[i];
			loopLength [initial] = k + 1;
			i = P[i] - 1;
		}
	}

	for (int initial = 0; initial < N; initial++)
	{
		if (loop [initial] >= 0)
		{
			long long tmp = (long long) (K / loopLength [initial]) - 1;
			long long K2 = (long long) (K % loopLength [initial]) + loopLength [initial];
			score = loop [initial] * tmp;
			int i = initial;
							
			if (tmp == -1)
			{
				i = P [i] - 1;
				score = C [i];
				if (highscore < score)
					highscore = score;
					
				for (int k = 1; k < K; k++)
				{
					i = P [i] - 1;
					score += C [i];
					if (highscore < score)
						highscore = score;
				}
			}
			else
			{
				if (highscore < score)
					highscore = score;
				for (int k = 0; k < K2; k++)
				{
					if (highscore < score)
						highscore = score;
					i = P [i]-1;
					score += C [i];
					if (highscore < score)
						highscore = score;
				}
			}
		}
		else
		{
			i = initial;
			long long K2;
			if (K > loopLength [initial])
				K2 = loopLength [initial] + 1;
			else
				K2 = K;
			score = 0;

			for (int k = 0; k < K2; k++)
			{
				i = P [i]-1;
				score += C [i];
				if (highscore < score)
					highscore = score;
			}
		}
	}
	
	cout << highscore << endl;
	return 0;
}

Measured memory_bytes: 3720
import java.util.Arrays;
import java.util.Scanner;

class Main {

    public static final int INF = Integer.MAX_VALUE / 4;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();
        int[] c = new int[M];
        for (int i = 0; i < M; i++) {
            c[i] = scanner.nextInt();
        }
        int[] dp = new int[N + 1];
        Arrays.fill(dp, INF);
        dp[0] = 0;
        for (int i = 1; i <= N; i++) {
            for (int j = 0; j < M; j++) {
                if (c[j] <= i) {
                    dp[i] = Math.min(dp[i], dp[i - c[j]] + 1);
                }
            }
        }
        System.out.println(dp[N]);
    }
}


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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(ll i= (a); i < (ll)(b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    ll N, K; cin >> N >> K;
    ll ans = 0;
    REP(i, N) {
        ll x; cin >> x;
        ans += min(x, K - x) * 2;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3520
#include <stdio.h>

int main(void){
int r;
int g;
int b;
int goukei;

scanf("%d%d%d",&r,&g,&b);

goukei = ((100*r)+(10*g)+b)%4;

if(goukei==0){
printf("YES");
}else{
printf("NO");
}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; cin >> n;
    VL a(n), b(n); cin >> a >> b;

    function<bool(int)> check = [&](int x)->bool {
        return b[(x - 1 + n) % n] + b[(x + 1) % n] <= b[x];
    };

    bool ok = true;
    queue<int> q;
    FOR(i, 0, n) {
        ok &= a[i] <= b[i];
        if (check(i))q.push(i);
    }

    ll ans = 0;
    while (!q.empty()) {
        int x = q.front(); q.pop();
        ll s = b[(x - 1 + n) % n] + b[(x + 1) % n];
        if (a[x] <= b[x] % s) {
            ans += b[x] / s;
            b[x] %= s;
        }
        else {
            ok &= (b[x] - a[x]) % s == 0;
            ans += (b[x] - a[x]) / s;
            b[x] = a[x];
        }
        if (check((x - 1 + n) % n))q.push((x - 1 + n) % n);
        if (check((x + 1) % n))q.push((x + 1) % n);
    }

    FOR(i, 0, n)ok &= a[i] == b[i];
    cout << (ok ? ans : -1) << "\n";
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
int n;
vector <string> str;
string mem[15][15];
typedef pair <string,int> P;

string con(string a,string b){
  int K=0;
  for(int i=0;i<a.size();i++){
    int j=i,k=0;
    while(a[j]&&b[k]&&a[j]==b[k]) j++,k++;
    if(!a[j]||!b[k])K=max(K,k);
  }
  return b.substr(K,b.size());
}

string solve(){
  string dp[1<<14][14];
  for(int i=0;i<n;i++) dp[1<<i][i]=str[i];
  
  for(int i=0;i<(1<<n);i++)
    for(int k=0;k<n;k++){
      if(dp[i][k]=="")continue;
      for(int j=0;j<n;j++){
	if((i&(1<<j)))continue;
	string nx=dp[i][k]+mem[k][j];
	int ni=i|1<<j;
	if(!dp[ni][j].size()||nx.size()<dp[ni][j].size()) dp[ni][j]=nx;
	else if(nx.size()==dp[ni][j].size()&&dp[ni][j]>nx)dp[ni][j]=nx;
      }
    }

  string res;
  for(int i=0;i<n;i++) {
    if(dp[(1<<n)-1][i]=="")continue;
    if(res==""||res.size()>dp[(1<<n)-1][i].size()) res=dp[(1<<n)-1][i];
    else if(dp[(1<<n)-1][i].size()==res.size()) res=min(res,dp[(1<<n)-1][i]);
  }
  return res;
}

int main(){
  
  while(cin>>n,n){
    str.resize(n);
    for(int i=0;i<n;i++)cin>>str[i];

    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++){
	if(i==j)continue;
	if(con(str[i],str[j])==""){
	  str.erase(str.begin()+j);
	  n--;
	  i=-1;
	  break;
	}
      }
    
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)mem[i][j]=con(str[i],str[j]);

    cout<<solve()<<endl;
  }

  return 0;
}

Measured memory_bytes: 3444
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h1 = sc.nextInt()*60;
        int m1 = sc.nextInt();
        int h2 = sc.nextInt()*60;
        int m2 = sc.nextInt();
        int k = sc.nextInt();
        int life = (h2+m2) - (h1+m1);    
        System.out.println(life-k);
    }
}

Measured memory_bytes: 35700
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    if (s[0]==s[1] || s[1]==s[2] || s[2]==s[3]) cout << "Bad\n";
    else cout << "Good\n"; 
    return 0;
}


Measured memory_bytes: 256
import collections

N=int(input())
l=list(map(int,input().split()))
c=collections.Counter(l)
cv=list(c.values())
ck=list(c.keys())
if len(cv) == 3 and cv[0] == cv[1] and cv[1] == cv[2] and ck[0]==ck[1]^ck[2]:
    print("Yes")
elif len(cv) == 2 and ((cv[0] == cv[1]*2 and ck[1]==0) or (cv[1] == cv[0]*2 and ck[0]==0)):
    print("Yes")
elif len(cv) == 1 and ck[0] == 0:
    print("Yes")
else:
    print("No")


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

def main():
    x1, y1, x2, y2 = map(int, input().split())
    diff_x = x2 - x1
    diff_y = y2 - y1
    x3 = x2 - diff_y
    y3 = y2 + diff_x
    x4 = x1 - diff_y
    y4 = y1 + diff_x
    print(x3, y3, x4, y4)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define u 1000000
using namespace std;
int main()
{
    string s;
    int c=0,l=0;
    int a[6];
    memset(a,0,sizeof(a));
    cin>>s;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='S')
            l++;
        else if(s[i]=='R')
            {
                a[l]=a[l]+1;
            }
    }
    sort(a,a+l+1,greater<int>());
    cout<<a[0]<<endl;




 return 0;
}


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

using namespace std;

#define mp make_pair
#define F first
#define S second
#define pb push_back
#define fo(i, n) for(int i = 1; i <= n; ++i)

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

const int N = 200200;
const int mod = 1e9 + 7 ;
int n, p[N], ans;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin>>n;
	fo(i,n)
		cin>>p[i];
	fo(i, n)
	{
		if(p[i]==i)
		{
			swap(p[i+1],p[i]);
			ans++;
		}
	}
	cout<<ans;
	return 0;
}
               

Measured memory_bytes: 640
#include <iostream> 
#include <cstdio> 
#include <fstream> 
#include <algorithm> 
#include <cmath> 
#include <deque> 
#include <vector> 
#include <queue> 
#include <string> 
#include <cstring> 
#include <map> 
#include <stack> 
#include <set> 
using namespace std;
int main(){
int a[100001];
int n,A;
cin>>n>>A;
for(int i=0;i<n;i++)
{cin>>a[i];
 A-=a[i];
}
sort(a,a+n);
A/=a[0];
cout<<(n+A);
system("pause");
return 0;
}

Measured memory_bytes: 504
using System;

class Program
{
    static void Main()
    {
        for(int i = 1; i < 10 ; ++i)
        {
            for(int j = 1; j < 10 ; ++j)
            {
                Console.WriteLine("{0}x{1}={2}",i,j,i*j);
            }
        }
    }
}

Measured memory_bytes: 8864
s = list(map(int,list(input())))
a = s[0]*10+s[1]
b = s[2]*10+s[3]
lst = [1,2,3,4,5,6,7,8,9,10,11,12]
if a in lst:
    if b in lst:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if b in lst:
        print('YYMM')
    else:
        print('NA')

Measured memory_bytes: 3060
#include <stdio.h>

int main(){
	int d, r, a, b;
	double f;
	scanf("%d", &a);
	scanf("%d", &b);
	d = a / b;
	r = a % b;
	f = (double)a / (double)b;
	
	printf("%d ", d);
	printf("%d ", r);
	printf("%.5lf\n", f);
	return 0;
}


Measured memory_bytes: 2756
//It is good to start with zero//
//    kyu @Aryabhatta//




#include<bits/stdc++.h> 
using namespace std;                          
#pragma GCC optimize("O3")
typedef long long ll;
#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define vec(i, a)  for( auto i=a.begin();i != a.end(); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define mp make_pair
#define pb push_back
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define in  freopen("input.txt","r",stdin);
#define out freopen("output.txt","w",stdout);
#define sixfive in out 
typedef long double ld;
typedef std::pair<ll, ll> pii;
typedef std::vector<ll> vi;
const ll MOD = 1e9 + 7;
ll n_bits(ll n ) { ll x= __builtin_popcount(n) ;return x ;}
int pow(int a, int b, int m)
{
    int ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%m;
        b/=2;
        a=(a*a)%m;
    }
    return ans;
}
int main()
{    
    #ifndef ONLINE_JUDGE
    sixfive
    #endif
    fast
    ll t=1;
    //cin>>t;
    while(t--)
    {    
        string ans="ACL";

        int k;
        cin>>k;
        k--;
        for(int i=0;i<k;i++)
        {
            ans+="ACL";
        }
        cout<<ans;
    }
    return 0;
}

//            sometimes I do it for her...//

Measured memory_bytes: 3572
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
	
	double n;
	int m;
	
	while(true){
		cin >> n >> m;
		
		if(m == 0){
			break;
		}
		
		bool flag = false;
		
		for(int i = 0; i < m; i++){
			int num;
			cin >> num;
			if(num == 1){
				flag = true;
			}
		}
		if(flag){
			cout << 0 << endl;
		}else{
			printf("%.10f\n", n / 2.0);
		}
	}
	
	return 0;
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check();


// bool cmp(pair<int,int>p,pair<int,int>q) {
//     return p.first>q.first;//descending by first
//     return p.first<q.first;//ascending by first
//     return p.second>q.second;//descending by second
//     return p.second<q.second;//ascending by second
// }

bool cmp(int p,int q) {
    return p>q;//descending
    // return p<q;//ascending
}

int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }
    return 0;
}
int clue() {

    int d,t,s;
    cin>>d>>t>>s;
    (t*s>=d)?cout<<"Yes"<<endl:cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>

int main (void)
{
	int x , a , b , c , total = 0;
	scanf("%d %d %d" , &a , &b ,&c);
	for(x = a; x <= b ; x++)
	{
		if(c % x == 0)
		{
			total++;
		} 
	}
	printf("%d\n" , total);
	return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("dichromatic.in","r",stdin)
#define OUT freopen("dichromatic.out","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define sq(x)  ((x)*(x))

using namespace __gnu_pbds;
using namespace std ;

#define maxn 200005
#define mod 1000000007LL

typedef  long long int T ;

const int N = 100000 ;

int bigMod(int a, int n, int m)
{
    if(n==0 ) return 1 ;
    int r = bigMod(a,n/2,m) ;
    r = (1LL*r*r)%m ;
    if(n&1) r = (1LL*r*a)%m ;
    return r ;
}


int fact[maxn] , invFact[maxn] ;
int dp[maxn] , cnt[maxn] ;
int a[maxn] ;

int C(int n, int r)
{
    return (1LL*fact[n]*((1LL*invFact[r]*invFact[n-r])%mod))%mod ;
}

int main()
{
    fact[0] =1 ;
    for(int i=1 ; i<=2*N ; i++) fact[i] = (1LL*fact[i-1]*i)%mod ;
    invFact[2*N] = bigMod(fact[2*N],mod-2,mod) ;
    for(int i=2*N -1 ; i>=0 ; i--) invFact[i] = (1LL*invFact[i+1]*(i+1))%mod ;

  //  for(int i=0 ; i<=N ; i++) printf("%d\n",invFact[i]) ;

  //  printf("%d %d\n",fact[6],C(6,2)) ;

    int n , X ;
    scanf("%d %d",&n,&X) ;

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

    sort(a+1,a+n+1) ;

    for(int i=1 ; i<=n ; i++) cnt[ a[i] ]++ ;

    for(int i=1; i<=N ; i++) cnt[i] += cnt[i-1] ;

    dp[0] = 0 ;

    for(int i=1 ; i<=N ; i++)
    {
        if( cnt[i]==0 )
        {
            dp[i] = i ;
            continue ;
        }

        for(int j=cnt[i] ; j>=1 ; j--)
        {
            int m = a[ j ] ;
            int r = i%m ;

            int ret = dp[r] ;
            ret = (1LL*ret*fact[cnt[i]-1])%mod ;
            ret = (1LL*ret*invFact[cnt[r]])%mod;

//            printf("%d----%d %d\n",i,r,ret) ;

            dp[i] = (dp[i]+ret)%mod ;
        }
  //      printf("%d--> %d\n",i,dp[i]) ;
    }

    int ans = (1LL*dp[X]*fact[n])%mod ;
    ans = (1LL*ans*invFact[cnt[X]])%mod ;

    printf("%d\n",ans) ;

    return  0 ;
}


Measured memory_bytes: 2560
input()
s = input()
pair = ["SS", "SW", "WS", "WW"]
replace = {"S": "W", "W": "S"}
hasFound = False
for i in pair:
    for j in s[1:]:
        if j is 'o':
            if i[-1] is 'S':
                i += i[-2]
            else:
                i += replace[i[-2]]
        else:
            if i[-1] is 'S':
                i += replace[i[-2]]
            else:
                i += i[-2]
    if i[0] is i[-1]:
        if s[0] == 'o':
            hasFound = i[0] is 'S' and i[-2] is i[1] or i[0] is 'W' and i[-2] is not i[1]
        else:
            hasFound = i[0] is 'S' and i[-2] is not i[1] or i[0] is 'W' and i[-2] is i[1]
    if hasFound:
        print(i[:-1])
        break
if not hasFound:
    print(-1)

Measured memory_bytes: 3564
#include<stdio.h>
int main(void)
{
	int n;
	int t[101],z[101];;
	int a,b,c,d;
	int i,j;
	
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		t[i]=0;
		z[i]=1;
	}
	for(i=0;i<n*(n-1)/2;i++){
		scanf("%d %d %d %d",&a,&b,&c,&d);
		if(c>d){
			t[a]+=3;
		}
		else if(c<d){
			t[b]+=3;
		}
		else if(c==d){
			t[a]+=1;
			t[b]+=1;
		}
	}
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(t[i]>t[j]){
				z[j]++;
			}
		}
	}
	for(i=1;i<=n;i++){
		printf("%d\n",z[i]);
	}
	return 0;
}

Measured memory_bytes: 1028