akhauriyash/Code-Regression huggingface dataset:
N, T = map(int, input().split())
t = list(map(int, input().split()))
res = 0
for i in range(N):
  if i != N - 1:
    if t[i] + T >= t[i + 1]:
      res += t[i + 1] - t[i]
    else:
      res += T
  else:
    res += T
print(res)

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

using namespace std;

int t;
long long a, b, c, d;

long long gcd(long long a, long long b){
	if(a < b) swap(a, b);
	while(b){
		a %= b;
		swap(a, b);
	}
	return a;
}

int main(){
	scanf("%d", &t);
	for (int i = 0; i < t; ++i){
		bool ans = true;
		scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
		if(b > d || b > a) ans = false;
		else if(b > c + 1){
			long long e = gcd(d, b);
			if(a % e - e + b > c) ans = false;
		}
		printf("%s\n", ans ? "Yes" : "No");
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;

    int fx = 0;
    int x = N;
    while(x > 0) {
        fx += x % 10;
        x /= 10;
    }
    if (N%fx == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
N=int(input())
# 1011: -9
# 101  1 + 4 =5
# 10: -2
# 1

def calc(x):
    ans=""
    
    while True:

        if x%2==0:
            ans="0"+ans
        else:
            ans="1"+ans
            x-=1
        if x==0:
            break

        x = x//(-2)
    return ans

a=calc(N)

print(a)        

Measured memory_bytes: 61844
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
ans = [[0] * W for i in range(H)]

dy = 1
x = 0
y = 0
n = 1
for i in range(H*W):
    ans[y][x] = str(n)
    a[0] -= 1
    if a[0] == 0:
        a = a[1:]
        n += 1
    if y == H-1 and dy == 1:
        x += 1
        dy = -1
    elif y == 0 and dy == -1:
        x += 1
        dy = 1
    else:
        y += dy

for i in range(H):
    print(' '.join(ans[i]))


Measured memory_bytes: 3772
#include<iostream>
using namespace std;
int main()
{
	char s[10];
	int count,i,j;
	for(int i=0;i<4;i++)
	{
		cin>>s[i];
	}
	for(i=0;i<4;i++)
	{
		count=0;
		for(j=0;j<4;j++)
		{
			if(s[i]==s[j])
			{
				count++;
			}
	    }
	    	if(count!=2)
			{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
ans_str_sums = []
while True:
    S = input()
    if S == '0':
        break
    else:
        str_sum = 0
        for i in range(len(S)):
            str_sum = str_sum + int(S[i])
        ans_str_sums.append(str_sum)
for ans_str_sum in ans_str_sums:
    print(ans_str_sum)


Measured memory_bytes: 5616
// abc042_b
#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 <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

template <typename A, typename B> bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#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() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  rep(i, n) cin>>s[i];
  sort(s.begin(), s.end());
  for (string x : s) {
    cout<<x;
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

ll dp[101][25];
vector<pair<int,pair<int,int>>> g[101];
ll dp2[1<<8];

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,m,h,k;
	while(1){
		cin >> n >> m >> h >> k;
		if(n==0&&m==0&&h==0&&k==0)break;
		for(int i=0;i<n;i++){
			for(int j=0;j<=h;j++){
				dp[i][j]=1e18;
			}
		}
		for(int i=0;i<n;i++){
			g[i].clear();
		}
		map<pair<int,int>,int> mp;
		for(int i=0;i<m;i++){
			int a,b,c,d,e; cin >> a >> b >> c >> d >> e;
			a--; b--;
			e--;
			g[a].push_back(make_pair(b,make_pair(c,d)));
			g[b].push_back(make_pair(a,make_pair(c,d)));
			mp[make_pair(a,b)]=e;
			mp[make_pair(b,a)]=e;
		}
		int s,t; cin >> s >> t;
		s--; t--;
		int p; cin >> p;
		for(int i=0;i<(1<<k);i++){
			dp2[i]=1e15;
		}
		vector<pair<int,ll>> v(p);
		for(int i=0;i<p;i++){
			int kk; cin >> kk;
			int d; cin >> d;
			int res=0;
			for(int j=0;j<kk;j++){
				int e; cin >> e;
				e--;
				res+=(1<<e);
			}
			v[i]=make_pair(res,d);
		}
		dp2[0]=0;
		for(int i=0;i<(1<<k);i++){
			if(dp2[i]>=1e15)continue;
			for(int j=0;j<p;j++){
				dp2[i|v[j].first]=min(dp2[i|v[j].first],dp2[i]+v[j].second);
			}
		}
		ll res=1e18;
		for(int ii=0;ii<(1<<k);ii++){
			if(dp2[ii]>=1e15)continue;
			for(int i=0;i<n;i++){
				for(int j=0;j<=h;j++){
					dp[i][j]=1e18;
				}
			}
			priority_queue<pair<int,pair<int,int>>> q;
			q.push(make_pair(0,make_pair(s,0)));
			dp[s][0]=0;
			while(q.size()){
				auto p=q.top(); q.pop();
				if(-p.first>dp[p.second.first][p.second.second])continue;
				for(auto t:g[p.second.first]){
					if(p.second.second+t.second.second>h)continue;
					int ee=mp[make_pair(p.second.first,t.first)];
					if((1<<ee)&ii){
						if(dp[t.first][p.second.second+t.second.second]>dp[p.second.first][p.second.second]){
							dp[t.first][p.second.second+t.second.second]=dp[p.second.first][p.second.second];
							q.push(make_pair(-dp[t.first][p.second.second+t.second.second],make_pair(t.first,p.second.second+t.second.second)));
						}
					}
					else{
						if(dp[t.first][p.second.second+t.second.second]>dp[p.second.first][p.second.second]+t.second.first){
							dp[t.first][p.second.second+t.second.second]=dp[p.second.first][p.second.second]+t.second.first;
							q.push(make_pair(-dp[t.first][p.second.second+t.second.second],make_pair(t.first,p.second.second+t.second.second)));
						}
					}
				}
			}
			ll mi=1e18;
			for(int i=0;i<=h;i++){
				mi=min(dp[t][i],mi);
			}
			res=min(res,mi+dp2[ii]);
		}
		if(res>=1e15){
			cout << -1 << endl;
		}else{
			cout << res << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3332
a = str(input())
l = list(a)

K = 0
U = 0
P = 0
C = 0

n = len(l)

for i in range(0,n):
    if l[i] == 'K':
        K += 1
    if l[i] == 'U':
        U += 1
    if l[i] == 'P':
        P += 1
    if l[i] == 'C':
        C += 1
                        
min = K
if U < min:
    min = U
if P < min:
    min = P
if C < min:
    min = C
print(min)



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

using ll = long long;

#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 ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  int n, t; std::cin >> n >> t;
  vector<pi> ab(n);
  rep(i, n) {
    std::cin >> ab[i].fi >> ab[i].se;
  }
  vi dp(t);
  sort(rng(ab));
  int ans = 0;
  rep(i, n) {
    chmax(ans, dp[t-1]+ab[i].se);
    drep(j, t) {
      if (j - ab[i].fi < 0) continue;
      chmax(dp[j], dp[j-ab[i].fi] + ab[i].se);
    }
  }
  std::cout << ans << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define int long long
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
# define mo 1000000007

 signed main(){
    gok
    int a[3][3];
    map<int,pair<int,int>> mp;
    map<int,int> mp1;
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>a[i][j];
            mp1[a[i][j]]=1;
            mp[a[i][j]] = {i,j};
        }
    }
  int n;
  cin>>n;
  for(int i=0;i<n;i++)
  {
      int x;
      cin>>x;
      if(mp1[x]==1){
      pair<int,int> tt=mp[x];
      a[tt.first][tt.second]=-1;
      }
  }
  bool ch=false;
  for(int i=0;i<3;i++)
  {
      int s=0;
      for(int j=0;j<3;j++)
      {
          s += a[i][j];
      }
      if(s==-3)
        ch=true;
  }
  for(int i=0;i<3;i++)
  {
      int s=0;
      for(int j=0;j<3;j++)
      {
          s += a[j][i];
      }
      if(s==-3)
        ch=true;
  }
  if(a[0][0]==a[1][1] && a[1][1]==a[2][2] && a[0][0]==-1)
    ch=true;
  if(a[1][1] == a[0][2] && a[1][1]==a[2][0] && a[1][1]==-1)
    ch=true;
  if(ch)
    cout<<"Yes";
  else
    cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

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

  long x = k/50;
  long y = k%50;

  vector<long> res;

  rep(i,y) res.pb(49 + x + (50 - y) + 1);
  rep(i,50-y) res.pb(49 + x - y);

  cout << 50 << endl;

  rep(i,50) cout << res[i] << " \n"[i==49];

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int l = 0,r=0,maxi=0;
	string S;
	cin >> S;
	for (size_t i = 0; i < S.size(); i++)
	{
		if (S.at(i)=='A'|| S.at(i) == 'T'|| S.at(i) == 'G'|| S.at(i) == 'C')
		{
			r++;
		}
		else {
			maxi = max(r-l, maxi);
			l = i;
			r = i;
		}
	}
	maxi = max(r - l, maxi);
	cout << maxi;
}

Measured memory_bytes: 256
import java.text.ParseException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws ParseException {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
           int y=sc.nextInt();
           int m=sc.nextInt();
           int d=sc.nextInt();
           int s=y*10000+m*100+d;
           if(19890108<=s) {
               System.out.println("heisei "+(y-1988)+" "+m+" "+d);
           }else if(19261225<=s) {
               System.out.println("showa "+(y-1925)+" "+m+" "+d);
           }else if(19120730<=s) {
               System.out.println("taisho "+(y-1911)+" "+m+" "+d);
           }else if(18680908<=s){
               System.out.println("meiji "+(y-1867)+" "+m+" "+d);
           }else {
               System.out.println("pre-meiji");
           }
        }
    }
}


Measured memory_bytes: 25864
#include <iostream>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef complex<double> C;
#define EPS (1e-10)
#define EQ(a,b) (abs(a-b) < EPS) 
#define EQV(a,b) (EQ(a.real(), b.real()) && EQ(a.imag(), b.imag()))
int n;
C s[100], e[100];

double cross(C a, C b) {
  return a.real() * b.imag() - a.imag() * b.real();
}

void solve() {
  for(int i=0;i<n;i++)
    cin>>s[i].real()>>s[i].imag()>>e[i].real()>>e[i].imag();
  
  // ツ古ーツ点
  int res = 1;
  for (int i = 0; i < n; i += 1) {
    vector<C> iss;
    int cnt = 0;
    for (int j = 0; j < i; j += 1) {
      C iv = e[i] - s[i];
      C jv = e[j] - s[j];
      if (abs(cross(iv, jv)) < EPS) continue;
      
      /*
      double d1 = cross(jv, s[i] - s[j]);
      double d2 = cross(jv, e[i] - s[j]);
      double t = d1 / (d1 + d2);
      C is = s[i] + iv * t;
      */
      C is = s[i] + iv * cross(jv, s[j] - s[i]) / cross(jv, iv);
      if (abs(is.real()) > 100.0 - EPS) continue;
      if (abs(is.imag()) > 100.0 - EPS) continue; 
      
      bool flag = true;
      for (int i = 0; i < iss.size(); i += 1) {
        if (EQV(iss[i], is)) {
          flag = false; break;
        }
      }
      if (flag) {
        iss.push_back(is);
        cnt++;
      }
    }
    res += cnt + 1;
  }
  cout<<res<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>n, n) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 968
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 1e9 + 7;
const int N = 200005;
const int K = 50;
set < int > g1[N], g2[N];
int f[N], invf[N], s[N], dp[N], used[N];
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    for (int i = 1; i <= m; i++){
        int u, v;
        cin >> u >> v;
        if (s[u - 1] == 'A') g1[v].insert(u); else g2[v].insert(u);
        if (s[v - 1] == 'A') g1[u].insert(v); else g2[u].insert(v);
    }
    set < int > t;
    for (int i = 1; i <= n; i++){
        if (g1[i].size() == 0 || g2[i].size() == 0){
            t.insert(i);
            used[i] = 1;
        }
    }
    while(!t.empty()){
        int v = *t.begin();
        t.erase(t.begin());
        for (auto u: g1[v]){
            if (u == v) continue;
            g1[u].erase(v);
            g2[u].erase(v);
            if (g1[u].size() == 0 || g2[u].size() == 0 && !used[u]){
                t.insert(u);
                used[u] = 1;
            }
        }
        for (auto u: g2[v]){
            if (u == v) continue;
            g1[u].erase(v);
            g2[u].erase(v);
            if (g1[u].size() == 0 ||  g2[u].size() == 0 && !used[u]){
                t.insert(u);
                used[u] = 1;
            }
        }
        while(!g1[v].empty()) g1[v].erase(g1[v].begin());
        while(!g2[v].empty()) g2[v].erase(g2[v].begin());
    }
    for (int i = 1; i <= n; i++){
        if (g1[i].size() != 0 && g2[i].size() != 0){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No";
}


Measured memory_bytes: 45520
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  string a;
  cin>>a;
  if(a.at(0)!='A'){
    cout<<"WA"<<endl;
    return 0;
  }
  for(ll i=2;i<a.size()-1;i++){
    if(a.at(i)=='C'){
      a.at(i)='z';
      break;
    }
    if(i==a.size()-2){
      cout<<"WA"<<endl;
      return 0;
    }
  }
  for(ll i=1;i<a.size();i++){
    if(a.at(i)<'a'||a.at(i)>'z'){
      cout<<"WA"<<endl;
      return 0;
    }
  }
  cout<<"AC"<<endl;
  
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string btos(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  ll n;cin>>n;
  ll ans=0;
  for(ll i=1;i*i<=n;i++){
    ans=i*i;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
n = gets.to_i
a = gets.split.map(&:to_i)

count = Hash.new{|h,k| h[k] = 0}

n.times do |i|
  count[a[i]] +=1
end

ans = 0

count.each do |(k,v)|
  ans +=
    if v >= k
      v-k
    else
      v
    end
end

puts ans


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

using namespace std;
int main(){
	ios::sync_with_stdio(false);
	list<int> lis;
	int cnt;
	cin >> cnt;
	string tmp;
	int tmpI;
	for(int i=0; i<cnt; i++){
		cin >> tmp;
		if(tmp[0] == 'i'){	//insert x
			cin >> tmpI;
			lis.push_front(tmpI);
		}else if(tmp == "delete"){	//delete x
			cin >> tmpI;
			for(list<int>::iterator it = lis.begin(); it != lis.end(); it++){
				if(*it == tmpI){
					lis.erase(it);
					break;
				}
			}
		}else if(tmp[6] == 'F'){	//deleteF
			lis.pop_front();
		}else{	//deleteL
			lis.pop_back();
		}
	}
	for(list<int>::iterator it = lis.begin(); it != lis.end(); it++){
		if(it != lis.begin()){
			cout << " ";
		}
		cout << *it;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 34384
from bisect import bisect_left, bisect_right; from collections import Counter, defaultdict, deque, OrderedDict; from copy import deepcopy; from fractions import gcd; from functools import lru_cache, reduce; from math import ceil, floor; from sys import stdin, setrecursionlimit
import heapq as hq; import itertools as its; import operator as op


# globals
inf = float('inf')
input = stdin.readline


def main():
    s = get_str()
    c = Counter(s)
    if len(c.keys()) == 2 and list(c.values())[0] == 2:
        print("Yes")
    else:
        print("No")
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def gets(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input().strip()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().strip().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    setrecursionlimit(4100000)
    main()


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

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (int i = j; i < (n); i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define out(ans) cout << ans << endl
typedef pair<int,int>P;
const ll mod=1e9+7;

int main(){

  int m,d;cin>>m>>d;
  int count=0;

  rep(i,2,m+1){
    rep(j,10,d+1){
      int a=j/10,b=j%10;
      if(i==a*b&&a>=2&&b>=2){
        count++;
      }

    }
  }
  out(count);

  return 0;
}


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


int main() {
  int n, x, t;
  cin >> n >> x >> t;
  cout << t * ((n+x-1) / x);
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  double a[n];
  double add = 0;
  for(int i = 0; i < n; ++i) {
    cin >> a[i];
    add += a[i];
  }
  double h = (double)add / n;
  double s = 1000, pos;
  for(int i = n - 1; i >= 0; --i) {
    if(s >= fabs(h - a[i])) { s = fabs(h - a[i]); pos = i; }
  }

  cout << pos << endl;
  return 0;
}

Measured memory_bytes: 256
#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(long long i=0;i<x;i++)
#define repn(i,x) for(long long 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())
vector<pair<string,P> >vec;

void solve(long long n, vector<long long> p){
	ll cnt = 0;
	rep(i, n-2) {
		if ((p[i] < p[i+1] && p[i+1] < p[i+2]) || (p[i+2] < p[i+1] && p[i+1] < p[i])) {
			cnt++;
		}
	}
	cout << cnt << endl;
}

int main(){	
	long long n;
	scanf("%lld",&n);
	vector<long long> p(n-1+1);
	for(int i = 0 ; i <= n-1 ; i++){
		scanf("%lld",&p[i]);
	}
	solve(n, p);
	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <string.h>
#include <vector>

using namespace std;
int main() {
    int A,B,X;
    string ans;
    cin >> A>>B>>X;
    if(A<=X&&A+B>=X){
        ans="YES";
    }else{
        ans="NO";
    }
    cout << ans << endl;
    return 0;
}

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

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repp(i, s, e) for (int i = (s); i < (e); i++)
#define all(x) x.begin(), x.end()

#define endl "\n"

void use_cio() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}

template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto x : V) os << x << ", ";
  return os << "]";
}
//--------------------------------------------------//
const ll MOD = 1e9 + 7;
inline ll mul(ll a, ll b) { return ((a % MOD) * (b % MOD)) % MOD; }
ll pow_mod(ll x, ll n) {
  ll ret = 1;
  for (; n; n >>= 1, x = mul(x, x))
    if (n & 1) ret = mul(ret, x);
  return ret;
}
inline ll inv_mod(ll x) { return pow_mod(x, MOD - 2); }
inline ll add(ll a, ll b) { return (a + b) % MOD; }
int main() {
  use_cio();
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  ll proba = mul(a, inv_mod(a + b));
  ll probb = mul(b, inv_mod(a + b));
  ll tomul = mul(100, inv_mod(100 - c));
  ll ans = 0;
  ll proban = pow_mod(proba, n);
  ll probbn = pow_mod(probb, n);
  ll tmp = 1, prv = 0;
  ll apow = 1;
  ll bpow = 1;
  repp(i, n, 2 * n) {
    ll toadd = add(mul(proban, bpow), mul(probbn, apow));
    ans = add(ans, mul(mul((tmp - prv + MOD) % MOD, i), toadd));
    prv = tmp;
    tmp = mul(tmp, mul(i + 1, inv_mod(i - n + 1)));
    apow = mul(apow, proba);
    bpow = mul(bpow, probb);
  }
  cout << mul(ans, tomul) << endl;
}


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

using namespace std;
int main(){

int a,b,c,d,e,f;
string z,y;
cin>>z;
cin>>a;
b=z.length();
c=b-1;
e=a;
f=c/a;

cout<<z[0];
for(int i=0;i<f;i++)
{
    cout<<z[e];
    e=e+a;

}


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>;
const int INF = 1001001001;

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

    if (c - a - b > 2 && 4*a*b < (c - a - b)*(c - a - b)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))



vector <vector <ll>> dp(3000+1, vector<ll>(3000+1, 1e18));
vector <ll> as;

ll calc(ll begin, ll end, bool taro_turn){
    if (begin == end){
        return 0;
    }
    if (dp[begin][end] != 1e18){
        return dp[begin][end];
    }
    ll a = calc(begin+1, end, !taro_turn);
    ll b = calc(begin, end-1, !taro_turn);
    if (taro_turn){
        a += as[begin];
        b += as[end-1];
    } else {
        a -= as[begin];
        b -= as[end-1];
    }
    ll ret;
    if (taro_turn){
        ret = max(a, b);
    } else {
        ret = min(a, b);
    }
    dp[begin][end] = ret;
    return ret;
}


int main(void){
    ll n; cin >> n;
    REP(i, n){
        ll a; cin >> a;
        as.push_back(a);
    }
    cout << calc(0, n, true) << endl;
    return 0;
}

Measured memory_bytes: 71040
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double A = Integer.parseInt(sc.next());
    double B = Integer.parseInt(sc.next());
    if((A+B) % 2 == 0){
      System.out.println((int)(A+B)/2);
    }else{
      System.out.println("IMPOSSIBLE");
    }
  }
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int n, q;
    cin >> n >> q;
    vector<tuple<int, int, int>> works(n);
    for (int i=0; i<n; ++i) {
        ll s, t, x;
        cin >> s >> t >> x;
        works.at(i) = make_tuple(s-x, t-x, x);
    }

    vector<int> res(q);
    using P = pair<int, int>;
    priority_queue<P, vector<P>, greater<P>> que;
    std::sort(works.begin(), works.end());
    int cur = 0;
    for (int i=0; i<q; ++i) {
        int d;
        cin >> d;
        while (cur < n && get<0>(works.at(cur)) <= d) {
            que.push({get<2>(works.at(cur)), get<1>(works.at(cur))});
            ++cur;
        }
        while (!que.empty() && que.top().second <= d) que.pop();
        if (que.empty()) res.at(i) = -1;
        else res.at(i) = que.top().first;
    }
    for (int x : res) cout << x << '\n';
}

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

    solve();

    return 0;
}


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

string rotate(const string& s) {
	string r_s;
	r_s = s.substr(1, s.size() - 1);
	r_s += s.substr(0, 1);
	return r_s;
}

int main() {
	string s,t;
	cin >> s;
	cin >> t;
	string out = "No";
	for (size_t i = 0; i < s.size(); ++i) {
		if (s == t) {
			out = "Yes";
			break;
		}
		s = rotate(s);
	}
	cout << out << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long LL;
LL gcd(LL u, LL v) {
  LL r;
  while (0 != v) {
	  r = u % v; 
	  u = v; 
	  v = r; //
  }
  return u;
}
//最少公倍数
LL lcm(LL a, LL b){
	return  a*b/gcd(a, b);
}
int main(int argc, char* argv[])
{
	LL A,B,C,D;
	cin>>A>>B>>C>>D;
	LL LCM=lcm(C,D);
	LL Sum=B-A+1;
	LL AC=A/C;
	if (A%C==0){
		AC--;
	}
	LL numC=B/C-AC;
	LL AD=A/D;
	if (A%D==0){
		AD--;
	}
	LL numD=B/D-AD;
	LL ALCM=A/LCM;
	if (A%LCM==0){
		ALCM--;
	}
	LL numLCM=B/LCM-ALCM;
	cout<<Sum-numC-numD+numLCM<<endl;
	return 0;
}

Measured memory_bytes: 256
import fractions
# input
n = int(input())
A = [0] + [int(i) for i in input().split()] + [0]

# define
L = [0 for i in range(n+1)]
R = [0 for i in range(n+1)]
M = [0 for i in range(n)]

# main
for i in range(2, n+1):
  L[i] = fractions.gcd(L[i-1], A[i-1])
  R[n+1-i] = fractions.gcd(R[n+2-i], A[n+2-i])
  
for i in range(n):
  M[i] = fractions.gcd(L[i+1], R[i+1])

# output  
print(max(M))


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;

#define mt make_tuple
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sqr(x) ((ll)(x) * (x))

const int MAXN = 4000;

ll cnt[MAXN+1][3];

int pronadjiBoju(char c1, char c2)
{
    char niz[3] = {'R', 'G', 'B'};

    for(int i = 0; i < 3; ++i)
    {
        if(niz[i] != c1 && niz[i] != c2)return i;
    }
}

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

    for(int i = 0; i <= n; ++i)
    {
        for(int j = 0; j < 3; ++j)cnt[i+1][j]=cnt[i][j];
        cnt[i+1][s[i]=='R'?0:s[i]=='G'?1:2]++;
    }

//    for(int i = 1; i <= n; ++i)
//    {
//        for(int j = 0; j < 3; ++j)
//        {
//            cout << cnt[i][j] << '\n';
//        }
//
//        cout << "---------------------\n";
//    }

    ll resenje = 0LL;

    for(int i = 1; i<= n; ++i)
    {
        for(int j = i + 1; j <= n; ++j)
        {
            if(s[i-1]==s[j-1])continue;
            int trazimoTuBoju = pronadjiBoju(s[i-1], s[j-1]);
            resenje += (cnt[j][trazimoTuBoju] - cnt[i-1][trazimoTuBoju]);
            if((i+j)%2==0 && s[(i+j)/2-1]!= s[i-1] && s[(i+j)/2-1] != s[j-1])
            {
                --resenje;
            }
        }
    }

    cout << resenje << '\n';

    return 0;
}


Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
	cout << fixed << setprecision(10);
	int n;
	cin >> n;

	LLI sum = 0;
	vector<int> a(n);

	REP(i, n)
	{
		cin >> a[i];
		sum ^= a[i];
	}

	REP(i, n)
	{
		int ans = a[i] ^ sum;
		cout << ans << endl;
	}

	return 0;
}

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

namespace ITP1_7_D
{
    class Program
    {
        static void Main(string[] args)
        {
            // 行列A：n×m
            // 行列B：m×l
            // 行列A×行列B=行列C：n×l　←　Cを出力するプログラム
            //各要素：a(ij)、b(ij)、c(ij)

            //1行目(n、m、l)を取得する
            long[] info = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            long n = info[0];
            long m = info[1];
            long l = info[2];

            //行列A、B、Cを2次元配列として宣言
            //型[,] 配列名 = new 型[縦の要素数, 横の要素数]
            long[,] ranksA = new long[n, m];
            long[,] ranksB = new long[m, l];
            long[,] ranksC = new long[n, l];

            //行列A、Bの要素を受け取る配列の宣言と初期化
            long[] rowA = new long[m];
            long[] rowB = new long[l];

            //下記for文で用いる繰り返し回数の初期化
            long i1 = 0;
            long i2 = 0;
            long i3 = 0;
            long i4 = 0;
            long i5 = 0;
            long i6 = 0;
            long i7 = 0;

            //行列Aを2次元配列に代入
            for (i1 = 0; i1 < n; i1++)                                                       //n行分繰り返す処理
            {
                rowA = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();           //行列の一行を要素に分解し、配列にする

                for (i2 = 0; i2 < m; i2++)                                                  //n列分繰り返す処理
                {
                    ranksA[i1, i2] = rowA[i2];
                }

            }

            //行列Bを2次元配列に代入
            for (i3 = 0; i3 < m; i3++)
            {
                rowB = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();

                for (i4 = 0; i4 < l; i4++)
                {
                    ranksB[i3, i4] = rowB[i4];
                }
            }

            //行列A×行列Bの答えを行列Cに代入する処理
            for (i5 = 0; i5 < n; i5++)
            {
                for (i6 = 0; i6 < l; i6++)
                {
                    for (i7 = 0; i7 < m; i7++)
                    {
                        ranksC[i5, i6] += ranksA[i5, i7] * ranksB[i7, i6];
                    }
                }
            }
            //行列Cを出力する
            for (i5 = 0; i5 < n; i5++)
            {
                for (i6 = 0; i6 < l - 1; i6++)
                {
                    Console.Write(ranksC[i5, i6].ToString());

                    Console.Write(" ");
                }
                Console.WriteLine(ranksC[i5,i6]);
            }
        }

    }
}



Measured memory_bytes: 20488
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
#define endl '\n'
using namespace std;
int dy[4] = { 1, 0, -1, 0 }, dx[4] = { 0, 1, 0, -1 };
typedef pair<ll, ll> P;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    bool m1 = false;
    bool m2 = false;
    int mm1 = (s[0] - '0') * 10 + (s[1] - '0');
    int mm2 = (s[2] - '0') * 10 + (s[3] - '0');
    if (1 <= mm1 && mm1 <= 12) {
        m1 = true;
    }
    if (1 <= mm2 && mm2 <= 12) {
        m2 = true;
    }

    if (!m1 && !m2) {
        cout << "NA" << endl;
    } else if (m1 && m2) {
        cout << "AMBIGUOUS" << endl;
    } else if (m1 && !m2) {
        cout << "MMYY" << endl;
    } else{
        cout << "YYMM" << endl;
    }
    return 0;
}

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

struct UnionFind {
	vector<int> par;
	
	UnionFind(int n) : par(n) {
		for (int i = 0; i < n; i++) par[i] = i;
	}
	
	int root(int x) {
		return par[x] == x ? x : par[x] = root(par[x]);
	}
	
	void unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x != y) par[x] = y;
	}
	
	bool same(int x, int y) {
		return root(x) == root(y);
	}
};

struct Edge {
	int s, t, w;
	
	Edge() { ; }
	Edge(int s, int t, int w) : s(s), t(t), w(w) { ; }
	bool operator <(Edge const &e) { return w < e.w; }
};

int main() {
	int v, e;
	cin >> v >> e;
	vector<Edge> g(e);
	rep(i, e) {
		int s, t, w;
		cin >> s >> t >> w;
		g[i] = Edge(s, t, w);
	}
	sort(g.begin(), g.end());
	UnionFind uf(v);
	int ans = 0;
	rep(i, e) {
		if (!uf.same(g[i].s, g[i].t)) {
			uf.unite(g[i].s, g[i].t);
			ans += g[i].w;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4072
def dfs(node,visited,friends,connected_compnts):
    cmpnt = set()
    stack = [node]
    while stack:
        curr = stack.pop()
        if curr not in visited:
            visited.add(curr)
            cmpnt.add(curr)
            for kid in friends[curr]:
                stack.append(kid)

    connected_compnts.append(cmpnt)

def solve(cmpnt,friends,blocks,ans):
    arr = list(cmpnt)
    for node in arr:
        cmpnt.remove(node)
        add = []
        for kid in friends[node]:
            if kid in cmpnt:
                add.append(kid)
                cmpnt.remove(kid)

        blocked = set()
        for block in blocks[node]:
            blocked.add(block)
            
        ans[node] = len(cmpnt)-len(cmpnt&blocked)
        cmpnt.add(node)
        for kid in add:
            cmpnt.add(kid)

def main():
    n,m,k = map(int,input().split())
    friends = {}
    blocks = {}

    for i in range(1,n+1):
        friends[i] = []

    for i in range(1,n+1):
        blocks[i] = []

    for i in range(m):
        a,b = map(int,input().split())
        friends[a].append(b)
        friends[b].append(a)

    for i in range(k):
        a,b = map(int,input().split())
        blocks[a].append(b)
        blocks[b].append(a)

    connected_compnts = []

    visited = set()
    for i in range(1,n+1):
        if i not in visited:
            dfs(i,visited,friends,connected_compnts)

    ans = [0]*(n+1)
    for cmpnt in connected_compnts:
        solve(cmpnt,friends,blocks,ans)

    for i in range(1,n+1):
        print(ans[i],end = ' ')

main()


Measured memory_bytes: 120548
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int w = sc.nextInt();
    for (int i = 0; i < S.length(); i++) {
      if (i % w == 0) {
        System.out.print(S.charAt(i));
      }
    }
    System.out.println();
  }
}

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

#define 	ll 						long long int
#define 	pb 						push_back
#define 	mp 						make_pair
#define 	fast 					ios_base::sync_with_stdio(false);cin.tie(NULL);
#define 	ff 						first
#define 	ss 						second
#define 	nil 					-10e+9
#define 	initial 				0
#define 	waiting 				1
#define 	visit 					2
#define 	inf  					10e+9
#define 	mx   					200005
#define 	mxx  					1000005
#define 	mod  					1000000007
#define 	pr   					pair<ll,ll>
#define 	pp_queue 			priority_queue<pr,vector<pr>, greater<pr> >
#define 	dp_queue 			priority_queue<int,vector<int>, greater<int> >
#define 	sp_queue 			priority_queue<int>
#define 	fr(i,p,q)			for(int i=p;i<q;++i)
#define 	frr(i,p,q) 		for(int i=p;i<=q;++i)
#define 	mem(a,b) 			memset(a,b,sizeof(a))
#define 	len(a)   			(int)a.size()
#define 	input  				freopen("input.txt", "r", stdin);
#define 	output 				freopen("output.txt", "w", stdout);
#define 	debug(arr,j,n) fr(i,j,n) cout<<arr[i]<<" ";

ll power(ll a,ll b){ll aa=1;while(b){if(b&1){aa=aa*a;aa%=mod;}a=a*a;a%=mod;b/=2;}return aa;}

using namespace std;

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

	int a[n+1],b[n];

	fr(i,1,n) cin>>b[i];
	a[n]=b[n-1];
	a[1]=a[2]=b[1];

	for(int i=1;i<n-1;i++){
		a[i+1]=min(b[i],b[i+1]);
	}
	a[1]=b[1];
	ll sum=0;
	fr(i,1,n+1) sum+=a[i];
	cout<<sum<<"\n";
  return 0;
}


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

bool exists(vector<int> v, int n) {
    for (int i = 0; i < v.size(); i++) {
        if (v[i] == n) return true;
    }
    return false;
}

int main() {
    while (true) {
        int n;
        cin >> n;
        if (!n) return 0;
        int count[(n - 1) / 2 + 1];
        vector<int> mod;
        for (int i = 0; i < (n - 1) / 2 + 1; i++) {
            count[i] = 0;
        }
        for (int i = 1; i < n; i++) {
            int res = (i * i) % n;
            if (!exists(mod, res)) {
                mod.push_back(res);
            }
        }
        for (int i = 0; i < mod.size(); i++) {
            for (int j = 0; j < mod.size(); j++) {
                if (i == j) continue;
                int res = mod[i] - mod[j];
                if (res < 0) res += n;
                if (res > (n - 1) / 2) res = n - res;
                count[res]++;
            }
        }
        for (int i = 1; i < (n - 1) / 2 + 1; i++) {
            cout << count[i] << endl;
        }
    }
}

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

bool dice(vector<int>a,vector<int>b) {
	vector<int>m(6);
	for (int h = 0; h<6; h++)
		m[h] = a[h];
	for (int e = 0; e<4; e++) {
		a[0] = m[1]; a[1] = m[5]; a[4] = m[0]; a[5] = m[4];
		for (int h = 0; h<6; h++)
			m[h] = a[h];
		for (int f = 0; f<4; f++) {
			a[0] = m[3]; a[2] = m[0]; a[3] = m[5]; a[5] = m[2];
			for (int h = 0; h<6; h++)
				m[h] = a[h];
			for (int g = 0; g<4; g++) {
				a[2] = m[1]; a[4] = m[2]; a[1] = m[3]; a[3] = m[4];
				for (int h = 0; h<6; h++)
					m[h] = a[h];
				if (a == b)
				{
					return true;
				}
			}
		}
		if (e == 3) { return false; }
	}
}
int main() {
	int a;
	cin >> a;
	vector<vector<int>>s(0);
	for (int b = 0; b < a; b++) {
		vector<int>e(6);
		for (int c = 0; c<6; c++) {
			int d;
			cin >> d;
			e[c] = d;
		}
		s.push_back(e);
	}
	for (int f = 0; f < s.size(); f++) {
		for (int g = f + 1; g < s.size(); g++) {
			if (dice(s[f], s[g])) { cout << "No" << endl; goto l; }
		}
		if (s.size() - f == 1) { cout << "Yes" << endl; break; }
	}
l:;
}

Measured memory_bytes: 3180
n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(lambda x: int(x)-1, input().split())) for _ in range(m)]

is_good = [True] * n
for a, b in ab:
    if h[a] > h[b]:
        is_good[b] = False
    elif h[a] < h[b]:
        is_good[a] = False
    else:
        is_good[a] = False
        is_good[b] = False
print(sum(is_good))

Measured memory_bytes: 32016
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<utility>
using namespace std;
typedef  long long ll;
pair<ll,ll> a[333333];
int n;
bool check(ll k){
  priority_queue <int> q;
  ll s=0;
  int i;
  for(i=0;i<k;i++){
    q.push(a[i].first);
    s+=a[i].first;
  }

  //cout << s << " : " << a[k-1].second*k << endl;
  if(s<=k*a[k-1].second) return 1;
  i=k;
  while(i<n-1){
    s-=q.top(); q.pop();
    q.push(a[i].first);
    s+=a[i].first;
    //cout << s << " : " << k*a[i].second << endl;
    if(s<=k*a[i].second) return 1;
    i++;
  }
  //  i++;
    s-=q.top(); q.pop();
    q.push(a[i].first);
    s+=a[i].first;
    //cout << s << " : " << k*a[i].second << endl;
  return s<=k*a[i].second;
  //  return 0;
}
main(){
  cin >> n;

  for(int i=0;i<n;i++){
    cin >> a[i].second >> a[i].first;
    a[i].first*=-1;
    // a[i].second*=-1;
  }

  sort(a,a+n);//世具ソートス
  for(int i=0;i<n;i++){
    a[i].first*=-1;
    //a[i].second*=-1;
    swap(a[i].first,a[i].second);
    //cout << a[i].first << ' ' << a[i].second << endl;
  }

  int ed = n;
  int st=0;
  int res=0;
  while(st<=ed){
    int h=(st+ed)/2;
    //cout << "check" << endl;
    if(check(h)){
      //cout << "ok..." <<  h << endl;
      st=h+1;
      res=max(res,h);
    }
    else{
      //cout << "ng..." << h << endl;
      ed=h-1;
    }
  }
  cout << res << endl;
  return 0;
}

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

int main()
{
int I , c , d;
cin >> I >> c >>d;
for (int i =1 ; i<= max(c,d);i++){
if ((I*i)<= max(c,d)&&(I*i)>= min(c,d)){
    cout <<"OK";
    return 0;}
}
cout << "NG";
    return 0;
}


Measured memory_bytes: 3028
n = int(input())
d = []
c = 0
ans = 'No'
for i in range(n):
    d1, d2 = [int(_) for _ in input().split()]
    if d1 == d2:
        c += 1
    else:
        c = 0
    if c == 3:
        ans = 'Yes'
print(ans)

Measured memory_bytes: 9176
#include<stdio.h>
int main(void){
  int a=0,b=0;
  scanf("%d %d",&a,&b);
  while(a<=1 && a>=100 && b<=1 && b>=100){
  scanf("%d %d",&a,&b);
  }
  printf("%d %d\n",a*b,((a*2)+(b*2)));
}


Measured memory_bytes: 2024
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define INPUT(x) scanf("%d",&x)
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(x,s,e) for(int x = s; x <= e; x++)
#define RREP1(x,n) for(int x = n-1; x >= 0; x--)
#define RREP2(x,s,e) for(int x = s; x >= e; x--)
#define BR printf("\n")
#define INF 2000000000

typedef long long ll;

int main(){
    int p[3];
    REP1(i,3){
        INPUT(p[i]);
    }
    int counter = 1;
    if(p[1] != p[0]) counter++;
    if(p[2] != p[0] && p[2] != p[1]) counter++;
    
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    N, K, *A = map(int, read().split())
    for i in range(N-K):
        if A[i] < A[K+i]:
            print('Yes')
        else:
            print('No')
    return

if __name__ == '__main__':
    main()


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

#define ll long long

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

    int k,x;
    cin>>k>>x;
    if(500*k>=x)
    	cout<<"Yes";
    else
    	cout<<"No";
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll n,k,res;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n>>k;
    res = (n/k) * (n/k) * (n/k);
    if (k%2==0 & n>=k/2) {
        ll tmp = (n - k/2)/k +1 ;
        res += tmp*tmp*tmp;
    }
    cout<<res<<endl;
}



Measured memory_bytes: 256
import itertools
n = int(input())
if n%2 == 0:
    print(n*(n-2)//2)
    for i,j in itertools.combinations(range(1,n+1),2):
        if i + j == n+1:continue
        print(i,j)
else:
    print(n*(n-1)//2 - n//2)
    for i,j in itertools.combinations(range(1,n+1),2):
        if i + j == n:continue
        print(i,j)


Measured memory_bytes: 3612
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int maxn = 1e5 + 5;
string s, t;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	cin >> s >> t;
	int ans = 100000, cnt;
	for(int i = 0; i + t.length() <= s.length(); ++i) {
		cnt = 0;
		for(int j = 0; j < t.length(); ++j)
			cnt += (s[i + j] != t[j]);
		ans = min(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3648
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(5, [2, 6, 1, 4, 5])
    YES
    >>> print_ans(6, [4, 1, 3, 1, 6, 2])
    NO
    >>> print_ans(2, [10000000, 10000000])
    NO
    """
    br = set(ar)
    print("YES" if len(br) == N else "NO")
    

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = list(map(int,input().rstrip().split()))
    print_ans(N, ar)




Measured memory_bytes: 34460
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

int main (void) {
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  REP(i, N)
    cin >> S[i];
  sort(ALL(S));
  REP(i, N)
    cout << S[i];
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
   int A,B,C;
   int cnt=0;
   scanf("%d %d %d",&A,&B,&C);
   if(A==B){
      cnt++;
   }
   if(B==C){
      cnt++;
   }
   if(A==C){
      cnt++;
   }
   if(cnt==1){
      printf("Yes");
   }else{
      printf("No");
   }
   return 0;
}


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

using namespace std;
int n;
int m;
int k;

#define MAX 100002



vector<long long int> V;

deque<pair<long long int,int> > mp[MAX];
int a[MAX];


int main(){
	cin >> n >> m >> k;
	for (int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	V.assign(k+1, -1);
	long long int ans = 0;
	for (int i = 0; i < n; i++){
		int mm = min(k, i + 1);
		for (int j = mm; j >=1; j--){
			while (!mp[j-1].empty() && mp[j-1].front().second < i - m){
				mp[j-1].pop_front();
			}
			long long int gt = 0;
			if(j>1)gt = mp[j-1].front().first;
			gt += (long long int)(a[i])*(long long int)(j);
			while (!mp[j].empty() && mp[j].back().first < gt){
				mp[j].pop_back();
			}
			mp[j].push_back(make_pair(gt,i));
			if (ans < gt){
				ans = gt;
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 67968