akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using P = pair<int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr ll INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n, d; cin>>n>>d;
    cout << (n + 2 * d) / (2 * d + 1) << endl;
}

Measured memory_bytes: 256
n = int(input())
h = [int(i) for i in input().split()]
def chmin(a, b):
    if a > b:
        return b
    else:
        return a

f_inf = float('inf')
dp = [f_inf] * n
dp[0] = 0
for i in range(n-1):
    dp[i + 1] = chmin(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
    # n-2の時は2つ先はない
    if i < n-2:
        dp[i + 2] = chmin(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))
print(dp[-1])

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

int main(){
	int x, y;
	
	while(1){
		cin >> x >> y;
		if ( x == 0 && y == 0 ) break;
	
     	if ( x < y ){
		  cout << x << " " << y << endl;
     	} else {
		  cout << y << " " << x << endl;
	    }
   }
	
   return 0;
}


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

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

  int count = 0;
  for (int a = 0; a <= A; a++) {
    for (int b = 0; b <= B; b++) {
      for (int c = 0; c <= C; c++) {
        int price = 500*a + 100*b + 50*c;
        if (price == X) {
          count++;
        }
      }
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int s, w;
	cin >> s >> w;
	if (s <= w) {
		cout << "unsafe" << endl;
	}
	else {
		cout << "safe" << endl;
	}
	return 0;
}

Measured memory_bytes: 3636
IDENTIFICATION DIVISION.
       PROGRAM-ID. test1.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 N PIC 99999.
       01 A PIC 99999.
       01 RE PIC ZZZZ9.
       PROCEDURE DIVISION.
       MAIN.
       	ACCEPT N.
      	ACCEPT A.
      	COMPUTE N=N*N.
      	SUBTRACT A FROM N.
      	MOVE N TO RE.
      	DISPLAY RE.
        STOP RUN.



Measured memory_bytes: 888
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        System.out.println(lcm(x,y));

    }

    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }

}

Measured memory_bytes: 23124
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        List<Integer> h = new ArrayList<>();

        IntStream.rangeClosed(1, N).forEach(i -> h.add(sc.nextInt()));
        sc.close();

        int answer = (int) h.stream()
                .filter(hi -> hi >= K)
                .count();

        System.out.println(answer);
    }
}

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

using namespace std;
int main(int argc, char* argv[])
{
	string S;
	cin>>S;
	int strLen=S.length();
	int i;
	int BNum=0;
	int WNum=0;
	for (i=0;i<strLen;i++){
		if (S[i]=='W'){
			WNum++;
		}else{
			BNum++;
		}
	}
	if (WNum==0 || BNum==0){
		cout<<0<<endl;
		return 0;
	}
	char *p,*q;
	int aw=0;
	p = (char*)S.c_str();
	while (WNum>0 && BNum>0){
		q = p + strLen-1;
		if (*q=='B'){
			while (q!=p && *q=='B'){
				*q='\0';
				strLen--;
				BNum--;
				q--;
			}
		}else{
			while (q!=p && *q=='W'){
				*q='\0';
				WNum--;
				strLen--;
				q--;
			}
		}
		aw++;
	}
	cout<<aw<<endl;
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
#include<string>
#include<math.h>
#include<iostream>
using namespace std;
int main()
{
	int a,b,s;
 	scanf("%d%d",&a,&b);
 	s=a*b;
 	if(s%2==0)
 	printf("Even\n");
 	else
 	printf("Odd\n");
} 

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(H: int, A: int):
    print(int(H/A) if H%A==0 else int(H/A)+1)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    solve(H, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
S = input()
ans_list = []
count = 0
for s in S:
    if s == 'A':
        count += 1
    elif s == 'T':
        count += 1
    elif s == 'G':
        count += 1
    elif s == 'C':
        count += 1
    else:
        count = 0
    ans_list.append(count)
print(max(ans_list))

Measured memory_bytes: 9004
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n; cin >> n;
    vector<int> a(n);
    for (int &x : a) {
        cin >> x;
    }
    for (int i = 1; i <= n; i++) {
        a[i - 1] -= i;
    }
    sort(a.begin(), a.end());
    ll res = LONG_LONG_MAX;
    for (int i = max(0, n / 2 - 100); i <= min(n - 1, n / 2 + 100); i++) {
        ll cur = 0;
        for (int &x : a) {
            cur += abs(x - a[i]);
        }
        res = min(res, cur);
    }
    cout << res << "\n";
}


Measured memory_bytes: 1024
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=10000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int n,a[20][20];
ll sum[1001000],f[1001000];

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int main()
{
	n=read();
	rep(i,1,n) rep(j,1,n) a[i][j]=read();
	int lim=(1<<n)-1;
	rep(i,1,lim)
	{
		rep(j,1,n)
			rep(k,j+1,n)
				if (((i>>(j-1))&1) && ((i>>(k-1))&1))
					sum[i]+=a[j][k];
	}
	rep(i,1,lim)
	{
		for(int j=i;j;j=(j-1)&i)
			f[i]=max(f[i],f[i^j]+sum[j]);
	}
	printf("%lld",f[lim]);
	return 0;
}
			


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

signed main()
{
    int n;
    long long a, b, x[100000], ans = 0;

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

    for(int i=1 ;i<n ;i++ ){
        ans += min( (x[i]-x[i-1])*a, b);
    }

    cout << ans << endl;
    return (0);
}


Measured memory_bytes: 4352
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream    inputStream    = System.in;
        OutputStream outputStream = System.out;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	int N = in.nextInt();
        	int H = in.nextInt();
        	int W = in.nextInt();
        	int[] A = new int[N];
        	int[] B = new int[N];
        	int count = 0;
        	for(int i = 0; i < N; i++) {
        		A[i] = in.nextInt();
        		B[i] = in.nextInt();
        		if(A[i] >= H && B[i] >= W) {
        			count++;
        		}
        	}
        	out.println(count);
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}



Measured memory_bytes: 22740
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string str;
    cin >> str;
    string output = "";
    for(size_t i = 0;i < str.size();i++)
    {
        if((i+1)%2 != 0)
        {
           output += str[i];
        }
    }
    cout << output << endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  ll N;
  cin>>N;
  vector<ll>A(N);
  vector<ll>B(N+1);
  
  for(ll i=1;i<N;i++){
    cin>>A[i];
    B[A[i]]++;
  }

  rep(i,N){
    cout<<B[i+1]<<endl;
  }
}


Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<28;
const long long MOD =1000000000+7;
void solve(int a){cout<<( a?"Yes":"No")<<endl;}
int main(){
	int n,h;
	cin >>n>>h;
	vector<int>a(n,0);
	vector<int>b(n,0);
	for(int i=0;i<n;i++){
		cin >>a[i]>>b[i];
	}
	int ans=0;
	int in=0;
	sort(a.begin(),a.end(),greater<int>());
	sort(b.begin(), b.end(), greater<int>());
	while(a[0] <b[in]){
		ans++;
		h-=b[in];
		in++;
		if(h <=0 or in >=n){
			break;
		}
	}
	
	ans+=max(0,(h+a[0]-1)/a[0]);
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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; }

int main() {
    int n, m; cin >> n >> m;
    vector<vector<int>> g(n);
    rep(i, m) {
        int a, b; cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<ll> dist(n, LLINF);
    vector<int> par(n, -1);
    dist[0] = 0;
    priority_queue<pli, vector<pli>, greater<pli>> q;
    q.emplace(0, 0);
    while (!q.empty()) {
        pli now = q.top();
        q.pop();
        int u = now.second;
        for (auto &v: g[u]) {
            if (chmin(dist[v], dist[u] + 1)) {
                par[v] = u;
                q.emplace(dist[v], v);
            }
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i < n; i++) {
        cout << par[i] + 1 << endl;
    }
}


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

A=[[0 for s in range(10)] for t in range(10)]


for i in range(1,N+1):
	s = str(i)
	A[int(s[0])][int(s[-1])]+=1

x=0
for s in range(10):
	for t in range(10):
		x+=A[s][t]*A[t][s]
print(x)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define endl "\n"
#define speed() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(x) (int)(x).size()
#define _USE_MATH_DEFINES
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
    speed();
    int N, K, Q; cin >> N >> K >> Q;
    int S[N];
    rep(i, 0, N) S[i] = K;
    rep(i, 0, N) S[i] -= Q;
    rep(i, 0, Q) {
        int n; cin >> n;
        S[n-1] += 1;
    }
    rep(i, 0, N) {
        (S[i] <= 0) ? cout << "No" << endl : cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 4060
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
#define mod 1000000007 
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
using namespace __gnu_pbds;
using namespace std;
 
// PMAMP :)
// INL , IIWOIL
 
ll power(ll base, ll exp)
{
    ll ans=1;
    while(exp>0)
    {
        if(exp&1) ans=(ans*base)%mod;
        base=(base*base)%mod;
        exp/=2;
    }
    return ans;
}
ll func(ll n,ll r)
{
    ll ans=1;
    ll ans2=1;
    for(int i=1;i<=r;i++)
    {
        //ans = ((ans*(n-i+1))%mod * )
        ans = (ans*(n-i+1)%mod);
        ans2 = (ans2*i)%mod;
        //trace(ans);
    }
    ans2=power(ans2,mod-2);
    ll ret = (ans*ans2)%mod;
    //cout<<ans<<" "<<ans2<<" "<<ret<< endl;
    return ret;
}
int main()
{
    jaldi
    ll n,a,b;
    cin>>n>>a>>b;
    ll total = power(2,n)-1;
    //trace(total);
    a=n-a<a?n-a:a;
    b=n-b<b?n-b:b;
    ll r1 = func(n,a);
    ll r2 = func(n,b);
    ll final = (total-r1-r2+2*mod)%mod;
    cout<<final;
    return 0;
}

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



int main(){ 
    int n; cin >> n;
    vector<int> x(n);
    float sum = 0;
    
    for(int i = 0; i < n; i++){
        cin >> x.at(i);
        sum += x.at(i);
    }
    
    int pos = floor(sum/n+0.5);
    
    int ans = 0;
    for(int i = 0; i < n; i++){
        ans += (x.at(i) - pos)*(x.at(i) - pos);
    }
    
    cout << ans << endl;
    
 
}
        


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

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

  while (tn--) {
    int n;
    string bgstr;
    cin >> n >> bgstr;

    int bn = 0, gn = 0, len = bgstr.size();
    
    for (int i = 0; i < len; i++) {
      if (bgstr[i] == 'B') bn++;
      else gn++;
    }

    int max_bn = 0;

    for (int i = -1; i < len; i++) {
      int bn0 = bn, gn0 = gn, pos = 0;
      string str0(bgstr);

      for (int j = 0; bn0 > 0 && gn0 > 0; j++) {
	pos = (pos + n + ((i == j) ? 0 : -1)) % str0.size();
	if (str0[pos] == 'B') bn0--;
	else gn0--;
	str0.erase(pos, 1);
      }

      if (max_bn < bn0) max_bn = bn0;
    }

    cout << max_bn << endl;
  }

  return 0;
}

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

int n;
set<int> st;
vector<int> ans;

int main() {
  cin >> n;
  for(int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    st.insert(x);
  }
  cin >> n;
  for(int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if(st.find(x) != st.end()) ans.push_back(x);
  }
  cout << ans.size() << endl;
  return 0;
}


Measured memory_bytes: 7756
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
  int R[MAX], n;

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

  int maxv = -2000000000;
  int minv = R[0];

  for ( int i = 1; i < n; i++ ) {
    maxv = max(maxv, R[i] - minv);
    minv = min(minv, R[i]);
  }

  cout << maxv << endl;

  return 0;
}



Measured memory_bytes: 3884
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <complex>
#include <bitset>
#include <numeric>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define SE second
#define FI first
#define DBG(a) cerr<<(a)<<endl;
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
const LL LINF=334ll<<53; const int INF=15<<26; const LL MOD=1E9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,ans=0;
    LL a[100010]={},t;
    cin >> n>>t;
    REP(i,n){
        cin >> a[i];
    }
    int l=a[0],dmax=0,cnt=0;
    FOR(i,1,n){
        if(a[i]-l>dmax){
            cnt=1;
            dmax=a[i]-l;
        }else if(a[i]-l==dmax){
            cnt++;
        }else if(a[i]<l){
            l=a[i];
        }
    }
    cout << cnt << endl;




    return 0;
}


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

int a[2222];
int main() {
    int n, x, y;
    cin >> n >> x >> y;
    for(int i = 1; i <= n; i++)
        for(int j = i; j <= n; j++)
            a[min({abs(i - j), abs(i - x) + 1 + abs(y - j),
                   abs(i - y) + 1 + abs(x - j)})]++;
    for(int i = 1; i < n; i++)
        cout << a[i] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
long long n, x = 0;
int main()
{
  cin >> n;
  for (long long i = 1; i <= n; ++i)
  {
    if (i % 3 != 0 && i % 5 != 0)
      x += i;
  }
  cout << x << '\n';
}


Measured memory_bytes: 3604
#include <string>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string.h>
#include <utility>
#include <queue>
#include <stack>
#include <iomanip>
#include <ctype.h>
#include <map>
#include <set>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <sstream>
#include <math.h>
#include <time.h>
#include <iostream>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <tuple>
#include <cmath>
#include <stdio.h>      /* printf, fgets */
#include <stdlib.h>
#include <fstream>

using namespace std;

typedef long long LL;

#define FOR(i,n) for(int i = 0;i < n;i++)
#define MP make_pair
#define PB push_back
#define ALL(a) (a).begin(),(a).end()
#define PII pair<int, int>
#define PLL pair<long long, long long>
#define CLEAR(a) memset(a, 0, sizeof(a))
#define ERASE(a) memset(a, -1, sizeof(a))
#define INF 2000000007LL
#define y1 uu1
#define y2 uu2
const double EPS = 1E-12;
const double PI = acos(-1.0);
const LL mod = 1000000007;

using namespace std;

int m1,m2,d1,d2;

void solve() {
  cin >> m1 >> d1 >> m2 >> d2;
  cout << (int)(m1 != m2) << endl;
}

int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(0);
  solve();
  return 0;
}


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

using namespace std ;

typedef long long LL ;

inline LL solve ( LL a , LL b )
{
	if ( b%a==0 ) return 2*b-a ;
	return solve(b,a%b)+a/b*b*2;
}

int main ()
{
	LL n , x ;
	scanf("%lld%lld",&n,&x);
	if ( 2*x<=n ) printf("%lld\n",n+solve(n-x,x));
	else printf("%lld\n",n+solve(x,n-x));
	return 0 ;
}

Measured memory_bytes: 128
// #Sazaの1日1AC
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000007;
const long long INF=9e15;
const double PI=3.14159265358979323846;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
using vvl=vector<vector<long long>>;
using vP=vector<pair<long long, long long>>;
//ショートカット
#define rep(i,n) for(long long i = 0; i < n; i++)
#define rep2(i,k,n) for(long long i = k; i < n; i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define mkp make_pair
//入力
#define vin(v,N) for(long long id=0;id<N;id++) cin>>v.at(id)
#define lin(n) long long n;cin>>n
#define chin(x) char x;cin>>x;
#define sin(s) string s;cin>>s;
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

#define max(a,b) max((ll)a,(ll)b)
#define min(a,b) min((ll)a,(ll)b)

//関数
//最大公約数
long long gcd(long long m, long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m, long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x, long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//繰り返し二乗法
long long repeat_squaring(long long x, long long n){
  if(n==0) return 1;
  else if(n%2==0){
    long long t=repeat_squaring(x,n/2);
    return t*t%mod;
  }
  else
    return x*repeat_squaring(x,n-1);
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//構造体

/////////////////⊂('ω'⊂ )))Σ≡GO!/////////////////

double f(double x){
  return 4*x*(1-x);
}

//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(10);
  
  lin(a);lin(va);lin(b);lin(vb);
  lin(T);

  if(a == b) cout << "YES" << endl;
  else if(va <= vb) cout << "NO" << endl;
  else{
    ll v = va - vb;
    ll l = abs(a - b);
    if(l <= v*T) cout << "YES" << endl;
    else cout << "NO" << endl;

  }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<long>p(n);
  int i;
  for(i=0;i<n;i++)cin>>p[i];
  vector<long>a(n);
  vector<long>b(n);
  a[0]=1;
  b[0]=1e9-50000;
  for(i=1;i<n;i++){
    a[i] = a[i-1]+30000;
    b[i] = b[i-1]-30000;
  }
  for(i=1;i<n;i++){
    a[p[i]-1]+=i;
  }
  for(i=0;i<n-1;i++){
    cout << a[i] << " ";
  }
  cout<<a[n-1]<<endl;
  for(i=0;i<n-1;i++){
    cout<<b[i]<<" ";
  }
  cout<<b[n-1]<<endl;
}


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

long long i, ans, A, B;
string s;

void calc(long long k, long long A, long long B){
  // printf("k = %d, A = %d, B = %d\n", k, A, B);
  // kは何個目の隙間かを表す
  // 隙間に+を入れるか入れないかで深さ優先探索
  if(k == i-1){
    ans += A+B;
    // printf("add sum = %d\n", A+B);
  }
  else{
    calc(k+1, A+B, s[k+1]-48);
    calc(k+1, A, 10*B+s[k+1]-48);
  }
}

int main(){
  cin>>s;
  i = s.length();

  ans = 0;
  calc(0, 0, s[0]-48);
  printf("%lld\n", ans);
}


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

// ALDS1_5_D
public class Main {
	int SENTINEL = 1234567890;
	long sum = 0;
	void merge(int[]A, int left, int mid, int right) {
		int n1 = mid - left + 1;
		int n2 = right - mid;
		int[] L = new int[n1 + 1];
		int[] R = new int[n2 + 1];
		for (int i = 0; i < n1; i++) {
			L[i] = A[left + i];
		}
		for (int i = 0; i < n2; i++) {
			R[i] = A[mid + 1 + i];
		}
		L[n1] = SENTINEL;
		R[n2] = SENTINEL;
		int i = 0;
		int j = 0;
		for (int k = left; k <= right; k++) {
			if (L[i] <= R[j]) {
				sum += k - i - left;
				A[k] = L[i];
				i = i + 1;
			} else {
				A[k] = R[j];
				j = j + 1;
			}
	    }
	}

	void mergeSort(int[] A, int left, int right) {
	    	if (left < right) {
	    		int mid = (left + right)/2;
	    		mergeSort(A, left, mid);
	    		mergeSort(A, mid + 1, right);
	    		merge(A, left, mid, right);
	  	}
	}
	
	void run() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] str = br.readLine().split(" ");
		int[] A = new int[n];
		for (int i = 0; i < n; i++) {
			A[i] = Integer.parseInt(str[i]);
		}
		mergeSort(A, 0, n - 1);
		System.out.println(sum);
	}
	
	public static void main(String[] args) throws IOException {
		new Main().run();
	}
}



Measured memory_bytes: 61300
// A - Poor
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c; cin>>a>>b>>c;
	bool ans = false;
	if(a==b && a!=c) ans = true;
	if(a==c && a!=b) ans = true;
	if(b==c && a!=b) ans = true;
	cout<< (ans? "Yes":"No") <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>
#include <cassert>
#include <numeric>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define PUT(x) cout << x << endl
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 10000000000LL;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };

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

	int result = accumulate(s.begin(),s.end(),0);

	// '0' : a
	// '1' : b

	cout << result - '0' * 6 << endl;


	return 0;
}


Measured memory_bytes: 256
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
from itertools import product
import sys
def main(X, Y, Z, K, A, B, C):
    A.sort(reverse=True)
    B.sort(reverse=True)
    C.sort(reverse=True)
    ans = []
    for x in range(1, X + 1):
        if x > K: break
        for y in range(1, Y + 1):
            if x * y > K: break
            for z in range(1, Z + 1):
                if x * y * z > K: break
                ans.append(A[x - 1] + B[y - 1] + C[z - 1])
    ans.sort(reverse=True)
    for i in range(K):
        print(ans[i])

if __name__ == '__main__':
    input = sys.stdin.readline
    X, Y, Z, K = map(int, input().split())
    *A, = map(int, input().split())
    *B, = map(int, input().split())
    *C, = map(int, input().split())
    main(X, Y, Z, K, A, B, C)


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

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

  vector<pair<int, int>> s(N);
  rep(i,0,N-1) cin >> s[i].first >> s[i].second;

  vector<pair<int, int>> c(M);
  rep(i,0,M-1) cin >> c[i].first >> c[i].second;

  vector<int> answers(N);
  rep(i,0,N-1) {
    pair<int,int> stu = s[i];
    int x1 = stu.first, y1 = stu.second;
    int d = 1001001001;
    int ans;
    rep(j,0,M-1) {
      pair<int,int> cp = c[j];
      int x2 = cp.first, y2 = cp.second;
      int tmp_d = abs(x1 - x2) + abs(y1 - y2);
      if (tmp_d < d) {
        d = tmp_d;
        ans = j + 1;
      }
    }
    answers[i] = ans;
  }

  for (int ans : answers) cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int r;
  cin>>r;
  cout<<3*r*r<<endl;
}



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

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

    int n;
    cin>>n;

    int cnt=0;
    int m=0;
    int ans=0;

    for(int i=0;i<n;i++)
    {
        int h;
        cin>>h;

        if(m<h)
        {
            ans=max(ans,cnt);
            cnt=0;
        }
        else
        {
            cnt++;
        }
        m=h;
    }
    
    ans=max(ans,cnt);

    cout<<ans<<"\n";

    return 0;
}


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


int main(){
	int N;cin >> N;
	vector<int> X(N);
	rep(i, N){
		cin >> X[i];
	}
	int ans = 1000000000;
	rep(i,101){
		int tmp = 0;
		rep(j,N) {
			tmp += (i - X[j]) * (i - X[j]);
		}
		ans = min (ans, tmp);
	}
	cout << ans << endl;


	
}














Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
int f(int k) {
	int p = k, r = 0;
	while (p > 0) {
		r += p % 10;
		p /= 10;
	}
	return r;
}
signed main() {
	int n, a, b; cin >> n >> a >> b;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int k = f(i);
		if (a <= k && k <= b)ans += i;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#!python
# -*- coding: utf-8 -*-

N, M, X = map(int, input().split(' '))
As = list(map(int, input().split(' ')))

S1 = 0
S2 = 0
for A in As:
    if A < X:
        S1 += 1
    else:
        S2 += 1

print(min(S1, S2))


Measured memory_bytes: 2940
/* Author: $%U%$
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/
#include <bits/stdc++.h>
using namespace std;
#define fore(i, a, b) for (int i = a, to = b; i < to; i++)
#define foref(i, a, b) for (int i = b - 1, to = a; i >= to; i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define SZ(v) (int)v.size()
#define pb push_back
typedef long long Long;
typedef pair<Long, Long> Pair;
vector<vector<Long>> genPos(Long x, Long y) {
  vector<Long> v(x);
  fore(i, 0, x) v[i] = i;
  set<vector<Long>> used;
  do {
    vector<Long> res(y);
    fore(i, 0, y) res[i] = v[i];
    used.insert(res);
  } while (next_permutation(all(v)));
  vector<vector<Long>> ans;
  for (auto val : used) ans.pb(val);
  return ans;
}
Long test(Long n, Long m) {
  vector<vector<Long>> pos1 = genPos(m, n);
  Long ans = 0;
  fore(i, 0, SZ(pos1)) fore(j, 0, SZ(pos1)) {
    bool ok = true;
    fore(k, 0, n) {
      if (pos1[i][k] == pos1[j][k]) ok = false;
    }
    if (ok) ans++;
  }
  return ans;
}
const int MX = (5e5);
Long fact[MX + 2];
const Long MOD = (1e9 + 7);
void init() {
  fact[0] = 1;
  fore(i, 1, MX + 2) fact[i] = (fact[i - 1] * (Long)(i)) % MOD;
}
Long fastPow(Long x, Long y) {
  Long ans = 1;
  Long cur = x;
  while (y) {
    if (y & 1) ans = (ans * cur) % MOD;
    cur = (cur * cur) % MOD;
    y >>= 1;
  }
  return ans;
}
Long inv(Long x) {
  return fastPow(x, MOD - 2);
}
Long cnk(Long x, Long y) {
  Long ans = fact[x] * inv(fact[y]);
  ans %= MOD;
  ans *= inv(fact[x - y]);
  ans %= MOD;
  return ans;
}
Long now(Long x, Long y) {
  Long ans = 0;
  bool ok = 1;
  Long base = (cnk(y, x) * fact[x] % MOD);
  fore(i, 0, x + 1) {
    Long valor = (cnk(y - i, x - i) * fact[x - i] % MOD) * cnk(x, i) % MOD;
    if (ok)
      ans += valor;
    else
      ans -= valor;
    ans %= MOD;
    ans += MOD;
    ans %= MOD;
    ok = !ok;
  }
  ans *= base;
  ans %= MOD;
  return ans;
}
void solve() {
  init();
  Long x, y;
  cin >> x >> y;
  cout << now(x, y) << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int t = 1;
  //cin >> t;
  while (t--) solve();

  return 0;
}

Measured memory_bytes: 7520
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	int N; cin >> N;
	string S; cin >> S;
	int Q; cin >> Q;
	vector<int> k(N);
	rep(i,Q) cin >> k[i];

	vector<ll> D(N+1),C(N+1);
	rep(i,N) {
		if (S[i] == 'D') D[i+1]++;
		if (S[i] == 'C') C[i+1]++;
	}
	rep(i,N) {
		D[i+1] += D[i];
		C[i+1] += C[i];
	}
	vector<ll> A(N+1);
	rep(i,Q) {
		ll ans = 0;
		rep(j,N) {
			A[j+1] = 0;
			if (S[j] == 'D') {
				A[j+1] = C[min(N,j+k[i])];
			}
		}
		rep(j,N) A[j+1] += A[j];

		rep(j,N) {
			if (S[j] == 'M') ans += A[j] - A[max(0,j-k[i])] - (D[j] - D[max(0,j-k[i])])*C[j+1]; 
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 28700
#include <bits/stdc++.h>
//#include <ext/numeric>


using namespace std;
//using namespace __gnu_cxx;

const int MAXN = (int)1e3 + 5;
const int MAXM = (int)1e4 + 5;


int n;
int A[MAXN], B[MAXN];
long long memo[MAXN][MAXM];

long long solve(int idx, int h) {
    if (h <= 0)
        return 0;
    if (idx == n)
        return INT_MAX;
    long long &ret = memo[idx][h];
    if (~ret)
        return ret;
    ret = solve(idx + 1, h);
    ret = min(ret, solve(idx + 1, h - A[idx]) + B[idx]);
    ret = min(ret, solve(idx, h - A[idx]) + B[idx]);
    return ret;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(10), cout << fixed;

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

    memset(memo, -1, sizeof memo);
    cout << solve(0, h) << '\n';


    return 0;
}

Measured memory_bytes: 82808
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        Map<String, Integer> wordmap = new TreeMap<>();
        int max = 0;
        for (int i=0;i<N;i++) {
            String S_n = sc.next();
            if (wordmap.containsKey(S_n)) {
                int count = wordmap.get(S_n);
                wordmap.put(S_n, count + 1);
                if (max <= count) max = count + 1;
            } else {
                wordmap.put(S_n, 1);
                if (max == 0) max = 1;
            }
        }

        for (String key : wordmap.keySet()) {
            if (wordmap.get(key) == max) System.out.println(key);
        }

    }
}

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

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define FOR(it,c) for(auto&& it=begin(c);it!=end(c);it++)
#define ROF(it,c) for(auto&& it=rbegin(c);it!=rend(c);it++)
#define INT(n) int n;assert(0<scanf("%d",&n))

class union_find {
public:
  vector<unsigned int> par, rank;
  union_find(unsigned int n) {
    for(unsigned int i = 0; i < n; i++){
      par.push_back(i);
      rank.push_back(1);
    }
  }
  unsigned int root(unsigned int x){
    return par[x] == x ? x : par[x] = root(par[x]);
  }
  unsigned int getrank(unsigned int x){
    return rank[root(x)];
  }
  bool same(unsigned int x, unsigned int y){
    return root(x) == root(y);
  }
  void unite(unsigned int x, unsigned int y){
    x = root(x);
    y = root(y);
    if (x == y){return;}
    if (rank[x] < rank[y]){
      par[x] = y;
      rank[y] += rank[x];
    } else {
      par[y] = x;
      rank[x] += rank[y];
    }
  }
};

int main(){
  INT(n); INT(m);
  union_find uf(n + 1);
  REP(m){
    INT(a); INT(b);
    uf.unite(a, b);
  }
  unsigned int ans = 1;
  REP(i, 1, n + 1){
    ans = max(ans, uf.getrank(i));
  }
  printf("%u\n", ans);
  return 0;
}

Measured memory_bytes: 5104
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    int n;
    cin>>n;
    map<string, int> mp;
    rep(i, n){
        string s;
        cin>>s;
        mp[s]++;
    }
    int ans = mp.size();
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 19260
#include<stdio.h>
int parent(int i){
  return i/2;
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
    }

main()
{
  int i,n,A[250];
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: ",i);
    printf("key = %d, ",A[i]);
    if(i!=1)printf("parent key = %d, ",A[parent(i)]);
    if(i<=n/2 ) {
      printf("left key = %d, ",A[left(i)]);
      if(left(i)!=n){
	printf("right key = %d, ",A[right(i)]);
      }
      else if(left(i)==n && right(i)<n) printf("right key = %d, ",A[right(i)]);
    }
      printf("\n");
  }
  return 0;
}

Measured memory_bytes: 600
n=int(input())
h=[int(i) for i in input().split()]
dp=[0]*n
dp[1]=abs(h[0]-h[1])
for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[-1])    

Measured memory_bytes: 13800
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
 int a,b,c;
 cin >> a>>b>> c;
 if(a!=b && a!=c)cout << a << endl;
 else if(b!=c && b!=a)cout <<  b<< endl;
 else if(c!=a && c!=b)cout << c << endl;

}

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

int main()
{

    ios_base::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    if(a>=1 && a<=9 && b>=1 && b<=9)
        cout<<a*b<<"\n";
    else
        cout<<"-1\n";
    return 0;
}


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

int main() {

	//A

	/*char st[200000];
	int i;
	for (i = 0; i < 200000; i++) {
		st[i] = ' ';
	}
	cin >> st;
	int stcount,delcount;
	stcount = 0;
	delcount = 0;
	for (i = 0; i < 200000; i++) {
		if (st[i] == 'T') {
			if (delcount == 0) {
				stcount++;
			}
			else {
				delcount--;
			}
		}else if(st[i] =='S'){
			delcount++;
		}
	}
	cout << stcount * 2;

	return 0;*/
	//C

	int n;
	cin >> n;

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

	int mina=101;
	for (i = 0; i < n; i++) {
		if (a[i] < mina) {
			mina = a[i];
		}
	}
	int minc = 0;
	int mincc;
	int j;
	for (i = 0; i < n; i++) {
		if (a[i] == mina) {
			minc++;
		}
	}
	if (minc >= 3) {
		cout << "Impossible";
	}
	else if (minc == 2) {
		
		for (j = mina + 1; j <= 2 * mina - 1; j++) {
			mincc = 0;
			for (i = 0; i < n; i++) {
				if (a[i] == j) {
					mincc++;
				}
			}
			if (mincc < 2) {
				cout << "Impossible";
				return 0;
			}
		}
		for (i = 0; i < n; i++) {
			if (a[i] > 2 * mina - 1) {
				cout << "Impossible";
				return 0;
			}
		}
		cout << "Possible";
		return 0;
	}else if(minc==1){
		for (j = mina + 1; j <= 2 * mina; j++) {
			mincc = 0;
			for (i = 0; i < n; i++) {
				if (a[i] == j) {
					mincc++;
				}
			}
			if (mincc < 2) {
				cout << "Impossible";
				return 0;
			}
		}
		for (i = 0; i < n; i++) {
			if (a[i] > 2 * mina) {
				cout << "Impossible";
				return 0;
			}
		}
		cout << "Possible";
		return 0;
	}


	return 0;
}

Measured memory_bytes: 256
N = int(input())
Ls = list(map(int, input().split()))
ls = sorted(set(Ls))
ks = [Ls.count(l) for l in ls]
# print(ks)
n = 0
for i, (l, k) in enumerate(zip(ls, ks)):
    lls = ls[i + 1:]
    kks = ks[i + 1:]
    for j, (ll, kk) in enumerate(zip(lls, kks)):
        l3s = lls[j + 1:]
        k3s = kks[j + 1:]
        for l3, k3 in zip(l3s, k3s):
            n += k * kk * k3 * (l3 < l + ll)
#             print(k,kk,k3,l,ll)
print(n)

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

using namespace std;

const long long MOD = 1000000007;

// べき乗の余り計算
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) {
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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


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

    cout << mod(modpow(10, N, MOD) - modpow(9, N, MOD) * 2 + modpow(8, N, MOD), MOD) << endl;
    return 0;
}

Measured memory_bytes: 3588
from collections import deque

dd = [[1, 0], [-1, 0], [0, 1], [0, -1]]
H, W = list(map(int, input().split()))
field = [input() for _ in range(H)]
def bfs():
  dist = [[float('inf')] * W for _ in range(H)]
  que = deque()
  que.append((0, 0))
  dist[0][0] = 0
  while len(que) > 0:
    y, x = que.popleft()
    if y == H - 1 and x == W - 1:
      break
    for dx, dy in dd:
      ny, nx = y + dy, x + dx
      if 0<=nx<W and 0<=ny<H and field[ny][nx]=='.' and dist[ny][nx]==float('inf'):
        dist[ny][nx] = dist[y][x] + 1
        que.append((ny, nx))
  return dist[H - 1][W - 1]
    
count = sum([f.count('#') for f in field])
need = bfs()
      
if need == float('inf'):
  print(-1)
else:
  print(H * W - count - need - 1)

Measured memory_bytes: 3316
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 62;

int main() {
  //
  ll h, w;
  cin >> h >> w;
  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) cin >> a[i];

  int i = 0, j = 0;
  vvl data(h, vl(w));
  rep(k, n) {
    while (a[k] > 0) {
      data[i][j] = k + 1;
      a[k]--;

      if (i & 1) {
        // to left
        if (j > 0) {
          j--;
        } else {
          i++;
        }
      } else {
        // to right
        if (j < w - 1) {
          j++;
        } else {
          i++;
        }
      }
    }
  }

  rep(i, h) {
    rep(j, w) {
      cout << data[i][j];
      if (j == w - 1) {
        cout << endl;
      } else {
        cout << " ";
      }
    }
  }
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <tuple>
using namespace std;

long long L; vector<tuple<int, int, int>>G;

int main() {
	cin >> L;
	for (int i = 1; i <= 18; i++) {
		G.push_back(make_tuple(i, i + 1, 0));
		G.push_back(make_tuple(i, i + 1, (1 << (i - 1))));
	}
	int Z = L, sum = 0;
	for (int i = 19; i >= 1; i--) {
		while (Z >= (1 << (i - 1))) {
			G.push_back(make_tuple(i, 20, sum));
			sum += (1 << (i - 1)); Z -= (1 << (i - 1));
		}
	}
	cout << 20 << " " << G.size() << endl;
	for (int i = 0; i < G.size(); i++) cout << get<0>(G[i]) << " " << get<1>(G[i]) << " " << get<2>(G[i]) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();		//n個の重り
		ArrayList<Integer>w=new ArrayList<Integer>();
		
		int sum=0;
		for(int i=0;i<n;i++) {
			w.add(sc.nextInt());	//重りの重さ
			sum+=w.get(i);
		}
		int s1=w.get(0);
		int s2=sum-w.get(0);
		int ans=Math.abs(s1-s2);
		
		for(int i=1;i<n-1;i++) {
			s1+=w.get(i);
			s2-=w.get(i);
			ans=Math.min(ans,Math.abs(s1-s2));
		}
		System.out.println(ans);
		sc.close();
	}
}

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

int main(){
int n;
  cin >> n;
vector<vector<int>> a(2,vector<int>(n));
for(int i=0;i<2;i++){
  for(int j=0;j<n;j++){
  cin >> a[i][j];
  }
}
int sum;
int s=-1;
if(n>=2){
for(int i=0;i<=n-1;i++){
sum=0;  
int j=0;  
while(j<=i && j<=n-1){
  sum+=a[0][j];
  if(j==i)break;
  else j++;
  }
while(j>=i && j<=n-1)sum+=a[1][j],j++;
s=max(s,sum);  
}
cout << s << endl;
}
else cout << a[0][0]+a[1][0] << endl;  
}  




Measured memory_bytes: 3596
#include<iostream>
#include<cstdio>
#include<map>
using namespace std ;
int main(){
 
  int n;
  char a,b; 
  for(;;){
 map<char,char> a2b;
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin >> a >> b;
      a2b[a]=b;
	}
    cin>>n;
    for(int i=0;i<n;i++){
      cin>>a;
      if(a2b.count(a)==0){
	cout<<a;
      }
      else cout<<a2b[a];
      }
    cout<<endl;
  }
  return 0;
}

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

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

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

    int dp[n];
    for (int i = 0; i < n; ++i) dp[i] = 1000000000;
    dp[0] = 0;
    for (int i = 1; i < n; ++i) {
        dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1) dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }

    cout << dp[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 1024
from collections import deque

S=input()
N=len(S)

prev=S[0]
ans=N
temp=0

con=deque()

for i in range(N):
    if S[i]==prev:
        temp+=1
    else:
        con.append(temp)
        prev=S[i]
        temp=1
con.append(temp)       
        
        
    
while len(con)>2:
    a=con[0]
    b=con[-1]
    if b>=a:
        c=con.popleft()
        con[0]+=c
        ans=min(ans,N-a)
    else:
        c=con.pop()
        con[-1]+=c
        ans=min(ans,N-b)
    
    
    
if len(con)==2:
    ans=min(ans,max(con))
else:
    ans=N
    
    
print(ans)
    
    




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

using namespace std;


int main(){
  int A,B;
  cin >>A>>B;
  if (A>=13){
    cout << B<<endl;
  }
  else if (A>=6){
    cout <<B/2<<endl;
  }
  else{
    cout <<0<<endl;
  }
}


Measured memory_bytes: 256