akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] p = new int[n];
		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}
		sc.close();

		int ans = 0;
		for (int i = 1; i < n - 1; i++) {
			if ((p[i - 1] < p[i] && p[i] < p[i + 1])
					|| (p[i - 1] > p[i] && p[i] > p[i + 1])) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23892
def solve():
    N = int(input())
    S = input()
    add = ""
    left = 0
    right = 0
    for i in range(N):
        if S[i] == '(':
            left += 1

        else:
            right += 1
            if left < right:
                left += 1
                add += '('

    add2 = ""

    left = 0
    right = 0
    for i in range(N-1,-1,-1):
        if S[i] == '(':
            left += 1
            if left > right:
                right += 1
                add2 += ')'

        else:
            right += 1
    print(add+S+add2)

    
if __name__ == '__main__':
    solve()

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int minimum(vector<int> data){
  sort(data.begin(), data.end());
  int min_num = data.at(0);
  int max_num = data.at(data.size() - 1);
  int ans = min_num;
  int long long tmp = 10000000000;
  for (int j = min_num; j <= max_num; j++)
  {
    int sum = 0;
    for (int i = 0; i < data.size();i++)
    {
      sum =sum+ (data.at(i) - j)*(data.at(i) - j);
      //cout << sum << endl;
    }
    if(tmp>=sum){
      tmp = sum;
    }
  }
  return tmp;
}
int main(){
  int N;
  cin >> N;
  vector<int> data(N);
  for (int i = 0; i < N;i++){
    cin >> data.at(i);
  }
  int long long ans = minimum(data);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;


long n;
string s;

bool solve(bool first, bool second){
    bool place[n];
    long current = 0;

    place[0] = first;
    place[1] = second;

    while(current < n){
        if (current == 0){
            if (s[current] == 'o')
                place[n-1] = !(first ^ second);
            else
                place[n-1] = (first ^ second);
        }
        if (current == n-2){
            if (s[current] == 'o'){
                if (!(place[current-1] ^ place[current]) != place[current+1])
                    return false;
            }
            if (s[current] == 'x'){
                if ((place[current-1] ^ place[current]) != place[current+1])
                    return false;
            }
        }
        if (current == n-1){
            if(s[current] == 'o'){
                if(place[current] && (place[current-1] ^ place[0]))
                    return false;
                if((!place[current]) && (!(place[current-1] ^ place[0])))
                    return false;
            }else{
                if(place[current] && (!(place[current-1] ^ place[0])))
                    return false;
                if((!place[current]) && (place[current-1] ^ place[0]))
                    return false;
            }
        }
        if(current > 0 && current < n-2){
            if(s[current] == 'o'){
                if(place[current] == true)
                    place[current+1] = place[current-1];
                else
                    place[current+1] = !place[current-1];
            } else{
                if(place[current] == true)
                    place[current+1] = !place[current-1];
                else
                    place[current+1] = place[current-1];
            }
        }
        current++;
    }
    for(int i=0;i<n;i++){
        if(place[i] == true){
            cout << 'S';
        }else{
            cout << 'W';
        }
    }
    cout << endl;
    return true;
}

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

    bool place[n];
    for(int i= 0;i<n;i++){
        place[i] = true;
    }

    bool flag = false;
    //SS
    flag = solve(true,true);
    if (flag)
        return 0;
    //SW
    flag = solve(true,false);
    if (flag)
        return 0;
    //WS
    flag = solve(false,true);
    if (flag)
        return 0;
    //WW
    flag = solve(false,false);
    if (flag)
        return 0;
    cout << -1 << endl;
}

Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

string s;
vector<string> ans;
void dfs(int idx, int S) {
    if (idx == s.size()) {
        ans.push_back(s);
        return;
    }
    int t = s[idx] - 'a';
    if (S >> t & 1) {
        dfs(idx + 1, S);
    }
    if (!(S >> (t + 1) & 1)) {
        if (t != 25) {
            s[idx]++;
            dfs(idx + 1, S | 1 << (t + 1));
            s[idx]--;
        }
    }
}

int main() {
    while (cin >> s) {
        if (s == "#") break;
        ans.clear();
        dfs(0, 1);
        sort(all(ans));
        cout << ans.size() << endl;
        if (ans.size() > 10) {
            rep(i, 5) cout << ans[i] << endl;
            rep(i, 5) cout << ans[ans.size() + i - 5] << endl;
        } else
            for (auto e : ans) cout << e << endl;
    }
    return 0;
}

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

#define pb push_back
#define mp make_pair
#define inside sl<=l&&r<=sr
#define outside r<sl||sr<l
#define INF 1000000009
#define mod 1000000007
using namespace std;
typedef long long ll;

int n, k;
ll arr[102];
ll dp[101][100005];
ll presum[101][100005];

ll get(int i, int j){
	if (j == -1) return 0;
	else return presum[i][j];
}

int main(){
	//freopen("stl.gir", "r", stdin);
	
	cin >> n >> k;
	for (int i = 0; i < n; i++) cin >> arr[i];
	
	//for (int i = 0; i < n; i++) dp[i][0] = 1;
	for (int i = n-1; i >= 0; i--){
		for (ll j = 0; j <= k; j++){
			if (i == n-1){
				dp[i][j] = (j <= arr[i]);
			} else {
				ll ans = 0;
				dp[i][j] = get(i+1, j) - get(i+1, j-min(j, arr[i])-1);
				dp[i][j] = ((dp[i][j]%mod)+mod)%mod;
			}
		}
		presum[i][0] = dp[i][0];
		for (int j = 1; j <= k; j++){
			presum[i][j] = presum[i][j-1] + dp[i][j];
			presum[i][j] %= mod;
		}
	}
	
	cout << dp[0][k] << endl;
	
}

Measured memory_bytes: 157952
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

#include <stdio.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, k, n) for (int i = (k); i < (n); i++)
#define rrep(i, k, n) for (int i = (k); i >= (n); i++)
#define pb push_back
#define vec vector
#define ref(a) &(a)

const int mod = 1e9 + 7;

typedef long long ll;

using namespace std;

string s;

void solve() {
  int len = s.length();
  cout << s[0] << len - 2 << s[len - 1] << endl;
  return;
}

int main() {
  cin >> s;
  solve();
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double dd;
const int N = 1e5+5;
const dd eps = 1e-8;
const int mod = 1e9+7;

int n,m,q,a[55],b[55],c[55],d[55],qu[55],ans;

void dfs(int p,int x){
  qu[p] = x;
  if(p == n+1){
    int now = 0;
    for(int i = 1;i <= q;i++){
      if(qu[b[i]]-qu[a[i]] == c[i]) now += d[i];
    }
    ans = max(ans,now);
    return;
  }
  for(int i = x;i <= m;i++) dfs(p+1,i);
}

int main(){
  ios::sync_with_stdio(false);
  // freopen("input.txt","r",stdin);
  cin>>n>>m>>q;
  for(int i = 1;i <= q;i++){
    cin>>a[i]>>b[i]>>c[i]>>d[i];
  }
  dfs(1,1);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7, N = 1e5 + 7;

bool dp[N][3][3][3];

signed main()
{
	IO_OP;
	
	int n, a[3];
	cin >> n >> a[0] >> a[1] >> a[2];
	V<string> s(n);
	for(int i = 0; i < n; i++)
		cin >> s[i];
	if(a[0] + a[1] + a[2] != 2) {
		string ans;
		for(int i = 0; i < n; i++) {
			int x = s[i][0] - 'A', y = s[i][1] - 'A';
			if(a[x] > a[y]) swap(x, y);
			if(a[y] == 0) {
				cout << "No" << endl;
				return 0;
			}
			a[x]++, a[y]--;
			ans += (char) ('A' + x);
			ans += '\n';
		}
		cout << "Yes" << endl;
		cout << ans;
		return 0;
	} else {
		dp[0][a[0]][a[1]][a[2]] = 1;
		for(int i = 0; i < n; i++) {
			for(int x = 0; x < 3; x++) {
				for(int y = 0; y < 3; y++) {
					for(int z = 0; z < 3; z++) {
						if(x + y + z == 2 && dp[i][x][y][z]) {
							if(s[i] == "AB") {
								if(x) dp[i+1][x-1][y+1][z] = 1;
								if(y) dp[i+1][x+1][y-1][z] = 1;
							} else if(s[i] == "BC") {
								if(y) dp[i+1][x][y-1][z+1] = 1;
								if(z) dp[i+1][x][y+1][z-1] = 1;
							} else {
								if(x) dp[i+1][x-1][y][z+1] = 1;
								if(z) dp[i+1][x+1][y][z-1] = 1;
							}
						}
					}
				}
			}
		}
		for(int x = 0; x < 3; x++)
			for(int y = 0; y < 3; y++)
				for(int z = 0; z < 3; z++) {
					if(dp[n][x][y][z]) {
						cout << "Yes" << endl;
						string ans;
						for(int i = n-1; i >= 0; i--) {
							if(s[i] == "AB") {
								if(x && dp[i][x-1][y+1][z]) x--, y++, ans.PB('A');
								if(y && dp[i][x+1][y-1][z]) x++, y--, ans.PB('B'); 
							} else if(s[i] == "BC") {
								if(y && dp[i][x][y-1][z+1]) y--, z++, ans.PB('B');
								if(z && dp[i][x][y+1][z-1]) y++, z--, ans.PB('C');
							} else {
								if(x && dp[i][x-1][y][z+1]) x--, z++, ans.PB('A');
								if(z && dp[i][x+1][y][z-1]) x++, z--, ans.PB('C');
							}
						}
						reverse(ALL(ans));
						for(char c:ans) cout << c << endl;
						return 0;
					}
				}
		cout << "No" << endl;
	}
}





Measured memory_bytes: 9236
// Created by SAMAN on ۷/۳۱/۲۰۲۰ م..
//#pragma GCC target ("avx2")
#pragma GCC optimization ("O2")
#pragma GCC optimization ("unroll-loops") 
#include <iostream>
#include <algorithm>
#include <map>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue> 
#include <vector>
#include <set>
#include <fstream>
#include <cstdlib>
#include <iterator>
#include <cmath>
#include <ctime>
#include <iomanip>
//#warning not there YET
//#error hello
#define lint long long int
#define endl '\n'
#define kill(x) return cout<<x<<'\n', 0;
#define debug(x) cout << #x << " : " << x << '\n'
#define pb push_back
#define ppb pop_back
#define f first
#define s second
#define _ri [i<<1|1]
#define _le [i<<1]  
typedef long long  ll;
typedef long double ld;

using namespace std;

lint n,w;
const int maxn = 109;
const int nm = 1e6+900;
const int N = 1e5+ 37;
lint weight[nm],value[nm];
lint dp[maxn][nm];
/* 
dp[i][j] -> i taye aval jameshoon beshe j  min sum weight
dp[i][j] = min (dp[i-1][j-val[i]] + weight[i] , dp[i-1][j])
ans = dp[n][w] 
*/
int main(){
	//freopen("kn.txt","r",stdin);
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
	cin >> n >> w;
	for(int i = 1;i<=n;i++){
		cin >> weight[i];
		cin >> value[i];
	}

	for(lint i = 0;i <= n;i++){	
		for(lint j = 0;j<=N;j++){
			if(j == 0)
				dp[i][j] = 0;
			else if( i == 0)
				dp[i][j] = 2e12;
			else if(value[i] <= j){

				dp[i][j] = min(1LL * dp[i-1][j] ,1LL * dp[i-1] [j-value[i]] + weight[i]);
			}
			else	
				dp[i][j] = dp[i-1][j];
		}
	
	}
	ll maxi = -1;
	for(lint i = 0;i<=N;i++)
		if( dp[n][i] <= w)
			maxi = max(maxi,i);
	cout<<maxi;	
	
	// debug(dp[1][10]);	
//	debug(dp[0][0]);
//	debug(dp[0][10]);
//	debug(dp[1][10]);
//	debug(dp[2][22]);
}


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

int main(void){
    stack<int> S1;
    stack<pair<int, int> > S2;
    char ch;
    int sum = 0;
    for (int i = 0; cin >> ch; i++) {
        if (ch == '\\') S1.push(i);
        else if (ch == '/' && S1.size() > 0) {
            int j = S1.top();
            S1.pop();
            sum += i - j;
            int a = i - j;
            while (S2.size() > 0 && S2.top().first > j) {
                a += S2.top().second;
                S2.pop();
            }
            S2.push(make_pair(j, a));
        }
    }
    
    vector<int> ans;
    while (S2.size() > 0){
        ans.push_back(S2.top().second);
        S2.pop();
    }
    reverse(ans.begin(), ans.end());
    cout << sum << endl;
    cout << ans.size();
    for (int i = 0; i < ans.size(); i++) {
        cout << " " << ans[i];
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3204
val = [int(x) for x in input().split()]
array_a = []
array_b = []
res = True

for i in range(val[0]):
    array_a.append(input())
for j in range(val[1]):
    array_b.append(input())

for k in range(len(array_b)):
    if array_b[k] not in array_a[k]:
        res = False
        break
print("Yes" if res == True else "No")

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

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

		System.out.println(t + s);
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {

		return sc.next();
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}

		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;

int N, K;
int A[200010] = {};
int B[200010] = {};

signed main()
{
	cin >> N >> K;
	REP(i, N)
	{
		cin >> A[i];
	}

	ARY_SORT(A, N);

	int c = -1;
	int cnt = -1;
	REP(i, N)
	{
		if (A[i] != c)
		{
			cnt++;
			c = A[i];
		}
		B[cnt]++;
	}
	cnt++;

	ARY_SORT(B, cnt);

	int ans = 0;
	for (int i = 0; i < cnt - K; i++)
	{
		ans += B[i];
	}

	cout << ans << endl;
}



Measured memory_bytes: 3328
//17571@nith.ac.in @Ankit Verma
#include <bits/stdc++.h>
#define bolt ios::sync_with_stdio(false)
#define ull unsigned long long
#define ll long long
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
using namespace std;

int main() {



	bolt;
	cin.tie(nullptr);
	cout.tie(nullptr);
	int ar[] = {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};
	int n; cin >> n;
	n--;
	cout << ar[n] << endl;
	

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var line = Console.ReadLine();
        var list = line.Split(' ');

        var eight = int.Parse(list[0]);
        var ten = int.Parse(list[1]);

        var eightList = new List<int>();
        var tenList = new List<int>();
        for (var i = 1; i < 1001; i++)
        {
            var eightTax = Math.Truncate(i * 0.08);
            if (eightTax == eight)
            {
                eightList.Add(i);
            }

            var tenTax = Math.Truncate(i * 0.1);
            if (tenTax == ten)
            {
                tenList.Add(i);
            }
        }

        var ans = -1;
        foreach (var num in eightList)
        {
            if (tenList.Contains(num))
            {
                ans = num;
                break;
            }
        }

        Console.WriteLine(ans);

    }
}



Measured memory_bytes: 13268
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s, i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = s, i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = s; i < (n); ++i)
#define VFORS(i, s, n) for(int i = s; i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = s, i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = s, i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end());

using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;
using VLL = vector<ll>;
using VS = vector<string>;
using VC = vector<char>;
using VB = vector<bool>;

const int MOD = 1000000007;
const int INF = 1000000000;

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


int dx[4] = {-1, 0, 0, 1};
int dy[4] = {0, -1, 1, 0};
int h, w;
int cnt = 0; //白のマスの数
VS s;
vector<VI> d;

struct Point{
    int x, y;
    Point(int X, int Y) : x(X), y(Y){};
    //x:縦 y:横
};

void bfs(){
    queue<Point> que;//point, distance

    que.push(Point(0, 0));
    while(!que.empty()){
        Point p = que.front(); que.pop();
        REP(i, 4){
            int nx = p.x + dx[i], ny = p.y + dy[i];
            if(0 <= nx && nx < h && 0 <= ny && ny < w &&
               d[nx][ny] == -1 && s[nx][ny] == '.'){
                if(nx == h-1 && ny == w-1){
                    cout << cnt - d[p.x][p.y] - 1 << "\n"; return;
                }
                que.push(Point(nx, ny));
                d[nx][ny] = d[p.x][p.y] + 1;
            }
        }
    }
    cout << -1 << "\n";
    return;
}

int main(){
    cin >> h >> w;
    d.resize(h, VI(w, -1));
    s.resize(h);
    d[0][0] = 1;
    REP(i, h){
        cin >> s[i];
        REP(j, w){if(s[i][j] == '.') ++cnt;
        }
    }
    bfs();
    return 0;
}


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

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

  for(int i = 0; i <= (int)s.size(); i += 2){
    if(s[i] == '\0') break;
    cout << s[i];
  }

  cout << endl;

  return 0;

}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = 1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";

const int maxn = 50 + 5;
int n;
long long a[maxn];

void solve() {
    cin >> n;
    FOR(i, 0, n) cin >> a[i];
    long long ans = 0;
    while (*max_element(a, a + n) >= n) {
        long long tot = 0;
        FOR(i, 0, n) {
            tot += (a[i] - n + 1 + n - 1) / n;
        }
        long long cur = tot;
        FOR(i, 0, n) {
            long long used = min(cur, (a[i] - n + 1 + n - 1) / n);
            a[i] -= used * n;
            a[i] += tot - used;
            cur -= used;
        }
        ans += tot;
    }
    cout << ans << "\n";
}

int main() {
    int JUDGE_ONLINE = 1;
    if (fopen("in.txt", "r")) {
        JUDGE_ONLINE = 0;
        assert(freopen("in.txt", "r", stdin));
        //assert(freopen("out.txt", "w", stdout));
    }
    else {
        ios_base::sync_with_stdio(0), cin.tie(0);
    }
    solve();
    if (!JUDGE_ONLINE) {
        //cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    }
    return 0;
}

Measured memory_bytes: 256
a, b = input().split()
c = list(map(int, input().split()))
d = int(b)
e = sorted(c,reverse=True)
ans = 0

if d >= len(e):
  print("0")
else:
  if d == 0:
    for j in e:
      ans += j
    print(str(ans))
  else:
    for i in range(d):
      e[i] = 0
    for j in e:
      ans += j
    print(str(ans))



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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

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

    int here[300];
    fill(here,here+300,1);
    rep(i,m)
    {
        int a;
        cin >>a;
        here[a]=0;
    }

    queue<int> que;
    rep(i,n) que.push(i);

    int ans=0;
    while(que.size()>1)
    {
        int a=que.front(); que.pop();
        int b=que.front(); que.pop();

        if(here[a] && here[b]) ++ans;

        if(!here[a]) que.push(b);
        else que.push(a);
    }

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

Measured memory_bytes: 3116
#include<bits/stdc++.h>
#define lowbit(x) ((x)&(-(x)))
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 10;
string a, b, c;
bool check(string s)
{
    string t = s;
    reverse(s.begin(),s.end());
    return s == t;
}
int main()
{
    cin>>a;
    int n = a.length();
    b = a.substr(0, (n-1)/2);
    c = a.substr((n+3)/2 - 1, n - (n+3)/2 + 1);
    if(check(a) && check(b) && check(c))
        printf("Yes");
    else
        printf("No");
    return 0;
}


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

#define PI 3.14159265

int main(void)
{
    int side1, side2, deg;
    scanf("%d %d %d", &side1, &side2, &deg);

    double rad = deg * PI / 180;

    double area = side1 * side2 * sin(rad) / 2;
    double side3 = sqrt(pow(side1, 2) + pow(side2, 2)
                        - 2 * side1 * side2 * cos(rad));
    double round = side1 + side2 + side3;
    double height = side2 * sin(rad);

    printf("%f\n%f\n%f\n", area, round, height);

    return 0;
}

Measured memory_bytes: 632
#include "bits/stdc++.h"
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 ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

int main(){
    int a=0,b=0,c=0,d,n=0,x=0;
    VI m(3);
    string s,s1,s2;
    cin >> a >> b >> c; 
    while (d<c && b>0){
        if(a>b){
            break;
        }
        else {
        d++;
        b-=a;
        }
    }
    
    cout << d <<endl;
    return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 5003;
int n, k, a[N];
bitset <N> p[N], s[N];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n >> k;
	for (int i = 1; i <= n; i++) cin >> a[i];
	p[0][0] = 1;
	for (int i = 1; i <= n; i++)
		p[i] = p[i - 1] | (p[i - 1] << a[i]);
	s[n + 1][0] = 1;
	for (int i = n; i >= 1; i--)
		s[i] = s[i + 1] | (s[i + 1] << a[i]);
	int res = n;
	for (int i = 1; i <= n; i++) {
		int l = k - 1;
		for (int j = k - 1; j >= 0; j--) {
			if (p[i - 1][j] == 0) continue;
			while (l + j >= k || s[i + 1][l] == 0)
				l--;
			if (j + l >= k - a[i]) {
				res--;
				break;
			}
		}
	}
	cout << res;
}


Measured memory_bytes: 9856
S = input()
White = '10'*(len(S)//2)+'1'*(len(S)%2)
Black = '01'*(len(S)//2)+'0'*(len(S)%2)
WD = len([X for X in map(set,zip(S,White)) if len(X)==2])
BD = len([X for X in map(set,zip(S,Black)) if len(X)==2])
print(min(WD,BD))

Measured memory_bytes: 31992
#include<bits/stdc++.h>
using namespace std;
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pb push_back
#define mp make_pair
int main()
{
    io;
    int i,n,p;
    cin>>n;
    map<string,set<pair<int,int>,greater<pair<int,int> > > >m;
    string s;
    for(i=0;i<n;i++)
    {
        cin>>s>>p;
        m[s].insert(mp(p,i+1));
    }
     map<string,set<pair<int,int>,greater<pair<int,int> > > >::iterator it;
     for(it=m.begin();it!=m.end();it++)
      {
       set<pair<int,int>,greater<pair<int,int> > >::iterator itt;
       for(itt=it->second.begin();itt!=it->second.end();itt++)
            cout<<(*itt).second<<"\n";
      }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int W,H,x,y,r,a,b,c,d;
    scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
    a = x + r ;
    b = y + r ;
    c = x - r ;
    d = y - r ;
    if (a <= W && b<= H && c >= 0 && d >= 0 ) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    
    
    
    
    return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n, a[100];

int main(){
	while (cin >> n&&n){
		REP(i, n)cin >> a[i];
		int sum = 32;
		int co = 0;
		while (sum){
			sum -= (sum - 1) % 5;
			cout << sum << endl;
			if(sum>a[co])sum -= a[co];
			else sum = 0;
			cout << sum << endl;
			co++;
			if (co == n)co = 0;
		}
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000


int main(){
	
	int N;
	cin>>N;
	
	vector<int> a(N);
	for(int i=0;i<N;i++){
		cin>>a[i];
		a[i]--;
	}
	
	int now = 0;
	
	for(int i=0;i<1000000;i++){
		if(now==1){
			cout<<i<<endl;
			return 0;
		}
		now = a[now];
	}
	
	cout<<-1<<endl;
	
    return 0;
}



Measured memory_bytes: 640
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		List<Integer> list = Arrays.asList(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);

		int k;
		k = scan.nextInt();

		k = k - 1;

		System.out.println(list.get(k));
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


Measured memory_bytes: 23764
#include <stdio.h>
int main()
{
 
  int S,result1,result2,result3,result4;

  scanf("%d",&S);

  result1=S/3600;
  result2=S%3600;
  result3=result2/60;
  result4=result2%60;


 printf("%d:%d:%d\n",result1,result3,result4);

 return 0;

}

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  
  if (a + b == c || a + c == b || b + c == a) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
    
  return 0;
}

Measured memory_bytes: 3600
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int noc=sc.nextInt(),len=noc,i=0,n=0;
		int[] a = new int[noc];
		while (noc-->0) a[i++]=sc.nextInt();
		Arrays.sort(a);
		for (i=0; i<len-2; i++) {
			for (int j=i+1; j<len-1; j++) {
				for (int k=j+1; k<len; k++) {
					if ((a[i]+a[j])>a[k]) {
						if ((a[i]!=a[j])&&(a[j]!=a[k])&&(a[i]!=a[k])) n++;
					}
				}
			}
		}
		System.out.println(n);
		sc.close();	
	}

	public static void main(String args[]) {
		solve();
	}

}


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

int main(void){
	long int A,B,K;

	cin >> A >> B >> K;


	if(A > K){
		cout << A-K << " " << B << "\n";
	}else if(A + B >K){
		cout  << "0" << " " << B-(K-A) << "\n";
	}else{
		cout << "0" << " " << "0" << "\n";
	}

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int n;
long long t;

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

long long lcm(long long u, long long v)
{
    long long h = gcd(u,v);
    return(u*(v/h));
}

int main()
{
    while(scanf("%d",&n)!=EOF)
    {
        long long ans = 1;
        for(int i=1;i<=n;i++)
        {
            scanf("%lld",&t);
            ans = lcm(ans,t);
        }
        printf("%lld\n",ans);
    }
}


Measured memory_bytes: 128
def main():
    A, B, H, M = (int(i) for i in input().split())
    from math import radians, sqrt, cos
    rH = radians(0.5*(H*60+M))
    rM = radians(6*M)
    ans = sqrt(A**2 + B**2 - 2*A*B*cos(rM - rH))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9504
#include <iostream>
#include <climits>

struct Node {
	int key;
	int lazy;
	Node() {}
};

void eval(Node* segtree, int index, int l, int r)
{
	if (segtree[index].lazy < INT_MAX) {
		segtree[index].key = segtree[index].lazy;
		if (l+1 < r) {
			segtree[2*index+1].lazy = segtree[index].lazy;
			segtree[2*index+2].lazy = segtree[index].lazy;
		}
		segtree[index].lazy = INT_MAX;
	}
}

void update(Node* segtree, int s, int t, int x, int l, int r, int index, int time)
{
	eval(segtree, index, l, r);
	
	if (t<l || r<=s) return;
	else if (s<=l && r<=t+1) {
		//segtree[index].key = x;
		segtree[index].lazy = x;
		eval(segtree, index, l, r);
	}
	else {
		int mid = (l + r) / 2;
		update(segtree, s, t, x, l, mid, 2*index+1, time);
		update(segtree, s, t, x, mid, r, 2*index+2, time);
		segtree[index].key = std::min(segtree[2*index+1].key, segtree[2*index+2].key);
	}
}

int find(Node* segtree, int s, int t, int l, int r, int index)
{
	if (t<l || r<=s) return INT_MAX;
	
	eval(segtree, index, l, r);
	
	if (s<=l && r<=t+1) {
		return segtree[index].key;
	}
	else {
		int mid = (l + r) / 2;
		int x = find(segtree, s, t, l, mid, 2*index+1);
		int y = find(segtree, s, t, mid, r, 2*index+2);
		return std::min(x, y);
	}
}

int main()
{
	int n; std::cin >> n;
	int seg_size = 1;
	for (; seg_size < n; seg_size<<=1);
	Node* segtree = new Node[2*seg_size-1];
	for (int i=0; i<2*seg_size-1; i++) {
		segtree[i].key = INT_MAX;
		segtree[i].lazy = INT_MAX;
	}
	
	int q; std::cin >> q;
	for (int i=0; i<q; i++) {
		int op, s, t, x;
		std::cin >> op;
		if (op==0) {
			std::cin >> s >> t >> x;
			update(segtree, s, t, x, 0, seg_size, 0, i);
		}
		else {
			std::cin >> s >> t;
			std::cout << find(segtree, s, t, 0, seg_size, 0) << std::endl;
		}
	}
	delete[] segtree;
	return 0;
}
	



Measured memory_bytes: 4956
package main

import "fmt"

func main() {
	var s, t string
	fmt.Scan(&s, &t)

	for i := 0; i < len(s); i++ {
		if s[len(s)-i:len(s)]+s[0:len(s)-i] == t {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 512
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int aplace = 0;
		int zplace = 0;
		for(int i=0; i<s.length()-1; i++){
			if(s.charAt(i)=='A'){
				aplace = i;
				break;
			}
		}
		for(int i=s.length()-1; i>0; i--){
			if(s.charAt(i)=='Z'){
				zplace = i;
				break;
			}
		}
		System.out.println(zplace-aplace+1);
	}
}

Measured memory_bytes: 27092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  ll n;
  cin >> n;
  vl a(n);
  for (auto&& i : a) {
    cin >> i;
  }

  ll ans = 0;
  rep(i, n-1) {
    if (a[i+1] > a[i]) {
      ans++;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;



int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
	
	string s;
	int i,a[2]={0};
	cin>>s;
	for(i=0;i<s.length();i++){
		if(i%2==0&&s[i]!='1')a[0]++;
		if(i%2==1&&s[i]!='0')a[0]++;
	}
	for(i=0;i<s.length();i++){
		if(i%2==1&&s[i]!='1')a[1]++;
		if(i%2==0&&s[i]!='0')a[1]++;
	}
	cout<<min(a[0],a[1])<<endl;
	
	
	
	
	
//////////////////////////////////////////////////////
	return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(int i = (int)k; i < (int)n; i++)
#define rrep(i, n) RREP(i, n, 0)
#define RREP(i, n, k) for(int i = (int)n-1; i > (int)k-1; i--)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define ALL(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " " << x << endl;

typedef long long ll;

const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
const int dx8[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy8[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

bool comp(const pair<int,int>&a, const pair<int,int>&b) {
    return a.first < b.first;
}

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

    int N, T;
    cin >> N >> T;
    vector<pair<ll, int> > t;
    rep(i,N) {
        ll ti;
        cin >> ti;
        t.push_back(make_pair(ti,1));
        t.push_back(make_pair(ti+T,-1));
    }

    sort(ALL(t));

    ll ans=0;
    int num=0;
    int cur=0;
    rep(i,t.size()) {
        if(num>0) ans += t[i].first -cur;
        cur = t[i].first;
        num += t[i].second;
    }

    // rep(i,t.size()) {
    //     debug(t[i].first);
    //     debug(t[i].second);
    // }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 10092
#include<stdio.h>
int i,n;
double x,y,z;
int seito[100],kekka[100];

void BMI(double x,double y,int i)
{
	z = x/(y*y);
	if(z >= 25)
	{
		kekka[i] = 1;
		return ;
	}
	return ;
}


int main()
{
	while(scanf("%d,%lf,%lf",&seito[i],&x,&y)!=EOF){
		BMI(x,y,i);
		if(kekka[i] == 1)
		{
			printf("%d\n",seito[i]);
		}
		else
		{
		}
		i++;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long n,m=1;
    cin>>n;
    for(long long i=2;i*i<=n;i++){
        if(n%i==0){
            m=i;
        }
    }
    cout<<(m+(n/m)-2);
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int N, t[100005], x[100005], y[100005];

int main(void) {

	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> t[i]; cin >> x[i]; cin >> y[i];
	}

	bool ans = true;

	for (int i = 1; i <= N; i++) {
		if (t[i] - t[i - 1] >= abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]) && ((t[i] - t[i - 1]) - abs(x[i] - x[i - 1]) - abs(y[i] - y[i - 1])) % 2 == 0) {}
		else { ans = false; }
	}

	if (ans) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }

	//system("pause");
	return 0;
}

Measured memory_bytes: 1408
//
//  main.cpp
//  ervb
//
//  Created by Kanak Gautam on 21/04/20.
//  Copyright © 2020 Kanak Gautam. All rights reserved.
//
 
 
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <utility>
#define pb push_back
#define mk make_pair
#define endl "\n"
#define mod 1000000007
using namespace std;
typedef long long int lli;
typedef long double ld;
priority_queue <lli, vector<lli>, greater<lli> > ti;
vector <lli> p[300005],q[300005],b(300005,0),f(300005,0);
lli vis[200005];
map <pair<lli,lli>,lli> mp;
set<pair<lli, lli> > s;
set<lli> st;
map<lli,lli> np,v;
queue<lli> qy;
lli gcd(lli a, lli b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
      
}
lli bpow(lli a, lli b) {
    lli res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%mod;
        a = (a * a)%mod;
        b >>= 1;
    }
    return res%mod;
}
lli fact(lli i)
{
    f[0]=1;
    for(lli k=1;k<=i;k++)
    {
        (f[k]=f[k-1]*k)%=mod;
    }
    return f[i];
}
lli isprime(lli n)
{
    if(n==1)
        return 0;
    for(lli i=2;i<=sqrt(n);i++)
        if(n%i==0)
            return 0;
    return 1;
}
bool cmp(lli i,lli j)
{
    return p[i].size()<p[j].size();
}
void sieve()
{
    for(lli i=2;i<=5000000;i++)
    {
        if(b[i]==0)
        {
        for(lli j=2;i*j<=5000000;j++)
        {
            b[i*j]=1;
        }
        }
    }
}
int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    lli h,w,m;cin>>h>>w>>m;
    map<lli,lli> r;
    map<lli,lli> c;
    map<pair<lli,lli>,lli>a;
    lli x,y,mx1=0,mx2=0;
    for(lli i=1;i<=m;i++)
    {
        cin>>x>>y;
        a[{x,y}]++;
        r[x]++;c[y]++;
        a[{x,y}]=1;
        if(r[x]>=mx1)
        {
            mx1=r[x];
            p[mx1].pb(x);
        }
        if(c[y]>=mx2)
        {
            mx2=c[y];
            q[mx2].pb(y);
        }
    }
    lli ans=0;
    for(auto u:p[mx1])
    {
        for(auto v:q[mx2])
        {
            //cout<<u<<" "<<v<<endl;
            if(a[{u,v}]==0)
            {
                ans=r[u]+c[v];break;
            }
            else
            {
                ans=max(ans,r[u]+c[v]-a[{u,v}]);
            }
        }
    }
    cout<<ans<<endl;
}



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

using namespace std; 
#define fr for(int i = 0;i < n;i++)
#define pb push_back
void printVector(set<int>x){
    for(auto i:x){
        cout << i << " ";
    }
    cout << endl;
}


int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);

    char c;
    long long int n,x,k;
    cin >> n >> k;
    vector<int>input;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        input.push_back(x);
    }
    sort(input.begin(),input.end());
    x = 0;
    for (int i = 0; i < k; i++)
    {
        x += input[i];
    }
    cout << x << endl;
    
    

}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,x,y,f;
    scanf("%d%d%d%d",&n,&k,&x,&y);
    long long int ans;
    if(n<=k)
    {
        ans=x*n;
    }
    else if(n>k)
    {
        ans=x*k;
        f=n-k;
        ans+=f*y;
    }
    printf("%lld",ans);
    return 0;
}


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

typedef long long ll;
using namespace std;

#define REP(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define sum(v) accumulate(ALL(v),0)

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

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> v(n);
    rep(i, n) {
        cin>>v[i];
    }
    vector<int> w = v;
    sort(ALL(w));
    int diff = 0;
    dbg(v);
    dbg(w);
    rep(i,v.size()){
        if(v[i]!=w[i]){
            diff ++;
        }
        if(diff>2){
            YES(false);
            return 0;
        }
    }
    if(diff==0||diff==2){
        YES(true);
    }
    return  0;
}


Measured memory_bytes: 256
// c++11 ~
#include <iostream>
#include <string>
#include <set>
using namespace std;

int position(char x)
{
    set<char> left;
    left.insert('q');
    left.insert('a');
    left.insert('z');
    left.insert('w');
    left.insert('s');
    left.insert('x');
    left.insert('e');
    left.insert('d');
    left.insert('c');
    left.insert('r');
    left.insert('f');
    left.insert('v');
    left.insert('t');
    left.insert('g');
    left.insert('b');

    // cout << "x is " << x << endl;
    if(left.count(x) == 1)
    {
        // cout << "left" << endl;
        return -1;
    }
    else
    {
        // cout << "right" << endl;
        return +1;
    }
}

int main()
{
    string s;
    int count = 0;
    int pos;

    while (true)
    {
        count =0;
        cin >> s;
        if (s == "#") break;
        
        
        for(size_t i = 0; i < s.size(); i++)
        {
            if (i==0) {
                pos = position(s[i]);
            }
            else
            {
                if (position(s[i]) == pos)
                {
                    count += 0;
                    pos *= 1;
                }
                else
                {
                    count += 1;
                    pos *= -1;
                } 
            }
        }
        
        cout << count << endl;
    }
    return 0;
}


Measured memory_bytes: 3052
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define df 0


int main(){
  int n,m,deg[51]={},i,a;
  scanf("%d%d",&n,&m);
  for(i=0;i<2*m;i++){
    scanf("%d",&a);
    deg[a]++;
  }
  for(i=1;i<=n;i++)
    printf("%d\n",deg[i]);
  return 0;
}


/// confirm df==0 ///

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mxn= 5e4+5;
// check for forloop
// intialize variable
// overflow
// go for easy solution
#define mod 1000000007
ll INF = 1000000000000000005LL;
//#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main(){
    rishabh();
    ll n,T;
    cin>>n>>T;
    ll arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    ll ans=0, t=0;
    for(int i=0;i<n;i++){
        if(arr[i]>t){
            ans=ans+T;
            t=arr[i]+T;
        }
        else {
            ans=ans+(arr[i]+T-t);
            t=arr[i]+T;
        }
        //cout<<ans<<' ';
    }
    cout<<ans;
}

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

#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,a,b)     for(int i=b;i>=a;i--)

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

    cin>>n;
    cout<<"ABC"<<n;
}




Measured memory_bytes: 256
// https://atcoder.jp/contests/agc002/tasks/agc002_a

#include <bits/stdc++.h>
using namespace std;

int main()
{
    long a, b;
    cin >> a >> b;

    if (a > 0)
    {
        cout << "Positive" << endl;
    }
    else if (a == 0)
    {
        cout << "Zero" << endl;
    }
    else
    {
        if (b >= 0)
        {
            cout << "Zero" << endl;
        }
        else
        {
            cout << ((b - a + 1) & 1 ? "Negative" : "Positive") << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3536