akhauriyash/Code-Regression huggingface dataset:
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

// const ll MAX_N = 1e5;
// ll N;
// ll h[MAX_N];
// ll dp[MAX_N+1]; // メモ化テーブル
 
// // i番目以降の品物から重さの総和がj以下になるように選ぶ
// void rec(ll i){
// 	if (i==0) dp[i] = 0;
// 	else if (i==1) dp[i] = abs(h[1]-h[0]);
// 	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
// 	return;
// }
 
 
int main() {
	// 入力
	ll N;
	cin >> N;
	pair<string, P> PS[N];
	for (ll i = 0; i < N; ++i){
		string s; ll p;cin>>s>>p;
		PS[i] = make_pair(s, make_pair(-p,i));
	}
 
	// 解法
	sort(PS,PS+N);
	REP(i,N){
		cout<<PS[i].second.second+1<<endl;
		// printf("%s %ll", PS[i].first, PS[i].second);
	}
}


Measured memory_bytes: 256
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define ull unsigned long long
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
int INF = 1001001001;
const int MOD=1e9+7;
int main(void)
{
	int h,m,h2,m2,k;
	in h>>m>>h2>>m2>>k;
	int oki = h*60+m;
	int ne = h2*60+m2;



	cout<<ne-oki-k<<endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define PI 3.1415926535897932384
using namespace std;

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


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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

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

    int L = s.size();
    if(L <= k)
        cout << s << '\n';
    else
        cout << s.substr(0, k) << "..." << '\n';
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
    #include <cmath>
    using namespace std;
     
    int main() {
    	int q;cin>>q;
    	long long a[q],b[q];
    //	long long a,b;
    //	for(int i = 1; i <= q; i++)
    //	{
    //		cin >> a >> b;
    //		long long ans;
    //		long long pr = a * b;
    //		long long t = sqrt(pr);
    //		if(t * (t + 1) < pr)
    //			ans = t * 2 - 1;
    //		else if(t * t == pr)
    //		{
    //			if(a == b)
    //				ans = (t - 1) * 2;
    //			else
    //				ans = (t - 1) * 2 - 1;
    //		}
    //		else
    //			ans = (t - 1) * 2;
    //		cout << ans << endl;
    //	}
    	for(int i=0;i<q;i++){
    		cin>>a[i]>>b[i];
    	}
     
    	for(int i=0;i<q;i++){
    		long long ans=0;
    		long long s=a[i]*b[i];
    		long long max=b[i];
    		long long min=a[i];
    		if(a[i]>b[i]){
    			max=a[i];
    			min=b[i];
    		}
    		ans=2*(min-1);
    		long long k=sqrt(s);
    		if(k*(k+1)<s){
    			ans=2*k-1;
    		}else if(k*k==s){
    			if(min==max){
    				ans=2*k-2;
    			}else{
    				ans=2*k-3;
    			}
    		}else{
    			ans=2*k-2;
    		}
    //		if(k*k==s){
    //			ans=2*(k-1)-1;
    //		}else{
    //			if(k*(k+1)<s){
    //				ans=2*k-1;
    //			}else{
    //				ans=2*k-2;
    //			}
    //		}
    //		if(k==min){
    //			ans=2*(min-1);
    //		}
    		cout<<ans<<endl;
     
    	}
    	return 0;
    }

Measured memory_bytes: 256
s = input()

ans = 1
temp0 = s[0]
i = 1
while i < len(s):
    temp1 = s[i]
    while temp0 == temp1:
        i += 1
        if i >= len(s):
            ans -= 1
            break
        temp1 = temp1 + s[i]
    ans += 1 
    i += 1  
    temp0 = temp1 

print(ans)


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

int main(){
  int n;
  cin>>n;
  vector<int> p(n),q(n);
  for(int i=0;i<n;i++) cin>>p[i];
  for(int i=0;i<n;i++) cin>>q[i];
  vector<int> a(n);
  for(int i=0;i<n;i++) a[i]=i+1;
  map<vector<int>,int> mp;
  do{
    mp[a]=mp.size();
  }while(next_permutation(a.begin(),a.end()));
  cout<<abs(mp[p]-mp[q])<<endl;
}

Measured memory_bytes: 5376
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  vector<vector<ll>> open(n,vector<ll>(10));
  for(int i = 0;i < n;i++){
    for(int j = 0;j < 10;j++){
      cin >> open[i][j];
    }
  }
  vector<vector<ll>> benefit(n,vector<ll>(11));
  for(int i = 0;i < n;i++){
    for(int j = 0;j < 11;j++){
      cin >> benefit[i][j];
    }
  }
  ll res = 0;
  res = INT_MIN;
  for(int i = 0;i < (1<<10);i++){
    ll now = 0;
    vector<ll> count(n);
    for(int j = 0;j < n;j++)count[j] = 0;
    bool any = false;
    for(int j = 0;j < 10;j++){
      if(i & (1<<j)){
        any = true;
        for(int k = 0;k < n;k++){
          if(open[k][j] == 1)count[k]++;
        }
      }
    }
    for(int j = 0;j < n;j++)now += benefit[j][count[j]];
    if(any)res = max(res,now);
    //cout << now << " " << i << endl;
  }
  cout << res << endl;
  return 0;
}

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

int main(void) {
    ll n,m,d;
    cin >> n >> m >> d;
    ll a;
    if(d == 0) {
        a = n*(m-1);
    } else {
        a = 2*(n-d)*(m-1);
    }
    ll b = n*n;
    double res = (double)((double)(a)/(double)(b));
    printf("%.10f\n",res);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define repl(i, a, b) for (ll i = a; i < (b); ++i)
#define repd(i, a, b) for (int i = b; i >= (a); --i)
#define repdl(i, a, b) for (ll i = b; i >= (a); --i)
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const ll MOD = 1'000'000'007LL;
ll bpow(ll b, ll p, ll m = 1000000007LL) {
  ll rt = 1;
  for (; p; p >>= 1, b = b * b % m)
    if (p & 1)
      rt = rt * b % m;
  return rt;
}
int a[1000005];
int sieve[1000005];
int cnt[1000005];
void fact(int x) {
  if (x == 1)
    return;
  while (x != 1) {
    int tmp = sieve[x];
    cnt[tmp]++;
    while (x % tmp == 0)
      x /= tmp;
  }
}
bool check(int x) {
  if (x == 1)
    return true;
  while (x != 1) {
    int tmp = sieve[x];
    if (cnt[tmp] > 1)
      return false;
    while (x % tmp == 0)
      x /= tmp;
  }
  return true;
}
int main() {
  IOS;
  int n;
  cin >> n;
  for (int i = 1; i < 1000005; i++)
    sieve[i] = i;
  for (int i = 2; i < 1000005; i += 2)
    sieve[i] = 2;
  for (int i = 3; i < 1000005; i++) {
    if (sieve[i] == i) {
      for (ll j = 1LL * i * i; j < 1000005; j += i) {
        sieve[j] = i;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cin >> a[i];
  int g = 0;
  for (int i = 1; i <= n; i++) {
    g = __gcd(g, a[i]);
    fact(a[i]);
  }
  int ok = 1;
  for (int i = 1; i <= n; i++) {
    if (!check(a[i]))
      ok = 0;
  }
  if (ok) {
    cout << "pairwise coprime" << endl;
  } else if (g == 1) {
    cout << "setwise coprime" << endl;
  } else {
    cout << "not coprime" << endl;
  }
}


Measured memory_bytes: 15224
import java.io.*;
import java.util.*;
public class Main{
	public static void main(String args[]) throws IOException{
               BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));	
			char[] c = reader.readLine().toCharArray();
			if(Character.isLowerCase(c[0])) System.out.println("a");
			else System.out.println("A");		
	}
}


Measured memory_bytes: 32640
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#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>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
const int dx[8] = { -1,0,1,-1,1,-1,0,1 };
const int dy[8] = { 1,1,1,0,0,-1,-1,-1 };


//LOVE NyantakoGG	https://www.youtube.com/channel/UC6XdFs8T6Ei54O0FYl3PVVA


using namespace std;

long long gcd(long long a, long long b) {
	if (a < b) {
		swap(a, b);
	}
	long long r = -1;
	while (r != 0) {
		r = a % b;
		if (r == 0) {
			return b;
		}
		else {
			a = b;
			b = r;
		}
	}
}

long long lcm(long long a, long long b) {
	return a / gcd(a, b) * b;
}

int main() {
	long long A, B, C, D, CD, ans;
	cin >> A >> B >> C >> D;
	CD = lcm(C, D);
	ans = (B - A) + 1;
	ans -= B / C - (A - 1) / C;
	ans -= B / D - (A - 1) / D;
	ans += B / CD - (A - 1) / CD;
	cout << ans << endl;
}


Measured memory_bytes: 256
import sys
# sys.stdin = open('input.txt')

n, m = map(int, input().split())
a = list(map(int, input().split()))

tot = sum(a)
th = tot / (4 * m)
cnt = 0

for i in a:
    if i >= th:
        cnt += 1

if cnt >= m:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(){
  char c;
  cin >> c;
  if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o')  cout << "vowel" << endl;
  else  cout << "consonant" << endl;

  return 0;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code

int main(int argc, char const* argv[])
{
	int n,k;
	cin >> n >> k;
	VL h(n);
	cin >> h;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (h[i] >= k) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
N = int(input())
Ans = [0] * 4

for i in range(1,N+1):
  st = str(input())
  if st == 'AC':
    Ans[0] += 1
  elif st == 'WA':
    Ans[1] += 1
  elif st == 'TLE':
    Ans[2] += 1
  elif st == 'RE':
    Ans[3] += 1
    

print('AC x ' + str(Ans[0]))
print('WA x ' + str(Ans[1]))
print('TLE x ' + str(Ans[2]))
print('RE x ' + str(Ans[3]))


Measured memory_bytes: 9068
import itertools


max_num = 200
num_list = [i for i in range(-max_num,  max_num+1)]
num_comb = list(itertools.permutations(num_list, 2))

x = int(input().strip())
for comb in num_comb:
    a = comb[0]
    b = comb[1]
    # print(a, b)
    a5 = a ** 5
    b5 = b ** 5
    if a5 - b5 == x:
        print(a, b)
        break

Measured memory_bytes: 78008
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e5+5;

int n, ans=0;
string a, b, c;

int32_t main()
{
	IOS;
	cin>>n>>a>>b>>c;
	for(int i=0;i<n;i++)
	{
		map<char, int> m;
		m[a[i]]++;
		m[b[i]]++;
		m[c[i]]++;
		int mx=0;
		for(auto &it:m)
			mx=max(mx, it.second);
		ans+=3-mx;
	}
	cout<<ans;
	return 0;
}


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

int main(){
   long long int X,Y;
   cin >> X >> Y;
long long int A = X;
long long int ans = 0;
   for(long long int i = X; i <= Y; i += A){
       ans++; 
       A = i;
   }

   cout << ans;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
//最初に設定する.
const int MAX = 510000; const ll MOD = 998244353;
long long fac[MAX], finv[MAX], inv[MAX];  void modcinit() { 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 modc(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;
    cin>>n>>m;
    ll k;
    cin>>k;
    modcinit();
    ll mod=998244353;
    ll res=0;
    rep(i,0,k+1){
        ll add=(((m*modc(n-1,i)%mod)+mod)%mod*modpow(m-1,n-1-i,mod)%mod+mod)%mod;
        res=((res+add)%mod+mod)%mod;
    }
    cout<<res<<endl;
    return 0;
}




Measured memory_bytes: 15588
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

char f(char c) {
	return c - 'a' + 'A';
}

int main() {
	for (int i = 0; i < 3; i++) {
		string s; cin >> s;
		cout << f(s[0]);
	}

	cout << endl;
	return 0;
}

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

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

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

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

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

    size_t N;
    cin >> N;

    int res = 0;
    vector<int> a(N);
    cin >> a[0];
    for (size_t i = 1; i < N; ++i) {
        cin >> a[i];
        if (a[i] == a[i - 1]) {
            res++;
            a[i] = -1;
        }
    }

    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
h,w = map(int,input().split())
B = [input() for _ in range(h)]
dp=[]
def ch(x1,y1,x2,y2):
    if B[x1][y1]=='.' and B[x2][y2]=='#':
        return 1
    else:
        return 0
dp = [[0 for j in range(w)] for i in range(h)]
for i in range(h):
    for j in range(w):
        if i==0 and j==0 and B[i][j]=='#':
            dp[i][j]+=1
        elif i==0:
            dp[i][j] = dp[i][j-1]+ch(i,j-1,i,j)
        elif j==0:
            dp[i][j] = dp[i-1][j]+ch(i-1,j,i,j)
        else:
            dp[i][j] = min(dp[i][j-1]+ch(i,j-1,i,j),dp[i-1][j]+ch(i-1,j,i,j))
print(dp[h-1][w-1])

Measured memory_bytes: 3188
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<list>
#include<vector>
#include<cmath>

using ll = long long;
using namespace std;

int main(void){

    string x;
    cin >> x;

    int ans = 0;
    int ptr = 0;
    for(int i=0;i<x.size();i++){
        if(x[i]=='S')ptr--;
        else ptr++;
        ans = max(ans,ptr);
    }
    cout << ans*2 << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl;
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl;
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

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

  ll tmp = min(a,k);
  a -= tmp;
  k -= tmp;
  b -= min(b,k);
  cout << a SP b << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define INF 1e+18
#define EPS 1e-8
using namespace std;

vector<int> prime,flag;

void list_prime(int N){
	flag.resize(N + 1);
	flag[0] = 1;
	flag[1] = 1;
	for(int i = 4;i <= N;i += 2) flag[i] = 1;
	for(int i = 3;i * i <= N;i += 2){
		if(flag[i]) continue;
		for(int j = i * 2;j <= N;j += i) flag[j] = 1;
	}
	for(int i = 0;i <= N;i++) if(!flag[i]) prime.push_back(i);
	for(int i = 0;i <= N;i++) flag[i] = !flag[i];
}

signed main(){
	int n,s[100010],t[100010],ans = 0;
	map<int,int> cnt;
	scanf("%lld",&n);
	list_prime(2154);
	for(int i = 0;i < n;i++) scanf("%lld",&s[i]);
	for(int i = 0;i < n;i++){
		int tmp = s[i];
		t[i] = 1;
		for(int p : prime){
			int p3 = p * p * p;
			while(s[i] % p3 == 0){
				s[i] /= p3;
				tmp /= p3;
			}
			if(s[i] % (p * p) == 0) t[i] *= p;
			else if(s[i] % p == 0) t[i] *= p * p;
			while(tmp % p == 0) tmp /= p;
		}
		int sq = (int)sqrt((double)tmp + EPS);
		if(sq * sq == tmp || tmp <= 100000){
			if(sq * sq == tmp) t[i] *= sq;
			else t[i] *= tmp * tmp;
			cnt[s[i]]++;
		}
		else s[i] = 0;
	}
	bool flag = false;
	for(int i = 0;i < n;i++){
		if(s[i] == 1) flag = true;
		if(s[i] >= 2){
			ans += max(cnt[s[i]],cnt[t[i]]);
			cnt[s[i]] = 0;
			cnt[t[i]] = 0;
		}
		if(!s[i]) ans++;
	}
	cout << ans + flag << endl;
	return 0;
}

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

int main() {
    int n;
    scanf("%d", &n);
    int i, v[n], c[n];
    int x = 0, y = 0;
    for (i = 0; i < n; i++) scanf("%d", &v[i]);
    for (i = 0; i < n; i++) scanf("%d", &c[i]);
    for (i = 0; i < n; i++) {
        if (v[i] - c[i] > 0) {
            y += c[i];
            x += v[i];
        }
    }
    printf("%d\n", x - y);
}


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

const long long MOD = 1000000007;

vector<ll> cnt(1e5, 0);
void solve(long long N, std::vector<long long> A) {
    rep(i, N) { cnt[A[i]]++; }
    ll ans = 1;
    if (N % 2 == 0) {
        for (ll i = 0; i <= N; i++) {
            if (i % 2 == 0 && cnt[i] != 0) {
                cout << 0 << endl;
                return;
            }
            if (i % 2 == 1) {
                if (cnt[i] != 2) {
                    cout << 0 << endl;
                    return;
                } else {
                    ans *= 2;
                    ans %= MOD;
                }
            }
        }
    } else {
        if (cnt[0] != 1) {
            cout << 0 << endl;
            return;
        }
        for (ll i = 1; i <= N; i++) {
            if (i % 2 == 1 && cnt[i] != 0) {
                cout << 0 << endl;
                return;
            }
            if (i % 2 == 0) {
                if (cnt[i] != 2) {
                    cout << 0 << endl;
                    return;
                } else {
                    ans *= 2;
                    ans %= MOD;
                }
            }
        }
    }
    cout << ans << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <climits>
#include <numeric>

#define all(x) begin(x),end(x)

using namespace std;
using ll = long long;

template<typename T>
T gcd(T a, T b) {
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

int main()
{
    int N; cin >> N;
    vector<int> x;
    vector<int> y;
    vector<int> p;
    for (int i = 0; i < N; ++i) {
        int _x;
        int _y;
        cin >> _x >> _y;
        x.push_back(_x);
        y.push_back(_y);
        p.push_back(i);
    }

    double res = 0;
    int cnt = 0;
    do {
        double len[N-1];
        for (int i = 0; i < N-1; ++i) {
            int x1 = x[p[i]];
            int y1 = y[p[i]];
            int x2 = x[p[i+1]];
            int y2 = y[p[i+1]];
            len[i] = sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
        }
        double _res = 0;
        for (int i = 0; i < N-1; ++i) {
            _res += len[i];
        }
        res += _res;
        cnt++;
    } while(next_permutation(p.begin(), p.end()));

    printf("%.10lf\n", res/cnt);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
const LL MOD = 1e9 + 7;
const int MAX = 101010;
LL T[MAX], A[MAX];

int main(){
    
    // 1. 入力情報.
    int N;
    scanf("%d", &N);
    rep(i, N) scanf("%lld", &T[i]);
    rep(i, N) scanf("%lld", &A[i]);
    
    // 2. 記録の整合性を確認.
    bool ok = true;
    int atT = -1, atA = -1;
    if(T[N - 1] != A[0]) ok = false;
    rep(i, N){
        if(T[i] == T[N - 1]){
            atT = i;
            break;
        }
    }
    repr(i, N - 1, 0){
        if(A[i] == A[0]){
            atA = i;
            break;
        }
    }
    if(atT > atA) ok = false;
    
    // 3. 記録の整合性が矛盾していれば終了.
    if(!ok){
        puts("0");
        return 0;
    }
    
    // 4. 山の高さの列としてありうるものは？
    LL ans = 1, befT = T[0], befA = A[N - 1];
    repx(i, 1, atT){
        if(befT == T[i]) ans *= T[i];
        ans %= MOD;
        befT = T[i];
    }
    repr(i, N - 2, atT + 1){
        if(befA == A[i]) ans *= A[i];
        ans %= MOD;
        befA = A[i];
    }
    
    // 5. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 1792
def slove():
    import sys
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    cnt = 0
    for i in range(a, b + 1):
        s = str(i)
        b = True
        for j in range(len(s)):
            if s[j] != s[-j-1]:
                b = False
                break
        if b:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    slove()


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

int main(){
    int N;
    cin>>N;
    int F;
    F=N%10;
    if((F==2)||(F==4)||(F==5)||(F==7)||(F==9)){
        cout<<"hon"<<endl;
        return 0;
    }
    else if((F==0)||(F==1)||(F==6)||(F==8)){
        cout<<"pon"<<endl;
        return 0;
    }
    cout<<"bon"<<endl;
    return 0;
    
    
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    LL n;
    cin >> n;
    if ( n==1 ) {
        cout << 0 << '\n';
        return 0;
    }
    LL m=n;
    map<LL, LL> mp;
    for ( LL i=2; i*i<=m; i++ ) {
        while ( m%i==0 ) {
            mp[i]++;
            m/=i;
        }
    }
    if ( m>1 ) mp[m]++;

    LL ans=0;
    for ( auto p:mp ) {
        // cout << p.second << '\n';
        LL x=sqrt(p.second*2);
        if ( x*(x+1)<=2*p.second ) {
            ans+=x;
        } else {
            ans+=x-1;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3676
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final char[] inputs = sc.nextLine().toCharArray();
		
		int[] map = new int[inputs.length];
		
		for(int i = 0; i < inputs.length; i++){
			map[i] = inputs[i] == '/' ? 1 : inputs[i] == '_' ? 0 : -1;
		}
		
		int[] maps = new int[inputs.length + 1];
		for(int i = 0; i < map.length; i++){
			maps[i + 1] = map[i]; 
		}
		for(int i = 1; i < maps.length; i++){
			maps[i] += maps[i - 1];
		}
		
		//System.out.println(Arrays.toString(map));
		//System.out.println(Arrays.toString(maps));
		
		LinkedList<Integer> area_list = new LinkedList<Integer>();
		
		int total_areas = 0;
		for(int cur_pos = 0; cur_pos < maps.length; cur_pos++){
			final int cur_height = maps[cur_pos];
			int areas = 0;
			
			boolean ok = false;
			for(int next_pos = cur_pos + 1; next_pos < maps.length; next_pos++){
				final int prev_height = maps[next_pos - 1] - cur_height;
				final int next_height = maps[next_pos] - cur_height;
				final int max_height = Math.abs(Math.max(prev_height, next_height));
				
				//System.out.println(cur_pos + ":" + next_pos + " [" + prev_height + " " + next_height + "]");
				
				if(next_height <= 0){
					areas += max_height;
					if(prev_height < next_height){
						areas += 1;
					}
				}
				
				if(next_height >= 0){
					cur_pos = next_pos - 1;
					ok = true;
					break;
				}
			}
			
			if(ok && areas > 0){
				total_areas += areas;
				area_list.add(areas);
			}
		}
		
		System.out.println(total_areas);
		System.out.print(area_list.size());
		for(int area : area_list){
			System.out.print(" " + area);
		}
		System.out.println();
		
		sc.close();
	}

}

Measured memory_bytes: 25264
#include<iostream>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int a,b,c,d,e,time=0;
  cin>>a>>b>>c>>d>>e;
  if(a<=0){
    time+=abs(0-a)*c;
    a=0;
  }
  if(a==0){
    time+=d;
  }
  time+=abs(b-a)*e;
  cout<<time<<endl;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
int main()
{
   long long n, a, b;
    cin >> n >> a >> b;

    if((n == 1 && a!=b) || a > b){
        cout << 0 << endl;
        return 0;
    }
    
    long long op1 = a * (n -1) + b;
    long long op2 = a + b * (n-1);
    cout << op2 - op1 + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main (void){
int S = 86400;
 scanf("%d",&S) ;
int h=   S / 3600;
int m = S % 3600 / 60 ;
int s =  S % 3600 % 60 ;
printf("%d:%d:%d\n",h,m,s);
return 0; 
}

Measured memory_bytes: 592
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	char a[4],b[4];
	int f=0;
	scanf("%s %s",a,b);
	for(int i=0;i<3;i++)
	{
		if(a[2-i]!=b[i])f=1;
	}
	if(f==1)cout<<"NO";
	else cout<<"YES";
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	line := nextLine()

	x, _ := strconv.Atoi(line)

	cols := strings.Split(line, "")

	sum := 0

	for _, s := range cols {
		n, _ := strconv.Atoi(s)
		sum += n
	}

	if x%sum == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#define N 3
using namespace std;

int main(){
    int grid[N][N];
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            cin >> grid[i][j];
        }
    }

    int a[3] = {0};
    int b[3];
    for(int i = 0; i < N; i++) b[i] = grid[0][i] - a[0];
    for(int i = 0; i < N; i++) a[i] = grid[i][0] - b[0];

    bool judge = true;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(grid[i][j] != a[i] + b[j]) judge = false;
        }
    }
    if(judge) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define en "\n"
using namespace std;
const int M=1e5+100;

char s[M];
int p[M];

int main()
{
    int n,k,ct=0,kk=0;
    cin>>n>>k>>s;
    for(int i=0; i<n; i++)
    {
        if(s[i]=='0')
        {
            if(ct)
            {
                p[kk++]=ct;
                ct=0;
            }
            p[kk++]=0;
        }
        else
            ct++;
    }
    if(ct)p[kk++]=ct;

    int ans=0,tem=0,p1=-1,k2=k;

    for(int i=0; i<kk; i++)
    {
        if(p[i])tem+=p[i];
        else
        {
            if(!k2)
            {
                ans=max(ans,tem);
                tem=0;
                k2=k;
                i=p1;
                p1=-1;
            }
            else
            {
                while(!p[i]&&i<kk)
                {
                    i++;
                    tem++;
                }
                i--;
                k2--;
                if(p1==-1)
                    p1=i;
            }
        }
    }
    ans=max(ans,tem);
    cout<<ans<<en;
    return 0;
}
//3 0 1 0 1 0 2 0 2


Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define INF 1<<30

int main() {
  int n;
  while(cin>>n,n) {
    int ans = 0;
    while(n--) {
      int x,y,h,w;
      cin >> x >> y >> h >> w;
      int v = x+y+h;
      if (v<=60&&w<=2)
        ans += 600;
      else if (v<=80&&w<=5)
        ans += 800;
      else if (v<=100&&w<=10)
        ans += 1000;
      else if (v<=120&&w<=15)
        ans += 1200;
      else if (v<=140&&w<=20)
        ans += 1400;
      else if (v<=160&&w<=25)
        ans += 1600;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<cctype>
using namespace std;

int main(){
	char ch;
	int cnt[26]={};
	while( cin >> ch ){
	ch=tolower(ch);
	if(isalpha(ch)){
	cnt[ch-'a']++;
	}}
	for(int i=0;i<26;i++){
	printf("%c : %d\n",i+'a',cnt[i]);
	}
	
  return 0;
}


Measured memory_bytes: 3152
input_line = input()
Line = list(input_line)

flag = 0

for i in Line:
    # print(i)

    if i == "h" and flag == 0:
        flag = 1
    elif i == "i" and flag ==1:
        flag = 0
    else:
        flag = 2

if flag == 1:
    print("No")
elif flag == 2:
    print("No")
elif flag == 0:
    print("Yes")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

// dist[v] に頂点 s から頂点 v への距離を入れる関数
void dijkstra(int s, Graph &G, vector<ll> &dist){
  fill(all(dist), INF);
  dist[s] = 0;

  priority_queue<P, vector<P>, greater<P>> pq;//距離が小さい順に取り出す
  pq.push(P(0,s)); // 頂点 s からスタート

  while (!pq.empty()) {
    P p = pq.top(); pq.pop();
    int v = p.second;
    if(dist[v] < p.first) continue;// 既に v に辿り着く短い経路有ならスルー (これはただの高速化)

    for(auto e : G[v]){// v から行ける頂点 nv 達を走査
      int nv = e.to;
      ll w = e.weight;
      if(dist[nv] > dist[v] + w){
        dist[nv] = dist[v] + w;
        pq.push(P(dist[nv], nv));
      }
    }
  }
}

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};


const int MAX = 510000;
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;
    }
}


int main(){
  int n; cin >> n;
  vl x(n);
  rep(i, n) cin >> x[i];
  COMinit();
  vl c(n+1);
  rep(i,n) {
    c[i+1] = (c[i] + inv[i+1])%MOD;
  }
  
  ll ans = 0;
  for(int i = 1; i < n; i++) {
    ans += (x[i]-x[i-1])*c[i];
    ans %= MOD;
  }

  ans = (ans * fac[n-1])%MOD;

  cout << ans << endl;
}

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

int main()
{
   string s;
   cin>>s;
   if(s=="Sunny")
   {
       cout<<"Cloudy"<<endl;
   }
   else if(s=="Cloudy")
   {
       cout<<"Rainy"<<endl;
   }
   else if(s=="Rainy")
   {
       cout<<"Sunny"<<endl;
   }
   cout<<endl;
    return 0;
}

Measured memory_bytes: 3584
n=int(input())
l=[0,0,0,0]#non,~a,b~,b~a
ans=0
for i in range(n):
    s=input()
    ans+=s.count("AB")
    l[2*int(s[0]=="B")+1*int(s[-1]=="A")]+=1

if l[-1]:
    ans+=l[-1]-1
    if l[1]:
        l[1]-=1
        ans+=1
    if l[2]:
        l[2]-=1
        ans+=1
print(ans+min(l[1:3]))

Measured memory_bytes: 3192
N = int(input())

rest_dict = {}


rest_arr = []
for i in range(N):
    tmp = input().split()
    rest_arr.append(tmp)

for i in range(N):
    if rest_arr[i][0] in rest_dict:
        rest_dict[rest_arr[i][0]].append(int(rest_arr[i][1]))
    else:
        rest_dict[rest_arr[i][0]] = [int(rest_arr[i][1])]
    rest_dict[rest_arr[i][0]] = sorted(rest_dict[rest_arr[i][0]], key=lambda x: -x)



rest_dict = sorted(rest_dict.items())


def search_num(rest, num):
    for i in range(N):
        if rest_arr[i][0] == rest and int(rest_arr[i][1]) == num:
            return i + 1
 

for i in rest_dict:
    for j in i[1]:
        print(search_num(i[0], j))

Measured memory_bytes: 3064
/*Lucky_Glass*/
#include<queue>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=100,inf=(1<<29);

int Rr,Cc,Ps,Pt,Emat[N+3][N+3],Edep[N*3],Eans[N+3][N+3];
bool Bb[N+3][N+3];
vector<int> Vec[N+3];

struct GGRAPH{
	struct GNODE{
		int to,cap,Vx,Vy;
		GNODE *nxt,*rev;
	}Gnod[(N*N+N*2)*3];
	GNODE *Gtop[N*3],*Gcnt;
	void Init(int Nn){
		Gcnt=Gnod;
		fill(Gtop,Gtop+1+Nn,Gcnt);
	}
	void AddEdge(int u,int v,int ca1,int ca2,int Vx,int Vy){
		GNODE *p=++Gcnt,*q=++Gcnt;
		*p=(GNODE){v,ca1,Vx,Vy,Gtop[u],q};Gtop[u]=p;
		*q=(GNODE){u,ca2,Vx,Vy,Gtop[v],p};Gtop[v]=q;
	}
}Gflw;

GGRAPH::GNODE *Cop[N*3];

int Aug(int u,int flwin){
	if(u==Pt) return flwin;
	int flwout=0;
	for(auto &it=Cop[u];it;it=it->nxt){
		int v=it->to;
		if(!it->cap || Edep[v]!=Edep[u]+1) continue;
		int flwv=min(flwin-flwout,it->cap);
		flwv=Aug(v,flwv);
		flwout+=flwv;
		it->cap-=flwv;
		it->rev->cap+=flwv;
		if(flwout==flwin) break;
	}
	return flwout;
}
bool BFS(){
	for(int i=1;i<=Rr*2+2;i++)
		Cop[i]=Gflw.Gtop[i],Edep[i]=inf;
	queue<int> que;
	Edep[Ps]=0;
	que.push(Ps);
	while(!que.empty()){
		int u=que.front();que.pop();
		for(auto it=Cop[u];it;it=it->nxt){
			int v=it->to;
			if(!it->cap || Edep[v]!=inf) continue;
			Edep[v]=Edep[u]+1;
			if(v==Pt) return true;
			que.push(v);
		}
	}
	return false;
}
int Dinic(){
	int mxflw=0;
	while(BFS()) mxflw+=Aug(Ps,inf);
	return mxflw;
}
int main(){
	scanf("%d%d",&Rr,&Cc);
	Ps=2*Rr+1;Pt=2*Rr+2;
	for(int i=1;i<=Rr;i++)
		for(int j=1;j<=Cc;j++)
			scanf("%d",&Emat[i][j]);
	for(int i=1;i<=Cc;i++){
		Gflw.Init(2*Rr+2);
		int Vtot=0;
		for(int j=1;j<=Rr;j++)
			for(int k=1;k<=Cc;k++)
				if(!Bb[j][k]){
					Gflw.AddEdge(j,(Emat[j][k]-1)/Cc+1+Rr,1,0,j,k);
					Vtot+=2;
				}
		for(int j=1;j<=Rr;j++) Gflw.AddEdge(Ps,j,1,0,0,0);
		for(int j=1;j<=Rr;j++) Gflw.AddEdge(j+Rr,Pt,1,0,0,0);
		int Rs=Dinic();
		for(int j=1;j<=Vtot;j+=2){
			auto it=Gflw.Gnod[j];
			if(it.cap==0){
				Eans[it.Vx][i]=Emat[it.Vx][it.Vy];
				Bb[it.Vx][it.Vy]=true;
			}
		}
	}
	for(int i=1;i<=Rr;i++)
		for(int j=1;j<=Cc;j++){
			printf("%d",Eans[i][j]);
			Vec[j].push_back(Eans[i][j]);
			if(j==Cc) printf("\n");
			else printf(" ");
		}
	for(int i=1;i<=Cc;i++){
		sort(Vec[i].begin(),Vec[i].end());
		for(int j=1;j<=Rr;j++)
			Eans[j][i]=Vec[i][j-1];
	}
	for(int i=1;i<=Rr;i++)
		for(int j=1;j<=Cc;j++){
			printf("%d",Eans[i][j]);
			if(j==Cc) printf("\n");
			else printf(" ");
		}
	return 0;
}

Measured memory_bytes: 1152
x, n = map(int, input().split())
a = [int(x) for x in input().split()]
b = [i for i in range(0,102) if i not in a] 
b_tmp = list(map(lambda s:abs(s-x), b)) #b_tmpはbとxの差分のリストをさくせい
address = b_tmp.index(min(b_tmp))
print(b[address])

Measured memory_bytes: 9048