akhauriyash/Code-Regression huggingface dataset:
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 
const ll INF = 1e18 + 10 ; 
int main(){
    fastio
    ll n ; 
    cin >> n ; 
    n = n - 1;
    ll ans = (n * (n + 1)) / 2;
    cout << ans << endl;
    return 0 ;
}

Measured memory_bytes: 256
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

/*
#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64
#endif
*/

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;


long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}
const int N = 555;

int blue[N][N];
int red[N][N];

int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
	int n = readInt(), m = readInt();
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (i % 2 == 0) {
				blue[i][j] = 1;					
			} else {
				red[i][j] = 1;				
			}        
			if (j == 1) {
				red[i][j] = 0;
				blue[i][j] = 1;
			} else if (j == m) {
				red[i][j] = 1;
				blue[i][j] = 0;				
			}
			    
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			char x;
			cin >> x;
			if (x == '#') {
				if (blue[i][j]) {
					red[i][j] = 1;
				}
				else {
					blue[i][j] = 1;
				}
			}
		}
	}
    for (int i = 1; i <= n; i++) {
    	for (int j = 1; j <= m; j++) {
    		if (blue[i][j]) {
    			cout << "#";
    		} else {
    			cout << ".";
    		}
    	}
    	cout << endl;
    }
    cout << endl;
    for (int i = 1; i <= n; i++) {
    	for (int j = 1; j <= m; j++) {
    		if (red[i][j]) {
    			cout << "#";
    		} else {
    			cout << ".";
    		}
    	}
    	cout << endl;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2944
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 1000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
signed main(){
	
	int a;
	cin>>a;
	cout<<ceil2(a,2)<<endl;

}

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

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

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

  int N;
  cin >> N;

  cout << 3 * N * N << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int n; cin >> n;

	int i = 0;
	while (i <= n) {
		int64_t d = i * 108;
		if (n == (int)(d / 100)) {
			cout << i << endl;
			return 0;
		}
		i++;
	}

	cout << ":(" << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
	Scanner scn = new Scanner(System.in);
	int n = scn.nextInt();
      int t = scn.nextInt();
      int[] a = new int[n];
      for(int i=0; i<a.length; ++i){
        a[i] = scn.nextInt();
      }
      int[] b = new int[n];
      for(int i=0; i<b.length; ++i){
        b[0]=0;
        if(i>0){
        b[i] = a[i] - a[(i-1)] ;
        }
      }
      int count = 0;
      for(int i=0; i<b.length; ++i){
        if(b[i] <= t){
          count = count + b[i];
        }else{
          count = count + t;
        }
      }
      int ans = count + t;
      System.out.println(ans);
	}
}


Measured memory_bytes: 60036
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <=(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
   int l[60];
   int sum=0;
int main(){
   int n,k;
   cin>>n>>k;
   rep(i,n)cin>>l[i];
   
   sort(l,l+n,greater<int>());
   
   for(int i=0;i<k;i++){
     sum+=l[i];
   }
   cout<<sum<<endl;
}

Measured memory_bytes: 384
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        // s >= t
        s: String,
        t: String,
    };
    let diff = substr_diff(&s.as_bytes(), &t.as_bytes()).unwrap();
    println!("{}", diff);
}

fn diff_chars(t: &[u8], p: &[u8]) -> usize {
    fn rec(t:&[u8], p: &[u8], index: usize, count: usize) -> usize {
        if index >= p.len() {
            count
        } else {
            match t[index] == p[index] {
                true => {
                    rec(t, p, index + 1, count)
                }
                false => {
                    rec(t, p, index + 1, count + 1)
                }
            }
        }
    }
    rec(t, p, 0, 0)
}

fn substr_diff(text: &[u8], ptrn: &[u8]) -> Option<usize> {
    if text.len() < ptrn.len() {
        None
    } else {
        let tl = text.len();
        let pl = ptrn.len();
        let mut diff = pl;
        for i in 0..tl - pl + 1 {
            let substr = &text[i..i + pl];
            let temp = diff_chars(substr, &ptrn[..]);
            if temp < diff {
                diff = temp;
            };
        }
        Some(diff)
    }
}


Measured memory_bytes: 2192
'use strict'

const main = (input) => {
    const a = parseInt(input.split(' ')[0])
    const b = parseInt(input.split(' ')[1])
    if(a + b < 24){
        console.log(a + b)
    }else{
        console.log(a + b - 24)
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

Measured memory_bytes: 9420
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>

int main() {
  size_t n;
  scanf("%zu", &n);

  intmax_t res = 1;
  std::vector<intmax_t> a(n);
  for (auto& ai: a) scanf("%jd", &ai);
  std::sort(a.begin(), a.end());

  for (auto ai: a) {
    if (__builtin_mul_overflow(res, ai, &res))
      return puts("-1"), 0;
  }
  intmax_t const inf = 1e18;
  if (res > inf) return puts("-1"), 0;
  printf("%jd\n", res);
}


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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

#define REP(i, x, n) for(ll i=x; i<(ll)n; ++i)
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()

ll gcd(ll n, ll m){
    while(true){
        if(n<m) swap(n, m);
        if(!m) break;
        n %= m;
    }
    return n;
}

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

    ll b = abs(B) - abs(B)/C - abs(B)/D + abs(B)/C*gcd(C, D)/D;
    ll a = abs(A-1) - abs(A-1)/C - abs(A-1)/D + abs(A-1)/C*gcd(C, D)/D;
    cout << (b-a) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;

main(){
    int n;
    cin >> n;
    rep(i, n){
        int y,m,d;
        cin>>y>>m>>d;
        LL ans=0;
        for(int ye=y; ye<1000; ye++){
            if(ye==y){
                ans += 19-d+1;
                if(m&1 || !(y%3)) ans++;
                for(int mo=m+1; mo<=10; mo++){
                    if(mo&1|| !(y%3)) ans+=20;
                    else ans+=19;
                }
            }else{
                if(!(ye%3)) ans+=20*10;
                else ans+=20*5+19*5;
            }
        }
        cout << ans << endl;
    }
}




Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#define int long long

using namespace std;

signed main(){
    int n, sum=0;
    cin >> n;
    vector<int> nums(200000, 0), table(200000, 0), diff(200000, 0);
    //nums.resize(n);
    for(int i=0;i<n;i++){
        cin >> nums[i];
        table[nums[i]]++;
    }
    for(int i=1;i<n+1;i++){
        //cout << table[i] << endl;
        if(table[i]>=2){
            sum+=table[i]*(table[i]-1)/2;
            diff[i] = (table[i]*(table[i]-1)-(table[i]-2)*(table[i]-1))/2;
        }
    }
    //cout << sum << endl;
    for(int i=0;i<n;i++){
        cout << sum - diff[nums[i]] << endl;
    }
    return 0;
}

    

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979
//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
const int64_t MOD = 1000000007;
//const int64_t INF = 998244353;
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; }
using namespace std;
//#define P pair<int, int>
typedef pair<int, int> P;

int main(){
    int A, B, M;
    cin >> A >> B >> M;
    vector<int> a(A), b(B), x(M), y(M), c(M);
    rep(i, 0, A) cin >> a.at(i);
    rep(i, 0, B) cin >> b.at(i);
    rep(i, 0, M) cin >> x.at(i) >> y.at(i) >> c.at(i);
    int fin = INF;
    rep(i, 0, M){
        int sum = a.at(x.at(i) - 1) + b.at(y.at(i) - 1) - c.at(i);
        fin = min(fin, sum);
    }
    int min_a = *min_element(all(a));
    int min_b = *min_element(all(b));
    fin = min(fin, min_a + min_b);
    cout << fin << endl;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;
vector<ll> ans;
void dfs(int rem, ll cur)
{
    if (rem == 0)
    {
        ans.push_back(cur);
        return;
    }
    int last = cur % 10;
    rep(i, 10)
    {
        if (abs(last - i) <= 1)
        {
            dfs(rem - 1, cur * 10 + i);
        }
    }
}

int main()
{
    rep(i, 10)
    {
        rep(j, 1, 10)
        {
            dfs(i, j);
        }
    }
    sort(ALL(ans));
    int k;
    cin >> k;
    cout << ans[k - 1] << endl;
    return 0;
}


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

typedef unsigned long long ull;

int main()
{
    ull X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    priority_queue<ull> P, Q, R;
    ull x;
    for(int i = 0; i < A; i++){ cin >> x; P.push(x);}
    for(int i = 0; i < B; i++){ cin >> x; Q.push(x);}
    for(int i = 0; i < C; i++){ cin >> x; R.push(x);}
    ull res = 0;
    while(P.size() + Q.size() + R.size() + X + Y > A + B + C){
        auto p = P.empty()? 0 : A == X + P.size()? 0 : P.top();
        auto q = Q.empty()? 0 : B == Y + Q.size()? 0 : Q.top();
        auto r = R.empty()? 0 : R.top();
        if(r > p && r > q){
            res += r;
            R.pop();
        }else if(p > q){
            res += p;
            P.pop();
        }else{
            res += q;
            Q.pop();
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3316
import java.util.*;

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

    long n = scan.nextLong();
    int g = (int) Math.sqrt(n);
    ArrayList<Long> a = new ArrayList<Long>();
    for (int i=g;i>=1;i--){
      if (n%i == 0){
        long a1 = (long) i;
        long a2 = (long) n/i;
        if (check(a1) == true){
          a.add(a1);
        }
        if (check(a2) == true){
          a.add(a2);
        }
      }
    }

    long sum = 0;
    for(long k : a){
      long check = n;
      int count = 0;
      while (check % k == 0){
        count += 1;
        check = (long) check/k;
      }
      sum += find(count);
    }
    System.out.println(sum);
  }

  static boolean check(long a){
    if (a == 1){
      return false;
    }

    int b = (int) Math.sqrt(a);
    for (int i=b;i>=2;i--){
      if (a%i == 0){
        return false;
      }
    }
    return true;
  }

  static int find(int a){
    int count = 0;
    while (((count*count+count)/2) <= a){
      count += 1;
    }
    return count-1;
  }

}


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

int main(){
  long long  N,t;
  cin >> N;
  
  rep(i,N-1){
    t=t+i+1;
  }
  cout << t << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll n;
    cin >> n;
    vector<ll> l(n);
    ll answer = 0;
    REP(i,n)cin >> l[i];
    sort(ALL(l));
    REP(i,n-2){
        for(int j=i+1;j < n-1;j++){
            ll smaller = lower_bound(ALL(l),l[i]+l[j])-l.begin();
            answer += smaller-j-1;
        }
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    W = list(map(int, input().split()))
    sub = []
    for i in range(N):
        L = sum(W[:i+1])
        R = sum(W[i+1:])
        sub.append(abs(L - R))
    return(min(sub))
if __name__ == '__main__':
    print(main())


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

#define int           long long 
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (int)(1e18)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){ cerr << name << " = " << arg1 << endl;}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args)
{ const char *name = strchr(names, ',');cerr.write(names, name-names) << " = " << arg1 << endl;_F(name+2, args...);}

template< typename T1, typename T2 > istream& operator>>(istream& in, pair<T1, T2> &q){ in >> q.F >> q.S; return in;}
template< typename T1, typename T2 > ostream& operator<<(ostream& out, pair<T1, T2> &q){ out << q.F << " " << q.S; return out;}
template< typename T1, typename T2 > pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F+p2.F, p1.S+p2.S};}
template< typename T1, typename T2 > pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F-p2.F, p1.S-p2.S};}
template< typename T1, typename T2 > bool operator<(pair<T1, T2> p1, pair<T1, T2> p2){ return p1 < p2 ;}

template<typename T> void Unique(vector<T> &v){
    sort(all(v)), v.resize(distance(v.begin(), unique(all(v))));
}

const int M = 1e9+7;

void solve(int &test) {
	int n, ans = 0;

	cin >> n;

	int cur = 0, x;
	for(int i = 0; i < n; i++) {
		cin >> x;

		ans += cur*x;
		ans%= M;

		cur += x;
		cur %= M;
	}

	cout << ans << endl;
}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   
    start = clock();
    
  
    int test = 1;
    // cin >> test;

    cout << fixed << setprecision(2);
     
    for(int i = 1; i <= test; ++i){
        solve(i); 
    }

    cerr << time(start);
    return 0;
}

Measured memory_bytes: 3804
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }



int main() {
	int H, W;
	scanf("%d%d", &H, &W);
	char f[101][101];
	for (int i = 0; i < H; i++) {
		scanf("%s", f[i]);
	}
	for (int i = 0; i < H + 2; i++) {
		if (i == 0 || i == H + 1) {
			for (int j = 0; j < W + 2; j++) {
				printf("#");
			}
		}
		else {
			printf("#%s#", f[i-1]);
		}
		printf("\n");
	}

#ifdef DEBUGF
	getch();
#endif
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? 1e9:1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int t; cin >> t;
    if(t <= 1199)cout << "ABC" << endl;
    else if(t <2800)cout << "ARC" << endl;
    else cout << "AGC";
}




Measured memory_bytes: 256
N,M = map(int,input().split())
H = list(map(int,input().split()))
lose = []
for i in range(M):
    A,B = map(int,input().split())
    if(H[A-1]>H[B-1]):
        loser = B
    elif(H[B-1]>H[A-1]):
        loser= A
    else:
        lose.append(A)
        lose.append(B)
        continue
    lose.append(loser)
set_lose = set(lose)
print(N-len(set_lose))

Measured memory_bytes: 20144
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    rep(i,n) cin>>a.at(i);
    sort(a.begin(),a.end());
    int ans=0;
    rep(i,k) ans+=a.at(i);
    cout<<ans;
}


Measured memory_bytes: 3636
from sys import stdin
def LI(): return list(map(int,stdin.readline().rstrip().split()))

tmp = LI()
for i in range(2):
    if tmp[i]==1:
        tmp[i] = 999

a,b = [tmp.pop(0) for _ in range(2)]

if a<b:
    print('Bob')
elif b<a:
    print('Alice')
else:
    print('Draw')

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

struct H{
  int val;
  H *l, *r;
  H(int v):val(v){
    l=r=nullptr;
  }
};
H *root;
H* meld(H* h1, H* h2){
  if(h1==nullptr) return h2;
  if(h2==nullptr) return h1;
  if(h1->val<h2->val) swap(h1, h2);
  h1->r=meld(h1->r, h2);
  swap(h1->l, h1->r);
  return h1;
}
void insert(int x){
  root=meld(root, new H(x));
}
int front(){
  return root->val;
}
void remove(){
  root=meld(root->l, root->r);
}

int main(){
  while(1){
    string s; cin>> s;
    if(s[0]=='e'){
      if(s[1]=='n') break;
      cout<< front()<< endl;
      remove();
    }else{
      int x; cin>> x;
      insert(x);
    }
  }
}



Measured memory_bytes: 49972
#include <stdio.h>
int main(void)
{
  int a,b,c,d;
  scanf("%d %d %d",&a,&b,&c);
  if((a+b+c) == 17){
    if(((a+b-7)==5)||((a+c-7)==5)||(((c+b-7)==5))){
      printf("YES");
    }else{
      printf("NO");
    }
  }else{
    printf("NO");
  }
  return 0;
}


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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

int main() {
	string a;
	cin >> a;
	
	string ans;

	int l = a.length();

	REP(i,l) {
		ans += "x";
	}
	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
template <class T>
bool chmax(T &a, const T &b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;

void solve()
{
	string s;
	cin>>s;
	cout<<s.substr(0,3)<<endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


Measured memory_bytes: 3640
"""#################################################################
【ABC108】
B_Ruined_Square
#################################################################"""

#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

x1, y1, x2, y2 = ISI()
dx = x2 - x1
dy = y2 - y1
x3 = x2 - dy
y3 = y2 + dx
x4 = x3 - dx
y4 = y3 - dy
print(x3, y3, x4, y4)

Measured memory_bytes: 3064
import sys
from itertools import accumulate
from operator import xor

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

N = INT()
A = [0] + LIST() + [0]

acc1 = list(accumulate(A, xor))
acc2 = list(accumulate(A[::-1], xor))[::-1]
ans = [0] * (N+1)
for i in range(1, N+1):
    ans[i] = acc1[i-1] ^ acc2[i+1]
print(*ans[1:])


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


int main() {
  int A, B, C;
  cin >> A; 
  cin >> B;
  cin >> C;
  //cout << B << endl;
  if((A+B+C) > 21) cout << "bust" << endl;
  else cout << "win" << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.swing.text.Segment;

public class Main {

	public static void main(String[] args) throws IOException {
		try (Scanner sc = new Scanner(System.in)) {
			final char[] ins = sc.next().toCharArray();
			
			final int fst = Character.getNumericValue(ins[0]);
			final int snd = Character.getNumericValue(ins[1]);
			final int thd = Character.getNumericValue(ins[2]);
			final int fur = Character.getNumericValue(ins[3]);
			
			
			for(int i = 0; i <= 1; i++){
				final int snd_value = (i == 0) ? snd : -snd;
				final String snd_str = (i == 0 ? "+" : "-") + snd;
				
				for(int j = 0; j <= 1; j++){
					final int thd_value = (j == 0) ? thd : -thd;
					final String thd_str = (j == 0 ? "+" : "-") + thd;
					
					for(int k = 0; k <= 1; k++){
						final int fur_value = (k == 0) ? fur : -fur;
						final String fur_str = (k == 0 ? "+" : "-") + fur;
						
						final int value = fst + snd_value + thd_value + fur_value;
						if(value != 7){ continue; }
						
						System.out.println(fst + snd_str + thd_str + fur_str+"="+7);
						return;
					}
				}
			}
			
			
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
#include <bitset>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dcm(a) setprecision(a)<<fixed
#define MOD 1000000007
#define clr(memo, a) memset(memo,a,sizeof(memo))
#define PI acos(-1)
int const N=3e3+5;
ll dp[N][N];
void solve()
{
int n;
cin>>n;
vector<int> a(n+1);
for(int i=0;i<n;i++)
    cin>>a[i];
for(int i=n-1;i>=0;i--)
for(int j=i;j<n;j++){
    if(i==j)
        dp[i][j]=a[i];
    else
        dp[i][j]=max(a[i]-dp[i+1][j],a[j]-dp[i][j-1]);
}
cout<<dp[0][n-1]<<endl;
}
int main()
{
    fast;
    solve();

    return 0;
}


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

#define forn(i, n) for(int i = 0; i < n; i++)
#define for1(i, n) for(int i = 1; i <= n; i++)
#define PrintArray(a,n) for(int i=0;i<n;i++) cout << a[i] << " "; cout << endl;
#define CopyArray(a,temp,n) for(int i=0;i<n;i++) temp[i]=a[i];
#define InputArray(a,n) for(int i=0;i<n;i++) cin >> a[i];
#define MAX(a,b,c) max(max(a,b),c)
#define SumInRange(a,b) ((b*(b+1))/2)-(((a-1)*(a))/2)
#define Different_Random srand(time(NULL))
#define Random(a,b) (rand()%((b+1)-a))+a
#define __delete(v,n) v.erase(remove(v.begin(),v.end(),n),v.end())

#define Cases  cout << "Case " << ++Case << ": ";
#define __test int tt; int Case=0; cin >> tt; while(tt--)
#define newline cout << "\n";

#define read(x)    freopen(#x, "r", stdin)
#define write(x)   freopen(#x, "w", stdout)

#define all(x)     x.begin(), x.end()
#define dbg(args...)    {string sss(#args);sss+=',';cerr<<"-->";debugger::call(all(sss), args);cerr<<"\n";}
#define dbgA(A, n)      {cerr<<"-->"<<#A<<"=(";forn(i, n)cerr<<A[i]<<" ";cerr<<")\n";}
#define dbgA2(A, n, m)  {cerr<<"-->"<<#A<<"=\n";forn(i, n){forn(j, m){cerr<<setw(4)<<A[i][j]<<" ";}cerr<<"\n";}cerr<<"\n";}

struct debugger{
    typedef string::iterator si;
    static void call(si it, si ed) {}
    template<typename T, typename ... aT>
    static void call(si it, si ed, T a, aT... rest) {
        string b;
        for(; *it!=','; ++it) if(*it!=' ')b+=*it;
        cerr << b << " = " << a << " ";
        call(++it, ed, rest...);
    }
};

template<typename T>
T Max(T a) {return a;}

template<typename T, typename... Args>
T Max(T a, Args... args){ return a > Max(args...)? a : Max(args...);}

template<typename T>
T Min(T a) {return a;}

template<typename T, typename... Args>
T Min(T a, Args... args){ return a < Min(args...)? a : Min(args...);}


//int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
//int dy[] = {0, 0, 1, -1, -1, -1, 1, 1};
//int knight_x[] = {2, 2, -2, -2, 1, 1, -1, -1};
//int knight_y[] = {1, -1, 1, -1, 2, -2, 2, -2};

/*
cout.precision(x);
cout << fixed;
*/

typedef long long int ll;
typedef unsigned long long int ull;
const double GOLD = (1.0 + sqrt(5.0))/2.0;
const double EPS = 1e-9;
const int INF = 0x7f7f7f7f;
const double PI = 3.141592653589793;
const double E = 2.718281828459045;

ll expo(ll a, ll n)
{
    ll result = 1;
    while(n)
    {
        if(n%2) result*=a;
        a*=a; n/=2;
    }
    return result;
}

ll mod_expo(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
const int MOD = 1e9+7;
int main()
{
    #ifdef TarekHasan
        read(input.txt);
    #endif // TarekHasan
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int n; cin >> n;
    for(int i=0;i<n;i++) cout << "ACL";
    cout << endl;

    cerr << "time = " << clock() << " ms" << '\n';
    return 0;
}



Measured memory_bytes: 3444
import math

a,b = map(int,input().split())
ans = []
count = 0

for i in range(1,1001):
     if(math.floor(i * 0.08) == a and math.floor(i * 0.1) == b):
        ans.append(i)
        count += 1

if(count == 0):
    print('-1')
else:
    print(min(ans)) 

Measured memory_bytes: 9124
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using static System.Console;
using static System.Math;

namespace abc167A
{
  public class MainClass
  {
    public static void Main(string[] args)
    {
      long N = long.Parse(Console.ReadLine());
      long[] A = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
      long ans = 1;
      long now = 1000000000000000000;
      long mod ;
      bool zero = false;
      bool over = false;
      
      for(int i = 0; i < N; i++){
        if(A[i] == 0){zero = true; break;}
      }
      for(int i = 0; i < N; i++){
        if(now < A[i]){over = true; break;}
        now /= A[i];
        //now += 1;
      }
      if(zero == true){Console.WriteLine(0);}
      else if(over == true){Console.WriteLine(-1);}
      else{
        for(int i = 0; i < N; i++){
          ans *= A[i];
        }
        Console.WriteLine(ans);
      }
    }
  }
}

Measured memory_bytes: 41312
// In the name of God

#include <bits/stdc++.h>

using namespace std;

#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define debug(x) cout << #x << ": " << x << endl;

int main() {
	IOS
	string s;
	cin >> s;
	int cnt1=0, cnt2=0;
	for(int i=0; s[i]; i++) {
		if(s[i]=='0') cnt1++;
		else cnt2++;
	}
	cout << min(cnt1, cnt2)*2;
	return 0;
}


Measured memory_bytes: 512
//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define mod 1000000007
#define endl '\n'
typedef long long int ll ;
using namespace std;
#define MAX 100009	
int main()
{
    ll arr[4][4];
     ll vis[4][4];
    for(int i=1;i<=3;i++){
        for(int j=1;j<=3;j++){
            cin>>arr[i][j];
            vis[i][j]=0;
        }
    }
    ll n;
    cin>>n;
    for(int i=1;i<=n;i++){
        ll a; cin>>a;
        for(int j=1;j<=3;j++){
            int flag=0;
            for(int k=1;k<=3;k++){
                if(arr[j][k]==a) {  vis[j][k]=1; flag=1; break; }
            }
            if(flag) break;
        }
    }
    for(int i=1;i<=3;i++){
        int flag=0;
        for(int j=1;j<=3;j++) {
            if(vis[i][j]==0){ flag=1; break; }
        }
        if(flag==0)  {cout<<"Yes"<<endl; return 0 ;}
    }
    for(int i=1;i<=3;i++){
        int flag=0;
        for(int j=1;j<=3;j++) {
            if(vis[j][i]==0) {flag=1; break; }
        }
        if(flag==0)  {cout<<"Yes"<<endl; return 0 ;}
    }
    int flag=0;
    for(int i=1;i<=3;i++){
        if(vis[i][i]==0) { flag=1; break; }
    }
     if(flag==0)  {cout<<"Yes"<<endl; return 0 ;}
     flag=0;
     for(int i=1;i<=3;i++){
         if(vis[i][3-i+1]==0) { flag=1; break; }
     }
     if(flag==0)  {cout<<"Yes"<<endl; return 0 ;}
     cout<<"No"<<endl;
   
}

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

int main(){
  ll a,b,c,k;
  cin >> a >> b >> c >> k;
  if(a>=k) cout << k << endl;
  else if(a+b>=k) cout << a << endl;
  else cout << a-(k-a-b) << endl;
  return 0;
}

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

#define PI 3.14159265358979323846

void Main()
{
  ll A,B,H,M;
  cin >> A >> B >> H >> M;
  double angleH = 30.0*H + M/2.0;
  double angleM = 6.0*M;
  double theta = abs(angleH - angleM);
  //cout << theta << endl;
  cout << sqrt(A*A + B*B - 2.0 * A * B * cos(theta * PI / 180.0)) << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

Measured memory_bytes: 4244
a=int(input())
n=list(map(int,input().split()))
候補=0
longest=0
for i in range(a-1):
    if n[i]>=n[i+1]:
        候補+=1
        if longest<候補:
            longest=候補
    elif longest<候補:
        longest=候補
        候補=0
    else:
        候補=0

print(longest)

Measured memory_bytes: 63856
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

int N, K;
set <int>num;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> K;
		num.insert(K);
	}
	if (!(num.size() % 2))cout << num.size() - 1 << endl;
	else cout << num.size() << endl;
	return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std ;
void solve() {
  int n ;
  cin >> n ;
  set<string> s;
  for(int i=0; i<n; i++){
    string q ;
    cin >> q ;
    s.insert(q);
  }
  cout << s.size();  
}
int main() {
  int t=1;
  //cin >> t ;
  while(t--) solve() ;
  return 0 ;
}


Measured memory_bytes: 19224
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;


int main(){FIN

    string s; int n;
    cin >> s;
    cin>>n;
    // cout<<s.size()<<endl;
    int mn = min(n, int(s.size()));
    
    REP(i, mn){
        // cout<<s[i]<<endl;
        if (s[i] != '1'){
            // cout<<"asd"<<endl;
            cout << s[i]<<endl;
            return 0;
        }
    }
    cout<<'1'<<endl;
    return 0;
}

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

int main(void)
{
	long int N,a = 1,b,i;
	scanf("%ld",&N);
	for(i = 1;i * i <= N; i++){
		if(N % i == 0){
			a = i;
		}
	}
	b = N / a;
	printf("%ld\n",a + b - 2);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int M=100010;
bool v[410][410];
int n,m,a[M],b[M];
bool p[410];
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<=m;i++)scanf("%d%d",a+i,b+i);
for(int i=1;i<=n;i++){
v[i][i]=1;
for(int j=m;j>=1;j--){
bool x=v[i][a[j]],y=v[i][b[j]];
if(x&&y){p[i]=1;break;}
else if(x)v[i][b[j]]=1;
else if(y)v[i][a[j]]=1;}}
int ans=0;
for(int i=1;i<n;i++){
if(p[i])continue;
for(int j=i+1;j<=n;j++){
if(p[j])continue;
bool flag=1;
for(int k=1;k<=n;k++)
if(v[i][k]&&v[j][k])flag=0;
ans+=flag;}}
printf("%d\n",ans);
return 0;}

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

int main(){
    int H,W;
    cin >> H >> W;
    vector<vector<char> > S(H,vector<char>(W));
    rep(i,H)rep(j,W)cin >> S[i][j];
    
    vector<vector<int> > left(H,vector<int>(W,0)), right(H,vector<int>(W,0));
    vector<vector<int> > top(H,vector<int>(W,0)), bottom(H,vector<int>(W,0));
    //前処理...各マスの照らせるマス目の数を計算しておく.
    rep(i,H){
        rep(j,W){
            if(S[i][j] == '#')continue;
            if(j != 0)left[i][j] += left[i][j-1]+1;
            else left[i][j] = 1;
            
            if(i != 0)top[i][j] += top[i-1][j]+1;
            else top[i][j] = 1;
        }   
    }

    for(int i = H-1; i >= 0; i--){
        for(int j = W-1; j >= 0 ; j--){
            if(S[i][j] == '#')continue;
            if(j != W-1) right[i][j] += right[i][j+1]+1;
            else right[i][j] = 1;

            if(i != H-1) bottom[i][j] += bottom[i+1][j]+1;
            else bottom[i][j] = 1;
        }
    }
    //走査
    int res = 0;
    rep(i,H){
        rep(j,W){
        res = max(res,left[i][j]+right[i][j]+top[i][j]+bottom[i][j]-3);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 67072
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program {
    static void Main() {
        Scanner cin = new Scanner();
        int N = cin.Int();
        var x = new int[N];
        var y = new int[N];
        var h = new int[N];
        for (int i = 0; i < N; i++) {
            x[i] = cin.Int();
            y[i] = cin.Int();
            h[i] = cin.Int();
        }

        int H, tmpH;
        bool flag;
        for(int Cx = 0; Cx <= 100; Cx++) {
            for(int Cy = 0; Cy <= 100; Cy++) {
                H = -1;
                flag = true;
                if (flag) {
                    for (int i = 0; i < N; i++) {
                        if (h[i] != 0) {
                            tmpH = h[i] + Math.Abs(x[i] - Cx) + Math.Abs(y[i] - Cy);
                            if (H == -1) H = tmpH;
                            if (tmpH != H) flag = false;
                        }
                    }
                }
                if (flag) {
                    for (int i = 0; i < N; i++) {
                        tmpH = H - Math.Abs(x[i] - Cx) - Math.Abs(y[i] - Cy);
                        if (tmpH < 0) tmpH = 0;
                        if (tmpH != h[i]) flag = false;
                    }
                }
                if (flag) {
                    Console.WriteLine(Cx + " " + Cy + " " + H);
                    return;
                }
            }
        }
        Console.ReadLine();
    }
}

class Scanner //標準入力
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Long() + add;
        }
        return Array;
    }

    public double Double()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Double() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
char N[6];
int main(){
  rd(N);
  if(N[0]==N[1] && N[1]==N[2]||N[1]==N[2] && N[2]==N[3]){
    wt_L("Yes");
    wt_L('\n');
  }
  else{
    wt_L("No");
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// char N[6];
// {
//   rd(N);
//   wt( if[N[0]==N[1]==N[2]||N[1]==N[2]==N[3], "Yes", "No"] );
// }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int unsigned ll;
int main()
{
    ll n,ans=1,i,temp=1;
    ll a[1000000];
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            cout<<0;
            return 0;
        }
    }
    for(i=0;i<n;i++)
    {
        ans*=a[i];
        if(temp>ans)
        {
            cout<<-1;
            return 0;
        }
        temp=ans;
        if(ans>1000000000000000000)
        {
            cout<<-1;
            return 0;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 4416