akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N,D; cin >> N >> D;
    res = (N+2*D)/(2*D+1);
    return res;
}
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    //solve<ll>(0);
    cout << fixed << setprecision(12) << solve<ll>() << endl;
    return 0;
}

Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String args[]) throws Exception {
		MyScanner sc = new MyScanner();
		String s = sc.next();
		
		if(s.equals("ABC"))
			System.out.println("ARC");
		else
			System.out.println("ABC");
		
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

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

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}

Measured memory_bytes: 32724
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

bool fn_is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

bool isOK(int index, int key, vector<ll>& a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key, vector<ll>& a) {
    int ng = -1;
    int ok = a.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key, a)) ok = mid;
        else ng = mid;
    }
    return ok;
}

struct UnionFind {
    vector<int> r;

    UnionFind(int N) {
        r = vector<int>(N, -1);
    }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) {
        return -r[root(x)];
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

int main()
{
    int a,b,c; cin >> a >> b >> c;
    cout << min(b/a, c) << endl;
}


Measured memory_bytes: 3556
function main(input){
    inputI = input.split('\n');
    number = parseInt(inputI[0]);
    inputA = inputI[1].split(' ');
    out='APPROVED';
    check=0;

    for(i=0;i<number;i++){
        check=parseInt(inputA[i]);
        if(check%2==0){
            if(check%3!=0 && check%5!=0){
                out='DENIED';
            }
        }
    }

    console.log(out);

}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;

#define fi first
#define se second
#define endl '\n' 
#define pb push_back
#define INF 0x3f3f3f3f
#define mkp make_pair
#define mem(v, k) memset(v, k, sizeof(v))
#define forn(i,n) for(int i=0; i<n; ++i)
#define for1(i,b) for(int i=1; i<=b; ++i)
#define forr(i,b) for (int i=b-1; i>=0; --i)
#define sz(s) int(s.size())
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()

const ll mod = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	int n;
	cin >> n;
	
	int ans = 0;
	
	for(int i = 1, j = n-1; i < j; i++, j--)
		ans++;
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define mp make_pair
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (1<<30)
#define LLINF (1LL<<60)
//#define MOD 998244353
#define MOD 1000000007
#define PI 3.14159265358979
using ll = long long;
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<a*b;
    return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>

int partition(int *, int , int);
int main()
{
  int n, A[100000], i, j, q;
  scanf("%d", &n);  // ??°???A??????????????¨?????´??°n
  for(i = 0; i < n; i++)
    scanf("%d", &A[i]);  // ??°???A???n??????????´?

  q = partition(A, 0, n-1);
  for(i = 0; i < n; i++)
    {
      if(i == q) printf("[");
      printf("%d", A[i]);
      if(i == q) printf("]");
      if(i != n-1) printf(" ");
      if(i == n-1) printf("\n");
    }
  return 0;
}

int partition(int *A, int p, int r)
{
  int x, i, j, tmp;

  x = A[r];
  i = p-1;
  for(j = p; j < r; j++)
    {
      if(A[j] <= x)
	{
	  i = i+1;
	  tmp = A[i];
	  A[i] = A[j];
	  A[j] = tmp;
	}
    }
  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;
  return i+1;
}

Measured memory_bytes: 996
#include <stdio.h>
#include <string.h>
#include <vector>
#include <numeric>
#include <algorithm>
#include <functional>
#include <string>
#include <math.h>

using namespace std;


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

  int max_sum = 0;

  max_sum += min(a, k);

  k -= a;

  if (k > 0) {
    k -= min(b, k);
  }

  if (k > 0) {
    max_sum -= min(c, k);
  }

  printf("%d", max_sum);


  return 0;
}


Measured memory_bytes: 1712
#ABC077 C - Snuke Festival
from bisect import bisect_left, bisect_right
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

N = ni()
A = nl()
B = nl()
C = nl()

A.sort()
C.sort()

ans = 0

for i in range(N):
    t = 0
    tt = 0
    t = bisect_left(A,B[i])
    tt = N-bisect_right(C,B[i])
    ans += t*tt

print(ans)

Measured memory_bytes: 22720
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define endl '\n'
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int dist[100001],a,b;
vector<int>vec[100001];
int solve(int idx){
    int &cur=dist[idx];
    if(cur!=-1)
        return cur;
    cur=0;
    for(int i=0;i<vec[idx].size();i++){
        cur=max(cur,1+solve(vec[idx][i]));
    }
    return cur;
}
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    memset(dist,-1,sizeof(dist));
    cin>>a>>b;
    for(int i=0;i<b;i++){
        int x,y;
        cin>>x>>y;
        vec[x].push_back(y);
    }
    int s=0;
    for(int i=1;i<=a;i++)
        s=max(s,solve(i));
    cout<<s;
}

Measured memory_bytes: 8192
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<complex>
#include<numeric>
#include<unordered_map>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define PRIM 3
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

unordered_map<Int, Int> dist;

void solve(){
    Int n, a, b, c, d;
    dist.clear();
    cin >> n >> a >> b >> c >> d;
    priority_queue<P, vector<P>, greater<P>> pq;
    dist[n] = 0;
    pq.push(P(0,n));
    Int ans = LINF;
    while(!pq.empty()){
        P tmp = pq.top();pq.pop();
        Int from = tmp.second;
        if(dist[from] < tmp.first)continue;
        if((double)d * from < 1e18)
            ans = min(ans, dist[from] + d * from);
        vector<P> nxt;
        if(from % 2 == 0)nxt.push_back({from / 2, a});
        if((from+1) % 2 == 0)nxt.push_back({(from+1) / 2, a+d});
        if((from-1) % 2 == 0)nxt.push_back({(from-1) / 2, a+d});
        if(from % 3 == 0)nxt.push_back({from / 3, b});
        if((from+1) % 3 == 0)nxt.push_back({(from+1) / 3, b+d});
        if((from+2) % 3 == 0)nxt.push_back({(from+2) / 3, b+d+d});
        if((from-1) % 3 == 0)nxt.push_back({(from-1) / 3, b+d});
        if((from-2) % 3 == 0)nxt.push_back({(from-2) / 3, b+d+d});
        if(from % 5 == 0)nxt.push_back({from / 5, c});
        if((from+1) % 5 == 0)nxt.push_back({(from+1) / 5, c+d});
        if((from+2) % 5 == 0)nxt.push_back({(from+2) / 5, c+d+d});
        if((from+3) % 5 == 0)nxt.push_back({(from+3) / 5, c+d+d+d});
        if((from+4) % 5 == 0)nxt.push_back({(from+4) / 5, c+d+d+d+d});
        if((from-1) % 5 == 0)nxt.push_back({(from-1) / 5, c+d});
        if((from-2) % 5 == 0)nxt.push_back({(from-2) / 5, c+d+d});
        if((from-3) % 5 == 0)nxt.push_back({(from-3) / 5, c+d+d+d});
        if((from-4) % 5 == 0)nxt.push_back({(from-4) / 5, c+d+d+d+d});
        for(auto p:nxt){
            Int to = p.first;
            Int c = p.second;
            if(to < 0 || to > 2 * n)continue;
            if(dist.count(to) == 0 || dist[to] > dist[from] + c){
                dist[to] = dist[from] + c;
                pq.push(P(dist[to], to));
            }
        }            
    }
    cout << ans << endl;
}

int main(){
    int t;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
} 

Measured memory_bytes: 3984
#include<bits/stdc++.h>
using namespace std;
bool binarySearch(int *A,int n,int key){
	int left = 0;
	int right = n;
	while(left<right){
		int mid=(left+right)/2;
		if(A[mid] == key)
			return true;
		else if(key < A[mid])
			right = mid;
		else 
			left = mid + 1;
	}
	return false;
}
int main(){
	int n;
	cin>>n;
	
	int a[n+1];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	
	int q;
	cin>>q;
	
	int key,sum=0;
	for(int i=0;i<q;i++){
		cin>>key;
		if(binarySearch(a,n,key)){
			sum++;
		}
	}
	cout<<sum<<endl;
	return 0;
} 


Measured memory_bytes: 3476
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

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

int main() {
	ll n; cin >> n;
	ll cnt = 0;
	while (n) {
		if ((n % 10) == 2)cnt++;
		n /= 10;
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd(x) cout << "-----------------------------------" << endl;
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

//********************************template END****************************************//

void solve(void){

	int N;
	cin >> N;

	int M = 1<<N;

	vec xs(M);
	mat ms(M, vec (2, 0));

	rep(M, i)
	{
		cin >> xs[i];
		ms[i][0] = xs[i];
	}

	rep(N, i) rep(M, j)
	{
		if (j >> i & 1)
		{
			if (ms[j ^ (1<<i)][0] > ms[j][0])
			{
				ms[j][1] = max(ms[j ^ (1<<i)][1], ms[j][0]);
				ms[j][0] = ms[j ^ (1<<i)][0];
			}
			else
			{
				ms[j][1] = max(ms[j][1], ms[j ^ (1<<i)][0]);
			}

		}
	}

	int ans = 0;

	Rep(1, M-1, k)
	{
		ans = max(ans, ms[k][0] + ms[k][1]);
		cout << ans << endl;
	}

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 18432
#include <iostream>
#include <stdio.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
using namespace std;


int main(void)
{
	int N; cin >> N;
	lli ans = 1;
	rep(i, 1, N + 1)ans = (ans*i) % MOD;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import std;

auto input()
{
    return readln().chomp();
}

alias sread = () => readln.chomp();
alias aryread(T = long) = () => readln.split.to!(T[]);

void main()
{
    string s;
    s = input();
    foreach (_; 0 .. s.length)
    {
        write('x');
    }

}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}


Measured memory_bytes: 3592
#include <iostream>
#include <string.h>
using namespace std;

int main(){
  int count=0;
  int n,h,w,N;
  int a,b;
  cin >>n>>h>>w ;
  for(int i=0; i<n; i++){
  	cin >>a>>b;
    if(h<=a&&w<=b){
      count++;
    }
  }
  cout << count <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long int n,a,b;
	cin>>n>>a>>b;
	long long int res=1;
	if(n==1)
	{
		if(a!=b){
			cout<<0<<endl;
			return 0;
		}
		cout<<1<<endl;
		return 0;
	}
	if(a==b){
		cout<<1<<endl;
		return 0;
	}
	if(a>b)
	{
		cout<<0<<endl;
		return 0;
	}
	for(int i=1;i<=n-2;++i)
	{
		res+=(b-a);
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
using namespace std;

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

	int D = b - a;
	int K[1000] = { 1 };
	for (int i = 1; i <= D; i++) {
		K[i] = K[i - 1] + i + 1;
		if (i == D-1) {
			printf("%d", K[i]-b);
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()


def char_to_int(c):
    return ord(c) - 97


char_counts = [0 for _ in range(26)]
for c in S:
    i = char_to_int(c)
    char_counts[i] = char_counts[i] + 1

ans = 1
for i in char_counts:
    ans = ans * (i + 1)
ans = (ans - 1) % (10 ** 9 + 7)
print(ans)


Measured memory_bytes: 3572
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
}

class Pair {
	long first;
	long second;
	long third;

	Pair(long first, long second, long third) {
		this.first = first;
		this.second = second;
		this.third = third;
	}
}

class TaskB {

	public void solve(int testNumber, InputReader in, PrintWriter pw) {
		int N = in.nextInt();
		int h[] = new int[N];
		for (int i = 0; i < N; i++) {
			h[i] = in.nextInt();
		}
		int dp[] = new int[N];
		Arrays.fill(dp, Integer.MAX_VALUE);
		dp[0] = 0;
		for (int i = 0; i < N; i++) {
			for (int j : new int[] { i + 1, i + 2 }) {
				if (j < N) {
					dp[j] = Math.min(dp[j], dp[i] + Math.abs(h[i] - h[j]));
				}
			}
		}
		pw.println(dp[N - 1]);

	}

	int __gcd(int a, int b) {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	}

	public int getInt(int num) {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	}

	public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 39332
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;


int main()
{
int N,M;
int x[5],a=0,k=11;
for(int i=0;i<5;i++){
  cin>>x[i];
  if(x[i]%10!=0&&x[i]%10<k){
    k=x[i]%10;
  }
  x[i]=(x[i]+9)-((x[i]+9)%10);

  a+=x[i];
}
if(k==11)k=0;
 if(k!=0)cout<<a-10+k<<endl;

 if(k==0)cout<<a<<endl;


return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;

const int mod = 1000000007;
struct mint{
    ll x;
    mint(ll x=0):x(x%mod){}
    mint& operator+=(const mint a){
        if ((x+= a.x) >= mod) x-= mod;
        return *this;
    }
    mint& operator-=(const mint a){
        if ((x+= mod - a.x) >= mod) x-= mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x*=a.x)%=mod;
        return *this;
    }
    mint operator+(const mint a) const{
        mint ans(*this);
        return ans+= a;
    }
    mint operator-(const mint a) const{
        mint ans(*this);
        return ans-= a;
    }
    mint operator*(const mint a) const{
        mint ans(*this);
        return ans*= a;
    }
};


int main(){
    string S;
    cin >> S;
    int rep = 0;
    rep(i,S.size()-1){
        if (S[i] == S[i+1]) rep = 1;
    }
    cout << (rep == 1? "Bad":"Good");
}


Measured memory_bytes: 256
#!/usr/bin/python
from collections import defaultdict
from heapq import *
import sys
d=defaultdict(int)
n,k=map(int,sys.stdin.readline().split())
for _ in range(n):
	s=sys.stdin.readline().strip()
	d[s[0]]-=1
if len(d)<k:
	print(0)
else:
	q=[]
	for khi in d:
		heappush(q,[d[khi],khi])
	r=0
	while 1:
		a=[heappop(q) for _ in range(k)]
		if any(e[0]==0 for e in a): break
		for e in a:
			e[0]+=1
			heappush(q,e)
		r+=1
	print(r)

Measured memory_bytes: 3192
//Link : https://atcoder.jp/contests/agc018/tasks/agc018_c

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 5005

int in[N];
int d[N];
ll solve(int k) {
  ll n,x,m;
  scanf("%lld %lld %lld ", &n,&x,&m);
  ll D = 0;
  ll ret = n-1;
  for(int i=0;i<k;++i) {
    d[i] = in[i]%m;
    D = (D + d[i]);
    if(d[i]==0) {
      if(i+1<=n-1) {
        ll c = (n-1-i-1)/k + 1;
        ret -= c;
      }
    }
  }
  x%=m;
  ll a = x;
  ll b= x + ((n-1)/k)*D;
  int ind = ((n-1)/k)*k + 1;
  while(ind<=n-1) {
    b += d[(ind-1)%k];
    ++ind;
  }
  ret -= b/m;
  ret += a/m;
  return ret;
}
void solve() {
  int k,q;scanf("%d %d ", &k,&q);
  for(int i=0;i<k;++i) {
    scanf("%d ", &in[i]);
  }
  while(q--) {
    printf("%lld\n", solve(k));
  }
}

int main() {
    //freopen("input.txt","r",stdin);
    solve();
    return 0;
}


Measured memory_bytes: 384
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 04/19/20 20:43:13
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  double r; cin>>r;
  cout <<fixed<< r*2*M_PI << endl;

  return 0;
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353
#define MEM_SIZE 201010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

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

void solve(void)
{
  int n, m;
  cin >> n;
  cin >> m;
  vector<int> vec(n, 0);
  for (int i = 0; i < n; i++)
  {
    cin >> vec[i];
  }
  for (int i = 0; i < n - 1; i++)
  {
    vec[i + 1] += vec[i];
  }
  map<int, int> mp;
  mp[0]++;
  for (int i = 0; i < n; i++)
  {
    mp[vec[i] % m] += 1;
  }
  int res = 0;
  for (auto &&x : mp)
  {
    int xx = x.second;
    res += xx * (xx - 1) / 2;
  }
  cout << res << endl;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

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

  return 0;
}


Measured memory_bytes: 7920
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ull unsigned long long int
#define ll long long int
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define MOD (ull)(double)(1e9 + 7)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vb vector<bool>
#define vd vector<double>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vs vector<string>
#define vvb vector<vb>
#define pull pair<ull, ull>
#define F first
#define S second
#define m_p make_pair
#define debug(x) cout << #x << " " << x << endl
#define printArr(a, start, end)for(int i=start ; i<end ; ++i)cout << a[i] << " ";cout << '\n';
#define readArr(a, start, end)for(int i=start ; i<end ; ++i)cin >> a[i];
#define read2D(mat, n, m)for(int i=0 ; i<n ; ++i)for(int j=0 ; j<m ; ++j)cin >> mat[i][j];

const long double PI = 3.141592653589793238462643383279502884197169399;

// Find Set LSB = (x&(-x)), isPowerOfTwo = (x & (x-1))
int n, m;
vector<set<int> > g;
vb vis;
vi con;

void dfs(int node, int mark){
	vis[node] = 1;
	con[node] = mark;
	
	for(auto to : g[node]){
		if(!vis[to]){
			dfs(to, mark);
		}
	}
}

void solve(){
	cin >> n >> m;
	
	g = vector<set<int> >(n);
	vis = vb(n, 0);
	con = vi(n, 0);
	
	int u, v;
	for(int i=0 ; i<m ; ++i){
		cin >> u >> v;
		--u, --v;
		g[u].insert(v);
		g[v].insert(u);
	}
	
	int mark = 1;
	for(int i=0 ; i<n ; ++i){
		if(!vis[i]){
			dfs(i, mark);
			++mark;
		}
	}
	
	int ans=0;
	map<int, int> mp;
	for(int i=0 ; i<n ; ++i)++mp[con[i]], ans = max(ans, mp[con[i]]);
	cout << ans;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cout << fixed << setprecision(10);
	
	int tt=1;
	//cin >> tt;
	
	while(tt--){
		solve();
	}
}


Measured memory_bytes: 41424
#include <stdio.h>

int main(){
    int n;
    int i,j;
    int card[5][14];
    for(i=1; i<=4; i++){
        for(j=1; j<=13; j++){
            card[i][j] = 0;
        }
    }
    
    char suit;
    char op;
    int rank;
    scanf("%d", &n);
    for(i = 0; i<n; i++){
        op = getchar();
        scanf("%c %d", &suit, &rank);
        if(suit == 'S') card[1][rank] = 1;
        else if(suit == 'H') card[2][rank] = 1;
        else if(suit == 'C') card[3][rank] = 1;
        else if(suit == 'D') card[4][rank] = 1;
    }

    for(i=1; i<=4; i++){
        for(j=1; j<=13; j++){
            if(card[i][j] == 0){
                
                if(i==1) printf("S %d\n", j);
                else if(i==2) printf("H %d\n", j);
                else if(i==3) printf("C %d\n", j);
                else if(i==4) printf("D %d\n", j);
            }
        }
    }
}



Measured memory_bytes: 1984
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
signed main()
{
    SPEED;
    int n,k,c;
    cin>>n>>k>>c;
    string s;
    cin>>s;
    int mn[k],mx[k],j=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='o')
        {
            mn[j]=i;
            ++j;
            i+=c;
        }
        if(j==k)
        {
            break;
        }
    }
    j=k-1;
    for(int i=n-1;i>=0;i--)
    {
        if(s[i]=='o')
        {
            mx[j]=i;
            --j;
            i-=c;
        }
        if(j<0)
        {
            break;
        }
    }
    for(int i=0;i<k;i++)
    {
        if(mn[i]==mx[i])
        {
            cout<<mn[i]+1<<endl;
        }
    }
}

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

int main(){
    int h1,m1,h2,m2,k; cin >> h1 >> m1 >> h2 >> m2 >> k;
    int x1 = 60 * h1 + m1;
    int x2 = 60 * h2 + m2;

    int t = x2 - x1;
    if(t>=k){
        cout << t-k << endl;
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 3612
import java.util.*;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {

        int n = sc.nextInt();

        List<Map.Entry<Integer, Map.Entry<String, Integer>>> list = new ArrayList<>();
        for (int i=1; i <= n; i++) {
            list.add(
                    new AbstractMap.SimpleEntry<>(i,
                            new AbstractMap.SimpleEntry<>(
                                    sc.next(),
                                    sc.nextInt()
                            )
                    )
            );
        }

        list.sort((o1, o2) -> {
            if (o1.getValue().getKey().compareTo(o2.getValue().getKey()) > 0)
                return 100;
            else if (o1.getValue().getKey().compareTo(o2.getValue().getKey()) == 0) {
                return sign(o2.getValue().getValue() - o1.getValue().getValue());
            } else
                return -100;
        });

        list.forEach(e -> System.out.println(e.getKey()));

    }

    private static int sign(int i) {
        if (i > 0)
            return 1;
        else if (i == 0)
            return 0;
        else
            return -1;
    }
}


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

int main() {
 long long int h;
 cin >> h;
 int count = 0;
 for(int i=0;i<100;i++){
   h /= 2;
   if (h >= 1) count++;
   else break;
 }
 long long int ans =0;

 for(int i=0;i<count+1;i++){
    ans += pow(2,i);
 }
 cout << ans << endl;
}

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

int main() {
    for (int i = 1; ; i++) {
        int x;
        cin >> x;
        
        if (!(x)) {
            break;
        } else {
            cout << "Case " << i << ": " << x << endl;
        }
    }
}


Measured memory_bytes: 3116
class Binary_Indexed_Tree:
    def __init__(self, n):
        """
        :param n: 最大の要素数
        """
        self.n = n
        self.tree = [0] * (n + 1)
        self.depth = n.bit_length() - 1

    def sum(self, i):
        """ 区間[0,i) の総和を求める """
        s = 0
        i -= 1
        while i >= 0:
            s += self.tree[i]
            i = (i & (i + 1)) - 1
        return s

    def built(self, array):
        """ array を初期値とするBITを構築 """
        for i, a in enumerate(array):
            self.add(i, a)

    def add(self, i, x):
        """ i 番目の要素に x を足す """
        while i < self.n:
            self.tree[i] += x
            i |= i + 1

    def get(self, i, j):
        """ 部分区間和 [i, j) """
        if i == 0:
            return self.sum(j)
        return self.sum(j) - self.sum(i)

    def lower_bound(self, x, equal=False):
        """ (a0+a1+...+ai < x となる最大の i, その時の a0+a1+...+ai )
             a0+a1+...+ai <= x としたい場合は equal = True
             二分探索であるため、ai>=0 を満たす必要がある"""
        sum_ = 0
        pos = -1  # 1-indexed の時は pos = 0
        if equal:
            for i in range(self.depth, -1, -1):
                k = pos + (1 << i)
                if k < self.n and sum_ + self.tree[k] <= x:  # 1-indexed の時は k <= self.n
                    sum_ += self.tree[k]
                    pos += 1 << i
        else:
            for i in range(self.depth, -1, -1):
                k = pos + (1 << i)
                if k < self.n and sum_ + self.tree[k] < x:  # 1-indexed の時は k <= self.n
                    sum_ += self.tree[k]
                    pos += 1 << i

        return pos, sum_

    def __getitem__(self, i):
        """ [a0, a1, a2, ...] """
        return self.get(i, i + 1)

    def __iter__(self):
        """ [a0, a1, a2, ...] """
        for i in range(self.n):
            yield self.get(i, i + 1)

    def __str__(self):
        text1 = " ".join(["element:            "] + list(map(str, self)))
        text2 = " ".join(["cumsum(1-indexed):  "] + list(str(self.sum(i)) for i in range(1, self.n + 1)))
        return "\n".join((text1, text2))


import sys
input = sys.stdin.readline
n, q = map(int, input().split())
a = list(map(int, input().split()))
b = Binary_Indexed_Tree(n)
b.built(a)
for i in range(q):
    q, x, y = map(int, input().split())
    if q:
        print(b.get(x, y))
    else:
        b.add(x, y)


Measured memory_bytes: 127960
import std.stdio, std.algorithm, std.range, std.format, std.numeric, std.string, std.conv, std.array;

void main() {
    size_t n, m;
    long[string] count;
    readf("%d\n", &n);
    foreach (i; 0 .. n) {
        const k = readln();
        count[k] = count.get(k, 0) + 1;
    }
    readf("%d\n", &m);
    foreach (i; 0 .. m) {
        const k = readln();
        count[k] = count.get(k, 0) - 1;
    }
    writeln(max(0, reduce!max(count.byValue)));
}

Measured memory_bytes: 256
#include<stdio.h>
int main() {
	int f[50001] = {0};
	int n, a, b, c;
	for (a = 2; a < 50001; a ++) {
		if (f[a] == 0) {
			for (b = a*2; b < 50001; b += a)
				f[b] = 1;
		}
	}
	while (scanf("%d", &n), n) {
		c = 0;
		for (a = 2; a <= n/2; a ++) {
			if (f[a] == 0 && f[n-a] == 0) {
				c ++;
			}
		}
		printf("%d\n", c);
	}
	return 0;
}

Measured memory_bytes: 608
n=int(input())

def divisore(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

def factorization(n):
    p=2
    fcr=[]
    while p*p<=n:
        while n%p==0:
            fcr.append(p)
            n//=p
        p+=1
    if n>1:
        fcr.append(n)
    return fcr

l=divisore(n)[1:]

ans=0
for i in l:
  t_l=factorization(i)
  if len(set(t_l))!=1:
    continue

  if n%i==0:
    ans+=1
    n//=i

print(ans)

Measured memory_bytes: 9524
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';
int mod = 1e9 + 7;
ll inf = 1e18;

int main()
{
    ll n, m;
    cin >> n >> m;
    if(2*n>=m){
        cout << m / 2 << endl;
    }
    else{
        ll sum = n;
        m -= 2 * n;
        sum += m / 4;
        cout << sum << endl;
    }
    return 0;
}

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

#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using P   = pair<int, int>;

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

template <class T>
void dump_vec(const vector<T> &v) {
    auto len = v.size();
    rep(i, 0, len) {
        cout << v[i] << (i == (int)len - 1 ? "\n" : " ");
    }
}

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

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

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

signed main() {
    int N;
    cin >> N;
    vector<int> S(N);
    rep(i, 0, N) cin >> S[i];
    int Q;
    cin >> Q;
    vector<int> T(Q);
    rep(i, 0, Q) cin >> T[i];

    int ans = 0;
    sort(all(S));
    rep(i, 0, Q) {
        auto t = T[i];
        int ok = N;
        int ng = -1;
        while (abs(ok - ng) > 1) {
            auto mid = (ok + ng) / 2;
            if (S[mid] >= t)
                ok = mid;
            else
                ng = mid;
        }
        if (S[ok] == t) ans++;
    }
    cout << ans << "\n";
}



Measured memory_bytes: 3404
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var s = n.ToString();
        var sum = 0;
        for (int i = 0; i < s.Length; i++)
        {
            sum += int.Parse(s[i].ToString());
        }
        if (n % sum == 0) Console.WriteLine("Yes");
        else Console.WriteLine("No");

    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){

	COMinit();

	lli n,k;
	cin>>n>>k;

	REP(i,1,k+1){
		/*赤の間は何個?*/
		lli redNum = n-k+1;
		lli blueInsert = COM(redNum,i);

		/*青の並び替えは何とおり？*/
		lli blueLine = COM(k-1,i-1);
		cout<<(blueInsert*blueLine)%MOD<<endl;
	}

 
	return 0;
}

Measured memory_bytes: 12160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n,k;
	cin>>n>>k;
	ll a[n];ll pre[n+1];
	memset(pre, 0, sizeof pre);
	for(int i=0;i<n;i++)
	cin>>a[i];
	pre[0]=0;
	for(int i=1;i<=n;i++)
	pre[i]=pre[i-1]+a[i-1];
	for(int i=0;i<=n;i++)pre[i]=(pre[i]-i+k)%k;
	
	map<ll, ll> cnt;ll ans=0;
	for(int i=0;i<=n;i++)
	{
		if(i-k>=0)cnt[pre[i-k]]--;
		ans+=cnt[pre[i]];
		cnt[pre[i]]++;
	}
	cout<<ans;
	
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
#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 = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

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

int main() {
  string s;
  cin >> s;
  ll ans=0;
  for(int i=0;i<s.size()-1;i++) {
    if(s[i]!=s[i+1]) {
      ans++;
    }
  }
  cout << ans;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define repit2(x) for (__typeof((x).begin()) it2 = (x).begin(); it2 != (x).end(); it2++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define Sort(v) sort(All(v))
#define SortR(v) sort(All(v), std::greater<__typeof(v[0])>())

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    int x1, y1;
	int x2, y2;

	cin >> x1 >> y1 >> x2 >> y2;

	int diffX = Abs(x1 - x2);
	int diffY = Abs(y1 - y2);

	if (x1 < x2) {
		if (y1 < y2) cout << x2 - diffY << " " << y2 + diffX << " " << (x2 - diffY) - diffX << " " << (y2 + diffX) - diffY << End;
		else cout << x2 + diffY << " " << y2 + diffX << " " << (x2 + diffY) - diffX << " " << (y2 + diffX) + diffY << End;
	} else {
		if (y1 < y2) cout << x2 - diffY << " " << y2 - diffX << " " << (x2 - diffY) + diffX << " " << (y2 - diffX) - diffY << End;
		else cout << x2 + diffY << " " << y2 - diffX << " " << (x2 + diffY) + diffX << " " << (y2 - diffX) + diffY << End;
	}
	
	return 0;
}


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

void solve(){
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	for(int i=0;i<n;i++){
		if (s.substr(i, s.size() - i) == t.substr(0, s.size() - i)) {
			cout << n + i;
			return;
		}
	}
	cout << n + n;
}

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

return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    long long int ans = 0;
    map<long long int, int> memo;
    long long int sum = 0;
    for(int i = 0; i < n; i++){
        sum += a[i];
        if(memo.count(sum) == 0){
            memo[sum] = 1;
        }else{
            memo.at(sum)++;
        }
    }
    sum = 0;
    for(int i = 0; i < n; i++){
        if(memo.count(sum) > 0){
            ans += memo.at(sum);
        }
        sum += a[i];
        if(memo.count(sum) > 0){
            if(memo.at(sum) > 1) memo.at(sum)--;
            else memo.erase(sum);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 13568
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long 
#define ii pair<int,int>
#define iii pair<int,ii>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define pw(x) (1<<(x))
#define inf 1000000005
#define MOD 1000000007 
#define N 105
#define M 1000003
#define LOG 20
#define KOK 250
#define EPS 0.0000001
using namespace std;

bitset<4000005> ok;

int main() {

	int n,sum=0;

	ok[0]=1;

	scanf("%d",&n);

	for(int i=1;i<=n;i++) {

		int x;

		scanf("%d",&x);

		sum+=x;

		ok=ok|(ok<<x);

	}

	for(int i=(sum+1)/2;;i++) {

		if(ok[i]) {

			printf("%d",i);

			return 0;

		}

	}

}

Measured memory_bytes: 2176
n=int(input())
s=sorted([int(input()) for _ in range(n)])
ans=sum(s)
tmp=ans
num=ans
if ans%10==0:
    for i in range(n):
        tmp-=s[i]
        if tmp%10!=0:
            break
    for i in s:
        if i%10!=0:
            num=i
            break
print(max(tmp,ans-num))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
long double const pi = std::acos(-1.0L);


int main() {
  long double a, b, h, m;
  cin >> a >> b >> h >> m;
  long double k =2*pi*(h/12+m/60/12-m/60);
  long double kakudo=cos(k);
  long double ans = a*a+b*b-2*a*b*kakudo;
  ans=sqrt(ans);
  cout << fixed << setprecision(10);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4116
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

typedef long long ll;
const int INF = 1001001001;
const int mod = 1000000007;

// 場合の数を格納
// i桁目を剰余類がj(0-12)になったときの場合の数(各桁において'?'の場合は0-9で走査して調べる)
int dp[100005][15];

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

int main(){
    string S;
    cin >> S;
    int n = S.length();
    
    int mul = 1;
    vector<int> m(n);       // (10のべき乗)%13
    for(int i = n-1; i >= 0; --i){
        m[i] = mul;
        mul = (mul * 10) % 13;
    }
    
    // dpテーブルの初期化
    dp[0][0] = 1;
    
    for(int i = 0; i < n; ++i){
        if(S[i] != '?'){        // 数が確定しているとき
            int temp = S[i] - '0';  // 今見ている桁の数字
            for(int j = 0; j <= 12; ++j){
                dp[i + 1][(j + m[i] * temp) % 13] += dp[i][j];          // 剰余が(j + m[i]*temp) % 13になる
            }
        }
        else{               // 数が確定していないとき
            for(int N = 0; N <= 9; ++N){        // 0-9を代入して剰余を計算
                for(int j = 0; j <= 12; ++j){
                    int id = (j + m[i] * N) % 13;       // 更新するindex
                    dp[i + 1][id] = (dp[i + 1][id] + dp[i][j]) % mod;
                }
            }
        }
    }

    cout << dp[n][5] << endl;
}


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

int main() {
  int n;
  string s;
  cin>>n>>s;
  int a=s.size();
  for(int i=0;i<a;i++){
    s[i]=(s[i]-'A'+n)%26+'A';
  }
  cout<<s<<endl;
}

Measured memory_bytes: 256