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

using namespace std;



int main(int argc, char* argv[])
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  array<int, 3> a;
  for (int& v : a) cin >> v;
  sort(a.begin(), a.end());

  cout << 10*a[2] + a[1] + a[0] << "\n";

  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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


	int N, L;
	cin >> N >> L;

	int ans = 0;
	rep(i,N) {
		ans += L + i;
	}
	if (0 <= L) {
		ans -= L;
	}
	else if (0 <= N + L - 1) {
	}
	else {
		ans -= N + L - 1;
	}

	cout << ans << endl;



	return 0;
}

Measured memory_bytes: 256
import itertools
s=input()
C=['+','']
X=list(itertools.product(C,repeat=len(s)-1))
ans=0
for i in range(len(X)):
    res=''
    for j in range(len(s)-1):
        res+=s[j]+X[i][j]
    res+=s[len(s)-1]
    ans+=eval(res)

print(ans)

Measured memory_bytes: 3064
package main

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

func main() {
	fsc := NewFastScanner()
	N := fsc.NextInt()
	Y := fsc.NextInt()
	for i := 0; i <= N; i++ {
		for j := 0; i+j <= N; j++ {
			k := N - (i + j)
			sum := 10000*i + 5000*j + 1000*k
			if sum == Y {
				fmt.Println(i, j, k)
				return
			}
		}
	}
	fmt.Println(-1, -1, -1)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}

func (s *FastScanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

//Max,Min
func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func IntMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

//Gcd
func IntGcd(a, b int) int {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return IntGcd(b, a%b)
}
func Int64Gcd(a, b int64) int64 {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return Int64Gcd(b, a%b)
}

func IntAbs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

func Int64Abs(a int64) int64 {
	if a < 0 {
		a *= -1
	}
	return a
}


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

int main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL);
    string str;
    cin >> str;
    for(long long i = 1;i <= str.size();i++) cout << 'x';
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <assert.h>
#include <iomanip>


int max1 = 1e9;

using namespace std;

int main(int argc, const char * argv[]) {

    std::ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cin.tie(NULL);
	char alpha;
	cin >> alpha;
	if (isupper(alpha)){
		cout << 'A' << endl;
	}
	else cout << 'a' << endl;

	return 0;
}



Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n,a[105],sum,ans;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }
    if(sum%n>=(n+1)/2){
        sum=sum/n+1;
    }else{
        sum=sum/n;
    }
    for(int i=0;i<n;i++){
        ans+=((a[i]-sum)*(a[i]-sum));
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 3652
#include<stdio.h>
int main(void)
{
	int n,s[1001],p[1001],q[1001],r[1001],cnt,i,P,Q,R,C,x[1001];
	while(1){
		scanf("%d",&n);
		if(n==0) break;
		for(i=0;i<n;i++){
			scanf("%d%d%d%d",&s[i],&p[i],&q[i],&r[i]);
			x[i]=0;
		}
		scanf("%d %d %d %d",&P,&Q,&R,&C);
		cnt=0;
		for(i=0;i<n;i++){
			if(p[i]<=P&&q[i]<=Q&&r[i]<=R&&(p[i]*4+q[i]*9+r[i]*4)<=C){
				x[cnt]=s[i];
				cnt++;
			}
		}
		if(cnt>0){
			for(i=0;i<cnt;i++) printf("%d\n",x[i]);
		}
		else printf("NA\n");
	}
	return 0;
}

Measured memory_bytes: 2696
use proconio::input;

fn main() {
    unsafe {
        input!(n: usize, k: usize, ijc: [(usize, usize, char); n]);
        let mut g = vec![vec![0; k + 1]; k + 1];
        let mut b_count = 0;
        let mut w_count = 0;
        for &(i, j, c) in &ijc {
            *g.get_unchecked_mut(i % k + 1).get_unchecked_mut(j % k + 1) +=
                if ((i / k + j / k) % 2 == 1) ^ (c == 'W') {
                    w_count += 1;
                    1
                } else {
                    b_count += 1;
                    -1
                };
        }
        for i in 0..k {
            for j in 0..k {
                *g.get_unchecked_mut(i + 1).get_unchecked_mut(j + 1) +=
                    g.get_unchecked(i + 1).get_unchecked(j)
                        + g.get_unchecked(i).get_unchecked(j + 1)
                        - g.get_unchecked(i).get_unchecked(j);
            }
        }

        let mut min = std::i32::MAX;
        let mut max = std::i32::MIN;
        for i in 0..k {
            for j in 0..k {
                let x = -g.get_unchecked(i).get_unchecked(k) - g.get_unchecked(k).get_unchecked(j)
                    + 2 * g.get_unchecked(i).get_unchecked(j);
                if x < min {
                    min = x;
                }
                if max < x {
                    max = x;
                }
            }
        }
        println!(
            "{}",
            std::cmp::max(
                -(g.get_unchecked(k).get_unchecked(k) + min) + w_count,
                g.get_unchecked(k).get_unchecked(k) + max + b_count
            )
        );
    }
}


Measured memory_bytes: 10308
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
signed main()
{
    SPEED;
    int a,b,m,mn1=1e18,mn2=1e18,mn=1e18;
    cin>>a>>b>>m;
    int p1[a],p2[b];
    for(int i=0;i<a;i++)
    {
        cin>>p1[i];
        mn1=min(mn1,p1[i]);
    }
    for(int i=0;i<b;i++)
    {
        cin>>p2[i];
        mn2=min(mn2,p2[i]);
    }
    mn=min(mn,mn1+mn2);
    for(int i=0;i<m;i++)
    {
        int x,y,c;
        cin>>x>>y>>c;
        mn=min(mn,p1[x-1]+p2[y-1]-c);
    }
    cout<<mn;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main() {
cout<<fixed<<setprecision(10);

  ll X;
  cin >>X;
  
  ll s=X/500;
  ll t=(X-500*s)/5;
  cout <<1000*s+5*t << endl;

	
}

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

using namespace std;

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

    int q;
    cin>>q;

    map<string,int> mp;
    while(q--){
        int op;
        string s;
        cin>>op>>s;
        switch(op)
        {
            case 0:
                int x;
                cin>>x;
                mp[s]=x;
                break;
            case 1:
                cout<<mp[s]<<endl;
        }
    }

    return 0;
}



Measured memory_bytes: 25968
#include<bits/stdc++.h>
using namespace std;
 
template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
    out << '(' << p.first << ',' << p.second << ')';
        return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
    in >> p.first >> p.second;
        return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
    for (T &x : v)
        in >> x;
    return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T> > &v)
{
    for (const vector<T> &x : v)
        out << x << '\n';
    return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
    for (const T &x : v)
        out << x << ' ';
    return out;
}
 
template <class T>
ostream& operator << (ostream& out,const set<T> &s)
{
    for (const T &x : s)
        out << x << ' ';
    return out;
}
 
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define epsilon 0.00000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl "\n"
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

int main()
{
    fast();
    ll n,x,m;
    cin>>n>>x>>m;

    vi ind(m,-1);

    vi a;
    a.pb(x);
    ind[x]=0;
    ll index=1;
    x=(x*x)%m;
    while(ind[x]==-1 && sz(a)<n)
    {
        ind[x]=index;
        a.pb(x);
        x=(x*x)%m;
        index++;
    }
    index=ind[x];
    if(sz(a)==n)
    {
        ll sum=0;
        for(ll i=0;i<n;i++)
            sum+=a[i];
        cout<<sum<<nl;
    }
    else
    {
        n-=index;
        ll cycle=sz(a)-index;
        ll num=n/cycle;
        ll rem=n%cycle;
        ll prev=0;
        for(ll i=0;i<index;i++)
            prev+=a[i];
        ll rep=0;
        for(ll i=index;i<sz(a);i++)
            rep+=a[i];
        if(a.back()!=0)
        {
            rep*=num;
            for(ll i=index;i<index+rem;i++)
                rep+=a[i];
        }
        cout<<prev+rep<<nl;
    }
    
}


Measured memory_bytes: 4636
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  long double wa = 0;
  rep(i, 0, n) { 
    long double a;
    cin >> a;
    wa += 1 / a;
  }
  cout << 1/wa << endl;
  return 0;
}

Measured memory_bytes: 3748
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getval(_T& a) {
	std::cin >> a;
}
template<class _T> static void getval(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getval(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}
template <class _T> static _T tp_abs(_T a) {
	if (a < (_T)0) {
		a *= (_T)-1;
	}
	return a;
}
template <class _T> static void tp_swap(_T& right, _T& left) {
	//	usage:  tp_swap<type name>(a, b);
	_T tmp = right;
	right = left;
	left = tmp;
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}

static void exec()
{
	std::string orgs;
	getval(orgs);

	int K;
	getval(K);

	int len = orgs.length();
	for (int i = 0; i < len; i++) {
		int code = orgs[i] - 'a';
		if (!code) continue;
		int ope = 26 - code;

		if (K >= ope) {
			K -= ope;
			orgs[i] = 'a';
		}
	}

	if (K) {
		orgs[len - 1] += (K % 26);
		if (orgs[len - 1] > 'z') {
			orgs[len - 1] -= 'a';
		}
	}
	std::cout << orgs << std::endl;
}


Measured memory_bytes: 3720
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include<math.h>
#include <queue>
using namespace std;
#define Minf -1e9
#define scan(n) scanf("%lld",&n)
typedef long long ll;
const int maxn = 1*1e5+10;
const ll INF = 1e9+100;
const int mod = 998244353;

int a[maxn];
int main()
{
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	for (int i = 0; i < n; i++){
		for (int j = i + 1; j < n; j++){
			for (int k = j + 1; k < n; k++){
				if (a[i] + a[j] > a[k] && a[i] + a[k] > a[j] && a[j] + a[k] > a[i]&&a[i]!=a[j]&&a[i]!=a[k]&&a[j]!=a[k]) {
					ans++;
				}
			}
		}
	}

	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 3696
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace i18n
{
    class i18n
    {
        static void Main(string[] args)
        {
            string strInp = Console.ReadLine();
            //Console.WriteLine(strInp);

            string strSt = strInp.Substring(0, 1);
            string strEn = strInp.Substring(strInp.Length-1, 1);
            //Console.WriteLine(strEn);
            int intLen = strInp.Length - 2;


            Console.WriteLine(string.Concat(strSt, intLen , strEn));

            // デバッグ用
            return;

        }
    }
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i], a[i]--;

  int res = 0;
  rep(i,n) {
    if (i == a[a[i]]) res++;
  }
  cout << res/2 << endl;
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<tuple<string, int, int>> a;
    for (int i = 1; i <= n; i++) {
      string s;
      int p;
      cin >> s >> p;
      p *= -1;
      a.emplace_back(s,p,i);
    }
    sort(a.begin(), a.end());
    rep(i,n) {
      cout << get<2>(a[i]) << endl;
    }
    return 0;
}

Measured memory_bytes: 3604
#include<iostream>
#include<cstdio>
#include<cstring>
using  namespace  std;
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if (a==b) cout<<c;
	else if (a==c) cout<<b;
	else if (c==b) cout<<a;
 } 


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;

int main(){

   while(1){
      int n;
      cin>> n;
      if(n==0){
         break;
      }
      int s[n];
      for(int i=0; i<n; i++) cin>> s[i];

      int sum=accumulate(s, s+n, 0);
      int mi=*min_element(s, s+n);
      int ma=*max_element(s, s+n);

      cout<< (sum-mi-ma)/(n-2)<< endl;

   }

   return 0;
}

Measured memory_bytes: 3064
in_line = raw_input().split()
n = int(in_line[0])
m = int(in_line[1])
l = int(in_line[2])
a = []
b = []
for i in range(0,n):
    in_line = raw_input().split()
    a.append([])
    for j in range(0,m):
        a[i].append(int(in_line[j]))
for i in range(0,m):
    in_line = raw_input().split()
    b.append([])
    for j in range(0,l):
        b[i].append(int(in_line[j]))
for i in range(0,n):
    for j in range(0,l):
        col = 0
        for k in range(0,m):
            col += a[i][k]*b[k][j]
        if j == l-1:
            print col
        else:
            print col,

Measured memory_bytes: 7012
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define testing 1
#define FOR(i,s,e) for(ll i = s; i <= (ll)e; ++i)
#define DEC(i,s,e) for(ll i = s; i >= (ll)e; --i)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << "\n"
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << "\n"
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"\n"
#define dbv(v) cerr << #v << ":"; for (auto ite : v) cerr << ite << ' '; cerr <<"\n"
#define dbvp(v) cerr << #v << ":"; for (auto ite : v) cerr << "{"  << ite.f << ',' << ite.s << "} "; cerr << "\n"
#define dba(a,ss,ee) cerr << #a << ":"; FOR(ite,ss,ee) cerr << a[ite] << ' '; cerr << "\n"
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "LINE: " << __LINE__ << "\n";
typedef pair <ll, ll> pi;
typedef tuple<ll,ll,ll> ti3;
string cts(char x) {string t(1,x); return t;}
ll rand(ll a, ll b) { return a + rng() % (b-a+1); }
const int MOD = 1e9 + 7;
const int inf = (int)1e9 + 500;
const long long oo = (ll)1e18 + 500;
template <typename T> void chmax(T& a, T b) { a = max(a, b); }
template <typename T> void chmin(T& a, T b) { a = min(a, b); }
const int MAXN = -1;
#if !testing
#define cerr if(0)cout
#endif

int32_t main() 
{
	IAMSPEED
      string str; cin >> str;
  if(str=="ABC")cout <<"ARC";
  else cout << "ABC";
}



Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
typedef long long  ll;
#define EPS 1e-9
#define PI acos(-1.0)
string arr[3] = {"Sunny", "Cloudy", "Rainy"};
int main() {
   ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
   string s;
   cin >> s;
   for(int i = 0 ; i < 3 ; ++i){
      if(s == arr[i]){
         cout << arr[(i + 1) % 3] << "\n";
         return 0;
      }
   }
}

Measured memory_bytes: 256
import std.stdio;
import std.container;
import std.algorithm;

void main(){
	while(true){
		int n;
		readf("%d\n", &n);
		if(n == 0) break;
		int[1000] itime = 0;
		auto islogin = redBlackTree!(false,int)();
		int month=-1, date=-1;
		bool logined = false;
		while(n--){
			int m, d, hour, minute, p;
			int time;
			char e;
			readf("%d/%d %d:%d %s %d\n", &m, &d, &hour, &minute, &e, &p);
			time = 60*hour+minute;
			if(d != date || m != month){
				if(logined)
					foreach(i; islogin)
						itime[i] += 24*60;
				logined = false;
				date = d; month = m;
				islogin.clear();
			}
			if(e == 'I'){
				if(p == 0){
					logined = true;
					foreach(i; islogin)
						itime[i] -= time;
				}else{
					islogin.insert(p-1);
					if(logined)	itime[p-1] -= time;
				}
			}else{
				if(p == 0){
					logined = false;
					foreach(i; islogin)
						itime[i] += time;
				}else{
					islogin.removeKey(p-1);
					if(logined)	itime[p-1] += time;
				}
			}
		}
		writeln(reduce!max(0, itime));
	}
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<vector>
#include<map>

#define For(i,a,b) for(int i=a;i<=b;i++)
#define ForD(i,a,b) for (int i=a;i>=b;i--)
#define LL long long
#define INF (2147483647)
#define sqr(x)	((x)*(x))

using namespace std;

inline int read(){
    int data=0,w=1; char ch=0;
    while (ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if (ch=='-') w=-1,ch=getchar();
    while  (ch>='0' && ch<='9') data=data*10+ch-'0',ch=getchar();
    return data*w;
}

inline void write(int x){
	if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
} 

char s1[200],s2[200];
int t;

int main(){	
	int n=read();
	scanf("%s",s1+1);
	scanf("%s",s2+1);
	
	For(i,1,n+1){
		bool t=true;
		For(j,i,n)
			if (s1[j]!=s2[j-i+1]){
				t=false;break;
			}
		if (t){
			write((i-1)*2+(n-i+1)),puts("");
		/*	printf("The shortest string is ");
			For(j,1,n)
				putchar(s1[j]);
			For(j,n-i+2,n)
				putchar(s2[j]);
			puts("");*/
			break;
		}
	}	
	
} 

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  char s[100000];
  scanf("%s",s);
  int i,j=0;
    for(i=1;i<100000;i++){
      if(s[i]=='\0') break;
      if(s[i]==s[i-1]){
        j++;
        if(s[i]=='0') s[i]='1';
          else s[i]='0';
      }  
    }  
  printf("%d",j);
  return 0;
}

Measured memory_bytes: 256
n=int(input())
l=list(map(int,input().split()))
s=0
m=1000000007
s1=sum(l)
s1=(s1*s1)
s2=0
for i in range(n):
  s2=s2+l[i]*l[i]
print(((s1-s2)//2)%m)
  

Measured memory_bytes: 31348
N,K = list(map(int,input().split()))

if K%2==0:
    k=K//2
    k_1_list = list(range(k,N+1,k*2))
    k_2_list = list(range(K,N+1,K))
else:
    k=K
    k_1_list = []
    k_2_list = list(range(K,N+1,K))
    
# k_1_list,k_2_list

print(len(k_1_list)**3+len(k_2_list)**3)

Measured memory_bytes: 63688
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,M;
  cin>>N>>M;
  vector<int> A(M);
  int count=0;
  for(int i=0;i<M;i++){
  cin>>A.at(i);
    count+=A.at(i);
   
  }
  if(count==N){
    cout<<0<<endl;
  }
  if(count>N){
  cout<<-1<<endl;
  }
  if(N>count){
    cout<<N-count<<endl;
  }

}


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

using ll = long long;
const int mod = 1e9 + 7;

int cnt[2000];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    int sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        sum += A[i];
    }
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (A[i] * 4 * M >= sum)
            cnt++;
    }
    if (cnt >= M)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int n;
    int a, b;
    int score_a, score_b;
    int i;
    
    while (1){
        scanf("%d", &n);
        if (n == 0){
            break;
        }
        
        score_a = score_b = 0;
        for (i = 0; i < n; i++){
            scanf("%d%d", &a, &b);
            if (a == b){
                score_a += a;
                score_b += b;
            }
            else if (a > b){
                score_a += (a + b);
            }
            else {
                score_b += (a + b);
            }
        }
        printf("%d %d\n", score_a, score_b);
    }
    
    return (0);
}

Measured memory_bytes: 600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String S = scanner.nextLine();
		String T = scanner.nextLine();

		String t = T.substring(0,S.length());

		if(S.compareTo(t) == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		scanner.close();


	}

}


Measured memory_bytes: 35532
#include <stdio.h>
int main(void) {
  int h,w,cross,x=0;
  int i=0,j=0,m=0,n=0,flag=0;   /*i:h  j:w*/
  while(scanf("%d%d", &h, &w) && (h != 0 || w != 0)) {

  if(h == 0 || w == 0) {
    break;
  }
  cross = h * h + w * w;
  for(i = h + 1; i <= 150; i++) {
    for(j = i + 1; j <= 150; j++) {
     if(i * i + j * j == cross) {
	x = cross;
	flag = 1;
	m = i;
	n = j;
	break;
      }
    }
    if(flag == 1) break;
  }


  while(1) {
    if(flag == 0) {
      cross++;
      for(i = 1; i <= 150; i++) {
	for(j = i + 1; j <= 150; j++) {
	  if(i * i + j * j == cross) {
	    x = cross;
	    m = i;
	    n = j;
	    flag = 1;
	    break;
	  }
	}
	if(flag == 1) break;
      }
    } else{
      break;
    }
  }
  flag = 0;
  printf("%d %d\n", m, n);

  }
  return 0;
}

Measured memory_bytes: 600
//	-*- mode: C++ -*-
//	Greatest Common Divisor
//		Write a program which finds the greatest common divisor of two natural numbers a and b
//
//	Input
//		a and b are given in a line sparated by a single space.
//
//	Output
//		Output the greatest common divisor of a and b.
//
//	Constrants
//		1 ≤ a, b ≤ 109
//
//	Hint
//		You can use the following observation:
//
//		For integers x and y, if x ≥ y, then gcd(x, y) = gcd(y, x%y)
//
//	Sample Input 1
//		54 20
//	Sample Output 1
//		2
//	Sample Input 2
//		147 105
//	Sample Output 2
//		21

#include <iostream>

int	main(int	argc,
		 char*	argv[])
{
	unsigned long long	a	{0};
	unsigned long long	b	{0};

	std::cin >> a >> b;

	if(a < b){
		auto tmp	= a;
		a			= b;
		b			= tmp;
	}

	// ユークリッドの互除法
	unsigned int	r	= a % b;
	while(r != 0){
		a = b;
		b = r;
		r = a % b;
	}

	std::cout << b << '\n';

    return 0;
}



Measured memory_bytes: 3116
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>
#include<bitset>
#include<stack>
#include<fstream>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> lltpl;

int dy8[8] = { 2,2,-2,-2,1,1,-1,-1 };
int dx8[8] = { 1,-1,1,-1,2,-2,2,-2 };
int dx4[4] = { 1,0,0,-1 };
int dy4[4] = { 0,1,-1,0 };


/******************************************************************************************/


const int IINF = 1e9 + 7;
const ll LINF = LLONG_MAX;
constexpr ll MOD = 998244353;



template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}

// vector
template <typename T>
istream& operator>>(istream & is, vector<T> & vec) { for (T& x : vec) is >> x; return is; }
// pair
template <typename T, typename U>ostream& operator<<(ostream & os, pair<T, U> & pair_var) { os << "(" << pair_var.first << ", " << pair_var.second << ")"; return os; }
// vector
template <typename T>ostream& operator<<(ostream & os, const vector<T> & vec) { os << "{";	for (int i = 0; i < vec.size(); i++) { os << vec[i] << (i + 1 == vec.size() ? "" : ", "); }os << "}"; return os; }
// map
template <typename T, typename U>ostream& operator<<(ostream & os, map<T, U> & map_var) { os << "{";	repi(itr, map_var) { os << *itr; itr++; if (itr != map_var.end()) os << ", "; itr--; }os << "}"; return os; }
// set
template <typename T>ostream& operator<<(ostream & os, set<T> & set_var) { os << "{"; repi(itr, set_var) { os << *itr; itr++; if (itr != set_var.end()) os << ", "; itr--; }os << "}"; return os; }



int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	

	ll n;
	cin >> n;
	vector<ll> a(n);
	vector<ll> cnt(100005, 0);
	bool flag = true;
	ll maxi = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		if (i == 0 && a[i] != 0) {
			flag = false;
		}
		maxi = max(maxi, a[i]);
		cnt[a[i]]++;
	}

	if (!flag) {
		cout << "0" << endl;
		return 0;
	}
	ll ans = 1;

	if (cnt[0] >= 2) {
		cout << "0" << endl;
		return 0;
	}
	for (int i = 0; i <= maxi; i++)
	{
		if (i == 0)continue;
		for (int j = 0; j < cnt[i]; j++)
		{
			ans *= cnt[i - 1];
			ans %= MOD;
		}
	}
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>

using namespace std;
 int A[100100];
int gcd(int a,int b)
{
    return b==0?a:gcd(b,a%b);
}

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

      memset(A,0,sizeof(A));
        for(int i=0;i<N;i++)
        {
            scanf("%d",&A[i]);
        }
        int d=A[0];
        for(int i=0;i<N;i++)
        {
            d=gcd(d,A[i]);
        }
       // cout<<d<<endl;
        int cd=0;
        for(int i=0;i<N;i++)
        {
            if(A[i]>=K&&(A[i]-K)%d==0)
                {cd=1;
                break;}
        }
        if(cd)
            cout<<"POSSIBLE"<<endl;
        else
            cout<<"IMPOSSIBLE"<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main(){
	int n,m;
	int i,j;
	int a,b;
	int count;
	
	scanf("%d %d",&n,&m);
	
	int visited[n+1];
	int lists[n+1][n+1];
	
	for(i=0;i<=n;i++){
		visited[i] = 0;
		for(j=0;j<=n;j++){
			lists[i][j] = 0;
		}	
	}
	
	for(i=0;i<m;i++){
		scanf("%d %d",&a,&b);
		lists[a][b] = 1;
		lists[b][a] = 1;
	}
	
	visited[1] = 1;
	count =  walk(n,visited,lists,1);
	
	printf("%d\n",count);
	
	return 0;
}

int walk(int n,int visited[n+1],int lists[n+1][n+1],int k){
	int i;
	int allvisited = 1;
	int result = 0;
	
	for(i=1;i<=n;i++){
		if(visited[i]==0) allvisited = 0;
	}
	if(allvisited==1) return 1;
	
	visited[k] = 1;
	for(i=0;i<=n;i++){
		if(lists[k][i]==0) continue;
		if(visited[i]==1) continue;
		visited[i] = 1;
		result += walk(n,visited,lists,i);
		visited[i] = 0;
	}
	
	return result;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i=0;i<N;i++){
        cin >> vec.at(i);
    }
    sort(vec.begin(),vec.end());
    // for(int i=0;i<N;i++){
    //     cout << vec.at(i) << endl;
    // }
    int mid = N/2;
    // cout << "mid = " << mid << endl;
    int dif = vec.at(mid) - vec.at(mid-1);
    int sum = 0;
    if(vec.at(mid-1)==vec.at(mid)){
        cout << 0 << endl;
    }
    else{
        for(int i=0;i<dif;i++){
            sum++;
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int[] nums = new int[N];
		int countA = 0;
		int countB = 0;
		int countC = 0;
		for(int i=0; i<N; i++) {
			nums[i] = sc.nextInt();
			if(nums[i] <= A) {
				countA++;
			}else if(nums[i]>A && nums[i]<=B) {
				countB++;
			}else if(nums[i] > B) {
				countC++;
			}
		}
		int min = Math.min(countA, countB);
		min = Math.min(countC, min);
		System.out.println(min);
	}
}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

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

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

ll r_fuct[2000];
ll fuct[2000];

//MOD逆元
void conb(ll n,ll k){
    fuct[0] = 1;
    for(int i = 1;i < k+1;i++){
        fuct[i] *= fuct[i-1]%MOD;
        
        ll b = MOD, u = 1, v = 0;
        ll value = fuct[i];
        while (b) {
            ll t = value / b;
            value -= t * b;
            swap(value, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        r_fuct[i] = u;
    }
}

ll factrial(ll n){
    if(n == 0) return 1;
    ll p = factrial(n-1)*n%MOD;
    return p;
}

//MOD逆元
ll farmat(ll n,ll p){    
    if(p == 0) return 1;
    else if(p == 1) return n%MOD;
    ll d = farmat(n,p/2);
    if(p%2 == 0){
        return (d*d)%MOD;
    }else{
        return ((n*d)%MOD*d)%MOD;
    }
}

ll conbination(ll n,ll k){
    ll a = factrial(n);
    ll b = factrial(k);
    ll c = factrial(n-k);
    return (a*farmat(b,MOD-2)%MOD*farmat(c,MOD-2))%MOD;
}

int n;
int memo[10000000];

int fib(int i){
    if(i <= 1) return i;
    if(memo[i] != 0) return memo[i];
    return memo[i] = fib(i-1)+fib(i-2);
}


void solve() {
   int n;
   cin >> n;
   int a[n+1];
   a[0] = INF;
   a[n] = INF;
   for(int i = 1; i < n;i++){
       cin >> a[i];
   }
   int ans = 0;
   for(int i = 1;i < n+1;i++){
       ans += min(a[i-1],a[i]);
   }
    cout << ans << endl;
}


int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  int n, m = 0;
  string s;
  cin >> n >> s;
  rep(i,n)
  {
    bitset<26> b, c;
    for (int j = 0; j <= i; j++) {
      b.set(s[j] - 'a');
    }
    c.reset();
    for (int j = i + 1; j < n; j++) {
      c.set(s[j] - 'a');
    }
    c &= b;
    m = max(m, (int)c.count());
  }
  cout << m;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc =new Scanner(System.in);
        long[] line =new long[4];
        for (int i = 0; i < 4; i++) {
            line[i] = sc.nextLong();  
        }
        long max = Long.MIN_VALUE;
        
        for (int i = 0; i < 2; i++) {
            for (int j = 2; j < 4; j++) {
                max = Math.max(max, line[i]*line[j]);
            }
        }

        System.out.println(max);
		sc.close();
    }
}


Measured memory_bytes: 35696
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <assert.h>
#include <iostream>

using namespace std;

int min(int a, int b){
    return a < b ? a : b;
}

int max(int a, int b){
    return a > b ? a : b;
}

void solucion(){

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long N, M;
    cin >> N >> M;

    for (int i=0; i<M; i++) {
        int aux;
        cin >> aux;
        N -= aux;
    }

    cout << ( (N < 0) ? -1 : N)  << "\n";
    return 0;
}


Measured memory_bytes: 3196
#include <iostream>

using namespace std;

int main() {
    int N;

    cin >> N;
    int res = N;

    for(int i = 0; i <= N; i += 6) {
        int cc = 0;
        int t = i;
        
        while(t > 0) {
            t /= 6, cc += t%6; 
        }
        t = N-i;
        while(t > 0) {
            cc += t % 9, t /= 9;
        }
        if(res > cc) res = cc;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <cstdio>
//#include <iomanip>//"cout<<fixed<<setprecision(n)<<sth<<endl;"
//#include <string>//"reverse(s's it,s's it)"
//#include <functional>//"greater<T>" "sort(a,a+n,greater<int>());""
//#include <cmath>//"abs" "sqrt"
//#include <numeric>//"accumulate(inputit,inputit,init,(optional) object)"
//#include <algorithm>//"lower_bound(it,it,v)" "next_permutation(a,a+n)"
//"reverse(v's it,v's it)"(v: vector)
using namespace std;
#define pb push_back//also for STRING
#define fi first
#define sc second
#define mp make_pair
#define is insert
#define ps push//TMP//stack,(priority) queue,
#define fr front//TMP//queue//for priority, use top().
typedef long long ll;//not necessarily
typedef pair<int,int> pii;
//Add other types in the same way.
const ll M=1000000007;//can be changed
int mod(int a){	return (a+M)%M;	}//M can be a variable
void plmod(ll &a,ll b){	a=(a+b+M)%M;	return;	}
void mnmod(ll &a,ll b){	a=(a-b+M)%M;	return;	}
void mlmod(ll &a,ll b){	a=(a*b)%M;  	return;	}
//Caution! you may need sth larger than "+M"!
void chmax(int &a,int b){	a=max(a,b);	return;	}
void chmin(int &a,int b){	a=min(a,b);	return;	}
//These 2 could be better in long long

int main(){
	string s;
	cin>>s;
	if(s.substr(0,4)=="YAKI") cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    immutable w = readln().chomp().to!int();
    immutable n = readln().chomp().to!int();
    auto t = iota(1,w+1).array();
    foreach(_;0..n)
    {
        auto ab = readln().chomp().split(",").map!(x=>x.to!int()-1);
        swap(t[ab[0]],t[ab[1]]);
    }
    t.map!(to!string).join("\n").writeln();
}

Measured memory_bytes: 1076
#include <iostream>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <random>
#include <ctime>
#include <bitset>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstring>
#include <queue>
#include <deque>
#include <list>
#include <stack>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define ld long double
#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) x.begin(), x.end()
#define fast_io cout.tie(0), cin.tie(0), ios_base::sync_with_stdio(0)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using namespace std;
ld eps = (ld)1 / 1e15;
ll inf = 1e18, mod1 = 998244353, mod2 = 1e9 + 7;
ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main()
{
    //freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
    fast_io;
    ll a, b, c;
    cin >> a >> b >> c;
    if ((a == b && c != a) || (a == c && b != a) || (b == c && a != c)) cout << "Yes";
    else cout << "No";
    return 0;
}

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

int main() {
  int K, A, B, answer=0;
  cin >> K;
  cin >> A >> B;
  for (int i=A; i<=B; i++) {
    if(i%K==0) {
      answer = 1;
      break;
    }
  }
  if (answer == 1) {
    cout << "OK" << endl;
  } else {
    cout << "NG" << endl;
  }
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = 200005;
vector<int> g[N];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n, m;
	cin>>n>>m;
	for(int i = 0; i < m; i++){
		int u, v;
		cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	for(auto v : g[1]){
		for(auto u : g[v]){
			if(u == n){
				cout<<"POSSIBLE"<<endl;
				exit(0);
			}
		}
	}
	cout<<"IMPOSSIBLE"<<endl;

	return 0;
}

Measured memory_bytes: 12016
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << __LINE__ << ' ' << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
template<class T> using pque = priority_queue<T, vector<T>, greater<T>>;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr int mod1e9 = 1000000007;
constexpr int mod998 = 998244353;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
constexpr ll ten(int n) { return n ? 10 * ten(n - 1) : 1; };
int dx[] = { 1,0,-1,0,1,1,-1,-1 }; int dy[] = { 0,1,0,-1,1,-1,1,-1 };
void fail() { cout << "-1\n"; exit(0); }
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
template<class T> istream &operator >> (istream &s, vector<T> &v) { for (auto &e : v) s >> e; return s; }
template<class T> ostream &operator << (ostream &s, const vector<T> &v) { for (auto &e : v) s << e << ' '; return s; }

struct fastio {
	fastio() {
		cin.tie(0); cout.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(20);
		cerr << fixed << setprecision(20);
	}
}fastio_;

int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max({ a*c,a*d,b*c,b*d }) << '\n';
}

Measured memory_bytes: 3648
// https://atcoder.jp/contests/abc154/tasks/abc154_a

#include <bits/stdc++.h>
using namespace std;
int main() {
    string S, T;
    int A, B;
    cin >> S >> T;
    cin >> A >> B;

    string U;
    cin >> U;

    if(U == T) B--;
    else A--;

    cout << A << " " << B << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<unordered_set>
#define ll long long
#define pb push_back
#define rep(i,n) for (int i=0;i<n;i++)
#define INF 1e9+7
#define vec vector<int>

using namespace std;


int main() {
    int n;
    cin >> n;
    unordered_set<string>st;
    rep(i,n){
        string str1,str2;
        cin >>str1>>str2;
        if (str1=="insert") st.insert(str2);
        else {
            cout<<(st.count(str2)? "yes":"no")<<endl;
        }
    }
}


Measured memory_bytes: 31948
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <fstream>
#include <stdint.h>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;

constexpr int INF       = 1000000000;/* 1e+9a */
constexpr int MODULO    = 1000000007;

#define REP(i,f,n) for(int i=(f); i < (n); ++i)
#define PER(i,f,n) for(int i=(n-1); i >= f; --i)

constexpr int evx[4] = { 1, 0, -1, 0 };
constexpr int evy[4] = { 0, 1, 0, -1 };

//----------------------------------
//----------------------------------
//
int n;
vector<int64_t> t, a;

int solve()
{
        vector<int64_t> difp(n, 0);
        difp[0] = t[0];
        if(a[0] < t[0])
                return 0;

        REP(i, 1, n)
        {
                if(t[i-1] != t[i])
                {
                        difp[i] = t[i];
                        if(a[i] < t[i])
                                return 0;
                }
        }

        if(difp[n-1] != 0 && difp[n-1] != a[n-1])
                return 0;
        difp[n-1] = a[n-1];

        PER(i, 1, n)
        {
                if(a[i-1] != a[i])
                {
                        if(difp[i-1] != 0 && difp[i-1] != a[i-1])
                                return 0;
                        difp[i-1] = a[i-1];
                }
        }

        int64_t ans = 1;
        REP(i, 0, n)
        {
                if(difp[i] ==0)
                {
                        /* cerr << i << ":"; */
                        ans *= min(a[i],t[i]);
                        /* cerr << ans << '\n'; */
                }
                ans %= MODULO;
        }
        return ans;

}




signed main()
{
    ios::sync_with_stdio(false);
        cin >> n;
        for(int i = 0; i < n; i++)
        {
                int tmp;
                cin >> tmp;
                t.push_back(tmp);
        }
        for(int i = 0; i < n; i++)
        {
                int tmp;
                cin >> tmp;
                a.push_back(tmp);
        }
        cout << solve() << '\n';

}



Measured memory_bytes: 2676
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<algorithm>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>*/
//#include<ext/rope>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;
const double PI=acos(-1.0);
const double eps=1e-6;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
template<typename T> void debug(T x)
{
    cout<<"value="<<x<<endl;
    return;
}
signed main()
{
	//ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
	int a=read(),b=read();
	cout<<a*b<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   int n, m, ctr_on, ans = 0;
   cin >> n >> m;
   vector<int> k(m + 1, 0), p(m + 1, 0);
   vector<vector<int>> s(m + 1, vector<int>(n + 1, 0));
   for (int i = 1; i <= m; i++)
   {
      cin >> k[i];
      for (int j = 1; j <= k[i]; j++)
         cin >> s[i][j];
   }
   for (int i = 1; i <= m; i++)
      cin >> p[i];
   for (int i = 0; i < 1 << n; i++)
   {
      bool is_on = true;
      for (int j = 1; j <= m; j++)
      {
         ctr_on = 0;
         for (int l = 1; l <= k[j]; l++)
            if (i & 1 << (s[j][l] - 1))
               ctr_on++;
         if (ctr_on % 2 != p[j])
         {
            is_on = false;
            break;
         }
      }
      if (is_on)
         ans++;
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256