akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h> 
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
using namespace std;
const int INF = 1e9;
int n,m,a,b,ans,ckazu,d,e;
int hen[705][705];
int wi[705];
bool dp[777][777];
vector<pair<int,int> > c(705);
void bfs(int now){
  if(wi[now]!=0)return;
  else {wi[now]=1;c[ckazu].first++;}
  queue<int> q;
  q.push(now);
  while(!q.empty()){
    int ne=q.front();q.pop();
    for(int i=0;i<n;i++){
      if(i!=ne && hen[ne][i]==false){
	if(wi[i]==0){
	  wi[i]=-1*wi[ne];
	  if(wi[i]==1){
	    c[ckazu].first++;
	  }else{
	    c[ckazu].second++;
	  }
	  q.push(i);
	}else if(wi[i]==wi[ne]){
	  ans=-1;return;
	}
      }
    }
  }

  ckazu++;
  return;
}

int main(){
  cin>>n>>m;
  REP(i,m){
    cin>>a>>b;
    a--;b--;
    hen[b][a]=hen[a][b]=true;
  }
  ckazu=0;
  for(int i=0;i<n;i++){
    bfs(i);
    if(ans==-1){
      cout<<-1<<endl;return 0;
    }
  }
  dp[0][0]=true;
  ans=INF;
  for(int i=1;i<ckazu+1;i++){
    for(int j=0;j<=n;j++){
      if(dp[i-1][j]==true){
	dp[i][j+c[i-1].first]=true;
	dp[i][j+c[i-1].second]=true;
      }
    }
  }
  for(int i=0;i<=n;i++){
    if(dp[ckazu][i]==true){
      int tmp=i*(i-1)/2+(n-i)*(n-i-1)/2;
      
      ans=min(ans,tmp);
    }
  }
  cout<<ans<<endl;
  return 0;
}




Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
vector<int> x = {1,-1,0,0};
vector<int> y = {0,0,-1,1};
int main(){
    int n;
    cin >> n;
    vector<int> data(n);
    int sum = 0;
    rep(i,0,n){
        cin >> data[i];
        sum += data[i];
    }
    if(sum%10!=0){
        cout<<sum<<endl;
    }else{
        sort(data.begin(),data.end());
        rep(i,0,data.size()){
            if(data[i]%10!=0){
                sum-=data[i];
                cout<<sum<<endl;
                return 0;
            }
        }
        cout<<0<<endl;
    }
    
    

  return 0;
}

Measured memory_bytes: 3640
from itertools import accumulate
N = int(input())
A = list(map(int, input().split()))
B = A[::-1]

B = list(accumulate(B))

mod = 10 ** 9 + 7
ans = 0
for i in range(len(A) - 1):
    ans += (B[len(A) - i - 2] * A[i]) % mod
    ans %= mod

print(ans)

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

int main() {
  int n,k;
  cin>>n>>k;
  vector<int> h(n);
  rep(i,n) cin>>h[i];
  //////////
  sort(all(h));
  int ans=1000000001;
  rep(i,n-k+1){
    int c=h[i+k-1]-h[i];
    ans=min(ans,c);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
#define print(x) cout << (x) << endl;
#define Yes() cout << "Yes" << endl;
#define No() cout << "No" << endl;
#define YES() cout << "YES" << endl;
#define NO() cout << "NO" << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const { // 2 ** 5 ... mint(2).pow(5);
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint choose(int n, int a) {
    mint x = 1, y = 1;
    rep (i, a) {
        x *= n - i;
        y *= i + 1;
    }
    return x / y;
}

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

    mint ans;
    ans = mint(2).pow(n) - 1 - choose(n, a) - choose(n, b);

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

Measured memory_bytes: 256
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

r = int(input())
print(3*r**2)


Measured memory_bytes: 7872
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;
using namespace std;

#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl

ll n, cnt, ans, a[ohara], b, c, d, tmp, tmpp, m, h, w, x, y, sum, pos, k;
ld doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge
{
    int to, cost;
};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin >> n;
    rep(i, n) cin >> a[i];
    sort(a, a + n);
    reverse(a, a + n);
    ll now = n - 1;
    rep(i, n)
    {
        if (i % 2 == 1)
        {
            if (i == n - 1)
            {
                if (a[i] != 0)
                {
                    Cout(0);
                    return 0;
                }
            }
        }
        if (a[i] == now && a[i + 1] == now)
        {
            i++;
            now -= 2;
        }
        else
        {
            Cout(0);
            return 0;
        }
    }
    n /= 2;
    cnt = 1;
    rep(i, n)(cnt *= 2) %= MOD;
    Cout(cnt);
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s,t;
	cin>>s>>t;
	int lens=s.length(),lent=t.length();
	int ans=1e9;
	for(int i=0;i<lens;i++){
		int now=0;
		bool ok=1;
		for(int j=0;j<lent;j++){
			if(i+j>=lens){
				ok=0;
				break;
			}
			if(s[i+j]!=t[j]) now++;
		}
		if(!ok) break;
		ans=min(ans,now);
	}
	printf("%d",ans);
	return 0;
}

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


int main() {
  int N;
  int P;
  cin >> N >> P;
  int minimum = P;
  int counter=0;
  
  for (int i=0; i<N; i++) {
    if(minimum >= P) {
      counter++;
      minimum = P;
    }
    if (i!=N-1) cin >> P;
  }
    
  cout << counter << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
using namespace std; 

int main() {
  int N;
  cin >> N;
  vector<vector<int>> V(3, vector<int>(N));
  rep(i, 0, N) cin >> V[0][i] >> V[1][i] >> V[2][i];
  
  vector<vector<int>> dp(3, vector<int>(N + 1, -1));
  dp[0][0] = 0;
  dp[1][0] = 0;
  dp[2][0] = 0;
  rep(i, 1, N + 1) {
    rep(j, 0, 3) {
      rep(k, 0, 3) {
        if (j != k) dp[j][i] = max(dp[j][i], dp[k][i - 1] + V[j][i - 1]);
      }
    }
  }
  
  int ans = -1;
  rep(i, 0, 3) ans = max(ans, dp[i][N]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2940
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {

		int N =nextInt();
		long K = nextLong();
		int[] A = nextInts();

		int[] to = new int[N+1];
		to[0]=1;
		HashMap<Integer,Integer> map = new HashMap<>();
		map.put(1, 0);
		int loopCnt=0;
		int tail = 0;
		for(int i=1;i<=N;i++){
			to[i]=A[to[i-1]-1];
			if(map.containsKey(A[to[i-1]-1])){
				loopCnt=i-map.get(A[to[i-1]-1]);
				tail=i-loopCnt+1;
				break;
			}
			map.put(A[to[i-1]-1], i);
		}
		int idx ;
		if(K<=tail){
			idx=(int)K;
		}else{
			idx=(int)((K-tail)%loopCnt)+tail;
		}
		System.out.println(to[idx]);
	}


	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 67976
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)


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

ll dp[101][301];

int main(){
    string s;
    cin >> s;
    int g = 0, p = 0;
    rep(i, s.size()){
        if(s[i] == 'g')g++;
        else p++;
    }
    int pp = s.size() / 2;
    int gg = s.size() - pp;

    cout << -min(gg, p) + min(pp, g) << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <cassert>
//#define NDEBUG
int main(void){
    using namespace std;

    static const int ConstraintsMin = 0;
    static const int ConstraintsMax = 86400;
    int total_sec =0;
    int hour =0;
    int min =0;
    int sec =0;
    cin >> total_sec;
    
    assert(ConstraintsMin <= total_sec && total_sec < ConstraintsMax); /* Precondition */
    
    /* Calculation */
    hour = total_sec/60/60;
    min = total_sec%3600/60;
    sec = total_sec%60%60;
    cout << hour<<":"<<min<<":"<<sec<< endl;
    
    return 0;
}

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

typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    string S;
    string T;
    cin >> S >> T;

    //変換表の配列
    vector<int> start(26, -1);
    vector<int> goal(26, -1);

    rep(i, (int)S.size()){
        int a = S[i] - 'a';
        int b = T[i] - 'a';

        //startかgoalの変換表がすでに埋まっていた場合
        if(start[a] != -1 || goal[b] != -1){
            if(start[a] != b || goal[b] != a){
                cout << "No" << endl;
                return 0;
            }
        }
        //変換表の作成
        start[a] = b;
        goal[b] = a;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3924
#include<bits/stdc++.h>
#define LL long long
const int N=100005;
using namespace std;

string s;
LL k;

int main(){
	cin>>s>>k;
	int len=s.length();
	for(int i=0;i<len;i++){
		int now=s[i]-'0';
		if(now!=1){
		  	printf("%d\n",now);
		  	return 0;
		}
		if(i+1==k){
			printf("%d\n",now);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define ll long long
#define ull unsigned long long
#define dd double
#define oo 1001007000
#define ff float
#define ooo 1000000100000000000
#define iii pair<ll,ll>
#define vii vector<ll>
#define viii vector<iii>
#define sss pair<str,str>
#define str string
#define sii set<ll>
#define siii set<iii>
#define st size_t
#define r0 return 0
#define pb push_back
#define sz size
using namespace std;

const char E='\n';
const int N=100015;
const int NN=1000000;
const ll md=1e9+7;

ll gcd(ll a,ll b){
    while (a>0 && b>0){
        if (a>b)a%=b;else b%=a;
    }
    return a+b;
}

ll _pow(ll n,ll p){
    if (p==0)return 1;
    if (p==1)return n%md;
    if (p==2)return (n*n)%md;
    if (p%2==0){
        return _pow(_pow(n,p/2),2);
    }else
        return (_pow(_pow(n,p/2),2)*n)%md;

}
ll last[N]={0};

int kld(ll x){
    int kl=0;
    while (x>1){
        kl++;
        x/=last[x];
    }
    return kl;
}


int main(){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
    vii primes;
    for (ll i=2;i<=N-5;i++){
        if (last[i]==0){
            last[i]=i;
            primes.pb(i);
            for (ll j=i*i;j<=N-5;j+=i){
                last[j]=i;
            }
        }
    }

    ll n,k;
    cin >> n >> k;
    ll ans=_pow(k,n);
    ll q,qq;
    ll kl[N]={0};
    for (int i=k;i>k/2;i--){
        if (i*2>k){
            kl[i]=_pow(k/i,n)%md;
        }
    }
    for (int i=k/2;i>=1;i--){
        kl[i]=(_pow(k/i,n))%md;
        for (int j=2;j<=k/i;j++){
            kl[i]+=md;
            kl[i]-=kl[j*i];
            kl[i]%=md;
        }
    }
    ans=0;
    for (int i=1;i<=k;i++){
        //cout << i << " " << kl[i] << E;
        ans+=kl[i]*i;
        ans%=md;
    }
    cout << ans << E;
    r0;
}
/*














*/


Measured memory_bytes: 5312
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    public struct Pair { public int x, y; public Pair(int x, int y) { this.x = x; this.y = y; } }
    public static void Solve()
    {
        int N = NextInt();
        long K = NextLong();
        int[] A = LineInt();
        long ans = 0;
        for (int i = 0; i < N; i++)
        {
            //以降出現数
            long cou = 0;
            for (int j = 0; j < N; j++)
                if (A[i] > A[j]) cou++;
            long box = ((K - 1) * K / 2) % MOD;
            ans += (box * cou) % MOD;
            cou = 0;
            for (int j = i + 1; j < N; j++)
                if (A[i] > A[j]) cou++;
            ans += cou * (K);
            ans %= MOD;
        }
        Console.WriteLine(ans);

    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}
public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 13444
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int a,b;
  for(int c=0; cin >>a>>b,a||b; c++){
    if(c){cout<<endl;}
    vector<int> year;
    for(int i=a; i<=b; i++){
      if(!(i%4) && i%100){year.push_back(i);}
      else if(!(i%400)){year.push_back(i);}
    }
    if(year.empty()){cout<<"NA"<<endl;}
    else{for(int i=0; i<year.size(); i++){cout <<year[i]<<endl;}}
  }
  return 0;
}

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

int main () {
  int64_t n; cin >> n;
  map<string, int> mp;
  for (int i=0;i<n;i++) {
    string s;
    cin >> s;
    sort(s.begin(),s.end());
    mp[s]++;
  }
  int64_t ans = 0;
  for (auto p:mp) {
    int64_t s = p.second;
    ans += s*(s-1) / 2;
  }
  cout << ans;
}

Measured memory_bytes: 11264
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# 初項s, 交差dのn個の数列の和
def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    N = int(input())
    P = list(map(int, input().split()))
    ans = 0
    for i in range(1, N - 1):
        a, b, c = P[i - 1], P[i], P[i + 1]
        ans += list(sorted([a, b, c]))[1] == b
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 4072
#include <iostream>
#include <math.h>
#include <strings.h>
using namespace std;

int main()
{
unsigned long long A,B,C,K;
cin>>A>>B>>K;
C=A+B;
if(K==0){
 cout<<A<<" "<<B;
}else if(A>=K){
    cout<<(A-K)<<" "<<B;
}
else if(C>=K){
    cout<<0<<" "<<(C-K);
}else
{
     cout<<0<<" "<<0;
}

return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define hell                         1000000007
#define hell2                        998244353
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define all(v)                       v.begin(),v.end()
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(ll i=a;i<b;i++)
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'
 
const ll MAX=200005;
const ll SQN=330;
const ll LG=22;
const double PI=atan(1)*4;
using namespace std;

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

    ll n,k;
    cin >> n >> k;
    ll a[n];
    rep(i,0,n) cin >> a[i];

    rep(i,k,n) {
    	if(a[i]>a[i-k]) cout << "Yes" << endl;
    	else cout << "No" << endl;
    }
}


Measured memory_bytes: 5208
W,H,N = map(int,input().split())
p = 0
q = W
l = 0
m = H

for i in range(N):
  x,y,a = map(int, input().split())
  if a == 1:
    p = max(p,x)
  if a == 2:
    q = min(q,x)
  if a == 3:
    l = max(l,y)
  if a == 4:
    m = min(m,y)
if (q-p)<0 or (m-l)<0:
  print(0)
  exit()
else:
  S = (q-p)*(m-l)
  print(S)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int u32;
typedef pair<int, int> p;
int Inf = 1000000000;
ll inf = 1000000000000;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
char s[30][30];
int dist[30][30];
queue<p> que;
void update(int y, int x, int D) {
	if (dist[y][x] != Inf) return;
	que.push(p(y, x));
	dist[y][x] = D;
}
int bfs(int H, int W, int I, int J) {
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			dist[i][j] = Inf;
		}
	}
	update(I, J, 0);
	while (!que.empty()) {
		int y = que.front().first;
		int x = que.front().second;
		que.pop();
		for (int dir = 0; dir < 4; dir++) {
			int ny = y + dy[dir];
			int nx = x + dx[dir];
			if (ny<0 || ny>H || nx<0 || nx>W) continue;
			if (s[ny][nx] == '#') continue;
			update(ny, nx, dist[y][x] + 1);
		}
	}
	int MaxDist = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (dist[i][j] == Inf) continue;
			MaxDist = max(MaxDist, dist[i][j]);
		}
	}
	return MaxDist;
}
int main() {
	int h ,w;
	cin >> h >> w;
	int i, j;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			cin >> s[i][j];
		}
	}
	int ans = 0;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			if (s[i][j] == '#') continue;
			ans = max(ans, bfs(h, w, i, j));
		}
	}
	cout << ans;
	return(0);
}

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

const int MOD = 1e9 + 7;

long long pow_mod(long long x, int n) {
    long long res = 1;
    while (n) {
        if (n & 1) res = res * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return res;
}

long long cmb(int n, int r) {
    if (r < 0 || r > n) return 0;
    // nCr = x/y = n(n-1)...(n-r+1)/r(r-1)...1
    long long x = 1, y = 1;
    for (int i = 0; i < r; ++i) {
        x = x * (n - i) % MOD;
        y = y * (i + 1) % MOD;
    }
    return x * pow_mod(y, MOD - 2) % MOD;
}

int main() {
    int n, a, b;  cin >> n >> a >> b;
    long long ans = pow_mod(2, n) - 1 - cmb(n, a) - cmb(n, b);
    while (ans < 0) ans += MOD;
    cout << ans % MOD << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn int
using ll = long long;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int a[1000000];
#define  MAX 10000
struct Node {
	int key;
	Node *right, *left, *parent;
};

Node *root, *NIL;
vector<Node*> nodes;

void preParse(Node *u) {
	if (u == NIL)
		return;
	cout << ' ' << u->key;
	preParse(u->left);
	preParse(u->right);
}

void inParse(Node* u) {
	if (u == NIL)
		return;
	inParse(u->left);
	cout << ' ' << u->key;
	inParse(u->right);
}

void postParse(Node* u) {
	if (u == NIL)
		return;
	postParse(u->left);
	postParse(u->right);
	cout << ' ' << u->key;
}

void insert(int key) {
	Node *y = NIL;
	Node *x = root;
	Node* z = new Node;
	nodes.pb(z);
	z->key = key;
	z->left = NIL;
	z->right = NIL;
	while (x != NIL) {
		y = x;
		if (z->key < x->key) {
			x = x->left;
		}
		else {
			x = x->right;
		}
	}
	z->parent = y;
	if (y == NIL) {
		root = z;
	}
	else {
		if (z->key < y->key) {
			y->left = z;
		}
		else {
			y->right = z;
		}
	}
}

signed main() {
	int n, i, x;
	string com;
	cin >> n;
	rep(i, n) {
		cin >> com;
		if (com == "insert") {
			cin >> x;
			insert(x);
		}
		if (com == "print") {
			inParse(root);
			cout << endl;
			preParse(root);
			cout << endl;
		}
	}
	for (auto n : nodes)
		delete n;
	return 0;
}


Measured memory_bytes: 30156
import Control.Monad
import Control.Applicative
import Data.List
import Data.Char

main = do
  n <- inp toInt
  xs <- inps (2*n) id
  mapM_ putStrLn $ solve xs

solve :: [String] -> [String]
solve [] = []
solve (x:y:ys) = add x y : solve ys

add :: String -> String -> String
add x y = if length rs > 80 then "overflow" else rs
  where rx = map digitToInt $ reverse x
        ry = map digitToInt $ reverse y
        add' :: String -> Int -> [Int] -> [Int] -> String
        add' acc c [] [] = if c == 0 then acc else '1':acc
        add' acc c (x:xs) [] = let (cy,cr) = f (x + c) in add' (cr:acc) cy xs []
        add' acc c [] (y:ys) = let (cy,cr) = f (y + c) in add' (cr:acc) cy [] ys
        add' acc c (x:xs) (y:ys) = let (cy,cr) = f (x + y + c) in add' (cr:acc) cy xs ys
        f :: Int -> (Int, Char)
        f z = if z < 10 then (0,intToDigit z) else (1,intToDigit (z - 10) )
        rs = add' [] 0 rx ry

toInt :: String -> Int
toInt s = read s

inp :: (String -> a) -> IO a
inp f = f <$> getLine

inps :: Int -> (String -> a) -> IO [a]
inps n f = map f <$> replicateM n getLine

Measured memory_bytes: 4204
//状态:
//题号:
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <iomanip>
#include <cassert>
#include <complex>
#include <functional>
#include <list>
#include <cmath>
using namespace std;
int l;
bool f[100005];
char tmp[100005];
bool res[100005];
void print() {
	if(res[l-1]) {
		if(f[l-1]) {
			if(res[l-2]!=res[0])return;
		} else {
			if(res[l-2]==res[0])return;
		}
	} else {
		if(f[l-1]) {
			if(res[l-2]==res[0])return;
		} else {
			if(res[l-2]!=res[0])return;
		}
	}
	for(int i=0; i<l; i++)if(res[i])putchar('S');
	else putchar('W');
	putchar('\n');
	exit(0);
}
int main() {
	scanf("%d",&l);
	scanf("%s",tmp);
	for(int i=0; i<l; i++) {
		f[i]=(tmp[i]=='o');
	}
	for(int a0=0; a0<=1; a0++) {
		for(int a1=0; a1<=1; a1++) {
			memset(res,0,sizeof(res));
			res[0]=a0,res[1]=a1;
			for(int i=2; i<l; ++i) {
				if(res[i-1]) {
					if(f[i-1])res[i]=res[i-2];
					else res[i]=!res[i-2];
				} else {
					if(f[i-1])res[i]=!res[i-2];
					else res[i]=res[i-2];
				}
			}
			//	print();
			if(res[0]) {
				if(f[0]) {
					if(res[l-1]==res[1])print();
				} else {
					if(res[l-1]!=res[1])print();
				}
			} else {
				if(f[0]) {
					if(res[l-1]!=res[1])print();
				} else {
					if(res[l-1]==res[1])print();
				}
			}
		}
	}
	puts("-1");
	return 0;
}


Measured memory_bytes: 640
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int n,a,b;
int main()
{
	get3(n,a,b);
	if(a>b)puts("0");
	else if(n<2)printf("%d\n",a==b);
	else printf("%lld\n",1ll*(b-a)*(n-2)+1);
	return 0;
}

Measured memory_bytes: 256
def main():
    N,K = map(int, input().split())
    
    l=[]
    
    for i in range(1,N+1):
        if i < K:
            m=i
            j=0
            while m<K:
                j+=1
                m = i*(2**j)
            l.append(1/(N*(2**j)))
        else:
            l.append(1/N)
    print(sum(l))
main()

Measured memory_bytes: 6296
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
ll h,w,cnt,a,d;
int x[4]={-1,1,0,0};
int y[4]={0,0,-1,1};
vector<vector<char>> c(402,vector<char>(402,'a'));
bool b[402][402];
set<pair<int,int>> s[402*402];
void dfs(int i,int j){
  b[i][j]=false;
  if(c[i][j]=='#'){
  a++;
    for(int k=0;k<4;k++){
      if(c[i+x[k]][j+y[k]]=='.'&&b[i+x[k]][j+y[k]]){
        dfs(i+x[k],j+y[k]);
      }
    }
  }else if(c[i][j]=='.'){
    s[d].insert(make_pair(i,j));
    for(int k=0;k<4;k++){
      if(c[i+x[k]][j+y[k]]=='#'&&b[i+x[k]][j+y[k]]){
        dfs(i+x[k],j+y[k]);
      }
    }
  }
}
int main(){
  cin>>h>>w;
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      cin>>c[i][j];
    }
  }
  memset(b,true,sizeof(b));
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      if(c[i][j]=='#'){
        dfs(i,j);
        cnt+=(int)s[d].size()*a;
        d++;
        a=0;
      }
    }
  }
  cout<<cnt;
}

Measured memory_bytes: 19328
//2020.1.27
//s1270188 xxxmk2
//alds1_12c

#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
#define N 100000
#define WHITE 0
#define GRAY 1
#define BLACK 2

//struct
struct node{
  int id;
  int d;
  struct node *next;
};

//global
int num;
struct node data[N];

//function
void insert(int a,int id,int d){
  struct node*dd, *n;

  dd=malloc(sizeof(struct node));
  dd->id=id;
  dd->d=d;
  dd->next=NULL;

  for(n=&data[a];n->next!=NULL;n=n->next);
  n->next=dd;
}

void cnt(void){
  int color[N], d[N];
  int min, i, u, ddd;
  struct node *n;
  
  //reset
  for(i=0;i<num;i++){
    color[i]=WHITE;
    d[i]=INT_MAX;
  }
  d[0]=0;

  
  while(1){
    min=INT_MAX;
    
    for(i=0;i<num;i++){
      if(color[i]!=BLACK && d[i]<min){
	min=d[i];
	u=i;
      }
    }
    
    if(min==INT_MAX) break;

    color[u]=BLACK;

    for(n=&data[u];n!=NULL;n=n->next){
      if(color[n->id]!=BLACK && d[u]+n->d<d[n->id]){
	d[n->id]=d[u]+n->d;
	color[n->id]=GRAY;
      }
      
    }
    
  }

  for(i=0;i<num;i++) printf("%d %d\n",i,d[i]);  

}



int main(){
  int i, j, a, b, c, d;
  
  //input
  scanf("%d",&num);
  for(i=0;i<num;i++) data[i].next=NULL; //reset
    
  for(i=0;i<num;i++){
    scanf("%d %d",&a,&b);
    for(j=0;j<b;j++) {
      scanf("%d %d",&c,&d);
      insert(a,c,d);
    }
  }
  
  /* input test
  struct node *n;
  for(i=0;i<num;i++){
    printf("%d: ",i);
    for(n=data[i].next;n!=NULL;n=n->next) printf("%2d ",n->id);
    printf("\n   ");
    for(n=data[i].next;n!=NULL;n=n->next) printf("%2d ",n->d);
    printf("\n\n");
  }
  */
  
  //output
  cnt();
  
  return 0;
}



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

using namespace std;

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

int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<long long> AS(N + 1);
  for (int i = 0; i < N; i++) {
    AS[i + 1] = AS[i] + A[i];
  }
  auto sum = [&](int a, int b) {
    return AS[b] - AS[a];
  };
  int l = 1, c = 2, r = 3;
  long long ans = 1e15;
  while (c + 1 < N) {
    long long s = abs(sum(0, l) - sum(l, c));
    while (l + 1 < c) {
      long long s2 = abs(sum(0, l + 1) - sum(l + 1, c));
      if (s < s2) break;
      l++;
      s = s2;
    }
    s = abs(sum(c, r) - sum(r, N));
    while (r + 1 < N) {
      long long s2 = abs(sum(c, r + 1) - sum(r + 1, N));
      if (s < s2) break;
      r++;
      s = s2;
    }
    long long max4 = max(max(sum(0, l), sum(l, c)), max(sum(c, r), sum(r, N)));
    long long min4 = min(min(sum(0, l), sum(l, c)), min(sum(c, r), sum(r, N)));
    chmin(ans, abs(max4 - min4));
    c++;
    if (c == r) r++;
  }
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


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

long long calc(int n, int c1, int c2, int s1, int s2, const vector<int>& options,
               int d, int nt, int ot) {
  int b1(d-1), a1(d+1), b2(d-1), a2(d+1);
  while (b1 >= 0 && options[b1] != nt) b1--;
  while (b2 >= 0 && options[b2] != ot) b2--;
  while (a1 < n && options[a1] != nt) a1++;
  while (a2 < n && options[a2] != ot) a2++;
  int x1(d-b1-1), y1(a1-d-1), z1(a1-b1-1), x2(d-b2-1), y2(a2-d-1), z2(a2-b2-1);
  int diff1 = z1*(z1+1)/2-x1*(x1+1)/2-y1*(y1+1)/2;
  int diff2 = z2*(z2+1)/2-x2*(x2+1)/2-y2*(y2+1)/2;
  return (long long) diff1 * c1 - (long long) diff2 * c2 + s1 - s2;
}

int main() {
  int n;
  cin >> n;
  vector<int> c(26);
  vector<array<int, 26>> s(n);
  
  vector<int> last(26, -1);
  
  for (int i = 0; i < 26; ++i)
    cin >> c[i];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < 26; ++j)
      cin >> s[i][j];
  
  long long total(0);
  vector<int> options(n);
  
  for (int i = 0; i < n; ++i) {
    int neg(0), test(-1);
    for (int j = 0; j < 26; ++j) {
      neg -= c[j] * (i - last[j]);
    }
    
    int max_score = -1e9;
    for (int j = 0; j < 26; ++j) {
      int ss = s[i][j] + neg + c[j] * (i - last[j]);
      if (ss > max_score) {
        max_score = ss;
        test = j;
      }
    }
    total += max_score;
    options[i] = test;
    last[test] = i;
  }
  
  for (int t = 1; t <= 500; ++t) {
    for (int dd = n - 1; dd >= 0; --dd) {
      for (int tt = 25; tt >= 0; --tt) {
        if (tt == options[dd]) continue;
        int ot = options[dd];
        long long ns = calc(n, c[tt], c[ot], s[dd][tt], s[dd][ot],
                            options, dd, tt, ot);
        //cout << ns << endl;
        if (ns > 0) {
          total += ns;
          options[dd] = tt;
    	}
      }
    }
  }
  for (const int& i: options) cout << i + 1 << endl;
  
  return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

	static final long DIVIDE_NUMBER = 1000000007;

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int answer = 0;

		for (int i = 1; i < 6; i++) {

			int target = scan.nextInt();

			if (target == 0) {

				answer = i;
			}
		}

		println(answer);
	}

	public static void println(Object target) {
		System.out.println(target);
	}
}


Measured memory_bytes: 27088
# -*- coding: utf-8 -*-
import sys


N = int(input())
S = list(input())
#%%
r_ruiseki = [0]*(N+1)
b_ruiseki = [0]*(N+1)
g_ruiseki = [0]*(N+1)
for i in range(N):
    r_ruiseki[i+1] = r_ruiseki[i] + (S[i]=='R')
    g_ruiseki[i+1] = g_ruiseki[i] + (S[i]=='G')
    b_ruiseki[i+1] = b_ruiseki[i] + (S[i]=='B')
pos_r = []
pos_b = []
pos_g = []
for i,s in enumerate(S):
    if s=='R':
        pos_r.append(i)
    elif s=='B':
        pos_b.append(i)
    else:
        pos_g.append(i)

ans = 0
for i in pos_r:
    for j in pos_b:
        if j-i<=1:
            continue
        ans += g_ruiseki[j+1] - g_ruiseki[i]
        if (i&1 == j&1):
            if S[(i+j)//2]=='G':
                ans -= 1
    

for i in pos_b:
    for j in pos_r:
        if j-i<=1:
            continue
        ans += g_ruiseki[j+1] - g_ruiseki[i]
        if (i&1 == j&1):
            if S[(i+j)//2]=='G':
                ans -= 1
    

for i in pos_r:
    for j in pos_g:
        if j-i<=1:
            continue
        ans += b_ruiseki[j+1] - b_ruiseki[i]
        if (i&1 == j&1):
            if S[(i+j)//2]=='B':
                ans -= 1
    
for i in pos_g:
    for j in pos_r:
        if j-i<=1:
            continue
        ans += b_ruiseki[j+1] - b_ruiseki[i]
        if (i&1 == j&1):
            if S[(i+j)//2]=='B':
                ans -= 1
    

for i in pos_g:
    for j in pos_b:
        if j-i<=1:
            continue
        ans += r_ruiseki[j+1] - r_ruiseki[i]
        if (i&1 == j&1):
            if S[(i+j)//2]=='R':
                ans -= 1
    
for i in pos_b:
    for j in pos_g:
        if j-i<=1:
            continue
        ans += r_ruiseki[j+1] - r_ruiseki[i]
        if (i&1 == j&1):
            if S[(i+j)//2]=='R':
                ans -= 1
    

print(ans)
            
            

Measured memory_bytes: 69336
N = int(input())


def dfs(s):
    if int(s) > N:
        return 0
    if all(s.count(c) > 0 for c in "357"):
        cnt = 1
    else:
        cnt = 0
    for c in "357":
        cnt += dfs(s + c)
    return cnt


ans = dfs("0")

print(ans)


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

public class Main {

	public static String solve (String[] str) {
		int baseX = 0, baseY = 0;
		main : for (int i = 0; i < str.length - 2; i++) {
			for (int j = 0; j < str[i].length() - 2; j++) {
				if (str[i].charAt(j) == '1') {
					baseX = j;
					baseY = i;
					break main;
				}
			}
		}

		if (str[baseY].charAt(baseX + 1) == '1') {
			if (str[baseY + 1].charAt(baseX) == '1') {
				return str[baseY + 1].charAt(baseX + 1) == '1' ? "A" : "G";
			} else {
				return str[baseY + 1].charAt(baseX + 1) == '1' ? "E" : "C";
			}

		} else {

			if (str[baseY + 2].charAt(baseX) == '1')
				return "B";
			else
				return str[baseY + 1].charAt(baseX + 1) == '1' ? "F" : "D";

		}
	}

	public static void main(String[] args) throws IOException {

		BufferedReader br =
				new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		while ((line = br.readLine()) != null) {
			if (line.isEmpty()) continue;
			String[] str = new String[10];
			str[0] = line + "00";
			for (int i = 1; i < str.length - 2; i++)
				str[i] = br.readLine() + "00";
			str[8] = "00000000";
			str[9] = "00000000";
			System.out.println(solve(str));
		}

	}

}

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

public class Main {

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] a = new long[N];
        long ans = 0;
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextLong();
        }
        for (int i = 0; i < N; i++) {
            while (true) {
                if (a[i] % 2 != 0) {
                    break;
                } else {
                    a[i] = a[i] / 2;
                    ans++;
                }
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 34364
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (r : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  print $ r ^ 2

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 508
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007

int main(){
    string s;
    cin >> s;
    cout << s.substr(0,5) << " " << s.substr(6,7) << " " << s.substr(14,5) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int mod = 1e9 + 7;
const int inf = 2e18;

signed main() {
    double R;
    cin >> R;
    cout << fixed << setprecision(10) << 2 * R * PI << endl;
}



Measured memory_bytes: 3772
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

const int N=100005;

ldb dp[3000][3000];

void solve()
{
   
    int n;
    cin>>n;
    ldb p[n+1];
    for(int i=1;i<=n;i++)
        cin>>p[i];
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=i;j++)
        {
            if(!j)
                dp[i][j]=(1-p[i])*dp[i-1][j];
            else
                dp[i][j]=(1-p[i])*dp[i-1][j]+p[i]*dp[i-1][j-1];
        }
    }
    cout<<setprecision(20);
    ldb ans=0;
    for(int i=(n+1)/2;i<=n;i++)
        ans=ans+dp[n][i];
    cout<<ans<<endl;
    
    
    
    
    
}


int32_t main()
{
    IOS;
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}






Measured memory_bytes: 139136
#include<iostream>
#include<cmath>
using namespace std;
int main(void)
{
    int n,t,a,h,idx=0;
    double mn=1e9,y;
    cin >> n >> t >> a;
    for(int i=1; i<=n; i++){
        cin >> h;
        y = abs(a-t+h*0.006);
        if(y<mn)
            mn=y,idx=i;
    }
    cout << idx;
}


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

int main() {
  int a;
  int b;
  int c;
  cin >> a;
  cin >> b;
  cin >> c;
  if (a < b) {
    if (b < c) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
int main(){
  	int a;
  	bool yymm = false, mmyy = false;
   	scanf("%d",&a);
  	int x = a / 100, y = a % 100;
  	if (1<=y && y<=12) yymm = true;
  	if (1<=x && x<=12) mmyy = true;
  
  	if (yymm && mmyy) puts("AMBIGUOUS");
  	if (yymm && !mmyy) puts("YYMM");
  	if (!yymm && mmyy) puts("MMYY");
  	if (!yymm && !mmyy) puts("NA");
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<string>
#include<queue>
using namespace std;

int main() {
	char com[20];

	priority_queue<int>PQ;

	while (1) {
		scanf("%s", com);
		if (com[0] == 'i') {
			int key;
			scanf("%d", &key);
			PQ.push(key);
		}
		else if (com[1] == 'x') {
			printf("%d\n", PQ.top());
			PQ.pop();
		}
		else if (com[0] == 'e') {
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 6456
import java.util.*;

 
public class Main {
	public static void main(String[] args) {
 
	Scanner sc  = new Scanner(System.in);
        
    int cnt = 0;

	StringBuilder str = new StringBuilder();
		

    String s1 = sc.next();
    char[] c1 = s1.toCharArray();
    int c=0;

    for(int i = s1.length()-1; i>=0 ; i-- ){
       
   //    System.out.println("str = "+str);
       
       if(c1[i]!='B'&&c==0)
       {
           str.append(c1[i]);
       }
       else if(c1[i]=='B')
       {
            ++c;
       }else{
           c--;
       }
    }
       
       

        System.out.print(str.reverse());
        System.out.println();
	}
        
}

Measured memory_bytes: 9684
#include <iostream>
#include <cstdlib>
#include <vector>

using namespace std;

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

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

    vector<int> b(n, 0);

    bool valid = true;
    RPT(i, n) {
        int tmp;
        cin >> tmp;
        if (
            (tmp % 2 != ((n - 1) % 2)) ||
            (b[tmp] == 2) ||
            ((tmp == 0) && (b[0] == 1)))
        {
            valid = false;
            break;
        }
        b[tmp]++;
    }

    long long result = 0;
    if (valid) {
        result = 1;
        RPT(i, n/2) result = (result * 2) % 1000000007;
    }

    // Output
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

#define ll long long

ll get_gcd(ll A, ll B)
{
	if (A%B == 0) return B;
	return get_gcd(B, A%B);
}

int main()
{
	ll A, B, C, D;

	scanf("%lld %lld %lld %lld", &A, &B, &C, &D);

	printf("%lld\n", B - (B / C) - (B / D) + (B / (C*D/get_gcd(C, D))) - ((A - 1) - (A - 1) / C - (A - 1) / D + (A - 1) / (C*D/get_gcd(C, D))));

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <bitset>
#include <cmath>

using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

// F(0, x)
bitset<40> func ( ll a ){

    bitset<40> bs;
    if(a <= 0){
        return bitset<40>(0);
    }

    if( a % 2 == 1){
        if( ((a + 1) / 2 ) % 2 ){
            bs = bitset<40>(1);
            return bs;
        }
        else{
            bs = bitset<40>(0);
            return bs;
        }
    }
    else{
        return func( a - 1 ) | bitset<40> (a);
    }

}

ll func(bitset<40> bs){
    ll tmp = 0;
    for(int i = 0; i < bs.size(); i++){
       tmp += ((ll)bs[i]) * pow( (ll)2, (ll)i);
    }
    return tmp;
}

int main(){

    ll a, b;
    cin >> a >> b;
    

    auto bs1 = func(a - 1);
    auto bs2 = func(b);
    auto bs3 = bs1 ^ bs2;
    cout << func(bs3) << endl;

}

Measured memory_bytes: 256
#include<stdio.h>

int main (void){

    int L,R,d;
    int min,max;
    int ans;
    scanf("%d %d %d",&L,&R,&d);

    if(L%d==0){
        min=L;
    }else{
        min=L+d-L%d;
    }

    max=R-R%d;

    if(d==1){
        min=1;
    }
    ans=(max/d)-(min/d)+1;

    printf("%d",ans);


    return 0 ;

}

Measured memory_bytes: 1728
import sys

# sys.stdin = open('d1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


def solve(n, k, a):
    filter(lambda x: x < k, a)
    n = len(a)
    a.sort()
    s = 0
    lowest = None
    for i in range(n - 1, -1, -1):
        if k - a[i] <= s:
            # a[i] is not unnecessary
            lowest = i
        else:
            # maybe a[i] is unnecessary
            s += a[i]
    if lowest is None:
        return n
    return lowest

n, k = read_int_list()
a = read_int_list()
res = solve(n, k, a)
print(res)


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

int main(){
	int n;
	cin >> n;
	int m;
	cin >> m;
	int ans = m;
	for(int i = 0; i < n; i++){
		int a, b;
		cin >> a >> b;
		m += a-b;
		if(m > ans) ans = m;
		if(m < 0){
			cout << "0" << endl;
			return 0;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1160