akhauriyash/Code-Regression huggingface dataset:
n = int(input())
A = []
B = []
C = []
for _ in range(n):
    a, b, c = map(int, input().split())
    A.append(a)
    B.append(b)
    C.append(c)
dp = [[0] * n for _ in range(3)]
dp[0][0] = A[0]
dp[1][0] = B[0]
dp[2][0] = C[0]
for i in range(1, n):
    dp[0][i] = A[i] + max(dp[1][i-1], dp[2][i-1])
    dp[1][i] = B[i] + max(dp[0][i-1], dp[2][i-1])
    dp[2][i] = C[i] + max(dp[0][i-1], dp[1][i-1])
print(max(dp[0][-1], dp[1][-1], dp[2][-1]))

Measured memory_bytes: 32648
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define in auto&it
#define out auto it
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
const double pi = acos(-1);
#define err(x) cerr<<#x<<" = "<<x<<'\n';
int main() {
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
		freopen("error.txt", "w", stderr);
	#endif
	fastio
	int n;
	cin>>n;
	ll ar[n];
	for(int i=0;i<n;++i) cin>>ar[i];
	vector<int>suf(n);
	suf[n-1]=0;
	suf[n-2]=ar[n-1]%mod;
	for(int i=n-3;i>=0;--i){
		suf[i]=((ar[i+1])%mod+(suf[i+1])%mod)%mod;
	//for(auto x:suf) cerr<<x<<" ";
		suf[i]%=mod;
	}
	ll ans=0;
	for(int i=0;i<n-1;++i){
		ans+=((ar[i]%mod)*(suf[i]%mod))%mod;
		ans%=mod;
	}
	cout<<(((ans%mod)+mod)%mod);
	return 0;
}

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

using namespace std;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef pair<int,int> pii;
typedef long long ll;
#define debug(x) cout << #x << "=" << x << endl;
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(); cout << (i>0 ? " ":"") << v[i++]); cout << "\n"; return os;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x;
    cin >> x;
    ll x0 = 100;
    int ans = 0;
    while(x0 < x){
        ans++;
        x0 = x0 + x0/100;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3628
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


S1 =  sys.stdin.readline().rstrip()
S2 =  sys.stdin.readline().rstrip()

if S1[::-1] == S2:
    print("YES")
else:
    print("NO")

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

using namespace std;

inline int read(){
	int x(0);char ch('@');bool flag(false);
	for(;!isdigit(ch);ch=getchar())	flag|=(ch=='-');
	for(;isdigit(ch);ch=getchar())	x=(x<<3)+(x<<1)+(ch^48);
	return flag?-x:x;
}

int n,m;
int OP[110][110];
int temp;

int main(){
	n=read(),m=read();
	for(register int i(1);i<=n;++i)
		for(register int j(1);j<=m;++j)
			OP[i][j]=read();
	for(register int i(1);i<=n;++i)
		for(register int j(i+1);j<=n;++j){
			int ans=0;
			for(register int k=1;k<=m;++k)
				ans+=pow(OP[i][k]-OP[j][k],2);
			if(ans==pow((int)sqrt(ans),2))	++temp;
		}
	printf("%d\n",temp);
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>

using namespace std;

#define MAX_H 20
#define MAX_W 20

#define INF (1<<28)

int w, h;
int F[MAX_H][MAX_W];
int G[MAX_H][MAX_W];
int gy, gx;
int y, x;
int py, px;

void debug();

const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
void move(int d) {
    //printf("    %d\n", d);
    while (F[y][x] == 0) {
        x += dx[d];
        y += dy[d];
    }
    if (F[y][x] == 3) return;
    F[y][x] = 0;
    y -= dy[d];
    x -= dx[d];
}

bool can_move(int d) {
    if (F[y+dy[d]][x+dx[d]] == 1) return false;
    int _y = y;
    int _x = x;
    while (F[_y][_x] == 0) {
        _y += dy[d];
        _x += dx[d];
        if (_y < 0 || h <= _y || _x < 0 || w <= _x) return false;
    }
    return true;
}

void debug() {
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            printf("%d ", F[i][j]);
        }
        printf("\n");
    }
}

int solve(int cur) {
    if (y == gy && x == gx) return 0;
    if (cur >= 10) return INF;
    int min_cost = INF;
    for (int i = 0; i < 4; i++) {
        if (can_move(i)) {
            int backup[h][w];
            int py = y, px = x;
            for (int j = 0; j < h; j++)
                for (int k = 0; k < w; k++)
                    backup[j][k] = F[j][k];
            move(i);
            min_cost = min(min_cost, solve(cur+1)+1);
            y = py, x = px;
            for (int j = 0; j < h; j++)
                for (int k = 0; k < w; k++)
                    F[j][k] = backup[j][k];
        }
    }
    return min_cost;
}

int main() {
    while (scanf("%d %d", &w, &h), w || h) {
        int sy, sx;
        for (int i = 0; i < h; i++)
            for (int j = 0; j < w; j++) {
                scanf("%d", &F[i][j]);
                if (F[i][j] == 2) {
                    y = i, x = j;
                    F[i][j] = 0;
                }
                if (F[i][j] == 3) 
                    gy = i, gx = j;
            }
        int ans = solve(0);
        printf("%d\n", (ans > 10 ? -1 : ans));
    }
    return 0;
}

Measured memory_bytes: 1044
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scanf("%d\n", &N)
	A := make([]int, N)
	for i := 0; i < N; i++ {
		var a int
		fmt.Scan(&a)
		A[i] = a
	}
	cnt := 0
	pos := 0
	num := 1
	ok := false
	for pos < N {
		if A[pos] != num {
			pos++
			cnt++
			continue
		}
		if A[pos] == num {
			ok = true
			pos++
			num++
			continue
		}
	}
	if ok {
		fmt.Println(cnt)
	} else {
		fmt.Println(-1)
	}
}


Measured memory_bytes: 7424
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n,t,a,x;
    double y,d;
    vector<pair<double,ll> >v;
    pair<double,ll>p;
    cin>>n;
    cin>>t>>a;
    //d=t-a*0.006;
    for(ll i=0;i<n;i++)
    {
        cin>>x;
        y=t-x*0.006;
        y=abs(y-a);
        p.first=y;
        p.second=i+1;
        v.push_back(p);
    }
    sort(v.begin(),v.end());
    cout<<v[0].second<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i,l,r) for(int i = (int)l;i<(int)r;i++)
#define td(v) v.begin(),v.end()
#define sz(v) (int)v.size()
//#define M   1000000007 // 1e9 + 7
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline ll mod(ll n, ll m){ ll ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0LL ? a : gcd(b, a%b));}
ll exp(ll a,ll b,ll m){
    
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}


int32_t main(){
  fastio;
  int n;
  cin>>n;
  set<string > S;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    S.insert(s);
  }
  cout<<S.size()<<endl;

  // Math -> gcd it all
  // Did u check N=1? Did you switch N,M?
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    bool flag = false;
    rep(i, b) if(a * (i + 1) % b == c) flag = true;
    if(flag) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int N, A, B;

  scanf("%d %d %d", &N, &A, &B);

  int max, min;

  if(A > B) max = B;
  else max = A;

  min = A + B - N;
  if(min <= 0) min = 0;

  printf("%d %d\n", max, min);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    int n,v,j;
    cin >> n;
    int l[n];
    for(int i = 0; i < n; i++){
        cin >> l[i];
    }
    for(int k = 0; k < n-1; k++){
            cout << l[k] << " ";
        }
        cout << l[n-1] << endl;
    for(int i = 1; i < n; i++){
        v = l[i];
        j = i - 1;
        while( j >= 0 and l[j] > v){
            l[j+1] = l[j];
            j--;
        l[j+1] = v;
        }
        for(int k = 0; k < n-1; k++){
            cout << l[k] << " ";
        }
        cout << l[n-1] << endl;
        
    }
}
    



Measured memory_bytes: 3096
#include <iostream>
#define MAX_N 100
#define MAX_M 100

using namespace std;

int n, m, a[MAX_N][MAX_M], b[MAX_M];

void solve() {
    for(int i = 0; i < n; i++) {
        int ans = 0;
        for(int j = 0; j < m; j++) {
            ans += a[i][j] * b[j];
        }
        cout << ans << endl;
    }
}

int main() {
    cin >> n >> m;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    for(int i = 0; i < m; i++) cin >> b[i];
    solve();
}


Measured memory_bytes: 3088
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n, q] <- getIntList
    edges <- VU.replicateM (n-1) $ do
        [a, b] <- getIntList
        return (a-1, b-1)
    pxs <- VU.replicateM q $ do
        [p, x] <- getIntList
        return (p-1, x)
    let nexts = V.create $ do
            vec <- VM.replicate n []
            VU.forM_ edges $ \(a, b) -> do
                VM.modify vec (b :) a
                VM.modify vec (a :) b
            return vec
        vals = VU.create $ do
            vec <- VUM.replicate n 0
            VU.forM pxs $ \(p, x) -> do
                VUM.modify vec (+ x) p
            return vec
        count = VU.create $ do
            vec <- VUM.replicate n 0
            let dfs par q acc = do
                    let acc' = acc + (vals VU.! q)
                    VUM.write vec q acc'
                    let clds = filter (/= par) (nexts V.! q)
                    forM_ clds $ \i -> dfs q i acc'
            dfs (-1) 0 0
            return vec
    putStrLn . unwords . map show $ VU.toList count

Measured memory_bytes: 45052
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	n <- readInt
	print $ if n `mod` 2 == 0 then n else 2 * n

Measured memory_bytes: 508
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        String s = sc.next();
        int c = 0;

        for(int i = 0; i < s.length()-2; i++){
            String ss = s.substring(i, i+3); 
            if (ss.equals("ABC")) c++;
        }

        System.out.println(c);
    }
}

Measured memory_bytes: 22608
class Array
  def diff; res = []; (size-1).times{|i| res << (self[i+1] - self[i]).abs }; res end
end

n, a, b = gets.to_s.split.map{|t| t.to_f }
x = gets.to_s.split.map{|t| t.to_i }

d = x.diff

c = b / a
# p d
k = d.count{|t| t <= c }
d = d.select{ |t| t <= c }.reduce(0){|s, t| s+t }
# p d
# p c
# p k
ans = a.to_i * d + b.to_i * (n-1-k)

puts ans.to_i

Measured memory_bytes: 10124
//g++ test.cpp -o test.out
//入出力：http://kaitei.net/cpp/iostream/
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
using namespace std;

int X;

int isBuyable(){
	if(X==0) return 0;
	else if(X%100==0) return 1;
	else{
		int minimum_times = (X%100)/5;
		if((X%100)%5!=0) minimum_times++;
		if((int)(X/100)>=minimum_times) return 1;
	}
	return 0;
}

int main(){
	cin >> X;

	if(isBuyable()){
		cout << 1;
		return 0;
	}
	cout << 0;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <random>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)

char affinechar(char c, int a, int b) {
    if (islower(c)) {
        return 'a' + (a * (c - 'a') + b) % 26;
    }else {
        return c;
    }
}

void affineconv(string &s, int a, int b) {
    REP(i,s.size()) {
        s[i] =  affinechar(s[i], a, b);
    }
}

bool isEnglish(string s) {
    return s.find("that") != string::npos || s.find("this") != string::npos;
}

random_device rnd;

int rnda() {
    int a = rnd();
    a = abs(a) % 26;
    if (a % 2 == 0 || a % 13 == 0) {
        return rnda();
    }else {
        return a;
    }
}

int rndb() {
    return rnd() % 26;
}

int main() {
    string s;
    while(getline(cin, s)) {
        if (s.size() > 3) {
            while (!isEnglish(s)) {
                affineconv(s, rnda(), rndb());
                //cout << s << endl;
            }
            cout << s << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

template<class T, class Cond>
struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  bool operator()(T& a, const T& b) const {
    if(cond(a, b)) { a = b; return true; }
    return false;
  }
};
template<class T, class Cond>
chain<T, Cond> make_chain(Cond cond) { return chain<T, Cond>(cond); }

i64 gcd(i64 a, i64 b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  i64 K;
  cin >> K;
  i64 ans = 0;
  rep(a,1,K + 1) rep(b,1,K + 1) rep(c,1,K + 1) {
    ans += gcd(a, gcd(b, c));
  }
  std::cout << ans << std::endl;
}


Measured memory_bytes: 3596
#include<iostream>
#include<iomanip>
#include<cstdio>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>
#include<numeric>

using namespace std;
typedef long long ll;
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;}


ll G[200][200];

int main() {
    int N, M, R; cin >> N >> M >> R;
    vector<int> r(R), A(M), B(M), C(M);
    for (int i = 0; i < R; i++) {cin >> r[i]; r[i]--;}
    sort(r.begin(),r.end());
    for (int i = 0; i < M; i++) cin >> A[i] >> B[i] >> C[i];
    
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            G[i][j] = 1e18;
        }
    }

    for (int i = 0; i < M; i++) {
        G[A[i]-1][B[i]-1] = G[B[i]-1][A[i]-1] = C[i];
    }
    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                chmin(G[i][j],G[i][k]+G[k][j]);
            }
        }
    }
    ll res = 1e9;
    do {
        ll tmp = 0;
        for (int i = 0; i < R-1; i++) tmp += G[r[i]][r[i+1]];
        chmin(res,tmp);
    } while (next_permutation(r.begin(),r.end()));
    cout << res << endl;



}


Measured memory_bytes: 768
n, q = (int(x) for x in input().split())
process = [input().split() for _ in range(n)]
time = 0
while process:
    p = process.pop(0)
    if int(p[1]) <= q:
        time += int(p[1])
        print(p[0], time)
    else:
        time += q
        process.append([p[0], int(p[1]) - q])

Measured memory_bytes: 19688
N=int(input())
A=[0 for i in range(N)]
for i in range(N):
  A[i]=int(input())
max1=max(A)
numbers_of_max1=0
for i in range(N):
  if A[i]==max1:
    numbers_of_max1+=1
    
if numbers_of_max1>1:
  for i in range(N):
    print(max1)
else:
  L=A.copy()
  L.pop(L.index(max1))
  max2 = max(L)
  for i in range(N):
    if A[i]==max1:
      print(max2)
    else:
      print(max1)

Measured memory_bytes: 14072
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;


int main() {
int D,N;
cin >> D >> N;
int64_t ans;
if (D == 0) {
    if (N == 100) ans = 101;
    else ans = N;
} else if (D == 1) {
    if (N == 100) ans = 10100;
    else ans = N*100;
} else if (D == 2) {
    if (N == 100) ans = 1010000;
    else ans = N*10000;
}
cout << ans << endl;


return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int power_of_3(int);

int main (void){
    int x;
    //fprintf(stderr, "数字を入力>>>");

    scanf("%d", &x);

    printf("%d\n", power_of_3(x));

}

int power_of_3(int x){
    return x*x*x;
}


Measured memory_bytes: 2048
#include<stdio.h>
#define MAX 44
int main(){
  int n,i;
  int y0,y1,y2;

  scanf("%d",&n);

  y1=1;
  y0=0;

  for(i = 1; i<=n ; i++){
    y2 = y1 + y0;
    y0 = y1;
    y1 = y2;
    if(i == n){
      printf("%d\n",y1);
    }
  }
  return 0;
}



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

int main() {
  int wat1, wat2, sug1, sug2, melt, max;
  cin >> wat1 >> wat2 >> sug1 >> sug2 >> melt >> max;
  int ansSW = wat1 * 100, ansS = 0;
  for (int i = 0; i < 31; i++) {
    for (int j = 0; j < 31; j++) {
      for (int k = 0; k < 100; k++) {
        for (int l = 0; l < 100; l++) {
          int Water = (wat1 * i + wat2 * j) * 100;
          int Sugar = sug1 * k + sug2 * l;
          if (Water + Sugar <= max && Sugar <= Water * melt / 100 &&
              (double)(ansS) / (ansSW) <= (double)Sugar / (Water + Sugar)) {
            ansSW = Water + Sugar;
            ansS = Sugar;
          }
        }
      }
    }
  }

  cout << ansSW << " " << ansS << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main() {
	int n;
	int check = 0;
	int s[100040];
	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%d", &s[i]);
		if (s[i] % 2 == 1) { check++; }
	}
	if (check >= 1) { printf("first"); }
	else { printf("second"); }
}

Measured memory_bytes: 512
integer N,A
integer,allocatable,dimension(:)::X
integer(16),allocatable,dimension(:,:,:)::DP
integer(16) ans
read*,N,A
allocate(X(N))
read*,X
allocate(DP(0:N,0:N,0:50*N))
DP=0
DP(0,0,0)=1
do i=1,N
  do j=0,i
    do k=0,N*a
      if(k<x(i).or.j==0)then
        DP(i,j,k)=DP(i-1,j,k)
      else
        DP(i,j,k)=DP(i-1,j,k)+DP(i-1,j-1,k-x(i))
      end if
    end do
  end do
end do

ans=0
do i=1,N
  ans=ans+DP(N,i,i*A)
end do

print"(i0)",ans

end


Measured memory_bytes: 101888
def main():
	n=int(input())
	src = [int(item) for item in input().split()]
	dst = [int(item) for item in input().split()]
	ans=0
	def	SandQ(i):
		ri=i+1
		li=i-1
		if i==0:li=n-1
		if i==n-1:ri=0
		x=0
		if dst[i]-src[i]>=dst[ri]+dst[li]:
			x=(dst[i]-src[i])//(dst[ri]+dst[li])
			dst[i]-=(dst[ri]+dst[li])*x
			x+=SandQ(li)
			x+=SandQ(ri)
		return x;
	for i in range(n):
		ans+=SandQ(i)
	for i in range(n):
		if src[i]!=dst[i]:
			print(-1)
			exit()
	else:print(ans)
main()


Measured memory_bytes: 33508
#include<iostream>
using namespace std;
int main(){
  char t;
  cin>>t;
  if(t == 'A'){
    cout<<"T"<<endl;
    return 0;
  }
  if(t == 'T'){
    cout<<"A"<<endl;
    return 0;
  }
  if(t == 'G'){
    cout<<"C"<<endl;
    return 0;
  }
  else{
    cout<<"G"<<endl;
    return 0;
  }
  return 0;
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;

int main() {
  cin.sync_with_stdio(0); cin.tie(0);
  cin.exceptions(cin.failbit);

  int a, b,c;
  cin >> a >> b;
  if (a>b)swap(a,b);
  if (a==1 and b==2)c=3;
  else if (a==1 and b==3)c=2;
  else c=1;
  cout << c << endl;
}

Measured memory_bytes: 256
n = int(input())
if n < 105:
    print(0)
else:
    ans = 0
    for i in range(105, n+1, 2):
        cnt = 0
        for p in range(1,i+1):
            if i % p == 0:
                cnt += 1
        if cnt == 8:
            ans += 1
    print(ans)

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n;
ll a[110][110];
int main(){
	scanf("%lld",&n);
	int m=n;
	if(n%2==0)m++;
	rep(i,1,n+1)a[i][m-i]=1;
	printf("%d\n",n*(n-1)/2-n/2);
	rep(i,1,n+1)rep(j,i+1,n+1)if(!a[i][j])printf("%lld %lld\n",i,j);
}

Measured memory_bytes: 256
//k > 1 dp[i][j][k] = max(dp[i][j - 1][k], dp[i][j - 1][k - 1] + val[i][j]);
//k = 1 除了上述式子外加上 dp[i][j][k] = dp[i - 1][j][0/1/2/3] + val[i][j];
//k = 0 dp[i][j - 1][k], dp[i][j - 1][0/1/2/3];

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int R, C, K;
ll mp[3010][3010];
ll dp[3010][3010][4], mx[3010][3010];
int main() {
	memset(dp, 0xcf, sizeof(dp));
	memset(mx, 0xcf, sizeof(mx));
	cin >> R >> C >> K;
	for (int i = 1, r, c; i <= K; i++) {
		cin >> r >> c;
		cin >> mp[r][c];
	}
	dp[1][1][0] = 0;
	dp[1][1][1] = mp[1][1];
	mx[1][1] = max(0ll, mp[1][1]);
	for (int i = 1; i <= R; i++) {
		for (int j = 1; j <= C; j++) {
			if (i == 1 && j == 1) continue;
			for (int k = 0; k < 4; k++) {
				if (k > 1) {
					dp[i][j][k] = max(dp[i][j - 1][k], dp[i][j - 1][k - 1] + mp[i][j]);
				} else if (k == 1) {
					dp[i][j][k] = max(dp[i][j - 1][k], dp[i][j - 1][k - 1] + mp[i][j]);
					dp[i][j][k] = max(dp[i][j][k], mx[i - 1][j] + mp[i][j]);
				} else if (k == 0) {
					dp[i][j][k] = max(mx[i - 1][j], dp[i][j - 1][k]);
				}
				mx[i][j] = max(mx[i][j], dp[i][j][k]);
			}
		}
	}
//	cout << dp[1][1][1] << endl;
	cout << mx[R][C];
	return 0;
}

Measured memory_bytes: 427848
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

int n;
string a;

int main() {
	
	cin >> a;
	
	for(register int i=0; i<a.size(); i++) {
		if(a[i] == '+')	n ++;
		else	n --;
	}
	
	cout << n << endl;
	
	return 0;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int a, b, c;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> a >> b >> c;
	cout << (c >= a && c <= b ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>
#include <random>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

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


int main(int argc, char const* argv[])
{
  string s;
  cin >> s;
  int res = 0;
  rep(i, 4){
    if(s[i] == '2')res++;
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1000000007
//P pa(114,514);   ,vector<P>vec(N,0);
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}
//cout << setprecision(123);
//a=atoi(S.c_str());
//S=to_string(a);
int main(){
  int n,a,b,c;
  bool ok=true;
  cin>>n;
  vector<int>v(n);
  REP(i,n){
    cin>>v[i];
  }
  for(int i=n;i--;i>0){
    a=v[i];
    b=v[i-1];
    c=a-b;
    if(c+2<=0){
      ok=false;
      break;
    }
    else if(c+1==0){
      v[i-1]--;
    }
  }
      
      
      
  if(ok){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

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 U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 n;
	cin >> n;
	vector<PII> vs(n);
	REP(i, n) {
	  cin >> vs[i].fs >> vs[i].sc;
//	  vs[i].sc *= -1;
	}
	sort(all(vs));
	vector<int64> ls(n, 0), rs(n, 0);
	vector<PII> lint(n), rint(n);
	int64 l = vs[0].fs, r = vs[0].sc;
	REP(i, n) {
	  chmax(l, vs[i].fs);
	  chmin(r, vs[i].sc);
	  ls[i] = max((int64)0, r-l+1);
	  lint[i] = PII(l, r);
	}
	l = vs.back().fs; r = vs.back().sc;
	for (int64 i = n-1; i >= 0; i--) {
	  chmax(l, vs[i].fs);
	  chmin(r, vs[i].sc);
	  rs[i] = max((int64)0, r-l+1);
	  rint[i] = PII(l, r);

	}
	int64 res = 0;
	REP(i, n-1) {
	  chmax(res, ls[i] + rs[i+1]);
	}
	FOR(i, 1, n-1) {
	  chmax(res, vs[i].sc-vs[i].fs+1 + max((int64)0, min(lint[i-1].sc, rint[i+1].sc)-max(lint[i-1].fs, rint[i+1].fs)+1));
	}
	cout << res << endl;
}


Measured memory_bytes: 7040
# -*- coding: utf-8 -*-
#AGC014A
import sys
#import collections

#n= int(input())

tmp = input().split()
n,k = list(map(lambda a: int(a), tmp))

tmp = input().split()
a = list(map(lambda a: int(a), tmp))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

maxa=a[0]
tmp=a[0]
for i in range(1,n):
	maxa=max(maxa,a[i])
	tmp=gcd(tmp, a[i])

if(k<=maxa)and(k%tmp ==0):
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")

#print(maxa)
#print(tmp)




Measured memory_bytes: 14228
n, m, l = [int(i) for i in input().split()]

A = []
B = []
C = []
for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i) for i in input().split()])

for i in range(n):
    C.append([])
    for j in range(l):
        C[i].append(0)
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]

for li in range(n):
    print(" ".join([str(s) for s in C[li]])) 

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

int main() {
  std::string S;

  std::cin >> S;

  int win = 0;

  for (auto c: S) if (c == 'o') win++;

  bool ans = 8-win <= 15-S.size();

  std::cout << (ans?"YES":"NO") << std::endl;

  return 0;
}


Measured memory_bytes: 256
use std::io::Read;

fn main(){
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut iter = s.split_whitespace();
    let a = iter.next().unwrap().parse::<i32>().unwrap();
    iter.next().unwrap();//b
    iter.next().unwrap();//c
    iter.next().unwrap();//d
    let e = iter.next().unwrap().parse::<i32>().unwrap();
    let k = iter.next().unwrap().parse::<i32>().unwrap();
    println!("{}",if e - a  > k{":("}else{"Yay!"});
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define PI 3.14159265358979323846
#define fi first
#define se second

ll mod = 1e9+7;
ll max(ll a, ll b ) {
	if(a>b)
		return a;
	else return b;
}
ll min(ll a, ll b ) {
	if(a<b)
		return a;
	else return b;
}
ll gcd(ll a, ll b, ll& x, ll& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll x1, y1;
    ll d = gcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}
ll inv(ll a) {
	ll x, y;
	ll g = gcd(a, mod, x, y);
	x = (x % mod + mod) % mod;
	return x;
}
ll binpow(ll a, ll b, ll m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

int main() {
	int t;
	//cin>>t;
	t = 1;
	while(t--) {
		ll x;
		cin>>x;
		int ans = 0;
		if(x>=400 && x<=599) ans = 8;
		else if(x>=600 && x<=799) ans = 7;
		else if(x>=800 && x<=999) ans = 6;
		else if(x>=1000 && x<=1199) ans = 5;
		else if(x>=1200 && x<=1399) ans = 4;
		else if(x>=1400 && x<=1599) ans = 3;
		else if(x>=1600 && x<=1799) ans = 2;
		else if(x>=1800 && x<=1999) ans = 1;
		cout<<ans;
	}
	return 0;
}


Measured memory_bytes: 3592
import math

n,d = map(int, input().split())
p = []
for i in range(n):
  p.append(list(map(int, input().split())))

c = 0
for i in range(n):
  for j in range(i+1,n):
    elm = 0
    for k in range(d):
      elm += (p[i][k] - p[j][k])**2 
    if math.sqrt(elm).is_integer():
      c += 1

print(c)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int w,h,n; cin >> w >> h >> n;
    int u=h,d=0,r=w,l=0;   
    while(n--){
        int x,y,a; cin >> x >> y >> a;
        if(a==1) chmax(l,x);//l=x;
        else if(a==2) chmin(r,x);//r=x;
        else if(a==3) chmax(d,y);//d=y;
        else chmin(u,y);//u=y;
    }
    if(r-l<=0 || u-d<=0) cout<<0<<endl;
    else cout<<(r-l)*(u-d)<<endl;
}

Measured memory_bytes: 3656
from itertools import accumulate
from bisect import bisect

N = int(input())
C = [0]+list(accumulate(map(int,input().split())))
S = C[N]
f = lambda x:abs(x[0]-x[1])
def it():
  k1 = 1
  k2 = 3
  for i in range(2,N-1):
    ci = C[i]
    k1 = bisect(C, ci//2, lo=k1,hi=i)
    a,b = min(((ci-c,c) for c in (C[k1-1],C[k1])), key=f)
    k2 = bisect(C, (S+ci)//2, lo=k2,hi=N)
    c,d = min(((S-c,c-ci) for c in (C[k2-1],C[k2])), key=f)
    yield max(a,b,c,d)-min(a,b,c,d)

print(min(it()))

Measured memory_bytes: 25968
def nyu():
    S =  list(map(str,input()))
    return S

def kansu(S):

    s_flg = True

    for s in range(len(S)):
        tmp = S[s]
        if S.count(tmp) % 2 != 0:
            s_flg = False
            break

    if s_flg == True:
        print("Yes")
    else:
        print("No")




S = nyu()
kansu(S)



Measured memory_bytes: 2940
import java.util.HashSet;
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String[] arr=new String[n];
        for (int i = 0; i <arr.length ; i++) {
            arr[i]=sc.next();
        }
        HashSet<String> hs = new HashSet<String>();
        for(int i = 0; i < n; i++)
        {
            // add all the elements to the HashSet
            hs.add(arr[i]);
        }
        System.out.println(hs.size());
    }
}


Measured memory_bytes: 73680
from collections import deque, defaultdict

N, M = map(int, input().split())

AB = [tuple(map(int, input().split())) for _ in range(M)]

vertexes = set()
edges = defaultdict(set)
for a, b in AB:
    edges[a].add(b)
    edges[b].add(a)
    vertexes.add(a)
    vertexes.add(b)

res = 1
while vertexes:
    v = vertexes.pop()
    compos = 1
    q = deque()
    q.append(v)
    while q:
        now = q.popleft()
        for neighbor in edges[now]:
            if neighbor in vertexes:
                vertexes.discard(neighbor)
                q.append(neighbor)
                compos += 1
    
    res = max(compos, res)

print(res)






Measured memory_bytes: 195004
# import numpy as np


def solve():
    print(ll_no_dup[k-1])
    return






#a = [int(i) for i in input().split(" ")]




lunluns = [str(i) for i in range(1, 10)]

it = 0
count = 0
all_count = len(lunluns)
while count <= 10 ** 5:
    it = len(lunluns)
    last_count = all_count
    all_count = 0
    for i in range(it-last_count, it):
        last_val = int(lunluns[i][-1])
        if last_val > 0:
            lunluns.append(lunluns[i] + str(last_val - 1))
            count += 1
            all_count +=1
        lunluns.append(lunluns[i] + str(last_val))
        count += 1
        all_count +=1
        if last_val < 9:
            lunluns.append(lunluns[i] + str(last_val + 1))
            count += 1
            all_count +=1
        if count > 10 ** 5:
            break

ll_no_dup = [str(1)]
for i in range(1, len(lunluns)):
    if lunluns[i]!=lunluns[i-1]:
        ll_no_dup.append(lunluns[i])



k = int(input())
solve()

Measured memory_bytes: 55204
import math

log = math.log(8, 2)

n, k = input().split(' ')
n, k = int(n), int(k)

sum = 0

for i in range(1, n+1):
    exp  = math.log(k/i, 0.5)
    current = 1/n * 0.5**(math.ceil(abs(exp)))
    if exp >= 0:
        exp = 0
        current = 1/n 
    sum += current

if k == 1:
    print(1)
else:
    print(sum)



Measured memory_bytes: 3060
from sys import stdin
input = stdin.readline
import math

memo = [[0] * 201 for _ in range(201)]

def sgcd(i, j):
    if memo[i][j] == 0:
        memo[i][j] = math.gcd(i, j)
    return memo[i][j]

def main():
    N = int(input())
    ans = 0
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            a = sgcd(i, j)
            for k in range(1, N + 1):
                ans += sgcd(a, k)
    print(ans)


if __name__ == '__main__':
    main()

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

typedef long long int LL;
#define REP(n) for(LL i = 0; i < n; i++)

int main(){
    string s, sub;
    cin >> s;
    int keeper, ans = 114514, s2i;
    for(int i = 0; i < s.size()-2; i++){
        sub = s.substr(i, 3);
        s2i = stoi(sub);
        keeper = abs(753-s2i);
        ans = min(keeper, ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
 
int main(){
    int N,M;
    vector<string> S;
    string stmp;
 
    cin >> N >> M;
    int p[M];
    for(int i=0; i<M; i++){
        cin >> p[i] >> stmp;
        S.push_back(stmp);
    }
 
    vector<bool> ac(N,false);
    vector<int> wa(N,0);
 
    for(int i=0; i<M; i++){
        if( ac[p[i]-1] ) continue;
        if( S[i] == "WA" ){
            wa[p[i]-1]++;
        }else{
            ac[p[i]-1]=true;
        }
    }
 
    int nac=0, npen=0;
 
    for( int i=0; i<N; i++ ){
        nac += ac[i];
        npen+= ac[i]*wa[i];
    }
 
    cout << nac << " " << npen << endl;
 
    return 0;
}

Measured memory_bytes: 6516
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 4e18;

int main() {
    int n, l; cin >> n >> l;
    int t = -1;
    vector<int> a(n);
    REP(i, n) {
        cin >> a[i];
        if (i > 0 && a[i - 1] + a[i] >= l) {
            t = i - 1;
        }
    }
    if (t == -1) {
        puts("Impossible");
    }
    else {
        puts("Possible");
        REP(i, n - 1) {
            if (i != t) cout << i + 1 << endl;
            else {
                break;
            }
        }
        for (int i = n-2; i > t; i--) {
            cout << i + 1 << endl;
        }
        cout << t + 1 << endl;
    }
    getchar(); getchar();
}

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

int main() {
int A,B,C;
  cin >> A >> B >> C;
 if(A == 5 && B == 5 && C == 7){
  cout << "YES" << endl;
 }
  else if(A ==5 && B == 7 && C == 5){
  cout << "YES" << endl;
  }
  else if(A == 7 && B == 5 && C == 5){
  cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 3604
/*
    PROG: milk2
	LANG: C++14
	ID: ashikuj1
*/

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

#define mod (ll) (1e9)
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define pb push_back
#define make_pair mp
#define pi acos(-1)
#define N (int)3e5


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


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

   int n,k;
   cin>>n>>k;
   (n*500>=k)?cout<<"Yes"<<endl:cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int A, B, K, i;
    scanf("%d%d%d", &A, &B, &K);

    int min = A < B ? A : B;

    int cnt = 0;
    for (min; min > 0; min--)
    {
        if(A % min == 0 && B % min == 0){
            cnt++;
            if(cnt == K){
                printf("%d\n", min);
                return 0;
            }
        }
    }
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <string>
#include <utility>
#include <map> 
#include <queue>
#include <stack>
#include <iomanip>
#include <sstream>
#define MP make_pair
#define PB push_back
#define SZ size()
#define B begin()
#define E end()
#define ll long long
#define REP(i,a,n) for(ll i=a; i<n; ++i)
#define RED(i,n,a) for(ll i=n; i>=a; --i)
#define m9 1000000007
#define endl "\n"
#define F first
#define S second
#define ld long double
#define eps 0.00000000001
#define MAX 1000000007
#define vll vector <ll> 
#define pll pair <ll,ll> 

using namespace std;

ll gcd(ll a, ll b){
    if(a%b==0){
        return b;
    }
    else{
        return gcd(b, a%b);
    }
}
ll powc(ll a, ll b){
    if(b<0){
        return -1;
    }
    ll res=1;
    while(b>0){
        if(b&1){
            res*=a;
        }
        a*=a;
        res%=m9, a%=m9;
        b>>=1;
    }
    return res;
}


int main(){
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    ll x; cin>>x;
    if(x>=30){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}       

Measured memory_bytes: 3608
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;// 任意長整数型
using bint = mp::cpp_int;// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;// ついでに有理数型
using rat = boost::rational<bint>;
*/
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
double a,b,c;
int main(){ //srand((unsigned)time(NULL));
  cin >> a >> b >> c;
  c *= acos(-1)/180;
  cout << syo(5) << a*b*sin(c)/2 << endl;
  cout << syo(5) << a+b+sqrt(a*a+b*b-2*a*b*cos(c)) << endl;
  cout << syo(5) << b*sin(c) << endl;
}



Measured memory_bytes: 3584
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
// #pragma comment(linker, "/stack:200000000"]
 
#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <stack>
#include <random>
#include <fstream>
#include <sstream>
 
#define fr first
#define se second
#define pb push_back
#define ll long long
#define ld long double
#define hm unordered_map 
#define pii pair<int, int>
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define cinv(v) for (auto& x: v) cin >> x
#define forn(i, n) for (int i = 0; i < n; ++i)
#define forln(i, l, n) for (int i = l; i < n; ++i)

#define int ll

using namespace std;

#ifdef __LOCAL
	#define dbg(x) cerr << #x << " : " << x << '\n'
	const int maxn = 20;
#else 
	#define dbg(x)
	const int maxn = 2e5 + 20;
#endif

//tg: @galebickosikasa
 
const ll inf = (ll) 2e9;
const ld pi = 3.14159265358979323846264;
const ld eps = 1e-8;
const ll mod = (ll)1e9 + 7;
const ll ns = 97;

random_device rd;
mt19937 SuperRandom(rd());



signed main () {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int a, b;
	cin >> a >> b;
	int ans = a * (a - 1) / 2 + b * (b - 1) / 2;
	cout << ans;







}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define PB push_back
#define FI first
#define SE second
using namespace std;
typedef pair<int,int> pii;
static const int inf = 1ll<<60;

int w,h;
int feld[110][110];
int ill[110][110];
int use[110][110];
int odd_dx[6]={1,-1,1,0,1,0};
int even_dx[6]={1,-1,0,-1,0,-1};
int dy[6]={0,0,-1,-1,1,1};
int ans;
bool sorrou;

void search(int x,int y){
    if(feld[x][y]==1||ill[x][y]==1)return;
    if(x<=0||x>w||y<=0||y>h){
        sorrou=false;
        return;
    }
    ill[x][y]=1;
    for(int i=0;i<6;++i){
        int nx,ny;
        if(y%2!=0)nx=odd_dx[i]+x;
        else nx=even_dx[i]+x;
        ny=dy[i]+y;
        search(nx,ny);
    }
}

void cnt(int x,int y){
    if(use[x][y]==1)return;
    if(feld[x][y]==1){
        ans--;
        return;
    }
    if(x<=0||x>w||y<=0||y>h){
        return;
    }
    use[x][y]=1;
    for(int i=0;i<6;++i){
        int nx,ny;
        if(y%2!=0)nx=odd_dx[i]+x;
        else nx=even_dx[i]+x;
        ny=dy[i]+y;
        cnt(nx,ny);
    }
}

signed main(){
    cin>>w>>h;
    for(int y=1;y<=h;++y){
        for(int x=1;x<=w;++x)cin>>feld[x][y];
    }
    for(int y=1;y<=h;++y){
        for(int x=1;x<=w;++x){
            if(feld[x][y]==1){
                ill[x][y]=1;
                for(int i=0;i<6;++i){
                    int nx,ny;
                    if(y%2!=0)nx=odd_dx[i]+x;
                    else nx=even_dx[i]+x;
                    ny=dy[i]+y;
                    if(feld[nx][ny]==0)ans++;
                }
            }
        }
    }
    for(int y=1;y<=h;++y){
        for(int x=1;x<=w;++x){
            if(feld[x][y]==0&&ill[x][y]!=1){
                sorrou=true;
                search(x,y);
                if(sorrou==true)cnt(x,y);
            }
        }
    }
    cout<<ans<<endl;
}

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

namespace ABC061a
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;
            var word = Console.ReadLine().Split(' ');
            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);
            //
            if (a <= c && c <= b)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 11092