akhauriyash/Code-Regression huggingface dataset:
// ABC049_B
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define REPN(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0LL)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const ll MOD7 = 1000000007;  // 1 000 000 007
const ll MOD9 = 1000000009;  // 1 000 000 009

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

    // input
    ll H, W;
    cin >> H >> W;
    vector<string> vec(H);
    REP(i, H) cin >> vec[i];
    
    // calculation
    REP(i, H) {
        cout << vec[i] << "\n";
        cout << vec[i] << "\n";
    }
    
    return 0;
}


Measured memory_bytes: 256
#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>;

int main(){
  ll a;
  cin >> a;
  ll b = a/500;
  ll c = (a%500)/5;
  ll ans = b*1000 + c*5;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>
#include<cassert>

using namespace std;

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define rep(i,n) FOR(i,0,n)

struct edge{int to,cost;};

void dump_line(ll *b,int n){
	for(int i=0;i<n;i++){
		cout << b[i] << " ";
	}
	cout << "\n";
}

ll mypow(ll x,ll n){
	if(n==0) return 1;
	ll res=mypow(x*x,n/2);
	if(n&1) res=res*x;
	return res;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n,k;
	cin >> n >> k;
	ll a[n];
	ll rui[n+1]; 
	rep(i,n) {
		cin >> a[i];
		rui[i+1] = rui[i]+a[i];
	}
	int subnum=n*(n+1)/2;
	ll sub[subnum];
	int cnt=0;
	rep(i,n){
		for(int j=i+1;j<n+1;j++){
			sub[cnt++] = rui[j]-rui[i];
		}
	}
	ll ans=0;
	ll check=0;
	for(ll bit=(1LL<<40);bit>=1;bit>>=1){
		cnt=0;
		rep(i,subnum){
			if(((sub[i] & check) == check) && ((sub[i] & bit) == bit)) cnt++;
		}
		if(cnt>=k){
			ans += bit;
			check |= bit;
		}
	}
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

int main() {
  int X, Y, Z;
  cin >> X >> Y >> Z;

  int K;
  cin >> K;

  vector<ll> A(X);
  rep(i, X) cin >> A[i];
  vector<ll> B(Y);
  rep(i, Y) cin >> B[i];
  vector<ll> C(Z);
  rep(i, Z) cin >> C[i];

  sort(all(A), greater<ll>());
  sort(all(B), greater<ll>());
  sort(all(C), greater<ll>());

  vector<ll> ABC;
  rep(x, X) {
    rep(y, Y) {
      rep(z, Z) {
        if ((x + 1) * (y + 1) * (z + 1) <= K)
          ABC.pb(A[x] + B[y] + C[z]);
        else
          break;
      }
    }
  }

  sort(all(ABC), greater<ll>());

  rep(k, K) { cout << ABC[k] << endl; }
}

Measured memory_bytes: 1404
#include<bits/stdc++.h>
#define MAX 1e9
using namespace std;

typedef long long ll;

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

ll dp[110][100100] = {0};

int
main(void)
{

  int n; cin >> n;
  ll w; cin >> w;
  ll value[110], weight[110];
  for(int i = 0; i < n; i++){
    cin >> weight[i] >> value[i];
  }


  for(int i = 0; i < n; i++){
    for(int j = 0; j <= w; j++){
      if(j - weight[i] >= 0){
        dp[i + 1][j] = max(dp[i][j], dp[i][j - weight[i]] + value[i]);
      }else{
        dp[i + 1][j] = max(dp[i][j], dp[i][j]);
      }
    }
  }

  cout << dp[n][w] << endl;
  
  
  return 0;
}

Measured memory_bytes: 79360
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    int a_[3];
    a_[0] = a + b;
    a_[1] = b + c;
    a_[2] = a + c;

    sort(a_, a_ + 3);

    cout << a_[0] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e6+4;
const int mod = 1e9+7;
int f[N], g[N];
int n;

void add(int &x, int y)
{
	x = (x + y) % mod;
}
int sub(int x,int y)
{
	return (((x-y) % mod) + mod) % mod;
}

int mul(int x,int y)
{
	x = x % mod,
	y = y % mod;
	return (x*y) % mod;
}

int binpow(int a,int b)
{
	if(b == 0)
		return 1;
	int res = binpow(a, b/2);
	if(b % 2 == 0)
		return mul(res, res);
	else
		return mul(mul(a, res), res);
}

int Ckn(int k, int n)
{
	return mul(g[n], binpow(mul(g[n-k], g[k]), mod-2) );
}

signed main()
{
	g[0] = 1;
	for(int i=1;i<N;i++)
	{
		g[i] = mul(g[i-1], i);
	}

	cin >> n;
	for(int i=n/2;i<=n-1;i++)
	{
		f[i] = mul(mul(Ckn(n-1-i, i-1), g[i]), g[n-1-i]);
		// cout<<f[i]<<' ';
	}
	f[n/2 - 1] = 0;
	int ans = 0;
	for(int i=n/2;i<=n-1;i++)
	{
		add(ans, mul(i, sub(f[i], f[i-1])));
	}
	cout<<ans;
}

Measured memory_bytes: 13824
#include <set>
#include <queue>
#include <cstdio>
#include <algorithm>
using namespace std;

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

int main()
{
	int t, n;
	while (scanf("%d %d", &t, &n) != EOF) {
		if (t == 0 && n == 0)
			break;

		set<pair<int, int> > block;
		for (int i = 0; i < n; ++i) {
			int x, y;
			scanf("%d %d", &x, &y);
			block.insert(pair<int, int>(x, y));
		}

		pair<int, int> s;
		scanf("%d %d", &s.first, &s.second);

		set<pair<int, int> > ans;
		queue<pair<int, int> > que, next;
		ans.insert(s);
		que.push(s);

		for (int i = 0; i < t; ++i) {
			while (!que.empty()) {
				pair<int, int> f = que.front();
				que.pop();

				for (int j = 0; j < 6; ++j) {
					pair<int, int> p = f;
					p.first += dx[j];
					p.second += dy[j];

					if (block.find(p) != block.end() || ans.find(p) != ans.end())
						continue;

					ans.insert(p);
					next.push(p);
				}
			}
			swap(que, next);
		}

		printf("%d\n", ans.size());
	}
	return 0;
}

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

int main() {
	int n,a,b;
	int ans,p;

	ans=0;
	p=0;
	cin >> n ;

	rep(i, n){
		cin >> a >> b ;	
		if (a==b) p++;
		else p=0;
		ans=max(ans,p);
	}
	if(ans>2) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;



struct edge{ll to, from, cost;};
edge e[2002];
ll d[1001];
bool neg[1001];
int n, m;



int main(){
    for(int i = 0; i < 1001; i++){
        d[i] = LL_INF;
    }
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin >> e[i].from >> e[i].to >> e[i].cost;
        e[i].cost = -e[i].cost;
    }
    d[1] = 0;
    for(int j = 0; j < n; j++){
        for(int i = 0; i < m; i++){
            if(d[e[i].from] != LL_INF && d[e[i].to] > d[e[i].from] + e[i].cost){
                d[e[i].to] = d[e[i].from] + e[i].cost;
            }
        }
    }
    ll ans = d[n];
    for(int i = 0; i < 1001; i++)   neg[i] = false;

    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(d[e[j].from] == LL_INF)  continue;

            if(d[e[j].to] > d[e[j].from] + e[j].cost){
                d[e[j].to] = d[e[j].from] + e[j].cost;
                neg[e[j].to] = true;
            }

            if(neg[e[j].from]){
                neg[e[j].to] = true;
            }
        }

    }

    if(neg[n])  cout << "inf\n";
    else cout << -ans << endl;


}

Measured memory_bytes: 256
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const input = stdin.split('\n')

const [n, q] = input[0].split(' ').map(Number)

let to = []
let counts = []

for (let i = 0; i < n; i++) {
  to.push([])
  counts.push(0)
}

for (let i = 1; i < n + q; i++) {
  if (i < n) {
    let [a, b] = input[i].split(' ').map(Number)
    --a
    --b
    to[a].push(b)
    to[b].push(a)
  } else {
    let [p, x] = input[i].split(' ').map(Number)
    --p
    counts[p] += x
  }
}

const ans = () => {
  let p = 0

  let stack = []
  let pStack = []
  for (let i = 0; i < to[p].length; i++) {
    stack.push(to[p][i])
    pStack.push(p)
  }

  let done = new Set()
  done.add(p)

  // スタックが空になったら終了
  while (stack.length > 0) {
    // スタックからノードを取り出す
    const v = stack.pop()
    const parent = pStack.pop()

    // そのノードのcountに親のcountを足しこむ。その後ノードを探索済みにする
    counts[v] += counts[parent]
    done.add(v)

    // ノードの子をスタックに追加し、ノードを親にする
    const childs = to[v]
    for (let i = 0; i < childs.length; i++) {
      // 既に探索済みの子は追加しない
      if (done.has(childs[i])) continue
      stack.push(childs[i])
      pStack.push(v)
    }
  }

  console.log(counts.join(' '))
}

ans()


Measured memory_bytes: 137372
#include <bits/stdc++.h>
/*
#include<algorithm>
#include<array>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<typeinfo>
#include<utility>
#include<vector>
*/
#define int long long int
#define double long double
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define rep(i, n) for (int(i) = 0, i##_len = (n); (i) < i##_len; (i)++)
#define reps(i, x) for (int(i) = 1; (i) <= (int)(x); (i)++)
#define rrep(i, x) for (int(i) = ((int)(x)-1); (i) >= 0; (i)--)
#define rreps(i, x) for (int(i) = ((int)(x)); (i) > 0; (i)--)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define bit(n) ((int)(1) << (n))
#define all(x) (x).begin(), (x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl
#define nint int
using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
typedef pair<int, int> pii;
typedef pair<double, double> dop;
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 gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
struct aaa {
    aaa()
    {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} aaaaaaa;



signed main()
{
    int n,q;
    cin >> n >> q;
    std::vector<pii> timem;
    std::set<int> s;
    for(int i = 0; i < n; i++){
        int s,t,x;
        cin >> s >> t >> x;
        t--;
        timem.pb(pii(s - x, x));
        timem.pb(pii(t - x, -1 * x));
    }
    for(int i = 0; i < q; i++){
        int temp;
        cin >> temp;
        timem.pb(pii(temp,0));
    }
    std::sort(timem.begin(),timem.end(), [](const pii &a, const pii &b) { return a.second > b.second;});
    std::stable_sort(timem.begin(),timem.end(), [](const pii &a, const pii &b){return a.first < b.first;});

    for(int i = 0; i < timem.size(); i++){
        int se = timem[i].second;
        if(se == 0){
            if(s.empty()){
                cout << -1 << endl;
            } else {
                cout << *(s.begin()) << endl;
            }
        } else if(se > 0){
            s.insert(se);
        } else {
            s.erase(abs(se));
        }
    }
    return 0;
}

Measured memory_bytes: 21220
#include<stdio.h>

int main(void)
{
	int n, i, min, max;
	scanf( "%d", &n );
	int r[n];
	for( i = 0; i < n; i++ ){
		scanf( "%d", &r[i] );
	}
	
	max = r[1] - r[0];
	min = r[0];
	
	for( i = 1; i < n; i++ ){
		if( min > r[i] ){
			min = r[i];
		}else if( max < r[i] - min ){
			max = r[i] - min;
		}
	}
			
	printf( "%d\n", max );
	
	return 0;
}


Measured memory_bytes: 2548
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;


public class Main {
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();
    long[] a = sc.nextLongList(7);
    long ret = 0;


    if (a[0] > 0 && a[3] > 0 && a[4] > 0 && a[0] % 2 + a[3] % 2 + a[4] % 2 >= 2) {
      a[0] --;
      a[3] --;
      a[4] --;
      ret += 6;
    }
    
    ret += a[0] / 2 * 4;
    ret += a[1] * 2;
    ret += a[3] / 2 * 4;
    ret += a[4] / 2 * 4;
    
    
    

    System.out.println(ret / 2);
  }

}


class FastScanner {
	public static String debug = null;

	private final InputStream in = System.in;
	private int ptr = 0;
	private int buflen = 0;
	private byte[] buffer = new byte[1024];
	private boolean eos = false;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				if (debug != null) {
					buflen = debug.length();
					buffer = debug.getBytes();
					debug = "";
					eos = true;
				} else {
					buflen = in.read(buffer);
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen < 0) {
				eos = true;
				return false;
			} else if (buflen == 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean isEOS() {
		return this.eos;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		return (int) nextLong();
	}

	public long[] nextLongList(int n) {
		return nextLongTable(1, n)[0];
	}

	public int[] nextIntList(int n) {
		return nextIntTable(1, n)[0];
	}

	public long[][] nextLongTable(int n, int m) {
		long[][] ret = new long[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextLong();
			}
		}
		return ret;
	}

	public int[][] nextIntTable(int n, int m) {
		int[][] ret = new int[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextInt();
			}
		}
		return ret;
	}
}

Measured memory_bytes: 8148
L = int(input())

bits = format(L, 'b')
n = len(bits)

print(20, n+bits.count('1')+17)

for i in range(1, 20):
    print(i, i+1, 0)
for i in range(1, n):
    print(i, i+1, 1 << (n-i-1))

num = 1 << (n-1)
for i, c in enumerate(bits):
    if i == 0:
        continue
    if c == '1':
        print(1, i+1, num)
        num += 1 << (n-i-1)


Measured memory_bytes: 62072
#include <iostream>

using namespace std;
int main(void) {
	int a, b, c, x = 0;

	cin >> a >> b >> c;
	for (int i = a; i <= b; ++i) {
		if(c % i == 0){
			x = x + 1;
		}
	}
	cout << x << "\n";
}

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

#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a, v) memset((a), v, sizeof(a))

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

int rev(int x) {
	int ret = 0;
	while (x) {
		ret = ret * 10 + (x % 10);
		x /= 10;
	}
	return ret;
}

int res[15][15];

int main() {
	int n; scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		int lastDigit = i % 10;
		int tmp = rev(i);
		int firstDigit = tmp % 10;
		res[firstDigit][lastDigit]++;
	}

	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		int lastDigit = i % 10;
		int tmp = rev(i);
		int firstDigit = tmp % 10;
		ans += res[lastDigit][firstDigit];
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n, a[100000], ans = 0;
    long long shr = 0;
    vector<int> v;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        int b;
        cin >> b;
        if(a[i] < b){
            ans++;
            shr += b - a[i];
        }
        if(a[i] > b){
            v.push_back(a[i]-b);
        }
    }
    sort(v.begin(), v.end(), greater<int>());
    for(int i=0;i<v.size();i++){
        if(shr <= 0)break;
        ans++;
        shr -= v[i];
    }
    if(shr > 0){
        ans = -1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main()
{
    // 整数の入力
    string S ;
    cin >> S ;
    string S_a = S.substr(0,2);
    string S_b = S.substr(2,2);
    int nS_a = atoi(S_a.c_str());
    int nS_b = atoi(S_b.c_str());

    string ans;
    if( (nS_a >= 1 && nS_a <= 12) && (nS_b >= 1 && nS_b <= 12)){
        ans = "AMBIGUOUS";
    }
    else if( (nS_a >= 1 && nS_a <= 12) && ((nS_b >= 13 && nS_b <= 99) || nS_b == 0)){
        ans = "MMYY";
    }
    else if( (nS_b >= 1 && nS_b <= 12) && ((nS_a >= 13 && nS_a <= 99) || nS_a == 0)){
        ans = "YYMM";
    }
    else{
        ans = "NA";
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
#define MOD 1000000007
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
inline bool BETWEEN(int x, int min,int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}

using namespace std;
#pragma endregion
signed main() {
	char N[3];
	cin >> N[0] >> N[1] >> N[2];
	if (N[0] == N[2])
		cout << "Yes";
	else
		cout << "No";
}

Measured memory_bytes: 256
N,M = list(map(int,input().split(" ")))
dic = {}
Acount = 0
Wcount = 0
tmp_w = {}
for i in range(M):
    x1,y1=[i for i in input().split(" ")]
    if x1 in dic:
        if dic[x1] == "WA" and y1 == "AC":
            Acount += 1
            Wcount = Wcount + tmp_w[x1]
            dic[x1] = y1
        elif dic[x1] == "WA" and y1 == "WA":
            tmp_w[x1] = tmp_w[x1] + 1
    else:
        if y1 == "AC":
            Acount += 1
            dic[x1] = y1
        else:
            tmp_w[x1] = 1
            dic[x1] = y1
print(Acount,Wcount)


Measured memory_bytes: 22064
#include <cstdio>
#include <cstring>

using namespace std;
const int Max_N(5050);
const int MOD(1000000000 + 7);

namespace io
{
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush (){fwrite (obuf, 1, oS - obuf, stdout);oS = obuf;}
	inline void putc (char x){*oS ++ = x;if (oS == oT) flush ();}
	template <class I>
	inline void gi (I &x) {for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;}
	template <class I>
	inline void print (I x){
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;while(x) qu[++ qr] = x % 10 + '0',  x /= 10;while (qr) putc (qu[qr--]);}
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io::gi;
using io::putc;
using io::print;

constexpr int Mult(int a, int b)
{
	return a * 1LL * b % MOD;
}

constexpr int Add(int a, int b)
{
	return a + b >= MOD ? a + b - MOD : a + b;
}

constexpr int Sub(int a, int b)
{
	return a - b < 0 ? a - b + MOD : a - b;
}

inline void upd(int &a, int b)
{
	a = Add(a, b);
}

inline void inc(int &a, int b)
{
	a = Sub(a, b);
}

int N, Head[Max_N], Total, To[Max_N << 1], Next[Max_N << 1], G[Max_N];

inline void Add_Edge(int s, int t)
{
	++Total, To[Total] = t, Next[Total] = Head[s], Head[s] = Total;
}

int Size[Max_N], F[Max_N][Max_N], H[Max_N], Ans;

void dp(int u, int fa)
{
	F[u][Size[u] = 1] = 1;
	for (int i = Head[u], v;i;i = Next[i])
		if ((v = To[i]) != fa)
		{
			dp(v, u);
			memset(H, 0, sizeof(H));
			for (int x = 1;x <= Size[u];++x)
				for (int y = 1;y <= Size[v];++y)
				{
					upd(H[x + y], Mult(F[u][x], F[v][y]));
					inc(H[x + 0], Mult(F[u][x], Mult(F[v][y], G[y])));
				}
			Size[u] += Size[v];
			for (int x = 1;x <= Size[u];++x)
				F[u][x] = H[x];
		}
}

int main()
{
	gi(N);
	for (int i = 1, u, v;i != N;++i)
		gi(u), gi(v), Add_Edge(u, v), Add_Edge(v, u);
	G[0] = 1;
	for (int n = 2;n <= N;++n)
		G[n] = Mult(n - 1, G[n - 2]);
	dp(1, -1);
	for (int n = 1;n <= N;++n)
		upd(Ans, Mult(F[1][n], G[n]));
	printf("%d", Ans);
	return 0;
}

Measured memory_bytes: 102272
#include<bits/stdc++.h>
    using namespace std;
    int fir,sec;
    bool f,s;
    int main(){
        scanf("%2d%2d",&fir,&sec);
        if(1<=fir&&fir<=12) s=1;
        if(1<=sec&&sec<=12) f=1;
        if(f&&s) printf("AMBIGUOUS");
        else if(f) printf("YYMM");
        else if(s) printf("MMYY");
        else printf("NA");
    }

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
using namespace std;

int n,k;
int len[55];
int main(){
    cin>>n>>k;
    int res=0;
    for(int i=0;i<n;i++) {scanf("%d",&len[i]);res+=len[i];}
    sort(len,len+n);
    for(int i=0;i<n-k;i++) res-=len[i];
    cout <<res<<endl;
    return 0;
}

Measured memory_bytes: 256
//ABC176_A
#include <stdio.h>
int main(){
	int n,x,t;
	int ans;
	
	scanf("%d %d %d",&n,&x,&t);
	
	ans = ((n + (x-1))/x) * t;
	
	printf("%d",ans);
	
	return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;

  if (a*b % 2 == 0) {
          cout << "Even" << endl;
    }
    
  else if ( a*b % 2 == 1) {
          cout << "Odd" << endl;
    }
 }
  


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

namespace ABC099
{
    class Program
    {
        static void Main(string[] args)
        {
            List<string> list = new List<string>();
            while (true)
            {
                string line = Console.ReadLine();
                if (line == null) break;
                list.Add(line);
            }
            var ss = list[0].ToCharArray();
            var sss = ss.OrderBy(z => z);

            Boolean b = true;
            foreach (var item in sss)
            {
                if ( sss.Where(x => x == item).Count()%2==0)
                {
                    b = true;
                }
                else
                {
                    b = false;
                  break;
                }
               
            }
            if (b==true)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }

    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <climits>
#include <memory>
#include <sstream>
#include <iomanip>

using namespace std;


int main() {

	int y, n;

	cin >> n >> y;

	int ans_i= -1, ans_j = -1;

	for (int i = 0; i <= n; i++) {
		if (10000 * i > y)break;
		for (int j = 0; j <= n - i; j++) {
			if (10000 * i + 5000 * j + 1000 * (n - i - j) == y) {
				ans_i = i;
				ans_j = j;
			}
			else if (10000 * i + 5000 * j + 1000 * (n - i - j) > y) {
				break;
			}
		}
		if (ans_i != -1) break;
	}

	if (ans_i == -1) {
		cout << "-1 -1 -1" << endl;
	}
	else {
		cout << ans_i << " " << ans_j << " " << n - ans_i - ans_j << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
int main(void){
    int d,t,s;
    cin>>d>>t>>s;
    if(d<=t*s){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
}


Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

int main()
{
  double a, b, h, m;
  cin >> a >> b >> h >> m;
  
  double l;
  double lx, ly;
  lx = a * cos(M_PI * (0.5 - (h + m/60.0)/ 6.0)) - b * cos(M_PI * (0.5-m/ 30.0));
  ly = a * sin(M_PI * (0.5 - (h + m/60.0)/ 6.0)) - b * sin(M_PI * (0.5 - m/ 30.0));
  l = sqrt(lx*lx+ly*ly);
  cout << fixed << setprecision(15) << l << endl;
}


Measured memory_bytes: 4148
#include<iostream>
#include<bitset>
#include<algorithm>

using namespace std;

typedef long long ll;

int N, K;
ll A[5000 + 10];

bool f(int pos) {
	//A[pos]は不必要か？
	bitset<5000 + 30> dp;
	dp[0] = 1;
	for (int i = 0; i < N; i++) {
		if (i == pos)continue;
		if (A[i] <= K)dp |= (dp << A[i]);
	}
	if (K - A[pos] <= 0)return false;
	for (int i = (K - A[pos]); i < K; i++) {
		if (dp[i]) {
			return false;
		}
	}
	return true;
}

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A, A + N);
	
	int l = 0, u = N - 1;
	while (u - l > 1) {
		int mid = (u + l) / 2;
		if (f(mid))l = mid;
		else u = mid;
	}

	if (f(u))cout << u + 1 << endl;
	else if (f(l))cout << l + 1 << endl;
	else cout << 0 << endl;
	
	return 0;
}


Measured memory_bytes: 764
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;

int main()
{
    long long a[5];
    long long n;
    cin>>n;
    for(int i=0;i<5;i++)
        cin>>a[i];
    sort(a,a+5);
    cout<<4+(n%a[0]==0?n/a[0]:1+n/a[0]);
}

Measured memory_bytes: 256
#include<iostream>
#include <string>
#include <cstdlib> //絶対値利用のため
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
	int n, m;
	cin >> n >> m;
	int k[35];
	int a[35][35];
	int b[35] = { 0 };
	for (int i = 0; i < n; i++) {
		cin >> k[i];
		for (int j = 0; j < k[i]; j++) {
			cin >> a[i][j];
			b[a[i][j]]++;
		}
	}
	int counter = 0;
	for (int i = 1; i <= m; i++) {
		if (b[i] == n) counter++;
	}


		cout << counter << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int a, b;
    scanf("%d %d", &a, &b);
    if(a > b)
    {
        printf("a > b\n");
    }
    else if(a < b)
    {
        printf("a < b\n");
    }
    else
    {
        printf("a == b\n");
    }
    return 0;
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
struct edge{
	int v,w;
	edge(){;}
	edge(int v,int w):v(v),w(w){;}
	bool operator<(const edge&p)const{
		return w>p.w;
	}
};
vector<edge> e[105];
priority_queue<edge> q;
bool ok[105];
int main(){
//	freopen("a.txt","r",stdin);
	int n,tem;
	cin>>n;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++){
			cin>>tem;
			if(tem!=-1)e[i].push_back(edge(j,tem)),e[j].push_back(edge(i,tem));
		}
	int res=0;
	ok[0]=1;
	int k=0;
	for(int i=0;i<e[0].size();i++)q.push(e[0][i]);
	while(k!=n-1){
		edge te=q.top();q.pop();
		if(ok[te.v])continue;
		else{
			k++;
			ok[te.v]=1;
			res+=te.w;
			for(int i=0;i<e[te.v].size();i++)q.push(e[te.v][i]);
		}
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 3228
#include<iostream>
#include<cstdlib>
#include <algorithm>
#include <stdlib.h>
using namespace std;

int main()
{
  int w, a, b;
  cin >> w >> a >> b;

  if(w > max(a,b) - min(a,b))
  {
    cout << 0 << endl;
    exit(0);
  }

  cout << max(a,b) - (min(a,b) + w) << endl;  
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize, m: usize,
        lr: [(usize1, usize); m],
    }
    let mut imos = vec![0i64; n + 1];
    for &(l, r) in &lr {
        imos[l] += 1;
        imos[r] -= 1;
    }
    for i in 0..n {
        imos[i + 1] += imos[i];
    }
    let mut cnt = 0;
    for i in 0..n {
        if imos[i] == m as i64 {
            cnt += 1;
        }
    }
    puts!("{}\n", cnt);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 10620
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
string a,b;
int rui[4005];
vector<int>B;
int main(){
	cin>>a>>b;
	for(int i=0;i<2*b.size();i++){
		if(i)rui[i]=rui[i-1];
		rui[i]+=(b[i%b.size()]=='1');
		if(b[i%b.size()]=='1') B.pb(i);
	}
	int ans = INF; int n=a.size();
	for(int i=0;i<a.size();i++){
		vector<int>vi;
		vector<P>LR;
		for(int x=0;x<a.size();x++){
			if(b[x] != a[(x+i)%a.size()]){
				vi.pb((x+i)%a.size());
				int X = (x+i)%a.size();
				
				int y = POSU(B,X+a.size());
				if(y==0){
					cout<<-1<<endl; return 0;
				}
				y--;
				int l = (X+a.size())-B[y];
				
				y = POSL(B,X);
				if(y==B.size()){
					cout<<-1<<endl; return 0;
				}
				int r = X-B[y];
				LR.pb(mp(l,r));
			}
		}
		sort(LR.begin(),LR.end(),greater<P>()); int nxt=0;int R = 0;
		for(int L=n;L>=0;L--){
			while(nxt!=LR.size() && LR[nxt].fi>L){
				R=min(R,LR[nxt].sc);nxt++;
			}
			for(int G=i-2*n;G<=i+2*n;G+=n){
				if(G<=R){//cout<<L<<R<<G<<endl;
					ans = min(ans,2*L-G+int(vi.size()));
				}
				else if(L<=G){
					ans = min(ans,-2*R+G+int(vi.size()));
				}
				else{
					ans = min(ans,2*L-R+G-R+int(vi.size()));
					ans = min(ans,-2*R+L+L-G+int(vi.size()));
				}
			}
		}
		//cout<<ans<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <iterator>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(),x.end()

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const ll INF=1e18+123;
const ld EPS=1e-9;
const int inf=1e9+123;
const int MOD=1e9+7;
const int N=2e5+123;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};

int a[N],n;

ll calc(ll x){
    ll s=0;
    for(int i=1;i<=n;i++){
        s+=abs(x-a[i]);
        x++;
    }
    return s;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    ll l=-1e12,r=1e12;
    while(l<r){
        ll mid=(l+r)/2;
        if(calc(mid)>=calc(mid+1)){
            l=mid+1;
        }
        else r=mid;
    }
    cout<<calc(r);
    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>

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

	scanf("%d %d %d", &n, &h, &w);

	printf("%d\n", (n - h + 1)*(n - w + 1));

	return 0;
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{

    string S;
    cin >> S;
    map<char,int> A;
    rep(i,int(S.length())) A[S[i]]++;
    for (auto p : A) {
        if(p.se > 1) {
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
    
    
    

    return 0;
}


Measured memory_bytes: 256
using System;

namespace agc016_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int[] ret = new int[26];
            for (int i = 'a'; i <= 'z'; i++)
            {
                int max = 0;
                int now = 0;
                for (int j = 0; j < s.Length; j++)
                {
                    if (s[j] == (char)i)
                    {
                        max = Math.Max(max, now); now = 0;
                    }
                    else
                    {
                        now++;
                    }
                }
                max = Math.Max(max, now);
                ret[i - 97] = max;
            }
            Array.Sort(ret);
            Console.WriteLine(ret[0]);
        }
    }
}

Measured memory_bytes: 11092
def f(n):
    if n % 2 == 0:
        return n / 2
    else:
        return (n*3) + 1

s = int(input())
l = [s]
m = 1

while True:
    num = f(l[m-1])
    if num not in l:
        l.append(num)
        m += 1
    else:
        print(m + 1)
        break


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int N=30;
typedef long long ll;

int d[N],len,tmp;
ll f[N][2][2];

ll dp(int n) {
	memset(f,0,sizeof(f));
	int m=n>>1;
	f[0][0][0]=1;
	for(int i=0;i<m;i++)
		for(int j=0;j<2;j++)
			for(int k=0;k<2;k++)
				if(f[i][j][k]) {
					for(int x=0;x<10;x++) {
						int y=x+d[i+1]+k,k1=y/10;y%=10;
						if(k1>1) continue;
						int j1=(10*j+x-y-d[n-i]);
						if(j1!=0&&j1!=1) continue;
						if(!i&&(!x||!y)) continue;
						f[i+1][j1][k1]+=f[i][j][k];
					}
				}
	if(n&1) {
		ll ret=0;
		for(int j=0;j<2;j++)
			for(int k=0;k<2;k++)
				for(int x=0;x<10;x++) {
					if(x+d[m+1]+k==x+j*10) ret+=f[m][j][k];
				}
		return ret;
	}
	else return f[m][0][0]+f[m][1][1];
}

int main() {
	cin>>tmp;
	while(tmp) d[++len]=tmp%10,tmp/=10;
	ll ans=0;
	for(int i=len;i<=2*len;i++) ans+=dp(i);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
N,S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp =[[0]*(S+1) for _ in range(N+1)]
dp[0][0]=1
for i in range(N):
    for j in range(S+1):
        dp[i+1][j] += 2*dp[i][j]
        dp[i+1][j] %= mod
        if j+A[i]<=S:
            dp[i+1][j+A[i]] += dp[i][j]
            dp[i+1][j+A[i]] %= mod
print(dp[N][S])

Measured memory_bytes: 135444
//                        DushtuBunny
//                        Rahul Halder    
//    Indian Institute of Engineering Science & Technology,Shibpur


#include <bits/stdc++.h>

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define int long long
#define f first
#define se second
#define LB lower_bound
#define UB upper_bound
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define pie 3.14159265358979323846264338327950288
const unsigned int MOD = 1000000007;

using namespace std;

int32_t main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    IOS;
    int T;
    // cin>>T;
    T=1;

    while(T--)
    {
        ll k;cin>>k;
        string s;cin>>s;
        if(s.size()<=k)
            cout<<s;
        else
            cout<<s.substr(0,k)<<"...";
    }
    

    return 0;
}

Measured memory_bytes: 3676
fun intList() = readLine()?.split(" ")?.map(String::toInt) ?: TODO()
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val a = intList()
    val box = Array(n) { 0 }
    (n - 1).downTo(0).forEach { i ->
        var balls = a[i]
        var multiple = 2
        while ((i + 1) * multiple <= n) {
            balls += box[(i + 1) * multiple - 1]
            multiple++
        }
        box[i] = balls % 2
    }
    val m = box.count { it == 1 }
    if (m == 0) {
        println("0")
    } else {
        println(
            """
        $m
        ${box.mapIndexedNotNull { i, v ->
                if (v == 1) {
                    i + 1
                } else {
                    null
                }
            }.joinToString(separator = " ")}
    """.trimIndent()
        )
    }
}


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

int main(){
    string s;
    cin >> s;
    string sub1 = "KIH", sub2 = "B", sub3 = "R";
    string ans = "NO";
    for(int bit = 0; bit < (1 << 4); bit++){
        string coans = "";
        if(bit & 1) coans += 'A';
        coans += sub1;
        if(bit & (1 << 1)) coans += 'A';
        coans += sub2;
        if(bit & (1 << 2)) coans += 'A';
        coans += sub3;
        if(bit & (1 << 3)) coans += 'A';

        if(s == coans) ans = "YES";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class ConnectNodeInfo{
	vector<vector<pair<ll,ll>>> graph;
public:
	ConnectNodeInfo(int node_num){
		graph.resize(node_num);
	}
	void AddNonDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
		graph[v].emplace_back(u,w);
	}
	void AddDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
	}
	vector<pair<ll,ll>>& operator[](ll index){
		return graph[index];
	}
	size_t size(){return graph.size();}
};

class Dijkstra{
	using Point = pair<ll,ll>;
	vector<ll> dist;
public:
	void CalcShortestPath(int start,ConnectNodeInfo& connect){
		dist.resize(connect.size(),1LL<<60);
		dist[start] = 0;

		priority_queue<Point,vector<Point>,greater<Point>> Q;
		Q.emplace(0,start);
		while(!Q.empty()){
			auto p = Q.top();
			Q.pop();
			int v = p.second;
			if(dist[v]<p.first){
				continue;
			}
			for(auto e:connect[v]){
				if(dist[e.first]>dist[v]+e.second){
					dist[e.first] = dist[v]+e.second;
					Q.emplace(dist[e.first],e.first);
				}
			}
		}
	}
	ll GetDistance(int i){
		return dist[i];
	}
};

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

	int N=in(),M=in();
	ConnectNodeInfo connect(3*N);
	REP(i,M){
		int u=in()-1,v=in()-1;
		connect.AddDirectionalConnection(3*u,3*v+1,1);
		connect.AddDirectionalConnection(3*u+1,3*v+2,1);
		connect.AddDirectionalConnection(3*u+2,3*v,1);
	}
	int S=in()-1,T=in()-1;
	Dijkstra Dij;
	Dij.CalcShortestPath(3*S,connect);
	auto dist = Dij.GetDistance(3*T);
	out(dist>=1LL<<60?-1:dist/3LL);
	return 0;
}

Measured memory_bytes: 19072
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int a[5];
    for(int i = 0;i < 5;i++){
        scanf("%d", &a[i]);
    }
    int count = 0;
    int p = 10;
    for(int i = 0;i < 5;i++){
        if(a[i] % 10 == 0)count++;
        else if(p > a[i] % 10){
            p = a[i] % 10;
        }
    }
    p = p + 40 - count*10;
    printf("%d\n", a[0]/10*10 + a[1]/10*10 + a[2]/10*10 + a[3]/10*10 + a[4]/10*10 + p);
    return 0;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	ll n, a;
	vector<ll> v1;
	vector<ll> v2;
	ll count = 0;

	cin >> n;

	REP(i, n) {
		cin >> a;
		v1.push_back(a);
	}

	if (n % 2 == 0) {
		for (int i = n / 2; i > 0; i--) {
			v2.push_back(v1[2 * i - 1]);
		}

		for (int i = 0; i < n / 2; i++) {
			v2.push_back(v1[i * 2]);
		}
	}
	else {
		for (int i = (n + 1) / 2; i > 0; i--) {
			v2.push_back(v1[2 * i - 2]);
		}

		for (int i = 0; i < n / 2; i++) {
			v2.push_back(v1[i * 2 + 1]);
		}
	}

	cout << v2 << endl;
}

Measured memory_bytes: 5488
n = int(input())
AC, WA, TLE, RE = 0, 0, 0, 0
while n != 0:
  i = input()
  if i == 'AC':
  	AC += 1
  elif i == 'WA':
    WA += 1
  elif i == 'TLE':
    TLE += 1
  elif i == 'RE':
    RE += 1
  n -= 1
print("AC x",AC)
print("WA x",WA)
print("TLE x",TLE)
print("RE x",RE)

Measured memory_bytes: 9204
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    if(k <= a) cout << k << endl;
    else if(k <= a+b) cout << a << endl;
    else cout << a - (k-a-b) << endl;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    set<int>arr;
    int n;
    cin>>n;
    for(int i=0; i<n; i++){
    	int num;
    	cin>>num;
    	arr.insert(num);
	}
	if(arr.size()==n)
	 cout<<"YES";
	else
	 cout<<"NO";
	return 0;
}

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

int main() {
  int n, k; cin >> n >> k;
  vector<int> v(n);
  vector<int> r(n+1, 1<<30); r[0] = 0;
  for (int i=0; i<n; i++) cin >> v[i];

  for (int i=0; i<n; i++) {
    for (int j=1; j<=k; j++) {
      int cost = abs(v[i] - v[i+j]);
      r[i+j] = min(r[i+j], r[i] + cost);
    }
  }

  cout << r[n-1] << endl;

  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
const ll MAX_N = 10000100;

vector<int> is_prime;
void init_prime()
{
    is_prime.assign(MAX_N, 1);
    is_prime[0] = 0;
    for (ll i = 2; i*i < MAX_N; ++i)
    if (is_prime[i])
    {
        for (ll j = i*i; j < MAX_N; j += i)
            is_prime[j] = 0;
    }
}

int main()
{
    init_prime();
    ll a, b;
    cin >> a >> b;

    ll g = __gcd(a, b);

    int cnt = 1;
    bool flag = true;
    for (ll n = 2; n*n <= g; ++n)
    if (is_prime[n] and g % n == 0)
    {
        ++cnt;
        flag = false;
        while (g % n == 0) g /= n;
    }
    if (g > 1) ++cnt;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 39424