akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>

typedef struct{
  double x;
  double y;
}Koch;

void kochCurve(int, Koch, Koch);

int main(){
  int n;
  Koch p1, p2;

  p1.x = 0;
  p1.y = 0;

  p2.x = 100;
  p2.y = 0;

  scanf("%d", &n);

  printf("%f %f\n", p1.x, p1.y);
  kochCurve(n, p1, p2);
  printf("%f %f\n", p2.x, p2.y);

  return 0;
}

void kochCurve(int n, Koch p1, Koch p2){
  Koch s, t, u;

  if(n == 0) return;

  s.x = (p2.x - p1.x)/3 + p1.x;
  s.y = (p2.y - p1.y)/3 + p1.y;
  t.x = 2*(p2.x - p1.x)/3 + p1.x;
  t.y = 2*(p2.y - p1.y)/3 + p1.y;
  u.x = (t.x - s.x)/2 - sqrt(3)/2 * (t.y - s.y) + s.x;
  u.y = (t.y - s.y)/2 + sqrt(3)/2 * (t.x - s.x) + s.y;

  kochCurve(n - 1, p1, s);
  printf("%f %f\n", s.x, s.y);

  kochCurve(n - 1, s, u);
  printf("%f %f\n",u.x, u.y);

  kochCurve(n - 1, u, t);
  printf("%f %f\n",t.x, t.y);

  kochCurve(n - 1, t, p2);
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll, int, char>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-7
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int n;
ll a, b, c;
vector<string> vec(100005);
ll cnt = 0;
vector<char> ans;
void solve(int ind, int ca, int cb, int cc) {
    if(ind>n) return ;
    if(ca<0 || cb<0 || cc<0) return ;
    if(cnt>1e7) return ;
    if(ind==n) {
        cout<<"Yes"<<endl;
        for(auto& it : ans) {
            cout<<it<<endl;
        }
        cout<<endl;
        exit(0);
    }

    cnt++;

    string now = vec[ind];
    if(now=="AB") {
        ans.push_back('A');
        solve(ind+1, ca+1, cb-1, cc);
        ans.pop_back();
        ans.push_back('B');
        solve(ind+1, ca-1, cb+1, cc);
        ans.pop_back();
    }
    if(now=="AC") {
        ans.push_back('A');
        solve(ind+1, ca+1, cb, cc-1);
        ans.pop_back();
        ans.push_back('C');
        solve(ind+1, ca-1, cb, cc+1);
        ans.pop_back();
    }
    if(now=="BC") {
        ans.push_back('C');
        solve(ind+1, ca, cb-1, cc+1);
        ans.pop_back();
        ans.push_back('B');
        solve(ind+1, ca, cb+1, cc-1);
        ans.pop_back();
    }
}

int32_t main() {
    fastio
    cin>>n;
    cin>>a>>b>>c;
    for(auto& it : vec) cin>>it;

    solve(0, a, b, c);
    cout<<"No"<<endl;
}

Measured memory_bytes: 20760
N = int(input())
L = list(map(int, input().split()))
ans = 0
L.sort()
#print(L)
for i in range(N-2):
	for j in range(i+1,N-1):
		if L[i]!=L[j]:	
			for k in range(j+1,N):
				if L[j]!=L[k]:
					if L[k]<L[i]+L[j]:
						ans += 1
print(ans)

Measured memory_bytes: 9200
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define CAT(a,b)a b
#define VASIZE(a,b,N,...)N
template<class T>auto size(T&&a)->decltype(a.size(), int()) { return a.size(); }
template<class T>typename make_signed<decltype(T() % 0)>::type size(T a) { return a; }
#define REP(t,a,N)for(decltype(size(N))t=size(a),_l##t=size(N);t<_l##t;t++)
#define RREP(t,a,N)for(decltype(size(N))t=size(N)-1,_l##t=size(a);t>=_l##t;t--)
#define rep(t,...)CAT(REP,VASIZE(__VA_ARGS__,(t,__VA_ARGS__),(t,0,__VA_ARGS__)))
#define rrep(t,...)CAT(RREP,VASIZE(__VA_ARGS__,(t,__VA_ARGS__),(t,0,__VA_ARGS__)))
#define all(a)begin(a),end(a)

void Calc();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0); cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
struct Scanner {
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) cin >> i; return a; }
  string Line() { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

/*---------------------------------------------------------------------*/
template<class T, class B, class...V>struct Vec {
  typedef Vec<T, V...>A; typedef vector<typename A::t>t; t nvec(B a, V...b) { return t(a, A().nvec(b...)); }
};
template<class T, class B>struct Vec<T, B> { typedef vector<T>t; t nvec(B a) { return t(a); } };
template<class T>tuple<T>Init(T t) { return tuple<T>(t); }
template<class T, class C>struct Vec<T, tuple<C>> { using t = T; T nvec(tuple<C> a) { return get<0>(a); } };
template<class T = int, class...B> typename Vec<T, B...>::t nvec(B...b) { return Vec<T, B...>().nvec(b...); }



void Calc() {
  int n, a;
  in, n, a;

  auto x = in.Array(n);

  auto dp = nvec<ll>(n + 1, n + 1, 50 * 50, Init(0));
  dp[0][0][0] = 1;
  rep(i, n) rep(k, n) rrep(j, dp[i][k].size()) if (dp[i][k][j]) {
    dp[i + 1][k][j] += dp[i][k][j];
    dp[i + 1][k + 1][j + x[i]] += dp[i][k][j];
  }
  ll ans = 0;
  rep(i, n) {
    ans += dp[n][i + 1][i * a + a];
  }
  cout << (ans) << endl;
}


Measured memory_bytes: 52224
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
constexpr int INF = (1 << 29);
constexpr ll INF_ = (1LL << 58);
constexpr ld EPS = (1e-10);
constexpr ld PI_ = 3.141592653589793238;//46264338327950288
constexpr ld E_ = 2.71828182845904523;//5360287471352
constexpr ll MOD = 1000000007;
//// functions (integer)_________________________________
ll modpow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a % m;
		a = a * a%m; n >>= 1;
	}
	return res;
}
ll modinv(ll a, ll p, ll mod){
  return modpow(a,p-2,mod);
}
////-----------------------------------------------------
int main(void){
  int N, K; ll A[100005], factorial[200005], invfactorial[200005], Comb[200005];
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N >> K;
  RPT(i,0,N) cin >> A[i];
  if(K==1) {cout << 0 << endl; return 0;}
  sort(A,A+N);
  factorial[0] = 1;
  invfactorial[0] = 1;
  RPT(i,1,2*N+1){
    factorial[i] = (i*factorial[i-1])%MOD;
    invfactorial[i] = modpow(factorial[i],MOD-2,MOD);
  }
  FOR(i,K-2,N-1){
    Comb[i] = ((factorial[i]*invfactorial[K-2]%MOD)*invfactorial[i-K+2])%MOD;
  }
  ll ans = 0;
  ll Min_ = 0, Max_ = 0, _N = 0; 
  RPT(i,0,N-K+1){
    int Min_i = N - K - i, Max_i = K - 1 + i;
    _N += Comb[K-2+i];
    _N %= MOD;
    Min_ += ((A[Min_i]+MOD)*_N)%MOD;
    Max_ += ((A[Max_i]+MOD)*_N)%MOD;
    Min_ %= MOD;
    Max_ %= MOD;
  }
  ans = (Max_ - Min_ + MOD) % MOD;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5760
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits>
#include <climits>
#include <functional>
#include <numeric>

using namespace std;

#define alloc(type,n) (type*)calloc(sizeof(type),(n));
typedef long long lli;

lli n;
vector<string> a;
lli h_row;
lli v_row;
lli max_h;
lli max_v;
vector<lli> v_c;
vector<lli> h_c;
vector<lli> slash;
lli ans;

bool check(){
	bool judge = false;
	bool row_judge;
	lli c;
	for(int i = 0;i < n;i++) {
		c = 0;
		for(int j = 0;j < n;j++){
			if(a[i][j] == '#') judge = true,c++;
		}
		if(c == n) v_row++;
		v_c.push_back(c);
	}
	for(int i = 0;i < n;i++){
		c = 0;
		for(int j = 0;j < n;j++){
			if(a[j][i] == '#') c++;
		}
		if(c == n) h_row++;
		h_c.push_back(c);
		max_h = max(max_h,c);
	}
	for(int i = 0;i < n;i++){
		if(a[i][i] == '#') slash.push_back(true);
		else slash.push_back(false);
	}
	return judge;
}

int main(){
	cin >> n;
	a = vector<string>(n);
	for(int i = 0;i < n;i++) cin >> a[i];
	if(!check()){
		cout << -1 << endl;
		return 0;
	}
	if(v_row){
		cout << n-h_row << endl;
	}else{
		ans = INT_MAX;
		for(int i = 0;i < n;i++){
			if(slash[i]){
				ans = min(ans,n-v_c[i]);
			}else{
				if(h_c[i]) ans = min(ans,n-v_c[i]);
				else ans = min(ans,n-v_c[i]+1);
			}
		}
		ans += n-h_row;
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define lint long long int
#define rep(i,n) for(int i=0;i<int(n);i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define arep(i,a,n) for(int i=a;i<n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define fill(a,x) fill(a.begin(),a.end(),x)
#define eb(data) emplace_back(data)
#define pb(data) emplace_back(data)
#define mp make_pair
#define ALNUM 26
#define vint vector<int>
#define F first
#define S second
#define ALL(data) data.begin(),data.end()
#define GEts(s) getline(cin,s);
using namespace std;
template<typename Rast>inline void out(Rast rast){cout<<rast<<"\n";return;}
template<typename Rast>inline void in(Rast& rast){cin>>rast;return;}
template<typename T>istream& operator >> (istream& is, vector<T>& vec){for(T& x: vec) is >> x;return is;}
template<typename First, typename... Rest>void in(First& first, Rest&... rest){cin >> first;in(rest...);return;}
template<typename First, typename... Rest>void out(First first, Rest... rest){cout << first<<" ";out(rest...);return;}
template<typename T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<typename T1,typename T2>bool chmax(T1& a,T2 b){if(a<b){a=b;return true;}else{return false;}}
template<typename T1,typename T2>bool chmin(T1& a,T2 b){if(a>b){a=b;return true;}else{return false;}}
template<typename T>T lcm(T a, T b){return a * b / gcd(a, b);}
static const double pi = 3.141592653589793;
lint modpow(lint a,lint n,lint p){if(n==1)return a%p;if(n%2==1)return (a*modpow(a,n-1,p))%p;lint t=modpow(a,n/2,p);return (t*t)%p;}//a^n%p
lint MOD=pow(10,9)+7;
//lint MOD=998244353;
lint inf=pow(2,50);
int intinf=pow(2,30);
/**int dirx[]={1,0};int diry[]={0,1};//*///右、下
/**int dirx[]={0,1,0,-1};int diry[]={-1,0,1,0};//*///四方位
/**int dirx[]={-1,0,1,1,1,0,-1,-1};int diry[]={-1,-1,-1,0,1,1,1,0};//*///八方位

class unionfind{
public:
	vector<int> table;
	vector<int> wod;
	void init(int size){
		table.resize(size);
		wod.resize(size);
		rep(i,size)table[i]=i,wod[i]=i;
	};
	int root(int index){
		if(table[index]==index)return index;
		else{
			int hoge=root(table[index]);
			table[index]=hoge;
			return hoge;
		}
	};
	bool same(int x,int y){
		return(root(x)==root(y));
	};
	int marge(int x,int y){
		int yroot=root(y);
		int xroot=root(x);
		if(xroot==yroot)return 0;
		table[yroot]=xroot;
		return 0;
	}
};

vector<int> fu(lint n){
	vector<int> ret;
	arep(i,2,1000000){
		while(n%i==0){
			ret.pb(i);
			n/=i;
		}
	}
	if(n!=1)ret.pb(n);
	sort(ret);
	return ret;
}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);cout<<std::fixed<<std::setprecision(12);
	lint n;
	in(n);
	auto recv=fu(n);
	int siz=recv.size();
	cout<<n<<':';
	rep(i,siz)cout<<' '<<recv[i];
	out("");
	return 0;
}



Measured memory_bytes: 3208
import sys
from collections import deque

def test():

	n = int(sys.stdin.readline())
	DLlist = deque()

	for i in range(n):
	
		command = sys.stdin.readline().split()

		if command[0] == 'insert':
			DLlist.appendleft(int(command[1]))

		elif command[0] == 'deleteFirst':
			DLlist.popleft()

		elif command[0] == 'deleteLast':
			DLlist.pop()

		elif command[0] == 'delete':
			x = int(command[1])
			for j in range(len(DLlist)):
				if DLlist[j] == x:
					DLlist.remove(x)
					break
				

	for i in range(len(DLlist)-1):
		print(f"{DLlist[i]} ",end='')
	print(f"{DLlist[len(DLlist)-1]}")
					

if __name__ == "__main__":
	test()


Measured memory_bytes: 45904
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }

int main() {
    int n, W; cin >> n >> W;
    vll w(n), v(n);
    rep(i, n) cin >> w[i] >> v[i];
    vector<vll> dp(n+1, vll(W+1, 0));
    FOR(i, 1, n+1) {
        rep(iw, w[i-1]) dp[i][iw] = dp[i-1][iw];
        FOR(iw, w[i-1], W+1) {
            dp[i][iw] = max(dp[i-1][iw], dp[i-1][iw - w[i-1]] + v[i-1]);
        }
    }
    cout << dp[n][W] << endl;
    return 0;
}


Measured memory_bytes: 80256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//long a = Long.parseLong(sc.next());
		String t = sc.next();
		char[] c = t.toCharArray();
		c[0] = (char) (c[0]+1);
		//long b = Long.parseLong(sc.next());
		//int c = Integer.parseInt(sc.next());
		//int n = Integer.parseInt(sc.next());
		//long res=n;
		//int l = Integer.parseInt(sc.next());
		//int sum=0;
		//String s = sc.next();
		//String t = sc.next();
		//String w = sc.next();
		//int a = Integer.parseInt(sc.next());
		//String t = sc.next();

		/*if() {//a、e、i、o、u
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}*/
		/*for(int i=0;i<t.length();i++) {
			if(t.substring(i,i+1).equals(",")) {
				buff+=" ";
			}else {
				buff+=t.substring(i, i+1);
			}
		}*/
		System.out.println(c);

	}
}




Measured memory_bytes: 21972
x = int(input())
a = 0
b = 0
for i in range(121):
    tmp = (i ** 5 - x)
    flag = True
    #負の値でFalse
    if tmp < 0:
        flag = False
    b_kouho = abs(tmp) **(1/5)
    b_kouho = round(b_kouho) * -1
    if flag:
        b_kouho *= -1
    if i**5 - b_kouho**5 == x:
        a = i
        b = b_kouho
        break
print("{} {}".format(int(a),int(b)))

Measured memory_bytes: 9464
use std::io::Read;
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let m: usize = iter.next().unwrap().parse().unwrap();
    let mut x: Vec<i64> = (0..m)
        .map(|_| iter.next().unwrap().parse().unwrap())
        .collect();

    x.sort();

    let mut d = Vec::new();
    for i in 0..m - 1 {
        d.push((x[i] - x[i + 1]).abs());
    }
    d.sort();

    let mut ans: i64 = 0;
    if n < m {
        for i in 0..m - n {
            ans += d[i];
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 8444
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>

template <class T>
struct SegmentTree {
  int SEG_LEN = 1;
  std::vector<T> node;
  SegmentTree(int n) {
    while (SEG_LEN < n) { SEG_LEN <<= 1; }
    node.assign(SEG_LEN*2, 0);
  }
  void add(int idx, T v) {
    idx += SEG_LEN;
    node[idx] += v;
    while (true) {
      idx /= 2;
      if (idx == 0) { break; }
      node[idx] = node[idx*2] + node[idx * 2 + 1];
    }
  }
  T sum(int l, int r) {
    l += SEG_LEN; r += SEG_LEN;
    T ret = 0;
    while (l < r) {
      if (l & 1) { ret += node[l++]; }
      if (r & 1) { ret += node[r-1]; r--; }
      l /= 2; r /= 2;
    }
    return ret;
  }
};

int main() {
  std::cout << std::setprecision(20) << std::fixed;
  int n, k; std::cin >> n >> k;
  SegmentTree<double> seg_tree(n);

  for (int i = 0; i < n; i++) {
    int p; std::cin >> p;
    seg_tree.add(i, (1+p)/2.0);
  }
  double ans = 0;
  for (int i = 0; i <= n-k; i++) {
    ans = std::max(ans, seg_tree.sum(i, i+k));
  }
  std::cout << ans << std::endl;
}

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

typedef pair<long long, long long> pll;

long long A[200005];
long long B[200005];
long long C[200005];
long long D[200005];
long long pow2[200005];

const long long MOD = 1e9+7;

map<pll, long long> map1;

void insert1(long long a, long long b, int i){
    if(b == 0 && a == 0){
        a = b = 0;
    }else if(b == 0){
        b = 0;
        a = 1;
    }else if(a == 0){
        a = 0;
        b = 1;
    }else{
        long long temp = __gcd(abs(a), abs(b));
        a /= temp;
        b /= temp;
    }

    if(a < 0){
        a = -a;
        b = -b;
    }

    C[i] = a;
    D[i] = b;

    pll indx = pll(a, b);
    //printf("%lld %lld inserted into map\n", a, b);
    if(map1.find(indx) == map1.end()){
        map1[indx] = 1;
    }else{
        map1[indx] ++;
    }
}

int main(){
    int N;
    scanf("%d", &N);

    pow2[0] = 1;
    for(int i = 1; i <= N; i ++){
        scanf("%lld%lld", &A[i], &B[i]);

        //if(A[i] == 0 && B[i] == 0){throw;}
        //if(abs(A[i]) == abs(B[i])){throw;}
        pow2[i] = 2*pow2[i-1]%MOD;
    }

    map1[pll(0, 0)] = 0;
    for(int i = 1; i <= N; i ++){
        insert1(A[i], B[i], i);
    }

    long long ans = 1;
    long long temp = map1[pll(0, 0)];
    for(int i = 1; i <= N; i ++){
        //printf("C[%d]=%lld D[%d]=%lld\n", i, C[i], i, D[i]);
        if(C[i] == 0 && D[i] == 0){continue;}

        //printf("%lld\n", map1[pll(C[i], D[i])]);

        long long ways = pow2[map1[pll(C[i], D[i])]];

        pll inv;
        if(C[i] == 0 || D[i] == 0){
            //ways = pow2[map1[pll(C[i], D[i])]];
            map1[pll(C[i], D[i])] = 0;
            inv = pll(D[i], C[i]);
            if(map1.find(inv) != map1.end()){
                ways += pow2[map1[inv]];
                map1[inv] = 0;
            }else{
                ways ++;
            }
            ways = (ways+MOD-1)%MOD;
            //throw;
        }else{
            map1[pll(C[i], D[i])] = 0;
            inv = pll(-D[i], C[i]);
            if(map1.find(inv) != map1.end()){
                ways += pow2[map1[inv]];
                map1[inv] = 0;
            }else{
                ways ++;
            }

            inv = pll(D[i], -C[i]);
            if(map1.find(inv) != map1.end()){
                ways += pow2[map1[inv]];
                map1[inv] = 0;
            }else{
                ways ++;
            }

            ways = (ways+MOD-2)%MOD;
        }
        //printf("ways=%lld\n", ways);
        ans = ans*ways%MOD;
    }
    ans += temp;
    ans = (ans+MOD-1)%MOD;

    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 23908
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<10)
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main() {
    ll n,m;
    cin>>n>>m;
    vector<ll>a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    map<ll,ll>ma;
    vector<ll>sum(n+1);
    sum[0]=0;
    for(int i=0;i<n;i++)sum[i+1]=(sum[i]+a[i])%m;
    ll ans=0;
    for(int i=0;i<n+1;i++){
      ans+=ma[sum[i]];
      ma[sum[i]]++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5760
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <algorithm>

using namespace std;

void func(long long n, vector<long long>& ret)
{
	for (long long i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i != 1 && i * i != n) {
				ret.push_back(n / i);
			}
		}
	}
	sort(ret.begin(), ret.end());
}

int main()
{
	long long N;
	cin >> N;
	vector<long long> arr;
	func(N, arr);
	long long ans = 0;
	for (int i = 0; i < arr.size(); i++) {
		long long val = N / arr[i] - 1;
		if (val > arr[i]) {
			ans += val;
		}
	}
    cout << ans << endl;
	return 0;
}


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

using namespace std;
using ll = long long int;
using lc = complex<double>;

int main(void) {
    constexpr ll MOD = 1e9 + 7;
    constexpr double PI = acos(-1);
    cout << fixed << setprecision(32);
    cin.tie(0); ios::sync_with_stdio(false);

    ll n;
    cin >> n;
    map<ll,ll> m;
    ll s = 0;
    while(n--) {
        ll x;
        cin >> x;
        m[x]++;
        s += x;
    }

    ll q;
    cin >> q;
    while(q--) {
        ll b, c;
        cin >> b >> c;
        s += (c-b)*m[b];
        m[c] += m[b];
        m[b] = 0;
        cout << s << endl;
    }
    
}


Measured memory_bytes: 9500
#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort(x.rbegin(), x.rend())
#define REVERSE(x) reverse(ALL(x))
#define MAX(x) *max_element(ALL(x))
#define MAXI(x) max_element(ALL(x)) - x.begin()
#define SUM(x) accumulate(ALL(x), 0ll)
#define COUNT(x, y) count(ALL(x), y);
#define ANS cout << ans << "\n"
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define Yes cout << "Yes\n";
#define No cout << "No\n";
#define YN YES else NO
#define yn Yes else No
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(z, v.size()) cerr << " " << v[z]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;
using vp = vector<P>;
using vs = vector<string>;

template <typename T>
inline istream& operator>>(istream& i, vector<T>& v) {
  rep(j, v.size()) i >> v[j];
  return i;
}

template <typename T1, typename T2>
inline istream& operator>>(istream& i, pair<T1, T2>& v) {
  return i >> v.first >> v.second;
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

signed main() {
  init();
  ll N;
  cin >> N;
  vll X(N), Y(N);
  rep(i, N) cin >> X[i] >> Y[i];
  vll X2(N), Y2(N);
  rep(i, N) {
    X2[i] = X[i] + Y[i];
    Y2[i] = X[i] - Y[i];
  }

  SORT(X2);
  SORT(Y2);

  ll ans = max(X2.back() - X2[0], Y2.back() - Y2[0]);
  ANS;

  return 0;
}

Measured memory_bytes: 9512
use proconio::input;
use std::collections::HashMap;

fn main() {
    input! {
        n: usize,
        aa: [i64; n],
    }

    let mut map = HashMap::new();
    let mut sum = 0;
    let mut count = 0_usize;

    for a in aa {
        sum += a;
        if sum == 0 {
            count += 1;
        }
        if let Some(&val) = map.get(&sum) {
            count += val;
        }
        *map.entry(sum).or_insert(0) += 1;
    }

    println!("{}", count);
}


Measured memory_bytes: 12328
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm> 
using namespace std;
 
# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

int main()
{
    string s;cin >> s;

    long long int ans=0;
    char pre=s.at(0);
    for(int i=1;i<s.size();i++){
        if(pre!=s.at(i)) ans++;
        pre = s.at(i);
    }    
    p(ans)
}

Measured memory_bytes: 512
s = input()
a = int(s[:2])
b = int(s[-2:])
ym = True if 1 <= b <= 12 else False
my = True if 1 <= a <= 12 else False
print('AMBIGUOUS' if ym and my else 'YYMM' if ym else 'MMYY' if my else 'NA')


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstdio>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <set>
#include <utility>
#include <functional>
using namespace std;
typedef pair<int, int> pii;
typedef pair<string, int> P;
typedef long long ll;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
const int MAXN = 100000;
const int MAXE = 100000;
const int MAXV = 10000;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
struct UnionFind{
    vector<int> par,rank;
    UnionFind(int n):par(n),rank(n){
        for(int i=0;i<n;++i) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    void unite(int x,int y){
        int rx=root(x),ry=root(y);
        if(rx==ry) return ;
        if(rank[ry]>rank[rx]) par[rx]=ry;
        else par[ry]=rx;
        if(rank[rx]==rank[ry]) rank[rx]++;
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};
int main(){
    int n;cin>>n;
    vector<ll> t(n),a(n);
    for(int i=0;i<n;++i) cin>>t[i];
    for(int i=0;i<n;++i) cin>>a[i];
    ll ans=1;
    bool flag=true;
    for(int i=0;i<n;++i){
        if(i==0||t[i-1]<t[i]){
            if(a[i]>a[i+1]){
                if(t[i]!=a[i]) flag=false;
            }else{
                if(t[i]>a[i]) flag=false;
            }
        }else{
            if(i==n-1||a[i]>a[i+1]){
                if(t[i]<a[i]) flag=false;
            }else{
                ans=ans*min(t[i],a[i])%MOD;
            }
        }
    }
    if(!flag){
        cout<<0<<endl;
        return 0;
    }
    cout<<ans<<endl;
    return 0;
}

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

ll max1(ll a,ll b){
  return a>b?a:b;
}
ll min1(ll a,ll b){
  return a>b?b:a;
}

ll max1(ll a,ll b,ll c){
  return max1(a,max1(b,c));
}
ll min1(ll a,ll b,ll c){
  return min1(a,min1(b,c));
}

int main(void){
  ll h,w;
  
  cin>>h>>w;
  if(h%3==0||w%3==0){
    cout<<0<<endl;
    return 0;
  }
  ll res,tmax,tmin,x,y,z,t;
  res=1e9;
  //cout<<"w"<<w<<" h"<<h<<endl;
  for(ll i=1;i<=(h/3)+1;i++){
    x=i*w;
    if((h-i)%2==0) z=y=((h-i)/2)*w;
    else {
      y=((h-i)/2)*w;
      z=(((h-i)/2)+1)*w;
    }
    //cout<<x<<" "<<y<<" "<<z<<endl;
    res=min1(res,max1(x,y,z)-min1(x,y,z));
    if(w%2==0) z=y=(h-i)*(w/2);
    else{
      y=(h-i)*(w/2);
      z=(h-i)*((w/2)+1);
    }
    res=min1(res,max1(x,y,z)-min1(x,y,z));
  }
  t=h;h=w;w=t;
  //cout<<"w"<<w<<" h"<<h<<endl;
  for(ll i=1;i<=(h/3)+1;i++){
    x=i*w;
    if((h-i)%2==0) z=y=((h-i)/2)*w;
    else {
      y=((h-i)/2)*w;
      z=(((h-i)/2)+1)*w;
    }
    //cout<<x<<" "<<y<<" "<<z<<endl;
    res=min1(res,max1(x,y,z)-min1(x,y,z));
    if(w%2==0) z=y=(h-i)*(w/2);
    else{
      y=(h-i)*(w/2);
      z=(h-i)*((w/2)+1);
    }
    res=min1(res,max1(x,y,z)-min1(x,y,z));
  }  
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
typedef pair<int , int > pii;
#define MOD 1000000007
#define MOD1 998244353
#define ff first
#define ss second
#define bn cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define sz(a) (a).size()
#define o(a) cout << a
#define MAX6 1000006
#define int ll
#define all(x) x.begin(), x.end()
#define ppii pair<int,pii>
#define vi vector<int>
#define vii vector<pii>
#define viii vector<ppii>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define MAX5 300005
#define MAX7 10000007
#define rep(i,a,b)  for (__typeof((b)) i=(a);i<=(b);i++)
#define nrep(i,b,a)  for (__typeof((b)) i=(b);i>=(a);i--)
#define mem(a) memset(a,0,sizeof(a))
#define memneg(a) memset(a,-1,sizeof(a))
//#define se second
#define LN 14
#define LIM 22
#define MAX_ALPHA 26
const long long INF64 = 1e18;
const ll INF = 1e9;
const double PI = acos(-1);
#define ld long double
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
inline void max_self(ll &a, ll b)
{
  a = max(a,b);
}
 
inline void min_self(ll &a,ll b)
{
  a = min(a,b);
}
 
inline void add_self(ll &a, ll b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
 
inline void sub_self(ll &a, ll b) {
  a -= b;
  if (a < 0) a += MOD;
}
 
inline int mul(int a, int b) {
  return (int) ((long long) a * b % MOD);
}
 
 
ll gcd(ll a,ll b)
{
  if(b == 0)
    return a;
  else 
    return gcd(b, a%b);
}
 
 
int countDigits(int x)
{
  int cnt = 0;
  while(x)
  {
    x /= 10;
    cnt++;
  }
  return cnt;
}
 
 
ll binExpo(ll a,ll b)
{
  ll res = 1;
  while(b)
  {
    if(b&1)
      res = (res * a)%MOD;
    a = (a * a)%MOD;
    b /= 2;
  }
  return res%MOD;
}
 
int sum(int a) {
    int result = 0;
    while (a > 0) {
        result += a % 10;
        a /= 10;
    }
    return result;
}

//dp[i] --> TRUE if we have i coins remaining and first player wins 

void solve()
{
  int n, k;
  cin>>n>>k;
  vector<int > a(n+1);
  rep(i, 0, k-1)
    cin>>a[i];

  vector<bool> dp(k + 1);
  dp[0] = false;

  rep(i, 0, k)
  {
    rep(j, 0, n-1)
    {
      if(i - a[j] >= 0 and !dp[i - a[j]])
        dp[i] = true;
    }
  }
  cout<<(dp[k] == true ? "First" : "Second")<<endl;
}

signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

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















Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

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

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

    int n;
    cin>>n;
    vector<int> as(n);
    rep(i, n) cin>>as[i];
    int q;
    cin>>q;

    rep(i, q) {
        int b, e, k;
        cin>>b>>e>>k;
        cout<<count(as.begin() + b, as.begin() + e, k)<<endl;
    }
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
int a[55];
int main()
{
	int n;
	cin>>n;
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(i!=a[i])cnt++;
	}
	if(cnt<=2)cout<<"YES";
	else cout<<"NO";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<int(n);i++)
#define FOR(i,n,m) for(int i=n;i<int(m);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
using namespace std;
 
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
 
int vx[]={0,0,-1,1};
int vy[]={1,-1,0,0};
int dx[]={1,0,-1,1,-1,1,0,-1};
int dy[]={1,1,1,0,0,-1,-1,-1};
 
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}

int main(){
	int r;
	cin>>r;
	double pi = 3.14159265;
	cout<<2*r*pi<<endl;
	return 0;
}

Measured memory_bytes: 3788
X, K, D = gets.split.map(&:to_i)
if X.abs >= (K*D).abs
    puts X.abs - (K*D).abs
else
    init_K = X.div(D)
    init_X = X % D
    if (K - init_K).even?
        puts init_X.abs
    else
        puts (init_X - D).abs
    end
end

Measured memory_bytes: 14372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;



int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(ll i=0;i<n;i++) cin >> a[i];
    vector<ll> ans;
    while(!a.empty()){
        bool flag=false;
        ll m=a.size();
        for(ll i=m-1;i>=0;i--){
            if(a[i]==i+1){
                flag=true;
                ans.push_back(i+1);
                a.erase(a.begin()+i);
                break;
            }
        }
        if(!flag){
            cout << -1 << endl;
            return 0;
        }
    }
    reverse(ans.begin(),ans.end());
    for(ll i=0;i<n;i++){
        cout << ans[i] << endl;
    }
    return 0;
}  


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
const int MOD=1000000007;
int n;
int dp[100005],cnt[100005];
char s[100005],t[100005];
int main()
{
  cin>>n;
  for(int i=0;i<n;i++) cin>>s[i];

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

  cnt[s[0]-'a']=1;
  for(int i=1;i<n;i++){
    (dp[i]+=cnt[t[i]-'a'])%=MOD;
    (cnt[s[i]-'a']+=dp[i])%=MOD;
  }

  cout<<dp[n-1]<<endl;
  return 0;
}



Measured memory_bytes: 3680
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <algorithm>
#include<math.h>
#include <cmath>
#include<iomanip>
using namespace std;
int main(){
    double a, b, C;cin >> a >> b >> C;
    double rad = M_PI /180 *C;
     
    double S = a * b * sin(rad)/ 2;
    double L = sqrt(a * a + b * b -2*a*b*cos(rad)) + a + b;
    double h = 2 * S / a;
    cout << fixed << setprecision(12) << S << endl;
    cout << L << endl;
    cout << h << endl;
        return 0;
    }
            


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int N,M,K,tmp,ans = 0;
	cin >> N >> M;
	vector<int> v(M,0);
	for (int i = 0;i < N;i++){
		cin >> K;
		for (int j = 0;j < K;j++){
			cin >> tmp;
			v[tmp-1]++;
		}
	}
	for (int i = 0;i < M;i++){
		if (v[i] == N){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a, b; cin >> a >> b;
    if(a*b % 2 == 0) cout << "Even" << endl;
    else cout << "Odd" << endl;
    return 0;
}

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

int main() {
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> b(m);
  for(int i=0; i<m; i++)
    cin >> b.at(i);
  vector<vector<int>> a(n, vector<int> (m));
  for(int i=0; i<n; i++) {
    for(int j=0; j<m; j++) {
      cin >> a.at(i).at(j);
    }
  }
  
  int count = 0;
  
  for(int i=0; i<n; i++) {
    int p = c;
    for(int j=0; j<m; j++) {
      p += a.at(i).at(j) * b.at(j);
    }
    if(p > 0) {
      count ++;
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static int[] a = null;
	static int[] b = null;
	static int[] c = null;
	static int[] d = null;
	static int n = 0;
	static int m = 0;
	static int q = 0;
	static long ans = -100L;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		q = sc.nextInt();
		a = new int[q];
		b = new int[q];
		c = new int[q];
		d = new int[q];

		for (int i = 0; i < q; ++i) {
			a[i] = sc.nextInt() - 1;
			b[i] = sc.nextInt() - 1;
			c[i] = sc.nextInt();
			d[i] = sc.nextInt();
		}

		dfs(new ArrayList<Integer>());
		System.out.println(ans);
	}

	public static void dfs(ArrayList<Integer> list) {
		if (list.size() == n) {
			long score = 0L;
			for (int i = 0; i < q; ++i) {
				score += (list.get(b[i]) - list.get(a[i]) == c[i]) ? d[i] : 0L;
			}
			ans = Math.max(ans, score);
			return;
		}

		if (!list.isEmpty()) {
			for (int num = list.get(list.size() - 1); num <= m; ++num) {
				list.add(num);
				dfs(list);
				list.remove(list.size() - 1);
			}
		} else {
			for (int num = 1; num <= m; ++num) {
				list.add(num);
				dfs(list);
				list.remove(list.size() - 1);
			}
		}
	}
}


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

using namespace std;

int main() {
    int n; cin >> n;
    string str_n = to_string(n);
    int sum = 0;
    for(auto s : str_n) {
        sum += s - '0';
    }
    n % sum == 0 ? cout << "Yes" : cout << "No";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<set>
#include<map>
#include<queue>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);++i)
#define rrep(i,n) for(int (i)=(n)-1;(i)>=0;--i)
#define rep1(i,n) for(int (i)=1;(i)<=(n);++i)
#define rrep1(i,n) for(int (i)=(n);(i)>=1;--i)
#define pb push_back
#define fr first
#define sc second
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> DP;
typedef pair<long long,long long> LP;
typedef double db;
using namespace std;
string s;
bool b = 0;
int main()
{
  ll l;
  cin>>s;
  l = s.size();
  rep(i,7){
    b |= ( s.substr(0,7-i)+s.substr(l-i,i) == "keyence");
  }
  puts(b?"YES":"NO");
}


Measured memory_bytes: 256
from collections import defaultdict
d = defaultdict(int)

N, K = map(int, input().split())
li = list(map(int, input().split()))

for i in range(1, 1000+1):
  t = 0
  for s in range(1, i+1):
    t += s * (1 / i)

  d[i] = t

ans = 0
t = 0

for index, i in enumerate(li):
  t += d[i]

  if index > K-1:
    t -= d[li[index-K]]

  if ans < t:
    ans = t

print(ans)

Measured memory_bytes: 71792
use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let a: i64 = sc.read();
    let b: i64 = sc.read();
    println!("{}", cmp::max(cmp::max(a + b, a - b), a * b));
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
N,K,S = map(int,input().split())
if K==N:
    A = [S]*N
    print(*A)
    exit()

a = 10**9 if S<10**9 else 10**9-2
A = [a]*N

if K==0:
    print(*A)
    exit()

if S==1:
    for i in range(K):
        A[i] = 1
    print(*A)
    exit()

for i in range(K+1):
    if i%2:
        A[i] = 1
    else:
        A[i] = S-1
print(*A)

Measured memory_bytes: 7788
#include <iostream>
using namespace std;
int main(){
    int W,H,x,y,r;
    cin >>W>>H>>x>>y>>r;
    
    if(y+r<=H && x+r<=W && 0<=y-r && 0<=x-r){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long 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 {
		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;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

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


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

	vector<double> A(N + 1);
	repn(i, N)cin >> A[i];

	double M = 1000000000;

	vector<vector<ll>> c(50, vector<ll>(50, 0));

	repn(i, N) {
		ll t = A[i] * M + 0.1;

		ll x = 0;
		ll y = 0;
		while (t % 2 == 0) { x++; t /= 2; }
		while (t % 5 == 0) { y++; t /= 5; }
		c[x][y]++;
		//cout << x << y << endl;
	}

	ll ans = 0;
	rep(i, 50)rep(j, 50)rep(k, 50)rep(l, 50) {
		if (i + k < 18 || j + l < 18) { continue; }
		
		if (i == k && j == l) { ans += c[i][j] * (c[i][j] - 1); }
		else { ans += c[i][j] * c[k][l];
		//if (c[i][j] * c[k][l] != 0) { cout << i << j << k << l << endl; }
		}
	}

	ans /= 2;
	cout << ans << endl;


}


Measured memory_bytes: 4748
#include <stdio.h>

int main(){
  int i, j, a, b, f = -1;
  while(scanf("%d%d", &a, &b) && (a || b)){
    if(f != -1) puts("");
    f = 1;
    for(i = a;i <= b;i++){
      if(i % 4 == 0 && (i % 100 || i % 400 == 0)){
        printf("%d\n", i);
        f = 0;
      }
    }
    if(f) puts("NA");
  }
  return 0;
}

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

string str, ans;

int main( void ) {
    
    cin >> str;
    for( char ch : str ) {
        if( ch == 'B' ) {
            if( ans.length() > 0 )
                ans.pop_back();
        } else
            ans.push_back( ch );
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];


int main(){
  ll a;double b;cin>>a>>b;
  ll bb=round(b*100);
  ll ans=(a*bb)/100;
  cout<<ans<<endl;
}






Measured memory_bytes: 3752
from sys import stdin, stdout
from collections import defaultdict, deque

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()

def main():
	n, m = (int(x) for x in rll())
	H = deque((int(x) for x in rll()))
	H.appendleft(0)
	G = {i: [] for i in range(1, n+1)}	
	goodcnt = 0
	for _ in range(m):
		a, b = (int(x) for x in rll())
		G[a].append(b)
		G[b].append(a)
	for obs in range(1, n+1):
		good = True
		for nbhr in G[obs]:
			if H[nbhr] >= H[obs]:
				good = False
				break
		if good:
			goodcnt += 1
	stdout.write(str(goodcnt));stdout.write("\n")
	stdout.close()

if __name__ == "__main__":
	main()

Measured memory_bytes: 93088
#include<stdio.h>

typedef int S4;
typedef unsigned char U1;

#define FALSE (0)
#define TRUE  (1)

#define MAX_INPUT_VALUE (1000) /* ?????§??\?????? */

#define MAX_LINE_LENGTH	(1000) /* ???????????? */
#define MIN_LINE_LENGTH	(1)		

#define NUM_LINE		(3)

static S4 s4_s_isRightTriangle(S4*);

S4 main()
{
	U1 u1_t_isComplete;
	S4 s4_t_dataNum;
	S4 s4_t_i;
	S4 s4_t_lines[NUM_LINE];
	S4 s4_t_result;

	u1_t_isComplete = (U1)FALSE;

	/* ??\??? */
	(void)scanf("%d", &s4_t_dataNum);
	if (s4_t_dataNum <= (S4)MAX_INPUT_VALUE)
	{
		for (s4_t_i = (S4)0; s4_t_i < s4_t_dataNum; s4_t_i++)
		{
			(void)scanf("%d %d %d\n", &s4_t_lines[0], &s4_t_lines[1], &s4_t_lines[2]);

			s4_t_result = s4_s_isRightTriangle(s4_t_lines);
			
			/* ?????? */
			if (s4_t_result == (S4)TRUE)
			{
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
	}

	return ((S4)0);
}

/* ?????°???3???????????????????´????????????? */
/* ??????????????´?§?????§???¢??????TRUE???????????\??????FALSE */
static S4 s4_s_isRightTriangle(S4* s4_a_lines)
{
	S4 s4_t_i;
	S4 s4_t_longestLine;
	S4 s4_t_longestLineNum;
	S4 s4_t_sum;
	S4 s4_t_rtn;

	s4_t_rtn = (S4)FALSE;

	/* ?????????????????¢??? */
	s4_t_longestLine = s4_a_lines[0];
	s4_t_longestLineNum = (S4)0;
	for (s4_t_i = (S4)1; s4_t_i < (S4)NUM_LINE; s4_t_i++)
	{
		if (s4_t_longestLine < s4_a_lines[s4_t_i])
		{
			s4_t_longestLine = s4_a_lines[s4_t_i];
			s4_t_longestLineNum = s4_t_i;
		}
	}

	/* ??´?§?????§???¢????????¶????????????????????? */
	/* ???????????????2?????? */
	s4_t_longestLine = s4_t_longestLine * s4_t_longestLine;

	/* ??????????????\???????????????2?????? */
	s4_a_lines[s4_t_longestLineNum] = (S4)0;
	s4_t_sum = s4_a_lines[0] * s4_a_lines[0] + s4_a_lines[1] * s4_a_lines[1] + s4_a_lines[2] * s4_a_lines[2];

	if (s4_t_longestLine == s4_t_sum)
	{
		s4_t_rtn = (S4)TRUE;
	}

	return(s4_t_rtn);
}

Measured memory_bytes: 1752
#include<stdio.h>
int main(void)
{
	int n,i;
	scanf("%d",&n);
	if(n>100){
		n%=100;
		n%=10;
	}
	else if(n>10){
		n%=10;
	}
	if(n==3){
		printf("bon\n");
	}
	else if(n==0||n==1||n==6||n==8){
		printf("pon\n");
	}
	else{
		printf("hon\n");
	}
	return 0;
}

Measured memory_bytes: 1624
/*Hey, What's up?*/

#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector<long long>v;
int main()
{
    fastio;
    long long a=0,b=0,c,d,e,f=0,l,g,m,n,k,i,j,t,p,q;
    string s,ss,sa,st;
    cin>>s>>ss;
    n=s.size();
    m=ss.size();
    for(i=0; i<n; i++)
    {
        sa.push_back('z');
    }
    if(n<m)
    {
        cout<<"UNRESTORABLE\n";
        return 0;
    }
    f=0;
    for(i=0; i<=n-m; i++)
    {
        p=1;
        st=s;
        for(j=i,k=0; k<m; j++,k++)
        {
            if(s[j]==ss[k]||s[j]=='?')
            {
                st[j]=ss[k];
            }
            else
                p=0;
        }
        if(p)
        {
            f=1;
            for(j=0; j<n; j++)
            {
                if(st[j]=='?')
                    st[j]='a';
            }
            if(st<sa)
                sa=st;
        }
    }
    if(!f)
    {
        cout<<"UNRESTORABLE\n";
    }
    else
        cout<<sa<<'\n';
    return 0;
}


Measured memory_bytes: 256
using System;

public class Program
{
    public void Proc() {
        Reader.IsDebug = false;
        string inpt = Reader.ReadLine();
        string ans = "No";
        if(inpt != null && inpt.Length > 0) {
            int idx = inpt.IndexOf('C');
            if(idx >= 0 && inpt.LastIndexOf('F') >idx) {
                ans = "Yes";
            }
        }
        Console.WriteLine(ans);
    }

    public class Reader {
        public static bool IsDebug = true;

        private static string Input = @"

123

        ";

        private static System.IO.StringReader rd;
        public static string ReadLine() {
            if(!IsDebug) {
                return Console.ReadLine();
            }
            if(rd == null) {
                rd = new System.IO.StringReader(Input.Trim());
            }
            return rd.ReadLine();
        }
    }
    public static void Main(string[] args)
    {
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 2648