akhauriyash/Code-Regression huggingface dataset:
/*
[ ( ^ _ ^ ) ]
*/

// problem: atc/abc162_a

import java.io.*;
import java.util.*;


public class Main {
    int INF = (int)1e9;
    long MOD = 1000000007;


    void solve(InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        int[] c = new int[100];
        while(n>0) {
            c[n%10]++;
            n/=10;
        }
        if(c[7]>0) {
            out.println("Yes");
        } else {
            out.println("No");
        }
    }
    

    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        while(t-- >0) {
            new Main().solve(in, out);
        }
        out.close();
    }
    
    public static void show(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }
    
    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;
        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() { return Integer.parseInt(next()); }
        long nextLong() { return Long.parseLong(next()); }
        double nextDouble() { return Double.parseDouble(next()); }
    }
}

Measured memory_bytes: 25356
from collections import defaultdict
it = lambda: list(map(int, input().strip().split()))


def solve():
    N, X, M = it()
    if N == 1: return X % M

    cur = 0
    cnt = 0
    value = defaultdict(int)
    history = defaultdict(int)
    for i in range(N):
        if X in history: break
        value[X] = cur
        history[X] = i
        cnt += 1
        cur += X
        X = X * X % M
        
    loop = cur - value[X]
    period = i - history[X]
    freq, rem = divmod(N - cnt, period)
    cur += freq * loop
    for i in range(rem):
        cur += X
        X = X * X % M
    return cur


if __name__ == '__main__':
    print(solve())

Measured memory_bytes: 20136
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int a[51],b[51],c[51],d[51];
inline int dist(int x1,int y1,int x2,int y2)
{
	return abs(x1-x2)+abs(y1-y2);
}
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i];
	}
	for(int i=1;i<=m;i++)
	{
		cin>>c[i]>>d[i];
	}
	for(int i=1;i<=n;i++)
	{
		int min_dist=dist(a[i],b[i],c[1],d[1]);
		int id=1;
		for(int j=2;j<=m;j++)
		{
			int cur_dist=dist(a[i],b[i],c[j],d[j]);
			if(cur_dist<min_dist)
			{
				min_dist=cur_dist;
				id=j;
			}
		}
		cout<<id<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        
        // 定数
        final String RESULT_YES = "Yes";
        final String RESULT_NO = "No";
        
        Scanner sc = new Scanner(System.in);
        //Scanner sc = new Scanner("1 1\r\n999-0000");
        
        // ハイフンより前の文字数
        int postOfficeCode = sc.nextInt();
        // ハイフンより後の文字数
        int locationCode = sc.nextInt();
        // 評価対象文字列
        String val = sc.next();
        
        boolean result = false;
        
        if(val.matches("[0-9]{"+postOfficeCode+"}-[0-9]{"+locationCode+"}")) {
            result = true;
        }
        
        if(result) {
            System.out.println(RESULT_YES);
        } else {
            System.out.println(RESULT_NO);
        }
        
    }
}


Measured memory_bytes: 21716
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
#define INF 0x3f3f3f3f
#define mod 1000000009
#define e  2.718281828459045
#define eps 1.0e18
#define PI acos(-1)
#define lowbit(x) (x&(-x))
#define memset(x,y) memset(x,y,sizeof(x))
#define lson i << 1,l,m
#define rson i << 1 | 1,m + 1,r
#define ll long long
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++) cout<<"x";
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int x;
  cin >> x;
  x = 1 - x;
  cout << x << endl;
  return 0;
}

Measured memory_bytes: 3620
"use strict";

const main = arg => {
    const N  = arg.split("\n")[0].split(" ").map(n=>parseInt(n));
    const AB = N.reduce((m,n)=>m+n);
    console.log(AB < 10 ? AB : "error" );
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using Pdi = pair<double, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int K; cin >> K;
    string S; cin >> S;
    if(SZ(S) <= K) Out(S);
    else{
        cout << S.substr(0, K) + "..." << endl;
    } 

    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
using namespace std;
using ll = long long;
int main() {
    int a, b;
    cin >> a >> b;
    cout << a - b + 1 << endl;
}

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

int main() {
  int n, c = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b = 0;
    cin >> a;
    while (a % 2 == 0) {
      a /= 2;
      b++;
    }
    if (i == 0) c = b;
    else if (c > b) c = b;
  }  
  cout << c << endl;
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
int main() {
	vector<int> num(3);
	string s;
	cin >> s;
	for (auto t : s)num[t - 'a']++;
	int M, m = num[0];
	for (auto v : num) {
		M = max(M, v);
		m = min(m, v);
	}
	puts(M - m <= 1 ? "YES" : "NO");
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    cin>>N;
    int A[N];
    int sum=0;
    map<int,int> m;
    m[0]++;
    rep(i,N){
        cin>>A[i];
        sum+=A[i];
        m[sum]++;
    }
    int ans=0;
    for(auto p:m){
        ans+=p.second*(p.second-1)/2;
    }
    cout << ans << endl;



}


Measured memory_bytes: 14336
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <stdio.h>
#include <string.h>
int n;
char com[15];
char str[15];

int C[1777771];

int g(char ch){
  if(ch=='A')return 1;
  if(ch=='G')return 2;
  if(ch=='T')return 3;
  return 4;
}

int f(){
  int res=0;
  for(int i=0;str[i]!='\0';i++){
    res=res*4+g(str[i]);
  }
  return res;
}

int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%s %s",com,str);

    int key=f();
    
    if(com[0]=='f'){
      int ans=C[key%1777771];
      if(ans)printf("yes\n");
      else printf("no\n");
    }else{
      C[key%1777771]=1;
    }
  }
  return 0;
}

Measured memory_bytes: 8076
using System;
public class Hello{
    public static void Main(){
        // Your code here!
        int n = int.Parse(Console.ReadLine());
        string []s = Console.ReadLine().Split();
        int[] A = new int[n];
        for(int i=0;i<n;++i){
            A[i] = int.Parse(s[i]);
        }
        for(int j=0;j<n;++j){
            int tmp = A[j];
            int i = j - 1;
            while(i>=0&&A[i]>tmp){
                A[i+1] = A[i];
                --i;
            }
            A[i+1] = tmp;
            for(i=0;i<n;++i){
                if(i!=0)Console.Write(" ");
                Console.Write(A[i]);
            }
            Console.Write("\n");
        }
    }
}



Measured memory_bytes: 17904
def resolve():
    a,b,k=map(int,input().split())
    realk=min(b-a+1,k)
    ans=list(range(a,a+realk))
    ans+=list(range(b-realk+1,b+1))
    answer=sorted(list(set(ans)))
    for i in answer:
        print(i)
    

resolve()

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define int                     long long int
#define ld                      long double
#define pb                      push_back
#define rep(i,a,b,c)            for(int i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(int i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define vpii                    vector<pair<int,int>>
#define si                      set<int>
#define usi                     unordered_set<int>
#define vi                      vector<int>
#define vld                     vector<ld>
#define vvi                     vector<vector<int>>
#define vvld                    vector<vector<ld>>
#define pii                     pair<int,int>
#define vvpii                   vector<vector<pair<int,int>>>
#define pqi                     priority_queue<int>
#define mii                     map<int,int>
#define mic                     map<int,char>
#define um                      unordered_map
#define umii                    um<int,int>
#define umic                    um<int,char>
#define umci                    um<char,int>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define test                    int Testcases;cin>>Testcases;while(Testcases--)
#define input(a,n)              for(int i=0;i<n;++i) cin>>a[i];
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void inp_out()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
    #endif
}

int32_t main()
{
	fastIO
	inp_out();
	int a,b,q;
	cin>>a>>b>>q;
	int low=0,high=q,ans=-inf;
	while(low<=high)
	{
		int mid=(low+high)/2;
		int val=(a*mid)/b-a*(mid/b);
		if(val>=ans)
		{
			low=mid+1;
			ans=val;
		}
		else
		{
			high=mid-1;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3648
using System;

namespace ITP1_3_D
{
    class Program
    {
        static void Main()
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            int c = int.Parse(str[2]);
            int cnt;

            for (cnt = 0; a <= b; a++) if (c % a == 0) cnt++;

            Console.WriteLine(cnt);
        }
    }
}

Measured memory_bytes: 9252
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  s[k - 1] = s[k - 1] - ('A' - 'a');
  P(s);



  return 0;

}

Measured memory_bytes: 256
N = gets.to_i
ans = 'Yes'
S = []
l = nil
N.times{
  s = gets.chomp
  if S.include?(s) || ((not l.nil?) && s[0] != l) then
    ans = 'No'
  else
    S << s
    l = s[-1]
  end
}

puts ans


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

enum Face : int { Top=0, Front=1, Right=2, Left=3, Back=4, Bottom=5 };
class cube {
private:
  int f[6];
  unordered_map<int, string> name_;

public:  
  /*
            1(Top)
    4(Left) 2(Front) 3(Right) 5(Back)
            6(Bottom)
  */
  cube(){}
  cube(vector<int> const& vs){ assert(vs.size() == 6); for(int i=0; i<6; i++) f[i] = vs[i]; }
  cube(vector<string> const& vs) { assert(vs.size() == 6); for(int i=0; i<6; i++) f[i] = i, name_[i] = vs[i]; }
  void roll_z() { roll(1, 2, 4, 3); }
  void roll_y() { roll(0, 2, 5, 3); }
  void roll_x() { roll(0, 1, 5, 4); }
  void roll(int i, int j, int k, int l) {
    int t = f[i]; f[i] = f[j]; f[j] = f[k]; f[k] = f[l]; f[l] = t;
  }

  const int& operator[] (int idx) const { return f[idx]; }
  const string& name(int idx) { return name_[f[idx]]; }

  void roll(int k) {
    if(k == 0) roll_y();
    if(k == 1) roll_x();
    if(k == 2) for(int i=0; i<3; i++) roll_y();
    if(k == 3) for(int i=0; i<3; i++) roll_x();
  }

  bool roll_top_front(int top, int front) {
    for(int k = 0; k < 6; (k & 1 ? roll_y() : roll_x()), k++)
      for(int i = 0; i < 4; roll_z(), ++i)
        if(top == f[Top] && front == f[Front]) return true;
    return false;
  }

  bool operator== (cube const& rhs) const {
    for(int i=0; i<6; i++)
      if(f[i] != rhs.f[i]) return false;
    return true;
  }

  bool isomorphic(cube rhs) const {
    for(int k = 0; k < 6; (k & 1 ? rhs.roll_y() : rhs.roll_x()), k++)
      for(int i = 0; i < 4; rhs.roll_z(), ++i)
        if(operator==(rhs)) return true;
    return false;
  }
};

int main() {

  for(int N; cin >> N && N;) {
    cube c({1,5,4,3,2,6});
    string t = "wnes";
    rep(i, N) {
      string s; cin >> s;
      c.roll(t.find(s[0]));
    }
    cout << c[Top] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3172
#include <iostream>
typedef long long ll;
using namespace std;

ll gcd(ll x, ll y) {
    if(x<y) return gcd(y, x);
    ll r=x%y;
    while(r!=0) {
        x=y;
        y=r;
        r=x%y;
    }
    return y;
}

int main() {
    int n;
    ll a, ans;
    cin >> n;
    cin >> ans;
    for(int i=1; i<n; i++) {
        cin >> a;
        ans = gcd(ans, a);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
const int mod = 1e9+7;
inline int read(){int w=1,s=0;char ch=getchar();while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}return w*s;}
int size[5050];
struct node{
	int to,next;
}e[100010];
ll base[5050],f[5050][5050],g[5050],h[5050],tot,n;
inline void add_edge(int from,int to){e[++tot].next=h[from];h[from]=tot;e[tot].to=to;}
inline int add(int a,int b){a+=b;if(a>=mod) a-=mod; return a;}
inline void DFS(int now,int ffa)
{
	size[now]=1;
	for(register int i=h[now];i;i=e[i].next)
	{
		int to=e[i].to;if(to==ffa) continue;
		DFS(to,now);size[now]+=size[to];
	}
	f[now][1]=1;int las=1;
	for(register int i=h[now];i;i=e[i].next){
		int to=e[i].to;if(to==ffa) continue;
		for(register int j=1;j<=las;++j) g[j]=f[now][j],f[now][j]=0;
		for(register int j=1;j<=las;++j){
			for(register int k=1;k<=size[to];++k){
				f[now][k+j]=add(f[now][j+k],1ll*g[j]*f[to][k]%mod);
				if(!(k&1)){
					f[now][j]=add(f[now][j],mod-(1ll*g[j]*f[to][k]%mod*base[k/2]%mod));
				}
			}
		}las+=size[to];
	}
}
int main()
{
	n=read();
	for(register int i=1,u,v;i<n;++i) u=read(),v=read(),add_edge(u,v),add_edge(v,u);
	base[0]=1;for(register int i=1;i<=n;++i) base[i]=1ll*base[i-1]*(2*i-1)%mod;
	DFS(1,0);int ans=0;
	for(register int i=1;i<=n;++i) if(i%2==0) ans=add(ans,1ll*f[1][i]*base[i/2]%mod);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 198272
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

inline bool isdigit(char a){
	if(a>='0' && a<='9') return true;
	return false;
}


int main(){
	int n,m,num,ans=0;
	string s;
	stack<int> st;
	stack<int> tmp;
	getline(cin , s);
	for(int i=0;i<s.size();++i){
		if (isdigit(s[i])){
			while(s[i]!=' ' && s[i]!=0){
				num=(int)(s[i]-'0');
				tmp.push(num);
				i++;
			}
			num=0,m=1;
			while(!tmp.empty()){
				num+=tmp.top()*m;
				m*=10;
				tmp.pop();
			}
			st.push(num);
			i--;
		} else if (s[i]=='+' || s[i]=='-' || s[i]=='*'){
			if(s[i]=='+'){
				n=st.top();
				st.pop();
				n+=st.top();
				st.pop();
				st.push(n);
			} else if(s[i]=='-'){
				n=st.top();
				st.pop();
				n-=st.top();
				st.pop();
				st.push(-n);
			} else if(s[i]=='*') {
				n=st.top();
				st.pop();
				n*=st.top();
				st.pop();
				st.push(n);
			}
		} else if(s[i]==' '){
			continue;
		}
	}
	cout << st.top() << endl;
	return 0; 
}

Measured memory_bytes: 1180
<?php

fscanf(STDIN, "%d %d", $row, $col);

$table = [];
for ($i = 0; $i < $row; $i++) {
  $table[$i] = explode(" ", trim(fgets(STDIN)));
  $table[$i][$col] = 0;
  for ($j = 0; $j < $col; $j++) {
    $table[$i][$col] += $table[$i][$j];
  }
}
for ($j = 0; $j <= $col; $j++) {
  $table[$row][$j] = 0;
  for ($i = 0; $i < $row; $i++) {
    $table[$row][$j] += $table[$i][$j];
  }
}
for ($i = 0; $i <= $row; $i++) {
  echo implode(" ", $table[$i])."\n";
}


Measured memory_bytes: 10964
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = in.nextIntArray(n);

            int[] b = a.clone();
            Arrays.sort(b);

            int mid = b[(b.length - 1) / 2];
            for (int i = 0; i < n; i++) {
                if (a[i] <= mid) {
                    out.println(b[(b.length + 1) / 2]);
                } else {
                    out.println(mid);
                }
            }
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 54824
#include <stdio.h>
#include <string.h>
#define p1 0
#define p2 1
#define p3 2

void visit(int );
void dfs();

int n,A[100][100],c[100],d[100],f[100],t;

int main()
{
  int i,j,u,v,k;

  for(i = 0;i < n;i++)
    {
      for(j = 0;j < n;j++)
	{
	  A[i][j] = 0;
	}
    }
  scanf("%d",&n);
  for(i = 0;i < n;i++)
    {
      scanf("%d",&u);
      scanf("%d",&k);
      if(k == 0) continue;
	/*{
	  for(l = 0;l < n;l++)
	    {
	      A[u-1][l] = 0;
	      }*/
      for(j = 0;j < k;j++)
	{
	  scanf("%d",&v);
	  A[u-1][v-1] = 1;
	}
    }
  dfs();
    
  return 0;
}
void dfs()
{
  int i;
  for(i = 0;i < n;i++)
  {
    c[i] = p1;
  }
  t = 0;
  for(i = 0;i < n;i++)
    {
      if(c[i] == p1) visit(i);
    }
  for(i = 0;i < n;i++)
    {
      printf("%d ",i + 1);
      printf("%d ",d[i]);
      printf("%d\n",f[i]);
    }
}
void visit(int r)
{
  int x;
  c[r] = p2;
  d[r] = ++t;
  for(x = 0;x < n;x++)
    {
      if(A[r][x] == 0) continue;
      if(c[x] == p1)
	{
	  visit(x);
	}
    }
  c[r] = p3;
  f[r] = ++t;
}
  
  
    
  
  



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int n; cin >> n;
	string s; cin >> s;
	REP(i, s.length()) {
		if (s[i] + n > 'Z')
			printf("%c", s[i] + n - 26);
		else
			printf("%c", s[i] + n);
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード
 
//ループ
#define rep(i, n) for(int i = 0; i < (n); i++) //普通のループ
#define repr(i, n) for(int i = n; i >= 0; i--) //逆ループ
 
//型名省略
typedef long long ll;
//値
static const ll MX = 100005;
static const ll MX_ll = 1e18;
const double PI = acos(-1); //π
 
using namespace std;
 
//ソート
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
 
//#include "./lib/generic/search.h"

//文字列入力した小数値を小数点なくして返す
int changeDoubleToInt(string decimal){ 
    decimal.erase(1, 1); //小数点削除
    int n_decimal = atoi(decimal.c_str()); //c_strでchar*に変換後、atoiでintに変換
    return n_decimal;
}

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    int ans=0;
    rep(i, n){
        cin >> s[i];
    }
    sort(s.begin(), s.end()); // vector
    //rep(i, n) cout << s[i] << endl;

    rep(i, n){
        ans++;
        while(1){
            if(s[i]==s[i+1]) i++;
            else break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9496
import heapq

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


def solve():
    AA = [[-x, x] for x in A]

    heapq.heapify(AA)

    for i in range(M):
        x, y = heapq.heappop(AA)
        heapq.heappush(AA, [-(y//2), y//2])

    AAA = [x[1] for x in AA]
    return sum(AAA)


print(solve())


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

using namespace std;

int main(void) {
  int n;
  while (cin >> n, n) {
    int m[110], p[110][110];
    for (int i = 0; i < n; i++) {
      cin >> m[i];
      for (int j = 0; j < m[i]; j++) {
        cin >> p[i][j];
      }
    }

    int K, l[110];
    cin >> K;
    for (int i = 0; i < K; i++) {
      cin >> l[i];
    }

    int ans = -1;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < K; j++) {
        bool none = true;
        for (int k = 0; k < m[i]; k++) {
          if (p[i][k] != l[j]) continue;
          none = false;
          break;
        }
        if (none) break;
        if (j == K - 1) {
          if (ans >= 0) ans = -1, i = n;
          else ans = i + 1;
        }
      }
    }

    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3116
N = 55555 + 1
prime_table  = [True] * N
d = {}
for i in range(2,N):
    if prime_table[i]:
        if i%5 not in d :
            d[i%5] = []
        d[i%5].append(i)
        j = 2
        while i * j < N:
            prime_table[i*j] = False
            j+=1

n = int(input())
print(" ".join([str(v) for v in d[1][:n]]))


Measured memory_bytes: 3700
import java.util.*;

public class Main {
	public static void main(String args[]) {
    	Scanner sc = new Scanner(System.in);
      	int N,K;
      	String S;
      	N = sc.nextInt();
      	S = sc.next();
      	K = sc.nextInt();
      	char[] s = new char[N];
      	for (int i = 0; i < N; i++) {
        	s[i] = S.charAt(i);
        }
      	for(int i = 0;i < N; i++) {
        	if(s[K-1] != s[i]) {
              	s[i] = '*';
            }
        }
      	for(int i = 0; i < N; i++) {
        	System.out.print(s[i]);
        }
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 1000000000000000ll;
const int MOD = 1000000007;
template<class T>  //多次元ベクトルの生成
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
int main(){
	auto c=make_vec<int>(3,3);
	rep(i,3)rep(j,3)std::cin >> c[i][j];
	rep(i,101)rep(j,101)rep(k,101){{{
		if(((c[0][0]-i==c[0][1]-j)&&(c[0][2]-k==c[0][1]-j))&&
		   ((c[1][0]-i==c[1][1]-j)&&(c[1][2]-k==c[1][1]-j))&&
		   ((c[2][0]-i==c[2][1]-j)&&(c[2][2]-k==c[2][1]-j))){
		std::cout << "Yes" << std::endl;
		exit(0);}
	}}}
	std::cout << "No" << std::endl;
}

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

int main()
{
   int n;
   cin>>n;
   int cnt=0;
   for (int i=1;i<=n;i++)
   {
       int x;
       cin>>x;
       if(i%2==1&&x%2==1)
        cnt++;
   }
   cout<<cnt;
    return 0;
}


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

inline long long read(){
    long long s = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9'){
        if (ch == '-') w = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9'){
        s = s * 10 + ch - '0';
        ch = getchar();
    }
    return s * w;
}
int k, a, b;
int main(){
    k = read();
    a = read(), b = read();
    int n = a / k;
    if (a % k != 0){
        n++;
    }
    n = n * k;
    if (n <= b){
        puts("OK");
    }
    else{
        puts("NG");
    }
    return 0;
}
//g++ A.cpp -o A.exe -lm -Wall

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


int main(){
  int n,q,i,id,sum,j;
  sum=0;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> l(q),r(q);
  for(i=0;i<q;++i){
    cin >> l[i] >> r[i];
    l[i]--;
    r[i]--;
  }
  vector<int> ru(n,0);
  id=0;
  for(i=0;i<n;++i){
    if(s[i]=='A' && s[i+1]=='C'){
      id++;
    }
    ru[i]=id;
  }
  for(i=0;i<q;++i){
    if(l[i]-1>=0){
    sum=ru[r[i]-1]-ru[l[i]-1];
  }else{
    sum=ru[r[i]-1];
  }
    cout << sum << endl;
    sum=0;
  }
  return 0;

}


Measured memory_bytes: 2176
import java.util.Iterator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		
		int max4 = n / 4;
		int max7 = n / 7;
		
		String ans = "No";
		for (int i = 0; i <= max4; i++) {
			for (int j = 0; j <= max7; j++) {
				if (i * 4 + j * 7 == n) {
					ans = "Yes";
					break;
				}
			}
			
		}
		System.out.println(ans);
	}
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  ll n;
  cin >> n;
  vector<ll> a(n);
  for(int i = 0; i < n; ++i)
  {
    cin >> a[i];
  }

  sort(a.begin(), a.end());

  int ans = 0;
  for(int i = 0; i < n - 2; ++i)
  {
    for(int j = i + 1; j < n - 1; ++j)
    {
      if (a[i] == a[j]) continue;
      for(int k = j + 1; k < n; ++k)
      {
        if (a[j] == a[k]) continue;
        if (a[i] + a[j] > a[k]) ans++;
      }
    }
  }
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3660
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  auto n = readln.chomp.to!int;
  auto p = readln.chomp.split.to!(int[]);
  auto q = readln.chomp.split.to!(int[]);

  int[][] ar;
  auto f = new int[](n);
  f[] = false;
  void calc(int[] a) {
    if (a.length == n) {
      ar ~= a;
      return;
    }

    foreach (i; 0..n) {
      if (f[i]) continue;
      f[i] = true;
      calc(a ~ (i + 1));
      f[i] = false;
    }
  }

  int[] tmp;
  calc(tmp);
  int pr, qr;
  foreach (int i; 0..ar.length.to!int) {
    if (p == ar[i]) {
      pr = i + 1;
    }
    if (q == ar[i]) {
      qr = i + 1;
    }
  }
  abs(pr - qr).writeln;
}


Measured memory_bytes: 7036
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)

const ll mod = (ll)1e9+7;
const ll maxn = (ll)2e5+5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e18;

ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};


void solve(){ 
    ll a;
    string s;
    cin >> a >> s;
    ll c = (s[0]-'0') *100LL + (s[2] - '0')*10LL + (s[3] - '0');
	cout << (ll)(a*c)/100LL; 
	return;
}


int main() {
   
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    ll T;
    T=1;
    //cin >> T;
    //scanf("%lld",&T);
    ll CT = 0;
    //work();
    while(T--){
    	//cout << "Case " << ++CT <<": " ;
    	//printf("Case %lld: ",++CT);
		solve();
	}
    
    return 0;
}


Measured memory_bytes: 3632
from math import gcd
def main():
    ans = 0
    k = int(input())
    for i in range(k):
        for j in range(k):
            for l in range(k):
                ans += gcd(i+1,gcd(j+1,l+1))
    print(ans)


if __name__ == "__main__":
    main()

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

using namespace std;

int main()
{
    int X;

    scanf("%d", &X);

    int ans = 1, tmp;
    for (int i = 2; i < X; i++)
    {
        tmp = i;
        for (int j = 1; tmp <= X; j++)
        {
            tmp *= i;
            if (tmp <= X && tmp > ans)
            {
                ans = tmp;
            }
        }
        if (tmp == i * i)
        {
            break;
        }
    }

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

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  vector<int> x(n);
  
  int sum=0;
  for (int i=0;i<n;i++) {
    cin >> x.at(i);
    sum += x.at(i);
   }
  
  int ret=0, P=(sum)/n;
  if (n/2 < sum%n) { P++; }
  for (int i=0;i<n;i++) {
    ret += (x.at(i) - P) * (x.at(i) - P);
  }
  cout << ret << endl;
}

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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n)	 for(int i = 0; i < (n); i++)
#define all(a)		 begin(a), end(a)

typedef long long int		   ll;
typedef long long unsigned int llu;

void solve(string S) {
	if(S.length() == 2) printf("1");
	else {
		for(int i = (S.length() - 1) / 2; i >= 0; i--) {
			if(S.substr(0, i) == S.substr(i, i)) {
				cout << i * 2;
				break;
			}
		}
	}
}

int main() {
	string S;
	cin >> S;
	solve(S);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
using datas=pair<ll,ll>;
using tdata=pair<datas,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncrlistp[200000],modncrlistm[200000];

ll modncrs(ll n,ll r){
  ll i,j;
  if(modncrlistp[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistp[i])break;
    }
    if(i<0){
      modncrlistp[0]=1;
      rep1(i,n+1){
        modncrlistp[i]=(modncrlistp[i-1]*i)%mod;
      }
    }else{
      For(j,i+1,n+1){
        modncrlistp[j]=(modncrlistp[j-1]*j)%mod;
      }
    }
  }
  if(modncrlistm[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistm[i])break;
    }
    if(i<0){
      modncrlistm[0]=1;
      rep1(i,n+1){
        modncrlistm[i]=(modncrlistm[i-1]*modinv(i))%mod;
      }
    }else{
      For(j,i+1,n+1)modncrlistm[j]=(modncrlistm[j-1]*modinv(j))%mod;
    }
  }
  return (((modncrlistp[n]*modncrlistm[r])%mod)*modncrlistm[n-r])%mod;
}

ll modncr(ll n,ll r){
  if(r*2>n)return modncr(n,n-r);
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}

int main(){
  ll i,N,H,a,b,cnt=0;
  cin>>N>>H;
  datas x;
  priority_queue<datas> que;
  rep(i,N){
    cin>>a>>b;
    que.push(datas(a,1));
    que.push(datas(b,0));
  }
  while(H>0){
    x=que.top();que.pop();
    if(x.second){
      i=(H+x.first-1)/x.first;
      cnt+=i;
      break;
    }else{
      H-=x.first;
      cnt++;
    }
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 6512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i < n; i++)
#define rep3(i, x, n) for(int i = x; i > n; i--)
const long long MOD = 1e9+7;
const long long INF = 1e15;
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
    int N;
    cin >> N;
    vector<P> vec;
    ll L, R;
    ll mR = 1e9;
    rep(i, N){
        cin >> L >> R;
        vec.push_back(P(L, R));
        mR = min(mR, R);
    }
    sort(vec.begin(), vec.end(), greater<P>());
    ll ML = vec[0].first;
    ll minR[N-1];
    minR[0] = vec[0].second;
    ll ans = 0;
    ll zero = 0;
    rep(i, N-1){
        ll l = vec[i+1].first;
        ll r = vec[i+1].second;
        if(i >= 1) minR[i] = min(minR[i-1], vec[i].second);
        ans = max(ans, max(zero, mR-ML+1) + r-l+1);
        ans = max(ans, max(zero, minR[i]-ML+1) + max(zero, mR-l+1));
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
int a,b;
cin>>a>>b;
cout << a*b << " " << 2*(a+b) << endl;
  return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>

using namespace std;
int vx[4] = { 1, -1, 0, 0 };
int vy[4] = { 0, 0, 1, -1 };
int h, w;
vector<vector<int>> mp, b, c;

int main() {
	cin >> h >> w;
	mp.resize(h);
	for (int i = 0; i < h; i++)
		mp[i].resize(w);
	b = mp;
	c = mp;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if ((i % 2 == 0 || j == 0) && j != w - 1)
				b[i][j] = 1;
			else
				c[i][j] = 1;
		}
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			char a;
			cin >> a;
			if (a == '#') {
				b[i][j] = 1;
				c[i][j] = 1;
			}
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (b[i][j] == 1)
				cout << "#";
			else
				cout << ".";
		}
		cout << endl;
	}
	cout << endl;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (c[i][j] == 1)
				cout << "#";
			else
				cout << ".";
		}
		cout << endl;
	}
//	cin >> w;
	return 0;
}

Measured memory_bytes: 3712
#include<stdio.h>
#include<string.h>

typedef struct proces{
  char eee[10];
  int rrr;
  int time;
}def;

int head,n,ta;
def o[100000];

void aaa(def s){
  o[ta]=s;
  ta=(ta+1)%100000;
}

def deq(){
  def sd=o[head];
  head=(head+1)%100000;
  return sd;
}

int min(int k,int l){
  if(k>l) return l;
  else return k;
}

int main(){
  int tasu,i,q,b,sum=0;
  def type;
  scanf("%d %d",&b,&q);
  for(i=1;i<=b;i++){
    scanf("%s",o[i].eee);
    scanf("%d",&o[i].time);
    o[i].rrr=1;
  }
  head=1;
  ta=b+1;
  while(ta != head){
    type=deq();
    tasu=min(q,type.time);
    type.time=type.time-tasu;
    sum=sum+tasu;
    if(type.time>0){
      aaa(type);
    }
    else if(type.rrr==1){
      printf("%s %d\n",type.eee,sum);
      type.rrr=0;
    }
  }
  return 0;
}



Measured memory_bytes: 3664
//#define _GLIBCXX_DEBUG//実行時、何も出なかったらこれを使う
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<numeric>
#include<climits>
#include<limits>//
#include <stdio.h>//

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

int dy[] = {1,0,-1,0,1,-1,-1,1}; //次に行くところ
int dx[] = {0,1,0,-1,1,1,-1,-1}; //上に同じ



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,k;
  cin >> n >> k;
  vector<int> h(n+k+2),dp(n+k+2,INT_MAX);
  for (int i = 0; i < n; i++){
    cin >> h[i];
  }
  dp[0] = 0;
  for (int i = 0; i < n; i++){
    for (int j = 1; j <= k; j++){
      chmin(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
    }
  }

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

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

using namespace std;

struct job {
    int A, B;
    job() : A(0), B(0) {};
    job(int _A, int _B) : A(_A), B(_B) {};

    bool operator < (const job &rhs) const {
        return B < rhs.B;
    }
};


int main() {
    int N; cin >> N;
    vector<job> jobs(N);
    for(int i=0;i<N;i++){
        int A,B; cin >> A >> B;
        jobs[i] = job(A,B);
    }

    sort(jobs.begin(), jobs.end());

    long long sumA = 0l;
    for(int i=0;i<N;i++) {
        sumA += jobs[i].A;
        if(sumA > jobs[i].B) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class A
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var S = Console.ReadLine();
            var vowels = new[] { "a", "e", "i", "o", "u" };
            Console.WriteLine(vowels.Contains(S) ? "vowel" : "consonant");
        }
    }
}


Measured memory_bytes: 26264
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, a, x, res;

signed main() {
	cin >> n;
	rep(i,n) {
		cin >> a;
		if (x<=a) res++;
		chmax(x,a);
	}
	cout << res << endl;
}

Measured memory_bytes: 256
// a.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include <iostream>
#include <vector>
#include <algorithm>

#define MOD (1000000000 + 7)

int main()
{
	int n;
	std::vector< int > diffAbs;
	std::vector< int > count;
	std::vector< int > ansDiffAbs;
	
	
	
	std::cin >> n;
	diffAbs.resize(n);
	count.resize(n, 0);
	ansDiffAbs.resize(n);

	int a;
	for (int i = 0; i < n; ++i ) {
		std::cin >> a;
		diffAbs[i] = a;
		count[a] ++;
	}

	for (int i = 0; i < n; ++i) {
		ansDiffAbs[i] = abs((n-(i+1))-i);
	}

	// 各絶対値の出現回数が正しいか事前チェック.
	// 偶数
	if (n % 2 != 0) {
		// zero ある？
		if ( count[0] != 1 ) {
			std::cout << 0 << std::endl;
			return 0;
		}
	} 

	// 零以外の絶対値は必ず奇数となり出現数は２
	// 1, 3, 5, 7...N
	for (int i = 1; i < n; i += 2) {
		if (count[ansDiffAbs[i]] != 2) {
			std::cout << 0 << std::endl;
			return 0;
		}
	}
	// 組み合わせの数は決まっているのであとは計算で求まる。
	int num = 1;
	for (int i = 0; i < n/2; ++i ) {
		num *= 2;
		num %= MOD;
	}
	std::cout <<  num << std::endl;


	return 0;


}



Measured memory_bytes: 1408