akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.function.DoubleToIntFunction;

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

        // Listに標準入力の値を取得
        LinkedList<String> scList = new LinkedList<>();
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            while (br.ready()) {
                String[] lineArray = br.readLine().split(" ");
                Arrays.<String>stream(lineArray).forEach(s -> scList.add(s.trim()));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

        int n = Integer.parseInt(scList.pop());

        HashMap<String, Integer> bossIdMap = new HashMap<>();
        for (String bossId: scList) {
            if (!bossIdMap.containsKey(bossId)) {
                bossIdMap.put(bossId, 1);
            } else {
                bossIdMap.put(bossId, bossIdMap.get(bossId) + 1);
            }
        }

        for (int i = 1; i <= n; i++) {
            int res = 0;
            if (bossIdMap.containsKey(String.valueOf(i))) {
                res = bossIdMap.get(String.valueOf(i));
            }
            System.out.println(res);
        }
    }
}

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

int main() {
  string S;
  cin >> S;
  int N = S.size();
  auto f = [&](string s) {
    string t = s;
    reverse(t.begin(), t.end());
    return s == t;
  };
  cout << ((f(S) && f(S.substr((N + 3) / 2 - 1))) ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 3584
#pragma GCC optimize("03")
#include <bits/stdc++.h>
#define ll long long 
#define fi first
#define se second

//CHECK FOR N = 1 OR OTHER DUMB TESTS 

using namespace std;

int n, a[100100];
set<int> s;
map<int, int> mp;

int tr(int x, int y, int z) {
	map<int, int> m;
	int v[100100];
	v[1] = x;
	v[2] = y;
	v[3] = z;
	m[x]++;
	m[y]++;
	m[z]++;
	for (int i = 4; i <= n; i += 3) {
		v[i] = x;
		v[i + 1] = y;
		v[i + 2] = z;
		if (i <= n)
			m[x]++;
		if (i + 1 <= n)
			m[y]++;
		if (i + 2 <= n)
			m[z]++;
	}
	 
	bool ch = 1;
	v[0] = v[n];
	v[n + 1] = v[1];
	for (int i = 1; i <= n; i++)
		if (v[i] != (v[i - 1] ^ v[i + 1]))
			ch = 0;
	
	if (m[x] != mp[x] || m[y] != mp[y] || m[z] != mp[z])
		ch = 0;
	
	return ch;
}

int main() {
	//ifstream cin("tst.in");
	//ofstream out("tst.out");
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		mp[a[i]]++;
		s.insert(a[i]);
	}
	if ((int) s.size() > 3)
		return cout << "No", 0;
	
	int f = 0;
	for (auto it1 : s)
		for (auto it2 : s)
			for (auto it3 : s)
				f |= tr(it1, it2, it3);
				
	if (f)
		cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 7808
#include <stdio.h>
int main(void){
  int row,column,i,j,rblack[100]={0},cblack[100]={0};//rblack,cblack各行・列の＃数を数える配列
  char matrix[100][100];
  scanf("%d %d",&row,&column);//行数、列数を入力
  for(i=0;i<row;i++){//
    for(j=0;j<column;j++){
      scanf(" %c",&matrix[i][j]);//
      if(matrix[i][j] == '#'){//
        rblack[i] += 1;//
        cblack[j] += 1;//
      }
    }
  }
  for(i=0;i<row;i++){//
    for(j=0;j<column;j++){
      if(rblack[i] != 0 && cblack[j] != 0){//
        printf("%c",matrix[i][j]);//
      }
    }
    if(rblack != 0){//
      printf("\n");//
    }
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
const double pi = acos(-1);

int main() {
    double a, b, h, m;
    cin >> a >> b >> h >> m;

    double x = abs(5.5*m - 30.0*h);
    double y = min(x, 360.0-x);

    y = y*pi/180.0;

    double z = a*a + b*b - 2.0*a*b*cos(y);

    double ans = sqrt(z);
    
    exout(ans);
    re0;
}

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

a_100 = N // 100
N = N - (100* a_100)

a_10 = N // 10
N = N - (10 * a_10)

a_1 = N // 1
N = N - a_1

if a_1 == 3:
    print('bon')
elif a_1 == 0 or a_1 == 1 or a_1 == 6 or a_1 == 8:
    print('pon')
else:
    print('hon')


Measured memory_bytes: 9180
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>

using std::list;
using std::max;
using std::min;
using std::vector;

int main()
{
  int a, b;
  scanf("%d%d", &a, &b);
  if(8 < a || 8 < b) {
    puts(":(");
  } else {
    puts("Yay!");
  }
  return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
using namespace std;
int main(){
	int N, M,sumT=0;
	int T[1000], P[1000], X[1000],ans[1000];
	cin >> N;
	for (int i = 0; i < N; i++){
		cin >> T[i];
		sumT = sumT + T[i];
	}
	cin >> M;
	for (int j = 0; j < M; j++){
		cin >> P[j]>> X[j];
		ans[j] = sumT - T[P[j] - 1] + X[j];
	}
	for (int j = 0; j < M; j++){
		cout << ans[j] << endl;
	}
	return 0;
}

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

int main() {
  int n;
  while(cin >> n && n) {
    int g[n][n];
    fill(g[0], g[n], 0);
    int x, y;
    x = n/2;
    y = n/2+1;
    g[y][x] = 1;
    for(int i = 1; i < n*n; ++i) {
      x = (x+1)%n;
      y = (y+1)%n;
      while(g[y][x] != 0) {
        x = (x+n-1)%n;
        y = (y+1)%n;
      }
      g[y][x] = i+1;
    }

    for(int i = 0; i < n; ++i) {
      for(int j = 0; j < n; ++j) {
        printf("%4d", g[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(n==0)break;
		int max=0,num;
		for(int i=0,p,d1,d2;i<n;++i){
			cin>>p>>d1>>d2;
			if(max<d1+d2){
				num=p;
				max=d1+d2;
			}
		}
		cout<<num<<" "<<max<<endl;
	}
	return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll n;
  string s;
  cin >> n >> s;
  if (n%2==1) { cout << "No" << endl; return 0; }
  rep(i,n/2){
    if (s[i] != s[i+n/2]) {
      cout << "No" << endl;
      return 0;
    }
  }
    cout << "Yes" << endl;
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    set<string> st;
    REP(i,n){
        string s;
        cin >> s;
        st.insert(s);
    }
    ANS(st.size());
    return 0;
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n, x; cin >> n >> x;
    int a[n];
    for(int i=0;i<n;i++) cin >> a[i];
    ll ans = abs(a[0] - x);
    for(int i=1;i<n;i++){
        ans = gcd(ans, abs(a[i] - x));
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
  static int n;
  static long x;
  static long[] a;

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

    n = sc.nextInt(); x = sc.nextInt();
    a = new long[n];
    for(int i = 0; i < n; i++){
      a[i] = sc.nextInt();
    }

    boolean[] flag = new boolean[n];
    for(int i = 0; i < n - 1; i++){
      if(a[i] + a[i + 1] > x){
        flag[i] = flag[i + 1] = true;
      }
    }

    long sum = 0;
    int s = 0;
    while(s < n){
      while(s < n && !flag[s]){
        ++s;
      }
      int t = s + 1;
      while(t < n && flag[t]){
        ++t;
      }
      if(t - s == 2){
        sum += a[s] + a[s + 1] - x;
      }
      else{
        for(int i = s; i < t - 1; i++){
          if(a[i] + a[i + 1] > x){
            long diff = Math.min(a[i + 1], a[i] + a[i + 1] - x);
            a[i + 1] -= diff; sum += diff;
          }
          if(a[i] + a[i + 1] > x){
            long diff = Math.min(a[i], a[i] + a[i + 1] - x);
            a[i] -= diff; sum += diff;
          }
        }
      }
      s = t;
    }

    System.out.println(sum);
  }
}


Measured memory_bytes: 46876
#include<bits/stdc++.h>
using namespace std;
long long N, A, B;
int main(void)
{
	cin >> N >> A >> B;
	if ((B - A) % 2)
	{
		cout << min(A, N - B + 1) + (B - A - 1) / 2 << endl;
	}
	else
	{
		cout << (B - A) / 2 << endl;
	}
	return 0;
}

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

using namespace std;

int pre[100001], val[100001], prime[100001];

int main(void){
  for(int i = 2; i < 100001; ++i){
    for(int j = 2 * i; !prime[i] && j < 100001; j+=i){
      prime[j] = 1;
    }
  }
  for(int i = 3; i < 100001; ++i){
    val[i] = (!prime[i] && !prime[int((i + 1) / 2)]);
    pre[i] = val[i] + pre[i - 1];
  }
  int n, l, r;
  cin >> n;
  for(int i = 0; i < n; ++i){
    cin >> l >> r;
    cout << pre[r] - pre[l - 1] << "\n";
  }
}


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

int main(){
    string s;
    cin >> s ;
    if (s == "hi" || s == "hihi" || s == "hihihi" || s == "hihihihi" || s == "hihihihihi"){
        cout  << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()
struct revran {
  const i64 b, e;
  struct iter {
    i64 i;
    constexpr iter(const i64 i) noexcept: i(i) {}
    void operator++() noexcept { --i; }
    constexpr i64 operator*() const noexcept { return i; }
    constexpr bool operator!=(const iter x) const noexcept { return i != x.i; }
  };
  constexpr revran(const i64 e) noexcept: b(0), e(e) {}
  constexpr revran(const i64 b, const i64 e) noexcept: b(b), e(e) {}
  constexpr iter begin() const noexcept { return iter(e - 1); }
  constexpr iter end() const noexcept { return iter(b - 1); }
};

struct ran {
  const i64 b, e;
  struct iter {
    i64 i;
    constexpr iter(const i64 i) noexcept: i(i) {}
    void operator++() noexcept { ++i; }
    constexpr i64 operator*() const noexcept { return i; }
    constexpr bool operator!=(const iter x) const noexcept { return i != x.i; }
  };
  constexpr ran(const i64 e) noexcept: b(0), e(e) {}
  constexpr ran(const i64 b, const i64 e) noexcept: b(b), e(e) {}
  constexpr iter begin() const noexcept { return iter(b); }
  constexpr iter end() const noexcept { return iter(e); }
  constexpr revran rev() const noexcept { return revran(b, e); }
};

constexpr ran rn0(const i64 e) noexcept { return ran(e); }
constexpr ran rn0(const i64 b, const i64 e) noexcept { return ran(b, e); }
constexpr ran rn1(const i64 e) noexcept { return ran(1, e + 1); }
constexpr ran rn1(const i64 b, const i64 e) noexcept { return ran(b, e + 1); }

int main() {
  int N;
  cin >> N;
  vector<i64> a(N);
  for(int i: ran(N)) cin >> a[i];
  vector<i64> b = a;
  sort(all(b));
  if(a == b) {
    cout << 0 << endl;
    return 0;
  }
  i64 cnt = 0;
  for(int i: ran(N)) {
    if(a[i] == b[i]) cnt++;
  }
  int Q;
  cin >> Q;
  for(int i: ran(Q)) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    if(a[x] == b[x]) cnt--;
    if(a[y] == b[y]) cnt--;
    swap(a[x], a[y]);
    if(a[x] == b[x]) cnt++;
    if(a[y] == b[y]) cnt++;
    if(cnt == N) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}



Measured memory_bytes: 7616
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <cmath>
#include <memory.h>
#include <iomanip>
#include <cassert>
using namespace std;

#define maxn 100002
#define FOR(i, l, r) for (int i=l; i<=r; ++i)
#define FORD(i, r, l) for (int i=r; i>=l; --i)
#define REP(i, r) for (int i=0; i<(int)r; ++i)
#define REPD(i, r) for (int i=(int)r-1; i>=0; --i)
#define fi first
#define se second
#define mk make_pair
#define nil NULL
#define y0 y902
#define y1 y232
#define x0 x92
#define x1 x899
#define next asdfa
#define sz size
#define Debug(X) {cerr << #X << " = " << X << '\n';}
#define PR(A, n) {cerr << #A << " = "; FOR(i, 1, n) cerr << A[i] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; REP(i, n) cerr << A[i] << ' '; cerr << '\n';}
typedef long long ll;
typedef double db;
typedef pair<db, db> dd;
typedef pair<int, int> ii;
typedef vector<int> vi;
const int inf = 1e9;
const ll MOD = 1000000007;
template<class T> int getbit(T x, int pos) {return (x>>(pos-1)) & 1;}
template<class T> void turn_on(T &x, int pos) {x = x | ((T)1<<(pos-1));}
template<class T> void turn_off(T &x, int pos) {x = x & ~((T)1<<(pos-1));}
template<class T> T sqr(T a) {return a*a;}

int n, a[maxn], pos[maxn];
ll fact[maxn];

ll POW(int n, int k) {
    if (k==0) return 1;
    ll tmp = POW(n, k/2);
    if (k%2==0) return tmp*tmp%MOD;
    return tmp*tmp%MOD*n%MOD;
}

ll C(int n, int k) {
    if (n<k) return 0;
    return fact[n]*POW(fact[k]*fact[n-k]%MOD, MOD-2)%MOD;
}

int main() {
    //freopen("11.inp", "r", stdin);
    //freopen("", "w", stdout);
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    FOR(i, 1, n+1) cin >> a[i];
    int x, y;
    FOR(i, 1, n+1) {
        if (pos[a[i]]!=0) {
            x = pos[a[i]];
            y = i;
            break;
        }
        pos[a[i]] = i;
    }
    fact[0] = 1;
    FOR(i, 1, n+1) fact[i] = (fact[i-1]*i)%MOD;
    //Debug(POW(24, 5));
    //Debug((POW(24, 11)%11));
    FOR(k, 1, n+1) {
        cout << (C(n+1, k) - C(x+n-y, k-1) + MOD*MOD)%MOD << '\n';
    }
}



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

int main(){
  int x;
  cin >> x;
  int a[100005];
 
  /* 判定フラグ */
  int flag;
 
  /* 素数かどうかを判定 */
  for(int i=x;i<=100003;++i ) {
    flag = 0;
    for(int j=2;j<i;++j ){
      if(i%j==0 ) {
        flag = 1;
        break;
      }
    }
    /* 判定結果を出力 */
    if(flag==0){
      cout << i << endl;
      break;
    }
  }
  return 0;
}



Measured memory_bytes: 256
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

A = [False, False, False]
B = [False, False, False]
C = [False, False, False]

N = int(input())



for i in range(N):
    t = int(input())
    for j in range(3):
        if t == a[j]:
            A[j] = True
        if t == b[j]:
            B[j] = True
        if t == c[j]:
            C[j] = True

if (A[0] and A[1] and A[2]) or (B[0] and B[1] and B[2]) or (C[0] and C[1] and C[2]) or (A[0] and B[0] and C[0]) or (A[1] and B[1] and C[1]) or (A[2] and B[2] and C[2]) or (A[0] and B[1] and C[2]) or (A[2] and B[1] and C[0]):
    print('Yes')
else:
    print('No')



Measured memory_bytes: 3064
#include <stdio.h>
int main(void)
{
    int a, b,c;
    scanf("%d %d %d", &a, &b,&c);
    if ((a < b) && (b < c))
    {
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 2048
using System;
using System.Collections.Generic;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Text.RegularExpressions;
using System.Threading;

namespace Atcoder
{
	class Program
	{
		//string s = Console.ReadLine();
		//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
		//int H = intArray[0];
		//int W = intArray[1];
		//int N = int.Parse(Console.ReadLine());
		//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());
		//Boolean ok = false;
		//List<int> dp = Enumerable.Repeat(個数, 値).ToList();

		//Console.WriteLine(ans);
		//Console.WriteLine("Yes");
		//Console.WriteLine("No");
		//Console.ReadKey();
		//Console.WriteLine(cnt);

		//string[] strArray = Console.ReadLine().Split(' ').ToArray();
		//string S = strArray[0];
		//string T = strArray[1];
		static void Main(string[] args)
		{
			int N = int.Parse(Console.ReadLine());
			int[] L = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
			int cnt = 0;
			if(N < 3)
            {
				Console.WriteLine(0);
				return;
			}

			for (int i = 0; i < N - 2; i++)
			{
				for (int j = i + 1; j < N - 1; j++)
				{
					if(L[i] == L[j])
						continue;
					for (int k = j + 1; k < N; k++)
					{
						if (L[i] == L[k] || L[j] == L[k])
							continue;
						int max = Math.Max(Math.Max(L[i], L[j]), L[k]);
						int sum = L[i] + L[j] + L[k];
						if (L[i] + L[j] > L[k]
						 && L[i] + L[k] > L[j]
						 && L[j] + L[k] > L[i])

							cnt++;
					}
				}
			}
			Console.WriteLine(cnt);
		}

		/// <summary>
		/// 回文
		/// </summary>
		/// <param name="Target"></param>
		/// <param name="len"></param>
		/// <returns></returns>
		static bool Palindrome(string Target , int len)
        {
			bool yes = true;

			for(int i = 0;i < len; i++)
            {
				if(Target[i] != Target[len - 1 - i])
                {
					yes = false;
					break;
                }
            }
			return yes;
        }

		/// <summary>
		/// アナグラム
		/// </summary>
		/// <param name="word1"></param>
		/// <param name="word2"></param>
		/// <returns></returns>
		static bool IsAnagramOf(string word1, string word2)
		{
			return word1.OrderBy(x => x).SequenceEqual(word2.OrderBy(x => x));
		}
		/// <summary>
		/// 最小公倍数
		/// </summary>
		/// <param name="a"></param>
		/// <param name="b"></param>
		/// <returns></returns>
		public static BigInteger Lcm(BigInteger a, BigInteger b)
		{
			return a * b / Gcd(a, b);
		}

		/// <summary>
		/// 最大公約数
		/// </summary>
		/// <param name="a"></param>
		/// <param name="b"></param>
		/// <returns></returns>
		public static BigInteger Gcd(BigInteger a, BigInteger b)
		{
			if (a < b)
				// 引数を入替えて自分を呼び出す
				return Gcd(b, a);
			while (b != 0)
			{
				var remainder = a % b;
				a = b;
				b = remainder;
			}
			return a;
		}
	}
}

Measured memory_bytes: 28192
H = gets.to_i
W = gets.to_i
N = gets.to_i

def counts
  if H >= W
    if N % H == 0
      N / H
    else
      (N / H) + 1
    end
  else
    if N % W == 0
      N / W
    else
      (N / W) + 1
    end
  end
end

puts counts


Measured memory_bytes: 3836
#include<cstdio>

int main(){
	int A, B, K, N;
	scanf("%d %d %d", &A,&B,&K);
	for(int i = 1; i <= K;i++)
		if(i % 2 == 1){
			if(A%2 == 1){
				int e = A/2;
				A = e;
				B += e;
				}
			else{
				int e = A/2;
				A = e;
				B += e;}
		}
		else{
			if(B%2 == 1)
			{	int e = B/2;
				B = e;
				A += e;
				}
			else{
				int e = B/2;
				B = e;
				A += e;
				}}
	printf("%d %d", A,B);
			
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int x,y,a,b,c,p[100005],q[100005],r[100005],ans;
void solve(){
    cin>>x>>y>>a>>b>>c;
    rep(i,0,a) cin>>p[i];
    rep(i,0,b) cin>>q[i];
    rep(i,0,c) cin>>r[i];
    sort(p,p+a);
    reverse(p,p+a);
    sort(q,q+b);
    reverse(q,q+b);
    sort(r,r+c);
    reverse(r,r+c);
    vi v;
    rep(i,0,x) v.pb(p[i]);   
    rep(i,0,y) v.pb(q[i]);
    rep(i,0,min(x+y,c)) v.pb(r[i]);
    sort(all(v));
    reverse(all(v));
    rep(i,0,x+y) ans+=v[i];
    cout<<ans<<endl;   
}
 
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 8560
#include <iostream>


using namespace std;
int main(int argc,char **argv)
{
  int N;

  cin >> N;

  unsigned long long power=1;
  for(int i=0;i<N;i++)
  {
    power = power * (i+1) % 1000000007 ;
  }
  cout << power << endl;

  return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vchar = vector<char>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  ll a, b, c;
  cin >> a >> b >> c;
  cout << (4 * a * b < (c - a - b) * (c - a - b) && c - a - b > 0 ? "Yes" : "No") << endl;
}

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

#define abs(a) ((((a) < 0)) ? (-(a)) : (a))
#define min(a,b) (((a) > (b)) ? (b) : (a))
int main(void) {
    int64_t H,W;
    vector<vector<int64_t>> v(10,vector<int64_t>(10));
    int64_t wall;
    int64_t sum = 0;
    cin >> H >> W;

    for(int i=0;i<10;i++) {
        for(int j=0;j<10;j++) {
            cin >> v[i][j];
        }
    }

    for(int k=0;k<10;k++) {
        for(int i=0;i<10;i++) {
            for(int j=0;j<10;j++) {
                v[i][j] = min(v[i][j],v[i][k]+v[k][j]);
            }
        }
    }

    for(int i=0;i<H;i++) {
        for(int j=0;j<W;j++) {
            cin >> wall;
            if(abs(wall) != 1) {
                sum += v[wall][1];
            }
        }
    }
    
    cout << sum << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<int> A(N);
    vec<ll> cnt(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
        A[i]--;
        cnt[A[i]]++;
    }
    ll ans = 0;
    for(int i=0;i<N;i++) ans += cnt[i]*(cnt[i]-1)/2;

    auto add = [&](int x){
        ans -= cnt[x]*(cnt[x]-1)/2;
        cnt[x]++;
        ans += cnt[x]*(cnt[x]-1)/2;
    };

    auto del = [&](int x){
        ans -= cnt[x]*(cnt[x]-1)/2;
        cnt[x]--;
        ans += cnt[x]*(cnt[x]-1)/2;
    };

    for(int i=0;i<N;i++){
        del(A[i]);
        cout << ans << "\n";
        add(A[i]);
    }
}

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

using namespace std;

int main(){
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int ax = x2-x1;
	int ay = y2-y1;
	cout << (x2 - ay) << " " << (y2 + ax) << " " << (x1 - ay) << " " << (y1 + ax) << endl;
	return 0;
}


Measured memory_bytes: 256
nums = input()
charas = input()
 
num = nums.split()
 
temp = int(num[1]) - 1
 
chara_1 = charas[ : temp]

chara_2 = charas[temp + 1 : ]
 
new_chara = charas[temp].lower()
 
print(chara_1 + new_chara + chara_2)

Measured memory_bytes: 2940
#X,Y,A,B,C = map(int, input().split())
#p = [int(x) for x in input().split()]
#q = [int(x) for x in input().split()]
#r = [int(x) for x in input().split()]
#p.sort(reverse = True)
#q.sort(reverse = True)
#r.sort(reverse = True)
#newp = p[:X]
#newq = q[:Y]
#lis = newp + newq
#lis.sort(reverse = True)
#s = sum(lis)
#for i in range(len(r)):
#    if lis[-i-1] < r[i]:
#        s = s - lis[-i-1] + r[i]
#    else:
#        break
#print(s)

X,Y,A,B,C = map(int, input().split())
p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]
p.sort(reverse = True)
q.sort(reverse = True)
p = p[:X]
q = q[:Y]
ans = p+q+r
ans.sort(reverse = True)
print(sum(ans[:X+Y]))


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

 int main(){
   int a,b;
   cin >> a >> b;
   if ((a+b)%2 == 0){
     cout << (a+b)/2 << endl;
   }
   else {
     cout << ((a+b)/2)+1 << endl;
   }
 }

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

field = [['.' for _ in range(W)] for _ in range(H)]
for _ in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        for i in range(H):
            for j in range(0, x):
                field[i][j] = '#'
    elif a == 2:
        for i in range(H):
            for j in range(x, W):
                field[i][j] = '#'
    elif a == 3:
        for i in range(0, y):
            for j in range(W):
                field[i][j] = '#'
    else:
        for i in range(y, H):
            for j in range(W):
                field[i][j] = '#'

ans = 0
for i in range(H):
    for j in range(W):
        if field[i][j] == '.':
            ans += 1
print(ans)


Measured memory_bytes: 42224
from collections import deque

dq = deque()
n, q = map(int, input().split())
for _ in range(n):
    name, time = input().split()
    dq.append((name, int(time)))
t = 0
while dq:
    name, time = dq.popleft()
    if time > q:
        dq.append((name, time - q))
        t += q
    else:
        t += time
        print(name, t)



Measured memory_bytes: 12528
/*
    AOJ Volume0 0001

        List of Top 3 Hills
        There is a data which provides heights (in meter) of mountains. The data is only for ten mountains.
        Write a program which prints heights of the top three mountains in descending order.


        Input
            Height of mountain 1
            Height of mountain 2
            Height of mountain 3
             .
             .
            Height of mountain 10



        Constraints
            0 ≤ height of mountain (integer) ≤ 10,000



        Output
            Height of the 1st mountain
            Height of the 2nd mountain
            Height of the 3rd mountain



        Sample Input 1
            1819
            2003
            876
            2840
            1723
            1673
            3776
            2848
            1592
            922

        Output for the Sample Input 1
            3776
            2848
            2840

        Sample Input 2
            100
            200
            300
            400
            500
            600
            700
            800
            900
            900
    
        Output for the Sample Input 2
            900
            900
            800
    
*/

#include <iostream>


namespace aoj
{
    class bigger_int_storage
    {
    private:
        int _size;
        int* _buffer;

    public:
        bigger_int_storage(int size);
        ~bigger_int_storage();
        void push(int value);
        int operator[](int idx)const;
    };
}



int main(void)
{
    aoj::bigger_int_storage bs(3);

    for(int i=0; i<10; ++i)
    {
        int input;
        std::cin >> input;
        bs.push(input);

        /*

        // confirming : 
        std::cout << std::endl;
        std::cout << "[current] -----" << std::endl;
        std::cout << bs[0] << std::endl;
        std::cout << bs[1] << std::endl;
        std::cout << bs[2] << std::endl;
        */
    }

    std::cout << bs[0] << std::endl;
    std::cout << bs[1] << std::endl;
    std::cout << bs[2] << std::endl;

    return 0;
}




aoj::bigger_int_storage::bigger_int_storage(int size)
{
    _size = size;
    _buffer = new int[_size];
    for(int i=0; i<_size; ++i)
        _buffer[i] = -2147483648;
}

aoj::bigger_int_storage::~bigger_int_storage()
{
    delete[] _buffer;
}

void aoj::bigger_int_storage::push(int value)
{
    for(int i=0; i<_size; ++i)
    {
        if(value > _buffer[i])
        {
            for(int j=_size-1; j>i; --j)
                _buffer[j] = _buffer[j-1];

            _buffer[i] = value;
            break;
        }
    }
}

int aoj::bigger_int_storage::operator[](int idx)const
{
    return _buffer[idx];
}




Measured memory_bytes: 3112
N, T = map(int, input().split())
c = [input().split() for _ in range(N)]
num = 9999

for i in range(N):
  if int(c[i][1]) <= T:
    num = min(num, int(c[i][0]))

if num == 9999:
  print('TLE')
else:
  print(num)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//2次元累積和を返す関数
vector<vector<ll>> csum2d(vector<vector<ll>> a){
	vector<vector<ll>> res(a.size() + 1, vector<ll>(a[0].size() + 1, 0));
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[0].size(); j++)
		{
			res[i + 1][j + 1] = res[i][j + 1] + res[i + 1][j] - res[i][j] + a[i][j];
		}
	}
	return res;
}

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	vector<double> b(n);
	rep(i, n) b[i] = 1.0 / a[i];
	double ans = 0;
	rep(i, n) ans += b[i];
	cout << fixed << setprecision(10) << 1.0 / ans << endl;
	return 0;
}



Measured memory_bytes: 256
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container;
import std.numeric, std.math;
import core.bitop;

string my_readln() { return chomp(readln()); }

long mod = pow(10, 9) + 7;
long moda(long x, long y) { return (x + y) % mod; }
long mods(long x, long y) { return ((x + mod) - (y % mod)) % mod; }
long modm(long x, long y) { return (x * y) % mod; }

void main()
{
	auto tokens = my_readln.split;
	auto N = tokens[0].to!long;
	auto A = my_readln;
	auto B = my_readln;
	auto C = my_readln;

	ulong ans;
	foreach (i; 0..N)
	{
		ulong cnt;
		if (A[i] != B[i]) ++cnt;
		if (A[i] != C[i]) ++cnt;
		if (B[i] != C[i]) ++cnt;

		if (cnt == 2) ++ans;
		else if (cnt == 3) ans += 2;
	}

	writeln(ans);
	stdout.flush();
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif



signed main() {

    int n;
    cin>>n;
    string s;
    cin>>s;

    int ans=0;
    for(int i=1; i<=n-2; i++){
        set<int> se;
        for(int j=0;j<i;j++) se.insert(s[j]);
        int t=0;
        for(int j=i;j<n;j++)
            if(se.find(s[j])!=se.end()){ t++; se.erase(s[j]);}
        ans=max(ans,t);
    }
    cout << ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
a, b, c, x, y = map(int, input().split())
mp = min(x, y)
hp = mp * c * 2
hp += (x - y) * a if x > y else (y - x) * b if x < y else 0
print(min(a * x + b * y, hp, max(x, y) * c * 2))


Measured memory_bytes: 2940
//#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);
    string s;
    cin >> s;
    int l = s.length();
    vvll dp(l+1,vll(13,0));
    reverse(s.begin(), s.end());
    if(s[0]=='?'){
        REP(i,10){
            dp[1][i]=1;
        }
    }else{
        int tmp = s[0]-'0';
        dp[1][tmp] = 1;
    }
    
    int base = 1;
    for(int i=1;i<l;i++){
        base = base * 10;
        base %= 13;
        if(s[i]=='?'){
            for(int k = 0;k<10;k++){
                int now = k;
                for(int j=0;j<13;++j){
                    dp[i+1][(j+now*base)%13]+=dp[i][j];
                    dp[i+1][(j+now*base)%13]%=mod;
                }
            }
        }else{
            int now = s[i]-'0';
            for(int j=0;j<13;++j){
                dp[i+1][(j+now*base)%13]+=dp[i][j]; 
                dp[i+1][(j+now*base)%13]%=mod;
            }
        }
    }
    cout << dp[l][5] << endl;
    return 0;
}

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

int dp[2001][2001];
int mod = 1000000007;

int nCr(int n, int r)
{
       if(n==r) return dp[n][r] = 1;
       if(r==0) return dp[n][r] = 1;
       if(r==1) return dp[n][r] = n;
       if(dp[n][r]) return dp[n][r];
	   dp[n][r] = (nCr(n-1,r) % mod + nCr(n-1,r-1) % mod) % mod;
       return dp[n][r];
}

int main() {
	
	int n, k;
	cin >> n >> k;
	
	for(int i=1; i<=k; i++){
		if(i > (n - k + 1) ){
			puts("0");
		}else{
			int ans;
			ans = ((ll) nCr(n-k+1, i) * nCr(k-1, i-1)) % mod;
			cout << ans << endl; 
		}
	}

	return 0;
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n;
long long k;

// 答えがx以下かどうか
bool judge(long long x) {
    x ++;
    for (int i=0; i<n-1; ++i) {
        x -= (x + k - 1) / k;
    }
    return x >= 1;
}

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

    ll l = -1;
    ll r = 1e18;

    while (r - l > 1) {
        ll mid = (l + r) / 2;
        if (judge(mid)) {
            r = mid;
        } else {
            l = mid;
        }
    }
    cout << r << endl;

    return 0;
}


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

class Solver extends Main{
	Solver(){
	}
}

class Main{
	public static void main(String[] args) throws FileNotFoundException{
		Scanner sc=new Scanner(System.in);
		int[] prm=readlI(sc," ");
		int n=prm[0];
		int m=prm[1];
		long[][] data=new long[n][2]; 
		for(int i=0; i<prm[0]; i++){
			data[i]=readlL(sc," ");
		}
		long base=data[0][0];
		List<Long> a=new ArrayList<Long>();
		List<Long> b=new ArrayList<Long>();
		List<Long> c=new ArrayList<Long>();
		List<Long> d=new ArrayList<Long>();
		for(int i=0; i<data.length; i++){
			if(data[i][0]==base){
				a.add(data[i][1]);
			}else if(data[i][0]==base+1){
				b.add(data[i][1]);
			}else if(data[i][0]==base+2){
				c.add(data[i][1]);
			}else if(data[i][0]==base+3){
				d.add(data[i][1]);
			}
		}
		Collections.sort(a);Collections.reverse(a);a.add(0,(long)0);
		Collections.sort(b);Collections.reverse(b);b.add(0,(long)0);
		Collections.sort(c);Collections.reverse(c);c.add(0,(long)0);
		Collections.sort(d);Collections.reverse(d);d.add(0,(long)0);
		for(int i=1; i<a.size(); i++) a.set(i,(long)a.get(i)+a.get(i-1));
		for(int i=1; i<b.size(); i++) b.set(i,(long)b.get(i)+b.get(i-1));
		for(int i=1; i<c.size(); i++) c.set(i,(long)c.get(i)+c.get(i-1));
		for(int i=1; i<d.size(); i++) d.set(i,(long)d.get(i)+d.get(i-1));
		long val=0;
		long wgt=0;
		long total=0;
		for(int i=0; i<a.size(); i++){
			for(int j=0; j<b.size(); j++){
				for(int k=0; k<c.size(); k++){
					for(int l=0; l<d.size(); l++){
						val=a.get(i)+b.get(j)+c.get(k)+d.get(l);
						wgt=base*i+(base+1)*j+(base+2)*k+(base+3)*l;
						if(wgt<=(long)m && total<val){
							total=val;
						}
					}
				}
			}
		}
		puts(total);
	}	
	
	//utility
	static int[] readlI(Scanner sc, String dl){
		return Arrays.stream(sc.nextLine().trim().split(dl)).mapToInt(Integer::parseInt).toArray();
	}
	static long[] readlL(Scanner sc, String dl){
		return Arrays.stream(sc.nextLine().trim().split(dl)).mapToLong(Long::parseLong).toArray();
	}
	static int readI(Scanner sc){
		return Integer.parseInt(sc.nextLine().trim());
	}
	static String[] readlS(Scanner sc, String dl){
		return sc.nextLine().trim().split(dl);
	}
	static String resadS(Scanner sc){
		return sc.nextLine().trim();
	}
	@SuppressWarnings("unchecked")
	static <T> void puts(T... args){
		for(int i=0; i<args.length-1; i++){
			System.out.printf("%s ",args[i]);
		}
		System.out.println(args[args.length-1]);
	}
	static void puts(int[] ary){
		for(int i=0; i<ary.length-1; i++){
			System.out.printf("%d ",ary[i]);
		}
		System.out.println(ary[ary.length-1]);
	}
	static void puts(long[] ary){
		for(int i=0; i<ary.length-1; i++){
			System.out.printf("%d ",ary[i]);
		}
		System.out.println(ary[ary.length-1]);
	}
	static void tblSort(int[][] tbl){
		Arrays.sort(tbl, new Comparator<int[]>(){
			@Override
			public int compare(int[] a, int[] b){
				if(a[0]==b[0]){
					return b[1]-a[1];
				}else{
					return b[0]-a[0];
				}
			}
		});
	}
}


Measured memory_bytes: 29808
#include<iostream>
#include<cstdio>
#include<cstring>

inline bool check_min(int a,int &b){return a<b?b=a,1:0;}
inline bool check_max(int a,int &b){return a>b?b=a,1:0;}

const int N=101000,INF=1000000007;

int Abs(int x){return x<0?-x:x;}

int s[N],pre[N],suf[N];
int n;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",s+i);
	for(int i=1;i<=n;i++)
		pre[i]=pre[i-1]+Abs(s[i]-s[i-1]);
	for(int i=n;i;i--)
		suf[i]=suf[i+1]+Abs(s[i]-s[i+1]);

	for(int i=1;i<=n;i++)
		printf("%d\n",pre[i-1]+suf[i+1]+Abs(s[i-1]-s[i+1]));
	return 0;
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main()
{
    ft
    int t,i,j,n,m,l=0,r=INT_MIN;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>m;
        r=max(r,m);
        l+=m;
    }
    l-=r;
    (r<l)? cout<<"Yes\n":cout<<"No\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

template <class T>
struct Edge {
    int from, to;
    T cost;
    Edge(int from = -1, int to = -1, T cost = 1) : from(from), to(to), cost(cost){};

    bool operator<(const Edge<T>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<T>& e) const { return this->cost > e.cost; }
};

template <class T = int>
class Graph {
public:
    explicit Graph(int N = 0) : size(N) { path.resize(size); }
    void span(int u, int v, T cost = 1) { path[u].push_back(Edge<T>(u, v, cost)); }
    std::vector<Edge<T>> operator[](int v) const { return path[v]; }

    int size;
    std::vector<std::vector<Edge<T>>> path;
};

template <class T = int>
class TopologicalSort {
public:
    Graph<T> graph;
    std::vector<bool> visited;
    std::vector<int> order, id;
    // トポロジカルソート後において、頂点vはid[v]番目

    void dfs(int v) {
        if (visited[v]) return;
        visited[v] = true;
        for (const auto& e : graph[v]) dfs(e.to);
        order.push_back(v);
    }

    explicit TopologicalSort(const Graph<T>& graph) : graph(graph) {
        visited.assign(graph.size, false);
        for (int v = 0; v < graph.size; ++v) dfs(v);
        std::reverse(order.begin(), order.end());

        id.resize(graph.size);
        for (int i = 0; i < graph.size; ++i) id[order[i]] = i;
    }
};

int main() {
    int N, M;
    std::cin >> N >> M;
    Graph<> graph(N);
    for (int i = 0; i < M; ++i) {
        int u, v;
        std::cin >> u >> v;
        graph.span(u, v);
    }

    TopologicalSort<> ts(graph);
    for (int v = 0; v < N; ++v) {
        for (const auto& e : graph[v]) {
            if (ts.id[e.from] > ts.id[e.to]) {
                std::cout << 1 << std::endl;
                return 0;
            }
        }
    }
    std::cout << 0 << std::endl;
    return 0;
}



Measured memory_bytes: 3208
A = []
for i in range(3):
    A += [[int(i) for i in input().split()]]

N = int(input())

b=[]
ans = [[False]*3,[False]*3, [False]*3]
for i in range(N):
    b += [int(input())]

#print(ans)
#print(A)
for i in range(N):
    num = b[i]
    for j in range(3):
        for k in range(3):
            if A[j][k]==num:
                ans[j][k] = True;
                
#print(ans)

answer = ans[0][0] and ans[1][1] and ans[2][2]
answer = answer or (ans[0][2] and ans[1][1] and ans[2][0])

for i in range(3):
    answer = answer or (ans[i][0] and ans[i][1] and ans[i][2])
    answer = answer or (ans[0][i] and ans[1][i] and ans[2][i])

if answer:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 999999999
#define MINF -999999999
#define ALL(n) n.begin(),n.end()
#define MP make_pair
#define F first
#define S second

int main() {
	int n, a;
	ll ans = 0;
	cin >> n;
	REP(i, n) {
		cin >> a;
		ans += a - 1;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
let () =
  let _ = Scanf.sscanf (input_line stdin) "%d" (fun a -> a) in
  let s = input_line stdin in
  let n = ref 0 in
  let prev_c = ref ' ' in 
  let _ = String.iter (fun c -> if !prev_c  <> c then n := !n + 1; prev_c := c) s
  in
  print_int !n;
  print_newline ()


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

using ll = long long ;

int main(void){
    // Here your code !
    ll a,b,c;
    cin >> a >> b >> c;
    
    for(int i = 0; i < 100000; i++){
        
        if(a % 2 || b%2 || c%2){
            cout << i << endl;
            return 0;
        }
        ll d = (b + c)/2,e = (a+c)/2,f = (a+b)/2;
        a = d; b = e; c = f;
        
    }
    
    cout << -1 << endl;
    
}


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

#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)

// policy-based
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;	


using namespace std;


typedef long long ll; // int or long long
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;

/*
typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
*/
 
const ll MAX = 2e6+10;
const ll inf = 1e9;

ll a[MAX],b[MAX];
int main(){
	fastio;
	ll n,m,k,ans = 0;
	cin>>n>>m>>k;
	f(i,1,n+1) cin>>a[i];
	f(i,1,n+1) a[i]+=a[i-1];
	
	f(i,1,m+1) cin>>b[i];
	f(i,1,m+1) b[i]+=b[i-1];
	
	f(i,0,n+1){
		ll sum = k -a[i];
		if (sum<0) break;
		ll ini = 0,fin = m;
		while(ini<fin){
			ll mid = (ini+fin+1)/2;
			if(b[mid]>sum) fin = mid -1;
			else ini = mid;
		}
//		cout<< a[i] <<" " << b[ini]<<endl;
		ans = max(ans,i+ini);
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

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

using ll = long long;

ll memo[3001][3001];
ll sum[3001];
int N;
int a[3000];

void init()
{
  cin >> N;
  rep(i, N) {
    cin >> a[i];
    sum[i+1] = sum[i] + a[i];
    rep(j, N+1) {
      if (i == j) continue;
      memo[i][j] = -1;
      memo[j][i] = -1;
    }
  }
}

ll dfs(int s, int t)
{
  ll& res = memo[s][t];
  if (res != -1) return res;
  ll x = a[s] + (sum[t] - sum[s+1]) - dfs(s+1, t);
  ll y = a[t-1] + (sum[t-1] - sum[s]) - dfs(s, t-1);
  return res = max(x, y);
}

int main()
{
  init();
  ll x = dfs(0, N);
  ll y = sum[N] - x;
  cout << x - y << endl;
}

Measured memory_bytes: 70784
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String inputStr=sc.nextLine();
		char[] aStr=new char[inputStr.length()];
		int i = 0;
		for(int j = 0;j < inputStr.length();j++){
			aStr[j]=inputStr.charAt(j);
			if(aStr[j] == '+'){
				i = i + 1;
			}else{
				i = i - 1;
			}
		}
		// 出力
		System.out.println(i);
	}
}

Measured memory_bytes: 21204