akhauriyash/Code-Regression huggingface dataset:
// import chie template :) {{{
import std.stdio, std.algorithm, std.array, std.string, std.math, std.conv,
  std.range, std.container, std.bigint, std.ascii, std.typecons, std.format, std.bitmanip;

// }}}
// nep.scanner {{{
class Scanner {
  import std.stdio : File, stdin;
  import std.conv : to;
  import std.array : split;
  import std.string;
  import std.traits : isSomeString;

  private File file;
  private char[][] str;
  private size_t idx;

  this(File file = stdin) {
    this.file = file;
    this.idx = 0;
  }

  this(StrType)(StrType s, File file = stdin) if (isSomeString!(StrType)) {
    this.file = file;
    this.idx = 0;
    fromString(s);
  }

  private char[] next() {
    if (idx < str.length) {
      return str[idx++];
    }

    char[] s;
    while (s.length == 0) {
      s = file.readln.strip.to!(char[]);
    }

    str = s.split;
    idx = 0;

    return str[idx++];
  }

  T next(T)() {
    return next.to!(T);
  }

  T[] nextArray(T)(size_t len) {
    T[] ret = new T[len];

    foreach (ref c; ret) {
      c = next!(T);
    }

    return ret;
  }

  void scan()() {
  }

  void scan(T, S...)(ref T x, ref S args) {
    x = next!(T);
    scan(args);
  }

  void fromString(StrType)(StrType s) if (isSomeString!(StrType)) {
    str ~= s.to!(char[]).strip.split;
  }
}
// }}}


long[] divisor(const long n) {
  long[] ret;

  for (long i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      ret ~= i;
      if (i != n / i) {
        ret ~= n / i;
      }
    }
  }

  return ret;
}

void main() {
  auto cin = new Scanner;
  long n;
  cin.scan(n);

  auto primes = divisor(n);
  auto prevPrimes = divisor(n - 1);

  auto res = prevPrimes.length - 1;
  foreach (k; primes) {
    if (k == 1) continue;
    long nn = n;

    while (nn >= k) {
      if (nn % k == 0) {
        nn /= k;
      } else {
        nn %= k;
      }
    }

    if (nn == 1) {
      res++;
    }
  }

  writeln(res);
}


Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

struct UnionFind {
  vector<int> d;
  UnionFind(int n) : d(n, -1) {}
  int root(int x) {
    if(d[x] < 0) return x;
    return d[x] = root(d[x]);
  }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return false;
    if(d[x] > d[y]) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y); }
  int size(int x) { return -d[root(x)]; }
};

int main() {
  ll n, m;
  cin >> n >> m;
  UnionFind uf(n);
  rep(i, m) {
    ll x, y, z;
    cin >> x >> y >> z;
    x--;
    y--;
    uf.unite(x, y);
  }
  set<ll> st;
  rep(i, n) st.insert(uf.root(i));
  cout << st.size() << endl;
}

Measured memory_bytes: 8132
//参考：https://qiita.com/DaikiSuyama/items/9dba963ba74396b9b7fd
//インクルード(アルファベット順)
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define FIR first    //pairの一つ目の要素
#define SEC second   //pairの二つ目の要素

signed main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll N, X;
    cin >> N >> X;

    vector<ll> A(N);
    REP(i, N)
    cin >> A[i];

    REP(i, N)
    A[i] = abs(A[i] - X);

    sort(ALL(A));

    ll max_num = A[N - 1];

    vector<ll> div;
    FORD(i, ll(sqrt(max_num)), 1)
    {
        if (max_num % i == 0)
        {
            div.PB(i);
            if (i * i != max_num)
                div.PB(max_num / i);
        }
    }

    sort(ALL(div), greater<ll>());
    REP(i, SIZE(div))
    {
        bool is_ok = true;
        REP(j, N)
        {
            if (A[j] % div[i] != 0)
            {
                is_ok = false;
                break;
            }
        }

        if (is_ok)
        {
            cout << div[i] << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3676
x,y=map(int,input().split())
if (x+y)%3!=0:
    print(0)
else:
    a=y-(x+y)//3
    b=x-(x+y)//3
    if a<0 or b<0:
        print(0)
    else:
        def cmb(n, r, mod):
            if ( r<0 or r>n ):
                return 0
            r = min(r, n-r)
            return g1[n] * g2[r] * g2[n-r] % mod
        mod = 10**9+7
        N = 10**6
        g1 = [1,1]
        g2 = [1,1]
        inverse = [0, 1]
        for i in range( 2, N + 1 ):
            g1.append( ( g1[-1] * i ) % mod )
            inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
            g2.append( (g2[-1] * inverse[-1]) % mod )
        ans=cmb(a+b,a,mod)
        print(ans)

Measured memory_bytes: 122016
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;


const int N = (int) 1e5 + 100;
char str[N];
int cnt[3];

int main(int,  char **)
{
#ifdef LOCAL
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

    scanf("%s", str);
    int n = strlen(str);
    for (int i = 0; i < n; i++)
    {
        cnt[str[i] - 'a']++;
    }
    sort(cnt, cnt + 3);
    if (cnt[2] - cnt[0] <= 1)
        printf("YES\n");
    else
        printf("NO\n");

	return 0;
}



Measured memory_bytes: 764
fn main() {
    let v = read_vec::<usize>();
    let h = v[0];
    let w = v[1];
    let mut v2 = vec![vec!['#'; w + 2]; h + 2];
    for i in 0..h {
        let s = read::<String>().chars().collect::<Vec<_>>();
        for j in 0..s.len() {
            v2[i + 1][j + 1] = s[j];
        }
    }
    for i in 0..h + 2 {
        println!("{}", v2[i].clone().into_iter().collect::<String>());
    }
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
data = input()
split = data.split(' ')
a = int(split[0])
b = int(split[1])
c = int(split[2])

if b < a:
    a, b = b, a

for i in range(a, b):
    judge = 'No'
    if i == c:
        judge = 'Yes'
        break

print(judge)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
    #include <filesystem>
    namespace fs = std::filesystem;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll X;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path __p = __FILE__;
        fs::path __input, __output;
        __input = __output = __p.parent_path();
        __input += string("/input/") + string(__p.stem()) + string(".txt");
        __output += string("/output/") + string(__p.stem()) + string(".txt");
        freopen(__input.c_str(), "r", stdin);
        freopen(__output.c_str(), "w", stdout);
    #endif
    cin >> X;
}

int solve(){
    for (ll a = -1000LL; a <= 1000LL; a++)
    {
        for (ll b = -1000LL; b <= 1000LL; b++)
        {
            if((a*a*a*a*a+b*b*b*b*b)==X){
                cout << a << " " << (-b) << endl;
                return 0;
            }
        }
        
    }
    return 0;    
}

int main()
{
    input();
    solve();
    return 0;
}


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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// #define mp make_pair
//#define endl '\n'

int main() {
  int n;
  cin >> n;
  vi a(n);
  rep (i, n) {
    cin >> a[i];
  }

  int ma = 0, ma2 = 0;
  rep (i, n) {
    if (a[i] > ma) {
      ma2 = ma;
      ma = a[i];
    }
    else if (a[i] > ma2) {
      ma2 = a[i];
    }
  }

  rep (i, n) {
    if (a[i] != ma) {
      cout << ma << endl;
    }
    else {
      cout << ma2 << endl;
    }
  }

  
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
const int N=200010,p=998244353;
int add(int x,int y){return(x+y)%p;}
int mul(int x,int y){return 1ll*x*y%p;}
int mpow(int a,int n){
    int ret=1;
    while(n){
        if(n&1)ret=mul(ret,a);
        a=mul(a,a);
        n/=2;
	}
	return ret;
}
int pow2[N];
int n;
struct point{
    int x,y;
}a[N];
bool cmpx(const point&a,const point&b){return a.x<b.x;}
bool cmpy(const point&a,const point&b){return a.y<b.y;}
vector<int>vx,vy;
int ans;
int tr[N];
void updata(int x,int z){
    for(;x<N;x+=x&-x)tr[x]+=z;
}
int query(int x){
    int ret=0;
    for(;x;x-=x&-x)ret+=tr[x];
    return ret;
}
int main(){
//	freopen("1.in","r",stdin);
	pow2[0]=1;
	for(int i=1;i<N;++i)pow2[i]=mul(pow2[i-1],2);
    cin>>n;
    for(int i=1;i<=n;++i){
        scanf("%d%d",&a[i].x,&a[i].y);
	    vx.push_back(a[i].x);
	    vy.push_back(a[i].y);
	}
	sort(vx.begin(),vx.end());
	sort(vy.begin(),vy.end());
	for(int i=1;i<=n;++i){
	    a[i].x=lower_bound(vx.begin(),vx.end(),a[i].x)-vx.begin()+1;
	    a[i].y=lower_bound(vy.begin(),vy.end(),a[i].y)-vy.begin()+1;
	}
//	for(int i=1;i<=n;++i)cout<<a[i].x<<' '<<a[i].y<<endl;
	ans=mul(pow2[n]-1,n);
	int l,r;
	sort(a+1,a+n+1,cmpx);
	l=1,r=n;
	for(int i=1;i<=n;++i){
	    while(a[l].x<a[i].x&&l<=n)++l;
	    ans=add(ans,p-pow2[l-1]+1);
	}
	for(int i=n;i;--i){
	    while(a[r].x>a[i].x&&r>=1)--r;
	    ans=add(ans,p-pow2[n-r]+1);
	}
	sort(a+1,a+n+1,cmpy);
	l=1,r=n;
	for(int i=1;i<=n;++i){
	    while(a[l].y<a[i].y&&l<=n)++l;
	    ans=add(ans,p-pow2[l-1]+1);
	}
	for(int i=n;i;--i){
	    while(a[r].y>a[i].y&&r>=1)--r;
	    ans=add(ans,p-pow2[n-r]+1);
	}
	sort(a+1,a+n+1,cmpx);
	for(int i=1;i<=n;++i){
	    int q=query(a[i].y);
	    ans=add(ans,pow2[q]-1);
	    q=i-query(a[i].y)-1;
	    ans=add(ans,pow2[q]-1);
		updata(a[i].y,1);
	}
	memset(tr,0,sizeof tr);
	reverse(a+1,a+n+1);
	for(int i=1;i<=n;++i){
	    int q=query(a[i].y);
	    ans=add(ans,pow2[q]-1);
	    q=i-query(a[i].y)-1;
	    ans=add(ans,pow2[q]-1);
		updata(a[i].y,1);
	}
	cout<<ans<<endl;
}

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

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

    vector<int> mao(n);
    for(int i=0; i<n; i++) cin>>mao.at(i);

    int z = 0;
    for(int i=0; i<n; i++) {
        if(mao.at(i)>=k) z++;
    }

    cout<<z<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
	for(;;){
		int H,W;
		cin>>H>>W;
		if(H==0&&W==0)break;
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				cout<<'#';
			}
			cout<<endl;
		}cout<<endl;	
	}
}



Measured memory_bytes: 3088
/*

*/
#include<iostream>
#include<iomanip>
#include<ios>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>
#include<cstdlib>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)
#define MAX_N 10000

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

const int INF = 1<<30;
const ll MOD = ll(1e9+7);

int main(){
  int n, k;cin>>n>>k;
  vector<bool> snuke(n, false);
  rep(i, k){
    int d;cin>>d;
    rep(j, d){
      int a;cin>>a;
      snuke[--a]=true;
    }
  }
  int cnt = 0;
  rep(i, n){
    if(!snuke[i])cnt++;
  }
  cout<<cnt<<endl;
  // system("read -n 1 -s -p \"Press any key to continue...\"");
}


Measured memory_bytes: 3620
n=int(input())

temp=0
cnt=0


for _ in range(n):
    a=int(input())
    hoge=min(a,temp)
    cnt+=hoge

    if a>hoge:
        cnt+=(a-hoge)//2
        temp=(a-hoge)-((a-hoge)//2)*2
    else:
        temp=0

print(cnt)




Measured memory_bytes: 45416
#include <stdio.h>

int main(void)
{
	int n;
	scanf("%d",&n);
	if(n%2 == 0){	
		printf("%d\n",n/2);
	}
	else if(n%2 != 0){
		printf("%d\n",(n/2)+1);
	}
	return 0;
}



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

int main(){
	int kosu[2][20][20],x,y,c,i,j;
	
	while(~scanf("%d%d",&x,&y)){
		if(x==0&&y==0)break;
		memset(kosu,0,sizeof(kosu));
		for(i=1;i<=y;i++){
			for(j=1;j<=x;j++){
				scanf("%d",&c);
				kosu[1][i][j]=c;
			}
		}
		
		for(i=1;i<=x;i++){
			if(kosu[1][1][i]==0)kosu[0][1][i]=1;
		}
		
		for(i=2;i<y;i++){
			for(j=1;j<=x;j++){
				if(kosu[1][i][j]==1)continue;
				if(kosu[1][i-2][j]==2)kosu[0][i][j]+=kosu[0][i-2][j];
				if(kosu[1][i][j]==2){
					kosu[0][i][j]+=(kosu[1][i-1][j]==2?0:kosu[0][i-1][j]);
				}else{
					kosu[0][i][j]+=((kosu[1][i-1][j-1]==2?0:kosu[0][i-1][j-1])+(kosu[1][i-1][j]==2?0:kosu[0][i-1][j])+(kosu[1][i-1][j+1]==2?0:kosu[0][i-1][j+1]));
				}
			}
		}
		
		if(y==1){
			j=0;
			for(i=1;i<=x;i++){
				j+=kosu[0][y][i];
			}
			printf("%d\n",j);
			continue;
		}
		
		for(j=1;j<=x;j++){
			if(kosu[1][y-1][j]==2)kosu[0][y][j]+=kosu[0][y-1][j];
			if(kosu[1][y][j]!=1 && kosu[1][y-2][j]==2)kosu[0][y][j]+=kosu[0][y-2][j];
			if(kosu[1][y][j]==1)continue;
			if(kosu[1][y][j]==2){
				kosu[0][y][j]+=(kosu[1][y-1][j]==2?0:kosu[0][y-1][j]);
			}else{
				kosu[0][y][j]+=((kosu[1][y-1][j-1]==2?0:kosu[0][y-1][j-1])+(kosu[1][y-1][j]==2?0:kosu[0][y-1][j])+(kosu[1][y-1][j+1]==2?0:kosu[0][y-1][j+1]));
			}
		}
		
		
		j=0;
		for(i=1;i<=x;i++){
			j+=kosu[0][y][i];
		}
		printf("%d\n",j);
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
typedef long long ll;
#define F(i,L,R) for (ll i = L; i < R; i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define re(x) scanf("%lld",&x)
#define MAXN 1000006
using namespace std;
ll spf[MAXN]; 
map<ll,ll> pcnt;
   
void seive() 
{ 
    spf[1] = 1; 
    F(i,2,MAXN) spf[i] = i; 
  
    for (ll i=4; i<MAXN; i+=2) spf[i] = 2; 
  
    for (ll i=3; i*i<MAXN; i++) 
    {  
        if (spf[i] == i)  for (ll j=i*i; j<MAXN; j+=i)  if (spf[j]==j) spf[j] = i; 
    } 
} 
  
// A O(log n) function returning primefactorization 
set<ll> factors(ll x) 
{ 
	set<ll> v;
    while (x != 1) 
    { 
    	v.insert(spf[x]);
        x = x / spf[x]; 
    } 
    return v; 
} 

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

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  seive();
  ll n, flag = 0;
  cin>>n;
  ll a[n];
  F(i,0,n) cin>>a[i];
  set<ll> k = factors(a[0]);

  for(auto i: k) pcnt[i]++;
  F(i,1,n){
  	set<ll> ans = factors(a[i]);
  	for(auto i: ans){
  		if(pcnt[i]  == 1){
  			flag = 1;
  			break;
  		}
  		pcnt[i] = 1;
  	}
  	if(flag ==1) break; 
  }
  if(flag == 0) cout<<"pairwise coprime";
  else {
  	ll gcd = a[0];
  	F(i,1,n) gcd = ggcd(a[i], gcd);
  	if(gcd == 1) cout<<"setwise coprime";
  	else cout<<"not coprime";
  }





  
  return 0;
}

Measured memory_bytes: 19228
n, m = map(int, input().split())
relations = [[] for _ in range(n)]
 
for i in range(m):
    s, t = map(int, input().split())
    relations[s] += [t]
    relations[t] += [s]
friend_id = [None] * n
for s, t in enumerate(relations):
    if t:
        queue = [s]
        while len(queue):
            k = queue.pop()
            friend_id[k] = s
            queue += relations[k]
            relations[k] = []
 
q = int(input())
for i in range(q):
    s, t = map(int, input().split())
    print('yes' if friend_id[s] != None and friend_id[s] == friend_id[t] else'no')


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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	if(s[s.size() - 1] == 's') cout << s << "es" << endl;
	else cout << s << "s" << endl;

	return 0;
}

Measured memory_bytes: 3624
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

n = I()
a = LI()

# a[0] の符号を決めて貪欲に

# a[0] > 0 にする

s = 0  # 累積和
b = 0  # 操作回数
for i in range(n):
    if i % 2 == 0:
        if s+a[i] > 0:
            s += a[i]
        else:
            b += -(s+a[i])+1
            s = 1
    else:
        if s+a[i] < 0:
            s += a[i]
        else:
            b += s+a[i]+1
            s = -1

# a[i] < 0 にする

s = 0  # 累積和
c = 0  # 操作回数
for i in range(n):
    if i % 2 == 1:
        if s+a[i] > 0:
            s += a[i]
        else:
            c += -(s+a[i])+1
            s = 1
    else:
        if s+a[i] < 0:
            s += a[i]
        else:
            c += s+a[i]+1
            s = -1

print(min(b,c))


Measured memory_bytes: 85324
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		System.out.println((Math.abs(c-a) <= d || (Math.abs(b-a) <= d && Math.abs(c-b) <= d) )? "Yes" : "No");
	}
}

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

int main(){
    int x;cin>>x;
    bool array[x+1]={false};
    array[1]=true;
    for(int i=2;i*i<=x;i++){
        ll num = i*i;
        while(num<=x){
            array[num]=true;
            num*=i;
        }
    }
    int ans = 1;
    rep1(i,x){
        if(array[i])ans =i;
    }
    co(ans);
}

Measured memory_bytes: 256
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan,sqrt
import cmath as cma
import copy as cp
import sys
import re
sys.setrecursionlimit(10**7)
EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf
MOD = 10**9 + 7

def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def adj(n): return [[] for _ in range(n)]

n = iinput()
a = iarr()
amax = max(a)
#amax = 10**6

cnt = [0 for i in range(amax+1)]
for num in a:
    for i in range(1,amax//num + 1):
        tmp = num * i
        cnt[tmp] += 1

ans = 0
for num in a:
    if cnt[num]==1: ans += 1
print(ans)



Measured memory_bytes: 62324
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        var tpl = new Tuple<string, int, int>[N];
        for(int i = 0; i < N; i++)
        {
            string[] s = Console.ReadLine().Split(' ');
            tpl[i] = Tuple.Create(s[0], int.Parse(s[1]), i + 1);
        }
        var ans = tpl.OrderBy(x => x.Item1).ThenByDescending(x => x.Item2);
        foreach (var num in ans)
            Console.WriteLine(num.Item3);
    }
}


Measured memory_bytes: 13660
#include<bits/stdc++.h>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define ff(i, n) for (int i = 1; i <= n; i++)
#define F first
#define S second
#define vpii vector<pair<int,int> >
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back   
#define PB pop_back
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;

void solve(){
    int l, r, d, ans = 0;
    cin>>l>>r>>d;
    for(int i = l; i <= r; i++){
        if(i%d == 0)ans++;
    }
    cout<<ans;
}

int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N;
  cin >> N;
  vector<int> p(N);
  REP(i, N) cin >> p[i];
  vector<int> a(N);
  REP(i, N) a[i] = i*20000+1;
  vector<int> b(N);
  REP(i, N) b[i] = (N-i)*20000+1;
  int last = 0;
  REP(i, N) a[p[i]-1] += i;
  REP(i, N) cout << a[i] << (i!=N-1 ? " " : "");
  cout << "\n";
  REP(i, N) cout << b[i] << (i!=N-1 ? " " : "");
  cout << "\n";

}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x=0):x((x%mod+mod)%mod){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}
	
	// for prime mod
	mint inv() const {
		return pow(mod-2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res/=a;
	}
};

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	mint ans = 1;
	sort(all(a));
	bool ok = true;
	int p;
	if(n%2 == 0) {
		p = 1;
		rep(i, n) {
			if(a[i] != p) ok = false;
			if(i%2 == 1) p += 2;
		}
	} else {
		p = 0;
		rep(i, n) {
			if(a[i] != p) ok = false;
			if(i%2 == 0) p += 2;
		}
	}
	if(!ok) {
		cout << 0 << endl;
		return 0;
	}
	rep(i, (p-1)/2) {
		ans *= 2;
	}
	cout << ans.x << endl;
	return 0;
}

Measured memory_bytes: 640
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

#a = list(map(int, input().split()))

t1,t2 = list(map(int, input().split()))
a1,a2 = list(map(int, input().split()))
b1,b2 = list(map(int, input().split()))

d1 = a1*t1 - b1*t1
d2 = (a2-b2)*t2
#print(abs(d2)-abs(d1))

if(d1*d2>0 or abs(d1)>abs(d2)):
    print(0)
elif(abs(d1)==abs(d2)):
    print('infinity')
else:
    if(d1 % (abs(d2)-abs(d1)) == 0):
        print(2*(abs(d1) // (abs(d2)-abs(d1))))
    else:
        print(1 + 2*(abs(d1) // (abs(d2)-abs(d1))  ))
        


Measured memory_bytes: 40152
x, k, d = gets.chomp.split(' ').map(&:to_i)
if x.abs > k * d
  puts x.abs - (k * d)
else
  base = (x.abs / d).to_i
  if (k - base) % 2 == 0
    puts (x.abs - (base * d)).abs
  else
    puts d - (x.abs - (base * d)).abs
  end
end


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

int x, a, b;

int Abs(int x) {
	if (x > 0) return x;
	return -x;
}

int main() {
	cin >> x >> a >> b;
	if (Abs(x - a) < Abs(x - b)) cout << "A" << endl;
	else cout << "B" << endl;
	return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.Functor
import Data.List
import Data.Maybe

justMean :: Int -> Int -> Maybe Int
justMean a b
  | even d = Just $ a + div d 2
  | otherwise = Nothing
  where d = b - a

main = (\[a,b] -> justMean a b) . map read . words <$> getLine >>= putStrLn . maybe "IMPOSSIBLE" show 

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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x, y;
  cin >> x >> y;
  int ans = (max(0, 4 - x)) * 100000;
  ans += (max(0, 4 - y)) * 100000;
  if (x == 1 && y == 1) ans += 400000;
  cout << ans;
  return 0;
}


Measured memory_bytes: 3620
import math
def combinations_count(n, r):
  if n==0 or n==1:
    return 0
  else:
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m=list(map(int,input().split()))
print(combinations_count(n,2)+combinations_count(m,2))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=10,INF=1<<29;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    while(1){
        int Q;cin>>Q;
        ll diff=0;
        
        for(int i=0;i<Q;i++){
            ll a,c;
            char b;cin>>a>>b>>c;
            if(b=='('){
                diff+=c;
            }else{
                diff-=c;
            }
            
            if(diff==0) cout<<"Yes"<<endl;
            else cout<<"No"<<endl;
        }
        
        break;
    }
}



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


#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

#define X real()
#define Y imag()

using namespace std;
using namespace __gnu_pbds;

template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
using ll  = long long;

using point = complex<double>;


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


const double EPS = 1e-8;
const long long mod = 1e9+7;

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

const int N = 1e5 + 5;


int n ,a[N],k;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; ++i)
            cin >> a[i];
    int ans = INT_MAX;
    sort(a,a + n);
    for(int i = 0; i+k <= n; ++i){
        ans = min(ans,a[i + k - 1] - a[i]);
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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

int K,X;

int main(){
    cin>>K>>X;
    if(K*500>=X)out("Yes");
    else out("No");
    
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/04/04  Problem: ABC 044 B / Link: http://abc044.contest.atcoder.jp/tasks/abc044_b  ----- */


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

	string s; cin >> s;
	map<char, int>m;
	for (auto c : s) {
		m[c]++;
	}
	LL ans = 1;
	for (auto it : m) {
		ans &= it.second % 2 == 0;
	}

	auto print_yesno = [](LL yes, int mode = 0) {
		if (mode == 0) {
			cout << (yes ? "yes" : "no") << endl;
		}
		else if (mode == 1) {
			cout << (yes ? "Yes" : "No") << endl;
		}
		else if (mode == 2) {
			cout << (yes ? "YES" : "NO") << endl;
		}
		else assert(0);
	};
	print_yesno(ans,1);

	return 0;
}


Measured memory_bytes: 256
N = int(input())

A = [int(x) for x in input().split()]
num_c = 0
for i in range(0, N):
    minj = i
    for j in range(i, N):
        if A[j] < A[minj]:
            minj = j
    if(i != minj):
        A[i], A[minj] = A[minj], A[i]
        num_c += 1

print((" ").join(str(x) for x in A))
print(num_c)

Measured memory_bytes: 7752
# input
N = int(input())
A = []
append = A.append

for i in range(N):
    append(int(input()))

sort_A = sorted(A, reverse=True)[:2]

# check
for a in A:
    if a == sort_A[0]:
        print(sort_A[1])
    else:
        print(sort_A[0])

Measured memory_bytes: 13320
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, M, X, Y;
int A[110], B[110];

void solve() {
	cin >> N >> M >> X >> Y;
	rep(i, 0, N) cin >> A[i];
	rep(i, 0, M) cin >> B[i];
	for(int i = X + 1; i <= Y; i++) {
		bool ok = true;
		rep(j, 0, N) {
			if(A[j] >= i) ok = false;
		}
		rep(j, 0, M) {
			if(B[j] < i) ok = false;
		}
		if(ok) {
			cout << "No War\n";
			return;
		}
	}
	cout << "War\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <cmath>
#include <bitset>
#include <string>
#define REP(i,n) for(int i=0;i<n;i++)
using Int = long long;
using namespace std;
int main()
{
    Int x; cin >> x;
    Int cnt = 0;
    cnt += (x / 11) * 2;
    x = x % 11;
    if (x > 0) {
        cnt++;
        x -= 6;
    }
    if (x > 0) {
        cnt++;
        x -= 5;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define INF ((int) 1e9+1)

int main() {
    int N, W;
    cin >> N >> W;
    int w[N], v[N];
    for (int i=0; i<N; i++) 
        scanf("%d %d", w+i, v+i);
    
    int MAX_VALUE = 1000 * N +1;
    long long ans[N][MAX_VALUE];

    for (int p=0; p<MAX_VALUE; p++)
        ans[0][p] = p == v[0]? w[0] : INF;
    ans[0][0] = 0;

    for (int i=1; i<N; i++) {
        for (int j=0; j<MAX_VALUE; j++) {
            ans[i][j] = ans[i-1][j];

            if (j >= v[i])
                ans[i][j] = min (ans[i][j], ans[i-1][j-v[i]] + w[i]);
        }
    }

    for (int i=MAX_VALUE-1; i>=0; i--) {
        if (ans[N-1][i] <= W) {
            cout << i << endl;
            return 0;
        }
    }


    return 0;
}

Measured memory_bytes: 78336
/*
文字列の配列の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
 */
import java.util.*;
import java.awt.*;
import java.awt.geom.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        int n = sc.nextInt(),m=sc.nextInt();
        int[] a=new int[200001];
        int[] b=new int[200001];
        HashSet<Integer>[] via=new HashSet[200001];
        for (int i = 1; i <= 200000; i++) {
            via[i]=new HashSet<>();
        }
        for (int i = 0; i < m; i++) {
            a[i]=sc.nextInt();
            b[i]=sc.nextInt();
            via[a[i]].add(b[i]);
            via[b[i]].add(a[i]);
        }
        for (Integer k:via[1]){
            for (Integer l:via[k]){
                if(l==n){
                    out.println("POSSIBLE");
                    exit(0);
                }
            }
        }
        out.println("IMPOSSIBLE");
    }
}

Measured memory_bytes: 188828
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int a,b;cin>>a>>b;
    if(b%a==0){
        cout<<a+b<<endl;
    }else{
        cout<<b-a<<endl;
    }
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
using p = pair<int,int>;
using pp = pair<p,int>;
using ll = long long;
const auto INF =(ll)1e9;
int main(){
  int n,k;
  cin >> n >> k;
  auto h = vector<int>(n,0);
  for (int i = 0; i < n; i++)
  {
    cin >> h[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++)
  {
    if(h[i]>=k) ans++;
  }
  cout << ans;
  
  

  return 0;
}

Measured memory_bytes: 640
s = input()
t = input()
cnt = []
for i in range(len(s) - len(t) + 1):
    c = 0
    for j in range(len(t)):
        if s[i + j] == t[j]:
            c += 1
    cnt.append(c)
ans = len(t) - max(cnt)
print(ans)

Measured memory_bytes: 67772
using System;
using System.Linq;

namespace Five_Transportations
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int d = int.Parse(Console.ReadLine());
            int e = int.Parse(Console.ReadLine());

            var inputs = new int[] { a, b, c, d, e };
            var modZero = inputs.Where(i => i % 10 == 0).ToList();
            var modNotZero = inputs.Where(i => i % 10 != 0);
            modZero.AddRange(modNotZero.OrderBy(i => i % 10 * -1));
            inputs = modZero.ToArray();
            int orderTime = 0;
            for (int i = 0; i < 5; i++)
            {
                orderTime += inputs[i];
                if (inputs[i] % 10 != 0 && inputs.Length - 1 != i)
                {
                    orderTime += 10 - inputs[i] % 10;
                }
            }

            Console.WriteLine(orderTime);
        }
    }
}


Measured memory_bytes: 13396
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<Edge>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,CNT[61],ans=0,pow=1;
  cin>>N;
  REP(i,61) CNT[i]=0;
  REP(i,N){
    ll A,it=0;
    cin>>A;
    while(A>0){
      CNT[it]+=A%2;
      A/=2;
      it++;
    }
  }
  
  REP(i,61){
    ans+=(N-CNT[i])*CNT[i]%MOD*pow%MOD;
    ans%=MOD;
    pow*=2;
    pow%=MOD;
  }
  co(ans);
  return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>

int main(void){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a == b){
        if(b == c)puts("No");
        else puts("Yes");
    }else{
        if(b == c || a == c)puts("Yes");
        else puts("No");
    }
    return 0;
}


Measured memory_bytes: 128
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>

using namespace std;

int n;
double r;

struct point {
  double x, y;
} p[100005], o;

inline double sqr(double x) { return x * x; }

inline double dis(point a, point b) {
  return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y));
}

inline bool cmp(double a, double b) { return fabs(a - b) < 1e-8; }

point geto(point a, point b, point c) {
  double a1, a2, b1, b2, c1, c2;
  point ans;
  a1 = 2 * (b.x - a.x), b1 = 2 * (b.y - a.y),
  c1 = sqr(b.x) - sqr(a.x) + sqr(b.y) - sqr(a.y);
  a2 = 2 * (c.x - a.x), b2 = 2 * (c.y - a.y),
  c2 = sqr(c.x) - sqr(a.x) + sqr(c.y) - sqr(a.y);
  if (cmp(a1, 0)) {
    ans.y = c1 / b1;
    ans.x = (c2 - ans.y * b2) / a2;
  } else if (cmp(b1, 0)) {
    ans.x = c1 / a1;
    ans.y = (c2 - ans.x * a2) / b2;
  } else {
    ans.x = (c2 * b1 - c1 * b2) / (a2 * b1 - a1 * b2);
    ans.y = (c2 * a1 - c1 * a2) / (b2 * a1 - b1 * a2);
  }
  return ans;
}

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lf%lf", &p[i].x, &p[i].y);
  for (int i = 1; i <= n; i++) swap(p[rand() % n + 1], p[rand() % n + 1]);
  o = p[1];
  for (int i = 1; i <= n; i++) {
    if (dis(o, p[i]) < r || cmp(dis(o, p[i]), r)) continue;
    o.x = (p[i].x + p[1].x) / 2;
    o.y = (p[i].y + p[1].y) / 2;
    r = dis(p[i], p[1]) / 2;
    for (int j = 2; j < i; j++) {
      if (dis(o, p[j]) < r || cmp(dis(o, p[j]), r)) continue;
      o.x = (p[i].x + p[j].x) / 2;
      o.y = (p[i].y + p[j].y) / 2;
      r = dis(p[i], p[j]) / 2;
      for (int k = 1; k < j; k++) {
        if (dis(o, p[k]) < r || cmp(dis(o, p[k]), r)) continue;
        o = geto(p[i], p[j], p[k]);
        r = dis(o, p[i]);
      }
    }
  }
  printf("%.20lf\n", r);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
typedef long long LL;
const LL mod=1000000007;

int main(){
  string L;
  cin >> L;
  LL N=L.size();
  LL ans=0;
  LL dp[100010][2]={0};
  dp[0][0]=2; dp[0][1]=1;
  rep(i,N-1){
    if(L[i+1]=='0'){
      dp[i+1][0]=dp[i][0];
      dp[i+1][1]=dp[i][1]*3%mod;
    }
    else{
      dp[i+1][0]=dp[i][0]*2%mod;
      dp[i+1][1]=(dp[i][1]*3+dp[i][0])%mod;
    }
  }
  ans+=dp[N-1][0]+dp[N-1][1];
  cout << ans%mod << endl;

  return 0;
}


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

int main() {
  int N, M;
  cin >> N;
  for (int i = 1; i <= 10000; i++) {
    if (i * (i - 1) / 2 < N && N <= i * (i + 1) / 2) {
      M = i;
      break;
    }
  }
  for (int i = 1; i <= M; i++) {
    if (i != M * (M + 1) / 2 - N) {
      cout << i << endl;
    }
  }
}

Measured memory_bytes: 3616