akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+5;
//int a[N];

int main()

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

    int arr[3];

    cin >> arr[0] >> arr[1] >> arr[2];

    sort(arr, arr+3);

    if (arr[2] == arr[1]) cout << arr[0];
    else cout << arr[2];

    return 0;
}


Measured memory_bytes: 256
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_C&lang=jp

#include <iostream>
using namespace std;

struct Card {
    char suit, value;
};

void bubble(struct Card A[], int N)
{
    for( int i = 0; i < N; i++ ){
	for( int j = N - 1; j >= i; j-- ){
	    if( A[j].value < A[j - 1].value ){
		Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t;
	    }
	}
    }
}

void selection(struct Card A[], int N)
{
    for( int i = 0; i < N; i++ ){
	int minj = i;
	for( int j = i; j < N; j++ ){
	    if( A[j].value < A[minj].value ) minj = j;
	}
	Card t = A[i]; A[i] = A[minj]; A[minj] = t;
    }
}

void print(struct Card A[], int N)
{
    for( int i = 0; i < N; i++ ){
	if( i > 0 ) cout << " ";
	cout << A[i]. suit << A[i].value;
    }
    cout << endl;
}

//バブルソートと選択ソートの結果を比較
bool isStable(struct Card C1[], struct Card C2[], int N)
{
    for( int i = 0; i < N; i++ ){
	if( C1[i].suit != C2[i].suit ) return false;
    }
    return true;
}

int main()
{
    Card C1[100], C2[100];
    int N;
    char ch; // ?

    cin >> N;
    for( int i = 0; i < N; i++ ){
	cin >> C1[i].suit >> C1[i].value;
    }

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

    bubble(C1, N);
    selection(C2, N);

    print(C1, N);
    cout << "Stable" << endl;
    print(C2, N);
    if( isStable(C1, C2, N) ){
	cout << "Stable" << endl;
    } else {
	cout << "Not stable" << endl;
    }

    return 0;
}

Measured memory_bytes: 1156
N = int(input())
values = [int(input()) for i in range(N)]
values = sorted(values)

sort_values = []
med = int(N/2) if N % 2 == 1 else int(N/2)-1
prev = values[med]
A = values[:med]
B = list(reversed(values[med+1:]))
BAsum = 0
for i in range(med+1):
  if i >= len(B):
    break
  now = B[i]
  BAsum += abs(now-prev)
  prev = now
  if i >= len(A):
    break
  now = A[i]
  BAsum += abs(now-prev)
  prev = now

med = int(N/2)
prev = values[med]
A = values[:med]
B = list(reversed(values[med+1:]))
ABsum = 0
for i in range(med+1):
  if i >= len(A):
    break
  now = A[i]
  ABsum += abs(now-prev)
  prev = now
  if i >= len(B):
    break
  now = B[i]
  ABsum += abs(now-prev)
  prev = now  

#print(A, B)
print(max([BAsum, ABsum]))

Measured memory_bytes: 8532
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long ll;

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

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N,cnt=0;
  cin>>N;
  vector<int> A(N);
  REP(i,N){
    cin>>A[i];
  }
  REP(i,N-1){
    if(A[i]==i+1){
      swap(A[i],A[i+1]);
      cnt++;
    }
  }
  if(A[N-1]==N)cnt++;
  cout<<cnt<<endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

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

void solve(void)
{
  int N,A;cin>>N>>A;
  vector<int> vec (N,0);
  for (int i = 0; i < N; i++)
  {
     cin>>vec[i];
  }
  int M = 2550;
  vector<vector<vector<int> > > DP (N+1 ,vector<vector<int> >(N+1,vector<int>(M,0)));
  DP[0][0][0] = 1;
  for (int i = 0; i < N; i++)//までの数で
  {
    for (int j = 0; j < N; j++)
    {
      for (int k = 0; k < M; k++)
      {
        DP[i+1][j][k] += DP[i][j][k];
      }
      
    }
    
    for (int j = i; j >= 0; j--)//枚使って
    {
      for (int k = 0; k < M; k++)//できる
      {
        if(k + vec[i] >= M)continue;
        DP[i+1][j+1][k+vec[i]] += DP[i][j][k];
      }
    }
  }
  int ANS = 0;
  // DEBUG(DP[N][1]);
  for (int i = 1; i <= N; i++)
  {
    int T = A*i;
    ANS += DP[N][i][T];
    
  }
  cout<<ANS<<endl;
  
  

  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

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

  return 0;
}


Measured memory_bytes: 53248
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, K): (usize, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };
    let a: Vec<i64> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };

    let s: Vec<i64> = {
        let mut s = vec![];
        for i in 0..N {
            let mut acc = 0;
            for j in i..N {
                acc += a[j];
                s.push(acc);
            }}
        s
    };
    let M = s.len();
    let mut useable = vec![true; M];
    let mut res: i64 = 0;
    for k in (0..50).rev() {
        if (0..M).filter(|&i| useable[i] && ((s[i] >> k) & 1) == 1).count() >= K {
            for i in 0..M { useable[i] &= ((s[i] >> k) & 1) == 1; }
            res += 1 << k;
        }
    }
    let ans = res;

    println!("{}", ans);
}

Measured memory_bytes: 9976
#include<bits/stdc++.h>
using namespace std;
char s[1000];
int main(){
	int n;
	scanf("%d",&n);
	scanf("%s",s);
	s[n] = 'D';
	s[n+1] = 'D';
	int res = 0;
	for(int i=0;i<n;i++){
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C' )
			res++;
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 256
def input_from_console():
    l, r = map(int, input().split())
    return l, r


def solve(l, r):
    minimum = 2020
    if r - l >= 2019:
        return 0
    a, b = l % 2019, r % 2019
    if r // 2019 > l // 2019:
        return 0
    for i in range(a, b):
        for j in range(a + 1, b + 1):
            minimum = min(minimum, (i * j) % 2019)
    result = minimum
    return result


def main():
    l, r = input_from_console()
    print(solve(l, r))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()


Measured memory_bytes: 3188
import java.util.Scanner;

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

		s = sc.nextLine();
		String array[] = s.split("");

		if(array[2].equals(array[3]) && array[4].equals(array[5])){
			System.out.println("Yes");
		}else{
				System.out.print("No");
		}
	}
}

Measured memory_bytes: 23124
x = int(input())

if 6 < x < 11:
    print(2)
    exit()
elif 1 <= x <= 6:
    print(1)
    exit()

if x % 11 == 0:
    print((x // 11) * 2)
else:
    num = (x // 11) * 2
    amari = x % 11
    if 0 <= amari <= 6:
        print(num + 1)
    else:
        print(num + 2)


Measured memory_bytes: 9136
import java.util.Scanner;

public class Main {

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

		int a = scan.nextInt();
		int b = scan.nextInt();

		System.out.printf("%d %d %f\n", (a / b), (a % b), (double)a / b);
		scan.close();
	}
}

Measured memory_bytes: 17180
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

// ミラーラビン素数判定法 (Miller-Rabin Primality Test)
template<typename T>
struct MLPT {
    MLPT() {}

    T mod_pow(T x, T n, T mod) {
        if(n == 0) return 1;
        T res = mod_pow((x * x) % mod, n / 2, mod);
        if(n & 1) res = (res * x) % mod;
        return res;
    }

    bool solve(T N) {
        if(N <  2) return false;
        if(N == 2) return true;
        int case_num = 10;
        
        srand( time(NULL) );
        while(case_num--) {
            // 適当な a \in [1, N-1] を用意してテスト。合成数であれば弾こう
            T a = (rand() % (N-1)) + 1;
            T d = N-1, s = 0;
            while(d % 2 == 0) d >>= 1, s++;

            if(mod_pow(a, d, N) == 1) continue;
            bool pbprime = false;
            for(int r=0; r<s; r++) {
                if(mod_pow(a, d*(1LL << r), N) == N-1) {
                    pbprime = true;
                    break;
                }
            }
            if(!pbprime) return false;
        }
        return true;
    }
};
 
signed main() {
    int T; scanf("%lld", &T);
    MLPT<int> ml;

    int ans = 0;
    while(T--) {
        int num; scanf("%lld", &num);
        bool pr = ml.solve(num);
        ans += pr;
    }
    printf("%lld\n", ans);
    return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n;
  cin >> n;
  vector<ll> h(n);  rep(i, 0, n) cin >> h[i];
  
  ll high = h[0];
  rep(i, 0, n) {
    if(high > h[i] +1) {
      cout << "No" << "\n";
      return 0;
    }
    high = max(high, h[i]);
  }
  
  cout << "Yes" << "\n";
}

Measured memory_bytes: 1024
# coding: utf-8

S = input()
Q = int(input())


heads = {}
tails = {}
h = 0
t = 0
rev = False
for _ in range(Q):
    line = input()

    if line[0] == "1":
        rev = not rev

    else:
        if line[2] == "1":
            if rev:
                # S = "".join([S, line[4]])
                tails[t] = line[4]
                t += 1
            else:
                # S = "".join([line[4], S])
                heads[h] = line[4]
                h += 1
        else:
            if rev:
                # S = "".join([line[4], S])
                heads[h] = line[4]
                h += 1
            else:
                # S = "".join([S, line[4]])
                tails[t] = line[4]
                t += 1

head = [None] * h
tail = [None] * t

for i in range(h):
    head[i] = heads[i]
head = head[::-1]

for i in range(t):
    tail[i] = tails[i]

head_joint = "".join(head)
tail_joint = "".join(tail)
joint = "".join([head_joint, S, tail_joint])

if rev:
    print(joint[::-1])
else:
    print(joint)


Measured memory_bytes: 24336
#include<iostream>
using namespace std;
int main() {
  int a,b;
  cin >> a >> b;
  if(a*b*1 %2 != 0 || a*b*2 %2 != 0 || a*b*3 %2 != 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
// Author: Jinhai Chen
#include <cstring>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long ll;
int n,A,t;
const int maxn = 1e5+10;
double h[maxn],a[maxn];


int main() {
#ifndef ONLINE_JUDGE
//	freopen("data.in","r",stdin);
#endif
	ios::sync_with_stdio(false);
	cin>>n>>t>>A;
	for(int i=1;i<=n;i++) cin>>h[i];
	for(int i=1;i<=n;i++) a[i]=t-0.006*h[i];
	double g=1e19;
	int ans=-1;
	for(int i=1;i<=n;i++) {
		if(fabs(a[i]-A)<g) {
			g=fabs(a[i]-A);
			ans=i;
		}
	}
	cout<<ans<<endl;
	return 0;
}














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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

int l[500000];
int r[500000];
int depth[500000];
int leafNum[500000];
ll notSave[500000];
ll doSave[500000];

int main() {
  int n;
  cin >> n;
  REP(i,n-1) {
    scanf("%d %d",l+i,r+i);
    --l[i];
    --r[i];
  }
  depth[0] = 0;
  REP(i,n-2) {
    depth[l[i]] = depth[r[i]] = depth[i]+1;
  }
  leafNum[n-1] = 1;
  for (int i=n-2; i>=0; --i) {
    leafNum[i] = leafNum[l[i]] + leafNum[r[i]];
    notSave[i] = leafNum[i] + notSave[l[i]] + notSave[r[i]];
    doSave[i] = min(min(notSave[l[i]] + leafNum[l[i]] + 1 + doSave[r[i]],
                        notSave[r[i]] + leafNum[r[i]] + 1 + doSave[l[i]]),
                    doSave[l[i]] + doSave[r[i]] + 2 + depth[i]);
    // cout << i << " " << leafNum[i] << " " << notSave[i] << " "<< doSave[i] << endl;
  }
  cout << doSave[0] << endl;
}

Measured memory_bytes: 16864
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			int in = Integer.parseInt(br.readLine());

			 System.out.println("AB"+(in<=999?"C":"D"));
		}
	}
}

Measured memory_bytes: 25176
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {

    var n = parseInt(input[0], 10);

    var ans = '';
    var count = 0;
    var i = 0;
    for (i = 11; i <= 55555; i += 5) {
        if (IsPrime(i)) {
            if (i > 11) {
                ans += ' ';
            }
            ans += i.toString();
            count++;
            if (count >= n) {
                break;
            }
        }
    }

    console.log(ans);

    return 0;
}

function IsPrime(num) {

    if (num === 2) {
        return true;
    }

    if (num <= 1) {
        return false;
    }

    var i = 0;
    for (i = 2; i < num; i++) {

        if (num % i === 0) {
            return false;
        }
    }

    return true;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    LL n, m;cin >> n >> m;
    if(n == 1 && m == 1){
        cout << 1 << endl;
        return 0;
    }
    if(n == 1){
        cout << m-2 << endl;
        return 0;
    }
    if(m == 1){
        cout << n-2 << endl;
        return 0;
    }
    printf("%lld\n", (n-2LL)*(m-2LL));
    return 0;
}


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

const ll MOD = 1000000007;

void ruiseki(vector<ll> &A, int a){
    A[a] = A[a-1] + a;
    return;
}

int main() {
    int N, K; cin >> N >> K;
    vector<ll> X(N+1),Y(N+1),Z(N+2);
    rep(i, N+1){
        X[i] = i;
    }
    Y[0] = 0;
    rep(i, N){
        ruiseki(Y, i+1);
    }

    for (int i = K; i <= N; i++){
        ll mi,ma;
        mi = Y[i-1];
        ma = Y[N] - Y[N-i];
        Z[i] = ma - mi + 1;
    }
    Z[N+1] = 1;

    ll sum = 0;
    for (int i = K; i <= N+1; i++){
        sum = (sum + Z[i]) % MOD;
    }

    cout << sum << endl;

}

Measured memory_bytes: 7984
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;
int n;
vector<int> g[100005];
int mxb(int a){
  return 31-__builtin_clz(a);
}
int dfs(int v,int p){
  int mask=0,incr=-1;
  for(auto to:g[v]){
    if(to==p) continue;
    int tmp=dfs(to,v);
    if(tmp&mask) chmax(incr,mxb(tmp&mask));
    mask|=tmp;
  }
  if(incr==-1) incr=0;
  for(int i=incr;;++i) if(!(mask>>i&1)){
    mask|=(1<<i);
    mask&=~((1<<i)-1);
    break;
  }
  return mask;
}


int main(){
  cin>>n;
  REP(i,n-1){
    int a,b;scanf("%d%d",&a,&b);--a;--b;
    g[a].pb(b);
    g[b].pb(a);
  }
  int res=dfs(0,-1);
  int ans=0;
  REP(i,30) if(res>>i&1) ans=i;
  cout<<ans<<endl;
  return 0;
}





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

int main()
{
  int n;
  cin >> n;
  string w[n];
  for(int i = 0; i < n; ++i) cin >> w[i];
  
  for(int i = 0; i < n-1; ++i){
    for(int j = i+1; j < n; ++j){
      if(w[i] == w[j]){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  
  for(int i = 0; i < n-1; ++i){
    if(w[i].back() != w[i+1].front()){
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>

int main() {

    int a, b;

    scanf("%d %d", &a, &b);

    int mysum = a * b - (a + b) + 1;

    printf("%d", mysum);

}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
using namespace std ;
using ll = long long;

int main(){
    int N,K,X,Y;
    int a = 0;
    cin >> N;
    cin >> K;
    cin >> X;
    cin >> Y;
    if(N <= K){
        a = N*X;
    }else{
        a = K*X+Y*(N-K);
    }
    cout << a;
    return 0 ;
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

ll n;
ll a[60];
ll m=60;

ll dp[61][2][3];

int main(){
  cin>>n;
  rep(i,m){
    if((n>>i)&1LL)a[i]=1;
  }
  reverse(a,a+m);
  dp[0][0][0]=1;
  rep(i,m){
    rep(j,2){
      rep(k,3){
        if(dp[i][j][k]==0)continue;
        rep(b,(j==0?a[i]+1:2)){
          if(a[i]==0){
            if(b==0){
              { // 0 0
                if(k>0) (dp[i+1][!(j==0&&b==a[i])][2]+=dp[i][j][k])%=mod;
                else (dp[i+1][!(j==0&&b==a[i])][0]+=dp[i][j][k])%=mod;
              }
              if(j==1&&k>0){ // 1 1
                if(k==1) (dp[i+1][!(j==0&&b==a[i])][0]+=dp[i][j][k])%=mod;
                else (dp[i+1][!(j==0&&b==a[i])][2]+=dp[i][j][k])%=mod;
              }
            }else if(b==1){
              if(j==1&&k>0){ // 1 0
                (dp[i+1][!(j==0&&b==a[i])][k]+=dp[i][j][k])%=mod;
              }
            }
          }else if(a[i]==1){
            if(b==0){
              { // 0 0
                if(k>0) (dp[i+1][!(j==0&&b==a[i])][2]+=dp[i][j][k])%=mod;
                else (dp[i+1][!(j==0&&b==a[i])][1]+=dp[i][j][k])%=mod;
              }
              if(j==1&&k>0){ // 1 1
                if(k==1) (dp[i+1][!(j==0&&b==a[i])][1]+=dp[i][j][k])%=mod;
                else (dp[i+1][!(j==0&&b==a[i])][2]+=dp[i][j][k])%=mod;
              }
            }else if(b==1){
              { // 1 0
                if(k>0) (dp[i+1][!(j==0&&b==a[i])][2]+=dp[i][j][k])%=mod;
                else (dp[i+1][!(j==0&&b==a[i])][0]+=dp[i][j][k])%=mod;
              }
            }
          }
        }
      }
    }
  }
  ll res=0;
  rep(j,2)rep(k,3){
    (res+=dp[m][j][k])%=mod;
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define len 100005
struct task {
	char name[100];
	int time;
};
int head=0, tail=0;
void enqueue(task add,task* q) {
	q[tail] = add;
	tail = (tail + 1) % len;
}

task dequeue(task* q) {
	task temp = q[head];
	head = (head + 1) % len;
	return temp;
}
task tasks[len];
int main() {
	int t0, n;
	cin >> n >> t0;
	int t = 0;
	for (int i = 0; i < n; i++) {
		cin >> tasks[i].name >> tasks[i].time;
		tail++;
	}
	while(head!=tail||(head==0 && tail==0)) {
		if (tasks[head].time <= t0) {
			t += tasks[head].time;
			tasks[head].time = 0;
			cout << tasks[head].name << " " << t << endl;
			dequeue(tasks);
		}
		else {
			t += t0;
			tasks[head].time -= t0;
			enqueue(tasks[head], tasks);
			dequeue(tasks);
		}
	}
	int x = 1;
	return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner scanner = new Scanner(System.in);
		int[] a = new int[3];
		for(int i = 0; i < 3; i++){
			a[i] = scanner.nextInt();
		}
		Arrays.sort(a);
		if(a[0] == a[1] && a[0] == 5 && a[2] == 7){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 23764
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
string s;
int main(){
cin>>s;
if (s[0]!='A'||isupper(s[1])||isupper(s.back())) return puts("WA"),0;
int cnt[999]={0};
for (int i=2;i<s.size()-1;++i){
  cnt[s[i]]++;
  }
if (cnt['C']!=1) return puts("WA"),0;
int llx=0;
for (int i='A';i<='Z';++i) if (cnt[i]) ++llx;
puts(llx!=1?"WA":"AC");
}

Measured memory_bytes: 256
import sys
import bisect
_input = sys.stdin.readlines()
a, b, q = [int(i) for i in _input[0].split()]
data = [int(i) for i in _input[1:]]
s_ls = data[:a]
t_ls = data[a:a+b]
x_ls = data[-q:]
INF = 10 ** 18

for x in x_ls:
    s_ind = min(bisect.bisect_left(s_ls, x), a-1)
    t_ind = min(bisect.bisect_left(t_ls, x), b-1)
    best = INF
    for _s in [-1, 0]:
        if s_ind == 0 and _s == -1:
            continue
        for _t in [-1, 0]:
            if t_ind == 0 and _t == -1:
                continue
            s = s_ls[s_ind + _s]
            t = t_ls[t_ind + _t]
            if (s - x) * (t - x) >= 0:
                dis = max(abs(t - x), abs(s - x))
            else:
                dis = min(abs(t - x), abs(s - x)) * 2 + max(abs(t - x), abs(s - x))
            best = min(dis, best)
    print(best)

Measured memory_bytes: 122732
#include <cstdio>
#include <algorithm>

using namespace std;

const int N=2e5+10;

int n,A[N],now[N];

void Init()
{
	scanf("%d",&n);
	n=2*n-1;
	for (int i=1;i<=n;++i) scanf("%d",&A[i]);
}

int len[N],op[N];
bool Check(int x)
{
	for (int i=1;i<=n;++i) if (A[i]>=x) now[i]=1;else now[i]=0;
	int top=0,cnt=0;
	for (int i=1;i<=n;)
	{
		int pos=i;
		while (now[pos]==now[i] && i<=n) ++i;
		if (i-pos>1)
		{
			if (top && now[pos]==op[top]) len[top]+=i-pos+cnt;
			else 
			{
				++top; len[top]=i-pos;
				if (top-1) len[top-1]+=cnt>>1,len[top]+=cnt>>1;else len[top]+=cnt;
				op[top]=now[pos];
			}
			cnt=0;
		}else cnt++;
	}
	if (!top) return now[1];
	len[top]+=cnt;cnt=0;
	int sum=0;
	for (int i=1;i<=top;++i) sum+=len[i];
	int l=1,r=top;
	while (l!=r)
	{
		int del=min(len[l],len[r]);
		len[l]-=del; len[r]-=del;
		if (!len[l]) ++l;
		if (!len[r]) --r;
	}
	return op[l];
}

void Solve()
{
	int l=1,r=n;
	while (l<=r)
	{
		int mid=(l+r)>>1;
		if (Check(mid)) l=mid+1;
		else r=mid-1;
	}
	printf("%d\n",r);
}

int main()
{
	Init();
	Solve();	
	return 0;
}

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

long long GCD(long long x,long long y){
    if(y == 0)return x;
    return GCD(y,x%y);
}

int main(){
    int N;
    long long K;
    cin >> N >> K;
    long long ma = 0, g = 0;
    for(int i = 0; i < N;i++){
        long long a;cin >> a;
        ma = max(ma,a);
        g = GCD(g,a);
    }
    
    if(K <= ma && K%g == 0)cout << "POSSIBLE" <<endl;
    else cout << "IMPOSSIBLE" << endl;
    
}

Measured memory_bytes: 256
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
--
-- 1 <= input to f <= n
local function find_min_true(n, f)
    local function loop(i, j)
        if i == j then
            --assert(i >= 1 and i <= n + 1)
            return i
        end
        local h = math.floor((i + j) / 2)
        --assert(h >= 1 and h <= n)
        if f(h) then
            return loop(i, h)
        else
            return loop(h + 1, j)
        end
    end
    return loop(1, n + 1)
end
--
local N = read.n()
local L = read.N(N)
table.sort(L)
local ans = 0
for i=1,N-2 do
    local a = L[i]
    for j=i+1,N-1 do
        local b = L[j]
        local function count()
            local function f(x)
                x = x + j -- [1,N-j] --> [j+1,N]
                local c = L[x]
                return c >= a + b
            end
            return find_min_true(N-j, f) - 1
        end
        ans = ans + count()
    end
end
print(ans)


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

int main() {
    int a, b;
    cin >> a >> b;
    int ans;
    if(a>=12) ans = b;
    if(a >= 6 && a <= 12) ans = b/2;
    if(a<=5) ans = 0;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename T>
T gcd(T a, T b){
    T n = min(a,b);
    T m = max(a,b);
    if(n == 0){ return m;}
    else {
        return gcd(n, m % n);
    }
}

int main(void)
{
    ll N, M;
    
    string S, T;

    cin >> N >> M >> S >> T;

    ll L = N * M / gcd(N, M);
    bool match = false;
    int i = 0;
    while(true){
        if(i * L/M >= N || i * L/N >= M) break;

        if(S[i * L/M] == T[i * L/N]){
            match = true;
        } else {
            match = false;
            break;
        }
        i++;
    }
    if(match){
        cout << L << endl;
    } else {
        cout << -1 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3768
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int change, u100, u500, u1000;

    void run(){
	while(sc.hasNext()){
	    int a = sc.nextInt();
	    int b = sc.nextInt();
	    if(!(a==0 && b==0)){
		change = b-a;
		u100 = 0;
		u500 = 0;
		u1000 = 0;
		solve();
	    }
	}
    }

    void solve(){
	while(change>=1000){
	    u1000++;
	    change -= 1000;
	}
	while(change>=500){
	    u500++;
	    change -= 500;
	}
	u100 = change/100;
	System.out.println(u100+" "+u500+" "+u1000);
    }
}
		    

Measured memory_bytes: 24620
/*
 * main.c
 *
 *  Created on: 2020/07/27
 *      Author: 113896
 */
#include <stdio.h>


int main() {

	int W, H, x, y, r;
	scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);

	int ans = 1;
	if (x-r < 0) ans = 0;
	if (y-r < 0) ans = 0;
	if (x+r > W) ans = 0;
	if (y+r > H) ans = 0;

	if (ans) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

	return 0;
}



Measured memory_bytes: 2132
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
int main() {
	int N;
	int sumL = 0;
	vector<int> L;
	cin >> N;
	
	L.resize(N);

	for (int i = 0; i < N; ++i) {
		cin >> L[i];
		sumL += L[i];
	}
	sort(L.rbegin(), L.rend());
	sumL -= L[0];

	//cout << L[0] << " " << sumL << endl;
	if (L[0] < sumL)cout << "Yes" << endl;
	else cout << "No" << endl;

	system("pause");
	return 0;
}

Measured memory_bytes: 504
N, K = map(int, input().split())
mod = 10**9 + 7

gcd = {}
s = 0

for x in range(K,0,-1):
  
    i = K // x
    tmp = pow(i,N,mod)  # 組み合わせ数
    
    if i > 1:
        for j in range(2,i+1):
            tmp -= gcd[j * x]
    
    gcd[x] = tmp
    s += (tmp * x) % mod
    s %= mod

print(s)

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

using pil = std::pair<long long, int>;
constexpr long long mod{1000000007};

struct Node {
	// いずれも0:s→t、1:t→s
	long long path_num[2]{}, distance[2]{1LL << 60, 1LL << 60};
	std::list<std::pair<int, long long>> edges;
};
int n, m, s, t;
std::vector<Node> graph;

void dijkstra(int, int);
long long calcNum(int, int);
long long pow2(long long);

int main()
{
	scanf("%d%d%d%d", &n, &m, &s, &t);
	s--; t--;
	graph.resize(n);
	for (int i{}; i < m; i++)
	{
		int u, v;
		long long d;
		scanf("%d%d%lld", &u, &v, &d);
		u--; v--;
		graph[u].edges.push_back({v, 2 * d});
		graph[v].edges.push_back({u, 2 * d});
	}
	dijkstra(s, 0);
	dijkstra(t, 1);

	graph[s].path_num[0] = graph[t].path_num[1] = 1;
	calcNum(t, 0);
	calcNum(s, 1);
	
	const long long encount_time{graph[t].distance[0] / 2};
	long long encount_combi{};
	for (int i{}; i < n; i++)
	{
		if (!graph[i].path_num[0] || graph[i].distance[0] > encount_time) continue;
		// 以下、頂点iが最短経路上に存在するかつ頂点sのencount_time閉近傍内の場合のみ
		if (graph[i].distance[0] == encount_time && graph[i].distance[1] == encount_time)
		{
			encount_combi = (encount_combi + pow2(graph[i].path_num[0] * graph[i].path_num[1] % mod)) % mod;
			continue;
		}
		// 以下、頂点iは頂点sのencount_time近傍内
		for (auto& e: graph[i].edges)
		{
			if (!graph[e.first].path_num) continue;
			int& dir{i}, rev{e.first};
			// 以下、revは最短経路上に存在
			if (graph[rev].distance[1] >= encount_time) continue;
			// 以下、revはtのencount_time近傍上に存在
			if (graph[dir].distance[0] + e.second != graph[rev].distance[0]) continue;
			// 辺(dir,rev)を通る最短経路が存在
			encount_combi = (encount_combi + pow2(graph[dir].path_num[0] * graph[rev].path_num[1] % mod)) % mod;
		}
	}
	printf("%lld\n", (pow2(graph[t].path_num[0]) % mod + mod - encount_combi) % mod);

	return 0;
}

void dijkstra(int from, int direct)
{
	std::priority_queue<pil, std::vector<pil>, std::greater<pil>> pq;
	pq.push({0, from});
	while (!pq.empty())
	{
		pil dist{pq.top()};
		pq.pop();
		if (dist.first > graph[dist.second].distance[direct]) continue;
		graph[dist.second].distance[direct] = dist.first;
		for (auto& e: graph[dist.second].edges)
			if (graph[dist.second].distance[direct] + e.second < graph[e.first].distance[direct])
			{
				graph[e.first].distance[direct] = graph[dist.second].distance[direct] + e.second;
				pq.push({dist.first + e.second, e.first});
			}
	}
	return;
}

long long calcNum(int index, int direct)
{
	long long& path_num{graph[index].path_num[direct]};
	if (path_num > 0) return path_num;
	for (auto& e: graph[index].edges)
		if (graph[e.first].distance[direct] + e.second == graph[index].distance[direct])
			path_num = (path_num + calcNum(e.first, direct)) % mod;
	return path_num;
}

long long pow2(long long x) { return x * x % mod; }

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

int main(){
    int N;
    cin >> N;
    int A[N];
    int a=0;
    rep(i,N){
        cin >> A[i];
    }
    rep(i,N){
        if(A[i]%2==0){
            if(A[i]%3==0 || A[i]%5==0);
            else a++;
        }
    }
    if(a==0)cout <<"APPROVED";
    else cout << "DENIED";
    
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	int n;
	char b[111];
	cin>>n;
	int flag=0;
	for(int i=0;i<n;i++){
		scanf(" %c",&b[i]);
		if(b[i]=='Y')flag=1;
	}
	if(flag==1)printf("Four\n");
	else printf("Three\n");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;



int main(){
    ll N;
    cin >> N;
    vector<ll> A(N,0);
    for(ll i=0;i<N;i++){
        cin>>A[i]
    ;}
    sort(A.begin(), A.end());
    ll M=A[N-1];
    ll t=lower_bound(A.begin(), A.end(), M/2)-A.begin();
    if(t!=0){
    ll s=t-1;
    if(abs(A[t]-(double)M/2)>=abs(A[s]-(double)M/2))t=s;}
    cout<<M<<" "<<A[t]<<endl;
    
    return 0;
}


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

int main(void){
    int n;
    string s;
    cin >> n >> s;
    int ans = 0, t;
    for (int i=1; i<n; i++) {
        t = 0;
        vector<int> c(26, 0);
        for (int j=0; j<i; j++) {
            for (int k=i; k<n; k++) {
                if (c[s[j]-'a'] == 0 &&s[j] == s[k]) {
                    c[s[j]-'a'] = 1;
                    t++;
                    break;
                }
            }
        }
        ans = max(ans, t);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3612
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    S = input().strip()
    if S == b'ABC':
        print("ARC")
    else:
        print("ABC")

if __name__ == "__main__":
	main()

Measured memory_bytes: 61736
import math
a,b,h,m = map(float,input().split())
# x1=a*math.cos(2*math.pi/12*(3-h))
# y1=a*math.sin(2*math.pi/12*(3-h))
#
# x2=b*math.cos(2*math.pi/60*(15-m))
# y2=b*math.sin(2*math.pi/60*(15-m))



rad = 2*math.pi*(h/12 + m/60/12 - m/60)

ans = a**2 + b**2 - 2 * a * b * math.cos(rad)
print(math.sqrt(ans))

Measured memory_bytes: 9436
#include <stdio.h>
int prime(int n);
int main(void) {
	int n,k;
	scanf("%d", &n);

	if (prime(n))
		printf("%d",n);
	else {
		for(k=n;prime(k)==0;k++){
		}
		printf("%d",k);
		}
	
	return 0;
}

/*素数を判定する関数
 * 素数であれば1を返し、素数でなければ0を返す
 */
int prime(int n) {
	int i; 
	
	for (i = 2; i < n; i++) {
		if (n % i == 0) {
			return 0;
		}
	}
	return 1;
}


Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
inline int input() { int x; scanf("%d", &x); return x; }
const int maxn = 505;
int f[maxn], g[maxn];
int a[maxn][maxn];
void get(int l, int r) {
    int n = r - l + 1;
    if(n <= 2) {
        a[l][r] = f[n];
        return;
    }
    int mid = l + g[n] - 1;
    get(l, mid);
    get(mid + 1, r);
    for(int i = l; i <= mid; i ++)
        for(int j = mid + 1; j <= r; j ++)
            a[i][j] = f[n];
}

int main() {
    int n = input();
    f[1] = f[2] = 1;
    for(int i = 3; i <= n; i ++) {
        f[i] = 1000000000;
        for(int j = 1; j < i; j ++) {
            int v = std::max(f[j], f[i - j]) + 1;
            if(v < f[i]) {
                f[i] = v;
                g[i] = j;
            }
        }
    }
    get(1, n);
    for(int i = 1; i < n; i ++) {
        for(int j = i + 1; j <= n; j ++)
            printf("%d ", a[i][j]);
        puts("");
    }
}

Measured memory_bytes: 1408
"""
int(input())
map(int, input().split())
list(map(int, input().split()))
input()
input().split()
"""


n = int(input())
mod = 1000000007
tmp = (10**n)%mod
diff = 2*(9**n)%mod
eight = (8**n)%mod

ans = tmp - diff + eight
ans%=mod
print(ans)


Measured memory_bytes: 10660
/*

                              Jai Shree Krishna !!
                                 Radhe Radhe !!
                                 
             उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।।
             
*/
   
   
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int,int>
#define vvi vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(int j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define endl "\n"
#define mp make_pair
#define ins insert
#define rep(i,s,e)  for(int i=s;i<=e;i++)
#define repd(i,s,e)  for(int i=e;i>=s;i--)
#define vb vector<bool>
#define read2(n,m) int n,m; cin >> n >> m;
#define range(v) v.begin(),v.end()
#define sortd(v) sort(v.begin(),v.end(),greater<int>())
#define sorti(v) sort(v.begin(),v.end())
#define PI 3.14159265358979323846264338
const ll inf = 1e18;
const ll mod = 1e9 + 7;
 
signed main()
{
 
    fast;
    double a,b,h,m;
    cin >> a >> b >> h >> m;
    double hh = 30*h ;
    hh+= (m/60.0)*30;
    double mm = 6*m;
    double angle = hh-mm;
    double l = sqrt(a*a + b*b - 2*cos(angle*PI/180)*a*b);
    cout<<setprecision(15)<<l<<endl;
    return 0;
}

/* Pooja Yadav */

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

long long A(int x){
  long long n=2;
  for(int i=0;i<x;i++){
    n*=5;
  }
  return n;
}


int main() {
 long long a,b,c;
  cin>>a>>b>>c;
  
  if(c>=a&&c<=b){
    cout<<"Yes";
  }
  else{
  cout<<"No";
  }
  
 
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  map<string,int> day;
  day["SUN"] = 7;
  day["MON"] = 6;
  day["TUE"] = 5;
  day["WED"] = 4;
  day["THU"] = 3;
  day["FRI"] = 2;
  day["SAT"] = 1;
  string s; cin >> s;
  cout << day[s];
}

Measured memory_bytes: 3528
#include<iostream>

using namespace std;

int main(){
    int h, w, n;
    cin >> h >> w >> n;

    int a[n];

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

    int c[h][w];
    int lst[h*w];
    int count = 0;
    int num;
    for (int i = 0; i < n; i++){
        num = a[i];

        for (int j = 0; j < num; j++){
            lst[count] = i+1;
            count++;
        }

    }

    // for (int i; i < h*w; i++){
    //     cout << lst[i] << " ";

    // }    
    // cout << "\n\n";

    count = 0;
    for (int i = 0; i < w; i++){
        if (i % 2 == 0){
            for (int j = 0; j < h; j++){
                c[j][i] = lst[count];
                count++;
            }
        }
        else{
            for (int j = h-1; j > -1; j--){
                c[j][i] = lst[count];
                count++;
            }
        }
    }

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cout << c[i][j] << " "; 
        }
        cout << '\n';
        
    }
    
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
int main(){
 int K;
 cin >> K;
 queue<long long int> p;
 for(int i = 1; i < 10; i++) {
     p.push(i);
 }
 for(int i = 0; i < K - 1; i++) {
     long long s = p.front();
     p.pop();
     for(int j = -1; j <= 1; j++) {
         long long add = (s % 10) + j;
         if(add >= 0 && add <= 9) { p.push(s * 10 + add); }
     }
 }

 cout << p.front() << endl; 
 return 0;
}

Measured memory_bytes: 1792
n,a,b = map(int,input().split())

if n == 1:
    if a == b:
        ans = 1
    else:
        ans = 0
else:
    if a > b:
        ans = 0
    elif a == b:
        ans = 1
    else:
        ans = (n-2)*(b-a)+1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
	int t=1;
	//cin>>t;
	while(t--)
	{
	    int l;
	    scanf("%d", &l);
	    printf("%.12f", (double)l*l*l/27);
	}
	return 0;
}

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 result = 0;
        for (int i = 1; i <= n; i++) {
            if (i % 2 == 0) {
                continue;
            }
            int cnt = 0;
            for (int j = 1; j <= i; j++) {
                if (i % j == 0) {
                    cnt++;
                }
            }
            if (cnt == 8) {
                result++;
            }
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 21844
import sys
C = [list(map(int, sys.stdin.readline().split(" "))) for i in range(3)]
for a0 in range(101):
    b0 = C[0][0] - a0
    b1 = C[0][1] - a0
    b2 = C[0][2] - a0
    if (C[1][0] - b0 == C[1][1] - b1 == C[1][2] - b2) and (C[2][0] - b0 == C[2][1] - b1 == C[2][2] - b2):
        print("Yes")
        exit()
print("No")

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

template<typename T>
inline void read(T &num) {
	T x = 0, f = 1; char cch = getchar();
	for (; cch > '9' || cch < '0'; cch = getchar()) if (cch == '-') f = -1;
	for (; cch <= '9' && cch >= '0'; cch = getchar()) x = (x << 3) + (x << 1) + (cch ^ '0');
	num = x * f;
}

int n, m, len, tot, L[200005], R[200005], ch[1000005][26];
bool ok[1000005][26];
char s[1000005], t[1000005];
vector<int> v[1000005];
ll ans;

void insert(int l, int r, int id) {
	int x = 0; 
	v[0].push_back(id);
	for (int i = l; i <= r; i++) {
		int c = s[i]-'a';
		if (!ch[x][c]) ch[x][c] = ++tot;
		x = ch[x][c];
		v[x].push_back(id);
	}
}

void solve(int l, int r, int id) {
	int x = 0;
	for (int i = l; i < r; i++) {
		int c = s[i]-'a';
		x = ch[x][c];
	}
	for (auto y : v[x]) {
		if (y == id || R[y] - L[y] + 1 <= r - l + 1) continue;
		if (ok[L[y] + r - l][s[r]-'a']) ans++;
	}
}

int main() {
	read(n);
	for (int i = 1; i <= n; i++) {
		scanf("%s", t + 1);
		m = strlen(t + 1);
		L[i] = len + 1;
		for (int j = m; j; j--) {
			s[++len] = t[j];
		}
		R[i] = len; 
		insert(L[i], R[i], i);
	} 
	for (int i = 1; i <= n; i++) {
		for (int j = R[i]; j >= L[i]; j--) {
			for (int k = 0; k < 26; k++) ok[j][k] = ok[j+1][k];
			ok[j][s[j]-'a'] = 1;
		}
	}
	for (int i = 1; i <= n; i++) {
		solve(L[i], R[i], i);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 186048
import sys

input=sys.stdin.readline

N,Q=map(int,input().split())
S=input()
A=[]
B=[]
l=[0]

for _ in range(Q):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)

count=0
for i in range(1,N):
    if S[i-1]=="A" and S[i]=="C":
        count+=1
    l.append(count)

for i in range(Q):
    print(l[B[i]-1]-l[A[i]-1])

    


Measured memory_bytes: 14320
h, w=map(int, input().split())
a=[""]*h
for i in range(h):
    a[i]=input()

row=[0]*h
col=[0]*w

for i in range(h):
    for j in range(w):
        if a[i][j]=="#":
            row[i]=1
            col[j]=1

for i in range(h):
    if row[i]==1:
        for j in range(w):
            if col[j]==1:
                print(a[i][j], end='')

        print()

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

#define rep(i, n) for(int i = 0; i < (n); i++)

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

    char c;
    rep(i, 4) {
        cin >> c;
        cout << c;
    }
    cout << " ";
    string s;
    cin >> s;
    cout << s << endl;
}


Measured memory_bytes: 256