akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int ti = clock();
    int d;
    cin >> d;
    vi c(26);
    rep(i, 26) cin >> c[i];
    vector<vi> s(d, vi(26));
    rep(i, d) rep(j, 26) cin >> s[i][j];
    vi last(26), t(d);
    ll sum = 0;
    rep1(i, d) {
        ll cm = 0;
        rep(j, 26) cm += c[j] * (i - last[j]);
        pii m(-INF, -1);
        rep(j, 26) {
            ll sat = s[i-1][j] - cm + c[j] * (i - last[j]);
            m = max(m, {sat, j});
        }
        sum += m.first;
        last[m.second] = i;
        t[i-1] = m.second;
        //cout << (m.second + 1) << endl;
    }
    srand((unsigned)time(NULL));
    while (clock()-ti < CLOCKS_PER_SEC*195/100) {
        int dr = rand() % d + 1, qr = rand() % 26;
        int fq = t[dr-1], tq = qr;
        int td = dr;
        int fl = dr-1, fr = dr+1, tl = dr, tr = dr;
        while (fl > 0) {
            if (t[fl-1] == fq) break;
            --fl;
        }
        while (fr <= d) {
            if (t[fr-1] == fq) break;
            ++fr;
        }
        while (tl > 0) {
            if (t[tl-1] == tq) break;
            --tl;
        }
        while (tr <= d) {
            if (t[tr-1] == tq) break;
            ++tr;
        }
        ll nsum = sum;
        nsum -= s[td-1][fq];
        nsum += (td-fl)*(td-fl-1)*c[fq]/2 + (fr-td)*(fr-td-1)*c[fq]/2;
        nsum -= (fr-fl)*(fr-fl-1)*c[fq]/2;
        nsum += s[td-1][tq];
        nsum -= (td-tl)*(td-tl-1)*c[tq]/2 + (tr-td)*(tr-td-1)*c[tq]/2;
        nsum += (tr-tl)*(tr-tl-1)*c[tq]/2;
        //cout << sum << endl;
        if (nsum >= sum*1.02) t[td-1] = tq;
    }
    rep(i, d) cout << (t[i] + 1) << endl;
    return 0;
}


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

int main() {
 int A, B;
 cin >> A >> B;
 if(A<6){
   cout << 0 << endl;
 }
 else if(A>12){
   cout << B << endl;
 }
 else{
   cout << B/2 << endl;
 }
}

Measured memory_bytes: 3580
if __name__ == '__main__':
    N = int(input())
    W = [str(input()) for _ in range(N)]

    mem = set([W[0]])

    answer = 'Yes'
    for i in range(1, N):
        if len(mem & set([W[i]])) == 0 and W[i-1][-1::] == W[i][0:1:]:
            mem.add(W[i])
        else:
            # print(W[i-1])
            # print(W[i-1][-1::])
            # print(W[i])
            # print(W[i][0:1:])
            # print(mem)
            # print(set([W[i]]))
            # print(len(mem & set(W[i])))
            answer = 'No'
            break
    print(answer)


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

int main()
{
    int n;
    cin >> n;
    int s = 0;
    int t = n;
    while (t != 0) {
        s += t % 10;
        t /= 10;
    }
    if (n % s == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n, m, c = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(n)]
num = 0
for i in range(n):
    d = c
    for j in range(m):
        d += A[i][j]*B[j]
    if d > 0:
        num += 1
print(num)

Measured memory_bytes: 3060
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define f first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,less<int>,
rb_tree_tag,tree_order_statistics_node_update>
ordered_set;
vi v;
int x;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);

#ifndef ONLINE_JUDGE
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
#endif

for(int i=0;i<4;i++){
       cin >> x;
       v.pb(x);
}
sort(all(v));
if(v[0]==1&&v[1]==4&&v[2]==7&&v[3]==9){
       cout << "YES" << endl;
}
else cout << "NO" << endl;






return 0;}
///....


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

int main() {
	int n; cin >> n;
	int A[n];
	for(int i = 0; i < n; i++) {
		cin >> A[i];
	}
		
	int ans = 0;
	bool flag = false;
 
	while(1){
		for(int i = 0; i < n; i++) {
			if(A[i] % 2 == 0) {
				A[i] /= 2;
			}else{
				flag = true;
			}
		}
		if(flag) break;
		ans++;
	}
 
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    string s;
    vi a(4);
    REP(i, n) {
        cin >> s;
        if (s == "AC") a[0]++;
        else if (s == "WA") a[1]++;
        else if (s == "TLE") a[2]++;
        else if (s == "RE") a[3]++;
    }
    cout << "AC x " << a[0] << endl;
    cout << "WA x " << a[1] << endl;
    cout << "TLE x " << a[2] << endl;
    cout << "RE x " << a[3] << endl;
}


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

int main() {
  int n;
  cin>>n;
  int A[n];
  for (int i=0; i<n; i++) {
    cin>>A[i];
  }
  int cnt=0;
  vector<int> G;
  for (int h=1; ; ) {
    if (h>n) {
      break;
    }
    G.push_back(h);
    h=3*h+1;
  }
  for (int i=G.size()-1; i>=0; i--) {
    for (int j=G[i]; j<n; j++) {
      int v=A[j];
      int k=j-G[i];
      while (k>=0 && A[k]>v) {
        A[k+G[i]]=A[k];
        k-=G[i];
        cnt++;
      }
      A[k+G[i]]=v;
    }
  }
  cout<<G.size()<<endl;
  for (int i=G.size()-1; i>=0; i--) {
    cout<<G[i]<<(i==0?"":" ")<<flush;
  }
  cout<<endl;
  cout<<cnt<<endl;
  for (int i=0; i<n; i++) {
    cout<<A[i]<<endl;
  }
  return 0;
}



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

int main() {
  string S;
  cin >> S;

  if (S.size() == 2)
    cout << S << endl;
  else {
    reverse(S.begin(), S.end());
    cout << S << endl;
  }
  return 0;
}

Measured memory_bytes: 3552
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;


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

Measured memory_bytes: 3628
using System;
using System.Linq;

public class Sample17{
    public static void Main(){
        
        while (true){
            string[] side = Console.ReadLine().Trim().Split(' ');
            int h = int.Parse(side[0]);
            int w = int.Parse(side[1]);
          
          //終了処理、バリデーション
            if (h == 0 && w == 0){ 
                break;
            }else if( h < 1 || w < 1 || 300 < h || 300 < w){
                
                Console.WriteLine("入力された値が範囲外です。");
                Environment.Exit(0);
            }
            
            var s = new string('#', w);
            
            for (int i = 0; i < h; i++){
                Console.WriteLine(s);
            }
            Console.WriteLine();

        }
    }    
}



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

int main() {
    int N, Q;
    cin >> N >> Q;
    dsu d(N);
    rep(i, Q) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            d.merge(u, v);
        } else {
            cout << d.same(u, v) ? 1 : 0;
            cout << endl;
        }
    }
}

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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> P(N);
  for(int i=0;i<N;i++) cin >> P[i];
  int ans = N-K+1;
  
  int cnt1=1,cnt2=0;
  for(int i=1;i<N;i++){
    if(P[i]>P[i-1]) cnt1++;
    else{
      if(cnt1>=K) cnt2++;
      cnt1 = 1;
    }
  }
  if(cnt1>=K) cnt2++;
  if(cnt2>=2) ans = ans - cnt2 + 1;
  
  set<int> S;
  for(int i=1;i<K-1;i++) S.insert(P[i]);
  for(int l=1;l<N-K+1;l++){
    S.insert(P[l+K-2]);
    if(P[l-1]<*begin(S) && P[l+K-1]>*rbegin(S)) ans--;
    S.erase(P[l]);
  }
  
  cout << ans << endl;
  return 0;
}


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

using namespace std;

const int maxn = 1e5+10;

int n, m;
vector<int> g[maxn], ch[maxn];
long long int dp[maxn], p[maxn];

void dfs1(int v, int par){
	dp[v] = 1;
	for (int u: g[v]){
		if (u != par)
			ch[v].push_back(u);
	}

	for (int u: ch[v]){
		dfs1(u, v);
		dp[v] = dp[v] * (dp[u] + 1) % m;
	}
}

void dfs2(int v){
	vector<long long int> t;
	long long int mul = 1;
	for (int i = ch[v].size()-1; i >= 0; i--){
		t.push_back(mul);
		mul = mul * (dp[ch[v][i]]+1) % m;
	}

	mul = 1;
	for (int i = 0; i < ch[v].size(); i++){
		p[ch[v][i]] = ((mul * t.back() % m * p[v] % m) + 1) % m;
		t.pop_back();
		mul = mul * (dp[ch[v][i]]+1) % m;
	}

	for (int u: ch[v])
		dfs2(u);
}

int main(){
	cin >> n >> m;
	for (int i = 1; i < n; i++){
		int u, v;
		scanf("%d%d", &u, &v);
		g[v].push_back(u);
		g[u].push_back(v);
	}

	dfs1(1, -1);

	p[1] = 1;
	dfs2(1);

	for (int i = 1; i <= n; i++)
		printf("%d\n", dp[i] * p[i] % m);
	return 0;
}


Measured memory_bytes: 22272
#include<bits/stdc++.h>
#include<unordered_set>
#define lop(i,n) for(int i=0;i<n;i++)
#define lop1(i,n) for(int i=1;i<=n;i++)
#define lopr(i,n) for(int i=n-1;i>=0;i--)
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define IOS  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl "\n"
#define F first
#define S second    
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define sz(x) (ll)x.size()
#define M1 1000000007
#define M2 998244353
#define I1 1000000001
#define I2 1000000000000000001
#define pb push_back
#define asort(v) sort(v.begin(),v.end())
#define dsort(v) sort(v.begin(),v.end(),greater<int>())
using namespace std;
int main()
{
    IOS;
   #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
   int n;
   cin>>n;
   int a=0,b=0,count=0;
   for (int i = 0; i < n; ++i)
   {
       cin>>a>>b;
       if(a==b){count++;}
       if(a!=b){count=0;}
       if(count==3){cout<<"Yes";return 0;}
   }
   cout<<"No";
}
    

   
  

     




       
     


Measured memory_bytes: 3616
import math

a=int(input())
b=[]
d=0.0
cnt=0

for i in range(a):
    b.append(list(map(int , input().split())))

for i in range(a-1):
    for j in range(i+1, a, 1):
        cx=(b[i][0]-b[j][0])
        cy=(b[i][1]-b[j][1])
        cz=math.sqrt(cx*cx+cy*cy)
        d+=cz
        cnt+=1

print(d/cnt*(a-1))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int mINF = 1e9;
const int MOD = 1e9+7;

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

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

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

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


int main() {
    int N,K;cin >> N >> K;
    vector<int> L(N);
    for(int i = 0;i < N;i++){
      cin >> L.at(i);
    }
    sort(L.begin(),L.end());

    int ans = 0;
    for(int i = 0;i < K;i++){
      ans+=L.at(N-i-1);
    }

    cout << ans << endl;

  }       

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  int N, A, B, C; cin >> N >> A >> B >> C;
  int D[N]; FOR(i,0,N) cin >> D[i];
  int dp[N+1][N+1]; CLR(dp); // ??????????????°?????????????????????
  FOR(i,0,N) {
    FOR(j,0,N+1) {
      // ????????????
      dp[i+1][j] = max(dp[i][j], dp[i+1][j]);
      // ??????
      if(j+1<=N) dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + D[i]);
    }
  }
  int ans = 0;
  FOR(i,1,N+1) {
    ans = max(ans,max(C/A,(C+dp[N][i])/(A+i*B)));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3144
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const long double EPS = 1e-10;

int main() {
  int n;
  cin >> n;
  vector<int> l(n + 1);
  rep(i, n) cin >> l[i];
  l[n] = INF;

  sort(l.begin(), l.end());

  int ans = 0;
  rep(i, n) {
    FOR(j, i + 1, n) {
      auto itr = lower_bound(l.begin(), l.end(), l[i] + l[j]);
      ans += distance(l.begin(), itr) - j - 1;
    }
  }
  cout << ans << endl;

  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
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 +c - '0';
    	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;
char s[505][505];
int sumr[505],sumc[505];
bool vis[505];
void Solve() {
    read(N);
    bool flag = 0;
    for(int i = 1 ; i <= N ; ++i) {
        scanf("%s",s[i] + 1);
        for(int j = 1 ; j <= N ; ++j) {
            if(s[i][j] == '#') flag = 1;
        }
    }
    if(!flag) {
        puts("-1");return;
    }
    for(int i = 1 ; i <= N ; ++i) {
        for(int j = 1 ; j <= N ; ++j) {
            if(s[i][j] == '#') vis[j] = 1;
        }
    }
    int cnt = 0;
    for(int j = 1 ; j <= N ; ++j) {
        int c = 0;
        for(int i = 1 ; i <= N ; ++i) {
            c += (s[i][j] == '#');
        }
        if(c == N) ++cnt;
    }
    int ans = 2 * N;
    for(int i = 1 ; i <= N ; ++i) {
        int c = 0;
        for(int j = 1 ; j <= N ; ++j) {
            c += (s[i][j] == '.');
        }
        ans = min(ans,c + N - cnt + (vis[i] ^ 1));
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps DBL_EPSILON
#define mod (ll)1000000007
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n, m, p, a[5010], b[5010], c[5010];
vector<int> g[3000];
int d[3000];
int canuse[3000];
void bfs() {
	queue<int> que;
	canuse[n] = true;
	que.push(n);
	while (!que.empty()) {
		int node = que.front();
		que.pop();
		for (int i : g[node]) {
			if (!canuse[i]) {
				canuse[i] = true;
				que.push(i);
			}
		}
	}
}
void func() {
	REP(i, n)d[i] = INF;
	d[1] = 0;
	for (int cnt = 1;; cnt++) {
		bool update = false;
		rep(i, m) {
			if (!canuse[b[i]])continue;
			if (d[a[i]] != INF && d[b[i]] > d[a[i]] + c[i]) {
				d[b[i]] = d[a[i]] + c[i];
				update = true;
			}
		}
		if (!update)break;
		if (cnt >= n + 10) {
			cout << -1 << endl;
			exit(0);
		}
	}
}
signed main() {
	cin >> n >> m >> p;
	rep(i, m) {
		cin >> a[i] >> b[i] >> c[i];
		c[i] = p - c[i];
		g[b[i]].push_back(a[i]);
	}
	bfs();
	func();
	cout << max((ll)0, -d[n]) << endl;
	return 0;
}

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

int main(void){
    int H, W;
        
    string hori;
    int i, j;
    bool b;
    
    while(!cin.eof()){
        cin >> H >> W;
        if(!H && !W) return 0;
        
        for(i = 0; i < H; i++){
            b = !(i % 2);
            for(j = 0; j < W; j++){
                cout << ((b)? '#' : '.');
                b = !b;
            }
            cout << endl;
        }
        cout << endl;
        
    }
    return 0;
}

Measured memory_bytes: 3028
n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
key = []
p = -1
for i in range(1, n):
  if p == i:
    continue
  if a[i] == a[i-1]:
    key.append(a[i])
    if len(key) == 2:
      break
    p = i+1
if len(key) < 2:
  print(0)
else:
  print(key[0]*key[1])

Measured memory_bytes: 14252
# 3 行 3 列の正方形状のマス目があり、各マスには英小文字が書かれています。 
# 上から i 行目、左から j 列目のマスに書かれた文字は、cij です。
# マス目の左上と右下を結ぶような対角線上のマス目に書かれた文字を、
# 左上から順に読んでできる 3 文字の文字列を出力してください。

3.times do |i|
    row = gets.chomp
    print row[i]
end
print "\n"

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

const int MX_N = 1e5+5;

int N, e[MX_N], c[MX_N], mx_c = 0;
vector<int> al[MX_N];

void dfs(int u, int p, int x) {
    int d = 0;
    for (int y : al[u]) {
        int v = e[y] ^ u;
        if (v == p) continue;
        if (d == x) ++d;
        c[y] = d;
        dfs(v,u,d);
        ++d;
    }
    mx_c = max(mx_c, d);
}

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N;
    for (int i = 0; i < N-1; ++i) {
        int a, b; cin >> a >> b;
        e[i] = a^b;
        al[a].emplace_back(i);
        al[b].emplace_back(i);
    }

    dfs(1,0,-1);
    cout << mx_c << '\n';
    for (int i = 0; i < N-1; ++i) {
        cout << c[i]+1 << '\n';
    }
}



Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
int main() {
   // cout<<"Hello World!";
   int n;
   cin>>n;
   string s;
   cin>>s;
   int ans=0;
   for(int i=0;i<n;++i)
   {
       ans=ans^int(s[i]);
   }
   if(!ans)cout<<"Yes";
   else
    cout<<"No";

   return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]

use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::iter::once;
#[cfg(debug_assertions)]
include! {"./debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}

macro_rules! read {
    ([$t:ident] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ([$t:ident]) =>
        (rl().split_whitespace().map(|w| read_type!(w, $t)).collect::<Vec<_>>());
    (_, [$t:ident] ; $n:expr) =>
        ((0..$n).map(|_| read!(_, [$t])).collect::<Vec<_>>());
    (_, [$t:ident]) =>
        (rl().split_whitespace().skip(1).map(|w| read_type!(w, $t)).collect::<Vec<_>>());
    ($($t:ident),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ($t:ident) => (read_type!(rl(), $t));
    ($($t:ident),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(read_type!(w.next().unwrap(), $t)),*)
    }};
}

macro_rules! read_type {
    ($s:expr, chars) => {
        $s.chars().collect::<Vec<char>>()
    };
    ($s:expr, usize1) => {
        read_type!($s, usize) - 1
    };
    ($s:expr, $t:ty) => {
        $s.parse::<$t>().unwrap()
    };
}

fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

////////////////////////////////////////////////////////////////////////////////

fn main() {
    let n = read!(usize);
    let mut d = read!([i64]);

    d.sort();
    debug!(d);

    let ans = d[n / 2] - d[n / 2 - 1];

    println!("{}", ans);
}


Measured memory_bytes: 6396
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
ll A[5000001],bin[5000001];
vector<ll>v;
map<int,int>myMap;
set<int>mySet;
vector<pair<ll,ll> >v2;
/*void bti(ll n)
{
ll k=1;
  while(n!=0)
    {
    bin[k++]=n%2;
    n/=2;
    }
}*/
/*void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}*/
int main()
{
   ll n,k,q,a;
   cin>>n>>k>>q;
   for(int i=0;i<q;i++)
   {
       cin>>a;
       myMap[a]++;
   }
   for(int i=0;i<n;i++)
   {
       if(k-q+myMap[i+1]>0)
       {
           cout<<"Yes"<<endl;
       }
       else
        cout<<"No"<<endl;
   }
return 0;
}


Measured memory_bytes: 5376
N = int(input())
AB = []

for i in range(N):
  AB.append(list(map(int, input().split())))

AB.sort(key = lambda x: x[1])

time = 0
possibility = 1

for l in AB:
  if l[0] + time > l[1]:
    possibility = 0
    break
  else:
    time += l[0]
    
if possibility == 1:
  print("Yes")
else:
  print("No")

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

int main()
{
int m;
while(cin>>m){
if(m==0) break;
int ans=0;
m=1000-m;
while(m>=500){
ans++;
m-=500;
}
while(m>=100){
ans++;
m-=100;
}

while(m>=50){
ans++;
m-=50;
}
while(m>=10){
ans++;
m-=10;
}

while(m>=5){
ans++;
m-=5;
}

ans+=m;
cout<<ans<<endl;

}

}

Measured memory_bytes: 0
use proconio::{
   fastout, input,
   marker::{Bytes, Chars, Isize1, Usize1},
};

fn main() {
   input! {
      s:Chars,
   }
   input! {
      t:Chars,
   }

   let mut flag = true;
   if s.len() + 1 == t.len() {
      for i in 0..s.len() {
         if s[i] != t[i] {
            flag = false;
         }
      }
      if flag {
         println!("Yes");
      } else {
         println!("No");
      }
      return;
   }
   println!("No");
}


Measured memory_bytes: 2168
#include <climits>
#include <iostream>
#include <vector>

typedef std::vector<int> IntVector;

void Input(IntVector& Inputs)
{
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int Count;
	std::cin >> Count;
	Inputs.resize(Count);
	for(int i=0;i<Count;i++)
	{
		int N = 0;
		std::cin >> N;
		Inputs[i] = N;
	}
}

void Output(IntVector& Outputs)
{
	for(unsigned i=0;i<Outputs.size();i++)
	{
		std::cout << Outputs[i];
		if(i + 1 < Outputs.size())
		{
			std::cout << " ";
		}else
		{
			std::cout << std::endl;
		}
	}
}

int merge(IntVector& A,int left,int mid,int right)
{
	int n1 = mid - left;
	int n2 = right - mid;
	
	IntVector L(n1+1);
	for(int i=0;i<n1;i++)
	{
		L[i] = A[left+i];
	}
	IntVector R(n2+1);
	for(int i=0;i<n2;i++)
	{
		R[i] = A[mid+i];
	}
	L[n1] = INT_MAX;
	R[n2] = INT_MAX;
	
	int i = 0;
	int j = 0;
	for(int k=left;k<right;k++)
	{
		if(L[i] <= R[j])
		{
			A[k] = L[i];
			i++;
		}else
		{
			A[k] = R[j];
			j++;
		}
	}
	return i+j;
}

int mergeSort(IntVector& A,int left,int right)
{
	int Count = 0;
	if(left+1 < right)
	{
		int mid = (left + right)/2;
		Count += mergeSort(A,left,mid);
		Count += mergeSort(A,mid,right);
		return Count + merge(A,left,mid,right);
	}
	return 0;
}

int main()
{
	IntVector Inputs;
	Input(Inputs);
	int CompareCount = mergeSort(Inputs,0,Inputs.size());
	Output(Inputs);
	std::cout << CompareCount << std::endl;
	return 0;
}

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

int64_t nCk(int64_t n, int64_t k)
{
  int64_t res = 1;
  for (int64_t i = 1; i <= k; i++)
  {
    res = (res * (n - i + 1)) / i;
  }
  return res;
}

int main()
{
  long double N, A, B, ave = 0;
  cin >> N >> A >> B;
  vector<long double> V(N);
  map<long double, int64_t> mp;
  for (int i = 0; i < N; i++)
  {
    cin >> V[i];
    mp[V[i]]++;
  }
  sort(V.begin(), V.end());
  reverse(V.begin(), V.end());
  for (int i = 0; i < A; i++)
  {
    ave += (V.at(i) / A);
  }
  cout << fixed << setprecision(10) << ave << endl;
  int64_t ans = 1, n = A; // 残り何個選ぶ必要があるか
  if (mp[V[0]] <= A)
  {
    for (int i = 0; i < N; i++)
    {
      int64_t cnt = 1, j = i + 1; // cnt: V[i]を選べる個数
      while (j < N && V[j] == V[i])
      {
        cnt++;
        j++;
      }
      ans *= nCk(cnt, min(cnt, n));
      n -= min(cnt, n);
      if (n <= 0)
        break;
      i = j - 1;
    }
    cout << ans << endl;
  }
  else
  {
    for (int64_t k = A; k <= B; k++)
    {
      ans += nCk(mp[V[0]], k);
    }
    cout << ans - 1 << endl;
  }
}

Measured memory_bytes: 3796
def solve(N, X, M):
    seen = set()
    front = [X]
    cycle = []
    for i in range(N - 1):
        x = (front[-1] * front[-1]) % M
        if x in seen:  # seen can't be more than M since x is < M
            index = front.index(x)
            front, cycle = front[:index], front[index:]
            break
        front.append(x)
        seen.add(x)
    if N <= len(front):
        return sum(front[:N])

    if N <= len(front) + len(cycle):
        return sum(front) + sum(cycle[: N - len(front)])

    q, r = divmod(N - len(front), len(cycle))

    if False:
        A = [pow(X, 2 ** i, M) for i in range(N)]
        B = front + cycle * q + cycle[:r]
        print(A, B)
        assert A == B
    return sum(front) + sum(cycle) * q + sum(cycle[:r])


N, X, M = [int(x) for x in input().split()]
print(solve(N, X, M))


Measured memory_bytes: 76004
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << 
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << std::endl; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    vector<bool> ok(2001, false);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int bit = 0; bit < 1 << n; bit++) {
        int sum = 0;
        for(int i = 0; i < n; i++){
            if(1 & bit >> i) {
                sum += a[i];
            }
        }
        if(sum > 2000) continue;
        else ok[sum] = true;
    }
    int q;
    cin >> q;
    while(q--) {
        int m;
        cin >> m;
        if(ok[m]) cout << "yes" << endl;
        else cout << "no" << endl;
    }
} 


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}

//a,b x
int main(){
	ll D; cin>>D;
  if(D==22) cout<<"Christmas Eve Eve Eve";
  else if(D==23) cout<<"Christmas Eve Eve";
  else if(D==24) cout<<"Christmas Eve";
  else cout<<"Christmas";
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{

	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long K = sc.nextLong();

		long ans = 0;

		if(N>K){
			long x = N / K;
			long ans1 = N - (K * x);
			long ans2 = ((x + 1) * K) - N;
			ans = (ans1 > ans2)? ans2 : ans1;
		}else if(N<K){
			long ans1 = K - N;
			long ans2 = N;
			ans = (ans1 > ans2)? ans2 : ans1;
		}else{
			ans = 0;
		}

		System.out.println(ans);
		// System.out.println(S.toString());

	}
}

Measured memory_bytes: 23124
#!/usr/bin/env python3
x, y = map(int, input().split())
ans = float('inf')
filt = lambda z: [ z, float('inf') ][ z < 0 ]
ans = min(ans, filt(   y  -    x )    )
ans = min(ans, filt(   y  - (- x)) + 1)
ans = min(ans, filt((- y) -    x ) + 1)
ans = min(ans, filt((- y) - (- x)) + 2)
print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int

struct edge {int to, cost;} ;
vector<edge> G[200010];
int d[200010];

void dfs(int V, int cost) {
    d[V] = cost;
    rep(i, G[V].size()) {
        // 行先までのコストが求まっているときは計算しない．
        if (d[G[V][i].to] != INF) continue;
        dfs(G[V][i].to, cost + G[V][i].cost);
    }
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;

    int L[M], R[M], D[M];
    rep(i, M) {
        cin >> L[i] >> R[i] >> D[i];
        L[i]--; R[i]--;
        G[L[i]].push_back({R[i], D[i]});
        G[R[i]].push_back({L[i], -D[i]});
    }
    rep(i, 200010) d[i] = INF;
    rep(i, M) if (d[R[i]] == INF) dfs(L[i], 0);
    
    //rep(i, 200010) if (d[i] != INF) cout << "d[" << i+1 << "] = " << d[i] << endl;
    
    rep(i, M) {
        if (d[R[i]] - d[L[i]] != D[i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 24320
#include<stdio.h>
int main()
{
 int a,b;
 int sum=0;
 scanf("%d %d",&a,&b);
 if(a<=b){
  sum=b;
  b--;
  }
 else {
   sum=a;
   a--;
 }
  
   if(a<=b){
  sum=sum+b;
   }
 else {
   sum=sum+a;
 }
  
  printf("%d",sum);
  
 
 
   return 0;
}
    

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

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

        System.out.println(
                (r * r)
        );
    }
}


Measured memory_bytes: 21972
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_9_A
W = gets.chomp.downcase
words = []
while true
    line = gets.chomp
    break if line == 'END_OF_TEXT'
    line.downcase.split.each do |word|
        words.push word
    end
end
puts words.count W

Measured memory_bytes: 6100
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

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

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

int main() {
	for(string line; getline(cin, line);) {
		int a = 0, b = 0;
		for(int i = 0; i < line.length() - 2; i++) {
			if(line[i] == 'I' && line[i+1] == 'O' && line[i+2] == 'I') b++;
			if(line[i] == 'J' && line[i+1] == 'O' && line[i+2] == 'I') a++;
		}
		cout << a << endl << b << endl;
	}
	return 0;
}

Measured memory_bytes: 0
N = int(input())
A = [0]+list(map(int,input().split()))+[0]
B = [0]+list(map(int,input().split()))+[0]
ans = 0
for i in range(1, N+2):
    c = min(A[i], B[i-1])
    A[i] -= c
    ans += c
    c = min(A[i], B[i])
    A[i] -= c
    B[i] -= c
    ans += c
print(ans)

Measured memory_bytes: 18348
#ifdef __GNUC__
#pragma GCC target("avx2")
#pragma GCC optimize ("O25")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC optimize("unroll-loops")
#define iss std::cin
#endif
#include "bits/stdc++.h"
//#include <boost/multiprecision/cpp_int.hpp>
//#include <boost/multiprecision/cpp_dec_float.hpp>
#define rep(i, times) for(ll i = 0; i < (times); ++i)
#define p(x) (cout << x << "\n")
using ll = long long; using ld = long double; using namespace std;

#ifndef __GNUC__
string text =
R"X(
0 2 3 4 5
)X";
stringstream iss{text};
#endif 

void procedures( ) {
	ll N{5}, a;
	rep(n, N) { 
		iss >> a;
		if (a == 0) p(n + 1);
	}
};
int main( ) {
	cin.tie(0);	ios::sync_with_stdio(0);
	procedures( );
}


Measured memory_bytes: 3600
n, m = gets.split.map(&:to_i)
max_l = 1
min_r = n
m.times do
  l, r = gets.split.map(&:to_i)
  max_l = l if l > max_l
  min_r = r if r < min_r
end
if max_l <= min_r
  puts min_r - max_l + 1
else
  puts 0
end


Measured memory_bytes: 1788
#![allow(unused_macros, unused_imports, dead_code)]

use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
            assert!(_it.next().is_none());
        }
    };
}

fn main() {
    from_line!(n: usize);
    let mut a: Vec<usize> =
        read_line().trim().split_whitespace().map(|a| a.parse().unwrap()).collect();
    let mut b: Vec<usize> =
        read_line().trim().split_whitespace().map(|a| a.parse().unwrap()).collect();
    let mut c: Vec<usize> =
        read_line().trim().split_whitespace().map(|a| a.parse().unwrap()).collect();
    a.sort();
    b.sort();
    c.sort();
    let mut ab = Vec::with_capacity(n + 1);
    //let mut bc = Vec::with_capacity(n + 1);
    let mut ai_last = 0;
    'loop_bi: for b_ in b.iter() {
        for ai in ai_last..n {
            if a[ai] >= *b_ {
                ai_last = ai;
                ab.push(ai);
                continue 'loop_bi;
            }
        }
        ab.push(n);
        ai_last = n;
    }
    let mut ans = 0usize;
    let mut bi_last = 0;
    let mut memo = 0;
    'loop_ci: for c_ in c.iter() {
        let mut subtot = memo;
        for bi in bi_last..n {
            if b[bi] >= *c_ {
                bi_last = bi;
                //bc.push(bi);
                memo = subtot;
                ans += subtot;
                //println!("add {}", subtot);
                continue 'loop_ci;
            }
            //println!("subtot {} -> {}", subtot, subtot + ab[bi]);
            subtot += ab[bi];
        }
        ans += subtot;
        memo = subtot;
        bi_last = n;
        //println!("add {}", subtot);
        //bc.push(n);
    }
    //println!("ab: {:?}", ab);
    //println!("bc: {:?}", bc);
    /*
    for x in bc {
        ans += ab[..x].iter().sum();
    }
    */


    println!("{}", ans);
}


Measured memory_bytes: 13560
n, m, l = map(int, input().split())

a = []
for i in range(n):
  c = [int(num) for num in input().split()]
  a.append(c)

b = []
for i in range(m):
  c = [int(num) for num in input().split()]
  b.append(c)

for i in range(n):
  line = []
  for j in range(l):
    score = 0
    for k in range(m):
      score += a[i][k]*b[k][j]
    line.append(str(score))
  print(' '.join(line))


Measured memory_bytes: 6240
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int a;
    int b;
    int x;
    int y;
    scanf("%d %d",&a, &b);
    x=a*b;
    y=2*(a+b);

    printf("%d %d\n", x, y);
    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <cmath>
#include <cfenv>
using namespace std;

int main()
{
    double n, d;
    int ans = 0;
    cin >> n >> d;
    vector<vector<double>> a (n, vector<double>(d));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            double g = 0;
            for (int k = 0; k < d; k++) {
                g += pow(a[i][k]-a[j][k], 2.0);
            }
            if (ceil(sqrt(g)) == sqrt(g)) ans++;
        }
    }

    cout << ans << endl;
    return 0;
}

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int r, g, b; cin >> r >> g >> b;
    string s = to_string(r) + to_string(g) + to_string(b);
    if(stoi(s)%4==0) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())

l=[0 for i in range(n)]
for i in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for j in a:
        l[j-1]+=1

ans=0
for i in l:
    if i==0:
        ans+=1

print(ans)   

Measured memory_bytes: 9212
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`



		`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */

	n, m := nextInt(), nextInt()
	ng := map[int]int{}
	if n%2 == 0 {
		ng[n/2] = 1
	}

	c := 0

	for i := 1; i <= m; i++ {
		_, check := ng[n-(c+i)+1-i]
		if check {
			c++
		}
		fmt.Fprintln(out, i, n-(c+i)+1)

		ng[n-(c+i)+1-i] = 1
		ng[-(-(c + i) + 1 - i)] = 1

	}

	//fmt.Fprintln(out, "[DEBUG]", d)
	//fmt.Fprintln(out, ans)
}

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

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}


Measured memory_bytes: 12968
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N = I()
    A = LI()
    c = Counter(A)
    if N % 2 != 0 and c[0] != 1:
        print(0)
        exit()
        
    for i in range(1,(N + 1) // 2):
        if c[i*2-(N%2==0)] != 2:
            print(0)
            exit()
    print(pow(2,N//2,mod))
if __name__ == '__main__':
    main()

Measured memory_bytes: 55768
/* Tuan Kkura */
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define base 31
#define MOD 1e9+7
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORs(i, a, b) for(int i = a; i >= b; i--)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define __FOR(i, a, b, k) for(int i = a; i <= b; i+= k)
#define __REP(i, a, b, k) for(int i = a; i < b; i+= k)
#define pb push_back
#define _io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

typedef pair <int, int> ii;
typedef vector <ii> vii;
#define fi first
#define se second
#define mp make_pair
#define PROB "text"
#define MAXN 200005

int main()
{
    _io
    int A, B;
    cin >> A >> B;
    cout << (B-1+A-2)/(A-1) << '\n';
}


Measured memory_bytes: 256
package main

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

var nextStr func() string

func init() {
	nextStr = newReadString(os.Stdin)
}

func main() {
	s := nextStr()
	n := len(s)
	cnt := n

	for i := 0; i < n && rune(s[i]) != 'A'; i++ {
		cnt--
	}
	for i := n - 1; i >= 0 && rune(s[i]) != 'Z'; i-- {
		cnt--
	}

	fmt.Println(cnt)
}

func nextInt() (result int) {
	result, _ = strconv.Atoi(nextStr())
	return
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
		}
		return r.Text()
	}
}


Measured memory_bytes: 1280
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = s.replaceAll("BC", "D");
        int aseq = 0;
        long ans = 0L;
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == 'A') aseq++;
            else if(s.charAt(i) == 'D') ans += aseq;
            else aseq = 0;
        }
        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 32880
public fun readln() = readLine()!!
    public fun readlnByte() = readln().toByte()
    public fun readlnShort() = readln().toShort()
    public fun readlnInt() = readln().toInt()
    public fun readlnLong() = readln().toLong()
    public fun readlnFloat() = readln().toFloat()
    public fun readlnDouble() = readln().toDouble()
    public fun readlnBigInt(radix: Int = 10) = readln().toBigInteger(radix)
    public fun readlnBigDecimal() = readln().toBigDecimal()
     
    public fun lineSequence(limit: Int = Int.MAX_VALUE) = generateSequence { readLine() }.constrainOnce().take(limit)
    public fun readlnStrings() = readln().split(' ')
    public fun readlnBytes() = readlnStrings().map { it.toByte() }
    public fun readlnShorts() = readlnStrings().map { it.toShort() }
    public fun readlnInts() = readlnStrings().map { it.toInt() }
    public fun readlnLongs() = readlnStrings().map { it.toLong() }
    fun main() {
        val (a, b, c, d) = readlnLongs()
        val max = listOf(a*c, a*d, b*c, b*d).max()
        println("%d".format(max))
    }

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


#define INF 1000000000000


signed main()
 {
   int n;
   cin>>n;
   cout<<3.14*n*2;

 }


Measured memory_bytes: 3760