akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
#define __lcm(a,b) ((a)/__gcd(a,b)*(b))
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288419716939937510582097;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}
int A,B,C,x,y;
int main()
{
	A=read(),B=read(),C=read(),x=read(),y=read();
	LL ans=INFLL;
	For(i,0,max(x,y))ans=min(ans,2LL*i*C+((x-i)>=0?(x-i):0)*A+((y-i)>=0?(y-i):0)*B);
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main()
{
 long long a, b, x, y, t, gcd, lcm;

  while(scanf("%lld%lld", &x, &y)!=EOF){
    a = x;
  b = y;

  while (b != 0) {
    t = b;
    b = a % b;
    a = t;
   gcd = a;
lcm = (x*y)/gcd;
  }
    printf("%lld %lld\n",gcd,lcm);
  }






  return 0;

}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)

int main() {
    // your code goes here
    ll n,p,c[200005],sum[200005]={0},ans=0,k[10005]={0},ts=1;
    char s[200005];
    cin >> n >> p;
    cin >> s;
    rep(i,0,n-1) c[n-i]=s[i]-'0';
    k[0]=1;
    rep(i,1,n){
        sum[i]=(sum[i-1]+ts*c[i]%p)%p;
        k[sum[i]]++;
        ts=(ts*10)%p;
    }
    if(p==2){
        rep(i,1,n){
            if(c[i]%2==0){
                ans+=(n-i+1);
            }
        }
    } else if(p==5){
        rep(i,1,n){
            if(c[i]%5==0){
                ans+=(n-i+1);
            }
        }
    } else {
        rep(i,0,p-1){
            ans+=((k[i]-1)*(k[i])/2);
        }
    }
    cout << ans << endl;
    return 0;
}

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

const int MAXN = (int)2e5 + 500;

int n;
int num[MAXN], loc[MAXN];

int main(){
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        scanf("%d", &num[i]);
        loc[num[i]] = i;
    }
    int mx = 0, las = 0, cur = 0;
    for(int i = 1; i <= n; i++){
        if(loc[i] > las){
            cur++;
            mx = max(mx, cur);
        }
        else{
            cur = 1;
        }
        las = loc[i];
    }
    cout << n - mx;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,m,l;

struct edge
{
	int to,cap,rev;
};
vector<edge>G[3005];
bool used[3005];
int E[105][105];

void add_edge(int from,int to,int cap)
{
	G[from].push_back((edge){to,cap,G[to].size()});
	G[to].push_back((edge){from,0,G[from].size()-1});
}
int dfs(int v,int t,int f)
{ 
	if(v==t) return f;
	used[v]=true;
	for(int i=0;i<G[v].size();i++)
	{
		edge &e=G[v][i];
		if(!used[e.to] && e.cap>0)
		{ 
			int d=dfs(e.to,t,min(f,e.cap));
			if(d>0) 
			{ 
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}
int max_flow(int s,int t)
{ 
	int flow=0;
	while(1)
	{ 
		memset(used,0,sizeof(used));
		int f=dfs(s,t,INF);
		if(!f) return flow;
		flow+=f;
	}
}
int p[1005],t[1005];
int main(){
	while(1){
		cin >> n >> m >> l;
		if(n==0) return 0;
		rep(i,105) rep(j,105){
			E[i][j] = INF;
			if(i==j) E[i][j] = 0;
		}
		rep(i,3005){
			G[i].clear(); used[i] = 0;
		}
		for(int i=0;i<m;i++){
			int u,v,d;
			cin >> u >> v >> d;
			E[u][v] = E[v][u] = d;
		}
		for(int i=0;i<l;i++) cin >> p[i] >> t[i];
		
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				for(int k=0;k<n;k++){
					E[j][k] = min(E[j][k],E[j][i]+E[i][k]);
				}
			}
		}
		for(int i=0;i<l;i++){
			for(int j=0;j<l;j++){
				if(i==j)continue;
				if(t[i]+E[p[i]][p[j]] <= t[j]){
					add_edge(i,j+1005,1);
				}
			}
		}
		for(int i=0;i<l;i++) add_edge(2301,i,1);
		for(int i=0;i<l;i++) add_edge(i+1005,2302,1);
		cout << l-max_flow(2301,2302) << endl;
	}
}

Measured memory_bytes: 28104
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int used[26]={0};

int get_count(std::string str,char c){
  int n = str.length();
  while(1){
    char h = str[0];
    bool single = true;
    for(int i=1;i<str.length();++i){
      if(h!=str[i]){
        single = false;
        break;
      }
    }
    if(single) break;
    string str2(str.length()-1,' ');
    for(int i=0;i<str2.length();++i){
      if(str[i]==c||str[i+1]==c){
        str2[i]=c;
      }else{
        str2[i]=str[i];
      }
    }
    str = str2;
  }
  return n-str.length();
}


int main(){
  string str;
  cin >> str;
  int n = str.length();
  for(int i=0;i<n;++i){
    used[str[i]-'a']=1;
  }
  int mincnt = 101;
  for(int i=0;i<26;++i){
    if(used[i]){
      mincnt = min(mincnt,get_count(str,i+'a'));
    }
  }
  cout << mincnt << endl;
  return 0;
}

Measured memory_bytes: 256
# numpy使えたら早いだろうな・・・
L1 = list(map(int,input().split()))
L2 = list(map(int,input().split()))
L3 = list(map(int,input().split()))
N = int(input())
B = [int(input()) for _ in range(N)]

Flag = False

LL = L1 + L2 + L3
# print(LL)
# print(B)

for i in B:
    if i in LL:
        LL[LL.index(i)] = 0

# 横
for i in range(3):
    t = LL[3*i] + LL[3*i+1] + LL[3*i+2]
    if t == 0:
        Flag = True

# 縦
for i in range(3):
    t = t = LL[i] + LL[i+3] + LL[i+6]
    if t == 0:
        Flag = True

# 斜め
t = LL[0] + LL[4] + LL[8]
if t == 0:
    Flag = True
t = LL[2] + LL[4] + LL[6]
if t == 0:
    Flag = True

if Flag == True:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
package main

import "fmt"

func main() {
	var n, m, s int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var v int
		fmt.Scan(&v)
		if v >= m {
			s++
			m = v
		}
	}
	fmt.Println(s)
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n){
        cin >> a.at(i);
    }
    ll ans = 0;
    for(ll i = 1; i < n; ++i){
        if(a.at(i) == a.at(i - 1)){
            ans++;
            a.at(i) = - i;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
    int n,m;cin>>n>>m;
    vector<int> a(m);
    vector<int> b(m);
    int i;
    for(i=0;i<m;i++)cin>>a.at(i)>>b.at(i);
    vector<int> counta(n);
    vector<int> countb(n);
    for(i=0;i<m;i++)
    {
        if(a.at(i)==1)countb.at(b.at(i)-1)++;
        if(b.at(i)==n)counta.at(a.at(i)-1)++;
    }
    bool ok=false;
    for(i=0;i<n;i++)
    {
        if(counta.at(i)>=1&&countb.at(i)>=1)ok=true;
    }
    if(ok)cout<<"POSSIBLE"<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
}


Measured memory_bytes: 3328
from math import cos, sin, pi


class Point():
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def show(self):
        print(f"{self.x:.8f} {self.y:.8f}")


def calc_s(p1, p2) -> Point:
    x = p1.x * 2 / 3 + p2.x / 3
    y = p1.y * 2 / 3 + p2.y / 3
    s = Point(x, y)
    return s


def calc_t(p1, p2) -> Point:
    x = p1.x / 3 + p2.x * 2 / 3
    y = p1.y / 3 + p2.y * 2 / 3
    t = Point(x, y)
    return t


def calc_u(s, t) -> Point:
    theta = pi / 3
    x = s.x + (t.x - s.x) * cos(theta) - (t.y - s.y) * sin(theta)
    y = s.y + (t.x - s.x) * sin(theta) + (t.y - s.y) * cos(theta)
    u = Point(x, y)
    return u


def koch(n, p1, p2):
    if n == 0:
        return

    s = calc_s(p1, p2)
    t = calc_t(p1, p2)
    u = calc_u(s, t)

    koch(n - 1, p1, s)
    s.show()

    koch(n - 1, s, u)
    u.show()

    koch(n - 1, u, t)
    t.show()

    koch(n - 1, t, p2)


def main():
    n = int(input())
    p1 = Point(0, 0)
    p2 = Point(100, 0)

    p1.show()
    koch(n, p1, p2)
    p2.show()


if __name__ == "__main__":
    main()



Measured memory_bytes: 5804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fo(i,n) for(ll i=0;i<n;i++)
#define fok(i,k,n) for(ll i=k;i<n;i++)
#define ci(x) cin>>x
#define ci2(x,y) cin>>x>>y
#define co(x) cout<<x<<"\n"
#define co2(x,y) cout<<x<<" "<<y<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define PI 3.1415926535897932384626
#define deb1(x) cout<<#x<<" "<<x<<endl
#define deb2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n"
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;	

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	ci(s);
	set<char> h;
	fo(i,3){
		h.insert(s[i]);
	}
	if((int)h.size()==2){
		co("Yes");
	}
	else{
		co("No");
	}
}


Measured memory_bytes: 256
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
#以下てんぷら
def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


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

def ip():
    return int(input())
n = ip()                                     #入力整数1つ
#n,x= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(h)]
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
s = (n//11)*2
r = n%11
if r:
    s+=1
    if r>6: s+=1
print(s)

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll H[200005];

int main() {
    ll N, K;
    cin >> N >> K;
    REP(i, N) {
        cin >> H[i];
    }
    sort(H, H + N);
    ll ans = 0;
    REP(i, N - K) {
        ans += H[i];
    }
    cout << ans << endl;
    return 0;
}

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

const string YES = "Yes";
const string NO = "No";

bool is_kaibbun(string s){
    for(int i = 0;i < (int)s.size()/2;i++){
        if(s[i] != s[s.size() - i - 1]){
            return false;
        }
    }
    return true;
}
void solve(std::string S){
    if(is_kaibbun(S) && is_kaibbun(S.substr(0, S.size()/2)) && is_kaibbun(S.substr((S.size()+3)/2-1, S.size()/2))){
        cout<<YES<<endl;
    }else{
        cout<<NO<<endl;
    }
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
def show(nums):
    print(' '.join(map(str, nums)))    


def selection_sort(nums, n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if nums[j] < nums[minj]:
                minj = j
        v = nums[i]
        nums[i] = nums[minj]
        nums[minj] = v
        if i != minj:
            count += 1
    show(nums)
    print(count)

    
n = int(input())
nums = list(map(int, input().split()))
selection_sort(nums, n)


Measured memory_bytes: 5600
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric> 
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1e9 + 5;
typedef long long ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
///////////////////////////////////////////////////////////////////////

typedef pair<int, int> item;

const int N = 101;
const ll MAX_LL = 1e18L + 5;

int n, w;
int weight, value;
vector<item> items(N);
vector<ll> dp(N * 1000 + 1, MAX_LL);

// dp[i] is the minimum total weight of items with total value exactly i
int main() {
    scanf("%d%d", &n, &w);

    int total_value = N * 1000 + 1;
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        scanf("%d%d", &weight, &value);
        for (int value_already = total_value - value; value_already >= 0; --value_already) {
            chmin(dp[value_already + value], dp[value_already] + weight);
        }
    }

    ll res = 0;
    for (ll i = 0; i < total_value; ++i) {
        if (dp[i] <= w) res = max(res, i);
    }
    printf("%lld\n", res);
}

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

int main(){
	char ch[1201];
	int alpha[26] = {};

	for(int i=0; i<1201; i++){
		scanf("%c",&ch[i]);
		if(ch[i] == '\0') break;
		ch[i] = tolower(ch[i]);
		if( isalpha(ch[i]) ){
			alpha[ch[i]-'a']++;
		}
	}

	for(int i=0; i<26; i++){
		printf("%c : %d\n",'a'+i,alpha[i]);
	}

	return 0;
}

Measured memory_bytes: 1144
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	rdr := NewReader(20)
	n := ReadInt()

	l := make([]int64, 5)

	for i := 0; i < n; i++ {
		name := ReadLine(rdr)
		if name[0:1] == "M" {
			l[0]++
		}
		if name[0:1] == "A" {
			l[1]++
		}
		if name[0:1] == "R" {
			l[2]++
		}
		if name[0:1] == "C" {
			l[3]++
		}
		if name[0:1] == "H" {
			l[4]++
		}
	}

	res := int64(0)
	for i := 0; i < 5; i++ {
		for j := i + 1; j < 5; j++ {
			for k := j + 1; k < 5; k++ {
				res += l[i] * l[j] * l[k]
			}
		}
	}

	fmt.Println(res)
}

type Reader struct {
	rdr  *bufio.Reader
	size int
}

func NewReader(size int) *Reader {
	return &Reader{
		bufio.NewReaderSize(os.Stdin, size),
		size,
	}
}

func ReadInt() (i int) {
	fmt.Scan(&i)
	return
}

func ReadLine(r *Reader) string {
	buf := make([]byte, 0, r.size)
	for {
		line, isPrefix, err := r.rdr.ReadLine()
		if err != nil {
			panic(err)
		}
		buf = append(buf, line...)
		if !isPrefix {
			break
		}
	}
	return string(buf)
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

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

	if (500ll * K >= X) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
 
 int L,R,d;
 scanf("%d %d %d", &L, &R, &d);
 int akhir=0;
  for (int i=1; i<=R; i++){
   if(d*i >= L && d*i <= R){
    akhir++;
   }
  }
  printf("%d\n", akhir);
 return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> list(3);
  int n;
  for(int i=0; i<3; i++) {
    cin >> list.at(i);
  }
  sort(list.begin(),list.end());
  cin >> n;
  for(int i=0; i<n; i++) {
    list.at(2) *= 2;
  }
  int ans = 0;
  for(int i=0; i<3; i++) {
    ans += list.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int in(void){
	int i;scanf("%d",&i);
	return i;
}
int main(void){
	int a=in(),b=in();
	if(a%3==0||b%3==0||(a+b)%3==0){
		puts("Possible");
	}
	else{
		puts("Impossible");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    int a;
    cin >> a;
    cout << a+a*a+a*a*a << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check(int n) {
    for(int i=2;i*i<=n;++i) {
        if(n%i==0)
        return false;
    }
    return true;
}


// bool cmp(pair<int,int>p,pair<int,int>q) {
//     // return p.first>q.first;//descending by first
//     // return p.first<q.first;//ascending by first
//     // return p.second>q.second;//descending by second
//     return p.second<q.second;//ascending by second
// }

bool cmp(int p,int q) {
    return p>q;//descending
    // return p<q;//ascending
}

bool det(int n) {
    for(int i=1;i<=9;++i) {
        for(int j=1;j<=9;++j) {
            if(i*j==n)return true;
        }
    }
    return false;
}

int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }

    return 0;
}
int clue() {

    int n;
    cin>>n;

    
    (det(n))?cout<<"Yes"<<endl:cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();

        if ((a + b) % 2 == 0) {
            System.out.println((a + b) / 2);
        } else {
            System.out.println("IMPOSSIBLE");
        }
    }
}

Measured memory_bytes: 21844
/**
*     => Md. Sajjat Hosen
*     => Department of Computer Science and Engineering
*     => Bangabandhu Sheikh Mujibur Rahman Science and Technology University
**/

/*..................! TRY ONCE MORE !..................*/

/*...Part - 01...*/

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

/*...Part - 02...*/

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

int Int(){int x ; scanf("%d",&x) ; return x ;}
ll Long(){ll x ; scanf("%lld",&x) ; return x ;}
float Float(){float x ; scanf("%f",&x) ; return x ;}
double Double(){double x ; scanf("%lf",&x); return x;}

/*...Part - 03...*/
/*....Debugger....*/

#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) {cout << endl ;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}

/*...Part - 04...*/
/*...Needed to change according to problem requirements...*/

const int N          = (int)2e5 + 5 ;
const int maxN       = (int)1e6 + 6 ;
const ll  Mod        = (ll)1e9 + 7 ;
const int inf        = (int)2e9 ;
const ll  Inf        = (ll)1e18 ;

/*..........................................................*/
/*...Part - 05...*/

#define     debug(x)    cerr << #x << " = " << x << '\n' ;
#define     rep(i,b,e)  for(__typeof(e) i = (b) ; i != (e + 1) - 2 * ((b) > (e))  ; i += 1 - 2 * ((b) > (e)))
#define     Int         Int()
#define     Long        Long()
#define     Float       Float()
#define     Double      Double()
#define     all(x)      x.begin() , x.end()
#define     sz(x)       (int)x.size()
#define     ff          first
#define     ss          second
#define     pb          push_back
#define     eb          emplace_back
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)

/*...Part - 06...*/
/*...... ! Code start from here ! ......*/



int main(){
    //freopen("input.txt","r",stdin);
    int test = 1 , tc = 0 ;
    ll h, count = 0, ans = 0;
    while(test--){
        h = Long;
        while(h != 1){
            count++;
            h /= 2;
        }
        ans = pow(2, count);
        ans *= 2;
        printf("%lld\n", --ans);
    }
    return 0 ;
}

/*...Always look at the part - 04...*/
/*...............END................*/


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

int main(){
    int H, W;
    cin >> H >> W;
    int table[H][W];
    for(int i = 0;i < H;++i){
        string s;
        cin >> s;
        for(int j = 0;j < s.length();++j){
            if(s[j] == '#'){
                table[i][j] = 0;
            }else{
                table[i][j] = 1;
            }
        }
    }
    int counttable[H][W];
    for(int i = 0;i < H;++i){
        for(int j = 0;j < W;++j){
            if(j == 0){
                counttable[i][j] = table[i][j];
            }else if(table[i][j] == 0){
                counttable[i][j] = table[i][j];
            }else{
                counttable[i][j] = table[i][j] + counttable[i][j-1];
            }
        }
    }
    int counttableT[H][W];
    for(int i = 0;i < H;++i){
        for(int j = 0;j < W;++j){
            if(i == 0){
                counttableT[i][j] = table[i][j];
            }else if(table[i][j] == 0){
                counttableT[i][j] = table[i][j];
            }else{
                counttableT[i][j] = table[i][j] + counttableT[i-1][j];
            }
        }
    }
    for(int i = 0;i < H;++i){
        for(int j = W-2;j > -1;--j){
            if(counttable[i][j] != 0 && counttable[i][j] < counttable[i][j+1]){
                counttable[i][j] = counttable[i][j+1];
            }
        }
    }
    for(int i = H-2;i > -1;--i){
        for(int j = 0;j < W;++j){
            if(counttableT[i][j] != 0 && counttableT[i][j] < counttableT[i+1][j]){
                counttableT[i][j] = counttableT[i+1][j];
            }
        }
    }
    int ans = 0;
    for(int i = 0;i < H;++i){
        for(int j = 0;j < W;++j){
            ans = max(ans, counttable[i][j] + counttableT[i][j]);
        }
    }
    cout << ans-1 << endl;
    return 0;
}

Measured memory_bytes: 47104
#include <iostream>
using namespace std;
int main (void){
  int A,B,C;
  cin >> A >> B >> C;
  int K;
  cin >> K;
  
  for(int i=0; i<K; i++){
    if(A >= B){
      B = B * 2;
    }else if(B >= C){
      C = C * 2;
    }
  }
  
  if(B > A && C > B){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3616
Q = int(input())
qs = [tuple(map(int,input().split())) for i in range(Q)]

MAXN = 10**5+10
sieve = [0,0] + [1]*MAXN
p = 2
while p*p <= MAXN:
    if sieve[p]:
        for q in range(2*p,MAXN+1,p):
            sieve[q] = 0
    p += 1

cums = [0]
for i in range(1,MAXN):
    valid = sieve[i] and sieve[(i+1)//2]
    cums.append(cums[-1] + int(valid))

for l,r in qs:
    ans = cums[r] - cums[l-1]
    print(ans)

Measured memory_bytes: 21012
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

int main()
{
    string number;
    cin >> number;
    if (number.at(0) == number.at(1) ||
        number.at(1) == number.at(2) ||
        number.at(2) == number.at(3))
    {
        cout << "Bad" << endl;
    }
    else
    {
        cout << "Good" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// Made by Luis Miguel Baez
// es.luismiguelbaez@gmail.com
 
#include <bits/stdc++.h>
 
using namespace std;
 
#define endl '\n'
#define precise(n,k) fixed << setprecision(k) << n
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
 
#define uint  unsigned int
#define ll    long long
#define ull   unsigned long long
#define ld    long double
 
#define pii   pair<int, int>
#define piii  pair<int, pair<int, int>>
#define pll   pair<ll, ll>
 
#define F  first
#define S  second
#define PB push_back
#define MP make_pair
 
#define debug(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
string to_string(string s) {
    return '"' + s + '"';
}
 
string to_string(bool b) {
    return (b ? "true" : "false");
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename T>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const T &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string((T)x);
    }
    res += "}";
    return res;
}
 
// add templates here

template<class T>
void println(const vector<T> &data) {
    cout << to_string<vector<T>, T>(data) <<endl;
}
 
template<class T>
void println(const T &data) {
    cout << to_string((T)data) << endl;
}
 
const int MOD = int(1e9+7);
const int oo  = int(1e9 + 20);
const ll lloo  = (ll)(1e18 + 10);

void solve() {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    
    ll divA1 = A/C;
    ll divA2 = B/C + ((A % C == 0)?1:0);
    
    ll divB1 = A/D;
    ll divB2 = B/D + ((A % D == 0)?1:0);
    
    ll divC1 = A/(C*D/__gcd(C, D));
    ll divC2 = B/(C*D/__gcd(C, D)) + ((A % (C*D/__gcd(C, D)) == 0)?1:0);
    
    ll sum = ((ll)abs(divA1 - divA2)) + ((ll)abs(divB1 - divB2));
    ll sub = ((ll)abs(divC1 - divC2));
    
    // cout << "DivA " << abs(divA1 - divA2) << endl;
    // cout << "DivB " << abs(divB1 - divB2) << endl;
    // cout << "Sum : " << sum << endl;
    // cout << "Sub : " << sub << endl;
    
    cout << (ll)((B - A + 1) - (sum - sub)) << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    solve();
    
    return 0;
}

Measured memory_bytes: 3636
fun main(args: Array<String>) {
    val (y,x) = readLine()!!.split(" ").map(String::toInt)
    var e = ("#".repeat(x + 2))
    println(e)
    for(i in 0 until y){
        println("#" + readLine()!! + "#")
    }
    println(e)
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

class UnionFind
{
    std::vector<P> data;

public:
    UnionFind(int size) : data(size, P(-1,0)) {}
    // 結合可能か
    bool unite(int x, int y)
    {
        x = root(x).first;
        y = root(y).first;
        if(x==y)
        {
            int sz = size(x);
            if(sz>data[x].second)
            {
                data[x].second++;
                return true;
            }
            return false;
        }
        int sz = size(x) + size(y);
        if(sz> data[x].second + data[y].second){
        if (data[y].first < data[x].first)
            std::swap(x, y);
        data[x].first += data[y].first;
        data[y].first = x;
        data[x].second += data[y].second + 1;
        data[y].second = data[x].second;
        return true;}
        return false;
    }
    bool find(int x, int y)
    {
        return root(x).first == root(y).first;
    }
    P root(int x)
    {
        return data[x].first < 0 ? P(x, data[x].second) : data[x] = root(data[x].first);
    }
    int size(int x)
    {
        return -data[root(x).first].first;
    }
};

struct Edge
{
    int from, to;
    ll cost;
};

bool operator<(const Edge &e, const Edge &f)
{
    return e.cost < f.cost;
}

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

    int n, h, w;
    cin >> n >> h >> w;
    vector<Edge> es;
    for (int i = 0; i < n; i++)
    {
        int r, c, a;
        cin >> r >> c >> a;
        r--;
        c--;
        es.push_back(Edge{r, c + h, a});
    }
    sort(es.rbegin(), es.rend());
    UnionFind uf(h + w);
    ll ret = 0;
    for(const auto &e:es)
    {
        int from = e.from, to = e.to;
        ll a = e.cost;
        if(uf.unite(from, to))
        {
            ret += a;
        }
    }
    cout << ret << endl;
}


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

public class Solution
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(x => int.Parse(x) - 1).ToArray();
        var B = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var C = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        var score = 0;
        var prev = int.MinValue;
        foreach (var a in A)
        {
            score += B[a];
            if (prev + 1 == a)
            {
                score += C[prev];
            }
            prev = a;
        }

        Console.WriteLine(score);
    }
}

Measured memory_bytes: 13268
N, S = map(int, input().split())
A = map(int, input().split())
 
def solve(length, target, nums):
  
  dp = [[0]*(target+1) for i in range(length+1)]
  dp[0][0] = 1
  for i, n in enumerate(nums):
    for j, comb_num in enumerate(dp[i]):
      sub = j - n
      dp[i + 1][j] += comb_num * 2
      #print(i, j, sub, dp[i])
      if sub >= 0:
        dp[i + 1][j] += dp[i][sub]
      dp[i + 1][j] %= 998244353
  #print(dp)
  print(dp[length][target])
  
solve(N, S, A)

Measured memory_bytes: 139196
def partition(A, p, r):
 x = A[r]
 i  = p-1
 for j in range(p,r):
  if int(A[j][1]) <= int(x[1]):
   i += 1
   A[i],A[j] = A[j],A[i]
 A[i+1],A[r] = A[r],A[i+1]
 return i+1

def quicksort(A, p, r):
 if p < r:
  q = partition(A, p, r)
  quicksort(A, p, q-1)
  quicksort(A, q+1, r)

def merge(A, left, mid, right):
    L = A[left:mid] + [[0,1000000001]]
    R = A[mid:right] + [[0,1000000001]]
    i = j = 0
    for k in range(left, right):
        if int(L[i][1]) <= int(R[j][1]):
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
 
def mergeSort(A, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        mergeSort(A, left, mid)
        mergeSort(A, mid, right)
        merge(A, left, mid, right)


n = int(input())
A = [input().split() for i in range(n)]
B = A[:]
quicksort(A, 0, n-1)
mergeSort(B, 0, n)

juge = 1
for i in range(n):
 if A[i] != B[i]:
  juge = 0
  break
if juge == 1:
 print("Stable")
else:
 print("Not stable")

for i in range(n):
 print(" ".join(A[i]))

Measured memory_bytes: 32956
#include <iostream>
#include <string>
//#include <stack>

using namespace std;

char stack[101];
int pointer;

char pop( void )
{
	if(pointer > 0) return stack[--pointer];
	else return 'x';
}
void push( char c )
{
	if(pointer < 101) stack[pointer++] = c;
}
int main( void )
{
	string in;
	while(getline(cin, in), in[0] != '.') {
		pointer = 0;
		bool hit = true;
		int len = in.size();
		for(int i=0; i < len; ++i) {
			if(in[i] == '(' || in[i] == '[') {
				push(in[i]);
			}
			else if(in[i] == ')') {
				if('(' != pop()) hit = false;
			}
			else if(in[i] == ']') {
				if('[' != pop()) hit = false;
			}
		}
		if(!pointer && hit)
			cout << "yes" << endl;
		else
			cout << "no" << endl;
	}
}

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

int main() {
	int N;
	cin >> N;
	int ans=0, count;
	bool flag=false;

	for(int i=0; i<=N; i++){
	    for(int j=0; j<=N; j++){
		if(N==4*i + 7*j){
		    flag = true;
		}		    
	    }
	}
	cout << (flag ? "Yes": "No") << endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <string>
#include <string_view>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

int64_t read_int() {
    int64_t ret = 0, sgn = 1;
    int ch = getchar_unlocked();
    while (isspace(ch)) { ch = getchar_unlocked(); }
    if (ch == '-') { sgn = -1; ch = getchar_unlocked(); }
    for (; isdigit(ch); ch = getchar_unlocked())
        ret = (ret * 10) + (ch - '0');
    ungetc(ch, stdin);
    return sgn * ret;
}

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

template <typename T> inline void assign_min(T& x, const T& value) noexcept { x = min(x, value); }
template <typename T> inline void assign_max(T& x, const T& value) noexcept { x = max(x, value); }

constexpr char LF = '\n';

//-------------------------------------------------------------------------------------------------

string read_word() {
    string ret;
    int ch = getchar_unlocked();
    while (isspace(ch)) { ch = getchar_unlocked(); }
    for (; ch != EOF && !isspace(ch); ch = getchar_unlocked())
        ret += ch;
    ungetc(ch, stdin);
    return ret;
}

using int128 = __int128_t;

int main() {
    int128 A = read_int();
    string B = read_word();

    int128 C = 0;
    REP(i, B.size()) {
        if (B[i] == '.') continue;
        C = (C * 10) + (B[i] - '0');
    }
    cout << int64_t(A*C/100) << endl;
}


Measured memory_bytes: 3172
import sys
input=sys.stdin.readline

def main():
    n,m,x=map(int,input().split())
    C=[]
    A=[]
    for _ in range(n):
        c,*a=map(int,input().split())
        C.append(c)
        A.append(a)
    ans=float('inf')
    for i in range(1<<n):
        S=[0]*m
        tmp=0
        for j in range(n):
            if (i>>j)&1==0:
                continue
            tmp+=C[j]
            B=A[j]
            for k,b in enumerate(B):
                S[k]+=b
        for s in S:
            if s<x:
                break
        else:
            ans=min(ans,tmp)
    print(-1 if ans==float('inf') else ans)
    
if __name__=='__main__':
    main()

Measured memory_bytes: 68524
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int N;

    scanf("%d", &N);

    int a[N+1];

    for(int i = 1; i <= N; i++){
        scanf("%d", &a[i]);
    }

    int b = 1;

    int f = 1;
    int c = 0;

    for(int i = 0; i < N; i++){
        b = a[b];
        c++;
        if(b == 2){
            f = 0;
            break;
        }
    }

    if(f == 0){
        printf("%d\n", c);
    }else{
        printf("-1\n");
    }

    return 0;
}

Measured memory_bytes: 2076
#include <bits/stdc++.h>
typedef long long LL;
#define rep(i,a,b) for(auto i=(a);i<=(b);++i)
#define per(i,a,b) for(auto i=(a);i>=(b);--i)
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define ls rt<<1
#define rs rt<<1|1
#define root 1,cnum,1
#define Pr pair<int,int>
#define Prd pair<double,double>
#define Prl pair<LL,LL>
#define fi first
#define se second
#define Abs(x) (x>0?x:x*-1)
#define lowbit(x) (x&(-x))
#define mst(a,b) memset(a,b,sizeof(a))
using namespace std;
const int INF = 0x7FFFFFFF;
const LL LINF = 0x7FFFFFFFFFFFFF;
void guan() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }

const LL mod = 1e9+7; 
const int maxn = 1010101;
LL t[maxn];
LL fact[maxn];
LL f[maxn], pref[maxn], inv_fact[maxn];

LL qpow(LL a, LL n) {
    LL sum = 1;
    while(n) {
        if(n&1) sum = sum*a%mod;
        a=a*a%mod;
        n>>=1;
    } return sum;
}
void init(int n) {
    fact[0] = 1;
    rep(i,1,maxn-10) fact[i] = fact[i-1]*i%mod;
    inv_fact[maxn-10] = qpow(fact[maxn-10],mod-2);
    per(i,maxn-11,0) inv_fact[i] = inv_fact[i+1]*(i+1)%mod;
    LL sum = 0;
    f[0] = 1;
    rep(i,1,n) f[i] = i%mod;
    pref[0] = 0;
    //cout << fact[n-1] << " " << inv_fact[n-2] << " " << f[n-2] << " " << qpow(2,mod-2) << endl;
    rep(i,1,n) pref[i] = (pref[i-1]+fact[n]*inv_fact[n-i+1]%mod*f[n-i+1]%mod*qpow(i,mod-2)%mod*fact[n-i]%mod)%mod;
}
int main() {
    guan();
    int d, h, k, p, q;
    LL n, m;
    while(cin >> n) {
        init(n);
        rep(i,1,n) cin >> t[i];
        LL ans = 0;
        //cout << pref[1] << " " << pref[2] << " " << pref[3] << endl;
        rep(i,1,n) {
            ans = (ans + (pref[i]+pref[n-i+1]-pref[1]+mod)%mod*t[i]%mod)%mod;
            //cout << ans << " ";
        }
        cout << ans << endl;
        //cout << endl;
    }
    return 0;
}

Measured memory_bytes: 24832
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
main(){
  ll n;
  cin>>n;
  vector<ll> a(n);
  for(auto&x:a)cin>>x;
  vector<ll> dp(n+1,(1LL<<50));
  dp[0]=0;
  dp[1]=abs(a[0]-a[1]);
  for(ll i=2;i<n;++i){
    dp[i]=min(dp[i-1]+abs(a[i-1]-a[i]),dp[i-2]+abs(a[i-2]-a[i]));
  }
  cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
K, N = gets.chomp.split(" ").map(&:to_i)
A = gets.chomp.split(" ").map(&:to_i)

min = Float::INFINITY
A.each.with_index do |a, i|
  min = [K - (A[(i + 1) % N] - a) % K, (A[(i - 1) % N] - a) % K, min].min
end

puts min

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

int main()
{
    string s,t,ans="";
    cin >> s >> t;
    vector<vector<int> > dp(s.size()+1,vector<int>(t.size()+1,0));
    for(int i=1;i<=s.size();i++){
        for(int j=1;j<=t.size();j++){
            if(s[i-1]==t[j-1])
                dp[i][j] = dp[i-1][j-1]+1;
            else
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
        }
    }
    int i=s.size(),j=t.size();
    while(i&&j){
        if(s[i-1]==t[j-1]){
            ans += s[i-1];
            i--,j--;
        } else if(dp[i][j]==dp[i-1][j])
            i--;
        else
            j--;
    }
    reverse(ans.begin(),ans.end());
    cout << ans;
    return 0;
}


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

int main(){
	string s,t;
	cin >> s >> t;
	int ans = 1000000000;
	for(int i = 0 ; i <= s.size()-t.size() ; i += 1){
		int sum = 0;
		for(int j = i ; j < i+t.size() ; j += 1){
			if(s[j] != t[j-i]){
				sum += 1;
			}
		}
		ans = min(ans,sum);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3644
import sys,os
from collections import defaultdict, deque
from math import ceil, floor, inf
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
class Combinations:
    def __init__(self,n,p):
        self.n = n
        self.p = p
        self.g1 = [1,1]
        self.g2 = [1,1]
        inverse = [0,1]
        for i in range(2, self.n + 1):
            self.g1.append( ( self.g1[-1] * i ) % self.p )
            inverse.append( ( -inverse[self.p % i] * (self.p//i) ) % self.p )
            self.g2.append( (self.g2[-1] * inverse[-1]) % self.p )
    def nCr(self,r):
        if r < 0 or self.n < r:
            return 0
        r = min(r, self.n-r)
        return self.g1[self.n] * self.g2[r] * self.g2[self.n-r] % self.p

def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD =  998244353

    N,M,K = LMIIS()
    ans = 0
    cmb = Combinations(N-1,MOD)
    #i個のブロックを連結、全体でN-i個、どこを連結させるかは(N-1)Ci通り
    powtable = [0] * N
    powtable[N-K-1] = pow(M-1,N-K-1,MOD) % MOD
    for i in range(N-K,N):
        powtable[i] = powtable[i-1] * (M-1) % MOD

    for i in range(K+1):
        ans += powtable[N-i-1] * cmb.nCr(i)
        ans %= MOD
    # for i in range(K+1):
    #     ans += M * pow(M-1,N-i-1,MOD) * cmb.nCr(i)
    #     ans %= MOD
    print(ans*M%MOD)

    

if __name__ == '__main__':
    main()

Measured memory_bytes: 111472
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

/**
 * for (int i = 0; i < N; i++) {}
 * System.out.println();
 *
 */
public class Main implements Runnable { //クラス名はMain2

	public static void main(String[] args) {
		Thread.setDefaultUncaughtExceptionHandler((t, e) -> System.exit(1));
		new Thread(null, new Main(), "", 16 * 1024 * 1024).start(); //16MBスタックを確保して実行
	}

	public void run() {
		FastScannerMain2 sc = new FastScannerMain2(System.in);

		try {
			int A = sc.nextInt();
			int B = sc.nextInt();
			int M = sc.nextInt();
			int[] a = new int[A + 1];
			int[] b = new int[B + 1];
			ArrayList<Costs> sums = new ArrayList<>();

			long ans = 0;

			long minA = Long.MAX_VALUE;
			for (int i = 1; i <= A; i++) {
				a[i] = sc.nextInt();
				if (minA > a[i]) {
					minA = a[i];
				}
			}

			long minB = Long.MAX_VALUE;
			for (int i = 1; i <= B; i++) {
				b[i] = sc.nextInt();
				if (minB > b[i]) {
					minB = b[i];
				}
			}

			long min = Long.MAX_VALUE;
			Costs cost = new Costs();
			for (int i = 1; i <= M; i++) {
				cost.x = sc.nextInt();
				cost.y = sc.nextInt();
				cost.cos = sc.nextInt();
				cost.sum = a[cost.x] + b[cost.y] - cost.cos;
				if (min > cost.sum) {
					min = cost.sum;
				}
			}

			if ((minA + minB) > min) {
				System.out.println(min);
			} else {
				System.out.println((minA + minB));
			}

		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}

class Costs {
	int x;
	int y;
	int cos;
	long sum;
}

//高速なScanner
class FastScannerMain2 {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScannerMain2(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

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

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll LINF = 0x3f3f3f3f3f3f3f3f;

int n, m;
vector<pll> lis[200100];
ll ans, arr[200100];
struct lazy_seg {
    ll tree[530000], lazy[530000];
    void init(int s = 0, int e = n+1, int idx = 1) {
        tree[idx] = lazy[idx] = 0;
        if (s==e) return;
        init(s,(s+e)/2,idx*2); init((s+e)/2+1,e,idx*2+1);
    }
    void pd(int idx) {
        tree[idx*2]+=lazy[idx];
        lazy[idx*2]+=lazy[idx];
        tree[idx*2+1]+=lazy[idx];
        lazy[idx*2+1]+=lazy[idx];
        lazy[idx]=0;
    }
    void pu(int idx) {
        tree[idx] = max(tree[idx*2],tree[idx*2+1]);
    }
    void upd(int S, int E, ll val, int s = 0, int e = n+1, int idx = 1) {
        if (e<S||E<s) return;
        if (S<=s&&e<=E) {
            tree[idx]+=val;
            lazy[idx]+=val;
            return;
        }
        pd(idx);
        upd(S,E,val,s,(s+e)/2,idx*2);
        upd(S,E,val,(s+e)/2+1,e,idx*2+1);
        pu(idx);
    }
    ll getv(int S, int E, int s = 0, int e = n+1, int idx = 1) {
        if (e<S||E<s) return -LINF;
        if (S<=s&&e<=E) return tree[idx];
        pd(idx);
        return max(getv(S,E,s,(s+e)/2,idx*2),getv(S,E,(s+e)/2+1,e,idx*2+1));
    }
} lst;

int main() {
    int i;

    scanf("%d%d",&n,&m);
    for (i=0;i<m;i++) {
        int l, r; ll v;
        scanf("%d%d%lld",&l,&r,&v); ans += v;
        lis[r+1].emplace_back(-v,l+1);
    }
    lst.init();
    for (i=2;i<=n+1;i++) {
        for (pll &tmp : lis[i]) lst.upd(0,tmp.second-2,tmp.first);
        if (i==n+1) {
            printf("%lld\n",ans+lst.getv(0,i-1));
            break;
        }
        lst.upd(i,i,lst.getv(0,i-1));
    }

    return 0;
}


Measured memory_bytes: 20992
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));


		String word = br.readLine();
		int count = 0;
		while(true){
			String sentence = br.readLine();
			
			if(sentence.equals("END_OF_TEXT")){
				break;

			}

			String[] tmpArray = sentence.split("[[^a-z]&&[^A-Z]]");
			
			for(int i = 0; i < tmpArray.length ; i++){
				if(tmpArray[i].equalsIgnoreCase(word)){
					count++;
				}
			}

		}
		
		System.out.println(count);

//
//			if(Character.isLowerCase(c)){
//				System.out.print(Character.toUpperCase(c));
//			}
//
//			else if(Character.isUpperCase(c)){
//				System.out.print(Character.toLowerCase(c));
//			}
//			else {
//				System.out.print(c);
//			}
//		}
//		System.out.println();

//		String[] tmpArray = br.readLine().split(" ");
//		int n = Integer.parseInt(tmpArray[0]);
//		int m = Integer.parseInt(tmpArray[1]);
//		int l = Integer.parseInt(tmpArray[2]);
//
//		long[][] a = new long[n][m];
//		long[][] b = new long[m][l];
//		long[][] c = new long[n][l];
//
//		for(int i = 0; i < n; i ++){
//			tmpArray = br.readLine().split(" ");
//			for(int j = 0; j < m; j++){
//				a[i][j] = Long.parseLong(tmpArray[j]);
//			}
//		}
//
//		for(int i = 0; i < m; i ++){
//			tmpArray = br.readLine().split(" ");
//			for(int j = 0; j < l; j++){
//				b[i][j] = Integer.parseInt(tmpArray[j]);
//			}
//		}
//
//		for(int i = 0; i < n; i++){
//			for(int j = 0; j < l; j++){
//				for(int k = 0; k < m; k++){
//					c[i][j] += a[i][k]*b[k][j];
//				}
//
//				if(j != 0 ){
//					System.out.print(" ");
//				}
//				System.out.print(c[i][j]);
//			}
//			System.out.println();
//		}


	}

}

Measured memory_bytes: 24524