akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=200000;

int n,m;
char s[MAXN+1];
vector<int> adj[MAXN];

bool alive[MAXN];
int cnt[MAXN][2];
int q[MAXN],qhead,qtail;

void run() {
	scanf("%d%d",&n,&m);
	scanf("%s",s);
	REP(i,m) { int a,b; scanf("%d%d",&a,&b); --a,--b; adj[a].PB(b); adj[b].PB(a); }

	REP(i,n) alive[i]=true;
	REP(i,n) cnt[i][0]=cnt[i][1]=0;
	REP(i,n) REPSZ(j,adj[i]) { int k=adj[i][j]; ++cnt[i][s[k]-'A']; }
	qhead=qtail=0; REP(i,n) if(cnt[i][0]==0||cnt[i][1]==0) { alive[i]=false; q[qhead++]=i; }
	//REP(i,n) printf("%d: %d/%d\n",i,cnt[i][0],cnt[i][1]);
	while(qtail<qhead) {
		int at=q[qtail++];
		//printf("processing %d\n",at+1);
		REPSZ(i,adj[at]) { int to=adj[at][i]; --cnt[to][s[at]-'A']; if(alive[to]&&(cnt[to][0]==0||cnt[to][1]==0)) alive[to]=false,q[qhead++]=to; }
	}
	REP(i,n) if(alive[i]) { printf("Yes\n"); return; } printf("No\n");
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 12928
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            sS = Console.ReadLine().Trim().Split(' ');
            List<int> lstA = new List<int>();
            for (int i = 0; i < sS.Length; i++) { lstA.Add(int.Parse(sS[i])); }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iOut = 0;
            lstA.Sort(delegate (int mca1, int mca2) { return (int)(mca2 - mca1); });              // aの降順
            int iA = 0, iB = 0;
            for (int i = 0; i < lstA.Count; i++)
            {
                if (i % 2 == 0) { iA += lstA[i]; }
                else            { iB += lstA[i]; }
            }
            iOut = iA - iB;

            // 出力
            Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, c;
    cin>>a>>b>>c;
    int i, flag = 0;
    for(i = 1; i<=b; i++)
    {
        int p = a * i;
        if(p%b == c)
        {
            flag++;
            break;
        }
    }
    if(flag == 0)
    {
        cout<<"NO"<<endl;
        return 0;
    }
     cout<<"YES"<<endl;
     return 0;
}


Measured memory_bytes: 3532
def main():
    numbers = input().split(" ")
    takahashi = int(numbers[0])
    aoki = int(numbers[1])
    repeat = int(numbers[2])
    if repeat == 0:
        pass
    elif takahashi >= repeat and takahashi > 0:
        takahashi -= repeat
    elif aoki == 0:
        takahashi -= min(takahashi, repeat)
    elif takahashi == 0 and aoki >= repeat:
        aoki -= repeat
    elif takahashi + aoki < repeat:
        aoki = 0
        takahashi = 0
    else:
        aoki += takahashi
        aoki -= repeat
        takahashi = 0

    print(str(takahashi) + " " + str(aoki))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>//toINFandByd
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define endl "\n"
using namespace std;
typedef long long ll;

void solve(){
    ll n;
    cin >> n;
    ll i;
    ll ans = 0;
    for(i=1;i<=n;i++){
        ll m = n/i;
        ll temp = (m*(m+1))/2;
        temp*=i;
        ans+=temp;
    }
    cout << ans << endl;
}   

int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
    //     freopen("output.txt","w",stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

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

int main(){
    ll N,Q; 
    cin >> N;
    vector<ll> A(N);
    for(ll i=0;i<N;i++)cin >> A[i];
    cin >> Q;
    vector<ll> B(Q),C(Q);
    for(ll i=0;i<Q;i++)cin >> B[i] >> C[i];

    map<ll ,ll> D;
    //for(ll i=0;i<=100004;i++)D[i] = 0;
    for(ll i=0;i<N;i++)D[A[i]] += 1;
    ll sum = 0;
    for(ll i = 0;i<N;i++)sum += A[i];
    for(ll q=0;q<Q;q++){
        sum -= B[q]*D[B[q]];
        sum += C[q]*D[B[q]];
        D[C[q]] += D[B[q]];
        D[B[q]] = 0;
        cout << sum << endl;
    }
}

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

int main(){
  string s;
  cin >> s;
  int N = s.size();
  int count0 = 0, count1 = 0;
  for(int i = 0; i < N; i++){
    if(s[i] == '0') count0++;
    else count1++;
  }
  cout << 2*min(count0, count1) << endl;
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}


void Main()
{
    LL n;cin>>n;

    if(n==1){
        cout<<0<<endl;
        return;
    }


    LL r10=1;
    LL r8=1;
    LL r9=1;
    REP(i,n){
        r10 *= 10;
        r10 %= MOD;
        r9 *= 9;
        r9 %= MOD;
        r8 *= 8;
        r8 %= MOD;
    }
    
    //dump(r10)
    //dump(r9)
    //dump(r8)
    LL result = r10-(r9-r8)-r9 +MOD+MOD+MOD;
    result %= MOD;
    cout<<result<<endl;




    
    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int 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;}

ll const mod = 1e9+7;

int up(int i,int k) {
  return (i+k-1)/k;
}

int main() {
  string S;
  cin >> S;
  int x,y;
  cin >> x >> y;
  vector<vector<int>> val(2);
  S = S + "T";
  int t = 0,axis = 0;
  vector<int> sumxy(2,0);

  rep(i,S.size()) {
    if (S[i]=='F') {
      t++;
    }
    else {
      val[axis].push_back(t);
      sumxy[axis]+=t;
      t=0;
      axis = (axis+1)%2;
    }
  }

  int xmax = 0;
  vector<vector<int>> dpx(val[0].size()+1,vector<int> (8001,0)),
  dpy(val[1].size()+1,vector<int> (8001,0));
  
  dpx[0][0] = 1;
  rep2(i,1,val[0].size()+1) {
    xmax+=val[0][i-1];
    rep2(j,val[0][0],xmax+1) {
      dpx[i][j] = dpx[i-1][j];
      if (j-val[0][i-1]>=0 && dpx[i-1][j-val[0][i-1]]>0) dpx[i][j]=1;
    }
  }

  xmax=0;
  dpy[0][0] = 1;
  rep2(i,1,val[1].size()+1) {
    xmax+=val[1][i-1];
    rep(j,xmax+1) {
      dpy[i][j] = dpy[i-1][j];
      if (j-val[1][i-1]>=0 && dpy[i-1][j-val[1][i-1]]>0) dpy[i][j]=1;
    }
  }

  // cout << dpx[val[0].size()][(x+sumxy[0])/2] << ' ' << dpy[val[1].size()][(y+sumxy[1])/2] << endl;
  if ( (x+sumxy[0])%2==0 && (y+sumxy[1])%2==0 && dpx[val[0].size()][(x+sumxy[0])/2]>0 && dpy[val[1].size()][(y+sumxy[1])/2]>0)
    cout << "Yes\n";
  
  else cout << "No\n";
}

Measured memory_bytes: 248704
def solve():
    N, Ma, Mb = map(int, input().split())
    a, b, c = [], [], []

    for i in range(N):
        ai, bi, ci = map(int, input().split())
        a.append(ai)
        b.append(bi)
        c.append(ci)

    nvals = 99 * N * 2 + 1
    inf = 40 * 100 + 1
    dp = [inf] * nvals

    for i in range(N):
        v = Mb * a[i] - Ma * b[i]

        if i == 0:
            dp[v] = c[i]
            continue

        if v > 0:
            for j in range(99 * N, -99 * N + v - 1, -1):
                dp[j] = min(dp[j], dp[j - v] + c[i])
        else:
            for j in range(-99 * N, 99 * N + v + 1):
                dp[j] = min(dp[j], dp[j - v] + c[i])

        dp[v] = min(dp[v], c[i])

    ans = dp[0]

    if ans < inf:
        print(ans)
    else:
        print(-1)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 3188
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    int n = 1;
    int pay ;

    
    while (n){
        int cent = 0;
        
        cin >>n;
        if (n==0){
            break;
        }
    

    
    pay = 1000 - n;
    
    if (pay >= 500){
        pay -= 500;
        cent++;
    }
    
    while (pay >= 100){
        pay -= 100;
        cent++;
    }
    
    while (pay >= 50){
        pay -= 50;
        cent++;
    }
    
    while (pay >= 10){
        pay -= 10;
        cent++;
    }
    
    while (pay >= 5){
        pay -= 5;
        cent++;
    }
    
    while (pay >= 1){
        pay -= 1;
        cent++;
    }
    
    cout << cent << "\n";
 
    
    }
    return 0;

}

Measured memory_bytes: 2988
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class ATrain {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n, i;
	    in >> n >> i;
	    out << n - i + 1 << endl;
	}
};


int main() {
	ATrain solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

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

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

using namespace std;

int main()
{
  int a[5];
  REP(i,5) {
    cin >> a[i];
  }
  int result = 644;
  REP(i,5) {
    int tmp = 0;
    REP(j,5) {
      if (i == j) continue;
      if (a[j]%10 == 0) {
        tmp += a[j];
      } else {
        tmp += ((a[j] + 10)/10)*10;
      }
    }
    tmp += a[i];
    result = min(tmp, result);
  }
  cout << result << endl;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main(){
	int a,b,c;scanf("%d %d %d",&a,&b,&c);
	if(a==b && b==c)printf("No");
	else if(a==b||b==c||c==a)printf("Yes");
	else printf("No");
	return 0;
	} 


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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}


signed main() 
{
  string s; cin>>s;
  int c[3]={};
  rep(i,3)
  {
    if(s[i]=='a') c[0]++;
    else if(s[i]=='b') c[1]++;
    else c[2]++;
  }
  if(c[0]==1&&c[1]==1&&c[2]==1) print("Yes");
  else print("No");

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x1,x2;
  cin>>x1>>x2;
  int price1,price2;
  price1=round(x1/0.08),price2=x2*10;
  int Min,Max;
  Min=min(price1,price2);
  Max=max(price1,price2);
  //cout<<Min<<Max<<endl;
  for(int i=Min;i<=Max;i++){
    if(floor(i*0.08)==x1&&floor(i*0.10)==x2){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
}

Measured memory_bytes: 256
import sys
from collections import deque
n, m = map(int, input().split( ))
Edg = [[] for _ in range(n)]
rev_Edg = [[] for _ in range(n)]
deg = [len(rev_Edg[i]) for i in range(n)]


Root_check = [1]*n
Dist = [0]*n
for i in range(m):
    v1,v2 = map(int, sys.stdin.readline().split( ))
    v1-=1
    v2-=1
    Edg[v1].append(v2)
    rev_Edg[v2].append(v1)
    deg[v2] += 1
    Root_check[v2] = 0
    

Q =deque()
for i in range(n):
    if Root_check[i] == 1:
        Q.append(i)

while len(Q) > 0:
    v = Q.popleft()
    for w in Edg[v]:
        Dist[w] = max(Dist[w],Dist[v] +1)####
        deg[w] -=1 ############
        if deg[w] == 0:##########
            Q.append(w)###########
            


print(max(Dist))


Measured memory_bytes: 66224
#include <iostream>
using namespace std;
int StartDebt = 100000;

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		StartDebt *= 1.05;
		if(StartDebt % 1000 != 0){
			StartDebt = 1000 * (StartDebt / 1000 + 1);
		}
	}
	cout << StartDebt << endl;
	return 0;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
  using namespace std;
  #define int long long int 
  #define vi vector<int>
  #define pii pair<long long ,long long>
  #define pll pair<int,int>
  #define mod 1000000007
  #define hell 998244353
  #define all(x) x.begin(),x.end()
  #define mp(x,y) make_pair(x,y)
  #define mem(a,val) memset(a,val,sizeof(a))
  #define eb push_back
  #define ff first
  #define ss second
  #define rep(n) for(int i=0;i<n;i++)
  #define lb lower_bound
  #define up upper_bound
  
  void solve()
  { 
     int n;
     cin>>n;
    double ans;
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
       if(i & 1)
         cnt++;
    }
    ans=(double)(cnt)/(double)(n);
    cout<<fixed<<setprecision(10)<<ans;
    

  }



  signed main()
  {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


   
    
     
    
    int T;
    T=1;
    
    while(T--)
    {
      solve();
    }
    return 0;
  }

Measured memory_bytes: 384
#include<stdio.h>

int main()
{
	int W,H;
	int i,j;
	
	while(scanf("%d %d",&H,&W)!=EOF)
	{
		if(H==0&&W==0)break;
		else
		{
			for(i=0;i<H;i++)
			{
				for(j=0;j<W;j++)
				{
					if(i==0||i==H-1||j==0||j==W-1)printf("#");
					else printf(".");
				}
				printf("\n");
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
#include <boost/foreach.hpp>
using namespace std;
#define pi 2*asin(1.0)
#define MAX 10000000
#define MOD 1000000007
#define _GLIBCXX_DEBUG
 
vector<long> fac(MAX);
vector<long> finv(MAX);
vector<long> inv(MAX);
vector<long> Primelist;
//template functions
/////////////////////////
void Prinit(){
long PR=10000001;
vector<long> P(PR,0);
for(long i=2;i*i<PR;i++){
    if(P.at(i)==0){
        long j=i;
      j+=i;
        while(j<PR){
            P.at(j)=1;
             j+=i;         
        }
    }
}

for(long i=2;i*i<PR;i++){//Primelist.size()=446
    if(P.at(i)==0){
        Primelist.push_back(i);
    }
}
}

void Cominit(){
  fac.at(0)=fac.at(1)=1;
  finv.at(0)=finv.at(1)=1;
  inv.at(1)=1;
  for(long i=2;i<MAX;i++){
      fac.at(i)=(fac.at(i-1)*i)%MOD;
      inv.at(i)=MOD-inv.at(MOD%i)*(MOD/i)%MOD;
      finv.at(i)=finv.at(i-1)*inv.at(i)%MOD;
  }
}

long facComb(long N,long M){// nCm%
if(N<M) return 0;
if(N<0||M<0) return 0;
return fac.at(N)*(finv.at(M)*finv.at(N-M)%MOD)%MOD;
}

long Comb(long N,long M){// nCm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
for(long i=M;i>0;i--){
    ans=ans/i;
}
return ans;
}

long Perm(long N,long M){// nPm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
return ans;
}

long GCM(long A,long B){
            long W,r;
    if(A<B){

        W=B;
        B=A;
        A=W;
    }
    while(A%B!=0){
        r=A%B;
        A=B;
        B=r;
    }
    return B;
}
long LCM(long A,long B){
    return (A*B)/GCM(A,B);
}

long upDiv(long a,long b){
  return (a+b-1)/b;
}

long strtolong(string str){
istringstream ss;
ss=istringstream(str);
long num;
ss>>num;
return num;
}

long chartolong(char ch){
long num;
num=ch-'0';
return num;
}

string longtostr(long N){
    string str;
    str=to_string(N);
    return str;
}







/////////////////////////


//Answer


int main() {
long N,ans=0;
cin>>N;
vector<long> d(N);
for(long i=0;i<N;i++){
cin>>d.at(i);
}
for(long i=0;i<N;i++){
    for(long j=i+1;j<N;j++){
        ans+=d.at(i)*d.at(j);
    }
}
cout<<ans<<endl;



}





Measured memory_bytes: 237472
#include<iostream>
using namespace std;
int main()
{
	int r, c;
	cin >> r >> c;
	int table[101][101] = {0};
	int sum = 0;
	for(int i = 0;i < r;i++)
	{
		for(int j = 0;j < c;j++)
		{
			cin >> table[i][j];
			table[i][c] += table[i][j];
			table[r][j] += table[i][j];
			sum += table[i][j];
		}
	}
	table[r][c] = sum;
	for(int i = 0;i <= r;i++ )
	{
		for(int j = 0;j < c;j++)
		{
			cout << table[i][j] << " ";
		}
		cout << table[i][c] << endl;
	}
	return 0;
}


Measured memory_bytes: 3132
(let* ((n (cons (read) (read)))
       (m (cons (read) (read)))
       (g (lcm (car m) (cdr m))))
  (princ (- (- (cdr n) (1- (car n)))
            (- (floor (cdr n) (car m)) (floor (1- (car n)) (car m)))
            (- (floor (cdr n) (cdr m)) (floor (1- (car n)) (cdr m)))
            (* -1 (- (floor (cdr n) g) (floor (1- (car n)) g))))))

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

#define f first
#define s second
#define ins insert
#define eb emplace_back
#define endl '\n'
#define ll long long
#define ld long double
#define vl vector<ll>
#define tc ll t; cin >> t; while (t--)
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define sz(c) (ll) c.size()
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define trav(x,c) for(auto &x : c)
#define _for(i,a,n) for(ll i = a ; i < n ; ++i)
#define _rfor(i,a,n) for(ll i = n-1 ; i >= a ; --i)
#define dx(x) cout << #x << ": " << x << endl;
#define dc(c) trav(x,c) cout << x << " "; cout << endl;
#define dm(m) trav(x,m) cout << x.f << "->" << x.s << endl;
#define godspeed cin.tie(0) -> sync_with_stdio(0);

const int INFI = 2e9 + 5;
const ll INFLL = 1e18 + 5;
const ll N = 2e5 + 5;
const ll MOD = 1e9 + 7;
const ld PIE = acos(-1.0);

int main() {
    godspeed;

 	ll n; cin >> n;
 	map<ll,ll> mp;
 	vl v(n); _for(i,0,n-1) {cin >> v[i]; mp[v[i]]++;}

 	_for(i,0,n) {
 		cout << mp[i+1] << endl; 
 	}
}

Measured memory_bytes: 17232
N, M = map(int,input().split())
s = []
c = []
for i in range(M):
  S, C = map(int,input().split())
  s.append(S)
  c.append(C)


for i in range(10 ** (N + 1)):
  Str = str(i)
  
  if len(Str) == N and all([Str[s[j] - 1] == str(c[j]) for j in range(M)]):
      print(Str)
      exit()

print(-1)

Measured memory_bytes: 3064
using System;
using System.Linq;
using System.Collections.Generic;


namespace ABC150
{
    class C2
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string P = string.Join("", Console.ReadLine().Split().ToArray());
            string Q = string.Join("", Console.ReadLine().Split().ToArray());

            var p = Permutation<int>.All(Enumerable.Range(1, N));

            long resP = 0;
            long resQ = 0;
            long index = 0;
            foreach (var item in p)
            {
                string s = string.Join("", item);
                if (s == P) resP = index;
                if (s == Q) resQ = index;
                index++;
            }
            Console.WriteLine(Math.Abs(resP - resQ));
        }

        static class Permutation<T>
        {
            private static void Search(List<T[]> perms, Stack<T> stack, T[] a)
            {
                int N = a.Length;
                if (N == 0)
                {
                    perms.Add(stack.Reverse().ToArray());
                }
                else
                {
                    var b = new T[N - 1];
                    Array.Copy(a, 1, b, 0, N - 1);
                    for (int i = 0; i < a.Length; ++i)
                    {
                        stack.Push(a[i]);
                        Search(perms, stack, b);
                        if (i < b.Length) { b[i] = a[i]; }
                        stack.Pop();
                    }
                }
            }
            public static IEnumerable<T[]> All(IEnumerable<T> src)
            {
                var perms = new List<T[]>();
                Search(perms, new Stack<T>(), src.ToArray());
                return perms;
            }
        }
    }
}


Measured memory_bytes: 23124
// Written by newbiechd
#include <cstdio>

const int maxN = 100003;
int dp[maxN];
inline int min(int x, int y) { return x < y ? x : y; }

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  
  dp[0] = 1;
  for (int i = 1; i < n; ++i) {
    int k = min(i, n - i + 1);
    for (int j = k; j < n; ++j)
      dp[j] = (dp[j] + dp[j - k]) % m;
  }
  
  int ans = 0;
  for (int j = 0; j < n; ++j)
    ans = (1ll * (n - j) * dp[j] + ans) % m;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
from bisect import bisect
x,z = [[357,375,537,573,735,753]],[]
for _ in range(4,10):
	y = set()
	for i in list(x[-1]):
		for j in ["3","5","7"]:
			for k in range(_): y.add(int(str(i)[:k]+j+str(i)[k:]))
	x.append(y)
for i in x:
	for j in i: z.append(j)
z.sort()
n = int(input())
print(bisect(z,n))

Measured memory_bytes: 5492
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];
double dist(ll i, ll j)
{
    double dx=x[i]-x[j];
    double dy=y[i]-y[j];
    return pow(dx*dx+dy*dy,0.5);
}

int main()
{
    string str;
    cin>>str;
    if(str[0]=='S')cout<<"Cloudy"<<endl;
    else if(str[0]=='C')cout<<"Rainy"<<endl;
    else cout<<"Sunny"<<endl;

}


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

namespace AtCoder.Abc
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            // 文字列配列の入力
            string[] inputStrArray = Console.ReadLine().Split(' ');

            char A = inputStrArray[0].ToCharArray()[0];
            char B = inputStrArray[1].ToCharArray()[0];

            if(A == B) {
                Console.WriteLine("=");
                return;
            }
            if (A < B) {
                Console.WriteLine("<");
            } else {
                Console.WriteLine(">");
            }
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define forz(i,n) for(int i=0;i<n;i++)
#define foro(i,n) for(int i=1;i<=n;i++)
#define mod 1000000007
#define pb push_back
#define vi vector<int>
#define lli long long int
using namespace std;
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);
int main()
{
     faster
     int n,k;
     cin>>n>>k;
     int a[n+1];
     foro(i,n)cin>>a[i];
     int dp[n+1];
     dp[1]=0;
     dp[2]=abs(a[2]-a[1]);
     const int INF=INT_MAX;
     for(int i=3;i<=n;i++)
     {
          dp[i]=INF;
     }
    for(int i=3;i<=n;i++){
        int it=((i-k)<=1)?1:(i-k);
         for(int j=i-1;j>=it;j--)
         {
              
                   dp[i]=min(abs(a[i]-a[j])+dp[j],dp[i]);
              
         }
    }
    cout<<dp[n]<<'\n';

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long
#define ull unsigned long long
 
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
 
    map<int, ll> mp;
    int n;
    cin >> n;
    vector<int> a(n);
    for (int &x : a) {
        cin >> x;
        mp[x]++;
    }
    ll cnt = 0;
    for (auto i : mp) {
        cnt += i.second * (i.second - 1) / 2;
    }
    for (int i = 0; i < n; i++) {
        ll val = mp[a[i]] - 1;
        ll ans = cnt - mp[a[i]] * (mp[a[i]] - 1) / 2 + val * (val - 1) / 2;
        cout << ans << '\n';
    }
}

Measured memory_bytes: 10368
import  itertools 
n,m=map(int,input().split())
edges=[[0]*n  for i in range(n)]
#print(edges)
for _ in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    edges[a][b]=1
    edges[b][a]=1
#print(edges)
#generate all permutations
l=[i for i in range(n)]
p_obj=itertools.permutations(l)
ans=0
for i in p_obj:
    #print(i)
    if i[0]>0:
        break
    flag=True
    for j in range(1,n):
        if edges[i[j-1]][i[j]]==0:
            flag=False
            break
    if flag:
        ans+=1
print(ans)



Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

class DisjointSet{
public :
    vector<int> rank,p;
    DisjointSet(){}
    DisjointSet(int size)
    {
        rank.resize(size,0);
        p.resize(size,0);
        for(int i=0;i<size;i++)
            makeSet(i);
    }
    void makeSet(int x)
    {
        p[x] = x;
        rank[x] = 0;
    }
    bool same(int x,int y)
    {
        return findSet(x) == findSet(y);
    }
    void unite(int x,int y)
    {
        link(findSet(x),findSet(y));
    }
    void link(int x,int y)
    {
        if(rank[x] > rank[y])
        {
            p[y] = x;
        }
        else
        {
            p[x] = y;
            if(rank[x] == rank[y])
                rank[y]++;
        }
    }
    int findSet(int x)
    {
        if(x!=p[x])
            p[x] = findSet(p[x]);
        return p[x];
    }
};
int main()
{
    int m,n;
    int t,a,b;
    scanf("%d%d",&m,&n);
    DisjointSet ds = DisjointSet(m);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d%d",&t,&a,&b);
        if(t == 0)
            ds.unite(a,b);
        else
        {
            if(ds.same(a,b))   //a,b属于同一个集合
                printf("1\n");
            else
                printf("0\n");
        }

    }
    return 0;
}

Measured memory_bytes: 3224
//============================================================================
// Name        : Hello5.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;





int main() {
	int a[3][3];
	int d[3][3];
	  rep(i,3)rep(j,3) cin >> a[i][j];
	  int n;
	  cin >> n;

rep(i,n) {
	int b;
      cin>>b;
	    rep(i,3)rep(j,3) if (a[i][j] == b)
	    	d[i][j] = 1;
	  }
bool ans=false;

rep(i,3){
int cnt=0;
rep(j,3)cnt+=d[i][j];

if(cnt==3) ans=true;

}

rep(i,3){
int cnt=0;
rep(j,3)
cnt+=d[j][i];
if(cnt==3) ans=true;
}

 {
   int cnt = 0;
   rep(j,3) cnt += d[j][j];
   if (cnt == 3) ans = true;
 }
{
int cnt=0;
rep(j,3)cnt+=d[j][2-j];

if(cnt==3) ans=true;
}


puts(ans?"Yes":"No");
	  return 0;
	}



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

using namespace std;

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

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

  int count[9];
  REP(i, 9)
    count[i] = 0;

  REP(i, N) {
    int a;
    cin >> a;
    ++count[min(a / 400, 8)];
  }

  int min_val = 0, max_val = 0;
  if (count[8] == N) {
    min_val = 1;
    max_val = count[8];
  } else {
    REP(i, 8) {
      if (count[i] != 0)
        ++min_val;
    }
    max_val = min_val + count[8];
  }

  cout << min_val << " " << max_val << endl;
  return 0;
}


Measured memory_bytes: 256
x=input()

if x == "SUN":
    print(7)
elif x == "MON":
    print(6)
elif x == "TUE":
    print(5)
elif x == "WED":
    print(4)
elif x == "THU":
    print(3)
elif x == "FRI":
    print(2)
elif x == "SAT":
    print(1)


Measured memory_bytes: 3064
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

def main():
    s = S()
    n = int(s)
    t = sum([int(c) for c in s])
    if n % t == 0:
        return 'Yes'

    return 'No'



print(main())


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

typedef struct Position
{
    double x;
    double y;
} Pos;

void printPos(Pos p)
{
    printf("%.8f %.8f\n", p.x, p.y);
}

void kochCurve(Pos p1, Pos p2, int n)
{
    if (n == 0)
        return;

    Pos s, u, t;
    s.x = (2.0 * p1.x + p2.x) / 3.0;
    s.y = (2.0 * p1.y + p2.y) / 3.0;
    t.x = (p1.x + 2.0 * p2.x) / 3.0;
    t.y = (p1.y + 2.0 * p2.y) / 3.0;
    u.x = (t.x - s.x) * cos(M_PI / 3.0) - (t.y - s.y) * sin(M_PI / 3.0) + s.x;
    u.y = (t.y - s.y) * cos(M_PI / 3.0) + (t.x - s.x) * sin(M_PI / 3.0) + s.y;

    kochCurve(p1, s, n - 1);
    printPos(s);
    kochCurve(s, u, n - 1);
    printPos(u);
    kochCurve(u, t, n - 1);
    printPos(t);
    kochCurve(t, p2, n - 1);
}

int main()
{
    int n;
    cin >> n;
    printPos({0.0, 0.0});
    kochCurve({0.0, 0.0}, {100.0, 0.0}, n);
    printPos({100.0, 0.0});
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

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

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

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

signed main() {
  int n = read();
  print(800 * n - n / 15 * 200);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
    int a,b,c,d;
    while(scanf("%d %d %d %d",&a,&b,&c,&d)!=EOF)
    {
        if(a<b)
        {
            int temp;
            temp=b;
            b=a;
            a=temp;
        }
        if(c<d)
        {
            int temp;
            temp=d;
            d=c;
            c=temp;
        }
        printf("%d\n",b+d);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<vector<char>> vec;
int main(){
  ll H,W;
  cin>>H>>W;
  ll dp[101][101];
  vec.resize(H,vector<char>(W));
  for(ll i=0;i<H;i++){
    for(ll j=0;j<W;j++){
      cin>>vec.at(i).at(j);
    }
  }
  dp[1][1]=0;
  if(vec.at(0).at(0)=='#'){dp[1][1]++;}
  for(ll i=1;i<=H;i++){
    for(ll j=1;j<=W;j++){
      if(i==1&&j==1){
      }else if(i==1&&j!=1){
        dp[1][j]=dp[1][j-1];
        if(vec.at(0).at(j-1)=='#'&&vec.at(0).at(j-2)=='.'){dp[1][j]++;}
      }else if(i!=1&&j==1){
        dp[i][1]=dp[i-1][1];
        if(vec.at(i-1).at(0)=='#'&&vec.at(i-2).at(0)=='.'){dp[i][1]++;}
      }else{
        ll a=dp[i][j-1];
        if(vec.at(i-1).at(j-1)=='#'&&vec.at(i-1).at(j-2)=='.'){a++;}
        ll b=dp[i-1][j];
        if(vec.at(i-1).at(j-1)=='#'&&vec.at(i-2).at(j-1)=='.'){b++;}
        dp[i][j]=min(a,b);
      }
    }
  }
  cout<<dp[H][W]<<endl;
}

Measured memory_bytes: 384
// #include <bits/stdc++.h>
#include <iostream> // cout, endl, cin
#include <iomanip> // setprecision
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

// #define int long long

// loop
#define FOR(i, a, b) for (int i = (a); i < (b); i++) 	// a ~ b-1	(ascending)
#define REP(i, n) FOR(i, 0, n)							// 0 ~ n-1
#define NREP(i, n) FOR(i, 1, n + 1)						// 1 ~ n
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)	// a ~ b	(descending)
#define RREP(i, n) RFOR(i, n, 0)						// n ~ 0
#define RNREP(i, n) RFOR(i, n, 1)						// n ~ 1
 
// container operation
#define all(v) v.begin(), v.end()
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define ASORT(c) std::sort((c).begin(), (c).end())
#define DSORT(c) std::sort((c).begin(), (c).end(), std::greater<typeof((c).front())>())
#define SIZE(x) ((int)(x).size())
// union of two containers
template <typename T>
void container_union(T &c1, T &c2, T &c3) {
  std::vector<int> vec;
  std::set_union(c1.begin(), c1.end(),
                 c2.begin(), c2.end(),
                 std::back_inserter(vec));
  T tmp(vec.begin(), vec.end());
  c3 = tmp;
}

// chmax, chmin
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

// grid-search
std::vector<int> dx = {1, -1, 0,  0};
std::vector<int> dy = {0,  0, 1, -1};
 
// debug
#define check(x) std::cout << #x << " = " << x << '\n'
 
// print
#define cout(x) std::cout << x << '\n'
 
// type alias
using VI = std::vector<int>;
using VII = std::vector<VI>;
using VB = std::vector<bool>;
using VBB = std::vector<VB>;
using VS = std::vector<std::string>;
using PII = std::pair<int, int>;

// yes/no
std::string yes = "Yes";
std::string no = "No";
std::string YES = "YES";
std::string NO = "NO";

void solve();

signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  solve();
  return 0;
}

void solve() {
  int n, k;
  std::cin >> n >> k;
  VI p(n);
  std::vector<int> e(n);
  REP(i, n) {
    std::cin >> p.at(i);
    e.at(i) = p.at(i) + 1;
  }

  int max = 0;
  int sum = 0;
  REP(i, n - k + 1) {
    if (i == 0) {
      REP(j, k) {
        sum += e.at(j);
      }
    } else {
      sum -= e.at(i-1);
      sum += e.at(i+k-1);
    }
    chmax(max, sum);
  }
  std::cout << std::fixed << std::setprecision(10);
  cout((double)max / (double)2);
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

long long N, A[109], B[109], dist[109][109], P[109], dp[109]; bool used[109]; vector<int>x[109], y[109], z[109], w[109];

void dfs(int pos, int dep) {
	dp[pos] = dep;
	for (int i = 0; i < x[pos].size(); i++) {
		if (used[x[pos][i]] == true || dp[x[pos][i]] >= 0) continue;
		w[pos].push_back(x[pos][i]);
		dfs(x[pos][i], dep + 1);
	}
}

long long solve(vector<int>vec) {
	for (int i = 1; i <= N; i++) { used[i] = false; dp[i] = -1; y[i].clear(); w[i].clear(); }
	for (int i = 0; i < vec.size(); i++) used[vec[i]] = true;
	for (int i = 0; i < vec.size(); i++) {
		dfs(vec[i], 0);
	}
	for (int i = 1; i <= N; i++) y[dp[i]].push_back(i);
	long long ret = 1;
	for (int i = 0; i <= N; i++) {
		long long maxn = 0;
		for (int j = 0; j < y[i].size(); j++) maxn = max(maxn, (long long)w[y[i][j]].size());
		if (maxn >= 1) ret *= maxn;
	}
	ret *= vec.size();
	return ret;
}

int main() {
	cin >> N;
	for (int i = 1; i <= N - 1; i++) {
		cin >> A[i] >> B[i];
		x[A[i]].push_back(B[i]);
		x[B[i]].push_back(A[i]);
	}
	for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) dist[i][j] = (1 << 30); dist[i][i] = 0; }
	for (int i = 1; i <= N - 1; i++) { dist[A[i]][B[i]] = 1; dist[B[i]][A[i]] = 1; }
	for (int k = 1; k <= N; k++) { for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]); } }
	
	long long minx = (1 << 30), maxn = 0;
	for (int i = 1; i <= N; i++) {
		long long R = 0; for (int j = 1; j <= N; j++) R = max(R, dist[i][j]);
		P[i] = R; z[P[i]].push_back(i);
		minx = min(minx, P[i]);
		maxn = max(maxn, P[i]);
	}
	long long G = solve(z[minx]);
	if (z[minx].size() == 1) {
		int pos = z[minx][0];
		for (int i = 0; i < x[pos].size(); i++) {
			vector<int>T = { pos,x[pos][i] };
			G = min(G, solve(T));
		}
	}
	cout << maxn - minx + 1 << " " << G << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N,ans=0,n=0;
    cin>>N;
    vector<int> X(N);
    for(int i=0;i<N;i++){
        cin>>X[i];
    }
    int m;
    sort(X.begin(), X.end());
    reverse(X.begin(), X.end());
    m = X[0];
    for(int i=0;i<=m;i++){
        n = 0;
        for(int j=0;j<X.size();j++){
            n += (X[j]-i) * (X[j]-i);
            if(i==0){
                ans = n;
            }
        }
        if(n<ans){
            ans = n;
        }
    }
    cout<<ans<<endl;
}

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

bool judge(uint32_t i, int32_t m, const std::vector<uint32_t>& A) {
  if (m == 0)
    return true;
  else if (m < 0 || i == A.size())
    return false;
  return judge(i + 1, m, A) || judge(i + 1, m - A[i], A);
}

int main() {
  uint32_t n = 0;
  std::cin >> n;

  std::vector<uint32_t> A(n);
  for (size_t i = 0; i < n; i++) std::cin >> A[i];

  uint32_t q = 0;
  std::cin >> q;

  for (size_t i = 0; i < q; i++) {
    uint32_t m = 0;
    std::cin >> m;
    std::cout << (judge(0, m, A) ? "yes" : "no") << std::endl;
  }

  return 0;
}


Measured memory_bytes: 3092
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
mo = 10**9+7

def main():
	a,b,c,d = MI()
	while (a > 0):
		a-=d
		c-=b
	if(c<=0):
		print("Yes")
	else:
		print("No")

if __name__ == '__main__':
	main()

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

namespace ABC_069A___K_City
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);

            Console.WriteLine((n - 1) * (m - 1));

        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

#define MAX_V 100001
struct edge { int to; ll cost; };

vector<edge> tree[MAX_V];
ll d[MAX_V];
int n;

// s: 開始地点の頂点
void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + n, LINF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) { continue; }
        for (int i = 0; i < tree[v].size(); i++) {
            edge e = tree[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main(){
    int m;
    cin >> n >> m;
    rep(i, m){
        int l, r;
        ll c;
        cin >> l >> r >> c;
        l--, r--;
        tree[l].push_back({r, c});
    }
    rep(i, n - 1) tree[i+1].push_back({i,0});

    dijkstra(0);

    cout << (d[n-1]!=LINF?d[n-1]:-1) << endl;
    return 0;
}


Measured memory_bytes: 12184
#include <stdio.h>
#include <math.h>
int main(void){
	double a,b,c,s,l,h;
	scanf("%lf %lf %lf",&a,&b,&c);
	c=c*3.14159265/180.0;
	s=a*b*sin(c)/2;
	l=a+b+(sqrt(a*a+b*b-2*a*b*cos(c)));
	h=b*sin(c);
	printf("%.8f\n%.8f\n%.8f\n",s,l,h);
	return 0;
}

Measured memory_bytes: 676
#include <cstdio>
#include <cmath>

int main() {
    int d, n;
    scanf("%d %d", &d, &n);
    
    if (n == 100) {
        printf("%d\n", (int)pow(100, d) * (n+1));
    } else {
        printf("%d\n", (int)pow(100, d) * n);
    }
    return 0;
}

Measured memory_bytes: 128
n=int(input())
h=list(map(int,input().split()))+[1e9+1]
cnt=0
max_m=-1
for i in range(n):
    if h[i]>=h[i+1]:
        cnt+=1
    else:
        max_m=max(max_m,cnt)
        cnt=0
print(max_m)
    

Measured memory_bytes: 20504
//テンプレ
#include <bits/stdc++.h>
#define int long long
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define FOR(i,a,b)  for(int i = (a); i <= (b); ++i)
#define ALL(v) (v).begin(),(v).end()

using namespace std;
//constexpr int MOD = 10e9+7;
//constexpr int INF = 1LL << 60;
template <class T> inline bool chmin(T& a, T b){if(a > b){ a = b; return 1;} return 0;}  
template <class T> inline bool chmax(T& a, T b){if(a < b){ a = b; return 1;} return 0;}  
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
//
signed main (){
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   int x1,y1,x2,y2;
   cin >> x1 >> y1 >> x2 >> y2;
   cout << y1-y2+x2 <<" " << -(x1-x2) + y2 <<" "<< -(y2-y1) + x1 <<" " <<  x2 - x1 + y1 << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    int a,b;
    cin>>a>>b;
    if(a%2==0||b%2==0) cout<<"Even"<<endl;
    else cout<<"Odd"<<endl;
    return 0;
}

Measured memory_bytes: 256