akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main() {
  char vowel[5] = {'a', 'e', 'i', 'o', 'u'};
  char c;
  cin >> c;
  for (int i = 0; i < 5; ++i) {
    if (vowel[i] == c) {
      cout << "vowel" << endl;
      return 0;
    }
  }
  cout << "consonant" << endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int maxim(ll &D, vector<int> &bits) {
  int x = 0;
  for(int i = 0; i < D; i++) {
    if(bits.at(i) == 0) {
      x = max(x, (i));
    }
  }
  return x;
}
int main() {
  ll D, G;
  cin >> D >> G;
  vector<pair<int, int>> pc(D);
  for(int i = 0; i < D; i++) {
    cin >> pc.at(i).first >> pc.at(i).second;
  }
  
  int mini = 1000;
  for(int i = 0; i < (1 << D); i++) {
    ll sum = 0;
    int count = 0;
    vector<int> bits(D);
    int l = i;
    for(int j = 0; j < D; j++) {
      bits.at(j) = l % 2;
      l /= 2;
    }
    
    for(int k = 0; k < D; k++) {
      if(bits.at(k) == 1) {
        sum += (100 * (k + 1) * pc.at(k).first + pc.at(k).second);
        count += pc.at(k).first;
      }
    }
    //ここまで正常
    if(sum >= G) {
      mini = min(count, mini);
    } else {
      int x = maxim(D, bits);
      for(int m = 0; m < pc.at(x).first; m++) {
        sum += 100 * (x + 1);
        count += 1;
        if(sum >= G) {
          mini = min(count, mini);
          break;
        }
      }
    }
  }
  cout << mini << endl;
  
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int x = scan.nextInt();
		int count = 0;
		while(n != 0 || x != 0)
		{
			for(int i = 1;i <= n;i++)
			{
				for(int j = i + 1;j <= n;j++)
				{
					for(int k = j + 1;k <= n;k++)
					{
						if(i + j + k == x){count++;}
					}
				}
			}
			System.out.println(count);
			n = scan.nextInt();
			x = scan.nextInt();
			count = 0;
		}
	}
}

Measured memory_bytes: 19612
#include <stdio.h>
#include <math.h>

int is_prime(int a){
    for(int i=2; i<=sqrt(a); i++){
        if(a%i == 0) return 0;
    }
    return 1;
}

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

    int data, num_of_prime = 0;
    for(int i=0; i<data_num; i++){
        scanf("%d", &data);
        if(is_prime(data)) num_of_prime++;
    }
    printf("%d\n", num_of_prime);
}



Measured memory_bytes: 2068
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
#include <string>
#include <bitset>
#include <functional>
#include <iomanip>

using namespace std;
using lint = long long;
using vi = vector<int>;
using vl = vector<int>;
using pii = pair<int, int>;
using pll = pair<lint, lint>;
using pqi = priority_queue<int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i > 0; i--)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
#define mp(x, y) make_pair((x), (y))
#define all(x) (x).begin(), (x).end()
#define foreach(it, x) for (auto it = (x).begin(); it != (x).end(); it++)
#define space (char)0x20

constexpr lint MOD = 1e9 + 7;
int A, B, C, D, E, F, G, H, I, J, K, L, M, N;
int O, P, Q, R, S, T, U, V, W, X, Y, Z;
// string s;

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

	cin >> N >> M;
    int ac = 0;
    int wa = 0;
    vector<bool> status(N+1, false);
    vector<int> penalty(N+1, 0);
    rep(i, M) {
        int f; string s;
        cin >> f >> s;
        if (s == "AC") {
            if (!status[f]) {
                status[f] = true;
                ac += 1;
                wa += penalty[f];
            }
        } else {
            penalty[f]++;
        }
    }

    cout << ac << space << wa << endl;
	return 0;
}

Measured memory_bytes: 640
using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int a = sc.NextInt();
        int b = sc.NextInt();
        int H = sc.NextInt();
        int M = sc.NextInt();
        // 角度

        double ToRad = Math.PI / 180;
        double hh = 0.5 * (H * 60 + M);
        double mm = M * 6;

        double yH = Math.Sin(hh * ToRad) * a;
        double xH = Math.Cos(hh * ToRad) * a;

        double yM = Math.Sin(mm * ToRad) * b;
        double xM = Math.Cos(mm * ToRad) * b;

        double dy = (yH - yM);
        double dx = (xH - xM);
        double dist = Math.Sqrt(dy * dy + dx * dx);
        Console.WriteLine(dist);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 28008
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
//



//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, m ;
  cin >> n >> m ;
  vector<pair<int,int>> pai(n) ;
  pai.at(0) = MP(1,0) ;
  REP(i,n-1){
    pai.at(i+1) = MP(0,1) ;
  }
  
  REP(i,m){
    int a, b ;
    cin >> a >> b ;
    
    if(pai.at(a-1).FI!=0){
      if(pai.at(a-1).SE!=0){
        pai.at(b-1).FI++ ;
        pai.at(a-1).SE-- ;
      }
      else{
        pai.at(a-1).FI-- ;
        pai.at(b-1).FI++ ;        
      }
    }
    else{
      pai.at(a-1).SE-- ;
      pai.at(b-1).SE++ ;
    }
  }
  
  int ans = 0 ;
  REP(i,n){
    if(pai.at(i).FI!=0){
      ans++ ;
    }
  }
  
  cout <<ans <<endl ;
        
  
  
  return 0 ;
}



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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
	int N, M; cin >> N >> M;
	vector<int> L(M), R(M); REP(i, M) cin >> L.at(i) >> R.at(i);
	vector<int> ans(N + 2); REP(i, N + 2) ans.at(i) = 0;
	REP(i, M) {
		ans.at(L.at(i)) += 1;
		ans.at(R.at(i) + 1) -= 1;
	}
	vector<ll> tmp(N + 1); REP(i, N + 1) tmp.at(i) = 0;
	int res = 0;
	REP(i, N + 1) {
		if(i == 0) continue;
		tmp.at(i) += tmp.at(i - 1) + ans.at(i);
		if(tmp.at(i) == M) res++;
	}
	cout << res << endl;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 100 * 1000;
const int MOD = 1000 * 1000 * 1000 + 7;
struct retour
{
	int blanc , noir;
};
vector<int> adj[MAXN];


retour recursion(int noeud , int pere)
{
	retour prMoi = {1,1};
	for (int i = 0 ; i < adj[noeud].size() ; i++)
	{
		if (adj[noeud][i] != pere)
		{
			retour nouv = recursion(adj[noeud][i] , noeud);
			prMoi.blanc *= (nouv.blanc + nouv.noir);
			prMoi.noir *= (nouv.blanc);
			prMoi.blanc %= MOD;
			prMoi.noir %= MOD;
		}
	}
	return prMoi;
}
int32_t main()
{
	int N;
	cin >> N;
	for (int i = 0 ; i < N - 1 ; i++)
	{
		int a,b;
		cin>>a>>b;
		a--; b--;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	retour sortie = recursion(0 , 0);
	cout<<(sortie.blanc + sortie.noir)%MOD<<endl;
}

Measured memory_bytes: 12672
open System
let R T = stdin.ReadLine()|> T
let RS T = stdin.ReadLine().Split()|>Array.map T
let Mod = (1e9|>int64)+7L
[<EntryPoint>]
let main argv =
    RS int
    |>fun c -> ((c.[0]+c.[1]-1)/c.[1])
    |>stdout.WriteLine
    0

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

using namespace std;

int main() {

    int cnt[4] = {};
    for (int i = 0; i < 3; i++) {
        int a, b; cin >> a >> b;
        a--;
        b--;
        cnt[a]++;
        cnt[b]++;
    }

    int cnt2[4] = {};
    for (int i = 0; i < 4; i++) {
        cnt2[cnt[i]]++;
    }

    if (cnt2[1] == 2 && cnt2[2] == 2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;
using M = map<int, int>;

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> v;
  M mp;
  rep(i, m){
    int x, y;
    cin >> x >> y;
    if(x == 1) v.push_back(y);
    else if(y == n) mp[x] = y;
    else{};
  }
  string s = "IMPOSSIBLE";
  rep(i, v.size()){
    if(mp[v[i]] == n) s = "POSSIBLE";
  }
  cout << s << endl;

  return 0;
}

Measured memory_bytes: 13004
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		sc.close();

		if(n%2==1){
			System.out.println("No");
			return;
		}

		String s1 = s.substring(0, n/2);
		String s2 = s.substring(n/2, n);

		if(s1.equals(s2)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define space " "
#define MOD (long long) 1000000007
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename T> void __f(const char* variable_name, T&& value){cout << variable_name << ": " << value << endl;}
template <typename T1, typename... T2> void __f(const char* names, T1&& arg1, T2&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << ": " << arg1 << " |";__f(comma + 1, args...);}

const ll N = 5e5 + 5;
ll *v;
ll a,b,k;

void solve(){
    cin >> k >> a >> b;
    ll num = k;
    while(num <= b){
        if(num >= a){
            cout << "OK" << endl;
            return;
        }
        num += k;
    }
    cout << "NG" << endl;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll t = 1;
    // cout << "\n\nBLAH BLAH BLAH\n\n";
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
let () =
  let w = read_line () in
  let rec loop count =
    match read_line () with
      "END_OF_TEXT" -> Printf.printf "%d\n" count
    | s -> loop (Str.split (Str.regexp " ") s
                 |> List.fold_left
                   (fun acc x ->if String.lowercase x = String.lowercase w then acc+1 else acc)
                   0
                 |> (+) count)
  in loop 0

Measured memory_bytes: 2308
(* Vicfred
 * https://atcoder.jp/contests/abc139/tasks/abc139_c
 * implementation
 * *)
let n = Scanf.scanf "%d\n" ( + ) 0
let hs = Array.init n @@ fun _ -> Scanf.scanf " %d" ( + ) 0
let maxima = ref 0
let main =
    Array.fold_left (fun (m, p) h -> if h <= p then incr maxima else maxima := 0;
    max m !maxima, h) (0, 0) hs |> fst |> Printf.printf "%d\n"



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

int main()
{
    bool s[11][7] = {{0,1,1,1,1,1,1},{0,0,0,0,1,1,0},{1,0,1,1,0,1,1},{1,0,0,1,1,1,1},{1,1,0,0,1,1,0},
                     {1,1,0,1,1,0,1},{1,1,1,1,1,0,1},{0,1,0,0,1,1,1},{1,1,1,1,1,1,1},{1,1,0,1,1,1,1},{0,0,0,0,0,0,0}};
    int n, d;

    while( cin >> n )
    {
        if( n == -1 )
            break;

        for( int i = 0; i < 7; i++ )
            s[10][i] = 0;
        
        for( int i = 0; i < n; i++ )
        {
            cin >> d;
            for( int j = 0; j < 7; j++ )
            {
                bool a = s[d][j] ^ s[10][j];
                cout << a;
                s[10][j] = s[d][j];
            }
            cout << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3100
#include <stdio.h>
int main(){
    int data[5];
    int i,a=0;
    for(i=0;i<5;i++){
    scanf("%d",&data[i]);
    if(data[i]<40){
        data[i]=40;
    }
    a += data[i];
    }
    a= a/5;
    printf("%d\n",a);
    return 0;
}

Measured memory_bytes: 1028
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll memo[2020][2020];
bool done[2020][2020];

ll c(int n, int k){
	if(k<0 || n<0 || n<k){
		return 0ll;
	}
	if(done[n][k]){
		return memo[n][k];
	}
	done[n][k] = true;
	if(k==0 || k==n){
		return memo[n][k] = 1ll;
	}
	memo[n][k] = (c(n-1,k-1)+c(n-1,k))%MOD;
	return memo[n][k];
}

int main(void){
	int n,k,i;
	ll ans;
	cin >> n >> k;
	if(n==k){
		cout << 1 << endl;
		for(i=1; i<k; ++i){
			cout << 0 << endl;
		}
		return 0;
	}
	for(i=1; i<=k; ++i){
		ans = c(n-k-1,i-1);
		mul_mod(ans,2);
		add_mod(ans,c(n-k-1,i-2));
		add_mod(ans,c(n-k-1,i));
		mul_mod(ans,c(k-1,i-1));
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 35456
#define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
using namespace std;
int main(){
	
	string res;
	string t="";
	queue<string> s;
	getline(cin,res);
	
	for(int i=0;i<res.size();i++){
		if(res[i]==' '||res[i]==','||res[i]=='.'){
			if(t.size()>=3&&t.size()<=6)
			s.push(t);
			t="";
		}
		else
			t+=res[i];
	}
	
	if(!s.empty()){
		cout<<s.front();
		s.pop();
		while(!s.empty()){
			cout<<" "<<s.front();
			s.pop();
			
	}
	}
	cout<<endl;
	
}

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

using pii = pair<int, int>;

int where(int y, int x, const int w) {
    y %= 2 * w;
    while(y > 0) {
        if((y + x) & 1) { // from right
            int move_r = min(y, w - x - 1);
            x += move_r;
            y -= move_r;
        } else { // from left
            int move_l = min(x, y);
            x -= move_l;
            y -= move_l;
        }
        y -= (y > 0);
    }
    return x;
}

int main() {
    int h, w, n;
    cin >> h >> w >> n;
    vector<pii> rmv(n);
    for(int i=0; i<n; ++i) {
        int y, x;
        cin >> y >> x;
        rmv[i] = make_pair(y-1, x-1);
    }
    sort(begin(rmv), end(rmv));

    vector<int> goal(w);
    iota(begin(goal), end(goal), 0);
    for(int i=0; i<n; ++i) {
        int y = rmv[i].first,
            x = rmv[i].second;
        swap(goal[where(y, x, w)], goal[where(y, x+1, w)]);
    }
    vector<int> res(w);
    for(int i=0; i<w; ++i) {
        res[goal[where(h, i, w)]] = i + 1;
    }
    for(auto x : res) {
        cout << x << endl;
    }
}


Measured memory_bytes: 5984
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    map<ll,ll> m;
    rep(i,n){
        cin>>a[i];
        m[i-a[i]]++;
    }

    ll ans=0;
    rep(i,n) ans+=m[i+a[i]];

    cout<<ans<<endl;
}



Measured memory_bytes: 27440
#include <algorithm>
#include <cstdio>

static const size_t n_max = 10000;
static int S[n_max];

int main() {
  size_t n, q;
  scanf("%zu", &n);
  for (size_t i = 0; i < n; i++)
    scanf("%d", S + i);
  scanf("%zu", &q);
  int c = 0;
  for (size_t i = 0; i < q; i++) {
    int t;
    scanf("%d", &t);
    if (std::find(S, S + n, t) != S + n)
      c++;
  }
  printf("%d\n", c);
  return 0;
}

Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ri register int
const long double PI=3.141592653589793238462643383279;
const int M=998244353,N=200005;
const long long inf=1000000000000000000ll;
int n,i,s,l,r,x[100005],o[100005],k;
long long a[100005],ans;
int main()
{
	scanf("%d %d",&n,&s);
	for(i=1;i<=n;++i)
		scanf("%d %d",&x[i],&a[i]);
	l=1,r=n;
	while(x[l]<s&&x[r]>s)
	{
		if(a[l]>=a[r])
		{
			a[l]+=a[r];
			o[++k]=r;
			--r;
		}
		else
		{
			a[r]+=a[l];
			o[++k]=l;
			++l;
		}
	}
	while(x[l]<s&&l<=n)
		o[++k]=l++;
	while(x[r]>s&&r>=1)
		o[++k]=r--;
	for(i=2;i<=k;++i)
		ans+=abs(x[o[i]]-x[o[i-1]]);
	ans+=abs(x[o[k]]-s);
	cout<<ans;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();

        if (a.equals("H") && b.equals("H") || a.equals("D") && b.equals("D")) {
            System.out.println("H");
        } else {
            System.out.println("D");
        }
    }
}


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

long long a[100000];

int fd(long long k1, int l, int r) {

	int m = (l + r) / 2;

	if (a[m] == k1 || a[l] == k1 || a[r] == k1)
		return 1;
	else if (a[m] > k1 && l < m - 1)
		fd(k1, l, m - 1);
	else if(m + 1 < r)
		fd(k1, m + 1, r);
	else
		return 0;
}

int main()
{
	int n, q;

	cin >> n;

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

	cin >> q;

	for (int i = 0; i < q; i++) {
		long long k;
		cin >> k;

		cout << fd(k, 0, n - 1) << endl;
	}

	return 0;
}


Measured memory_bytes: 3908
import copy
H, W, K = map(int, input().split())
c = [[s for s in input()] for i in range(H)]


def count(a):
    re = 0
    for n in a:
        for m in n:
            if m == "#":
                re += 1
    return re


result = 0
for i in range(2**H):
    for j in range(2**W):
        temp_c = copy.deepcopy(c)
        sh = format(i, "0" + str(H) + "b")
        sw = format(j, "0" + str(W) + "b")
        for z, s in enumerate(sh):
            if s == "1":
                temp_c[z] = ["." for x in range(W)]

        for z, s in enumerate(sw):
            if s == "1":
                for y in range(len(temp_c)):
                    temp_c[y][z] = "."
        res = count(temp_c)
        if res == K:
            result += 1

print(result)

Measured memory_bytes: 9108
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		long k = sc.nextLong();
		long aSum[] = new long[n + 1];
		long bSum[] = new long[m + 1];
		int ans = 0;
		int max = n;
		for(int i = 1 ; i <= n ; i++) {
			aSum[i] = aSum[i - 1] + sc.nextLong();
		}

		for(int i = 0 ; i <= m ; i++) {
          if(i != m)
			bSum[i + 1] = bSum[i] + sc.nextLong();

			long best = k - bSum[i];
			if(best < 0)
				break;
			while(max > 0 && aSum[max] > best) max--;

			ans = Math.max(ans , i + max);
		}

		System.out.println(ans);

	}
}



Measured memory_bytes: 64932
#include <bits/stdc++.h>
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define DEC(i, a, b) for (int i = (a); i > (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

  int N;
  cin >> N;
  vector<int> v(N);
  REP(i,N) {
    cin >> v[i];
  }
  int avg = round(accumulate(ALL(v),0LL)/(double)N);
  int ans = 0;
  for (auto e: v) {
    ans += (avg - e)*(avg - e);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 764
import java.awt.Polygon;
import java.awt.geom.Area;
import java.awt.geom.PathIterator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) throws Exception
	{
		new Main().run();
	}
	
	public void run() throws Exception
	{
		Scanner file = new Scanner(System.in);
		char[] chars = file.next().toCharArray();
		int len = chars.length;
		int c1 = 0;
		int c2 = 0;
		for(int i = 0;i<len;i++)
		{
			if(i%2==0 ^ chars[i] == '0')
				c1++;
			else
				c2++;
		}
		System.out.println(Math.min(c1, c2));
	}
}


Measured memory_bytes: 26660
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <climits>
#include <cfloat>


using namespace std;

int main()
{
	int used[32][32];
	int u[32];
	memset(u, 0, sizeof(u));
	memset(used, 0, sizeof(used));

	printf("?a\n");
	fflush(stdout);
	u[0] = 1;
	int tail;
	int myTail = 0;
	while (true)
	{
		char buf[16];
		scanf("%s", buf);
		if (strlen(buf) == 1)
		{
			int a = buf[0] - 'a';
			if (u[a] || a != myTail)
				break;
			else
			{
				u[a] = 1;
				tail = a;
			}
		}
		else
		{
			int a = buf[0] - 'a';
			int b = buf[1] - 'a';
			if (used[a][b] || a != myTail)
				break;
			else
			{
				used[a][b] = 1;
				tail = b;
			}
		}

		int i;
		for (i = 0; used[tail][i]; ++i)
			;
		myTail = i;
		used[tail][i] = 1;
		printf("?%c%c\n", 'a'+tail, 'a'+i);
		fflush(stdout);
	}
	printf("!OUT\n");
	fflush(stdout);

	return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<ll> l(n);
	rep(i,n) cin >> l[i];
	sort(l.begin(),l.end());
	ll ans = 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(l[i] != l[j] && l[k] != l[j] && l[i] != l[k] && l[k] < l[i] + l[j]) ans++;
			}
		}
	}
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3600
while 1:
    a,op,b=input().split()
    a=int(a)
    b=int(b)
    if op=="?":
        break
    if op=="+":
        print(a + b)
    elif op=="-":
        print(a-b)
    elif op=="*":
        print(a*b)
    elif op=="/":
        if b==0:
            break
        else:
            print(a//b)


Measured memory_bytes: 5596
use std::io;
fn read<T: std::str::FromStr>() -> T{
    let mut a = String::new();
    io::stdin().read_line(&mut a).ok().unwrap();
    a.trim().parse().ok().unwrap()
}

fn pri<T: std::fmt::Display>(a : T){
    println!("{}", a);
}

fn main() {
    let te : String = read();
    let tet : &str = &te;
    match tet {
        "A" => pri("T"),
        "T" => pri("A"),
        "C" => pri("G"),
        "G" => pri("C"),
        _ => ()
    }
}


Measured memory_bytes: 4352
import java.util.*;
class Main{
    public static void main(String[] args){
	Scanner stdIn = new Scanner(System.in);
	int[] A=new int[5];
	int n=A.length;
	for(int i=0;i<n;i++){
	    A[i]=stdIn.nextInt();
	}     
	int k = stdIn.nextInt();
	String result="Yay!";
	for(int m=0;m<n-1;m++){
	    for(int j=m+1;j<n;j++){
		if(A[j]-A[m]>k){
		    result=":(";
		    break;
		}
	    }
	}
	System.out.println(result);
    }
}


Measured memory_bytes: 21460
#include <bits/stdc++.h>
using namespace std;
void err() {
  cout << -1 << endl;
  exit(0);
}
void dfs (int crr, int dpt, vector<vector<int>>& grh, long long& cnt) {
  cnt += dpt;
  for (int nxt : grh[crr]) {
    dfs(nxt, dpt + 1, grh, cnt);
  }
}
int main() {
  int n;
  cin >> n;
  vector<long long> d(n);
  map<long long, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    mp[d[i]] = i;
  }
  sort(d.begin(), d.end());
  vector<long long> sz(n, 1);
  vector<vector<int>> grh(n);
  for (auto it = d.rbegin(); next(it) != d.rend(); it++) {
    auto i = mp.rbegin()->second;
    long long wnt = *it - n + 2 * sz[i];
    if (mp.find(wnt) == mp.end()) err();
    auto p = mp[wnt];
    grh[p].push_back(i);
    sz[p] += sz[i];
    mp.erase(--mp.end());
  }
  long long cnt = 0;
  int rt = mp[d[0]];
  queue<int> que;
  que.push(rt);
  vector<long long> dst(n, 0);
  while (!que.empty()) {
    auto crr = que.front();
    que.pop();
    for (int nxt : grh[crr]) {
      que.push(nxt);
      dst[nxt] = dst[crr] + 1;
    }
  }
  if (accumulate(dst.begin(), dst.end(), 0LL) != *d.begin()) err();
  // dfs(rt, 0, grh, cnt);
  // if (d[0] != cnt) err();
  for (int crr = 0; crr < n; crr++) {
    for (int nxt : grh[crr]) {
      cout << crr + 1 << ' ' << nxt + 1 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 12416
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define  all(v)            v.begin(), v.end()
#define  sz(x)             (long long)x.size()
#define  debug(x)          cout << '>' << #x << ':' << x << endl;
#define  debug2(x, y)      cout << #x << "=" << x << "," << #y << "=" << y << endl
#define  rep(i,n)          for(int i = 0; i <  n ; i++)
#define  reps(i,n)         for(int i = 1; i <= n ; i++)
#define  make_unique(v)    sort(all(v));v.erase(unique(all(v)), v.end());
#define  REMOVE(v,a)       v.erase(remove(v.begin(),v.end(), a), v.end());
#define  pb                push_back
#define  eb                emplace_back
#define  mp                make_pair
#define  endl              '\n'
#define  fi                first
#define  se                second
#define  ajs(a)            (a<0)?(-1*a):a

using namespace std;
typedef long long          ll;
typedef vector<long long>  vll;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;

const ll MOD = 1e9+7;
const double PI  = acos(-1.0);
const double EPS = (1e-10);
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = { -1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = { -1, 0, 1, 1, 1, 0, -1, -1};
bool cmp(int X, int Y) {return X > Y;}
int dcp(double A, double B){return fabs(A-B)<=EPS ? 0 : A<B ? -1:1;}

ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll lcm(ll a, ll b) {return (a / gcd(a, b)) * b;}
ll modpow(ll a, ll b, ll m=MOD){a %= m; ll res = 1; while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){if(b<0){return 0;}ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}


const int N = 1e6 + 5;
vi adj[N];
ll vis[102][102];



int main(){ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
string s;cin>>s;

ll cnt = 0;
ll n = s.length();
rep(i,n){
	if(s[i] == 'R'){cnt++;}
	
	}
	
if(cnt == 1 || cnt==3){cout<<cnt;}
else if(cnt == 2){
	if(s[0]=='R' && s[1] == 'R'){cout<<2;}
	else if(s[1]=='R' && s[2] == 'R'){cout<<2;}
	else{cout<<1;}
	}else{
		cout<<0<<endl;
		}




}



	
	




		



Measured memory_bytes: 27020
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <bitset>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;


int main() {
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    vector<bitset<5050>> dp(n+1), idp(n+1);
    dp[0].set(0);
    for (int i = 0; i < n; ++i) {
        dp[i+1] = dp[i] | (dp[i] << v[i]);
    }
    idp[n].set(0);
    for (int i = n-1; i >= 0; --i) {
        idp[i] = idp[i+1] | (idp[i+1] << v[i]);
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int l = max(0, k-v[i]), r = k - 1;
        int c = 0;
        for (int j = l; j <= r; ++j) {
            c += idp[i+1][j];
        }
        bool need = false;
        for (int j = 0; j < k; ++j) {
            if(dp[i][j] && c > 0){
                need = true;
                break;
            }
            if (l > 0) {
                c += idp[i+1][--l];
            }

            if (r > 0){
                c -= idp[i+1][--r+1];
            }
        }
        if (not need) ++ans;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 6400
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

vector<ll> v;

void dfs(ll s){
    auto ts = s;
    v.emplace_back(s);
    
    int n = 0;
    while(ts) {
        n++;
        ts /= 10;
    }
    if(n==10)return;

    int sb = s%10;
    if(sb!=0) dfs(s*10+(sb-1));
    dfs(s*10+(sb));
    if(sb!=9)dfs(s*10+(sb+1));
}

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

    Rep(i, 1, 10) dfs(i);
    SORT(v);
    pr(v[N-1]);
}

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




int main(void){
    string T;
    cin >> T;
    rep(i,T.size()){
        if(T[i] == '?'){
            T[i] = 'D';
        }
    }
    cout << T << endl;

    return 0;
}

Measured memory_bytes: 3768
from sys import stdin

def main():
    N = stdin.readline().rstrip()
    L_list = [int(L) for L in stdin.readline().rstrip().split()]
    L_list.sort()
    if L_list[-1] < sum(L_list[:-1]):
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    int N;
    cin >> N;
    int maxCount = 0;
    map<string, int> dic;
    rep(i, N) {
        string s;
        cin >> s;
        ++dic[s];
        maxCount = max (maxCount, dic[s]);
    }

    vector<string> ans;
    for (auto kv: dic) {
        if (kv.second == maxCount) {
            ans.push_back(kv.first);
        }
    }
    sort(ans.begin(), ans.end());

    for (string s: ans) {
        cout << s << endl;
    }

    return 0;
}


Measured memory_bytes: 25584
#include <stdio.h>

int main(void) {
  int p[101] = {0}, s[101] = {0}, q, i = 1, j, k = 1, rank[32] = {0}, score;

  while (1) {
    scanf("%d,%d", &p[i], &s[i]);
    if (p[i] == 0 && s[i] == 0) break;
    i++;
  }

  for (i = 30; i >= 0; i--)
    for (j = 0; j < 100; j++)
      if (s[j] == i) {
	rank[k] = i;
	k++;
	break;
      }

  while (scanf("%d", &q) != EOF) {
    score = s[q];
    for (i = 1; i < 32; i++) 
      if (rank[i] == score) {
	printf("%d\n", i);
	break;
      }
  }

  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

ll gcd(ll a, ll b){ return b==0?a:gcd(b,a%b);}

ll add(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a+b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll mul(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a*b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

const int N = 100+5;
const int inf = 1e9;
const int W = 10000+5;

int n, C;
int memo[W];

int main(){
	ri2(n, C);
	for(int i = 1; i <= C; i++) memo[i] = -inf;
	for(int i = 1; i <= n; i++){
		int v, w;
		ri2(v, w);
		for(int j = C; j >= w; j--){
			memo[j] = max(memo[j], memo[j - w] + v);
		}
	}
	printf("%d\n", *max_element(memo, memo + C + 1));
	return 0;
}


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

int main() {
  int input,a,b,c;
  cin >> input;
  a = input/100;
  b = (input - a*100) / 10;
  c = (input - a*100 - b*10);
  
  cout << a+b+c << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        
        int K = sc.nextInt();
        
        int[] a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        System.out.print(a[K-1]);
    }

    
}

Measured memory_bytes: 23124
#include<cstdio>
#include<iostream>
#include<cctype>
using namespace std;

#define ll long long
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define MD 1000000007

char sep[2] = {' ', '\n'};

int main() {
  int i, j, k, n, m, l;
  char c;

  while(true) {
    scanf("%c", &c);
    if (!isalpha(c)) printf("%c", c);
    else if (isupper(c)) printf("%c", tolower(c));
    else if (islower(c)) printf("%c", toupper(c));
    else exit(255);
    if (c == '\n') break;
  }

  return 0;
}
  

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

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define REP(i, n) for(ll i = n-1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << x << endl
#define mp make_pair
#define pb push_back

const long long MOD = 1000000007;
const long long INF = 1LL<<60;


int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cout << fixed << setprecision(12);
    ll n;
    cin >> n;
    if(n % 2 == 1){
        cout << 0 << endl;
        return 0;
    }
    ll a = 10;
    ll r = 0;
    while(a <= n){
        r += (n / a);
        a *= 5;
    }
    cout << r << endl;

    return 0;
}


Measured memory_bytes: 256
K = int(input())
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[K-1])


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <vector>

using namespace std;

int main()	{
  int n;
  cin >> n;
  string dict[n];
  for (int i = 0; i < n; i++)	{
    cin >> dict[i];
    sort(dict[i].begin(), dict[i].end());
  }
  string c = dict[0];
  string d(50, ' ');
  sort(c.begin(), c.end());
  string::iterator it;
  it = set_intersection(dict[0].begin(), dict[0].end(), c.begin(), c.end(), d.begin());
  for (int i = 1; i < n; i++)	{
	it = set_intersection(d.begin(), d.end(), dict[i].begin(), dict[i].end(), d.begin());
    d.resize(it - d.begin());
  }
  cout << d << endl;
  return 0;
}

Measured memory_bytes: 3628
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;
list<long long int> Prime(int M) {
	list<long long int>P;
	P.push_back(2);
	P.push_back(3);
	for (int i = 5; i <= M; i += 6) {
		bool flag = true;
		for (auto j : P) {
			if (i%j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i);
		flag = true;
		for (auto j : P) {
			if ((i + 2) % j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i + 2);
	}
	return P;
}

long long int N, M, K, Q, W, H;
long long int ans;


int main() {
	ios::sync_with_stdio(false);
	long double a, b, c;
	cin >> a >> b >> c;
	cout << (a + b)*c / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
N, L = map(int, input().split())

aji = []
aji_abs = []
for i in range(1, N+1):
    aji.append(L+i-1)
    aji_abs.append(abs(L+i-1))

eat = aji_abs.index(min(aji_abs))

ans = 0
for i in range(N):
    if i != eat:
        ans += aji[i]

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

int main( void ){
    int n;
    scanf("%d",&n);
    int x = (n/1.08)+0.9999999999;
    int true_x = x*1.08;
    if(n == true_x){
        printf("%d\n", x);
    } else {
        printf(":(\n");
    }
    return 0;
}


Measured memory_bytes: 128
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, X);
    IN(ll, N);
    AIN(ll, p, N);
    vector<bool> b(201);
    FOR(a, p)
    {
        b[a] = true;
    }
    ll ans = 0;
    REP1(i, 200)
    {
        if (abs(X - i) < abs(X - ans) and not b[i])
        {
            ans = i;
        }
    }
    OUT(ans);
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000009
int dp(int l,int r,int cnt);
int n,k;
int v[109];
int memo[59][59][109];

int main(){
  for(int i=0;i<55;i++){
    for(int j=0;j<55;j++){
      for(int l=0;l<105;l++){
	memo[i][j][l]=-INF;
      }
    }
  }
  
  cin>>n>>k;
  for(int i=1;i<=n;i++){
    cin>>v[i];
  }
  
  cout<<dp(1,n,0)<<endl;
  return(0);
}

int dp(int l,int r,int cnt){
  int rec=0;
  if(memo[l][r][cnt]!=-INF)return memo[l][r][cnt];
  vector<int>vec;
  for(int i=1;i<l;i++){
    vec.push_back(v[i]);
    rec+=v[i];
  }
  for(int i=r+1;i<=n;i++){
    vec.push_back(v[i]);
    rec+=v[i];
  }
  sort(vec.begin(),vec.end());
  for(int i=0;i<min(k-cnt,(int)vec.size());i++){
    if(vec[i]<0)rec-=vec[i];
  }
  //cout<<l<<' '<<r<<' '<<rec<<endl;
  //cout<<l<<' '<<r<<endl;
			     
  //rec=max(rec,dp(l,r,cnt));
  if(r+1!=l&&cnt<k)rec=max(rec,dp(l+1,r,cnt+1));
  if(r+1!=l&&cnt<k)rec=max(rec,dp(l,r-1,cnt+1));
  return memo[l][r][cnt]=rec;
}


Measured memory_bytes: 1664
using System;
public class Hello
{
    public static void Main()
    {
        int i;
        double sum =0;
        int n = int.Parse(Console.ReadLine());
        string[] s = Console.ReadLine().Trim().Split(' ');
        for (i = 0; i < n; i++)
            sum += 1.0 / int.Parse(s[i]);
      
        Console.WriteLine(1.0/sum);
    }
}

Measured memory_bytes: 13140
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val (N, K) = sc.nextLine().split(" ")
    val n = N.toLong()
    val k = K.toLong()

    if (k == 0L) {
        println(n * n)
        return
    }

    var sum = 0L;
    for (b in (k + 1)..n) {
        sum += (n / b) * (b - k)
        val mod = n % b
        if (mod >= k) {
            sum += mod - k + 1
        }
    }
    println(sum)
}

Measured memory_bytes: 34168
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <math.h>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#define ll long long
#define vi vector<ll>
#define vs vector<string>
#define fr(i, k, n) for (ll i = k; i < n; i++)
#define rep(i, n) fr(i, 0, n)
#define alll(v) v.begin(), v.end()
#define mp(a, b) make_pair(a, b)
#define rdd(a) ll a; cin >> a
#define rrd rdd(a); rep(i, a)
//min({a,b,c,d})などの記法
using namespace std;
template <class X> void pr(X x) { cout << x << endl; }
template <class X> void prr(X x) { for (auto it : x) { cout << it << endl; } }

int main() {
    ll w,h;
    cin>>w>>h;
    vector<ll> p(w),q(h);
    rep(i, w) cin>>p[i];
    rep(i, h) cin>>q[i];
    sort(alll(p));
    sort(alll(q));
    ll s=0,t=0,sum=0,tmp=0;;
    rep(i, w+h){
        if ((s<w&&p[w-s-1]>q[h-t-1])||t==h) {
            sum+=p[w-s-1]*(t+1);
            tmp+=(t+1);
            s++;
        }else{
            sum+=q[h-t-1]*(s+1);
            t++;
            tmp+=(s+1);
        }
    }
    pr(sum);
    return 0;
}


Measured memory_bytes: 2424
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  map<int,int64_t> r;
  r[0]++;
  int s=0;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    s=(s+a)%m;
    r[s]++;
  }
  int64_t c=0;
  for(auto x:r)
    c+=x.second*(x.second-1)/2;
  cout<<c<<endl;
}

Measured memory_bytes: 7376
import itertools

N = int(input())
P = input().replace(' ', '')
Q = input().replace(' ', '')
A = []

for perm in itertools.permutations(range(1, N + 1), N):
    p = ""
    for per in perm:
        p += str(per)
    A.append(p)
A.sort()
print(abs(A.index(P) - A.index(Q)))

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

const int D=60;//転送回数　(2.^60>Kの最大値)
const int MAX_N=200005;//街の和の最大値
int to[D][MAX_N];//to[a][b] 街bから2のa乗テレポートした先を表す。

int main(){

    int n;ll k;
    cin>>n>>k;

    rep(i,n){
        cin >> to[0][i];//この時点でto[0][i]には街iの転送先が格納される
        to[0][i]--;//転送先の街を一律で-1　→ 0indexのため
    }

    rep(i,D-1)rep(j,n){
        to[i+1][j]=to[i][to[i][j]];//街jから、2^(i+1)回移動した街は、街to[i][j]（=街jから2^i回移動した街）から2^i移動した街と等しい
    }

    int v=0;
    for (int i=D-1;i>=0;--i){
        ll l = 1ll<<i;//1をi回左ビットシフト=2^i
        if(l<=k){
            v=to[i][v];//街vから2^i進んだ街
            k-=l;//進んだ文、進むべき回数を減らす
        }
    }

    cout<<v+1<<endl;//最初の0indexを戻す
    return 0;
}

Measured memory_bytes: 50500