akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long int


int main()
{

  ios::sync_with_stdio(0);
  cin.tie(0);
  int n,k;
  cin>>n>>k;
  vector<int> h(n+1,0);
  for(int i=1; i<=n; i++){
    cin>>h[i];
  }
  ll dp[n+1];
  dp[0]=0;
  dp[1]=0;
  dp[2]=abs(h[1]-h[2]);
  for(int i=3; i<=n; i++){
        dp[i]=INT_MAX;
        for(int j=1; j<=k; j++){
            if(i-j>0){
                dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
            }
            else{break;}
        }
  }
  cout<<dp[n];

  return 0;
}

Measured memory_bytes: 4532
N = int(input())
data = []
for i in range(N):
    data.append(int(input()))

data.sort(reverse=True)
data_temp = []
for i in range(len(data)-1):
    data_temp.append(data[i]-data[i+1])
    
res = 0
for i in range(len(data_temp)):
    if data_temp[i] != 0:
        res += 1
print(res+1)

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(true) {
		int m = stdIn.nextInt();
		if(m == 0) break;
		m = 1000 - m;
		int t = 0;
		while(m != 0) {
			if(m - 500 >= 0) {
				t++;
				m -= 500;
				continue;
			}
			if(m - 100 >= 0) {
				t++;
				m -= 100;
				continue;
			}
			if(m - 50 >= 0) {
				t++;
				m -= 50;
				continue;
			}
			if(m - 10 >= 0) {
				t++;
				m -= 10;
				continue;
			}
			if(m - 5 >= 0) {
				t++;
				m -= 5;
				continue;
			}
			if(m - 1 >= 0) {
				t++;
				m -= 1;
				continue;
			}
		}
		
		System.out.println(t);
		
		
		}
	}
}

Measured memory_bytes: 17164
#include <cstdio>
#include <algorithm>

int main() {
  int x;
  scanf("%d", &x);

  int res = 1;
  for (int i = 2; i <= x; ++i) {
    for (int j = i*i; j <= x; j *= i)
      res = std::max(res, j);
  }
  printf("%d\n", res);
}


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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, k;
  cin >> n >> k;
  
  if(n <= k){
    cout << 0 << '\n';
    return 0;
  }
  
  vector<ll> h(n);
  for(int i = 0; i < n; i++) cin >> h.at(i);
  
  sort(h.rbegin(), h.rend());
  
  ll ans = 0;
  for(int i = k; i < n; i++){
    ans += h.at(i);
  }
  
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 1792
s = str(input())
a = int(s[:2])
b = int(s[2:])

if a > 12:
    if b > 12 or b == 0:
        print("NA")
    else:
        print("YYMM")
elif a == 0:
    if b > 12 or b == 0:
        print("NA")
    else:
        print("YYMM")
elif 0 < b <= 12:
    print("AMBIGUOUS")
else:
    print("MMYY")

Measured memory_bytes: 3060
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;


int main()
{
    int n;
    cin>>n;
    vector<long long int> a(n);
    for(int i=0;i<n;i++)
    cin>>a[i];
    long long  int c=0;
    int l=a.size();
    sort(a.begin(),a.end(),greater<int>());
    if(n==0)
    cout<<0<<"\n";
    else{
    c+=a[0];
    long long d=0;
    for(int i=2;i<a.size();i++)
    {
    
        if(i%2==0)
        d++;
        
        c+=a[d];
        
    }
    cout<<c<<"\n";}
    return 0;
}


Measured memory_bytes: 4844
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
using namespace std; using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
template<class T>bool chmax(T &a, const T &b) {if(a<b){a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a){a=b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    string s;
    cin >> s;
    ll a=0,b=0,c=0;
    rep(i,sz(s)){
        if(s[i]=='a') a++;
        else if(s[i] == 'b') b++;
        else c++;
    }
    int n = max({a,b,c})-min({a,b,c});
    if(n <= 1) cout << "YES" << endl;
    else cout << "NO" << endl;

}

Measured memory_bytes: 512
#include <stdio.h>

int main(){
    int n;
    scanf("%d",&n);
    int h[100000];
    for(int i=0;i<n;i++){
        scanf("%d",&h[i]);
    }
    if(n==1){
        printf("Yes\n");
        return 0;
    }
    if(h[n-2]-h[n-1]>1){
        printf("No\n");
        return 0;
    }
    for(int i=n-2;i>=0;i--){
        if(h[i]-h[i+1]==1)h[i]--;
        else if(h[i]-h[i+1]>1){
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }


int main() {
    string s;
    cin >> s;
    int n = s.size();

    ll ans = 0;
    rep(i, 1 << (n - 1)) {
        ll sm = 0;
        ll tot = 0;
        rep(j, n) {
            sm = 10 * sm + (s[j] - '0');
            if (i & (1 << j)) {
                tot += sm; sm = 0;
            }
        }
        tot += sm;
        ans += tot;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    long long i,a,b;
    long long p[4];
    for(i=0;i<4;i++){
        p[i]=0;
    }
    for(i=0;i<3;i++){
        cin>>a>>b;
        p[a-1]++;p[b-1]++;
    }
    a=0;
    for(i=0;i<4;i++){
        if(p[i]%2!=0){
            a++;
        }
    }
    if(a<3){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 256
// 下記, 参考.
// https://www.geeksforgeeks.org/bellman-ford-algorithm-dp-23/
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL<<60;
typedef long long LL;

struct Edge{ int f, t, w; };
struct Graph{
    int V, E;
    struct Edge* edge;
};
struct Graph* build(int V, int E){
    struct Graph* graph = new Graph;
    graph->V = V;
    graph->E = E;
    graph->edge = new Edge[E];
    return graph;
}

void printArr(LL dist[], int n){ 
    // printf("Vertex Distance from Source\n"); 
    // for(int i = 0; i < n; ++i) printf("%d \t\t %d\n", i, dist[i]);
    for(int i = 0; i < n; i++){
        if(dist[i] == INF) printf("%s\n", "INF");
        else               printf("%d\n", dist[i]);
    }
}

// ベルマン–フォード法.
// https://ja.wikipedia.org/wiki/ベルマン–フォード法
// https://www.geeksforgeeks.org/bellman-ford-algorithm-dp-23/
// グラフをベルマン–フォード法で探索する.
// ※BellmanFordの動作確認用.
// @param src: 探索開始する頂点.
// @param graph: グラフ.
// @return: 特に無し.
void BellmanFord(struct Graph* graph, int src){
    int V = graph->V, E = graph->E;
    LL dist[V];
    // Step 1: Initialize distances from src to all other vertices as INFINITE.
    for(int i = 0; i < V; i++) dist[i] = INF;
    dist[src] = 0; 

    // Step 2: Relax all edges |V| - 1 times. A simple shortest
    // path from src to any other vertex can have at-most |V| - 1 edges.
    for(int i = 1; i < V; i++){
        for(int j = 0; j < E; j++){
            int u = graph->edge[j].f;
            int v = graph->edge[j].t;
            int w = graph->edge[j].w;
            if(dist[u] != INF && dist[u] + w < dist[v]) dist[v] = dist[u] + w;
        }
    }
    
    // Step 3: check for negative-weight cycles.
    // The above step guarantees shortest distances
    // if graph doesn't contain negative weight cycle.
    // If we get a shorter path, then there is a cycle.
    bool negative = false;
    for(int i = 0; i < E; i++){
        int u = graph->edge[i].f;
        int v = graph->edge[i].t;
        int w  = graph->edge[i].w;
        if(dist[u] != INF && dist[u] + w < dist[v]){
            negative = true;
            printf("%s\n", "NEGATIVE CYCLE");
            break;
        }
    }

    if(!negative) printArr(dist, V);
    return;
} 

int main(){

    // 1. 入力情報.
    int V, E, r;
    scanf("%d %d %d", &V, &E, &r);
    
    // 2. グラフ作成.
    struct Graph* graph = build(V, E);
    
    for(int i = 0; i < E; i++){
        int f, t, w;
        scanf("%d %d %d", &f, &t, &w);
        graph->edge[i].f = f;
        graph->edge[i].t = t;
        graph->edge[i].w = w;
    }
    
    // 3. 単一始点最短経路の重みを計算し出力.
    BellmanFord(graph, r);
    
    // 4. 後処理.
    return 0;

}


Measured memory_bytes: 3212
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int main(){

    vector<int> a(3);
    REP(i,3){
        cin >> a[i];
    }
    VSORT(a);
    cout << a[2]*10+a[1]+a[0] << endl;



    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#include <stdlib.h>
#include <time.h>
#include <chrono>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

ll d;
vector<ll> c(26 + 1, 0);
vector<vector<ll>> s(365 + 1, vector<ll>(26 + 1, 0));

ll scoring(vector<int> t)
{
    ll ans = 0;
    vector<ll> last(26 + 1, 0);

    for (int i = 1; i <= d; i++)
    {
        ans += s[i][t[i]];
        ans -= c[t[i]] * (i - last[t[i]]) * (i - last[t[i]] - 1) / 2;
        last[t[i]] = i;
    }

    for (int i = 1; i <= 26; i++)
    {

        ans -= c[i] * (d - last[i] + 1) * (d - last[i]) / 2;
    }

    return ans;
}

int main(void)
{
    srand(time(NULL));
    cin >> d;

    for (int i = 1; i <= 26; i++)
    {
        cin >> c[i];
    }

    for (int i = 1; i <= d; i++)
    {
        for (int j = 1; j <= 26; j++)
        {
            cin >> s[i][j];
        }
    }

    vector<int> BestT(d + 1, 1);

    for (int i = 1; i <= d; i++)
    {
        BestT[i] = rand() % 26 + 1;
    }

    // printf("%lld\n", scoring(BestT));

    double BestScore = scoring(BestT);
    double score;

    auto start = chrono::system_clock::now();
    vector<int> t(d + 1, 1);

    double T0 = 2000;
    double T1 = 100;
    double TL = 1980;

    ll count = 0;

    while (1)
    {
        ll msec;

        msec = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count();

        if (msec >= TL)
        {
            break;
        }

        double T = powf(T0, 1 - msec / TL) * powf(T1, msec / TL);

        t = BestT;

        t[rand() % d + 1] = rand() % 26 + 1;

        score = scoring(t);

        if (exp((score - BestScore) / T) > 0.5)
        {
            BestT = t;
            BestScore = score;
        }
    }

    for (int i = 1; i <= d; i++)
    {
        printf("%d\n", BestT[i]);
    }

    // printf("%lld\n", scoring(BestT));
}


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

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

  long long ans = 0;

  if (K == 0) {
    ans = (long long)(N) * (long long)(N);
    //ans = (long long)(N * N);
  } else {
    for (int b = K + 1; b <= N; b++) {
      ans += (b - K) * (N / b) + max(0, N % b - K + 1);
    }
  }

  cout << ans << endl;
    

  return 0;

}

Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import *
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    m, d = LI()
    ans = 0
    for i in range(1, m + 1):
        for j in range(10, d + 1):
            if int(str(j)[0]) < 2 or int(str(j)[1]) < 2:
                continue
            if i == int(str(j)[0]) * int(str(j)[1]):
                ans += 1
    print(ans)
    return

#B
def B():
    n, l = LI()
    a = LI()
    d0 = defaultdict(int)
    d1 = defaultdict(int)
    for i in a:
        d0[i] += 1
    for i in range(n):
        b = 0
        for k in range(i+1, n):
            if a[i] > a[k]:
                b += 1
        d1[i] = b
    ans = 0
    d2 = list(d0.items())
    d2.sort()
    d3 = defaultdict(int)
    d = 0
    for key, value in d2:
        d3[key] = d
        d += value
    for i in range(n):
        ans += d3[a[i]] * l * (l-1) // 2 + d1[i] * l
        ans %= mod
    print(ans % mod)
    return

#C
def C():
    n = II()
    s = S()
    if s[0] == "W":
        print(0)
        return
    lis = [0] * (2 * n)
    l = [0] * (2 * n)
    l[0] = 1
    for i in range(1, 2 * n):
        lis[i] = (lis[i-1] ^ (s[i] == s[i-1]))
        l[i] += l[i - 1] + (lis[i] == 0)
    ans = 1
    if l[-1] != n or s[0] == "W":
        print(0)
        return
    k = 1
    for i in range(2 * n):
        if lis[i]:
            ans *= l[i] - (k - 1)
            ans %= mod
            k += 1
    print(ans * math.factorial(n) % mod)
    return

#D
def D():
    n = II()
    l = len(bin(n)) - 2
    for i in range(n - 1):
        for j in range(i + 2, n + 1):
            for k in range(l):
                if (j >> k) & 1 != ((i + 1) >> k) & 1:
                    print(k + 1, end=" ")
                    break
        print()
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    D()


Measured memory_bytes: 59992
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

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

/* do your best */

int main() {

  lint n, m, x; cin >> n >> m >> x;
  vector<vector<lint>> a(n, vector<lint> (m));
  vector<lint> c(n);
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }

  lint ans = INF;
  for (int bit = 0; bit < (1 << n); bit++) {
    vector<lint> und(m, 0);
    lint cost = 0;
    for (int i = 0; i < n; i++) {
      if (bit & (1 << i)) {
        cost += c[i];
        for (int j = 0; j < m; j++) {
          und[j] += a[i][j];
        }
      }
    }

    bool ok = true;
    for (int j = 0; j < m; j++) {
      if (und[j] < x) ok = false;
    }

    if (ok) {
      ans = min(ans, cost);
    }
  }

  if (ans == INF) {
    ans = -1;
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define c(n) cin>>n
#define co(n) cout<<n<<endl
using namespace std;

int main(){
  int a,b,c=0,d=0,e,n,m,x,y;
  c(n);
  int aa[100000];
  aa[0]=n;
  rep(i,1,10000){
    if(aa[i-1]==4 || aa[i-1]==2 || aa[i-1]==1){
      co(i+3);
      break;
    }
    if(aa[i-1]%2==0) aa[i]=aa[i-1]/2;
    else aa[i]=3*aa[i-1]+1;
  }
  
  return 0;
}

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<std::vector<char> > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    int n; 
    cin >> n;
    
    set<string> ans;
    irep(i, n) {
        string tmp;
        cin >> tmp;
        ans.insert(tmp);
    }
    cout << ans.size() << endl;
    return 0;
}
/** atcoder **/


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

const int DIM = 1e5 + 5;

int main(void) {
    ios::sync_with_stdio(false);
    
    int x, a, b;
    cin >> x >> a >> b;
    
    a = -a + b;
    
    if (a <= 0)
        cout << "delicious";
    else
    if (a <= x)
        cout << "safe";
    else
        cout << "dangerous";

    return 0;
}


Measured memory_bytes: 256
n = $stdin.gets.to_i
v = $stdin.gets.split.map(&:to_i)
c = $stdin.gets.split.map(&:to_i)
result = 0
n.times do |i|
	if v[i]-c[i]>0 
		result += v[i]-c[i]
	end
end

puts result

Measured memory_bytes: 1788
A, B, H, M = map(int, input().split())

import math

deg_m_hand = 360*(H/12) + 30*(M/60)
deg_h_hand = 360*(M/60)

theta = deg_m_hand - deg_h_hand

AB = math.sqrt( A**2 + B**2 - 2*A*B*math.cos(math.radians(theta) ) )

print(AB)

Measured memory_bytes: 9508
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<sstream>
#include<iostream>
using namespace std;
int main(void){

    string s[10];
    for(int i = 0;i < 8;i++){
        cin>>s[i];
    }

    cout<<90<<endl;
    for(int j = 0;j < 8;j++){
        for(int i = 7;i >= 0;i--){
            cout<<s[i][j];
        }
        cout<<endl;
    }
    cout<<180<<endl;
    for(int i = 7;i >= 0;i--){
        for(int j = 7;j >= 0;j--){
            cout<<s[i][j];
        }
        cout<<endl;
    }
    cout<<270<<endl;
    for(int j = 7;j >= 0;j--){
        for(int i = 0;i < 8;i++){
            cout<<s[i][j];
        }
        cout<<endl;
    }



    return 0;
}

Measured memory_bytes: 1188
program test
  implicit none
  integer :: n, flag, i, k, j
  integer, dimension ( : ), allocatable :: p, q

  read ( unit = *, fmt = * ) n

  allocate ( q ( 1:n ) )  
  allocate ( p ( 1:n ) ) 

  read ( unit = *, fmt = * ) p ( 1:n )

  k = 1

  do j = 1,n

     do i = 1, n

        if ( p ( i ) == minval ( p ) ) then

           q ( i ) = k

           k = k + 1

           p ( i ) = 100

           exit

        end if

     end do

  end do

  flag = 0

  do i = 1, n

     if ( q ( i ) /= i ) then

        flag = flag + 1

     end if

  end do

  if ( flag > 2 ) then

     write ( unit = *, fmt = '(a2)' ) 'NO'

     stop

  end if

  write ( unit = *, fmt = '(a3)' ) 'YES'

  stop



end program test


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <algorithm>
#include <queue>
#include <iterator>
#include <functional>
#include <numeric>
#include <cmath>
#include <stack>
#include <limits>
#include <ctime>

using namespace std;

#define ll long long
#define sc(n) static_cast<ll>(n)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll gcd(ll a, ll b) {
	return b == 0 ? a : gcd(b, a % b);
}

int main() {
	IO;
#ifdef _DEBUG
	ifstream cin("In.txt");
#endif	
	ll n;
	cin >> n;
	vector<vector<ll>>vc(3, vector<ll>(n+1));
	string st;
	cin >> st;
	for (size_t i = 0; i < n; i++) {
		vc[0][i + 1] = vc[0][i];
		vc[1][i + 1] = vc[1][i];
		vc[2][i + 1] = vc[2][i];
		if (st[i] == 'R') vc[0][i + 1]++;
		else if (st[i] == 'G') vc[1][i + 1]++;
		else vc[2][i + 1]++;
	}
	ll sm = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			sm += ((vc[0][i] - vc[0][i - 1]) * (vc[1][j] - vc[1][j - 1]) * (vc[2][n] - vc[2][j] - ((j + j - i <= n) ? (vc[2][j + j - i] - vc[2][j + j - i - 1]) : 0)));
			sm += ((vc[0][i] - vc[0][i - 1]) * (vc[2][j] - vc[2][j - 1]) * (vc[1][n] - vc[1][j] - ((j + j - i <= n) ? (vc[1][j + j - i] - vc[1][j + j - i - 1]) : 0)));
			sm += ((vc[1][i] - vc[1][i - 1]) * (vc[0][j] - vc[0][j - 1]) * (vc[2][n] - vc[2][j] - ((j + j - i <= n) ? (vc[2][j + j - i] - vc[2][j + j - i - 1]) : 0)));
			sm += ((vc[1][i] - vc[1][i - 1]) * (vc[2][j] - vc[2][j - 1]) * (vc[0][n] - vc[0][j] - ((j + j - i <= n) ? (vc[0][j + j - i] - vc[0][j + j - i - 1]) : 0)));
			sm += ((vc[2][i] - vc[2][i - 1]) * (vc[0][j] - vc[0][j - 1]) * (vc[1][n] - vc[1][j] - ((j + j - i <= n) ? (vc[1][j + j - i] - vc[1][j + j - i - 1]) : 0)));
			sm += ((vc[2][i] - vc[2][i - 1]) * (vc[1][j] - vc[1][j - 1]) * (vc[0][n] - vc[0][j] - ((j + j - i <= n) ? (vc[0][j + j - i] - vc[0][j + j - i - 1]) : 0)));
		}
	}
	cout << sm << endl;
	return 0;
}

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

int main(){
	int k,n;
	cin>>k>>n;
	int a[n+1];
	
	for(int i=1;i<=n;++i)
		cin>>a[i];
	
	int b[n+1];
	for(int i=1;i<=n-1;++i)
		b[i]=a[i+1]-a[i];
	
	b[n]=k-a[n]+a[1];
	
	int maxv=0;
	for(int i=1;i<=n;++i)
		maxv=max(maxv,b[i]);
	
	cout<<k-maxv<<endl;
	return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
import numpy as np

n, k = map(int, input().split())
f = np.zeros(n)
for i in range(k):
    d = int(input())
    a = map(int, input().split())
    for ai in a:
        f[ai-1] += 1
print(np.count_nonzero(f==0))

Measured memory_bytes: 27196
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int m = scanner.nextInt();

        final int divide = m / n;

        for (int i = divide; i >= 0; i--) {
            if (m % i == 0 && m/i >= n) {
                System.out.println(i);
                return;
            }
        }
    }
}


Measured memory_bytes: 21844
N = int(input())
C = {}
for x in range(1,142):
    for y in range(1,142):
        for z in range(1,142):
            a = (x+y)**2+(y+z)**2+(z+x)**2
            if a%2==0:
                if a//2 not in C:
                    C[a//2]=0
                C[a//2] += 1
for i in range(1,N+1):
    if i in C:
        print(C[i])
    else:
        print(0)

Measured memory_bytes: 82360
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = 100000;
        var li = new List<int>();

        //var sosu = new int[n+1];

        //var r = Math.Sqrt(n);
        //for(int i=2; i<=r; i += 2) {
        //    var x = i;
        //    while(x <= n) {
        //        sosu[x] = 1;
        //        x *= i;
        //    }
        //}
        //for(int i=3; i<=n; i++) {
        //    if(sosu[i] == 0) {
        //        l.Add(i);
        //    }
        //}

        for (int i = 3; i <= n; i+=2) {
            if (IsPrimeNumber(i)) {
                var x = (i + 1) / 2;
                if (IsPrimeNumber(x)) {
                    li.Add(i);
                }
            }
        }

        var q = int.Parse(input.ReadLine());
        for(int i=0; i<q; i++) {
            var spl = input.ReadLine().Split(' ');
            var l = int.Parse(spl[0]);
            var r = int.Parse(spl[1]);
            var c = li.Count(x => l <= x && x <= r);
            Console.WriteLine(c);
        }

        return null;
    }

    static bool IsPrimeNumber(long n) {
        if (n <= 3) return true;
        if (n % 2 == 0) return false;

        var r = (long)Math.Sqrt((double)n);

        for (int i = 3; i <= r; i += 2) {
            if (n % i == 0) return false;
        }
        return true;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


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

int main()
{
  int N, H;
  cin >> N >> H;
  int a, b[N];
  int amx;
  for (int i = 0; i < N; ++i) {
    cin >> a >> b[i];
    amx = max(a, amx);
  }

  int ans = 0;

  sort(b, b+N);
  for (int i = 0; i < N; ++i)
  {
    H -= max(amx, b[N-1-i]);
    ans++;
    if (H <= 0) {
      cout << ans << endl;
      return 0;
    }
  }
  cout << ans + (H - 1) / amx + 1 << endl;
  return 0;
}

Measured memory_bytes: 640
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    input()
    aa=LI()
    ac=Counter(aa)
    even=0
    for a,c in ac.items():
        if c%2==0:even+=1
    if even%2:ans=len(ac)-1
    else:ans=len(ac)
    print(ans)

main()

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

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

int main() {
	int cnt = 0;
	string s,t;
	cin >> s >> t;
	REP(i,3) {
		if (s[i] == t[i]) { cnt++; }
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fname "B"
#define bug(x) cerr << (#x) << " = " << (x) << endl
#define ll long long
#define REP0(i, n) for(int i = 0, _n = (n); i < _n; ++i)
#define REP1(i, n) for(int i = 1, _n = (n); i <= _n; ++i)
#define REPB0(i, n) for(int i = (n) - 1; i >= 0; --i)
#define REPB1(i, n) for(int i = (n); i > 0; --i)
#define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; ++i)
#define FORB(i, a, b) for(int i = (a), _b = (b); i >= _b; --i)
#define ARR0(a, n) {cerr <<(#a)<< ": ["; REP0(i, n) cerr<< ' ' << a[i] <<','; cerr<<']'<<endl;}
#define ARR1(a, n) {cerr <<(#a)<< ": ["; REP1(i, n) cerr<< ' ' << a[i] <<','; cerr<<']'<<endl;}
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define LB lower_bound
#define UB upper_bound
#define X first
#define Y second

using namespace std;
template<typename T, typename V>
inline void bugp(const pair<T, V> &x) {cerr << '{' << x.X << ", " << x.Y << '}' << endl;}
template<typename T, typename U, typename V>
inline void bugpp(const pair<T, pair<U, V> > &x) {cerr << '{' << x.X << ", {" << x.Y.X << ", " << x.Y.Y << "}}" << endl;}
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ll, int> li;
typedef pair<ll, ii> lii;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
    string n;
    cin >> n;
    int sum = 0;
    REP0(i, n.size()) {
        sum += n[i] - 48;
    }
    if(sum % 9) cout << "No";
    else cout << "Yes";
	return 0;
}


Measured memory_bytes: 3736
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        
        // dist[i][j] = 点i→jの直接距離
        // iとjを入れ替えても距離が同じとは限らない
        int[][] dist = new int[10][10];
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                dist[i][j] = sc.nextInt();
            }
        }
        
        // 「ワーシャルフロイド法」
        // 3つの頂点i, j, kを選んで、
        // i→k→jという道がi→jという道より短ければi→jの距離を更新する
        for (int k = 0; k < 10; k++) {
            for (int i = 0; i < 10; i++) {
                for (int j = 0; j < 10; j++) {
                    dist[i][j] = Math.min(dist[i][j], dist[i][k] + dist[k][j]);
                }
            }
        }
        
        // ans = 点pが点1に集まるまでの距離の和
        long ans = 0;
        for (int i = 0; i < h * w; i++) {
            int p = sc.nextInt();
            if (p == -1) continue;
            ans += dist[p][1];
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 43456
<?php

$n = trim(fgets(STDIN));
$nums = explode(' ',trim(fgets(STDIN)));

$avr = round(array_sum($nums)/count($nums));

$ans = 0;
for($i=0; $i<count($nums); $i++){
  $ans += ($nums[$i]-$avr)**2;
}

echo $ans;


?>

Measured memory_bytes: 4604
use proconio::input;

fn main() {
  input!{
    A:i64,
    B:i64,
    C:i64,
    D:i64
  }
  let attackA = (A+(D-1))/D;
  let attackT = (C+(B-1))/B;
  
  if attackT > attackA {
    println!("No");
  } else {
    println!("Yes");
  }
}

Measured memory_bytes: 2124
#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: 3064
//# pragma GCC optimize ("O2")
#include<bits/stdc++.h>
#define out(i,a,now) for(int i=a.be[now],to=a.v[i];~i;i=a.ne[i],to=a.v[i])
#define fo(i,a,b) for(i=(a);i<=(b);i++)
#define max(a,b) ((a)<(b)?(b):(a))
#define min(a,b) ((a)<(b)?(a):(b))
#define mp(a,b) make_pair(a,b)
#define qk(x) memset(x,0,sizeof(x))
#define RG register
#define gs(x) (tr[tr[x].f].son[1]==x)
#define lb(x) (x&(-x))
#define mid ((l+r)>>1)
#define SF scanf
#define PF printf
#ifdef Mogician
#endif
using namespace std;
typedef long long LL;
typedef double DB;
template <class T> void cmax(T &a,T b)
{
    a=max(a,b);
}
template <class T> void cmin(T &a,T b)
{
    a=min(a,b);
}
template <class T> void swp(T &a,T &b)
{
	T temp=a; a=b; b=temp;
}
const LL maxn=2100;
LL a[maxn],f[maxn],k,q,n,ans=INT_MAX,id;
LL cl(LL t)
{
	LL no[maxn],b[maxn],len,temp;
	LL i;
	temp=0;
	qk(no);
	fo(i,1,n)
	{
		temp++;
		if (a[i]<f[t]) temp=0;
		no[i]+=temp;
	}
	temp=0;
	for(i=n;i>=1;i--)
	{
		temp++;
		if (a[i]<f[t]) temp=0;
		no[i]+=temp;
	}
	len=0;
	LL res=0;
	temp=0; 
	fo(i,1,n+1)
	if (no[i]-1>=k)
	{
		temp++;
	}
	else
	{
		if (temp>=k)
		{
			priority_queue<LL,vector<LL>,greater<LL> >pq;
			LL j;
			fo(j,i-temp,i-1) pq.push(a[j]);
			fo(j,1,temp-k+1)
			{
				b[++len]=pq.top();
				pq.pop();
			}
			res+=temp-k+1;
		}
		temp=0;
	}
	if (res<q) return INT_MAX;
//	if(len<q) return INT_MAX>>1;
	sort(b+1,b+len+1);
	if (b[q]-b[1]<ans)
		id=b[1];
	return b[q]-b[1];
}
int main()
{
#ifdef Mogician
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
#endif
	SF("%lld%lld%lld",&n,&k,&q);
	LL i;
	fo(i,1,n) SF("%lld",&a[i]);
	fo(i,1,n) f[i]=a[i];
	sort(f+1,f+n+1);
	fo(i,1,n)
		cmin(ans,cl(i));
	PF("%lld",ans);
//	PF("\n%lld",id);
}

Measured memory_bytes: 384
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

a = L()
b = "".join(a)
b = int(b)
for i in range(1000):
    if b == i**2:
        print("Yes")
        sys.exit()
 
print("No")

Measured memory_bytes: 10376
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int H, W;
    cin >> H >> W;
    vector<vector<int>> A(H, vi(W));
    cin >> A;
    auto maximum_area_rectanle = [&]() {
        vector<int> row(W);
        int ret = 0;
        REP(i, H) {
            REP(j, W) {
                if (A[i][j] == 0) row[j] += 1;
                if (A[i][j] != 0) row[j] = 0;
            }
            
            // ヒストグラムの最大長方形
            stack<int> s; 
            int max_area = 0;
            int tp;
            int area_with_top;

            int idx = 0; 
            while (idx < W) { 
                if (s.empty() || row[s.top()] <= row[idx]) s.push(idx++); 
                else { 
                    tp = s.top();
                    s.pop();
                    area_with_top = row[tp] * (s.empty() ? idx : idx - s.top() - 1); 
                    if (max_area < area_with_top) max_area = area_with_top; 
                }
            }

            while (!s.empty()) { 
                tp = s.top(); 
                s.pop(); 
                area_with_top = row[tp] * (s.empty() ? idx : idx - s.top() - 1);
                if (max_area < area_with_top) max_area = area_with_top;
            } 

            chmax(ret, max_area);
        }
        return ret;
    };

    cout << maximum_area_rectanle() << endl;
    return (0^_^0);
}




Measured memory_bytes: 18012
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    private static int fact(int n) { int ans=1; for(int i=2;i<=n;i++) ans*=i; return ans; }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        char s[] = in.next().trim().toCharArray();
        char s2[] = new char[4];
        if(s[2]==s[3]&&s[4]==s[5]) out.println("Yes");
        else out.println("No");
        
    }
    
    /************* SOLUTION ENDS HERE **********/
}

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

int main()
{
	int w;
	cin >> w;

	string s;
	while (w){
		int t = (w % 3 + 3) % 3;
		if (t == 0){ s += '0'; w = w / 3; }
		if (t == 1){ s += '+'; w = (w - 1) / 3; }
		if (t == 2){ s += '-'; w = (w + 1) / 3; }
	}

	reverse(begin(s), end(s));
	cout << s << endl;
}

Measured memory_bytes: 3168
n, m = gets.split.map &:to_i
a = []
n.times do |i|
  a[i] = gets.split.map &:to_i
end
b = []
m.times do |j|
  b[j] = gets.split.map &:to_i
end
n.times do |i|
  mm = 9999999999
  mj = 0
  m.times do |j|
    d = (a[i][0]-b[j][0]).abs+(a[i][1]-b[j][1]).abs
    if d < mm
      mm = d
      mj = j
    end
  end
  puts mj + 1
end


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

int main() {
	int N, x, ans = 0;
	vector <bool> A(1000000000);
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> x;
		if (A[x]) {
			A[x] = false;
			ans--;
		}
		else {
			A[x] = true;
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 122368
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
using namespace std;

int main(){
  int a,b; cin>>a>>b; cout<<max(a+b,max(a-b,a*b));
}

Measured memory_bytes: 256
n=int(input())
s_list=[input() for _ in range(n)]

AC_cnt = 0
WA_cnt = 0
TLE_cnt = 0
RE_cnt = 0

for i in range(n):
    if s_list[i] == 'AC':
        AC_cnt += 1
    elif s_list[i] == 'WA':
        WA_cnt += 1
    elif s_list[i] == 'TLE':
        TLE_cnt += 1
    elif s_list[i] == 'RE':
        RE_cnt += 1

print('AC x ' + str(AC_cnt))
print('WA x ' + str(WA_cnt))
print('TLE x ' + str(TLE_cnt))
print('RE x ' + str(RE_cnt))

Measured memory_bytes: 16244
X,N = map(int, input().split())
p = input()
p = p.split()
p = [int(c) for c in p]
Y = Z = X
flug = 0
if X not in p:
    print(X)
if X in p:    
    for i in range(1,100):
        Y -= 1
        Z += 1
        if Y not in p:
            print(Y, end = " ")
            flug = 1
        elif Z not in p:
            print(Z)
            flug = 1
        if flug == 1:
            break

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

#define ALL(a) a.begin(),a.end()
using ll=long long;

int main(){
    ll q,h,s,d;
    cin>>q>>h>>s>>d;
    ll n;
    cin>>n;
    h=min(h,2*q);
    s=min(s,2*h);
    d=min(d,2*s);
    cout<<((n/2)*d+(n%2)*s)<<endl;
    return 0;
}

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

int main() {
    int n; cin >> n;
    vector<int> a(n+2);
    int sum = 0;
    for (int i = 1; i < n + 1; i++) {
        cin >> a[i];
        sum += abs(a[i] - a[i-1]);
        if (i == n) sum += abs(a[i]);
    }

    for (int i = 1; i < n+1; i++) {
        int ans = sum + abs(a[i-1] - a[i+1]) - abs(a[i-1] - a[i]) - abs(a[i] - a[i+1]);
        cout << ans << endl;
    }
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<lol, lol>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}
//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int a, b, x;
  cin >> a >> b >> x;
  cout << min({UPDigit(x, 1000) * a, UPDigit(x, 500) * b, (x / 1000) * a + UPDigit((x % 1000), 500) * b}) << '\n';
  return 0;
}



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

using namespace std;

int main()
{
    
 int a,b;
 cin>>a>>b;
 int s[a];
 int x[b];
 for(int i=0;i<a;i++)
 {
    s[i]=b; 
   
 }
  for(int k=0;k<b;k++)
 {
    x[k]=a; 
 }

 
 if(a>b)
 {
     for(int f=0;f<a;f++)
 {
     cout<<s[f];
 }
 }
 
 else if(a<b)
 {
    for(int l=0;l<b;l++)
 {
     cout<<x[l];
 }
 }
 else if(a==b) 
 {
     for(int l=0;l<b;l++)
 {
     cout<<x[l];
 }
 }
 
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int n,m,k;
  cin >> n >> m >> k;
  rep(i,n+1){
    rep(j,m+1){
      if(j*n+i*m-2*i*j==k){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
return 0;}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int n;
  cin>>n;
  if(n<=999){
    int m=n%10;
    if(m==2 || m==4 || m==5 || m==7 || m==9)cout<<"hon";
    else if(m==3)cout<<"bon";
    else cout<<"pon";
  }
}

Measured memory_bytes: 3640
def main():
    n, k, c = map(int, input().split())
    s = input().rstrip()
    frnt = [None]*n
    back = [None]*n
    if s[0] == "o":
        frnt[0] = [1, 0]
    else:
        frnt[0] = [0, -1*n - 100]
    for i in range(1, n):
        if s[i] == "o" and i - frnt[i-1][1] - 1 >= c:
            frnt[i] = [frnt[i-1][0]+1, i]
        else:
            frnt[i] = [frnt[i-1][0], frnt[i-1][1]]
    if s[-1] == "o":
        back[-1] = [1, n-1]
    else:
        back[-1] = [0, 2*n + 100]
    for i in reversed(range(n-1)):
        if s[i] == "o" and back[i+1][1] - i - 1 >= c:
            back[i] = [back[i+1][0]+1, i]
        else:
            back[i] = [back[i+1][0], back[i+1][1]]
    for i in range(n):
        if s[i] == "x":
            continue
        a = frnt[i][0] + back[i][0]
        if i == frnt[i][1]:
            a -= 1
        if i == back[i][1]:
            a -= 1
        if i != frnt[i][1] and i != back[i][1]:
            if back[i][1] - frnt[i][1] - 1 < c:
                a -= 1
        if a == k-1:
            print(i+1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 71232
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;

ll dp[64][125] = {};

// { AGCT}={01234}

int main() {
  int n;
  cin >> n;
  for(int i = 0; i < 4; i++) {
    dp[i][1] = 1;
  }
  for(int i = 1; i < n; i++) {//index
    for(int k = 0; k < 4; k++) {//input_char
      for(int a = 0; a < 4; a++) {
        for(int b = 0; b < 4; b++) {
          for(int c = 0; c < 4; c++) {
            if(
              (b==1&&c==2&&k==3) ||
              (b==1&&c==3&&k==2) ||
              (b==2&&c==1&&k==3) ||
              (a==1&&c==2&&k==3) ||
              (a==1&&b==2&&k==3)
            ) continue;
            int pre = a*16+b*4+c;
            int next = b*16+c*4+k;
            dp[next][i+1] += dp[pre][i];
            dp[next][i+1] %= MOD;
          }
        }
      }
    }
  }

  ll ans = 0;
  for(int i = 0; i < 64; i++) {
    ans += dp[i][n];
    //cout << (i/16) << "," << ((i/4)%4) << "," << (i%4) << "," << dp[i][n] << endl;
    ans %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import itertools


def f(j, adj):
    for i, node in enumerate(j):
        if i == 0:
            if node not in adj[1]:
                return False
        else:
            if j[i - 1] not in adj[node]:
                return False
    return True


n, m = map(int, input().split())

adj = [[] for _ in range(n + 1)]
for _ in range(m):
    a, b = map(int, input().split())
    adj[a].append(b)
    adj[b].append(a)

count = 0
for j in itertools.permutations(range(2, n + 1)):
    count += f(j, adj)

print(count)


Measured memory_bytes: 3064