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

using namespace std;

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

  int N; cin>>N;
  vector<pair<double, double>> dot(N);
  for (int i = 0; i < N; i++) {
    cin>>dot[i].first>>dot[i].second;
  }
  auto is_ok = [&](double r) -> bool {
    if (r == 0)
      return false;
    vector<pair<double, double>> cs;
    for (int i = 0; i < N; i++) {
      auto a = dot[i];
      for (int j = i+1; j < N; j++) {
        auto b = dot[j];
        auto check = [&](pair<double, double> c) {
          int k = 0;
          for (; k < N; k++) {
            if (k == i or k == j)
              continue;
            auto d = sqrt(pow(dot[k].first-c.first, 2) + pow(dot[k].second-c.second, 2));
            if (d > r+0.00000001)
              break;
          }
          return k == N;
        };
        auto l = sqrt(pow(a.first-b.first, 2) + pow(a.second-b.second, 2));
        if (l > r*2)
          return false;
        if (l == 0) {
          if (check(a))
            return true;
        } else {
          auto h = r * sqrt((double)1-l*l/(4*r*r));
          pair<double, double> c = {(a.first+b.first)/2, (a.second+b.second)/2};
          auto ccos = (b.second-a.second)/l;
          auto csin = (a.first-b.first)/l;
          if (check({c.first+h*ccos, c.second+h*csin}))
            return true;
          if (check({c.first-h*ccos, c.second-h*csin}))
            return true;
        }
      }
    }
    return false;
  };

  double ng = 0, ok = 2048;
  for (int i = 0; i < 100; i++) {
    auto r = (ok+ng)/2;
    if (is_ok(r)) {
      ok = r;
    } else {
      ng = r;
    }
  }
  cout << fixed << ok << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<map>
using namespace std;
map<int, bool> lib;
int main()
{
    int n; cin>>n; bool flag = true;
    while(n--){
        int a; cin>>a; 
        if(lib.count(a)) flag = false;
        if(!flag) break;
        lib[a] = true;
    }
    if(flag) puts("YES"); else puts("NO");
}

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

int main(){
	int N, K; cin>>N>>K;
	vector<int> A(N); rep(i, N) cin>>A[i];
	int ng = 0, ok = 1e9; // (ng,ok] = (l,r]
	while(ok - ng > 1){
		int m = (ok + ng) / 2;
		int64_t c = 0;
		rep(i, N) c += (A[i] - 1) / m;
		if(c <= K) ok = m; else ng = m;
	}
	cout<< ok <<endl;
}


Measured memory_bytes: 3968
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        //ArrayList<Integer> list;
        int n = sc.nextInt();

        if(n % 10 == 3){
            System.out.println("bon");
        }else if(n % 10 == 0||n % 10 == 1||n % 10 == 6||n % 10 == 8){
            System.out.println("pon");
        }else{
            System.out.println("hon");
        }
        
    
	}
}

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

int main() {
    int N, K;
    int i;
    int a = 1;
    cin >> N >> K;
    for(i = 0;i < N;i++) {
        if(a * 2 < a + K) {
            a *= 2;
        }else {
            a += K;
        }
    }
    cout << a << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int ans,a[1000010];
int main(){
	cin>>s;
	for (int i=1;i<=s.size();i++) a[i]=s[i-1]-'0';
	for (int i=s.size();i>=0;i--){
		int j=i;
		while (j>=0&&a[j]>=5) j--;
		if (a[i]==10)
			a[i-1]++;
		else if ((i-j==2&&j!=5)||(i-j>2)){
			a[j]++;
			for (int k=j+1;k<=i;k++) ans+=10-a[k]-1;
			ans++;
			i=j+1;
		}
		else if (i>=2&&a[i-1]==9&&10-a[i]<2+a[i]){
			ans+=10-a[i];
			a[i]=a[i-1]=0;
			a[i-2]++;
			i-=1;
		}
		else if (a[i]<=11-a[i])
			ans+=a[i];
		else{
			ans+=10-a[i];
			a[i]=0;
			a[i-1]++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5252
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint>> que;
priority_queue<llint> q;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

llint s,w;

void solve(){
	cin >> s >> w;
	if(s<=w)cout << "unsafe";
	else cout << "safe";
	cout << endl;
}

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


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define pq priority_queue
using namespace std; typedef pair<int, int> P; typedef pair<int, P> P2; typedef pair<int, P2> P3;
constexpr long long gcd(long long a, long long b){return b ? gcd(b, a % b) : a;}
constexpr long long lcm(long long a, long long b){return a / gcd(a, b) * b;}
constexpr int INF = 1e9, MOD = INF + 7, around[] = {0, 1, 1, -1, -1, 0, -1, 1, 0, 0};
constexpr int mod_pow(long long x, long long n, const int mod){long long ret=1;while(n){if(n&1)(ret*=x)%=mod;(x*=x)%=mod;n>>=1;}return ret;}
template<int n> struct Prime{bool arr[n+1];constexpr bool operator[](int k){return arr[k];}constexpr Prime():arr(){for(int i=2;i<n;i++){arr[i]=true;for(int j=2;j*j<=i;j++){if(!(i%j))arr[i]=false;}}}};
template<int n> struct Factorial{long long arr[n+1],ary[n+1];constexpr Factorial():arr(),ary(){arr[0]=1;ary[0]=1;for(int i=0;i<n;i++){arr[i+1]=arr[i]*(i+1)%MOD;ary[i+1]=mod_pow(arr[i+1],MOD-2,MOD);}}};
constexpr Factorial<1010> fact; constexpr Prime<10> prime;
constexpr long long comb(int a, int b){if(a < b) return 0LL;if(!a or !b) return 1LL; long long pos = fact.arr[a], pot = fact.ary[a - b], por = fact.ary[b]; return pos * pot % MOD * por % MOD;}
template<int n> struct Bernoulli{long long arr[n+1];constexpr Bernoulli():arr(){arr[0]=1;for(int i=1;i<=n;i++){long long sum=0;for(int j=0;j<i;j++){(sum+=comb(i+1,j)*arr[j]%MOD)%=MOD;}arr[i]=(MOD-mod_pow(i+1,MOD-2,MOD))%MOD*sum%MOD;}}};
constexpr int vx[] = {1, 0, -1, 0}, vy[] = {0, 1, 0, -1};
constexpr long double PI = abs(acos(-1));
constexpr int sqrtN = 512, logN = 32;
constexpr long long LINF=1e18;

int main(){
	int a[3]; cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	
	int c = 0;
	while(a[1] < a[2]){
		a[0]++; a[1]++; c++;
	}
	
	while(a[0] < a[1]){
		a[0] += 2; c++;
	}
	
	if(a[0] > a[1]) cout << c + 1 << endl;
	else cout << c << endl;
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<long long>> VVLL;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) (a).begin(),(a).end()

const int MOD = 1000000007;

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

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

void debug(VI &arr){
	int n=arr.size();
	rep(i,n){
		cout<<arr.at(i)<<endl;
	}
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

void debug(VVLL &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout<<board.at(i).at(j)<<" ";
		}
		cout<<endl;
	}
}

void debug(VS &board){
	int h = board.size();
	rep(i,h){
		cout<<board.at(i)<<endl;
	}
	return;
}

LL gcd(LL a,LL b){
	return b==0?a:gcd(b,a%b);
}

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

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	int a;
	cin>>a;
	cout<<a+a*a+a*a*a<<endl;
	return 0;
}


Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main() {
    int n, *p, ans = 0;
    cin >> n;
    p = new int[n];
    for (int i = 0; i < n; i++)
        cin >> p[i];
    for (int i = 1; i < n-1; i++) {
        if (p[i-1] < p[i] && p[i] < p[i+1])
            ans++;
        else if (p[i-1] > p[i] && p[i] > p[i+1])
            ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//author:emre yazicioglu

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define fori(a,b,c) for(ll a = b;a < ll(c);a++)
#define ford(a,b,c) for(ll a = b;a >= ll(c);a--)
#define pb push_back

const int N = 2e6 + 7;
ll n,m,k,ans,cur = 1,ar[N],fak[N] = {1,1};
ll sum,a,b,c,d;
string str[N];
vector<ll> v;

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);

	// freopen("../in.txt","r",stdin);
	// freopen("../out.txt","w",stdout);
	
	cin >> n;
	
	fori(i,2,1e5 + 1){
		fak[i] = i * (i - 1);
	}


	fori(i,0,n){
		cin >> str[i];
		sort(str[i].begin(),str[i].end());
	}

	sort(str, str + n);
	
	fori(i,0,n){
		if(str[i] == str[i + 1])
			cur++;
		else{
			v.pb(cur);
			cur = 1;
		}
	}

	fori(i,0,v.size()){
		// cout << v[i] << ' ';
		if(v[i] > 1){
			ans+=fak[v[i]]/2;
		}
	}

	cout << ans;
	// read question and limits again
}

Measured memory_bytes: 24060
#include <iostream>
using namespace std;
int main(){
  int k,s,c,i;
  while(1){
    cin >>k;
    if (!k) break;
    for(i=0,s=0;i<k*(k-1)/2;i++)
      cin>>c,s+=c;
    cout <<s/(k-1)<<endl;   
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		
		int K = scanner.nextInt();
		String S = scanner.next();	
		
		scanner.close();
		
		if (S.length() <= K) {
			System.out.println(S);
		} else {
			System.out.println(S.substring(0, K) + "...");
		}
	}

}


Measured memory_bytes: 27080
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N,A,B;
    cin >>N>>A>>B;
    
    cout << min(A*N,B) << endl;


    return 0;
    

}

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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int res = 0;
  for (int a = 0; a <= A; ++a) {
    for (int b = 0; b <= B; ++b) {
      for (int c = 0; c <= C; ++c) {
        int total = 500*a + 100*b + 50*c; // 合計金額
        if (total == X) ++res; // 合計金額が X に一致したら答えをインクリメント
      }
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define inf (int)(1e9)

int main(){
  while(1){
    int N, M, C, s, g, i, j, k;
    scanf("%d%d%d%d%d", &N, &M, &C, &s, &g);
    if(N == 0){
      return 0;
    }
    s--;
    g--;
    vector<vector<vector<int>>> dists(C, vector<vector<int>>(N, vector<int>(N, inf)));
    int x, y, d, c;
    for(i = 0; i < M; i++){
      scanf("%d%d%d%d", &x, &y, &d, &c);
      x--;
      y--;
      c--;
      dists[c][x][y] = min(dists[c][x][y], d);
      dists[c][y][x] = min(dists[c][y][x], d);
    }
    for(c = 0; c < C; c++){
      for(k = 0; k < N; k++){
        for(i = 0; i < N; i++){
          for(j = 0; j < N; j++){
            dists[c][i][j] = min(dists[c][i][j], dists[c][i][k] + dists[c][k][j]);
          }
        }
      }
    }
    vector<vector<int>> disall(N, vector<int>(N, inf));
    vector<int> p(C);
    for(c = 0; c < C; c++){
      scanf("%d", &p[c]);
    }
    for(c = 0; c < C; c++){
      vector<int> q(p[c]), r(p[c]);
      for(i = 0; i < p[c] - 1; i++){
        scanf("%d", &q[i]);
      }
      q[p[c] - 1] = inf;
      for(i = 0; i < p[c]; i++){
        scanf("%d", &r[i]);
      }
      vector<int> d_to_prise(20001, 0);
      for(i = 1, j = 0; i <= 20000; i++){
        if(q[j] < i){
          j++;
        }
        d_to_prise[i] = d_to_prise[i - 1] + r[j];
      }
/*      for(i = 0; i < 20; i++){
        printf("d_to_prise[%d] = %d\n", i, d_to_prise[i]);
      }
*/      for(i = 0; i < N; i++){
        for(j = 0; j < N; j++){
          if(dists[c][i][j] < inf){
            disall[i][j] = min(disall[i][j], d_to_prise[dists[c][i][j]]);
          }
        }
      }
    }
    for(k = 0; k < N; k++){
      for(i = 0; i < N; i++){
        for(j = 0; j < N; j++){
          disall[i][j] = min(disall[i][j], disall[i][k] + disall[k][j]);
        }
      }
    }
    if(disall[s][g] >= inf){
      printf("-1\n");
    }
    else{
      printf("%d\n", disall[s][g]);
    }
  }
}



Measured memory_bytes: 3980
N=int(input())
x=[0 for i in range(N)]
y=[0 for i in range(N)]
for i in range(N):
    x[i],y[i]=map(int,input().split())
A=[(x[i],y[i]) for i in range(N)]
B=[(x[i],y[i]) for i in range(N)]
A.sort(key=lambda p:p[0]+p[1])
B.sort(key=lambda p:p[0]-p[1])
def dist(a,b):
    return abs(a[0]-b[0])+abs(a[1]-b[1])
ans0=dist(A[0],A[-1])
ans1=dist(B[0],B[-1])
print(max(ans0,ans1))

Measured memory_bytes: 110000
#include<iostream>
#include<math.h> 
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long int lli;
lli mod=1000000007;
vector < lli> primes;

void Sieve(lli n) 
{ 
    bool prime[n+1];
	for(lli i=0;i<n+1;++i)
		prime[i]=true;
    for (lli p=2;p*p<=n;++p) 
    {
        if (prime[p] == true) 
        {  
            for (lli i=2*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    }  
    for(lli p=2; p<=n; p++) 
       if (prime[p]) 
		primes.push_back(p);  
}
lli gcd(lli a,lli b)  
 {
    if(b>a)
        swap(a,b);
    if (a%b==0)  
        return b;  
    else 
        return gcd(a%b,b);  
 }
lli lcm(lli a,lli b)
{
    return (a*b)/gcd(a,b);    
}
lli power(lli x,lli y,lli m)   
{ 
    lli res = 1; 
    x=x%m;   
    while (y > 0) 
    {  
        if (y%2==1) 
            res =(res*x)%m;  
        y=y/2; 
        x=(x*x)%m; 
    } 
    return res; 
}
bool sortcol( const vector<lli>& v1, const vector<lli>& v2 ) { 
    return v1[1] < v2[1]; 
}
bool sortcol1( const vector<lli>& v1, const vector<lli>& v2 ) { 
    return v1[0] < v2[0]; 
}
int main()
{
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	lli n,cnt=0;
	cin>>n;
	lli p[n];
	for(lli i=0;i<n;++i)
		cin>>p[i];
	for(lli i=1;i<n-1;++i)
	{
		if((p[i]>p[i-1]&&p[i]<p[i+1])||(p[i]<p[i-1]&&p[i]>p[i+1]))
			cnt++;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
using namespace std;
int top, S[200];//?????¶??????top?????¨??\?????¨??°???????????´??´?????°???S
void push(int x)
{
	 top++;
	S[top] = x; //??\?????¶?????????????????°???
}
int pop()
{ 
	int x= S[top];
	top--;//????????¶??????????????°?????????????????????
	return x;
}
int main()
{
	int a, b;
	top = 0;//?????????
	int i = 0;
	char s[100];
	//cout << "---";
	while (scanf("%s",s)!=EOF)
	{

		if (s[0] == '+')
		{
			a = pop();

			b = pop();
	
			push(a + b);
		
		}
		else if (s[0] == '-')
		{
			b = pop();
		
			a = pop();
		
			push(a - b);
		
		}
		else if (s[0] == '*')
		{
			a = pop();
		
			b = pop();
		
			push(a*b);
		
		}
		else
		{
			push(atoi(s));

		}
		i++;
	}
	printf("%d\n", pop());
	return 0;

}

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

struct Edge
{
    int nxt, to;
} e[200010];
int head[100010], cnt;

void add_edge(int a, int b)
{
    e[++cnt] = { head[a], b };
    head[a] = cnt;
}

bool ok = 1;

bool dfs(int nod, int tata)
{
    int grad(0);
    for (int i(head[nod]); i; i = e[i].nxt)
        if (e[i].to != tata)
            grad += dfs(e[i].to, nod);
    if (grad <= 1)
        return 1 - grad;
    ok = 0;
    return 0;
}

int main()
{
    int n, a, b;
    cin >> n;

    while (--n) {
        cin >> a >> b;
        add_edge(a, b);
        add_edge(b, a);
    }

    if (dfs(1, 0) || !ok)
        cout << "First";
    else
        cout << "Second";

    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
typedef pair <int,int> P;
const ll MAX_N = 100000;

int main() {
ll h,a;
ll ans = 0;

scanf("%lld%lld",&h,&a);

ans = h/a;
if(h%a != 0)ans++;
printf("%lld",ans);

	return 0;
}

Measured memory_bytes: 256
# B - Red or Blue

N = int(input())
s = input()

cntR = 0
cntB = 0

for i in s :
    if i == "R" :
        cntR += 1
    else :
        cntB += 1

if cntR > cntB :
    print("Yes")
else :
    print("No")
    

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

typedef long long int64;

#define MAX_N 200005

struct data {
	double ratio;
	int64 cost, profit;
};

void DFS(int depth, vector <data>& vs, int64 value, int64 now, int64& res){
	if(depth == 3){
		res = max(res, value + now);
		return;
	}

	if(value + now * max(1.0, vs[depth].ratio) < res) return;
	
	int64 upper = now / vs[depth].cost;
	if(vs[depth].ratio <= 1) upper = 0LL;
	for(int64 i = upper; i >= 0; i--){
		int64 remain = now - i * vs[depth].cost;
		DFS(depth + 1, vs, value + i * vs[depth].profit, remain, res);
	}
}

int64 solve(int64 N, int64 a, int64 b, int64 c, int64 A, int64 B, int64 C) {
	vector <data> vs;
	vs.push_back(data{1.0 * A / a, a, A});
	vs.push_back(data{1.0 * B / b, b, B});
	vs.push_back(data{1.0 * C / c, c, C});
	sort(vs.begin(), vs.end(), [](auto& lhs, auto& rhs){ return lhs.ratio > rhs.ratio;});
	int64 res = 0LL;
	DFS(0, vs, 0LL, N, res);
	return res;
}

int main() {
	// freopen("input.txt", "r", stdin);

	int64 N, gA, sA, bA, gB, sB, bB;
	scanf("%lld", &N);
	scanf("%lld %lld %lld", &gA, &sA, &bA);
	scanf("%lld %lld %lld", &gB, &sB, &bB);
	int64 M = solve(N, gA, sA, bA, gB, sB, bB);
	int64 res = solve(M, gB, sB, bB, gA, sA, bA);
	printf("%lld\n", res);
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod, digitDP, treeDP//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vl flag, D; vll path;
//***********//
int main() {
	cin >> N;
	string S;
	cin >> S;
	ll status = 0;
	ll L = 0, R = 0;
	ll flag = 0;
	for (i = 0; i < N; i++) {
		if (S[i] == ')') {
			status++;
		}
		else {
			status--;
		}
		if (status > 0) {
			L++;
			status--;
		}
	}
	if (status < 0) {
		R +=abs(status);
	}
	for (i = 0; i < L; i++) cout << "(";
	cout << S;
	for (i = 0; i < R; i++) cout << ")";
}

Measured memory_bytes: 3592
/*I MAY NOT GET THE SUCCESS IMMEDIATELY BUT I WILL GET IT FOR SURE*/
#include<bits/stdc++.h>
#define opt std::ios_base::sync_with_stdio(false)
#define I int
#define li		int32_t
#define lli		long long
#define ulli unsigned long long

#define pn			 printf("\n")
#define nl			 cout<<'\n'
#define sf(N)        scanf("%lld",&N)
#define pf(N)        printf("%lld",N)
#define sf1(N1,N2)    scanf("%lld %lld",&N1,&N2)
#define pf1(N1,N2)    printf("%lld %lld",N1,N2)
#define sf2(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define pf2(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define sl          cout<<' '
#define ps          printf(" ")

#define rep(i,a,b)	for(i=a;i<b;i++)
#define repr(i,a,b)	for(i=a;i>b;i--)
#define elif		else if
#define mset(a,b)	memset(a,b,sizeof(a))

#define pb		push_back
#define pob		pop_back
#define itr		iterator
#define sz()	size()
#define szof    sizeof
#define lb		lower_bound
#define ub		upper_bound
#define mp		make_pair
#define vlli    vector<lli>
#define plli	pair<lli,lli>
#define vplli	vector<plli >
#define F   	first
#define S		second
#define Dup     erase(unique(V.begin(),V.end()),V.end())

#define bs      binary_search
#define ub      upper_bound
#define lb      lower_bound

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

#define MX1     100000LL
#define MX2     1000000LL
#define Inf     1000000000000000LL
#define mod		1000000007LL
using namespace std;

lli Power(lli a,lli b)
{
    lli result=1;

    while(b)
    {
        if(b%2)
        {
            result=(result*a)%mod;
        }

        b=b>>1;
        a=(a*a)%mod;
    }

 return result;
}

lli F[1000];

int main()
{
    opt;

    /*#ifndef ONLINE_JUDGE
    freopen("double_squares.txt","r",stdin);
    freopen("double_squares_out.txt","w",stdout);
    #endif // ONLINE_JUDGE*/

    F[1]=1;
    F[0]=2;

    lli N,i;
    cin>>N;

    rep(i,2,N+1)
    {
        F[i]=F[i-1]+F[i-2];
    }

    cout<<F[N];







 return 0;
}


Measured memory_bytes: 256
arr = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'.split(', ')
K = int(input())
print(arr[K-1])


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long h = sc.nextLong();
		long w = sc.nextLong();
		sc.close();

		if (h == 1 || w == 1) {
			System.out.println(1);
		} else {
			System.out.println((h * w + 1) / 2);
		}
	}
}


Measured memory_bytes: 22228
#include<cstdio>

int main(){
    int a[3], b[3], c[3][3];
    for(int i = 0; i < 3; i++){
        scanf("%d%d%d", &c[i][0], &c[i][1], &c[i][2]);
    }
    bool ans = true;
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < 2; j++){
            if(!(c[i][j] + c[i+1][j+1] == c[i][j+1] + c[i+1][j]))
                ans = false;
        }
    }
    if(ans) puts("Yes");
    else puts("No");
    return 0;
}


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

const double pi  = 2 * acos(0.0);
const double eps = 1e-8;

#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<29)
#define INFLL (1LL<<62)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  rep(i, N) cin >> A[i];

  int lcm = N * M / __gcd(N, M);

  int ans = 0;
  int mini = 101;
  int maxi = -1;
  for (int i = 0; i < lcm; i++) {
    if (i && i % M == 0) {
      ans += maxi - mini;
      mini = 101;
      maxi = -1;
    }
    mini = min(A[i % N], mini);
    maxi = max(A[i % N], maxi);
  }

  ans += maxi - mini;

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

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

int dp[51];
int data[2][6] = {{ 2, 3, 5, 10, 12, 15 }, {380, 550, 850, 1520, 1870, 2244}};

int main() {
	fill(dp, dp + 51, INF);
	dp[0] = 0;
	REP(i, 6) {
		REP(j, 51) {
			if (j - data[0][i] >= 0)
				dp[j] = min(dp[j], dp[j - data[0][i]] + data[1][i]);
		}
	}
	
	int x;
	while (cin >> x, x) cout << dp[x / 100] << endl;
	return 0;
}

Measured memory_bytes: 1160
from sys import stdin, setrecursionlimit

setrecursionlimit(10 ** 9)


def input():
    return stdin.readline().strip()

X = int(input())
for A in range(-10 ** 3, 10 ** 3):
    A5 = A ** 5
    for B in range(-10 ** 3, 10 ** 3):
        if A5 - B ** 5 == X:
            print(A, B)
            exit()




Measured memory_bytes: 65476
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
 
int main(){
  int n;
  cin>>n;
  map<string,int>mp;
  rep(i,n){
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    mp[s]++;
  }
  long long ans=0;
  for(auto &p:mp){
    int s=p.second;
    ans+=(long long)s*(s-1)/2;
  }
  cout<<ans<<endl;
}
  /*
  
  long long ans=0;
  
  
  rep(i,n){
    cnt+=(long long)(mp[s[i]]*(mp[s[i]]-1))/2;
  }*/
  

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    ll n;
    cin >> n;
    vector<ll>a(n);
    for(ll i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    if(n%2==0){
        bool judge=true;
        for(ll i=0;i<n;i+=2){
            if(a[i]!=a[i+1]||a[i]!=i+1){
                judge=false;
                break;
            }
        }
        if(judge==false){
            cout << 0 << endl;
            return 0;
        }
    }
    else {
        bool judge=true;
        if(a[0]!=0) judge=false;
        for(ll i=1;i<n;i+=2){
            if(a[i]!=a[i+1]||a[i]!=i+1){
                judge=false;
                break;
            }
        }
        if(judge==false){
            cout << 0 << endl;
            return 0;
        }
    }
    ll x=n/2;
    ll ans = modpow(2,x,MOD);
    cout << ans << endl;
}


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



int B_search(int *data,int size,int x){
  int min=0,max=size-1,mid;
  while(min<=max){
    mid=(min+max)/2;
    if(data[mid]<x) min=mid+1;
    else if(x<data[mid]) max=mid-1;
    else return mid;
  }
  return -1;
}

int main(){
  int i,n,q,count=0,x;
  int *S;
  scanf("%d",&n);
  S=malloc(n*sizeof(int));
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&x);
    if(B_search(S,n,x)!=-1) count++;
  }
  printf("%d\n",count);
  return 0;
}
  

Measured memory_bytes: 984
N=int(input())
L=list(map(int,input().split()))
suml=sum(L)
l,ll,i=L[0],0,0
while l<suml/2:
  i+=1
  ll=l
  l+=L[i]

key=min(l-suml/2,suml/2-ll)
print(int(key*2))

Measured memory_bytes: 31384
#include<iostream>
#include<algorithm>
using namespace std;
int a[52],sum;
int cmp(int a,int b)
{
	return a>b;
}
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	cin>>a[i];
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=k;i++)
	sum+=a[i];
	cout<<sum;
}

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

using namespace std;

#define ll long long
#define mod 1000000007
#define mx 1000000000
#define endl '\n'

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m;
    cin>>n>>m;
    vector<string> s(n);
    for(int i = 0;i<n;i++)cin>>s[i];
    ll arr[n][m];
    for(int i = 0;i<n;i++){
        if(s[i][0] == '.')arr[i][0] = 1;
        else{
            for(int j = i;j<n;j++){
                arr[j][0] = 0;
            }
            break;
        }
    }
    for(int i = 0;i<m;i++){
        if(s[0][i] == '.')arr[0][i] = 1;
        else {
            for(int j = i;j<m;j++){
                arr[0][j] = 0;
            }
            break;
        }
    }
    for(int i = 1;i<n;i++){
        for(int j = 1;j<m;j++){
            if(s[i][j] == '#')arr[i][j] = 0;
            else{
                arr[i][j] = arr[i-1][j] + arr[i][j-1];
                arr[i][j] %= mod;
            }
        }
    }
    cout<<arr[n-1][m-1];
    return 0;
}



Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

string L;

lint dp[114514][2];

lint find(int now, bool is_less){
    if(now == L.size()){
        return 1;
    }else if(dp[now][is_less] != -1){
        return dp[now][is_less];
    }
    if(is_less){
        return dp[now][is_less] = find(now + 1, true) * 3 % mod;
    }else{
        if(L[now]){
            return dp[now][is_less] = (find(now + 1, false) * 2 + find(now + 1, true)) % mod;
        }else{
            return dp[now][is_less] = find(now + 1, false);
        }
    }
}

int main(){
    cin >> L;
    for(int i = 0; i < L.size(); i++){
        L[i] -= '0';
    }
    memset(dp, -1, sizeof(dp));
    cout << find(0, false) << endl;
}


Measured memory_bytes: 6912
import java.util.Scanner;

/**
 *
 * @author k16075kk
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
         Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int h = a/3600;
        int m = a%3600/60;
        int s = a%3600%60;
        
        System.out.println(h + ":" +m + ":" + s);
    }
    
}



Measured memory_bytes: 26332
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long H, W, ANS = 0;
	string S[2000];
	static long long L[2000][2000] = {}, R[2000][2000] = {}, U[2000][2000] = {}, D[2000][2000] = {};
	cin >> H >> W;
	for (int i = 0; i < H; i++) cin >> S[i];
	for (int i = 0; i < H; i++) {
		int COUNT = 0;
		for (int j = 0; j < W; j++) {
			if (S[i][j] == '#') {
				COUNT = 0;
			}
			else {
				L[i][j] = COUNT;
				COUNT++;
			}
		}
	}
	for (int i = 0; i < H; i++) {
		int COUNT = 0;
		for (int j = W - 1; j >= 0; j--) {
			if (S[i][j] == '#') {
				COUNT = 0;
			}
			else {
				R[i][j] = COUNT;
				COUNT++;
			}
		}
	}
	for (int i = 0; i < W; i++) {
		int COUNT = 0;
		for (int j = 0; j < H; j++) {
			if (S[j][i] == '#') {
				COUNT = 0;
			}
			else {
				U[j][i] = COUNT;
				COUNT++;
			}
		}
	}
	for (int i = 0; i < W; i++) {
		int COUNT = 0;
		for (int j = H - 1; j >= 0; j--) {
			if (S[j][i] == '#') {
				COUNT = 0;
			}
			else {
				D[j][i] = COUNT;
				COUNT++;
			}
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			ANS = max(ANS, L[i][j] + R[i][j] + U[i][j] + D[i][j] + 1);
		}
	}
	cout << ANS << endl;
}

Measured memory_bytes: 129408
N = int(input())
x = {}
ans = {}
y = []
k = 1
l = 1
for i in list(map(int,input().split())):
    x[k] = i
    y.append(i)
    k += 1

y.sort()
m_1 = y[int(N/2)]
m_2 = y[int(N/2)-1]

for i,j in sorted(x.items(),key = lambda x: x[1]):
    if (int(N/2) >= l):
        ans[i] = m_1
        l+=1
    else:
        ans[i] = m_2
        l+=1

for i,j in sorted(ans.items()):
    print(j)

Measured memory_bytes: 71836
#include <cstdio>
using namespace std;

int main()
{
    int a, b;
    int sum, digit;

    while (scanf("%d %d", &a, &b) != EOF) {
        digit = 0;
        sum = a + b;
        while (sum > 0) {
            sum /= 10;
            digit++;
        }
        printf("%d\n", digit);
    }

    return 0;
}

Measured memory_bytes: 1028
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9


int main() {
	int n, h, w;
	cin >> n >> h >> w;
	cout << (n-h+1)*(n-w+1) << endl;


	return 0;
}

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

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0) break;

        vector<vector<bool> > scd(n, vector<bool>(31, false));
        for(int i=0; i<n; i++){
            int m;
            cin >> m;
            for(int j=0; j<m; j++){
                int day;
                cin >> day;
                scd[i][day] = true;
            }
        }
        
        vector<long long int> own(n);
        for(int i=0; i<n; i++){
            own[i] = 1LL<<i;
        }
        
        int ans = -1;
        for(int day=1; day<=30; day++){
            long long int maps = 0;
            for(int i=0; i<n; i++){
                if(scd[i][day]){
                    maps |= own[i];
                }
            }
            for(int i=0; i<n; i++){
                if(scd[i][day]){
                    own[i] = maps;
                }
            }
            if(maps == (1LL<<n)-1){
                ans = day;
                break;
            }
        }

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

Measured memory_bytes: 2964
#include<stdio.h>
#include<string.h>

int main() {
	int start[26];
	int goal[26];
	for (int i = 0; i < 26; i++) {
		start[i] = -1;
		goal[i] = -1;
	}
	char S[200002], T[200002];
	scanf("%s%s", S, T);
	//printf("%s %s", S, T);
	for (int i = 0; i < strlen(S); i++) {
		int a = S[i] - 'a';
		int b = T[i] - 'a';
		if (start[a] != -1 || goal[b] != -1) {
			if (start[a] != b || goal[b] != a) {
				puts("No");
				return 0;
			}
		}
		else {
			start[a] = b;
			goal[b] = a;
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 512
MOD = 998244353
N,S= map(int,input().split())
A= list(map(int,input().split()))


dp = [[0 for i in range(S+1)] for j in range(N+1)]
sumdp = [0 for i in range(S+1)]

dp[0][0] = 1
sumdp[0] = 1

for i in range(1,N+1):
    a = A[i-1]
    if a <= S:
        dp[i][a] += i
    for j in range(1,S+1):
        if j+a > S:
            break
        dp[i][j+a] += sumdp[j]
        dp[i][j+a] %= MOD
    for j in range(S+1):
        sumdp[j] = (sumdp[j] + dp[i][j]) % MOD
    
ans = 0
for i in range(1,N+1):
    ans = (ans + dp[i][S] * (N+1-i)) % MOD
print(ans % MOD)



Measured memory_bytes: 120048
#include<stdio.h>

#define MAX 2000000
void maxHeapify(int ) ;
  
int H,A[MAX+1];

int main(){
  int i;

  scanf("%d",&H);

  for(i=1;i<=H;i++)scanf("%d",&A[i]);
  for(i=H/2;i>=1;i--)maxHeapify(i);
  for(i=1;i<=H;i++){
    printf(" %d",A[i]);
  }

  printf("\n");
  
  return 0;
}

void maxHeapify(int i){
  int l,r,largest,C;
  l=2*i;
  r=2*i+1;

  if(l<=H&&A[l]>A[i])largest=l;
  else largest = i;
  if(r<=H&&A[r]>A[largest])largest=r;

  if(largest!=i){
    C=A[i];
    A[i]=A[largest];
    A[largest]=C;
    maxHeapify(largest);
  }
}



Measured memory_bytes: 3672
def numba_compile(numba_config):
    import os, sys
    if sys.argv[-1] == "ONLINE_JUDGE":
        from numba import njit
        from numba.pycc import CC
        cc = CC("my_module")
        for func, signature in numba_config:
            globals()[func.__name__] = njit(signature)(func)
            cc.export(func.__name__, signature)(func)
        cc.compile()
        exit()
    elif os.name == "posix":
        exec(f"from my_module import {','.join(func.__name__ for func, _ in numba_config)}")
        for func, _ in numba_config:
            globals()[func.__name__] = vars()[func.__name__]
    else:
        from numba import njit
        for func, signature in numba_config:
            globals()[func.__name__] = njit(signature, cache=True)(func)
        print("compiled!", file=sys.stderr)

import numpy as np

def solve(N, M, L, ABC, Q, ST):
    inf = 1<<61
    G = np.full((N+1, N+1), inf)
    G.ravel()[::N+2] = 0
    for i in range(M):
        a, b, c = ABC[i]
        G[a, b] = c
        G[b, a] = c
    for k in range(N+1):
        for i in range(N+1):
            for j in range(N+1):
                if G[i, j] > G[i, k] + G[k, j]:
                    G[i, j] = G[i, k] + G[k, j]
    G = np.where(G<=L, 1, inf)
    G.ravel()[::N+2] = 0
    for k in range(N+1):
        for i in range(N+1):
            for j in range(N+1):
                if G[i, j] > G[i, k] + G[k, j]:
                    G[i, j] = G[i, k] + G[k, j]
    G = np.where(G==inf, 0, G) - 1
    #Ans = G[ST[:, 0], ST[:, 1]]
    Ans = np.zeros(Q, dtype=np.int64)
    for i, (s, t) in enumerate(zip(ST[:,0], ST[:,1])):
        Ans[i] = G[s, t]
    return Ans

numba_compile([
    [solve, "i8[:](i8,i8,i8,i8[:,:],i8,i8[:,:])"]
])

N, M, L = map(int, input().split())
ABC = np.array([list(map(int, input().split())) for _ in range(M)], dtype=np.int64)
Q = int(input())
ST = np.array([list(map(int, input().split())) for _ in range(Q)], dtype=np.int64)

Ans = solve(N, M, L, ABC, Q, ST)
print("\n".join(map(str, Ans.tolist())))


Measured memory_bytes: 41364
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp6
{
    class Program
    {
        static void Main(string[] args)
        {


            int N = Readint();
            var L = Readints();
            L.Sort();
            int mx = L.Last();
            Console.WriteLine(L.Sum() - mx > mx ? "Yes":"No") ;
            /*
            var s = Console.ReadLine();
            var K = Readint();
            var dpt1=Enumerable.Repeat(0, s.Length).Select(x => Enumerable.Repeat(0, K + 1).ToArray()).ToArray();
            var dpt2 = Enumerable.Repeat(0, s.Length).Select(x => Enumerable.Repeat(0, K + 1).ToArray()).ToArray();

            dpt1[0][1] = int.Parse(s[0].ToString()) - 1;
            dpt2[0][1] = 1;
            dpt1[0][0] = 1;

            foreach (var i in Enumerable.Range(1,s.Length-1))
            {
                var current = int.Parse(s[i].ToString());
                dpt1[i][0]=1;
                for(int j=1; j<=K;j++)
                {
                    if (current == 0)
                    {
                        dpt1[i][j] += dpt1[i - 1][j];
                        dpt2[i][j] += dpt2[i - 1][j];
                        dpt1[i][j] += dpt1[i - 1][j - 1] * 9;

                    }
                    else
                    {

                        dpt1[i][j] += dpt1[i - 1][j];
                        dpt2[i][j] += dpt2[i - 1][j - 1];
                        dpt1[i][j] += dpt1[i - 1][j - 1] * 9;
                        dpt1[i][j] += dpt2[i - 1][j - 1] * (current - 1);
                    }

                }
            }

            foreach(var i in dpt1)
            {
                Console.WriteLine(i.LJoin());
            }
            Console.WriteLine();
            foreach(var i in dpt2)
            {
                Console.WriteLine(i.LJoin());
            }
 

            Console.WriteLine(dpt1[s.Length-1][K] + dpt2[s.Length-1][K]);
            Console.ReadLine();
           */

        }

        static List<int> Readints()
        {
            return  Console.ReadLine().Split(' ').Select(x =>x.ToInt()).ToList();
        }
        static int Readint()
        {
            return Console.ReadLine().ToInt();
        }
        static void Read2int(out int a,out int b)
        {
            var ints = Readints();
            a = ints[0];
            b = ints[1];
        }    
        static int Max(int a,int b)
        {
            return a > b ? a : b;
        }
        



    }

    static  class extensions
    {
        public static int ToInt(this string s)
        {
            return int.Parse(s);
        }

        public static string LJoin<T>(this IEnumerable<T> list)
        {
            return string.Join(" ",list);
        }


    } 


}


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

int main(){

vector<vector<int>> c(3,vector<int>(3));
for(int i=0;i<3;i++){
 for(int j=0;j<3;j++){
 cin >> c[i][j]; 
 }
}
 bool flag = false;
 for(int j=0;j<2;j++){
if(c[0][j]-c[0][j+1]==c[1][j]-c[1][j+1] && c[1][j]-c[1][j+1]==c[2][j]-c[2][j+1]){
flag=true;
}else {
  flag =false;
  break;
}
 }
if(flag) cout << "Yes" << endl;
   else cout << "No"    << endl;
}

Measured memory_bytes: 3644
import java.util.*;

/**
 * Main
 */
public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        int result = 0;
        String[] a_str = new String[n];
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(sc.next());
            result ^= a[i];
        }

        System.out.println(result == 0 ? "Yes" : "No");
    }
}

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

const int MOD = 1000000007;

int main() {
    int N, K;
    cin >> N >> K;

    vector<vector<long long>> C(N + 1, vector<long long>(N + 1));
    for (int i = 0; i <= N; i++) {
        C[i][0] = 1;
        C[i][i] = 1;
        for (int j = 1; j < i; j++) {
            C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
            C[i][j] %= MOD;
        }
    }

    for (int i = 1; i <= K; i++) {
        if (N - K + 1 < i) {
            cout << 0 << endl;
            continue;
        }

        cout << (C[N - K + 1][i] * C[K - 1][i - 1]) % MOD << endl;
    }
    return 0;
}

Measured memory_bytes: 31616
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

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

//prototype declaration
int iin();
long long llin();
double din();
char cin();
void stin(char *s);
void iout(int i);
void llout(long long i);
void dout(double i);
void cout(char c);
void stout(char *s);
int gcd(int a, int b);
int lcm(int a, int b);
long long llgcd(long long a, long long b);
long long lllcm(long long a, long long b);
int asc(const void *a, const void *b);
int desc(const void *a, const void *b);
double to_deg(double rad);
double distance(int xi, int yi, int xj, int yj);

//main function
int main() {
    int n = iin(), k = iin();
    long long r = llin(), s = llin(), p = llin(), c = 0;
    char t[n];
    stin(t);
    int bw[n];
    for (int i = 0; i < n; i++) {
        if (i - k < 0) {
            if (t[i] == 'r') c += p;
            else if (t[i] == 's') c += r;
            else if (t[i] == 'p') c += s;
            bw[i] = 1;
        } else {
            if(t[i] == t[i - k] && bw[i - k] == 1) {
                bw[i] = 0;
                continue;
            } else {
                if (t[i] == 'r') c += p;
                else if (t[i] == 's') c += r;
                else if (t[i] == 'p') c += s;
                bw[i] = 1;
            }
        }
        //llout(c);
    }
    llout(c);
    return 0;
}

//body function
int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

/*
    int型の最大公約数
*/

int gcd(int a, int b) {
    int r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    int型の最小公倍数
*/

int lcm(int a, int b) {
    int r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    long long型の最大公約数
*/

long long llgcd(long long a, long long b) {
    long long r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    long long型の最小公倍数
*/

long long lllcm(long long a, long long b) {
    long long r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    int型の昇順用比較関数
*/

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

/*
    int型の降順用比較関数
*/

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

/*
    弧度法を度数法に
*/

double to_deg(double rad) {
    return rad * 180.0 / (atan(1.0) * 4.0);
}

double distance(int xi, int yi, int xj, int yj) {
    return hypot(xj - xi, yj - yi);
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	int n;
	string s;
	cin >> n >> s;

	int ans = 0;
	for(int a = 0; a < n; ++a)
	{
		vector<int> Z(n - a);
		Z[0] = n - a;
		int i = 1, j = 0;
		while(a + i < n)
		{
			while(a + i + j < n && s[a + j] == s[a + i + j])
			{
				j++;
			}
			Z[i] = j;
			ans = max(ans, min(i, Z[i]));

			if(j == 0)
			{
				i++;
				continue;
			}

			int k = 1;
			while(k < j && k + Z[k] < j)
			{
				Z[i + k] = Z[k];
				ans = max(ans, min(i + k, Z[i + k]));
				k++;
			}
			i += k;
			j -= k;
		}
	}
	cout << ans;
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 3620