akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);

    int N, M;
    cin >> N >> M;

    if (N == M) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<unsigned long> A(N);
    constexpr unsigned long MOD = 1000000007;
    unordered_map<unsigned long, unsigned long> fc;
    for(auto& i : A){
        cin >> i;
        auto k = i;
        for(unsigned long j{2}; j * j <= k; ++j){
            if(k % j == 0){
                unsigned long cnt{0};
                while(k % j == 0){
                    ++cnt;
                    k /= j;
                }
                fc[j] = max(fc[j], cnt);
            }
        }
        if(k != 1)fc[k] = max(fc[k], 1UL);
    }
    const auto& modpow = [](unsigned long a, unsigned long n = 1000000005) -> unsigned long {
        unsigned long r{1};
        while(n){
            if(n & 1)(r *= a) %= MOD;
            (a *= a) %= MOD;
            n >>= 1;
        }
        return r;
    };
    unsigned long s{1};
    for(const auto& i : fc)(s *= modpow(i.first, i.second)) %= MOD;
    unsigned long ans{0};
    for(const auto& i : A)ans += modpow(i);
    cout << ans % MOD * s % MOD << endl;
    return 0;
}

Measured memory_bytes: 768
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(long long *)a-*(long long *)b;
}

int main(void){
	int n=in(),i,a[200000];
	long long ans=INF,sum=0,tmp=0,syoko;
	rep(i,n){
		a[i]=llin();
		sum+=a[i];
	}
	rep(i,n-1){
		tmp+=a[i];
		syoko=llabs(2*tmp-sum);
		if(syoko<ans){
			ans=syoko;
		}
	}
	llprint(ans);
	return 0;
}


Measured memory_bytes: 896
import java.util.Scanner;
public class Main {

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if(x == y){
			System.out.println("a == b");
		}
		if(x > y){
			System.out.println("a > b");
		}
		if(x < y){
			System.out.println("a < b");
		}
	}
}

Measured memory_bytes: 26404
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int N = input.nextInt();
        int A[] = new int[N];
        for (int i = 0; i < N; i++){
          A[i] = input.nextInt();
        }
        int ans = 0;
        boolean flag = false;
        while (true){
          if (flag){
            break;
          }
          for (int i = 0; i < N; i++){
            if (A[i]%2 != 0){
              flag = true;
              break;
            }
            if (i == N-1){
              ans += 1;
            }
            A[i] /= 2;
          }
        }
        System.out.println(ans);
    }
}

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

using namespace std;

template <class T> inline T updmax(T& a, T b) { return a = max(a, b); }
template <class T> inline T updmin(T& a, T b) { return a = min(a, b); }

int ng() {
	cout << -1 << "\n";
	return 0;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	vector<int> a(n, 0);
	for (int i = 0; i < n; i++) cin >> a[i];
	vector<int> b(n, 0);
	for (int i = 0; i < n; i++) cin >> b[i];
	priority_queue<pair<int, int>> q;
	for (int i = 0; i < n; i++) {
		if (b[i] != a[i]) q.push(make_pair(b[i], i));
	}
	long long ret = 0;
	while (!q.empty()) {
		auto vi = q.top();
		q.pop();
		auto i = vi.second;
		if (b[i] < b[(i + n - 1) % n]) return ng();
		if (b[i] < b[(i + 1) % n]) return ng();
		int d = b[(i + n - 1) % n] + b[(i + 1) % n];
		if ((b[i] - a[i]) < d)
			return ng();
		else {
			ret += (b[i] - a[i]) / d;
			b[i] -= ((b[i] - a[i]) / d) * d;
			if (b[i] != a[i]) q.push(make_pair(b[i], i));
		}
	}
	cout << ret << "\n";
	return 0;
}

Measured memory_bytes: 3956
#include<bits/stdc++.h>
#define pypl ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{
		pypl;
		int n,w;
		cin>>n>>w;
		long long int values[n+1]={},weights[n+1]={},t[n+1][w+1]={};
		
		for(int i=1;i<=n;i++)
		{
			cin>>weights[i];
			cin>>values[i];
		}
		for(int i=0;i<=n;i++)
		{
			for(int j=0;j<=w;j++)
			{
				if(i==0||j==0)t[i][j]=0;
				else if(weights[i]>j)t[i][j]=t[i-1][j];
				else t[i][j]=max(t[i-1][j],values[i]+t[i-1][j-weights[i]]);
			}
		}
		cout<<t[n][w]<<"\n";
	return 0;
}

Measured memory_bytes: 79232
import Control.Monad
import Control.Applicative
import Data.List
import Data.Array

main = do

    a <- readLn :: IO Integer
    b <- readLn :: IO Integer
    
    if a > b then putStrLn "GREATER"
             else if a < b then putStrLn "LESS"
                           else putStrLn "EQUAL"





Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int pow(int n)
{
	if(n==0)return 1;
	int res = 1;
	rep(i,n){
		res *= -2;
	}
	return res;
}

int main()
{
	ll n;
	cin >> n;
	string s;
	ll now = -2;
	ll i = 1;
	if(n==0)
	{
		cout<<0<<endl;
		return 0;
	}

	while(n!=0)
	{
		if(n%i!=0)s.push_back('1'),n-=i/(-2);
		else s.push_back('0');
		now++;
		i*=-2;
		//cout<<n<<endl;
	}
	reverse(ALL(s));

	rep(i,s.size()-1)cout<<s[i];cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int sub(int x) {
  if(x<600) return 8;
  if(x<800) return 7;
  if(x<1000) return 6;
  if(x<1200) return 5;
  if(x<1400) return 4;
  if(x<1600) return 3;
  if(x<1800) return 2;
  return 1;
}

int main() {
  int x; cin >> x;
  cout << sub(x) << endl;
}


Measured memory_bytes: 3628
def jd(m,a,b,c)
  return [true,m[a]] if m[a]==m[b] and m[b]==m[c] and m[a]!="s"
  return [false,0]
end
while gets
  m=$_.chomp.split("")
  l=jd(m,0,1,2)<<jd(m,3,4,5)<<jd(m,6,7,8)<<jd(m,0,3,6)<<jd(m,1,4,7)<<jd(m,2,5,8)<<jd(m,0,4,8)<<jd(m,2,4,6)
  q=l.flatten!.index(true)
  puts q.nil? ? "d" : l[q+1]
end

Measured memory_bytes: 8672
n = int(input())
a = (input()).split(" ")
sumv = 0
temp = []
for i in range(n):
    temp.append(int(a[i]))
temp.sort()
for i in range(n-1):
    if(i==0):
        sumv =  (temp[i] + temp[i+1])/2
    else:
        sumv = (sumv + temp[i+1])/2
print(sumv)


Measured memory_bytes: 3060
//jinhaonan
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
template<class T>inline void read(T &x){
	x=0;char c=getchar();bool f=0;
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';x=(x<<1)+(x<<3)+c-'0',c=getchar());
	x=f?-x:x;
}
template<class T>inline void write(T x){
	if(x<0)putchar('-'),x=-x;
	if(x>=10)write(x/10);
	putchar(x%10+48);
}
template<class T>inline bool chkmax(T &a,T const &b){
	return a<b?a=b,1:0;
}
template<class T>inline bool chkmin(T &a,T const &b){
	return a>b?a=b,1:0;
}
const int mo=998244353;
int C[4010][4010],pw2[2010];
int F(int i,int j,int k){
	int res=0;
	for(int q=0;q<=min(i,k);++q)
		if(j+q-1>=0&&k-1+j>=q+j-1){
			res=(res+(long long)C[i][q]*pw2[q]%mo*C[k-1+j][q+j-1])%mo;
		}
	return res;
}
int main(){
	C[0][0]=1;
	for(int i=1;i<=4000;++i){
		C[i][0]=C[i][i]=1;
		for(int j=1;j<i;++j){
			C[i][j]=(C[i-1][j]+C[i-1][j-1])%mo;
		}
	}
	pw2[0]=1;
	for(int i=1;i<=2000;++i){
		pw2[i]=pw2[i-1]*2%mo;
	}
	
	int n,K;read(K),read(n);
	for(int i=2;i<=2*K;++i){
		int cnt=0;
		for(int x=1;x<=K;++x)
			if(i-x<=K&&i-x>=1)
				++cnt;
		if(i&1){
			write(F(cnt/2,K-cnt,n)),putchar('\n');
		}else{
			write((F((cnt-1)/2,K-cnt,n)+F((cnt-1)/2,K-cnt,n-1))%mo),putchar('\n');
		}
	}
	return 0;
}

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

int main()
{
  int n;
  scanf("%d", &n);
  vector<int> cards(n);

  for (int i = 0; i < n; i++) scanf("%d", &cards.at(i));

  sort(cards.begin(), cards.end());
  reverse(cards.begin(), cards.end());

  int alice=0, bob=0;
  for (int i = 0; i < n; i++){
    
    if(i==0 || i%2==0){
      alice += cards.at(i);
    }
    else{
      bob += cards.at(i);
    }
  }
  printf("%d", alice-bob);
}

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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

signed 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 left = 0; left <= n; left++){
    for(int right = 0; right <= n; right++){
      if(left + right > min(n,k)) continue;
      priority_queue<int,vector<int>,greater<int>> q;
      for(int l = 0; l < left; l++) q.push(v[l]);
      for(int r = 0; r < right; r++) q.push(v[n-1-r]);
      for(int i = 0; i < k - (left+right); i++){
        if(!q.empty() && q.top() < 0) q.pop();
      }
      int res = 0;
      while(!q.empty()){
        res += q.top(); q.pop();
      }
      ans = max(ans,res);
    }
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    for(int i = 0; i < N; i++) cin >> B[i];
    for(int i = 0; i < N; i++) cin >> C[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    ll res = 0;
    for(int i = 0; i < N; i++){
        auto Iterup = lower_bound(ALL(A), B[i]);
        auto Iterdown = upper_bound(ALL(C), B[i]);
        res += (Iterup - A.begin())*(C.end() - Iterdown);
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1408
N = int( input() )
n = []
for i in range(N):
	n.append(input().split())
	n[i][0] = int(n[i][0])
	n[i][1] = int(n[i][1])

n.sort(key=lambda x:x[1])

a = 0
t = 0
for i in range(N):
	a = a + n[i][0]
	if a > n[i][1]:
		print("No")
		exit()
print("Yes")

Measured memory_bytes: 53684
using System;

namespace abca156
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            if (a >= 10)
                Console.WriteLine(b);
            else
                Console.WriteLine(b + (100 * (10 - a)));

        }
    }
}


Measured memory_bytes: 13140
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"


int main(int argc, char const *argv[]) {
  int N;
  std::cin >> N;

  int max_digit = 1;
  int rep2[100], rep2_abs[100], rep2_temp[100], negative;

  for (size_t i = 0; i < 100; i++) {
    rep2[i] = 0;
    rep2_abs[i] = 0;
    rep2_temp[i] = 0;

  }

  if (N > -1) {
    negative = 1;
  } else{
    negative = -1;
    N = -N;
  }

  for (size_t i = 0; i < 100; i++) {

    int r = N % 2;
    N = N/2;
    rep2_temp[i] = r;

    if (r == 1) {
      max_digit = i+1;
    }
  }

  // std::cout << "2 digit " << '\n';
  //
  // for (size_t i = 0; i < max_digit; i++) {
  //   std::cout << rep2_temp[max_digit - i - 1] ;
  //   // std::cout << rep2_abs[max_digit - i - 1] ;
  // }
  // std::cout << '\n'<<"============ " << '\n';

  // abs val
  int overflow = 0, overflow2 = 0;

  for (size_t i = 0; i < 100; i++) {
    int input = rep2_temp[i] + overflow;
    overflow = 0;

    rep2_abs[i] = input;
    if (i%2 == 1 && rep2_temp[i] == 1) {
      overflow = 1;
    }
    if (input == 1) {
      max_digit = i+1;
    }
  }

  // std::cout << "-2 digit_abs " << '\n';
  //
  // for (size_t i = 0; i < max_digit; i++) {
  //   // std::cout << rep2_temp[max_digit - i - 1] ;
  //   std::cout << rep2_abs[max_digit - i - 1] ;
  // }
  // std::cout << '\n'<<"============ " << '\n';

  for (size_t i = 0; i < 100; i++) {
    if (rep2_abs[i] == 2) {
      rep2_abs[i] = 0;
      rep2_abs[i+1] += 1;
      rep2_abs[i+2] += 1;
    }

    if (rep2_abs[i] == 3) {
      rep2_abs[i] = 1;
      rep2_abs[i+1] += 1;
      rep2_abs[i+2] += 1;
    }

    if (rep2_abs[i] == 4) {
      rep2_abs[i] = 0;
      // rep2_abs[i+1] += 1;
      rep2_abs[i+2] += 1;
    }

    if (rep2_abs[i] == 1) {
      max_digit = i + 1;
    }
  }


  // std::cout << "max_digit "<<max_digit << '\n';
  // std::cout << "-2 digit_abs " << '\n';
  // for (size_t i = 0; i < max_digit; i++) {
  //   // std::cout << rep2_temp[max_digit - i - 1] ;
  //   std::cout << rep2_abs[max_digit - i - 1] ;
  // }
  // std::cout << '\n'<<"============ " << '\n';

  if (negative == 1) {
    for (size_t i = 0; i < 100; i++) {
      rep2[i] = rep2_abs[i];
    }
  }else{
    int overflow3 = 0;
    for (size_t i = 0; i < 100; i++) {
      rep2[i] = rep2_abs[i] + overflow3;
      overflow3 = 0;
      if (rep2_abs[i] == 1) {
        overflow3 = 1;
      }
    }
  }

  for (size_t i = 0; i < 100; i++) {
    if (rep2[i] == 2) {
      rep2[i] = 0;
      rep2[i+1] += 1;
      rep2[i+2] += 1;
    }

    if (rep2[i] == 3) {
      rep2[i] = 1;
      rep2[i+1] += 1;
      rep2[i+2] += 1;
    }

    if (rep2[i] == 4) {
      rep2[i] = 0;
      // rep2[i+1] += 1;
      rep2[i+2] += 1;
    }

    if (rep2[i] == 1) {
      max_digit = i + 1;
    }
  }

  for (size_t i = 0; i < max_digit; i++) {
    std::cout << rep2[max_digit - i - 1] ;
  }



  return 0;
}


Measured memory_bytes: 256
s=list(input())
t=list(input())
c=[chr(i) for i in range(97, 97+26)]
l=[[] for i in range(26)]
l2=[[] for i in range(26)]
for i in range(len(s)):
  l[c.index(s[i])].append(t[i])
  l2[c.index(t[i])].append(s[i])
for i in range(26):
  if len(set(l[i]))>1 or len(set(l2[i]))>1:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 81484
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>

#define INF 100000000

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    reverse(a.begin(),a.end());
    int alice = 0, bob = 0;
    for (int i = 1; i <= n; i++)
    {
        //cout << i << endl;

        if (i % 2 == 0)
        {
            //cout << "BOB\n";
            bob += a[i - 1];
            //cout << a[i-1] << endl << endl;
        }
        else
        {
            //cout << "Alice\n";
            alice += a[i - 1];
            //cout << a[i-1] << endl << endl;
        }
    }
    cout << alice - bob << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<cmath>
#include <algorithm>
using namespace std;
int main(){
  int n,count=0;
  cin>>n;
  vector<int> a(n);
  vector<int> sum(1000001);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  for(int i: a){
    if(sum[i]!=0){
      sum[i]=2;
      continue;
    }
    for(int j=0;j<1000001;j+=i)sum[j]++;
  }
  for(int i:a){
    if(sum[i]==1)count++;
  }
  cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 8004
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> anys;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(anys{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	int N, M;
	cin >> N >> M;
	vector<vector<int>> graph(N), rgraph(N);
	for(int i=0; i<M; i++){
		int s, t;
		cin >> s >> t;
		s--; t--;
		graph[s].push_back(t);
		rgraph[t].push_back(s);
	}

	double ans = 1e18;
	for(int i=N-1; i>=0; i--){
		vector<double> dp(N);
		for(int j=N-1; j>=0; j--){
			double dmax = 0;
			for(int t: graph[j]){
				dmax = max(dmax, dp[t]);
				dp[j] += dp[t]+1;
			}
			if(i==j && graph[j].size()>1){
				dp[j] -= dmax+1;
				dp[j] /= graph[j].size()-1;
			} else if(graph[j].size()>0){
				dp[j] /= graph[j].size();
			}
		}
		ans = min(ans, dp[0]);
	}
	
	cout << setprecision(20) << ans << endl;

	return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		
		try(Scanner scan = new Scanner(System.in)){

			int n = scan.nextInt();
			int[] array = new int[n+2];
			for(int i=0; i<n; i++) {
				array[i] = scan.nextInt();
			}
			
			int dice = 0;
			int counter = 0; 
			
			for(int i=0; i<array.length; i++) {

				if(array[i] == 1) {
					counter++;
				}else {
					dice = Math.max(dice, counter);
					counter = 0;
				}
			}
			dice = Math.max(dice, counter);
			System.out.println(dice+1);
		}
	}
}


Measured memory_bytes: 26488
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size()-8;i++)cout<<s[i];
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static void Main (string[] args)
        {
            string[] str;
            str = Console.ReadLine ().Split (' ');

            long N = int.Parse (str[0]);
            long[] P = new long[N];

            long ans = 0;

            for (int i = 2; i <= N; i++)
            {
                for (int j = i; j <= N; j += i)
                {
                    ans += j;
                }
            }

            Console.WriteLine (ans + N * (N + 1) / 2);

        }
    }

    class MyLibrary
    {

    }
}

Measured memory_bytes: 27224
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<int[]> examples = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int[] ints = new int[2];
            ints[0] = scanner.nextInt();
            ints[1] = scanner.nextInt();
            examples.add(ints);
        }
        judge(examples);
    }

    private static void judge(List<int[]> examples) {
        int count = 0;
        for (int[] item: examples) {
            if (item[0] == item[1]) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    bool ok = true;
    for (int i = 0; i < n; i++) {
        if (a[i] % 2 == 0) {
            ok &= (a[i] % 3 == 0 || a[i] % 5 == 0);
        }
    }
    if (ok) cout << "APPROVED\n";
    else cout << "DENIED\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
 public static void main(String[] args){
  Scanner sc=new Scanner(System.in);
   String alpha="abcdefghijklmnopqrstuvwxyz";
   String target=sc.next();
   
   for(int i=0;i<=24;i++){
     if(String.valueOf(alpha.charAt(i)).equals(target)){
        System.out.println(alpha.charAt(i+1));
     }
   }
 }
}


Measured memory_bytes: 23508
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <list>
#include <math.h>
#include <vector>
#include <algorithm>
#include<iomanip>
#include <unordered_map> 
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

#define MOD 1000000007


int main() {

  int N;
  string S;
  
  cin >> N >> S;

  for (int i = 0; i < S.length(); i++) {
    S[i] = ( ( S[i] - 'A' ) + N ) % 26 + 'A';
  }
  cout << S;

  //for float, double precision
  //cout << std::fixed << setprecision(15);
  return 0;

}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
typedef std::pair<int,int> Pos;

struct State{
  int row,column,depth;
  State(int a,int b,int c){
    row=a;
    column=b;
    depth=c;
  }
};

std::vector<bool> horizontal_wall[30]={},vertical_wall[30]={};
bool map[30][30]={};
int h,w;

bool CanMoveEast(State state){
  int row=state.row;
  int column=state.column;
  if(column+1>=w) return false;
  if(horizontal_wall[row][column]) return false;
  if(map[row][column+1]) return false;
  return true;
}

bool CanMoveWest(State state){
  int row=state.row;
  int column=state.column;
  if(column-1<0) return false;
  if(horizontal_wall[row][column-1]) return false;
  if(map[row][column-1]) return false;
  return true;
}

bool CanMoveNorth(State state){
  int row=state.row;
  int column=state.column;
  if(row-1<0) return false;
  if(vertical_wall[row-1][column]) return false;
  if(map[row-1][column]) return false;
  return true;
}

bool CanMoveSouth(State state){
  int row=state.row;
  int column=state.column;
  if(row+1>=h) return false;
  if(vertical_wall[row][column]) return false;
  if(map[row+1][column]) return false;
  return true;
}


int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  while (1) {

    //init
    h=0;
    w=0;
    for(int i=0;i<30;i++){
      horizontal_wall[i].clear();
      vertical_wall[i].clear();
    }
    for(int i=0;i<30;i++){
      for(int j=0;j<30;j++){
        map[i][j]=false;
      }
    }



    cin>>w>>h;

    if(w==0&&h==0) return 0;

    for(int i=0;i<2*h-1;i++){
      if(i%2==0){
        for(int j=0;j<w-1;j++){
          bool temp;
          cin>>temp;
          horizontal_wall[i/2].push_back(temp);
        }
      }else{
        for(int j=0;j<w;j++){
          bool temp;
          cin>>temp;
          vertical_wall[i/2].push_back(temp);
        }
      }
    }

    std::queue<State> bfs_queue;
    bfs_queue.push(State(0,0,1));
    map[0][0]=true;
    bool foundroot=false;
    while (!bfs_queue.empty()){
      State next_state=bfs_queue.front();
      int row=next_state.row,column=next_state.column,depth=next_state.depth;
      bfs_queue.pop();
      if(row==h-1&&column==w-1){
        cout<<depth<<endl;
        foundroot=true;
        break;
      }
      if(CanMoveEast(next_state)){
        map[row][column+1]=true;
        bfs_queue.push(State(row,column+1,depth+1));
      }
      if(CanMoveNorth(next_state)){
        map[row-1][column]=true;
        bfs_queue.push(State(row-1,column,depth+1));
      }
      if(CanMoveSouth(next_state)){
        map[row+1][column]=true;
        bfs_queue.push(State(row+1,column,depth+1));
      }
      if(CanMoveWest(next_state)){
        map[row][column-1]=true;
        bfs_queue.push(State(row,column-1,depth+1));
      }

    }
    if(!foundroot)cout<<0<<endl;
  }

}



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

long long n,a[200005],dp[200005],maks;
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=n;i++)
	{
		dp[a[i]]=dp[a[i]-1]+1;
		maks=max(maks,dp[a[i]]);
	}
	cout<<n-maks<<'\n';
}

Measured memory_bytes: 6752
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
#include<queue>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    deque<char> deq;
    string s;
    cin>>s;
    rep(i,s.size()) deq.push_back(s.at(i));
    int q;
    cin>>q;
    int t1sum=0;
    rep(i,q){
        int t;
        cin>>t;
        if(t==1){
            t1sum++;
        }
        else{
            int f;
            cin>>f;
            char c;
            cin>>c;
            if(f==1){
                if(t1sum%2==0){
                    deq.push_front(c);
                }
                else{
                    deq.push_back(c);
                }
            }
            else{
                if(t1sum%2==0){
                    deq.push_back(c);
                }
                else{
                    deq.push_front(c);
                }
            }
        }
    }
    if(t1sum%2==1) reverse(deq.begin(),deq.end());
    while(!deq.empty()){
        cout<<deq.front();
        deq.pop_front();
    }
    cout<<endl;
}


Measured memory_bytes: 896
n = gets.to_i
array = gets.split.map(&:to_i)
dp = Array.new(n,1.0/0)
dp[0] = 0
dp[1] = (array[0]-array[1]).abs
dp.each_index {|i|
  if i == 0 || i == 1
    next
  end
  dp[i] = [dp[i-1]+(array[i]-array[i-1]).abs,dp[i-2]+(array[i-2]-array[i]).abs].min
}
puts dp[-1]


Measured memory_bytes: 11396
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int x,n;
    cin >> x >> n;
    VI a(n);
    REP(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    for ( int d=0; d<=100; d++ ) {
        {
            auto it=lower_bound(ALL(a),x-d);
            if ( it==a.end()||*it!=x-d ) {
                cout << x-d << '\n';
                break;
            }
        }
        {
            auto it=lower_bound(ALL(a),x+d);
            if ( it==a.end()||*it!=x+d ) {
                cout << x+d << '\n';
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3648
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline long toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline long toLong(string s) {long v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const int INF = 10000;

char mp[22][22];

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

int bfs(int s,int t){
	int sum=0;
	queue<PII>pi;
	pi.push(MP(s,t));
	flag[s][t]=true;
	while(!pi.empty()){
		PII p=pi.front();pi.pop();
		
		sum++;
		REP(i,4){
			int y=p.first+dy[i],x=p.second+dx[i];
			if(mp[y][x]!='#'&&!flag[y][x]){
				flag[y][x]=true;
				pi.push(MP(y,x));
			}
		}
	}
	return sum;
}
int main(){
	int W,H;
	while(cin>>W>>H){
		if(W==0&&H==0)break;
		REP(i,22)REP(j,22){
			mp[i][j]='#';
		}
		CLR(flag);
		int y,x;
		REP(i,H)REP(j,W){
			cin>>mp[i+1][j+1];
			if(mp[i+1][j+1]=='@'){
				mp[i+1][j+1]='.';
				y=i+1;x=j+1;
			}
		}
		
		//cout<<"!"<<y<<" "<<x<<endl;
		cout<<bfs(y,x)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1212
S = input()
dp = [[0 for i in range(4)] for i in range(len(S)+1)]
MOD = 10**9+7
dp[0][3] = 1
for i in range(len(S)):
    if S[i] == '?': k = 3
    else: k = 1
    for _ in range(k):
        dp[i+1][0] += dp[i][0] 
        dp[i+1][1] += dp[i][1] 
        dp[i+1][2] += dp[i][2] 
        dp[i+1][3] += dp[i][3] 
    if S[i] == 'A':
        dp[i+1][0] +=  dp[i][3]
    elif S[i] == 'B':
        dp[i+1][1] +=  dp[i][0]
    elif S[i] == 'C':
        dp[i+1][2] += dp[i][1]
    else:
        dp[i+1][0] += dp[i][3]
        dp[i+1][1] += dp[i][0]
        dp[i+1][2] += dp[i][1]
    for j in range(4):
        if dp[1+i][j] > MOD: dp[i+1][j] %= MOD
print(dp[len(S)][2]%MOD)


Measured memory_bytes: 56796
// asdf_l
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ull, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define INF ((1 << 31)-1)
#define MOD (1000000007)

#define ALL(x) x.begin(), x.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define CHAR2INT(c) (c - '0')
#define COUT(x) cout << x << endl
#define COUT_2DARR(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }

int main() {
#ifdef LOCAL
    std::ifstream in("../arg.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    ull pow3[16];
    pow3[0] = 1;
    REP(i, 15) pow3[i + 1] = pow3[i] * 3;

    int arr[4][2] = {{0, 1}, {1,2}, {2,1}, {1,0}};

    while(true){
        int N, M;
        cin >> N >> M;
        if (N == 0) return 0;

        ull init_state = 0;
        REP(i, 3){
            int k;
            cin >> k;
            REP(j, k){
                int n;
                cin >> n;
                init_state += i * pow3[--n];
            }
        }
        ull final_state1 = 0;
        ull final_state2 = pow3[N] - 1;

        vector<bool> visited(pow3[N], false);
        queue<P> Q;
        Q.push(P(init_state, 0));
        int max_cup[3];
        while (!Q.empty()){
            P p = Q.front(); Q.pop();

            ull state = p.first;
            int count = p.second;

            if (count >= M) {
                COUT(-1);
                break;
            }

            if (state == final_state1 || state == final_state2) {
                COUT(count);
                break;
            }

            visited[state] = true;

            memset(max_cup, -1, sizeof(max_cup));
            ull tmp = state;

            vector<vector<ull>> vec(3, vector<ull>{});
            REP(i, N){
                ull res = tmp % 3;
                max_cup[res] = max(max_cup[res], i);
                tmp /= 3;
            }

            REP(i, 4){
                int src = arr[i][0];
                int dst = arr[i][1];
                if (max_cup[src] > max_cup[dst]){
                    ull next_state = src < dst ? state + pow3[max_cup[src]] : state - pow3[max_cup[src]];
                    if (visited[next_state]) continue;
                    Q.push(P(next_state, count + 1));
                }
            }

        }

    }
}



Measured memory_bytes: 4684
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {  
	ll kazu=1;
	while(1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁


/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll X;cin >> X;
	cout << (X / 500 * 1000) + X % 500 / 5 * 5 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
const int MAX_N = 100;
const int INF = 999999999;
using namespace std;

int dp[MAX_N+1][MAX_N+1];
int p[MAX_N+1];

int main(void) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        dp[i][i] = 0;
    }
    for (int i = 1; i <= n; i++) {
        cin >> p[i-1] >> p[i];
    }

    for (int l = 2; l <= n; l++) {
        for (int i = 1; i <= n-l+1; i++) {
            int j = i+l-1;
            dp[i][j] = INF;
            for (int k = i; k <= j-1; k++) {
                dp[i][j] = min(dp[i][j], dp[i][k]+dp[k+1][j] + p[i-1]*p[k]*p[j]);
            }
        }
    }

    cout << dp[1][n] << endl;

    return 0;
}

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

char memo[101][101];
int h,w;
void fruit(int a,int b,char c);

int main(){
  while(1){
    int t=0;
    for(int i=0;i<101;i++){
      for(int j=0;j<101;j++){
	memo[i][j]='Q';
      }
    }
    cin >> h >> w;
    if(w==0&&h==0)break;
    for(int i=0;i<h;i++){
      cin >> memo[i];
    }
    
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	if(memo[i][j]!='1'){
	  fruit(i,j,memo[i][j]);
	  t++;
	}
      }
    }
    cout << t << endl;
  }
}

void fruit(int i,int j,char c){
  if( i>=0 && j>=0 && i<h && j<w && memo[i][j]==c){
    memo[i][j]='1';
    /*if(c==memo[i+1][j])*/ fruit(i+1,j,c);
    /*if(c==memo[i-1][j])*/ fruit(i-1,j,c);
    /*if(c==memo[i][j+1])*/ fruit(i,j+1,c);
    /*if(c==memo[i][j-1])*/ fruit(i,j-1,c);
    return;
  }
  return;
}

Measured memory_bytes: 1484
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define REP(i,n) FOR(i,0,n)
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;

int main() {
  int n; cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  int cnt4 = 0, cnt2 = 0, cnt1 = 0;
  REP(i,n) {
    if (a[i]%4 == 0) cnt4++;
    else if (a[i]%2 == 0) cnt2++;
    else cnt1++;
  }
  if (cnt2) cnt1++;
  if (cnt4 >= cnt1 - 1) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 640
//BISMILLAHIRRAHMANIRRAHIM....*/
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<cassert>
#include<sstream>
#include<queue>
#include<stack>
#include<iostream>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#define ll long long
#define pb push_back
#define MP make_pair
#define vsort(v) sort(v.begin(),v.end())
#define NL printf("\n")
#define mod 1000000009
#define P(n) printf("%d",n)
#define xx first
#define yy second
#define bit(n) __builtin_popcount(n)
#define sc(a) scanf("%d",&a)
#include <set>
#include<map>
using namespace std;

// freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
/*int fx[] = {1,-1,0,0};
int fy[] = {0,0,1,-1};

int month[]= {31,28,31,30,31,30,31,31,30,31,30,31};
string day[]= {"Monday", "Tuesday", "Wednesday","Thursday","Friday", "Saturday", "Sunday"};
*/
 int ans = 1;
 void solve(int i, int j,int n){
        cout << "X";
       if(i==1 && j==1) return ;
       if(i==n && j==1) return ;
       if(i==n && j==n) return ;
       if(i==1 && j==n) return ;

       solve(i-1,j-1,n);
       solve(i-1,j+1,n);
       solve(i+1,j-1,n);
       solve(i+1,j+1,n);

       cout << endl;

     return ;
 }
 int solve2(int n){
    int o=0;
    if(n==0) return 1;
    while(n>0){
        if(n%10==0) o++;
        n/=10;
    }
    return o;
 }
 void sol(char c){
     char d=c+1;
  cout << d << endl;
  return ;
 }
 int main()
{
   //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

  //   sieve();

       int n,a,b,t;

     //  solve(n,n,n);
     int ans = 0;
     char c;
     cin >> c;
     sol(c);
     /*while(t--){
        cin >> a >> b;
     ans = 0;
     for(int i = a; i<=b; i++){
         ans +=solve2(i);
     }
     cout << ans << endl;
    }

    */


return 0;
}


Measured memory_bytes: 256
IDENTIFICATION DIVISION.
      PROGRAM-ID. 046A.
      DATA DIVISION.
      WORKING-STORAGE SECTION.
      01 INP PIC X(100).
      01 A PIC 9(3).
      01 B PIC 9(3).
      01 C PIC 9(3).
      
      PROCEDURE DIVISION.
      ACCEPT INP.
      UNSTRING INP DELIMITED BY " "
      INTO A B C.
      
      EVALUATE TRUE
      WHEN ( A = B ) AND ( B = C )
      	DISPLAY "1"
      WHEN ( A = B ) AND ( A NOT = C )
      WHEN ( A = B ) AND ( B NOT = C )
      WHEN ( B = C ) AND ( B NOT = A )
      WHEN ( B = C ) AND ( C NOT = A )
      WHEN ( A = C ) AND ( A NOT = B )
      WHEN ( A = C ) AND ( C NOT = B )
      	DISPLAY "2"
      WHEN ( A NOT = B ) AND ( B NOT = C )
      	DISPLAY "3"
      WHEN OTHER
      	CONTINUE
      END-EVALUATE.
      
      STOP RUN.

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl

using namespace std;
using i64 = long long;

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

    i64 sum = 0;

    for (int i = 1; i <= n; i++)
    {
        if ((i % 3 != 0) && (i % 5 != 0))
        {
            sum += i;
        }
    }

    cout << sum << endl;

    return 0;
}

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

int table[200][200];

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

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

    for(int i = 0; i < 200; i++) {
        for(int j = 0; j < 200; j++) {
            table[i][j] = gcd(i + 1, j + 1);
        }
    }

    int x = 0;
    for(int a = 1; a <= k; a++) {
        for(int b = 1; b <= k; b++) {
            int y = table[a - 1][b - 1];
            for(int c= 1; c <= k; c++) {
                x += table[y - 1][c - 1];
            }
        }
    }
    cout << x << endl;
    return 0;
}

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

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

    vector<long> a(n);
    for (long &i: a){
        cin >> i;
    }
    
    long long sum = 0;
    long long product = 0;
    int law = 1000000007;
    for (int j = 0; j < n; j++){
        sum = (sum + a.at(j)) % law;
    }
    for (int i = 0; i < n - 1; i++){
        sum = (sum - a.at(i)) % law;
        if (sum < 0) sum += law;
        product += a.at(i) * sum % law;
    }
    cout << product % law << endl;
}


Measured memory_bytes: 4824
/*  
    Talkin' to myself and feelin' old
    Sometimes I'd like to quit, nothin' ever seems to fit
    Hangin' around, nothin' to do but frown
    Rainy days and Mondays always get me down
    _________________________
    _________________________
    912 Hours of Solitude
    Quarantine_Day : 38
*/

#include<bits/stdc++.h>

using namespace std;

typedef long long int       ll;
typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef pair<int, int>      pii;
typedef pair<ll, ll>		pll;

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<int>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define REP(i,n)        for(int i = (int)(0); i < (int)(n); i++)
#define FOR(i, a, b)    for(int i = (int)a; i <= (int)b; i++)    

#define MAX 50005


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

	int a, b, c, d;
	cin>>a>>b>>c>>d;

	cout<<max(0, min(b, d) - max(a, c))<<"\n";
	
	return 0;
}


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

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

  char prev = s[0];
  int ans = 1;
  for (int i = 1; i < n; i++)
  {
    if(s[i]!=prev){
      prev=s[i];
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
#!/usr/bin/env python3
n = int(input())
x = list(map(int,input().split()))
a = sorted(x)
base = a[n//2]
for i in range(n):
    #if x[i] > a[n//2-1] or (x[i] == a[n//2-1] and a.count(x[i]) > 1): print(a[n//2-1])
    if x[i] > a[n//2-1]: print(a[n//2-1])
    else: print(a[n//2])

Measured memory_bytes: 26016
n = int(input())
d = [[0] * 21 for _ in range(21)]
ans = 0
for _ in range(n):
    a = input()
    if '.' not in a:
        c2 = c5 = 0
    else:
        c2 = c5 = -(len(a) - (a.index('.') + 1))
    a = int(a.replace('.',''))
    while a % 2 == 0:
        a //= 2
        c2 += 1
    while a % 5 == 0:
        a //= 5
        c5 += 1
    c2 = min(10, c2)
    c5 = min(10, c5)
    for i in range(-c2, 11):
        for j in range(-c5, 11):
            ans += d[i+10][j+10]
    d[c2+10][c5+10] += 1
print(ans)

Measured memory_bytes: 72272
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int b[] = new int[n];
            int f[] = new int[n];
            int r[] = new int[n];
            int v[] = new int[n];
            int num[][][] = new int[4][3][10];

            for (int i = 0; i < n; i++) {
                b[i] = sc.nextInt();
                f[i] = sc.nextInt();
                r[i] = sc.nextInt();
                v[i] = sc.nextInt();
                num[b[i]-1][f[i]-1][r[i]-1] += v[i];
            }
            for (int k = 0; k < 4; k++){
                for (int i = 0; i < 3; i++) {
                    for (int j = 0; j < 10; j ++) {
                        System.out.printf(" %d",num[k][i][j]);
                    }
                    System.out.println();
                }
                if (k == 3) break;
                System.out.printf("####################\n");
            }
        }
    }
}


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

int cheak(int a,int b){
    if(a<b){
        if (b/2<a) {
            return b-a;
        }
        return a;
    }
    return a-b;
}

int main(){
    int n,k;
    int x[100];
    cin>>n>>k;
    for (int i=0; i<n; i++) cin>>x[i];
    int sum=0;
    for (int i=0; i<n; i++){
        sum+=cheak(x[i],k);
    }
    cout<<sum*2<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace ABC109_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var AB = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var A = AB[0];
            var B = AB[1];

            if (A % 2 == 0 || B % 2 == 0)
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}


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

int main(){
    int N;
    cin >> N;
    int ans = 0;
    vector<int>A(N);
    vector<int>B(N);
    vector<int>C(N-1);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for(int i = 0; i < N; i++) {
        cin >> B[i];
        ans += B[i];
    }
    for(int i = 0; i < N-1; i++) {
        cin >> C[i];
    }
    for(int i = 1; i < N; i++) {
        if(A[i]-1 == A[i-1]) {
            ans += C[A[i]-2];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            sum = 500 * a + 100 * b + 50 * c
            # print(sum)
            if(sum == X):
                count += 1

print(count)


Measured memory_bytes: 3060
n,a,b,c,d = map(int,input().split())
S = input()
ans = 'Yes'

if d > c: #B君の方が目的地が遠い
    if S[b:d].count('##') != 0:
        ans = 'No'
    else:
        if S[a:c].count('##') != 0:
            ans = 'No'
else:
    if S[a:c].count('##') != 0:
         ans = 'No'
    else:
        if S[b-2:d+1].count('...') == 0:
            ans = 'No'

print(ans)          

Measured memory_bytes: 3572