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

public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		String s =scn.next();
		String c =scn.next();
		
		if(s.length()!=c.length()-1){
			System.out.println("No");
			return;
		}
		for(int i=0;i<s.length();i++){
			char ch1=s.charAt(i);
			char ch2 =c.charAt(i);
			if(ch1!=ch2){
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
		

	}

}

Measured memory_bytes: 35748
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define w(t) int t;cin>>t;while(t--)
#define pb push_back
#define mk make_pair
#define ascSort(v) sort(v.begin(), v.end())
#define descSort(v) sort(v.begin(), v.end(), greater<int>())
#define ff first
#define ss second
#define pi pair<int,int>
#define vi vector<int>
#define umapi unordered_map<int,int>

const int m=998244353;
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>PBDS;

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

int32_t main(){
	
	//FIO();
	
		string s,t;cin>>s>>t;
		int ans=t.length();
		for(int i=0; i<(int)s.length(); i++){
			if(i-1+(int)t.length()>=(int)s.length())break;
			int cnt=0;
			for(int j=0; j<(int)t.length(); j++)
				if(t[j]!=s[i+j])cnt++;
			ans=min(ans,cnt);
		}
		cout<<ans<<"\n";
		
	return 0;
	
		
}



	
	

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define int long long
#define PI 3.14159265
int mod = 1000000009;
#define fi(i,start,end) for(int i=0; i<n; i++)
#define pb(x) push_back(x)
#define int long long
#define PI 3.14159265
#define all(v) v.begin(), v.end()
#define endl cout<<"\n" 
#define ll long long
#define dbg(x) cout<<#x<<" "<<x;endl;
#define bye endl;return
using namespace std;
template<typename T>



void debug(vector<T> x){
    for(auto e:x){
        cout<<e<<" ";
    }
    cout<<"\n";
}
/*
1
8 6
1 2 4 1 2 4 1 2

*/


void solve(){
    int n;
    string s;
    cin>>s;
    n = s.size();
    bool start = false;
    int cur = 0;
    vector<int> helper;
    for(int i=0; i<n; i++){
        if(s[i]=='R'){
            if(!start){
                start = true;
            }
            cur++;
        }else{
            if(start){
                helper.push_back(cur);
                cur = 0;
                start = false;
            }
        }
    }
    if(cur > 0)
        helper.push_back(cur);
    int ans = 0;
    if((int)helper.size()>(int)0)
        ans = *max_element(all(helper));
    
    
    cout<<ans;bye;
    
}

signed main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1;;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}



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

	ll n;
	string s;
	cin >> n >> s;

	REP(i, s.size()) {
		s[i] += n;
		while (s[i] > 'Z') s[i] -= 26;
	}
	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <iomanip>
#include <map>
using namespace std;


int main()
{
   long long x, k, d;

   cin >> x >> k >> d;

   long long sign = 1;
   
   if (x < 0)
   {
      sign = -1;
      x = -x;
   }

   long long cnt = x / d;

   cnt = min(cnt, k);

   k -= cnt;

   long long finalpoint = x - cnt * d;

   if (k & 1)
   {
      finalpoint -= d;
   }

   cout << abs(finalpoint);

   return 0;
}

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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

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

    int M1, D1, M2, D2;
    std::cin >> M1 >> D1 >> M2 >> D2;
    std::cout << (M1 != M2 ? 1 : 0) << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <set>
#include <iostream>
#include "cmath"
#include <map>
#include "unordered_map"
#include <queue>

using namespace std;

struct pair_hash {
    long long hash_seed = (int)1e9 + 7;
    long long operator()(const pair<int, int>&x) const {
        return hash_seed*x.first + x.second;
    }
};

typedef unordered_map<pair<int, int>, int, pair_hash> megamap;
pair<int, int> go[4] = {
        {1, 0},
        {0, 1},
        {-1, 0},
        {0, - 1}
};
vector<int> graph[(int)1e6 + 7];
void explore(int k, megamap&belong, map<pair<int ,int>, bool>& g, pair<int, int> v, vector<pair<int, int>>& carry) {
    if(!g[v]) return;
    else {
        carry.push_back(v);
        for(auto x: go) {
            g[v] = false;
            belong[v] = k;
            explore(k, belong, g, {v.first + x.first, v.second + x.second}, carry);
        }
    }
}
int main() {
   ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   int n, m;
   cin >> n >> m;
   int ch, cw;
   cin >> ch >> cw;
   int dh, dw;
   cin >> dh >> dw;
   map<pair<int, int>, bool> x;
   for(int i = 0; i < n; i++) {
       string g;
       cin >> g;
       for (int j = 0; j < m; j++) {
           x[{i + 1, j + 1}] = g[j] == '.';
       }
   }
   unordered_map<pair<int, int>, int, pair_hash> belong;
   vector<vector<pair<int, int>>> comps;
   int k = 1;
   for(int i = 1; i <= n; i++) {
       for(int j = 1; j <= m; j++)
       {
           if(x[{i, j}]) {
               vector<pair<int, int>> new_comp;
               explore(k, belong, x, {i, j}, new_comp);
               comps.push_back(new_comp);
               ++k;
           }
       }
   }

   for(auto &v : comps) {
       for(auto c: v) {
           for (int i = max(1, c.first - 2); i <= min(n, c.first + 2); ++i) {
               for (int j = max(1, c.second - 2); j <= min(m, c.second + 2); ++j) {
                   if (belong[{i, j}] != 0 && belong[{i, j}] != belong[c]) {
                       graph[belong[c]].push_back(belong[{i, j}]);
                       graph[belong[{i, j}]].push_back(belong[c]);;
                   }
               }
           }
       }
   }
   vector<int> used(comps.size() + 1, 0);
   vector<int> d(comps.size() + 1, (int)1e9 + 7);
   queue<int> bfs;
   bfs.push(belong[{ch, cw}]);
   d[belong[{ch, cw}]] = 0;
   while(!bfs.empty()) {
        int v = bfs.front();
        bfs.pop();
        used[v] = true;
        for(auto to: graph[v]) {
            if (!used[to]) {
                bfs.push(to);
                used[to] = true;
                d[to] = d[v] + 1;
            }
        }
   }
   if(d[belong[{dh, dw}]] == (int)1e9 + 7) {
       printf("-1\n");
   } else printf("%d", d[belong[{dh, dw}]]);



}

Measured memory_bytes: 173572
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;

int main(){
    vector<ll> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    ll k; cin >> k;
    cout << a[k-1] << endl;
}

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

#define bolt ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double ld;

const ld pi=3.1415926535897932384626433;
const int mod = 1000000007;
const ll inf=3e18;

int main ()
{
   bolt;
   ll x;
   cin>>x;
   for (ll i=1000;i>=-1000;i--)
   {
      for (ll j=i-1;j>=-1000;j--)
      {
         if (pow(i,5)-pow(j,5)==x)
         {
            cout<<i<<" "<<j;
            return 0;
         }
      }
   }
}


Measured memory_bytes: 4112
// youngjinp20
// 2020 03

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

typedef long long ll;

const int MAX = 1e5;
int N;
int h[MAX];

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

	int dp[MAX];
	for (int i=1; i<N; i++) {
		if (i >= 2) {
			int cost1 = dp[i-1] + abs(h[i] - h[i-1]);
			int cost2 = dp[i-2] + abs(h[i] - h[i-2]);
			dp[i] = min(cost1, cost2);
		}
		else {
			int cost1 = dp[i-1] + abs(h[i] - h[i-1]);
			dp[i] = cost1;
		}
	}

	cout << dp[N-1] << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define v(t) vector<t>
#define vv(t) vector<vector<t>>
#define p(t1,t2) pair<t1,t2>
using namespace std ;
int main(){
    ll x , k , d ;
    cin >> x >> k >> d ;
    x = abs(x) ;
    ll mov = (x - x%d) / d;
    if(k>mov) cout << ((k-mov)%2)*(abs(x%d-d)) + ((k-mov+1)%2)*(abs(x%d)) << "\n" ;
    else cout << x - k*d << "\n" ;
    return 0 ;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
int n;
string s;
bool check(vin &a){
  rep(i,2,n){
    if(s[i-1]=='o'){
      if(a[i-1]==0){
        a[i]=a[i-2];
      }
      else{
        a[i]=(!a[i-2]);
      }
    }
    else{//x
      if(a[i-1]==0){
        a[i]=(!a[i-2]);
      }
      else{
        a[i]=a[i-2];
      }
    }
  }
  bool ans=1;
  //0
  if(s[0]=='o'){
    if(a[0]==0){
      if(a[n-1]!=a[1])ans=false;
    }
    else{
      if(a[n-1]==a[1])ans=false;
    }
  }
  else{
    if(a[0]==0){
      if(a[n-1]==a[1])ans=false;
    }
    else{
      if(a[n-1]!=a[1])ans=false;
    }
  }
  
  //n-1
  if(s[n-1]=='o'){
    if(a[n-1]==0){
      if(a[n-2]!=a[0])ans=false;
    }
    else{
      if(a[n-2]==a[0])ans=false;
    }
  }
  else{
    if(a[n-1]==0){
      if(a[n-2]==a[0])ans=false;
    }
    else{
      if(a[n-2]!=a[0])ans=false;
    }
  }
  
  return ans;
}

int main(){cout<<fixed<<setprecision(20);
		   //先頭二人O(n)
           cin>>n;
           cin>>s;
           bool ok=false;
           rep(i,0,4){
             vin a(n,-1);
             if(i==0){
               a[0]=0;a[1]=0;//0は羊さん
             if(check(a))ok=1;
                }
              if(i==1){
               a[0]=0;a[1]=1;//0は羊さん
             if(check(a))ok=1;
                }  
               if(i==2){
               a[0]=1;a[1]=0;//0は羊さん
             if(check(a))ok=1;
                } 
               if(i==3){
               a[0]=1;a[1]=1;//0は羊さん
             if(check(a))ok=1;
              } 
                if(ok){
                 rep(i,0,n){
                  if(a[i]==0)cout<<'S';
                   else cout<<'W';
                 }
                  break;
                }
           }
                if(ok)
                cout<<endl;
                else{
                 cout<<-1<<endl; 
                }
}

Measured memory_bytes: 4208
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class A
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		string S = GetString();
		string T = GetString();
		Console.WriteLine(S.Where((x, i) => T[i] == x).Count());

	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}


Measured memory_bytes: 13268
n = int(input())
DP = [None] * (n + 1)  # 計算結果を保存する配列
DP[0] = 1  # 定義より
DP[1] = 1  # 定義より

def fib(n):
    # フィボナッチ数を2からnまで順に求めていく
    for i in range(2, n + 1):
        DP[i] = DP[i-1] + DP[i-2]
    return DP[n]

print(fib(n))



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

#define PB emplace_back

using namespace std;

const int N = 3e3 + 100;

long long int mod = 1e9+7, dp[N][N], par[N];

long long int sum(int l, int r) {
    return (par[r] - par[l] + mod) % mod;
}

int main () {
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    dp[1][1]=1;
    for(int i = 2 ; i <= n ; i++ ) {
        char c = s[i-2];
        for(int j = 1 ; j <= n ; j++ ) {
            par[j] = par[j-1] + dp[i-1][j];
            par[j] %= mod;
        }
        for(int  j = 1 ; j <= i ; j++ ) {
            //dp[i][j];
            if(c == '<') {
                dp[i][j] += sum(0, j - 1);
            }
            else {
                dp[i][j] += sum(j-1, i-1);
            }
            dp[i][j] %= mod;
        }
    }
    long long int ans = 0;
    for(int i = 1 ; i <= n ; i++ ) {
        ans += dp[n][i];
        ans %= mod;
    }
    cout << ans;
}


Measured memory_bytes: 50020
#include<iostream>

using namespace std;

int H, W, N;
int a[100 * 100 + 10];

int main(){
  	cin >> H >> W >> N;
  	for(int i = 0; i < N; i++)cin >> a[i];
  	int pointer = 0, cnt = 0;
  	int tmp[100];
  	for(int i = 0; i < H; i++){
    	if(i % 2 == 0){
        	for(int j = 0; j < W; j++){
            	cout << pointer + 1 << " ";
              	cnt++;
              	if(cnt == a[pointer])cnt = 0, pointer++;
            }
        }else {
        	for(int j = W - 1; j >= 0; j--){
            	tmp[j] = pointer + 1;
              	cnt++;
              	if(cnt == a[pointer])cnt = 0, pointer++;
            }
          	for(int j = 0; j < W; j++)cout << tmp[j] << " ";
        }
       	cout << endl;
    }
	return 0;
}

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

int main() {
  int h,w,result;
  string inputs[50];
  cin >> h>>w;
  int x_position[] = {0,1, -1,  0,-1,1,1,-1};
  int y_position[] = {1,0,  0, -1, 1,1,-1,-1};
  for(int i=0; i<h;i++){
    cin >> inputs[i];
  }
  
  for(int count_h=0; count_h<h; count_h++){
    for(int count_w=0; count_w<w; count_w++){
      if(inputs[count_h][count_w]=='#'){
        continue;
      }
      result=0;
      for(int count=0; count<8; count++){
        int x = count_w+x_position[count];
        int y = count_h+y_position[count];
        if(x<0||w<= x){
          continue;
        }
        if(y<0||h<=y){
          continue;
        }
        if(inputs[y][x]=='#'){
          result+=1;
        }
      }
      inputs[count_h][count_w]=char(result + '0');
    }
  }

  for(int i=0; i<h;i++){
    cout << inputs[i]<<endl;
  }
}



Measured memory_bytes: 256
#include   <bits/stdc++.h>
using      namespace        std;
#define    int              long long int
#define    sz(a)            (int)a.size()
#define    w(x)              int T; cin>>T; while(T -- > 0)
#define    ff                first
#define    ss                second
#define    debug             cout<<"~~~~\n";

void solveTC(){

    int a,b;
    cin>>a>>b;

    cout<<(a*b)<<endl;

}

int32_t main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

//    w(x){  solveTC();  } // with TestCases

    solveTC();          //  without TestCases

    return 0;

}

Measured memory_bytes: 3652
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 21 13:54:29 2019

@author: Yamazaki Kenichi
"""

N = int(input())
S = input()
K = int(input())

ans = ''
key = S[K-1]
for c in S:
    if c != key:
        ans += '*'
    else:
        ans += c
print(ans)

Measured memory_bytes: 3060
# coding: utf-8
init = [int(s) for s in input().rstrip().split(' ')]
data = [int(s) for s in input().rstrip().split(' ')]

days_homework = sum(data)
left_time = init[0] - days_homework
if left_time < 0:
    print(-1)
else:
    print(left_time)

Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
string s,t,ans="";//ans为最后的答案，赋为空
int i,j,r;
int main(){
    cin>>s>>t;
    if(s.size()<t.size()){
        cout<<"UNRESTORABLE";
        return 0;
    }//大坑，必须判断s的长度会不会比t小(我被坑了3次QAQ)
    for(i=0;i<=s.size()-t.size();i++){//枚举t从哪个地方开始
        int k=i;//将i替换为k
        string ss=s;//将s替换为ss
        j=0;//初始化为0
        while(j<t.size()){
            if(ss[k]=='?')//如果为'?'，替换
                ss[k]=t[j];
            else if(s[k]!=t[j])//否则，如果不匹配，退出
                break;
            k++;//匹配则继续匹配
            j++;
        }
        if(j==t.size()){//如果完美匹配
            for(r=0;r<ss.size();r++){
                if(ss[r]=='?')//把'?'替换为'a'
                    ss[r]='a';
            }
            if(ans=="")//如果ans为空，将ans变为ss
                ans=ss;
            else ans=min(ans,ss);//否则,取字典序最小的
        }
    }
    if(ans=="")//若ans为空
        cout<<"UNRESTORABLE";
    else cout<<ans;//输出ans
    return 0;
}


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

using namespace std;

#define all(x) (x).begin(), (x).end()
#define sz(x) ( (int)(x).size() )
using LL = long long;

template<class T>
inline bool asMn(T &a, const T &b) { return a > b ? a = b, true : false; }
template<class T>
inline bool asMx(T &a, const T &b) { return a < b ? a = b, true : false; }

const int mod = 1e9 + 7;
mt19937 rng( (uint32_t)chrono::steady_clock::now().time_since_epoch().count() );

struct Mint {
  int a;
  Mint(int _a = 0) : a(_a) {}
  friend ostream& operator << (ostream &out, const Mint &_) {
    out << _.a;
    return out;
  }

  bool operator == (const Mint &_) const { return a == _.a; }
  bool operator ! () const { return !a; }

  Mint operator + (const Mint &_) const {
    int ret = a + _.a;
    return ret < mod ? Mint(ret) : Mint(ret - mod);
  }
  Mint operator - (const Mint &_) const { return *this + Mint(mod - _.a); }
  Mint operator * (const Mint &_) const { return Mint( (int)( (LL)a * _.a % mod) ); }
  friend Mint& operator += (Mint &a, const Mint &b) { return a = a + b; }
  friend Mint& operator -= (Mint &a, const Mint &b) { return a = a - b; }
  friend Mint& operator *= (Mint &a, const Mint &b) { return a = a * b; }
  Mint& operator ++ () { return *this = *this + Mint(1); }
  Mint& operator -- () { return *this = *this - Mint(1); }

  template<class T> Mint binPow(T exp) const {
    Mint ret(1), c = *this;
    for (; exp; exp >>= 1, c *= c) if (exp & 1) ret *= c;
    return ret;
  }
};

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

  #ifdef FourLeafClover
  freopen("input", "r", stdin);
  #endif // FourLeafCLover

  int n, m; cin >> n >> m;

  vector<vector<pair<int, int> > > cond(n);
  while (m--) {
    int l, r, x; cin >> l >> r >> x; --l; --r; --x;
    cond[r].emplace_back(l, x);
  }

  for (const auto &i : cond[0]) if (i.second) return cout << "0\n", 0;

  vector<vector<Mint> > f(n + 1, vector<Mint>(n + 1) );
  f[0][0] = Mint(3);

  for (int i = 1; i < n; ++i) {
    array<int, 3> l{ n, n, n }, r{ -1, -1, -1 };
    for (const auto &_ : cond[i]) {
      asMn(l[_.second], _.first);
      asMx(r[_.second], _.first);
    }

    auto check = [&](int pos1, int pos2, int pos3) {
      if (~r[0]) {
        if (pos2 >= l[0] || pos3 < r[0]) return false;
      }
      if (~r[1]) {
        if (pos1 >= l[1] || pos2 < r[1]) return false;
      }
      if (~r[2]) {
        if (pos1 < r[2]) return false;
      }

      return true;
    };

    vector<vector<Mint> > nF(n + 1, vector<Mint>(n + 1) );
    for (int j = 0; j < sz(f); ++j) {
      for (int k = j; k < sz(f); ++k) if (f[j][k].a) {
//        cerr << j << ' ' << k << ' ' << f[j][k] << '\n';
        if (check(j - 1, k - 1, i) ) nF[j][k] += f[j][k];
        if (check(j - 1, i - 1, i) ) nF[j][i] += f[j][k];
        if (check(k - 1, i - 1, i) ) nF[k][i] += f[j][k];
      }
    }

    f.swap(nF);
  }

  Mint ans;
  for (int j = 0; j < sz(f); ++j) ans += accumulate(all(f[j]), Mint(0) );

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 1136
from collections import defaultdict

import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    x,y,z=mis()
    print(z,x,y,sep=' ')


if __name__ == "__main__":
    main()

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

namespace Aizu
{
    class Program
    {
        static Dictionary<string, string> Data { get; set; }
        static string InputData { get; set; }

        static void Main(string[] args)
        {
            // データ取得
            Program.SetData();

            // Bubbleソート
            Program.BubbleSort();

            // 選択ソート
            Program.SelectionSort();
        }
        
        static void SetData()
        {

            Program.Data = new Dictionary<string, string>();

            Console.ReadLine();
            Program.InputData = Console.ReadLine();

            var temp = InputData.Split(' ');
            for (var i = 0; i < temp.Length; i++)
            {
                var number = temp[i].Substring(1, 1);

                // 安定ソートか否か判定用
                if (Program.Data.ContainsKey(number))
                {
                    Program.Data[number] += " " + temp[i];
                }
                else
                {
                    Program.Data[number] = temp[i];
                }
            }
        }

        static void BubbleSort()
        {
            var data = Program.InputData.Split(' ');
            var num = data.Length;
            for (var i = 0; i < num; i++)
            {
                for (var j = num - 1; i < j; j--)
                {
                    var num1 = int.Parse(data[j].Substring(1, 1));
                    var num2 = int.Parse(data[j - 1].Substring(1, 1));

                    if (num1 < num2)
                    {
                        var temp = data[j];
                        data[j] = data[j - 1];
                        data[j - 1] = temp;
                    }
                }
            }

            var result = string.Join(" ", data);
            Console.WriteLine(result);
            Console.WriteLine("Stable");

        }

        static void SelectionSort()
        {
            var data = Program.InputData.Split(' ');
            var num = data.Length;
            for (var i = 0; i < num; i++)
            {
                var minj = i;
                for(var j = i; j < num; j++)
                {
                    var num1 = int.Parse(data[j].Substring(1, 1));
                    var num2 = int.Parse(data[minj].Substring(1, 1));
                    if(num1 < num2)
                    {
                        minj = j;
                    }
                }

                var temp = data[i];
                data[i] = data[minj];
                data[minj] = temp;
            }

            var result = string.Join(" ", data);
            Console.WriteLine(result);
            bool flag = true;
            foreach (string key in Program.Data.Keys)
            {
                if (-1 == result.IndexOf(Program.Data[key]))
                {
                    flag = false;
                }
            }

            Console.WriteLine(flag ? "Stable" : "Not stable");
        }
    }
}



Measured memory_bytes: 9848
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main(void){
  int A;
  int B;
  cin >> A;
  cin >> B;
  
  if(A<=B*2){
    printf("0");
  }else{
    printf("%d",A-B*2); 
  }
 return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

Int Gcd(Int a, Int b) {
    if (b == 0) {
        return a;
    } else {
        return Gcd(b, a % b);
    }
}

int main() {
    int n;
    cin >> n;
    vector<Int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    Int ans = a[0];
    for (int i = 1; i < n; i++) {
        ans = Gcd(ans, a[i]);
    }

    cout << ans << endl;

    return 0;
}


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

int main()
{
    list<int>L, L2;

    int n, x;

    cin >> n;

    for(int i=0; i<n; i++)
    {
        cin >> x;
        L.push_front(x);
    }
    L.sort();

    L.unique();

    cout << L.size() << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <numeric>
#include <cstdint>

using Int = std::int64_t;

int main() {
	Int n, m;
	std::cin >> n >> m;

	std::vector<Int> a(n);
	for (auto&& e : a)
		std::cin >> e;

	std::vector<std::pair<Int, Int>> cb(m);
	for (auto&& p : cb)
		std::cin >> p.second >> p.first;

	std::sort(a.begin(), a.end());
	std::sort(cb.begin(), cb.end(), std::greater<>{});

	Int where = 0;
	for (auto&& p : cb) {
		const Int lb = std::lower_bound(a.begin() + where, a.end(), p.first) - (a.begin() + where);
		const Int succ = std::min(lb, p.second);

		for (Int i = 0; i < succ; ++i)
			a[where + i] = p.first;

		where += succ;
		if (where >= n)
			break;
	}

	std::cout << std::accumulate(a.begin(), a.end(), Int(0)) << std::endl;
}

Measured memory_bytes: 2688
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <map>
#include <string>
#include <cstring>
typedef long long int ll;
using namespace std;

int main() {
	int N; cin >> N;
	vector<int>R(N);
	for (int i = 0; i < N; i++) {
		cin >> R.at(i);
	}
	int Max = -999999999, Min = R.at(0);
	for (int i = 1; i < N; i++) {
		Max = max(Max, R.at(i) - Min);
		Min = min(Min, R.at(i));
	}
	cout << Max<< endl;
}



Measured memory_bytes: 3612
#pragma GCC optimize("2,Ofast,inline")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define LL long long
#define pii pair<int, int>
using namespace std;
const int N = 1e5 + 10;

template <typename T> T read(T &x) {
	int f = 0;
	register char c = getchar();
	while (c > '9' || c < '0') f |= (c == '-'), c = getchar();
	for (x = 0; c >= '0' && c <= '9'; c = getchar())
		x = (x << 3) + (x << 1) + (c ^ 48);
	if (f) x = -x;
	return x;
}

LL k, n;
int f[N][2];
char s[N];

void upd(int &x, int y) {
	x = min(x, y);
}
int F[N],cnt;
int main() {
	scanf("%s", s + 1);
	read(k);
	n = strlen(s + 1);
	LL ans = 0,sum=1;
	for(int i=2;i<=n;i++){
		if(s[i]!=s[i-1])F[++cnt]=sum,sum=0;
		sum++;
	}
	F[++cnt]=sum,sum=0;
	if(cnt==1){
		printf("%lld\n",(n*k)/2);
	}
	else {
		if(s[1]==s[n]){
			for(int i=2;i<=cnt-1;i++)ans+=((F[i])/2)*k;
//			cout<<ans<<endl;
			ans+=(k-1)*((F[1]+F[cnt])/2)+(F[1])/2+(F[cnt])/2;
//			cout<<ans<<endl;
		}
		else {
			for(int i=1;i<=cnt;i++)ans+=((F[i]))/2*k;
		}
		printf("%lld\n",ans);
	}
	return 0;
	for (int i = 2; i <= n; ++i) {
		if (s[i] == s[i - 1]) {
			++ans;
//			s[i] = 'z' + 1;
		}
	}
	ans = ans * k;
	if (s[1] == s[n]) ans += k - 1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
yoko=[input() for i in range(n)]
yokosiro=[0 if "#" in yoko[i] else 1 for i in range(n)]
tatesiro=[]
for i in range(m):
    ta=[0 if yoko[j][i]=="#" else 1 for j in range(n)]
    if 0 in ta:
        tatesiro.append(0)
    else:
        tatesiro.append(1)
for i in range(n):
    if yokosiro[i]==0:
        print("".join([yoko[i][j] for j in range(m) if tatesiro[j]==0]))

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--) 
#define Rep(i,a) for(int i = 0; i < a; i++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ab(x) ((x) < 0 ? -(x) : (x))
using namespace std;
typedef long long LL;
typedef map<int, int>::iterator mit;
typedef set<int>::iterator sit;
typedef pair<int, int> pii;
#define x first
#define y second
LL n;

string str(int x) {
	string s = "";
	while (x) s = char(x % 10 + '0') + s, x /= 10;
	return s;
}

int main() {	
//	freopen("whx.in","r",stdin);
	cin >>n; n++;
	string s = "", t = "";
	bool flag = false; int cnt = 0;
	dep(i,40,0) if ((1LL << (i + 1)) <= n) {
		cnt += 2;
		if (s.length()) s = s + ' '; 
		s = s + str(i + 1);
		if (t.length()) t = t + ' ';
		t = t + str(i + 1);

		if (n >> i & 1) s = s + ' ' + str(45 + i), t = str(45 + i) + ' ' + t, cnt += 2;
	}
	cout <<cnt<<endl;
	cout <<s<<' '<<t<<endl;
	return 0;
}


Measured memory_bytes: 256
/* Problem link: https://atcoder.jp/contests/dp/tasks/dp_c */


#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pi pair<int, int>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define deb(x) cout << #x << ":" << x << endl;
#define deba(x) cerr << #x << endl; for (auto a : x) cerr << a << " "; cerr << endl;
/* freopen("input.txt", "r", stdin); */
/* freopen("output.txt", "w", stdout); */
const int MOD = 1000000007;


int main() {
	fastio();
	int n;
	cin >> n;
	int a[n], b[n], c[n], dp[n][3], act[n];
	for(int i=0;i<n;i++)
		cin >> a[i] >> b[i] >> c[i];
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	for(int i=1;i<n;i++) {
		dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i];
		dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i];
		dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i];
	}
	cout << max(max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]) << "\n";

	return 0;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main()
{
    int n, h, w;
    cin >> n >> h >> w;

    cout << (n - h + 1) * (n - w + 1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;

long long mod = 1000000007;

long long mypow(long long x, long long y){
  if(y == 1) return x;
  long long z = mypow(x, y / 2) % mod;
  if(y % 2 == 0){
    return (z * z) % mod;
  }
  else{
    return ((z * z) % mod * x) % mod;
  }
}
long long choose(long long l, long long r){
  long long u = 1, d = 1;
  for(int i = l; i > l - r; i--){
    u = (u * i) % mod;
  }
  for(int i = r; i >= 1; i--){
    d = (d * i) % mod;
  }
  d = mypow(d, mod - 2);
  return (u * d) % mod;
}

long long kaijo(long long x){
  if(x <= 1) return 1;
  return (kaijo(x - 1) * x) % mod;
}

void solve(){
  long long n, k, sum = 0; cin >> n >> k;
  vector<long long> ans(k, 0);
  for(int i = 0; i <= min(n - k, k - 1); i++){
    long long x = choose(k - 1, i), y, z, w, rn = n - k - i, g = i + 2;
    /*y = kaijo(rn + g - 1);
    z = kaijo(rn);
    w = kaijo(g - 1);
    z = mypow(z, mod - 2);
    w = mypow(w, mod - 2);*/
    y = choose(rn + g - 1, rn);
    ans[i] = (x * y) % mod;
    //ans[i] = (((y * z) % mod * w) % mod * x) % mod;
  }
  for(int i = 0; i < k; i++){
    cout << ans[i] << endl;
  }
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,k=map(int,input().split())
    if k%2==0:
        print((n//k)**3+((n+k//2)//k)**3)
    else:
        print((n//k)**3)
    
            

if __name__=='__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
 
#define INF (1e9)
typedef long long unsigned int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
 

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int gcd(int a,int b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}





int main()
{
	int N;
	cin >> N;
	int V[N];
	int C[N];
	REP(i,N){
		cin >> V[i];
	}
	REP(i,N){
		cin >> C[i];
	}
	int ans = 0;
	REP(i, N)
	{
		if(V[i]-C[i]>0){
			ans += V[i] - C[i];
		}
	}
	cout << ans << endl;

	return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

typedef unsigned long long ull;
 
mt19937_64 r(std::chrono::high_resolution_clock::now().time_since_epoch().count());

ull const MASK30 = (1<<30)-1;
ull const MASK31 = INT_MAX;
ull const MOD = (1LL<<61)-1;
ull const MOD5 = MOD*5;
ull const base = r()%MOD;
 
struct RollingHash {
private:
    vector<ull> power,hash;
public:
    inline ull mul(ull a,ull b) {
        ull au = a>>31;
        ull ad = (a&MASK31);
        ull bu = b>>31;
        ull bd = (b&MASK31);
        ull mid = au*bd+ad*bu;
        return ((au*bu)<<1)+ad*bd+(mid>>30)+((mid&MASK30)<<31);
    }

    inline ull calcmod(ull a) {
        a = (a&MOD)+(a>>61);
        if (a > MOD) a -= MOD;
        return a;
    }

    RollingHash(string& s) {
        int n = s.size();
        power.resize(n+1);
        hash.resize(n+1);
        power[0] = 1;
        hash[0] = 0;
        for (int i = 0;i < n;++i) power[i+1] = calcmod(mul(power[i],base));
        for (int i = 0;i < n;++i) hash[i+1] = calcmod(mul(hash[i],base)+s[i]);
    }

    ull get(int l, int r)  {
        if (l) {
            return calcmod(hash[r]+MOD5-mul(hash[l],power[r-l]));
        }
        return hash[r];
    }
 
 
    ull connect(ull h1,int l,int r) {
        ull h2 = get(l,r);
        return calcmod(mul(h1,power[r-l])+h2);
    }
 
    int LCP(int l1,int r1,RollingHash& rh,int l2,int r2) {
        int ok = 0,ng = min(r1-l1,r2-l2)+1;
        while (ng-ok > 1) {
            int mid = (ok+ng)/2;
            if (get(l1,l1+mid) == rh.get(l2,l2+mid)) ok = mid;
            else ng = mid;
        }
        return ok;
    }
};

int main() {
    string s,t,u;
    cin >> s >> t;
    int n = s.size(),m = t.size(),x,ans = 0;
    u = "";
    for (int i = 0;i < m/n+2;++i) u += s;
    x = u.size();
    RollingHash rht(t),rhu(u);
    vector<int> a(x);
    for (int i = 0;i < n;++i) a[i] = rht.LCP(0,m,rhu,i,x);
    vector<bool> b(n,false),used(n,false);

    for (int i = 0;i < n;++i) {
        if (a[i] < m) continue;
        b[i] = true;
    }
    for (int i = 0;i < n;++i) {
        if (!b[i]) used[i] = true;
        if (b[((i-m)%n+n)%n]) continue;
        int ret = 0,f = i;
        while (b[f]) {
            used[f] = true;
            (f += m) %= n;
            ret++;
        }
        ans = max(ans,ret);
    }
    for (int i = 0;i < n;++i) if (!used[i]) {
        cout << "-1" << endl;
        return 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 39880
#include<iostream>
#include<string>
#include<math.h>
#include <vector>
#include <algorithm>

using namespace std;


int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);    
        
    int arr[2];
    cin>>arr[0]>>arr[1]>>arr[2];
    sort(arr,arr+3);
    
    cout<<arr[0]<<" "<<arr[1]<<" "<<arr[2]<<"\n";
    	return 0;
}



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

int main()
{
    int n,c=0;
    cin>>n;
    int x[n+5];
    for(int i=1;i<=n;i++)
    {
        cin>>x[i];
        if(x[i]!=i)c++;
    }
    if(c<=2)cout<<"YES"<<endl;
    else cout<<"NO\n";



    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using console = System.Console;

namespace AtCoderTemplate
{
    public class App
    {
        public static void Main(string[] args)
        {
            int n,m;
            {
                var tmp = console.ReadLine().Split(' ')
                .Select(i=>int.Parse(i)).ToArray();
                n = tmp[0];
                m = tmp[1];
            }
            var a = new List<int>();
            for(int i = 0;i < n;i++)
            {
                a.AddRange(console.ReadLine().Split().Skip(1).Select(v=>int.Parse(v)));
            }
            console.WriteLine(a.GroupBy(v=>v).Count(v=>v.Count()>=n));
        }
    }
}


Measured memory_bytes: 13536
#include <bits/stdc++.h>
        #define endl '\n'
        #define modulo 1000000007
        #define int unsigned long long
        //#define __int128 long long
        #pragma GCC optimize("-Ofast")
        #define float double
        #define PI 3.141592653589793238462643383279502884
        #define sinDegrees(x) sin((x) * PI / 180.0)
        #define tanDegrees(x) tan((x) * PI / 180.0)
        #define atanDegrees(x) atan(x)* 180.0 / PI
        #define f first
        #define s second
        using namespace std;
        int power(int x,int y,int m)
        {
        int temp;
        if(y == 0)
        return 1;
        temp = (power(x, y/2,m))%m;
        if (y%2 == 0)
        return ((temp%m)*temp);
        else
        return ((x*temp%m)*temp%m)%m;
        }
        int inv(int x)
        {
        return (power(x,modulo-2,modulo))%modulo;
        }
        bool comp(pair<int,int>a,pair<int,int>b)
        {
            if(a.second==b.second)
            return a.first<b.first;
            return a.second<b.second;
        }
        ///Solution created by:Ahmadsm2005
        int32_t main()
        {
            //freopen("output.txt","w", stdout);
            //freopen("input0.txt","r", stdin);
            iostream::sync_with_stdio(0);
            cin.tie(0);
            cout.tie(0);
            string s;
            cin>>s;
            if(s[2]==s[3]&&s[4]==s[5])
            cout<<"Yes";
            else
            cout<<"No";
            return 0;
        }


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

using namespace std;

//typedef pair<int,int> P;

int main(){
	int n,m;
	scanf("%d %d", &n, &m);
	printf("%d\n",(n-1)*(m-1));

	return 0;
}


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

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 MAX_N 100000

class Edge {
    public:
        int from;
        int to;
        int index;
};

bool visited[MAX_N];

map<pair<int, int>, int> colors;

void color(const int cur_nd, int cur_color, const int color_variation, vector<vector<Edge> > &edges) {
    if (visited[cur_nd]) {
        return;
    }
    // cout << cur_nd << "," << cur_color << "," << color_variation << endl;
    visited[cur_nd] = true;
    for (int i = 0; i < (int) edges[cur_nd].size(); i++) {
        int other = edges[cur_nd][i].to;
        if (colors.find(make_pair(other, cur_nd)) != colors.end()) {
            colors[make_pair(cur_nd, other)] = colors[make_pair(other, cur_nd)];
        } else {
            colors[make_pair(cur_nd, other)] = ((cur_color++) % color_variation) + 1;
            color(edges[cur_nd][i].to, cur_color, color_variation, edges);
        }
        // if (edges[cur_nd][i].index > MAX_N) continue;
        // edges[cur_nd][i].color = ((cur_color++) % color_variation) + 1;
        // cout << edges[cur_nd][i].color << endl;
        // color(edges[cur_nd][i].to, cur_color, color_variation, edges);
    }
}

int main(void) {
    int N;
    cin >> N;

    vector<vector<Edge> > edges(N);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        edges[a - 1].push_back({a - 1, b - 1, i});
        edges[b - 1].push_back({b - 1, a - 1, MAX_N + 1});
    }

    int max_edge = -1;
    int nd_max_edge = -1;
    for (int i = 0; i < N; i++) {
        // cout << edges[i].size() << endl;
        if ((int) edges[i].size() > max_edge) {
            max_edge = (int) edges[i].size();
            nd_max_edge = i;
        }
    }

    vector<bool> visited(N, false);
    color(nd_max_edge, 1, max_edge, edges);

    cout << max_edge << endl;

    vector<Edge> res;
    for (int i = 0; i < (int) edges.size(); i++) {
        for (int j = 0; j < (int) edges[i].size(); j++) {
            res.push_back(edges[i][j]);
        }
    }

    sort(res.begin(), res.end(), [](const Edge &a, const Edge &b) {
            return a.index < b.index;
    });

    for (int i = 0; i < N - 1; i++) {
        cout << colors[make_pair(res[i].from, res[i].to)] << endl;
    }

    return 0;
}


Measured memory_bytes: 23924
def isPrime(x):
    if x == 2:
        return True
    if x < 2 or x & 1 == 0:
        return False
    for i in range(3, int(x ** 0.5 + 1)):
        if x % i == 0:
            return False
    return True

print(sum(map(isPrime, [int(input()) for _ in range(int(input()))])))



Measured memory_bytes: 5992
import math

if __name__ == '__main__':
    x = 0
    y = 0
    angle = 90

    r, t = map(int, input().split(','))

    while r != 0 or t != 0:
        x = x + r * math.cos(math.radians(angle))
        y = y + r * math.sin(math.radians(angle))
        angle -= t
        r, t = map(int, input().split(','))
    print(int(x))
    print(int(y))


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

using namespace std;

int main()
{
    int n, i;
    cin >> n;
    int a[n];
    for (i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    cout << a[((n - 1)/ 2) + 1] - a[(n - 1)/ 2];
}

Measured memory_bytes: 640
from inspect import currentframe

def chkprint(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

from functools import reduce
from math import floor, ceil

N = int(input())
A = list(map(lambda s: int(s[1])-s[0]-1, enumerate(input().split())))

A.sort()

if N%2 == 0:
  m0 = N//2
  m1 = m0 - 1
  a0 = floor((A[m0] + A[m1])/2)
  a1 = ceil((A[m0] + A[m1])/2)
  # chkprint(m0)
  # chkprint(m1)

  print(min(reduce(lambda s, x: s + abs(x - a0), A, 0), reduce(lambda s, x: s + abs(x - a1), A, 0)))
else:
  m = N//2
  a = A[m]
  # chkprint(a)
  print(reduce(lambda s, x: s + abs(x - a), A, 0))



Measured memory_bytes: 28604
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>
#include <ctype.h>
#include <cstdlib>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <map>
#include <queue>
#include <utility>

using namespace std;

const int INF = 1000000007;
const double PI = acos(-1.0);
typedef long long llong;
int n, q, a[20];

bool search(int i, int sum)
{
	if (sum == 0) return 1;
	if (i >= n) return 0;

	return search(i + 1, sum) || search(i + 1, sum - a[i]);
}


int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	cin >> q;
	vector<int> vec(q);
	for (int i = 0; i < q; i++)
	{
		cin >> vec[i];
		cout << (search(0, vec[i]) ? "yes" : "no") << endl;
	}

	return 0;



}

Measured memory_bytes: 3084
#include<stdio.h>

int main(){

  int flag,A[100],i,j,k,a,count = 0;

  scanf("%d",&a);

  for(i = 0; i < a; i++){
    scanf("%d",&A[i]);
  }

  flag = 1;

  while(flag){
    flag = 0;
    for(j = a - 1; j > 0; j--){
      if(A[j] < A[j-1]){
	k = A[j];
	A[j] = A[j-1];
	A[j-1] = k;
	flag = 1;
	count++;
      }
    }
  }

  for(i = 0; i < a; i++){
    printf("%d",A[i]);
    if(i == a -1) break;
    printf(" ");
  }

  printf("\n");

  printf("%d\n",count);

  return 0;
}

Measured memory_bytes: 604
from scipy.optimize import fmin
N = int(input())

INF = 10 ** 18
X = [[],[],[]]
Y = [[],[],[]]

for _ in range(N):
  x,y,d = input().split()
  x,y = int(x),int(y)
  if d == 'L':
    X[-1].append(x)
    Y[0].append(y)
  elif d == 'R':
    X[1].append(x)
    Y[0].append(y)
  elif d == 'U':
    Y[1].append(y)
    X[0].append(x)
  else:
    Y[-1].append(y)
    X[0].append(x)

for i in [-1,0,1]:
  X[i] = [min(X[i] + [INF]), max(X[i] + [-INF])]
  Y[i] = [min(Y[i] + [INF]), max(Y[i] + [-INF])]

def calc_width(t, X):
  left = INF
  right = -INF
  for i in [-1,0,1]:
    left = min(left, X[i][0] + i * t)
    right = max(right, X[i][1] + i * t)
  return right - left

def area(t):
  if t < 0:
    return INF
  return calc_width(t, X) * calc_width(t, Y)

xopt = fmin(area, x0 = 10**8, ftol = 10**-9, disp = False)
answer = area(xopt[0])
print(answer)


Measured memory_bytes: 25892