akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main
{
	public static void main(String[] args)
	{
		int A,B,T,Ans=0;
		Scanner sc = new Scanner(System.in);
		A = sc.nextInt();
		B = sc.nextInt();
		T = sc.nextInt();
		T+=0.5;
		for(int i=0;i<T;i++)
		{
			if((i+1)%A==0)	Ans+=B;
		}
		System.out.println(Ans);
	}
}

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

#define mem( arr, i ) fill( arr, arr + sizeof (arr), i )
#define MEM( arr, i ) memset( arr, i, sizeof (arr) )
#define Push push_back
#define Pair make_pair
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
//typedef priority_queue<T> prior_S<T>;
//typedef priority_queue< T, vector<T>, greater<T> > prior_B<T>;
const double PI = 3.141592653589793;
const lli I_MAX = 1LL << 60;
const lli mod = 1000000007;


void precal() {

	return;
}

void solve() {
	string s;
	cin >> s;
	
	if ( s > "2019/04/30" ) cout << "TBD\n";
	else cout << "Heisei\n";
}

int main() {
	precal();
	int t = 1;
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
   int a, b;
   cin >> a >> b;

   if (a == b)
       cout << "a == b" << endl; 
   else if (a > b)
       cout << "a > b" << endl;
   else
       cout << "a < b" << endl;
   
   return 0;
}


Measured memory_bytes: 3084
#include <iostream>
#include <sstream>
int INF=1000000000;
int cnt=0;
void merge(int A[],int left,int mid,int right){
  int n1,n2;
  n1=mid-left;
  n2=right-mid;
  int L[n1+1];
  int R[n2+1];
  for(int i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(int i=0;i<n2;i++){
    R[i]=A[mid+i];
  }
  L[n1]=R[n2]=INF;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
      cnt++;
    }else{
      A[k]=R[j];
      j++;
      cnt++;
    }
  }
}

void mergeSort(int A[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}

int main(){
  int n;
  std::cin>>n;
  int A[n];
  for(int i=0;i<n;i++){
    std::cin>>A[i];
  }
  int left=0;
  int right=n;
  mergeSort(A,left,right);
  for(int i=0;i<n-1;i++){
    std::cout<<A[i]<<" ";
  }
  std::cout<<A[n-1]<<"\n";
  std::cout<<cnt<<"\n";
}



Measured memory_bytes: 6912
import collections
N,K = map(int, input().split())
d = [0] * K
A = [0] * K
for i in range(K):
    d[i] = int(input())
    A[i] = list(map(int, input().split()))
B = []
for l in range(K):
    B += A[l]
c = collections.Counter(B)
values, counts = zip(*c.most_common())
ans = N - len(values)
print(ans)

Measured memory_bytes: 9272
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int n; cin >> n;
	int k; cin >> k;
	int h[n]; rep(i,n) cin >> h[i];
	sort(h, h + n);
	reverse(h, h + n);
	for(int i = 0; i < n; ++i) {
		if(h[i] < k) {
			cout << i << endl;
			return 0;
		}
	}
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 640
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))

    ans = sum(b)
    for i in range(n-1):
        if a[i] + 1 == a[i + 1]:
            ans += c[a[i]-1]
    print(ans)


if __name__ == '__main__':
    main()


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

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

  if (a[a.size() - 1] == b[0]  &&  b[b.size() - 1] == c[0])  {
    cout << "YES" << endl;
  }

  else cout << "NO" << endl;
}


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

int main(){
    int H1, M1, H2, M2, K;
    scanf("%d%d%d%d%d", &H1, &M1, &H2, &M2, &K);

    int t1 = H1*60+M1;
    int t2 = H2*60+M2;
    printf("%d", t2-t1-K);
    return 0;
}


Measured memory_bytes: 3828
#include<iostream>
using namespace std;
int main(){
  int n,a[100];
  string ans="APPROVED";
  cin>>n;
  for(int i=0;i<n;i++){cin>>a[i];if(a[i]%2==0 and a[i]%3!=0 and a[i]%5!=0)ans="DENIED";}
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a[4], b[4];
	int hit, blow;
	int i, j;
	
	while (scanf("%d", &a[0]) != EOF){
		hit = blow = 0;
		for (i = 1; i < 4; i++){
			scanf("%d", &a[i]);
		}
		for (i = 0; i < 4; i++){
			scanf("%d", &b[i]);
			if (a[i] == b[i]){
				hit++;
				a[i] = -2;
			}
		}
		for (i = 0; i < 4; i++){
			for (j = 0; j < 4; j++){
				if (a[i] == b[j]){
					blow++;
					a[i] = -2;
					break;
				}
			}
		}
		printf("%d %d\n", hit, blow);
	}
	
	return (0);
}

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

using namespace std;

void rwFile() {
    freopen("INP.inp", "r", stdin);
    freopen("OUT.out", "w", stdout);
}

const int MAXN = 444;
const long long oo = 1e18;
long long DP[MAXN][MAXN];

void solve() {
    int n; cin >> n;
    long long arr[n + 1], Sum[n + 1];
    Sum[0] = 0;
    for (int i = 1; i <= n; i++) {
        cin >> arr[i];
        Sum[i]  = Sum[i - 1] + arr[i];
    }
    for (int j = 1; j < n; j++) {
        for (int i = 1; i + j <= n; i++) {
            long long Diff = oo;
            for (int k = i; k < j + i; k++) {
                Diff = min(Diff, DP[i][k] + DP[k + 1][i + j]);
            }
            DP[i][i + j] = Diff + Sum[i + j] - Sum[i - 1];
        }
    }
    //for (int i = 0; i <= n; i++) cout << Sum[i] << " ";
    cout << DP[1][n];
}

int main()
{
    //rwFile();
    solve();
}


Measured memory_bytes: 1664
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
//#include <string>
//typedef long long LL;
using namespace std;

int main(){
    char b;
    cin >> b;
    if(b=='A'){
        cout << 'T';
    }else if(b=='C'){
        cout << 'G';
    }else if(b=='G'){
        cout << 'C';
    }else{
        cout << 'A';
    }
    cout << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]

import collections

buk = [0] * (10**5 + 1)
for e in a:
  buk[e] += 1

s = sum(a)

for b, c in bc:
  s += (c - b) * buk[b]
  buk[c] += buk[b]
  buk[b] = 0
  print(s)


Measured memory_bytes: 32276
#include <stdio.h>
#include <string.h>
 
int main()
{
    int i,n,t=0,h=0;
    char st[101],sh[101];
     
    scanf("%d",&n);
     
    for(i=0;i<n;i++){
        scanf("%s %s",&st,&sh);
        if(strcmp(st,sh) > 0){
            t += 3;
        }else if(strcmp(st,sh) < 0){
            h += 3;
        }else{
            h += 1;
            t += 1;
        }
    }
    printf("%d %d\n",t,h);
    return 0;
}

Measured memory_bytes: 604
#!/usr/bin/env python3

import sys
import math
import itertools

def main():
    s = sys.stdin.readline().strip()

    if ((len(s) % 2 == 0)
            and all((i % 2 != 0 or s[i] == 'h') and (i % 2 != 1 or s[i] == 'i')
                    for i in range(len(s)))):
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int n;
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
        --A[i];
    }
    vector<int> B(n);
    for (int i = 0; i < n; ++i) {
        cin >> B[i];
        --B[i];
    }

    const int INF = 1 << 24;
    vector<pair<int,int>> rangesA(n, make_pair(INF, -INF));
    vector<pair<int,int>> rangesB(n, make_pair(INF, -INF));

    for (int i = 0; i < n; ++i) {
        int l = i;
        int x = A[i];
        while (i + 1 < n && A[i + 1] == x) {
            ++i;
        }
        int r = i;
        rangesA[x] = make_pair(l, r);
    }
    for (int i = 0; i < n; ++i) {
        int l = i;
        int x = B[i];
        while (i + 1 < n && B[i + 1] == x) {
            ++i;
        }
        int r = i;
        rangesB[x] = make_pair(l, r);
    }

    bool ok = true;
    for (int i = 0; i < n; ++i) {
        int cntA = rangesA[i].second - rangesA[i].first + 1;
        int cntB = rangesB[i].second - rangesB[i].first + 1;
        if (cntA > 0 && cntB > 0 && cntA > n - cntB) {
            ok = false;
            break;
        }
    }

    if (!ok) {
        cout << "No\n";
        return 0;
    }


    vector<int> cnts(2 * n + 1, 0);

    for (int i = 0; i < n; ++i) {
        int la = rangesA[i].first, ra = rangesA[i].second;
        int lb = rangesB[i].first, rb = rangesB[i].second;
        if (la >= n || lb >= n) {
            continue;
        }

        int r = ra - lb;
        if (r < 0) {
            r += n;
        }
        int l = (la - (rb - lb)) - lb;
        while (l < 0) {
            l += n;
        }
        while (l > r) {
            r += n;
        }
        // cout << i << " : " << l << " - " << r << endl;
        cnts[l] += 1;
        cnts[r + 1] -= 1;
    }
    for (int i = 1; i < cnts.size(); ++i) {
        cnts[i] += cnts[i - 1];
    }

    int offset = -1;
    for (int i = 0; i < n; ++i) {
        if (cnts[i] + cnts[i + n]== 0) {
            offset = i;
            break;
        }
    }

    vector<int> res(n, 0);
    for (int i = 0; i < n; ++i) {
        res[i] = (B[(i - offset + n) % n]);
    }


    cout << "Yes\n";
    for (int i = 0; i < n; ++i) {
        cout << res[i] + 1 << (i == n - 1 ? '\n' : ' '); 
    }
    return 0;
}

Measured memory_bytes: 10284
import sys
from itertools import product

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    H, W, k = map(int, input().split())
    grid = list(list(input()) for _ in range(H))

    res = 0
    for pattern_H in product([0, 1], repeat=H):
        ign_H = []
        for idx, p in enumerate(pattern_H):
            if p == 1:
                ign_H.append(idx)
        for pattern_W in product([0, 1], repeat=W):
            cnt = 0
            ign_W = []
            for idx, p in enumerate(pattern_W):
                if p == 1:
                    ign_W.append(idx)
            for h in range(H):
                if h in ign_H:
                    continue
                for w in range(W):
                    if w in ign_W:
                        continue
                    if grid[h][w] == "#":
                        cnt += 1
            if cnt == k:
                res += 1
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9232
#include <iostream>

using namespace std;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	long long int r, D, x;
	cin >> r >> D >> x;
	
	
	for(int i=0;i<10;i++)
	{
		x = r*x - D;
		cout << x << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
#define mp make_pair
#define f first
#define s second
#define pb push_back

const int N = 1e5 + 5;
const int OO = 2e9;
const int mod = 1e9+7;

void init() {

}

int n;
ll m,a[N],cum[N],cur,ans;
map<int,int> x,y;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> m;

    for(int i=0;i<n;++i) {

        cin >> a[i];
        a[i] %= m;
        if(i) cum[i] = cum[i-1];
        cum[i] = (cum[i]+a[i])%m;
        x[cum[i]]++;

    }

    for(int i=0;i<n;++i) {

        ans += x[cur]-y[cur];
        y[cum[i]]++;
        cur = (cur+a[i]+m)%m;
    }

    cout << ans << '\n';

    return 0;

}

Measured memory_bytes: 7680
import java.io.*;
public class Main {
        public static void main(String[] args) throws IOException {
                BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                String a;
                while((a = in.readLine()) != null){
                        int x = 0;
                        char b = a.charAt(0);
                        int c = 0;  
                        while(x < a.length()){
                                if(a.charAt(x) == b){ 
                                        ++c;
                                } else {
                                        gfk(Integer.parseInt((new Character(b)).toString()),c);
                                        c = 1;
                                        b = a.charAt(x);
                                }   
                                ++x;
                        }   
                        gfk(Integer.parseInt(new Character(b).toString()),c);
                        System.out.println("");
                }   
        }   
        static void gfk(int a, int b){ 
                if(a == 0){ 
                        for(int i = 1;i < b; ++i){
                                System.out.print(" ");
                        }   
                } else {
                        --b;
                        --a;
                        System.out.print(key[a][b%key[a].length]);
                }   
        }

        static char key[][]
        =   
        {   
        {'\'',  ',',    '.',    '!',    '?'},
        {'a',   'b',    'c',    'A',    'B',    'C'},
        {'d',   'e',    'f',    'D',    'E',    'F'},
        {'g',   'h',    'i',    'G',    'H',    'I'},
        {'j',   'k',    'l',    'J',    'K',    'L'},
        {'m',   'n',    'o',    'M',    'N',    'O'},
        {'p',   'q',    'r',    's',    'P',    'Q',    'R',    'S'},
        {'t',   'u',    'v',    'T',    'U',    'V'},
        {'w',   'x',    'y',    'z',    'W',    'Z',    'Y',    'Z'}
        };
}

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

int main()
{
    string n;
    cin >> n;
    int p = 0;
    for(int i = 0; i < (int)n.size(); i++) p += n[i] - '0';
    if(p % 9) cout << "No" << endl;
    else cout << "Yes" << endl;
}


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

graph = []
for _ in range(n):
    tmp = list(map(int, input().split()))
    if tmp[1] == 0:
        graph.append([])
    else:
        graph.append(tmp[2:])
#print(graph)

seen = [0]*n
to_do = []
in_list = [0]*n
out_list = [0]*n
count = 0

def dfs(v):
    #print(v)
    global count
    if seen[v] == 0:
        seen[v] = 1
        count += 1
        in_list[v] = count
        to_do = graph[v]
        #print(in_list)
        #print(to_do)
        if len(to_do) > 0:
            for i in to_do:
                dfs(i-1)
        count += 1
        out_list[v] = count
        #print(out_list)
while True:
    if 0 in seen:
        k = seen.index(0)
        dfs(k)
    else:
        break

for i in range(n):
    print("{} {} {}".format(i+1,in_list[i],out_list[i]))


Measured memory_bytes: 5632
#include <iostream>
#include <string>
#include <stdio.h>
#include <numeric>
#include <algorithm>
#include <math.h>
using namespace std;
int main(){
    int sum=0;
    for(int i=0;i<5;++i){
        int n;
        cin>>n;
        if(n>=40){
            sum+=n;
        }
        else{
            sum+=40;
        }
    }
    cout<<sum/5<<endl;
    return 0;
}


Measured memory_bytes: 3068
#include<bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopb(i,a,b) for(int i=a;i>=b;i--)
#define loopm(i,a,b,step) for(int i=a;i<b;i+=step)
#define loopbm(i,a,b,step) for(int i=a;i>=b;i-=step)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define INF 1000000007
#define MOD 1000000007
#define BINF 1000000000000000001
#define int long long int
#define double long double

using namespace std;

#undef int
int main()
{
#define int long long int
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    
    int minsum=n;
    loopb(i,n-1,1)
    {
        int dig1=i;
        int dig2=n-i;
        
        int sum=0;
        while(dig1>0)
        {
            sum+=dig1%10;
            dig1/=10;
        }
        while(dig2>0)
        {
            sum+=dig2%10;
            dig2/=10;
        }
        minsum=min(sum,minsum);
    }
    
    cout<<minsum;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/math>
using namespace std;
using namespace atcoder;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    int N; cin >> N;
    int ans = 2 * N;

    for(int k = 1; k * k <= 2 * N; k++) if((2 * N) % k == 0){
        int m0 = k, m1 = (2 * N) / k;
        auto res = crt(vec({0, m1 - 1}), vec({m0, m1}));
        if(res.fi > 0){
            chmin(ans, res.fi);
        }else{
            if(res.se > 0) chmin(ans, res.se);
        }
        res = crt(vec({m0 - 1, m1}), vec({m0, m1}));
        if(res.fi > 0){
            chmin(ans, res.fi);
        }else{
            if(res.se > 0) chmin(ans, res.se);
        }
    }
    Out(ans);

    return 0;
}


Measured memory_bytes: 3648
# ABC154c


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと

    n = int(input())
    a = list(map(int, input().split()))
    b = set(a)
    if len(a) == len(b):
        print('YES')
        exit(0)
    print('NO')


if __name__ == '__main__':
    main()


Measured memory_bytes: 93908
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct elm {
    struct elm *next, *prev;
    int data;
} elm_t;

typedef struct {
    elm_t *front, *back;
} list_t;

void push_back(list_t *list, int data) {
    elm_t *e = malloc(sizeof(elm_t));
    elm_t *f = list->back->prev;
    e->next = f->next;
    e->prev = f;
    e->data = data;
    f->next = e;
    list->back->prev = e;
}

list_t *mklist() {
    list_t *l = malloc(sizeof(list_t));
    l->front = malloc(sizeof(elm_t));
    l->back = malloc(sizeof(elm_t));
    l->front->next = l->back;
    l->back->prev = l->front;
    return l;
}

int a[200000][2];

int cmp(const void *const key, const void *const memb) {
    return *(const int *) key - *(const int *) memb;
}

int main() {
    int n, p = 0;
    long long r = 1;
    scanf("%d", &n);
    for (int i = 0; i < n * 2; i++) {
        scanf("%d", &a[i][0]);
        a[i][1] = (i / n) * 2 - 1;
    }
    qsort(a, n * 2, sizeof(int) * 2, cmp);
    for (int i = 0; i < n * 2; i++) {
        if (p * a[i][1] < 0) r = (r * abs(p)) % 1000000007;
        p += a[i][1];
    }
    printf("%lld\n", r);
}


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

ll an[100010],am[100010];
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(b-a==c-b)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
    return 0;
}


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

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

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (long long)1e18 + 1;

template<typename T>
std::vector<T> pick_up_LIS(const vector<T>& origin, bool continuous = false) {
    std::vector<T> lis;
    if(continuous) {
        std::vector<T> buf(origin.size());
        for(T i = 0; i < (T)origin.size(); i++) {
            buf[origin[i] - 1] = i;
        }
        T max_cnt = 0, cnt = 1, start = 1;
        for(T i = 1; i < (T)buf.size(); i++) {
            if(buf[i - 1] < buf[i]) {
                cnt++;
            }
            else {
                if(max_cnt < cnt) {
                    max_cnt = cnt;
                    start   = i + 1 - max_cnt;
                }
                cnt = 1;
            }
        }
        if(max_cnt < cnt) {
            max_cnt = cnt;
            start   = buf.size() - max_cnt;
        }
        lis.reserve(max_cnt);
        for(T i = 0; i < (T)max_cnt; i++) {
            lis.push_back(start + i);
        }
    }
    else {
        std::vector<T> buf(origin.size() + 1, std::numeric_limits<T>::max());
        buf[0] = std::numeric_limits<T>::min();
        for(const auto& v : origin) {
            auto itr   = lower_bound(buf.begin(), buf.end(), v);
            auto index = distance(buf.begin(), itr);
            buf[index] = (v < buf[index]) ? v : buf[index];
        }
        auto itr = lower_bound(buf.begin(), buf.end(), std::numeric_limits<T>::max());
        std::move(buf.begin() + 1, itr, std::back_inserter(lis));
    }
    return lis;
}

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

    int N;
    std::cin >> N;

    vector<int> P(N);
    REP(i, N) {
        std::cin >> P[i];
    }

    auto lis = pick_up_LIS(P, true);
    std::cout << N - lis.size() << std::endl;

    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int n,k;
  	cin >>n >>k;
  	vector<vector<int>> ds(n);
  	rep(i,n){
    	int t,d;
      	cin >>t >>d;t--;
      	ds[t].push_back(d);
    }
  	vector<int> y0,y1;
  	rep(i,n){
    	if(ds[i].size()==0) continue;
      	sort(ds[i].begin(),ds[i].end());
      	y1.push_back(ds[i].back());
      	ds[i].pop_back();
      	y0.insert(y0.end(), ds[i].begin(), ds[i].end());
    }//y1には各種類の最大、y0はそれ以外を昇順で
  	sort(y0.rbegin(), y0.rend());
    sort(y1.rbegin(), y1.rend());//それぞれ降順
  	long long ans=0;
  	int Y=max(0,k-int(y0.size()));
    long long X=0;
  	rep(i,Y)   X +=y1[i]; //種類がk個に満たない時
  	rep(i,k-Y) X +=y0[i];
  	while(1){
    	ans=max(ans, X+(long long)Y*Y);
      	if(Y >= k || Y >= y1.size()) break;
      	X += y1[Y];
      	X -= y0[k-Y-1];
      	++Y;
    }
    cout <<ans <<endl;
  return 0;

}


Measured memory_bytes: 6396
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

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

int main()
{
    int N;
    cin >> N;
    int s[100];
    int ans = 0;
    for(int i = 0; i < N; ++i){
        cin >> s[i];
        ans += s[i];
    }

    sort(s, s+N);
    for(int i = 0; i < N; ++i){
        if(ans%10 != 0){
            cout << ans << endl;
            return 0;
        }
        if(s[i] % 10 != 0){
            ans -= s[i];
        }
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		int ans = 0;

		for(int i=0;i<s.length();i++) {

			if(s.charAt(i) == '2') ans++;
		}

		System.out.println(ans);

	}

}


Measured memory_bytes: 21844
def main():
    N = int(input())
    L = [int(i) for i in input().split()]
    L.sort()
    L_pair = []
    for i in range(N):
        for j in range(i+1, N):
            L_pair.append((i, j))

    def is_ok(mid, i, j):
        if L[mid] < L[i] + L[j]:
            return True
        else:
            return False

    def binary_search_meguru(i, j):
        left = j
        right = N
        while right - left > 1:
            mid = left + ((right - left) // 2)
            if is_ok(mid, i, j):
                left = mid
            else:
                right = mid
        return right

    ans = 0
    for i, j in L_pair:
        r = binary_search_meguru(i, j)
        ans += r - (j + 1)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 136108
#include<cstdio>

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

int h,w;
int sx,sy,tn;
int map[13][13];
//int mn[13][13];
//int tx[25],ty[25];
//int e[24][4],cf[24][4];
inline int dfs(char x,char y,char n){
	int i,k,nx,ny;
	int res=0;
	//printf("%d %d\n",x,y);
	for(k=0;k<4;k++){
		nx=x;
		ny=y;
		while(1){
			nx+=dx[k];
			ny+=dy[k];
			if(map[ny][nx]==0)continue;
			else if(map[ny][nx]==1){
				map[ny][nx]=0;
				//res+=dfs(nx,ny,n|(1<<mn[ny][nx]));
				res+=dfs(nx,ny,n-1);
				map[ny][nx]=1;
				break;
			}
			else if(map[ny][nx]==3)break;
			//else if(map[ny][nx]==2 && n==(1<<tn)-1){
			else if(map[ny][nx]==2 && n==0){
				res++;
				break;
			}
		}
	}
	return res;
}
int main(){
	int i,j,k;
	int nx,ny;
	
	while(1){
		scanf("%d%d",&w,&h);
		if(w==0 && h==0)break;
		tn=0;
		//memset(mn,-1,sizeof(mn));
		for(i=0;i<=w+1;i++)map[0][i]=map[h+1][i]=3;
		for(i=1;i<=h;i++){
			for(j=1;j<=w;j++){
				scanf("%d",&map[i][j]);
				if(map[i][j]==2){sx=j;sy=i;}
				if(map[i][j]==1){
					//mn[i][j]=tn;
					//tx[tn]=j;ty[tn]=i;
					tn++;
				}
			}
			map[i][0]=map[i][w+1]=3;
		}
		/*
		memset(e,-1,sizeof(e));
		memset(cf,0,sizeof(cf));
		for(i=0;i<tn;i++){
			for(k=0;k<4;k++){
				nx=tx[i];ny=ty[i];
				while(1){
					nx+=dx[k];ny+=dy[k];
					if(map[ny][nx]==1){
						e[i][k]=mn[ny][nx];
						break;
					}
					if(map[ny][nx]==3)break;
				}
				nx=tx[i];ny=ty[i];
				while(1){
					nx+=dx[k];ny+=dy[k];
					if(map[ny][nx]==2){
						cf[i][k]=1;
						break;
					}
					if(map[ny][nx]==3)break;
				}
			}
		}
		
		for(i=0;i<tn;i++){for(j=0;j<4;j++)printf("%2d ",e[i][j]);printf("\n");}
		for(i=0;i<tn;i++){for(j=0;j<4;j++)printf("%d",cf[i][j]);printf("\n");}
		for(i=0;i<=h+1;i++){for(j=0;j<=w+1;j++)printf("%d",map[i][j]);printf("\n");}
		printf("tn:%d\n",tn);
		for(i=0;i<=h+1;i++){
			for(j=0;j<=w+1;j++)if(mn[i][j]>=0){printf("%d",mn[i][j]);}else{printf(".");}
			printf("\n");
		}
		*/
		printf("%d\n",dfs(sx,sy,tn));
		
	}
	
	return 0;
}

Measured memory_bytes: 1032
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
  
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}
  
int main()
{
  int n;
  n = inputValue();

  vector<int> d(n);
  int i;
    rep(i, n){
        cin >> d[i];
    }

  std::sort(d.begin(), d.end());

  cout << (d[n/2] - d[n/2 - 1]);

  return 0;
}


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

#define vi vector<int>
#define vpii vector<pair<int, int>>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pii pair<int, int>
#define int long long int
#define inf INT_MAX
#define _inf INT_MIN
#define whilet int t;cin>>t;while(t--)
const int N = 100005;

int min_cost(vi v, int k) {
	int n = v.size();
	vi dp(n);

	dp[0] = 0;
	for (int i = 1; i < n; i++) {

		int a = inf;
		for (int j = 1; j <= k; j++) {
			if (i - j >= 0) a =  min(abs(v[i - j] - v[i] ) + dp[i - j], a);
		}

		dp[i] = a;
	}

	return dp[n - 1];
}

// dp contest questions from atcoder.jp/contests/dp/tasks
void solve() {
	int n, k;
	cin >> n >> k ;
	vi v(n);
	for (int i = 0; i < n; i++) cin >> v[i];
	cout << min_cost(v , k) << endl;

}

void init() {
	ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("../input.txt", "r", stdin);
	freopen("../output.txt", "w", stdout);
#endif
}


int32_t main()
{
	init();
	// whilet solve();
	solve();
}

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

int main(){
  string s,t;
  cin>>s>>t;
  int ans=0;
  for(int i=0;i<s.size();i++){
    if(s[i]!=t[i]){
      ans++;
    }
  }
  cout<<ans<<endl;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  
  vector<vector<char>> table(H, vector<char>(W));
  vector<bool> rows(H, false);
  vector<bool> cols(W, false);
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> table.at(i).at(j);
      if (table.at(i).at(j) == '#') {
        rows.at(i) = true;
        cols.at(j) = true;
      }
    }
  }

  for (int i = 0; i < H; i++) {
    if (!rows.at(i)) continue;
    for (int j = 0; j < W; j++) {
      if (cols.at(j)) cout << table.at(i).at(j);
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"bytes"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func abs(n int) int {
	if n >= 0 {
		return n
	}
	return -1 * n
}

func main() {
	scanner := makeScanner(1024)
	nl := eGetInts(scanner)
	n, l := nl[0], nl[1]

	agi := make([]int, n)
	total := 0
	for i := range agi {
		agi[i] = l + i + 1 - 1
		total += agi[i]
	}
	mindiff := 10000
	mini := -1
	for i := range agi {
		diff := total - agi[i]
		if abs(total-diff) < mindiff {
			mindiff = abs(total - diff)
			mini = i
		}
	}
	total = 0
	for i := range agi {
		agi[i] = l + i + 1 - 1
		if i != mini {
			total += agi[i]
		}
	}
	fmt.Println(total)
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}

type ints []int

func (s ints) String() string {
	var buf bytes.Buffer
	buf.WriteString("[")
	sep := ""
	for _, v := range s {
		buf.WriteString(fmt.Sprintf("%s%d", sep, v))
		sep = ", "
	}
	buf.WriteString("]")
	return buf.String()
}

func reverse(a ints) ints {
	r := make(ints, len(a))
	for i := 0; i < len(a); i++ {
		r[i] = a[len(a)-1-i]
	}
	return r
}
func max(a ints) (int, bool) {
	if len(a) == 0 {
		return 0, false
	}
	m := a[0]
	for _, e := range a {
		if e > m {
			m = e
		}
	}
	return m, true
}

// func min(a []int) int {
// 	m := a[0]
// 	for _, v := range a {
// 		if v < m {
// 			m = v
// 		}
// 	}
// 	return m
// }

func sum(a ints) int {
	if len(a) == 0 {
		return 0
	}
	sum := 0
	for _, e := range a {
		sum += e
	}
	return sum
}
func find(n int, a ints) int {
	for i, v := range a {
		if n == v {
			return i
		}
	}
	return -1
}


Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <numeric>
#include <bits/stdc++.h>

#define int long long

struct edge {
    int to;
    int cost;
};

using namespace std;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vb = vector<bool>;
using qi = queue<int>;
using P = pair<int, int>;
using graph = vector<vector<edge>>;
// using graph = vector<vector<int>>;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define delim(i, n) cout << (i == n-1 ? "\n" : " ");

const int inf = 1LL << 60;
// const int inf = 100000000;
const int mod = 1000000007;

const int maxn = 120003;
int n, m, k, l;

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

    cin >> n >> m >> k;
    l = n / m;
    if (n%m != 0) {
        l++;
    }
    
    cout << l*k << "\n";
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const ll MOD = 1000000007;
const double EPS = 1e-9;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

int digsum(int n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

int main(void){

    
    int n;
    cin>>n;
    if(n%digsum(n)==0)fin("Yes");
    else fin("No");

}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<math.h>

#define TORIDASI(size,data) if(str.substr(i,size) == data){\
i+=size;\
}
#define SUSUMU(doredake,mozi) for(int ssm = 0;ssm < doredake;ssm++){\
	str += mozi;\
}


using namespace std;
const long long int KIRAI = 10e9 + 7;

int main() {
	long long int a,b = 0;
	int c;
	b = 0;
	cin >> a;
	c = a % 11;
	if (c != 0) {
		if (c >= 7) {
			b++;
		}
		b++;
	}
	b += ((long long int)(a / 11)) * 2;
	cout << b << endl;
}

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

for i in range(N, 0, -1):
    # print(i)
    # print(s[-i:])
    # print(t[:i])
    if s[-i:] == t[:i]:
        print(2 * (N - i) + i)
        exit()
print(2 * N)


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

ll count(ll h){
    if(h==1) return 1;
    else return 1+2*count(h/2);
}

int main(){
    ll h;
    cin>>h;
    ll sum=count(h);
    cout<<sum<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
  int n,i,j,k;cin>>n;
  string s;
  cin>>s;
  int cnt[26];
  for(i=0;i<26;i++)
  {
    cnt[i]=0;
  }
  for(i=0;i<n;i++)
  {
    cnt[s[i]-'a']++;
  }
  int curr=1;
  for(i=0;i<26;i++)
  {
    if(cnt[i]>0)
    {
      curr=(curr*(cnt[i]+1))%1000000007;
    }
  }
  cout<<curr-1;
  return 0;
}

Measured memory_bytes: 512
H , W = map(int,input().split())
while H != 0 and W != 0:
  for i in range (W-1):
    print('#',end='')
  print('#')
  for j in range (H-2):
    print('#',end='')
    for k in range (W-2):
      print('.',end='')
    print('#')
  for i in range (W):
    print('#',end='')
  print()
  print()
  H , W = map(int,input().split())
  


Measured memory_bytes: 7000
package main

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

func newScanner() *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	return scanner
}

func scanInt() int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

var sc = newScanner()

var factorialMemo []int64

func factorial(n, m int) int64 {
	if n <= 1 {
		return 1
	}
	if factorialMemo[n] != 0 {
		return factorialMemo[n]
	}
	ret := int64(n) * factorial(n-1, m) % int64(m)
	factorialMemo[n] = ret
	return ret
}

func combination(n, k, m int) int64 {
	x := factorial(n, m) % int64(m)
	y := factorial(k, m) % int64(m)
	y = y * factorial(n-k, m) % int64(m)
	return x * pow(y, int64(m-2), int64(m)) % int64(m)
}

func permutation(n, k, m int) int64 {
	return combination(n+k-1, n-1, m)
}

func pow(p, n, m int64) int64 {
	if n == 0 {
		return 1
	}
	if n&1 == 0 {
		r := pow(p, n/2, m)
		return r * r % int64(m)
	}
	return int64(p) * pow(p, n-1, m) % int64(m)
}

func main() {
	const m = 1000000007
	n, k := scanInt(), scanInt()
	a := scanInts(n)
	sort.Ints(a)

	factorialMemo = make([]int64, n)
	var sum int64
	for d := 0; d < 2; d++ {
		for i := k - 1; i < n; i++ {
			ret := combination(i, k-1, m)
			if d == 1 {
				ret = -ret
			}
			sum += ret * int64(a[i]) % int64(m)
			sum %= m
		}
		sort.Sort(sort.Reverse(sort.IntSlice(a)))
	}
	fmt.Println(sum)
}


Measured memory_bytes: 8064
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if (x < y) x = y; }

int main() {
	long long X; long long Y;
	while (~scanf("%lld%lld", &X, &Y)) {
		puts(abs(X - Y) > 1 ? "Alice" : "Brown");
	}
	return 0;
}


Measured memory_bytes: 256
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

sx, sy, tx, ty = nl()

path = ''

for i in range(ty-sy):
    path += 'U'
for i in range(tx-sx):
    path += 'R'
for i in range(ty-sy):
    path += 'D'
for i in range(tx-sx):
    path += 'L'

path += 'L'
for i in range(ty-sy+1):
    path += 'U'
for i in range(tx-sx+1):
    path += 'R'
path += 'DR'
for i in range(ty-sy+1):
    path += 'D'
for i in range(tx-sx+1):
    path += 'L'
path += 'U'
print(path)









Measured memory_bytes: 44252
#include <bits/stdc++.h>
using namespace std;
long long int jue(long long int aa)
{
    if(aa<0)
    {
        return -1*aa;
    }
    else
    {
        return aa;
    }
}
int main()
{
 int n,m;
 scanf("%d%d",&n,&m);
 int a[220000];
 int b[220000];
 memset(a,0,sizeof(a));
 memset(b,0,sizeof(b));
 int p,q;
 for(int i=0;i<m;i++)
 {
     scanf("%d%d",&p,&q);
     if(p==1)
     {
        a[q]++;
     }
     if(q==1)
     {
         a[p]++;
     }
     if(p==n)
     {
         b[q]++;
     }
     if(q==n)
     {
         b[p]++;
     }
 }
 int i;
 for(i=2;i<n;i++)
 {
     if(a[i]>0&&b[i]>0)
     {
         printf("POSSIBLE\n");
         break;
     }
 }
 if(i==n)
 {
     printf("IMPOSSIBLE\n");
 }
    return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
int kaijo(int n){
	int ans=1;
	for(int i=2;i<=n;i++){
		ans*=i;
		ans%=MOD;
	}
	return ans;
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int comb(int a,int b){
	return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
}

signed main(){
	int x,a;
	cin>>x>>a;
	if(x<a)puts("0");
	else puts("10");
	return 0;
}


Measured memory_bytes: 256
/*=======================
Author    : Shounak Dey
Filename  : 1180a.cpp
=======================	*/
 
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int ull;
 
#define PB push_back
#define MK make_pair 
#define SZ(a) (int)(sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define read(n) scanf("%d",&n)
#define readl(n) scanf("%lld",&n)
#define readul(n) scanf("%llu",&n);
 
 
#define SORTV(a) sort(a.begin(),a.end())
#define TEST int Test;cin >> Test;while(Test--)
#define gcd(a,b) __gcd(a,b)
#define ffs(a) __builtin_ffs(a) // find first set
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
 
 
#define error(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }
 
vector<string> split(const string& s, char c) {
	vector<string> v;
	stringstream ss(s);
	string x;
	while (getline(ss, x, c))
		v.emplace_back(x);
	return move(v);
}
 
void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}
 
int main()
{
	fast_io;
	ll w,a,b;
	cin >> w >> a >> b;
	ll al,ar,bl,br;
	al = a;
	bl = b;
	ar = a+w;
	br = b+w;
	if(al<bl){
	    ll ret=0;
	    if(bl>ar)
	        ret = bl-ar;
	    cout << ret << endl;
	}
	else{
	    ll ret=0;
	    if(al>br)
	        ret = al-br;
	    cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>
#include <fstream>
#include <cassert>
using namespace std;

//common
typedef long long i64,ll;

#define BR "\n"
#define ALL(c) (c).begin(),(c).end()
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,r) for(int i=(l);i<(int)(r);++i)
#define EACH(it,o) for(auto it = (o).begin(); it != (o).end(); ++it)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))

//debug
#ifdef NDEBUG
#define DUMP(x)
#define DUMPLN(x)
#define DEBUG(x)
#define DEBUGLN(x)
#define LINE()
#define LINELN()
#define CHECK(exp,act)
#define STOP(e)
#else
#define DUMP(x)  cerr << #x << " = " << (x)
#define DUMPLN(x)  DUMP(x) <<endl
#define DEBUG(x) DUMP(x) << LINE() << " " << __FILE__
#define DEBUGLN(x) DEBUG(x)<<endl
#define LINE()    cerr<< " (L" << __LINE__ << ")"
#define LINELN()    LINE()<<endl
#define CHECK(exp,act)  if(exp!=act){DUMPLN(exp);DEBUGLN(act);}
#define STOP(e)  CHECK(e,true);if(!(e)) exit(1);
#endif

template<class T> inline string toString(const vector<T>& x) {
	stringstream ss;
	REP(i,x.size()){
		if(i!=0)ss<<" ";
		ss<< x[i];
	}
	return ss.str();
}

template<class T> inline string toString(const vector<vector<T> >& map) {
	stringstream ss;
	REP(i,map.size()){
		if(i!=0)ss<<BR;
		ss<< toString(map[i]);
	}
	return ss.str();
}
template<class K,class V>  string toString(map<K,V>& x) {
	string res;stringstream ss;
	for(auto& p:x)ss<< p.first<<":" << p.second<<" ";
	return ss.str();
}

string BITtoString(int bit){
    stringstream ss;
    while(bit!=0){ss<<(bit%2);bit/=2;}
    string res=ss.str();reverse(ALL(res));
    return res;
}

template<typename T,typename V> inline T mod(T v,V MOD){
	return (v%MOD+MOD)%MOD;
}

class Main{
public:
	
	void run(){
		int Q;scanf("%d",&Q);
		REP(q,Q){
			ll v;scanf("%llx",&v);
			bool sign=(v>>31)&1;
			ll Int=0;
			for(int i=7;i<31;i++){
				if((v>>i)&1)Int+=1LL<<(i-7);
			}
			ll Float=0;
			for(int i=0;i<7;i++){
				if((v>>i)&1)Float+=(1LL<<i)*78125;
			}
			if(sign)printf("-");
			printf("%lld.",Int);
			if(Float==0){
				printf("0\n");
			}else{
				stringstream ss;ss<<setw(7)<<setfill('0')<<Float;
				string res;ss>>res;
				int r;
				for(r=res.size();res[r-1]=='0'&&  r-1>=0;r--);
				cout << res.substr(0,r)<<endl;
			}
		}
	}
};

 int main(){
	//ios::sync_with_stdio(false);
 	Main().run();
 	return 0;
 }

Measured memory_bytes: 1292
#include<stdio.h>
int main(void)
{
    int n;
    int i;
    int kari = 100000,kari2;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        kari = kari + kari*0.05;
        kari2 =(kari/1000)*1000;
        if(kari-kari2>0)
        {
            kari = kari-(kari- ((kari2/1000)*1000));
            kari=kari + 1000;
        }
    }
    printf("%d\n",kari);
    return 0;
}

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

using namespace std;

int main (void) {
    int H, W;
    cin >> H >> W;
    vector<vector<int>> c(10, vector<int>(10));
    for ( int i = 0; i <= 9; i++ ) {
        for ( int j = 0; j <= 9; j++ ) {
            cin >> c.at(i).at(j);
        }
    }
    vector<vector<int>> A(H+1, vector<int>(W+1));
    for ( int i = 1; i <= H; i++ ) {
        for ( int j = 1; j <= W; j++ ) {
            cin >> A.at(i).at(j);
        }
    }

    /* Warshall-Floyd Algorithm */
    for ( int relay = 0; relay <= 9; relay++ ) {
        for ( int start = 0; start <= 9; start++ ) {
            for ( int dest = 0; dest <= 9; dest++ ) {
                c.at(start).at(dest) = min(c.at(start).at(dest),
                                           c.at(start).at(relay) + c.at(relay).at(dest));
            }
        }
    }

    long long ans = 0;
    for ( int i = 1; i <= H; i++ ) {
        for ( int j = 1; j <= W; j++ ) {
            if ( A.at(i).at(j) >= 0 ) ans += c.at(A.at(i).at(j)).at(1);
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3792