akhauriyash/Code-Regression huggingface dataset:
//Author:- Yatin Patel
//Mail:- yatinpatel.gt@gmail.com

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define FILEIN ifstream fin;fin.open("input.txt");
#define FILEOUT ofstream fout;fout.open("output.txt");

using namespace std;
using namespace __gnu_pbds;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << "  ";
    err(++it, args...);
}

#define FAST ios::sync_with_stdio(false);ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second

#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define minQueue priority_queue<ll,vector<ll>,greater<ll> >
#define maxQueue priority_queue<ll,vector<ll>,less<ll> > 

#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define RFOR(i,a,b) for(ll i=a;i>b;i--)
#define FILL(a,b) memset((a),(b),sizeof((a)))

#define MOD 1000000007
#define INF LONG_MAX
#define MINF LONG_MIN

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

ll power(ll x, unsigned ll y){
    if (y == 0)
        return 1;
    else if (y%2 == 0)
        return power(x, y/2)*power(x, y/2);
    else
        return x*power(x, y/2)*power(x, y/2);
}

//#define fin cin
//#define fout cout

int main(){

    FAST;
    ll n,k;
    cin>>n>>k;
    cout<<n-k+1;

    return 0;
}






Measured memory_bytes: 256
#include <iostream>

using namespace std;

int S(int N) {
	int s(0);
	while (N > 0) {
		s += N % 10;
		N /= 10;
	}
	return s;
}

int main() {
	int N;
	cin >> N;
	if (N % S(N) == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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();
		
		if (s.charAt(0) != 'A') {
			System.out.println("WA");
			return;
		}
		
		int cnt = 0, c = 0;
		for (int i = 2; i < s.length() - 1; i++) {
			if (s.charAt(i) == 'C') {
				cnt++;
				c = i;
			}
		}
		if (cnt != 1) {
			System.out.println("WA");
			return;
		}
		
		for (int i = 1; i < s.length(); i++) {
			if (i == c) continue;
			if ((int)s.charAt(i) <= 90) {
				System.out.println("WA");
				return;
			}
		}
		
		System.out.println("AC");
		
	}

}


Measured memory_bytes: 22612
#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int mod = 998244353;

void add (int &a, int b)
{
	a += b;
	if (a >= mod)
		a -= mod;
}
void sub (int &a, int b)
{
	a -= b;
	if (a < 0)
		a += mod;
}
int mult (int a, int b)
{
	return ll(a) * b % mod;
}

void solve(istream &cin = std::cin, ostream &cout = std::cout)
{
	int x;

	while (cin >> x)
	{
		cout << 360 / __gcd(360, x) << endl;
	}
}

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

#ifdef LOCAL
	auto st = clock();

	ifstream fin("../input.txt");
	solve(fin);

	cout << "clock: " << (clock() - st) / (double) CLOCKS_PER_SEC << endl;
#else
	solve();
#endif

	return 0;
}

Measured memory_bytes: 3652
import math
import sys
N = int(input())
temp = N
arr = []
if N == 1:
  print('0')
  sys.exit()
for i in range(2,int(-(-N**0.5//1))+1):
	if temp % i==0:
		cnt = 0
		while temp%i==0:
			cnt+=1
			temp//=i
		arr.append([i,cnt])
if temp!=1:
	arr.append([temp,1])
if arr == []:
	arr.append([n,1])
sum = 0
for i in range(len(arr)):
  p = arr[i][1]
  q = 1
  while p > 0:
    p -= q
    if p >= 0:
      sum += 1
      q += 1
print(sum)

Measured memory_bytes: 9496
N, M = map(int, input().split())
A = []
B = []
for i in range(M):
  a, b = map(int, input().split())
  if a == 1:
    A.append(b)
  if b == N:
    B.append(a)
C = list(set(A) & set(B))
ans = 'IMPOSSIBLE'
if len(C) > 0:
  ans = 'POSSIBLE'
print(ans)

Measured memory_bytes: 21828
N, M = map(int,input().split())
SWs = []
# 電球がどのスイッチに繋がっているか
from collections import defaultdict
d = defaultdict(list)
for i in range(N):
    d[i+1].append(0)


for i in range(M):
    As = list(map(int,input().split()))
    SWs.append(As[1:])
    for A in As[1:]:
        d[A].append(i+1)

# 正しい電球のON状態
ps = list(map(int,input().split()))
ans = 0

# スイッチ状態の全通り
for i in range(2**N):
    light = [0] * (M+1)
    flg = True
    x = bin(i)[2:]
    #調整
    a = "0"*(N-len(x))+x
    for i,s in enumerate(a):
        if int(s) == 0:
            for A in d[i+1]:
                light[A] += 1
    # print(a,light,ps)
    for p,l in zip(ps,light[1:]):
        if p != l%2:
            flg = False
    if flg:
        ans += 1

print(ans)

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

int main() {
  ll x,k,d;cin>>x>>k>>d;
  if (x<0) x *= -1;
  
  ll n = x / d;
  x -= d * min(k, n);
  k -= min(k, n);
  ll ans;
  if (k%2==1) ans = d - x;
  else ans = x;
  cout<<ans;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define endl '\n'
#define INF (1 << 21)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;
const int MOD = 1000000009;
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int a[200005];
  int mx = 0;
  map<int, int>cnt;
  
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> a[i];
    cnt[a[i]] ++;
    mx = max(mx, a[i]);
  }

  for(int i = 0;i < n;++i){
    cnt[a[i]]--;
    for(int j = mx;j >= 0;--j){
      if(cnt[j] != 0){
	cout << j << endl;
	break;
      }
    }
    cnt[a[i]]++;
  }

  return 0;
}


Measured memory_bytes: 10240
from statistics import mean, median,variance,stdev
import sys
import math
import fractions
def j(a):
    if a==1: print("Yes")
    else :print("No")


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

#x = ip()                              #入力整数1つ
#x,y = (int(i) for i in input().split())      #入力整数横2つ
#x,y,z = (int(i) for i in input().split())    #入力整数横3つ
#a,b,c,k = (int(i) for i in input().split())  #入力整数横4つ
a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

x = ip()
a.sort()
for i in range(x):
    a[2]*=2
print(sum(a))

Measured memory_bytes: 5144
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

const bool ready = []() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

/* Grid
 * Clock at 0,0
 * horizontal east west streets
 * vertical north south streets
 * Two initial railroads, x-axis and y-axis
 *
 * Note that points are weighted by p[i]
 * Since N is small we should be able to brute force somehow.
 *
 * Note that with n railroads ans eq 0.
 *
 * With one railroad we got basically 4
 * Building one railroad in a quadrant must be done
 * on median element (median with p[]).
 * Building secdon railroad in same quadrant...
 * ...
 * Brute force all of it.
 * All railroads should go through a position. But if a position has
 * a railroad, there is never need to build a second through it.
 *
 * So we got N positions and a horz or a vert or non railroad.
 * This is 3^n possible states.
 * Foreach one find the dist value, and update the ans for
 * number of build railroads.
 *
 * How to iterate 012? -> implement on vector
 * How to precalc the distances?
 */
const int INF=1e18;

void solve() {
    cini(n);
    vi x(n);
    vi y(n);
    vi p(n);

    for(int i=0; i<n; i++)
        cin>>x[i]>>y[i]>>p[i];

    vi ans(n+1, INF);
    ans[0]=0;
    for(int i=0; i<n; i++)
        ans[0]+=min(abs(x[i]), abs(y[i]))*p[i];

    int nobits[n+1];
    int bits[n+1];

    for(int s=0; s<(1<<n); s++) { // rails throug houses where s bit is set
        int idx0=0;
        int idx1=0;
        for(int i=0; i<n; i++) {
            if((s>>i)&1)
                bits[idx1++]=i;
            else
                nobits[idx0++]=i;
        }

        for(int t=s; true; t=(t-1)&s) {    // horz rail if t set else vert rail
            int dist=0;
            for(int ii=0; ii<idx0; ii++) {
                int i=nobits[ii];
                int d=min(abs(x[i]), abs(y[i]));
                for(int jj=0; jj<idx1; jj++) {
                    int j=bits[jj];
                    if((t>>j)&1)
                        d=min(d, abs(x[i]-x[j]));
                    else
                        d=min(d, abs(y[i]-y[j]));
                }
                dist+=d*p[i];
            }
            ans[idx1]=min(ans[idx1], dist);

            if(t==0)
                break;
        }

    }

    for(signed i=0; i<=n; i++)
        cout<<ans[i]<<endl;
}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


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

void input ();
void solve ();

const int MAXN = 3e3 + 1;

long long n, t;
std::pair <long long, long long> arr [MAXN];
long long dp [MAXN][MAXN];

long long f (long long x, long long r) {
  if (x >= n || r < 1)
    return dp [x][r] = 0;

  if (dp [x][r] != -1)
    return dp [x][r];


  return dp [x][r] = std::max (f (x + 1, r), f (x + 1, r - arr [x].first) + arr [x].second);
}

void input () {
  scanf ("%lld%lld", &n, &t);
  for (long long i = 0, a, b; i < n; i++) {
    scanf ("%lld%lld", &a, &b);
    arr [i] = std::make_pair (a, b);
  }

  memset (dp, -1, sizeof dp);

  solve ();
}

void solve () {
  std::sort (arr, arr + n);
  printf ("%lld\n", f (0, t));
}

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


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

using namespace std;

#define fi(n) for(int i=0;i<n;i++)
#define fj(n) for(int j=0;j<n;j++)
#define fr(n) for(int i=n-1;i>=0;i--)
#define fo(i,a,n) for(int i=a;i<n;i++)
#define vi vector<int>
#define vs vector<string>
#define int long long int
#define all(a) (a).begin(),(a).end()
#define sortall(x) sort(all(x))
#define itr(a) for(auto it=a.begin();it!=a.end();it++)
#define pb push_back
#define setbits(x) __builtin_popcountll(x)
#define zerbits(x) __builtinctzll(x)
#define mod 1000000007
#define sz(x) (int)x.size()
#define inf 1e18
#define W(x) int x;cin>>x;while(x--)
#define ps(x,y) fixed<<setprecision(y)<<x
#define mp make_pair
#define INT_SIZE 32
#define pr pair<int,int>
#define deb(x) cout<<#x<<"="<<x<<endl;
#define F first
#define S second
#define pii pair<int,int>

int mpow(int exp, int base);
void aeh()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("aana.txt", "r", stdin);
	freopen("jj.txt", "w", stdout);
#endif
}
int32_t main()
{
	//aeh();
	string s, t;
	cin >> s >> t;
	int n = s.size();
	int m = t.size();
	int a[n + 1][m + 1];
	fi(n + 1)
	{
		fj(m + 1)
		a[i][j] = 0;
	}
	vector<char>p;
	int ind = m + 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			a[i][j] = (s[i - 1] == t[j - 1]) ? (a[i - 1][j - 1] + 1) : max(a[i - 1][j], a[i][j - 1]);
			// cout << a[i][j] << " ";
		}
		// cout << endl;
	}
	int i = n, j = m;
	while (i > 0 && j > 0)
	{
		if (s[i - 1] == t[j - 1])
		{
			// cout << i << " " << j << endl;
			p.pb(s[i - 1]);
			i--;
			j--;
		}
		else if (a[i - 1][j] > a[i][j - 1])
			i--;
		else
			j--;
	}
	reverse(all(p));
	for (int i = 0; i < p.size(); i++)
		cout << p[i];
	// cout << p << endl;
	// reverse(all(p));
	// cout << a[n][m] << endl;
}


int mpow(int base, int exp)
{
	base %= mod;
	int result = 1;
	while (exp > 0)
	{
		if (exp & 1)result = (result * base) % mod;
		base = (base * base) % mod;
		exp >>= 1;
	}
	return result;
}

Measured memory_bytes: 70656
#pragma gcc optimize (o3)
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define S second
#define F first
#define ll long long
#define ld long double
#define U unsigned
#define pi acos(-1)

using namespace std;

const ll N = 1e3+5, mod = 1e9+7;

vector<vector<int> > v(N);
ll dp[N][N], n, m;
char x[N][N];

ll solveI()
{
    dp[n-1][m-1] = 1;
    for(int i = n-1 ; i >= 0 ; i--)
    {
        for(int j = m-1 ; j >= 0 ; j--)
        {
            if(x[i][j] == '#') continue;
            dp[i][j] += (dp[i+1][j] + dp[i][j+1])%mod;
        }
    }
    return dp[0][0];
}

int main()
{
    scanf("%d%d", &n, &m);
    for(int i = 0 ; i < n ; i++)
    {
        scanf("%s", x[i]);
    }
    printf("%lld", solveI());
    return 0;
}


Measured memory_bytes: 9088
S = input()

if S[0]!='A':
  print('WA')
  exit()
else:
  S_withoutA = S.replace('A','')

S_part = [i for i in S[2:-1] if i=='C']
if len(S_part) != 1:
  print('WA')
  exit()
else:
  S_withoutAC = S_withoutA.replace('C','')

if S_withoutAC.islower():
  print('AC')
else:
  print('WA')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

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

	vector<int> x(n), y(n), h(n);
	int p = -1;
	rep(i,n){
		cin >> x[i] >> y[i] >> h[i];
		if(h[i] != 0) p = i;
	}
	assert(p != -1);

	range(cx,0,101){
		range(cy,0,101){
			int high = h[p] + abs(x[p] - cx) + abs(y[p] - cy);

			auto f = [&](){
				rep(i,n){
					if(max(high - abs(x[i] - cx) - abs(y[i] - cy), 0) != h[i]){
						return false;
					}
				}
				return true;
			};
			if(f()){
				cout << cx << ' ' << cy << ' ' << high << endl;
				return 0;
			}
		}
	}
	assert(false);
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    string s;
    cin >> N >> s;
    int r = 0;
    int b = 0;
    for(int i = 0; i < N; i++) {
        if(s[i] == 'R') r++;
        else b++;
    }
    if(r > b) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp> 
//using namespace __gnu_pbds; 
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
typedef long long ll;
typedef long double ld;
#define trace(x)  cerr << #x << ": " << x << endl;
#define rep(i,a)  for(ll i=0; i< a; i++)
#define pb push_back
#define vl vector<ll>
template<typename ForwardIterator, typename T>
ForwardIterator first_less_than (ForwardIterator first, ForwardIterator last, T value) {
auto it = std::upper_bound (first, last, value);
return (it == first ? last : --it);
}
ll bb;
ll modify(ll x)
{
	return ((x%bb)+bb)%bb;
}
const ll N=1e5+5;
int main()
{
	fast;ll t;t=1;
	while(t--)
	{
		ll x;cin>>x;cout<<10-(x/200);

	}
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
int main() {
	// your code goes here
	ll n;
	cin>>n;
	ll a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	ll k=0;
	for(int i=0;i<n;i++){
		if(a[i]!=i+1){
			k++;
		}
	}
	if(k<=2){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,q;

vector<int> a,b,c,d,A;
int saiki(int k,int l,int p,vector<int> A);
  
int main(){
  int as;
  //cerr << "test";
  cin >>n >>m >>q;
  for(int i=0;i<q;i++){
    int e,f,g,h;
    cin >> e >> f >>g >>h;
    a.push_back(e);
    b.push_back(f);
    c.push_back(g);
    d.push_back(h);
  }
  //cerr << "test";
  as=saiki(n,m,q,A);
  cout <<as <<endl;
}
int saiki(int k,int l,int p,vector<int> A){
  int ans=0;
  vector<int> B=A;
  //cerr << k << l   << p  <<endl;
  if(k!=0){
  	for(int i=1;i<=l;i++){
      B.push_back(i);
      ans=max(ans,saiki(k-1,i,p,B));
      B.pop_back();
  	}
 	return ans;
  } 
  else{
  	for(int i=0;i<p;i++){
      //for(int j=0;j<A.size();j++)cerr << A[j];
      //cerr << endl;
    	if(A.at(A.size()-b.at(i))-A.at(A.size()-a.at(i))==c.at(i))ans+=d.at(i);
  	}
 	return ans;
  } 
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int H,N;
    cin >> H >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    
    for(int i = 0; i < N; i++){
        H -= A[i];
        if(H <= 0){
            break;
        }
    }
    if(H > 0){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define int long long int
#define pb push_back


using namespace std;
const int mx=1e5+1;
vector<int>v[mx];
vector<bool>vis(mx);
vector<int>dis(mx);
int maxn;
void dfs(int node)
{
    vis[node]=1;
    for(auto child:v[node])
    {
        if(!vis[child])
        {
            dfs(child);
        }
        dis[node]=max(dis[node],dis[child]+1);
        maxn=max(maxn,dis[node]);
    }

}


signed main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        v[a].pb(b);

    }
    for(int i=1;i<=n;i++)
    {
        if(!vis[i])
            dfs(i);
    }
    cout<<maxn<<"\n";


    return 0;
}


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

using namespace std;
using ll = long long;
const long long INF = 1LL<<60;

typedef pair<ll,ll> Pair;
int main(){

ll N,Q;
ll sum = 0;

cin >> N;

ll A;
vector<ll> cnt(100001,0);

for(ll i = 0;i < N;++i){
    cin >> A;
    sum += A;
    ++cnt[A];
}

cin >> Q;

ll B,C;
vector<ll> S(Q,0);

for(ll i = 0;i < Q;++i){

    cin >> B >> C;

    sum += (C - B)*cnt[B];
    cnt[C] += cnt[B];
    cnt[B] = 0;
    
    S[i] = sum;

}

for(ll i = 0;i < Q;++i) cout << S[i] << endl;

return 0;

}


Measured memory_bytes: 4820
#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 MOD = 998244353;

long long modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

const int MAX = 200001;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

    COMinit();
    ll ans = 0;
    for (int i = 0; i <= K; ++i) {
        ans = (ans + modpow(M - 1, i) % MOD * COM(N - 1, K - i) % MOD) % MOD;
    }
    ans = ans * M % MOD * modpow(M - 1, N - 1 - K) % MOD;
    cout << ans << endl;
}

Measured memory_bytes: 8296
#include <bits/stdc++.h>
#define s second
#define f first
#define pb push_back
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

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

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

int main(){ _

	string S;
	cin >> S;

	for(auto &i : S){
		if(i == ',') i = ' ';
	}

	cout << S << endl;

	return 0;
}
	


Measured memory_bytes: 3640
n = int(input())+1
a = list(map(int, input().split()))

b = [0]*n
c = [0]*n

now = 1
for i in range(n):
    b[i] = now
    now -= a[i]
    if now < 0:
        print(-1)
        exit()

    if now == 0 and i != n-1:
        print(-1)
        exit()
    now *= 2

a = list(reversed(a))
c[0] = a[0]
now = a[0]
for i in range(1, n):
    now += a[i]
    c[i] = now

c = list(reversed(c))

ans = 0
for i in range(n):
    ans += min(b[i], c[i])

print(ans)


Measured memory_bytes: 681520
#include <bits/stdc++.h>
 
using namespace std;
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define ll long long
#define ld long double
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<ll>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define sz(a) ll(a.size())

#define pb push_back
#define mp make_pair
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
ll INF = 1e6;

void solve()
{
    ll k;
    cin>>k;
    ll num=7;
    rep(i, 1, k+1)
    {
        if(num%k==0){
            cout<<i;
            exit(0);
        }
        num=(num*10+7)%k;
    }
    cout<<-1;
    
}

 
int main()
{
    SPEED;
    ll t = 1;
    //cin>>t;
    while(t--) solve();
    return 0;
}



Measured memory_bytes: 3608
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int ans = s.length();
		for (int i = 0; i < s.length(); ++i) {
			char[] ns = s.toCharArray();
			for (int t = 0; t < s.length(); ++t) {
				boolean f = true;
				for (int j = 0; j < s.length() - t - 1; ++j) {
					if (j + 1 < s.length() - t && ns[j + 1] == s.charAt(i)) {
						ns[j] = s.charAt(i);
					}
					f &= s.charAt(i) == ns[j];
				}
				if (f) {
					ans = Math.min(ans, t + 1);
				}
			}
		}
		boolean f = true;
		for (int i = 0; i + 1 < s.length(); ++i) {
			f &= s.charAt(i) == s.charAt(i + 1);
		}
		if (f)
			ans = 0;
		System.out.println(ans);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


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

vector<vector<char>> chess(8, vector<char>(8, '.'));

bool judge(int x, int y){//ななめにQがあるかないか
    int cnt = min(7-x, 7-y);
    for(int i = 1; i <= cnt; i++){
        if(chess[x+i][y+i] == 'Q'){
            return false;
        }
    }
    cnt = min(7-x, y);
    for(int i = 1; i <= cnt; i++){
        if(chess[x+i][y-i] == 'Q'){
            return false;
        }
    }
    cnt = min(x, y);
    for(int i = 1; i <= cnt; i++){
        if(chess[x-i][y-i] == 'Q'){
            return false;
        }
    }
    cnt = min(x, 7-y);
    for(int i = 1; i <= cnt; i++){
        if(chess[x-i][y+i] == 'Q'){
            return false;
        }
    }
    return true;
}

int main(){
    int k;
    cin >> k;
    vector<int> q_x(8, 0);//Qの縦座標
    vector<int> q_y(8, 0);//Qの横座標
    for(int i = 0; i < k; i++){
        int x, y;
        cin >> x >> y;
        q_x[x] = 1;
        q_y[y] = 1;
        chess[x][y] = 'Q';
    }
    vector<int> order;//自分で決める縦座標
    vector<int> y;//自分で決める横座標
    for(int i = 0; i < 8; i++){
        if(q_x[i] == 0){
            order.push_back(i);
        }
        if(q_y[i] == 0){
            y.push_back(i);
        }
    }

    vector<vector<char>> copy(8, vector<char>(8));   
    for(int i = 0; i < 8; i++){
        for(int j = 0; j < 8; j++){
            copy[i][j] = chess[i][j];
        }
    } 
    if(k == 8){
        for(int i = 0;  i < 8; i++){
            for(int j = 0; j < 8; j++){
                cout << chess[i][j];
            }
            cout << endl;
        }
    }
    else{
        do{
            bool flag = false;
            for(int i = 0; i < 8; i++){
                for(int j = 0; j < 8; j++){
                    chess[i][j] = copy[i][j];
                }
            }
    
            for(int i = 0; i < 8-k; i++){
                int chess_x = order[i];
                int chess_y = y[i];
                if(!judge(chess_x, chess_y)){
                    break;
                }
                else{
                    chess[chess_x][chess_y] = 'Q';
                }
                if(i == 7-k){
                    flag = true;
                }
            }
            if(flag){
                for(int i = 0; i < 8; i++){
                    for(int j = 0; j < 8; j++){
                        cout << chess[i][j];
                    }
                    cout << endl;
                }
            }
        } while(next_permutation(order.begin(), order.end()));
    }
}


Measured memory_bytes: 3156
#include <stdio.h>

int main(void)
{
    char S[50];
    int N, K;
    
    scanf("%d %d", &N, &K);
    scanf("%s", S);
    
    S[K - 1] = S[K - 1] + 32;
    
    printf("%s\n", S);
    
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>
#include <map>
#include <set>
#include <stack>
#include <deque>

#define INF 1000000000;
#define MOD 1000000007;
#define LIMIT 1000000000000000000;
typedef long long ll;
using namespace std;

int main()
{
    string s; cin >> s;
    s[3] = '8';
    cout << s << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int a, b,i,j;
	scanf("%d %d", &a, &b);
	for (i = 0,j=0; i < 2; i++) {
		if (a <= b) {
			j = j + b;
			b = b - 1;
		}
		else if (b < a) {
			j = j + a;
			a = a - 1;
		}
	}
	printf("%d", j);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include  <vector>
using namespace std;
#define INF 0x3f3f3f3f
const int N = 501;
int mod = 1e9 + 7;
typedef long long ll;
int rec[N];
int main()  
{
  //  freopen("in.txt", "r", stdin); 
    int n;
    while (~scanf("%d", &n))
    {
        int ans = 0;
        for (int i = 0; i < n; i++)
        {
            scanf("%d", rec + i);
            if (i)
            {
                if (rec[i] == rec[i-1])
                {
                    ans++;
                    rec[i] = 0;
                }
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt();
        long m = sc.nextInt();

        sc.close();

        long ans = Math.abs((n - 2) * (m - 2));

        System.out.println(ans);
    }
}

Measured memory_bytes: 21972
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;
    vector<char> a(26, 0);
    for (int i = 0; i < s.size(); i++)
    {
        int b = s[i] - 'a';
        if(a[b]==1){
            cout << "no" << endl;
            return 0;
        }
        a[b]=1;
    }
    cout << "yes" << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = pow(10,9)+7;

int main(){
    ll n,k; cin >> n >> k; 

    vector<ll> smallest(n+2); //要素数KはK個選ぶ時の最小値
    for(int i=1; i<=n+1; i++){
        smallest[i] = smallest[i-1] + (i-1);
    }

    vector<ll> biggest(n+2); //要素数KはK個選ぶ時の最大値
    for(int i=1; i<=n+1; i++){
        biggest[i] = biggest[i-1] + (n - (i-1));
    }

    ll ans = 0;
    for(int i=k; i<=n+1; i++){
        ans += biggest[i] - smallest[i] + 1;
    }

    ans %= MOD;

    cout << ans << endl;
}

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

int main() {
  int a, b, c, d, e, f;
  int i1, i2, i3, i4;
  cin >> a >> b >> c >> d >> e >> f;
  a *= 100;
  b *= 100;
  // 砂糖水の質量
  int all = a;
  // 砂糖の質量
  int sug = 0;
  for (i1 = 0; i1 <= 100; i1++)
    for (i2 = 0; i2 <= 100; i2++)
      for (i3 = 0; i3 <= 100; i3++)
        for (i4 = 0; i4 <= 100; i4++) {
          // 水
          int tot_wat = i1 * a + i2 * b;
          // 砂糖
          int tot_sug = i3 * c + i4 * d;
          // ビーカーに入るかどうか
          if (tot_wat + tot_sug <= f) {
            // 砂糖が解けているかどうか
            if (tot_sug * 100 <= tot_wat * e) {
              // 濃度が高ければ更新する
              if (sug * (tot_sug + tot_wat) <= all * tot_sug) {
                sug = tot_sug;
                all = tot_wat + tot_sug;
              }
            }
          }
        }
  cout << all << " " << sug << endl;
}


Measured memory_bytes: 256
import itertools
N, M, Q = map(int, input().split())
Qs = [list(map(int, input().split())) for _ in range(Q)]

_max = 0
for A in itertools.combinations_with_replacement(range(1, M+1), N):
    score = sum([q[3] for q in Qs if A[q[1] - 1] - A[q[0] - 1] == q[2]])
    _max = score if _max < score else _max
print(_max)

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

int main() {
    int a, b; cin >> a >> b;
    string ans = "";
    if (a <= 0 && 0 <= b) {
        ans = "Zero";
    } else if (a > 0) {
        ans = "Positive";
    } else {
        int len = b - a + 1;
        if (len % 2 == 0) ans = "Positive";
        else ans = "Negative";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main {
  public static void main(String[] args) throws Exception{
    FastScanner sc = new FastScanner(System.in);
    int r = sc.nextInt();
    new Solution(r);
  }
}

class Solution {
  public Solution(int r) {
    System.out.println(r * 2 * Math.PI);
    // System.out.println(res);
  }
}

class FastScanner {
  private final InputStream in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;

  public FastScanner(InputStream source) {
    in = source;
  }

  private boolean hasNextByte() {
    if (ptr < buflen) {
      return true;
    } else {
      ptr = 0;
      try {
        buflen = in.read(buffer);
      } catch (IOException e) {
        e.printStackTrace();
      }
      if (buflen <= 0) {
        return false;
      }
    }
    return true;
  }

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

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

  public boolean hasNext() {
    while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
    return hasNextByte();
  }

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

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

  public int nextInt() {
    long nl = nextLong();
    if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
      throw new NumberFormatException();
    return (int) nl;
  }

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

Measured memory_bytes: 32952
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll n;
  cin >> n;
  map<ll, ll> mp;
  REP(i, n){
    ll a;
    cin >> a;
    mp[a]++;
  }
  ll ans = 0;
  for(auto p : mp){
    ans += p.second % 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6528
io = STDIN
s=io.gets.chomp
$ar= %w(dreamer dream eraser erase)
def check(s)
  while true
    return false if $ar.none?{|st|s.end_with?(st)}
    $ar.each do |st|
      if s.end_with?(st)
        s = s[0..-(st.size+1)]
        return true if s.size==0
      end
    end
  end
end
puts check(s) ? "YES" : "NO"

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

int main(){

	  while(1){
			int m,nmin,nmax;
			cin >> m >> nmin >> nmax;
			if(!m) break;

			vector<int> p(m);
			for(int i=0; i<m; i++) cin >> p[i];

			int gap = 0,ans = 0;
			for(int i=nmin-1; i<nmax; i++){
				  if( gap <= p[i]-p[i+1] ) {
						gap = p[i] - p[i+1];
						ans = i;
				  }
			}
			cout << ans+1 << endl;
				  
			
			
			
	  }
}

Measured memory_bytes: 1196
#include<stdio.h>
#include<string.h>

int main(){
	
	int i, sum=0;
	char number[1000];
	
	while(1){
		scanf("%s",number);
		
		if(number[0]=='0')break;
		
		for(i=0;number[i]!='\0';i++){
			sum+=(number[i]-'0');
		}
		
		printf("%d\n",sum);
		sum=0;
	}
	return 0;
}

Measured memory_bytes: 536
#include<bits/stdc++.h>
using namespace std;
#define ms(x,y) memset(x, y, sizeof(x))
#define lowbit(x) ((x)&(-x))
#define sqr(x) ((x)*(x))
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;


void run_case() {
    int n, m;
    cin >> n >> m;
    vector<int> h(n+1);
    vector<set<int>> siz(n+1, set<int>()), valid(n+1, set<int>());
    for(int i = 1; i <= n; ++i) cin >> h[i];
    for(int i = 1; i <= m; ++i) {
        int a, b;
        cin >> a >> b;
        siz[a].insert(b);
        siz[b].insert(a);
        if(h[a] > h[b]) valid[a].insert(b);
        else if(h[a] < h[b])valid[b].insert(a);
    }
    int ans = 0;
    for(int i = 1; i <= n; ++i) {
        if(siz[i].size() == valid[i].size()) ans++;
    }
    cout << ans;
}


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    cout.flags(ios::fixed);cout.precision(9);
    //int t; cin >> t;
    //while(t--)
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 26964
#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main(){
  int a[3];
  for(int i=0;i<3;i++) cin >> a[i];
  sort(a,a+3);
  int sum=0;
  for(int i=0;i<2;i++){
      sum+=abs(a[i+1]-a[i]);
  }
  cout << sum<<endl;
}


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;

int main() {
    int N, p, c = 0;
    cin >> N;
    rep(i, N) {
        cin >> p;
        if (p != i + 1) c++;
    }
    if (c < 3) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int>G[100010];
struct node{
	int p,y;
}ques[100010];
int main(){
	int n,m,i;scanf("%d%d",&n,&m);
	for(i=1;i<=m;i++){
		int p,y;scanf("%d%d",&p,&y);
		G[p].push_back(y);
		ques[i]=(node){p,y};
	}
	for(i=1;i<=n;i++)sort(G[i].begin(),G[i].end());
	for(i=1;i<=m;i++){
		int p=ques[i].p,y=ques[i].y;
		int k=lower_bound(G[p].begin(),G[p].end(),y)-G[p].begin()+1;
		if(p/100000==0)printf("0");
		else printf("%d",p/100000);
		if(p/10000-p/100000*10==0)printf("0");
		else printf("%d",p/10000-p/100000*10);
		if(p/1000-p/10000*10==0)printf("0");
		else printf("%d",p/1000-p/10000*10);
		if(p/100-p/1000*10==0)printf("0");
		else printf("%d",p/100-p/1000*10);
		if(p/10-p/100*10==0)printf("0");
		else printf("%d",p/10-p/100*10);
		if(p-p/10*10==0)printf("0");
		else printf("%d",p-p/10*10);
		p=k;
		if(p/100000==0)printf("0");
		else printf("%d",p/100000);
		if(p/10000-p/100000*10==0)printf("0");
		else printf("%d",p/10000-p/100000*10);
		if(p/1000-p/10000*10==0)printf("0");
		else printf("%d",p/1000-p/10000*10);
		if(p/100-p/1000*10==0)printf("0");
		else printf("%d",p/100-p/1000*10);
		if(p/10-p/100*10==0)printf("0");
		else printf("%d",p/10-p/100*10);
		if(p-p/10*10==0)printf("0");
		else printf("%d",p-p/10*10);
		puts("");
	}
	return 0;
}


Measured memory_bytes: 7808
#include <bits/stdc++.h>
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define ll long long int
#define ld long double
#define el '\n'
#define PI (ld)3.14159265358979323846
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < int(n); i++)
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

/*vector<int> parent, rak;

int find_set(int v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}

void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (rak[a] < rak[b])
            swap(a, b);
        parent[b] = a;
        rank[a]+=rank[b];
    }
}*/

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}
ll extend_gcd(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1,y1;
    ll ans =extend_gcd(b,a%b,x1,y1);
    x=y1;
    y=x1-(a/b)*y1;

    return ans;
}
ll inverse(ll a,ll m){
    ll x,y;
    extend_gcd(m,a,x,y);
    y%=m;
    y+=m;
    y%=m;
    return y;
}

/*const int N = 1000001;
int lp[N+1];
vector<int> pr;
void s(){
for (int i=2; i<=N; ++i) {
        if (lp[i] == 0) {
            lp[i] = i;
            pr.push_back (i);
        }
        for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
            lp[i * pr[j]] = pr[j];
    }
}*/


ll kv;
ll t,n,x,y,h,k,z,p,q,w;

//vector<vector<ll>>v;
//vector<ll>vis,d;

ll sg(ll f){
    if(f<0)return 0;
    if(f%4==0)return f;
    else if(f%4==1)return 1;
    else if(f%4==2)return f+1;
    return 0;
}

int main() {
    IOS;
    cin>>x>>y;
    cout<<(sg(y)^sg(x-1));
    return 0;
}

Measured memory_bytes: 256
#pragma comment(linker, "/STACK:102400000,102400000")
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <sstream>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define lson root<<1,l,mid
#define rson root<<1|1,mid+1,r
#define Key_Value ch[ch[root][1]][0]
#define DBN1(a)           cerr<<#a<<"="<<(a)<<"\n"
#define DBN2(a,b)         cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBN3(a,b,c)       cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define DBN4(a,b,c,d)     cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e)   cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN6(a,b,c,d,e,f) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<", "<<#f<<"="<<(f)<<"\n"
#define clr(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
const int maxn=500000+5;
const int INF=0x3f3f3f3f;
const int P=1000000007;
const double PI=acos(-1.0);
template<typename T>
inline T read(T&x){
    x=0;int _f=0;char ch=getchar();
    while(ch<'0'||ch>'9')_f|=(ch=='-'),ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x=_f?-x:x;
}
string s;
int main(){
    cin>>s;
    int len=s.length();
    s=s.substr(0,len-8);
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin >> a >>b;
  if (a>9 | b>9){
    cout << -1 << endl;
  }else{
    cout << a*b << endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] t = new int[n];
        int[] x = new int[n];
        int[] y = new int[n];
        for (int i = 0; i < n; i++) {
            t[i] = sc.nextInt();
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }
        int tt = 0;
        int xx = 0;
        int yy = 0;
        for (int i = 0; i < n; i++) {
            int tmpT = t[i] - tt;
            int tmpX = Math.abs(x[i] - xx);
            int tmpY = Math.abs(y[i] - yy);
            if(tmpX + tmpY > tmpT) {
                System.out.println("No");
                return;
            }
            if(tmpT % 2 != (tmpX + tmpY) % 2) {
                System.out.println("No");
                return;
            }
            tt = t[i];
            xx = x[i];
            yy = y[i];
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 60344
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	ll a, b, c;
	cin >> a >> b;
	c = a * b;
	cout << (c % 2 ? "Odd" : "Even") << endl;
	return 0;
}


Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'


void solve(){ 
  unsigned ll n;
  cin >> n;
  if (n % 2) cout << 0;
  else {
    unsigned ll x = 10;
    unsigned ll ans = 0;
    while (x <= n){
      ans += n / x;
      x *= 5;
    }
    cout << ans << endl;
  }
}

int main() {
  ios::sync_with_stdio(false);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 

1000

1 

def f(n):
  if n // 10 == 0:
      return 1
  else:
      return n // 10 * f(n//10)

*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int compare(const void *a, const void *b)
{
    return *(int *)b - *(int *)a;
}
int hoge(int x){
  if(x%10!=0){
    x = x+(10-x%10);
  }
  return x;
}
int main(){
  int a,b,c,d,e,ans,y;
  int A,B,C,D,E;
  cin>>a>>b>>c>>d>>e;
  ans = hoge(a)+hoge(b)+hoge(c)+hoge(d)+hoge(e);
  A=a%10;
  B=b%10;
  C=c%10;
  D=d%10;
  E=e%10;
  int l[5]={A,B,C,D,E};
  //int count=0;
  int add =0;
  qsort(l,5,4,compare);
  for(int i=4;i>=0;--i){
    if(l[i]!=0){
      add = l[i]-10;
      break;
    }
  }
  cout<<ans+add;
  return 0;
}


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

int main()
{
    int n;
    cin >> n;
    int s[101];
    int m = 99999;
    int ans = 0;
    for(int i = 0; i < n; i++){
        cin >> s[i];
        ans += s[i];
        if(s[i] % 10){
            m = min(m, s[i]);
        }
    }
    if(ans % 10){
        cout << ans << endl;
    }
    else{
        if(m == 99999){
            cout << 0 << endl;
        }
        else{
            cout << ans - m << endl;
        }
    }
}

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 MAX = 1000;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L
//setprecision(15)

int main() {
	ll N, A, B; cin >> N >> A >> B;
	ll tmp = N / (A+B);
	ll tmp2 = N % (A+B);
	tmp = tmp * A;
	if (tmp2 <= A) {
		tmp += tmp2;
	} else {
		tmp += A;
	}
	cout << tmp << endl;
}

Measured memory_bytes: 3648