akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <string> 
using namespace std;
int max(int a, int b){
	if(a>=b) return a;
	else return b;
}
int main(){
	string s, t;
	cin>>s>>t;
	int i, j, m = s.size(), n = t.size();
	int ans[m+1][n+1];
	for(i=0;i<=m;i++){
		for(j=0;j<=n;j++){
			if(i==0 || j==0) {
				ans[i][j] = 0;
				continue;
			}
			int x = s[i-1]==t[j-1];
			if(s[i-1]==t[j-1]){
				ans[i][j] = 1 + ans[i-1][j-1];
			}
			else 
				ans[i][j] = max(ans[i][j-1], ans[i-1][j]);
			//cout<<"String:"<<s[i-1]<<t[j-1]<<" "<<ans[i][j]<<"\n";

		}
	}
	string LCS = "";
	i = m, j = n;
	while(LCS.size() < ans[m][n]){
		//cout<<i<<" "<<j<<s[i-1]<<" "<<t[j-1]<<"\n";
		if(s[i-1]==t[j-1]){
			LCS += s[i-1];
			i--;
			j--;
		}
		else{
			if(ans[i][j-1] > ans[i-1][j]) j--;
			else i--;
		}
	}
	reverse(LCS.begin(),LCS.end());
	//cout<<ans[m][n]<<"\n";
	cout<<LCS;
}

Measured memory_bytes: 35456
#include <stdio.h>
int main()
{
    int n;
    int i;
    int max=0;
    int count=0;

    
    scanf("%d",&n);
    int a[n];

    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        count = count + a[i];
        if(max<=a[i]){
            max=a[i];
        }
    }

    if(max<(count-max)){
        printf("Yes\n");
    }else{
        printf("No\n");
    }



    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1, (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;


ll area(pair<ll,ll> p){
    return p.first * p.second;
}

ll divide(ll h, ll w, int r){
    pair<ll,ll> a, b, c;
    a = make_pair(h/3 + r, w);
    b = make_pair((h - a.first)/2, w);
    c = make_pair(h - a.first - b.first, w);
    ll tmp = max({area(a), area(b), area(c)}) - min({area(a), area(b), area(c)});

    b = make_pair(h - a.first, w/2);
    c = make_pair(b.first, w - b.second);

    return min(tmp, max({area(a), area(b), area(c)}) - min({area(a), area(b), area(c)}));
}

int main(){
    ll h, w;
    cin >> h >> w;
    cout << min({divide(h,w,0), divide(h,w,1), divide(w,h,0), divide(w,h,1)}) << endl;
    return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *


S = input()
K = INT()

l = []
tmp = 1
for i in range(1, len(S)):
	if S[i] == S[i-1]:
		tmp += 1
	else:
		l.append(tmp)
		tmp = 1
l.append(tmp)

if S[0] != S[-1]:
	print(sum([x//2 for x in l])*K)
elif len(l) == 1:
	print(len(S)*K//2)
else:
	M = l[1:-1] + [l[0]+l[-1]]
	print(sum([x//2 for x in M])*(K-1) + sum([x//2 for x in l]))

Measured memory_bytes: 5200
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second


void solve()
{
    ll n,i,j,k,x,y,z;
    cin >> n >> k;
    ll a[n];
    for(i=0;i<n;i++)
        cin >> a[i];

    ll dp[n];
    for(i=0;i<n;i++)
        dp[i] = 1e10;
    dp[0] = 0;

    for(i=1;i<n;i++)
    {
        x = 1;
        while(i-x >= 0 && x <= k)
        {
            dp[i] = min(dp[i], dp[i-x] + abs(a[i] - a[i-x]));
            x++;
        }
    }
    /*for(i=0;i<n;i++)
        cout << dp[i] << " ";*/
    cout << dp[n-1];




}
int main()
{

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t=1;
	//cin >> t;
	while(t-- > 0)
	{
		solve();
	}

}


Measured memory_bytes: 5096
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <random>
#include <map>

using namespace std;

int LCS[1010][1010] = {};

int LCSLength(string strX,string strY) {

    int strXSize = strX.length();
    int strYSize = strY.length();
    for (int i = 0; i < strXSize + 1; i++) {
	for (int j = 0; j < strYSize + 1; j++) {
	    if (i == 0 || j == 0) {
		LCS[i][j] = 0;
	    }
	}
    }

    for (int i = 1; i < strXSize + 1; i++) {
	for (int j = 1; j < strYSize + 1; j++) {

	    //LCS[i]==LCS[j]
	    if (strX[i - 1] == strY[j - 1]) {
		LCS[i][j] = LCS[i - 1][j - 1] + 1;
	    }
	    else {
		LCS[i][j] = max(LCS[i][j - 1], LCS[i - 1][j]);
	    }
	}
    }

    return LCS[strXSize][strYSize];
}

int main() {

    //cin.tie(0);
    //ios::sync_with_stdio(false);

    int q; scanf("%d", &q);

    string strX;
    string strY;
    while (q-- > 0) {
	cin >> strX;
	cin >> strY;
	printf("%d\n", LCSLength(strX, strY));
    }



    return 0;

}




Measured memory_bytes: 7156
#include <iostream>
#include <vector>
using namespace std;
int c[26],s[400][30],last[400][30],d,now = -1000000000;
vector<int> ans,w;
int score(vector<int> &v){
    int i,j,res = 0;
    for(i=0;i<d;i++){
        for(j=0;j<26;j++){
            last[i][j] = 0;
        }
    }
    for(i=0;i<d;i++){
        int x = v[i]; x--;
        if(x>25){
            cout << x << endl;
            exit(1);
        }
        res += s[i][x];
        last[i][x] = i + 1;
        for(j=0;j<26;j++){
            res -= c[j]*(i + 1 - last[i][j]);
        }
    }
    return res;
}

int main(){
    int i,j; cin >> d;
    for(i=0;i<26;i++){
        cin >> c[i];
    }
    for(i=0;i<d;i++){
        for(j=0;j<26;j++){
            cin >> s[i][j];
        }
    }
    for(i=0;i<d;i++){
        //cout << i%26 + 1 << endl;
        ans.push_back(i%26 + 1);
    }
    now = score(ans);
    for(j=1;j<26;j++){
        w.clear();
        for(i=0;i<d;i++){
            w.push_back((i + j)%26 + 1);
        }
        int sc = score(w);
        if(sc>now){
            swap(ans,w); now = sc;
        }
    }
    for(i=0;i<d;i++){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 3756
n=int(input())
c=list(map(int,input().split()))
count=0
f=0
while True:
    for i in range(n):
        if c[i]%2!=0 or c[i]==0:
            f=1
        else:
            c[i]/=2
            
    if f==1:
        break
    count+=1
print(count)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define mod (ll)(1e9+7)
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<(x)<<endl
#define ps(x) cout<<(x);
#define pk(x) cout<<(x)<<" ";
#define pfix(d,x) cout << fixed << setprecision(d) << x << endl;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
#define p2d(v,n,m) rep(i,n){rep(j,m){pk(v[i][j]);}p("");}
#define fi first
#define se second
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
ll d,n,m,x,y,z,h,w,k,mi=inf,ma=-inf,ans,s,t,l,r,res,tmp,itr,p,q;
bool flag;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int dx8[8]={1,1,0,-1,-1,-1,0,1},dy8[8]={0,1,1,1,0,-1,-1,-1};
char cha;
string st;
typedef map<ll, ll> imap;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<pair<ll,ll> > VP;
P pa;


// mod_tools
ll fact[500000];

ll mpow(ll x, ll y){
    //d(x)
    if(y==0) return 1;
    if(y%2==0){
        return mpow(x*x%mod,y/2)%mod;
    }
    else{
        return x*mpow(x,y-1)%mod;
    }
}

ll minv(ll x){
    // only available for mod=10^9+7
    return mpow(x,mod-2);
}

// Please run this func for preparation
void mfact(){
    //prepare fact-array
    fact[0]=1;
    rep(i,1,500000){
        fact[i]=fact[i-1]*i%mod;
    }
}

//combiの呼び出しが大きいときはこれを使う
ll combi(ll n, ll k){
    return (fact[n]*minv(fact[k])%mod)*minv(fact[n-k])%mod;
}

//combiを一回呼び出すだけなら直接計算

int main(void){
    string S,T;
    cin>>S>>T;
    sort(all(S));
    sort(all(T));
    reverse(all(T));
    p((S<T)?"Yes":"No");
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int k, x;
  cin >> k >> x;
  if (500 * k >= x) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  ll H,W;
  cin>>H>>W;
  if(H!=1&&W!=1) cout<<(H*W+1)/2<<endl;
  else cout<<1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i = n;i >= 0;--i)
#define FOR(i,m,n) for(int i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

int main(void)
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll lcm = c * d / gcd(c, d);
    ll ac = 0, ad = 0, acd = 0;

    ac = b / c - a / c + ((a % c == 0) ? 1 : 0);
    ad = b / d - a / d + ((a % d == 0) ? 1 : 0);
    acd = b/lcm - a/lcm + ((a % lcm == 0) ? 1 : 0);
    ll ans = b - a - (ac + ad - acd) + 1;

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

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

using namespace std;

int main()
{
  int n,m;
  cin>>n>>m;
  
  vector<char> chr(n,'0');
  if(n>=2)
    chr.at(0)='1';
  
  
  vector<int> s(m);
  vector<char> c(m);
  
  for(int i=0;i<m;i++)
  {
    cin>>s.at(i)>>c.at(i);
  }
  for(int i=0;i<m;i++)
  {
    if(n>=2&&s.at(i)==1&&c.at(i)=='0')
    {
      cout<<"-1"<<endl;
      exit(0);
    }
    for(int j=i+1;j<m;j++)
    {
      if((s.at(i)==s.at(j)&&c.at(i)!=c.at(j)))
      {
        cout<<"-1"<<endl;
        exit(0);
      }
    }
  }
  
  for(int i=0;i<m;i++)
    chr.at(s.at(i)-1)=c.at(i);
  
  for(int i=0;i<n;i++)
  {
    cout<<chr.at(i);
    if(i==n-1)
      cout<<endl;
  }
}


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

#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
#define ll long long

int main(void)
{
    int i;char c;
    char let[30]={0};
    while((c=getchar())!=EOF)
    {
        if(isalpha(c))
        {
            if(isupper(c))
                c = tolower(c);
            let[(c-'a')]++;
        }
    }
    for(i=0;i<26;i++)
    {
        printf("%c : %d\n",(char)'a'+i,let[i]);
    }
    return 0;
}




Measured memory_bytes: 2060
#include<bits/stdc++.h>
using namespace std;
#define int int64_t
signed main(){	
  int n,ans,date[100000]={};
  int x=1,y=1,z=1;
  cin>>n;
  for(int i=1;i<=(int)sqrt(n);i++){
    for(int j=1;j<=(int)sqrt(n);j++){
      for(int k=1;k<=(int)sqrt(n);k++){
        date[i*i+j*j+k*k+(i*j)+(i*k)+(j*k)]++;
      }
    }
  }
  for(int i=1;i<=n;i++){
    cout<<date[i]<<"\n";
  }
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP0(i, n) for (int i = (n) - 1; i >= 0; --i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define RREP1(i, n) for (int i = (n); i >= 1; --i)
#define pow10(n) int(1e##n + n)

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

const int INTINF = int(1e9)+1;
const LL LLINF = LL(1e18)+1;
long double eps = 1.0E-14;

void solve()
{
    double R; cin >> R;
    std::cout << 2*R*M_PI << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(20);
    solve();
    return 0;
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, N) for (int I = 1; I <= (N); ++I)
#define FORR(I, N) for (int I = 0; I < (N); ++I)
#define REP(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPP(I, A, B) for (int I = (A); I >= (B); I--)
#define SORT_UNIQUE(c) (sort(c.begin(), c.end()), c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
#define GET_POS(c, x) (lower_bound(c.begin(), c.end(), x) - c.begin())
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
const int N = 100 + 5;
const int mod = 1e9 + 7;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
int a[N][N];
int p[N];
int cnt[N];
int main()
{
    int n, m;
    cin >> n >> m;
    FOR(i, m)
    {
        int x;
        cin >> cnt[i];
        FOR(j, cnt[i])
        {
            cin >> a[i][j];
        }
    }
    FOR(i, m)
    cin >> p[i];
    int ans = 0;
    FORR(i, (1 << n))
    {
        bitset<10> b(i);
        int flag = 0;
        FOR(j, m)
        {
            int _ = 0;
            FOR(k, cnt[j])
            {
                if (b[a[j][k] - 1] == 1)
                    _++;
            }
            if (_ % 2 == !p[j])
                flag = 1;
        }
        if (!flag)
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a += b;
	if(a>MOD){
		a -= MOD;
	}
}

int deg[100100];
vector<int> g[100100];
bool visited[100100];

bool dfs(int s, int t){
	int i;
	visited[s] = true;
	if(s==t){
		return true;
	}
	for(i=(g[s].l_ength()-1); i>=0; --i){
		if(visited[g[s][i]]){
			continue;
		}
		if(dfs(g[s][i],t)){
			return true;
		}
	}
	return false;
}

int main(void){
	int n,m,a,b,i,cnt=0;
	fill(visited,visited+100100,false);
	fill(deg,deg+100100,0);
	cin >> n >> m;
	for(i=0; i<m; ++i){
		cin >> a >> b;
		--a; --b;
		++deg[a];
		++deg[b];
		g[a].push_back(b);
		g[b].push_back(a);
	}
	for(i=0; i<n; ++i){
		if(deg[i]%2){
			cout << "No" << endl;
			return 0;
		}
	}
	a = -1;
	for(i=0; i<n; ++i){
		if(deg[i]>5){
			cout << "Yes" << endl;
			return 0;
		}else if(deg[i]>3){
			++cnt;
			if(a<0){
				a = i;
			}else{
				b = i;
			}
		}
	}
	if(cnt<2){
		cout << "No" << endl;
		return 0;
	}else if(cnt>2){
		cout << "Yes" << endl;
		return 0;
	}
	cnt = 0;
	while(true){
		visited[a] = false;
		visited[b] = false;
		if(dfs(a,b)){
			++cnt;
		}else{
			break;
		}
	}
	cout << ((cnt==2)?"Yes":"No") << endl;
	return 0;
}


Measured memory_bytes: 7424
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int N,A[1010];
  cin >> N;
  int ans = 0;
  int count = 0;
  for(int i = 0;i < N;i ++) cin >> A[i];
  
  for(int i =0;i < N;i ++){
    
    if(A[i]%2 == 0){
      
      if(A[i]%3== 0 || A[i]%5 == 0){
        ans++;
      }
      count ++;
    }
  }
    
    if(ans == count){
      puts("APPROVED");
    }else{
      puts("DENIED");
    }
}
        
        




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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p){os << "(" << p.first << ", " << p.second << ")"; return os;}

ll f(vector<ll> &A, ll c) {
    for(int i = 0; i < A.size(); i++) {
        c = c / A[i] * A[i];
    }
    return c;
}

bool f1(vector<ll> &A, ll c) {
    return f(A, c) >= 2;
}
bool f2(vector<ll> &A, ll c) {
    return f(A, c) >= 3;
}

void solve() {
    int K;
    cin >> K;
    vector<ll> A(K);
    for (int i = 0; i < K; i++) {
        cin >> A[i];
    }

    // 2以上
    ll ok = 1LL << 62, ng = 0;

    while(ok - ng > 1) {
        ll c = (ok + ng) / 2;
        if (f1(A, c)) {
            ok = c;
        } else {
            ng = c;
        }
    }
    ll okmin = ok;

    // 3以上
    ok = 1LL << 62, ng = 0;
    while(ok - ng > 1) {
        ll c = (ok + ng) / 2;
        if (f2(A, c)) {
            ok = c;
        } else {
            ng = c;
        }
    }
    ll okmax = ng;
    if (okmin > okmax) {
        cout << -1 << endl;
    } else {
        cout << okmin << " " << okmax << endl;
    }
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
 
public class Main{
  public static void main(String[] args)throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
                     
                       while(str != null){
                       String[] strs = str.split("\\s");
                       int m = Integer.parseInt(strs[0]);
                       int f = Integer.parseInt(strs[1]);
                       int r = Integer.parseInt(strs[2]);
                         
                       if(m==-1 && f ==-1 && r==-1){
                           break;
                       }
                     
                       if(m+f < 30 || m==-1 || f==-1){
                           System.out.println("F");
                       }else if(m+f < 50){
                           if(r >= 50){
                               System.out.println("C");
                            }else{
                               System.out.println("D");
                           }
                       }else if(m+f < 65){
                           System.out.println("C");
                       }else if(m+f < 80){
                           System.out.println("B");
                       }else{
                           System.out.println("A");
                       }
                       str = br.readLine(); 
 
                        }
                     
                   br.close();
 
  }
}

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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

#define MOD 998244353

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル
	int n, k;
	cin >> n >> k;

	vector<P> rng;
	rep(i,k){
		int l, r;
		cin >> l >> r;
		r++;
		rng.eb(make_pair(l,r));
	}

	vi dp(n);
	dp[0] = 1;
	dp[1] = -1;

	rep(i,n){
		// a[i] = f[i] - f[i-1]と定義する
		// a[i]の更新は 各jについて
		// a[i + l[j]] <-- a[i + l[j]] + f[i]
		// a[i + r[j] + 1] <-- a[i + r[j] + 1] - f[i]
		// とすると
		// f[i] = f[i+1] + a[i]で復元できる
		if(i > 0){
			dp[i] += dp[i-1];
			dp[i] = (dp[i]%MOD+MOD)%MOD;
		}
		rep(j, k){
			int l, r;
			tie(l, r) = rng[j];
			if(i+l < n){
				dp[i+l] += dp[i];
				dp[i+l] = (dp[i+l] % MOD + MOD) % MOD;
			}
			if(i+r < n){
				dp[i+r] -= dp[i];
				dp[i+r] = (dp[i+r] % MOD + MOD) % MOD;
			} 
		}
	}

	cout << dp[n-1] << endl;

	/*
	int l,r;
	vi s;
	rep(i,k){
		cin >> l >> r;
		FOR(j,l,r+1){
			s.eb(j);
		}
	}
	sort(s.begin(),s.end());

	// dp
	vi dp(n+1,-1);
	dp[1] = 1;
	// 配るDP
	FOR(i,1,n+1){
		// そこにたどり着く方法がないならスキップ
		if(dp[i] == -1) continue;
		// 現在位置からいけるところを探索
		rep(j, s.size()){
			int ele = s[j];
			// マスからはみ出るなら終了
			if(ele + i > n) break;
			// はみ出ないなら今までのルートを配る
			if(dp[i + ele] == -1) dp[i + ele] = 0;
			dp[i + ele] += dp[i];
			dp[i + ele] = dp[i + ele] % MOD;
		}
	}

	if(dp[n] == -1) cout << "0" << endl;
	else cout << dp[n] << endl;
	*/
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	
	solve();
	return 0;
}

Measured memory_bytes: 4720
//JSD
#include<iostream>
#define Mod 1000000007
#include<cmath>
#include<limits.h>
#define ll long long 
using namespace std;
int main(){
	ll n,m;
	cin>>n>>m;
	ll a[m];
	ll dp[n+1];
	for(int i=0;i<=n;i++ ) dp[i]=-1;
	dp[0]=1,dp[1]=1;
	for(int i=0;i<m;i++){
		cin>>a[i];
		dp[a[i]]=0;
	}
	for(int i=2;i<=n;i++){
		if(dp[i]==-1){
			dp[i]=(dp[i-1]+dp[i-2])%Mod;
		}
	}
	cout<<dp[n];
	
	return 0;
}

Measured memory_bytes: 1792
#pragma comment(linker,"/stack:16777216")
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=1;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define repr(a,n) for(int a=n-1;a>=0;a--)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

int main(int argc,char** argv){
	int n,m;
	cin>>n>>m;
	cout<<n*(n-1)/2+m*(m-1)/2;
	return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    # h0,w0h1,w1 = map(int, input().split())
    s = input()
    while s != "-":
        m = int(input())
        i = 0
        for _ in range(m):
            i += int(input())
        i %= len(s)
        print(s[i:] + s[:i])
        s = input()

main()



Measured memory_bytes: 5604
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		while(input.hasNext()){
			int A = input.nextInt();
			int B = input.nextInt();
			int C = input.nextInt();
			
			if(A == B){
				System.out.println(C);
			} else if (B == C){
				System.out.println(A);
			} else if (A == C){
				System.out.println(B);
			}
		}

	}

}


Measured memory_bytes: 22356
#include <bits/stdc++.h>
#include <unordered_set>
#include <random>
using namespace std;
#define ll long long
#define fr first
#define sc second
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()

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

	map<int, int> mp;
	for (int i = 1; i <= 100; i++)
		for (int j = 1; j <= 100; j++)
			for (int k = 1; k <= 100; k++)
				mp[i*i + j * j + k * k + i * j + i * k + j * k]++;

	for (int i = 1; i <= N; i++)
		cout << mp[i] << '\n';
	return 0;
}

Measured memory_bytes: 5452
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt(),m = sc.nextInt();
    int h[]=new int[n];
    int count=0;
    boolean flg[]=new boolean[n];
    for(int i=0;i<n;i++){
      h[i]=sc.nextInt();
      flg[i]=true;
    }
    for(int i=0;i<m;i++){
      int a=sc.nextInt()-1,b=sc.nextInt()-1;
      if(h[a]>=h[b]){
        flg[b]=false;
      }
      if(h[a]<=h[b]){
        flg[a]=false;
      }
    }
    for(int i=0;i<n;i++){
      if(flg[i]){count++;}
    }
    pl(count+"");
  }

  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
}


Measured memory_bytes: 59828
using System;


class MainClass
{
    public static void Main(string[] args)
    {
        for (int i = 1; i <= 9; i++){
            for (int j = 1; j <= 9; j++){
                Console.WriteLine(i.ToString() + "x" + j.ToString() + "=" + (i * j).ToString());
            }
        }
            
    }
}


Measured memory_bytes: 15772
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int kakko(int a,int b,int d){
  if(d==0)return a+b;
  else if(d==1)return a-b;
  else return a*b;
}
int main(){
  vector<int>in(4);
  map<int,char>out;
  out[0]='+';
  out[1]='-';
  out[2]='*';
  while(cin>>in[0]>>in[1]>>in[2]>>in[3],in[0]|in[1]|in[2]|in[3]){
    sort(all(in));
    bool h=false;
    do{
      rep(i,3)rep(j,3)rep(k,3){
	if(kakko(kakko(kakko(in[0],in[1],i),in[2],j),in[3],k)==10){
	  printf("(((%d %c %d) %c %d) %c %d)\n",in[0],out[i],in[1],out[j],in[2],out[k],in[3]);
	  h=true;
	  i=j=k=3;
	}else if(kakko(kakko(in[0],kakko(in[1],in[2],j),i),in[3],k)==10){
	  printf("((%d %c (%d %c %d)) %c %d)\n",in[0],out[i],in[1],out[j],in[2],out[k],in[3]);
	  h=true;
	  i=j=k=3;
	}else if(kakko(in[0],kakko(kakko(in[1],in[2],j),in[3],k),i)==10){
	  printf("(%d %c ((%d %c %d) %c %d))\n",in[0],out[i],in[1],out[j],in[2],out[k],in[3]);
	  h=true;
	  i=j=k=3;
	}else if(kakko(in[0],kakko(in[1],kakko(in[2],in[3],k),j),i)==10){
	  printf("(%d %c (%d %c (%d %c %d)))\n",in[0],out[i],in[1],out[j],in[2],out[k],in[3]);
	  h=true;
	  i=j=k=3;
	}else if(kakko(kakko(in[0],in[1],i),kakko(in[2],in[3],k),j)==10){
	  printf("((%d %c %d) %c (%d %c %d))\n",in[0],out[i],in[1],out[j],in[2],out[k],in[3]);
	  h=true;
	  i=j=k=3;
	}
      }
      if(h)break;
    }while(next_permutation(all(in)));
    if(!h)cout<<'0'<<endl;
  }
}

Measured memory_bytes: 1236
import Control.Monad
import Data.Array
import Data.List

main = do
  [h,w] <- fmap (map read . words) getLine
  input <- fmap (filter (/= '\n')) getContents
  let bd = listArray ((1,1),(h,w)) input
  putStrLn (solve bd)

type Board = Array (Int,Int) Char

solve :: Board -> String
solve bd =
  if ok then "Yes" else "No"
  where
    ok = and['#'`elem`neighbor ix bd | ix<- indices bd, bd!ix=='#']

neighbor :: (Int,Int) -> Board -> String
neighbor (i,j) bd =
  [bd!(x,y) | (x,y)<-[(i-1,j),(i+1,j),(i,j+1),(i,j-1)], 1<=x,x<=h,1<=y,y<=w]
  where
    (_,(h,w)) = bounds bd

Measured memory_bytes: 1020
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0620
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] a = new int[n[0]];
            for(int i = 0; i < a.Length; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
            }
            for(int k = 1; k <= n[1]; k++)
            {
                for(int i = 0; i < a.Length - 1; i++)
                {
                    if (a[i] % k > a[i + 1] % k) { int h = a[i];
                        a[i] = a[i + 1];
                        a[i + 1] = h;
                    }
                }
            }
            foreach(int i in a)
            {
                Console.WriteLine(i);
            }Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9564
//AnkitCode99 here....
//every ups and downs matter!

#include<bits/stdc++.h>
#define endl "\n"
#define Ryuga ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr)
typedef long long int ll;
#define rep(i,a,b) for(ll i=a;i<b;i++)

using namespace std;

const ll sz=1e5+5;
const ll szz=1e6+6;
const ll mod=1e9+7;

int main()
{
	Ryuga;

	

	clock_t startTime=clock();

	ll n;
	cin>>n;
	ll ar[n];
	rep(i,0,n)
	{
		cin>>ar[i];
	}

	set<ll> s;
	ll extra=0;
	rep(i,0,n)
	{
		if(ar[i]>3199)
		{
			extra++;
			continue;
		}

		s.insert(ar[i]/400);
	}

	ll ans=s.size();

	if(ans==0)
	{
		ans=1,extra--;
	}

	cout<<ans<<" "<<extra+ans<<endl;

	cerr << endl <<setprecision(20)<< double( clock() - startTime ) / (double)CLOCKS_PER_SEC<< " seconds." << endl;

}//Goodbye...

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<map>
using namespace std;

int main() {
	int N;
	int i,j,k;
	cin >> N;
	long long L[100];
	int coun = 0;
	for (i = 0; i < N; i++)cin >> L[i];
	for (i = 0; i < N-2; i++) {
		for (j = i+1; j < N-1; j++) {
			for (k = j+1; k < N; k++) {
				
				if (i != j && j != k && k != i) {
					if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i]) {
						if (L[i] + L[j] > L[k] && L[j] + L[k] > L[i] && L[k] + L[i] > L[j]) {
							coun++;
							//cout << i + 1 << "," << j + 1 << "," << k + 1 << endl;
						}
						
					}
					
				}
			}
		}
	}
	cout << coun << endl;
	
	return 0;

}

Measured memory_bytes: 3632
//	ZapZu's code hohoho
//	#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define dfs_black 1
#define dfs_white -1
#define pr pair
#define vt vector
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef double db;
typedef long long li;
typedef long double ld;

typedef pr<int, int> ii;
typedef pr<ld,ld> dd;

typedef vt<int> vi;
typedef vt<li> vli;
typedef vt<ld> vld;
typedef vt<ii> vii;

typedef map<int, int> mii;
typedef map<int, bool> mib;
typedef map<int, char> mic;

typedef set<int> s_i;
typedef set<char> s_c;

const int MOD = 1e9+7;
const li INF = 1e18;
const ld PI = 4*atan((ld)1);

signed main()
{
//	freopen(".inp", "r", stdin);
//	freopen(".out", "w", stdout);
	int a, b, k;
	cin>>k>>a>>b;
	for(int i=a; i<=b; i++)
	{
		if(i%k==0) 
		{
			cout<<"OK";
			return 0;
		}
	}
	cout<<"NG";
}




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

int main(){
	int64_t n, a;
	cin >> n >> a;
	int64_t x[n];
	for(int i = 0; i < n; i++) cin >> x[i];
	int64_t dp[n + 1][n + 1][50 * n + 1]{};
	dp[0][0][0] = 1;
	for(int i = 1; i < n + 1; i++) for(int j = 0; j < n + 1; j++) for(int k = 0; k < 50 * n + 1; k++){
		dp[i][j][k] += dp[i - 1][j][k];
		if(j && 0 <= k - x[i - 1]) dp[i][j][k] += dp[i - 1][j - 1][k - x[i - 1]];
	}
	int64_t ans = 0;
	for(int t = 1; t < n + 1 && a * t < 50 * n + 1; t++){
		cerr << t << ' ' << a * t << ' ' << dp[n][t][a * t] << endl;
		ans += dp[n][t][a * t];
	}
	cout << ans << endl;
}

Measured memory_bytes: 51072
#include <iostream>
#include <vector>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;

#define ll long long

int main(){

    ll int n, m;
    cin >> n >> m;
    ll int arr[n];
    ll int totalNoOfVotes=0;
    for(int i=0; i<n; i++){
        cin >> arr[i];
        totalNoOfVotes+=arr[i];
    }

    ll int threshold = ceil((long double)totalNoOfVotes/(4*m));

    ll int count=0;
    for(int i=0; i<n; i++){
        if(arr[i]>=threshold) count++;
    }

    if(count>=m) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		long N = input.nextLong();
		long M = input.nextLong();
      	if (M==1||N==1) System.out.println(1);
		else if (N%2==1&&M%2==1) System.out.println(M*N/2+1);
		else System.out.println(M*N/2);
	}
}

Measured memory_bytes: 21972
def q2():
    """B - ROT N"""
    N = int(input())
    S = list(input())
    
    for s in S:
        tmp = ord(s) + N
        if tmp > ord('Z'):
            tmp -= ord('Z') - ord('A') + 1
            
        print(chr(tmp), end='')
        
    print('')


if __name__ == '__main__':
    q2()


Measured memory_bytes: 4596
import java.util.Scanner;

public class Main {

    public static void main(String[] args)  {
        //input
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(lcm(a, b));
    }

    private static long gcd(long m, long n) {
        if (m < n) return gcd(n, m);
        if (n == 0 ) return m;
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
}

Measured memory_bytes: 22608
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  string s;
  cin >> s;
  int n = s.size();
  rep(i, 1, n) {
    int len = n - i;
    int mid = (len + 1) / 2;
    string a = s.substr(0, mid);
    string b = s.substr(mid, len - mid);
    if (a == b) {
      cout << a.size() * 2 << endl;
      return 0;
    }
  }
  cout << 1 << endl;
}


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

A = [list(map(int, input().split()))  for i in range(N)]

def Ans(n,a):
    for i in range(n-2):
        if a[i][0] == a[i][1]:
            if a[i+1][0] == a[i+1][1]:
                if a[i+2][0] == a[i+2][1]:
                    return('Yes')
                else:
                    continue
            else:
                continue
        else:
            continue
    return('No')
                    
print(Ans(N,A))

Measured memory_bytes: 9032
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000

//aのb乗
int beki(int a,int b){
	int x = 1;
	while(b!=0){
		if(b&1){
			x=mod(x*a);
		}
		a=mod(a*a);
		b>>=1;
	}
	return x;
}

//aの逆元
int gyakugen(int a){
	return beki(a,modulo-2);
}

int main(){
	
	int N;
	cin>>N;
	
	vector<int> A(N);
	for(int i=0;i<N;i++)cin>>A[i];
	
	int X = 1000001;

	vector<int> cnt(X,0);
	for(int i=0;i<N;i++){
		cnt[A[i]]++;
	}
	
	vector<int> sum(X,0);
	/*
	for(int i=0;i<N;i++){
		for(int j=0;j<yakusuu[A[i]].size();j++){
			sum[yakusuu[A[i]][j]] = mod(sum[yakusuu[A[i]][j]] + A[i]);
		}
	}*/
	
	for(int i=1;i<X;i++){
		for(int j=i;j<X;j+=i){
			int a = mod(j * cnt[j]);
			sum[i] = mod(sum[i] + a);
		}
	}
	
	vector<int> gyaku(X,0);
	for(int i=1;i<X;i++){
		gyaku[i] = mod(gyaku[i] + gyakugen(i));
		for(int j=2*i;j<X;j+=i){
			gyaku[j] = mod(gyaku[j] - gyaku[i]);
		}
	}
	
	int ans = 0;
	
	for(int i=1;i<X;i++){
		int a = mod(sum[i]*sum[i]);
		a = mod(a*gyaku[i]);
		ans = mod(ans + a);
	}
	
	for(int i=0;i<N;i++){
		ans = mod(ans - A[i]);
	}
	ans = mod(ans * gyakugen(2));
	
	cout<<ans<<endl;
		
		
	
	
	return 0;
}



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

int main() {
  double N; cin >> N;
  double ans = ((int)N%2==0) ? 1.0/2.0 : (N+1.)/(2*N);
  cout << fixed << setprecision(8);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
A, B, C, D = map(str, input())

for op1 in '+-':
    for op2 in '+-':
        for op3 in '+-':
            if eval(A+op1+B+op2+C+op3+D) == 7:
                print(A+op1+B+op2+C+op3+D+'=7')
                exit()

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int n, m;
    cin >> n >> m;
    vector<tuple<int, int, int>> es;
    vector<vector<int>> dist(n, vector<int>(n, INF));
    for(int i = 0; i < m; ++i){
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        es.emplace_back(a, b, c);
        dist[a][b] = dist[b][a] = c;
    }
    for(int i = 0; i < n; ++i)  dist[i][i] = 0;
    
    for(int k = 0; k < n; ++k){
        for(int i = 0; i < n; ++i){
            for(int j = 0; j < n; ++j){
                chmin(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int ans = 0;
    for(auto e : es){
        int a, b, c;
        tie(a, b, c) = e;
        bool ok = false;
        for(int i = 0; i < n; ++i){
            for(int j = 0; j < n; ++j){
                if(dist[i][j] == dist[i][a] + dist[b][j] + c){
                    ok = true;
                    break;
                }
                if(dist[i][j] == dist[i][b] + dist[a][j] + c){
                    ok = true;
                    break;
                }
            }
            if(ok)  break;
        }
        if(ok)  ++ans;
    }
    ans = m - ans;
    cout << ans << endl;
}

Measured memory_bytes: 3704
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, A, B;
    cin >> N >> A >> B;
    ll ans = 0;
    ll cnt = N / (A + B);
    ans += A * cnt;
    N -= cnt * (A + B);
    if(N > A) ans += A;
    else ans += N;

    cout << ans << endl;
}

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

using ll = long long;
const ll INF = 1e18;

int main() {
    int N;
    cin >> N;
    cout << N * (N + 1) / 2 << "\n";
}

Measured memory_bytes: 256
/* ex3_4
   moka223711 */

#include <stdio.h>

int main(void){
	int num, d = 0;
	scanf("%d", &num);

	// numを1から9で割って、余りが0かつ商が9以下になっているものを探す
	// 割れるものが見つかったらdを1に変える
	for(int i = 1; i <= 9; i++){
		if(num % i == 0 && num / i <= 9){
			d = 1;
			break;
		}
	}
	
	// 上のfor文で1から9で割り切れるものが見つかったときd == 1となっているため
	// if文が実行される、なかったときはelse文の実行
	if(d){
		printf("Yes");
	}
	else{
		printf("No");
	}
  
	return 0;
}


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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)

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

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

int main() {
    int n,t;
    V<int> v;
    cin >> n;
    REP(i,n) {
        cin >> t;
        v.push_back(t);
    }

    int cnt = 0;

    FOR(i,1,n-1) {
        if(v[i-1] < v[i] && v[i] < v[i+1]) {
            cnt++;
        } else if(v[i-1] > v[i] && v[i] > v[i+1]) {
			cnt++;
		}
    }

    cout << cnt << endl;

}


Measured memory_bytes: 256
fun main(args: Array<String>) = yorukatsu10c()

fun yorukatsu10c() {
    val n = readLine()!!.toInt()
    val aList = (1..n).map { readLine()!!.toLong() }

    val answer = aList.groupBy { it }.count { it.value.size % 2 != 0 }

    println(answer)
}


Measured memory_bytes: 49304
#include<vector>
#include<map>
#include<algorithm>
#include<set>
#include<iostream>
#include<string>
#include<set>
#include<queue>
#include<random>

using namespace std;

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> st;*/

#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")

#define pb push_back
#define ld long double
#define int long long

mt19937 rnd(51);

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s, s1;
	cin >> s >> s1;
	for (int i = 0; i < s.size(); i++){
        if (s[i] != s1[i]){
            cout << "No";
            return 0;
        }
	}
	cout << "Yes";
	return 0;
}


Measured memory_bytes: 3664
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	string str;
	cin >> str;
	
	bool w=false,e=false,n=false,s=false;
	
	REP(i,str.size())
	{
		if(str[i] =='W')w=true;
		if(str[i] =='E')e=true;
		if(str[i] =='N')n=true;
		if(str[i] =='S')s=true;
	}
	
	if(((w)&&(!e))||((!w)&&(e))||((n)&&(!s))||((!n)&&(s)))
	{
		cout << "No" << endl;
	}
	else
	{
		cout << "Yes" << endl;
	}		
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;


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

    ll rc = 0, gc = 0, bc = 0;
    for(char c: S){
        if(c == 'R') rc++;
        if(c == 'G') gc++;
        if(c == 'B') bc++;
    }
    ll ans = rc * gc * bc;
    for(int i = 0; i < N-2; i++){
        for(int j = 1; i + 2 * j < N; j++){
            if(S[i] != S[i + j] && S[i] != S[i + 2 * j] && S[i + j] != S[i + 2 * j]) ans--;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3648
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int main() {
	int n, f; cin >> n >> f;
	map<pair<string, string>, int> ma;
	rep(i, n) {
		int m; cin >> m;
		VS item(m); rep(j, m)cin >> item[j];
		for (int j = 0; j < m; j++) {
			for (int k = j + 1; k < m; k++) {
				string str1 = item[j], str2 = item[k];
				if (str1 > str2)swap(str1, str2);
				ma[mp(str1, str2)]++;
			}
		}
	}

	vector<pair<string, string>> p;
	for (auto aa : ma) {
		if (aa.second >= f)p.pb(aa.first);
	}
	sort(all(p));

	Cout(sz(p));
	for (auto aa : p) {
		Cout2(aa.first, aa.second);
	}
}


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

#define REP(i,a,b) for(int i=a,i##_end_=b;i<=i##_end_;++i)
#define DREP(i,a,b) for(int i=a,i##_end_=b;i>=i##_end_;--i)
#define debug(x) cout<<#x<<"="<<x<<endl
#define fi first
#define se second
#define mk make_pair
#define pb push_back
typedef long long ll;

using namespace std;

void File(){
	freopen("d.in","r",stdin);
	freopen("d.out","w",stdout);
}

template<typename T>void read(T &_){
	_=0; T f=1; char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())_=(_<<1)+(_<<3)+(c^'0');
	_*=f;
}

const int maxn=1e5+10;
int n,a[maxn];

int main(){
	//File();
	read(n);
	REP(i,1,n)read(a[i]);
	REP(i,1,n)if(a[i]%2)return puts("first"),0;
	puts("second");
	return 0;
}

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

int main() {
  ll a,b,k;
   cin >> a >> b >> k;
   if(a <= k){
     cout << 0 << " ";
     if(b <= k-a){
       cout << 0;
     }else{
       cout << (a+b-k);
     }
   }else{
     cout << a-k << " "<< b;
   }
  return 0;
}

Measured memory_bytes: 256