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

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

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int H, W;
    cin >> H >> W;

    vector<string> S(H);
    rep(i, H) cin >> S[i];

    queue<P> q;
    q.emplace(0, 0);

    bool res = false;
    int used[60][60];
    rep(i, H)rep(j, W) used[i][j] = INF;
    used[0][0] = 0;

    while (!q.empty()) {
        P p = q.front(); q.pop();
        int y = p.first, x = p.second;
        if (y == H-1 && x == W-1) {
            res = true;
            break;
        }
        if (y+1 < H && used[y+1][x] == INF && S[y+1][x] == '.') {
            used[y+1][x] = used[y][x] + 1;
            q.emplace(y+1, x);
        }
        if (0 <= y-1 && used[y-1][x] == INF && S[y-1][x] == '.') {
            used[y-1][x] = used[y][x] + 1;
            q.emplace(y-1, x);
        }
        if (x+1 < W && used[y][x+1] == INF && S[y][x+1] == '.') {
            used[y][x+1] = used[y][x] + 1;
            q.emplace(y, x+1);
        }
        if (0 <= x-1 && used[y][x-1] == INF && S[y][x-1] == '.') {
            used[y][x-1] = used[y][x] + 1;
            q.emplace(y, x-1);
        }
    }

    if (!res) {
        cout << -1 << endl;
        return 0;
    }

    vector<P> root;
    root.emplace_back(H-1, W-1);
    int y = H-1, x = W-1;
    while (0 < y || 0 < x) {
        if (0 < y && used[y-1][x] < used[y][x]) {
            y--;
        } else if (0 < x && used[y][x-1] < used[y][x]) {
            x--;
        } else if (y+1 < H && used[y+1][x] < used[y][x]) {
            y++;
        } else if (x+1 < W && used[y][x+1] < used[y][x]) {
            x++;
        }
        root.emplace_back(y, x);
    }

    int ans = 0;
    rep(i, H)rep(j, W) {
        if (S[i][j] == '#') continue;
        P pos = P(i, j);
        bool res = true;
        for (auto &p : root) {
            if (pos == p) res = false;
        }
        if (res) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll n;
  cin>>n;
  ll a,b,c;
  cin>>a>>b>>c;
  for(ll i=1;i<n;i++)
  {
    ll e,f,g;
    cin>>e>>f>>g;
    ll x,y,z;
    x=a;
    y=b;
    z=c;
    a=e+max(y,z);
    b=f+max(x,z);
    c=g+max(x,y);
  }
  cout<<max(max(a,b),c);
  return 0;
  
  
  
}


Measured memory_bytes: 384
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn main() {
    input! {
        mut n: usize,
    }
    let mut d = vec![];
    while n > 0 {
        n -= 1;
        d.push(n % 26);
        n /= 26;
    }
    d.reverse();
    eprintln!("{:?}", d);
    println!(
        "{}",
        d.iter()
            .map(|i| ('a' as usize + i) as u8 as char)
            .collect::<String>()
    );
}


Measured memory_bytes: 2192
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		boolean clear = false;
		for (int i = 1; i < b; i++) {
			if (a * i % b == c) {
				System.out.println("YES");
				clear = true;
				break;
			}
		}
		if (!clear) { 
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 20820
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
LL MOD = 1000000007;
vector<int> G[100000];
bool in[100000];
vector<int> S, T;
int main() {
	int N, M;
	cin >> N >> M;
	int s, t;
	for (int i = 0; i < M; i++) {
		int A, B;
		cin >> A >> B; A--; B--;
		G[A].push_back(B);
		G[B].push_back(A);
		s = A, t = B;
	}
	in[s] = in[t] = 1;
	int now = s;
	while (1) {
		bool ok = 1;
		for (int i = 0; i < G[now].size(); i++) {
			int to = G[now][i];
			if (!in[to]) {
				ok = 0;
				now = to;
				break;
			}
		}
		if (ok) break;
		in[now] = 1;
		S.push_back(now);
	}
	now = t;
	while (1) {
		bool ok = 1;
		for (int i = 0; i < G[now].size(); i++) {
			int to = G[now][i];
			if (!in[to]) {
				ok = 0;
				now = to;
				break;
			}
		}
		if (ok) break;
		in[now] = 1;
		T.push_back(now);
	}
	vector<int> ans;
	for (int i = S.size() - 1; i >= 0; i--) ans.push_back(S[i]);
	ans.push_back(s);
	ans.push_back(t);
	for (int i = 0; i < T.size(); i++) ans.push_back(T[i]);
	cout << ans.size() << endl;
	cout << ans[0] + 1;
	for (int i = 1; i < ans.size(); i++) {
		cout << " " << ans[i] + 1;
	}
	cout << endl;
}

Measured memory_bytes: 7288
import java.util.*;
 
public class Main { 
	public static int n;
	public static int m;
	public static int[][] cs;
	public static int[] ps;
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		cs = new int[m][n];
		for(int i=0; i<m; i++){
			int k = sc.nextInt();
			for(int j=0; j<k; j++){
				cs[i][j] = sc.nextInt();
			}
		}
		ps = new int[m];
		for(int i=0; i<m; i++){
			ps[i] = sc.nextInt();
		}
		int ans = bitSearch(n);
		System.out.println(ans);
	}

	static int bitSearch(int n) {
		int ans = 0;
		for (int i = 0; i < (Math.pow(2, n)); i++) {
			boolean[] flags = new boolean[n];
			for (int j = 0; j < n; j++) {
				if ((1 & i >> j) == 1) {
					flags[j] = true;
				} else {
					flags[j] = false;
				}
			}
			boolean flag=true;
			for(int j=0; j<cs.length; j++){
				int count = 0;
				for(int k: cs[j]){
					if(k != 0 && flags[k-1]) count++;
				}
				if(count%2!=ps[j]) flag=false; 
			}
			if(flag) ans++;
		}
		return ans;
	}
}


Measured memory_bytes: 22612
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
const int maxn =10007;
const int mx   =2e6+7;
using namespace std;
int n,m,fa[maxn];
struct node {
	int from;
	int to;
	double r;
}a[mx];
struct nn{
	int x,y;
}p[maxn];

bool cmp(node a,node b)
{
	return a.r>b.r;
}
void init(){
	for(int i=1;i<=n;i++)
		fa[i] = i;
	memset(a,0,sizeof(a));
	memset(p,0,sizeof(p));
}
int find(int x)
{
	if(fa[x]==x)return x;
	else return fa[x] = find (fa[x]);
}
bool uni(int x,int y)
{
	int px = find(x);
	int py = find (y);
	if(px==py)return false;
	fa[px] = py;
	return true;
}
int main(){
	scanf("%d%d",&n,&m);
	init();
	for(int i=1;i<=n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		p[i].x=x;
		p[i].y=y;
	}
	double sum = 0,res=0;
	for(int i=1;i<=m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		double tmp = sqrt((p[u].x-p[v].x)*(p[u].x-p[v].x)+(p[u].y-p[v].y)*(p[u].y-p[v].y));
		a[i].from=u;
		a[i].to=v;
		a[i].r = tmp;
		sum+=tmp;
	}
	sort(a+1,a+1+m,cmp);
	for(int i=1;i<=m;i++)
	{
		int u = a[i].from;
		int v = a[i].to;
		if(uni(u,v))res+=a[i].r;
	}
	printf("%.3lf\n",sum-res);
	return 0;
}


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

int main() {
  string K = "keyence";
  string S; cin >> S;
  int i,j;
  for(i=0; i<S.size(); ++i) {
    if(S[i] != K[i]) break;
  }
  for(j=S.size()-(K.size()-i); j<S.size(); ++j, ++i) {
    if(S[j] != K[i]) break;
  }
  printf("%s\n", i==K.size()?"YES":"NO");
}

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

int main(){
	int i,j,k,n,m,a[5],b[5],x,y,z;
	
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		a[0]=a[1]=0;
		a[2]=a[3]=4000;
		for(i=0;i<4;i++){
			scanf("%d",&m);
			z=0;
			for(j=0;j<4;j++){
				scanf("%d%d",&x,&y);
				z+=x*60+y;
			}
			for(j=0;j<i;j++){
				if(a[j]<z){
					for(k=i-1;k>=j;k--){
						a[k+1]=a[k];
						b[k+1]=b[k];
					}
					a[j]=z;
					b[j]=m;
					break;
				}
			}
			if(j==i){
				a[i]=z;
				b[i]=m;
			}
		}
		n-=4;
		while(n--){
			scanf("%d",&m);
			z=0;
			for(i=0;i<4;i++){
				scanf("%d%d",&x,&y);
				z+=x*60+y;
			}
			if(z>a[0]){
				a[1]=a[0];b[1]=b[0];
				a[0]=z;b[0]=m;
			}
			else if(z>a[1]){
				a[1]=z;b[1]=m;
			}
			if(z<a[3]){
				a[2]=a[3];b[2]=b[3];
				a[3]=z;b[3]=m;
			}
			else if(z<a[2]){
				a[2]=z;b[2]=m;
			}
		}
		for(i=3;i>0;i--)printf("%d\n",b[i]);
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstring>
#include <algorithm>
void Unused(...) {}
#ifndef DEBUG
  #define echo(...) Unused(__VA_ARGS__)
#else
  #define echo(...) fprintf(stderr, __VA_ARGS__)
#endif

typedef long long laolin;

const int MaxN = int(1e5) + 7;

int n, k;

int main()
{
    scanf("%d %d", &n, &k);
    laolin ans = n / k;
    laolin ano = 0;
    if (k % 2 == 0)
        ano = n / k + (n % k >= k / 2);
    printf("%lld\n", ans * ans * ans + ano * ano * ano);
    return 0;
}

/*
 * given a, then:
 *  - a + b %=k 0 => b = sk - a
 *  - a + c %=k 0 => c = tk - a
 *  - b + c %=k 0 => (s+t-p)k = 2a
 */



Measured memory_bytes: 128
#include <stdio.h>

void swap(int *a, int *b){
  int t=*a;*a=*b;*b=t;
}

int main(void){
  int w,n,i,l[31];
  scanf("%d\n",&w);
  scanf("%d\n",&n);
  for(i=1;i<=w;i++){
    l[i]=i;
  }
  for(i=0;i<n;i++) {
    int a,b;
    scanf("%d,%d\n",&a,&b);
    swap(&l[a],&l[b]);
  }
  for(i=1;i<=w;i++){
    printf("%d\n", l[i]);
  }

  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	vl a(s[0]=='1'?2:3,0);
	char t=s[0];
	rep(i,n){
		if(s[i]!=t)a.push_back(0);
		a.back()++;
		t=s[i];
	}
	a.push_back(0);
	a.push_back(0);
	//puta(a);
	ll pm=a.size();
	ll v=0,p=0,q=0;
	while(1){
		q+=a[p];
		if(p>=k*2+1){
			q-=a[p-(k*2+1)];
		}
		if(p%2==1){
			chmax(v,q);
		}
		p++;
		if(p==pm)break;
	}
	puta(v);
	return 0;
}


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

int main() {
    char ch;
    while(1) {
        cin.get(ch);
        if(ch == '\n') break;
        if(islower(ch)) {
            cout << (char)toupper(ch);
        } else if(isupper(ch)) {
            cout << (char)tolower(ch);
        } else {
            cout << ch;
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=5005;
int n,k,a[max_n];
//bool pre[max_n][max_n],suf[max_n][max_n];
bitset<max_n> pre[max_n],suf[max_n];
int main(){
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)scanf("%d",a+i);
    /*
    pre[0][0]=1;
    for(int i=0;i<n;i++){
        for(int j=0;j<=k;j++){
            pre[i+1][j]|=pre[i][j];
            pre[i+1][min(j+a[i+1],k)]|=pre[i][j];
        }
    }
    suf[n+1][0]=1;
    for(int i=n+1;i>=2;i--){
        for(int j=0;j<=k;j++){
            suf[i-1][j]|=suf[i][j];
            suf[i-1][min(j+a[i-1],k)]|=suf[i][j];
        }
    }
    */
    pre[0][0]=1;
    for(int i=1;i<=n;i++)pre[i]=pre[i-1]|(pre[i-1]<<a[i]);
    suf[n+1][0]=1;
    for(int i=n;i>=1;i--)suf[i]=suf[i+1]|(suf[i+1]<<a[i]);
    int ans=0;
    for(int i=1;i<=n;i++){
        int now=0;
        for(int j=k;j>=0;j--){
            while(now+j<k-a[i]||now<k&&!suf[i+1][now])++now;
            if(pre[i-1][j]&&now+j<k){
                ans++;
                break;
            }
        }
    }
    printf("%d\n",n-ans);
    return 0;
}

Measured memory_bytes: 6400
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int n, c, k;
  cin >> n >> c >> k;
  vector<int> t(n);
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }
  sort(all(t));
  int ans = 0;
  int now_max = t[0] + k;
  int now_n = 0;
  for (int i = 0; i < n; i++) {
    if (t[i] <= now_max && now_n + 1 <= c) {
      now_n++;
    } else {
      ans++;
      now_max = t[i] + k;
      now_n = 1;
    }
  }
  if (now_n > 0) ans++;
  cout << ans << endl;
  return 0;
}

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

int main() {
  int n,x; cin>>n>>x;
  int mymin=1000;
  for(int i=0;i<n;i++){
  	int m;cin>>m;
    x-=m;
    mymin=min(mymin,m);   
  }
  cout<<n+x/mymin<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
inline ll read(){
    ll res=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=getchar();}
    while(ch>='0'&&ch<='9'){res=(res<<3)+(res<<1)+ch-'0';ch=getchar();}
    return res*f;
}
void write(ll x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10|'0');
}

int n,ans;
signed main(){
    n=read();
    cout<<n*n*n<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){

    long long score[1000][1000],r,c,n;
    cin>>r>>c;

    for(int i=0;i<r;i++){ //縦
        for(int j=0;j<c;j++){ //横
            cin >> n;
            score[i][j] = n;
            score[i][c]+=n;
            cout<<score[i][j]<<" ";
        }
        cout<<score[i][c]<<endl;
    }

    for(int j=0;j<c;j++){ //横
    	for(int i=0;i<r;i++){ //縦
    		score[r][j]+=score[i][j];
    	}cout<<score[r][j]<<" ";
        score[r][c] += score[r][j];
    }cout<<score[r][c]<<endl;
    return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h> 
using namespace std;
int main(){
    int N,a[200001];
    deque<int> v;
    cin>>N;
    for(int i=0;i<N;i++) scanf("%d",&a[i]);
    for(int i=0;i<N;i++)
    if(i%2) v.push_front(a[i]);
    else v.push_back(a[i]);
    if(N%2) reverse(v.begin(),v.end());
    for(int i=0;i<N;i++) printf("%d ",v[i]);
    return 0;
}

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

using namespace std;

int main(int argc, char const *argv[])
{
    int N,limit;
    cin>>N>>limit;

    vector<pair<int,int>> route;
    
    for(int i = 0; i < N; i++)
    {
        pair<int,int> cost;

        cin>>cost.first>>cost.second;
        if(cost.second<=limit){
            route.emplace_back(cost);
        }

    }

    sort(route.begin(),route.end());
    if(route.empty()){
        cout<<"TLE"<<endl;
        return 0;
    }

    cout<<route[0].first<<endl;
    

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
const int INF = 1e9;

int H,W;
string s[55] = {string(55,'.')};
string tmp;

int main(){
    cin >> H >> W;
    for(int i = 1; i <= H; ++i){
        cin >> tmp;
        s[i] = '.' + tmp + '.';
    }

    REP(i,H){
        REP(j,W){
            if(s[i][j]=='#'){
                if(s[i-1][j]=='.' && s[i+1][j]=='.' && s[i][j-1]=='.' && s[i][j+1]=='.'){
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int a[3][3];rep(i,3)rep(j,3)cin>>a[i][j];
    int n;cin>>n;
    rep(i,n){
        int tmp;cin>>tmp;
        rep(j,3)rep(k,3)if(a[j][k]==tmp)a[j][k]=0;
    }
    ll flag = (a[0][0]+a[0][1]+a[0][2])*(a[1][0]+a[1][1]+a[1][2])*(a[2][0]+a[2][1]+a[2][2])*(a[0][0]+a[1][0]+a[2][0])*(a[0][1]+a[1][1]+a[2][1])*(a[0][2]+a[1][2]+a[2][2])*(a[0][0]+a[1][1]+a[2][2])*(a[0][2]+a[1][1]+a[0][2]);
    if(flag==0)co("Yes");else co("No");
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var l = [4]float64{0.25, 0.5, 1, 2}
	p := make([]int, 4)
	fmt.Scan(&p[0], &p[1], &p[2], &p[3])
	var N float64
	fmt.Scan(&N)
	cnt := make([]int, 4)
	for i := 3; i >= 0; i-- {
		cnt[i] = int(N / l[i])
		N -= float64(cnt[i]) * l[i]
	}

	for i := 3; i > 0; i-- {
		for j := i - 1; j >= 0; j-- {
			if float64(p[i])/l[i] > float64(p[j])/l[j] {
				cnt[j] += (cnt[i] * int(l[i]/l[j]))
				cnt[i] = 0
			}
		}
	}
	fmt.Println(cnt[0]*p[0] + cnt[1]*p[1] + cnt[2]*p[2] + cnt[3]*p[3])
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 512
import math
A,B,H,M = map(int,input().split())
theta = math.radians(min(abs((H*60+M)*0.5 - M*6),360-abs((H*60+M)*0.5 - M*6)))
print(math.sqrt((B-A*math.cos(theta))**2 + (A**2) * math.sin(theta)**2))

Measured memory_bytes: 9568
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author AnandOza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CAllGreen solver = new CAllGreen();
        solver.solve(1, in, out);
        out.close();
    }

    static class CAllGreen {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int d = in.nextInt(), g = in.nextInt() / 100;
            int[] p = new int[d];
            int[] c = new int[d];
            for (int i = 0; i < d; i++) {
                p[i] = in.nextInt();
                c[i] = in.nextInt() / 100;
            }

            int answer = Integer.MAX_VALUE;
            for (int s = 0; s < (1 << (d + 1)); s++) {
                int problems = 0;
                int points = 0;
                for (int i = 0; i < d; i++) {
                    if (((s >> i) & 1) > 0) {
                        problems += p[i];
                        points += p[i] * (i + 1);
                        points += c[i];
                    }
                }
                if (points >= g) {
                    //System.out.println(points + "\t" + problems);
                    answer = Math.min(answer, problems);
                    continue;
                }
                for (int i = d - 1; i >= 0; i--) {
                    if (((s >> i) & 1) == 0) {
                        if (p[i] * (i + 1) + points >= g) {
                            problems += (g - points + i) / (i + 1);
                            answer = Math.min(answer, problems);
                            break;
                        }
                        problems += p[i];
                        points += p[i] * i;
                    }
                }
            }

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 32900
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 101
void initialize(void);
int isEmpty(void);
int isFull(void);
void push(int);
int pop(void);

int top;
int S[MAX];
int main(){
  int x,i,j;
  char s[100];
  initialize();
  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      i = pop();
      j = pop();
      push(i+j);
    } else if ( s[0] == '-' ){
      i = pop();
      j = pop();
      push(j-i);
    } else if ( s[0] == '*' ){
      i = pop();
      j = pop();
      push(i*j);
    } else {
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",S[top]);
  return 0;
}
void initialize(void){
  top = 0;
}

int isEmpty(void){
  if(top==0)
  return 1;

  return 0;
}
int isFull(void){
  if(top >= MAX - 1)
    return 1;

  return 0;
}
void push(int x){
  if (isFull()==1){
    printf("error(overflow)");
  }else{
  top++;
  S[top] = x;
  }
}
int pop(void){
  if(isEmpty()==1){
    printf("error(underflow)");
  }else{
    top--;
    return S[top+1];
  }
}

Measured memory_bytes: 548
#pragma GCC optimize("Ofast")

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

using namespace std;
using namespace __gnu_pbds;

typedef
tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define relaxMax(a, b) a = max(a, b)
#define relaxMin(a, b) a = min(a, b)

typedef long long ll;
typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("amusing.in", "r", stdin);
    //freopen("amusing.out", "w", stdout);
}

void solve() {
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    if (v <= w){
        cout << "NO\n";
        return;
    }
    ll dx = abs(a - b);
    ll dv = v - w;
    cout << (dv * t >= dx ? "YES" : "NO") << '\n';
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

Measured memory_bytes: 3664
#include"bits/stdc++.h"
using namespace std;
int main(){
  int n;
    cin >> n;
  vector<int> s(n);
  for(int i = 0; i < n; i++){
    cin >> s.at(i);}
  double sum = 0.0;
  for(int i = 0; i < n; i++){
    sum+=1.0/s.at(i);}
  cout << 1.0/sum << endl;}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		
		if(a > b){
			System.out.println("a > b");
		}
		if(a < b){
			System.out.println("a < b");
		}
		if(a == b){
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 26316
#include <stdio.h>
int main(){
    int a,b,c,i,counter=0;
    scanf("%d %d %d",&a,&b,&c);
    
    for(i=a;i<=b;i++) {
    if(c%i==0) counter++;
    }
    
    printf("%d\n",counter);

    return 0;
    
}

Measured memory_bytes: 596
#include<stdio.h>
using namespace std;

int a[105];

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    int x=0;
    int m;
    for(int i=0;i<n;i++)
    {
        int minv=1005;
        for(int g=i+1;g<n;g++)
        {
            if(a[g]<minv)
            {
                minv=a[g];
                m=g;
            }

        }
        if(a[m]<a[i])
            {
                int t=a[m];
            a[m]=a[i];
            a[i]=t;
            x++;
    }
}
    for(int i=0;i<n;i++)
        if(i!=n-1)
            printf("%d ",a[i]);
        else
            printf("%d\n",a[i]);
    printf("%d\n",x);
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

int main() {
    int a,b;
    cin >> a >> b;
    cout << (((a*b)%2 == 1)?"Yes":"No") << endl;
}

Measured memory_bytes: 256
import math
a,b,c = map(float,input().split())

n = math.radians(c)

d = (a**2+b**2-2*b*a*math.cos(n))**0.5
h = b*math.sin(n)
l = a+b+d
s = a*h/2
print(s)
print(l)
print(h)


Measured memory_bytes: 5696
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((int)(x).size())

using namespace std;
typedef long long ll;

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
  map<char, int> m;
  REP(i, 4) {
    m[S[i]] += 1;
  }

  if (m.size() == 2) {
    for (auto i : m) {
      if (i.second != 2) {
        printf("No\n");
        return;
      }
    }
    printf("Yes\n");
  } else {
    printf("No\n");
  }
}

int main(){
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

typedef struct {
	int end[2], color;
} edge;

typedef struct List {
	struct List *next;
	edge *f;
} list;

int main()
{
	int i, N, a[100001], b[100001];
	scanf("%d", &N);
	for (i = 1; i <= N - 1; i++) scanf("%d %d", &(a[i]), &(b[i]));
	
	edge e[100001];
	list *inc[100001] = {}, l[200001];
	for (i = 1; i <= N - 1; i++) {
		e[i].end[0] = a[i];
		e[i].end[1] = b[i];
		e[i].color = -1;
		l[(i-1)*2].f = &(e[i]);
		l[(i-1)*2+1].f = &(e[i]);
		l[(i-1)*2].next = inc[a[i]];
		l[(i-1)*2+1].next = inc[b[i]];
		inc[a[i]] = &(l[(i-1)*2]);
		inc[b[i]] = &(l[(i-1)*2+1]);
	}
	
	int k, K = 0, flag[100001] = {0, -1}, q[100001] = {1}, head, tail;
	list *p;
	for (head = 0, tail = 1; head < tail; head++) {
		k = (flag[q[head]] == 1)? 2: 1;
		for (p = inc[q[head]]; p != NULL; p = p->next) {
			i = (p->f->end[0] == q[head])? p->f->end[1]: p->f->end[0];
			if (flag[i] == 0) {
				if (k == flag[q[head]]) k++;
				flag[i] = k;
				p->f->color = k++;
				q[tail++] = i;
			}
		}
		if (k - 1 > K) K = k - 1;
	}
	
	printf("%d\n", K);
	for (i = 1; i <= N - 1; i++) printf("%d\n", e[i].color);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 7040
import Control.Monad
import qualified Data.ByteString.Char8 as C
import Data.List
import Data.Ord

main = C.interact $ put . sol . get

get = fmap (unfoldr (C.readInt . C.dropWhile (==' '))) . C.lines

put = C.pack . show

sol ([_,w]:wvs) = maximum $ do 
  (w0,v0) <- f (bnd+0) wvs
  (w1,v1) <- f (bnd+1) wvs
  (w2,v2) <- f (bnd+2) wvs
  (w3,v3) <- f (bnd+3) wvs
  guard (w0+w1+w2+w3<=w)
  return (v0+v1+v2+v3)
  where
  bnd = head $ wvs!!0

f x = zip (iterate (+x) 0) . scanl (+) 0 . sortBy (flip compare) . fmap last . filter ((==x) . head)

Measured memory_bytes: 2428
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

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

const ll MOD = 1E+09 + 7;
const ll INF = 1E18;
const int MAX_N = 1E+05;

ll X, Y;

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

    cin >> X >> Y;

    if (abs(X - Y) <= 1) {
        cout << "Brown\n";
    } else {
        cout << "Alice\n";
    }

    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <random>
#include <complex>
#include <assert.h>

using namespace std;
typedef long long ll;
#define endl '\n'

const ll mod = 1000000007LL;
constexpr int v[] = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098 };

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

	int T; cin >> T;
	for (int _t = 0; _t < T; _t++) {
		ll N; cin >> N;
		ll ans = 869418286;
		if (N & 1) {// odd
			for (int i = 14, j = 29; i >= 0; i--, j--) {
				ans = (ans * N + v[j]) % mod;
			}
		}
		else {// even
			for (int i = 14; i >= 0; i--) {
				ans = (ans * N + v[i]) % mod;
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3200
w = int(input())
n = int(input())
a = [[int(i) for i in input().split(",")] for j in range(n)]
b = [0 for i in range(w)]
for i in range(1, w+1):
    next_num = i
    for j in a:
        if next_num == j[0]:
            next_num = j[1]
        elif next_num == j[1]:
            next_num = j[0]
    b[next_num - 1] = i
for i in range(w):
    print(b[i])

Measured memory_bytes: 7688
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define V 100001
int dp[2][V];
pair<int,int>data[101];//weight value
int dp_f(int n,int w){
	int total=0;
	for(int i=1;i<=n;i++)total+=data[i].second;
	for(int i=1;i<=V;i++)dp[0][i]=1e9+1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=total;j++){
			if(j<data[i].second){
				dp[i%2][j]=dp[(i+1)%2][j];
				continue;
			}
			dp[i%2][j]=min(dp[(i+1)%2][j-data[i].second]+data[i].first,dp[(i+1)%2][j]);
		}
	}
	int ans=0;
	for(int i=1;i<=total;i++){
		if(dp[n%2][i]<=w)ans=max(ans,i);
	}
	return ans;
}
main(){
	int n,w;
	cin>>n>>w;
	for(int i=1;i<=n;i++)cin>>data[i].first>>data[i].second;
	cout<<dp_f(n,w)<<"\n";
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<map>
#include<algorithm>
#define maxn 20
#define ll long long
#define mod 1000000007
using namespace std;
int n,m,q,x,y,cnt=0,tim=0;
int node[maxn<<1],lid[maxn<<1],rid[maxn<<1];
ll ans,val[maxn<<1],dlt[1<<maxn],f[10][1<<maxn];
map<int,int>fa,id;
int find(int x){
	return fa.count(x)?fa[x]=find(fa[x]):x;
}
ll ksm(ll x,ll i){
	ll res=1;
	for(;i;i>>=1,x=x*x%mod)
		if(i&1)res=res*x%mod;
	return res;
}
int main(){
	scanf("%d%d",&n,&q);
	for(register int i=1;i<=q;i++){
		scanf("%d%d",&x,&y);
		if(x>y)swap(x,y);
		x--;
		node[++cnt]=x;
		node[++cnt]=y;
		int fx=find(x),fy=find(y);
		if(fx>fy)swap(fx,fy);
		if(fx!=fy)fa[fy]=fx;
	}
	node[++cnt]=0;
	sort(node+1,node+cnt+1);
	cnt=unique(node+1,node+cnt+1)-node-1;
	ans=1;
	for(register int i=1,lst=0;i<=cnt;lst=node[i],i++){
		int now=node[i];
		id[now]=fa.count(now)?id[find(now)]:tim++;
		lid[i]=id[lst];
		rid[i]=id[now];
		if(!now){
			ans=ans*ksm(9,mod-2)%mod;
			val[i]=1;
		}
		else{
			ll res=(ksm(10,now-lst)-1)*ksm(9,mod-2)%mod;
			//cout<<"res="<<res<<endl;
			ans=ans*res%mod;
			val[i]=(res+1)*ksm(res,mod-2)%mod;
		}
		//cout<<i<<" lid="<<lid[i]<<" rid="<<rid[i]<<" val="<<val[i]<<endl;
	}
	//cout<<"tim="<<tim<<endl;
	if(node[cnt]<n)ans=ans*ksm(10,n-node[cnt])%mod;
	m=(1<<tim);
	for(register int i=0;i<m;i++){
		dlt[i]=1;
		for(register int j=2;j<=cnt;j++){
			//cout<<i<<" l="<<lid[j]<<" r="<<rid[j]<<endl;
			if(((i>>lid[j])&1)&&((i>>rid[j])&1))dlt[i]=dlt[i]*val[j]%mod;
		}
		f[0][i]=dlt[i];
	}
	for(register int i=0;i<8;i++){
		for(register int j=0;j<m;j++){
			for(register int k=j;k<m;k=(k+1)|j){
				f[i+1][k]=(f[i+1][k]+f[i][j]*dlt[j^k]%mod)%mod;
			}
		}
	}
	/*for(register int i=0;i<9;i++){
		for(register int j=0;j<m;j++){
			cout<<"f["<<i<<"]["<<j<<"]="<<f[i][j]<<endl;
		}
	}
	cout<<ans<<" "<<f[8][m-1]<<endl;*/
	printf("%lld",ans*f[8][m-1]%mod);
	return 0;
}

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

typedef pair<int, int> pii;

int N, M;
vector<int> arr;

struct BIT {
    vector<pii> tree;
    void init() {
        tree = vector<pii>(4*M, pii(0, 0));
    }
    void upd(int idx, pii val, int l, int r, int n) {
        if(idx < l || r < idx) return;
        if(l == r) {
            tree[n] = val;
            return;
        }
        int m = (l + r)>>1;
        upd(idx, val, l, m, 2*n);
        upd(idx, val, m + 1, r, 2*n + 1);
        tree[n] = min(tree[2*n], tree[2*n + 1]);
    }
    pii quer(int a, int b, int l, int r, int n) {
        if(b < l || r < a) return pii(1e9, 1e9);
        if(a <= l && r <= b) return tree[n];
        int m = (l + r)>>1;
        pii L = quer(a, b, l, m, 2*n);
        pii R = quer(a, b, m + 1, r, 2*n + 1);
        return min(L, R);
    }
} odd, even;

struct seg {
    int l, r;
    pii x;
    bool operator <(const seg &i) const {
        return arr[x.first] > arr[i.x.first] || (arr[x.first] == arr[i.x.first] && arr[x.second] > arr[i.x.second]);
    }
};
priority_queue<seg> pq;

pii solve(int l, int r) {
    if(l & 1) {
        pii t = odd.quer(l/2, (r - 1)/2, 0, M - 1, 1);
        pii d = even.quer((t.second + 1)/2, r/2, 0, M - 1, 1);
        return pii(t.second, d.second);
    }
    else {
        pii t = even.quer(l/2, r/2, 0, M - 1, 1);
        pii d = odd.quer((t.second + 1)/2, (r - 1)/2, 0, M - 1, 1);
        return pii(t.second, d.second);
    }
}

vector<int> ans;

int main() {
    scanf("%d", &N);
    arr.resize(N);
    for(int i = 0; i < N; i++) {
        scanf("%d", &arr[i]);
    }
    M = N/2;
    odd.init();
    even.init();
    for(int i = 0; i < M; i++) {
        odd.upd(i, pii(arr[2*i + 1], 2*i + 1), 0, M - 1, 1);
        even.upd(i, pii(arr[2*i], 2*i), 0, M - 1, 1);
    }

    pq.push({ 0, N - 1, solve(0, N - 1) });
    while(!pq.empty()) {
        seg t = pq.top(); pq.pop();

        ans.push_back(arr[t.x.first]);
        ans.push_back(arr[t.x.second]);

        if(t.l < t.x.first) pq.push({ t.l, t.x.first - 1, solve(t.l, t.x.first - 1) });
        if(t.x.first + 1 < t.x.second) pq.push({ t.x.first + 1, t.x.second - 1, solve(t.x.first + 1, t.x.second - 1) });
        if(t.x.second < t.r) pq.push({ t.x.second + 1, t.r, solve(t.x.second + 1, t.r) });
    }
//*
    for(int i = 0; i < ans.size(); i++) {
        printf("%d ", ans[i]);
    }
//*/
}


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

int main() {
    int n,a,b;
    cin >> n >> a >> b;
    cout << min(n*a,b) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector<int> gr[N];
int slt, cnt[5], mark[N];
long long ans;
bool z;
void dfs(int v, int rang = 1) {
	mark[v] = rang;
	for (auto u : gr[v]) {
		if (!mark[u])
			dfs(u, 3 - rang);
		else {
			if (mark[u] == mark[v])
				z = true;
		}
	}	
}
int main() {
	int n, m;
	cin >> n >> m;
	slt = n;
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		x--, y--;
		gr[x].push_back(y);
		gr[y].push_back(x);
	}
	for (int i = 0; i < n; i++) {
		z = false;
		if (!mark[i]) {
			if (gr[i].size() > 0) {
				dfs(i);
				if (z == true)
					cnt[0]++;
				else
					cnt[1]++;
			}
			else {
				slt--;
			}
		}
	}
	ans = 1ll * n * n - 1ll * slt * slt + cnt[0] + 2 * cnt[1] + 1ll * cnt[0] * (cnt[0] - 1) + 1ll * 2 * cnt[1] * cnt[0] + 1ll * 2 * cnt[1] * (cnt[1] - 1);
	cout << ans;
	return 0;
}


Measured memory_bytes: 9984
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	string S;
	int len;
	bool ans = false;

	cin >> S;
	len = S.length();

	rep(i, len - 1) {
		if (S.substr(i, 2) == "AC") ans = true;
	}

	cout << (ans ? "Yes" : "No") << endl;

	return 0;
}


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

long long a,b,c,t;

long long read(){
	long long x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}
 
int main(){
	a=read();b=read();
	if (a==b) {printf("1\n");return 0;};
	for (t=60;(a&(1ll<<t))==(b&(1ll<<t));t--);
	c=1ll<<t;a&=2*c-1;b&=2*c-1;
	for (t--;t>=0&&(b&(1ll<<t))==0;t--);
	b|=(1ll<<(t+1))-1;
	printf("%lld\n",b-a+1+2*c-max(c+a,b+1));
	return 0;
}

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


int main() {
    long long n;
    cin >> n;
    string s[n];
    long long i;
    map<string,int> mp;
    bool ok = true;
    for(i=0;i<n;i++)
    {
        cin >> s[i];
        if(mp.find(s[i]) != mp.end())
        {
            ok = false;
            break;
        }
        if(i == 0)
            mp[s[i]]++;
        else
        {
            if(s[i][0] != s[i-1][s[i-1].length()-1])
            {
                ok = false;
                break;
            }
            mp[s[i]]++;
            
        }
    }
    cout <<(ok ? "Yes": "No");
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 500020;
const double pi = acos(-1); const double EPS = 1e-8;
const ll INF = 1e12;

vector<int>primes;
bool is_prime(int x) {
	for (auto y : primes) {
		if (y*y > x)break;
		if (x%y == 0)return false;
	}
	return true;
}
void init() {
	for (int i = 7; i <= 300000; i += 7) {
		int x = i - 1;
		if (is_prime(x))primes.push_back(x);
		x = i + 1;
		if (is_prime(x))primes.push_back(x);
	}
}
void solve() {
	int N; cin >> N;
	if (N == 1)exit(0);
	set<int>ans;
	cout << N << ": ";
	int M = primes.size();
	REP(i, M) {
		int p = primes[i];
		if (p > N)break;
		if (N%p == 0)ans.insert(p);
	}
	//if (N != 1)ans.insert(N);
	vector<int>v;
	for (auto x : ans)v.push_back(x);
	print_space(v);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	init();
	while(true)
	solve();
}




Measured memory_bytes: 3308
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  scanf("%d",&n);
  int w[n];
  REP(i,n) scanf("%d",&w[i]);
  int ans = 1e9;
  FOR(i, 1, n){
    int sum1 = 0;
    int sum2 = 0;
    FOR(j, 0, i) sum1 += w[j];
    FOR(j, i, n) sum2 += w[j];
    ans = min(ans, abs(sum1 - sum2));
  }
  cout  << ans << endl;
  
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    // 
    static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intの最大値 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ary = new int[n];
        for(int i = 0;i < n;i++){
            int tmp = sc.nextInt();
            if(tmp%2==0){
                if(!(tmp%3==0||tmp%5==0)){
                    System.out.println("DENIED");
              		return;
                }
            }
        }
        System.out.println("APPROVED");

    }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define int long long
using namespace std;
//string sort (s.begin(),s.end());

main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,k;
	cin>>n>>k;
	int a[n+10];
	for(int i=0;i<n;i++)
    {
        cin>>a[i];

    }
    int f=0;
    int idx;
    for(int i=0;i<n-1;i++)
    {

        if(a[i]+a[i+1]>=k)
        {
            f=1;
            idx=i+1;
            break;
        }

    }
    if(f==0)
    {
         cout<<"Impossible"<<endl;
    }
    else
    {
        cout<<"Possible"<<endl;
        for(int i=1;i<idx;i++)
        {
            cout<<i<<endl;
        }
        for(int i=n-1;i>=idx;i--)
        {
            cout<<i<<endl;
        }

    }



}




Measured memory_bytes: 4440
import math
N, D = map(int, input().split())
X = []
ans = 0
for i in range(N):
	x = list(map(int, input().split()))
	X.append(x)
	for j in range(i):
		l = 0
		for k in range(D):
			l += (X[j][k] - x[k]) ** 2
		if int(math.sqrt(l)) ** 2 == l:
			ans += 1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,mod=1000000007,pas,i,j,fct[200009];
long long xar(long long q, long long w){
    if(w==0) return 1;
    long long qw=xar(q,w/2);
    if(w%2==0) return (qw*qw)%mod; else return (((qw*qw)%mod)*q)%mod;
}
long long di(long long q, long long w){
    long long qw=q*xar(w,mod-2);
    return qw%mod;
}
long long C(long long q, long long w){
    long long qw=fct[q],we=fct[w]*fct[q-w];
    we%=mod;
    return di(qw,we);
}
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a>>b;
    fct[0]=1;
    for(i=1; i<=200002; i++){
        fct[i]=fct[i-1]*i;fct[i]%=mod;
    }
    if(b>=a-1){
        d=a-1;
    }else{
        d=b;
    }
    for(c=0; c<=d; c++){
        j=a;i=a-c;
        pas+=C(j-1,i-1)*C(a,c);
        pas%=mod;
    }
    cout<<pas;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);
typedef pair<int,int> P;
const int INF = 1001001001;


int main() {
  int x, y;
  cin >> x >> y;
  for(int i = 0; i <= x; ++i){
    if(2*i+4*(x-i)==y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
#pragma once
#include <stdio.h>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

ll memo[100010];
int a[100010];
int n, m;

ll calc(int x) {
	if (a[x] == 1) return 0;
	if (x > n) return 0;
	if (x == n) return 1;
	ll& res = memo[x];
	if (~res) return res;
	res = 0;
	res += calc(x + 1);
	res %= INF;
	res += calc(x + 2);
	res %= INF;
	return res;
}

void solv() {
	
	cin >> n >> m;
	memset(memo, -1, sizeof(memo));
	for (size_t i = 0; i < m; i++)
	{
		int b;
		cin >> b;
		a[b] = 1;
	}

	cout << calc(0) << endl;
}

int main() {
	//COMinit();
	solv();

	return 0;
}
 

Measured memory_bytes: 4480