akhauriyash/Code-Regression huggingface dataset:
#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--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N, M;
    cin >> N >> M;
    pii p[M];
    rep(i, M){
        int a, b;
        cin >> a >> b;
        a--, b--;
        p[i] = pii(b, a);
    }
    sort(p, p+M);
    int ans = 0, now = 0;
    rep(i, M){
        if(p[i].second >= now){
            ans++;
            now = p[i].first;
        }
    }
    cout << ans << endl;
}

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

int main()
{
  int N;
  cin>>N;
  int arr[N];
    
  for(int i=0;i<N;i++)
  {
    cin>>arr[i];
  }
  
  int sum=0;
  for(int i=0;i<N;i++)
  {
    if(i==N-1)
    {
    	break;
    }
    for(int j=i;j<N;j++)
    {
      if(j==N-1)
      {
      	break;
      }
      sum+=arr[i]*arr[j+1];
    }
  }
  cout<<sum;
}


Measured memory_bytes: 256
a,b,s;
main(e){
	for(;scanf("%d%d",&a,&b),a;){
		e||puts("NA");
		for(e=0,s&&puts(""),s=1;a<=b;a++)
			a%4||a%100==0&&a%400||printf("%d\n",a,e=1);
	}
	exit(0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using llong = long long;

const int INF = 100100100;
const int MOD = 1e9 + 7;

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

    string S;
    cin >> S;

    if (S == "SUN") {
        cout << 7;
    } else if (S == "MON") {
        cout << 6;
    } else if (S == "TUE") {
        cout << 5;
    } else if (S == "WED") {
        cout << 4;
    } else if (S == "THU") {
        cout << 3;
    } else if (S == "FRI") {
        cout << 2;
    } else if (S == "SAT") {
        cout << 1;
    }
    cout << "\n";
    return 0;
}


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

public class Program
{
  public static void Main()
  {
    var n = int.Parse(Console.ReadLine());
    var input = new Dictionary<string, long>();
    long result = 0;

    for (var count = 0; count < n; count++)
    {
      var value = string.Join("", Console.ReadLine().OrderBy(charactor => charactor));
      
      if (input.ContainsKey(value))
      {
        result += input[value];
        input[value]++;
      }
      else
      {
        input.Add(value, 1);
      }
    }

    Console.WriteLine(result);
  }
}


Measured memory_bytes: 31124
from collections import defaultdict, deque
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


a, p = LI()
sums = 3 * a + p
print(sums // 2)


Measured memory_bytes: 3316
#include <stdio.h>
#include <stdlib.h>

int compare_int(const void *a,const void *b){
  return *(long*)a-*(long*)b;
}

int main(void){
  int N,M;
  scanf("%d%d",&N,&M);

  int X[M];
  for(int i = 0;i < M;i++) scanf("%d",&X[i]);

  qsort(X,M,sizeof(int),compare_int);

  M--;
  int gap[M];
  for(int i = 0;i < M;i++){
    gap[i] = X[i+1]-X[i];
  }

  qsort(gap,M,sizeof(int),compare_int);

  long long ans = X[M]-X[0];
  for(int i = M-1;i > M-N && i >= 0;i--){
    ans -= gap[i];
  }

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

  return 0;
}

Measured memory_bytes: 1268
W,H,x,y,r = input().split(" ")
W = int(W)
H = int(H)
x = int(x)
y = int(y)
r = int(r)

outside = False
if x-r < 0:
    outside = True
if y-r < 0:
    outside = True
if x+r > W:
    outside = True
if y+r > H:
    outside = True

if outside:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 5596
a,b=map(int,input().split())


amari=[(a*(a+1)%2019)]
for i in range(a,b):
    for j in range(i+1,b+1):
        x=i%2019
        y=j%2019
        if x==0 or y==0:
            print(0)
            exit()
        elif (x*y)%2019<amari[-1]:
            amari.append((x*y)%2019)

print(amari[-1])

Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a<b){
    printf("a < b\n");
  }else if(a>b){
    printf("a > b\n");
  }else{
    printf("a == b\n");
  }
  
  return 0;
}

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

int main() {
  int A, B;
  string S, T, U;
  cin >> S >> T;
  cin >> A >> B;
  cin >> U;
  if(S == U){
    cout << A-1 << " " << B << endl;
  } else {
    cout << A << " " << B-1 << endl;
  }
}


Measured memory_bytes: 256
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]

tab_sum_0 = [0]
tab_sum_1 = [0]
sum_tmp_0 = 0
sum_tmp_1 = 0
for i in range(N):
    sum_tmp_0 += A[0][i]
    tab_sum_0.append(sum_tmp_0)
    sum_tmp_1 += A[1][i]
    tab_sum_1.append(sum_tmp_1)

ans = 0
for i in range(N):
    ans_tmp = 0
    ans_tmp += tab_sum_0[i + 1] - tab_sum_0[0]
    ans_tmp += tab_sum_1[N] - tab_sum_1[i]
    ans = max(ans, ans_tmp)

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
const ll mod=998244353;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> data_struct;

ll a,b,c,d;
map<ll,ll> mp;

ll dfs(ll n)
{
	if (n==0)
		return 0;
	if(n==1)
		return d;
	if(mp.count(n))
		return mp[n];
	ll mn = (ll)5e18;

	if(d < mn/n)
		mn =min(mn, d*n);

	for(int i=0;i<3;i++)
	{
		ll p= vector<ll>{2,3,5}[i];
		ll q= vector<ll>{a,b,c}[i];
		if(n%p == 0)
		{
			mn = min(mn, q + dfs(n/p));
		}
		else
		{
			ll down = n/p * p;
			mn = min(mn,q + (n-down)*d + dfs(n/p));
			mn = min(mn,q + (down+p-n)*d + dfs(n/p+1));
		}
	}
	return mp[n]=mn;
}

int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n>>a>>b>>c>>d;
		cout<<dfs(n)<<"\n";
		mp.clear();
	}
	return 0;
}

Measured memory_bytes: 4380
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int x = sc.nextInt();
		
		List<Integer> list = new ArrayList<>();
		
		for(int i=0; i<n; i++) {
			list.add(sc.nextInt());
		}
		
		Collections.sort(list);
		
		int count = 0;
		while(x - list.get(count) >= 0) {
			x = x - list.get(count);
			count++;
			if(count == n) {
				if(x != 0) {
					count--;
				}
				break;
			}
		}
		
		System.out.println(count);
	}
	
}


Measured memory_bytes: 21844
import java.util.Scanner;
class Main{
    int W,H,x,y,r;
    public void yatary() {  
        Scanner sc = new Scanner(System.in);
        W = sc.nextInt();
        H = sc.nextInt();
        x = sc.nextInt();
        y = sc.nextInt();
        r = sc.nextInt();
        if(x - r >= 0 && y - r >= 0 ){ 
            if(x + r <= W && y + r <= H){ 
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }else{
            System.out.println("No");
        }
    }
    public static void main(String[] args){  
        new Main().yatary();    
    }
} 

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

using namespace std;

#define all(x) (x).begin(),(x).end()

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;

struct UnionFind {
    vector<int> par;

    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


int main(){

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


    UnionFind ut(n+1);
    for(int i = 0; i < m; ++i){
        int a, b;
        cin >> a >> b;

        ut.unite(a-1, b-1);
    }

    int ans = 0;
    for(int i = 0; i < n; ++i){
        if(!ut.same(0, i)){
            ut.unite(0, i);
            ans ++;
        }
    }

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(), (c).end());
const long long MOD = 1e9 + 7;
typedef long long ll;

int main(){
	vector<int> a(3);
	rep(i, 3)cin >> a[i];
	SORT(a);
	int ans = a[0] + a[1] + a[2] * 10;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
typedef vector<int> vi;
//const int MAX=;

int main(){
	int N;
	cin>>N;
	int L[101];
	int sum=0;
	rep(i,N){
		cin>>L[i];
		sum+=L[i];
	}
	sort(L,L+N);
	sum-=L[N-1];
	if(sum>L[N-1])cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

import numpy as np
import itertools

H,W = map(int,readline().split())
S = (np.frombuffer(read(),dtype='S1')==b'#').reshape(H,-1)[:,:W].astype(np.int64)

# pad_width
p = min(H,W)+1

S = np.pad(S,(p,p),'constant')

def F(S,H,W):
    # L,Uに頂点があって、RDに第3の頂点がある場合。
    # Rは数えずDだけ数えておく
    cnt = 0
    diag = np.zeros((H+p,W+p),np.int64)
    diag[:H,:W] += S[p:-p,p:-p]
    for n in range(1,H+p):
        diag[n,:W] += diag[n-1,1:W+1]
    for n in range(1,p):
        cnt += (S[1+p:H+1+p,1-n+p:W+1-n+p] * S[1-n+p:H+1-n+p,1+p:W+1+p] * (diag[1+n:H+1+n,1:W+1]-diag[1:H+1,1+n:W+1+n])).sum()
    return cnt

x = []
x.append(F(S,H,W))
S = S.T[::-1,:] # 90度回転
x.append(F(S,W,H))
S = S.T[::-1,:] # 90度回転
x.append(F(S,H,W))
S = S.T[::-1,:] # 90度回転
x.append(F(S,W,H))

answer = sum(x)
print(answer)



Measured memory_bytes: 34472
#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)

int main()
{
    int n;
    cin >> n;
    int ans = 0, temp = 0;
    rep(i, n) {
        int p;
        cin >> p;
        if (i == 0) {
            temp = p;
            ans++;            
        }
        else {
            if (temp >= p) {
                temp = p;
                ans++;
            }
        }        
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define rep(i, n) for (int i=0; i<(n); i++)
using namespace std;

static const int N=100;

int main() {
  int M[N][N];
  int n,u,k,v;
  cin>>n;
  rep(i, n) {
    rep(j, n) {
      M[i][j]=0;
    }
  }
  rep(i, n) {
    cin>>u>>k;
    u--; //0オリジンへ変換
    rep(j, k) {
      cin>>v;
      v--; //0オリジンへ変換
      M[u][v]=1;//uとvの辺を張る
    }
  }

  rep(i, n) {
    rep(j, n) {
      if (j) cout<<" ";
      cout<<M[i][j];
    }
    cout<<endl;
  }

  return 0;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	int res =0,c=0;
	for(int i=1;i<=n;i++)
	{
		int x,y;
		cin>>x>>y;
		if(x==y)
			c++;
		else
			c=0;
		res = max(res,c);
	}
	if(res >= 3)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return 0;
}

Measured memory_bytes: 3644
import java.util.*;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer N = Integer.parseInt(scanner.next());
        Integer M = Integer.parseInt(scanner.next());
        Long[] x = new Long[M];
        Long[] d = new Long[M];
        Arrays.fill(d, 0l);

        for (int i = 0; i < M; i++) {
            x[i] = scanner.nextLong();
        }

        Arrays.sort(x);

        for (int i = 0; i < M-1; i++) {
            d[i] = x[i+1] - x[i];
        }
        Arrays.sort(d, Comparator.reverseOrder());

        for (int i = 0; i < N-1; i++) {
            if (M == i) break;
            d[i] = 0l;
        }

        Long sum = Stream.of(d).mapToLong(Long::longValue).sum();
        System.out.println(sum);
    }
}


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

int main(int argc, const char * argv[]) {
    int n;
    
    cin >> n;
    
    vector<int> P(n);
    for (int i = 0; i < n; i++) cin >> P[i];
    
    int ans = 0;
    for (int i = 1; i < n - 1; i++) {
        vector<int> tmp(3);
        tmp[0] = P[i - 1];
        tmp[1] = P[i];
        tmp[2] = P[i + 1];
        sort(tmp.begin(), tmp.end());
        if (tmp[1] == P[i]) {
            ans++;
        }
    }
    
    cout << ans << endl;
    
    return 0;
}

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

int main() {
    using namespace std;
    vector<unsigned long> dp1(10), dp2(100), dp3(1000);
    unsigned long N;
    cin >> N;
    string s;
    cin >> s;
    for(const auto& c : s){
        unsigned long t = c - 48UL;
        for(unsigned long i = 0; i < 100; ++i)dp3[i * 10 + t] |= dp2[i];
        for(unsigned long i = 0; i < 10; ++i)dp2[i * 10 + t] |= dp1[i];
        dp1[t] |= 1;
    }
    cout << accumulate(dp3.begin(), dp3.end(), 0UL) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
using namespace std;

int main(void){
	int A,B,ans=0;
	cin >> A >> B;
        ans=A-1;
        if(B>=A)ans++;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N, K, C;
    string S;
    cin >> N >> K >> C >> S;

    vector<int> front(N, 0), back(N, 0);

    int cnt = 1;
    rep(i, S.size()) {
        if (S[i] == 'o') {
            front[i] = cnt;
            cnt++;
            i += C;
        }
    }

    cnt = 1;
    for (int i = N - 1; i >= 0; i--) {
        if (S[i] == 'o') {
            back[i] = cnt;
            cnt++;
            i -= C;
        }
    }

    rep(i, N) {
        if (back[i] != 0) back[i] = K - back[i] + 1;
    }

    rep(i, N) {
        if (S[i] == 'x' || front[i] == 0) continue;
        if (front[i] == back[i]) cout << i + 1 << endl;
    }
    return 0;
}

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

#define MAX 20
#define INF 10000000

int n;
vector<string> vs;
int lc[MAX][MAX];
int dp[MAX][1<<MAX];

int fuga(string a, string b){
	int asize = a.size(), bsize = b.size();
	
	for(int i = 0, j; i < asize; i++){
		if(a[i] == b[0]){
			bool flag = true;
			for(j = 0; i+j < asize && j < bsize; j++){
				if(a[i+j] != b[j]){
					flag = false;
					break;
				}
			}
			if(flag){
				if(i+bsize <= asize) return -1;
				else return asize-i;
			}
		}
	}
	return 0;
}

void hogehoge(){
	vector<int> del;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(i==j) continue;
			lc[i][j] = fuga(vs[i],vs[j]);
			if(lc[i][j] == -1) del.push_back(j);
		}
	}
	if(del.size()){
		sort(del.begin(), del.end());

		del.erase(unique(del.begin(),del.end()),del.end());
		for(int i = del.size()-1; i >= 0; i--){
			vs.erase(vs.begin()+del[i]);
		}
		n -= (int)del.size();
	}
}


// int hoge(int y,int x){
	// int ma = 0;
	// if(x&(1<<(y-1))) return 0;
	// for(int i = 1; i <= n; i++){
		// if(i==y)continue;
		// // int temp = x&(~(1<<(i-1)));
		// cout<<"+++"<<i<<" "<<y<<" "<<" "<<(x&(~(1<<(y-1))))<<" "<<endl;
		// ma = max(dp[i][x&(~(1<<(y-1)))] + lc[i][y], ma);
	// }
	
	// return ma;
// }

void bitp(int x){
	int bit[100] = {}, count = 0;
	
	for(int count = 0; x; x>>=1) bit[count++] = x%2;
	
	for(int i = 0; i <= 32; i++)cout<<bit[i]; cout<<endl;
}

void hoge(int x){
	
	for(int i = 1; i <= n; i++){
		if(!(x&(1<<(i-1))))continue;
		int ma = 0, temp = x&(~(1<<(i-1)));
		for(int j = 1; j <= n; j++){
			if(!(temp&(1<<(j-1))))continue;
			ma = max(ma, dp[j][temp] + lc[j][i]);
		}
		dp[i][x] = ma;
	}
}

int solve(){
	
	hogehoge();

	hogehoge();
	
	
	// for(int i = 1; i < (1<<n); i++){
		// for(int j = 1; j <= n; j++){
			// dp[j][i] = hoge(j,i);
			// cout<<j<<" "<<i<<" "<<dp[i][j]<<endl;
		// }
	// }
	
	for(int i = 1; i < (1<<n); i++){
		hoge(i);
	}
	
	int size = 0, ans = 0;
	
	for(int i = 1; i <= n; i++){
		ans = max(dp[i][(1<<n)-1], ans);
		size += vs[i].size();
	}
	return size-ans;
}

signed main(){

  while(true){
    cin>>n;

    if(!n) break;
	
	vs.resize(n+1);
	
    for(int i = 1; i <= n; i++){
      cin>>vs[i];
    }
	
	cout<<solve()<<endl;
  }

  return 0;
}



Measured memory_bytes: 4048
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		sc.close();
		
		long ans = calc(B)^calc(A-1);
		
		System.out.println(ans);
		}
	
	static long calc(long a) {
		int N=50;
		
		long ans=0;
		
		//iは桁数（二進数）
		for(int i=0;i<N;i++) {
			//同じ塊('000111'、'000111')が出てくる周期
			long period = 1L<<i+1;
			
			long times = (a+1)/period; //周期の回数 切り捨てでOK
			
			long cnt=0;//1の現れる回数
			
			cnt += times*(period/2);
			
			//周期からはみ出た部分の１の数を加える。
			
			long rem = (a+1)%period;
			
			cnt += Math.max(0, rem-period/2);		
			
			if(cnt%2==1)ans += Math.pow(2, i);
		}
		
		return ans;
	}
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
#ifdef dbg
 #include "./printer.hpp"
#else
 #define dump(x) (void)0
#endif

using namespace std;

inline long  toInt(string s) {long  v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define long long long
long  pw(long  x, long  y){long  ans = 1;for(long  i = 0; i < y; i++){ans = ans * x;}return ans;}
long  factorial(long  x){long  ans = 1; for(int i = 1 ;i < x+1; i++){ans = ans *i;}return ans;}

long  permutation(long  x, long  y){return factorial(x)/factorial(x-y);}

//long combination(long x, long y){long ans = 1;if(y == 0){return 1;}	if(x-y < y){return combination(x,x-y);}for(long i = 0; i < y; i++){	ans *= (x-i);}	for(long i = 0; i < y; i++){ans /= (i+1);	}	

#define MOD 1000000007


int main(){
  long a,b,c;
  cin >> a >> b >> c;
  if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0){
    cout << 0 << endl;
    return 0;
  }

  long ans = min(a*b, b*c);
  ans = min(c*a,ans);
  cout << ans << endl;
  return 0;

 }



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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vst;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;


const ll mod=1e9+7;
const ll inf=1e16; 

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)

ll gcd (ll a, ll b) {
 
  while(a%b){
   ll r=a%b;
    a=b;
    b=r;
  
  }
 
 return b;
}


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

 ll a,b;
  cin >> a >> b;
 
 cout << (a/gcd(a,b))*b << endl; 
  
  
} // main


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

int main(){
  int a,b;
  cin >> a >> b;
  for(int i=1;i<=1000;i++){
    if((i*8/100)==a&&(i*1/10)==b){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 <<endl;
  return 0;
}

Measured memory_bytes: 256
//2020年4月17日現在

#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>
#include <cstdio>
#include <iterator>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }

namespace {
    // printElems(&a[0], &a[n]);　みたいな感じで使う。
    void printElems(const int* begin, const int* end)
    {
        for (const int* p = begin; p != end; ++p) {
            std::cout << *p << ' ';
        }
        std::cout << std::endl;
    }
}

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define FOR(i,j,n) for(int i=j; i < n; i++)
#define souatari(i,j,n) rep1(i,n-1)rep(j,i)
#define souatari1(i,j,n) for(int i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef array<int,3> arr3;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
const ll BIG = 10000000000000000;



int main(){
    ll x;
    cin >> x;
    for(ll a = 0; a<5405; a++){
        for(ll b = -5404; b < 5405; b++){
            if(pow(a,5)-pow(b,5) == x){
                prints(a,b);
                return 0;
            }
        }
    }


	return 0;
}



Measured memory_bytes: 4228
#include <stdio.h>
 
int main(void){
	
	char a[4],b[4],c[4];
	
	scanf("%s\n%s\n%s",&a,&b,&c);
	
	printf("%c%c%c\n",a[0],b[1],c[2]);
	
	return 0;
}

Measured memory_bytes: 128
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

S_counter = Counter(S)

print('AC x {}'.format(S_counter.get('AC', 0)))
print('WA x {}'.format(S_counter.get('WA', 0)))
print('TLE x {}'.format(S_counter.get('TLE', 0)))
print('RE x {}'.format(S_counter.get('RE', 0)))


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

    using namespace std;

    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define FOR(i,a,b) for(int i = (a); i < (b); i++)
    #define rep(i,n) FOR(i,0,n)
    #define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
    #define ITER(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
    #define FILL(a,value) memset(a, value, sizeof(a))

    #define SZ(a) (int)a.size()
    #define ALL(a) a.begin(),a.end()
    #define PB push_back
    #define MP make_pair
    #define in insert
    #define er erase
    #define fs first
    #define sc second


    typedef long long LL;
    typedef vector<int> VI;

    typedef vector<bool> VB;
    typedef vector<LL> VL;
    typedef pair<int,int> PII;
    typedef pair<LL,LL> PLL;
    typedef vector<PII> VPI;
    typedef vector<VL>VVL;
    typedef vector<VI>VVI;
    typedef vector<string>VS;

    typedef vector<vector<PII>> VVPI;
    typedef vector<vector<PLL>> VVPL;



    const double PI = acos(-1.0);
    const int INF = 1000 * 1000 * 1000 + 7;
    const LL LINF = INF * (LL)INF;

    const int MAX = 305;

    const int MAS = 1e5 + 10 ;
    const int MOD = 1000 * 1000 * 1000 + 7;
    const double EPS = 1e-8;
    vector<vector<int >> g(MAS);

    vector<int>tin(MAS),fup(MAS);
    vector<vector<int >> up ;
    vector<vector<int> > g1(MAS);

    VI a (MAS) ;
        LL sum (int l,int r)
        {
            LL s  = 0;
            FOR(i,l,r + 1)
            {
                s+=a[i];
            }
            return s;
        }
        LL dp[401][401];
    int main() {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
      //  freopen("skateboard.in","r",stdin);
      //  freopen("skateboard.out","w",stdout);
       int n;
       cin >> n;
       rep(i,n)
       {
           cin >> a[i];
       }
       RFOR(l,n,0)
       {
           FOR(r,l,n)
           {
               if ( l ==r)
               {
                   dp[l][r] = 0 ;
               }
               else
               {
                   LL s = sum(l,r);
                   dp[l][r] = LINF;
                   for(int i = l ;i <=r - 1 ; i++)
                   {
                       dp[l][r] =min(dp[l][r],dp[l][i] + dp[i +1][r] + s);
                   }
               }
           }
       }
       cout << dp[0][n-1] ;

    }

Measured memory_bytes: 9088
#include <iostream>
#include <string>

int main()
{
	std::string input;
	std::cin >> input;
	for (std::string::const_reverse_iterator i = input.rbegin(); i != input.rend(); ++i) {
		std::cout << *i;
	}
	std::cout << std::endl;

	return 0;
}

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

#define INF 0x3f3f3f3f
#define NINF -0x3f3f3f3f

using namespace std;

typedef pair<int,int> pii;

vector<int> ady[200005];

int main (int argc, char const* argv[])
{
	int n,m;
	scanf("%d %d",&n,&m);
	
	for (int i = 0; i < m; i += 1)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		
		--a; --b;
		
		ady[a].push_back(b);
		ady[b].push_back(a);
	}
	
	bool valid = false;
	for (int dv0 : ady[0])
	{
		for (int dvV : ady[dv0])
		{
			if (dvV == n-1)
			{
				valid = true;
			}
		}
	}
	
	if (valid)
		printf("POSSIBLE\n");
	else
		printf("IMPOSSIBLE\n");
		
	return 0;
}

Measured memory_bytes: 12016
/* ex3_2
   seira3 */

#include<stdio.h>
#include<stdlib.h>

int main(void){
    int number; //変数宣言
    scanf("%d",&number); //numberに入力
    int unit_digit; //numberの一の位
    unit_digit = number % 10; //代入
    if(unit_digit==3){ //numberの一の位が3のとき
        printf("%s\n","bon"); //bonを出力
    }
    else if(unit_digit==0||unit_digit==1||unit_digit==6||unit_digit==8){ //numberの一の位が0,1,6,8のとき
        printf("%s\n","pon"); //ponを出力
    }
    else{ //それ以外の時
        printf("%s\n","hon"); //honを出力
    }
    return 0;
}

Measured memory_bytes: 1620
x = gets.chomp.to_i

if 400 <= x and x < 600
  p 8
elsif 600 <= x and x < 800
  p 7
elsif 800 <= x  and x < 1000
  p 6
elsif 1000 <= x and x < 1200
  p 5
elsif 1200 <= x and x < 1400
  p 4
elsif 1400 <= x and x < 1600
  p 3
elsif 1600 <= x and x < 1800
  p 2
else
  p 1
end


Measured memory_bytes: 14356
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <tr1/unordered_map>
#define mo 1000000007
#define num(x) (x>='0' && x<='9')
typedef unsigned long long ull;
typedef long long ll;
using namespace std::tr1;
using namespace std;
int read(){
    int p=0, q=1;
    char ch=getchar();
    while (!num(ch))
        (ch=='-'?q=-1:0),
        ch=getchar();
    while (num(ch)) p=p*10+ch-'0', ch=getchar();
    return p*q;
}
int power(ll a, int b){
	ll c=1;
	while (b){
		if (b&1) c=c*a%mo;
		a=a*a%mo;
		b>>=1;
	}
	return c;
}
#define N 10000
int n, k, p[N], c[N], l[N], flag[N];
ll ans, f[N];
int main(){
	ans=-1ll*999999999*999999999;
	n=read();k=read();
	for (int i=1;i<=n;i++) p[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	for (int i=1;i<=n;i++)
		if (!flag[i]){
			int ct;
			flag[i]=1;
			l[ct=1]=i;
			f[ct]=c[i];
			for (int j=p[l[ct]];j && !flag[j];j=p[j])
				flag[j]=1,
				l[++ct]=j,
				f[ct]=f[ct-1]+c[j];
			int u=k/ct, v=k%ct;
			for (int j=1;j<=ct;j++){
				for (int p=1;p<=min(ct, k);p++)
					ans=max(ans, f[min(j+p,ct)]-f[j]+f[max(0,p-ct+j)]+f[ct]*((k-p)/ct)*(f[ct]>0));
			}
		}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3800
#include <stdio.h>
#define N 36

typedef struct{
  char design;
  int num;
}card;



int main(){
  int i,j,n,minj,c=0;
  card a[N],b[N],temp;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %c %d",&a[i].design,&a[i].num);
    b[i].design=a[i].design;
    b[i].num=a[i].num;
  }
  //bubblesort
  for(i=0;i<n;i++){
    for(j=n-1;j>=i+1;j--){
      if(a[j].num<a[j-1].num){
	temp=a[j];
	a[j]=a[j-1];
	a[j-1]=temp;
      }
    }
  }
  
  //selectionsort 
   for(i=0;i<n;i++){
     minj=i;
    for(j=i;j<n;j++){
      if (b[j].num < b[minj].num){
	minj=j;
      }
    }
    if(i!=minj){
      temp=b[i];
      b[i]=b[minj];
      b[minj]=temp;
    }
   }
  for(i=0;i<n;i++){
    printf("%c%d",a[i].design,a[i].num);
    if(i<n-1)printf(" ");
  }
  printf("\nStable\n");
  for(i=0;i<n;i++){
    printf("%c%d",b[i].design,b[i].num);
    if(i<n-1)printf(" ");
    if(a[i].design!=b[i].design)c++;
  }
  if(c)printf("\nNot stable\n");
  else printf("\nStable\n");
  
  return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    string s;
    cin >> s;
    int n = s.size();
    int ans = 0;
    int cnt = 0;
    rep(i, n) {
        if(s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C') ++cnt;
        else cnt = 0;
        // cout << s[i] << ' ' << cnt << endl;
        chmax(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int n, a, c=0, r=0;
  cin >> n;
  for(int i=0;i<n;++i) {
    cin >> a;
    if(c+1==a)++c;
    else ++r;
  }
  if(c) cout << r;
  else cout << -1;
}
    

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

bool compare(const int& lhs, const int& rhs) {
	return lhs > rhs;
}

bool comparepair(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) {
	return lhs.second > rhs.second;
}


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

	int a[100010];

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

	std::pair<int, int> pairs[100010];
	for (int i = 0; i < m; ++i) {
		std::cin >> pairs[i].first >> pairs[i].second;
	}

	std::sort(a, a + n, compare);
	std::sort(pairs, pairs + m, comparepair);

	long long int sum = 0;
	int it1 = 0, it2 = 0;
	for (int i = 0; i < n; ++i) {

		if (it2 > m) {
			sum += a[it1];
			++it1;
		}
		else
		{
			if (a[it1] >= pairs[it2].second) {
				sum += a[it1];
				++it1;
			}
			else
			{
				sum += pairs[it2].second;
				--pairs[it2].first;
				if (pairs[it2].first == 0)
					++it2;
			}
		}
	}

	std::cout << sum;
}

Measured memory_bytes: 4736
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using static Input;
using static Util;
class Program
{
    static int N;
    static int K;
    static int[] A;
    static void INPUT()
    {
        N = NextInt();
        K = NextInt();
        A = LineInt();
    }
    static void OUTPUT()
    {
        var d = new int[2001];
        var ans = 0L;
        for (int idx = A.Length - 1; idx >= 0; idx--)
        {
            var n = A[idx];
            d[n]++;

            ans += d.Take(n).Sum();
        }

        var kk = ((long)(K-1)*(K)) / 2 % MOD;

        ans *= K;
        ans %= MOD;
        for (int idx = 0; idx < 2001; idx++)
        {
            ans += ((long)d[idx] * d.Take(idx).Sum() * kk) % MOD;
            ans %= MOD;
        }
        Console.WriteLine(ans);
    }
    static void Main(string[] args)
    {
#if DEBUG  
        TESTINPUT();
#else
        INPUT();
#endif
        OUTPUT();
    }

    static void TESTINPUT()
    {
        N = 2;
        K = 3;
        A = new int[] { 3, 2, 1, 2 };
        K = 998244353;
        A = new int[]{ 10 ,9, 8 ,7 ,5, 6 ,3 ,4 ,2 ,1 };
        //K = 2;
        //A = new int[] { 2, 2000 };
    }
}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{

}




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

int main(){
  
  int s,s1,s2,s3;
  cin >> s;
  s1 = s / 100;
  s2 = s % 100;
  s3 = s2 % 10;
  s2 = s2 / 10;
  
  cout << s1 + s2 + s3 << endl;
}
  

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

# 文字列をリストにすると分解できる
# print(list("python")) ['p', 'y', 't', 'h', 'o', 'n']

ans = 0
for i in range(n+1):
    if a <= sum(list(map(int,list(str(i))))) <= b:
        ans += i
print(ans)


Measured memory_bytes: 3060
import java.math.*;
import java.util.*;
  


public class Main {
	
	
	
	public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        scan.nextLine();
        while(n-->0) {
        	String a=scan.nextLine(),b=scan.nextLine();
        	int dp[][]=new int[1005][1005];
        	int max=0;
        	a=" "+a;
        	b=" "+b;
        	for(int i=1;i<a.length();i++) {
        		for(int j=1;j<b.length();j++) {
        			if(a.charAt(i)!=b.charAt(j)) {
        				dp[i][j]=Math.max(dp[i-1][j],dp[i][j-1]);
        			}else {
        				dp[i][j]=dp[i-1][j-1]+1;
        			}
        			max=Math.max(max, dp[i][j]);
        		}
        		
        	}
        	System.out.println(max);
        }
        
	}
	
	
	
}


Measured memory_bytes: 161900
import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def era(n):
    ret = [1 for i in range(n + 2)]
    for i in range(2, int(math.sqrt(n) +3)):
        if ret[i] != 0:
            for j in range(2, n//i + 1):
                ret[i * j] = 0
    rret = []
    for i, r in enumerate(ret):
        if r == 1 and i != 0:
            rret.append(i)

    return rret


def houjyo(n, m, k, kaijyo):
    # kaburi ... k
    # all ... n
    if k == n:
        return 1
    else:
        # kasanarierabi nck * nokorierabi (m - k)p(n-k) - houjyo(+1)
        ret = nck(n,k,kaijyo) * npk(m-k, n-k, kaijyo) # - (k + 1) * houjyo(n, m, k+1, kaijyo)
        # print(nck(n,k,kaijyo) , npk(m-k, n-k, kaijyo))
        return ret % MOD


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret


def solve():
    n = getN()
    nums = getList()

    ref = [0,0,0]
    ans = 1
    for num in nums:
        tmp = num
        ref.sort()
        if ref[0] == tmp:
            if ref[0] == ref[1]:
                if ref[0] == ref[2]:
                    ans *= 3
                else:
                    ans *= 2
            ref[0] += 1

        elif ref[1] == tmp:
            if ref[1] == ref[2]:
                ans *= 2

            ref[1] += 1
        elif ref[2] == tmp:
            ref[2] += 1
        else:
            print(0)
            return
        ans %= MOD
        # print(ans)

    print(ans)
def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

Measured memory_bytes: 86584
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
int main() {
	int n;
	cin >> n;
	long long res = 0;
	for (int i = 1; i <= n; i++){
		if (i % 3 == 0 or i % 5 == 0) continue;
		res += i;
	}

	cout << res << endl;

}


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

const int MOD = (int)1e9+7;

int main(){
	int N;
	cin >> N;
	vector<int> a(N);
	for(int i=0;i<N;i++)	cin >> a.at(i);

	int ans=0;
	int now=1;
	for(int i=0;i<N;i++){
		if(a.at(i)==now){
			now++;
		}
		else{
			ans++;
		}
	}
	if(ans!=N)	cout << ans << endl;
	else	cout << -1 << endl;

	return 0;
}


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

int main() {
    int A, B, C, K;
    cin >> A >> B >> C >> K;

    int cnt = 0;
    while (A >= B) {
        B *= 2;
        cnt++;
    }
    while (B >= C) {
        C *= 2;
        cnt++;
    }

    if (cnt <= K) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
    v a(5);
    rep(i,5)cin>>a[i];
    int k; cin>>k;
    if(a[4]-a[0]>k)
        cout << ":(" << endl;
    else
        cout << "Yay!" << 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 rep2(i, m, n) for (int i = m; i < n; ++i)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
// vvi data(n, vi(m));
using vll = vector<long long>;
using vvll = vector<vll>;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

ll pow(int x, int y) {
  ll res = 1;
  rep(i, y) {
    res *= (i + 1);
    res %= MOD;
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  cout << pow(1, n) << endl;
}


Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main()
    {
        string[] cin = Console.ReadLine().Split();
        int n = int.Parse(cin[0]);
        int k = int.Parse(cin[1]);
        int[] x = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();

        int ans = int.MaxValue;
        for (int i = 0; i <= n - k; i++)
        {
            ans = Math.Min(ans, Math.Abs(x[i] - x[i + k - 1]) + Math.Abs(x[i]));
            ans = Math.Min(ans, Math.Abs(x[i] - x[i + k - 1]) + Math.Abs(x[i + k - 1]));
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 21728
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
  input!{
    n: i32,
  }
  println!("{}", 48-n);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  string s;
  cin >> s;
  int ans = 0;
  rep(i,s.size()){
    if(s.at(i)=='+'){
      ans++;
    }else{
      ans--;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.14159265358979323
//void quick(int *,long long,long long);
char a[1000000];
int main(){
     
	int b[10000];
	int i,j,k;
	for(i=2;i<1000000;i++)
		a[i]=1;
	b[0]=0;
	k=1;
	i=2;
	while(i*i<1000000){
		b[k]=b[k-1]+i;
		j=i;
		while(i*j<1000000){
			a[i*j]=0;
			j++;
		}
		i++;
		while(a[i]==0)
			i++;
		k++;
	}
	while(i<1000000&&k<10005){
		b[k]=b[k-1]+i;
		i++;
		while(a[i]==0)
			i++;
		k++;
	}
	while(scanf("%d",&i)!=EOF)
		if(i!=0)
			printf("%d\n",b[i]);
		else
			break;
	return 0;
}

Measured memory_bytes: 1612
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto A = new long[](N);
	foreach (i; 0..N)
		A[i] = RD;

	long ans;
	auto index = A.MAKE_IDX;
	foreach (ii, i; index)
	{
		if (ii % 2 != 0) continue;
		if (i % 2 != 0)
			++ans;
	}

	writeln(ans);
	stdout.flush;
	debug readln;
}

Measured memory_bytes: 4860
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;

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

int main(){
    int K;
    long long int ans = 0;
    cin >> K;
    for (int i = 1; i < K+1; i++) {
        for (int j = 1; j < K+1; j++) {
            for (int k = 1; k < K+1; k++) {
                int tmp = gcd(i, j);
                ans += gcd(tmp, k);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    ll C;
    cin>>N>>C;
    mat D(C,vec(C)), c(N,vec(N));
    rep(i,C) rep(j,C) cin>>D[i][j];
    mat line(3,vec(C,0));
    rep(i,N) {
        rep(j,N) {
            cin>>c[i][j];
            --c[i][j];
            ++line[(i+j)%3][c[i][j]];
        }
    }
    ll ans = 1e+9;
    rep(i,C){
        rep(j,C){
            if(j == i) continue;
            rep(k,C){
                if((k == j) || (k == i)) continue;
                ll temp = 0;
                rep(l,3){
                    vec V = line[l];
                    rep(m,C){
                        if(l == 0){
                            temp += D[m][i] * V[m];
                        }else if(l == 1){
                            temp += D[m][j] * V[m];
                        }else{
                            temp += D[m][k] * V[m];
                        }
                    }
                }
                ans = min(ans,temp);
                //cout<<i<<' '<<j<<' '<<k<<' '<<temp<<endl;
            }
        }
    }
    cout<<ans<<endl;
}


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

using namespace std;

#define ll long long
#define MOD 1000000007

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

    int n,k;
    cin>>n>>k;

    int ar[n];
    for (int i = 0; i < n; ++i)
    {
        cin>>ar[i];
    }

    vector<int> dp(n,INFINITY);
    dp[0] = 0;

    for(int i=0;i<n;i++){
        for(int j=i+1;j<=i+k;j++)
            if(j<n)
                dp[j] = min(dp[j], dp[i]+abs(ar[i]-ar[j]));
    }
    cout<<dp[n-1];

    return 0;
}

Measured memory_bytes: 1024
import sys

S = input()
alphabets = 'abcdefghijklmnopqrstuvwxyz'
seen = set(list(S))

if len(S) < 26:
    for c in alphabets:
        if c not in seen:
            print(S + c)
            sys.exit()

for i in range(len(S)):
    t = S[-1-i]
    if t != 'z':
        for t_dash in alphabets[alphabets.find(t)+1:]:
            if t_dash not in seen:
                print(S[:-1-i] + t_dash)
                sys.exit()
    seen.remove(t)

print('-1')

Measured memory_bytes: 3064
from operator import itemgetter

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

a = []
b = []

for i in range(M):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

st = sorted([(a[i],b[i]) for i in range(M)], key=itemgetter(1))

ans = 0
last = -10000000

for i in range(M):
    if last <= st[i][0]:
        ans += 1
        last = st[i][1]
print(ans)

Measured memory_bytes: 20604