akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string S, T, U, V, W, X;
  cin >> S;
  T=S;
  reverse(S.begin(), S.end());
  U=S.substr(0,S.size()/2);
  V=U;
  reverse(U.begin(), U.end());
  W=S.substr((S.size()+3)/2-1,S.size()-(S.size()+3)/2+1);
  X=W;
  reverse(W.begin(), W.end());
  if(T==S && V==U && W==X) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int A[200010];
int ans[200010];
int main(int argc, char const *argv[]) {
  int N;
  cin >> N;
  for (int i = 0; i < N-1; i++){
    cin >> A[i];
    ans[A[i]]++;
  }
  for (int i = 1; i<=N; i++){
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 5068
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>

using namespace std;

int main()
{
    int n,m;
    int l,r;
    int lef,rig;
    cin >> n >> m;
    lef = 0;
    rig = n;
    for(int i = 0;i < m;i++){
      cin >> l >> r;
      if(lef < l){
        lef = l;
      }
      if(rig > r){
        rig = r;
      }
    }
    if(rig - lef < 0){
      cout << 0 << endl;
    }else{
      cout << rig - lef + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
ll powmod(ll n, ll k, ll m) {
ll r=1;
 for(; k>0; k >>=1) {
   if(k&1) r=(r*n)%m;
   n=(n*n)%m;
 }
  return r;
}

ll fact(ll n) {
ll a=1;
rep(i,n) {
a=a*(n-i);
}
return a;
}

ll pow(ll a, ll b) {
ll x=1;
rep(i,b) {
x=x*a;
}
return x;
}

int main() {
ll N;
  ll M;
  cin >>N>>M;
  vvl vec(M);
  rep(i,M) {
ll a;
    cin >>a;
    rep(j,a) {
      ll b;
      cin >>b;
      vec.at(i).push_back(b);
    }
  }
  
  
  vl pp(M);
  rep(i,M) {
cin >>pp.at(i);
  }
  
  
  
  //endin
  
  ll count=0;
  for(int bit=0;bit<(1<<N); ++bit) {
    
    vl ps(M);
    rep(i,M) {
ps.at(i)=0;
    }

    
    rep(i,N) {
if(bit&(1<<i)) {
  rep(j,M) {
rep(k, vec.at(j).size()) {
if(vec.at(j).at(k)==i+1) {
ps.at(j)++;
}
}
    
  }
}
   }
   
  
  rep(i,M) {
     ps.at(i)=ps.at(i)%2;
    }
    bool ans=true;
    rep(i,M) {
      if(pp.at(i)!=ps.at(i)) {
        ans=false;
        break;
      }
    }
    if(ans) {
      count++;
    }
    
    
  }
  
  
  
  cout<<count<<endl;
}
    
  
  
  
  
  
 
    

    
    
  

Measured memory_bytes: 3540
#import 
#=input()
n=int(input())
#=map(int,input().split())
a=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

l = [[a[0]]]
for i in range(n-1):
    if a[i] > a[i+1]:
        if a[i] != l[-1][0]:
            l[-1] += [a[i]]
        else:
            del l[-1]
        l += [[a[i+1]]]
if a[-1] != l[-1][0]:
    l[-1] += [a[-1]]
else:
    del l[-1]

m = 1000
for i in range(len(l)):
    k = m // l[i][0]
    m %= l[i][0]
    m += k * l[i][1]
print(m)
    

Measured memory_bytes: 9204
use std::io::stdin;

macro_rules! read {
    ($t: ty) => {{
        let mut line = String::new();
        stdin().read_line(&mut line);
        line.trim().parse::<$t>().unwrap()
    }};
    ($($t: ty), *) => {{
        let mut line = String::new();
        stdin().read_line(&mut line);
        let mut iter = line.split_whitespace();
        (
            $(iter.next().unwrap().parse::<$t>().unwrap(), )*
        )
    }}
}
macro_rules! reads {
    ($e:expr, $t:ty) => {{
        let mut v = vec![];
        for _ in 0..$e {
            let mut line = String::new();
            stdin().read_line(&mut line);
            v.push(line.trim().parse::<$t>().unwrap());
        }
        v
    }};
}

fn main() {
    let a = read!(u32);
    let b = read!(u32);
    let c = read!(u32);
    let d = read!(u32);
    let e = read!(u32);
    let k = read!(u32);

    if b - a > k {
        println!(":(");
        return;
    }
    if c - a > k {
        println!(":(");
        return;
    }
    if d - a > k {
        println!(":(");
        return;
    }
    if e - a > k {
        println!(":(");
        return;
    }
    println!("Yay!");
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <map>
using namespace std;
typedef long long ll;
char s1[200005];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	scanf("%s",s1);
//	puts(s1);
	ll ans=0;
	if(m==2 || m==5)
	{
		for(int i=0;i<n;i++)
		{
			if((s1[i]-'0')%m==0)
			{
				ans+=i;
				ans+=1; 
			}
		}
	}
	else
	{
		map<int,int> mp;
		mp[0]++;
		int s=0;
		int w=1;
		for(int i=n-1;i>=0;i--)
		{
			s+=((s1[i]-'0')*w%m); //若s值相同,(但s值间存在0且m的倍数产生0,0不改变余值,会出现问题)
			s%=m;                 //s可以与之前任意s(不包括此s)之间数可以被M整除 ,故产生 mp[s]个串
			//printf("%d***%d\n",mp[s],s);//固前面特判2,5两个质数 
			ans+=mp[s];    //例如369,9与0产生9;6与0产生69, 6与9产生6;,
			mp[s]++;      // 3与0产生369,3与9产生36,3与6产生3 
			w=w*10%m;      //乘法取模防止过大数,不影响实际值 
		}
	}
	printf("%lld\n",ans);
	return 0;
}

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

void solve(long long a, long long b)
{
    cout << ceil(static_cast<double>(a + b) / 2.0) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long a;
    scanf("%lld", &a);
    long long b;
    scanf("%lld", &b);
    solve(a, b);
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

int main()
{
	string st;
	int h, m;

	while(1) {
		cin >> st;
		if(st == "-")
			break;
		cin >> m;
		for(int i = 0; i < m; ++i) {
			cin >> h;
			st = st.substr(h) + st.substr(0, h);
		}
		cout << st << endl;
	}
		return 0;
}

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

using namespace std;

typedef long long ll;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

int main() {
  ll n, m; read(n, m);
  ll cur = n * m;
  if(cur & 1ll) cur++;
  if(n == 1 or m == 1) {
    print(1);
    return 0;
  }
  print(cur / 2ll);
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int q = Integer.parseInt(sa[1]);
		long ans = (long) (n - 2) * (n - 2);
		TreeMap<Integer, Integer> mapx = new TreeMap<>();
		TreeMap<Integer, Integer> mapy = new TreeMap<>();
		mapx.put(n - 1, n - 1);
		mapy.put(n - 1, n - 1);
		for (int i = 0; i < q; i++) {
			sa = br.readLine().split(" ");
			int a = Integer.parseInt(sa[1]) - 1;
			if (sa[0].equals("1")) {
				int b = mapx.get(mapx.ceilingKey(a));
				ans -= b - 1;
				mapy.put(b, Math.min(a, mapy.getOrDefault(b, n - 1)));
			} else {
				int b = mapy.get(mapy.ceilingKey(a));
				ans -= b - 1;
				mapx.put(b, Math.min(a, mapx.getOrDefault(b, n - 1)));
			}
		}
		System.out.println(ans);
		br.close();
	}
}


Measured memory_bytes: 62548
#include <stdio.h>
#include <vector>
#include <queue>
typedef long long ll;
using namespace std;

int main(void) {
  ll i, j, k, n, a, b;
  scanf("%lld", &n);
  vector<ll> vec[n];
  ll p[n];
  for(i = 0; i < n; ++i) p[i] = -1;
  p[0] = 0;
  for(i = 0; i < n - 1; ++i) {
    scanf("%lld%lld", &a, &b);
    a--, b--;
    vec[a].push_back(b);
    vec[b].push_back(a);
  }
  queue<ll> q;
  q.push(0);
  while(!q.empty()) {
    queue<ll> qt;
    while(!q.empty()) {
      ll t = q.front(); q.pop();
      for(i = 0; i < vec[t].size(); ++i) {
        if(p[vec[t][i]] == -1) {
          p[vec[t][i]] = t;
          qt.push(vec[t][i]);
        }
      }
    }
    while(!qt.empty()) {
      q.push(qt.front()); qt.pop();
    }
  }
  ll now = n - 1, num = 0;
  while(now) now = p[now], num++;
  num--, now = n - 1;
  num /= 2;
  for(i = 0; i < num; ++i) now = p[now];
  a = 0, b = 0;
  q.push(0);
  while(!q.empty()) {
    queue<ll> qt;
    while(!q.empty()) {
      ll t = q.front(); q.pop();
      for(i = 0; i < vec[t].size(); ++i)  if(p[t] != vec[t][i] && vec[t][i] != now) ++a, qt.push(vec[t][i]);
    }
    while(!qt.empty()) {
      q.push(qt.front()); qt.pop();
    }
  }
  q.push(now);
  while(!q.empty()) {
    queue<ll> qt;
    while(!q.empty()) {
      ll t = q.front(); q.pop();
      for(i = 0; i < vec[t].size(); ++i)  if(p[t] != vec[t][i]) ++b, qt.push(vec[t][i]);
    }
    while(!qt.empty()) {
      q.push(qt.front()); qt.pop();
    }
  }
  if(a > b) printf("Fennec");
  else printf("Snuke");
  return 0;
}

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

string s;

int main()
{
	getline(cin, s);
	int k = s.length();
	int cnt = 0;
	for(int i = 0; i < k; i++)
	{
		if(s[i] == 'o') cnt++;
	}
	int r = 15 - k;
	cnt += r;
	if(cnt >= 8) printf("YES\n");
	else printf("NO\n");
}

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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N, A;
            N = int.Parse(Console.ReadLine());
            A = int.Parse(Console.ReadLine());
            if (N % 500 - A <= 0)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

from itertools import product

def main():
    N = II()
    A, G, C, T = range(4)
    def code(c0, c1, c2):
        return c0 + 4 * c1 + 16 * c2
    dp = [0] * 64
    dp[code(T, T, T)] = 1
    for _ in range(N):
        pre = dp
        dp = [0] * 64
        for p1, p2, p3 in product(range(4), repeat=3):
            for cur in range(4):
                if (p2, p1, cur) in [(A, G, C), (A, C, G), (G, A, C)]:
                    continue
                if (p3, p1, cur) == (A, G, C):
                    continue
                if (p3, p2, cur) == (A, G, C):
                    continue
                dp[code(cur, p1, p2)] += pre[code(p1, p2, p3)]
                dp[code(cur, p1, p2)] %= MOD
    ans = sum(dp)

    return ans % MOD

print(main())

Measured memory_bytes: 3188
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int a, b, c, x;
    cin >> a >> b >> c >> x;
    int ans = 0;
    imfor(i, a + 1) {
        imfor(j, b + 1) {
            imfor(k, c + 1) {
                if (500 * i + 100 * j + 50 * k == x) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <string>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,h[100005];
ll dp[100005];
#define ALL(v)  (v).begin(),(v).end()
std::set<int> st;
//#define MAX(a,b) if(a>b)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))

    /*  ペア関連
    //vector<pair<long long, long long> > pairs(N);
    for(long long i=0; i<N; i++){
        long long a, b;
        cin >> a >> b;
        pairs[i] = make_pair(a, b);
    }
    
    //sort(pairs.begin(), pairs.end(),greater<pair<int,int> >());
	sort(pairs.begin(), pairs.end());
    */

 	//stack<int> sta;   
    //queue<int> que;


int main(){
    long long sum,sum1;
	sum=0;
	sum1=0;
	int flg,flg1,cnt,cnt1;
	flg=0;
	flg1=0;
	cnt=0;
	cnt1=0;
	long long max;
	int max1;
	max=0;
	max1=0;
	int min;
	int min1;
	min=INF;
	min1=INF;

	int work1,work2,work3,work4;
	work1=0;
	work2=0;
	work3=0;
	work4=0;
	
	long long N,M,K;
	string s;
    
	std::cin >> N;
    //std::cin >> N >> M;
    //std::cin >> N >> M >> K;
    
	//std::vector<long long> v(N);
	//std::vector<long long> w(N);
    //std::cin >> s;
    
    
    // 配列入力
    /*
    for(long long i=0; i<N; i++){
		std::cin >> v[i];
	}
	*/
	/*
	for(long long i=0; i<N; i++){
		std::cin >> w[i];
	}
	*/
    
	
	//通常
	/*
    for(long long i=0; i<N; i++){
		
	}
	*/
	

	//文字列入力
	/*
	for(long long i=0; i<s.length(); i++){
		
		if(s[i]!='1'){
	}
	*/

	
	
	//ソート
    //std::sort(v.begin(),v.end());//昇順ソート
    //std::sort(v.begin(),v.end(),std::greater<long long>());//降順ソート
    //std::sort(w.begin(),w.end());//昇順ソート
    //std::sort(w.begin(),w.end(),std::greater<long long>());//降順ソート
    /*
    
    //S.substr(i, 5);
    //S.size();
    
    for(long long i=0; i<N; i++){
		std::cin >> v[i];
		if(st.find(v[i])==st.end()){
			st.insert(v[i]);
		}
		else{
			st.erase(v[i]);
		}
	}
	*/


	/*
	int a[4];
	int value;
	value=0;
	
	a[0] = (value % 10); 
	value /= 10;// 1桁目を取り出す
	a[1] = (value % 10); 
	value /= 10;// 2桁目を取り出す
	a[2] = (value % 10); 
	value /= 10;// 3桁目を取り出す
	a[3] = (value % 10); 
	value /= 10;// 4桁目を取り出す
    work1=a[0]+10*a[1];
    work2=a[2]+10*a[3];
    */
	
	
    if(1){
    	printf("%d",180*(N-2));
    	//printf("%lld",N);
    	//puts("Yes");
    	//printf("%d",st.size());
    	//文字列の出力
    	//std::cout << s << std::endl;
    	//printf("%.12f\n",ret);
    	//cout << sum << endl;
	}
	else{
		//puts("No");
	}
	return 0;
}


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

int board[3][3], n;
bool a[3][3];

bool bingoRow(bool a[3][3]){
	for(int i=0; i<3; i++){
		if(a[0][i] && a[1][i] && a[2][i]){
			return true;
		}
	}
	return false;
}

bool bingoCol(bool a[3][3]){
	for(int i=0; i<3; i++){
		if(a[i][0] && a[i][1] && a[i][2]){
			return true;
		}
	}
	return false;
}

bool bingoDia(bool a[3][3]){
	if(a[0][0] && a[1][1] && a[2][2])
		return true;
	else if(a[0][2] && a[1][1] && a[2][0]){
		return true;
	}
	return false;
}

int main() {
	for(int i=0; i<3; i++){
		for(int j=0; j<3; j++){
			cin >> board[i][j];
			a[i][j] = false;
		}
	}

	cin >> n;
	for(int k=0, b; k<n; k++){
		cin >> b;

		for(int i=0; i<3; i++){
			for(int j=0; j<3; j++){
				if(board[i][j] == b){
					a[i][j] = true;
					break;
				}
			}
		}
	}

	if(bingoDia(a) || bingoCol(a) || bingoRow(a))
		cout << "Yes" << endl;
	else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

int main() {
  int l;
  string s;
  while(cin >> s >> l, s!="0"||l!=0) {
    map<string,int> mp;
    REP(i,INF) {
      s = string(l - s.size(), '0') + s;
      //cout << s << endl;
      if (mp.count(s)) {
        cout << mp[s] << " " << atoi(s.c_str()) << " " << i-mp[s] << endl;
        break;
      }
      mp[s] = i;
      sort(ALL(s));
      string t = s;
      reverse(ALL(t));
      int tmp = atoi(t.c_str()) - atoi(s.c_str());
      stringstream ss;
      ss << tmp;
      s = ss.str();
      
      //cout << atoi(t.c_str()) - atoi(s.c_str()) << endl;
      
    }
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	int now = INF;
	int ans = 0;
	rep(i, n) {
		if (now > a[i]) {
			ans++;
		}
		chmin(now, a[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll gcd(ll x, ll y) {
	return y ? gcd(y, x%y): x;
}
ll low(ll x, ll y) {
	return y/gcd(x, y) * x;
}
int main() {
	int n;
	cin >> n;
	ll x = 1, y;
	while(n--) {
		cin >> y;
		x = low(x, y);
	}
	cout << x << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

const double pie = acos(-1.0);
const ll MOD = 1e9 + 7;

// 最大公約数
ll gcd(ll a, ll b)
{
   if (a%b == 0) {
       return(b);
   } else {
       return(gcd(b, a%b));
   }
}

// 最小公倍数
ll lcm(ll a, ll b){
   return a / gcd(a, b) * b;
}

//素数判定
bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: // fall-through
        case 3: return true;
    } // n > 3 が保証された
    if(n % 2 == 0 || n % 3 == 0) return false;
    for(unsigned i = 5; i * i <= n; i += 6) {
        if(n % i     == 0) return false; // (6の倍数)-1
        if(n % (i+2) == 0) return false; // (6の倍数)+1
    }
    return true;
}

void solve() {
    ll A[210000];
    ll n; cin >> n;
    Rep(i, 2, n){
        ll a; cin >> a;
        A[a]++;
    }
    Rep(i, 1, n){
        cout << A[i] << endl;
    }
}

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

    solve();
    return 0;
}


Measured memory_bytes: 5188
# -*- coding: utf-8 -*-
N, K = map(int, raw_input().split())
l_arr = map(int, raw_input().split())

l_arr_sorted = sorted(l_arr, reverse=True)
max_len = 0
for idx in range(0, K):
  max_len += l_arr_sorted[idx]

print(max_len)

# https://atcoder.jp/contests/abc067/tasks/abc067_b

Measured memory_bytes: 2696
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    int x, n;
    cin >> x >> n;
    map<int, int> mp;
    rep(i, n) {
        int p;
        cin >> p;
        mp[p] = 1;
    }
    for (int i = 0; i < 10000; i++) {
        if (!mp.count(x - i)) {
            cout << x - i << endl;
            return 0;
        }
        if (!mp.count(x + i)) {
            cout << x + i << endl;
            return 0;
        }
    }
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  ll x, y;
  cin >> x >> y;

  int ans = 0;
  while (x <= y) {
    ans++;
    x <<= 1;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}
func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0
	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 3
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}
	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	hh := make([]int, n)
	aa := make([]int64, n)
	for i := 0; i < n; i++ {
		hh[i] = getNextInt(scanner) - 1
	}
	for i := 0; i < n; i++ {
		aa[i] = getNextInt64(scanner)
	}
	dec := newDecomposition(n)
	for i := 0; i < n; i++ {
		m := dec.max(0, hh[i])
		dec.maximize(hh[i], m+aa[i])
	}
	fmt.Fprintln(writer, dec.max(0, n))
}

type decomposition struct {
	chunk  int
	bucket [][]int64
}

func newDecomposition(n int) decomposition {
	bucket := make([][]int64, 1)
	bucket[0] = make([]int64, n)
	chunk := 4
	for i := 0; n > 1; i++ {
		n = (n-1)/chunk + 1
		bucket = append(bucket, make([]int64, n))
	}
	return decomposition{
		chunk:  chunk,
		bucket: bucket,
	}
}
func (dec *decomposition) upleft(l int) int {
	return (l + dec.chunk - 1) / dec.chunk
}
func (dec *decomposition) upright(r int) int {
	return r / dec.chunk
}
func (dec *decomposition) maximize(index int, value int64) {
	dec.bucket[0][index] = value
	h := len(dec.bucket)
	for i := 0; i < h-1; i++ {
		p := index / dec.chunk
		r := (p + 1) * dec.chunk
		if r >= len(dec.bucket[i]) {
			r = len(dec.bucket[i])
		}
		dec.bucket[i+1][p] = value
		for j := p * dec.chunk; j < r; j++ {
			if dec.bucket[i+1][p] < dec.bucket[i][j] {
				dec.bucket[i+1][p] = dec.bucket[i][j]
			}
		}
		index /= dec.chunk
	}
}
func (dec *decomposition) max(l, r int) int64 {
	return dec.maxh(l, r, 0)
}
func (dec *decomposition) maxh(l, r, h int) int64 {
	m := dec.bucket[h][l]
	ll := dec.upleft(l)
	rr := dec.upright(r)
	for i := l; i < r && i < ll*dec.chunk; i++ {
		if m < dec.bucket[h][i] {
			m = dec.bucket[h][i]
		}
	}
	if ll < rr {
		mm := dec.maxh(ll, rr, h+1)
		if m < mm {
			m = mm
		}
	}
	for i := rr * dec.chunk; i < r && ll <= rr; i++ {
		if m < dec.bucket[h][i] {
			m = dec.bucket[h][i]
		}
	}
	return m
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector <vector< int> > vvi;
typedef vector<ll> vl;
typedef vector <vector< ll> > vvl;

#define endl "\n"
#define sp " "
#define M 1000000007
#define PI acos(-1.0)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

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

#define ini(a,i) memset(a, i, sizeof(a))
#define forf(n,x) for(int x = 0; x < n; ++x)
#define forb(n,x) for(int x = n-1; x >= 0; --x)
#define fori(n,x,i) for(int x=i; x<n; ++x)
#define vin(arr,n) forf(n,_) cin>>arr[_]
#define vout(arr,n) {forf(n,_) cout<<arr[_]<<sp; cout<<endl;}

#define all(c) c.begin(), c.end()
#define itr(c,it) for( auto it = c.begin(); it != c.end(); ++it)

typedef priority_queue <int> pq;

ll modInv(ll a)
{
    ll y = M-2;
    ll ans = 1;
    
    a %= M;
    while (y > 0) 
    { 
        if (y & 1) 
            ans = (ans*a) % M; 
  
        y = y>>1;
        a = (a*a) % M; 
    } 
    return ans;
    
}

int main()
{
	fastio;
	/*
	int quer;
	cin>>quer;
	forf(quer,qe)
	{

	}
	*/
	int n,m,k;
	cin>>n>>m>>k;
	int minn = INT_MAX;
	int arr[n][m+1];
	forf(n,i)
		vin(arr[i], m+1);
	int up = 1<<n;
	//cout<<up<<endl;
	int pows[n] = {0};
	pows[0] = 1;
	forf(n-1,i)
	{
		pows[i+1] = pows[i]<<1;
		//cout<<pows[i]<<sp;
	}
	//cout<<pows[n-1]<<sp;
	int sums[m+1];
	forf(up,l)
	{
		forf(m+1,j)
			sums[j] = 0;
		forf(n,i)
		{
			if(pows[i] & l)
			{
				forf(m+1,j)
				{
					sums[j] += arr[i][j];
				}
			}
		}
		int f = 0;
		forf(m,j)
		{
			
			if(sums[j+1] < k)
			{
				f = 1;
				break;
			}
		}
		if(!f)
		{
			if(minn > sums[0])
				minn = sums[0];
		}
		
	}
	if(minn == INT_MAX)
		cout<<-1;
	else
		cout<<minn;
	return 0;
}


Measured memory_bytes: 3660
A,B,C,D=map(int,input().split())
a=B//C-(A-1)//C
b=B//D-(A-1)//D
def lcm(x,y):
    return x*y//gcd(x,y)

def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)

z=lcm(C,D)
c=B//z-(A-1)//z
print(B-A+1-a-b+c)

Measured memory_bytes: 9192
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
static const int N = 1000;

int lcs(string X, string Y) {
	int c[N + 1][N + 1];
	int m = X.size();
	int n = Y.size();
	int maxl = 0;
	X = ' ' + X;
	Y = ' ' + Y;
	for (int i = 0; i <= m; i++)c[i][0] = 0;
	for (int j = 1; j <= n; j++)c[0][j] = 0;

	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= n; j++) {
			if (X[i] == Y[j]) {
				c[i][j] = c[i - 1][j - 1] + 1;
			}
			else {
				c[i][j] = max(c[i - 1][j], c[i][j - 1]);
			}
			maxl = max(maxl, c[i][j]);
		}
	}

	return maxl;
}

int main() {
	string s1, s2;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s1 >> s2;
		cout << lcs(s1, s2) << endl;
	}

	return 0;
}


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

using namespace std;

int main()
{
    string str;
    int cnt = 0;

    cin >> str;

    for (int i = 0; i < int(str.length()/2); i++)
    {
        if (str[i] != str[str.length()-i-1])
        {
            cnt++;
         }
    }

    cout << cnt;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
#define endl '\n'
#define first F
#define second S
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin>>n;
	int a = n*n, b=n*n*n;
	cout<<n+a+b<<endl;
	return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define     SZ  50500
#define     LIM 2500005
#define     pii pair<int, int>
#define     pb  push_back
#define     ff  first
#define     ss  second


int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int i, j, k;
    string s; cin>>s;
    for (i = 0; s[i]; i++){
        if (s[i] == 'A'){
            break;
        }
    }
    for (j = s.size()-1, k = 0; j >= 0; j--, k++){
        if (s[j] == 'Z') break;
    }

    int sz = s.size();

    cout<<(sz-i-k)<<endl;



    return 0;
}



Measured memory_bytes: 720
A,B,C = map(int,input().split())
if A%2==1 or B%2==1 or C%2==1:
    print(0)
elif A==B and A==C:
    print(-1)
else:
    a = 0
    while A%2==0:
        A //= 2
        a += 1
    b = 0
    while B%2==0:
        B //= 2
        b += 1
    c = 0
    while C%2==0:
        C //= 2
        c += 1
    cnt = min(a,b,c)
    if [a,b,c].count(cnt)<3:
        print(cnt)
    else:
        print(cnt+1)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <list>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)

using namespace std;

int i,j,k,l,m,n;
/////////////////////////////////////////////////////

ll N,X;
set<ll> x;
ll gcd;
ll GCD(ll a,ll b){
    if(b==0){
        return a;
    }
    return GCD(b,a%b);
}

int main(){
    cin>>N>>X;
    x.insert(X);
    fornum(i,0,N){
        ll xx;
        cin>>xx;
        x.insert(xx);
    }
    auto I=x.begin();
    ll Prev=(*I++);
    gcd=(*I)-Prev;
    Prev=(*I++);
    while(I!=x.cend() ){
        gcd=GCD((*I)-Prev,gcd);
        Prev=(*I++);
    }

    cout<<gcd;
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll a, b; cin >> a >> b;
    cout << ((a>8 || b>8) ? ":(" : "Yay!" ) << endl;
}

Measured memory_bytes: 256
n = int(input())
s = input()
s_original = s

while s.count("()") > 0:
    s = s.replace("()","")

left_count = s.count(")")
right_count = s.count("(")

for i in range(left_count):
    s_original = "(" + s_original
    
for i in range(right_count):
    s_original = s_original + ")"
    
print(s_original)

Measured memory_bytes: 3060
package main
 
import (
	"fmt"
)
 
func main() {
	var a, b int
	fmt.Scanf("%d", &a)
	fmt.Scanf("%d", &b)
	result := (a * b) % 2
	if result == 1 {
		fmt.Printf("%s", "Odd")
	} else {
		fmt.Printf("%s", "Even")
	}
}

Measured memory_bytes: 1836
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long

#define all(X) (X).begin(), (X).end()
#define reset(X) memset(X, 0, sizeof(X))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define endl '\n'
#define fi first
#define se second

using namespace __gnu_pbds;
using namespace std;
const int mod = 1e9 + 7;
// const int mod=998244353;
//const int mod=1e9+9;
//const int INF=4e18+10;
const int INF = 4e18 + 10;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define read(n) \
int n;      \
cin >> n;
#define readv(x, n)   \
vector<int> x(n); \
for (auto &i : x) \
    cin >> i;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

template <typename T1, typename T2>
void set_min(T1 &a, T2 b)
{
    a = min(a, (T1)b);
}

int multiply(int a, int b, int in_mod) { return (a * b) % in_mod; }
int mult_identity(int a) { return 1; }


auto power(auto a, int b, int in_mod)
{
    auto prod = mult_identity(a);
    auto mult = a % in_mod;
    while (b != 0)
    {
        if (b % 2)
        {
            prod = multiply(prod, mult, in_mod);
        }
        mult = multiply(mult, mult, in_mod);
        b /= 2;
    }
    return prod;
}
int mod_inv(int q, int in_mod)
{

    return power(q, in_mod - 2, in_mod);
}


void solve()
{
    int n;
    cin>>n;
    int z,w;
    cin>>z>>w;
    readv(a,n);
    reverse(all(a));
    a.insert(a.end(), w);
    a.insert(a.end(), z);


    vector<vector<int>> dp(n+3,  vector<int>({0, INF}));

    for(int i= 1;i<=n;i++)
    {
            //first player

            for(int k = 1;k<i;k++)
                dp[i][0] = max(dp[i][0], dp[k][1]);
            dp[i][0] = max(dp[i][0], abs(a[i] - a[0]) );

            //second player
            for(int k = 1;k<i;k++)
                dp[i][1] = min(dp[i][1], dp[k][0]);
            dp[i][1] = min(dp[i][1], abs(a[i] - a[0]) );

    }

    cout<<dp[n][0]<<endl;


}



signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cerr.tie(NULL);
#ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen("INPUT.txt", "r", stdin);
        freopen("OUTPUT.txt", "w", stdout);
    }
#endif
    auto clk = clock();
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // -------------------------------------Code starts here---------------------------------------------------------------------

    int t = 1;
    // cin >> t;

    for (int test = 1; test <= t; test++)
    {
        // cout<<"Case #"<<test<<":\n";
        //cout<<"Trip #"<<test<<": ";
        // cout<<endl;
        solve();
        // solveB();

        // cout<<endl;
    }

    // -------------------------------------Code ends here------------------------------------------------------------------

    clk = clock() - clk;
    // cerr << fixed << setprecision(6) << "Time: " << ((long double)clk) / CLOCKS_PER_SEC << "\n";
    return 0;
}


Measured memory_bytes: 3768
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <string>
#include <sstream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long  ll;



int main(int argc, const char * argv[]) {
    
    int k;cin>>k;
    string s="ACL";
    for(int i=0;i<k;i++) cout<<s;
    
    
    
   
    
    
    
     
    return 0;
}





























Measured memory_bytes: 3460
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

    int N, Q;
    cin >> N >> Q;
    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    for (int i = 0; i < Q; i++) {
        ll x;
        cin >> x;
        int t = 0;
        ll ans = 0, total = 0;
        for (int s = 0; s < N; s++) {
            for (; t < N && total + a[t] <= x; t++) total += a[t];
            ans += t - s;
            total -= a[s];
        }
        cout << ans << '\n';
    }
}


Measured memory_bytes: 3224
#include<stdio.h>
int main()
{
    int i,j,a,b;
    while(1){

    scanf("%d%d",&a,&b);
    if(a==0&&b==0)
        break;
    for(i=1;i<=a;i++)
    {
        for(j=1;j<=b;j++){
                if(i%2!=0)
                {
                    if(j%2!=0)
                         printf("#");
                    else
                    printf(".");

                }
                else if(i%2==0)
                {
                    if(j%2!=0)
                    printf(".");
                else
                    printf("#");

                }

            }

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

    }

    return 0;
}



Measured memory_bytes: 2056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ll n,c=0,i=2,ans=1,sum=0;
    cin>>n;

    while(n!=0)
    {
        n=n/2;
        c++;
    }


    ll x=c-1;

    while(x--)
    {
        ans=ans*2;
        sum+=ans;
        //cout<<ans<<endl;
    }

    //cout<<c<<endl;
    cout<<sum+1<<endl;



    return 0;
}


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

const string YES = "POSSIBLE";
const string NO = "IMPOSSIBLE";
typedef long long ll;
template<typename T>
T gcd(T a, T b){
    if (b==0) return a;
    else return  gcd(b,a%b);
}

void solve(long long N, long long K, std::vector<long long> A){
    ll maximum = *max_element(A.begin(),A.end());
    ll gcd_A = A[0];
    for(const auto a : A){
        gcd_A = gcd(gcd_A,a);
    }
    if (K%gcd_A==0 && K <= maximum) printf("POSSIBLE\n");
    else printf("IMPOSSIBLE\n");

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, K, std::move(A));
    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int MAXN = 200000+9;
char S[MAXN];
int len;
int cnt[30];
int pred[MAXN],succ[MAXN],head[30];
int num[MAXN];
bool vis[MAXN];
int tmp[MAXN];
typedef long long LL;
int tree[MAXN];

int lowbit(int x){
	return x&-x;
}

void add(int pos,int val){
	for(int i=pos;i<=len;i+=lowbit(i))
		tree[i]+=val;
}

LL getsum(int pos){
	LL re=0;
	for(int i=pos;i;i-=lowbit(i))
		re+=tree[i];
	return re;
}

void PRE(){
	memset(head,-1,sizeof(head));
	for(int i=len;i;i--){
		succ[i]=head[num[i]];
		head[num[i]]=i;
	}
	memset(head,-1,sizeof(head));
	for(int i=1;i<=len;i++){
		pred[i]=head[num[i]];
		head[num[i]]=i;
	}
}

LL Invpair(int *A){
	LL re=0;
	for(int i=1;i<=len;i++){
		re+=(i-getsum(A[i]-1)-1);
		add(A[i],1);
	}
	return re;
}

void solve(){
	int l,r;
	for(int i=1;i<=len;i++){
		if(!vis[i]){
			l=i,r=head[num[i]];
			while(r!=-1){
				tmp[len-l+1]=r;
				vis[l]=1;
				l=succ[l];r=pred[r];
			}
		}
	}
	printf("%lld\n",Invpair(tmp)>>1);
}

int main(){
	scanf("%s",S+1);
	len=strlen(S+1);
	for(int i=1;i<=len;i++){
		num[i]=S[i]-'a'+1;
		cnt[num[i]]++;
	}
	int odd=0;
	for(int i=1;i<=26;i++)
		if(cnt[i]&1)odd++;
	if(odd>1){
		puts("-1");
		return 0;
	}
	PRE();
	solve();
	return 0;
}

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


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    int n;
    long int ans = 0;
    cin >> n;
    for (int i = 1; i < n + 1; i++)for (int j = 1; j < n + 1; j++)for (int k = 1; k < n + 1; k++)ans += euclidean_gcd(euclidean_gcd(i, j), k);
    cout << ans;
}

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

using namespace std;

typedef long long ll;

vector<char> sv, tv;

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

    for (int i = 0; i < s.size(); ++i) sv.push_back(s[i]);
    for (int i = 0; i < t.size(); ++i) tv.push_back(t[i]);
    sort(sv.begin(), sv.end());
    sort(tv.begin(), tv.end(), greater<char>());

    bool bIsLexOrder = true;
    for (int i = 0; i < s.size(); ++i)
    {
        if (i >= t.size()
            || sv[i] > tv[i]
            || (sv.size() == tv.size() && sv[i] == tv[i]))
        {
            bIsLexOrder = false;
            break;
        }
        if (sv[i] < tv[i]) break;
    }

    string ans = bIsLexOrder ? "Yes" : "No";
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
L=[]
R=[]
for i in range(K):
  l,r= map(int, input().split())
  L.append(l)
  R.append(r)

dp=[0]*(N+1)
dp[1]=1
dpd=[0]*(N+2)
dpd[2]=-1

for i in range(1, N):
  for j in range(K):
    dpd[min(i+L[j],N+1)]+=dp[i]
    dpd[min(i+R[j]+1,N+1)]-=dp[i]
  dp[i+1]=(dp[i]+dpd[i+1])%998244353

print(dp[N])

Measured memory_bytes: 82384
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

#n = int(input())
#n, op = [i for i in readline().split()]


#s,t = [i for i in readline().split()]

#print(t+s)

a,b,k = [int(i) for i in readline().split()]


if a >= k: a -= k
else:
    k -= a
    a = 0
    b = max(0,b-k)


print(*[a,b])






Measured memory_bytes: 2940
N, W = gets.split.map(&:to_i)
d = [[0, 0]]

(0..(N-1)).each do
  w, v = gets.split.map(&:to_i)
  next if w > W
  
  (0..(d.size - 1)).each do |i|
    d << [d[i][0] + w, d[i][1] + v] if d[i][0] + w <= W
  end
  d.sort!
  
  idx = 1
  while idx < d.size do
    if d[idx-1][1] >= d[idx][1]
      d.delete_at(idx)
    else
      idx += 1
    end
  end
end

puts d[-1][1]

Measured memory_bytes: 2680
///
// File:  b.go
// Author: ymiyamoto
//
// Created on Sat Apr  7 21:04:38 2018
//
package main

import (
	"fmt"
)

var A, B, K int

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

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

func main() {
	fmt.Scan(&A, &B, &K)

	for i := A; i < min(B+1, A+K); i++ {
		fmt.Println(i)
	}

	for i := max(A+K, B-K+1); i <= B; i++ {
		fmt.Println(i)
	}
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-
A, B = map(int, input().split())
ansA = set()
for i in range(10*B, 10*(B+1)):
  ansA.add(i)

st = int(25*A/2)
if(25*A % 2 != 0):
  st += 1

ed = int(25*(A+1)/2)
if(25*(A+1) % 2 != 0):
  ed += 1

ansB = set()
for i in range(st, ed):
  ansB.add(i)

ans = ansA & ansB
if(len(ans) == 0):
  print('-1')
else:
  print(min(ans))


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;
#define pi 3.1415926


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

    

		


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

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

	string A, B, C;

	cin >> A >> B >> C;

	// cout << C << B << A;

	// printf("%c", A[0]);
	char *pa = (char *)A.c_str();
	char *pb = (char *)B.c_str();
	char *pc = (char *)C.c_str();

#define check_end(p) \
	if (*p == '\0') goto end

	char tp = 'a';  // {a, b, c};
	while (true) {
		// printf("%c", tp);
		switch (tp) {
			case 'a':
				check_end(pa);
				tp = *pa;
				pa++;
				break;
			case 'b':
				check_end(pb);
				tp = *pb;
				pb++;
				break;
			case 'c':
				check_end(pc);
				tp = *pc;
				pc++;
				break;
			default:
				goto end;
				break;
		}
	}
end:
	printf("%c", tp + 'A' - 'a');

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
using namespace std;
#define _GLIBCXX_DEBUG
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vit vector<lint>::iterator
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define mod 1000000007
#define graph_set(n) struct edge{int to,int cost;} vector<edge> G((n))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define range(x,y) ((x) >= 0 && (x) < h && (y) >= 0 && (y) < w)
#define pyes cout << "Yes" << endl
#define pno cout << "No" << endl
typedef vector<long long> vi;
typedef vector<pair<long long, long long>> vp;
typedef vector<vector<long long>> vvi;
typedef pair<long long, long long> pi;
typedef long long lint;
typedef long long ll;
lint qp(int a, ll b) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
lint qp(int a, ll b, int mo) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
lint gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
long long INF = 1e14;

//////////////////////////////////////////////////////////////////////
ll cir(vi a, int m) {
	ll n = a.size();
	if (m >= 0) return a[m];
	else return a[n - (-1 * m % n)];
}
ll cnt;
int main(void) {
	ll n, x; cin >> n >> x;
	vi a(n); rep(n)scanf("%lld", &a[i]);
	vvi b(n, vi(n, 0));
	ll ans = 1e18;
	for (ll k = 0; k <= n - 1; k++) {
		ll res = 0;
		for (ll i = 0; i < n; i++)
		{
			cnt++;
			if (k == 0) b[k][i] = a[i];
			else {
				if (i - k < 0) b[k][i] = min(b[k - 1][i], a[n + (i - k)]);
				else b[k][i] = min(b[k - 1][i], a[(i - k)]);
				//b[k][i] = min(b[k - 1][i], cir(a, i - k));
			}
			res += b[k][i];
		}
		mins(ans, res + k * x);
	}
//	debug(cnt);
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 31616
#include <iostream>
#include <iomanip>
#include <queue>
using namespace std;
#define INF 1000000007
#define ll long long
#define rep(i, start, end) for(ll i=(ll)start; i<(ll)end; i++)
#define print(a) cout << a << endl;
#define printarray(a, len) rep(i,0,len) cout << a[i] << " ";
 
int main(){
  ll a, b;
  cin >> a >> b;
  if ((a + b) % 2 == 0){
    print((a + b) / 2);
  }else{
    print("IMPOSSIBLE");
  }
  
  return 0;
}

Measured memory_bytes: 256