akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;

int main() {
    long long n;    cin >> n;
    string s;
    while (n > 0) {
        s.push_back('a'+(n-1)%26);
        n = (n-1) / 26;
    }
    for (int i = s.length()-1; i >= 0; i--)
        cout << s[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 3616
#include<stdio.h>
int main()
{
    int a,b,i,j;
    int d=0,f,g,h;
    scanf("%d",&a);
    int x[a];
    char c[12];
    for(i=0;i<a;i++){
        scanf("%s %d",c,&b);
        if(c[0]=='i'){
            x[i]=b;
        }
        else if(c[6]=='F'){
            i-=2;
	    a-=2;
        }
        else if(c[6]=='L'){
            i--;
	    a--;
	    d++;
        }
        else{
            i--;
	    a--;
            f=0;
            for(j=i;j>=0;j--){
                if(f>0)break;
                if(b==x[j]){
                    g=i-j;
                    h=0;
                    f++;
                    while(g!=h++){
		      x[j+h-1]=x[j+h];		  
		    }
		    i--;
		    a--;
                }
            }
        }
    }
    for(i=0;i<a-d;i++){
      if(i==a-d-1){
	printf("%d\n",x[a-1-i]);
      }
      else{
	printf("%d ",x[a-1-i]);
      }
    }
    return 0;
}



Measured memory_bytes: 5600
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int main() {
	int a, b; cin >> a >> b;
	int n; cin >> n;
	VI s(n), f(n);
	rep(i, n)cin >> s[i] >> f[i];

	bool flag = false;
	rep(i, n) {
		if ((s[i] < a&&a < f[i]) || (s[i] < b&&b < f[i]) || (s[i] == a && f[i] == b) || (s[i] > a&&f[i] < b))flag = true;
	}
	Cout(flag);
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    string N;
    cin>>N;
    string a,b,c,d;
    a=N.at(0); b=N.at(1); c=N.at(2); d=N.at(3);
    int A=stoi(a),B=stoi(b),C=stoi(c),D=stoi(d);
    if(A+B+C+D==7) cout<<A<<"+"<<B<<"+"<<C<<"+"<<D<<"=7"<<endl;
    else if(A+B+C-D==7) cout<<A<<"+"<<B<<"+"<<C<<"-"<<D<<"=7"<<endl;
    else if(A+B-C+D==7) cout<<A<<"+"<<B<<"-"<<C<<"+"<<D<<"=7"<<endl;
    else if(A+B-C-D==7) cout<<A<<"+"<<B<<"-"<<C<<"-"<<D<<"=7"<<endl;
    else if(A-B+C+D==7) cout<<A<<"-"<<B<<"+"<<C<<"+"<<D<<"=7"<<endl;
    else if(A-B+C-D==7) cout<<A<<"-"<<B<<"+"<<C<<"-"<<D<<"=7"<<endl;
    else if(A-B-C+D==7) cout<<A<<"-"<<B<<"-"<<C<<"+"<<D<<"=7"<<endl;
    else if(A-B-C-D==7) cout<<A<<"-"<<B<<"-"<<C<<"-"<<D<<"=7"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define pb push_back;
#define all(x) (x).begin(), (x).end()
#define rep(i,N) for(int i=0; i<N; i++)
typedef long long ll;
typedef pair<char, char> c_c;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
const int INF = 1000000007;
const ll LLINF = 1000000000000000007LL;

bool IsPrime(int num){

    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int x;
    cin >> x;
    if (x==2){
        cout << 2 << endl;
        return 0;
    }
    int cnt = x;

    while(1){
        if(IsPrime(cnt)){
            cout << cnt << endl;
            break;
        }
        cnt++;
    }
    
    return 0;
}

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

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

dp = [[0]*(w+1) for _ in range(n+1)]

for i in range(n):
    for j in range(w+1):
        if j >= t[i][1]:
            dp[i+1][j] = max(dp[i][j-t[i][1]]+t[i][0], dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]
print(dp[n][w])


Measured memory_bytes: 41888
a=list(map(int,input().split()))
a.sort()
count=(a[2]-a[0])//2
count+=(a[2]-a[1])//2
if (a[2]-a[0])%2+(a[2]-a[1])%2 == 2:
    count+=1
elif (a[2]-a[0])%2+(a[2]-a[1])%2 ==1:
    count+=2
print(count)

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

using namespace std;

typedef pair<int, int> pii;
#define mk make_pair

int Sqrt[200005], Cnt[4];
int N, D[2], col[606][606];
vector<int> fact[2];

void dfs(int id, int x, int y, int color, int empty) {
  Cnt[col[x][y] = color]++;
  for (auto t : fact[id]) {
    int delta_y = Sqrt[D[id] - t * t];
    int x_1 = x - t, y_1 = y - delta_y;
    int x_2 = x + t, y_2 = y + delta_y;
    if (x_1 >= 0 && y_1 >= 0 && col[x_1][y_1] == empty)
      dfs(id, x_1, y_1, color ^ 1, empty);
    if (x_1 >= 0 && y_2 < N && col[x_1][y_2] == empty)
      dfs(id, x_1, y_2, color ^ 1, empty);
    if (x_2 < N && y_1 >= 0 && col[x_2][y_1] == empty)
      dfs(id, x_2, y_1, color ^ 1, empty);
    if (x_2 < N && y_2 < N && col[x_2][y_2] == empty)
      dfs(id, x_2, y_2, color ^ 1, empty);
  }
}

int main() {
  scanf("%d%d%d", &N, &D[0], &D[1]), N <<= 1;
  for (int i = 0; i * i <= 200000; i++) Sqrt[i * i] = i;
  for (int x = 0; x * x <= D[0] && x <= N; x++)
    if (Sqrt[D[0] - x * x] || D[0] == x * x) fact[0].push_back(x);
  for (int x = 0; x * x <= D[1] && x <= N; x++)
    if (Sqrt[D[1] - x * x] || D[1] == x * x) fact[1].push_back(x);
  memset(col, -1, sizeof(col));
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++)
      if (col[i][j] == -1) dfs(0, i, j, 0, -1);
  if (Cnt[0] >= Cnt[1]) {
    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++)
        if (col[i][j] == 0) dfs(1, i, j, 2, 0);
  } else {
    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++)
        if (col[i][j] == 1) dfs(1, i, j, 2, 1);
  }
  int Need = (N >> 1) * (N >> 1);
  if (Cnt[2] >= Cnt[3]) {
    for (int i = 0; i < N && Need; i++)
      for (int j = 0; j < N && Need; j++)
        if (col[i][j] == 2) printf("%d %d\n", i, j), Need--;
  } else {
    for (int i = 0; i < N && Need; i++)
      for (int j = 0; j < N && Need; j++)
        if (col[i][j] == 3) printf("%d %d\n", i, j), Need--;
  }
  return 0;
}


Measured memory_bytes: 42496
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int dp[100010],a[100010];

int main(void){

	int n;
	cin >> n;
	REP(i,n) cin >> a[i];

	const int INF=1e9+7;
	fill(dp,dp+n,INF);
	REP(i,n){
		*lower_bound(dp,dp+n,a[i])=a[i];
	}

	cout << lower_bound(dp,dp+n,INF)-dp << endl;

	return 0;
}

Measured memory_bytes: 1940
<?php



fscanf(STDIN, "%d%d", $N, $M);

$map = array_fill(1,$N,[]);

for($i=1;$i<=$N;$i++){
    list($map[$i][1], $map[$i][2], $map[$i][4]) = explode(" ", trim(fgets(STDIN)));
}
$ans = PHP_INT_MIN;
for($k = 0;$k<8;$k++) {
    $list = [];
    $sum = 0;
    foreach($map as $row) {
        $tmp = 0;
        foreach ($row as $key => $value) {
            if (($key & $k) > 0) {
                $value *= -1;
            }
            $tmp += $value;
        }
        $list[] = $tmp;
    }
    rsort($list);
    $a_tmp = 0;
    for($i=0;$i<$M;$i++){
        $a_tmp += $list[$i];
    }
    $ans = max($ans, $a_tmp);
}
echo $ans;

Measured memory_bytes: 4604
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    string s;
    cin >> s;
    if(s[1]=='B')s[1]='R';else s[1]='B';
    cout << s << endl;
}


Measured memory_bytes: 3596
n,K = map(int,input().split())
p = list(map(int,input().split()))

acc = []
x = 0
for i in range(n):
    x += p[i]
    acc.append(x)

ex = 0
for i in range(n-K+1):
    if i == 0:
        bre = acc[i+K-1]
    else:
        bre = acc[i+K-1] - acc[i-1]
    exx = (K+bre)/2
    
    if exx > ex:
        ex = exx
print(ex)

Measured memory_bytes: 25060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define INF 1000000000000000000
#define all(x) x.begin(), x.end()
#define PI 3.141592653589793

int main() {
    string S, T;
    cin >> S >> T;
    bool judge = 1;
    map<char, char> A, B;
    rep(i, S.size()) {
        char s = S[i], t = T[i];
        if (A.count(s) && A[s] != t)
            judge = false;
        if (B.count(t) && B[t] != s)
            judge = false;
        A[s] = t, B[t] = s;
    }
    if (judge)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 776
import java.util.*;

public class Main {
    static final int MOD = 1000000007;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		HashSet<Integer> set = new HashSet<>();
		for (int i = 0; i < m; i++) {
		    set.add(sc.nextInt());
		}
		int[] dp = new int[n + 1];
		dp[0] = 1;
		if (!set.contains(1)) {
		    dp[1] = 1;
		}
		for (int i = 2; i <= n; i++) {
		    if (!set.contains(i)) {
		        dp[i] = (dp[i - 2] + dp[i - 1]) % MOD;
		    }
		}
		System.out.println(dp[n]);
   }
}


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

int main() {
  int N, M; cin >> N >> M;
  long A[N]; for (int i = 0; i < N; i++) cin >> A[i];
  sort(A, A + N, greater<int>());
  int P[N];
  for (int i = 0; i < N; i++) {
    P[i] = 0;
    long n = A[i];
    while (n > 0) {
      n /= 2; P[i]++;
    }
  }
  int prev = P[0], idx_p = 0;
  for (int i = 0; i < M; i++) {
    if ((idx_p >= N) || (P[idx_p] != prev)) {
      prev = P[0];
      if (prev == 0) break;
      while ((idx_p < N) && (P[idx_p] == prev)) idx_p++;
      sort(A, A+idx_p, greater<int>());
      idx_p = 0;
    }
    P[idx_p]--;
    A[idx_p] /= 2;
    idx_p++;
  }
  long sum = 0;
  for (int i = 0; i < N; i++) {
    sum += A[i];
  }
  cout << sum << endl;
}

Measured memory_bytes: 1408
def main():
    n = int(input())

    if n > 86399:
        print("invalid answer.")
        return

    h = int(n / 3600)
    th = h*3600
    m = int((n-th) /60)
    tm = m *60
    s = n-th-tm

    print("{0}:{1}:{2}".format(h,m,s))

if __name__ == '__main__':
    main()

Measured memory_bytes: 5592
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    private static final int[][] table = new int[10][10];

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out)) {
            for (int i = 0; i < 10; i++) {
                for (int j = 0; j < 10; j++) {
                    table[i][j] = in.nextInt();
                }
            }
            int ans = 0;
            main:
            for (int i = 0; i < 10000; i++) {
                int[] d = new int[5];
                {
                    int t = i;
                    for (int j = 0; j < 4; j++) {
                        d[3 - j] = t % 10;
                        t /= 10;
                    }
                }
                d[4] = ssn(d[0], d[1], d[2], d[3]);
                if (ssn(d) != 0) throw new RuntimeException();

                // Misuse
                for (int j = 0; j < 5; j++) {
                    int original = d[j];
                    for (int k = 0; k < 10; k++) {
                        if (original == k) continue;
                        d[j] = k;
                        if (ssn(d) == 0) {
                            //System.out.println(Arrays.toString(d)+": Misuse");
                            ans++;
                            continue main;
                        }
                    }
                    d[j] = original;
                }

                // Swap
                for (int j = 0; j < 4; j++) {
                    if (d[j] == d[j + 1]) continue;
                    swap(d, j, j + 1);
                    if (ssn(d) == 0) {
                        //System.out.println(Arrays.toString(d)+": Swap");
                        ans++;
                        continue main;
                    }
                    swap(d, j, j + 1);
                }
            }
            out.println(ans);
        }
    }

    private static int ssn(int... a) {
        int t = 0;
        for (int i = 0; i < a.length; i++) {
            t = table[t][a[i]];
        }
        return t;
    }

    private static void swap(int[] a, int x, int y) {
        int t = a[x];
        a[x] = a[y];
        a[y] = t;
    }
}



Measured memory_bytes: 29592
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yosiiii
 */


#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long int i=0;i<(n);++i)
typedef long long int ll;

class ACircle {
public:
	void solve(std::istream& in, std::ostream& out) {
        int r;
        in >>r;
        out <<r*r <<endl;
	}
};


int main() {
	ACircle solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#define INF 100000000000000
using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

int main(){
    llong N,M;
    cin >> N >> M;
    llong sum=0;
    vector<llong> A(M);
    for(int i=0; i<M; i++){
        cin >> A[i];
    }
    for(int i=0; i<A.size(); i++){
        sum = sum + A[i];
    }
    if(sum>N){
        cout << -1 << endl;
        exit(0);
    }
    cout << N-sum << endl;
    return 0;
}

//00:81 s

Measured memory_bytes: 3268
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//for(int i = 0; i<n; i++)
 
 
int main()
{
    string s,t;cin>>s>>t;
    int n = (int) s.size();
    for(int i = 0; i < n; i++){
        bool can = true;
        for(int j = 0; j < n; j++){
            if(s[j] != t[(j + i)%n]) can = false;
        }
        if(can) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <iomanip>
  
using namespace std;

#define pi 3.141592653589793

void CountingSort(int a[], int b[], int k)
{
	int *c = new int[2000000];
	for(int i = 0; i < 2000000; i++){
		c[i] = 0;
	}
	for(int i = 0; i < k; i++){
		c[a[i]]++;
	}
	for(int i = 1; i < 2000000; i++){
		c[i] = c[i] + c[i - 1];
	}
	for(int i = k - 1; i >= 0; i--){
		b[c[a[i]] - 1] = a[i];
		c[a[i]]--;
	}
	delete[] c;
	return;
}

int main()
{
	int n;
	int *a  = new int[2000000];
	int *b = new int[2000000];
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	CountingSort(a, b, n);
	for(int i = 0; i < n; i++){
		cout << b[i];
		if(i == n - 1) cout << endl;
		else cout << " ";
	}
	delete[] a;
	delete[] b;
	return 0;
}

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

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

    int n, m;
    cin >> n >> m;
    vector<int> w(n), v(n);
    REP(i, n) cin >> w[i] >> v[i];

    vector<ll> dp(m + 1, 0);
    REP(i, n)
        for (int j = m; j >= w[i]; j--)
            dp[j] = max(dp[j], dp[j - w[i]] + v[i]);

    cout << dp[m] << '\n';
    return 0;
}

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

int main(void){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if((a+b)>(c+d)) cout << "Left" << endl;
  else if((a+b)<(c+d)) cout << "Right" << endl;
  else cout << "Balanced" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int canvas[100][100];

void draw(int x, int y, int tmpx, int tmpy) {
	int i, j;
	for (i = x; i < tmpx; i++) {
		for (j = y; j < tmpy; j++) {
			canvas[i][j] = 1;
		}
	}
}

int main(){
	int W, H, N, sum = 0, x[100], y[100], a[100], i, j;
	scanf("%d%d%d", &W, &H, &N);
	for (i = 0; i < W; i++) {
		for (j = 0; j < H; j++) {
			canvas[i][j] = 0;
		}
	}
	for (i = 0; i < N; i++) {
		scanf("%d%d%d", &x[i], &y[i], &a[i]);
	}

	for (i = 0; i < N; i++) {
		switch(a[i]) {
			case 1:
				draw(0, 0, x[i], H);
				break;
			case 2:
				draw(x[i], 0, W, H);
				break;
			case 3:
				draw(0, 0, W, y[i]);
				break;
			case 4:
				draw(0, y[i], W, H);
				break;
			default:
				break;
		}

	}

	for (i = 0; i < W; i++) {
		for (j = 0; j < H; j++) {
			if (canvas[i][j] == 0)sum++;
		}
	}
	printf("%d\n", sum);
	scanf("%d", &sum);
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce
# stdin = open("sample.txt")
 
MOD = 1000000007
 
def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
def combination(m,n):
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))
 
def main():
    s_1 = stdin.readline().rstrip()
    s_2 = stdin.readline().rstrip()
    s_check = s_2[0:-1]
    if s_1 == s_check:
        print("Yes")
    else:
        print("No")
 
main()

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

int main() {
    ll n;
    cin >> n;
    unordered_map<string,int> um;
    ll res = 0;
    rep(i,n){
        string s;
        cin >> s;
        sort(s.begin(),s.end());
        if(um.find(s) != um.end()){
            res += um.at(s);
            um.at(s)++;
        }else{
            um.insert(make_pair(s,1));
        }
    }
    cout << res << endl;
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 10660
#include <bits/stdc++.h>
#define int long long
#define pii pair<int, int>
  
using namespace std;
const int inf = 1e9 + 7;
int k;

vector<int> res(10);

void rec(int id, int pr) {
	//cout << id << " " << pr << '\n';
	if (id == 10) {
		k--;
		return;
	}


	if (pr == -1) {
		rec(id + 1, -1);

		for(int i = 1;i <= 9;i++) {
			if (k == -1) return;
			res[id] = i;
			rec(id + 1, i);
		}

	}else{
		for(int i = max(0ll, pr - 1);i <= min(9ll, pr + 1);i++) {
			if (k == -1) return;
			res[id] = i;
			rec(id + 1, i);
		}
	}
}






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

	cin >> k;

	rec(0, -1);

	int id = 0;
	while(res[id] == 0) id++;

	for(int i = id;i <= 9;i++) cout << res[i];
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const long long MOD = 998244353;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
constexpr auto PI = 3.14159265358979323846264338327950L;
int needleX[4] = { -1,0,1,0 };
int needleY[4] = { 0,1,0,-1 };

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    char N;
    cin >> N;
    if (isupper(N))cout << "A" << endl;
    else cout << "a" << endl;
    return 0;
}


Measured memory_bytes: 3648
from heapq import heappop, heappush


class E:
    def __init__(self, to, cost):
        self.to = to
        self.cost = cost


#
N, M, r = [int(x) for x in input().split()]

G = [[] for x in range(N)]
D = [float('inf')] * N
V = [False] * N

for i in range(M):
    s, t, d = [int(x) for x in input().split()]
    G[s].append(E(t, d))

#
pq = [(0, r)]
D[r] = 0

while pq:
    u = heappop(pq)
    if V[u[1]]:
        continue
    for v in G[u[1]]:
        if v.cost + u[0] < D[v.to]:
            D[v.to] = v.cost + u[0]
            heappush(pq, (D[v.to], v.to))
    V[u[1]] = True
#
for d in D:
    print(d if d != float('inf') else 'INF')


Measured memory_bytes: 140484
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    a=sort(parseMap(split(readline())))
    println(a[3]-a[2]+a[2]-a[1])
end
main()

Measured memory_bytes: 113936
n,a,b=map(int,input().split())
if a>b:
  print(0)
  exit()
if a==b:
  print(1)
  exit()
if n==1:
  print(0)
  exit()
minimum = a*(n-1)+b
maximum = b*(n-1)+a
if n<=2:
  print(1)
else:
  print(maximum-minimum+1)


Measured memory_bytes: 3316
import math

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

if N == 1:
    print(M)
else:
    divisor = []
    n = int(math.sqrt(M))
    for i in range(1, n+1):
        if M % i == 0:
            tmp = M // i
            if not i in divisor:
                divisor.append(i)
            if not tmp in divisor:
                divisor.append(tmp)
    maximize = 0
    threshold = M // N
    for item in divisor:
        if item <= threshold and maximize < item:
            maximize = item

    print(maximize)

Measured memory_bytes: 3064
n, m = map(int, input().split())
k = [list(map(int, input().split())) for i in range(n)]
ans = 0
for i in range(1, m+1):
    cnt = 0
    for p in k:
        if i in p[1:]:
            cnt += 1
    if cnt == n:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Info{
	char name[101];
	int length,value;
};

struct Data{
	Data(int arg_left,int arg_sum_value){
		left = arg_left;
		sum_value = arg_sum_value;
	}
	bool operator<(const struct Data &arg) const{
		return left > arg.left;
	}

	int left,sum_value;
};

int N;
Info info[100];
char line[201];
int case_number = 1,line_length;


void func(){

	int tmp_length;
	for(int i = 0; i < N; i++){
		scanf("%s %d",info[i].name,&info[i].value);
		for(tmp_length = 0; info[i].name[tmp_length] != '\0'; tmp_length++);
		info[i].length = tmp_length;
	}

	scanf("%s",line);
	for(tmp_length = 0; line[tmp_length] != '\0'; tmp_length++);
	line_length = tmp_length;


	int max_value[line_length+1];
	for(int i = 0; i <= line_length; i++)max_value[i] = 0;

	priority_queue<Data> Q;
	Q.push(Data(0,0));

	bool FLG;

	while(!Q.empty()){

		if(Q.top().left == line_length){
			Q.pop();
		}else if(Q.top().sum_value < max_value[Q.top().left]){
			Q.pop();
		}else{

			for(int i = 0; i < N; i++){
				if(Q.top().left+info[i].length-1 >= line_length)continue;

				FLG = true;
				for(int k = 0; k < info[i].length; k++){
					if(line[Q.top().left+k] != info[i].name[k]){
						FLG = false;
						break;
					}
				}


				if(FLG){
					if(max_value[Q.top().left+info[i].length] < Q.top().sum_value+info[i].value){
						max_value[Q.top().left+info[i].length] = Q.top().sum_value+info[i].value;
						Q.push(Data(Q.top().left+info[i].length,max_value[Q.top().left+info[i].length]));
					}
				}
			}

			Q.pop();
		}
	}

	int digit = max_value[line_length];

	int dp[digit+1];
	int next_dp[digit+1];

	for(int i = 1; i <= digit; i++){
		dp[i] = BIG_NUM;
		next_dp[i] = BIG_NUM;
	}

	dp[0] = 0;
	next_dp[0] = 0;

	for(int i = 0; i < N; i++){
		for(int num = 1; num*info[i].value <= digit; num++){
			for(int k = digit; k-num*info[i].value >= 0; k--){
				if(dp[k-num*info[i].value] != BIG_NUM){
					next_dp[k] = min(next_dp[k],dp[k-num*info[i].value]+num*info[i].length);
				}
			}
		}
		for(int k = 1; k <= digit; k++)dp[k] = next_dp[k];
	}

	printf("Case %d: %d\n",case_number,next_dp[digit]);

	case_number++;
}


int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 3356
using System;
using System.Linq;
using System.Collections.Generic;

public class Hello{
    public static void Main(){
        // Your code here!
        string S = Console.ReadLine();
        string[] divide = new string[]{"dream", "dreamer", "erase", "eraser"};
        bool[] dp = new bool[100010];
        
        
        
        //bool can = true;
        dp[0] = true;
        for(int i = 0; i <= S.Length; i++)
        {
            if(dp[i] == false)
            {
                continue;
            }
            //bool can2 = false;
            for(int j = 0; j < divide.Length; j++)
            {
                string d = divide[j];
                
                if(S.Length - i  < d.Length)
                {
                    continue;
                }
                
                else if(S.Substring(i, d.Length) == d) //divide[i]で分割できたら
                {
                    dp[i + d.Length] = true;
                    //Console.WriteLine(i + d.Length);
                }
                
            }
            /*
            if(can2 == false)
            {
                
                can = false;
                break;
            }
            */
        }
        
       
        
        if(dp[S.Length] == true) Console.WriteLine("YES");
        else Console.WriteLine("NO");
        
    }
}

Measured memory_bytes: 13408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    ll n;
    cin >> n;
    ll hn=pow(n,0.5);
    while(true){
        if(n%hn==0){
            cout << hn+n/hn-2;
            return 0;
        }
        hn--;
    }
}

/*



 */


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    int s;
    cin>>s;
    vector<int> memo(400,0);
    bool flag =false;
    int index=0;
    while(!flag){
        index++;
        if(1==memo[s]){
            flag=true;
        }else{
            memo[s]++;
            if(0==s%2){
                s/=2;
            }else{
                s=3*s+1;
            }
        }
    }
    cout<<index<<endl;
    return 0;
}

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



int main() {
  int x;
  cin >> x;
  
  if(x>=30) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  
  return 0;
}


Measured memory_bytes: 3668
import math
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**6)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7


N = INT()
G = [dict() for _ in range(N)]
for i in range(N-1):
    u,v,w=map(int,input().split())
    G[u-1][v-1]=w
    G[v-1][u-1]=w
color=[-1 for _ in range(N)]
dist=[-1 for _ in range(N)]
dist[0]=0
q=[0]
while q:
    r=q.pop()
    for p in G[r]:
        if dist[p]!=-1:
            continue
        dist[p]=dist[r]+G[r][p]
        q.append(p)
for i in range(N):
    color[i]=dist[i]%2
for ans in color:
    print(ans)

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) {
    cin >> a[i];
    a[i]--;
  }
  int ans = 0;
  vector<bool> push(n, false);
  int now = a[0];
  while (1) {
    if (push[now]) {
      ans = -1;
      break;
    }
    push[now] = true;
    ans++;
    if (now == 1) break;
    now = a[now];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3796
from sys import stdin
import math
# import numpy as np
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = [int(x) for x in stdin.readline().rstrip().split()]
x = []
for i in range(6):
  x.append(int(stdin.readline().rstrip().split()[0]))
  
kyori = x[4] - x[0]
k = x[5]
if k >= kyori:
  print("Yay!")
else:
  print(":(")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)

using namespace std;
typedef long long ll;

string s;

int main()
{
    FAST_IO;

    cin >> s;
    int s0 = 0, s1 = 0;
    for (int i = 0; i < (int) s.size(); i++) {
        if ((i % 2 == 0 && s[i] == '0') || (i%2 != 0 && s[i] == '1'))
            s0++;
        else
            s1++;
    }
    cout << s.size() - max(s0, s1) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(){
    char S[1024];
    scanf("%s", S);

    int i=0;
    while(S[i]!='\0'){
        i++;
    }

    if(S[i-1]=='s'){
        S[i]='e';
        S[i+1]='s';
        S[i+2]='\0';
    }
    else{
        S[i]='s';
        S[i+1]='\0';
    }

    printf("%s\n", S);
    return 0;
}

Measured memory_bytes: 1660
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <string.h>
#include <string>
#include <complex>
#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i = 0; i < n; ++i)
#define Rep(i,n) for(int i = 1; i <= n; ++i)
#define lowbit(x) ((x)&(-x))
//#pragma comment(linker,"/STACK:1024000000,1024000000")
#define eps 1e-8
#define sqr(x) ((x)*(x))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef complex<double>cp;
template<class T>inline void rread(T&num){
    num=0;T f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
    num*=f;
}
const ll inf = 1e18;
const int maxn = 2e5+10, mod = 1e9 + 7;
const int mod1 = 1e8+7,mod2 = 41;
const double pi = acos(-1);
ll gcd (ll a, ll b)
{return ( a ? gcd(b%a, a) : b );}
void exgcd(ll a,ll b,ll &d,ll& x,ll& y)
{
    if(!b){d=a;x=1;y=0;}
    else {exgcd(b,a%b,d,y,x);y-=x*(a/b);}
}
cp power(cp a, int n)
{cp p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
unsigned long long power(unsigned long long a, unsigned long long n)
{unsigned long long p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n)
{ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod)
{ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
//head
int n,m;
int a[maxn],b[maxn];
pair<int,int> p[maxn];
int main()
{
    int kase=1;
    //freopen("data2.out","r",stdin);
    //freopen("ans2.out","w",stdout);


   while(cin>>n>>m)
   {
       int cun = 0;
       for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i],&b[i]),p[cun].first = a[i],p[cun++].second = 1,
        p[cun].first = b[i],p[cun++].second = 2;
        sort(p,p+cun);
        int ans = 0;
        for(int i=cun-1;i>=0;i--)
        {
            if(p[i].second==1)
            {
                ans+=(m-1)/p[i].first+1;
                break;
            }
            ans++;
            m-=p[i].first;
            if(m<=0)
                break;
        }
        cout<<ans<<endl;



   }

    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int N;
    cin >> N;
    map<string, vector<int>> S;
    vector<int> P(N);
    int i, j, tmp;
    string s;
    for(i = 0; i < N; i++) {
        cin >> s >> P[i];
        S[s].push_back(i);
        j = S[s].size() - 1;
        while(j > 0) {
            if(P.at(S[s].at(j)) > P.at(S[s].at(j - 1))) {
                tmp = S[s].at(j);
                S[s].at(j) = S[s].at(j - 1);
                S[s].at(j - 1) = tmp;
            }
            j--;
        }
    }

    for(auto itr = S.begin(); itr != S.end(); ++itr) {
        for(i = 0; i < itr->second.size(); i++) {
            cout << itr->second[i] + 1 << endl;
        }
    }
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>

#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <ctime>

// namespace
using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

// constant
static const ll MOD = 1000000007LL;
static const double PI = 3.14159265358979323846;

// conversion
inline ll toint(string s) { ll v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

// print
#define RET(x) return cout << x << endl, 0;

// for loop
#define REP(i, a, b) for ((i) = (ll)(a);(i) < (ll)(b);(i)++)
#define REPD(i, a, b) for (ll i = (ll)(a);(i) < (ll)(b);(i)++)
#define REPI(v, vs) for (auto& v : vs)

//debug
#ifdef LOCAL_ENV
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define DUMP(x)
#define DEBUG(x)
#endif

#define MAX_VALUE 9223372036854775807LL

template <ull N, class T, class... Args, std::enable_if_t<N == 0, int> = 0>
auto make_multiple_vector(Args... args) {
    return T(args...);
}

template <ull N, class T, class... Args, std::enable_if_t<N != 0, int> = 0>
auto make_multiple_vector(ull size, Args... args) {
    using value_type = std::decay_t<decltype(make_multiple_vector<N - 1, T>(args...))>;
    return vector<value_type>(size, make_multiple_vector<N - 1, T>(args...));
}

int solve() {
	string S, T;
	cin >> S >> T;

	ll res = MAX_VALUE;
	REPD(i, 0, S.size()) {
		if (S.size() < T.size() + i) break;
		ll curr_res = 0;
		REPD(j, 0, T.size()) {
			if (S[i + j] != T[j]) ++curr_res;
		}
		res = min(res, curr_res);
	}
	
	RET(res);

	return 0;
}

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

	solve();
	// ll t;
	// cin >> t;
	// REPD(i, 0, t) solve();

	return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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; }

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n;
  cin >> n;
  vector<pair<ll, ll>> a(n); // pair of <value, id>
  rep(i, n) {
    cin >> a[i].first;
    a[i].second = i + 1; // 1-indexed
  }
  sort(all(a));
  reverse(all(a));
  // For Debug
  // rep(i, n) {
  //   cout << a[i].first << " " << a[i].second << endl;
  // }

  vector<vector<ll>> dp(n+1, vector<ll>(n+1)); // dp[x][y] .. max score when selecting x as (i-pi) and y as (pi-i).
  rep(x, n) rep(y, n) {
    ll now = x + y;
    if (now >= n) { continue; }
    ll px = x+1; // 1, 2, ...
    ll py = n-y; // n, n-1, ...
    if (a[now].second - px >= 0) { // i >= j
      chmax(dp[x+1][y], dp[x][y] + a[now].first * (a[now].second - px));
    }
    if (py - a[now].second >= 0) { // i <= j
      chmax(dp[x][y+1], dp[x][y] + a[now].first * (py - a[now].second));
    }
  }

  ll ans = 0;
  rep(i, n+1) {
    chmax(ans, dp[i][n-i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 34576
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

int c[128][128];
bool flag[128][128];

void solve(ll A, ll B, vector<vector<ll>> d) {
  REP(x,128) REP(y,128) {
    REP(i,A) REP(j,B) {
      chmax(c[x][y], int(d[i][j]) - x * (i + 1) - y * (j + 1));
    }
  }
  // REP(i,10) { REP(j,10) cout << c[i][j] << " "; cout << endl; }
  vector<tuple<int,int,int>> res;
  REP(s,120) REP(x,128) {
    int y = s - x;
    if (y < 0) continue;
    // if (x == 0 && y == 0)
    // cout << x << " " << y << endl;
    bool ok = false;
    REP(i,A) REP(j,B) {
      if (flag[i][j]) continue;
      if (c[x][y] == int(d[i][j]) - x * (i + 1) - y * (j + 1)) {
        ok = true;
        flag[i][j] = true;
      }
    }
    if (ok) {
      res.emplace_back(x, y, c[x][y]);
      // cout << x << " " << y << " " << c[x][y] << endl;
    }
  }
  bool ng = false;
  REP(i,A) REP(j,B) if (!flag[i][j]) ng = true;
  if (ng) cout << "Impossible" << endl;
  else {
    int V = 2;
    vector<tuple<int,int,string>> edge;
    for (auto t: res) {
      int x, y, cost;
      tie(x, y, cost) = t;
      int pv = 0;
      REP(i,x) {
        edge.emplace_back(pv, V, "X");
        pv = V; ++V;
      }
      REP(i,y) {
        edge.emplace_back(pv, V, "Y");
        pv = V; ++V;
      }
      edge.emplace_back(pv, 1, to_string(cost));
    }
    cout << "Possible" << endl;
    cout << V << " " << edge.size() << endl;
    for (auto e: edge) {
      int s, t; string c;
      tie(s, t, c) = e;
      cout << s + 1 << " " << t + 1 << " " << c << endl;
    }
    cout << 1 << " " << 2 << endl;
  }
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll B;
	ll A;
	scanf("%lld", &A);
	scanf("%lld", &B);
	vector<vector<ll>> d(A-1+1,vector<ll>(B-1+1));
	for (int i = 0 ; i <= A-1 ; i++) {
	  for (int j = 0 ; j <= B-1 ; j++) {
	    scanf("%lld", &d[i][j]);
	  }
	}
	solve(A, B, d);
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()

string S, T;

int main() {
    cin >> S >> T;
    cout << T << S << endl;
}

Measured memory_bytes: 256
n=int(input())
print(str(n) + ":",end=" ")
x=[]
a=2
while a*a<=n :
    while n%a == 0:
        x.append(a)
        n=n//a
    a+=1
if n>1:
    x.append(n)
print(' '.join(str(k) for k in x))


Measured memory_bytes: 5604
const C: usize = 7;
const BUF: usize = 600;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let mut k: usize = sc.read();
    let mut precompute = [[0; C]; BUF];

    for from in 0..BUF {
        for to in from..BUF {
            for next in 0..C {
                precompute[to][next] += if next == 0 {
                    1
                } else {
                    precompute[from][next - 1]
                };
            }
        }
    }

    let mut ans = String::new();
    for i in (0..BUF).rev() {
        let count = k / precompute[i][C - 1];
        k %= precompute[i][C - 1];
        for _ in 0..count {
            ans.push('L');
        }
        ans.push_str("AVITSEF");
    }

    ans = ans.chars().rev().collect();
    println!("{}", ans);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
# n = int(input())
# a, b = map(int, input().split())
# int_list = list(map(int, input().split()))
# l = list(input().split())
n = int(input())
a_list = list(map(int, input().split()))

n_minus = 0
mn = 10**9
abssum = 0
for a in a_list:
  absa = abs(a)
  abssum += absa
  if a < 0:
    n_minus += 1
  if absa < mn:
    mn = absa
    
if n_minus %2 == 0:
  print(abssum)
else:
  print(abssum - 2*mn)

Measured memory_bytes: 14284
#include<stdio.h>

int main(void)
{
	
	int H,M;	
	int h,m;
	
	while(1){
		
		scanf("%d %d",&H, &M);
		if( H == 0 && M == 0 ){
			break;
		}
		
		for(h = 0; h < H; h++)
		{
			for(m = 0; m < M; m++)
			{
			
				printf( "#" );
			}
			
			printf( "\n" );
		}
		
		printf( "\n" );
	}
	
	return 0;
}


Measured memory_bytes: 2104
#include <stdio.h>
int main(void){
	char num[4];
	scanf("%s",num);
	int i=0;
	while(i<4){
		if(num[i]=='1'){
			num[i]='9';
		}else if(num[i]=='9'){
			num[i]='1';
		}
		i++;
	}
	printf("%s",num);
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b;cin >> a >> b;
    int i = 1,j = 1;
    long long ans1 = a,ans2 = b;
    while(ans1 != ans2)
    {
        if(ans1 > ans2)ans2 = b*j++;
        else ans1 = a*i++;
    }
    cout << ans1 << endl;
    return 0;
}


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

int main() {
  int X;
  cin >> X;
  int x = X;
  int sum = 0;
  while(x!=0) {
    sum+=x%10;
    x/=10;
  }
  
  if(X%sum==0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
M = 0
D = int(input())
*c, = map(int, input().split())
S = []
for _ in [None] * D:
    *s, = map(int, input().split())
    S += s,
last = [-1] * 26

def check():
    for d in range(D):
        t = int(input())
        M += S[d][t - 1]
        last[t - 1] = d
        M -= sum((d - last[i]) * c[i] for i in range(26))
        print(M)

INF = float("inf")
for d in range(D):
    m = -INF
    for j in range(26):
        Q = S[d][j] - sum((d - last[i]) * c[i] for i in range(26) if i != j)
        if m < Q:
            t, m = j, Q
    print(t + 1)
    last[t] = d
    M += m
    # print(M)

Measured memory_bytes: 9520