akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
 vector<int>nod[200001];
 vector<int>ans;

void dfs(int now,int p,int sum=0){
    ans[now]+=sum;
    for(int child:nod[now]){
        if(child==p)continue;
        dfs(child,now,ans[now]);
    }
}

int main(){
    int n,q;
    cin>>n>>q;
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        --a;
        --b;
        nod[a].push_back(b);
        nod[b].push_back(a);
    }
    ans.resize(n);
    rep(i,q){
        int p,x;
        cin>>p>>x;
        p--;
        ans[p]+=x;
    }
    dfs(0,-1);

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

Measured memory_bytes: 23424
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9 + 7;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("INP.txt", "r", stdin);
	//freopen("OUT.txt", "w", stdout);
	ll k, x;
	cin >> k >> x;
	for (ll i = x - k + 1; i < x; i++) {
		if (x >= -1000000 && x <= 1000000) {
			cout << i << ' ';
		}			
	}
	cout << x << ' ';
	for (ll i = x + 1; i <= x + k - 1; i++) {
		if (x >= -1000000 && x <= 1000000) {
			cout << i << ' ';
		}	
	}
	return 0;
}	

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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args&&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#define pi 3.141592653589
#define MOD 1000000007
#define to() int t; cin>>t; while(t--)
#define pb push_back
#define in insert
#define mp make_pair
#define ff first
#define ss second
#define si(s) s.size()
#define fori(it,v) for(it=v.begin();it!=v.end(); it++) 
#define for1(low,high,k) for(int i=low;i<high;i+=k)
#define for11(low,high,k) for(int j=low;j<high;j+=k)
#define for2(low,high,k) for(int i=low;i<=high;i+=k)
#define rev(high,low,k)  for(int i=high;i>=low ;i-=k)
#define all(x) x.begin(), x.end()
#define fil(x,i) memset(x,i,sizeof(x));
#define setbits(x) __builtin_popcount(x)
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout) 
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;


int main()
{
	boost;
	int n; cin>>n;
	vector<ll>v(n);
	for1(0,n,1) cin>>v[i];
	sort(all(v));
	int cnt=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			for(int k=j+1;k<n;k++){
				if(v[i]!=v[j] && v[j]!=v[k] && v[i]!=v[k]){
						if(v[i]+v[j]>v[k])
							cnt++;
				}
			}
		}
	}
	cout<<cnt<<endl;
		
return 0;
}


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

int main() {
    int N, K, p[10000];
    cin >> N >> K;
    for (int i = 0; i < N; ++i) cin >> p[i];
    sort(p, p + N);
    int sum = 0;
    for (int i = 0; i < K; ++i) sum += p[i];
    cout << sum;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
//#define int long long

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

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

// gcd: 最大公約数, lcm: 最小公倍数
template<typename T>
T euclidean(T a, T b){
    if(a < b) swap(a, b);
    T r = a % b;
    while(r != 0){
        a = b; b = r; r = a % b;
    }
    return b;
}
template<typename T>
T gcd(T a, T b){
    return euclidean(a, b);
}
template<typename T>
T lcm(T a, T b){
    T g = gcd(a, b);
    return a / g * b;
}

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

    int n;
    cin >> n;
    vector<LL> t(n);
    REP(i, n) cin >> t[i];
    
    LL ans = t[0];
    REP(i, n-1){
        ans = lcm(ans, t[i+1]);
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
const double pi = 3.141592653589793;
int main(){
    int x,y;
    cin>>x>>y;
    bool ans;
    if(y%2!=0){
        ans=false;
    }
    else{
        if(-x+(y/2)>=0 && 2*x-(y/2)>=0){
            ans=true;
        }
        else{
            ans=false;
        }
    }
    YN(ans);
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <stack>
#include <utility>
#include <cmath>
#include <cstdio>

using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;
LL MOD = 1000000007;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> dp(K+1, 0);
    vector<int>A(N, 0);
    for(int i=0; i<N; i++)
        cin >> A[i];
    //dp[0] = true;
    for(int j=0; j<=K; j++) {
        bool win = false;
        for(auto a: A) {
            if(j-a < 0) continue;
            if(!dp[j-a]) win = true;
        }
        dp[j] = win;
    }
    cout << (dp[K] ? "First" : "Second") << endl;

    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<vector<vector<int>>> v3int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef vector<vector<vector<ll>>> v3ll;
typedef list<int> liint;
typedef pair<int, int> pint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, int>> vpll_int;
typedef vector<pair<int, ll>> vpint_ll;
typedef set<pair<int, int>> spint;
typedef set<pair<ll, int>> spll;
typedef unordered_map<int, unordered_set<int>> Graph;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll N, X, M;

    cin >> N >> X >> M;

    //ll t = 1;
    set<ll> apear;
    vll ordered;
    ll modX = X;
    ll twice = -1;
    rep(i, N) {
        if (apear.count(modX) > 0) {
            twice = modX;
            break;
        }
        apear.insert(modX);
        ordered.push_back(modX);
        modX *= modX;
        modX %= M;
       // ans += modX;
        //cout << modX << endl;
        //t *= 2;
    }
    ll ans = 0;
    ll t = N;
    vll peri;
    rep(i, ordered.size()) {
        if (ordered[i] == twice) {
            REP(j, i, ordered.size()) {
                peri.push_back(ordered[j]);
            }
            break;
        }
        ans += ordered[i];
        t--;
    }
    if (twice != -1) {
        ll mul = t / peri.size();
        ll add = t % peri.size();
        rep(i, peri.size()) {
            ans += mul * peri[i];
            if (i < add) {
                ans += peri[i];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl ans(n);
  rep(i, n) {
    ll a;
    cin >> a;
    ans[a - 1] = i + 1;
  }
  rep(i, n) cout << ans[i] << '\n';
}

Measured memory_bytes: 3984
n = int(raw_input())
a = raw_input().split()

cnt = 0
for i in a:
    a[cnt] = int(i)
    cnt += 1

chk = {}
chk2 = {}
def make_divisors(k):
    divisors = []
    for i in range(1, int(k**0.5)+1):
        if k % i == 0:
            if i in chk:
                chk[i] += 1
            else:
                chk[i] = 1
            if i != k // i:
                key = int(k//i)
                if key in chk:
                    chk[key] += 1
                else:
                    chk[key] = 1
    return divisors

for i in range(2):
    make_divisors(a[i])
cnt = 1
for i in range(2,len(a)):
    k = a[i]
    if k not in chk2:
        chk2[k] = 1
    else:
        if chk2[k] == 1:
            chk2[k] += 1
        elif chk2[k] > 1:
            continue
    del_list = []
    for j in chk:
        if k % j == 0:
            chk[j] += 1
        if chk[j] < cnt+1:
            del_list.append(j)
    for j in del_list:
        del chk[j]
    cnt += 1

answer = 0
for i in chk:
    if int(chk[i]) >= chk[1] - 1 and i > answer:
        answer = i
print answer

Measured memory_bytes: 9360
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
int n,ans;
int main(void){
    cin>>n;
    while(n){
        if(n%10==2)ans++;
        n/=10;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
package main
import (
  "fmt"
  "os"
)
func main() {
  var n int
  var s string
  fmt.Scan(&n,&s)
  d := map[int]string{0:"S",1:"W"}
  if m,ok := check(n,s,0,0);ok {
    for i:=0;i<n;i++ { fmt.Print(d[m[i]]) }
    fmt.Println()
    os.Exit(0)
  }
  if m,ok := check(n,s,0,1);ok {
    for i:=0;i<n;i++ { fmt.Print(d[m[i]]) }
    fmt.Println()
    os.Exit(0)
  }
  if m,ok := check(n,s,1,0);ok {
    for i:=0;i<n;i++ { fmt.Print(d[m[i]]) }
    fmt.Println()
    os.Exit(0)
  }
  if m,ok := check(n,s,1,1);ok {
    for i:=0;i<n;i++ { fmt.Print(d[m[i]]) }
    fmt.Println()
    os.Exit(0)
  }
  fmt.Println(-1)
}
func check(n int,s string,m0 int,m1 int) ([]int,bool) {
  var m []int = make([]int,n)
  m[0],m[1] = m0,m1
  for i:=1;i<n-1;i++ {
    if (m[i] == 0) == (s[i:i+1] == "o") {
      m[i+1] = m[i-1]
    } else {
      m[i+1] = 1-m[i-1]
    }
  }
  if (m[n-1] == 0) == (s[n-1:n] == "o") {
    if m[0] != m[n-2] { return nil,false }
  } else {
    if m[0] != 1-m[n-2] { return nil,false }
  }
  if (m[0] == 0) == (s[0:1] == "o") {
    if m[1] != m[n-1] { return nil,false }
  } else {
    if m[1] != 1-m[n-1] { return nil,false }
  }
  return m,true
}

Measured memory_bytes: 5504
import * as fs from 'fs';

//in
// 2 5
// 1 WA
// 1 AC
// 2 WA
// 2 AC
// 2 WA
//out
// 2 2
// 一回もACならなかった問いのWAは0

const inp: string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n');
const [n, m] = inp[0].split(' ').map(Number);
inp.shift(); // 不要な引数を除く

const acList: any = {};
const waList: any = {};
let acTotal: number = 0;
let waTotal: number = 0;
for (let i: number = 0; i < m; i++) {
    const q: number = parseInt(inp[i].split(' ')[0]);
    if (q > n) continue;

    const status: string = inp[i].split(' ')[1];
    if (status === 'AC') {
        if (!acList[q]) {
            acList[q] = 1;
            acTotal++;

            // waCnt
            if (waList[q]) waTotal += waList[q];
        }
    } else if (status === 'WA') {
        if (acList[q]) continue;
        (!waList[q]) ? waList[q] = 1 : waList[q]++;
    }
}

//
console.log(`${acTotal} ${waTotal}`);


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

using namespace std;

typedef long long ll;

int main() {

  ll x, k, d;
  cin >> x >> k >> d;

  if(x<0) x = (-1)*x;

  ll n = x/d;
  ll ans = 0;

  if(n>=k) {
    ans = x-k*d;
  }else {
    ll m = k-n;
    if(m%2==0) ans = abs(x-n*d);
    else ans = abs(x%d-d);
  }

  cout << ans << endl;

  return 0;
}


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

namespace ABC067B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N, K;
            string[] vals = Console.ReadLine().Split(' ');

            N = int.Parse(vals[0]);
            K = int.Parse(vals[1]);

            int[] l = new int[N];
            vals = Console.ReadLine().Split(' ');
            for (int i = 0; i < N; i++)
                l[i] = int.Parse(vals[i]);

            Array.Sort(l, (a, b) => b - a);

            int ans = 0;
            for (int i = 0; i < K; i++)
                ans += l[i];

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13268
fun main(args: Array<String>) {
    val c = (0 until 3).map {
        readLine()!!.split(' ').map { it.toInt() }.toIntArray()
    }.toTypedArray()

    val a = IntArray(3)
    val b = c.first()
    a[1] = c[1][0] - b[0]
    a[2] = c[2][0] - b[0]

    for (i in 0 until 3) {
        for (j in 0 until 3) {
            if (c[i][j] != a[i] + b[j]) {
                println("No")
                return
            }
        }
    }

    println("Yes")
}


Measured memory_bytes: 38220
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

static const ll MOD = 1e9 + 7;
static const ll INF = (ll)1 << 62;

static const ll MAX_N = 100001;
static const ll MAX_M = 100001;

ll V;
ll d[MAX_N];
struct edge { ll to, cost; };
typedef pair<ll, ll> P;
vector<edge> G[MAX_N];
priority_queue <P, vector<P>, greater<P>> que;
void dijkstra(ll s) {
	fill(d, d + V, INF);
	d[s] = 0;

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

int main() {
	ll E, r; cin >> V >> E >> r;
	rep(i, 0, E) {
		ll s, t, d; cin >> s >> t >> d;
		G[s].push_back(*(new edge{ t,d }));
	}

	dijkstra(r);

	rep(i, 0, V) {
		if (d[i] == INF)cout << "INF" << endl;
		else cout << d[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 34952
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int N,M,K,L,A[200005],B[200005];
string str,str2;

int main() {
	
	cout << fixed << setprecision(18);
	cin>>str>>str2;
	cout<<str2+str<<endl;
	
} 

Measured memory_bytes: 256
ABC = list(map(int,input().split()))
ans = 0
ABC.sort()
if ABC[0] == ABC[1] == ABC[2]:
    ans = 0
elif ABC[0] != ABC[1] and ABC[1] != ABC[2]:
    sa = ABC[2] - ABC[1]
    ans += sa
    ABC[0] += sa
    ans += -(-(ABC[2] - ABC[0])//2)
    if (ABC[2] - ABC[0]) % 2 == 1:
        ans += 1
elif ABC[0] == ABC[1]:
    ans += ABC[2] - ABC[0]
elif ABC[1] == ABC[2]:
    ans += -(-(ABC[2]-ABC[0])//2)
    if (ABC[2] - ABC[0]) % 2 == 1:
        ans += 1
print(ans)


Measured memory_bytes: 3064
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Math;

namespace AtCoder
{
    public class Program
    {



        public static void Main(string[] args)
        {
            Dictionary<int, int> pairs = new Dictionary<int, int>();
            ReadInt();
            var a = ReadInts();
            foreach(var i in a)
            {
                if (!pairs.ContainsKey(i))
                {
                    pairs.Add(i, 1);

                }
                else {
                    pairs[i] += 1;
                }
            }

            var sum = 0;
            foreach(var i in pairs)
            {
                if (i.Value < i.Key)
                {
                    sum += i.Value;
                }
                else {
                    sum += -i.Key + i.Value;

                }

            }

            Write(sum);




         }

        private static void Read2Ints(out int a, out int b)
        {
            var temp = ReadInts();
            a = temp[0];
            b = temp[1];
        }
        private static void Read3Ints(out int a, out int b, out int c)
        {
            var temp = ReadInts();
            a = temp[0];
            b = temp[1];
            c = temp[2];
        }

        private static void Write(IEnumerable<string> target, string sep = " ") { Console.WriteLine(string.Join(sep, target)); }
        private static void Write(IEnumerable<double> target, string sep = " ") { Console.WriteLine(string.Join(sep, target)); }
        private static void Write(IEnumerable<long> target, string sep = " ") { Console.WriteLine(string.Join(sep, target)); }
        private static void Writeints(IEnumerable<int> target, string sep = " ") { Console.WriteLine(string.Join(sep, target)); }
        private static void Write<T>(T str) { Console.WriteLine(str); }
        private static string[] ReadStrings() { return Console.ReadLine().Split(' '); }
        private static int ReadInt() { return int.Parse(Console.ReadLine()); }
        private static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        private static int[] ReadInts() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        private static double[] ReadDoubles() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }

    }

}

Measured memory_bytes: 26460
N,T=map(int,input().split())
t = list(map(int,input().split()))

ans=0
for i in range(N):
  if i == 0:
    start = t[i]
    finish = t[i]+T
    continue
    
  if t[i]<finish:
    finish = t[i]+T
    continue
    
  else:
    ans += finish - start
    start = t[i]
    finish = t[i]+T
    
ans += finish - start

print(ans)

Measured memory_bytes: 30844
#include <iostream>
#define rep(k,i,n) for(int i=k;i<n;++i)
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin>>N;
    long B[N];
    long long ans=0;
    rep(0,i,N-1)cin>>B[i];
    ans+=B[0]+B[N-2];
    rep(0,i,N-2){
        ans+=min(B[i],B[i+1]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
struct multi {
  ll first;
  ll second;
  ll third;
};
bool multicomp(const multi &a, const multi &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll M = 0;
  vvl A(21);
  while (true) {
    ll N;
    cin >> N;
    if (N == 0)
      break;
    REP(i, N) {
      ll a = 0;
      cin >> a;
      A[M].push_back(a);
    }
    M++;
  }
  REP(i, M) {
    sort(ALL(A[i]));
    ll ans = 0;
    ll N = A[i].size();
    for (ll j = 1; j < N - 1; j++) {
      ans += A[i][j];
    }
    cout << ans / (N - 2) << endl;
  }
  return 0;
}



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

int main()
{
    int M, D;
    cin >> M >> D;

    int ans = 0;
    for (int m = 4; m <= M; m++)
    {
        for (int d = 22; d <= D; d++)
        {
            int d0 = d % 10;
            int d10 = d / 10;
            if (d0 >= 2 && d10 >= 2 && d0 * d10 == m)
            {
                ans++;
            }
        }
    }

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

Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define inf 1000000005
#define mod 1000000007
#define eps 1e-10
#define rep(i,n) for(int i = 0; i < (n); ++i) /*0からn-1までのrepeat*/
#define rrep(i,n) for(int i = 1; i <= (n); ++i) /*1からnまでのrepeat*/
#define drep(i,n) for(int i = (n)-1; i >= 0; --i) /*n-1から0までのrepeat*/
#define srep(i,s,t) for (int i = s; i < t; ++i) /*sからt-1までのrepeat*/
#define isin(x,l,r) ((l) <= (x) && (x) < (r)) /*l以上r未満のx*/
#define each(a,b) for(auto& (a): (b)) /*よくわからん*/
#define pct __builtin_popcountll /*1bitの数*/
#define all(a) a.begin(),a.end() /*範囲*/
#define sz(v) (int)(v).size() /*大きさ*/
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end()) /*重複削除*/
#define cmx(x,y) x=max(x,y) /*最大*/
#define cmn(x,y) x=min(x,y) /*最小*/
#define rev(v) reverse((v).begin(),(v).end()); /*逆順*/
#define so(v) sort((v).begin(), (v).end()); /*ソート*/
#define yn {puts("Yes");}else{puts("No");} /*はい・いいえ*/
#define dame { puts("-1"); return 0;}/*だめ*/
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using namespace std;

using ll = long long;
using unit = unsigned;
using ull = unsigned long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vp = vector<P>;
using vt = vector<T>;
using vs = vector<string>;

int main() {
    int a;
    cin >> a;
    cout << 180 * (a - 2) << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;
typedef long long ll;

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

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  bool taka;
  REP(i,1000){
    if(i%2==0){
      C-=B;
      if(C<=0){
        taka=true;
        break;
      }
    }else{
      A-=D;
      if(A<=0){
        taka=false;
        break;
      }
    }
  }
  cout<<(taka ? "Yes" : "No")<<endl;
}


Measured memory_bytes: 3624
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>

using namespace std;

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

    std::unordered_set<uint64_t> S;
    for (size_t i = 0; i < N; ++i) {
        uint64_t t;
        std::cin >> t;

        auto itr = S.find(t);
        if (itr != S.end()) {
            S.erase(itr);
        }
        else {
            S.insert(t);
        }
    }

    std::cout << S.size() << std::endl;

    return 0;
}


Measured memory_bytes: 4388
#include<algorithm>
#include<iostream>
#include<math.h>
#include<queue>
#include<stdio.h>
#include<stdlib.h>
#include<stack>
#include<string>
#include<vector>

#define ll long long
#define ull unsigned long long

using namespace std;
int main(void) {

	ll A[100001] = { 0 };
	ll N = 0,X = 0,Y = 0;

	scanf("%lld", &N);
	for (ll i = 0; i < N; i++)
		scanf("%lld", &A[i]);

	sort(A, A + N);

	for (ll i = N - 1; i >= 0; i--) {
		if (A[i] == A[i + 1] && X != 0) {
			Y = A[i];
			break;
		}
		if (A[i] == A[i + 1] && X == 0) {
			X = A[i];
			i--;
		}
	}

	printf("%lld\n", X * Y);

	return 0;
}



Measured memory_bytes: 1656
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<vector<ll> > mat;

ll a[100005],b[100005];

int main()
{ios_base::sync_with_stdio(false);
int n;
gl(n);
ll c=0;
rep(i,1,n)cin>>a[i]>>b[i];

ren(i,n,1)
{
	ll x=a[i]+c;
	ll y=x/b[i];
	if(x%b[i]!=0)y++;
	ll cnt=y*b[i]-a[i]-c;
	if(x==0)cnt==0;
	c+=cnt;
}
ol(c);
return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cctype>
#include <string>
using namespace std;
int main(void){
    
    string a,b,c,res;
    cin >> a >> b >> c;
    
    res += a[0];
    res += b[0];
    res += c[0];
    
    transform(res.begin(), res.end(), res.begin(), ::toupper);
    
    cout << res << endl;
    
    
}


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

int main(){
  string S;
  cin >> S;
  if(S.at(0)==S.at(1)&&S.at(2)==S.at(3)&&S.at(0)!=S.at(2)){
    cout << "Yes" << endl;
  }
  else if(S.at(0)==S.at(2)&&S.at(3)==S.at(1)&&S.at(2)!=S.at(3)){
    cout << "Yes" << endl;
  }
  else if(S.at(0)==S.at(3)&&S.at(2)==S.at(1)&&S.at(0)!=S.at(2)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3600
import kotlin.math.max

fun main() {
    val w = mutableListOf<Long>()
    val z = mutableListOf<Long>()
    val n = nextInt()
    repeat(n) {
        val (x, y) = nextLongList()
        w.add(x + y)
        z.add(x - y)
    }
    println(
        max(
            (w.max() ?: 0) - (w.min() ?: 0),
            (z.max() ?: 0) - (z.min() ?: 0)
        )
    )
}

// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)

// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }
inline fun <reified T> sized2DArray(row: Int, column: Int, default: T) = Array(row) { Array(column) { default } }

// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

fun gcd(x: Int, y: Int): Int {
    fun innerGcd(x: Int, y: Int): Int {
        return if (x % y == 0) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

fun gcd(x: Long, y: Long): Long {
    fun innerGcd(x: Long, y: Long): Long {
        return if (x % y == 0L) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

// classes
class UnionFindTree(val size: Int) {
    private val r = sizedArray(size, -1)
    fun root(x: Int): Int {
        if (r[x] < 0) return x
        return root(r[x])
    }

    fun unite(x: Int, y: Int) {
        var rx = root(x)
        var ry = root(y)
        if (rx == ry) return
        if (r[rx] > r[ry]) {
            rx = ry.also { ry = rx }
        }
        r[rx] += r[ry]
        r[ry] = rx
    }

    fun size(x: Int) = -r[root(x)]

    override fun toString(): String {
        return r.joinToString(separator = ", ")
    }
}

Measured memory_bytes: 73804
#include <iostream>
 
using namespace std;
 
int main(int argc, char const *argv[]) {
	unsigned int H, W, h, w;

	cin >> H >> W;
	cin >> h >> w;

	unsigned int sum = H *W;
	sum -= h * W;
	sum -= w * (H - h);
 
	cout << sum;
 
	return 0;
}

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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
typedef long long ll;

vector<string> split(const string &s, char delim) {
    vector<string> elems;
    stringstream ss(s);
    string item;
    while (getline(ss, item, delim)) {
    if (!item.empty()) {
            elems.push_back(item);
        }
    }
    return elems;
}

void solve() {
    string s;
    getline(cin,s);
    auto splited = split(s,' ');

    stack<int> stk;
    string opes = "+-*";
    for (const auto &it: splited) {
        if(it.size() == 1 && count(ALL(opes),it[0])) {
            int a = stk.top();
            stk.pop();
            int b = stk.top();
            stk.pop();

            char c = it[0];
            switch (c) {
                case '+':
                    stk.push(a+b);
                    break;
                case '-':
                    stk.push(b-a);
                    break;
                case '*':
                    stk.push(a*b);
                    break;
                default:
                    return;
            }
        }
        else stk.push(stoi(it));
    }
    cout << stk.top() << endl;
}

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


Measured memory_bytes: 3200
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
long n, m;
long a, b, c;
void solve() {
    cin >> n >> m;
    map<long,long> M;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        //カードに記載されている数値の出現回数をカウントする
        M[a]++;
    }
    for (int i = 0; i < m; ++i) {
        cin >> b >> c;
        //数値の書き換え回数を加算する
        //書き換え可能な箇所は全部書き換えた後の個数とする
        M[c] += b;
    }
    long long ans = 0;
    //書き換えた後の数列を末尾から加算
    //数値の最大値からn文字分加算が終わるか、先頭(最小値)までチェックすると終了
    for (auto i = M.end(); ; --i) {
        if (i == M.end())--i;
        ans += min(n, i->second) * i->first;
        n -= i->second;
        if (n <= 0) break;
        if (i == M.begin()) break;
    }
    cout << ans << endl;
    return;
}
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
int main(int args, char* argv[]) {
    solve();
}

Measured memory_bytes: 12800
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9


int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int ans = c - (a - b);
	if (ans < 0)ans = 0;
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
M=41
B=[[0 for x in range(M-len(bin(A[i])[2:]))]+list([int(x) for x in bin(A[i])[2:]]) for i in range(N)]
C=[[0,0] for i in range(M)]
for i in range(N):
    for j in range(M):
        C[j][B[i][j]]+=1
D=[-1 for i in range(M)]
for j in range(M):
    if C[j][0]<=C[j][1]:
        D[j]=0
    else:
        D[j]=1
E=[2**(M-i-1) for i in range(M)]
tmp=0
for i in range(M):
    if tmp+E[i]*D[i]<=K:
        tmp+=E[i]*D[i]
ans=0
for i in range(N):
    ans+=tmp^A[i]
print(ans)


Measured memory_bytes: 123236
package main

import (
  "fmt"
)

var ans = [1e5]int{}
func main() {
  var s []byte
  fmt.Scan(&s)
  var n,p int
  last := 'R'
  ans := make([]int, len(s))
  for i := range s {
    if last == 'R' && s[i] == 'L' {
      ans[i-1] += (n+1)/2 
      ans[i] += n/2
      p = i
      n=0
    } else if last == 'L' && s[i] == 'R' {
      ans[p-1] += n/2
      ans[p] += (n+1)/2
      n=0
    }
    n++
    last = rune(s[i])
    
    if i == len(s)-1 && last == 'L' {
      ans[p-1] += n/2
      ans[p] += (n+1)/2
    }    
  }
  for i := 0; i < len(s); i++ {
    fmt.Printf("%d ", ans[i])
  }
}
  
  
  
  
  
  
  






Measured memory_bytes: 4304
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;
void solve();
main(){
    ios_base::sync_with_stdio(false);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}
vector<int>g[100001];
vector<bool>used(100001, false);
int ans = 0;
void go(int v){
    used[v] = true;
    for(auto i: g[v]){
        if(!used[i]){
            go(i);
        }
    }
}
void solve(){
    int n, m, x, y;
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    for(int i = 1; i <= n; i++){
        if(!used[i]){
            ans ++;
            go(i);
        }
    }
    cout << ans - 1 << endl;
}


Measured memory_bytes: 10332
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;cin>>S;int i;
  for(i=0;i<S.size();i++){
    if((i%2==1&&S.at(i)=='R')||(i%2==0&&S.at(i)=='L'))break;
  }
  if(i==S.size())cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		long k=sc.nextLong();
		if(s.length()==1) {
			System.out.println(k/2);

			return;
		}

		char a=s.charAt(0);
		Boolean kaeta[]=new Boolean[s.length()];
		long cnt=0;
		kaeta[0]=false;
		int first=1;
		Boolean tmp=true;
		for(int i=1;i<s.length();i++) {
			char b=s.charAt(i);
			if(b==a&&!kaeta[i-1]) {
				cnt++;
				kaeta[i]=true;
			}else {
				kaeta[i]=false;
			}
			if(b==a&&first==i) {
				//tmp=false;
				first++;
			}else {
				tmp=false;
			}
			a=b;
		}
		int last=1;
			char l=s.charAt(s.length()-1);
			//System.out.println(l);
			for(int i=s.length()-2;i>=0;i--) {
				char r=s.charAt(i);
				//System.out.println(r);
				if(r==l) {
					last++;
				}else {
					break;
				}
			}
		//System.out.println(first+" "+last);
		//System.out.println(cnt);
		if(a==s.charAt(0)&&!kaeta[s.length()-1]&&tmp) {

			if(k%2==0) {
				cnt=cnt*2+1;
				System.out.println(cnt*k/2);

			}else {
				//System.out.println(cnt+" "+k);
				System.out.println((cnt*2+1)*(k/2)+cnt);
			}
			return;

		}
		if(a==s.charAt(0)&&!kaeta[s.length()-1]&&!tmp&&(first+last)%2==0) {

			if(k==1) {
				System.out.println(cnt);
			}else {
				//System.out.println();
				System.out.println((cnt+1)*k-1);
			}
			return;

		}

		cnt*=k;

		System.out.println(cnt);
	}
}


Measured memory_bytes: 21332
import sys

def isleft(ox, oy, ax, ay, px, py):
    oax, oay = ax - ox, ay - oy
    opx, opy = px - ox, py - oy
    if oax * opy > oay * opx:
        return 1
    else:
        return 0

for line in sys.stdin:
    x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
#    A, B, C, P = (x1, y1), (x2, y2), (x3, y3), (xp, yp)
#    if isleft(*A, *B, *P) == isleft(*B, *C, *P) == isleft(*C, *A, *P):
    if isleft(x1, y1, x2, y2, xp, yp) == isleft(x2, y2, x3, y3, xp, yp) == isleft(x3, y3, x1, y1, xp, yp):
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 7424
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n=II()
    a,b=MI()
    pp=MI()
    cnt=[0]*3
    for p in pp:
        if p>b:cnt[0]+=1
        elif p>a:cnt[1]+=1
        else:cnt[2]+=1
    print(min(cnt))

main()

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

using namespace std;
using int64 = long long int;

constexpr int MaxN = 100000 + 10;
int64 A[MaxN];
int64 D[MaxN];
int64 D2[MaxN];

int64 Gcd(int64 a, int64 b)
{
    while (b != 0)
    {
        int64 next = a % b;
        a = b;
        b = next;
    }

    return a;
}

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

    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }

    D[0] = A[0];
    for (int i = 1; i < n; i++)
    {
        D[i] = Gcd(D[i - 1], A[i]);
    }

    D2[n - 1] = A[n - 1];
    for (int i = n - 2; i >= 0; i--)
    {
        D2[i] = Gcd(D2[i + 1], A[i]);
    }

    int64 ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (i == 0)
        {
            ans = max(ans, D2[i + 1]);
        }
        else if (i == n - 1)
        {
            ans = max(ans, D[i - 1]);
        }
        else
        {
            ans = max(ans, Gcd(D[i - 1], D2[i + 1]));
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#define MAGIC cin.tie(NULL); ios_base::sync_with_stdio(false)
#define endl '\n'
//#define ll long long
#define mod (1000000007)
//#define NCONS 100001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
//#define MCONS 2001
//#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
#define int long long
//#define double long double
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
typedef long long ll;

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

#define YYYY cout << "YES" << endl
#define NNNN cout << "NO" << endl
#define yyyy cout << "Yes" << endl
#define nnnn cout << "No" << endl
int dx[]{0, 1, 0, -1};
int dy[]{1, 0, -1, 0};

const int NCONS = 100001;
//const int MCONS = 101;


int n, k, q;

int player_wins[NCONS];

int32_t main()
{
    MAGIC;
    cin >> n >> k >> q;
    for(int i = 0; i < q; i++)
    {
        int a; cin >> a; player_wins[a] += 1;
    }
    
    for(int i = 1; i <= n; i++)
    {
        if(k - (q - player_wins[i]) > 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    
    
   
    return 0;
}



Measured memory_bytes: 1408
S = list(input()) #１文字ずつ
N = len(S)
al=[chr(ord('a') + i) for i in range(26)]
# print('al:',al)
 
flag=0
if S[0]!='A':
    #print('A')
    flag=1
 
else:
    count=0
    for i in range(2,N-1):
        if S[i]=='C':
            count+=1
 
    # print('count:',count)
    if count==1:
        for i in range(N):
            if S[i]!='A' and S[i]!='C':
                if S[i] not in al:
                    flag=1
 
    else:
        flag=1
 
if flag==0:
    print('AC')
else:
    print('WA')

Measured memory_bytes: 61924
import java.util.*;

public class Main {

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        int len = s.length();
        String x = "";
        for(int i = 0 ; i < len ; i++){
            x += "x";
        }

        System.out.println(x);
    }

}

Measured memory_bytes: 21844
#define _USE_MATH_DEFINES

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string,getline
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap, pair
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt,ceil,M_PI, pow, sin
#include <sstream>	//stringstream,getline
#include <numeric>	//gcd, accumlate
#include <deque>	//deque

using namespace std;

int main() {

	bool x;
	cin >> x;

	cout << !x << endl;

	return 0;

}

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

class Program
{
    public static void Main()
    {
        String[] input = Console.ReadLine().Split();
        long n = long.Parse(input[0]);
        long a = long.Parse(input[1]);
        long b = long.Parse(input[2]);
        long mod = 1000000007;
        long ans = Mpow(2, n, mod);
        ans = ans + mod - Ncr(n, a, mod) + mod - Ncr(n, b, mod) - 1 + mod;
        ans %= mod;
        Console.WriteLine(ans);
    }
    public static long Mpow(long x, long n, long m)
    {
        long ans = 1;
        while (n > 0)
        {
            if (n % 2 == 1)
            {
                ans = ans * x % m;
                n -= 1;
            }
            x = x * x % m;
            n /= 2;
        }
        return ans;
    }
    public static long Ncr(long n, long r, long m)
    {
        long ans = 1;
        for (long i = n - r + 1; i <= n; i++)
        {
            ans = ans * i % m;
        }
        for (long i = 2; i <= r; i++)
        {
            ans = ans * Mpow(i, m - 2, m) % m;
        }
        return ans;
    }
}

Measured memory_bytes: 13140
n,m = map(int,input().split())
c = list(map(int,input().split()))
i = 0
dp = [0] * 50001
for i in range(50001):
    dp[i] = i
#金額ごとに最小枚数を出す
for i in range(2,n+1):
    for j in range(m):
        if i - c[j] >= 0:
            dp[i] = min(dp[i], dp[i - c[j]] + 1)

print(dp[n])


Measured memory_bytes: 7524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define pf push_front
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 

int main() {
	string s;
	cin >> s;
	bool ok = true;
	forn(i, sz(s)) {
		if((i+1)%2!=0 && s[i]=='L') {
			ok = false;
			break;
		} 
		if((i+1)%2==0 && s[i] == 'R') {
			ok = false;
			break;
		}
	}
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 3632
n = int(input())
b = 0
ans = True
for _ in range(n):
    p, x = input().split()
    x = int(x)

    if p == "(":
        b += x
    else:
        b -= x
        if b < 0:
            ans = False

if ans:
    if b == 0:
        print("YES")
    else:
        print("NO")
else:
    print("NO")


Measured memory_bytes: 5608