akhauriyash/Code-Regression huggingface dataset:
// Author := Abhishek Giri

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define V(type) vector<(type)>
#define all(c) ((c).begin(),(c).end())
#define in(var) cin>>(var)
#define out(var) cout<<(var)
#define on(var) cout<<var<<"\n"
#define f(i,n) for(ll i = 0 ; i < n ;i++)
#define mfor(i,init,n,b) for(ll i = (init) ; i < (n) ; i+= (b))
#define cfor(i,c) for(auto i = (c).begin() ; i!= (c).end(); i++)
#define el "\n"
#define ret return
#define F first
#define S second

/*##################################################################################*/

/*
int prime[100000] ;
vector < int > pr;
void calculateprime()
{
    prime[0] = prime[1] = 1 ;
    for(int i = 2 ; i <= 100000 ; i++)
    {
        if(prime[i] == 0)
        {
            pr.pb(i);
            for(ll j = i*2 ; j <= 100000 ; j += i )
            {
                prime[j] = 1 ;
            }
        }
    }
}
*/


void customrun(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

bool isprime(ll n)
{
    for(ll i = 2 ; (ll) i*i <= n ; i++)
    {
        if(n % i == 0){
            return false;
        }
    }
    return true;
}

ll fib(int n)
{
    ll a = 0, b = 1, c, i;
    if( n == 0)
        return a;
    for (i = 2; i <= n; i++)
    {
        c = (a + b);
        a = b;
        b = c;
    }
    return b;
}


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

ll extendedgcd(ll a, ll b, ll& x, ll& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll x1, y1;
    ll d = extendedgcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}

ll findgrouplcm(vector<int> &arr, int n)
{
    ll ans = arr[0];

    for (ll i = 1; i < n; i++)
        ans = (arr[i] * (ans/(gcd(arr[i], ans))));

    return ans;
}


ll powerwithmod(ll x, unsigned ll y, ll p)
{
    ll res = 1;

    x = x % p;

    if (x == 0) return 0;

    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;

        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}


bool comp(const pair < long,long > &a, const pair < long ,long > &b){
    if(a.first == b.first) return a.second < b.second;
    return a.first < b.first;
}

void solve();

int main() {
    clock_t begin = clock();

    fast();
    customrun();
    ll t = 1;
    //cin>>t;
    //calculateprime();
    mfor(i,1,t+1,1)
    {
        //cout<<"Case #"<<i<<": \n";
        solve();
    }
    clock_t end = clock();
    double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
    //cout<<"\ntime spent is "<<time_spent;
    return 0;
}


void solve(){
    int n,x,t;
    in(n)>>x>>t;

    out(t*((n+x-1)/x));
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int a, b, c;
    while (cin >> a >> b >> c)
    {
        int cnt = 0;

        for (int i = 1; i <= 10; i++)
        {
            if (i == a || i == b || i == c)
                continue;
            if (a + b + i <= 20)
                cnt++;
        }

        if (cnt >= 4)
        {
            OP("YES");
        }
        else
        {
            OP("NO");
        }
    }
    return 0;
}


Measured memory_bytes: 3100
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

class Relation{
public:
	Relation(int tmp_n,int tmp_m){
		n = tmp_n;
		m = tmp_m;
		V = new vector<int>[n];
		group = new int[n];
		for(int i=0;i<n;i++){
			group[i] = 0;
		}
		group_number = 1;
	}

	void push(int s,int t){
		V[s].push_back(t);
		V[t].push_back(s);
	}

	void makeGroup(){
		int node,i;
		queue<int> Q;
		Q.push(0);
		group[0] = 1;
		while(true){
			while(!Q.empty()){
				node = Q.front();
				Q.pop();
				if(V[node].size() > 0){
					for(int k=0; k < V[node].size();k++){
						if(group[V[node][k]] == 0){
							group[V[node][k]] = group[node];
							Q.push(V[node][k]);
						}
					}
				}
			}
			group_number++;
			for(i=0;i<n;i++){
				if(group[i] == 0){
					group[i] = group_number;
					Q.push(i);
					break;
				}
			}
			if(i == n) break;
		}
	}

	bool canAccsess(int s,int t){
		return group[s] == group[t];
	}

private:
	vector<int>* V;
	int* group;
	int group_number;
	int n,m;
};

int main(){
	int n,m,s,t,q;
	scanf("%d %d",&n,&m);

	Relation relation(n,m);
	for(int i=0;i<m;i++){
		scanf("%d %d",&s,&t);
		relation.push(s,t);
	}
	relation.makeGroup();
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%d %d",&s,&t);
		if(relation.canAccsess(s,t)){
			printf("yes\n");
		}else{
			printf("no\n");
		}
	}
    return 0;
}

Measured memory_bytes: 8596
def main():
    n,m=map(int,input().split())
    s=[tuple(map(int,input().split())) for _ in range(n)]
    s.sort(key=lambda x: x[0])
    bought = 0
    cost = 0
    for yen, ko in s:
        cost += ko*yen
        bought += ko
        #print(cost, bought, m)
        if bought >= m:
            cost -= (bought-m)*yen
            break
    print(cost)
    
if __name__ == "__main__":
    main()

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

int main() {
	long long n,x; cin >> n >> x;
	vector<long long> a(n);
	for(auto&e:a) cin >> e;
	vector<long long> b(a);
	long long ans=1e18;
	for(int i=0;i<n;++i) {
		long long tmp=0;
		for(int j=0;j<n;++j) tmp+=b[j]=min(b[j],a[(j-i+n)%n]);
		ans=min(ans,tmp+x*i);
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ri register
#define int long long
#define E (n+1)
using namespace std; const int N=200010;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar();
    return s*w;
}
int n,Z,W,a[N];
signed main()
{
    n=read(), Z=read(), W=read();
    for(ri int i=1;i<=n;i++) a[i]=read();
    if(n>1) printf("%lld\n",max(abs(a[n]-W),abs(a[n]-a[n-1])));
    else printf("%lld\n",abs(a[n]-W));
    return 0;
}

Measured memory_bytes: 3740
//Keep Working Hard
  // I__Like__Food  

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define tracel5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)

const int N = 55;

int32_t main()
{



    IOS

    int n,m;
    cin >> n >> m;

  priority_queue<int> pq;

  for(int i = 1; i <= n; i++)
  {
  	int x;
  	cin >> x;
  	pq.push(x);
  }


  while(m--)
  {
  	int k = pq.top();
  	pq.pop();
  	k/=2;
  	pq.push(k);
  }

  int ans = 0;

  while(!pq.empty())
  {
  	ans += pq.top();

  	pq.pop(); 
  }

  cout << ans;

    return 0;
}




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

int main(){
  string a;
  cin >> a;
  int q;
  cin >> q;
  int rev=1; //1:normal, -1:reverse
  int ichi=1;
  string pre;
  string suf;
  rep(i,q){
    int tmp;
    cin >> tmp;
    if (tmp==1){
      //reverse(a.begin(), a.end());
      rev*=-1;
      continue;
    }
    int f;
    char c;
    cin >> f >> c;
    if (f==2) f=-1; //-1:後ろ, 1:前
    if (f*rev==1) pre.push_back(c);
    else suf.push_back(c);
  }
  reverse(pre.begin(), pre.end());
  a = pre + a + suf;
  if (rev==-1) reverse(a.begin(), a.end());
  
  
  cout << a << endl;
}

Measured memory_bytes: 1348
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(reader.readLine());
		int[] a = new int[n];
		int[] b = new int[n];
		int k = Integer.MIN_VALUE;
		StringTokenizer st = new StringTokenizer(reader.readLine());
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(st.nextToken());
			k = Math.max(k, a[i]);
		}
		countingSort(a, b, k);
		StringBuilder sb = new StringBuilder();
		sb.append(b[0]);
		for (int i = 1; i < n; i++) {
			sb.append(' ').append(b[i]);
		}
		System.out.println(sb.toString());
	}

	private static void countingSort(int[] a, int[] b, int k) {
		int[] c = new int[k + 1];
		for (int i = 0; i < a.length; i++) {
			c[a[i]]++;
		}
		for (int i = 1; i <= k; i++) {
			c[i] += c[i - 1];
		}
		for (int i = a.length - 1; i >= 0; i--) {
			c[a[i]]--;
			b[c[a[i]]] = a[i];
		}
	}
}



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

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

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

    int N; cin >> N;
    int tmp = 1;

    while(tmp <= N){
        tmp *= 2;
    }

    cout << tmp/2 << endl;

    return 0;

}

Measured memory_bytes: 256
/**
 *      ABC 110 A
 *      author  : kyomukyomupurin
 *      created : 2018-09-23 21:01:09
**/
 
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int A, B, C; cin >> A >> B >> C;
 
    if (A >= B && A >= C){
        cout << 10 * A + B + C << endl;
    }
    else if (B >= A && B >= C){
        cout << 10 * B + A + C << endl;
    }
    else if (C >= A && C >= B){
        cout << 10 * C + A + B << endl;
    }
    
    return 0;
}

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

int n,m,cnt[26],aim[5];
char s[233];

void doit(int x){
	for (int i=0;i<26;i++){
		while (aim[x]&&cnt[i]>=x)
			aim[x]--,cnt[i]-=x;
	}
	if (aim[x]) exit(0*puts("No"));
}

int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++){
		scanf("%s",s+1);
		for (int j=1;j<=m;j++)
			cnt[s[j]-'a']++;
	}
	aim[1]=n&m&1;
	aim[2]=m/2*(n%2)+n/2*(m%2);
	aim[4]=(n*m-aim[1]-aim[2]*2)/4;
	doit(4); doit(2); doit(1);
	puts("Yes");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

ll M;

ll mpow(ll x, ll n, ll m){
    ll ret = 1;
    while(n){
        if(n&1) ret *= x, ret %= m;
        x *= x, x %= m;
        n >>= 1;
    }
    return ret;
}

const int MAX = 3e3;
ll fac[MAX+1], ifac[MAX+1];

void init(){
    fac[0] = 1;
    rep(i, MAX){
        fac[i+1] = fac[i]*(i+1)%M;
    }
    ifac[MAX] = mpow(fac[MAX], M-2, M);
    rep3(i, MAX, 1){
        ifac[i-1] = ifac[i]*i%M;
    }
}

ll perm(int n, int k){
    return fac[n]*ifac[n-k]%M;
}

ll comb(int n, int k){
    return perm(n, k)*ifac[k]%M;
}

int main(){
    int N;
    cin >> N >> M;
    init();
    ll dp[N+1][N+1];
    fill(dp[0], dp[N+1], 0);
    rep(i, N+1){
        dp[i][0] = dp[i][i] = 1;
        rep2(j, 1, i-1){
            dp[i][j] = dp[i-1][j-1]+(j+1)*dp[i-1][j];
            dp[i][j] %= M;
        }
    }
    ll ans = 0;
    rep(i, N+1){
        ll tmp = 0, pw = mpow(2, N-i, M), now = 1;
        rep(j, i+1){
            tmp += dp[i][j]*now, tmp %= M;
            now *= pw, now %= M;
        }
        tmp *= mpow(2, mpow(2, N-i, M-1), M), tmp %= M;
        tmp *= comb(N, i), tmp %= M;
        if(i&1) ans += M-tmp;
        else ans += tmp;
        ans %= M;
    }
    cout << ans << endl;
}

Measured memory_bytes: 73908
w=raw_input()
n=input()
l=['print','replace','reverse']
for i in range(n):
    c=map(str,raw_input().split())
    if c[0]==l[0]:
        print w[int(c[1]):int(c[2])+1]
    elif c[0]==l[1]:
        w=w[:int(c[1])]+c[3]+w[int(c[2])+1:]
    else:
        w=w[0:int(c[1])]+w[int(c[1]):int(c[2])+1][::-1]+w[int(c[2])+1:]

Measured memory_bytes: 4236
from collections import deque

K = int(input())

dq = deque([])

cnt = 0
for i in range(1, 10):
    dq.append(str(i))


while cnt < K:
    val = dq.popleft()
    cnt += 1

    if cnt == K:
        print(val)
        exit()

    if val[-1] == '0':
        dq.append(val + '0')
        dq.append(val + '1')
    elif val[-1] == '9':
        dq.append(val + '8')
        dq.append(val + '9')
    else:
        prev = int(val[-1]) - 1
        nex = int(val[-1]) + 1

        dq.append(val + str(prev))
        dq.append(val + val[-1])
        dq.append(val + str(nex))


Measured memory_bytes: 17012
#include<iostream>
#include<cstring>
using namespace std;
char s[10001];
int main()
{
	cin>>s;
	int len=strlen(s);
	for(int i=0;i<len;i++)
		if(s[i]=='9')
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
s = str(input())
K = int(input())

lis = list(set(list(s)))
lis.sort()

ans_lis = []
for i in range(min(5, len(lis))):
    i = lis[i]
    s2 = s
    while 1:
        idx = s2.find(i)
        if idx==-1:
            break
        ans_lis += [s2[idx:idx+l+1] for l in range(min(5, len(s2)-idx))]
        s2 = s2[idx+1:]
ans_lis = list(set(ans_lis))
ans_lis.sort()
print(ans_lis[K-1])

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

#define pb push_back
#define mp make_pair

typedef long long ll;

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;


int main()
{
  int n, y;
  cin >> n >> y;

  for(int i = 0; i <= n; i++){
    for(int j = 0; i+j <= n; j++){
      int k = n - (i+j);
      int sum = 10000*i + 5000*j + 1000*k;
      if(sum == y){
        cout << i << " " << j << " " << k << endl;
        return 0;
      }
    }
  }

  cout << "-1 -1 -1" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // ver1.9.4
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a[a.size()-1]<<endl;
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

signed main() {
  cout << fixed << setprecision(15);
  int a,b,c;
  cin >> a >> b >> c;
  if(a<b&&b<c) cYes;
  else cNo;
  return 0;
}



Measured memory_bytes: 3136
#include<bits/stdc++.h>
using namespace std;
long N,A,B,C,D,E;
int main() {
  cin>>N>>A>>B>>C>>D>>E;
  cout<<max({(N-1)/A,(N-1)/B,(N-1)/C,(N-1)/D,(N-1)/E})+5<< endl;
  return 0;
}


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

using namespace std;

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

    for (int i = 0; i < (int)s.length(); i++) {
        if (i % 2 == 0 && s[i] == 'L') {
            cout << "No\n";
            return 0;
        }
        
        if (i % 2 == 1 && s[i] == 'R') {
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";
    return 0;
}



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

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

    int count = 0;
    for (int i=1; i<=n; i++) {
        int k = 0;
        int t = i;
        while(true) {
            if (t == 0) break;
            k += t % 10;
            t /= 10;
        }
        if (k >= a && k <= b) count += i;
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
n, m = map(int, input().split())
ab = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  ab[a].append(b)
  ab[b].append(a)

ary = []
def dfs(s,t):
  if len(t) == n:
    ary.append(t)
    return
  for i in ab[s]:
    if i not in t:
      dfs(i,t+[i])
  return
dfs(0,[0])

print (len(ary))

Measured memory_bytes: 9652
#include <bits/stdc++.h>
#define ll long long
#define N 7
#define M 59
using namespace std;
int a[N],n,m,pos[N];
ll Ans=0.0,dp[N*M][1<<N];
ll get()
{
	memset(dp,0,sizeof(dp));
	dp[n*a[n]][0]=1;
	for (int i=0;i<=n*m;i++)
		for (int j=i;j<=n*m;j++)
			for (int k=0;k<(1<<(n-1));k++)
				if (i%n&&!(k>>(pos[i%n]-1)&1))
					dp[min(n*m,max(j,i+n*a[pos[i%n]]))][k|(1<<(pos[i%n]-1))]+=dp[j][k];
	return dp[n*m][(1<<(n-1))-1];
}
int main()
{
	cin>>n>>m;
	for (int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+n+1);
	for (int i=1;i<n;i++) pos[i]=i;
	ll num=0;
	while (true)
	{
		Ans+=get();
		num++;
		if (!next_permutation(pos+1,pos+n)) break;
	}
	for (int i=1;i<n;i++) num=num*m;
	cout<<setprecision(15)<<(double)Ans/num<<endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,nn) for(int i=0;i<nn;i++)
#define MOD 1000000007
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}

int n,m;

int par[100],urank[100];

void init(int n){
  FOR(i,n){
    par[i+1]=i+1;
    urank[i+1]=0;
  }
}

int root(int n){
  return par[n]==n?n:par[n]=root(par[n]);
}

void unite(int a,int b){
  a=root(a);
  b=root(b);
  if(a==b)return;
  if(urank[a]<urank[b]){
    par[a]=par[b];
  }else{
    par[b]=par[a];
    if(urank[a]==urank[b]){
      urank[a]++;
    }
  }
}

bool same(int a,int b){
  return root(a)==root(b);
}



int main(){
  cin >> n >> m;
  int a[100],b[100];
  FOR(i,m){
    cin >> a[i] >> b[i];
  }
  int ans=0;
  bool c=0;

  FOR(i,m){
    init(n);
    FOR(j,m){
      if(i==j)continue;
      unite(a[j],b[j]);
    }
    c=0;
    FOR(j,n){
      FOR(k,n){
        if(!same(j+1,k+1)){
          c=1;
          ans++;
          
          break;
        }
      }
      if(c)break;
    }
  }

  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const ll INF = LLONG_MAX;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int n, m;
ll l;
ll dp[2222][2222];
vi k, s, sum;

ll solve(int left, int right)
{
	if (dp[left][right] < INF) return dp[left][right];
	int t = max(left, right);
	ll res;
	if (t == n - 2)
	{
		res = (sum[k[n - 1]] - sum[k[left] - 1]) / l + (sum[k[n - 1]] - sum[k[right] - 1]) / l;
	}
	else
	{
		res = min(solve(t + 1, right) + (sum[k[t + 1]] - sum[k[left] - 1]) / l, solve(left, t + 1) + (sum[k[t + 1]] - sum[k[right] - 1]) / l);
	}
	return dp[left][right] = res;
}

int main()
{
	REP(i, 2222)REP(j, 2222) dp[i][j] = INF;
	cin >> n >> m >> l;
	k.resize(n), s.resize(m), sum.resize(m + 1);
	REP(i, n) cin >> k[i];
	REP(i, m) cin >> s[i];
	sort(ALL(k));
	REP(i, m) sum[i + 1] = sum[i] + s[i];
	cout << solve(0, 0) << endl;
	return 0;
}

Measured memory_bytes: 43248
#include<iostream>
using namespace std;
int main(){
  int n,sum=0;
  cin>>n;
  string s;
  cin>>s;
  for(int i=0;i<s.size()-2;i++){
    if(s.substr(i,3)=="ABC")
      sum++;
  }
  cout<<sum;
  return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	vector<string>s(3);
	for(auto&i:s)cin>>i;
	char ans;
	vector<int>abc(3,0);
	for(int i=0,tmp;;){
		tmp=i;
		i=s.at(i).at(abc.at(i))-'a';
		++abc.at(tmp);
		if(s.at(i).size()==abc.at(i)){
			cout<<static_cast<char>('A'+i)<<"\n"s;
			break;
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}





int main() {
	ll N;
	cin >> N;
	vector<ll> P(N);
	vector<ll> Q(N);
	rep(i,N){
		cin >> P.at(i);
		Q.at(P.at(i)-1) = i;		
	}
	
	ll an =1,c=1;
	rep(i, N-1) {
		if (Q.at(i) < Q.at(i + 1)) {
			c++;
			an = max(an, c);
			
		}
		else {
			
			c = 1;
		}
	}
	cout << N-an << endl;
}


Measured memory_bytes: 3328
let main = (standardInput) => {
  let lengthList = standardInput.split(" ");
  let input = Number.parseInt(lengthList[0]);

  function fib(n) {
    let first = 1,
      second = 1,
      result = 0;
    if (n === 0 || n === 1) {
      return 1;
    } else {
      for (let i = 1; i < n; i++) {
        result = first + second;
        first = second;
        second = result;
      }
      return result;
    }
  }
  console.log(fib(input));
};

main(require("fs").readFileSync("/dev/stdin", "UTF-8"));


Measured memory_bytes: 15144
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int dp[1 << 12];
int main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n, m, a, b, c, k;
  cin >> n >> m;
  for (int i = (1 << n) - 1; ~i; i--) dp[i] = 1e9;
  dp[0] = 0;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    c = 0;
    for (int j = 0; j < b; j++) {
      cin >> k;
      c |= (1 << k-1);
    }
    for (int j = (1 << n) - 1; ~j; j--) {
      dp[j | c] = min(dp[j | c], dp[j] + a);
    }
  }
  int ans = dp[(1<<n) - 1];
  if (ans == 1e9) cout << -1;
  else cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <vector>
#define ll long long
#define min(x,y) (x>y?y:x)
#define loop(i,s,e) for(int i=s;i<e;i++)
ll * ops;
int minOp(int * heights, int n, int k){
	if(ops[n]!=-1)return ops[n];
  	if(n==0)ops[n]=0;
  	else if(n==1)ops[n]=abs(heights[n]-heights[n-1]);
      
  	else{
          ll minht=INT32_MAX;
          loop(i,1,k+1){
                if(n-i>=0){
                    ll temp=minOp(heights,n-i,k)+abs(heights[n]-heights[n-i]);
                    minht=min(minht,temp);
                }
            }
          ops[n]=minht;
      } 
  	return ops[n];
}

int main(){
    ll n;cin>>n;
    int k;cin>>k;
  	ops=new ll[n];
    int * heights=new int[n];
  	loop(i,0,n){
        cin>>heights[i];
        ops[i]=-1;
    }
  	cout<<minOp(heights,n-1,k)<<endl;

}

Measured memory_bytes: 9216
#!/usr/bin/env python3

n = int(input())
a = list(map(int, input().split()))
assert len(a) == n

num = {}
for x in a:
    if x in num:
        num[x] += 1
    else:
        num[x] = 1

res = 0
for x in num:
    if num[x] >= x:
        res += num[x] - x
    else:
        res += num[x]

print(res)
    


Measured memory_bytes: 18168
#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 ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

typedef complex<double> P;
typedef complex<double> Vec;

double dot(Vec a, Vec b) {
	return a.real() * b.real() + a.imag() * b.imag();
}

double cross(Vec a, Vec b) {
	return a.real() * b.imag() - a.imag() * b.real();
}

bool comp(P a, P b) {
	if (a.real() != b.real()) return a.real() < b.real();
	return a.imag() < b.imag();
}

vector<P> convex_full(vector<P> p) {
	sort(ALL(p), comp);
	
	vector<P> res(2 * p.size());
	int k = 0;
	
	// 下側凸包
	REP(i, p.size()) {
		while (k > 1 && cross(res[k - 1] - res[k - 2], p[i] - res[k - 2]) <= 0) k--;
		res[k++] = p[i];
	}
	
	// 上側凸包
	for (int i = (int)p.size() - 2, c1 = k; i >= 0; i--) {
		while (k > c1 && cross(res[k - 1] - res[k - 2], p[i] - res[k - 2]) <= 0) k--;
		res[k++] = p[i];
	}
	
	res.resize(k - 1);
	return res;
}

int N;
double x[100], y[100];
double ans[100], ang[100];

int main() {
	cin >> N;
	REP(i, N) scanf("%lf %lf", x + i, y + i);
	
	if (N == 2) {
		printf("0.5\n0.5\n");
		return 0;
	}
	
	vector<P> p;
	REP(i, N) p.emplace_back(x[i], y[i]);
	
	vector<P> totu = convex_full(p);
	vector<pair<P, int> > dat;
	REP(i, totu.size()) {
		REP(j, N) if (totu[i] == p[j]) {
			dat.emplace_back(p[j], j);
			break;
		}
	}
	
	
	REP(i, dat.size()) {
		Vec v1 = dat[(i + 1) % dat.size()].fi - dat[i].fi;
		Vec v2 = dat[(i - 1 + dat.size()) % dat.size()].fi - dat[i].fi;
		ang[i] = M_PI - acos(dot(v1, v2) / sqrt(dot(v1, v1) * dot(v2, v2)));
		ans[dat[i].se] = ang[i] / (2 * M_PI);
	}
	
	REP(i, N) printf("%.15lf\n", ans[i]);
	return 0;
}


Measured memory_bytes: 384
// ACM-ICPCアジア地区予選2014 B. Miscalculation

#include <iostream>
#include <string>

using namespace std;

int mul(const string& str, int& idx){
	int res = str[idx]-'0';
	while(idx+1 < str.size() && str[idx+1]=='*'){
		idx += 2;
		res *= str[idx]-'0';
	}
	return res;
}

int add(const string& str, int& idx){
	int res = mul(str, idx);
	while(idx+1 < str.size() && str[idx+1] == '+'){
		idx += 2;
		res += mul(str, idx);
	}
	return res;
}

int bob(const string& str, int& idx){
	int res = str[idx]-'0';
	while(idx+1 < str.size()){
		if(str[idx+1] == '+') res += str[idx+2]-'0';
		else                  res *= str[idx+2]-'0';
		idx += 2;
	}
	return res;
}

int main(){
	string s; int d;
	while(cin >> s >> d){
		int idx = 0;
		int a = add(s, idx);
		idx = 0;
		int b = bob(s, idx);
		if(a == d){
			cout << (b == d ? "U" : "M") << endl;
		} else {
			cout << (b == d ? "L" : "I") << endl;
		}
	}
}

Measured memory_bytes: 1192
import bisect


A, B, Q = map(int, input().split())
s = [-10 ** 12] + [int(input()) for _ in range(A)] + [10 ** 12]
t = [-10 ** 12] + [int(input()) for _ in range(B)] + [10 ** 12]
x = [int(input()) for _ in range(Q)]
for i in x:
    si = bisect.bisect_left(s, i)
    ti = bisect.bisect_left(t, i)
    s1, s2 = s[si - 1], s[si]
    t1, t2 = t[ti - 1], t[ti]
    ans = 10 ** 12
    for ss in [s1, s2]:
        for tt in [t1, t2]:
            ans = min(ans, abs(i - ss) + abs(ss - tt),
                      abs(i - tt) + abs(ss - tt))
    print(ans)

Measured memory_bytes: 16144
#include <stdio.h>

int main(void)
{
	int a;
	int b;
	int c;
	
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);
	
	if (a < b && b < c){
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	
	return (0);
}

Measured memory_bytes: 580
#include <stdio.h>
 
int main() {
  int c, d, pos = 0;
  char str[20];
  scanf("%d %d %s", &c, &d, str);
  for (int i = 0; str[i] != '\0'; i++) {
    (str[i] == '-') ? pos += i + 1 : pos += 0;
  }
  pos == c + 1 ? puts("Yes") : puts("No");
  return 0;
}

Measured memory_bytes: 1632
/*######################################################
#########~~~~~####~~~~###~~##~~##~~##~~##~~##~~#########
#########~~##~~##~~##~~##~~~#~~##~~~#~~##~~##~~#########
#~~~~~~##~~~~~###~~~~~~##~~#~~~##~~#~~~##~~##~~##~~~~~~#
#########~~######~~##~~##~~##~~##~~##~~##~~##~~#########
#########~~######~~##~~##~~##~~##~~##~~###~~~~##########
######################################################*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#define ll long long
#define str string
#define rtn return
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define db long double
#define MOD 1000000007
#define INF 1e18
#define EPS 1e-15
#define pll pair <ll, ll>
#define vi vector<ll>
#define vpll vector<pll>
#define value_at find_by_order
#define index_of order_of_key
#define fill(a,v) memset(a,v,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(ll i=0;i<n;++i)
#define per(i,n) for(ll i=n-1;i>=0;--i)
#define loop1(i, n) for (int i=1;i<=n;++i)
#define loop(i, begin, end) for (__typeof(end) i = (begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define FAST_IO std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);std::cout.tie(NULL)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " = " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " = " << arg1 << " |";
  __f(comma+1, args...);
}
#else
#define trace(...)
#endif

template<class T> void remin(T &a, T b) {a = min(a, b);}
template<class T> void remax(T &a, T b) {a = max(a, b);}
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define N 100005

ll dp[N][2];
ll n, k;
ll a[105];

ll solve(int k, int mask) {
  if (k == 0 || k < a[0]) rtn 0;
  if (dp[k][mask] != -1) rtn dp[k][mask];
  dp[k][mask] = 0;
  rep(i, n) {
    if (a[i] <= k)
      dp[k][mask] |= !solve(k - a[i], !mask);
  }
  //trace(k, mask, dp[k][mask]);
  rtn dp[k][mask];
}

int main() {
  //FAST_IO;
  fill(dp, -1);
  cin >> n >> k;
  rep(i, n) cin >> a[i];
  cout << (solve(k, 0) == 1 ? "First" : "Second");
  rtn 0;
}


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

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

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//C++17以上
template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

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

int main() {
    int n;cin >> n;
    vector<int> h(n);
    rep(i,n)cin >> h[i];
    int pre = -100;
    for(int i=0;i<n;i++){
        if(pre<=h[i]-1){
            pre = h[i] -1;
        }else if(pre<=h[i]){
            pre = h[i];
        }else{
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 640
import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array,
  std.functional, std.container, std.typecons;

int M = 1000000007;

int[] tbl = [ 1, 10, 9, 12, 3, 4 ];

void main() {
  string S = readln.chomp;
  auto N = S.length;

  ulong[] items = new ulong[0];
  int baseMod13 = 0;
  foreach(i; 0..N) {
    char c = S[$-1-i];
    if(c == '?') items ~= i % 6;
    c = c != '?' ? c : '0';
    baseMod13 += (tbl[i % 6]*(c - '0')) % 13;
  }
  baseMod13 %= 13;

  int mod13 = ((13+5) - baseMod13) % 13;
  ulong[13][] dp = new ulong[13][items.length];
  if (dp.length == 0) {
    writeln(baseMod13 == 5 ? 1 : 0);
    return;
  }
  foreach(i; 0..10) {
    int mod = (tbl[items[0]] * i)%13;
    dp[0][mod]++;
  }
  foreach(i; 1..dp.length) {
    foreach(j; 0..13) {
      ulong m = 0;
      foreach(k; 0..10) {
        int mod = (tbl[items[i]] * k) % 13;
        int diff = ((13+j) - mod) % 13;
        m = (m + dp[i-1][diff]) % M;
      }
      dp[i][j] = m % M;
    }
  }
  dp[$-1][mod13].writeln;
}


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

int main() {
    vector<vector<int>> c(4, vector<int>(4));
    for (int i=1; i<=3; i++) cin >> c[i][1] >> c[i][2] >> c[i][3];
    int a1, a2, a3, b1, b2, b3;
    a1 = 0;
    b1 = c[1][1];
    b2 = c[1][2];
    b3 = c[1][3];
    a2 = c[2][1] - b1;
    a3 = c[3][1] - b1;
    bool A = c[2][2] == a2 + b2;
    bool B = c[2][3] == a2 + b3;
    bool C = c[3][2] == a3 + b2;
    bool D = c[3][3] == a3 + b3;
    if (A && B && C && D) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> VECINT;
typedef vector<ll> VECLL;

int main() {
  int N,K;cin>>N>>K;
  map<int,int> mp;
  REP(i,N) {
    int a;cin>>a;
    mp[a]++;
  }
  // まずは数の種類でカウントを取っていく
  // K種類よりも少なければそこで終了
  // 多ければ、最も個数が少ないものから順番に消していく
  int mp_size = mp.size();
  if (mp_size<=K) {
    OUT(0);
    return 0;
  }

  vector<P> pairs;
  for (auto m:mp) pairs.push_back({m.first,m.second});

  auto sorter = [](P a, P b) { return a.second < b.second; };
  sort(ALL(pairs),sorter);

  int gap = mp_size - K;
  int ans = 0;
  REP(i,gap) ans += pairs[i].second;

  OUT(ans);

  return 0;
}

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

#define ll              long long
#define pb              push_back
#define mp              make_pair
#define ff              first
#define ss              second
#define SQ(x)           ((x)*(x))
#define LCM(x,y)        (((x)/gcd((x),(y)))*(y))
#define PI              acos(-1)
#define SZ(x)           x.size() - 1
#define waa             printf("Ripon\n")
#define mem(a,b)        memset(a,b,sizeof(a))
#define rep(i,a,n)      for(int i=(int)(a);i<=(int)(n);i++)
#define per(i,n,a)      for(int i=(int)(n);i>=(int)(a);i--)
#define SC              scanf
#define PF              printf
#define all(v)          v.begin(), v.end()
#define allr(v)         v.rbegin(), v.rend()
int dx[] = { 0, 1, 0, -1, -1, 1, 1, -1 };
int dy[] = { 1, 0, -1, 0, -1, -1, 1, 1 };
int kx[] = { -2, -2, -1, 1, 2, 2, 1, -1 };
int ky[] = { -1, 1, 2, 2, 1, -1, -2, -2 };
int overlap(int rs,int re,int qs,int qe){ if(rs>qe or re<qs) return 0; else if(qs<=rs and re<=qe) return 1; else return 2;} // 0 no, 1 total, 2 partial
//--------------------------//
void pvec(auto v){
    for (auto x:v){
        cout<<x<<" ";
    }
    cout<<endl;
}
//------------done with useless stuff--------------//


struct DATA{};
#define TC 0
#define mod 10000007
#define N 1000000
int n,m;
string str;
vector<int> v;



void solve(int T) {

    cin>>str;
    stack<char> st,st2;
    rep(i,0,SZ(str)){
        if(str[i]=='B' and !st.empty()) st.pop();
        else if(str[i]=='0') st.push('0');
        else if(str[i]=='1') st.push('1');
        else continue;
    }

    while(!st.empty()){
        st2.push(st.top());
        st.pop();
    }

    while(!st2.empty()){
        cout<<st2.top();
        st2.pop();
    }

    cout<<endl;

}


int main(){

    ios_base::sync_with_stdio(0);cin.tie(nullptr);
	#ifdef RIPON
	    freopen("file.txt","r",stdin);
	#endif

    int T=1;
    if(TC) cin>>T;
    for(int t=1;t<=T;t++)   solve(t);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int a[102][102];
int tansaku(int x,int y,int s,int t){
	int count = 0;
		for(int i = y;i < y + t;i++){
			for(int j = x;j < x + s;j++){
				if(a[i][j] == 1)count++;
			}
		}
	return count;
}


int main() {
	int n,w,h,x,y,s,t,ans,count;
	while(1){
		ans = 0;
		cin >> n;
		if(n == 0)break;
		for(int i = 0;i < 101;i++){
			for(int j = 0;j < 101;j++){
				a[i][j] = 0;
			}
		}
		cin >> w >> h;
		for(int i = 0;i < n;i++){
			cin >> x >> y;
			a[y][x] = 1;
		}
		cin >> s >> t;
		
		for(int i = 1;i + t - 1<= h;i++){
			for(int j = 1;j + s - 1 <= w;j++){
				ans = max(ans,tansaku(j,i,s,t));
			}
		}
	
	
	cout << ans <<endl;
	}
	return 0;
}

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

int main()
{

	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n;
	cin >> n;
	int ara[n];
	for (int i = 0; i < n; ++i)
	{
		cin >> ara[i];
	}
	int sum = 0;
	int z = 0;
	for (int i = 0; i < n - 2; ++i)
	{
		for(int j = i + 1; j < n - 1; j++)
		{
			while(ara[j] == ara[i] && j < n - 1)
			{
				j++;
			}
			if(j == n - 1)
			{
				break;
			}
			for(int k = j + 1; k < n; k++)
			{
				while(ara[k] == ara[j] || ara[k] == ara[i] && k < n)
				{
					k++;
				}
				if(k == n)
				{
					break;
				}
				if (ara[i] + ara[j] > ara[k] && ara[j] + ara[k] > ara[i] && ara[k] + ara[i] > ara[j])
				{
					sum++;
				}
			}
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3616
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro split-ints-and-bind (vars string &body body)
  (let ((pos1 (gensym "POS"))
	(pos2 (gensym "POS"))
	(str (gensym "STR")))
    (labels ((expand (vars &optional (init-pos1 t))
	       (if (null vars)
		   body
		   `((let* ((,pos1 ,(if init-pos1 0 `(1+ ,pos2)))
			    (,pos2 (position #\space ,str :start ,pos1 :test #'char=))
			    (,(car vars) (parse-integer ,str :start ,pos1 :end ,pos2)))
		       ,@(expand (cdr vars) nil))))))
      `(let ((,str ,string))
         (declare (string ,str))
	 ,@(expand vars)))))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

;; Hauptteil

(defun main ()
  (declare #.OPT)
  (let* ((n (read))
         (m (read))
         (edges (make-array m :element-type 'list)) ; (from to -cost)
         (dp (make-array n :element-type 'fixnum :initial-element most-positive-fixnum)))
    (setf (aref dp 0) 0)
    (dotimes (i m)
      (split-ints-and-bind (a b c) (read-line)
        (declare (uint32 a b) (fixnum c))
        (setf (aref edges i) (list (- a 1) (- b 1) (- c)))))
    (labels ((forward ()
               (loop for (src dest neg-cost) of-type (uint32 uint32 fixnum) across edges
                     when (and (/= most-positive-fixnum (aref dp src))
                               (< (+ (aref dp src) neg-cost)
                                  (aref dp dest)))
                     do (setf (aref dp dest) (+ (aref dp src) neg-cost)))))
      (if (= (loop repeat (- n 1) do (forward)
                   finally (return (aref dp (- n 1))))
             (loop repeat n do (forward)
                   finally (return (aref dp (- n 1)))))
          (println (- (aref dp (- n 1))))
          (println "inf")))))

#-swank(main)


Measured memory_bytes: 20968
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> v[606];
int main()
{
	int n,now=1,ans=2,cnt;
	scanf("%d",&n);
	while(now<n)
	{
		now+=ans;
		ans++;
	}
	if(now!=n)
	{
		printf("No");
		return 0;
	}
	cnt=0;
	for(int i=1;i<ans;i++)
		for(int j=i+1;j<=ans;j++)
		{
			++cnt;
			v[i].push_back(cnt);
			v[j].push_back(cnt);
		}
	printf("Yes\n%d\n",ans);
	for(int i=1;i<=ans;i++)
	{
		printf("%d",(int)v[i].size());
		for(int j=0;j<v[i].size();j++)
			printf(" %d",v[i][j]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;


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

    int n, displayed_rating;
    cin >> n >> displayed_rating;

    int modifier = (n < 10) ? 100 * (10 - n) : 0;
    cout << displayed_rating + modifier;
    return 0;
}

/*
file=a
g++ -W -Wall -pedantic --std=c++17 -ggdb3 -o ${file}.out ${file}.cpp && ./${file}.out

*/


Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;
int h,w;
int a[505][505];
vector<pi>vec;
vector<pair<pi,pi> >ses;
vector<pi>yo;
int flag=0;
void dfs(int x,int y,int ex,int ey,int turn)
{
    if(flag)return ;
    if(x==ex && y==ey)
    {
        flag=1;
        return ;
    }
    if(y>w)
    {
        y=w;
        x++;
        turn=1-turn;
        dfs(x,y,ex,ey,turn);
        return ;
    }
    if(y<1)
    {
        y=1;
        x++;
        turn=1-turn;
        dfs(x,y,ex,ey,turn);
        return ;
    }
    yo.pb(mp(x,y));
    if(turn==0)
    {
        dfs(x,y+1,ex,ey,turn);
    }
    else if(turn==1)
    {
        dfs(x,y-1,ex,ey,turn);
    }

}
void work(pi u,pi v)
{
    int x1=u.fi;
    int y1=u.si;
    int x2=v.fi;
    int y2=v.si;
    int turn=0;
    if(x1%2==0)turn=1;
    flag=0;
    yo.clear();
    dfs(x1,y1,x2,y2,turn);
    yo.pb(mp(x2,y2));
    int sz=yo.size();
//    for(auto x:yo)
//    {
//        cout<<x.fi<<" "<<x.si<<endl;
//    }
//    cout<<"......"<<endl;
    for(int i=0;i<sz-1;i++)
    {
       ses.pb(mp(yo[i],yo[i+1]));
    }
}
 main()

{
    fast
    cin>>h>>w;
    f(i,1,h)
    {
        vector<pi>nw;
        f(j,1,w)
        {
            cin>>a[i][j];
            if(a[i][j]%2==1)nw.pb(mp(i,j));
        }
        if(i%2==0)reverse(nw.begin(),nw.end());
        for(auto x:nw)vec.pb(x);
    }
    if(vec.size()==0)
    {
        cout<<"0"<<endl;
        return 0;
    }
    if(vec.size()%2==1)vec.pop_back();
    int sz=vec.size();
    if(sz==0)
    {
        cout<<"0"<<endl;return 0;
    }
    for(int i=0;i<sz;i=i+2)
    {
        pi x=vec[i];
        pi y=vec[i+1];
        //cout<<x.fi<<" "<<x.si<<" "<<y.fi<<" "<<y.si<<endl;
        work(x,y);
    }
   cout<<ses.size()<<"\n";
    for(auto x:ses)
    {
        pi u=x.fi;
        pi v=x.si;
        cout<<u.fi<<" "<<u.si<<" "<<v.fi<<" "<<v.si<<"\n";
    }
    return 0;

}





































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

bool isPrime(int x) {
    if (x == 2) {
    	return true;
    }
    if (x < 2 || x % 2 == 0) {
    	return false;
    }
    int i = 3;
    while (i <= sqrt(x)) {
    	if (x % i == 0) {
    		return false;
    	}
    	i = i + 2;
    }
    return true;
}
int main() {
    int n;
    cin >> n;
    int count = 0;
    for (int i = 0; i < n; i++){
        int x;
        cin >> x;
        if (isPrime(x) == true) {
        	count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define MOD 998244353LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

string str;

set<string> se;
int dp[300001][3][4][2];

void dfs(string s){
	if(se.find(s)!=se.end())return;
	se.insert(s);
	for(int i=0;i+1<s.size();i++){
		if(s[i]!=s[i+1]){
			for(int j=0;j<3;j++){
				if(s[i]!=('a'+j) && s[i+1]!=('a'+j)){
					string ss=s;
					ss[i]=('a'+j);
					ss[i+1]=('a'+j);
					dfs(ss);
				}
			}
		}
	}
}

int main(void){
	cin >> str;
	if(str.size()<=4){
		dfs(str);
		cout << se.size() << endl;
	}else{
		int n=str.size();
		bool fu=false;
		bool unko=false;
		int cnt=0;
		for(int i=0;i<n;i++){
			cnt+=str[i]-'a';
			if(i<n-1 && str[i]!=str[i+1])fu=true;
			if(i<n-1 && str[i]==str[i+1])unko=true;
		}
		if(!fu){
			printf("1\n");
			return 0;
		}
		dp[0][0][3][0]=1;
		for(int i=0;i<n;i++){
			for(int j=0;j<3;j++){
				for(int k=0;k<=3;k++){
					for(int l=0;l<2;l++){
						for(int a=0;a<3;a++){
							dp[i+1][(j+a)%3][a][max(l,a==k?1:0)]+=dp[i][j][k][l];
							dp[i+1][(j+a)%3][a][max(l,a==k?1:0)]%=MOD;
						}
					}
				}
			}
		}
		ll ans=0;
		if(!unko)ans++;
		for(int i=0;i<3;i++){
			ans+=dp[n][cnt%3][i][1];
			ans%=MOD;
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 20996