akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <sstream>

#define DEBUG 0
#define W first
#define U second.first
#define V second.second
#define pb push_back
#define INF 1000000000
#define fore(i,a,b) for (int i = (a), _b = (b); i < (_b); ++i)
#define fort(i,a,b) for (int i = (a), _b = (b); i <= (_b); ++i)
#define ford(i,a,b) for (int i = (a), _b = (b); i >= (_b); --i)

using namespace std;

typedef long long LL;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vii> vvii;
typedef vector<int> vi;
typedef vector<vi> vvi;

int n, m, p;
viii e;
vi d;

int main() {
    if (DEBUG) {
        freopen("CP.inp", "r", stdin);
        //freopen("CP.out", "w", stdout);
    }
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> m >> p;
    while (m--) {
        int u, v, w; cin >> u >> v >> w;
        e.pb(iii(-(w - p), ii(u, v)));
    }
    d = vi(n + 1, INF);
    d[1] = 0;
    fort(i, 0, 2 * n)
        for (iii &x : e)
            if (d[x.U] != INF && d[x.V] > d[x.U] + x.W) {
                d[x.V] = d[x.U] + x.W;
                if (i >= n && x.V == n) {
                    cout << "-1\n";
                    return 0;
                }
            }
    cout << max(0, -d[n]) << '\n';
    return 0;
}


Measured memory_bytes: 384
H, W = map(int, input().split())
a = [0 for _ in range(H)]

for i in range(H):
    a[i] = list(map(str, input()))

row = [False] * H
col = [False] * W

for i in range(H):
    for j in range(W):
        if a[i][j] == '#':
            row[i] = True
            col[j] = True

for i in range(H):
    if row[i]:
        for j in range(W):
            if col[j]:
                print(a[i][j], end = '')
        print()


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


const int MAXN = 2e5+5;
int A[MAXN];
int k, n;
bool judge(double m)
{
    int cnt = 0;

    for(int i = 1; i <= n; ++i)
    {
        cnt += ceil(A[i] / m) - 1;

        if(cnt > k)
            return false;
    }

    return true;
}

int main() {

   cin >> n >> k;

   double l = 0, r = 0;

   for(int i = 1; i <= n; ++i)
   {
        cin >> A[i];
        if(r < A[i])
            r = A[i];
   }


   while(r - l >= 1e-6)
   {
       double mid = (r + l) / 2;
       if(judge(mid))
        r = mid;
       else
        l = mid;
   }

   cout << int(ceil(l)) << endl;


    return 0;
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  /*while(x->left != NIL){
    x = x->left;
  }
  return x;*/
}

Node treeSearch(Node u, int k){
  if(u == NIL || k == u->key){
    return u;
  }
  if(k < u->key){
    return treeSearch(u->left,k);
  }else{
    return treeSearch(u->right,k);
  }
  while(u != NIL && k != u->key){
    if(k < u->key){
      u = u->left;
    }else{
      u = u->right;
    }
  }
  return u;
}
 
Node treeSuccessor(Node x){
  /* Node y;
  if(x->right != NIL){
    return treeMinimum(x->right);
  }
  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;*/
}

void treeDelete(Node z){
  /*  Node y;
  Node x;
  if(z->left == NIL || z->right == NIL){
    y = z;
  }else{
    y = treeSuccessor(z);
  }
  if(y->left != NIL){
    x = y->left;
  }else{
    x = y->right;
  }
  if(x != NIL){
    x->parent = y->parent;
  }
  if(y->parent == NIL){
    root = x;
  }else if(y == y->parent->left){
    y->parent->left = x;
  }else{
    y->parent->right = x;
  }
  if(y != z){
    z->key = y->key;
    }*/
  }

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }else{
      x = x->right;
    }
  }
  z->parent = y;
  if(y == NIL){
    root = z;
  }else if(z->key < y->key){
    y->left = z;
  }else{
    y->right = z;
  }
}

void inorder(Node u){
  if(u->left != NIL){
    inorder(u->left);
  }
  printf(" %d",u->key);
  if(u->right != NIL){
    inorder(u->right);
  }
}
void preorder(Node u){
  printf(" %d",u->key);
  if(u->left != NIL){
    preorder(u->left);
  }
  if(u->right != NIL){
   preorder(u->right);
  }
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 19364
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int x;
    cin >> x;
    if(x<=599){
        cout << 8 << endl;
    }
    else if(x<=799) cout << 7 << endl;
    else if(x <=999) cout << 6 << endl;
    else if(x <=1199) cout << 5 << endl;
    else if(x<=1399) cout << 4 << endl;
    else if(x<=1599) cout << 3 << endl;
    else if(x<=1799) cout << 2 << endl;
    else cout << 1 << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main(){
	int a,b,c,x;
	int ans=0;
	cin>>a>>b>>c>>x;
	for(int i=0;i<=a;i++){
		for(int j=0;j<=b;j++){
			for(int k=0;k<=c;k++){
				if(500*i+100*j+50*k == x) ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int n,m;
int main()
{	
	scanf("%d%d",&n,&m);
	for (int i=m/n+1;i;i--)
	{
		if (m%i==0&&m/i>=n) {printf("%d\n",i);break;}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int N, a;
	int ans = 0;
	cin >> N;
	
	for (int i = 0; i < N; i++)
	{
		cin >> a;
		while (a % 2 == 0) {
			ans++;
			a /= 2;
		}
	}

	cout << ans << endl;
}

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

typedef long long ll;
const int N = 3e5 + 5;

int n, a[N], xum, ok = 1;

int main() {
	cin>>n;
	for(int i = 1; i <= n; i++) {
		cin>>a[i];
		xum = xum^a[i];
	}
	if(xum) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
}

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

int main(){
    int W, H, N, ans=0, left, top, right, bottom;
    cin >> W >> H >> N;
    vector<int> x(N), y(N), a(N);
    int map[H][W];
    for(int i=0; i<N; i++)
	cin >> x[i] >> y[i] >> a[i];

    for(int i=0; i<H; i++){
	for(int j=0; j<W; j++){
	    map[i][j]=0;
	}
    }

    for(int i=0; i<N; i++){
	if(a[i]==1){
	    bottom = H;
	    top = 0;
	    left=0;
	    right = x[i];		
	}
	else if(a[i]==2){
	    bottom = H;
	    top = 0;
	    left=x[i];
	    right = W;		
	}
	else if(a[i]==3){
	    bottom = y[i];
	    top = 0;
	    left=0;
	    right = W;		    
	}
	else if(a[i]==4){
	    bottom = H;
	    top = y[i];
	    left=0;
	    right = W;		    
	}

	for(int j=top; j<bottom; j++){
	    for(int k=left; k<right; k++){
		map[j][k]++;
	    }
	}
	
    }
    
    for(int i=0; i<H; i++){
	for(int j=0; j<W; j++){
	    if(map[i][j]==0)
		ans++;
	}
    }
    
    cout <<ans<< endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
vector<string>split(string s, char c = ' ') {
	vector<string>vec;
	string h = "";
	for (int i = 0; i < s.size();) {
		int j = i;
		while (j < s.size() && s[j] != ' ') {
			h += s[j++];
		}
		if (h.size() > 0) vec.push_back(h);
		h = "";
		i = j + 1;
	}
	return vec;
}
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	string s;
	cin >> s;
	int ans = 0, res = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '0' && i % 2 == 0) ans++;
		else if (s[i] == '1' && i % 2 == 1) ans++;
		else res++;
	}
	cout << min(ans, res) << endl;
}

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


int main(void)
{
    int N;
    cin >> N;
    vector<ll> L(N);
    for (int i = 0; i < N; i++)
    {
        cin >> L[i];
    }

    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i+1; j < N; j++)
        {
            if(L[i] == L[j]) continue;
            for (int k = j+1; k < N; k++)
            {
                if(L[j] == L[k] || L[k] == L[i]) continue;

                bool cond1 = L[i] < (L[j] + L[k]);
                bool cond2 = L[j] < (L[i] + L[k]);
                bool cond3 = L[k] < (L[i] + L[j]);
                if(cond1 & cond2 & cond3){
                    ans ++;
                }
            }
        }
    }

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


Measured memory_bytes: 3628
/*
digu_J - Digvijay Janartha
NIT Hamirpur - INDIA
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    int len = comma - names;
    for (int i = 0; i < len; ++i) {
        cout << names[i];
    }
    cout <<  " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < ll, ll > pll;
typedef pair < int, int > pii;
typedef vector < ll > vll;
typedef vector < int > vi;

#define eb emplace_back
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll LINF = LLONG_MAX, base = 1e9, MOD = 1e9 + 7, N = 1e5 + 10, M = 1e3 + 10;
const int INF = INT_MAX;
const db PI = acos(-1);

void test();

int main() {
    fast_io();
    test();
    return 0;
}

void test() {
    int a, b;
    cin >> a >> b;
    if (a > 12) {
        cout << b << "\n";
    } else if (a > 5) {
        cout << b / 2 << "\n";
    } else {
        cout << "0\n";
    }
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << (abs(c-a)<=d || (abs(a-b)<=d&&abs(b-c)<=d)? "Yes": "No") << endl;

  return 0;
}


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

int main() {
    int K, X;
    cin >> K >> X;

    for(int i=X-K+1; i<X+K; i++) {
        cout << i << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

// vector print(debug or stdout)
template <class Iit>
void vout(const Iit &begin,const Iit &end,ostream &out) {
    for(auto it = begin; it != end; it++) {
        auto tmp = it;
        if (++tmp == end) out << *it << '\n';
        else out << *it << " ";
    }
}

int main(void)
{
    IOS

    int N, M, Q;
    cin >> N >> M >> Q;
    vector<int> v(N,1);
    
    vector<vector<int>> q;
    REP(i,Q) {
        vector<int> abcd(4);
        REP(j,4) cin >> abcd[j];
        abcd[0]--;
        abcd[1]--;
        q.push_back(abcd);
        //vout(ALL(abcd),cerr);
    }

    int ans = 0;
    while(true) {
        //vout(ALL(v),cerr);
        int tmp = 0;
        REP(i,Q) {
            if (v[q[i][1]] - v[q[i][0]] == q[i][2]) tmp += q[i][3];
        }
        ans = max(ans,tmp);

        int x = N-1;
        v[x]++;
        while (v[x] > M) {
            x--;
            v[x]++;
            if (x == 0) break;
        }
        FOR(i,x,N-1) v[i+1] = v[i];
        if (v[N-1] > M) break;
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 3660
"一般化うるう年"
while True:
    n, l, r = map(int, input().split())  # 数列の要素の個数はn個, lからrまでのxを試す
    if n == 0:
        break
    A = [int(input()) for _ in range(n)]

    ans = 0
    for x in range(l, r+1):
        flag = True
        for i in range(n):
            if x%A[i] == 0 and (i+1)%2 == 1:
                ans += 1
                flag = False
                break
            elif x%A[i] == 0 and (i+1)%2 == 0:
                flag = False
                break

        if flag:
            if n%2 == 0:
                ans += 1

    print(ans)



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

int main(void) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans=0;
    for(int a=0; a<10; a++){
        for(int b=0; b<10; b++){
            for(int c=0; c<10; c++){
                int k=0;
                for(int i=0; i<n; i++){
                    int x = s[i]-48;
                    if((k==0 & a==x)|(k==1 & b==x)|(k==2 & c==x)) k++;
                    if(k==3){
                        ans++;
                        break;
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		System.out.println(s.contains("a") && s.contains("b") && s.contains("c") ? "Yes" : "No");
	}
}

Measured memory_bytes: 23124
fun main(args : Array<String>) {
    val N = readLine()!!.toLong()

    val list753 = listOf("7", "5", "3")
    val maxDigits = Math.log10(N.toDouble()).toInt() + 1

    fun is753(string: String) : Boolean {
        return string.contains("7") && string.contains("3") && string.contains("5")
    }

    fun dfs(s: String) : Int {
        var count = 0
        if (is753(s) && s.toLong() <= N) {
            count++
        }
        if (s.length == maxDigits) {
            return count
        }

        list753.forEach {
            count += dfs(s + it)
        }
        return count
    }

    println(dfs(""))
}

Measured memory_bytes: 42972
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest._700problems
{
    class ARC103_E
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            string s = Read();
            int n = s.Length;
            if (s[n - 1] == '1' || s[0] == '0')
            {
                WriteLine(-1);
                return;
            }

            //check pair
            for (int i = 0; i < (n - 1) / 2; i++)
            {
                if ((s[i] != s[n - 2 - i]))
                {
                    WriteLine(-1);
                    return;
                }
            }

            int now = 1;
            int last = -1;
            for(int i = 1; i < n - 2; i++)
            {
                if (s[i] == '0') continue;

                if (last >= 0)
                {
                    WriteLine((last + 1) + " " + (i + 1));
                }

                for (int j = last+1; j < i; j++)
                {
                    WriteLine((j + 1) + " " + (i + 1));
                }

                last = i;
            }

            if (last >= 0)
            {
                WriteLine((last + 1) + " " + n);
            }

            for (int j = last + 1; j < n-1; j++)
            {
                WriteLine((j + 1) + " " + n);
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 16588
#ifdef BUILT_LOCAL

#include "niklib.h"

#endif

#include <iostream>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <cstdio>
#include <map>
#include <cmath>
#include <set>
#include <list>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef __int128 lll;
constexpr ll mod = 1000000007;

#define bs(n) (1ull<<(ull)(n))
#define rep(i, n) for(ll (i) = 0;(i) < (n);(i)++)


int main() {
    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << ' ' << b << ' ' << c << endl;
}

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

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

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

int main(void){

    string a, b;
    cin >> a >> b;

    b.pop_back();

    if(a == b) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

using namespace std;

#define int long long
#define INF 1e9
#define LINF 1e18

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

typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };

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

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

	int a, b;
	cin >> a >> b;
	cout << (a + b) / 2 << "\n";
	return 0;
}



Measured memory_bytes: 3232
#include<stdio.h>
#include<math.h>
int main(){
	long double a1[4],a2[4],b1[4],b2[4],aw,	bw,ah,bh,a[4],b[4];
	for(;scanf("%llf %llf %llf %llf %llf %llf %llf %llf",&a1[0],&a1[1],&a2[0],&a2[1],&b1[0],&b1[1],&b2[0],&b2[1])!=EOF;){
		a[0]=(a1[0]+a2[0])/2.0;
		a[1]=(a1[1]+a2[1])/2.0;
		b[0]=(b1[0]+b2[0])/2.0;
		b[1]=(b1[1]+b2[1])/2.0;
		aw=a2[0]-a1[0];
		ah=a2[1]-a1[1];
		bw=b2[0]-b1[0];
		bh=b2[1]-b1[1];
		if(((aw+bw)/2.0)>=fabs((double)(b[0]-a[0])) && ((ah+bh)/2.0)>=fabs((double)(b[1]-a[1])))printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

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

using namespace std;

int main()
{
	// 入出力関連設定
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(20);

	int h1,m1,h2,m2,k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;

	int min1=h1*60+m1;
	int min2=h2*60+m2-k;
	
	if(min2<=min1) cout << 0 << endl;
	else cout << min2-min1 << endl;

}

Measured memory_bytes: 3664
// Space-Time Sugoroku Road
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] road = new int[N];
		boolean[] selected = new boolean[N];
		Arrays.fill(selected, false);
		for (int i = 0; i < N; i++)
			road[i] = sc.nextInt();
		PriorityQueue<Node> queue = new PriorityQueue<Node>();
		Node n = new Node(0, 0);
		queue.add(n);
		while (!queue.isEmpty()) {
			n = queue.poll();
			if (n.num == N - 1)
				break;
			if (!selected[n.num]) {
				if (road[n.num] != 0)
					queue.add(new Node(n.num + road[n.num], n.cost));
				else
					for (int i = 1; i <= 6; i++)
						queue.add(new Node(n.num + i, n.cost + 1));
				selected[n.num] = true;
			}
		}
		System.out.println(n.cost);
		sc.close();
	}

	static class Node implements Comparable<Node> {
		int num, cost;

		Node(int n, int c) {
			num = n;
			cost = c;
		}

		@Override
		public int compareTo(Node anotherNode) {
			if (this.cost == anotherNode.cost)
				return this.num - anotherNode.num;
			return this.cost - anotherNode.cost;
		}

	}
}

Measured memory_bytes: 64188
# coding: utf-8
# Your code here!
import sys
n=int(input())
s=list(input())
if n%2==1:
    print("No")
    sys.exit()
else:
    for i in range(n//2):
        if s[i]==s[n//2+i]:
            continue
        print("No")
        sys.exit()
    print("Yes")

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

    using namespace std;

    const int MOD=1e9+7;
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        long long a,b,c,k;
        cin>>a>>b>>c>>k;
        long long total=0;
        while(k){
            if(a>=k){
                total+=k;
                break;
            }
            else{
                total+=a;
                k-=a;
            }
            if(b>=k){
                break;
            }
            else{
                k-=b;
            }
            if(c>=k){
                total+=(-k);
                break;
            }
            else{
                break;
            }
        }
        cout<<total;
        return 0;
    }


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

void solve() {
    int k;
    int a, b;
    cin >> k >> a >> b;
    for (int i = a; i <= b; ++i) {
        if (i % k == 0) {
            cout << "OK" << endl;
            return;
        }
    }
    cout << "NG" << endl;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair <int,int> PII;
typedef pair <int,string> PIS;
typedef vector <int> vec;
#define endl '\n'
#define pi 3.141592653589793
#define fori(z,n) for(int i=z;i<n;i++)
#define forii(z,n) for(int i=z;i<=n;i++)
int compare(int a, int b)
{
    return a>b;
}
int main() 
{ 
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    int max=arr[0];
    int index=0;
    for(int i=0;i<n;i++)
    {
        if(arr[i]>max)
        {
            max = arr[i];
            index = i;
        }
    }
    int secmax=-1;
    for(int i=0;i<n;i++)
    {
        if(arr[i]>secmax && i!=index)
        {
            secmax = arr[i];
        }
    }
    for(int i=0;i<n;i++)
    {
        if(i!=index)
        {
            cout<<max<<endl;
        }
        else
        {
            cout<<secmax<<endl;
        }
    }
    cerr<<"Time elapsed"<<1.0*clock()/CLOCKS_PER_SEC<<"s\n";
    return 0;
}


Measured memory_bytes: 2432
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int[] arr = new int[n + 1];
		for (int i = 1; i <= n; i++) {
		    arr[i] = sc.nextInt();
		}
		long[][][] dp = new long[n + 1][n + 1][50 * 50 + 1];
		dp[0][0][0] = 1;
		for (int i = 1; i <= n; i++) {
		    for (int j = 0; j < i; j++) {
		        for (int k = 0; k <= j * 50; k++) {
		            dp[i][j][k] += dp[i - 1][j][k];
		            dp[i][j + 1][k + arr[i]] = dp[i - 1][j][k];
		        }
		    }
		}
		long total = 0;
		for (int i = 1; i <= n; i++) {
		    total += dp[n][i][i * a];
		}
		System.out.println(total);
	}
}


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

int main(){
    string s, t;
    cin >> s >> t;
    int cnt = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] != t[i]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3896
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define pii pair<int,int>
#define reset(x,n) memset((x),(n),sizeof(x))
#define all(n) (n).begin(),(n).end()
#define pb push_back
#define IOS ios::sync_with_stdio(0),cin.tie(0);
ll dp[1005][1005];
char arr[1005][1005];
int main(){
	int n,m;
	cin>>n>>m;
	dp[1][1]=1;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin>>arr[i][j];
			if(arr[i][j]=='.'){
				dp[i][j]+=dp[i-1][j]+dp[i][j-1];
				dp[i][j]%=1000000007;
			}
		}
	}
	cout<<dp[n][m]<<'\n';
}


Measured memory_bytes: 9088
#include<iostream>
using namespace std;
int a[50],k[50],s[50],ans;
int n,m;
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>k[i];
		for(int j=1;j<=k[i];j++){
			cin>>a[j];
			s[a[j]]++;
		}
	}
	for(int i=1;i<=50;i++){
		if(s[i]==n) ans++;
	}
	cout<<ans<<endl;
	return 0;
}


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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string[] strs = sc.Array();

        string answer = strs[0][0].ToString() + strs[1][0].ToString() + strs[2][0].ToString();

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13140
import java.util.Arrays;
import java.util.Optional;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int count=Integer.valueOf(sc.nextLine());
		Optional<Integer> result=Arrays.asList(sc.nextLine().split(" "))
				.parallelStream()
				.map(Main::countCanDivideBy2)
				.min(Integer::compare);
		System.out.println(result.get());
	}
	public static int countCanDivideBy2(String s) {
		int i=Integer.parseInt(s);
		int result=0;
		while(i%2==0) {
			i/=2;
			result++;
		}
		return result;
	}
}

Measured memory_bytes: 29140
#include <iostream>

using namespace std;

int N;
int a[25][25];

long long int MOD = 1000000007;

long long int dp[1 << 25];

int count_bit(int k) {
	int num = 0;
	while (k) {
		num += (k & 1);
		k /= 2;
	}

	return num;
}

int main(void) {

	cin >> N;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			cin >> a[i][j];
		}
	}

	dp[0] = 1;

	for (int k = 0; k < (1 << N) - 1; k++) {
		int i = count_bit(k) + 1;
		for (int j = 1; j <= N; j++) {
			if ((a[i][j] == 1) && ((k&(1<<(j-1)))==0)) {
				dp[k | ((1 << (j - 1)))] += dp[k];
				dp[k | ((1 << (j - 1)))] %= MOD;
			}
		}
	}

	cout << dp[(1 << N) - 1] << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 18688
#include <cstdio>
#include <vector>

#define MAXN 100000

bool partz, e[MAXN + 1], viz[MAXN + 1];
std::vector < int > g[MAXN + 1];

void dfs(int x) {
    viz[x] = 1;
    int cnt = 0;
    for (auto &y : g[x]) {
        if (viz[y] == 0) {
            dfs(y);
            cnt += 1 - e[y];
        }
    }
    if (cnt == 1)
        e[x] = 1;
    else if (cnt > 1)
        partz = 1;
}

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

    for (int i = 1; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);

        g[x].push_back(y);
        g[y].push_back(x);
    }

    dfs(1);

    partz |= 1 - e[1];

    if (partz)
        printf("First\n");
    else
        printf("Second\n");

    return 0;
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll ans = -2LL<<62;
  maxs(ans,b*d);
  maxs(ans,a*c);
  maxs(ans,a*d);
  maxs(ans,b*c);
  if(a<=0 and b>=0) max(ans,0LL);
  if(c<=0 and d>=0) max(ans,0LL);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    sort(s.begin(),s.end());
   if(s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[3]&&s[0]!=s[2])
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
using LL = long long;
int main() {
	LL N;
	cin >> N; 
	vector<LL> A(N + 2);
	vector<LL> grad(N + 1);	// 次の日の上昇幅
	A[N + 1] = 0;
	for (LL i = 1; i <= N; i++) {
		cin >> A[i];

	}
	for (LL i = 1; i <= N; i++) {
		grad[i] = A[i+1] - A[i];
	}
	bool have_kabu = false;
	LL K_num = 0;
	LL money = 1000;
	for (LL i = 1; i <= N; i++) {
		if (have_kabu == false) {
			// 次の日に株が上がるときは買う
			if (grad[i] > 0) {
				K_num = money / A[i];
				money = money % A[i];
				have_kabu = true;
			}
		}
		// 株を持っていて次の日下がるときは全部売る
		else if(grad[i] < 0) {
			money = money + K_num * A[i];
			K_num = 0;
			have_kabu = false;
		}

	}
	cout << money << endl;
	return 0;

}

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

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

    while (1) {
        int N, M;
        cin >> N >> M;
        if (!N & !M) break;
        vector<vector<int>> score;
        for (int i = 0; i < N; i++) {
            int d, p;
            cin >> d >> p;
            vector<int> tmp;
            tmp.push_back(p);
            tmp.push_back(d);
            score.push_back(tmp);
        }
        sort(score.begin(), score.end(), greater<vector<int>>());
        int index = 0;
        while (M > 0) {
            if (score[index][1] == 0) index++;
            if (index == score.size()) break;
            if (M >= score[index][1]) {
                M -= score[index][1];
                score[index][1] = 0;
            } else {
                score[index][1] -= M;
                M = 0;
            }
        }
        int ans = 0;
        for (auto i : score) {
            ans += i[0] * i[1];
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3640
# require 'pry'
S = gets.chomp
K = gets.to_i
# binding.pry
S.size.times do |i|
  if S[i] != "1" && i + 1 <= K
    puts S[i]
    exit
  elsif S[i] == "1" && i + 1 >= K
    puts "1"
    exit
  end
end
puts "1"

Measured memory_bytes: 1788
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
 
using namespace std;
using ll = long long;
 
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };


int main()
{
	int n, k, x, y;

	cin >> n >> k >> x >> y;

	cout << x * min(n, k) + ((n - k < 0)? 0 : y * (n - k)) << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

#define MOD (1000000007)

int n;
int a[100000];

int main(int argc, char **argv) {
	cin >> n;
	REP(i, n) {
		cin >> a[i];
		if (a[i] % 2 == n % 2) {
			cout << 0 << endl;
			return 0;
		}
		a[i] /= 2;
	}
	sort(a, a + n);
	ll res = 1;
	REP(i, n) {
		if (a[i] != (i + n % 2) / 2) {
			cout << 0 << endl;
			return 0;
		}
		if (i % 2 == 1) res = res * 2 % MOD;
	}
	cout << res << endl;
	return 0;
}


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

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

const int INF = 1e9;
const int mod = 1e9+7;

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

    vector<int> a(26,INF);
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        int b[26] = {};
        for(int j = 0; j < s.length(); j++){
            b[s[j]-'a']++;
        } 
        for(int j = 0; j < 26; j++){
            if(b[j] != 0) a[j] = min(a[j],b[j]);
            else a[j] = 0;
        }
    }

    for(int i = 0; i < 26; i++){
        if(a[i] != INF){
            for(int j = 0; j < a[i]; j++){
                cout << char('a'+i);
            }
        }
    }
    cout << endl;

    return 0;
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
int a[252521];

ll naive(){
  ll ans = 0;
  REP(i,n){
    ll x = 0, s = 0;
    FOR(j,i,n){
      x ^= a[j];
      s += a[j];
      if(x==s)ans++;
    }
  }
  return ans;
}

ll solve(){
  ll ans = 0;
  ll s = 0, x = 0;
  s = a[0];
  x = a[0];
  int r = 1;
  REP(l,n){
    while(r<n){
      if(s+a[r] == (x^a[r])){
        s += a[r];
        x ^= a[r];
        r++;
      }else break;
    }
    ans += r-l;
    // DEBUG(r);
    s -= a[l]; x ^= a[l];
    if(r==l+1){
      s += a[r];
      x ^= a[r];
      r++;
    }
  }
  return ans;
}

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%d",a+i);
  // srand(time(NULL));
  // REP(i,n)a[i] = rand();
  printf("%lld\n",solve());
  // printf("%lld\n",naive());
  return 0;
}


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

typedef long long ll;
typedef long double ld;

const int N=1e7+10;


vector<int> g[55];
vector<pair<int,int> > e;
bool vis[55];
int u,v;

void dfs(int s){
    vis[s]=true;
    for(int it:g[s]){
        if((s==u && it==v)||(s==v && it==u))
            continue;
        if(!vis[it])
            dfs(it);
    }
}

int main(){
    //freopen("out.txt", "r", stdin);
    //freopen("answers.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    /*int t;
    cin>>t;
    while(t--){

    }*/
    int n,m;
    cin>>n>>m;
    while(m--){
        int a,b;
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
        e.push_back(make_pair(a,b));
    }
    int ans=0;
    for(auto it:e){
        memset(vis,0,sizeof vis);
        u=it.first,v=it.second;
        dfs(1);
        for(int i=1;i<=n;i++){
            if(!vis[i]){
                ans++;
                break;
            }
        }
    }
    cout<<ans<<endl;





    
    return 0;

}


Measured memory_bytes: 256
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
const long long MOD = 1000000007;

int main(void){
    ll x;
    ll n;
    ll t;
    cin >> n >> x >> t;
    ll ans = (n/x)*t;
    if(n%x){
        ans+= t;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<string> vec(N);
    for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
    }
  
  sort(vec.begin(),vec.end());

    int count=0;

    for(int i=0;i<N;i++){
      if(i<N-1){
          if(vec.at(i)==vec.at(i+1)){
            count=count;
          }
          else if(vec.at(i)!=vec.at(i+1)){
                count++;
          }
      }
        
    }

    cout << count+1  << endl;

    
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
vector <int> des[1000100];
int sg(int s,int pre=0)
{
	int ans=0;
	for (int k=0;k<des[s].size();k++) if (des[s][k]!=pre)
	{
		ans^=sg(des[s][k],s)+1;
	}
	return ans;
}
int main()
{
	int n;scanf("%d",&n);
	for (int i=1;i<n;i++)
	{
		int u,v;scanf("%d%d",&u,&v);
		des[u].push_back(v);des[v].push_back(u);
	}
	if (sg(1)) printf("Alice\n");else printf("Bob\n");
}

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

#define fio                           \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define pi pair<ll, ll>
#define PI 3.141592653589793238462643383279502884L
#define mp make_pair
#define pb push_back
#define fall(i, a, b) for (int i = a; i < b; i++)
#define sz(x) (ll) x.size()
#define all(x) x.begin(), x.end()
#define ed cout << "ed";
ll MOD = 1e9 + 7;
ll MOD1 = 1e9 + 123;
ll MOD2 = 1e9 + 321;

int main()
{
	fio;
	ll t, a, n, q, k, i, m, c, u, f, j, p, r, x, y, s, b, d;

	map<string, int> Mp;
	string S;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> S;
		Mp[S]++;
	}
	cout << "AC x " << Mp["AC"] << endl;
	cout << "WA x " << Mp["WA"] << endl;
	cout << "TLE x " << Mp["TLE"] << endl;
	cout << "RE x " << Mp["RE"] << endl;
	return 0;
}


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

struct UnionFind {
  vector<int> d;
  UnionFind(int n = 0) : d(n, -1) {}

  int find(int x) {
    if (d[x] < 0)
      return x;
    return d[x] = find(d[x]);
  }

  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y)
      return false;
    if (d[x] > d[y])
      swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }

  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -d[find(x)]; }
};

int main() {
  int n, m;
  cin >> n >> m;
  UnionFind uf(n);

  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    uf.unite(a, b);
  }

  int ans = 0;
  rep(i, n) ans = max(ans, uf.size(i));
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3972
#include<bits/stdc++.h>
using namespace std;
int main()
{ int n;
cin>>n;
long double p[n+1];
for(int i=1;i<=n;i++)
    cin>>p[i];
cout<<setprecision(11);
long double dp[n+1][n+1]={0};
for(int i=0;i<=n;i++)
    for(int j=0;j<=n;j++)
    dp[i][j]=0.000;

dp[0][0]=1.00;
long double var=1.0000;
for(int i=1;i<n;i++)
{    var=var*(1-p[i]);
    dp[i][0]=var;
}
for(int i=1;i<=n;i++)
{
    for(int j=1;j<=n;j++)
    { if(j>i)
        { dp[i][j]=0;
            false;
        }

      dp[i][j]=0;
      dp[i][j]=p[i]*dp[i-1][j-1]+(1-p[i])*dp[i-1][j];
    }
}

long double ans=0;
for(int i=n/2+1;i<=n;i++)
    ans+=dp[n][i];
cout<<ans<<endl;
}


Measured memory_bytes: 140928
s=input()
n=len(s)
m=(n-1)//2
t=s[:m]

for i in range(m):
  #print(s[i],s[-i-1])
  if s[i]!=s[-i-1]:
    print('No')
    exit()
if m%2==1: l=(m-1)//2
else: l=m//2
for i in range(l):
  #print(t[i],t[-i-1])
  if t[i]!=t[-i-1]:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 61872
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math


NN = 202020
MOD = 10**9+7
# MOD = 998244353
INF = float("inf")

s = input()
if s == "ABC":
    print("ARC")
else:
    print("ABC")


Measured memory_bytes: 68064