akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int k = int.Parse(Console.ReadLine());
            var ab = Console.ReadLine().Split().Select(int.Parse).ToList();
            var a = ab[0];
            var b = ab[1];
            string ans = "NG";

            for(int i = a; i <= Math.Min(a + k, b); i++)
            {
                if(i % k == 0)
                {
                    ans = "OK";
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 28260
#include <bits/stdc++.h>
using namespace std;
// #define cerr if(false)cerr
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> ii;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vii;
typedef long double ld;
typedef vector<ld> vld;
typedef vector<vector<ld>> vvld;
typedef vector<bool> vbl;
typedef vector<vbl> mbl;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(s) (s).begin(), (s).end()
const ll MOD = 1e9 + 7;

inline void solve()
{
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll i = 1; i <= n; i++)
    {
        ans += i * (n/i * (n/i + 1) / 2);
    }
    cout << ans << endl;
}

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

    int t = 1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; ++i)

int main(){
int n;
cin>>n;
long long int a[100001];
rep(i,0,n) cin>>a[i];

long long int cnt1 = 0;
long long int cnt2= 0;
long long int sum = 0;
   
   rep(i,0,n){
       sum+=a[i];
       if(i%2==0){
           while(sum<=0){
               sum++;
               cnt1++;
           }
       }else{
           while(sum>=0){
               sum--;
               cnt1++;
           }
       }
   }
   sum=0;
   rep(i,0,n){
        sum+=a[i];
       if(i%2==1){
           while(sum<=0){
               sum++;
               cnt2++;
           }
       }else{
           while(sum>=0){
               sum--;
               cnt2++;
           }
       }
   }
   cout<<min(cnt1,cnt2)<< endl;
   return 0;
}


Measured memory_bytes: 1024
#include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pb push_back
#define pf push_front
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
signed main(){
  int n,m;
  cin>>n>>m;
  int aa[200000]={};
  int bb[200000]={};
  bool f=false;
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    if(a==0)aa[b]=1;
    if(b==n-1)bb[a]=1;
  }
  rep(i,n){
    if(aa[i]==1&&bb[i]==1){
      f=true;
      break;
    }
  }
  cout<<(f?"POSSIBLE":"IMPOSSIBLE")<<endl;
  return 0;
}




Measured memory_bytes: 3328
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;

int main(){
  int n;
  bool yellow = false;
  cin >> n;
  char s[n];
  for(int i = 0; i < n; i++){
    cin >> s[i];
    if(s[i]=='Y'){
      yellow = true;
    }
  }
  if(yellow){
    cout << "Four" << endl;
  }else{
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    int N, M, A, B, C;
    string str1, str2;
    cin >> A >> B;
    cout << A * B << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define double long double
#define pi 3.141592653589
using namespace std;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
signed main(){
	ll n, m, k;
	cin >> n >> m >> k;
	ll memo = gcd(n, m);
	for (int i = memo; i >=1; i--) {
		if (memo%i == 0)k--;
		if (k == 0) {
			cout << i << endl;
			return 0;
		}
	}
	getchar(); getchar(); return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
  int x, h, m, s;

  cin >> x;

  h = x / 3600;
  m = (x % 3600) / 60;
  s = (x % 3600 ) % 60;

  cout << h << ":" << m << ":" << s << endl;
}



Measured memory_bytes: 3108
import java.util.Scanner;
import java.lang.Math;

public class Main {
	public static final int BIG_NUM = 2000000000;

	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int x, ans=-BIG_NUM, min=BIG_NUM;
		
		for(int i=0; i<n; i++){
			x = scan.nextInt();
			ans = Math.max(ans, x-min);
			min = Math.min(x, min);
		}
		
        System.out.println(ans);
        
		scan.close();
	}
}


Measured memory_bytes: 97860
fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfInt()
    val ans = IntArray(N)
    repeat(N) { ans[A[it] - 1] = it + 1 }
    println(ans.joinToString(separator = " "))
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }

Measured memory_bytes: 56508
#include<stdio.h>

int main(){
   long A,B,K;
   
   scanf("%ld %ld %ld",&A,&B,&K);
   
   if(A>K){
      A = A-K;
   }else{
      K = K-A;
      A = 0;
      if(K > B){
         B = 0;
      }else{
         B = B-K;
      }
   }
   printf("%ld %ld\n",A,B);

   return 0;
}
                              


Measured memory_bytes: 1732
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int i = 0;
        i += br.read();
        i += br.read();
        i += br.read();
        
        if(i == 294)
        System.out.println("Yes");
        else
        System.out.println("No");
    }

}


Measured memory_bytes: 21844
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
const int nax=256;
const ll mod=1000*1000*1000+7;

int n, k;

ll dp[nax][nax];

ll wyn;

void dod(ll &a, ll b)
{
	a=(a+b)%mod;
}

int main()
{
	scanf("%d%d", &n, &k);
	dp[0][0]=1;
	for (int i=1; i<=n; i++)
	{
		int x;
		scanf("%d", &x);
		for (int j=i; j>=0; j--)
			for (int l=0; l<nax; l++)
				dod(dp[j+1][l^x], dp[j][l]*(j+1));
	}
	for (int i=1; i<=n; i++)
		dod(wyn, dp[i][k]);
	printf("%lld\n", wyn);
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 2e9;
typedef pair<int, int> pi;
const ll MOD = (ll)1e9 + 7;
ll mypow(ll a, ll b)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			res = (res * a) % MOD;
		a = (a * a) % MOD;
		b >>= 1;
	}
	return res;
}
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	ll ans = 0;
	ans = (ans + mypow(10, n)) % MOD;
	ans = (ans - mypow(9, n)+MOD) % MOD;
	ans = (ans - mypow(9, n)+MOD) % MOD;
	ans = (ans + mypow(8, n)) % MOD;
	cout << ans;
}

Measured memory_bytes: 3584
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int k = sc.nextInt();
        int x = sc.nextInt();

        if(500*k>=x){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}

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

LL minima(LL a,LL b)
{
    if(a>b)
    {
        return b;
    }
    return a;
}

int main()
{
    LL n,i,j,k,one=1;
    cin>>n>>k;
    vector <LL> h(n+1);
    vector <LL> cost(n+1,1e18);
    for(i=1;i<=n;i++)
    {
        cin>>h[i];
    }

    cost[1]=0;    

    for(i=2;i<=n;i++)
    {
       // LL maxima=(i-k>1)?(i-k):one;
        for(j=i-1;j>=i-k;j--)
        {
            if(j<1)
            {
                break;
            }
            cost[i]=minima(cost[j]+fabs(h[i]-h[j]),cost[i]);
        }
        //cout<<i<<" "<<cost[i]<<endl;

    }
    cout<<cost[n]<<endl;
}

Measured memory_bytes: 1792
using System;
using static System.Console;
using static System.Math;
using System.Linq;
 
class Program
{
 
    static void Main()
    {
        string input = ReadLine();
        int res = 0;
        for(int i = 0;i<input.Length;i++)
        {
            if (input[i] == '+')
            {
                res++;
            }
            else { res--; }
        }
        WriteLine(res);
    }
}

Measured memory_bytes: 11092
// inputに入力データ全体が入る
function Main(input) {
	input = input.split("\n");
	const N = parseInt(input[0]);
	const amounts = input[1].split(" ").map(y => parseInt(y));
	var xs = "";
	var x = amounts[0];
	for (i = 1; i < N; i++) {
		if (i % 2 == 0) {
			x += amounts[i];
		} else {
			x -= amounts[i];
		}
	}
	xs += x.toString();
	for (i = 0; i < N-1; i++) {
		x = 2*amounts[i] - x;
		xs += " " + x;
	}
	console.log(xs);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 58420
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int ret[256];
char buf[256];

int main() {
  scanf("%s", buf);
  for(int i = 0; i < strlen(buf); i++) {
    ret[buf[i]]++;
  }
  for(int out: ret) {
    if(out%2) {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
}


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

const string YES = "Yes";
const string NO = "No";

void solve(std::string s, std::string t){
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    if(s<t) cout << YES << endl;
    else cout << NO << endl;
}

int main(){
    std::string s;
    std::cin >> s;
    std::string t;
    std::cin >> t;
    solve(s, t);
    return 0;
}


Measured memory_bytes: 256
N=int(input())
a=[int(i) for i in input(). split ()]
mi=a[0]
ma=a[0]
i=0
while i<N:
    if a[i]>ma:
        ma=a[i]
    if a[i]<mi:
        mi=a[i]
    i+=1
print (ma-mi)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define INF 12345689

string e, d;
int n;

string huga(string a, string v, string h){
  int size = a.size(), sizev = v.size();
  for(int j = 0; j <= size-sizev ;j++){
      string str, str2, str3, str4;
      for(int k = 0; k < j; k++) str4 +=a[k];
      for(int k = j; k < sizev+j; k++){
	str += a[k];
      }
      for(int k = sizev+j; k < size; k++) str3 +=a[k];
      
      if(str == v){
	return str4+h+huga(str3, v, h);
      }
  }
  return a;
}

int foo(string a, int x, string ab[2][12]){//cout<<"AA  "<<a<<endl;
  int ans = INF, t;
  if(a == d)return x;
  if(a.size() > d.size())return INF;
  for(int i = 1; i <= n; i++){//cout<<i<<"---"<<ab[1][i]<<endl;
    //cout<<huga(a,ab[1][i],ab[0][i])<<endl;
    string hu = huga(a,ab[0][i],ab[1][i]);
    //cout<<"hu == "<<hu<<endl;
    if(hu != a){
      t = foo(hu, x+1,ab);
      if(t != INF) ans = min(ans, t);
    }
  }
    
    /*
    int sizea = ab[0][i].size(), sizeb = ab[1][i].size(), size = a.size();
    for(int j = 0; j < size-sizeb ;j++){
      string str, str2, str3, str4;
      for(int k = 0; k < j; k++) str4 +=a[k];
      for(int k = j; k < sizeb+j; k++){
	str += a[k];
      }
      for(int k = sizeb+j; k < size; k++) str3 +=a[k];
      
      if(str == ab[1][i]){
	str2 = str4+ab[0][i]+str3;
	cout<<a<<" ";
	cout<<str4<<" "<<ab[0][i]<<" "<<str3<<endl;
	cout<<j<<" "<<str2<<endl;
	t = foo(str2,x+1);
	if(t != -1){
	  ans = min(ans,t);
	}
	
      }
    }
    */
  
  return ans;
}

signed main(){
  while(true){
    string ab[2][12];
    cin>>n;
    if(!n)break;
    e.clear();
    d.clear();
    
    for(int i = 1; i <= n; i++){
      cin>>ab[0][i]>>ab[1][i];
    }
    cin>>e>>d;
    int t = foo(e,0,ab);
    cout<<(t== INF?-1:t)<<endl;
  }
  
  return 0;
}



Measured memory_bytes: 3100
#include<bits/stdc++.h>
using ll=long long;
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 all(vec) vec.begin(), vec.end()
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;}

int main(){
  //input
  int dp[210];
  rep(i,210)dp[i]=0;//なぜかこの作業を行わなかったら後ろのdp[209]などで巨大な数が発生してしまいエラったので入れた。
  int n,m;
  cin>>n;
  vector<string>s(n);
  rep(i,n)cin>>s[i];
  cin>>m;
  vector<string>t(m);
  rep(i,m)cin>>t[i];
  vector<string>u(0);
  u.push_back(s[0]);
  int ct=1;

  //rep(i,210)cout<<dp[i]<<endl;

  
  Rep(i,1,n){
    ct=1;
    rep(j,u.size()){
      if(u[j]==s[i])ct=0;
    }
    if(ct==1)u.push_back(s[i]);
  }
  rep(i,m){
    ct=1;
    rep(j,u.size()){
      if(u[j]==t[i])ct=0;}
    if(ct==1)u.push_back(t[i]);
  }
  sort(u.begin(),u.end());

  rep(i,n){
    rep(j,u.size()){if(u[j]==s[i]){dp[j]++;break;}
    }}
  rep(i,m){
    rep(j,u.size()){if(u[j]==t[i]){dp[j]--;break;}
    }}
  int maxdp=0;
  rep(i,201){maxdp=max(maxdp,dp[i]);}
  cout<<maxdp<<endl;

  //rep(i,n)cout<<s[i]<<" "<<t[i]<<" "<<u[i]<<" "<<dp[i]<<" "<<endl;

    
  return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
char a[1005][1005];
int d[1005][1005];
int n,m;
int sx,sy;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ans;
queue<P> que;
int bfs(){
	//cout<<"Hello"<<endl;
	while(que.size()){
		//cout<<"Hello"<<endl;
		P p=que.front(); que.pop();
		//cout<<p.first<<" "<<p.second<<endl;
		for(int i=0;i<4;i++){
			int nx=p.first+dx[i],ny=p.second+dy[i];
			if(0<=nx&&nx<=n&&0<=ny&&ny<=m&&d[nx][ny]==1000000007){
				que.push(P(nx,ny));
				d[nx][ny]=d[p.first][p.second]+1;
			}
		}
	}
	return d[0][0];
}
int main(void){
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			d[i][j]=1000000007;
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>a[i][j];
			if(a[i][j]=='#'){
				que.push(P(i,j));
				d[i][j]=0;
			}
		}
	}
	int res=bfs();
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			//cout<<d[i][j]<<endl;
			ans=max(ans,d[i][j]);
		}
	}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 13328
n = int(input())
digit = len(str(n))

ans = 0

if digit == 1:
    ans = n
elif digit == 2:
    ans = 9
elif digit == 3:
    ans = 9 + (n - 99)
elif digit == 4:
    ans = 9 + 900
elif digit == 5:
    ans = 9 + 900 + (n - 9999)
elif digit == 6:
    ans = 9 + 900 + 90000
    
print(ans)

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

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

  if (a+b+2*sqrtl(a*b)-c < 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

}


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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  for (int i = k; i < n; i++) {
    if (a.at(i) > a.at(i - k)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4020
nk = list(map(int, input().split()))
s = list(map(str, input().split()))

n = nk[0]
k = nk[1]
str_s = s[0]

tmp = str_s[k-1]

new_s = "XXX"

if(tmp == 'A'):
    new_s = str_s[:k-1] + 'a' + str_s[k:n]
elif(tmp == 'B'):
    new_s = str_s[:k-1] + 'b' + str_s[k:n]
elif(tmp == 'C'):
    new_s = str_s[:k-1] + 'c' + str_s[k:n]

print(new_s)


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

namespace atcoder_code {
    class Program {
        static void Main (string[] args) {
            var input = Console.ReadLine ().Split (' ')
                .Select (x => double.Parse (x)).ToList ();
            var n = input[0];
            var d = input[1];
            var ans = Math.Ceiling (n / (d * 2 + 1));
            Console.WriteLine (ans);
        }
    }
}

Measured memory_bytes: 13268
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	a := nextInt()
	b := nextInt()
	k := nextInt()

	for i := a; i < min(a+k, b+1); i++ {
		fmt.Println(i)
	}
	for i := max(b-k+1, a+k); i < b+1; i++ {
		fmt.Println(i)
	}

}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1780
#include<cstdio>
#include<iostream>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<iomanip>
#include<fstream>
#include<ctime>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 10005;

int a[N], b[N], i, n;
LL ra, rb;

int main() {
scanf("%d", &n);
for (i=0;i<n;i++) scanf("%d", &a[i]);
for (i=0;i<n;i++) scanf("%d", &b[i]);
ra = rb = 0;
for (i=0;i<n;i++) {
	if (b[i] < a[i]) rb += (a[i] - b[i]);
	else if (b[i] > a[i]) {
		ra += ((b[i] - a[i]) / 2);
		if (a[i] % 2 != b[i] % 2) {
			ra++; rb++;
		}
	}
}
if (rb > ra) printf("No\n"); else printf("Yes\n");
return 0;
}



Measured memory_bytes: 384
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int max = sc.nextInt();
    int min = max;
	
    for(int i = 0;i < n-1;i++){
      int s = sc.nextInt();
      if(s > max){
        max = s;
      }else if(min > s){
        min = s;
      }
    }
    System.out.println(max-min);
  }
}

Measured memory_bytes: 23124
#include<stdio.h>
#define N 10000
#define Q 500
int linearSearch(int,int,int*);

int main(){
  int n,q,c = 0,i;
  int S[N],T[Q];

  scanf("%d",&n);
  for(i = 0; i < n; i++)
  scanf("%d",&S[i]);
  scanf("%d",&q);
  for(i = 0; i < q; i++){
  scanf("%d",&T[i]);
  c += linearSearch(n,T[i],S);
  }
  printf("%d\n",c);

  return 0;
}

int linearSearch(int n,int key,int a[]){

  int i;

  for(i = 0; i < n; i++)
    if (a[i] == key) return 1;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define INF = numeric_limits<long long>::max();
#define intf int_fast64_t
int main(){
    string s;
    cin >>s;

    cout << s[0] << s.size()-2 << s[s.size()-1] <<endl;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  string ans;
  
  if(a>=b){
for(int i = 0; i < a;i++){
ans = ans + std::to_string(b);
}
  }else{
    for(int i = 0;i< b;i++){
      ans = ans + std::to_string(a);
    }
        }
        
        cout << ans << endl;
  
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    cs = input()

    c = 0
    c_r = 0
    c_w = 0
    for i, c in enumerate(cs):
        if c == "R":
            c_r += 1
        else:
            c_w += 1
    if (c_r == 0) or (c_w == 0):
        print(0)
        return
    op = 0
    for i, c in enumerate(cs):
        if c_r == 0:
            break
        if c == "W":
            op += 1
        c_r -= 1
    print(op)

if __name__ == '__main__':
    main()


Measured memory_bytes: 67780
#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
typedef long long ll;
typedef pair<int,int> Pii;
const int INF=(1<<30)-1;
const int MAX=310;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}
int main(){
	int n,t,a;
	cin>>n;
	cin>>t>>a;
	int h[n];
	REP(i,n)cin>>h[i];
	double ans=1000000000000000;
	int kotae=-1;
	REP(i,n){
		double b=t-h[i]*0.006;
		double c=abs(a-b);
		if(c<=ans){
			ans=c;
			kotae=i;
		}
	}
	cout<<kotae+1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>

using namespace std;
using lint = int64_t;
using P = pair<int, int>;
using D = pair<double, double>;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
#define repn(i, a, b) for(int i = (a); i < (b); ++i)
#define Rep(i, n) for (int i = (n); i >= 0; --i)
#define All(vec) vec.begin(), vec.end()
#define cend printf("\n")

//constexpr lint mod = 998'244'353LL;
constexpr lint mod = 1000'000'007LL;
constexpr lint inf = 3LL * mod * mod;
const double Pi = 2.0 * acos(0.0);

template<class T> using prique     = priority_queue<T>;
template<class T> using prique_inv = priority_queue<T, vector<T>, greater<T>>;
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& rhs) { return is >> rhs.first >> rhs.second; }
template<class T, class U>inline ostream& operator<<(ostream& os, const pair<T, U>& rhs) { return os << rhs.first << " " << rhs.second << "\n"; }
template<class InputIterator> void arrin(InputIterator first, InputIterator last) { for (; first != last; ++first) cin >> (*first); }
template<class InputIterator> void arrout(InputIterator first, InputIterator last) {
	for (; first != last; ++first) {
		cout << (*first) << " ";
	}
	cout << "\n";
}

constexpr bool pri(lint x) { for (lint i = 2; i * i <= x; ++i) if (x % i == 0) return false; return 1 < x; }

inline double dis(D a, D b) { return hypot(a.first - b.first, a.second - b.second); }

lint fact[3000000];
void fact_init(lint n) {
	if (3000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (lint i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
}

lint modpow(lint x, lint n, lint m = mod) {
	lint res = 1;
	while (n > 0) {
		if (n & 1) {
			res *= x;
			if (m <= res) res %= m;
		}
		x *= x;
		if (m <= x) x %= m;
		n >>= 1;
	}
	return res;
}

lint intpow(lint x, lint n) {
	lint res = 1;
	while (n > 0) {
		if (n & 1) res *= x;
		x *= x;
		n >>= 1;
	}
	return res;
}

lint comb(lint n, lint r) {
	if (r == 0 || r == n) return 1;
	lint res = fact[n] * modpow(fact[n - r], mod - 2) % mod * modpow(fact[r], mod - 2) % mod;
	return res < 0 ? res + mod : res;
}

map<lint, lint> factring(lint n) {
	map<lint, lint> res;
	for (lint i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++res[i];
		}
	}
	if (n != 1) ++res[n];
	return res;
}

int n, k;
bool f(vector<int>& a) {
	vector<int>b(n + 1);
	rep(i, n) {
		b[max(0, i - a[i])]++;
		b[min(n, i + a[i] + 1)]--;
	}
	rep(i, n) {
		b[i + 1] += b[i];
	}
	bool res = true;
	rep(i, n) {
		a[i] = b[i];
		res &= (a[i] == n);
	}
	return res;
}
int main() {
	cin >> n >> k;
	vector<int>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, k) {
		if (f(a)) break;
	}
	for (int e : a) cout << e << " ";
}

Measured memory_bytes: 4828
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
const ll mod = 1000000007;
#define MAX_N 2200000
ll f[MAX_N+1];
ll invf[MAX_N+1];
ll modpow(ll  a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll nCm(ll n,ll m){return ((f[n]*invf[m])%mod)*invf[n-m]%mod;  }
int ncm(int r,int c){
        return nCm(r+c+2,r+1);
    }
signed main(){
    int r1,c1,r2,c2;cin >> r1 >> c1 >> r2 >> c2;
    rep(i,MAX_N+1){
        if(i == 0 || i == 1)f[i] = 1;
        else {
            f[i] = (f[i-1]*i)%mod;
        }
    }

    invf[MAX_N] = modpow(f[MAX_N],mod-2,mod);
    for(int i = MAX_N-1;i >= 0;--i){
        invf[i] = (invf[i+1]*(i+1))%mod;
    }
    

    int ans = ncm(r2,c2);
    ans -= ncm(r2,c1-1);
    ans -= ncm(c2,r1-1);
    ans+= ncm(r1-1,c1-1);
    cout << (ans%mod+mod)%mod << endl;
    //cout << nCm(5,2)%mod << endl;
    //rep(i,10)cout <<i << " " <<  invf[i] << endl;
    return 0;
}

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

#define _ << " " <<
#define tr(x) cout << #x _ x << endl
#define fi first
#define se second

#ifdef _WIN32
#define LD "%I64d"
#else
#define LD "%ld"
#endif

using namespace std;

typedef long long ll;

const int maxn = 100005;

int n, k;
int a[maxn];

int read() {
    if (scanf("%d %d", &n, &k) < 2) {
        return 0;
    }
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    return 1;
}

void solve() {
    int mid = -1;
    for (int i = 0; i < n - 1; i++) {
        if (a[i] + a[i + 1] >= k) {
            mid = i;
        }
    }
    if (mid == -1) {
        printf("Impossible\n");
        return ;
    }
    printf("Possible\n");
    for (int i = 0; i < mid; i++) {
        printf("%d\n", i + 1);
    }
    for (int i = n - 2; i > mid; i--) {
        printf("%d\n", i + 1);
    }
    printf("%d\n", mid + 1);
}

int main(int argc, char *argv[]) {
    while (read()) {
        solve();
    }
}


Measured memory_bytes: 1152
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  if(N<=999){
    printf("ABC");
  }else if(N==1000){
    cout << "ABD";
  }else if(N>=1001){
    printf("ABD");
  }

  return 0;
}

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

int main(){
    int N;
    double sum=0;
    cin >> N;
    double x[N] = {};
    double y[N] = {};
    for(int i=0; i<N; i++){
        cin >> x[i];
        cin >> y[i];
    }

    for(int i=0; i<N-1; i++){
        for(int j=i+1; j<N; j++){
            sum += sqrt(pow(x[i] - x[j],2) + pow(y[i] - y[j],2));
        }
    }

    cout << fixed << setprecision(10) << 2*sum/N << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
#define INF LLONG_MAX
typedef long long ll;
void bibs_swap(vector<int>& v, int k)
{
	rep(i, v.size()-1) if(v.at(i)%k>v.at(i+1)%k) swap(v.at(i), v.at(i+1));
}

void show(vector<int> v)
{
	rep(i, v.size()) cout << v.at(i) << endl;
}

int main(void)
{
	double a, b, c, d, e, f, ans_x, ans_y;
	cin >> a >> b >> c >> d;
	double p1p2_inc;
	if(a-c != 0) p1p2_inc = (b-d)/(a-c);
	else p1p2_inc = 0;
	double px_inc;
	if(p1p2_inc != 0)  px_inc = -1/p1p2_inc;
	else  px_inc = 0;
	double p1p2_sec;
	if(a==0 && b==0) p1p2_sec = -p1p2_inc*c + d;
	else p1p2_sec = -p1p2_inc*a + b;
	int q;
	cin >> q;
	rep(i, q)
	{
		cin >> e >> f;
		if(a==c) cout << 2*a - e << " " << f << endl;
		else if(b==d) cout << e << " " << 2*b - f << endl;
		else
		{
		    double px_sec = -px_inc*e + f;
		    ans_x = -(p1p2_sec - px_sec) / (p1p2_inc - px_inc);
		    ans_y = p1p2_inc*ans_x + p1p2_sec;
		    printf("%.9f %.9f\n", 2*ans_x - e, 2*ans_y - f);
		}
	}
	return 0;
}



Measured memory_bytes: 3272
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};


int main() {
    int h,a; cin >> h >> a;
    int ans = h/a;
    if (h%a != 0) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3568
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  int r, D, x;
  cin >> r >> D >> x;
  rep(i, 10){
    x = r * x - D;
    cout << x << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import queue

h, w = map(int, input().split(" "))

s = list()
for l in range(0, h):
    line = input()
    s.append(line)

dx = {(1, 0), (-1, 0), (0, 1), (0, -1)}


def search(start_h, start_w):
    if s[start_h][start_w] == "#":
        return -1

    cost = [[10000000 for i in range(0, w)] for j in range(0, h)]

    q = queue.Queue()
    q.put((start_h, start_w, 0))
    cost[start_h][start_w] = 0
    while not q.empty():
        current_h, current_w, current_c = q.get()
        # print("(%d, %d, %d)" % (current_h, current_w, current_c))

        # print("pos_w:%d, pos_h:%d, cost:%d" % (current_w, current_h, current_c))
        for dw, dh in dx:
            next_h = current_h + dh
            next_w = current_w + dw
            next_c = current_c + 1

            if next_h < 0 or next_h >= h or next_w < 0 or next_w >= w:
                continue

            if s[next_h][next_w] == "#" or cost[next_h][next_w] <= next_c:
                continue
            else:
                q.put((next_h, next_w, next_c))
                cost[next_h][next_w] = next_c

    tmp = 0
    for a in range(0, w):
        for b in range(0, h):
            if cost[b][a] > 1000:
                continue
            else:
                tmp = max(tmp, cost[b][a])

    return tmp


ans = 0
for i in range(0, w):
    for j in range(0, h):
        # print("start_h:%d, start_w:%d" % (j, i))
        cost_tmp = search(j, i)
        ans = max(ans, cost_tmp)
        # print("start_h:%d, start_w:%d cost:%d" % (j, i, cost_tmp))


print(ans)


Measured memory_bytes: 3952
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n+1]={};
	int b[n+1]={};
	int c[n+1]={};
	int temp;
	
	for(int i=1;i<=n;i++){
		cin>>temp;
		a[i]=a[i]+temp+max(b[i-1],c[i-1]);
		cin>>temp;
		b[i]=b[i]+temp+max(a[i-1],c[i-1]);
		cin>>temp;
		c[i]=c[i]+temp+max(a[i-1],b[i-1]);
	}

	temp=max(max(a[n],b[n]),c[n]);
	cout<<temp<<endl;


	return 0;
}

Measured memory_bytes: 1408
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int MAX = 111;
int n;
int x[MAX],y[MAX];
int il_wek(int a,int b){
  return x[a] * y[b] - x[b] * y[a];
}
int res = 0;
int kw(int a){
  return a * a;
}
void prob(int rx,int ry){
  maxi(res, kw(rx) + kw(ry));
}
int scal(int a,int b){
  return x[a] * x[b] + y[a] * y[b];
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(20);
  cerr << fixed << setprecision(6);
  cin >> n;
  R(i,n) cin >> x[i] >> y[i];
  R(i,n){
    int lx=0,ly=0;
    int rx=0,ry=0;
    int s1x=0,s1y=0;
    int s2x=0,s2y=0;
    R(j,n){
      int pom = il_wek(i,j);
      if(pom < 0){
        lx += x[j];
        ly += y[j];
      }else if(pom > 0){
        rx += x[j];
        ry += y[j];
      }else{
        if(scal(i,j) > 0){
          s1x += x[j];
          s1y += y[j];
        }else{
          s2x += x[j];
          s2y += y[j];
        }
      }
      prob(lx,ly);
      prob(lx + s1x,ly + s1y);
      prob(lx + s2x,ly + s2y);
      
      prob(rx,ry);
      prob(rx + s1x,ry + s1y);
      prob(rx + s2x,ry + s2y);
    }
  }
  cout << sqrt(res) << "\n";
}


Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))
sum1 = 100*100**2
for i in range(101):
    sum2 = 0
    for j in range(len(x)):
        sum2 += (x[j] - i)**2
    if sum2 < sum1:
        sum1 = sum2
print(sum1)

Measured memory_bytes: 9184
n = int(input())
a = [int(i) for i in input().split()]

y = sum(a) - a[0]
x = a[0]
min_diff = abs(x-y)

for i in range(1,n-1):
    x += a[i]
    y -= a[i]
    diff =  abs(x-y)
    if min_diff > diff:
        min_diff = diff

print(min_diff)



Measured memory_bytes: 24828
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
    int n, h;
    int cur;
    bool flg=true;
    cin >> n >> h;
    cur = h-1;
    for (int i = 1; i < n; ++i) {
        cin >> h;
        if(cur==h || cur==(h-1)){
            //stay
        }else if(cur>h){
            //out
            flg=false;
            break;
        }else{
            cur = h-1;
        }
    }
    if(flg){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct node{
  int key;
  node *left,*right,*p;
  node(){}
  node(int key):key(key){left=right=p=NULL;};
};
node *root;
void insert(node z){
  node *y=NULL;
  node *x=root;
  while(x!=NULL){
    y=x;
    if(z.key<x->key) x=x->left;
    else x=x->right;
  }
  z.p=y;
  if(y==NULL) root=new node(z);
  else if(z.key<y->key) y->left=new node(z);
  else y->right=new node(z);
}
void inorderTreeWalk(node *v){
  if(v==NULL) return;
  inorderTreeWalk(v->left);
  cout<<" "<<v->key;
  inorderTreeWalk(v->right);
}
void preorderTreeWalk(node *v){
  if(v==NULL) return;
  cout<<" "<<v->key;
  preorderTreeWalk(v->left);
  preorderTreeWalk(v->right);
}
signed main(){
  int n;
  cin>>n;
  root=NULL;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    //cout<<(root==NULL?-1:root->key)<<endl;
    if(s=="print"){
      inorderTreeWalk(root);
      cout<<endl;
      preorderTreeWalk(root);
      cout<<endl;
      continue;
    }
    int x;
    cin>>x;
    insert(node(x));
  }
  return 0;
}


Measured memory_bytes: 26640
first_line = raw_input().split(" ")
n = int(first_line[0])
m = int(first_line[1])
l = int(first_line[2])

array_a = []
array_b = []
for i in xrange(n):
  line = map(int, raw_input().split(" "))
  array_a.append(line)
for i in xrange(m):
  line = map(int, raw_input().split(" "))
  array_b.append(line)

# print array_a
# print array_b

array_c = []
for i in xrange(n):
  line = []
  for j in xrange(l):
    sum = 0
    for k in xrange(m):
      sum += array_a[i][k] * array_b[k][j]
    line.append(sum)
  array_c.append(line)

for i in xrange(n):
  print " ".join(map(str, array_c[i]))

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

int main() {
    long long n;
    cin>>n;
    string s="";
    int cond=0;
    while(n>cond){
        long long r=n%26;
        if(r==0){
            s+='z';
            n--;
        }
        else s+=(char)(r+'a'-1);
        n/=26;
    }
    reverse(s.begin(),s.end());
    cout<<s<<endl;
}



Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

//map
int main()
{
    int a,b,res;
    char c;

    while(true)
    {
        cin >> a >> c >> b;
        if(c == '+')
        {
            res = a + b;
        }
        else if(c == '-')
        {
            res = a - b;
        }
        else if(c == '*')
        {
            res = a * b;
        }
        else if(c == '/')
        {
            res = a / b;
        }
        else
        {
            //'?'
            break;
        }
        cout << res << endl;
    }

    return 0;
}


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

using namespace std;


int main() {
    int H,W,A,B;
    cin >> H >> W >> A >> B;
    vector<vector<int>> ans(H, vector<int>(W));
    for(int i=0;i<H;i++) {
        for(int j=0;j<W;j++) {
            if(i<B && j < A) ans[i][j] = 1;
            else if(i >= B && j >= A) ans[i][j] = 1;
            else ans[i][j] = 0;
        }
    }
    for(int i=0;i<H;i++) {
        for(int j=0;j<W;j++) {
            cout << ans[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 5120
import java.util.*;

public class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(),b=sc.nextInt();
        int ans = Math.max(a+b,Math.max(a-b,a*b));
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int n,m,s,g,d[SIZE],a,b;
vector<int> way[SIZE];

int main(){
  
  scanf("%d%d%d%d",&n,&m,&s,&g);

  s--; g--;
  
  for(int i=0;i<n;i++){
    scanf("%d",d+i);
  }

  for(int i=0;i<m;i++){
    scanf("%d%d",&a,&b);
    a--;
    b--;
    way[a].push_back(b);
  }

  queue<int> que;

  int dp[SIZE];
  
  for(int i=0;i<n;i++){
    dp[i] = INF;
  }

  dp[s] = 0;

  priority_queue<pair<int,int> > pq;
  
  pq.push({0, s});

  for(int i=0;i<n;i++){
    for(int j=0;j<way[i].size();j++){
      que.push(way[i][j]);
    }

    while(pq.size() && pq.top().second < i){
      pq.pop();
    }

    while(pq.size() && que.size()){
      auto p = que.front();
      que.pop();

      if(dp[p] > -pq.top().first + d[p]){
        dp[p] = min(dp[p], -pq.top().first + d[p]);
        pq.push({-dp[p], p});
      }
    }
  }

  int ans = INF;
  
  for(int i=g;i<n;i++){
    ans = min(ans, dp[i]);
  }

  printf("%d\n",ans);
  
  return 0;
}

Measured memory_bytes: 9460
#include<iostream>
using namespace std;
int a=0,b=0;
string c;
bool d=false,e=false,f=false,g=false;
int main(){
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>c;
    if(c=="P")d=true;
    else if(c=="Y")e=true;
    else if(c=="W")f=true;
    else if(c=="G")g=true;
  }
  if(d==true)b++;
    if(e==true)b++;
    if(f==true)b++;
    if(g==true)b++;
if(b==3)cout<<"Three"<<endl;
  else cout<<"Four"<<endl;
}

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

int main() {
    int N; cin >> N;
    vector<int> S;
    for(int i = 0; i < N; i++) {
        int s; cin >> s; S.push_back(s);
    }
    int Q; cin >> Q;
    vector<int> T;
    for(int i = 0; i < Q; i++) {
        int t; cin >> t; T.push_back(t);
    }
    sort(S.begin(), S.end());
    int res = 0;
    for(int i = 0; i < Q; i++) {
        res += binary_search(S.begin(), S.end(), T[i]);
    }
    cout << res << endl;
}

Measured memory_bytes: 1804
#include <iostream>
using namespace std;
int main(void){
    
    int count = 0;
    string S;
    cin >> S;
    
    if(S.size() % 2 == 0){
        for(int i = 1; i <= S.size()/2; i++){
            //cout << S[i-1] << "==" << S[S.size()-i] << endl;
            if( S[i-1] != S[S.size()-i] ) count++;
        }
    }
    else{
        for(int i = 1; i <= S.size()/2; i++){
            //cout << S[i-1] << "==" << S[S.size()-i] << endl;
            if(S[i-1] != S[S.size()-i]) count++;
        }
    }
    
    cout << count << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#include <utility>
#include <numeric>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
const int MOD = 1000000007;
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<string>s(n);
	vector<int>a(n);
	REP(i, n) {
		cin >> s[i] >> a[i];
	}
	vector<int>ord(n);
	iota(ord.begin(), ord.end(), 0);
	sort(ord.begin(), ord.end(), [&](int x, int y) {
		if (s[x] == s[y])return a[x] > a[y];
		return s[x] < s[y];
	});
	REP(i, n) {
		cout << ord[i] + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  string N;
  char tmp = 'X';
  int ans = 0;
  int d;
  cin >> d >> N;
  rep(i,N.length()) {
    if (tmp != N[i]) {
      ans++;
    }
    tmp = N[i];
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 512
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val seq = Seq.fill(n)(sc.nextInt)
  
  var min = seq.head
  var count = 1

  for (i <- seq) {
    if (i < min) {
      min = i
      count = count + 1
    }
  }
  
  println(count)
}

Measured memory_bytes: 80896
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int main(){
    int N, K;
    cin >> N >> K;
    vector<bool> v(N);
    REP(k, K){
        int d;
        cin >> d;
        REP(i, d){
            int A;
            cin >> A;
            A--;
            v[A] = true;
        }
    }
    int ans = 0;
    REP(i, N) if(!v[i]) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3600
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	var ng = false
	if s[0] != 'A' {
		ng = true
	}

	var sub = s[2 : len(s)-1]
	var indexC = 2
	var countC = 0
	for i, c := range sub {
		if c == 'C' {
			countC++
			indexC += i
		}
	}
	if countC != 1 {
		ng = true
	}

	for i, c := range s {
		if i == 0 || i == indexC {
			continue
		}
		if 'A' <= c && c <= 'Z' {
			ng = true
		}
	}

	if ng {
		fmt.Println("WA")
	} else {
		fmt.Println("AC")
	}
}


Measured memory_bytes: 512