akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int x,y,i,n,c;
vector <int> a(100010);
cin >> n;
x = 10000000;
y = 0;
for(i=0;i<n;i++){
cin >> a[i];
x = min(x,a[i]);
y = max(y,a[i]);
}
for(i=0;i<n;i++){
    if((y-x)>1){
        cout << "No" << endl;
        return 0;
    }
}
c = 0;
for(i=0;i<n;i++){
    if(a[i]==x){
        c++;
    }
}
if(y>x){
if(x>=c && (n+c)>=2*(x+1)){
    cout << "Yes" << endl;
}else{
    cout << "No" << endl;
}
}else{
    if(n-2*y>=0 || y==(n-1)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}
}


Measured memory_bytes: 768
#include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main(){
    LL a;
    LL b;
    LL ans=0;
    vector<LL> num(5);
    cin >> a >> b;
    for(LL i=a; i<=b; i++){
        LL tmp=i;
        for(LL j=0; j<5; j++){
            num[j]=tmp%10;
            tmp/=10;
        }
        if(num[0]==num[4] && num[1]==num[3]){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3600
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int a = sc.nextInt();
    if(x < a){
      System.out.println("0");
    }else{
      System.out.println("10");
    }
  }
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
#include <iostream>
#define ll long long
#define mem(f, x) memset(f, x, sizeof(f))
#define INF 0x3f3f3f3f
using namespace std;
const int M = 15;
const int N = 10005;
int n;
char s[N];
int main( ){
    while( scanf( "%d", &n ) != EOF ){
        cin >> s;
        int len = strlen( s );
        if( len <= n )
            cout << s << endl;
        else{
            for( int i = 0; i < n; i++ )
                cout << s[i];
            cout << "...\n";
        }
    }
    return 0;
}


Measured memory_bytes: 3768
import sys
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [sys.maxsize] * n
dp[0] = 0

for i in range(n):
    for j in range(i+1, i+k+1):
        if j < n:
            dp[j] = min(dp[j], dp[i]+abs(h[i]-h[j]))
            
print(dp[-1])

Measured memory_bytes: 52448
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i+1] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};

int main(){
  int n; string s; cin >> n >> s;
  int ans = 0;
  rep(i,n-2) {
    string t = s.substr(i,3);
    if(t == "ABC") ans++;
  }

  cout << ans << endl;
}

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


using namespace std;



const int MAXN = 100 * 1000 + 123;



int a[MAXN], b[MAXN], jav[MAXN];
string s;


int main() {
	cin >> s;
	{
		int tmp;
		for (int i = 0; i < s.size(); i++)
			if (s[i] == 'R')
				tmp = i;
			else
				a[i] = tmp;
		for (int i = 1; i <= s.size(); i++)
			if (s[s.size() - i] == 'L')
				tmp = s.size() - i;
			else
				b[s.size() - i] = tmp;
	}
	for (int i = 0; i < s.size(); i++)
		if (s[i] == 'R')
			jav[b[i] - ((b[i] - i) & 1)]++;
		else
			jav[a[i] + ((i - a[i]) & 1)]++;
	for (int i = 0; i < s.size(); i++)
		cout << jav[i] << ' ';
	return 0;
}

Measured memory_bytes: 1792
import sys
input = sys.stdin.buffer.readline

def f(g: list, deg: list):
	l = len(g)
	depth = [0] * l
	ret = []
	q = []
	for i, d in enumerate(deg):
		if not d:
			ret.append(i)
			q.append(i)
	while q:
		cur = q.pop(0)
		for nxt in g[cur]:
			deg[nxt] -= 1
			if not deg[nxt]:
				depth[nxt] = depth[cur] + 1
				ret.append(nxt)
				q.append(nxt)
	if l > len(ret):
		return False
	return max(depth)

def label(a, b, n):
	if a > b:
		a, b = b, a
	return (a - 1) * (2 * n - a) // 2 + b - a - 1


def main():
	n = int(input())
	g = [[] for _ in range(n * (n - 1) // 2)]
	deg = [0] * (n * (n - 1) // 2)
	for i in range(1, n + 1):
		l = list(map(int, input().split()))
		for x, y in zip(l, l[1:]):
			t = label(i, y, n)
			g[label(i, x, n)].append(t)
			deg[t] += 1
	depth = f(g, deg)
	if not depth:
		print(-1)
		exit()
	print(depth + 1)

if __name__ == "__main__":
	main()


Measured memory_bytes: 126292
import java.util.*;
public class Main {
	static long[] visited ;
	static long[] teleport_to;
	static List<Long> histry = new ArrayList<>();
	static long last=0;
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long K = sc.nextLong();
		long ans=0;
		visited = new long[(int) (N+1)];
		teleport_to= new long[(int) (N+1)];

		for(int i=1;i<=N;i++){
			teleport_to[i]=sc.nextLong();
		}
		visited[1]=1;
		histry.add((long) 1);
		func(1);
		//関数後の処理
		//int roop_root = histry.get(histry.size()-1);
		//histry.remove(histry.size()-1);
		int length=histry.size();     //System.out.println(last);
		int from_1_to_roop = histry.indexOf(last);
		//System.out.println(from_1_to_roop);
		if ((K-from_1_to_roop)<=0){
			ans=histry.get((int) K);
			System.out.println(ans);
		}
		else{
		ans=(K-from_1_to_roop)%(length-from_1_to_roop);
		ans=histry.get((int) (from_1_to_roop+ans));
		System.out.println(ans);
		}
	}

    public static void func(int arg){
    	int from = arg;
    	int next = (int) teleport_to[from];
    	if (visited[(int) next]==1) {
    		//histry.add((int) next);
    		last=next;
    		return;

    	}
    	else{
    		histry.add((long) next);
    		visited[(int) next]=1;
    		func(next);
    	}
    }
}



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

int main( void )
{
  string S, T;
  cin >> S >> T;

  int count = 0;

  for( int i = 0; i < S.size(); i++ ) {
    if( S.at( i ) != T.at( i ) )
      count++;
  }

  cout << count << endl;
  
}

Measured memory_bytes: 3896
N,M = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))

## 0,x1,x2,x3
## S = (x1 + x2 + x3 + (x2-x1) + (x3-x1) + (x3-x2)) * ...
##.  = (3*x3 + x2 - x1 - 3* 0)
##.  = ((3-0) + (2-1) + (1-2) + (0-3)
mod = int(1e9+7)
X.sort(reverse=True)
Y.sort(reverse=True)
XP,YP = 0,0
for i in range(N):
  XP += (N-1-i*2) * X[i] 
  XP %= mod
for i in range(M):
  YP += (M-1-i*2) * Y[i] 
  YP %= mod
  
print((XP * YP)%mod)
  

Measured memory_bytes: 24344
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
struct mint{
    using ull=unsigned long long int;
    ull v;
    mint(ll vv=0){s(vv%mod+mod);}
    mint& s(ull vv){
        v=vv<mod?vv:vv-mod;
        return *this;
    }
    //オーバーロード
    mint operator-()const{return mint()-*this;}//符号反転
    mint&operator+=(const mint&val){return s(v+val.v);}
    mint&operator-=(const mint&val){return s(v+mod-val.v);}
    mint&operator*=(const mint&val){
        v=ull(v)*val.v%mod;
        return *this;
    }
    mint&operator/=(const mint&val){return *this*=val.inv();}
    mint operator+(const mint&val){return mint(*this)+=val;}
    mint operator-(const mint&val){return mint(*this)-=val;}
    mint operator*(const mint&val){return mint(*this)*=val;}
    mint operator/(const mint&val){return mint(*this)/=val;}
    mint pow(int n)const{
        mint res(1),x(*this);
        while(n){
            if(n&1)res*=x;
            x*=x;
            n>>=1;
        }
        return res;
    }
    mint inv()const{return pow(mod-2);}
    //拡張ユークリッドの互除法
    /* mint inv()const{
        int x,y;
        int g=extgcd(v,mod,x,y);
        assert(g==1);
        if(x<0)x+=mod;
        return mint(x);
    }*/
    friend ostream& operator<<(ostream&os,const mint&val){
        return os<<val.v;
    }//出力
    bool operator<(const mint&val)const{return v<val.v;}
    bool operator==(const mint&val)const{return v==val.v;}
    bool operator>(const mint&val)const{return v>val.v;}
};
const ll MAX = 2000010;//設定
mint fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void init(){
    fac[0] = fac[1] = 1;
    for(int i=1;i<MAX;i++)fac[i]=fac[i-1]*i;
    finv[MAX-1]=fac[MAX-1].inv();
    for(int i=MAX-2;i>=0;i--)finv[i]=finv[i+1]*(i+1);
    for(int i=MAX-2;i>=1;i--)inv[i]=finv[i]+fac[i-1];
}
//階乗
mint factor(ll n,ll k){
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return fac[n]*finv[k];
}
// 二項係数計算
mint 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];
}
int main(){
ll n,k;
init();
cin>>n>>k;
for(int i=1;i<=k;i++){
	cout<<COM(n-k+1,i)*COM(k-1,i-1)<<"\n";
}
}

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

int main(){
    int n, k;
    bool d[10];
    memset(d, false, sizeof(d));
    cin >> n >> k;
    for(int i=0;i<k;i++){
        int tmp;cin>>tmp;
        d[tmp]=true;
    }
    while(1){
        int tmp=n;
        bool ans=false;
        while(tmp>0){
            ans|=d[tmp%10];
            tmp/=10;
            if(ans)break;
        }
        if(!ans)break;
        n++;
    }
    cout << n << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
#include<algorithm>
#include<string.h>
#include<cmath>
#include <vector>
#include<set>
using namespace std;
int p[100005];
struct node{
    int er;
    int index;
}f[100005];
int flag[1000005]={0};
int Find(int x){return f[x].er!=x?f[x].er=Find(f[x].er):f[x].er;}
void Union(int x,int y)
{
    int fx=Find(x),fy=Find(y);
    f[fx].er=fy;
}
bool cmp(node a,node b)
{
    return (a.er<b.er);
}
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&p[i]);
        f[i].er=i;
        f[i].index=i;
    }
    for(int i=1;i<=m;i++)
    {
        int x,y;scanf("%d%d",&x,&y);
        Union(x,y);
    }
    for(int i=1;i<=n;i++)
        f[i].er=Find(i);
    sort(f+1,f+n+1,cmp);
    int l=1,r=2;
    while(1)
    {
        int qw=f[l].er;
        while(qw==f[r].er){
            r++;
            if(r>n)break;
        }
        for(int i=l;i<r;i++)
        {
            flag[f[i].index]=qw;
        }
        for(int i=l;i<r;i++)
        {
            if(flag[p[f[i].index]]==qw)sum++;
        }
        if(r>n)break;
        else l=r;
    }
    printf("%d",sum);
}


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

int main() {

    ll X, ans;
    int year;
    
    cin >> X;
    ans = 100;
    year = 0;
     
    while(true){
        
        year++;
        ans = ans + ans * 0.01;
        
        if(ans >= X){
            cout << year;
            return 0;
        }
    
    }
 
}

Measured memory_bytes: 3632
S = input()
T = input()
A = S
if S == T:
  print('Yes')
else:
  eq = False
  for i in range(len(S)):
    A = A[-1] + A[0:-1]
    if A == T:
      eq = True
      break
  if eq:
    print('Yes')
  else:
    print('No')
  


Measured memory_bytes: 2940
'use strict'

function main(input) {

    input = input.split('\n')
    const n = ~~input[0]
    const x = input[1].split(' ').map(v => ~~v) //.sort((a, b) => a - b)
    const x2 = x.slice(0).sort((a, b) => a - b)
    const mid = x2[n / 2]
    const mid2 = x2[n / 2 - 1]

    let ans = 0
    for (let i = 0; i < n; i++) {
        if (x[i] < mid) ans = mid
        else ans = mid2
        console.log(ans)
    }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;

int main()
{
    int a, b, c, i, ans;
    cin >> a >> b >> c;
    i = a;
    ans = 0;

    while (i <= b)
    {
        if (c % i == 0)
        {
            ans++;
        }
        i++;
    }
    cout << ans << endl;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (ll NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (ll NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (ll NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll INF =1000000000000000;

ll nyanya(string t){
  ll ans =0LL;
  //basecace
  if(t.size() == 0)return 0LL;
  
  else if(t.size() == 1)return stoll(t);
  
  else{
    ans+=stoll(t);
    FOR(i,1,t.size()){
      ans+=stoll(t.substr(0,i))*(pow(2,t.size()-i-1))+nyanya(t.substr(i,t.size()-i));
    }
    return ans;
  }
}

int main(){
  string s;cin >> s;
  cout << nyanya(s) << endl;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>

int main(){
    string s; cin>>s;
    map<char,int> mp;
    for(char c:s){
        ++mp[c];
    }
    int num[3];
    num[0] = mp['a'];
    num[1] = mp['b'];
    num[2] = mp['c'];
    sort(num,num+3);
    int a = num[2];
    int b = num[1];
    int c = num[0];
    
    bool ok = ( (a-b<=1) && (a-c<=1) );
    
    cout << (ok?LINY:LINN);
    
}

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

int main() {

    int N;
    cin >> N;

    int A[N+N];
    for (int i = 2; i <= N; i++) {
       cin >> A[i];
    }

    int ans[N+N];    
    for (int i = 1; i <= N; i++) {
        ans[i]=0;
    }
    for (int i = 2; i <= N; i++) {
        ans[A[i]]++;
    }

    for (int i = 1; i <= N; i++) {
        cout << ans[i] << endl;
    }

    return 0;
}


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

int main() {
  int n;
  cin>>n;
  int64_t sum = 0;
  int times[100001];
  for(int i=0; i<100001; i++) times[i]=0;
  int64_t a[n];
  for(int i=0; i<n; i++) {
    cin>>a[i];
    sum+=a[i];
    times[a[i]]++;
  }
  int q;
  cin>>q;
  int bc[q][2];
  for(int i=0; i<q; i++) {
    cin>>bc[i][0]>>bc[i][1];
  }

  for(int i=0; i<q; i++) {
    int64_t b = bc[i][0];
    int64_t c = bc[i][1];
    int64_t ans = sum - b*times[b] + c*times[b];
    sum = ans;
    times[c] += times[b];
    times[b] = 0;
    cout<<ans<<endl;
  }
  


  return 0;
}

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

long gcd(long a, long b){
    if(a < b){
        long temp = b;
        b = a;
        a = temp;
    }
    long c = a%b;
    if(c==0){
        return b;
    }
    else{
        return gcd(c,b);
    }
}
long lcm(long a, long b){
    return a*b/gcd(a,b);
}

int main(){
    long a,b;
    long c,d;
    cin >> a; 
    cin >> b;
    cin >> c;
    cin >> d;

    long e =lcm(c,d);
    a-=1;
    cout << b - b/c -b/d +b/e - a + a/c +a/d - a/e << endl;
    
    return 0;
}

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

using namespace std;

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

int main(){
  int n;
  cin >> n;
  int c = 1;
  int r = 0;
  REP(i, n){
    int x;
    cin >> x;
    if(x != c){
      ++r;
    }else{
      ++c;
    }
  }
  if(r == n) r = -1;
  cout << r << endl;
  return 0;
}

Measured memory_bytes: 256
n, k = gets.chomp.split.map(&:to_i)
h = []
n.times do |i|
  h[i] = gets.chomp.to_i
end

h.sort!.reverse!

hh = []
(n-k+1).times do |i|
  hh.push(h[i] - h[i+k-1])
end
p hh.sort.first


Measured memory_bytes: 5040
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int maxn=100001;
int stoio(std::string str){
    int ret;
    stringstream ss;
    ss << str;
    ss >> ret;
return ret;
}
int main(){
  string s,t;
  cin>>s;
  cin>>t;
  int ts=t.size();
  for(int i=s.size()-1;i!=-1;i--){
    if(i-ts+1<0) continue;
    bool flag=true;
    for(int j=i-ts+1;j<=i;j++){
      if(s[j]!='?' and s[j]!=t[j-(i-ts+1)]){
        flag=false;
        break;
      }
          
    }
    if(flag){
      for(int j=i-ts+1;j<=i;j++){
        s[j]=t[j-(i-ts+1)];
      }
      for(int j=0;j<=s.size();j++){
        if(s[j]=='?') s[j]='a';
      }
      cout<<s<<endl;
      return 0;
    }  
    
  }
  cout<<"UNRESTORABLE"<<endl;
  return 0;
}


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

using namespace std;

#define fo(i,n) for(int i=0; i<n; i++)
#define Fo(i,k,n) for(int i=k; i<n; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it=a.begin(); it!=a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

string s,t;
vector<char> ans;
int ls,lt;

vector<vector<pair<int, pair<int, int>>>> dp;

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

    cin>>s>>t;
    ls = s.length();
    lt = t.length();
    dp.resize(ls+1, vector<pair<int, pair<int, int>>>(lt+1, make_pair(0, make_pair(0, 0))));
    Fo(i,1,ls+1){
        Fo(j,1,lt+1){
            if(s[i-1]==t[j-1]){
                // if(((1+dp[i-1][j-1].first) > dp[i-1][j].first) && ((1+dp[i-1][j-1].first) > dp[i][j-1].first)){
                //     cout<<i<<" "<<j<<" "<<dp[i-1][j-1].first<<" "<<dp[i][j-1].first<<" "<<dp[i-1][j].first<<endl;
                // }
                dp[i][j] = max({make_pair(1+dp[i-1][j-1].first, make_pair(i-1, j-1)), make_pair(dp[i-1][j].first, make_pair(i-1, j)), make_pair(dp[i][j-1].first, make_pair(i, j-1))});
                // cout<<dp[i][j].first<<" "<<dp[i][j].second.first<<" "<<dp[i][j].second.second<<endl;
            }else{
                dp[i][j] = max(make_pair(dp[i-1][j].first, make_pair(i-1, j)), make_pair(dp[i][j-1].first, make_pair(i, j-1)));
            }
        }
    }
    // cout<<dp[0][0].first<<" "<<dp[1][1].first<<endl;
    auto nans = make_pair(0, make_pair(0,0));
    Fo(i,1,ls+1){
        Fo(j,1,lt+1){
            if(dp[i][j].first > nans.first){
                nans = dp[i][j];
            }
        }
    }
    // cout<<nans.first<<" "<<nans.second.first<<" "<<nans.second.second<<endl;
    auto curr = nans.second, previous = nans.second;
    if(nans.first!=0){
        ans.push_back(s[curr.first]);
    }
    while(curr != make_pair(0, 0)){
        int l = curr.first, r = curr.second;
        if(l+1 == previous.first && r+1 == previous.second){
            ans.push_back(s[l]);
        }
        previous = curr;
        curr = dp[l][r].second;
    }
    if(curr.first+1 == previous.first && curr.second+1 == previous.second){
        ans.push_back(s[curr.first]);
    }
    for(auto it=ans.rbegin(); it!=ans.rend(); it++){
        cout<<*it;
    }
    cout<<endl;
    
    return 0;
}

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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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; }

int k, a, b;
int main() {
    cin >> k >> a >> b;
    int check = k;
    for(int i = a; i <= b; ++i) {
        if(i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>

using namespace std;

struct Data {
  string str;
  int p;
  int num;
  bool operator<(Data& d) const {
    return str < d.str || (str == d.str && p > d.p);
  }
};

int main() {
  int n;
  Data p[100];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i].str >> p[i].p;
    p[i].num = i+1;
  }
  sort(p, p+n);
  for (int i = 0; i < n; i++) {
    cout << p[i].num << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import numpy as np
l = []
for _ in range(5):
    l.append(int(input()))
l = np.array(l)
l_rem = l%10
l_rem = np.where(l_rem==0, 10, l_rem)
l = l[np.argsort(l_rem)]
j = 0
for i in reversed(l[1:]):
    tmp = i//10
    if i%10 != 0:
        tmp += 1
    j += tmp
print(10*j+l[0])

Measured memory_bytes: 12500
from sys import stdin
from collections import deque
def main():
    #入力
    readline=stdin.readline
    n,m=map(int,readline().split())
    G=[[] for _ in range(n+1)]
    for _ in range(m):
        a,b=map(int,readline().split())
        G[a].append(b)
        G[b].append(a)

    #bfs
    q=deque([tuple((1,0))])
    flags=[False]*(n+1)
    flags[1]=True
    ans=False
    while len(q)>0:
        now,d=q.popleft()
        if now==n:
            if d==2:
                ans=True
                break
        for nex in G[now]:
            if flags[nex]==False:
                flags[nex]=True
                q.append(tuple((nex,d+1)))

    print("POSSIBLE" if ans else "IMPOSSIBLE")

if __name__=="__main__":
    main()

Measured memory_bytes: 46744
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
using namespace std;

const int N = 2e5 + 10;
vector<int> G[N];
int v[N], vis[N], ans[N];
int s[N],tot;
void dfs(int u)
{
    static stack<int> st;
    if(tot==0 || s[tot] < v[u]){
        s[++tot] = v[u];
        ans[u] = tot;
        for (int e : G[u])
        {
            if (vis[e])
                continue;
            vis[e] = 1;
            dfs(e);
        }
        tot--;
    }else{
        int tmp = lower_bound(s+1,s+1+tot,v[u]) - s;
        swap(s[tmp],v[u]);
        ans[u] = tot;
        for (int e : G[u])
        {
            if (vis[e])
                continue;
            vis[e] = 1;
            dfs(e);
        }
        swap(s[tmp],v[u]);
    }
}

int main()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> v[i];
    }
    int u, v;
    for (int i = 1; i < n; ++i)
    {
        cin >> u >> v;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }
    vis[1] = 1;
    dfs(1);
    for (int i = 1; i <= n; ++i)
    {
        cout << ans[i] << '\n';
    }
    return 0;
}


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

using namespace std;

typedef long long ll;


int main(int, char**)
{
	int  n, m;
	cin >> n >> m;

	vector<int> x;
	vector<int> s;
	if (n >= m) {
		cout << 0 << endl;
		return 0;
	}
	x.resize(m);
	for (int i = 0; i < m; ++i) {
		cin >> x[i];
	}

	sort(x.begin(), x.end());
	s.resize(m-1);
	for (int i = 1; i < m; ++i) {
		s[i - 1] = x[i] - x[i -1];
           //  cerr << s[i] <<  " ";
	}

	int w = 0;
   
	sort(s.begin(), s.end());

	for (int i = 0; i < m - n; ++i) {
        // cerr << s[i] << " ";
		w += s[i];
	}
	cout << w << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>

int main(){
 int m,f,r;
 while(1){
  scanf("%d %d %d", &m, &f,&r);
  if(m==-1 && f==-1 && r==-1){break;}
  else if(m==-1 || f==-1){printf("F\n");}
  else if(m+f>=80){printf("A\n");}
  else if(65<=f+m && f+m<80){printf("B\n");}
  else if(50<=f+m && f+m<65 || r>=50){printf("C\n");}
  else if(30<=f+m && f+m<50 &&r<50){printf("D\n");}
  else if(f+m<30 && r<50){printf("F\n");}
  else{break;}
 }
 return 0;
}

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

int main(){
    size_t N;
    cin >> N;
    vector<vector<int>> v(N, vector<int>(N));
    for(auto& i : v){
        string s;
        cin >> s;
        transform(s.begin(), s.end(), i.begin(), [](auto i){return i - 97;});
    }
    size_t ans{0};
    for(size_t k = 0; k < N; ++k)ans += [&]{
        for(size_t j = 0; j < N; ++j)for(size_t i = 0; i < N; ++i)if(v[i][(j + k) % N] != v[j][(i + k) % N])return 0UL;
        return N;
    }();
    cout << ans << endl;
    return 0;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll n,m,Q;
vvll sum;
void buildSumTable(vll l, vll r){
  sum=vvll(n+1, vll(n+1));
  
  rep(i,m){
    sum[l[i]][r[i]]++;
  }
  rep(i,n){
    rep(j,n){
      sum[i+1][j+1]+=sum[i+1][j]+sum[i][j+1]-sum[i][j];
    }
  }
}

ll getSumRange(ll l, ll r){
  ll ans=sum[r][r]-sum[r][l-1]-sum[l-1][r]+sum[l-1][l-1];
  return ans;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  cin>>n>>m>>Q;
  
  vll l(m), r(m);
  rep(i,m) cin>>l[i]>>r[i];
  
  vll p(Q), q(Q);
  rep(i,Q) cin>>p[i]>>q[i];
  
  buildSumTable(l,r);
  
  rep(i,Q){
    ll ans=getSumRange(p[i],q[i]);
    cout<<ans<<endl;
  }
  
}

Measured memory_bytes: 10112
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)

#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

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

const ll mod = 1e9 + 7;
const ll IMF = 1LL << 60;
const double PI = 3.14159265358979323846;


// ****************************************CODE***************************************//






//1
int N;
ll W, weight[110], value[110];

//2
ll dp[110][100100] = {0};

int main(){
        cin >> N >> W;
        for(int i = 0; i < N; i++) cin >> weight[i] >> value[i];

        //3
        for(int i = 0; i < N; i++){
                for(int sum_w = 0; sum_w <= W; sum_w++){

                        if(sum_w - weight[i] >= 0){
                                chmax(dp[i+1][sum_w], dp[i][sum_w-weight[i]] + value[i]);
                        }

                        chmax(dp[i+1][sum_w], dp[i][sum_w]);
                }
        }

        cout << dp[N][W] << endl;
}













































Measured memory_bytes: 79360
// AOJ 2673 Do You Divide It?
// 2018.5.6 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

typedef struct { int x, y; } PP;

#define INF		 10000000
#define EPS		 1e-8
#define EQ(a,b)	 (fabs((a)-(b))<EPS)

int fcmp(double x) { if (fabs(x) < EPS) return 0; return x <= 0 ? -1 : 1; }

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

PP p[102];
double yy1[102], yy2[102];

int cmp(double *a, double *b) {	return fcmp(*a - *b); }

double calc(int i, int x)
{
	double a = ((double)(p[i+1].y - p[i].y))/(p[i+1].x - p[i].x);
	return a*(x - p[i].x) + p[i].y;
}

int main()
{
	int N, i, j, k, x, xmin, xmax;
	double s, odd, even;

	N = in();
	xmin = INF, xmax = -INF;
	for (i = 0; i < N; i++) {
		p[i].x = x = in()<<1, p[i].y = in();
		if (x < xmin) xmin = x;
		if (x > xmax) xmax = x;
	}
	p[N] = p[0];

	odd = 0, even = 0;
	for (k = 0, x = xmin; x < xmax; x++, k++) {
		j = 0;
		for (i = 0; i < N; i++) {
			if ((p[i].x <= x   && p[i+1].x <= x) ||
				(p[i].x >= x+1 && p[i+1].x >= x+1)) continue;
			yy1[j] = calc(i, x);
			yy2[j] = calc(i, x+1);
			j++;
		}
		qsort(yy1, j, sizeof(double), cmp);
		qsort(yy2, j, sizeof(double), cmp);

		s = 0;
		for (i = 0; i < j; i+=2) s +=  yy1[i+1] - yy1[i];
		for (i = 0; i < j; i+=2) s +=  yy2[i+1] - yy2[i];
		if (k & 1) odd += s;
		else      even += s;
	}
	if (odd < even) odd = even;
	printf("%.10lf\n", odd/4);
	return 0;
}



Measured memory_bytes: 2128
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 1000010;
const int MAXK = 100010;
const int MAXQ = 200010;

int n;
ll dp[MAXN][2];
vector<int> a[MAXN];

void dfs(int u, int p) {
    dp[u][0] = dp[u][1] = 1;
    FOR(i,0,SZ(a[u])-1) {
        int v = a[u][i];
        if (v == p) continue;
        dfs(v, u);
        dp[u][0] = dp[u][0] * ((dp[v][0] + dp[v][1]) % MODBASE) % MODBASE;
        dp[u][1] = dp[u][1] * dp[v][0] % MODBASE;
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    FOR(i,1,n-1) {
        int u, v;
        cin >> u >> v;
        a[u].emplace_back(v);
        a[v].emplace_back(u);
    }
    dfs(1, 0);
    cout << (dp[1][0] + dp[1][1]) % MODBASE;
    return 0;
}


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

#define fti(i, x, y) for(int i = (x), _y = (y); i <= _y; ++ i)
#define ftd(i, x, y) for(int i = (x), _y = (y); i >= _y; -- i)
#define ll long long

using namespace std;

const int N = 1e5 + 2;
int n, res;
char a[N];

void inp()
{
    scanf("%d %s", &n, a + 1);
}

void proc()
{
    fti(i, 1, n) if(a[i] != a[i - 1]) ++ res;
    printf("%d\n", res);
}

int main()
{
    inp();
    proc();
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> vec(n-1);
	for (int i = 0; i < n-1; i++) {
		cin >> vec.at(i);
	}
	vector<int> ans(n,0);
	for (int i = 0; i < n-1; i++) {
		ans.at(vec.at(i) - 1)++;
	}
	cout << ans.at(0);
	for (int i = 1; i < n; i++) {
		cout << endl << ans.at(i);
	}
}

Measured memory_bytes: 4820
import java.util.Scanner;

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


Measured memory_bytes: 26408
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

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

  vector<string> s(N);
  rep(i, N) { cin >> s[i]; }

  sort(s.begin(), s.end());
  s.erase(unique(s.begin(), s.end()), s.end());

  cout << s.size() << endl;
  return 0;
}

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

#define BLACK '.'
#define RED '#'
#define ST '@'

int w,h, ans=0;
char t[100][100];

int rec(int x, int y){
  if( x<0 || x>=h ) return 0;
  if( y<0 || y>=w ) return 0;

  if( t[x][y] == RED ) return 0;
  t[x][y] = RED;

  int dx[4] = {0,0,1,-1};
  int dy[4] = {1,-1,0,0};
  int r=1;
  for( int d=0;d<4;d++ )
     r+= rec(x+dx[d], y+dy[d]);
  return r;
}
int main(){
  while( cin>>w >> h, w){
    int si, sj;
    for( int i=0;i<h;i++ )
      for( int j=0;j<w;j++) {
	cin >> t[i][j];
	if( t[i][j] == ST ){
	  si=i; sj=j;
	}
      }
    cout << rec(si,sj) << endl;
  }
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
int x;
int main() {
    cin >> x;
    bool flg = false;
    int xs = x;
    for(int i = 0; ; ++i) {
        xs = x + i;
        int limit = sqrt(xs);
        bool flg2 = true;
        for(int i = 2; i <= limit; ++i) {
            if(xs % i == 0) {
                flg2 = false;
                break;
            }
        }
        if(flg2) flg = true;
        if(flg) break;
    }

    cout << xs << endl;
}

Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#include <functional>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi   vector<int> 
#define   co(x)  cout << x << '\n' 
#define   dbg(x)  cerr << #x << " = " << x << '\n' 
#define   bitcount(x)  (int)__builtin_popcount(x) 
#define   sz(x)  (int)x.size()
#define   all(a) a.begin(),a.end() 
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std ; 

int  dp[2005] , s ; 


int fun(int sum){ 
    if (sum <= 2){ 
        return (sum == 0) ; 
    } 
    if (dp[sum] != -1) return dp[sum];
    int s=0; 
    for (int i=3;i<=sum;i++) { 
        s += fun(sum-i); 
        s %= 1000000007 ; 
    }
    return dp[sum] = s ; 
}

inline void solve(){ 
    cin >> s ; 
    memset(dp,-1,sizeof(dp));
    cout << fun(s) << endl ; 
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3640
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8

void mainmain(){
	int n, m;
	scanf("%d%d", &n, &m);
	VV(int) G(n + 1);
	for(int i = 0; i < m; ++i){
		int a, b;
		scanf("%d%d", &a, &b);
		G[a].push_back(b);
		G[b].push_back(a);
	}
	sort(ALL(G[n]));
	bool ok = false;
	for(int u : G[1]){
		if(binary_search(ALL(G[n]), u)){
			ok = true;
			break;
		}
	}
	puts(ok ? "POSSIBLE" : "IMPOSSIBLE");
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 12016
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ok cout << "ok" << endl;
#define sp << " " <<
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


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

    int n, m;
    int a[60][60], b[60][60];
    char tmp;
    cin >> n >> m;
    rep(h, n){
        rep(w, n){
            cin >> tmp;
            if(tmp == '#') a[w][h] = 1;
            else a[w][h] = 0;
        }
    }
    rep(h, m){
        rep(w, m){
            cin >> tmp;
            if(tmp == '#') b[w][h] = 1;
            else b[w][h] = 0;
        }
    }

    bool res = false;
    function<bool(int, int)> solve = [&](int w, int h){
        rep(i, m){
            rep(j, m){
                if(a[w+j][h+i] != b[j][i]) return false;
            }
        }
        return true;
    };

    if(m > n) res = false;
    else{
        rep(h, n-m+1){
            rep(w, n-m+1){
                if(solve(w, h)){
                    res = true;
                    break;
                }
            }
        }
    }

    ans(res);

    return 0;
}


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

int main(){
    int N, i, ans=0;
    ull t;
    cin >> N;

    for (i=0; i<N; i++) {
        scanf("%d", &t);
        while (t%2==0) ans++, t/=2;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long dfs(long long h) {
    if (h == 1)
        return 1;
    else {
        return 2*dfs(h/2) + 1;
    }
}

int main() {
    long long h;    cin >> h;
    cout << dfs(h) << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAX = 1e6+7;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;

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


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use num::integer::{gcd, lcm};
#[allow(unused_imports)]
use permutohedron::LexicalPermutation;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};
#[allow(dead_code)]
const MOD: i32 = 1e9 as i32 + 7;

fn main() {
    input!(n: i64, k: i64);
    println!("{}", {
        let tmp = n % k;
        if tmp == 0 {
            tmp
        } else if (tmp - k).abs() < n {
            (tmp - k).abs()
        } else {
            tmp
        }
    });
}


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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  
  int P1, P2;
  
  P1 = A * N;
  P2 = B;

	if( P1 >= P2) {
    cout << P2 << endl;
    }
	else{
      cout << P1 << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
enum POSITION{ONLINE_BACK = -2, CLOCKWISE = -1, ON_SEGMENT = 0,
              COUNTER_CLOCKWISE = 1, ONLINE_FRONT = 2};
struct Point{
    double x;
    double y;
    Point(double x, double y) : x(x), y(y){}
    Point operator-(Point p){
        return Point(x - p.x, y - p.y);
    }
};
typedef Point Vector;
double get_cross(Vector v1, Vector v2) {
    return v1.x * v2.y - v1.y * v2.x;
}
double get_dot(Vector v1, Vector v2){
    return v1.x * v2.x + v1.y * v2.y;
}
struct Segment{
    Point p1;
    Point p2;
    Segment(Point p1, Point p2) : p1(p1), p2(p2){}
};
POSITION get_pos(Point p, Segment s){
    Vector base = s.p2 - s.p1;
    Vector obj  = p    - s.p1;
    double cross = get_cross(base, obj);
    if (cross >  1e-10) return CLOCKWISE;
    if (cross < -1e-10) return COUNTER_CLOCKWISE;
    if (get_dot(base, obj) < 0) return ONLINE_BACK;
    if (get_dot(base, base) < get_dot(obj, obj)) return ONLINE_FRONT;
    return ON_SEGMENT;
}
bool is_intersection(Segment s1, Segment s2){
    if (get_pos(s2.p1, s1) * get_pos(s2.p2, s1) > 0) return false;
    if (get_pos(s1.p1, s2) * get_pos(s1.p2, s2) > 0) return false;
    return true;
}

int main(){
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int x_p0, y_p0, x_p1, y_p1, x_p2, y_p2, x_p3, y_p3;
        cin >> x_p0 >> y_p0 >> x_p1 >> y_p1;
        cin >> x_p2 >> y_p2 >> x_p3 >> y_p3;
        Point p0(x_p0, y_p0);
        Point p1(x_p1, y_p1);
        Point p2(x_p2, y_p2);
        Point p3(x_p3, y_p3);
        Segment s1(p0, p1);
        Segment s2(p2, p3);
        int ans = 0;
        if (is_intersection(s1, s2)) ans = 1;
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3116