akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
	string abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
	string abcc[32] = {"100101", "10011010", "0101", "0001", "110", "01001",
					   "10011011", "010000", "0111", "10011000", "0110", "00100",
					   "10011001", "10011110", "00101", "111", "10011111", "1000",
					   "00110", "00111", "10011100", "10011101", "000010", "10010010",
					   "10010011", "10010000", "101", "010001", "000011", "10010001", "000000", "000001"};
	string zo = "01";
	string abcd[32];
	for (int i = 0; i < 32; i++) {
		string c = "";
		string d = "";
		int t = i;
		for (int j = 0; j < 5; j++) {
			c += zo[t%2];
			t /= 2;

		}
		for (int j = 4; j >= 0; j--) {
			d += c[j];
		}
		abcd[i] = d;
	}
	string a;
	while (getline(cin, a)) {
		string b = "";
		for (int i = 0; i < a.size(); i++) {
			for (int j = 0; j < abc.size(); j++) {
				if (a[i] == abc[j]) {
					b += abcc[j];
					break;
				}
			}
		}
		while (b.size() % 5 != 0) {
			b += '0';
		}
		while (true) {
			for (int j = 0; j < 32; j++) {
				if (b.substr(0, 5) == abcd[j]) {
					cout << abc[j];
					break;
				}
			}
			if (b.size() == 5) {
				break;
			} else {
				b = b.substr(5);
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int K, A, B;
	cin >> K >> A >> B;

	if (B - A <= 2) {
		co(K + 1);
		return 0;
	}

	ll C = B - A;

	ll kotae = 1;
	kotae += min(K, A - 1);
	K -= min(K, A - 1);

	kotae += C * (K / 2);
	K %= 2;
	kotae += K;

	co(kotae);

	Would you please return 0;
}

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

int main(){
  int A, B, C, D, dif;
  
  cin >> A >> B >> C >> D;

  dif = (B<D?B:D) - (A>C?A:C);
  cout << ((dif>0)?dif:0) << endl;
  
  return 0;
}

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

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;

	vector<vector<int>> num(N, vector<int>(2));
	if (N == 1) {
		num.at(0).at(0) = 0;
	}
	else {
		num.at(0).at(0) = 1;
	}
	num.at(0).at(1) = 0;

	bool ans = true;

	for (int i = 1; i < N; i++) {
		num.at(i).at(0) = 0;
		num.at(i).at(1) = 0;
	}

	for (int i = 0; i < M; i++) {
		int s, c;
		cin >> s >> c;

		if (num.at(s - 1).at(1) > 0) {
			if (num.at(s - 1).at(0) != c) {
				ans = false;
			}
		}
		
		num.at(s - 1).at(0) = c;
		num.at(s - 1).at(1)++;
	}

	if (num.at(0).at(0) == 0 && N != 1) ans = false;
	int x = 1;

	if (ans) {
		x = num.at(0).at(0);
		if (N > 1) {
			for (int i = 1; i < N; i++) {
				x *= 10;
				x += num.at(i).at(0);
			}
		}
	}
	else {
		x = -1;
	}

	cout << x << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define per(i,a,b) for(int i=a;i>=b;--i)
#define rvc(i,S) for(int i=0;i<S.size();++i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
inline int read()
{
	char c=getchar(); int ret=0;
	while(c<48||c>57)c=getchar();
	while(c>=48&&c<=57)ret=ret*10+c-48,c=getchar();
	return ret;
}int a[99],aa;  //0   //scanf 020    020
int n,fl,k;
int main()
{
	n=read();for(int i=1;i<=n;++i)a[i]=read();
	for(int i=1;i<=n;++i)
	for(int j=1;j<=n;++j){
		swap(a[i],a[j]);
		fl=1;for(int k=2;k<=n;++k)if(a[k]<a[k-1])fl=0;
		if(fl){
			puts("YES");
			return 0;
		}
		swap(a[i],a[j]);
	}
	puts("NO");
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    map<int,int> m;
    int n; cin >> n;
    int a[n]; rep(i,n) cin >> a[i];
    rep(i,n){
        m[a[i]]++;
        if(m[a[i]] > 1){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES";
}

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

int main() {
  int H, W;

  while (true) {
    cin >> H >> W;
    if (H == 0 && W == 0)
      break;
    for (int h = 0; h < H; h++) {
      for (int w = 0; w < W; w++) {
        if (0 < h && h < H - 1 && 0 < w && w < W - 1)
          cout << ".";
        else
          cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3056
import bisect

n, m=map(int, input().split())
a=list(map(int, input().split()))
a.sort()
s=[0 for _ in range(n+1)]
for i in range(n):
    s[i+1]=s[i]+a[i]

def calc(x):
    tot=0
    num=0
    for i in range(n):
        j=bisect.bisect_left(a, x-a[i])
        num+=n-j
        tot+=s[n]-s[j]
        tot+=a[i]*(n-j)
    return [tot, num]

l=0
r=(10**5)*2+5
while l+1<r:
    c=(l+r)//2
    if calc(c)[1]>=m:
        l=c
    else:
        r=c
p=calc(l)
ans=p[0]
ans-=(p[1]-m)*l
print(ans)

Measured memory_bytes: 58264
N, Y = map(int, input().split())
for i in range(N + 1):
    for j in range(N - i + 1):
        if i * 10000 + j * 5000 + (N - i - j) * 1000 == Y:
            print(i, j, N - i - j)
            exit()
print("-1 -1 -1")

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

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


 
signed main() {
    int N, K;
    cin >> N >> K;

    if(N>=2*K-1) YES;
    else NO;
    
    return 0;
}


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

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

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

    long long chohen=0, tanpen=0;
    for(int i=N-1; i>0; i--){
        if(A[i]==A[i-1]){
            if(chohen==0){
                chohen = A[i];
                A[i-1] = 0;
            }else{
                tanpen = A[i];
                break;
            }
        }
    }

    unsigned long long ans=chohen*tanpen;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
#define rep(i,n) for (int i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 
ll N;
ll NN;

int main(){

    cin >> N;

    cout << N*N*N << endl;

}


Measured memory_bytes: 256
N, C, K= map(int, input().split())
T = [int(input()) for _ in range(N)]

T.sort()

ans = 0

cnt = 0
last = T[0] + K

for t in T:
    if cnt < C and last >= t:
        cnt += 1
    else:
        ans += 1
        cnt = 1
        last = t + K

if cnt > 0:
    ans += 1

print(ans)

Measured memory_bytes: 13304
from collections import defaultdict
from bisect import *


def p_e():
    s = input()
    t = input()
    l = defaultdict(list)

    for i, c in enumerate(list(s)):
        l[c].append(i + 1)

    for c in list(t):
        if c not in l.keys():
            print(-1)
            exit()

    N = 0
    current = -1
    for c in list(t):
        R = l[c]

        x = bisect(R, current)

        if len(R) == x:
            N += 1
            current = R[0]
        else:
            current = R[x]

    print(N * len(s) + current)


if __name__ == '__main__':
    p_e()


Measured memory_bytes: 61320
#include <iostream>

using namespace std;

int main()
{
    long long int n,sum=0;
    cin>>n;
    for(long long int i=1;i<=n;i++)
    {
        if(i%3!=0&&i%5!=0)
            sum=sum+i;
    }
    cout<<sum;
    return 0;
}


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

using ll = long long int;
using P = pair<int, int>;
using P3 = pair<ll,P>;
using PP = pair<P, P>;
constexpr int INF = 1 << 30;
constexpr ll MOD = ll(1e9) + 7;
constexpr int di[] = {0, 1, 0, -1};
constexpr int dj[] = {1, 0, -1, 0};
constexpr double EPS = 1e-8;

bool ok(string &a, string &b){
    bool res = true;
    for(int i=7;i>=0;i--){
        res &= (a[i] == '*' || a[i] == b[i]);
    }
    return res;
}

bool solve(){
    int n, m;
    cin >> n >> m;
    if(n == 0) return true;
    vector<string> s(n), t(m);
    vector<int> c(n);
    for(int i=0;i<n;i++){
        cin >> s[i] >> c[i];
    }
    for(int i=0;i<m;i++){
        cin >> t[i];
    }
    int ans = 0;
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            if(ok(s[j],t[i])){
                ans += c[j];
                break;
            }
        }
    }
    cout << ans << endl;
    return false;
}

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


Measured memory_bytes: 3220
import java.util.*;
//import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		long a = parseLong(sc.next());
		long b = parseLong(sc.next());
		char[] s = sc.next().toCharArray();
		sc.close();
		boolean f=true;
		for (i = 0; i < a; i++) {
			if(s[i] < '0' || '9' < s[i]) {
				f=false;
				break;
			}
		}
		if(f && s[i] != '-') {
			f=false;
		}
		if(f) {
			i++;
			for (; i < a+b+1; i++) {
				if(s[i] < '0' || '9' < s[i]) {
					f=false;
					break;
				}
			}
		}
		out.println(f?"Yes":"No");
	}
}


Measured memory_bytes: 21844
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BBattle solver = new BBattle();
        solver.solve(1, in, out);
        out.close();
    }

    static class BBattle {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            int d = in.nextInt();
            out.println((c - 1 + b) / b <= (a - 1 + d) / d ? "Yes" : "No");
        }

    }
}



Measured memory_bytes: 35900
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>

using namespace std;
typedef long long ll;

struct Node;
struct Edge{
	Node* node;
	ll dist;
	Edge(Node* node_, ll dist_){
		node = node_;
		dist = dist_;
	}
};

struct Node{
	int id;
	ll dist;
	vector<Edge> edges;
	void CalcDist(int parentId){
		for(int i = 0; i < edges.size(); i++){
			if(parentId != edges[i].node->id){
				edges[i].node->dist = dist + edges[i].dist;
				edges[i].node->CalcDist(id);
			}
		}
	}
};

int main()
{
	int N;
	ll u[100000];
	ll v[100000];
	ll w[100000];
	cin >> N;
	for(int i = 0; i < N-1; i++){
		cin >> u[i] >> v[i] >> w[i];
	}
	
	Node Nodes[100001];
	for(int i = 0; i < N+1; i++){
		Nodes[i].id = i;
	}
	
	for(int i = 0; i < N-1; i++){
		Nodes[u[i]].dist = 0;
		Edge edgeUV(&Nodes[v[i]], w[i]);
		Edge edgeVU(&Nodes[u[i]], w[i]);
		Nodes[u[i]].edges.push_back(edgeUV);
		Nodes[v[i]].edges.push_back(edgeVU);
	}
	
	Nodes[1].CalcDist(0);
	
	for(int i = 1; i <= N; i++){
		cout << ((Nodes[i].dist % 2 == 0) ? 0 : 1 ) << endl;
	}
	
	return 0;
}


Measured memory_bytes: 12160
//abc057_c.cpp
//Sun Jun  3 20:29:05 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;

int keta (long long x) {
	int count = 0;
	while (x/10>=1){
		count++;
		x = x/10;
	}
	return count+1;
}

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

	int ans = keta(n);

	for (long long i=1;i*i<=n;i++){
		if (n%i==0){
			int tempans = keta(i);
			int anotherans = keta(n/i);
			if (anotherans > tempans){
				tempans = anotherans;
			}
			if (ans > tempans){
				ans = tempans;
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
//19
#include<iostream>
#include<cstring>

using namespace std;

int main(){
  for(int n,r;cin>>n>>r,n|r;){
    int card[50];
    for(int i=0;i<n;i++){
      card[i]=n-i;
    }
    for(int i=0;i<r;i++){
      int p,c;
      cin>>p>>c;
      int temp[50];
      memcpy(temp,card,sizeof(card[0])*(p-1));
      memmove(card,card+p-1,sizeof(card[0])*c);
      memcpy(card+c,temp,sizeof(card[0])*(p-1));
    }
    cout<<card[0]<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
const int INF = 2100100100;

int main() {
    string ramen;
    cin >> ramen;
    int len = ramen.size();
    char top = ramen.at(0);
    char last = ramen.at(len-1);
    string length = to_string(len-2);
    string tops = {top};
    string lasts = {last};
    string total = tops + length + lasts;
    cout << total << endl;
    return 0;

}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] lo= reader.readLine().split(" ");
		long a = Long.parseLong(lo[0]);
		char[] pol = lo[1].toCharArray();
		String h = "";
		for(int i =0;i<pol.length;i++){
			if(pol[i]=='.') continue;
			else h = h + pol[i];
		}
		long pow =Long.parseLong(h);
		long res = (pow*a)/100;
		System.out.println(res);
	}
}


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

d = {
  'AC': 0,
  'WA': 0,
  'TLE': 0,
  'RE': 0
}

for _ in range(N):
  d[input()] += 1

for key in ['AC', 'WA', 'TLE', 'RE']:
  print('{} x {}'.format(key, d[key]))

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

using ll = long long;

using VI = vector<int>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VC = vector<char>;
using PI = pair<int, int>;

#define FOR(i, s, n) for (int i = s; i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

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

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

using Edge = pair<ll, ll>;
using Graph = vector<vector<Edge>>;



vector<VVL> v;
ll N, Q, K;
VL dp;

Graph G;

ll x, y;


void rec(ll cur, ll cost, ll past) {
    dp[cur] = min(dp[cur], cost);
    
    for (auto e : G[cur]) {
        if (e.first == past) continue;
        rec(e.first, cost + e.second, cur);
    }
}


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

    cin >> N;
    G.resize(N);
    dp.assign(N + 1, INF);

    REP(i, N - 1) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        G[a].push_back({b, c});
        G[b].push_back({a, c});
    }

    cin >> Q >> K;
    K--;

    rec(K, 0, -1);

    for (int q = 0; q < Q; q++) {
        int x, y; cin >> x >> y; x--; y--;
        cout << dp[x] + dp[y] << endl;
    }




    



    return 0;
}

Measured memory_bytes: 17176
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;
 
ll geta(ll x, ll t, ll L) {
	ll odd=((t-2*x+2*L-1)/(2*L))*2 + 1;
	ll even=((t+2*L-1)/(2*L))*2;
	return min(odd,even);
}
ll getcost(ll L, ll x, ll t, ll out) {
	ll fa[2];
	fa[0]=geta(L-x,t,L);
	fa[1]=geta(x,t,L);
	if (out==0) {
		ll ans=min(fa[0],fa[1]); if (ans&1) ans++;
		return ans;
	}
	else if (out==-1) { // L2R
		return fa[1]|1;
	}
	else if (out==1) { // R2L
		return fa[0]|1;
	}
	else assert(0);
}
const int L2R=-1;
const int ZERO=0;
const int ANY=-123;
const int R2L=1;
void solve(long long N, long long L, vector<long long> vx, vector<long long> vt){
	ll final=0;
	ll lo=0,hi=0,cost=0;
	for (ll i=N-1;i>=0;i--) {
		ll x=vx[i],t=vt[i];
		ll hicost;
		ll newhi;
		{
			pll best=MP(INF,INF);
			for (ll out=-1;out<=1;out++) {
				if (hi+out>=1) {
					chkmin(best,MP(getcost(L,x,t,out),-out));
				}
			}
			ll out=-best.snd;
			newhi=hi+out;
			hicost=best.fst;
			cost+=hicost;
			//printf("out:%lld hicost:%lld\n",out,hicost);
		}
		{
			ll res=INF;
			for (ll out=-1;out<=1;out++) {
				ll tmplo=lo;
				while(tmplo+out<1&&tmplo+1<=hi) {
					tmplo+=1;
				}
				if (tmplo+out>=1) {
					ll newcost=getcost(L,x,t,out);
					if (newcost<=hicost) {
						//printf("lo:%lld tmplo:%lld out:%lld\n",lo,tmplo,out);
						assert(newcost==hicost);
						chkmin(res,tmplo+out);
					}
				}
			}
			assert(res<INF);
			lo=res;
		}
		hi=newhi;
		assert(lo<=hi);
	}
	ll delta=min(abs(lo-1),abs(hi-1));
	final++;
	final+=delta;
	final+=cost;
	if (final&1) final++;
	ll finalans=final*L;
	printf("%lld\n",finalans);
}
 
int main(){	
	ios_base::sync_with_stdio(false); cin.tie(0);
	long long N;
	long long L;
	scanf("%lld",&N);
	vector<long long> t(N-1+1);
	vector<long long> x(N-1+1);
	scanf("%lld",&L);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&x[i]);
	}
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&t[i]);
	}
	solve(N, L, x, t);
	return 0;
}


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

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

struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10); } } ___;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}

#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pii pair<int,int>
#define ff first
#define ss second
#define endll '\n'
#define rep(i,n) for(int i=0;i++<n;)
#define scl(i) scanf("%lld",&i);
#define int unsigned long long int


signed main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n; cin >> n;
	vector<int>vv(n);

	rep(i, n) {
		int a; cin >> a;
		if (!a)
		{
			cout << 0;
			return 0;
		}
		vv[i - 1] = a;
	}
	int ans = 1;

	for (int it : vv) {

		if (__builtin_mul_overflow(ans, it, &ans)) {
			cout << -1;
			return 0;
		}
		if (ans > 1000000000000000000) {
			cout << -1;
			return 0;
		}
	}
	cout << ans;


}

Measured memory_bytes: 3984
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n, t, a; cin >> n >> t >> a;
    t *= 1000;
    a *= 1000;
    vector<int> h(n);
    rep(i, n) {
        cin >> h[i];
    }
    int ans = -1, res = INF;
    rep(i, n) {
        if(chmin(res, abs(t - h[i] * 6 - a))) {
            ans = i;
        }
    }
    cout << ans + 1 << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N;
i64 A[101010], B[101010];

bool is_perm(i64 X)
{
	map<i64, int> cnta, cntb;
	for (int i = 0; i < N; ++i) {
		cnta[A[i]] += 1;
		cntb[B[i]] += 1;
	}
	cnta[X] += 1;
	for (auto c : cntb) {
		if (c.second > cnta[c.first]) return false;
	}
	return true;
}

int uf[101010];

int root(int p)
{
	return uf[p] < 0 ? p : (uf[p] = root(uf[p]));
}
void join(int p, int q)
{
	p = root(p);
	q = root(q);
	if (p == q) return;
	uf[p] += uf[q];
	uf[q] = p;
}

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) scanf("%lld", A + i);
	for (int i = 0; i < N; ++i) scanf("%lld", B + i);

	i64 X = 0;
	for (int i = 0; i < N; ++i) X ^= A[i];

	bool useX = false;
	for (int i = 0; i < N; ++i) {
		uf[i] = -1;
		if (A[i] != B[i] && X == B[i]) {
			useX = true;
		}
	}

	if (!is_perm(X)) {
		puts("-1");
		return 0;
	}

	int ret = 0;
	for (int i = 0; i < N; ++i) {
		if (A[i] != B[i]) ++ret;
	}
	if (ret == 0) {
		// A === B
		puts("0");
		return 0;
	}

	map<i64, int> loca, locb;
	for (int i = 0; i < N; ++i) {
		if (A[i] == B[i]) continue;
		loca[A[i]] = i;
		locb[B[i]] = i;
	}
	for (int i = 0; i < N; ++i) {
		if (A[i] == B[i]) continue;
		join(i, loca[A[i]]);
		join(i, locb[B[i]]);
		if (loca.count(B[i])) {
			join(i, loca[B[i]]);
		}
	}
	for (int i = 0; i < N; ++i) {
		if (A[i] == B[i]) continue;
		if (root(i) == i) {
			++ret;
		}
	}
	--ret;

	if (!useX) ++ret;
	printf("%d\n", ret);
	return 0;
}


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

struct BipartiteMatching {
  vector<vector<int>> graph;
  vector<int> match, alive, used;  int timestamp;

  BipartiteMatching(int n){
    graph=vector<vector<int>>(n);
    //alive=vector<int>(n,1);
    used=vector<int>(n,0);
    match=vector<int>(n,-1);
    timestamp=0;
  }

  void add_edge(int u, int v) {
    graph[u].push_back(v);
    graph[v].push_back(u);
  }

  bool dfs(int idx) {
    used[idx] = timestamp;
    for(auto &to : graph[idx]) {
      int to_match = match[to];
      //if(alive[to] == 0) continue;
      if(to_match==-1 || (used[to_match]!=timestamp && dfs(to_match))) {
        match[idx]=to;  match[to]=idx;
        return true;
      }
    }
    return false;
  }

  int bipartite_matching() {
    int ret = 0;
    for(int i=0; i<graph.size(); i++) {
      //if(alive[i]==0) continue;
      if(match[i]==-1){++timestamp; ret+=dfs(i);}
    }
    return ret;
  }

  void output() {
    for(int i = 0; i < graph.size(); i++) {
      if(i < match[i]) {cout << i << "-" << match[i] << endl;}
    }
  }
};

int main() {
  int N; cin >> N;
  BipartiteMatching bm(2*N);
  vector<int> a(N),b(N),c(N),d(N);
  for(int i=0;i<N;i++)cin >> a[i] >> b[i];
  for(int i=0;i<N;i++)cin >> c[i] >> d[i];
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(a[i]<c[j] && b[i]<d[j]){bm.add_edge(i,j+N);}
    }
  }
  cout << bm.bipartite_matching() << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acosl(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define MXN 200005
int main(){ 
    int p[200005];
    int n;
    scanf("%d",&n);
    if(n==1){
        printf("0\n");
        return 0;
    }
    for(int i=0;i<n;i++){
        int x;
        scanf("%d",&x);
        p[x]=i;
    }
    int ans=0;
    int last=0;
    if(p[n-1]>p[n])ans++,last=n;
    else last=n-1;
    for(int i=n-2;i>=1;i--){
        if(ans==0){
            if(p[i]>p[i+1])ans++,last=i+1;
        }
        else if(p[i]<p[i+1]&&(p[last]<p[i]||p[last]>p[i+1])){
          //  if(p[last]>p[i+1])
        //    last=i;
        }
        else if(p[i]>p[i+1]&&(p[i]>p[last]&&p[last]>p[i+1])){
            //last=i+1;
        }
        else{
            ans++;
            last=i+1;
        }
    }
    printf("%d\n",ans);
}
/**/

Measured memory_bytes: 1024
#include<stdio.h>
#include<queue>
#include<assert.h>
#include<tuple>
#include<string>
#include<algorithm>
#include<iostream>
#include<map>
#include<string.h>
#include<vector>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<ctype.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef tuple<int,int,int> t3;

const int MX = 100005;
const int MM = 1000000007;

vector<int> G[MX];
int A[MX], ans[MX];

void dfs(int x){
	ans[x] = 0;
	for(int c : G[x]){
		dfs(c);
		ans[x] |= !ans[c];
	}
}

int main()
{
	int N;
	scanf("%d", &N);
	for(int i = 1; i <= N; i++) scanf("%d", A+i);
	for(int i = 1; i < N; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		if( A[a] > A[b] ) G[a].push_back(b);
		else if( A[b] > A[a] ) G[b].push_back(a);
	}
	for(int i = 1; i <= N; i++) ans[i] = -1;
	for(int i = 1; i <= N; i++){
		if( ans[i] == -1 ) dfs(i);
	}
	for(int i = 1; i <= N; i++) if( ans[i] ) printf("%d ", i);
	printf("\n");
}


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

int main()
{
    int n, a, b;
    cin >> n >> a;
    b = n % 500;
    if (b <= a)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
import java.util.*;
class Main {
  static public void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.nextLine();
    var wrapper = new Object(){int cnt = 0; int max = 0;};
    str.chars().mapToObj(c -> (char)c).forEach(x -> {
      if( x == 'R'){
        wrapper.cnt++;
      }else{
        wrapper.max = wrapper.max < wrapper.cnt ? wrapper.cnt : wrapper.max;
        wrapper.cnt = 0;
      }
    });
    wrapper.max = wrapper.max < wrapper.cnt ? wrapper.cnt : wrapper.max;
    System.out.println(wrapper.max);
  }
}

Measured memory_bytes: 36124
#include<bits/stdc++.h>
#define ll long long int 
#define fori(i,n) for(i=0; i<n; i++)
#define ford(i,n) for(i=n-1; i>=0; i--)
#define vi vector<int> 
#define vs vector<string>
#define vll vector<ll>
#define di deque<int>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define pqi priority_queue<int>
#define pqll priority_queue<ll>
#define mod1 1000000007
#define mod2 998244353
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define gcd __gcd

#define fast_cin() ios::sync_with_stdio(false); cin.tie(nullptr)

using namespace std;

int main(int argc, char const *argv[]){
    fast_cin();
    int n,i;
    cin>>n;
    
    string s;
    cin>>s;
    if(n%2){
        cout<<"No\n";
        return 0;
    }
    int flag=0;
    fori(i,n/2){
        if(s[i]!=s[n/2+i]){
            flag=1;
            break;
        }
    }
    if(flag) cout<<"No\n";
    else cout<<"Yes\n";
    return 0;
}


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

#define MAX 100 

using namespace std;

int Partition(int input[], int head, int end){
    int i, j, x, t;
    
    i = head-1;
    x = input[end];
    
    for(j=head; j<end; j++){
        if(input[j] <= x){
            i++;
            t=input[i]; 
            input[i]=input[j]; 
            input[j]=t;
        }
    }
    t = input[i+1];
    input[i+1] = input[end];
    input[end] = t;
    
    return i+1;
}

void QuickSort(int input[], int head, int end){
    int index;
    
    if(head < end){
        index = Partition(input, head, end);
        QuickSort(input, head, index-1);
        QuickSort(input, index+1, end);
    }
}

int main(void){
    int n, num[MAX], alice = 0, bob = 0, ans = 0;
    bool turnOfAlice = true;
    
    cin >> n;
    
    for(int i=0; i<n; i++)
        cin >> num[i];
    
    QuickSort(num, 0, n-1);
    
    for(int i = n-1; i >= 0; i--){
        if(turnOfAlice){
            alice+=num[i];
            turnOfAlice = false;
        }else{
            bob+=num[i];
            turnOfAlice = true;
        }
    }
    
    ans = alice - bob;
    
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 3;

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

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

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

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

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


/* debug */
/*
ostream& operator << (ostream& s, UnionFind uf) {
    map<int, vector<int> > res;
    for (int i = 0; i < uf.par.size(); ++i) {
        int r = uf.root(i);
        res[r].push_back(i);
    }
    for (map<int, vector<int> >::iterator it = res.begin(); it != res.end(); ++it) {
        s << endl;
        for (int j = 0; j < (int)it->second.size(); ++j) {
            s << it->second[j] << ", ";
        }
    }
    return s << endl;
}
*/


int ufsample() {
    int N, Q; cin >> N >> Q;
    UnionFind uf(N);
    for (int q = 0; q < Q; ++q) {
        int com, x, y; cin >> com >> x >> y;
        if (com == 0) uf.merge(x, y);
        else {
            if (uf.issame(x, y)) cout << 1 << endl;
            else cout << 0 << endl;
        }
        //cout << uf << endl;
    }
}

void solve() {
    ll n, m; cin >> n >> m;
    UnionFind uf(n);
    for (int i = 0; i < m; ++i) {
        int a, b; cin >> a >> b; --a; --b;
        uf.merge(a, b);
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        ans = max(ans, uf.size(i) );
    }
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 4048
def gen_d_prim(n):
    D = [0,0] + [-1] * (n-1)
    for i in range(2, n+1):
        if D[i] > 0: continue
        for j in range(i, n+1, i): D[j] = i
    return D

def is_pairwise(A):
    D = gen_d_prim(10**6)
    past = set()
    for a in A:
        now = set()
        while a != 1:
            if not D[a] in now and D[a] in past:
                return False
            now.add(D[a])
            past.add(D[a])
            a //= D[a]
    return True

def gcd_all(A):
    from math import gcd
    g = 0
    for a in A: g = gcd(g, a)
    return g

def solve():
    if is_pairwise(A): return 0
    if gcd_all(A) ==1: return 1
    return 2
    
n = int(input())
A = [*map(int,input().split())]
print(['pairwise','setwise','not'][solve()], 'coprime')

Measured memory_bytes: 126820
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORr(i, k, n) for(int i = (k); i > (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORr(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

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

  ll ans = (ll)n*(n-1)/2;
  cout << ans << endl;

}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define ZERO(a) memset(a,0,sizeof(a))

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

  ll n,k;
  cin>>n>>k;
  
  ll cnt=0;
  while(n>0){
    n/=k;
    cnt++;
  }

  cout<<cnt<<endl;
}



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

int main(void){
	int len;
	char s[11],t[12];
	scanf("%s",s);
	scanf("%s",t);
	len=strlen(s);
	for(int i=0;i<len;i++){
		if(s[i]!=t[i]) {
			printf("No\n");	
			break;
		}
		else if(i==len-1) printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 1624
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,m,p;
int a[5005],b[5005],c[5005];
bool used[5005];
bool reach[2505];
ll dp[2505];

int main(void){
	scanf("%d%d%d",&n,&m,&p);
	for(int i=0;i<m;i++){
		scanf("%d%d%d",&a[i],&b[i],&c[i]);
		a[i]--;
		b[i]--;
		c[i]=p-c[i];
	}
	reach[n-1]=true;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(!reach[b[j]])continue;
			used[j]=true;
			reach[a[j]]=true;
		}
	}
	for(int i=0;i<n;i++){
		dp[i]=1LL<<60;
	}
	dp[0]=0;
	for(int i=0;i<n*3;i++){
		for(int j=0;j<m;j++){
			if(!used[j] || dp[a[j]]==(1LL<<60))continue;
			if(dp[b[j]]>dp[a[j]]+c[j]){
				dp[b[j]]=dp[a[j]]+c[j];
				if(i>=n-1){
					printf("-1\n");
					return 0;
				}
			}
		}
	}
	printf("%d\n",max(-dp[n-1],0LL));
	return 0;
}


Measured memory_bytes: 512
#include <map>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
string maxstr(string sx, string sy) {
	if (sx.size() != sy.size()) return (sx.size() > sy.size() ? sx : sy);
	return (sx > sy ? sx : sy);
}
map<string, bool> vis;
map<string, string> dp;
string solve(string s) {
	if (s == "0") return "0";
	if (s[0] == '0' || s[0] == '(' || s[0] == ')') return "invalid";
	if (vis[s]) return dp[s];
	int N = s.size();
	if (s.find('L') == string::npos && s.find('R') == string::npos && s.find('(') == string::npos && s.find(')') == string::npos && s.find(',') == string::npos) {
		for (int i = 0; i < N; ++i) {
			if (s[i] == '?') s[i] = '9';
		}
		return s;
	}
	if (N <= 5 || (s[0] != 'L' && s[0] != 'R' && s[0] != '?') || (s[1] != '(' && s[1] != '?') || (s[N - 1] != ')' && s[N - 1] != '?')) {
		return "invalid";
	}
	// Case of 'L'
	string ans;
	if (s[0] != 'R') {
		for (int i = 3; i < N - 2; ++i) {
			if (s[i] != ',' && s[i] != '?') continue;
			string lres = solve(s.substr(2, i - 2));
			string rres = solve(s.substr(i + 1, N - i - 2));
			if (lres != "invalid" && rres != "invalid") {
				ans = maxstr(ans, lres);
			}
		}
	}
	// Case of 'R'
	if (s[0] != 'L') {
		for (int i = 3; i < N - 2; ++i) {
			if (s[i] != ',' && s[i] != '?') continue;
			string lres = solve(s.substr(2, i - 2));
			string rres = solve(s.substr(i + 1, N - i - 2));
			if (lres != "invalid" && rres != "invalid") {
				ans = maxstr(ans, rres);
			}
		}
	}
	if (ans.empty()) ans = "invalid";
	vis[s] = true;
	dp[s] = ans;
	return ans;
}
int main() {
	string s;
	cin >> s;
	vis.clear();
	dp.clear();
	string ans = solve(s);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3332
import java.util.*;
class Main{
    public static void main(String[]args){
        Scanner cin=new Scanner(System.in);
        int result;
 
            int nowT=Integer.parseInt(cin.next());
            int addT=Integer.parseInt(cin.next());
 
            if(nowT+addT>23){
                result = nowT+addT-24;
            }else{
                result = nowT+addT;
            }
            System.out.println(result);
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN=3e5+10;
int n,pre[MAXN][20],lg[MAXN],deep[MAXN],m,dis,sum[MAXN],ans[MAXN],tot[MAXN];
struct node{
	int ed,v,co;
};
vector<node> G[MAXN];
struct que{
	int pos,co,val,id;
};
vector<que> Q[MAXN];
void DFS0(int x,int fa){
	//cout<<dis<<" "<<x<<endl;
	for(int i=0;i<Q[x].size();i++){
		ans[Q[x][i].id]+=Q[x][i].pos*(dis-tot[Q[x][i].co]+sum[Q[x][i].co]*Q[x][i].val);
	}
	for(int i=0;i<G[x].size();i++){
		int t=G[x][i].ed;
		if(t==fa)continue;
		dis+=G[x][i].v;
		sum[G[x][i].co]++;
		tot[G[x][i].co]+=G[x][i].v;
		DFS0(t,x);
		dis-=G[x][i].v;
		sum[G[x][i].co]--;
		tot[G[x][i].co]-=G[x][i].v;
	}
}
void DFS(int x,int fa){
	pre[x][0]=fa;
	deep[x]=deep[fa]+1;
	for(int i=1;(1<<i)<=deep[x];i++)pre[x][i]=pre[pre[x][i-1]][i-1];
	for(int i=0;i<G[x].size();i++){
		int t=G[x][i].ed;
		if(t==fa)continue;
		DFS(t,x);
	}
}
int LCA(int x,int y){
	if(deep[x]<deep[y])swap(x,y);
	while(deep[x]>deep[y])x=pre[x][lg[deep[x]-deep[y]]-1];
	if(x==y)return x;
	//cout<<x<<" "<<y<<endl;
	for(int i=lg[deep[x]]-1;i>=0;i--){
		if(pre[x][i]==pre[y][i])continue;
		x=pre[x][i],y=pre[y][i];
	}
	return pre[x][0];
}
signed main(){
	scanf("%lld %lld",&n,&m);
	for(int i=1;i<=MAXN-10;i++)lg[i]=lg[i-1]+((1<<lg[i-1])==i);
	for(int i=1;i<=n-1;i++){
		int st,ed,v,co;
		scanf("%lld %lld %lld %lld",&st,&ed,&co,&v);
		G[st].push_back(node{ed,v,co});
		G[ed].push_back(node{st,v,co});
	}
	DFS(1,0);
	for(int i=1;i<=m;i++){
		int co,val,x,y;
		scanf("%lld %lld %lld %lld",&co,&val,&x,&y);
		Q[x].push_back(que{1,co,val,i});
		Q[y].push_back(que{1,co,val,i});
		Q[LCA(x,y)].push_back(que{-2,co,val,i});
		//cout<<LCA(x,y)<<endl;
	}
	DFS0(1,0);
	for(int i=1;i<=m;i++)printf("%lld\n",ans[i]);
	return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
bitset<2020> A[2020];
bitset<2020> winL[2020],winR[2020],winRL[2020],winRR[2020];
bitset<2020> dp[2020];


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	for(j=1;j<N;j++) {
		cin>>s;
		FOR(i,j) {
			A[j][i]=s[i]=='1';
			A[i][j]=s[i]=='0';
		}
	}
	
	FOR(x,N) winL[x][x]=winR[x][x]=winRL[x][x]=winRR[x][x]=1;
	for(l=2;l<=N;l++) {
		for(x=0;x+l<=N;x++) {
			y=x+l-1;
			auto bs=winL[x] & (winR[y]>>1);
			if(bs.count()) dp[x][y]=dp[y][x]=1;
			bs=A[x] & dp[x] & winRL[y];
			if(bs.count()) winL[x][y]=winRL[y][x]=1;
			bs=A[y] & dp[y] & winRR[x];
			if(bs.count()) winR[y][x]=winRR[x][y]=1;
		}
	}
	int ret=0;
	FOR(i,N) ret+=winR[i][0]&winL[i][N-1];
	
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 3328
N,K=map(int,input().split())
A=list(map(int,input().split()))
K=K+1
bk=bin(K)
i=-1
keta1=[]
p2=[2**i for i in range(40)]
while bk[i]!="b":
  if bk[i]=="1":
    keta1.append(-i-1)
  i-=1
  
bk="0"*40+bk[2:]
A.sort(reverse=True)
B=[bin(item) for item in A]
sto=[0 for i in range(40)]
for i in range(N):
  c=-1
  d=0
  while True:
    if B[i][c]=="b":
      break
    elif B[i][c]=="1":
      sto[d]+=1
    c-=1
    d+=1
stos=[]
sums=[0 for i in range(40)]
sumk=[0 for i in range(40)]
for i in range(40):
  l=[sto[i],N-sto[i]]
  sums[i]=(p2[i]*max(l))
  sumk[i]=(p2[i]*l[int(bk[-i-1])])
ans=[]

for i in keta1:
  ans.append(sum(sums[:i])+sum(sumk[i+1:])+p2[i]*sto[i])
#print(sto)
#print(sums)
#print(sumk)
#print(ans)
print(max(ans))

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

using lli = long long int;
using Vint = vector<int>;
using Vlli = vector<lli>;
using Wint = vector<Vint>;
using Wlli = vector<Vlli>;
using pii = pair<int, int>;
using pll = pair<lli, lli>;

const int MOD = 1e9 + 7;
const int INFi = 2e9 + 1;
const lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)};

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(i, vec) for(auto &(i) : (vec))


template <class T> inline int argmin(vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

int main(void){
  int n; cin >> n;
  double res = 0, get;
  string is_yen;
  REP(i, n){
    cin >> get >> is_yen;
    res += (is_yen == "JPY") ? get : get * 380000;
  }
  cout << fixed << setprecision(8) << res << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

const int Mod = 998244353;

typedef struct {
	int key, id;
} data;

void merge_sort(data x[], int n)
{
	static data y[200001] = {};
	if (n <= 1) return;
	merge_sort(&(x[0]), n/2);
	merge_sort(&(x[n/2]), (n+1)/2);
	
	int i, p, q;
	for (i = 0, p = 0, q = n/2; i < n; i++) {
		if (p >= n/2) y[i] = x[q++];
		else if (q >= n) y[i] = x[p++];
		else y[i] = (x[p].key < x[q].key)? x[p++]: x[q++];
	}
	for (i = 0; i < n; i++) x[i] = y[i];
}

void add_BIT(int N, int BIT[], int i, int k)
{
	while (i <= N) {
		BIT[i] += k;
		i += (i & -i);
	}
}

int sum_BIT(int BIT[], int r)
{
	int sum = 0;
	while (r > 0) {
		sum += BIT[r];
		r -= (r & -r);
	}
	return sum;
}

int main()
{
	int i, j, m, n, N, tmp;
	data d[200001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d %d", &(d[i-1].key), &(d[i-1].id));
	merge_sort(d, N);
	for (i = 0, m = 1; i < N; i++, m++) {
		for (j = i, tmp = d[i].key; j < N && d[j].key == tmp; j++) {
			d[j].key = d[j].id;
			d[j].id = m;
		}
		j = i - 1;
	}
	merge_sort(d, N);
	for (i = 0, n = 1; i < N; i++, n++) {
		for (j = i, tmp = d[i].key; j < N && d[j].key == tmp; j++) d[j].key = n;
		j = i - 1;
	}

	long long pow[200001];
	for (i = 1, pow[0] = 1; i <= N; i++) pow[i] = pow[i-1] * 2 % Mod;
	
	int BIT[200001] = {};
	long long ans = (pow[N] - 1 + Mod) * N % Mod;
	for (i = 0; i < N; i++) {
		for (j = i; j < N && d[j].key == d[i].key; j++) ans += pow[sum_BIT(BIT, d[j].id - 1)] + pow[i - sum_BIT(BIT, d[j].id)];
		ans = (ans + (Mod - pow[i]) * (j - i)) % Mod;
		
		for (j = i; j < N && d[j].key == d[i].key; j++) add_BIT(m, BIT, d[j].id, 1);
		i = j - 1;
	}
	for (i = 1; i <= m; i++) BIT[i] = 0;
	for (i = N - 1; i >= 0; i--) {
		for (j = i; j >= 0 && d[j].key == d[i].key; j--) ans += pow[sum_BIT(BIT, d[j].id - 1)] + pow[N - i - 1 - sum_BIT(BIT, d[j].id)];
		ans = (ans + (Mod - pow[N-i-1]) * (i - j)) % Mod;
		
		for (j = i; j >= 0 && d[j].key == d[i].key; j--) add_BIT(m, BIT, d[j].id, 1);
		i = j + 1;
	}
	
	for (i = 0; i < N; i++) {
		d[i].key ^= d[i].id;
		d[i].id ^= d[i].key;
		d[i].key ^= d[i].id;
	}
	merge_sort(d, N);

	for (i = 0; i < N; i++) {
		for (j = i; j < N && d[j].key == d[i].key; j++);
		ans = (ans + (Mod - pow[i]) * (j - i)) % Mod;
		i = j - 1;
	}
	for (i = N - 1; i >= 0; i--) {
		for (j = i; j >= 0 && d[j].key == d[i].key; j--);
		ans = (ans + (Mod - pow[N-i-1]) * (i - j)) % Mod;
		i = j + 1;
	}
	
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 7188
#include <stdio.h>
#include <math.h>
int main() {
	double a, b, c;
	double PI = acos(-1);
	scanf("%lf %lf %lf", &a, &b, &c);
	c /= 180.0;
	c *= PI;
	printf("%lf\n%lf\n%lf\n", a * b * 0.5 * sin(c), a + b + sqrt(a * a + b * b - 2.0 * a * b * cos(c)), a * b * sin(c) / a);
	
	return 0;
}


Measured memory_bytes: 2124