akhauriyash/Code-Regression huggingface dataset:
using System;

namespace AtCoderDiverta2009D
{
    class Program
    {
        static void Main(string[] args)
        {
            long ans = 0;
            long N = long.Parse(Console.ReadLine());

            for(long a = 1; a * (a + 1) < N ; a++)
            {
                if ((N - a) % a == 0)
                {
                    ans += (N - a) / a;
                }
            }

            Console.WriteLine(ans.ToString());
        }

    }

}


Measured memory_bytes: 13140
n,k,q = list(map(int,input().split()))
ans = [0] * n
data = [k] * n
data2 = [0] * n
for i in range(q):
  tmp = int(input())
  data2[tmp-1] += 1

for i in range(n):
  ans[i] = data2[i] + data[i] - q

for i in range(n):
  if ans[i] >0 :
    print("Yes")
  else:
    print("No")

  

Measured memory_bytes: 9420
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>

//#include<bits/stdc++.h>




using namespace std;
int main() {
	
	int a, b, c;
	cin >> a >> b >> c;
	if (a <= c&&a + b >= c)cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second

int32_t main(){
	ios::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	int a[n];
	vector <int> vec[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < k; i++){
		int u, v;
		cin >> u >> v;
		u--, v--;
		vec[u].push_back(v);
		vec[v].push_back(u);
	}
	int ans = 0;
	for (int i = 0; i < n; i++){
		bool f = true;
		for (int j = 0; j < vec[i].size(); j++){
			if (a[vec[i][j]] >= a[i])
				f = false;
		}
		if (f)
			ans ++;
	}
	cout << ans;
}


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

using namespace std;
typedef long long ll;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  int x, y;
  cin >> x >> y;

  vector<int> xlist ,ylist;
  bool is_x = true;
  int buf = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'T') {
      if (is_x) {
        xlist.push_back(buf);
      } else {
        ylist.push_back(buf);
      }
      is_x = !is_x;
      buf = 0;
    } else {
      buf++;
    }
  }
  if (buf) {
    if (is_x) {
      xlist.push_back(buf);
    } else {
      ylist.push_back(buf);
    }
  }

  vector<vector<bool> > dpx(xlist.size() + 1, vector<bool>(s.size() * 2 + 1, false));
  dpx[1][s.size() + xlist[0]] = true;
  for (int i = 1; i < xlist.size(); i++) {
    for (int j = 0; j <= 2 * s.size(); j++) {
        if(dpx[i][j]) {
          dpx[i + 1][j + xlist[i]] = true;
          dpx[i + 1][j - xlist[i]] = true;
        }
    }
  }

  vector<vector<bool> > dpy(ylist.size() + 1, vector<bool>(s.size() * 2 + 1, false));
  dpy[0][s.size()] = true;
  for (int i = 0; i < ylist.size(); i++) {
    for (int j = 0; j <= 2 * s.size(); j++) {
      if(dpy[i][j]) {
        dpy[i + 1][j + ylist[i]] = true;
        dpy[i + 1][j - ylist[i]] = true;
      }
    }
  }

  if (dpx[xlist.size()][s.size() + x] && dpy[ylist.size()][s.size() + y]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

int n,m;
int pre[200050];
int b[200050] = {0};

void init()
{
	for(int i = 0;i<=200050;++i)
	    pre[i] = i;
}

int find(int x)
{
	if(x == pre[x]) return x;
	int root = find(pre[x]);//压缩路径 
	return pre[x] = root;
}

void join(int x,int y)
{
	int fx = find(x),fy = find(y);
	
	if(fx != fy){
		pre[fx] = fy;
	}
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    init();
	int n,m;
	cin>>n>>m;
	for(int i = 1;i<=m;++i){
		int x,y;
		cin>>x>>y;
		join(x,y);
		
//		for(int i = 1;i<=n;++i){
//			cout<<pre[i]<<" ";
//		}
//		cout<<endl;
	}
	for(int i = 1;i<=n;++i){
		b[find(i)]++;
	}
	int maxn = 0;
	for(int i = 1;i<=n;++i)
	    if(b[i]>maxn) maxn = b[i];
	    
	cout<<maxn<<endl;
	return 0;
}

Measured memory_bytes: 10596
#include<iostream>
#include<cstdio>

using namespace std;

int main(){
	
	int th, ts;
	cin >> th >> ts;

	int ah, as;
	cin >> ah >> as;

	int twin = 1;

	while(th > 0 && ah > 0){
		ah = ah - ts;
		th = th - as;

		if(th <= 0)
			twin = 0;
		if (ah <= 0)
			twin = 1;
	}

	if(twin == 0)
		printf("No");	
	else
		printf("Yes");

}


Measured memory_bytes: 3684
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    int l;
    cin >> n >> l;
    vll a(n);
    int o=0;
    REP(i,n){
        a[i]=l+i;
        o+=a[i];
    }
    int ans = -10000000;
    REP(i,n){
        int tmp = o-a[i];
        if(abs(o-tmp)<abs(o-ans)){
            ans = tmp;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A = list(iss())
    B = list(iss())
    A.sort()
    B.sort(reverse=True)
    print('Yes' if ''.join(A) < ''.join(B) else 'No')


if __name__ == '__main__':
    main()


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

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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

// Library
//

bool check(const char key) {
    bool ret = false;
    switch (key) {
        case 'A':
            ret = true;
            break;
        case 'C':
            ret = true;
            break;
        case 'G':
            ret = true;
            break;
        case 'T':
            ret = true;
            break;
        default:
            break;
    }
    return ret;
}


int main() {
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif

    string s; cin >> s;
    s += "!";
    int ans = 0;
    int tmp = 0;
    bool flag = false;
    for(int i = 0; i < s.size(); ++i){
        if(flag){
            if(check(s[i])){
                ++tmp;
            }
            else{
                ans = max(ans, tmp);
                flag = false;
                tmp = 0;
            }
        }
        else{
            if(check(s[i])){
                ++tmp;
                flag = true;
            }
        }
    }

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


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

typedef long long ll;
typedef pair<int, int> P;

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

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

int main() {
  int b, c;
  int a[5];
  while(cin >> b >> c) {
    if(!b && !c) return 0;
    a[0] = b + c;
    int m = a[0];
    rep(i, 0, 4) cin >> b >> c, a[i + 1] = b + c, m = max(m, a[i + 1]);
    rep(i, 0, 5) if(a[i] == m) cout << (char)('A' + i) << " " << m << endl;
  }
}

Measured memory_bytes: 3120
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int d = sc.nextInt();
      int x = sc.nextInt();
      int[] a = new int[n];
      for(int i = 0;i<n;i++)a[i] = sc.nextInt();
      int[] count = new int[n];
      int sum = 0;
      d--;
      int d0 = d;
      for(int i = 0;i < n;i++){
      	while(d>=0){
      		count[i]++;
        	d -= a[i];
      	}
        sum += count[i];
        d = d0;
      }
      System.out.println(sum+x);
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

// dist[v] に頂点 s から頂点 v への距離を入れる関数
void dijkstra(int s, Graph &G, vector<ll> &dist){
  fill(all(dist), INF);
  dist[s] = 0;

  priority_queue<P, vector<P>, greater<P>> pq;//距離が小さい順に取り出す
  pq.push(P(0,s)); // 頂点 s からスタート

  while (!pq.empty()) {
    P p = pq.top(); pq.pop();
    int v = p.second;
    if(dist[v] < p.first) continue;// 既に v に辿り着く短い経路有ならスルー (これはただの高速化)

    for(auto e : G[v]){// v から行ける頂点 nv 達を走査
      int nv = e.to;
      ll w = e.weight;
      if(dist[nv] > dist[v] + w){
        dist[nv] = dist[v] + w;
        pq.push(P(dist[nv], nv));
      }
    }
  }
}

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};



int main(){
  string s; cin >> s;
  ll n = sz(s);

  map<char,ll> C;
  rep(i,n) C[s[i]]++;

  ll ans = n*(n-1)/2;
  for(auto c : C) {
    ll num = c.second;
    ans -= num*(num-1)/2;
  }

  cout << ans+1 << endl;

}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//-----CODE------//
void solve(void)
{
  int N,K;
  cin>>N>>K;
  int ANS = 0;
  for (int i = 0; i < N; i++)
  {
    int X;cin>>X;
    ANS += min(abs(X),abs(K-X));
  }
  cout<<ANS*2<<endl;
  
  

  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<set>
#include<stack>
#include<queue>
using namespace std;

int main()
{
int n,x,t;
scanf("%d %d %d",&n,&x,&t);
int ans;
ans=n/x;
if(n%x!=0){ans++;}
ans=ans*t;
printf("%d",ans);
}


Measured memory_bytes: 3812
#include<stdio.h>

int main() {
   int a,b,c,d,e,k;
   scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&k);
   if(e-a <= k) {
      printf("Yay!\n");
   } else {
      printf(":(\n");
   }
}


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

int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    int n;
    cin >> n;
    
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    
    int cnt = 0;
    
    for(int i = 0; i < n; i++){
        while(a[i]%2==0){
            a[i]/=2;
            cnt++;
        }
    }
    cout << cnt << endl;
}




Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class Main {
  public static void main(String[] args){
    FastScanner sc = new FastScanner();

    int N = sc.nextInt();
    int flag = -1;

    for(int i = 1; i < 10; i++){
      for(int j = 1; j < 10; j++){
        if(N == i*j){
          flag = 1; break;
        }
      }
    }

    if(flag == -1){
      System.out.println("No");
    }else{
      System.out.println("Yes");
    }

  }

  public static class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner(String s) {
      try {
        br = new BufferedReader(new FileReader(s));
      } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }

    public FastScanner() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    String nextToken() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(nextToken());
    }

    long nextLong() {
      return Long.parseLong(nextToken());
    }

    double nextDouble() {
      return Double.parseDouble(nextToken());
    }
  }
}


Measured memory_bytes: 21204
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=200010;
bool w[N];
int a[N],L[N],R[N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
inline int find(int *fa,int x) {
    return fa[x]==x?x:fa[x]=find(fa,fa[x]);
}
int main() {
    int n;
    long long ans=0;
    cin>>n;
    for(int i=1;i<=n;i++)
	a[gi()]=i,L[i]=R[i]=i;
    for(int i=n;i;i--) {
	int x=a[i];
	w[x]=1;
	if(w[x-1]) R[x-1]=x,L[x]=x-1;
	if(w[x+1]) R[x]=x+1,L[x+1]=x;
	int l=find(L,x),r=find(R,x);
	ans+=1LL*(x-l+1)*(r-x+1)*i;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

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

using namespace std;
char fi[128][128];
bool ch[2][128][128];
int cost[2][128][128];
// lr,x+10,y+10;
int main(void)
{
  for(;;){
    REP(j,128) REP(i,128) fi[i][j]='X';
    REP(k,2) REP(j,128) REP(i,128) cost[k][i][j]=1048576;
    REP(k,2) REP(j,128) REP(i,128) ch[k][i][j]=false;
    int w,h;
    cin >> w >> h;
    if(!w) return 0;
    REP(I,h) REP(J,w){
      int i=I+10,j=J+10;
      string tmp;
      cin >> tmp;
      fi[i][j]=tmp[0];
    }
    REP(I,h) REP(J,w){
      int i=I+10,j=J+10;
      if(fi[i][j]=='S') REP(k,2){
	  cost[k][i][j]=0;
	  ch[k][i][j]=true;
	}
    }
    bool flag=true;
    while(flag){
      flag=false;
      REP(k,2) REP(I,h) REP(J,w){
	int i=I+10,j=J+10;
	if(!ch[k][i][j]) continue;
	ch[k][i][j]=false;
	FOR(ve,-2,3){
	  FOR(ho,1,4-abs(ve)){
	    int nk=1-k,ni=i+ve,nj=j+ho*(1-2*k);
	    int nextcost=cost[k][i][j];
	    if(fi[ni][nj]=='X') continue;
	    else if(fi[ni][nj]=='S') continue;
	    else if(fi[ni][nj]!='T') nextcost+=fi[ni][nj]-'0';
	    if(nextcost < cost[nk][ni][nj]){
	      //cout << nk << ' ' << ni << ' ' << nj << ' ' << nextcost << endl;
	      cost[nk][ni][nj]=nextcost;
	      ch[nk][ni][nj]=true;
	      flag=true;
	    }
	  }
	}
      }
    }
    int answer=1048576;
    REP(k,2) REP(I,h) REP(J,w){
      int i=I+10,j=J+10;
      if(fi[i][j]=='T') answer=min(answer,cost[k][i][j]);
    }
    if(answer<1048576) cout << answer << endl;
    else cout << -1 << endl;
  }
}

Measured memory_bytes: 3212
package main

import (
	"fmt"
	"os"
	"strconv"
	"bufio"
	"strings"
)

// define
var (
	sc = bufio.NewScanner(os.Stdin)
)

func scanIntLine(len int) []int{
	arr := make([]int, len)
	for i:=0; i<len; i++{
		sc.Scan()
		tmp, err := strconv.Atoi(sc.Text())
		if err == nil{
			arr[i] = tmp
		}
	}
	return arr
}

func scanStringLine(len int) []string{
	arr := make([]string, len)
	for i:=0; i<len; i++{
		sc.Scan()
		arr[i] = sc.Text()
	}
	return arr
}

func scanIntSplit(len int) []int{
	arr := make([]int, len)
	sc.Scan()
	for i, v := range strings.Split(sc.Text(), " "){
		tmp, err := strconv.Atoi(v)
		if err == nil{
			arr[i] = tmp
		}
	}
	return arr
}

func main(){
	abcd := scanIntSplit(4)
	A, B, C, D := abcd[0], abcd[1], abcd[2], abcd[3]
	if C <= A{
		if D <= A {
			fmt.Println(0)
		} else if D <= B {
			fmt.Println(D-A)
		} else {
			fmt.Println(B-A)
		}
	} else if C <= B {
		if D <= B {
			fmt.Println(D-C)
		} else {
			fmt.Println(B-C)
		}
	} else {
		fmt.Println(0)
	}
}

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

using namespace std;

int main() {
  string s,t;;
  cin >> s >> t;
  int c = 0;
  for (int i=0; i<s.size(); i++) {
    if (s[i]!=t[i]) {
      c++;
    }
  }
  cout << c << endl;
}

Measured memory_bytes: 3916
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;
int main(){
	int n; cin >>n;
	vector<int> a(n),b(n);
	cinf(n,a); cinf(n,b);
	vector<int> left(n+1),right(n+1);
	left[0]=0;right[0]=0;
	for(int i=1;i<=n;i++){
		left[i]=left[i-1]+a[i-1];
	}
	for(int i=1;i<=n;i++){
		right[i]=right[i-1]+b[n-i];
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		ans=max(ans,left[i]+right[n+1-i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<stdio.h>
using namespace std;



void solve() {

	
	long long N,K;
	long long *A;

	cin >>N>>K;
	A = new long long[N];
	
	for (int i = 0;i < N;i++)cin >> A[i];
	sort(A,A+N);
	

	if (K >= N) {
		cout << 0 << endl;
	}
	else {
		long long sum = 0;
		for (int i = N - 1 - K;i >= 0;i--)sum += A[i];
		cout << sum << endl;
	}

	

}



int main() {
	solve();

}

Measured memory_bytes: 1792
import copy
def bubbleSort(A, N):
    cnt = 0
    flag = 1
    while flag:
        flag = 0
        for j in range(N - 1, 0, -1):
            if A[j][1] < A[j - 1][1]:
                A[j], A[j - 1] = A[j - 1], A[j]
                flag = 1
                cnt = cnt + 1
    return cnt
 
 
def selectionSort(A, N):
    cnt = 0
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[j][1] < A[minj][1]:
                minj = j
        cnt = cnt + int(i != minj)
        A[i], A[minj] = A[minj], A[i]
    return cnt
 
def prArr(A, N):
    for i in range(N):
        if i != 0:
            print(" ", end = "")
        print(A[i], end = "")
    print()
 
     
N = int(input())
A = [i for i in input().split()]
B = copy.deepcopy(A)
 
bubbleSort(A, N)
selectionSort(B, N)
 
prArr(A, N)
print("Stable")
 
prArr(B, N)
print("Stable" if A == B else "Not stable")


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

int main() {
	// your code goes here
	long long int n;
	cin>>n;
	long long int arr[n],i;
	double s;
	for(i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	sort(arr,arr+n);
	//s=(arr[0]+arr[1])/2;
	s=(double)arr[0];
	for(i=0;i<n;i++)
	{
		s=(double)(s+arr[i])/2;
	}
	cout<<s<<endl;
	return 0;
}

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

using namespace std;

using i64 = long long;
#define forn(a, e) for (i64 a = 0; a < (i64)(e); a++)
#define forr(a, s, e) for (i64 a = s; a < (i64)(e); a++)
#define fore(e, a) for (auto& e : a)

#ifdef LOCAL
#define logv(a) {cerr << #a << " = "; fore(e, a) {cerr << e << " ";} cerr << "\n";}
#define logvp(a) {cerr << #a << " = "; fore(e, a) {cerr << "(" << e.first << ", " << e.second << ") ";} cerr << "\n";}
#define logvv(a) {cerr << #a << " = \n"; fore(r, a) { fore(e, r) {cerr << e << " ";} cerr << "\n";} }
#define logvf(a, field) {cerr << #a"."#field << " = \n"; fore(e, a) { cerr << e.field << " ";} cerr << "\n"; }
#define logvff(a, f1, f2) {cerr << #a".{"#f1 << ", "#f2 << "} = \n"; fore(e, a) { cerr << "(" << e.f1 <<", " << e.f2 << ") ";} cerr << "\n"; }
#define logs(a) cerr << #a << " = " << (a) << "\n";
#define logss(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << "\n";
#define logp(a) cerr << #a << " = " << "(" << a.first << ", " << a.second << ")" << "\n";
#define cond(pred, stmt) if (pred) { stmt }
#else
#define logv(a)
#define logvp(a)
#define logvv(a)
#define logvf(a, field)
#define logvff(a, f1, f2)
#define logs(a)
#define logss(a, b)
#define logp(a)
#define cond(pred, stmt)
#endif

using iip = pair<int, int>;
using llp = pair<i64, i64>;
using ivec = vector<int>;
using llvec = vector<i64>;
using svec = vector<string>;
template<typename T> using vec = vector<T>;

template<typename T, typename Dim>
auto make_vec(T value, Dim dim) { return vector<T>(dim, value); }
template<typename T, typename Dim1, typename... Dim>
auto make_vec(T value, Dim1 dim1, Dim... dims) { return make_vec(make_vec(value, dims...), dim1); }

template<typename T>
bool uax(T& v, const T& newv) { if (v < newv) { v = newv; return true; } else return false; }
template<typename T>
bool uin(T& v, const T& newv) { if (v > newv) { v = newv; return true; } else return false; }

template<typename T>
istream& operator>>(istream& is, vector<T>& c) { for (auto& e : c) is >> e; return is; }
template<typename T, size_t N>
istream& operator>>(istream& is, array<T, N>& c) { for (auto& e : c) is >> e; return is; }

template<typename ...T>
istream& read(T&... args) { return (cin >> ... >> args); }

static mt19937 rande(123123);
template<typename T>
T rand_int(T from, T to) { uniform_int_distribution<T> distr(from, to); return distr(rande); }

const i64 INF = 1e18;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    rande.seed(chrono::steady_clock::now().time_since_epoch().count());

    int n;
    while (read(n)) {
        llvec a(n);
        read(a);

        llvec cl(n);
        cl[0] = -1;
        llvec dp(n);
        forr(i, 1, n) {
            int p = i - 1;
            while (p != -1 && a[p] >= a[i]) {
                p = cl[p];
            }
            cl[i] = p;
        }

        i64 ans = 0;
        forn(i, n) {
            dp[i] = a[i] * (i - cl[i]);
            if (cl[i] != -1) {
                dp[i] += dp[cl[i]];
            }
            ans += dp[i];
        }

        cout << ans << endl;
    }
}

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

int main() {
  int64_t n;
  cin>>n;
  vector<int64_t> a(n);
  vector<int64_t> b(n-1);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  int x=a.at(n-1);
  for(int i=0;i<n-1;i++){
    b.at(i)=abs(x/2-a.at(i));
  }
  int64_t c=b.at(0);
  int count=0;
  for(int i=0;i<n-1;i++){
    if(b.at(i)<=c){
      count=i;
      c=b.at(i);
    }
  }
  int64_t y=a.at(count);
  cout<<x<<" "<<y<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
#define Max 1000001
#define inf INT_MAX
#define llinf LONG_LONG_MAX
#define rep(i,a,b) for(i=a;i<=b;i++)
#define rrep(i,a,b) for(i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pb push_back
#define pf push_front
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define PI 3.14159265358979311599796346854418516159057617187500
#define endl '\n'
const ll N=51,mod=1000000007;
signed main()
{
    fast;
    ll pro=1,temp,t,m,n,k,i,j,l,r,mid,x,y,z,rem,carry=0,ind,ans=0,mx=-llinf,mn=llinf,cnt=0,curr=0,prev,sum=0,flag=1,i1=-1,i2=-1;
	cin>>k>>x;
	for(i=max(-1000000ll,x-(k-1));i<=min(1000000ll,x+k-1);i++)
	{
		cout<<i<<' ';
	}
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
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; }
int64_t gcd(int64_t a, int64_t b) {
    if (b > a) {
        int64_t c = a;
        a = b;
        b = c;
    }

    if (a % b == 0) {
        return b;
    }

    int64_t c = a % b;
    return gcd(b, c);
}

int main()
{
    int64_t N, X;
    cin >> N >> X;
    vector<int64_t>vec(N);
    for (int64_t i=0; i<N; i++) {
        cin >> vec.at(i);
    }

    vector<int64_t>abs_(N);
    for (int64_t i=0; i<N; i++) {
        abs_[i] = abs(X - vec[i]);
    }

    int64_t num = abs_[0];
    for (int64_t i=1; i<N; i++) {
        num = gcd(num, abs_[i]);
    }

    cout << num << endl;
    return 0;
}

Measured memory_bytes: 4764
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const long long MOD=1000000007;

// vector<p> cut(M); vector<vector<ll> > v(4);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()), sort(v.rbegin(), v.rend()); //sort
// char '' str ""
int main(void)
{
    int k;cin>>k;

    if(k%2==0)cout<<(k/2)*(k/2)<<endl;
    else cout<<(k/2+1)*(k/2)<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define ll long long
#define INT_MAX 1e18
using namespace std;

ll getMinCost(vector<ll> slimes,int n) {
	ll res=0;
	vector<vector<ll>> dp(n,vector<ll>(n,0));
	vector<ll> runningSum(n+1,0);
	for(int i=0;i<n;i++) {
		dp[i][i]=slimes[i];
		runningSum[i+1]=runningSum[i]+slimes[i];
	}
	for(int size=1;size<n;size++) {
		for(int i=0;i<n-size;i++) {
			ll minCost=INT_MAX;
			//cout<<"at row "<<i<<endl;
			for(int j=0;j<size;j++) {
				ll tot=0;
				if(i+j!=i) {
					tot+=dp[i][i+j];
					//cout<<dp[i][i+j]<<" + ";
				}
				if(i+j+1!=i+size) {
					tot+=dp[i+j+1][i+size];
					//cout<<dp[i+j+1][i+size]<<" + ";
				}
				tot+=(runningSum[i+j+1]-runningSum[i])+(runningSum[i+size+1]-runningSum[i+j+1]);
				//cout<<(runningSum[i+j+1]-runningSum[i])<<" + "<<(runningSum[i+size+1]-runningSum[i+j+1])<<endl;
				if(tot<minCost) {
					minCost=tot;
				}
			}
			dp[i][i+size]=minCost;
		}
	}
	/*
	for(vector<ll> row:dp) {
		for(ll val:row) {
			cout<<val<<" ";
		}
		cout<<endl;
	}
	*/
	res=dp[0][n-1];
	return res;
}

int main() {
	int n=0;
	cin>>n;
	vector<ll> slimes(n,0);
	for(int i=0;i<n;i++) cin>>slimes[i];
	cout<<getMinCost(slimes,n)<<endl;
	return 0;
}

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

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    
		String str = "";
		try {
			int i = 0;
			while ((str = in.readLine()) != null) {
				if (str.equals("0")) break;
				
				i++;
				System.out.println("Case " + i + ": " + str);
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 31936
#pragma GCC optimize("O3")

#include <bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pii>
#define read(FILE)  freopen(FILE, "r", stdin);
#define out(FILE) freopen(FILE, "w", stdout);
#define clr(x, y) memset(x,y,sizeof(x));
#define IO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define rep(i, m, n) for(int i=m ; i<n ; i++)
#define forr(i, m, n) for(int i=m ; i<=n ; i++)
#define endl '\n'
#define pb push_back
#define re return
const int N = 1e5 + 5;
const ll OO = 1e9 + 7;
using namespace std;
int n,m,cnt=0;
vi a[N]; int dp[N];
int solve(int u){
    int &ret=dp[u];
    if(~ret) re ret;
    ret=0;
    rep(i,0,a[u].size()){
        ret=max(ret,1+solve(a[u][i]));
    }
    re ret;
}
int main() {
    IO;
    cin>>n>>m;
    rep(i,0,m){
        int u,v; cin>>u>>v;
        u--,v--;
        a[u].pb(v);
    }
    memset(dp,-1, sizeof(dp));
    int mx=0;
    rep(i,0,n){
        mx=max(mx,solve(i));
    }
    cout<<mx;

}

Measured memory_bytes: 7552
#!/usr/bin/env python

def solve(h):
    if len(h) == 0:
        return 0
    if len(h) == 1:
        return h[0]
    if max(*h) == 0:
        return 0
    min_v = min(*h)
    if min_v != 0:
        return min_v + solve([a - min_v for a in h])
    zero_ind = h.index(0)

    aaa, bbb = h[:zero_ind], h[zero_ind + 1:]
    return solve(aaa) + solve(bbb)


def main():
    input()
    h = [int(a) for a in input().split()]

    res = solve(h)
    print(res)


if __name__ == '__main__':
    main()


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

int main(){

    int t, ac = 0, wa = 0, tle = 0, re = 0;
    string st;
    cin>>t;
    vector<string> str;
    for(int i=0;i<t;i++){
        cin>>st;
        str.push_back(st);
    }
    for(int i=0;i<str.size();i++){
        if(str[i] == "AC"){
            ac ++;
        }
        else if(str[i] == "WA"){
            wa++;
        }
        else if(str[i] == "TLE"){
            tle ++;
        }
        else{
            re ++;
        }
    }
    cout<<"AC"<<" x "<<ac<<"\n"<<"WA"<<" x "<<wa<<"\n"<<"TLE"<<" x "<<tle<<"\n"<<"RE"<<" x "<<re<<"\n";
}


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

int main(){
    
    int N;
    cin >> N;
    
    long long num[10][10];
    for(int i = 0; i <10;i++){
        for(int j = 0; j <10;j++)num[i][j]=0;
    }
    for(int i = 1; i <= N;i++){
        
        int n = i;
        //cout << i<<endl;
        vector<int> vec;
        while(n){
            vec.push_back(n%10);
            n /= 10;
        }
        int a = vec[0];
        int b = vec.back();
        //cout << a <<" "<<b <<endl;
        num[a][b]++;
    }
    long long ans = 0;
    for(int i = 1; i < 10;i++){
        for(int j = 1; j < 10;j++){
            ans += num[i][j]*num[j][i];
        }
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 256
use std::io::{stdin, stdout, StdinLock, StdoutLock, BufReader, BufWriter, BufRead, Write};

fn main() {
    let (std_in, std_out) = (stdin(), stdout());
    let mut io = IO::new(std_in.lock(), std_out.lock());
    let tmp = io.rv::<i64>();
    let (n, k) = (tmp[0], tmp[1]);
    let M = 1000000007;

    let mut ans = 0;
    for i in k..=n+1 {
        let le = i * (i - 1) / 2;
        let ri = i * (2 * n + 1 - i) / 2;
        let dist = ri - le + 1;
        ans = (ans + dist) % M;
    }
    io.w(std::cmp::min(ans, M));
}


struct IO<'a> {
    br: BufReader<StdinLock<'a>>,
    bw: BufWriter<StdoutLock<'a>>,
}

#[allow(dead_code)]
impl IO<'_> {
    fn new<'a>(il: StdinLock<'a>, ol: StdoutLock<'a>) -> IO<'a> {
        IO {br: BufReader::new(il), bw: BufWriter::new(ol) }
    }

    fn r<T: std::str::FromStr>(&mut self) -> T {
        let mut buf = String::new();
        self.br.read_line(&mut buf).ok();
        buf.trim().parse().ok().unwrap()
    }

    fn rb(&mut self) -> Vec<u8> {
        let mut buf = String::new();
        self.br.read_line(&mut buf).ok();
        buf.trim().as_bytes().to_vec()
    }

    fn rv<T: std::str::FromStr>(&mut self) -> Vec<T> {
        let mut buf = String::new();
        self.br.read_line(&mut buf).ok();
        buf.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
    }

    fn rvb(&mut self) -> Vec<Vec<u8>> {
        let mut buf = String::new();
        self.br.read_line(&mut buf).ok();
        buf.trim().split_whitespace().map(|e| e.as_bytes().to_vec()).collect()
    }

    fn w<T: std::fmt::Display>(&mut self, x: T) {
        let _ = writeln!(self.bw, "{}", x);
    }

    fn wb(&mut self, s: &[u8]) {
        let _ = writeln!(self.bw, "{}", unsafe{std::str::from_utf8_unchecked(s)});
    }

    fn wv<T: std::fmt::Display>(&mut self, v: &[T]) {
        let _ = write!(self.bw, "{}", v[0].to_string());
        for x in v[1..].iter() {
            let _ = write!(self.bw, " {}", x.to_string());
        }
        let _ = writeln!(self.bw);
    }

    fn wvb(&mut self, v: &[Vec<u8>]) {
        let _ = write!(self.bw, "{}", unsafe{std::str::from_utf8_unchecked(&v[0])});
        for x in v[1..].iter() {
            let _ = write!(self.bw, " {}", unsafe{std::str::from_utf8_unchecked(x)});
        }
        let _ = writeln!(self.bw);
    }
}


Measured memory_bytes: 2108
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
using namespace std;
#define mods 1000000007LL
typedef long long LL;
LL konstan,temp,ans=0,a,b,last,total=0;
vector <LL> jaraka,jarakb;
LL modulo(LL angka){
	if(angka>=mods||angka<=-mods)
		angka%=mods;
	if(angka<0)
		angka+=mods;
	return angka;
}
int main()
{
	scanf("%lld%lld",&a,&b);
	for(int i=0;i<a;i++)
	{
		LL input;
		scanf("%lld",&input);
		if(i!=0)
			jaraka.push_back(input-last);
		last=input;
	}
	for(int i=0;i<b;i++)
	{
		LL input;
		scanf("%lld",&input);
		if(i!=0)
			jarakb.push_back(input-last);
		last=input;
	}
	temp=0;
	for(int i=jaraka.size()-1;i>=0;i--)
	{
		temp=modulo((LL) temp+(LL)((LL) jaraka.size()-i)*jaraka[i]);
		konstan=modulo(temp+konstan);
	}
	temp=0;
	for(int i=jarakb.size()-1;i>=0;i--)
	{
		temp=modulo((LL) temp+(LL)modulo(((LL) jarakb.size()-i)*jarakb[i])*konstan);
		ans=modulo(ans+temp);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 2548
"""
r > p
s > r
p > s
"""
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

ans = 0
hand = [""] * n

for i in range(n):
    if i < k:
        if t[i] == "r":
            ans += p
            hand[i] = "p"
        elif t[i] == "s":
            ans += r
            hand[i] = "r"
        elif t[i] == "p":
            ans += s
            hand[i] = "s"
    else:
        if t[i] == "r":
            if hand[i-k] != "p":
                ans += p
                hand[i] = "p"
            else:
                hand[i] = "?"
        elif t[i] == "s":
            if hand[i-k] != "r":
                ans += r
                hand[i] = "r"
            else:
                hand[i] = "?"
        elif t[i] == "p":
            if hand[i-k] != "s":
                ans += s
                hand[i] = "s"
            else:
                hand[i] = "?"
print(ans)

Measured memory_bytes: 4084
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')

N,M = inpl()

alist = [False for _ in range(N+1)]
for _ in range(M):
    alist[int(input())] = True

dp = [0 for _ in range(N+1)]
dp[0] = 1
if not alist[1]:
    dp[1] = 1
for i in range(2,N+1):
    if alist[i]:
        continue
    dp[i] += dp[i-1] + dp[i-2]

print(dp[N]%1000000007)


Measured memory_bytes: 464452
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

typedef pair<int, int> P;
#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 1234567890

const int maxn = 2e5 + 10;


//initialization here
//

int v[110], w[110];
int dp[110][10005];

//
//initialization finish


// your function is here
//




//
// your function finished



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

	// your code is here
	//
	ll a, b;
	char s;
	cin >> a >> s >> b;

	if (s == '+') Print(a + b);
	else Print(a - b);

	//
	// your code finished

	return 0;
}

Measured memory_bytes: 256
(defun solve (s)
  (let* ((lst (split s "/"))
         (year (parse-integer (aref lst 0)))
         (month (parse-integer (aref lst 1)))
         (day (parse-integer (aref lst 2))))
    (if (and (<= year 2019) (<= month 4) (<= day 30))
        "Heisei"
        "TBD")))

(defun split (str delim)
  (let ((res (make-array 1 :element-type 'string
                           :fill-pointer 0
                           :adjustable t)))
    (loop for i from 0 below (length str)
          with start = 0
          when (string-equal (char str i) delim)
            do (vector-push-extend (subseq str start i) res)
               (setf start (1+ i))
          finally (let ((tail (subseq str start)))
                    (when tail
                      (vector-push-extend tail res))))
    res))

(format t "~A~%" (solve (read-line)))


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

int main(void){
	int N;
	cin >> N;
	int cnt = 0;

	vector<int> a(N);
	for(int i=0;i<N;i++){
		cin >> a[i];
	}

	bool flag = true;
	while(flag){
		flag = false;
		for(int j=N-1;j>=1;j--){
			if(a[j] < a[j-1]){
				swap(a[j],a[j-1]);
				cnt++;
				flag = 1;
			}
		}
	}
	for(int i=0;i<N;i++){
		cout << a[i];
		if(i!=N-1)cout << " ";
	}
	cout << endl;
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3116
#include<iostream> 
#include<vector> 
#include<string> 
#include<algorithm> 
using namespace std; 
int main()
{
	string s;
	cin >> s;
	string a = "";
	for (int i = 0; i < s.size(); i+=2)
	{
		a += s.at(i);
	}
	cout << a << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main(){
	string s;cin>>s;
	sort(s.begin(),s.end());
	if(s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[2])puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int printArray(int numbers[], int length);
int main(void){
  int numbers[3];
  int n=3;
  int i=0;
  int k,min,temp,j;
  int in;
  for(i=0;i<3;i++){
    scanf("%d",&numbers[i]);
  }
 
    
  for (i=0;i<n-1;i++){
    min=numbers[i];
    
    k=i;
    
    for(j=i+1;j<n;j++){
    
      if(numbers[j]<min){
	
	min=numbers[j];

	k=j;

      }
    }
    temp=numbers[i];

    numbers[i]=numbers[k];
   
    numbers[k]=temp;
  }

 
  printArray(numbers, n);

  return 0;
}

 
printArray(int numbers[], int length){
  int i=0;
  for (i = 0; i < length-1; i++) {
    printf("%d ", numbers[i]);
  }
  printf("%d\n",numbers[length-1]);
  }

Measured memory_bytes: 596
#include <iostream>

using namespace std;

int main(){
    int n;

    while(cin >> n){
        int ans = 0;
        for(int a=0; a <= 9; a++){
            for(int b=0; b<=9; b++){
                for(int c=0; c<=9; c++){
                    for(int d=0; d<=9; d++){
                        if(a+b+c+d == n){
                            ans++;
                        }
                    }
                }
            }
        }

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

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

int main(){
	int a , b , i;
	scanf( "%d%d" , &a , &b );

	for( i = 1 ; i <= 3 ; ++i ){
		if( (a * b * i) % 2 == 1 ){
			puts( "Yes" );
			return 0;
		}
	}

	puts( "No" );
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a,b,c;
   cin>>a>>b>>c;
   if(a==5&&b==5&&c==7)
   {
       cout<<"YES";
   }
   else if(a==5&&b==7&&c==5)
   {
       cout<<"YES";
   }
   else if(a==7&&b==5&&c==5)
   {
       cout<<"YES";
   }
   else
   {
       cout<<"NO";
   }


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,max,i,j,k;
	cin>>n;
	max=0;
	if(n<=3){cout<<"1";return 0;}
	for(i=2;i*i<=n;i++){
		j=2;
		while(pow(i,j)<=n)j++;
		j-=1;
		if(pow(i,j)>=max)max=pow(i,j);
	}
	cout<<max;
}

Measured memory_bytes: 256
#include<stdio.h>
#define INF 10000000

int time[101][101],cost[101][101],m;

void warshall_floyd_time(void);
void warshall_floyd_cost(void);
int min(int,int);
void init(void);

int main(void){
  int i,j,n,k,a,b,cos,tim,p,q,r;

  while(scanf("%d %d",&n,&m),n,m){

    init();
    
    for(i=0;i<n;i++){
      scanf("%d %d %d %d",&a,&b,&cos,&tim);
      cost[a][b]=cost[b][a]=cos;
      time[a][b]=time[b][a]=tim;
    }

    warshall_floyd_time();
    warshall_floyd_cost();

    scanf("%d",&k);
    for(i=0;i<k;i++){
      scanf("%d %d %d",&p,&q,&r);
      printf("%d\n",r?time[p][q]:cost[p][q]);
    }
  }
  return 0;
}

void warshall_floyd_time(void){
  int i,j,k;
  for(k=0;k<=m;k++)
    for(i=0;i<=m;i++)
      for(j=0;j<=m;j++)
	time[i][j]=time[j][i]=min(time[i][j],time[i][k]+time[k][j]);
}

void warshall_floyd_cost(void){
  int i,j,k;
  for(k=0;k<=m;k++)
    for(i=0;i<=m;i++)
      for(j=0;j<=m;j++)
	cost[i][j]=cost[j][i]=min(cost[i][j],cost[i][k]+cost[k][j]);
}

int min(int x,int y){
return x<y?x:y;
}

void init(void){
  int i,j;
  for(i=0;i<101;i++){
    for(j=0;j<101;j++){
      time[i][j]=cost[i][j]=INF;     
    }
    time[i][i]=cost[i][i]=0;
  }
}

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

using namespace std;

typedef long long ll;

constexpr int MOD = 1000000007;
constexpr char nl = '\n';

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);

  int N, K;
  cin >> N >> K;
  ll sum = 0;
  for (ll k = K; k <= N + 1; k++) {
    ll min_sum = (k - 1) * k / 2;
    ll max_sum = (N - (k - 1) + N) * k / 2;
    sum += max_sum - min_sum + 1;
    // cerr << max_sum << ":" << min_sum << nl;
  }
  cout << sum % MOD << nl;
  return 0;
}


Measured memory_bytes: 3628
object Main {
    def main(args: Array[String]) = {
        import scala.io.StdIn.readLine
        var Array(n, m) = readLine.split(" ").map(_.toInt)
        var penalty: Array[Int] = new Array[Int](n)
        var done: Array[Int] = new Array[Int](n)

        for(i <- 0 until m) {
            var Array(idstring, ver) = readLine.split(" ")
            var id = idstring.toInt - 1
            ver match {
                case "AC" => done(id) = 1
                case "WA" => if( done(id) == 0 ) penalty(id) = penalty(id) + 1
                case _ =>  ;
            }
        }

        var ans: Int = 0; var pen: Int = 0
        for(i <- 0 until n) {
            ans = ans + done(i)
            if(done(i) == 1) pen = pen + penalty(i)
        }

        printf("%d %d\n", ans, pen)
    }
}

Measured memory_bytes: 49012
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A;
  cin >> N >> A;
  int x;
  x = N % 500;
  if(x <= A){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin >> s;
	int size=s.size();
	for(int i=0;i<size;i++){
		s.pop_back();
		int ss=s.size();
		if (s.substr(0, ss/2) == s.substr(ss/2, ss/2)) {
            cout << ss - 1 << endl;
            return 0;
        }
	}
    return 0;
}

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

int main() {
    int nana=0, go=0;
    for (int i = 0; i <3; i++) {
        int x;
        cin >> x;
        if (x ==5)go++;
        if (x ==7)nana++;
    }

    if (nana == 1 && go == 2) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<map>
using std::cin;using std::cerr;
using std::max;using std::min;
#define N 1005
#define ll long long
#define db double
#define dbg1(x) cerr<<#x<<"="<<(x)<<" "
#define dbg2(x) cerr<<#x<<"="<<(x)<<"\n"
int n,m,A[N],B[N],flag1,flag2,ans[N];
void Solve(int x,int y)
{
	for(int i=1;i<=m;i++)
	{
		if(abs(x)>abs(y)) if(x>0) putchar('R'),x-=ans[i];else putchar('L'),x+=ans[i];
		else if(y>0) putchar('U'),y-=ans[i];else putchar('D'),y+=ans[i];
	}
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d",&A[i],&B[i]),flag1|=(A[i]+B[i])&1,flag2|=~(A[i]+B[i])&1;
	if(flag1&&flag2) return puts("-1"),0;
	for(int i=30;~i;i--) ans[++m]=1<<i;
	if(flag2) ans[++m]=1;
	printf("%d\n",m);
	for(int i=1;i<=m;i++) printf("%d ",ans[i]);puts("");
	for(int i=1;i<=n;i++) Solve(A[i],B[i]),puts("");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;

int main() {
    ll n,d; cin >> n >> d;
    int ans = 0;
    for(int i = 0;i < n;i++){
        ll x,y; cin >> x >> y;
        ll a = pow(x,2),b = pow(y,2);
        if(sqrt(a+b) <= d){
            ans++;
        }
    }
    cout << ans;
}



Measured memory_bytes: 3620