akhauriyash/Code-Regression huggingface dataset:
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
// #define mp make_pair
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'
// #define int ll
vector<ll> ft(1, 1LL);

/*======================================================================*/
vector<int> graph[100005];
int arr[100005];
void solve(){
    int n, m;
    cin >> n >> m;
    rep(i, 0, n)cin >> arr[i+1];
    rep(i, 0, m){int node1, node2;cin >> node1 >> node2;graph[node1].pb(node2), graph[node2].pb(node1);}
   int ans = 0;
    rep(i, 1, n+1){
        int h = arr[i], f = 1;
        for(auto child : graph[i])if(arr[child] >= h)f = 0;
        ans += f;
    }
    cout << ans;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
int n,a[110],ans;
bool check(int a,int b,int c){
	if(a+b>c && a+c>b && b+c>a) return true;
	return false;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n-2;i++)
	    for(int j=i+1;j<=n-1;j++)
	        for(int k=j+1;k<=n;k++)
	            if(a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k] && check(a[i],a[j],a[k]))
	                ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3592
#include<map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>

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

ll const MAX = 1000006;
ll d[MAX];
long long const MOD = 1000000007;
long long mod_m(long long x, long long y) {
	return x * y % MOD;
}
long long mod_p(long long x, long long y) {
	return (x + y) % MOD;
}

//ax+by = (gcd of x and y)となるようにa,bを変更する
long long extgcd(long long x, long long y, long long &a, long long &b) {
	if (y == 0) {
		a = 1; b = 0;
		return x;
	}
	else {
		long long q = x / y; long long r = x % y;
		long long s;
		long long d = extgcd(y, r, s, a);
		b = s - a * q;
		return d;
	}
}

long long mod_inverse(long long x) {
	x %= MOD;
	long long a, b;
	a = b = 0;
	if (extgcd(x, MOD, a, b) != 1) {
		return -1;
	}
	else {
		return (MOD + a % MOD) % MOD;
	}
}
//階乗をここに記憶
long long mod_fact[MAX];
long long mod_inv_fact[MAX];

void prep_fact(long long n) {
	mod_fact[0] = 1;
	for (long long i = 1; i <= n; i++) {
		mod_fact[i] = (mod_fact[i - 1] * i) % MOD;
	}
}
void prep_inv(long long n) {
	for (long long i = 0; i <= n; i++) {
		mod_inv_fact[i] = mod_inverse(mod_fact[i]);
	}
}

long long nCr(long long n, long long r) {
	if (r<0 || r>n || n < 0) {
		return 0;
	}
	return (((mod_fact[n] * mod_inv_fact[r]) % MOD)*mod_inv_fact[n - r]) % MOD;
}

void prep_d(ll n) {
	REP(k, 0, n) {
		if (n - k - 1 < 0) {
			d[k] = 0;
		}
		else {
			d[k] = nCr(k - 1, n - k - 1) * mod_fact[k] % MOD*mod_fact[n - k - 1] % MOD;
		}
	}
}

int main() {
	ll n;
	cin >> n;
	prep_fact(MAX - 1);
	prep_inv(MAX - 1);
	prep_d(n);
	ll cnt = 0;
	REP(k, 1, n-1) {
		cnt = mod_p(cnt, mod_m(k, mod_p(MOD, d[k] - d[k - 1])));
	}
	cout << cnt << endl;
}

Measured memory_bytes: 23680
#include<iostream>
#include<string>
int a[40],n;
int haiku(int);
using namespace std;
int main(){
  while(1){
    string x;
    cin >> n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin >> x;
      a[i]=x.size();
    }
    int f;
    for(int i=0;i<n;i++){
      f=haiku(i);
      if(f==1){
	cout << i+1 << endl;
	break;
      }
    }
  }
  return 0;
}
int haiku(int x){
  int c=0,c2=0;
  for(int i=x;i<n;i++){
    c+=a[i];
    if(c2==0||c2==2){
      if(c<5)continue;
      else if(c==5){
	c=0;
	c2++;
	continue;
      }
      else return 0;
    }
    else{
      if(c<7)continue;
      if(c==7){
	c=0;
	c2++;
	if(c2==5)return 1;
	continue;
      }
      else return 0;
    }
  }
  return 0;
}
      

Measured memory_bytes: 3180
#include <iostream>
#include<time.h>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
#include<cctype>
#include<iterator>
#include<unordered_map>
#include <cassert>
#include <bit>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define greater greater<int>()
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
using Edge=pair<int,ll>;
using Graph=vector<vector<ll> >;//ll or Edge
using Edge=pair<int,ll>;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// g++ -o a a.cpp -Wall -lm -std=c++17
int main(){
    int n;cin>>n;
    cout<<1000*((n-1)/1000+1)-n<<endl;
}

Measured memory_bytes: 3608
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

void solve() {
	int n, m; cin >> n >> m;
    if(n == m) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	vector<int> A(N);
	vector<int> B(M);
	int res = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	map<int, int> mp;
	for (int i = 0; i < M; i++) {
		cin >> B[i];
		mp[B[i]]++;
	}
	vector<int> X(200005, 0);

	for (auto m : mp) {
		int a = m.first;
		int b = m.second;
		int ab = a * b;
		X[0] += b;
		for (int i = a; i < X.size(); i+= a) {
			X[i - 1] += -ab;
			X[i] += ab;
		}



	}
	for (int i = 1; i < X.size(); i++) {
		X[i] += X[i - 1];
	}
	for (int i = 1; i < X.size(); i++) {
		X[i] += X[i - 1];
	}
	/*for (int i = 0; i < 30; i++) {
		cerr << X[i] << " ";
	}
	cerr << endl;*/
	for (int i = 0; i < N; i++) {
		res += X[A[i] - 1];
	}
	cout << res << endl;
}


Measured memory_bytes: 19560
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] ABK = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            List<long> check = new List<long>();
            //AからB

            if(ABK[1] - ABK[0] < ABK[2] * 2)
            {
                for (long j = ABK[0]; j <= ABK[1]; j++)
                {
                        Console.WriteLine(j);
                }
                return;
            }
            for (long j = ABK[0];j < ABK[0] + ABK[2]; j++)
            {
                Console.WriteLine(j);
            }
            for (long j = ABK[1] - ABK[2] + 1;j <= ABK[1]; j++)
            {
                Console.WriteLine(j);
            }
            return;
            for (long j = ABK[0]; j <= ABK[1]; j++)
            {
                if(j < ABK[0] + ABK[2] || ABK[1] - ABK[2] < j)
                {
                    Console.WriteLine(j);
                }

                //check.Add(j);
            }
            return;
            for(int z = 0; z < check.Count; z++)
            {
                if(z < ABK[2])
                {
                    Console.WriteLine(check[z]);
                }
                else if(check.Count - ABK[2] <= z)
                {
                    Console.WriteLine(check[z]);
                }
            }
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


Measured memory_bytes: 28244
#include <iostream>
#include <algorithm>
#define INF 1e9+7
using namespace std;
typedef long long int ll;

int main() {

	char c[1001];
	char ans[1001];
	int w;
	int count = 0;
	cin >> c >> w;

	if (w == 1) {
		cout << c << endl; 
		return 0;
	}

	int a = 0;

	for (int i = 0; c[i] != '\0'; i++) {
		a++;
	}

	int p = 0;

	while (p <= a) {
		ans[count] = c[p];
		ans[count + 1] = '\0';
		count++;
		p = p + w;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int b=scan.nextInt();
long min=1000000,max=-10000000,sum=0;
for(int a=0;a<b;a++){
int c=scan.nextInt();
if(min>c)
min=c;
if(max<c)
max=c;
sum=sum+c;
}
System.out.println(min+" "+max+" "+sum);
}
}

Measured memory_bytes: 41004
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    int a[n];
    for(int i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    sort(a, a + n);
    int x, y;
    x = a[n-1];
    int z = 1000000000;
    for(int i = 0; i < n-1; i++){
        int dis;
        if (x / 2 >= a[i]){
            dis = x / 2 - a[i];
        }else {
            dis = a[i] - ((x + 1) / 2);
        }
        if (z > dis){
            z = dis;
            y = a[i];
        }
    }
    printf("%d %d\n", x, y);
    
}

Measured memory_bytes: 512
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val q = sc.nextInt()
  val s = sc.next()
  val lr = (1..q).map { Pair(sc.nextInt(), sc.nextInt()) }

  
  val t = Array(n) { 0 }
  for (i in 0 until n-1) {
    val s1 = s[i]
    val s2 = s[i+1]
    t[i + 1] = t[i] + if (s1 == 'A' && s2 == 'C') { 1 } else { 0 }
  }

  val list = mutableListOf<Int>()
  for (lri in lr) {
    val l = lri.first
    val r = lri.second
    val ti = t[r-1] - t[l-1]
    list.add(ti)
  }

  println(list.joinToString("\n"))

}


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

ss = []
ts = []
for i in range(N):
    s, t = input().split()
    t = int(t)
    ss.append(s)
    ts.append(t)

X = input()
for idx, s in enumerate(ss):
    if s == X:
        last = idx
    
print(sum(ts[last+1:]))

Measured memory_bytes: 3316
def main16():
    buf = input("");
    bufs = buf.split();
    hai = [];
    for i in range(len(bufs)):
        hai.append(int(bufs[i]));
    if hai[0] + hai[1] < hai[2]:
        print("NO");
    elif hai[0] > hai[2]:
        print("NO");
    else:
        print("YES");



if __name__ == '__main__':
    main16()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long int i64;
#define SZ(v) (int((v).size()))
#define ALL(vec) (vec).begin(),(vec).end()
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
 
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(__attribute__((unused)) istream_iterator<string> it) {}
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << a << endl; err(++it, args...); }
template<typename T1,typename T2> ostream& operator<<(ostream& os, pair<T1,T2>& buf) {
  return os << "(" << buf.first << ": " << buf.second << ")"; }
#define DefOut(Con) template<typename T>ostream&operator<<(ostream&os,Con<T>&A){ bool f = false; os << "{"; \
  for (auto &e: A) { if (f) os << ", "; os << e; f = true; } return os << "}"; }
#define DefOut2(Con) template<typename K,typename V>ostream&operator<<(ostream&os,Con<K,V>&A) \
{ bool f = false; os << "{"; for (auto &e: A) { if (f) os << ", "; os << e; f = true; } return os << "}"; }
template<typename T>ostream &operator << (ostream &os,vector<vector<T>>& A) {
  for (auto &B: A) os << '\n' << B; return os; }
DefOut(vector) DefOut(set) DefOut(multiset) DefOut2(map) 
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1000000007;
long long const INF = 1e18;
#define PI 3.14159265358979323846
/***********************************************************************/


int32_t main() {

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, m;
  cin >> n >> m;
  if (m == 0) {
    for (int i = 0; i < (1 << n); ++i) {
      cout << i << ' ' << i << ' ';
    }
    return 0;
  }
  if (m >= (1 << n)) {
    cout << -1;
    return 0;
  }
  int xr = 0;
  vector<int> ans;
  for (int i = 0; i < (1 << n); ++i) {
    if (i != m) {
      ans.push_back(i);
      xr ^= i;
    }
  }
  if (xr != m) {
    cout << -1;
    return 0;
  }
  for (int i: ans) cout << i << ' ';
  cout << m << ' ';
  reverse(ALL(ans));
  for (int i: ans) cout << i << ' ';
  cout << m << ' ';
  
  return 0;
}


Measured memory_bytes: 2552
#include <bits/stdc++.h>
#ifdef tester
    #include "prettyprint.hpp"
#endif
using namespace std;

#define hell 1000000007
#define ll long long
#define all(C) begin(C),end(C)
#define tr(C,it,cond) for(auto it = begin(C); cond and it!=end(C); ++it)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pb push_back
#define hash unordered_map
#define vi vector<ll>
#define pii pair<ll,ll>
#define index(V, ele) distance(V.begin(), find(all(V), ele))
#define N 100005

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

ll t,n,k,m,q;
string s;

// vim cli: !g++ -Dtester sol.cpp ; ./a.out ; rm a.out
int main() {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.precision(20);

    cin >> n;
    if (n==3 or n==5 or n==7)
        cout << "YES";
    else
        cout << "NO";
    // whats(t,v);
    return 0;
}

Measured memory_bytes: 256
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 100000

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

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

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

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int n;
int p[MAX];

int main() {
    cin >> n;
    REP(i, n) {
        cin >> p[i];
    }    

    int counter = 0;
    for(int i = 1;i<(n-1);i++) {
        set<int> s;
        s.insert(p[i-1]);
        s.insert(p[i]);
        s.insert(p[i+1]);
        auto itr = s.begin();
        itr++;
        if(*itr==p[i]) {
            counter++;
        }
    }

    cout << counter << endl;
    return 0;
}


Measured memory_bytes: 256
S = list(input())

for i in range(len(S)):
	temp = S[i]
	if((i+1) % 2 == 0): # 偶数文字目の時
		if(temp == 'R'): # 踏みにくい文字であった場合
			print('No')
			exit(0)
	else: # 奇数文字目の時
		if(temp == 'L'): # 踏みにくい文字であった場合
			print('No')
			exit(0)
print('Yes')

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

int main() {
  	long n;
  	cin >> n;
  	if(n%1000==0){
      cout << -0 << endl;
    }
  	else{
  	cout << 1000-n%1000 << endl;
    }
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  int N = 0;
  cin >> A >> B;
  for(int i=A ; i<B+1 ; i++){
    if(i/10000==i%10 && (i%10000)/1000==(i%100)/10) N++;
  }
  cout<<N<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
long long  mod = 1000000007;
int main()
{
	int X, A, B;
	scanf("%d%d%d", &X, &A, &B);
	X -= A;
	while (X >= B) {
		X -= B;
	}
	printf("%d", X);
	return 0;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    string s;
    cin >> s;

    // 処理
    // 出力
    sort(all(s));
    cout << (s == "abc" ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
using namespace std;

#include <iostream>
#include <vector>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <utility>
#include <algorithm>
#include <cstring>
#include <unordered_map>
#include <fstream>
#include <bits/stdc++.h>

typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair <string, string> pss;
typedef vector <pii> vpii;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector <string> vs;
typedef set<int> si;
typedef set<long long> sll;
typedef long long ll;
typedef tuple<int, int, int> tiii;
typedef tuple<char, int, int> tcii;
typedef tuple<string, string, int> tssi;
typedef tuple<string, int, int> tsii;
#define sz(arr) sizeof(arr)/sizeof(arr[0])
#define mmset(arr, hi) memset(arr, hi, sizeof(arr))
#define FOR(x, y, z) for (int x=y; x<z; x++)
#define F0R(x, z) for (int x=0; x<z; x++)

/*************************** END OF TEMPLATE ****************************/

int main() {
    long long N, K;
    cin >> N >> K;
    cout << min(N%K, abs(K-N%K));
}

Measured memory_bytes: 384
object Main{
  def main(args: Array[String]): Unit = {
    val in = new java.util.Scanner(System.in)
    val a = in.nextInt
    val b = in.nextInt
    val c = in.nextInt
    var count =0
    for(i <- a to b){
      if(c%i == 0) count+=1
    }
    println(count)
  }
}

Measured memory_bytes: 45032
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  vector<int> v(3);
  rep(snip_i, 3) cin >> v.at(snip_i);
  sort(v.begin(), v.end());
  int ans = 0;
  while(1){
    if(v.at(1) < v.at(2)){
      v.at(0)++;
      v.at(1)++;
      ans++;
    }else if(v.at(0) <v.at(1)){
      v.at(0) += 2;
      ans++;
      if(v.at(0)> v.at(1)){
        ans++;
        cout << ans << endl;
        return 0;
      }
    }else{
      cout << ans << endl;
      return 0;
    }
  }
  return 0;
}

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

int main(void){
  int n;
  while(cin >> n, n){
    vector< vector<double> > s(n, vector<double>(3));
    REP(i, n){
      REP(j, 3){
        cin >> s[i][j];
      }
    }
    int m;
    cin >> m;
    vector< vector<double> > t(m, vector<double>(4));
    REP(i, m){
      REP(j, 4){
        cin >> t[i][j];
      }
    }

    int ans = 0;
    REP(i, n){
      REP(j, m){
        double sx = s[i][0];
        double sy = s[i][1];
        double sz = s[i][2];
        double tx = t[j][0];
        double ty = t[j][1];
        double tz = t[j][2];
        double tt = t[j][3];
        double len_s = pow(sx*sx + sy*sy + sz*sz,0.5);
        double len_t = pow(tx*tx + ty*ty + tz*tz,0.5);
        double costheta = (sx*tx + sy*ty + sz*tz) / (len_s * len_t);
        double theta = acos(costheta);
        if(theta < tt){
          ans++;
          break;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1444
#include<cstdio>
#include<iostream> 
#include<string>
#include<stack>
#include<utility>

using namespace std;

int main(void){

	string ans;
	char inp;
	
	stack<pair<char,int> > tree1,tree2;
	string oper;

	while(cin>>oper){
		inp=getchar();
		while(1){
			inp=getchar();
			if(inp==' ') break;
			switch(inp){
			case '(':
				if(tree1.empty()) tree1.push(pair<char,int>(inp,0));
				else tree1.push(pair<char,int>(inp,tree1.top().second +1));
				break;
			case ')':
				tree1.push(pair<char,int>(inp,tree1.top().second -1));
				break;
			case ',':
				tree1.push(pair<char,int>(inp,tree1.top().second));
				break;
			}
		}
		while(1){
			inp=getchar();
			if(inp=='\n') break;
			switch(inp){
			case '(':
				if(tree2.empty()) tree2.push(pair<char,int>(inp,0));
				else tree2.push(pair<char,int>(inp,tree2.top().second +1));
				break;
			case ')':
				tree2.push(pair<char,int>(inp,tree2.top().second -1));
				break;
			case ',':
				tree2.push(pair<char,int>(inp,tree2.top().second));
				break;
			}
		}
		ans=")";
		tree1.pop(),tree2.pop();
		while(!tree1.empty()&&!tree2.empty()){
			if(tree1.top().second==tree2.top().second){
				if(tree1.top().first==tree2.top().first){
					ans+=tree1.top().first;
					tree1.pop(),tree2.pop();
				}
				else if(tree1.top().first=='('&&tree2.top().first==')'){
					if(oper=="u") ans+=tree2.top().first;
					tree2.pop();
				}
				else if(tree1.top().first==')'&&tree2.top().first=='('){
					if(oper=="u") ans+=tree1.top().first;
					tree1.pop();
				}
				else if(tree1.top().first==','){
					if(oper=="u") ans+=tree2.top().first;
					tree2.pop();
				}
				else{
					if(oper=="u") ans+=tree1.top().first;
					tree1.pop();
				}
			}
			else if(tree1.top().second>tree2.top().second){
				if(oper=="u") ans+=tree1.top().first;
				tree1.pop();
			}
			else{
				if(oper=="u") ans+=tree2.top().first;
				tree2.pop();
			}
		}
		for(int i=ans.length()-1;i>=0;i--){
			cout<<ans[i];
		}
		cout<<endl;
	}
	
    return 0;
}

Measured memory_bytes: 1192
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	int c = a + b;
	if (c % 2 == 0) cout << c / 2 << endl;
	else cout << "IMPOSSIBLE" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
using namespace std;

int main() {
	//cout << fixed << setprecision(10);
	long long int n, m,x[200000],y[200000],ball[200000],possible[200000]={},result=0;
	string str;
	cin >> n>>m;
	possible[1]=1;
	for(int i=1;i<=n;i++)
	{
		ball[i]=1;
	}
	
	for(int i=1;i<=m;i++)
	{
		cin>>x[i]>>y[i];
		ball[x[i]]--;
		ball[y[i]]++;
		if(possible[x[i]]==1)
		{
			possible[y[i]]=1;
		}
		if(ball[x[i]]==0)
		{
			possible[x[i]]=0;
		}
	}
	
	for(int i=1;i<=n;i++)
	{
		if(possible[i]==1)
		{
			result++;
		}
	}
	cout<<result;
}


Measured memory_bytes: 6528
import math
n = int(input())
x = [int(i) for i in input().split()]
ls1 = []
ls2 = []
mx = sum(x)/n
if math.ceil(mx) == math.floor(mx):
    for i in range(n):
        ls1.append((x[i]-mx)**2)
    print(int(sum(ls1)))
else:
    l = math.floor(mx)
    m = math.ceil(mx)
    for i in range(n):
        ls1.append((x[i]-l)**2)
        ls2.append((x[i]-m)**2)
    print(int(min(sum(ls1),sum(ls2))))


Measured memory_bytes: 38384
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]
def init_dp1(init, N): return [init for _ in range(N)]
def init_dp2(init, N, M): return [[init for _ in range(M)] for _ in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    A, B, C, D = read_values()

    while True:
        C -= B
        if C <= 0:
            print("Yes")
            return
        
        A -= D
        if A <= 0:
            print("No")
            return


if __name__ == "__main__":
    main()


Measured memory_bytes: 9868
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main()
{
  string a;
  long long  sum=0,n;
    cin>>a;
  n=a.length();
  for(int i=0;i<n;i++)
  {
   sum=sum+( a[i]-'0');  
    
  }
  //cout<<sum<<endl;
if(sum%9==0)
  cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}


Measured memory_bytes: 3716
#pragma comment(linker, "/STACK: 1024000000,1024000000")
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pii pair<int,int>
#define de(x) cout << #x << " = " << x << endl
#define dd(x) cout << #x << " = " << x << " " << endl
#define clr(a,b) memset(a,b,sizeof(a))
#define INF (0x3f3f3f3f)
#define LINF ((long long)(0x3f3f3f3f3f3f3f3f))
#define F first
#define S second
using namespace std;

const int N = 1e5 + 15;
typedef long long ll;
ll a[N], b[N], ans;

int main() {
	ans = 0;
	int n;
	scanf("%d", &n);
	for ( int i = 1; i <= n+1; i ++ )
		scanf("%lld", &a[i]);
	for ( int i = 1; i <= n; i ++ )
		scanf("%lld", &b[i]);
	
	for ( int i = 1; i <= n; i ++ ) {
		if ( b[i] >= a[i] ) {
			ans += a[i];
			b[i] -= a[i];
			a[i] = 0;
		}
		else {
			ans += b[i];
			b[i] = 0;
			a[i] -= b[i];
		}
		if ( b[i] >= a[i+1] ) {
			ans += a[i+1];
			b[i] -= a[i+1];
			a[i+1] = 0;
		}
		else if ( b[i] < a[i+1] ) {
			ans += b[i];
			a[i+1] -= b[i];
			b[i] = 0;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/ruby
require 'mathn'
h={};2.step(36){|i|h[i]=i.prime_division}
while(l=gets.split)!=["0","0"]	
	n=l[0].to_i;m=l[1].to_i(n)
	if n==0 then break end
	x=99999999999999999999
	h[n].each{|a,b|
		z=m;r=0
		while z>0 do r+=(z=z.div a) end
		x=[x,r.div(b)].min
	}
	p x
end

Measured memory_bytes: 3744
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,x,cnt=0,ans=0,v;
  cin >> n >> x;
  ll a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a,a+n);
  for(int i=0;i<n;i++){
    v=x;
    cnt = 0;
    for(int j=0;j<n;j++){
      if(i==j) continue;
      if(v>=a[j]){
        v-=a[j];
        cnt++;
      }
    }
    if(v==a[i]) cnt++;
    ans = max(cnt,ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
word_list = [input() for i in range(N)]
#print(word_list)

for i in range(1,N):
	if word_list[i] in word_list[:i] or word_list[i-1][-1] != word_list[i][0]:
		print("No")
		break
else:
	print("Yes")

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

int main()
{
  int n,i;
  scanf("%d",&n);
 // vector<string>v;
  int ac=0,wa=0,tle=0,re=0;
  for(i=0;i<n;i++)
  {
    string temp;
    cin>>temp;
    if(temp=="AC")
    {
      ac++;
    }
    else if(temp=="WA")
    {
      wa++;
    }
    else if(temp=="TLE")
    {
      tle++;
    }
    else
    {
      re++;
    }
  }
  printf("AC x %d\n",ac);
  printf("WA x %d\n",wa);
  printf("TLE x %d\n",tle);
  printf("RE x %d\n",re);
}


Measured memory_bytes: 3752
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
long long dig(long long x)
{
	int ans=0;
	while(x){ans+=x%10;x/=10;}
	return ans;
}
double a[101000000];
long long ans[10100000],tot=0;
int main()
{
	ans[1]=1;ans[2]=2;ans[3]=3;ans[4]=4;ans[5]=5;ans[6]=6;ans[7]=7;ans[8]=8;ans[9]=9;
	ans[10]=19;ans[11]=29;ans[12]=39;ans[13]=49;ans[14]=59;ans[15]=69;ans[16]=79;ans[17]=89;ans[18]=99;
	ans[19]=199;ans[20]=299;ans[21]=399;ans[22]=499;ans[23]=599;ans[24]=699;ans[25]=799;ans[26]=899;ans[27]=999;
	int tot=27;
	for(int i=0;i<=999;i++)
	{
		long long w=1;
		for(int j=0;j<=12;j++,w*=10)
		{
			long long k=i*w+(w-1);if(k==0)break;
			bool ok=0;
			for(int a=0;a<=999;a++)
			{
				long long W=1;
				for(int b=0;b<=13;b++,W*=10)
				{
					long long K=a*W+(W-1);//cout<<K<<' '<<k<<endl;
					if(K<=k)continue;
					if(1.0*K/dig(K)<1.0*k/dig(k)){ok=1;break;}
				}
				if(ok)break;
			}
			if(!ok)ans[++tot]=k;
		}
	}
	sort(ans+1,ans+tot+1);tot=unique(ans+1,ans+tot+1)-ans-1;
	int k;scanf("%d",&k);
	for(int i=1;i<=k;i++)printf("%lld\n",ans[i]);return 0;
	/*
	for(int i=1;i<=100000000;i++)
	{
		a[i]=1.0*i/dig(i);
	//	cout<<i<<' '<<dig(i)<<' '<<1.0*i/dig(i)<<endl;
	}
	for(int i=1;i<=100000000;i++)
	{
		bool ok=0;
		for(int j=i+1;j<=100000000;j++)if(a[j]<a[i]){ok=1;break;}
		if(!ok)cout<<i<<endl;
	}*/
	
}

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

int distance(short ax, short ay, short bx, short by);

int X[100];
int Y[100];
int H[100];

int main(){
	short i;
	short is;
	short N;
	if(scanf("%d", &N));
	short A = -1;
	for(i=0; i<N; i++){
	if(scanf("%d%d%d", &X[i], &Y[i], &H[i]));
		if(A==-1 && H[i]!=0){A=i;}
	}
	short CX=0, CY=0;
	int CH=0;
	for(CX=0; CX<=100; CX++){
		for(CY=0; CY<=100; CY++){
			CH = H[A]+distance(CX, CY, X[A], Y[A]);
			is = 1;
			for(i=0; i<N; i++){
				if(H[i] == 0){
					if(distance(CX, CY, X[i], Y[i]) < CH){
						is = 0;
						break;
					}
				}else{
					if(H[i]+distance(CX, CY, X[i], Y[i]) != CH){
						is = 0;
						break;
					}
				}
			}
			if(is){break;}
		}
		if(is){break;}
	}
	printf("%d %d %d\n", CX, CY, CH);
	return 0;
}

int distance(short ax, short ay, short bx, short by){
	return (ax>bx?ax-bx:bx-ax)+(ay>by?ay-by:by-ay);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
//#define ivorysi
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define MAXN 300005
using namespace std;
typedef long long int64;
typedef double db;
typedef unsigned int u32;
template<class T>

void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9' ) {
		res = res * 10 - '0' + c;
		c = getchar();
	}
	res *= f;
}

template<class T>

void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}

int N,A,B;
int cnt[MAXN];

void Solve() {
	read(N);read(A);read(B);
	int d = (N - 1) / A + 1,u = N - A + 1;
	if(B > u || B < d) {puts("-1");return;}
	cnt[1] = A;
	int t = N - A;
	for(int i = 2 ; i <= B ; ++i) {
		cnt[i] = t - A >= B - i ? A : t - (B - i);
		t -= cnt[i];
	}
	t = N;
	for(int i = B ; i >= 1 ; --i) {
		for(int j = t - cnt[i] + 1 ; j <= t ; ++j) {
			out(j);space;
		}
		t -= cnt[i];
	}
	enter;
}

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

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e2 + 5;
const int INF = 1e9 + 7;

int a;
double b;

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> a >> b;
	int c = round(b * 100);
	int ans = a * c;
	ans /= 100;
	cout << ans;
	return 0;
}
//10-09-2020 18:48:49

Measured memory_bytes: 3732
using System;
using System.Collections.Generic;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("3");
            WillReturn.Add("())");
            //(())
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("6");
            WillReturn.Add(")))())");
            //(((()))())
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("8");
            WillReturn.Add("))))((((");
            //(((())))(((())))
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        string S = InputList[1];

        int PutFirst = 0;
        int StackCnt = 0;
        foreach (char EachChar in S) {
            if (EachChar == '(') {
                StackCnt++;
            }
            if (EachChar == ')') {
                if (StackCnt == 0) PutFirst++;
                else StackCnt--;
            }
        }

        var Answer = new System.Text.StringBuilder();
        if (PutFirst > 0) Answer.Append(new string('(', PutFirst));
        Answer.Append(S);
        if (StackCnt > 0) Answer.Append(new string(')', StackCnt));
        Console.WriteLine(Answer.ToString());
    }
}


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

using namespace std;

long long a, b, c;

int main(){
//	freopen("input.inp", "r", stdin);
	scanf("%d%d%d",&a,&b,&c);
	if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) printf("0");
	else{
		if (a > b) swap(a, b);
		if (a > c) swap(a, c);
		if (b > c) swap(b, c);
		printf("%lld",1ll * a * b);
	}
	return 0;
}

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

int n, m;
bool ac[100005];
int p[100005];
int a, ps;

int main() {
  cin >> n >> m;
  for (int i = 0;i<m;i++) {
    int id;
    string s;
    cin >> id;
    cin >> s;
    
    if (ac[id]) continue;
    
    if (s=="AC") ac[id]=true;
    else p[id]++;
    
    }
  
  for (int i=0;i<=n;i++){
    if (ac[i]){
      a++;
      ps+=p[i];
      }
    }
  
  cout<<a<<' '<<ps<<endl;}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
bool pd(int x){
    int ans=1;
    for (int i=2;i<=floor(sqrt(x));i++)
        if (x%i==0) ans++;
    if (ans==4) return true; else return false;
}
int main(){
    int n;
    scanf("%d",&n);
    int sum=0;
    for (int i=2;i<=n;i++)
        if (pd(i)&&i&1){
            sum++;
        }
    printf("%d\n",sum);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
typedef long long ll;
typedef pair<ll,ll> PP;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false

class matrix{
    public:
    int ROW,COL;
    vector<vector<int>> value;
    
    matrix(int col,int row){
        COL = col;
        ROW = row;
        value.resize(col);
        for(int i=0;i<col;i++){
            value[i].resize(row);
            for(int j=0;j<row;j++){
                value[i][j]=0;
            }
        }
    }
    
	vector<int>& operator [] (int worm){
		return value[worm];
	}
	
    
    friend ostream& operator<<(ostream& os, const matrix& out);
    
    matrix operator*(matrix X){
        matrix R(this->COL,X.ROW);
        if(this->ROW != X.COL){
            return R;
        }
        for(int i=0;i<this->COL;i++){
            for(int j=0;j<X.ROW;j++){
                for(int k=0;k<this->ROW;k++){
                    R.value[i][j]+=this->value[i][k]*X.value[k][j];
                    R.value[i][j]%=MOD;
                }
            }
        }
        return R;
    }
    
    matrix operator%(int mod){
        for(int i=0;i<(this->COL);i++){
            for(int j=0;j<(this->ROW);j++){
                value[i][j]=(value[i][j]%mod);
            }
        }
        return *this;
    }
};


ostream& operator<<(ostream& os, const matrix& out){
    for(int i=0;i<out.COL;i++){
        for(int j=0;j<out.ROW;j++){
            os << out.value[i][j] << (j==out.ROW-1?"\n":" ");
        }
    }
    return os;
}


//累乗(繰り返し二乗法)
matrix power(matrix b,long long e){
  matrix r(b.COL,b.ROW);
  for(int i=0;i<b.COL;i++){
      r[i][i]=1;
  }
  while(e){
      if(e&1){
          r=(r*b);
      }
      b=(b*b);
      e >>=1;
      r = r%MOD;
      b = b%MOD;
  }
  return r;
}

signed main(void){
    int N,K,a;
    cin >> N >> K;
    matrix A(N,N),R(N,N);
    REP(i,N){
        REP(j,N){
            cin >> a;
            A[i][j]=a;
        }
    }
    
    
    #if debug
    cout << A << endl;
    R = power(A,1);
    cout << R << endl;
    #endif
    
    R = power(A,K);
    
    #if debug
    cout << R << endl;
    #endif
    
    int Ans=0;
    REP(i,N){
        REP(j,N){
            Ans+=R[i][j];
            Ans%=MOD;
        }
    }
    cout << Ans << endl;
    return 0;
}



Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>

using namespace std;
using ll = long long;

// inf
const ll infl = 1LL << 60;
const int inf = 1 << 30;

int main() {
    int N, L; cin >> N >> L;
    int p = N * (2 * L + N - 1) / 2;
    int ans;
    int m = inf;
    for (int i = 1; i <= N; ++i) {
        if (m > abs(L + i - 1)) {
            ans = p - (L + i - 1);
            m = abs(L + i - 1);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
const int maxn=100005;
struct Matrix
{
    long long a[2][2];
};
Matrix mull(Matrix x,Matrix y)
{
    Matrix ans;
    for(int i=0;i<2;i++)
    {
        for(int j=0;j<2;j++)
        {
            ans.a[i][j]=0;
            for(int k=0;k<2;k++)
            {
                ans.a[i][j]=(ans.a[i][j]+x.a[i][k]*y.a[k][j])%mod;
            }
        }
    }
    return ans;
}
long long fib(long long m)
{
    if(m<1) return 0;
    if(m<3) return 1;
    Matrix ans;
    m--;
    for(int i=0;i<2;i++)
    {
        for(int j=0;j<2;j++)
            ans.a[i][j]=(i==j);
    }
    Matrix shit;
    shit.a[0][1]=shit.a[0][0]=shit.a[1][0]=1;
    shit.a[1][1]=0;
    while(m)
    {
        if(m&1) ans=mull(ans,shit);
        shit=mull(shit,shit);m=m>>1;
    }
    return (ans.a[1][0]+ans.a[1][1])%mod;
}
long long fast(long long a,long long num)
{
    long long ans=1;
    while(num){
        if(num&1) ans=ans*a%mod;
        a=a*a%mod;
        num=num>>1;
    }
    return ans;
}
int main()
{
    int n;
    long long m;
    scanf("%d%lld",&n,&m);
    if(n==1){
        printf("%lld\n",fib(m));
        return 0;
    }
    int k=n-2;
    long long tmp=1;
    long long sum=fib(2*k+2);
    for(int i=1;i<=k;i++)
    {
        tmp=(m+i-1)%mod*tmp%mod*fast(i,mod-2)%mod;
        sum=sum+tmp*fib(2*k+2-2*i)%mod;
        sum=sum%mod;
    }
    sum=fib(m+2*k+2)-sum;
    sum=(sum%mod+mod)%mod;
    printf("%lld\n",sum);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
#include <random>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int main() {

    string s; cin >> s;
    if(s[0] == s[2]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
h,w,K=map(int,input().split())
mod=10**9+7
dp=[[0 for i in range(w)] for j in range(h+1)]
for i in range(2**(w-1)):dp[0][0]=1
for i in range(1,h+1):
    for j in range(2**(w-1)):
        s=format(j,"b").zfill(w-1)
        if "11" in s:continue
        exchanged=[False]*w
        for k in range(w-1):
            if s[k]=="1":
                dp[i][k]+=dp[i-1][k+1]
                dp[i][k+1]+=dp[i-1][k]
                dp[i][k]%=mod
                dp[i][k+1]%=mod
                exchanged[k]=True
                exchanged[k+1]=True
        for k in range(w):
            if exchanged[k]:continue
            dp[i][k]+=dp[i-1][k]
            dp[i][k]%=mod

print(dp[-1][K-1])

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

using ll = long long;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN_LL(v) ll v;cin>>v;
#define OUT(v) cout<<v<<endl

ll count(ll n, int d) {
  if (n <= 0)
    return 0;
  return n/(1LL<<d)*(1LL<<(d-1)) + max(0LL, n%(1LL<<d)-(1LL<<(d-1))+1);
}
int main() {
  IN_LL(A); IN_LL(B);

  ll sum = B;
  ll ans = 0;
  ll D = 1LL;
  FOR(d, 1, 64) {
    if ((count(B, d) - count(A-1, d)) % 2 == 1)
      ans += D;
    D *= 2LL;
  }
  OUT(ans);

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int d;
    cin>>d;
    
    if(d==25){
        cout<<"Christmas"<<endl;
    }else if(d==24){
        cout<<"Christmas Eve"<<endl;
    }else if(d==23){
        cout<<"Christmas Eve Eve"<<endl;
    }else{
        cout<<"Christmas Eve Eve Eve"<<endl;
    }
}


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

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

    int ans = h[0];
    for(int i = 1; i < N; i++)
        ans += max(0, h[i] - h[i-1]);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n ; cin >> n;
    cout << "pphbhhphph"[n % 10] << "on\n";
    return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>

int main(void){
	int n, x, y, h, w, l, m;
	while(1){
		scanf("%d", &n);
		if(!n) break;
		m = 0;
		while(n--){
			scanf("%d %d %d %d", &x, &y, &h, &w);
			l = x + y + h;
			if(l>160 || w>25) continue;
			else if(l>140 || w>20) m += 1600;
			else if(l>120 || w>15) m += 1400;
			else if(l>100 || w>10) m += 1200;
			else if(l>80 || w>5) m += 1000;
			else if(l>60 || w>2) m += 800;
			else m += 600;
		}
		printf("%d\n", m);
	}
	return 0;
}

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


using namespace std;
using ll = long long;

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

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

    ll ans = -1e+18;
    for (int i = 0; i < n; i++) {
        ll v = p[i] - 1;
        ll l = 1;
        ll c_sum = c[i];
        while (v != i) {
            l++;
            c_sum += c[v];
            v = p[v] - 1;
        }
        if (c_sum < 0) c_sum = 0;

        v = p[i] - 1;
        ll sum = 0;
        for (int i = 0; i < l; i++) {
            if (i >= k) break;
            sum += c[v];
            ans = max(ans, c_sum * ((k - i - 1) / l) + sum);
            v = p[v] - 1;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3680
# AOJ 0206: Next Trip
# Python3 2018.6.25 bal4u

while True:
	L = int(input())
	if L == 0: break
	s, k = 0, 0
	for i in range(1, 13):
		m, n = map(int, input().split())
		s += m-n
		if s >= L and k == 0: k = i
	print(k if k > 0 else "NA")


Measured memory_bytes: 5612