akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,M,X,Y;
    cin >> N >> M >> X >> Y;
    int x[N],y[M];
    for(int i=0; i<N; i++){
        cin >> x[i];
    }
    for(int i=0; i<M; i++){
        cin >> y[i];
    }
    int flag;
    for(int Z=X+1; Z<=Y; Z++){
        flag = 1;
        for(int i=0; i<N; i++){
            if( x[i] < Z){
                flag = 1;
            }else{
                flag=0;
                break;
            }
            for(int i=0; i<M; i++){
                if( y[i] >= Z){
                    flag = 1;
                }else{
                    flag = 0;
                    break;
                }
            }
        }
        if(flag ==1){
            cout << "No War" << endl;
            return 0;
        }
    }
    cout << "War" << endl;
}




Measured memory_bytes: 256
N,T = gets.chomp.split(" ").map(&:to_i)
cts = readlines.map{|l| l.split.map(&:to_i)}
ans = []
cts.each do |c, t|
  if t <= T
    ans << c
    end
end

if ans == []
  puts "TLE"
else
  puts ans.min
end

Measured memory_bytes: 1788
#include <stdio.h>

int main(void) {
  unsigned int S,h,m,s;
  scanf("%d",&S);
  h = S / 3600;
  m = (S % 3600) / 60;
  s = (S % 3600) % 60;
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64

int getSum(int n){
  int res = 0;
  string s = to_string(n);
  for(auto &&si: s){
    res += si-'0';
  }
  return res;
}

signed main() {
  int n; cin>>n;

  int ans = 1LL<<30;
  for(int i=1;i<=(n/2)+1;++i){
    ans = min(ans, getSum(i) + getSum(n-i));
  }
  cout<<ans<<endl;
  return 0;
}

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

using namespace std;

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

    int n;
    cin >> n;
    vector<double> as(n);
    for (int i = 0; i < n; i++) {
        cin >> as[i];
    }
    sort(as.rbegin(), as.rend());
    while (as.size() > 1) {
        double a = as.back();
        as.pop_back();
        double b = as.back();
        as.back() = (a + b) / 2; 
    }
    printf("%.10f\n", as.back());
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n,i;
	scanf("%d",&n);
	int a[100];
	for(i = 0;i < n;i++)
			{scanf("%d",&a[i]);
			}
	for(i = n - 1;i > -1;i--){
		if( i == n - 1 ){} else{printf(" ");}
		 printf("%d", a[i]);
	}
	printf("\n");
	return 0;
}



Measured memory_bytes: 2056
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

bool dcl(P a, P b){
    return a.first - a.second < b.first - b.second;
}

int main(){
    ll N; cin >> N;
    vector<P> seq(N);
    bool e = true;
    ll sm = 0;
    ll mn = 10000000000000;
    rep(i, 0, N){
        ll a, b; cin >> a >> b;
        if(a != b){
            e = false;
        }
        if(a > b){
            mn = min(mn, b);
        }
        seq[i] = mp(a, b);
        sm += a;
    }
    if(e){
        prtl(0);
        return 0;
    }
    prtl(sm - mn);
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=2e5+10;
int f[1<<26],d[N];
char s[N];
int main(){
	memset(f,0x3f,sizeof f);
	scanf("%s",s);
	int ns=0,t;f[ns]=0;
	for (int i=0;s[i];++i){
		ns^=1<<(s[i]-'a');
		t=f[ns]+1;
		for (int j=0;j<26;++j) t=min(t,f[ns^(1<<j)]+1);
		f[ns]=min(f[ns],t);
	}
	printf("%d",t);
	return 0;
}

Measured memory_bytes: 262528
from collections import defaultdict
from sys import stdin, stdout

input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    N, M = map(int, input().split())
    A = tuple(map(int, input().split()))

    sum_ = [0] * (N + 1)
    for i in range(N):
        sum_[i+1] = (sum_[i] + A[i]) % M

    ans = 0
    mod = defaultdict(int)
    for i in range(N + 1):
        ans += mod[sum_[i]]
        mod[sum_[i]] += 1

    print(ans)

main()


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

int main() {
	int n; cin >> n;
	vector<long double>a(n); for (auto&& x : a)cin >> x;

	long double ans = 0;
	for (int i = 0; i < n; i++) {
		ans += 1 / a[i];
	}
	ans = 1 / ans;
	cout << ans << endl;
	
	return 0;
}

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

#define ll long long
#define ar array
#define vi vector<int>
#define INF 1000000000


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int N; cin >> N;
	ll nums[N+10];
	for(int i=0; i < N; i++){
		ll n; cin >> n;
		nums[i] = n;
	}

	for(int i=0; i<N; i++){
		if(nums[i] == 0){
			cout << 0 << endl;
			return 0;
		}
	}	

	unsigned ll limit = 1000000000000000000ULL; 
	unsigned ll product = 1;	
	
	for(int i=0; i<N; i++){
		if(nums[i] <= limit/product){
			product *= nums[i];
		}
		else{
			cout << -1 << endl;
			return 0;
		}
	}	

	cout << product << endl;

	return 0;
}


Measured memory_bytes: 4416
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  int n;
  cin >> n;

  int abc[n][3];
  for (int i = 0; i < n; i++) {
    cin >> abc[i][0] >> abc[i][1] >> abc[i][2];
  }

  ll dp[n + 10][3] = {};

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if(j == k) continue;
        dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + abc[i][k]);
      }
    }
  }

  ll ans = 0;
  for (int i = 0; i < 3; i++) {
    ans = max(ans, dp[n][i]);
  }

  cout << ans << endl;

  return 0;
}

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

class ModularExponentiation
{
    unsigned long long ans;                    // Answer
public:
    unsigned long long compME(unsigned long long, unsigned long long, unsigned long long);  // Compute Modular Exponentiation
};

/*
 * Compute Modular Exponentiation
 */
unsigned long long ModularExponentiation::compME(unsigned long long b, unsigned long long e, unsigned long long m)
{
    if (e == 0) return 1;

    ans = compME(b, e / 2, m);
    ans = (ans * ans) % m;
    if (e % 2 == 1) ans = (ans * b) % m;

    return ans;
}

int main(){
  unsigned long long M = 998244353;
  int N;
  cin >> N;
  
  vector<pair<int, int>> D(N);
  for (int i = 0; i < N; i++) {
    cin >> D.at(i).first;
    D.at(i).second = i;
  }
  
  sort(D.begin(), D.end());
  
  vector<unsigned long long> cnt;
  unsigned long long ans = 1;
  int j = 0;
  unsigned long long tmp = 0, old = 1;
  
  for (int i = 0; i < N; i++) {
    
    if (D.at(i).first == 0 && D.at(i).second != 0) {
      cout << 0;
      return 0;
    }
    
    if (j == 0 && tmp > 1) {
      cout << 0;
      return 0;
    }
    
    if (D.at(i).first == j) tmp++;
    else {
      if (tmp == 0) {
        cout << 0;
        return 0;
      }
      
      // Instantiation
      ModularExponentiation objMain;

      // Compute Modular Exponentiation
      long long b = objMain.compME(old, tmp, M);
      
      /*unsigned long long b = 1;
      for (int k = 0; k < tmp; k++)
        b *= old % M;
      */
      cnt.push_back(b);
      old = tmp;
      tmp = 1;
      j++;
      if (j != D.at(i).first) {
        cout << 0;
        return 0;
      }
    }
    
    if (i == N - 1) {
      // Instantiation
      ModularExponentiation objMain;

      // Compute Modular Exponentiation
      long long b = objMain.compME(old, tmp, M);
      
      /*unsigned long long b = 1;
      for (int k = 0; k < tmp; k++)
        b *= old % M;
      */
      cnt.push_back(b);
      /*long long b = (long long)fmodl(pow(old, 2) , M);
      if (tmp % 2 == 0) 
        cnt.push_back((long long)fmodl(pow(b, tmp/2), M));
      else
        cnt.push_back((old % M) * (long long)fmodl(fmodl(pow(b, tmp / 2) , M ) ,M));
      */
    }
    
  }
  
  for (auto itr = cnt.begin(); itr != cnt.end(); itr++) {
    ans *= *itr;
    ans = ans % M;
  }
  
  cout << ans % M;
  return 0;
}



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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A, B; cin >> A >> B;
  cout  << A*B << endl;
}

Measured memory_bytes: 3612
/*
 * atcoder/abc167/d.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

/*
 * Kをシミュレートすると明らかにTLE
 * ただNが200000だから周期はこれより短いはず. 周期を見つければMODの問題に帰着できる.
 *
 * 短い周期が無ければmodN + 1が答え
 * 途中でループする場合
 */
ll N, K;
vector<ll> A;
vector<int> done;
void solve() {
  cin >> N >> K;
  A.resize(N+1);
  done.assign(N+1, -1);
  loop(n,1,N+1) cin >> A[n];
  ll pos = 1;
  done[pos] = 0;
  ll b_l = 0, in_l = 0;
  loop(n,1,N+1) {
    pos = A[pos];
    if (done[pos] >= 0) {
      b_l = done[pos];
      in_l = n - done[pos];
      break;
    }
    done[pos] = n;
  }

  if (K < b_l) {
    pos = 1;
    loop(n,0,K) {
      pos = A[pos];
    }
    cout << pos << endl;
    return;
  }
  K -= b_l;
  K %= in_l;
  K += b_l;
  pos = 1;
  loop(n,0,K) {
    pos = A[pos];
  }
  // cout << in_l << " " << b_l << " " << pos << endl;
  cout << pos << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


Measured memory_bytes: 5584
#define _CRT_SECURE_NO_WARNINGS
#define forn(i, a, n) for(int i = a; i < n; ++i)
#define pb push_back
#define mp make_pair
//#define f first
//#define sex second

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <set>
#include <ostream>
#include <queue>
#include <functional>
#include <sstream>
#include <map>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
#pragma comment(linker, "/STACK:228228000")
const ll mod = 9982443530;

ll n, k, res = 228228228;


int main()
{
	/*

	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	*/


	cin >> n >> k;
	forn(i, 0, n)
	{
		ll a;
		cin >> a;
		if (a == 1)
		{
			forn(j, 0, k)
			{
				if((i - j) >= 0 && (n - i - k + j) >= 0)
				res = min((i - j) / (k - 1) + ((i - j) % (k - 1) > 0) 
					+ (n - i - k + j) / (k - 1)
					+ ((n - i - k + j) % (k - 1) > 0) + 1, res);
			}
		}
	}
	
	cout << res;
	//cin >> res;
	return 0;
}


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

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

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

int main() {
    ll N;
    cin >> N;
    vector<ll> L(N),R(N),A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    L[0]=A[0];
    R[N-1]=A[N-1];
    for(int i=1;i<N;i++){
        L[i]=euclidean_gcd(L[i-1],A[i]);
    }
    for(int i=N-2;i>=0;i--){
        R[i]=euclidean_gcd(R[i+1],A[i]);
    }
    ll ma=max(L[N-2],R[1]);
    for(int i=1;i<N-1;i++){
        ma=max(ma,euclidean_gcd(L[i-1],R[i+1]));
    }
    cout << ma << endl;

    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int isSqure(int x);
int main()
{
    int a,b,c;
    cin>>a>>b;
    stringstream ss1,ss2,ss3;
    string m,n,s;

    ss1<<a;
    ss1>>m;
    ss2<<b;
    ss2>>n;

    s = m+n;
    ss3<<s;
    ss3>>c;


    if(isSqure(c) == 1)
        cout<<"Yes"<<endl;
    else if(isSqure(c) == 0)
        cout<<"No"<<endl;

    return 0;
}

int isSqure(int x)
{
    for(int i=1; i*i <=x; i++){
        if( (x %i ==0) && (x/i == i) ){
            return 1;
        }
    }
    return 0;
}



Measured memory_bytes: 3580
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<string>
#include<queue>
#include<bitset>
#include<stack>
#include<vector>
#include<set>
#include<map>
using namespace std;
namespace mine
{
	typedef long long ll;
	#define pr pair<int,int>
	#define FR first
	#define SE second
	#define MP make_pair
	#define vc vector
	#define PB push_back
	#define bin(x) (1ll<<(x))
	#define sz(x) ((int)x.size())
	#define all(x) x.begin(),x.end()
	#define fo(i,a,b) for(register int i=(a);i<=(b);i++)
	#define fd(i,a,b) for(register int i=(a);i>=(b);i--)
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(int num)
	{
		if(num<0) putchar('-'),num=-num;
		if(num>=10) write(num/10);putchar('0'+num%10);
	}
	void write1(int num){write(num);putchar(' ');}
	void write2(int num){write(num);putchar('\n');}
	template<typename T> void chmin(T &a,const T b){a=(a<b?a:b);}
	template<typename T> void chmax(T &a,const T b){a=(a>b?a:b);}
	const int N=1e3+10;
	ll qpower(ll x,ll e,ll mod)
	{
		int ans=1;x%=mod;
		while(e)
		{
			if(e&1) ans=ans*x%mod;
			x=x*x%mod;e>>=1;
		}return ans;
	}
	
	int n;vc<int> to[N];
	double f[N],g[N];
	double solve(double g[],int banx,int bany)
	{
		memset(g,0,sizeof f);
		fd(x,n-1,1) for(auto y:to[x]) if(x!=banx or y!=bany) g[x]+=(g[y]+1)/(sz(to[x])-(banx==x));
		return g[1]==0?1e18:g[1];
	}
	bool cmp(int a,int b){return f[a]>f[b];}
	void main()
	{
		n=qread();int m=qread();
		while(m--){int x=qread(),y=qread();to[x].PB(y);}
		double ans=solve(f,0,0);
		fo(x,1,n) if(sz(to[x])>1)
		{
			sort(all(to[x]),cmp);
			chmin(ans, solve(g,x,to[x][0]) );
		}printf("%lf",ans);
	}
};
int main()
{
	srand(time(0));
	mine::main();
}

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL<<60;

typedef pair<ll,ll> Pair;

int main(){

string S,T;
bool flg = true;

cin >> S >> T;

for(ll i = 0;i <S.length();++i)    if(S[i] != T[i]) flg = false; 

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



return 0;

}

Measured memory_bytes: 3628
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((uint64_t *)a) < *((uint64_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

static uint64_t A[100000];
static uint64_t As[100000];

int main(void) {
	uint64_t N;

	scanf("%"PRIu64"\n", &N);
	for (uint64_t idx = 0; idx < N; idx++) {
		scanf("%"PRIu64, &A[idx]);
		if (idx < N - 1) {
			scanf("\n");
		}
	}

	qsort(A, (size_t)N, sizeof(uint64_t), compare_f);

	As[0] = A[N / 2 - 1];
	As[N - 1] = A[N / 2];

	for (uint64_t idx = 1; idx < N - 1; idx++) {
		if (idx % 2 == 0) {
			As[idx] = A[idx / 2 - 1];
		}
		else {
			As[idx] = A[N - 1 - idx / 2];
		}
	}

	uint64_t sumMax = 0;
	for (uint64_t idx = 0; idx < N - 1; idx++) {
		sumMax += ABSS(As[idx], As[idx + 1]);
	}

	{
		As[0] = A[(N - 1) / 2];
		As[N - 1] = A[(N + 1) / 2];

		for (uint64_t idx = 1; idx < N - 1; idx++) {
			if (idx % 2 == 0) {
				As[idx] = A[N - 1 - (idx - 1) / 2];
			}
			else {
				As[idx] = A[idx / 2];
			}
		}

		uint64_t sum = 0;
		for (uint64_t idx = 0; idx < N - 1; idx++) {
			sum += ABSS(As[idx], As[idx + 1]);
		}

		if (sumMax < sum) {
			sumMax = sum;
		}
	}

	printf("%"PRIu64, sumMax);

	return 0;
}


Measured memory_bytes: 1788
//#include <bits/stdc++.h>                                                                                                                     
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }


int
main(void){
  int n, l;
  string s[n];
  cin >> n >> l;

  int v[n] = {};

  REP(i, n) cin >> s[i];

  SORT(s, n);

  REP(i, n) cout << s[i];

  cout << endl;
 
 return 0;
}

Measured memory_bytes: 256
//( ͡° ͜ʖ ͡°) °º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤º°` looking at my code...

#define ONLINE_JUDGE //in case i forget to uncomment this, sometimes the grader defines the macro ^.^
#ifdef ONLINE_JUDGE
#include <bits/stdc++.h>
#else
#include "stdc++.h"
#endif
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define INF  (int)1e9

#define int long long
using namespace std;

signed main() {
#ifndef ONLINE_JUDGE
    freopen("/Users/kdkdk/Desktop/input.txt", "r", stdin);
    //freopen("/Users/kdkdk/Desktop/output.txt", "w", stdout);
#endif
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;
    vector<pair<int,int> > bridges (m);
    for(int i = 0; i < m; ++i) cin >> bridges[i].first >> bridges[i].second;
    unordered_map<int, bool> possible;
    for(int i = 0; i < m; ++i) if(bridges[i].second == n) possible[bridges[i].first] = true;
    bool totPossible = false;
    for(int i = 0; i < m && !totPossible; ++i) if(bridges[i].first == 1) if(possible.count(bridges[i].second) > 0 && possible[bridges[i].second]) totPossible = true;
    cout << (totPossible ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return 0;
}






Measured memory_bytes: 7460
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const int d5 = 114514;
const double EPS = 1e-10;
const double INF = 1e+10;
const double PI = acos(-1.0);
signed main(){
    long long s,c;
    cin>>s>>c;
    long long res = 0;
    if(s*2<=c){
        c-=2*s;
        res+=s;
        res+=c/4;
    }
    else res=c/2;
    cout<<res<<endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) = println(run {
    val (d,n) = readLine()!!.split(" ").map { it.toInt() }

    when (n) {
        100 -> {
            when (d){
                1 -> 10100
                2 -> 1010000
                else -> 101
            }
        }
        else -> {
            when (d) {
                1 -> 100*n
                2 -> 10000*n
                else -> n
            }
        }
    }

})


Measured memory_bytes: 37932
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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

int h, w;
char board[51][51];
int dist[51][51];
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, -1, 0, 1};
int sx = 0, sy = 0;

int bfs() {
    queue<P> que;
    rep(i, h) rep(j, w) dist[i][j] = -1;
    int gy = h - 1, gx = w - 1;
    que.push(P(sx, sy));
    dist[sx][sy] = 0;
    while(!que.empty()) {
        P p = que.front(); que.pop();
        if(p.first == gx && p.second == gy) break;

        rep(i, 4) {
            int ny = p.first + dy[i];
            int nx = p.second + dx[i];
            if(0 <= ny && ny < h && 0 <= nx && nx < w && board[ny][nx] == '.' && dist[ny][nx] == -1) {
                dist[ny][nx] = dist[p.first][p.second] + 1;
                que.push(P(ny, nx));
            }
        }
    }
    return dist[gy][gx];
}

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

    cin >> h >> w;
    int cnt = 0;
    rep(i, h) rep(j, w) {
        cin >> board[i][j];
        if(board[i][j] == '.') cnt++;
    }

    int rel = bfs();
    if(rel == -1) cout << -1 << endl;
    else cout << cnt - rel - 1 << endl;
    return 0;
}


Measured memory_bytes: 256
a, b = map(int, input().split())
c = [0] * b
for i in range(a):
    d = list(map(int, input().split()))
    for j in range(1, d[0]+1):
        c[d[j]-1] += 1
e = 0
for i in range(b):
    if c[i] == a:
        e += 1
print(e)


Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000
#define MAX 200001

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const ll MOD = 1000000007;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

int main(){
    int N, H, W;
    cin >> N >> H >> W;
    int ans = 0;
    rep(i,N){
        int a,b;
        cin >> a >> b;
        if(a >= H && b >= W) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
N = int(input())
A = list(map(int, input().split()))

sunuke = A[0]
araiguma = sum(A[1:])
res = abs(sunuke - araiguma)
for i in range(1, N - 1):
    sunuke += A[i]
    araiguma -= A[i]
    res = min(res, abs(sunuke - araiguma))
print(res)


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

int main(){
    int A, B, K;
    cin >> A >> B >> K;
    //K番目に大きいものを求める
    vector<int> ans(100);
    int x = 0;
    for(int i = 100;i >= 1; i--){
        if(A % i == 0 && B % i == 0){
            ans[x] = i;
            x++;
        }
    }
    K--;
    cout<<ans[K]<<endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

ll h,w;
char a[111][111];
int cnt[33];
ll t1,t2;

int main(){
  cin>>h>>w;
  rep(i,h){
    cin>>a[i];
  }
  ll cnt1=0,cnt2=0;
  t1=h,t2=w;
  if(h%2==1&&w%2==1){
    cnt1++;
  }
  if(h%2!=0){
    cnt2+=w/2;
    h--;
  }
  if(w%2!=0){
    cnt2+=h/2;
    w--;
  }
  h=t1,w=t2;
  rep(i,h)rep(j,w){
    cnt[a[i][j]-'a']++;
  }
  rep(i,26){
    cnt[i]%=4;
    //dbg(cnt[i]);
    if(cnt[i]==1||cnt[i]==3){
      if(cnt1>0)cnt1--;
      else{
        cout<<"No"<<endl;
        return 0;
      }
    }
    if(cnt[i]==2){
      if(cnt2>0)cnt2--;
      else{
        cout<<"No"<<endl;
        return 0;
      }
    }
  }
  cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

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

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 998244353; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

const int N = 3001;
int dp[N] = {};

inline int binpow (int a, int n) {
    int ans = 1;
    for (; n; n >>= 1) {
        if (n & 1) {
            ans = ((ll)ans * a) % MOD;
        }
        a = ((ll)a * a) % MOD;
    }
    return ans;
}
inline int inv (int x) {
    return binpow(x, MOD - 2);
}

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, s;
    cin >> n >> s;
    vector <int> a(n);
    for (auto &i : a) cin >> i;
    int ans = 0;
    dp[0] = binpow(2, n);
    for (int i = 0; i < n; i++) {
        for (int j = s; j >= a[i]; j--) {
            dp[j] = (dp[j] + (ll)dp[j - a[i]] * inv(2)) % MOD;
        }
    }
    cout << dp[s] << '\n';
}


Measured memory_bytes: 3664
import numpy as np

def judge(c,s_g):

    start=s_g[0]
    goal=s_g[1]
    second=-2
    third=-7

    for i in range(6):
        if c[i]==start:
            c[i]=-1
            if i%2==0:
                second=c[i+1]
                c[i+1]=-1
            else:
                second=c[i-1]
                c[i-1]=-1
            break
    else:
        print("No")
        return 0

    for i in range(6):
        if c[i]==second:
            c[i]=-1
            if i%2==0:
                third=c[i+1]
                c[i+1]=-1
            else:
                third=c[i-1]
                c[i-1]=-1
            break
    else:
        print("No")
        return 0
            
    for i in range(6):
        if c[i]==third:
            if i%2==0:
                if c[i+1]==goal:
                    print("YES")
                    return 0
                else:
                    print("NO")
                    return 0
            else:
                if c[i-1]==goal:
                    print("YES")
                    return 0
                else:
                    print("NO")
                    return 0
            break
    else:
        print("NO")
        return 0
                
    if second==-2 or third==-7:
        print("NO")
        return 0

a=np.zeros(3)
b=np.zeros(3)
c=np.zeros(6)
for i in range(3):
    s,t=list(map(int,input().split()))
    a[i]=s
    b[i]=t
    c[2*i]=s
    c[2*i+1]=t
    
s_g=[]
for i in range(1,5):
    if np.sum(c==i)==1:
        index=np.where(c==i)
        s_g.append(i) 
i=judge(c,s_g)

Measured memory_bytes: 21156
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline
import time


_, = map(int,readline().split())
D = 365
*c, = map(int,readline().split())
s = tuple(tuple(map(int,readline().split())) for _ in range(D))

def output(ans):
    for i in ans: print(i+1)

def score(ans,s,c): # ans: 0-indexed としたときのスコアの計算
    last = [-1]*26
    score = 0
    for i, ai in enumerate(ans):
        score += s[i][ai]
        last[ai] = i
        for ci,li in zip(c,last):
            score -= ci*(i-li)
        #print(score) # i日目のスコア
    return score


#ans = [max(range(26),key=lambda x: si[x]) for si in s]
#ans = (list(range(26))*20)[:365]

def first_solution(s,c):
    minus = c[:]
    ans = [0]*365
    for i, si in enumerate(s):
        ans[i] = idx = max(range(26), key=lambda x:si[x]+minus[x])
        for i in range(26):
            minus[i] += c[i]
        minus[idx] = 0
    return ans        


"""
solution = 初期解(ランダム生成や、貪欲法など他の手法で求めたものを利用)
while 時間のある限り:
    solution を(ランダムに)少し変形
    if 変形前より解が悪化:
        solution を変形前の状態に戻す
"""


from bisect import bisect_left, bisect_right
"""
i 日目と i+1 日目を入れ替え
"""
def swap(i,ans,days,c,s):
    j = i+1
    ai = ans[i]
    aj = ans[j]
    di = days[ai]
    dj = days[aj]
    idx_i = bisect_left(di,-i)
    idx_j = bisect_left(dj,-j)
    
    #print(di,i,idx_i,ai)
    #print(dj,j,idx_j,aj)
    #assert di[idx_i] == -i and dj[idx_j] == -j 
    
    i_prev = -di[idx_i - 1]
    i_next = -di[idx_i + 1] if di[-1] != -i else -1

    j_prev = -dj[idx_j - 1]
    j_next = -dj[idx_j + 1] if dj[-1] != -j else -1

    delta_i = -c[ai]*(2*i-i_prev-i_next) + s[j][ai] - s[i][ai]
    delta_j = -c[aj]*(j_prev+j_next-2*i) - s[j][aj] + s[i][aj]
    #delta = delta_i + delta_j

    return delta_i + delta_j,idx_i,idx_j


def main(ans,s,c):
    from random import randrange
    start = time.time()
    days = [[-365] for _ in range(26)]
    for i in range(364,-1,-1):
        days[ans[i]].append(-i)

    while time.time() - start < 0.5:
        i = randrange(364)
        if ans[i] != ans[i+1]:
            delta,idx_i,idx_j = swap(i,ans,days,c,s)
            if delta > 0:
                days[ans[i]][idx_i] -= 1
                days[ans[i+1]][idx_j] += 1
                ans[i],ans[i+1] = ans[i+1],ans[i]

        

    return ans

#print(score(ans,s,c))
output(main(first_solution(s,c),s,c))







Measured memory_bytes: 10028
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<cstdlib>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
#include<cmath>
#include<string>
#include<bitset>
#define lmid l,mid,rt<<1
#define rmid mid+1,r,rt<<1|1
#define ll long long
using namespace std;
char s[5][5];
int main()
{
     for(int i=0;i<2;i++)
          scanf("%s",s[i]);
     if(s[0][0]==s[1][2]&&s[0][1]==s[1][1]&&s[0][2]==s[1][0])printf("YES\n");
     else printf("NO\n");
     return 0;
}


Measured memory_bytes: 256
N = int(input())
hotel = list(map(int, input().split()))
count = 0
c = 0
for i in range(1, N):
    c=0
    for j in range(0, i):
        
        if hotel[i] >= hotel[j]:
            c += 1
        if c == i:
            count += 1
print(count+1)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

// a %*% b
vector<vector<ll>> prod(vector<vector<ll>> a, vector<vector<ll>> b){
    ll n = a.size();
    vector<vector<ll>> res(n,vector<ll>(n));

    rep(i,n) rep(j,n) rep(k,n){
        (res[i][j] += (a[i][k] * b[k][j]) % MOD) %= MOD;
    }

    return res;
}

// a^k
vector<vector<ll>> f(vector<vector<ll>> a, ll k){
    ll n = a.size();
    vector<vector<ll>> res(n,vector<ll>(n));
    rep(i,n) res[i][i] = 1; // a^0 = I

    while(k > 0){
        if(k & 1){
            res = prod(res,a);
        }
        a = prod(a,a);
        k >>= 1;
    }

    return res;
}

void mainsolve(){

    ll n,k;
    cin >> n >> k;
    vector<vector<ll>> a(n,vector<ll>(n));
    rep(i,n) rep(j,n) cin >> a[i][j];

    vector<vector<ll>> b = f(a,k);

    ll res = 0;
    rep(i,n) rep(j,n) (res += b[i][j]) %= MOD;

    cout << res << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <vector>
using namespace std;
typedef long long LL;

int main(){
	LL a,b,ans;
	cin >> a >> b;
	if(a > b) swap(a,b);
	if(a == 1) cout << 1 << endl;
	else cout << ((a * b + 1LL) >> 1) << endl;
	return 0;
}

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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  int h;
  while(cin>>h,h){
    int num[h][5]={};
    for(int i=0;i<h;i++)
      for(int j=0;j<5;j++)
	cin>>num[i][j];
    int ans=0;
    while(1){
      bool flag=true;
      vector<pair<pair<int,int>,int> >kesi;
      for(int i=0;i<h;i++){
	int cnt=1;
	pair<int,int> doko=mp(INF,0);
	for(int j=0;j<4;j++){
	  if(num[i][j]!=0&&num[i][j]==num[i][j+1]){
	    if(doko.S==0)
	      doko=mp(min(doko.F,j),num[i][j]);
	    
	      cnt++;
	  }else{
	    if(cnt>=3){
	      flag=false;
	      kesi.pb(mp(mp(doko.F,doko.F+cnt-1),i));
	      ans+=cnt*doko.S;
	      //   cout<<ans<<endl;
	    }
	    doko=mp(INF,0);
	    cnt=1;
	  }
	}
	if(cnt>=3){
	  flag=false;
	  kesi.pb(mp(mp(doko.F,doko.F+cnt-1),i));
	  ans+=cnt*doko.S;
	  // cout<<cnt<<" "<<doko.S<<" "<<ans<<endl;
	}
      }
      if(flag)break;
      for(int i=kesi.size()-1;i>=0;i--){
	  for(int k=kesi[i].F.F;k<=kesi[i].F.S;k++){
	    num[kesi[i].S][k]=0;
	  }
	}
      

      for(int i=h-1;i>=0;i--){
	for(int j=0;j<5;j++){
	  int hei=i;
	  while(num[hei][j]==0&&hei>0){
	    hei--;
	  }
	  if(num[i][j]==0){
	  num[i][j]=num[hei][j];
	  num[hei][j]=0;
	  }
	}
      }
  
    }
    cout<<ans<<endl;
  }
  return 0;
}



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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define REP(k, n) for (ll k = 0; k < (ll)(n); ++k)
#define REPREV(k, n) for (ll k = (ll)(n)-1; k >= 0; --k)
#define FOR(k, a, b) for (ll k = (ll)(a); k < (ll)(b); ++k)
#define FORREV(k, a, b) for (ll k = (ll)(b)-1; k >= (ll)(a); --k)
#define FOREACH(e, v) for (auto e : v)

#define TGET(t, i) get<i>(t)
#define TSET(t, i, a) get<i>(t) = a
// MinHeap - priority_queue<ll, vll, greater<ll>> pq;

#define EVEN(n) ((n)&1) == 0
#define ODD(n) ((n)&1) == 1
#define MOD(x, m) ((x) % (m) + (m)) % (m)

#define SORT(v) sort(v.begin(), v.end())
#define SORTREV(v) sort(v.rbegin(), v.rend())
#define SHUFFLE(v) random_shuffle(v.begin(), v.end())
//srand(unsigned(time(0)));

#define REMOVEAT(v, i) v.erase(v.begin() + i)
#define REVERSE(v) reverse(v.begin(), v.end())

template <typename T>
void join(vector<T>& arr, string sep) {
    bool first = true;
    for (auto t : arr) {
        if (first) {
            first = false;
            cout << t;
        } else {
            cout << sep << t;
        }
    }
    cout << "\n";
}

#define POS "POSSIBLE"
#define IMPOS "IMPOSSIBLE"

// #define INF LLONG_MAX
// #define MINF LLONG_MIN
#define INF 9e18
#define MINF -INF

deque<int> divisors(int n) {
    deque<int> res;
    for (int i = sqrt(n); i > 1; i--) {
        if (n % i == 0) {
            int j = n / i;
            res.push_front(i);
            if (j != i) {
                res.push_back(j);
            }
        }
    }
    return res;
}

void solve() {
    ll n;
    cin >> n;
    vll a(n);
    map<ll, ll> s;
    bool one = false;
    REP(i, n){ 
        ll a;
        cin >> a;
        if (a == 1) {
            one = true;
        }
        s[a]++;
    }
    ll res = 0;
    FOREACH(kv, s) {
        ll a = kv.first;
        ll c = kv.second;
        if (a == 0) {
            res++;
            continue;
        }
        if (c > 1)
            continue;
        if (a == 1) {
            res++;
            continue;
        }
        if (one) {
            continue;
        }
        auto div = divisors(a);
        bool found = false;
        FOREACH(d, div) {
            if (s.count(d)) {
                found = true;
                break;
            }
        }
        if (!found)
            res++;
    }
    cout << res << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt = 1;
    // cin >> tt;
    for (int t = 1; t <= tt; t++) {
        // cout << "Case #" << t << ": ";
        solve();
    }

    return 0;
}

Measured memory_bytes: 17160
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, 500001), 500000)
	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

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	s:=getNextString(scanner)
	n:=len(s)
	ans:=0
	for i := 0; i < n/2; i++ {
		if s[i] == s[n-1-i]{
			continue
		}
		ans++
	}

	fmt.Fprintln(writer, ans)
	writer.Flush()
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

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

  int left = 0;
  int right = 0;
  int idx = 0;
  while (true) {
    if (S[idx] == '(') left++;
    else right++;

    if (right > left) {
      right = 0;
      left = 0;
      idx = 0;
      S = '(' + S;
      continue;
    }


    if (idx == S.length() - 1) {
      rep(i, left-right) {
        S = S + ')';
      }
      break;
    }

    idx++;
  }


  cout << S << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
hs = list(map(int, input().split()))

dp = [0]*(n+1)

for i in range(n):
    if i == 0:
        continue
    prev_abs = abs(hs[i] - hs[i-1])
    if i == 1:
        dp[i] = prev_abs
    else:
        dp[i] = min(dp[i-2] + abs(hs[i] - hs[i-2]), dp[i-1] + prev_abs)

print(dp[n-1])

Measured memory_bytes: 20652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    //
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    //
    int num=1;
    for(int j=0;j<N;j++){
        if(a[j]==num){
            num++;
        }
    }
    int ans;
    ans = N - num + 1;
    if(ans==N){
        ans =  -1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3968
import math

n=int(input())
num=[2,3]
for j in range(4,1000):
  for i in range(2,int(math.sqrt(j)+1)):
    if j%i==0:
      break
  else:
    num.append(j)

l=len(num)
times=[]
for ii in range(l):
  if num[ii]>n:
    break
  else:
    for jj in range(11):
      max=0
      count=0
      if num[ii]**jj>n:
        max=jj
    for k in range(1,max):
      count+=n//num[ii]**k
    times.append(count)
ans=1

for kk in range(len(times)):
  ans*=times[kk]+1
print(ans%1000000007)

Measured memory_bytes: 3064
#pragma once

#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;

#define rep(a,n) for(int a = 0;a < n;a++)
#define repi(a,b,n) for(int a = b;a < n;a++)

const ll mod = 1000000007;

ll mpow(ll x, ll n) {
	ll ans = 1; x %= mod;
	while (n != 0) {
		if (n & 1) ans = ans * x % mod;
		x = x * x % mod;
		n = n >> 1;
	}
	return ans;
}

ll inv_mod(ll a) { return mpow(a, mod - 2); }

class Factorial {
private:
	vector<ll> fac;
	vector<ll> ifac;
public:

	Factorial(ll N) {
		fac.push_back(1);
		for (int i = 0; i < N; i++) fac.push_back(fac[i] * (i + 1) % mod);
		ifac.resize(N + 1);
		ifac[N] = inv_mod(fac[N]);
		for (int i = 0; i < N; i++) ifac[N - 1 - i] = (ifac[N - i] * (N - i)) % mod;
	}

	ll fact(ll a) { return fac[a]; }
	ll ifact(ll a) { return ifac[a]; }

	ll cmb(ll a, ll b) {
		if (a == 0 && b == 0) return 1;
		if (a < b || a < 0 || b < 0) return 0;
		ll tmp = ifact(a - b) * ifact(b) % mod;
		return tmp * fac[a] % mod;
	}
	ll per(ll a, ll b) {
		if (a == 0 && b == 0) return 1;
		if (a < b || a < 0 || b < 0) return 0;
		return fac[a] * ifac[a - b] % mod;
	}
};

int main(void)
{
	ll n, m, k;
	cin >> n >> m >> k;
	Factorial f(n * m);
	ll sum = 0;
	//x
	{
		ll xSum = 0;
		rep(i, m) {
			(xSum += ((m - i) * i) % mod) %= mod;
		}
		ll n2 = n * n % mod;
		(xSum *= n2) %= mod;
		//1...n * (m-1) * n * 1;
		//2...n * (m-2) * n * 2;
		sum += xSum;
	}
	//y
	{
		ll ySum = 0;
		rep(i, n) {
			(ySum += ((n - i) * i) % mod) %= mod;
		}
		ll m2 = m * m % mod;
		(ySum *= m2) %= mod;
		//1...n * (m-1) * n * 1;
		//2...n * (m-2) * n * 2;
		sum += ySum;
	}
	(sum *= f.cmb(n * m - 2, k - 2) % mod) %= mod;
	cout << sum<< endl;
	return 0;
}


Measured memory_bytes: 3440
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;

int a,b,c,d,i,ans,l,r;
int k[105];
int main()
{
	cin>>a>>b>>c>>d;
	for(i=a;i<b;i++)
	{
		k[i]++;
	}
	for(i=c;i<d;i++)
	{
		k[i]++;
	}
	ans=0;
	for(i=0;i<=100;i++)
	{
		if(k[i]>1)
			ans++;
	}
	cout<<ans<<endl;
 return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int count(string s){
	int cnt=0,flg=0;
	rep(i,s.size()){
		if (flg==0){
			if(s[i]=='A'){
				flg=1;
			}
		}else{
			if(s[i]=='B'){
				cnt++;
		}
			if(s[i]!='A'){
				flg=0;
			}
		}
	}
	return cnt;
}
int main(){
	int n;
	cin>>n;
	vector<string> sl(n);
	rep(i,n){
		cin>>sl[i];
	}
	int sum=0;
	rep(i,n){
		sum+=count(sl[i]);
	}
	int a=0,b=0,ab=0,flg=0;
	rep(i,n){
		if(sl[i][sl[i].size()-1]=='A')a++;
		if(sl[i][0]=='B')b++;
		if((sl[i][sl[i].size()-1]=='A')&&(sl[i][0]=='B'))ab++;
		//if((sl[i][sl[i].size()-1]=='B')||(sl[i][0]=='A'));
	}
	a-=ab;
	b-=ab;
	if(a>0||b>0)flg=1;
	//cout<<sum<<" "<<a<<" "<<b<<" "<<ab<<" "<<flg<<endl;
	if(a<b){
		sum+=a;
		a=b-a;
	}else{
		sum+=b;
		a=a-b;
	}
	if(ab<=a) sum+=ab;
	else if(a!=0||flg==1) sum+=ab;
	else sum+=ab-1;
	cout<<sum<<endl;
	return 0;
}

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

using namespace std;

int main() {
	int n, c[3]{};
	string ans = "No";
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (a % 4 == 0)c[2]++;
		else if (a % 2 == 0)c[1]++;
		else c[0]++;
	}
	if (c[2] >= n / 2)ans = "Yes";
	else if (c[2] * 2 + c[1] >= n)ans = "Yes";
	cout << ans << endl;
	return 0;
}

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

Measured memory_bytes: 128
#include<stdio.h>
int main() {
	int a[100], b[100],i=0;
	char c[100];
	do {
		scanf("%d", &a[i]);
(void)getchar();
		scanf("%c", &c[i]);
		scanf("%d", &b[i]);
		
			i++;
	} while (c[i - 1] != '?');
	for (int z = 0; z < i; z++) {
		if (c[z] == '+') printf("%d\n", a[z] + b[z]);
		else if (c[z] == '-') printf("%d\n", a[z] - b[z]);
		else if (c[z] == '*') printf("%d\n", a[z] * b[z]);
		else if (c[z] == '/') printf("%d\n", a[z] / b[z]);
	}
}

Measured memory_bytes: 1032