akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>

using namespace std;
int gcd(int a,int b){
  if (a<b) return gcd(b,a);
  else {
  if (b==1) return 1;
  else if (b==0) return a;
  else return gcd(b,a%b);
  }
}

int main(){
  int a,b,k;
  cin >> a >> b >>k;
  int d=gcd(a,b);
  int count=0;
  int ans;
  for (int i=d;;i--){
    if (a%i==0 && b%i==0) count++;
    if (count==k){
      ans=i;
      break;
    }
  }
    cout << ans << endl;
  
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;
int main() {
	int N, K;
	cin >> N >> K;
	vector<int> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	int ans = 0;
	for (int A = 0; A <= min(N, K); A++) {
		for (int B = 0; B + A <= min(N, K); B++) {
			priority_queue<int, vector<int>, greater<>> pq;
			int score = 0;
			for (int i = 0; i < A; i++) {
				score += v[i];
				pq.push(v[i]);
			}
			for (int i = N - 1; i >= N - B; i--) {
				score += v[i];
				pq.push(v[i]);
			}
			
			int trash = K - A - B;
			for (int i = 0; i < trash; i++) {
				if (pq.empty())break;
				if (pq.top() < 0) {
					score -= pq.top();
					pq.pop();
				}
				else {
					break;
				}
			}
			ans = max(ans, score);
		}
	}
	cout << ans << endl;
	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;
//typedef __int64 LL;
//typedef long long int LL;
typedef vector<int> ivec;
typedef vector<string> svec;

const int MOD=1000000007;

int a[100010],b[100010];
int main()
{
	int n,h;
	int ans=0;
	cin>>n>>h;
	for(int i=0;i<n;i++)cin>>a[i]>>b[i];
	sort(a,a+n);
	sort(b,b+n);
	
	int po=lower_bound(b,b+n,a[n-1]+1)-b;
	int i=n-1;
	while(h>0)
	{
		if(i>=po)
		{
			h-=b[i];
			ans++;
			i--;
		}	
		else
		{
			h-=a[n-1];
			ans++;
		}
	}
	
	cout<<ans<<"\n";
	return 0;
}

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

#define ED return 0;
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define MAX 99999999
#define LONGMAX 99999999999999
#define FI first
#define SE second

bool evenstring(string str){
    if(str.size() % 2 == 1){
        return false;
    }
    if(str.substr(0,str.size()/2) == str.substr(str.size()/2,str.size()/2)){
        return true;
    }
    return false;
}

int main(){
    string s;
    cin >> s;
    for(int i = 1;true;i++){
        if(evenstring(s.substr(0,s.size()-i))){
            cout << s.size() - i << endl;
            ED
        }
    }
}


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

int main() {
    int64_t  X;
    cin>>X;
    int64_t  year=0;
    int64_t  mon=100;
    for(int64_t i=0;i<1e18;i++){
      mon*=1.01; 
      year++;
      if(mon>=X){break;}
       
    }
    cout<<year<<endl;

}//なんかおかしい

Measured memory_bytes: 3596
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

#define in1(T,a) T a; cin>>a;
#define in2(T,a,b) T a,b; cin>>a>>b;
#define in3(T,a,b,c) T a,b,c; cin>>a>>b>>c;
#define in4(T,a,b,c,d) T a,b,c,d; cin>>a>>b>>c>>d;
#define in5(T,a,b,c,d,e) T a,b,c,d,e; cin>>a>>b>>c>>d>>e;
#define yes(flag) puts((flag)?"yes":"no");
#define Yes(flag) puts((flag)?"Yes":"No");
#define YES(flag) puts((flag)?"YES":"NO");
#define Yey(flag) puts((flag)?"Yey!":":(");
#define poss(flag) puts((flag)?"possible":"impossible");
#define Poss(flag) puts((flag)?"Possible":"Impossible");
#define POSS(flag) puts((flag)?"POSSIBLE":"IMPOSSIBLE");
#define out(n) cout<<(n)<<endl;

int main() {
	in4(int,H, W, h, w)
	out((H-h)*(W-w))
}

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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>=n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main(){
  string s;
  cin >> s;
  int n = s.size();
  vector<int>ans(n);
  int cnt = 0;
  rep(i, 0, n){
      if(s[i]=='R')cnt++;
      else{
          ans[i-1] += cnt/2 + cnt%2;
          ans[i] += cnt/2;
          cnt = 0;
      }
  }
  cnt = 0;
  rrep(i, n-1, 0){
      if(s[i]=='L')cnt++;
      else{
          ans[i+1] += cnt/2 + cnt%2;
          ans[i] += cnt/2;
          cnt = 0;
      }
  }
  rep(i, 0, n)cout << ans[i] << " ";
  cout << endl;
}

Measured memory_bytes: 3820
#include<stdio.h>
main(void){
    
  int n,m,i,j;
  int a[100][100],b[100],c[100]={};
  scanf("%d%d",&n,&m);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%d",&a[i][j]);
      
    }
    
  }
  for(i=0;i<m;i++){
      
    scanf("%d",&b[i]);
  }
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      c[i]+=a[i][j]*b[j];
    }
    printf("%d\n",c[i]);
  }
  
  return 0;
}



Measured memory_bytes: 2108
from sys import exit, stdin

# import copy
# from collections import deque,Counter
# import numpy as np
input = stdin.readline

(N,) = map(int, input().split())
L = list(map(int, input().split()))

cnt = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                continue
            elif max([L[i], L[j], L[k]]) * 2 < sum([L[i], L[j], L[k]]):
                cnt += 1


print(cnt)



Measured memory_bytes: 9084
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        k: i64,
        n: usize,
        a: [i64; n],
    }
    let mut max = k - a[n - 1] + a[0];
    for i in 0..n - 1 {
        let t = a[i + 1] - a[i];
        if t > max { max = t; }
    }
    println!("{}", k - max);
}


Measured memory_bytes: 8444
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

int const N = 100 + 20 ;
int n , a[N] , mn = N , mx = 0 , cmn , cmx , cnt[N] ;

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

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

	for (int i = 0 ; i < n ; i ++) {
		if (a[i] < mn) mn = a[i] , cmn = 0 ;
		if (a[i] > mx) mx = a[i] , cmx = 0 ;

		if (a[i] == mn) cmn ++ ;
		if (a[i] == mx) cmx ++ ;
	}

	if (n == 2) {
		cout << (mx == 1 ? "Possible" : "Impossible") << '\n' ;
		return 0 ;
	}

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

	for (int i = mx ; i >= (mx + 1) / 2 ; i --) {
		int need = (2 * i == mx ? 1 : 2) ;
		if (cnt[i] < need) return cout << "Impossible\n" , 0 ;
	}

	if (mx > 1 && 2 * mn >= mx && cmx >= 2 && cmn <= 1 + (mx & 1)) cout << "Possible\n" ;
	else cout << "Impossible\n" ;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;

int main(){
    int n;  cin >> n;
    vector<double>p(n);
    rep(i, n)   cin >> p[i];
    vector<vector<double> >dp(n+1, vector<double>(n+1));
    for(int i = 1; i <= n; i++){
        if(i == 1){
            dp[i][0] = 1-p[0];
            dp[i][1] = p[0];
            continue;
        }
        rep(j, i+1){
            if(j == 0){
                dp[i][j] = dp[i-1][j] * (1-p[i-1]);
                continue;
            }
            dp[i][j] += dp[i-1][j-1] * p[i-1];
            dp[i][j] += dp[i-1][j] * (1-p[i-1]);
        }
    }
    double ans = 0;
    for(int j = (n+1)/2; j <= n; j++)   ans += dp[n][j];
    printf("%.10f\n", ans);
}


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

int main(){
    int N;
    int A[100];
    cin >> N;

    for(int i = 0; i < N; i++){
        cin >> A[i];
    }

    sort(A, A + N);
    int count = 1;

    for(int i = 0; i < N-1; i++){
        if(A[i] < A[i+1]){
            count++;
        }
    }
    cout << count << endl;
}

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

using namespace std;
using ll = long long;

const int N = 1e9;

vector<bool> p(N+1, true);

int main() {

  for (int i = 2;i < 9999;++i)   {
	  for (int j = 2;j < 99999;++j)   {
		  if (i * j > 250000) {
			break;
		  }
		  
		  p[i * j] = false;
		  
	  }
  }

  p[1] = false;
  p[2] = true;
  p[3] = true;

  int  X;
  cin>>X;
  
  for (int i = X;;++i) {
	  if (p[i]) {
		  cout<<i<<endl;
		  break;
	  }
  }
  
  
  return 0;
}


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

using namespace std;

int main(){
	int e[12];
	for(int i = 0; i < 12; ++i) cin >> e[i];
	sort(e, e + 12);
	if(e[0] == e[1] && e[2] == e[3] && e[4] == e[5] && e[6] == e[7] && e[8] == e[9] && e[10] == e[11]) cout << "yes" << endl;
	else cout << "no" << endl;
	return 0;
}

Measured memory_bytes: 3076
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {

    long MOD = (long) 1e9 + 7;

    void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        long[][][] dp = new long[N + 1][N + 1][K + 1];
        dp[0][0][0] = 1;

        for (int i = 1; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                for (int k = 0; k <= K; k++) {
                    if (0 > k - 2 * j || k - 2 * j > K ) continue;

                    dp[i][j][k] = (2 * j + 1) * dp[i - 1][j][k - 2 * j];
                    if (j < N) dp[i][j][k] += (j + 1) * (j + 1) * dp[i - 1][j + 1][k - 2 * j];
                    if (j > 0) dp[i][j][k] += dp[i - 1][j - 1][k - 2 * j];
                    dp[i][j][k] %= MOD;
                }
            }
//            debug(dp[i]);
        }
        System.out.println(dp[N][0][K]);
    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 85324
#include <stdio.h>
int main(){
	int a,b,c[300],d[300],i,j,k=0,l;

	while(1){
		scanf("%d %d",&a,&b);
		if(a==0 && b==0)
			break;
		c[k]=a;
		d[k]=b;
		k++;
	}
	for(l=0;l<k;l++){
		for(i=0;i<c[l];i++){
			for(j=0;j<d[l];j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include<stdio.h>

int main() {
    int n, i, j, u, k, v, M[100][100];
    scanf("%d",&n);
    for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
     M[i][j] = 0;
    }
    }

    for(i = 0; i < n; i++){
     scanf("%d %d", &u, &k);
      for(j = 0; j < k; j++){
       scanf("%d", &v);
       M[u-1][v-1] = 1;
      }
    }

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

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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;


    int n,m;
    cin >> n >> m;

    vi a(m), bits(m);
    vi s(1 << n, (1 << 30));
    rep(i, m) {
        cin >> a[i];
        int b;
        cin >> b;
        int bit = 0;
        rep(j, b) {
            int c;
            cin >> c;
            c--;
            bit |= 1 << c;
        }
        bits[i] = bit;
        s[bit] = min(s[bit], a[i]);
        // cout << bit << " " << a[i] << endl;
    }

    rep(i, m) {
        rep(j, 1 << n) if (s[j] != (1 << 30)) {
            // cout << i << " " << (j | bits[i]) << " " << s[j] << " " << a[i] << endl;
            s[j | bits[i]] = min(s[j | bits[i]], s[j] + a[i]);
        }
    }

    if (s[(1 << n) - 1] == (1 << 30)) {
        cout << "-1" << endl;
    } else {
        cout << s[(1 << n) - 1] << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n,m;
	cin>>n>>m;
	int a=2*n;
	if(m-a<0)
	{
		cout<<"No"<<endl;
		return 0;
	}
	a=m-a;
	if(a%2==1)
	{
		cout<<"No"<<endl;
		return 0;
	}
	a/=2;
	if(a>n)
	{
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	return 0;
}




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

int main()
{
	char a[1000];
	int sum = 0;
	scanf("%s",a);
	int len1=strlen(a);
	for(int i=0;i<len1;i++)
	{
		if(a[i] == '1')
		{
			sum++;
		}
	}
	printf("%d",sum);
	return 0;	
} 

Measured memory_bytes: 256
s = input()
k = int(input())
n = len(s)
l = []

t = set(list(s))
if len(t) == 1:
    print(n * k // 2)
    exit()

x = 1
for i in range(n):
    if i == n-1:
        l.append(x)
        continue
    
    if s[i] == s[i+1]:
        x += 1
    else:
        l.append(x)
        x = 1

ans = 0
for i in l:
    ans += i // 2
ans *= k
if l[0] % 2 and l[-1] % 2 and s[0] == s[-1]:
    ans += k-1

print(ans)

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

int main(){
    int H,W;
    while(1){
     cin >> H >> W;
     if(H == 0 && W == 0)break;
     for(int s = 0; s < H; s++){
      for(int i = 0; i < W; i++){
         printf("#");
        }
      printf("\n");
     }
     printf("\n");
    }
    return 0;
}



Measured memory_bytes: 3076
#include<bits/stdc++.h>
# define ll long long
# define ld long double
# define pb push_back
 
  
    // for(int i=0;i<n;i++){  
        
    //     int x,y;
    //     cin>>x>>y;
        
    //     v.pb({x,y});         //make pair in vector
    // }
 
using namespace std;
 
int main()
{
 
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll  n;
    cin>>n;
    cout<<2*(3.14159)*n; }

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

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

  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  
  int min = (int)(pow(10, 9) + 1);
  int max = 0;
  for (auto a : A) {
    if (a > max) max = a;
    if (a < min) min = a;
  }
  cout << (max - min) << endl;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;

#define PI acos(-1)
typedef long long ll;
#define INF 0x3f3f3f3f
int mod = 1000000007;
ll rec[88];
int main()
{
	//freopen("in.txt", "r", stdin);
	 int n;
	 while (~scanf("%d", &n))
	 {
	 	rec[0] = 2;
	 	rec[1] = 1;
	 	for (int i = 2; i <= n; i++)
	 		rec[i] = rec[i-1] + rec[i-2];
	 	cout<<rec[n]<<endl;
	 }
    return 0;
}

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

using namespace std;

int main(void){
int N;
//int keta = 0;
int cost = 0, mincost = 2000000;
//int flag = 0;
//int N;
cin >> N;
//cin >> K;

vector<int> X(N);

for(int i = 0; i < N; i++){
  cin >> X[i];
}
for(int i = 1; i <= 100; i++){
  cost = 0;
  for(int j = 0; j < N; j++){
    cost += (X[j] - i)*(X[j] - i);
  }
  if(cost < mincost) mincost = cost;
}

cout << mincost << endl;
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void dfs_visit(int);
void dfs();

#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[N][N];
int color[N],D[N],F[N],t;

int main()
{
  int i,j,u,x,y;

  scanf("%d",&n);

  for(i=0;i<n;i++)
    {
      for(j=0;j<n;j++)
        M[i][j]=0;
    }

  for(i=0;i<n;i++)
    {
      scanf("%d%d",&u,&y);
      u--;
      for(j=0;j<y;j++)
        {
          scanf("%d",&x);
          x--;
          M[u][x]=1;
        }
    }

  dfs();

  return 0;
}

void dfs_visit(int u)
{
  int v;
  color[u]=GRAY;
  D[u]=++t;

  for(v=0;v<n;v++)
    {
      if(M[u][v]==0) continue;
      if(color[v]==WHITE)
        {
          dfs_visit(v);
        }
    }
  color[u]=BLACK;
  F[u]=++t;
}

void dfs()
{
  int u;

  for(u=0;u<n;u++)
    color[u]=WHITE;

  t=0;

  for(u=0;u<n;u++)
    {
    if(color[u]==WHITE)
      dfs_visit(u);
    }

  for(u=0;u<n;u++)
    printf("%d %d %d\n",u+1,D[u],F[u]);
}





Measured memory_bytes: 2728
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

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

	vector<int> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a.at(i);
	}

	int ans = a.at(0);

	for (int i = 1; i < n; i++)
	{
		ans ^= a.at(i);
	}

	cout << (ans == 0 ? "Yes" : "No") << endl;
}


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

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

    map<string, int> m;

    for (int i = 0; i < n; i++) {
        string  tmp; cin >> tmp;
        m[tmp] = -1;
    }

     cout << m.size() << endl;
     return 0;
}

Measured memory_bytes: 19076
n = int(input())
l = list(map(int, input().split()))

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            a = l[i]
            b = l[j]
            c = l[k]
            # print(a, b, c, (a+b > c and a+c > b and  b+c > a))
            if a+b > c and a+c > b and  b+c > a and a != b and b != c and c != a:
                ans += 1
print(ans)


Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

typedef complex<double> P;

double cross(P a, P b) {
    return imag(conj(a) * b);
}

double dot(P a, P b) {
    return real(conj(a) * b);
}

struct L {
    P a, b, v;
    L(){}
    L(P _a, P _b) {a = _a, b = _b, v = b - a;}
    L(double _ax, double _ay, double _bx, double _by) {
        a = P(_ax, _ay), b = P(_bx, _by), v = b - a;
    }
};

// 2: parallel
// 1: orthogonal
// 0: otherwise
int relationLL(L l1, L l2) {
    if (cross(l1.v, l2.v) == 0) return 2;
    if (dot(l1.v, l2.v) == 0) return 1;
    return 0;
}

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

    int q;
    cin >> q;
    while (q--) {
        int v[4][2];
        rep(i, 4) rep(j, 2) cin >> v[i][j];
        L l1(v[0][0], v[0][1], v[1][0], v[1][1]);
        L l2(v[2][0], v[2][1], v[3][0], v[3][1]);
        cout << relationLL(l1, l2) << endl;
    }

}

Measured memory_bytes: 3176
NMAX = 10**5+1

is_prime = [True]*NMAX
for i in range(2, NMAX):
    if is_prime[i]:
        for j in range(2*i, NMAX, i):
            is_prime[j] = False

sim_2017 = [0]*NMAX
for i in range(3, NMAX, 2):
    if is_prime[i] and is_prime[(i+1)//2]:
        sim_2017[i] += 1
for i in range(1, NMAX):
    sim_2017[i] += sim_2017[i-1]

q = int(input())
for _ in range(q):
    l, r = list(map(int, input().split()))
    ans = sim_2017[r] - sim_2017[l-1]
    print(ans)


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

string S, T;
int locate = -1;

int main() {
	cin >> S;
	cin >> T;
	int LS = S.length(), LT = T.length();
	bool flag = false;
	for(int i = 0; i < LS; i++) {
		flag = true;
		for(int j = 0; j < LT; j++) {
			if(i + j >= LS || (S[i + j] != '?' && S[i + j] != T[j])) {
				flag = false;
				break;
			}
		}
		if(flag) locate = i;
	}
	if(locate < 0) {
		cout << "UNRESTORABLE" << endl;
		return 0;
	}
	for(int i = 0; i < LT; i++) {
		S[i + locate] = T[i];
	}
	for(int i = 0; i < LS; i++) {
		if(S[i] == '?') S[i] = 'a';
	}
	cout << S << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  FOR(i, v.size() - 1) { ret += to_string(v[i]) + ","; }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GI2(N, M);
  vector<int> dp(N + 1);
  dp[0] = 1;
  unordered_set<int> a;
  FOR(i, N) {
    GI(A);
    a.insert(A);
  }
  FORIN(i, 1, N + 1) {
    if (a.count(i)) {
      dp[i] = 0;
    } else if (i == 1) {
      dp[i] = dp[i - 1];
    } else {
      dp[i] = (dp[i - 1] + dp[i - 2]) % MOD;
    }
  }
  print(dp[N]);
  return 0;
}

Measured memory_bytes: 4772
import collections


class Solution:
    def solve(self, N: int, B) -> int:

        answer = B[0]

        for i in range(1, N-1):
            answer += min(B[i-1], B[i])

        answer += B[N-2]

        return answer


if __name__ == '__main__':

    # standard input
    N = int(input())
    B = list(map(int, input().split()))

    # solve
    solution = Solution()
    answer = solution.solve(N, B)
    print(answer)


Measured memory_bytes: 3316
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var s = next();
  var t = next();
  var output = 100000;
  for(var i = 0; i < s.length - t.length + 1; i++){
    var count = 0;
    for(var j = 0; j < t.length; j++){
      if(s[i + j] != t[j]){
        count++;
      }
    }
    output = Math.min(output, count);
  }
  myout(output);
}


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

int main(){
  int a;
    while(cin >> a){
      vector<int> v1;
      vector<int> v2;
      int max=0;
      v1.push_back(a);
      for(int i=0; i<3; ++i){
	int tmp;
	cin >> tmp;
	v1.push_back(tmp);
      }
      
      for(int i=0; i<2; ++i){
	int tmp;
	cin >> tmp;
	v2.push_back(tmp);
      }
      
      sort(v1.begin(),v1.end(),greater<int>());
      sort(v2.begin(),v2.end(),greater<int>());

      for(int i=0; i<3; ++i){
	max += v1[i];
      }
      for(int i=0; i<1; ++i){
	max += v2[i];
      }

      cout << max << endl;
    }
  return 0;
}
      



Measured memory_bytes: 3112
#include <iostream>
#include <vector>
#include <list>
#include <cstring>
#include <algorithm>
#include <string>

struct Map{
    std::string name;
    int point, num;
    Map(std::string townname, int score, int number){
        name = townname;
        point = score;
        num = number;
    }
};

bool cmp(struct Map &a, struct Map &b){
    if(a.name == b.name){
        return a.point > b.point;
    }else{
        return a.name < b.name;
    }
}

int main(){
    std::vector<Map> map;
    int sizey, tmpscore;
    char tmpname[10];
    std::cin >> sizey;
    

    for(int i = 0;i < sizey; i++){
        std::cin >> tmpname >> tmpscore;
        map.push_back(Map(tmpname,tmpscore,i));
    }

    std::sort(map.begin(), map.end(),cmp);

    for(auto itr : map){
        std::cout << itr.num + 1 << std::endl;
    }
        
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
#define int long long

int32_t main()
{
    int n,i,l,sum=0,mi,temp; cin>>n>>l;
    mi=abs(l);
    //cout<<abs(l);
    for(i=1;i<=n;i++)
    {
        sum+=l+i-1;
        if(abs(l+i-1)<=mi)
        {
            mi=abs(l+i-1);
            temp=l+i-1;
        }
    }
    //cout<<mi<<endl;
    cout<<sum-temp;
}


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

using namespace std;
#define int int64_t
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define gsort(x) sort((x).begin(), (x).end(), greater<int>())
#define rv(s) reverse((s).begin(), (s).end())
#define pii pair<int, int>
#define re(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
const long long mod = 1e9 + 7;

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

   string s;
   int cnt = 0;
   vector<int> x;
   bool a = false;

   cin >> s;

   rep(i, s.size())
   {
      if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')
      {
         ++cnt;
         a = true;
      }
      else
         a = false, x.push_back(cnt), cnt = 0;
   }
   x.push_back(cnt);

   gsort(x);

   cout << x[0] << '\n';
}

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

int main() {
    int y,m,d;
    scanf("%d/%d/%d",&y,&m,&d);
    if(m <= 4) cout << "Heisei" << endl;
    else cout << "TBD" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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)

ll mod = 1e9 + 7;

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

  string s;
  cin >> s;

  ll l = s.size();

  ll rec[4] = {};

  REP(i, l){
    if(s[i] == 'N') rec[0]++;
    if(s[i] == 'S') rec[1]++;
    if(s[i] == 'W') rec[2]++;
    if(s[i] == 'E') rec[3]++;
  }

  if((rec[0] && rec[1] == 0) || (rec[1] && rec[0] == 0) || (rec[2] && rec[3] == 0) || (rec[3] && rec[2] == 0)){
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
long long f(long long a){
  long long s=0,i,j,k;
  if(a%4==1||a%4==2)s=1;
  for(i=1;i<60;i++){
    j=(2LL<<i);
    k=a%j;
    if(k<j/2)continue;
    if(k%2==0)s+=1LL<<i;
  }
  return s;
}
int main(){
  long long n,m;
  scanf("%lld %lld",&n,&m);//printf("%lld\n",f(n-1));
  printf("%lld\n",f(n-1)^f(m));
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
int main(){
    int N, Q;
    long K;
    cin >> N >> K >> Q;

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

    int a;
    for(int i=0;i<Q;i++){
        cin >> a;
        A[a-1]++;
    }

    for(int i=0;i<N;i++){
        if(A[i]-Q+K>0) cout << "Yes" <<endl;
        else cout << "No" <<endl;
    }
    
  	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define null NULL
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) ((int)(a).size())
#define all(a) a.begin() , a.end()
#define fi first
#define se second
#define relaxMin(a , b) (a) = min((a),(b))
#define relaxMax(a , b) (a) = max((a),(b))
#define SQR(a) ((a)*(a))
#define PI 3.14159265358979323846
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

int n;
vector<pii> in;

bool Compare(const int& f, const int& s){
  return in[f] > in[s];
}

vi even, odd;

pair<ll, vi> Take(const vi& from){
  ll sum = 0;
  vi use;

  if(in[from[0]].fi <= 0){
    sum = in[from[0]].fi;
    use = {from[0]};
    return mp(sum, use);
  }

  for(int e : from)
    if(in[e].fi >= 0)
      sum += in[e].fi,
      use.pb(e);

  return mp(sum, use);
}

int main(){
  scanf("%d", &n);
  in.resize(n);
  for(auto& e : in)
    scanf("%d", &e.fi),
    e.se = 0;

  for(int i = 0;i < n;i += 2)
    even.pb(i);
  for(int i = 1;i < n;i += 2)
    odd.pb(i);

  sort(all(even), Compare);
  sort(all(odd), Compare);

  auto ans = Take(even);
  if(!odd.empty()){
    auto cand = Take(odd);
    if(ans.fi < cand.fi)
      ans = cand;
  }

  cout << ans.fi << '\n';

  for(int e : ans.se)
    in[e].se = 1;

  vi ops;
  while(sz(in) > 1){
    if(!in[0].se){
      ops.pb(0);
      in.erase(in.begin());
      continue;
    }

    if(!in.back().se){
      ops.pb(sz(in) - 1);
      in.erase(in.end() - 1);
      continue;
    }

    int want = 0;
    for(int i = 0;i < sz(in);++i)
      if(in[i].se) want = i;

    bool success = false;
    for(int i = 0;i < sz(in);++i)
      if(!in[i].se && (i & 1) == (want & 1)){
        ops.pb(i);
        in.erase(in.begin() + i);
        in.erase(in.begin() + i);
        success = true;
        break;
      }
    if(success) continue;

    ops.pb(1);
    in.erase(in.begin() + 1);
    in.erase(in.begin() + 1);
  }

  printf("%d\n", sz(ops));
  for(int e : ops)
    printf("%d\n", e + 1);

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9;
const ll mod = 1e9+7;
typedef pair<int,int> P;
typedef pair<pair<int,int>,pair<int,int>> PP;
#define rep(i,N) for(int i=0;i<N;i++)

int main(){
    int k,x;
    cin>>k>>x;
    int t = k-1;
    for(int i=x-t;i<=x+t;i++){
        cout<<i<<" ";
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    List<List<Integer>> t = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      t.add(new ArrayList<>());
    }
    for (int i = 0; i < N-1; i++) {
      int a = sc.nextInt();
      a--;
      int b = sc.nextInt();
      b--;
      t.get(a).add(b);
      t.get(b).add(a);
    }
    
    if (N == 1) {
      System.out.println(K);
      return;
    }
    
    int[] child = new int[N];
    for (int i = 0; i < N; i++) {
      child[i] = -1;
    }
    LinkedList<Integer> q = new LinkedList<>();
    q.offer(0);
    while (!q.isEmpty()) {
      int p = q.poll();
      child[p] = 0;
      for (int c : t.get(p)) {
        if (child[c] == -1) {
          child[p]++;
          q.offer(c);
        }
      }
      if ((p == 0 && child[0] > K-1)
         || (p > 0 && child[p] > K-2)) {
        System.out.println(0);
        return;
      }
    }
    int[] power = new int[K+1];
    power[K] = 1;
    power[K-1]--;
    
    power[K-1]++;
    power[K-1-child[0]]--;
    
    for (int i = 1; i < N; i++) {
      if (child[i] > 0) {
        power[K-2]++;
        power[K-2-child[i]]--;
      }
    }
    
    int num = 0;
    for (int i = K; i >=0; i--) {
      num += power[i];
      power[i] = num;
    }
    
    long ans = 1;
    for (int i = 2; i <= K; i++) {
      while (power[i]-- > 0) {
        ans *= i;
        ans %= 1_000_000_007;
      }
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 105036
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

#define int long long

const int N=1e6+5;
int n,ans,a[N],b[N],m;

signed main(){
	read(m);read(n);
	for(int i=1;i<=n;i++) read(a[i]);
	for(int i=1;i<n;i++) b[i]=a[i+1]-a[i];
	b[n]=m-a[n]+a[1];
	write(m-*max_element(b+1,b+1+n));
}

Measured memory_bytes: 5888
import sys
sys.setrecursionlimit(2**31-1)
input = sys.stdin.readline
write = lambda x: sys.stdout.write(str(x))
LMIIS = lambda : list(map(int,input().split()))
II = lambda : int(input())
dbg = lambda *something : print(*something) if DEBUG is True else 0
DEBUG = False

def main():

    N = II()
    t = [-1] * N


    E = [  [] for _ in range(N)]
 
    reached = [False] * N
    for _ in range(N-1):
        u,v,w = LMIIS()
        u -=1
        v -=1
        E[u].append((v,w))
        E[v].append((u,w))
    dbg(E)
    t[E[0][0][0]] = 0

     
    def search(u):
        for v,w in E[u]:
            if t[v] == -1:
                t[v] = t[u] if w % 2 == 0 else t[u]^1
                search(v)
                

    search(E[0][0][0])

    for i in t:
        write(i)
        write(' ')






    pass
if __name__ == '__main__':
    main()

Measured memory_bytes: 158112
#include<stdio.h>
int main(void){
    int i;
    double a,b,c,d,e,f,x,y;
    while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){
        x=(c*e-b*f)/(a*e-b*d);
        y=(a*f-c*d)/(a*e-d*b);
        if(x==-0)x=0;
        if(y==-0)y=0;
        printf("%.3f %.3f\n",x,y);
    }
    return 0;
}


Measured memory_bytes: 648
#include<bits/stdc++.h>
using namespace std;
int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	double a,b,x,v,h,t;
	cin >> a >> b >> x;	
	v = a*a*b;
	//补柱体..... --->看截面 
	if(v <= 2*x){//容器有一半或以上的空间 
		h = ((v-x)*2)/(a*a);//高 b 变 
		//arctan(a/h) = x ;x的余角为转过的角度 atan(h/a) 切一个矮柱 
		cout << fixed << setprecision(10) << atan(h/a)*(180/acos(-1));			
	}else{	
		//切一个窄柱 底面变为矩形 以小的边长为基准计算  
		a =  2*x/b/a;
		cout << fixed << setprecision(10) << atan(b/a)*(180/acos(-1));
	}
	return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1e9+7;
int main(void){
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    for(ll i=k;i<=n+1;i++){
        ans=(ans+i*(2*n-i+1)/2-i*(i-1)/2+1)%mod;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3644
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

//#include"atcoder/all"


#ifdef _MSC_VER
#include <intrin.h>

#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
//using namespace atcoder;

#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, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << endl
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << " \n"[i==(int)v.size()-1]
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;


void solve() {
	int A, B, C, D; cin >> A >> B >> C >> D;
	int K; cin >> K;
	int t1 = A * 60 + B;
	int t2 = C * 60 + D;
	int d = t2 - t1;
	print(d - K);
}



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

	//int q;
	//cin >> q;
	//while (q--)
	solve();

}


Measured memory_bytes: 3588
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time
from fractions import gcd
#import random


def I(): return int(input())


def MI(): return map(int, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = ['No', 'Yes']
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    S = input()
    stack = []
    ans = 0

    for i in range(len(S)//2):
        stack.append(S[i])

    start = 0
    if len(S) % 2 == 1:
        start = 1

    for i in range(len(S)//2+start, len(S)):
        a = stack.pop()
        if a != S[i]:
            ans += 1

    print(ans)



if __name__ == '__main__':
    main()


Measured memory_bytes: 5712
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
int main()
{
   string a,b;
   getline(cin>>ws,a);
   getline(cin>>ws,b);
   int c=0;
   for(int i=0;i<a.length();i++)
   {
       if(a[i]==b[i])
       {
           continue;
       }
       else c++;
   }
   cout<<c<<endl;


}


Measured memory_bytes: 3852
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main  implements Runnable {
	int[][] ta = new int[16][4096];
	int ptr = 0;
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 64 * 1024 * 1024).start();
    }

    public void run() {
    	FastScanner sc = new FastScanner(System.in);
    	//int[] ar = new int[3];
    	//ar[0]=Integer.parseInt(sc.next());
    	//Arrays.parallelSort(ar);
		int n = Integer.parseInt(sc.next());
		//long a = Long.parseLong(sc.next());
		//String s = sc.next();
		//String str = sc.next();
		//char c[] = str.toCharArray();
		//char a[][] = new char[n];
		//ArrayList<Str_4> lists = new ArrayList<Str_4>();
		//lists = new ArrayList;
		PrintWriter out = new PrintWriter(System.out);
		//int[] ra = new int[r];
		//ArrayList<ArrayList<Integer>> lists = new ArrayList<>();
		int [] a = new int [n];
		int [] b = new int [n];
		for(int i = 0; i < n; i++)
		{
			a[i] = Integer.parseInt(sc.next());
			b[i] = a[i];
		}
		Arrays.parallelSort(a);
		int ans = 0;
		for(int i = 0; i < n; i++)
		{
			if(a[i] != b[i])
			{
				ans++;
			}
		}
		if(ans <= 2)
		{
			out.println("YES");
		}
		else
		{
			out.println("NO");
		}
		out.flush();
    }

    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;
        public FastScanner(String in) {
        	StringReader sr = new StringReader(in);
            reader = new BufferedReader(new BufferedReader(sr));
            tokenizer = null;
        }
        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

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

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

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

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

    }
}

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

int main() {
    int N;
    cin >> N;
    int cnt_4 = 0, cnt_2 = 0;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        if (a % 4 == 0) cnt_4++;
        else if (a % 2 == 0) cnt_2++;
    }

    if (cnt_4 + (cnt_2 / 2) >= N / 2)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f

using namespace std;

const int N = 1e4 + 5;
const int M = 1e4 + 7;

int i,j,T,t,n,m,l,s,c[105],a,b,g[105],dp[N][105],p,k,d,flag;
string s1,s2,s3;

int main()
{
    ios::sync_with_stdio(false);
    cin >> s1 >> s2;
    cin >> m >> n;
    cin >> s3;
    if(s1==s3) m--;
    else n--;
    cout << m << " " << n;
    return 0;
}


Measured memory_bytes: 256
N=int(input())
S=input()
prel=0
prer=0
for s in S:
  if s=="(":
    prel+=1
  if s==")":
    if prel>0:
      prel-=1
    else:
      prer+=1
#print(prel,prer)
print(prer*"("+S+prel*")")



Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n; cin >> n;
    cout << (n + 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 200005
using namespace std;
set<string> s[maxn];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	map<string,int> cnt;
	int n;
	cin >> n;
	int maxx = 0;
	while(n--) {
		string str;
		cin >> str;
		cnt[str]++;
		int now = cnt[str];
		maxx = max(maxx,now);
		if(now > 1)
			s[now-1].erase(str);
		s[now].insert(str);
	}
	for(string now : s[maxx])
		cout << now << '\n';
	return 0;
}


Measured memory_bytes: 42624