akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define f first
#define s second
#define x real()
#define y imag()
using namespace std;
typedef complex <double> point;
int n,m,w,h,S;
point L[30001][2];
point A[30001];
int arm[30001];
 
bool ccw(point a,point b,point c){
  b-=a,c-=a;
  //  c*=b;
  
  return (b.x*c.y-b.y*c.x>0);
}
 
void mk_arm(){
  memset(arm,0,sizeof(arm));
  for(int i=0;i<n;i++){
    int low=0,mid,up=m+1;
    while(low<up){
      mid=(low+up)/2;
      if(!ccw(L[mid][0],L[mid][1],A[i])) up=mid;
      else low=mid+1;
    }
    arm[low]++;
  }
  for(int i=1;i<=m;i++)arm[i]+=arm[i-1];
}
 
int solve(){
  int res=0;
  for(int i=0;i<m;i++){
    int low=i,mid,up=m+1;
    while(low<up){
      mid=(low+up)/2;
      double sss=((L[mid][0].y-L[i][0].y)+(L[mid][1].y-L[i][1].y))*w/2.0;
      if(w*h-(sss)<S) up=mid;
      else low=mid+1; 
    }
    res=max(res,(arm[low-1]-arm[i]));
  }
  return n-res;
}
 
int main(){
  while(1){
    cin>>n>>m>>w>>h>>S;
    if(!n&&!m&&!w&&!h&&!S)break;
    L[0][0]=point(0,0);
    L[0][1]=point(w,0);
    for(int i=1,a,b;i<=m;i++){
      cin>>a>>b;
      L[i][0]=point(0,a);
      L[i][1]=point(w,b);
    }
 
    double a,b;
    for(int i=0;i<n;i++)cin>>a>>b,A[i]=point(a,b);
    mk_arm();
    cout << solve()<<endl;
  }
   
  return 0;
}

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

int main() {
    int N, M;

    cin >> N >> M;

    vector<int> stairs(N+1, true);

    for(int i=0; i<M; ++i){
        int a;
        cin >> a;
        stairs[a] = false;
    }

    vector<long long int> ans(N+1);
    ans[0] = 1;
    for(int now=0; now<N; ++now){
        for (int next=now+1; next<=min(N, now+2); ++next) {
            if(stairs[next]){
                ans[next] += ans[now];
                ans[next] %= 1000000007;
            }
        }
    }

    cout << ans[N] << endl;

    return 0;
}

Measured memory_bytes: 1408
n = int(input())
step = list(map(int, list(input().split(' '))))

m = 0
temp = 0

for i in range(n - 1):
  if step[i] >= step[i + 1]:
    temp += 1
  else:
    m = max(m, temp)
    temp = 0

m = max(m, temp)
print(int(m))

Measured memory_bytes: 64476
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){
    int cards[5];
    char dummy;
    while (cin>>cards[0]>>dummy>>cards[1]>>dummy>>cards[2]>>dummy>>cards[3]>>dummy>>cards[4])
    {
        int count=0,ans=0;
        sort(cards,cards+5);
        for (int i=0; i<4; i++)
        {
            if ( cards[i] == cards[i+1] )
            {
                count++;
                ans+=count;
            }
            else count=0;
        }
        
        if (ans==0)
        {
            int sum=0;
            for (int i=0; i<5; i++) sum+=cards[i];
            if(sum-cards[0]*5==10) puts("straight");
            else if(cards[0]==1 && cards[1]==10 && cards[2]==11 && cards[3]==12 && cards[4]==13) puts("straight");
            else puts("null");
        }
        
        else if (ans==1) puts("one pair");
        else if (ans==2) puts("two pair");
        else if (ans==3) puts("three card");
        else if (ans==4) puts("full house");
        else if (ans==6) puts("four card");
        
    }
    return 0;
}

Measured memory_bytes: 1132
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

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

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

bool done[1001001],memo[1001001];
int p[6]={100,101,102,103,104,105};

bool solve(int x){
	int i;
	if(x<0){
		return false;
	}
	if(done[x]){
		return memo[x];
	}
	done[x] = true;
	if(!x){
		return memo[x] = true;
	}
	for(i=0; i<6; ++i){
		memo[x] |= solve(x-p[i]);
	}
	return memo[x];
}

int main(void){
	int x;
	cin >> x;
	cout << solve(x) << endl;
	return 0;
}


Measured memory_bytes: 512
#include <cstdio>

int main() {
  char a[4];
  scanf("%s", a);
  int count = 0;
  if (a[0] == '1') count++;
  if (a[1] == '1') count++;
  if (a[2] == '1') count++;
  printf("%d", count);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int N, K, mx;
int V[100005];

int gcd(int a, int b) {
    int r = a % b;
    
    while(r) {
        a = b;
        b = r;
        r = a % b;
    }
    
    return b;
}

int main() {
    cin >> N >> K;
    
    for(int i = 1;i <= N; ++i) {
        cin >> V[i];
        
        if(V[i] == K) {
            cout << "POSSIBLE\n";
            return 0;
        }
        mx = max(mx, V[i]);
    }
    
    if(mx < K) {
        cout << "IMPOSSIBLE\n";
        return 0;
    }
    
    int ans = V[1];
    
    for(int i = 2; i <= N; ++i) {
        ans = gcd(ans, V[i]);
    }
    
    if(K % ans == 0) {
        cout << "POSSIBLE\n";
    }
    else {
        cout << "IMPOSSIBLE\n";
    }
    
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
	int n;
	int money = 100000;
	int i;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		money *= 1.05;
		if (money % 1000){
			money = money / 1000 + 1;
			money *= 1000;
		}
	}
	printf("%d\n", money);
	
	return (0);
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pi pair<ll, ll>
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define pd pair<double, double>
#define vp vector<pi>
#define f(i, n) for(int i = 0; i < n; i++)
#define fo(i, a, n) for(int i = a; i < n; i++)
#define mod (1000*1000*1000+7)
#define sz(x) int((x).size())
#define all(x) x.begin(),x.end()
#define DBG(v) cerr << #v << " = " << (v) << endl;
ll INF = (1ll<<61);

using namespace std;

int main(int argc, char* argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    unsigned ll x; cin >> x;
    if(x % 2) {
      cout << 0 << endl;
      return 0;
    }
    x/= 10;
    unsigned ll d = 1;
    unsigned ll ans = 0;
    while(x/d > 0 && d < 2e18/5){
      ans += x/d;
      d *= 5;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;


ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}


int main()
{
    ll a, b;
    cin >> a >> b;
    put(a * b / gcd(a, b))
    
    return 0;
}

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

int main() {
    int n;
    int min;
    int sum=0;
    scanf("%d",&n);
    int p[n];

    for(int i=0;i<n;i++){
        scanf("%d",&p[i]);
        if(i == 0){
            min = p[0];
        }   
        if(min >= p[i]){
            min = p[i];
            sum++;
        }
    }
    
    printf("%d",sum);
}



Measured memory_bytes: 1024
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}
//////////////

void solve() {
	LL N, T, A;
	cin >> N >> T >> A;
	vector<LL> H(N);
	for (int i = 0; i < N; ++i) {
		cin >> H[i];
	}

	int index = -1;
	LL sa = LINF;
	for (int i = 0; i < N; ++i) {
		LL res = abs(T * 1000 - H[i] * 6 - A * 1000);
		if (sa > res) {
			sa = res;
			index = i;
		}
	}
	cout << index + 1 << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 256
n,k=map(int,input().split())
d=list(map(int,input().split()))
x=list(range(1,100001))
y=[0]*100000
for i in range(100000):
    s=str(i)
    S=len(s)
    for j in range(S):
        if int(s[j]) in d:
            y[i-1]=1
            break
for i in range(100000):
    if i>=n-1:
        if y[i]==0:
            print(i+1)
            break

Measured memory_bytes: 13560
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        long ans = 0;
        for(int i=1;i<=n;i++) {
            long a = n%i;
            long s = n/i;
            ans+=(i+n-a)*s/2;
        }
        System.out.println(ans);
    }
}

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

using namespace std;

#define int long long

void solve() {
    string s;
    cin >> s;
    if (s == "SUN") cout << 7;
    else if (s == "MON") cout << 6;
    else if (s == "TUE") cout << 5;
    else if (s == "WED") cout << 4;
    else if (s == "THU") cout << 3;
    else if (s == "FRI") cout << 2;
    else if (s == "SAT") cout << 1;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

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

  rep(i, len(S) - 1) {
    if (S[i] == 'A' && S[i + 1] == 'C') {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		int n = sc.nextInt();
		int m = sc.nextInt();

		int lineA[][] = new int[n][m];
		int lineB[] = new int[m];
		int c[] = new int[n];

		// a???????????????????¨????
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				lineA[i][j] = sc.nextInt();
			}
		}
		// b????´??????????????¨????
		for (int i = 0; i < m; i++) {
			lineB[i] = sc.nextInt();
		}

		// ????¨?
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				c[i] += lineA[i][j] * lineB[j];
			}
		}

		// ??????
		for (int i = 0; i < n; i++) {
			System.out.println(c[i]);
		}
	}

}

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

using namespace std;

#define long long long
#define INF 2e18
#define MOD (long) (998244353)
#define umap unordered_map

int main()
{
    long t = 1;
    //cin >> t;

    while (t--) {
        long a;
        cin >> a;

        long ans = a + a*a + a*a*a;
        printf("%lld\n", ans);
    }
}


Measured memory_bytes: 3736
#include"bits/stdc++.h"
using namespace std;
#define LL long long

LL N,M,K,ans,r,t,a;

string s,f;
int main() {
	cin >> N>>M;
	LL L[100];
	LL D = 0;

	for (int i = 0; i < N; i++) {
		cin >> L[i];
		if (D + L[i] <= M) {
			ans++;
		}
		D = D + L[i];
	}
	cout << ans + 1 << endl;
	return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
int main() {
	char s[200000];
	int i, g = 0, p = 0;
	scanf("%s", s);
	for (i = 0; s[i]; i++) {
		if (s[i] == 'g') {
			g++;
		} else {
			p++;
		}
	}
	printf("%d\n", g - p >> 1);
	return 0;
}

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

using namespace std;

#define ll long long
#define ld long double
#define pll pair <ll , ll>

#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair

#define X first
#define Y second

#define LB(x) (x & (-x))
#define BIT(a,b) ((ll)(a&(1<<b))==0 ? false : true)

const ll MAXN=1e6+10;
const ll Mod=1e9+7;

ll dp[MAXN];
ll partial[MAXN];

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

    ll n;
    cin>>n;

    dp[0]=n;
    partial[0]=n;

    for(ll i=1;i<n;i++)
    {
        dp[i]=dp[i-1]+(n-1)*(n-1)+(i>2 ? partial[i-3] + n-i+1 : n-1);
        dp[i]%=Mod;

        partial[i]=partial[i-1]+dp[i];
        partial[i]%=Mod;
    }

    cout<<dp[n-1];
}


Measured memory_bytes: 15872
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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 main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, r;
	cin >> n >> r;
	int ans;
	if(n >= 10) ans = r;
	else ans = r + 100 * (10 - n);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 60;
constexpr auto mod = 1000000007;
constexpr auto MOD = 998244353;
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 main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a;
    cin >> a;
    string s;
    cin >> s;
    cout << (a >= 3200 ? s : "red") << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ll long long
using namespace std;

int main() {
	int ans = 0;
	int n, m;
	cin >> n >> m;
	int a[100000];
	int dist[100000] = { 0 };
	rep(i, m) {
		cin >> a[i];
	}
	sort(a, a + m);
	rep(i, m - 1) {
		dist[i]=a[i + 1] - a[i];
	}
	sort(dist, dist + m);
	rep(i, m - n + 1) {
		ans += dist[i];
	}
	cout << ans << endl;
	return 0;
}


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

#define SYNC ios::sync_with_stdio(0);
#define F first
#define S second
#define endl '\n'


using namespace std;

using ll = long long int;
using ii = pair<int, int>;
using vii = vector<ii>;
using vi = vector<int>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const int MAXN = 58;
const ll mod = 1000000007;



int main() {
    SYNC
    int n[5], k;
    string ans = "Yay!";
    for (auto &i : n) {
        cin >> i;
    }
    cin >> k;
    for (int i = 0; i < 5; i++) {
        for (int j = 0; j < 5; j++) {
            if (i == j) continue;
            if (abs(n[i] - n[j]) > k) {
                ans = ":(";
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    ios::sync_with_stdio(false);

    int A, B, C;
    cin >> A >> B >> C;

    if (A == B + C || B == A + C || C == A + B) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}



Measured memory_bytes: 256
import java.util.Scanner;


public class Main{
    public static void main(String srgs[]){
        Scanner sc = new Scanner(System.in);
        
        int i,j;
        while(true){
            int a = sc.nextInt();
        int b = sc.nextInt();
            if(a==0 && b==0){
                break;
            }
        for(i = 0;i<a;i++){
            for(j=0;j<b;j++){
            System.out.printf("#");
            }
            System.out.printf("\n");
            }
            System.out.printf("\n");
        }
        sc.close();
    }
}


Measured memory_bytes: 65044
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    double a[100][100], b[100][100], tmp=0;
    int n, m, l;
    int i, j,k;
    scanf("%d %d %d", &n, &m, &l);
    for (i=0; i<n; i++) {
        for (j=0; j<m; j++) {
            scanf("%lf", &a[i][j]);
        }
    }
    for (i=0; i<m; i++) {
        for (j=0; j<l; j++) {
            scanf("%lf", &b[i][j]);
        }
    }
    for (i=0; i<n; i++) {
        for (j=0; j<l;j++) {
            for (k=0; k<m; k++) {
                tmp+=a[i][k]*b[k][j];
            }
            printf("%.0f", tmp);
            if (j!=l-1) {
                printf(" ");
            }
            tmp=0;
        }
        printf("\n");
    }
    
    
    return 0;
}



Measured memory_bytes: 2140
//by Top1
#include <bits/stdc++.h>
          
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define cerr cout
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
      
const int inf = (1e18) + 1;
const int mod = 479001599;
const int maxn = 5e5 + 111;
        
using namespace std;          

string s;
set <string> t;

void solve(){
	int n;

	cin >> n;

	for (int i = 1; i <= n; i++){
		cin >> s;
		t.insert(s);
	}

	cout << sz(t);
}   
      
main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

    boost;
    
    int q = 1;

    //cin >> q;

    while (q--){
        solve();
    }
}

Measured memory_bytes: 19232
#include<iostream>

using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int i;
  for(i=1;i<b;i++){
    if((a*i%b)==c){
      cout<< "YES" <<endl;
      break;
    }
    if(i==(b-1)){
      cout << "NO" <<endl;
    }
  }
  return 0;
}


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

#define pb push_back
#define rep(i, a, n) for(int (i)=a; (i)<(n); (i)++)
#define FOR(i, n) rep(i, 0, n)
#define F(n) FOR(i, n)
#define FF(n) FOR(j, n)
#define repi(i, a, n) for(int (i)=a; (i)<=(n); (i)++)
#define FORI(i, n) repi(i, 1, n)
#define FI(n) FORI(i, n)
#define FFI(n) FORI(j, n)
#define IN(x) cin<<(x);
#define INFO(a) cout<<"info "<<a<<endl
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define vpii vector<pair<int, int> >
#define sortv(x) sort((x).begin(), (x).end())
#define sortvd(x) sort((x).begin(), (x).end(), greater<int>())
#define lboundv(x, v) lower_bound((x).begin(), (x).end(), (v))
#define uboundv(x, v) upper_bound((x).begin(), (x).end(), (v))
#define ite iterator
#define fi first
#define se second
#define mems(a, v) memset((a), (v), sizeof((a)))
#define lmid(l, r) ((l)+(r)-1)/2
#define rmid(l, r) ((l)+(r))/2+1
#define mp make_pair

typedef long long ll;

using namespace std;

int main() {
	ios::sync_with_stdio(0);
	ll A, B, C, D, E, F;
	cin>>A>>B>>C>>D>>E>>F;
	ll ma, mb, ms, md;long double den, mden=-1.0, den1=E*1.0; pii ans;
	//ans = mp(100*A, 0);
	FOR(a, F/(100*A)+2) {
		mb = (F-100*a*A)/(100*B);
		FOR(b, mb+2) {
			ms = (a*A+b*B)*E;
			FOR(c, ms/C+2) {
				md = (ms-c*C)/D;
				FOR(d, md+2) {
					//cout<<a<<' '<<b<<' '<<c<<' '<<d<<endl;
					if(!a && !b && !c && !d) continue;
					if(100*(a*A+b*B)+c*C+d*D > F) break;
					den = (long double) (c*C+d*D)*((long double)1.0)/((a*A+b*B));
					if(den>den1) break;
					if(den>=mden) {
						mden = den;
						ans = mp(c*C+d*D+100*(a*A+b*B), c*C+d*D);
	//cout<<ans.fi<<' '<<ans.se<<endl;
					//cout<<a*A<<' '<<b*B<<' '<<c<<' '<<d<<endl;
					}
				}
			}
		}
	}
	cout<<ans.fi<<' '<<ans.se<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func solve() int {
	var N, M int
	fmt.Scan(&N, &M)

	A := make(map[int]struct{}, M)
	for i := 0; i < M; i++ {
		var a int
		fmt.Scan(&a)
		if _, exist := A[a-1]; exist {
			return 0
		}
		A[a] = struct{}{}
	}

	dp := make([]int, N+1)
	dp[0] = 1
	for i := 1; i <= N; i++ {
		if _, broken := A[i]; broken {
			continue
		}
		if _, broken := A[i-1]; !broken {
			dp[i] += dp[i-1]
		}
		if i > 1 {
			if _, broken := A[i-2]; !broken {
				dp[i] += dp[i-2]
			}
		}
		dp[i] %= 1000000007
	}
	return dp[N]
}

func main() {
	ans := solve()
	fmt.Println(ans)
}


Measured memory_bytes: 4992
#include <iostream>
#include <string>

int main() {
    std::string str;
    
    std::cin >> str;
    
    int cnt = 0;
    int scnt = 0;
    for(int i = 0; i < str.size(); ++i) {
        if(str[i] == 'S') ++scnt;
        if(str[i] == 'T' && scnt) {
            ++cnt;
            --scnt;
        }
    }
    std::cout << str.size() - cnt * 2 << std::endl;
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;

int h, w;
int xlist[] = {1,  0, -1,  0};
int ylist[] = {0, -1,  0,  1};
vector<vector<char> > maze;
vector<vector<int> > cost;

int bfs() {
  queue<pair<int, int> > q;
  q.push(make_pair(0, 0));
  cost[0][0] = 0;
  while(!q.empty()) {
    pair<int, int> p = q.front(); q.pop();
    if (p.first == h-1 && p.second == w-1) {
      break;
    }
    for (int i = 0; i < 4; i++) {
      int ny = p.first  + ylist[i];
      int nx = p.second + xlist[i];
      if (0 <= nx && nx < w && 0 <= ny && ny < h
       && maze[ny][nx] == '.' && cost[ny][nx] == INF) {
         q.push(make_pair(ny, nx));
         cost[ny][nx] = cost[p.first][p.second] + 1;
       }
    }
  }
  return cost[h-1][w-1];
}

int main()
{
  cin >> h >> w;
  int cnt = 0;
  maze.resize(h, vector<char>(w));
  cost.resize(h, vector<int>(w, INF));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> maze[i][j];
      if (maze[i][j] == '.') {
        cnt++;
      }
    }
  }

  int c = bfs();
  if (c == INF) {
    cout << -1 << endl;
  } else {
    cout << cnt - c - 1 << endl;
  }
  return 0;
}

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

def main():
  n, m = map(int, input().split())
  tower_list = []
  for h in map(int, input().split()):
    tower_list.append([0,h,[]])
  
  count = n
  
  for _ in range(m):
    t1, t2 = map(int, input().split())
    if tower_list[t1-1][0] == 0:
      if tower_list[t1-1][1] <= tower_list[t2-1][1]:
        tower_list[t1-1][0] = 1
        n -= 1
    if tower_list[t2-1][0] == 0:
      if tower_list[t2-1][1] <= tower_list[t1-1][1]:
        tower_list[t2-1][0] = 1
        n -= 1
    
  return n

if __name__=='__main__':
  print(main())

Measured memory_bytes: 91724
#include<iostream>
#include<algorithm>
#include<cstring>
#include<queue>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<cstdio>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin>>s;
    int n=s.size(),i;
    for(i=0;i<n;i++)
    {
        if(s[i]=='d')
        {
            if(i+4>=n)
            {
                cout<<"NO\n";
                return 0;
            }
            if(s[i+1]=='r' && s[i+2]=='e' && s[i+3]=='a' && s[i+4]=='m')
            {
                if(i+4==n-1)break;
                if(i+6>=n)
                {
                    cout<<"NO\n";
                    return 0;
                }
                if(s[i+5]=='e' && s[i+6]=='r')
                {
                    if(i+7<n && s[i+7]=='a')i+=4;
                    else i+=6;
                }
                else i+=4;
            }
            else
            {
                cout<<"NO\n";
                return 0;
            }
        }
        else
        {
            if(i+4>=n)
            {
                cout<<"NO\n";
                return 0;
            }
            if(s[i]=='e' && s[i+1]=='r' && s[i+2]=='a' && s[i+3]=='s' && s[i+4]=='e')
            {
                if(i+4==n-1)break;
                if(s[i+5]=='r')i+=5;
                else i+=4;
            }
            else
            {
                cout<<"NO\n";
                return 0;
            }
        }
    }
    cout<<"YES\n";
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>

#define nl '\n';

using namespace std;

int r;

int main(){

    cin >> r;

    if(r < 1200){
        cout << "ABC";
    } else if(r < 2800){
        cout << "ARC";
    } else{
        cout << "AGC";
    }




}

//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out

// char** arr = new char*[r];
// for(long long i = 0; i < r; i++) arr[i] = new char[c];

Measured memory_bytes: 256
package main

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

const INFINITY = math.MaxInt64/2 - 1

func exec(stdin *Stdin, stdout *Stdout) {
	n := stdin.ReadInt()
	k := stdin.ReadInt()

	if n > k {
		n, k = n%k, k
	}

	stdout.Println(Min(n, Abs(n-k)))
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), INFINITY)
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

func Min(a int, b ...int) int {
	for _, v := range b {
		if v < a {
			a = v
		}
	}
	return a
}

func Max(a int, b ...int) int {
	for _, v := range b {
		if a < v {
			a = v
		}
	}
	return a
}

func Abs(x int) int {
	if x > 0 {
		return x
	} else {
		return x * -1
	}
}

func Pow(x, y int) int {
	z := 1
	for y > 0 {
		if y%2 == 0 {
			x *= x
			y /= 2
		} else {
			z *= x
			y -= 1
		}
	}
	return z
}

func CreateMatrix(x, y int) [][]int {
	matrix := make([][]int, x)
	for i := 0; i < x; i++ {
		matrix[i] = make([]int, y)
	}
	return matrix
}


Measured memory_bytes: 640
S=input()
def ispalindrome(str): return 1 if str == str[::-1] else 0
L=(len(S)-1)//2
T=S[:L]
U=S[L+1:]
if ispalindrome(S)==1 and ispalindrome(T)==1 and ispalindrome(U)==1:
    print("Yes")
else: print("No")


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>

#define rep(i, n) for(int i = 0;i < (n);i++)
#define rrep(i, n) for(int i = (n);i >= 0;i--)
#define FOR(i, m, n) for(int i = (m);i < (n);i++)

using namespace std;
using ll = long long;

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;}

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


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



int main() {
    int n; cin >> n;
    ll l; cin >> l;
    vector<ll> a(n);
    ll _max = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    int b = -1;
    for (int i = 0; i < n-1; i++)
    {
        ll tmp = a[i]+a[i+1];
        if (tmp > _max) {
            b= i+1;
            _max = tmp;
        }
    }
    

    if (_max < l) {
        cout << "Impossible" << endl;
        return 0;
    }
    cout << "Possible" << endl;
    for (int i = 1; i < b; i++) {
        cout << i << endl;
    }
    for (int i = n-1; i >= b; i--)
    {
        if (a[i] == _max) break;
        cout << i << endl;
    }
    

    
    return 0;
}


Measured memory_bytes: 1664
// AtCoder template
// sabaより胡蝶しのぶさんの方が可愛いのではないか？
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; ++i)



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s; cin >> s;
    if(s[0] == s[1] && s[1] == s[2]) cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
P = list(map(int, input().split()))
tmp = sum([(p * (p + 1) // 2) / p for p in P[:K]])
ans = tmp
for i in range(N - K):
    tmp -= (P[i] * (P[i] + 1) // 2) / P[i]
    tmp += (P[K + i] * (P[K + i] + 1) // 2) / P[K + i]
    ans = max(ans, tmp)
print(ans)


Measured memory_bytes: 24548
<?php
/*
    Problem URL : http://abc051.contest.atcoder.jp/tasks/abc051_b

    Score  :
    Result :
    Time   : ms
    Memory : KB
 */

fscanf(STDIN, "%d %d", $K, $S);

for ($i = 0; $i <= $K; $i++) {
    for ($j = 0; $j <= $K; $j++) {
        $rest = $S - $i - $j;
        if (0 <= $rest && $rest <= $K) {
            $ans++;
        }
    }
}

echo $ans . PHP_EOL;


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

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

int main(){
  int n;
  cin>>n;
  map <string,int> mp;
  rep(i,n){
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    mp[s]++;
  }

  ll ans=0;
  for (auto f:mp){
    ll nn=f.second;
    ans+=nn*(nn-1)/2;
  }
  cout<<ans;

}


Measured memory_bytes: 11264
#include <iostream>
#include <string>
#include <stack>
#include <algorithm>

using namespace std;

int main() {
    int state = 0;
    string str; cin >> str;
    if(str == "") {
        cout << "Cat" << endl;
        return 0;
    }

    stack<char> stk;
    stk.push('c');
    int i = 0;
    while(i < str.length()) {
        if(stk.empty()) {
            cout << "Rabbit" << endl;
            return 0;
        }
        char c = str[i];
        char e = stk.top();
        stk.pop();
        if(e == 'c' && c == 'm') {
            stk.push('w');
            stk.push('c');
            stk.push('e');
            stk.push('c');
            i++;
        } else if(e == 'e') {
            if(c == 'e') {
                i++;
            } else {
                cout << "Rabbit" << endl;
                return 0;
            }
        } else if(e == 'w') {
            if(c == 'w') {
                i++;
            } else {
                cout << "Rabbit" << endl;
                return 0;
            }
        }
    }
    cout << "Cat" << endl;
    return 0;
}



Measured memory_bytes: 3228
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header

int main() {
	string s;
	cin >> s;
	s[5] = ' ';
	s[13] = ' ';
	cout << s << endl;
 	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

typedef pair<int, int> P;

bool pairCompare(const P& firstElof, const P& secondElof)
{
    return firstElof.first > secondElof.first;
}

int main(){
    int n;
    cin >> n;
    vector<P> v(n);
    rep(i,n) cin >> v[i].first >> v[i].second;
    sort(v.begin(), v.end(), pairCompare);
    cout << v[0].first + v[0].second << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <cstring>
#include <stack>
#include <cstdio>
#include <complex>
#include <iomanip>
#include <cctype>
#include <cassert>
#include <numeric>
#include <climits>
#include <deque>
#include <random>
#include <functional>
#include <unordered_map>
#define rep(i,n) for(int i=0;i < (int)(n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define show(x) cout << #x << " = " << x << endl;
int main(){
    string s;
    cin >> s;
    int a = s[0] -'0';
    int b = s[1] -'0';
    int c = s[2] -'0';
    int d = s[3] -'0';
    if(a+b+c+d==7){
        cout << a << '+' << b << '+' << c << '+' << d<<"=7" << endl;
        return 0;
    }
    else if(a-b+c+d==7){
        
        cout << a << '-' << b << '+' << c << '+' << d<<"=7" << endl;
        return 0;
    }
    else if(a+b-c+d==7){
        
        cout << a << '+' << b << '-' << c << '+' << d<<"=7" << endl;
        return 0;
    }
    else if(a+b+c-d==7){
        
        cout << a << '+' << b << '+' << c << '-' << d<<"=7" << endl;
        return 0;
    }
    else if(a+b-c-d==7){
        
        cout << a << '+' << b << '-' << c << '-' << d<<"=7" << endl;
        return 0;
    }else if(a-b-c+d==7){
        
        cout << a << '-' << b << '-' << c << '+' << d<<"=7" << endl;
        return 0;
    }else if(a-b+c-d==7){
        
        cout << a << '-' << b << '+' << c << '-' << d<<"=7" << endl;
        return 0;
    }else if(a-b-c-d==7){
        
        cout << a << '-' << b << '-' << c << '-' << d<<"=7" << endl;
        return 0;
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
#define int long long int
#define pb push_back
#define vec vector<int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define foo(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair
#define deb(x) cout << #x << " --> " << x << endl;
#define deb1a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
        cout << it << " ";        \
    cout << endl;
#define deb2a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
    {                             \
        for (auto it1 : it)       \
        {                         \
            cout << it1 << " ";   \
        }                         \
        cout << endl;             \
    }
#define deb3a(v)                               \
    cout << #v << "-->" << endl;               \
    for (auto it : v)                          \
    {                                          \
        cout << it.fi << " " << it.se << endl; \
    }
#define mod 1000000007
#define so(v) sort(v.begin(), v.end())
#define fi first
#define se second
#define db1(x) cout << #x << "=" << x << endl
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int mI(int a, int m)
{
    return power(a, m - 2, m);
}
vector<vector<int>> dir = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};

#define MAXN 10000001
#define double long double

int n;
int dp[2001];
int fun(int i){
    if(i==0){
        return 1;
    }
    if(i<3){
        return 0;
    }
    if(dp[i]!=-1){
        return dp[i];
    }
    int ans = 0;
    foo(j,3,i+1){
        ans += fun(i - j);
        ans %= mod;
    }
    return dp[i] = ans;

}
void solve()
{
    int n;
    cin >> n;
    memset(dp, -1, sizeof(dp));
    cout << fun(n);
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    srand(time(0));

    // FILE *fin = freopen("ip.txt","r",stdin);
    // FILE *fout = freopen("op.txt","w",stdout);
    int t = 1, nn = 1;
    //cin >> t;
    while (t--)
    {
        // cout << "Case #" << nn << ":"
        //      << " ";
        // nn++;
        
        solve();
    }
}

Measured memory_bytes: 3672
package main

import (
	"fmt"
	"math"
)

func main() {
	var m [200000]int
	ans := 0
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		if i-a >= 0 {
			ans += m[i-a]
		}
		if i+a < n {
			m[i+a]++
		}
	}
	fmt.Println(ans)
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var inf = int(1e9)

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// Pair is C++`s Pair
type Pair struct {
	a, b int
}

type pairs []Pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


Measured memory_bytes: 7996
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = (1e-10);
long long const MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int dfs(int crt, int start, vector<vector<int>> &v, vector<vector<int>> &G) {
    v[crt][start] = 1;
    for (int i = 0; i < G[crt].size(); i++) {
        int nv = G[crt][i];
        if (v[nv][start] == 0) {
            dfs(nv, start, v, G);
        }
    }
    return 0;
}

int solve(int N) {
    vector<vector<int>> yotei(N, vector<int>(35));
    for (int i = 0; i < N; i++) {
        int k; cin >> k;
        for (int j = 0; j < k; j++) {
            int tmp; cin >> tmp;
            yotei[i][tmp] = 1;
        }
    }

    int ret = -1;
    vector<vector<int>> v(N*35, vector<int>(N));
    vector<vector<int>> G(N*35);
    for (int day = 0; day < 31; day++) {
        for (int i = 0; i < N; i++) {
            G[N*day+i].push_back(N*(day+1)+i);
            for (int j = i+1; j < N; j++) {
                if (yotei[i][day] && yotei[j][day]) {
                    G[N*day+i].push_back(N*day+j);
                    G[N*day+j].push_back(N*day+i);
                }
            }
        }
    }

    for (int i = 0; i < N; i++) {
        dfs(i, i, v, G);
    }

    for (int day = 0; day < 31; day++) {
        for (int i = 0; i < N; i++) {
            int flag = 1;
            for (int j = 0; j < N; j++) {
                if (!v[N*day+i][j]) flag = 0;
            }
            if (flag) {
                return ret = day;
            }
        }
    }
    
    return ret;
}

int main(void) {
    int N;
    vector<int> ans;
    while (1) {
        cin >> N;
        if (!N) break;
        ans.push_back(solve(N));
    }
    for (auto &i : ans) {
        cout << i << endl;
    }
}




Measured memory_bytes: 3664
#include <iostream>
int main(){
    long long A, B, C, X, Y;
    std::cin >> A >> B >> C >> X >> Y;
    long long ans = 0;
    long long res = 0;
    res = std::max(X, Y)*(2*C);
    if(A + B >= C*2){
        ans += std::min(X, Y)*(2*C);
        ans += A*(X - std::min(X, Y)) + B* (Y - std::min(X,Y));
    }
    else ans += A*X+B*Y;
    std::cout << std::min(ans, res) << std::endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char *argv[])
{
    int value;
    scanf("%d", &value);
    const int s = value % 60; value /= 60;
    const int m = value % 60; value /= 60;
    const int h = value;
    printf("%d:%d:%d\n", h, m, s);
    return 0;
}



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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long



int32_t main() {

    int n; cin >> n;
    string s; cin >> s;
    int red = 0, blue = 0;
    for(char c : s) {
        if(c == 'R') red++;
        else if(c == 'B') blue++;
    }
    if(red > blue) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


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

int main(){
    int dice,require,score;
    double p=0,temp;
    //cin>>dice>>require;
    scanf("%d %d",&dice,&require);
    if(dice<require){
        //printf("into situation 1\n");
        for(int i=1;i<=dice;i++){
            score=i;
            temp=1;
            while(score<require){
                score*=2;
                temp/=2;

            }
            p=p+(1.0/dice)*temp;
        }
    }else{
        for(int i=1;i<require;i++){
            score=i;
            temp=1;
            while(score<require){
                score*=2;
                temp/=2;
            }
            p+=(1.0/dice)*temp;
        }
        p+=(double)(dice-require+1)/dice;
    }
    printf("%.20lf\n",p);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int N;
	int k[1000], p[1000];

	cin >> N;

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

		if (p[i] >= k[i]){
			cout << k[i] << endl;
		}
		else if (k[i] % p[i] == 0){
			cout << p[i] << endl;
		}
		else {
			cout << k[i] % p[i] << endl;
		}
	}
}

Measured memory_bytes: 3104
l = list(input())
for a in ["+", "-"]:
    for b in ["+", "-"]:
        for c in ["+", "-"]:
            if eval(l[0]+a+l[1]+b+l[2]+c+l[3]) == 7:
                print(l[0]+a+l[1]+b+l[2]+c+l[3]+"=7")
                exit()

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

const int MAX_V = 100001;
const long long INF = 1000000000000000000;
struct edge{int to, ycost, scost;};
typedef pair<long long, int> P;
int n;
vector<edge> node[MAX_V];
long long d1[MAX_V], d2[MAX_V];

void dijkstra1(int s) {
    priority_queue<P, vector<P>, greater<P>> que;
    fill(d1, d1+n+1, INF);
    d1[s]=0;
    que.push(P(0, s));
    while(!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if(d1[v] < p.first) continue;
        for(int i=0; i < node[v].size(); i++){
            edge e = node[v][i];
            if(d1[e.to] > d1[v] + e.ycost) {
                d1[e.to] = d1[v] + e.ycost;
                que.push(P(d1[e.to], e.to));
            }
        }
    }
}

void dijkstra2(int s) {
    priority_queue<P, vector<P>, greater<P>> que;
    fill(d2, d2+n+1, INF);
    d2[s]=0;
    que.push(P(0, s));
    while(!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if(d2[v] < p.first) continue;
        for(int i=0; i < node[v].size(); i++){
            edge e = node[v][i];
            if(d2[e.to] > d2[v] + e.scost) {
                d2[e.to] = d2[v] + e.scost;
                que.push(P(d2[e.to], e.to));
            }
        }
    }
}

int main(){
    int m, s, t;
    const long long firstyen = 1000000000000000;
    long long maxsnook = 0;
    cin >> n >> m >> s >> t;
    long long ymaxsnook[n];
    for(int i=0; i<m; i++) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        node[u].push_back({v, a, b});
        node[v].push_back({u, a, b});
    }
    dijkstra1(s);
    dijkstra2(t);
    for(int i=n; i>0; i--){
        maxsnook = max(maxsnook, firstyen - d1[i] - d2[i]);
        ymaxsnook[i-1] = maxsnook;
    }
    for(int i=0; i<n; i++) cout << ymaxsnook[i] << endl;
}



Measured memory_bytes: 10748
from functools import reduce


def gcd(x, y):
    if not x:
        return y
    return gcd(y % x, x)


def lcm(x, y):
    return x * y // gcd(x, y)


n = int(input())
arr = list(map(int, input().split()))
lcm_arr = reduce(lcm, arr) - 1

print(sum([lcm_arr % x for x in arr]))


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

int main(void){
    char S[3];
    scanf("%s",S);
    char *check[]={"abc","acb","bac","bca","cab","cba"};
    int count = 0;
    for(int i = 0; i < 6;i++){
        if(strcmp(check[i],S)==0){
        printf("Yes\n");
        }else{
            count++;
        }
    }
    if(count == 6) printf("No\n");
    return 0;

}

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

const long double PI= 3.1415926535;

int main() {
  long double a,b,x;
  cin>>a>>b>>x;

  long double ans;
  if (a*a*b/2.0<=x) {
    ans=atanl(2.0*(a*a*b-x)/a/a/a);
  }
  else {
    ans=atanl(a*b*b/x/2.0);
  }
  ans*=180.0/PI;
  cout<<setprecision(10)<<ans<<endl;
}


Measured memory_bytes: 512
import sys

n = int(input())
h = list(map(int, input().split(' ')))
ans = 0
counter = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        counter += 1
    else:
        ans = max(ans, counter)
        counter = 0
print(max(ans, counter))


Measured memory_bytes: 15020
#include <iostream>

int main() {
  int A, B;
  std::cin >> A >> B;

  if (A <= 12) {
    if (6 <= A) {
      B /= 2;
    } else {
      B = 0;
    }
  }

  int result = B;
  std::cout << result << std::endl;

  return 0;
}

Measured memory_bytes: 256