akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
struct segtree{
    int dat[1048580],n;
    void build(int nn)
    {
        n=1;
        while(n<=nn) n<<=1;
    }
    void update(int k,int a){
        k+=n-1;
        dat[k]+=a;
        while(k>0){
            k=(k-1)/2;
            dat[k]=dat[(k<<1)+1]+dat[(k<<1)+2];
        }
    }
    int query(int l,int r){
        return query(l,r+1,0,0,n);
    }
    int query(int a,int b,int k,int l,int r){
        if(r<=a||b<=l) return 0;
        if(a<=l&&r<=b) return dat[k];
        return query(a,b,(k<<1)+1,l,(l+r)>>1)+query(a,b,(k<<1)+2,(l+r)>>1,r);
    }
}seg;
string s,t;
int n,cnt[30],num[30],poi[30];
ll ans;
vector<int> pos[30];
int calclen(int x,int p1,int p2){
    return abs(x-p1)+abs(n+1-p2);
}
int main()
{
    fastio;
    cin>>s;
    n=s.size();
    seg.build(n);
    s=' '+s;
    t=s;
    rep(i,1,n) cnt[s[i]-97]++;
    int odd=0;
    rep(i,0,25) odd+=(cnt[i]&1);
    if((n%2==0 && odd>0) || (n%2==1 && odd>1) )
    {
        cout<<"-1";
        return 0;
    }
    //rep(i,1,n) pos[s[i]-97].pb(i);
    if(odd){
        int od=0;
        rep(j,0,25)
        if(cnt[j]&1) od=j;
        t[(n+1)/2]=od+97;
    }
    int id=1;
    rep(i,1,n/2){
        while(cnt[s[id]-97]<=1) id++;
        t[i] = t[n+1-i] = s[id];
        cnt[s[id]-97] -= 2;
        id++;
    }
    //rep(i,0,25) pos[i].clear();
    rep(i,1,n) pos[s[i]-97].pb(i);
    //cout<<t.substr(1)<<endl;
    rep(i,1,n){
        int id=pos[t[i]-97][poi[t[i]-97]];
        poi[t[i]-97]++;
        //cout<<i<<' '<<id<<'\n';
        ans+=seg.query(id+1,n);
        seg.update(id,1);
    }
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 3536
from scipy.sparse import*
f=csgraph.floyd_warshall
I=9e9
i=lambda:map(int,input().split())
n,m,l=i()
d=eval('[I]*-~n,'*-~n)
while m:a,b,c=i();d[a][b]=c;m-=1
d=f(d,0)
d[d>l]=I
d[d<I]=1
d=f(d)
q,=i()
d[d>I]=I
while q:s,t=i();print(int(d[s,t]%I)-1);q-=1

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

int A, C, ans = 2e9;
vector<int> RGB(10);
vector<int> RG(10000);
int R, G, B, N;
int ok=0, flag=0;

vector<int> l(10, -1);

int main(){
    cin >> R >> G >> B >> N;
    int tmp;
    for(int i=0; i<=3000; i++){
	for(int j=0; j<=3000; j++){
	    tmp=N-R*i-G*j;
	    if((tmp>=0) && tmp%B==0){
		ok++;		
	    }
	    else if(tmp==0){
		ok++;
	    }
	}
    }
    

    // for(int k=0; k<RGB[2]; k++){
    // 	if(R*i+G*j+B*k==N)
    // 	    ok++;		
    // }


    cout << ok << "\n";
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int[] x = new int[10];
		for(int i = 0; i < 10; i++){
			x[i] = stdIn.nextInt();
		}

		for(int i = 0; i < 3; i++){
			int temp;
			for(int j = i; j < 10; j++){
				temp = x[i];
				if( x[j] > x[i] ){
					x[i] = x[j];
					x[j] = temp;
				}
			}
		}

		for(int i = 0; i < 3; i++){
			System.out.println(x[i]);
		}
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

void solve()
{
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int ans = 0;
	if(k>=0)
	{
		ans += min(k,a);
		k -= a;
	}
	if(k>=0)
	{
		// ans += min(k,b);
		k -= b;
	}
	if(k>=0)
	{
		ans -= min(k,c);
		// k -= a;
	}
	cout<<ans<<endl;
}

int main()
{
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 3676
#include<iostream>
using namespace std;
int main() {
	string a;
	cin >> a;
	if (a=="A"){
		cout << "T" << endl;
	}
	if (a == "T") {
		cout << "A" << endl;
	}
	if (a == "C") {
		cout << "G" << endl;
	}
	if (a == "G") {
		cout << "C" << endl;
	}
	return 0;
}

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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

signed main(){

  int n; cin >> n;

  double p = 0;
  for(int i = 0; i < n; i++){
    double a; cin >> a;
    p += 1 / a;
  }

  printf("%.6f\n",1 / p);

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
    
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define $ ios::sync_with_stdio(0);
//#define int long long int
    
using namespace std;
using namespace __gnu_pbds;
using ll = long long int;
using ii = pair<int, int>;
using vi = vector<int>;
using graph = vector<vi>;
using ordered_mset = tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update>;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
    
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    
const ll mod = 1000000007;
const int INF = 0x3f3f3f3f;
//const ll INFLL = (ll)1e17;
const int MAXN = 3123;
const double pi = 3.14159265359;
const double eps = 0.00000001;

double p[MAXN];
double dp[MAXN][MAXN];

int main() {
    $
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> p[i];
    }
    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        dp[i][0] = dp[i - 1][0] * (1 - p[i]);
    }
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            dp[i][j] = dp[i - 1][j - 1] * p[i] + dp[i - 1][j] * (1 - p[i]);
        }
    }
    double ans = 0;
    for (int i = n/2+1; i <= n; ++i) {
        ans += dp[n][i];
    }
    cout << fixed;
    cout.precision(10);
    cout << ans << '\n';
}


Measured memory_bytes: 73984
#!/usr/bin/env python3


def main():
    N = int(input())
    C = []
    S = []
    F = []
    for i in range(N - 1):
        sa = input().split(' ')
        C.append(int(sa[0]))
        S.append(int(sa[1]))
        F.append(int(sa[2]))

    for i in range(N):
        t = 0
        for j in range(i, N - 1):
            if t <= S[j]:
                t = S[j] + C[j]
            else:
                t = int((t + F[j] - 1) / F[j]) * F[j] + C[j]
        print(t)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<vector>
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int>a;
    for(int i=0;i<n;i++){
        int c;
        cin>>c;
        a.push_back(c);
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]>i&&a[a[i]-1]==i+1){
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 892
#include <iostream>
#include <math.h>
#include <stdio.h>

#define MAX_N 10

typedef long long ll;

using namespace std;

int A[MAX_N];

int main() {
  int N;
  cin >> N;
  ll _a = 1;
  ll res = 0;
  for (int i = 1; i <= N; ++i) {
    int a;
    cin >> a;
    res += _a * (a % 2 + 1) * pow(3, N - i);
    if (a % 2 == 0) {
      _a *= 2;
    }
  }
  printf("%lld\n", res);
}

Measured memory_bytes: 3556
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n;
  cin>>n;
  int f[n][10];int p[n][11];
  for(int i=0;i<n;i++){
    for(int j=0;j<10;j++){
      cin >> f[i][j];
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<11;j++){
      cin >> p[i][j];
    }
  }
  int sum=0;int c[n];int ans=-1000000000;
  for(int i=1;i<(1<<10);i++){
    for(int l=0;l<n;l++) c[l]=0;
    for(int j=0;j<n;j++){
      for(int k=0;k<10;k++){
        if((((1<<k)&i)!=0)&&f[j][k]==1) c[j]++;
      }
    }
    for(int i=0;i<n;i++){
      sum+=p[i][c[i]];
    }
    ans=max(sum,ans);sum=0;
  }
  cout << ans <<endl;
}


Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int a, b, t; readV(a, b, t);
  writeln(t/a*b);
}


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

const int maxn=9;

int n,a,b,c;
int s1[maxn],s2[maxn],s3[maxn];
bool vis[9];

int search(int a[maxn],int b[maxn])
{
	int flag=1;
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=b[i]) flag=0;
	}
	return flag;
}

void dfs(int u)
{
	if(u>n)
	{
		c++;
		if(search(s1,s3)) a=c;
		if(search(s2,s3)) b=c;
		return ;
	}
	for(int i=1;i<=n;i++)
	{
		if(!vis[i])
		{
			s3[u]=i;vis[i]=1;
			dfs(u+1);
			s3[u]=0;vis[i]=0;
		}
	}
}

int main()
{
	while(cin>>n)
	{
	 for(int i=1;i<=n;i++)
	  cin>>s1[i];
	 for(int i=1;i<=n;i++)
	  cin>>s2[i];
 	 dfs(1);
	 if(b>a)
	  printf("%d\n",b-a);
	 else printf("%d\n",a-b);
    }
	 return 0;
}

Measured memory_bytes: 3696
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <sys/time.h>

using namespace std;

void solve(int n, vector<string> s){
    //vector< vector<int> > bin(n vector<int>(26,0));
    vector< vector<int> > bin(26, vector<int>(n+1,0));
    string answer = "";
    for (int i = 0; i < n; i++) {
        while (!s[i].empty()) {
            for (int j = 0; j < 26; j++) {
                if (s[i].back() == 'a'+j) {
                    bin[j][i] += 1;
                    s[i].pop_back();
                    break;
                }
            }
        }
    }
    for (int i = 0; i < 26; i++) {
        bin[i][n] = *min_element(bin[i].begin(), bin[i].end()-1);
        for (int j = 0; j < bin[i][n]; j++) {
            answer.push_back('a' + i);
        }
    }
    cout << answer << endl;
}

int main(){
    struct timeval start,end;
    long long span;
    int n;

    gettimeofday(&start,NULL);
    cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    solve(n, s);
    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    fprintf(stderr,"**Total time: %lld ms\n",span/1000);
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int K = sc.nextInt();
			final String s = sc.next();
			
			if(s.length() <= K) {
				System.out.println(s);
			}else {
				System.out.println(s.substring(0, K) + "...");
			}
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}


Measured memory_bytes: 36604
import sys

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

if N >= M:
    print(0)
    sys.exit()
diff = [0]*(M-1)
for i in range(M-1):
    diff[i] = x[i+1] - x[i]
diff.sort()
ans = sum(diff[:M-N])
print(ans)


Measured memory_bytes: 13960
N = int(input())
a = input().split()
for i in range(N):
    a[i] = int(a[i])
Alice = 0
Bob = 0
a.sort(reverse=True)
for i in range(N):
    if(i%2==0):
        Alice = Alice + a[i]
    else:
        Bob = Bob + a[i]
print(Alice - Bob)

Measured memory_bytes: 3064
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        n = I()
        a = LI()

        l = len(a)
        if l == 1:
            rr.append(a[0]*2)
            break
        r = a[0] * 2
        p = [a[0]]
        for i in range(1,n):
            c = a[i]
            cp = c
            for j in range(i):
                b = a[j]
                bp = p[j]
                t = abs(b-c)
                u = ((b+c)**2 - t**2) ** 0.5
                tp = bp + u
                if cp < tp:
                    cp = tp
            p.append(cp)
            if r < cp + c:
                r = cp + c

        rr.append('{:00.9f}'.format(r))
        break

    return '\n'.join(map(str, rr))


print(main())




Measured memory_bytes: 9136
//#include<bits/stdc++.h>
#include<iostream>
using namespace std;
 
typedef long long ll;
const int N = 200005;

 
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	char c;
	cin>>c;
	c++;
	cout<<c;
	
	return 0;
}


Measured memory_bytes: 256
import Control.Monad
import Control.Applicative

move [a,b,c,d,e,f] o
	| o == 'E' = [d,b,a,f,e,c]
	| o == 'N' = [b,f,c,d,a,e]
	| o == 'S' = [e,a,c,d,f,b]
	| o == 'W' = [c,b,f,a,e,d]

allDicePattern dice = f dice (take 24 $ cycle "EEENNWWS")
	where
		f _ [] = []
		f dice (x:xs) = dice : f (move dice x) xs

solve (x:xs) = if any (`elem` allDicePattern x) xs then "No" else "Yes"

main = getContents >>= putStrLn . solve . map words . tail . lines

Measured memory_bytes: 3736
### constant

INF = Float::INFINITY
DELTA = 1e-11

MIN_X = MIN_Y = 0.0
MAX_X = MAX_Y = 10000.0
MAX_D = 10000.0

### classes

class Pt
  attr_accessor :x, :y

  def initialize() end
  def initialize(x, y) @x = x; @y = y end

  def ==(pt) @x == pt.x && @y == pt.y end
  def +(pt) Pt.new(@x + pt.x, @y + pt.y) end
  def -(pt) Pt.new(@x - pt.x, @y - pt.y) end
  def -@() Pt.new(-@x, -@y) end
  def *(t) Pt.new(@x * t, @y * t) end
  def /(t) Pt.new(@x / t, @y / t) end
  def dot(v) @x * v.x + @y * v.y end
  def cross(v) @x * v.y - @y * v.x end
  def d2() @x * @x + @y * @y end
  def d() Math.sqrt(d2()) end
  def to_s() "(#{@x},#{@y})" end
end

### global variables

### subroutines

def cross_lines(ap, av, bp, bv)
  cr01 = av.cross(bv)
  return nil if cr01 == 0.0

  ab = bp - ap
  cr0 = ab.cross(av)
  cr1 = ab.cross(bv)

  t0 = cr1 / cr01
  t1 = cr0 / cr01

  cl = av * t0 + ap
  #p [ap.to_s, av.to_s, bp.to_s, bv.to_s, cl.to_s]
  cl
end

def convex_cut(cpol, pt, v)
  n = cpol.length
  cpol0 = []

  for i in (0...n)
    cpt0 = cpol[i]
    cr0 = v.cross(cpt0 - pt)
    if cr0 >= 0.0
      cpol0 << cpt0
    end
    
    cpt1 = cpol[(i + 1) % n]
    cr1 = v.cross(cpt1 - pt)
    if cr0 * cr1 < 0.0
      pt = cross_lines(pt, v, cpt0, cpt1 - cpt0)
      cpol0 << pt
    end
  end

  #p cpol0.map{|pt| pt.to_s}; exit
  cpol0
end

### main

$max_conv = [
  Pt.new(MIN_X - 1, MIN_Y - 1), Pt.new(MAX_X + 1, MIN_Y - 1),
  Pt.new(MAX_X + 1, MAX_Y + 1), Pt.new(MIN_X - 1, MAX_Y + 1)
]

loop do
  $n = gets.to_i
  break if $n == 0

  $pts = $n.times.map{Pt.new(*gets.split.map(&:to_f))}
  $pts << $pts.first
  #p $pts.map{|pt| pt.to_s}

  $vecs = (0...$n).map{|i| $pts[i + 1] - $pts[i]}
  $nrvecs = $vecs.map{|v| d = v.d(); Pt.new(-v.y / d, v.x / d)}
  #p $vecs.map{|v| v.to_s}
  #p $nrvecs.map{|v| v.to_s}

  ld = 0.0
  ud = MAX_D 

  while (ud - ld > DELTA)
    md = (ld + ud) / 2

    cpol = $max_conv
    for i in (0...$n)
      cpol = convex_cut(cpol, $pts[i] + $nrvecs[i] * md, $vecs[i])
    end

    if ! cpol.empty?
      ld = md
    else
      ud = md
    end
  end

  d = (ld + ud) / 2
  puts "%.6f" % d
end

Measured memory_bytes: 6152
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void print_YES_NO(bool answer){cout<<(answer?"YES":"NO")<<endl;}
void print_Yes_No(bool answer){cout<<(answer?"Yes":"No")<<endl;}
void print_POSSIBLE_IMPOSSIBLE(bool answer){cout<<(answer?"POSSIBLE":"IMPOSSIBLE")<<endl;}

int s[3005][2];

int main(){
	int x,y;
	int i,j,k;
	for(i=0;cin>>x>>y;i++){
		if(x==0 && y==0)break;
		if(x>y)swap(x,y);
		s[i][0]=x,s[i][1]=y;
	}
	for(j=0;j<i;j++){
		cout<<s[j][0]<<" "<<s[j][1]<<endl;
	}
}



Measured memory_bytes: 3128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template <class S, class T>
ostream& operator<<(ostream& out, const pair<S, T>& o) {
    out << "(" << o.first << "," << o.second << ")";
    return out;
}
template <class T>
ostream& operator<<(ostream& out, const vector<T>& V) {
    for (int i = 0; i < V.size(); i++) {
        out << V[i];
        if (i != V.size() - 1) out << " ";
    }
    return out;
}
template <class T>
ostream& operator<<(ostream& out, const vector<vector<T> >& Mat) {
    for (int i = 0; i < Mat.size(); i++) {
        if (i != 0) out << endl;
        out << Mat[i];
    }
    return out;
}
template <class S, class T>
ostream& operator<<(ostream& out, const map<S, T>& mp) {
    out << "{ ";
    for (auto it = mp.begin(); it != mp.end(); it++) {
        out << it->first << ":" << it->second;
        if (mp.size() - 1 != distance(mp.begin(), it)) out << ", ";
    }
    out << " }";
    return out;
}
template <typename T>
vector<T> make_v(size_t a) {
    return vector<T>(a);
}
template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) {
    for (auto& e : t) fill_v(e, v);
}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template <class Type>
Type solve(Type res = Type()) {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    if (A < B) return "No";
    if (B > D) return "No";
    if (C >= B) return "Yes";

    // B <= A & B <= D & C < B
    /*
        A : A%B /   (A%B + B > C)
        D : D%B増える (B <= D)
    */

    A %= B;
    D %= B;

    // A < B / D < B

    ll GCD = gcd(B,D);
    ll X = B - GCD + (A%GCD);
    if(X > C) return "No";
    else return "Yes";


    return res;
}
int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // solve<ll>(0);
    int T;
    cin >> T;
    while (T--) cout << fixed << setprecision(12) << solve<string>() << endl;
    return 0;
}

Measured memory_bytes: 3568
var
	n,c,NN:int64;
	i,l,r,m,s:Longint;
	a,b:array[1..200000]of Longint;
begin
	read(n);
	for i:=1 to n do begin
		read(a[i]);
		if r<a[i] then r:=a[i];
	end;
	l:=-1;
	while r-l>1 do begin
		for i:=1 to 2*n do b[i]:=0;
		m:=(l+r)div 2;
		s:=n;
		b[s]:=1;
		NN:=0;
		c:=0;
		for i:=1 to n do begin
			if a[i]>m then begin
				inc(s);
				dec(NN,b[s]);
			end else begin
				inc(NN,b[s]);
				dec(s);
			end;
			inc(c,NN);
			inc(b[s]);
		end;
		if c*4>n*(n+1) then r:=m else l:=m;
	end;
	writeln(r);
end.


Measured memory_bytes: 1280
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const ll mod = 100000000000000003;
int ne[200001], he[100001];
char C[1200100];

ll num[500010];
int kazu[500010];
int query(ll n) {
	int n2 = n % 500000 + 1;
	while (num[n2] && num[n2] != n + 1) {
		n2 = n2 * 61 % 500009;
	}
	if (num[n2]) return kazu[n2];
	else return 0;
}
void add(ll n, int b) {
	int n2 = n % 500000 + 1;
	while (num[n2] && num[n2] != n + 1) {
		n2 = n2 * 61 % 500009;
	}
	if (num[n2]) kazu[n2] |= b;
	else {
		num[n2] = n + 1;
		kazu[n2] = b;
	}
}

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


	fread(C, 1, 1200100, stdin);
	char* ci = C, c;
	int N = 0;
	while ((c = *ci++) >= '0') N = N * 10 + c - '0';
	set<pair<int, char*>> ST;
	char* s[200001];
	rep1(i, N) {
		s[i] = ci;
		while (*ci++ >= '0');
		int n = ci - s[i] - 1;	
		if (n <= 100000) {
			ne[i] = he[n];
			he[n] = i;
		}
		else {
			ST.insert(mp(n, s[i]));
		}
	}

	ll kotae = 0;

	for (int M = 1; M <= 100000; M++) {
		for (int p = he[M]; p; p = ne[p]) {
			auto S = s[p];
			int k[26] = {};
			ll are = 0;
			for (int i = M - 1; i >= 1; i--) {
				int tmp = query(are);
				rep(j, 26) if ((tmp >> j & 1)) {
					k[j]++;
				}
				kotae += k[S[i] - 'a'];
				k[S[i] - 'a'] = 0;
				are = (are * 30 + S[i] - 'a' + 1) % mod;
			}

			kotae += k[S[0] - 'a'];
			k[S[0] - 'a'] = 0;

			add(are, 1 << (S[0] - 'a'));
		}
	}
	for (auto p : ST) {
		auto S = p.second;
		int k[26] = {};
		ll are = 0;
		for (int i = p.first - 1; i >= 1; i--) {
			int tmp = query(are);
			rep(j, 26) if ((tmp >> j & 1)) {
				k[j]++;
			}
			kotae += k[S[i] - 'a'];
			k[S[i] - 'a'] = 0;
			are = (are * 30 + S[i] - 'a' + 1) % mod;
		}

		kotae += k[S[0] - 'a'];
		k[S[0] - 'a'] = 0;

		add(are, 1 << (S[0] - 'a'));
	}
	co(kotae);


	Would you please return 0;
}

Measured memory_bytes: 12964
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        String[] split = str.split("");
        int count = 0;
        for (String s : split) {
            if (s.equals("1")) count += 1;
            else continue;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<string>
using namespace std;
int main() {
	string a;
	cin >> a;
	if (a.at(0) == 'S') {
		cout << "Cloudy" << endl;
	}
	else if (a.at(0) == 'C') {
		cout << "Rainy" << endl;
	}
	else if (a.at(0) == 'R') {
		cout << "Sunny" << endl;
	}
}

Measured memory_bytes: 256
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back

#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.x<<','<< P.y<<')';}

signed main()
{
	speed
	int h,w,n;cin>>h>>w>>n;
	int maxi=max(h,w);
	cout<<(n/maxi+((n%maxi)!=0));

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,-1,0};
const int vy[4] = {1,0,0,-1};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define int ll

int n,m;
int a[110000];

void dfs(int u,vector<int> &graph,bool visited[],vector<vector<int> > &g){
  
  if(visited[u]) return;
  visited[u] = true;
  for(int i=0;i<g[u].size();i++){
    dfs(g[u][i],graph,visited,g);
  }
  graph.PB(u);
}

vector<int> tsort(vector<vector<int> >& g){
  vector<int> graph;
  bool visited[110000] = {};
  for(int i=1;i<n+1;i++){
    dfs(i,graph,visited,g);
  }
  reverse(all(graph));
  return graph;
}



signed main(){
  cin>>n>>m;
  vector<vector<int> > v(n+1);


  rep(i,m){
    int a,b;
    cin>>a>>b;
    v[a].PB(b);
  }

  vector<int> w = tsort(v);

  for(int i=0;i<w.size();i++){
    int k = w[i];
    for(int j=0;j<v[k].size();j++){
      a[v[k][j]] = max(a[v[k][j]],a[k]+1);
    }
  }

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

  cout<<ans<<endl;

}

Measured memory_bytes: 10228
"""
---アルゴリズム概要---
a1 ~ anの各スロットに、Mの各素因数をいくつ置くか、という問題。
まずは、Mを素因数分解し、それから重複組み合わせの容量で、各素因数ごとに配分パターンを算出。
それらの配分パターンを素因数間でかけ合わせると、答えとなる。

Mの素因数分解は、試し割り法という最もシンプルな方法で行う。
"""
from collections import Counter
import math
N,M = map(int,input().split())
factors = []
while True:
    if M % 2 == 0:
        M //= 2
        factors.append(2)
    else:
        break
f = 3
while f**2 <= M:
    if M % f == 0:
        M //= f
        factors.append(f)
    else:
        f += 2
if M != 1:
    factors.append(M)

counter = Counter(factors)
ans = 1
for r in counter.values():
    ans *= math.factorial(N+r-1)//(math.factorial(N-1)*math.factorial(r))

print(ans%(10**9+7))

Measured memory_bytes: 114396
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<int,int> P;
typedef struct pair<int,P> P2;

const ll INF=1000000000000000001;
int main() {

	string s;
	cin>>s;
	ll ls=s.length();
	ll t=0;
	ll d[27]={};
	for(int i=0;i<ls;++i){
		int k=s[i]-97;
		d[k]++;
	}
	for(int i=0;i<27;++i)t+=(d[i]*(d[i]-1))/2;
	cout<<((ls-1)*ls)/2+1-t<<endl;
	return 0;
}


Measured memory_bytes: 640
#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 fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e18

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

bool used[26];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin >> s;
	int n = s.size();
	for(int i = 0; i < n; i++){
		if(!used[s[i]-'a']){
			used[s[i]-'a']=1;
		}
		else{
		while(used[s[i]-'a']){
			s[i]++;
		}
		if(s[i]-'a'>26){
			cout << -1;
			return 0;
		}
		else{
			for(int j = 0; j <= i; j++){
				cout << s[j];
			}
			return 0;
		}
		}
	}
	if(n<26){
		for(int i = 0; i < 26; i++){
			if(!used[i]){
				cout << s + char('a'+i);
				return 0;
			}
		}
	}
	else{
		for(int i = 24; i >= 0; i--){
			if(s[i]<s[i+1]){
				int cur = s[i+1];
				for(int j = i+2; j < 26; j++){
					if(s[j]>s[i]){
						cur=min(cur,int(s[j]));
					}
				}
				for(int j = 0; j < i; j++){
					cout << s[j];
				}
				cout << char(cur);
				return 0;
			}
		}
		cout << -1;
	}
	
	return 0;
}


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

using i64 = long long int;

int c[100005]={0}, l[100005]={0};

int lis(int n, int a[]){
    l[0] = a[0];
    int length = 1;
    for(int i=1;i<n;++i)
        if(l[length-1] < a[i])
            l[length++] = a[i];
        else
            *lower_bound(l, l+length-1, a[i]) = a[i];
    return length;
}

int main(){
    int n;
    cin >> n;

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

    cout << lis(n, c) << endl;

    return 0;
}



Measured memory_bytes: 3764
#include<bits/stdc++.h>
//template to keep things straight
 
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define sc(n) scanf("%d",&n)
#define scL(n) scanf("%lld",&n)
 
//#define cinL(n) scanf("%lld",&n)
//#define coutL(n) printf("%lld ",n);
 
#define pr(n) printf("%d\n",n);
#define prL(n) printf("%lld\n",n);
#define newl printf("\n")
//#define mp make_pair
#define pb push_back
#define pf pop_front
#define in insert
#define ll long long 
#define F first
#define S second
//#define MOD 100000000
#define mp make_pair
using namespace std;
#define tv(container, it)  for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define boost  ios::sync_with_stdio(false)//;cin.tie(0)
#define MOD 1000000007
int a[200001];
int main()
{
	int n;
	cin>>n;
	FOR(i,0,n)
	cin>>a[i];

	if(n%2==0)

	{
		for(int i=n-1;i>=0;i-=2)
		{
			cout<<a[i]<<" ";
		}
		for(int i=0;i<n;i+=2)
		{
			cout<<a[i]<<" ";
		}
	}
	else
	{
		for(int i=n-1;i>=0;i-=2)
		{
			cout<<a[i]<<" ";
		}
		for(int i=1;i<n;i+=2)
		{
			cout<<a[i]<<" ";
		}

	}
}
	


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
typedef vector< ii > vii;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef	vector<pair<int,pair<int,int > > > viii;
typedef long long int lli;

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(a) (int)(a.size())

#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define slli(n) scanf("%llid",&n)
#define lldout(n) printf("%llid\n",n)
const int N = (int)1e5 + 10;
//vvi v;
vector<vector<lli> > v;
lli cnt=0;
lli vis[N];
//int vis1[52][52],v[52][52];
int dfs(int t,int p){
	vis[t]=1;
  cnt++;
	//v[i][j]=val;
	rep(i,0,v[t].size()){
    if(v[t][i]==p){return 0;}
		if(vis[v[t][i]]==0){
			dfs(v[t][i],p);
		}
	}
	// if(v[i][j-1]==-1 and vis1[i][j-1]==0 and v[i+1][j-1]!=v[i][j] and v[i][j-2]!=v[i][j] and v[i-1][j-1]!=v[i][j])dfs(i,j-1,val);
	// if(v[i][j+1]==-1 and vis1[i][j+1]==0 and v[i][j+2]!=v[i][j] and v[i+1][j+1]!=v[i][j] and v[i-1][j+1]!=v[i][j])dfs(i,j+1,val);
	// if(v[i-1][j]==-1 and vis1[i-1][j]==0 and v[i-1][j-1]!=v[i][j] and v[i-1][j+1]!=v[i][j] and v[i-2][j]!=v[i][j])dfs(i-1,j,val);
	// if(v[i+1][j]==-1 and vis1[i+1][j]==0 and v[i+2][j]!=v[i][j] and v[i+1][j-1]!=v[i][j] and v[i+1][j+1]!=v[i][j])dfs(i+1,j,val);
	// return 0;
}
lli lcm(lli a,lli b) { return a*(b/__gcd(a,b));}
lli pow(lli x, lli y, lli p) {
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
map<lli,lli> ph;
lli vis1[200005],vis2[200005];
int main(){
  lli n;
	cin>>n;
	lli a[n+5];
	rep(i,0,n){
		cin>>a[i];
	}
	lli g=1;
	rep(i,0,n){
		//g=lcm(g,a[i]);
	}
	g-=1;
	lli ans=0;
	rep(i,0,n){
		ans+=a[i]-1;
	}
	cout<<ans<<endl;
	//cout<<g<<" "<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll n,w[400];
ll dp[500][500];

ll ans(ll i,ll j) {// i <= j
	if(dp[i][j] > -1) {
		return dp[i][j];
	}

	if(j - i <= 1) {
		if(j - i == 1 && abs(w[i] - w[j]) < 2) {
			return dp[i][j] = 2;
		}
		else
			return dp[i][j] = 0;
	}

	if(ans(i + 1,j - 1) == j - i - 1 && abs(w[i] - w[j]) < 2) {
		return dp[i][j] = j - i + 1;
	}

	ll ret = 0;

	REP(k,j - i) {
		ret = max(ret,ans(i,i + k) + ans(i + k + 1,j));
	}
	return dp[i][j] = ret;
}

void solve() {
	REP(i,n) {
		REP(j,n) {
			dp[i][j] = -1;
		}
	}
	cout << ans(0,n - 1) << endl;
}

int main(){
	while(1) {
		cin >> n;
		if(n == 0) 
			break;
		REP(i,n) {
			cin >> w[i];
		}
		solve();
	}
	return 0;
}



Measured memory_bytes: 4248
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
#endif

#ifdef _DEBUG
void init_global_C() {}
#else

#endif

int N, M;
vb visited;
vvb eg;

void dfs(int x) {
    if (visited[x]) return;
    
    visited[x] = true;
    REP(nx, N) {
        if (eg[x][nx] && !visited[nx]) dfs(nx);
    }
}

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

    cin >> N >> M;
    vi a(M), b(M);
    REP(i, M) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }

    eg = vvb(N, vb(N, false));

    REP(i, M) {
        eg[a[i]][b[i]] = true;
        eg[b[i]][a[i]] = true;;
    }

    int ans = 0;

    REP(i, M) {
        eg[a[i]][b[i]] = false;
        eg[b[i]][a[i]] = false;

        // DFS
        visited = vb(N, false);
        dfs(0);

        bool bridge = false;
        REP(x, N){
            if (!visited[x]) {
                bridge = true;
                break;
            }
        }
        if (bridge) ans++;

        eg[a[i]][b[i]] = true;
        eg[b[i]][a[i]] = true;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;

int main(){
  int a,b,c;
  int ans=0;
  cin>>a>>b>>c;
  if(a+b>=c) ans=b+c;
  else{
    ans=(2*b)+a+1;
  }
  cout<<ans<<endl;

  return 0;
}


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

int main() {
  int x, y;
  cin >> x >> y;
  for (int c = 0; c <= x; c++) {
    int t = x-c;
    int asi = c*2+t*4;
    if (asi == y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3612
/*
 * I'm strong. Stronger than all of you. Extremely strong.
 * I can kill all those Titans there. Even if I'm alone.
 * You're either incompetent or you're spineless cowards.
 * How pathetic.
 * You can sit here and suck on your fingers. Yeah, do that.
 * ~ Mikasa Ackerman
 */

#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> II;
typedef vector<II> VII;
typedef vector<int> VI;
typedef vector<VI> VVI;

typedef long long int LL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(), a.end()
#define SET(a, b) memset(a, b, sizeof(a))
#define si(n) scanf("%d", &n)
#define dout(n) printf("%d\n", n)
#define sll(n) scanf("%lld", &n)
#define lldout(n) printf("%lld\n", n)

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
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...);
}
#else
#define trace(...)
#endif

#define fast_io                                                                \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL)

#define endl '\n'

int main() {
  fast_io;
  string x;
  cin >> x;
  for (int i = 0; i < 8; i++) {
    int csum = x[0] - '0';
    string op(1, x[0]);
    for (int j = 0; j < 3; j++) {
      if (i & (1 << j))
        csum += x[j + 1] - '0', op += "+";
      else
        csum -= x[j + 1] - '0', op += "-";
      op += x[j + 1];
    }
    if (csum == 7) {
      op += "=7";
      cout << op << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
int a,b;
int main() {
	cin>>a>>b;
	if((a*b)%2)
		cout<<"Odd"<<endl;
	else
		cout<<"Even"<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n = ni()

ans = 1
for i in range(1, n + 1):
    ans = ans * i % mod
print(ans % mod)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S="";
    cin >>S;
    int N=S.size();
    int flag=0;
    
    for(int i=0;i<(N-1)/2;i++){
        if(S.at(i)!=S.at(N-i-1)){
            flag=1;
        }
    }
    
    
    
    for(int i=0;i<(N-1)/4;i++){
        if(S.at(i)!=S.at((N-1)/2-i-1)){
            flag=1;
        }
    }
    
    for(int i=(N+3)/2+1;i<N;i++){
        if(S.at(i)!=S.at(N-1-i)){
            flag=1;
        }
    }
    
    if(flag==0){
    cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	string s;
	cin >> s;
	int k;
	cin >> k;
	int n = s.size();
	if (s[0] == s[n-1]) {
		bool b = true;
		rep(i,n-1) if (s[i] != s[i+1]) b = false;
		if (b) cout << (ll) n * k / 2 << endl;
		else {
			int x = 1;
			int y = 1;
			rep(i,n-1) {
				if (s[i] == s[i+1]) x++;
				else break;
			}
			for (int i = n-1; i >= 1; i--) {
				if (s[i] == s[i-1]) y++;
				else break;
			}
			int t = 1;
			int z = 0;
			for (int i = 0; i < n; i++) {
				if (s[i] == s[i+1]) t++;
				else {
					z += t / 2;
					t = 1;
				}
			}
			z += t / 2;
			cout << (ll) z * k + (k-1) * (- x/2 - y/2 + (x+y)/2) << endl;
		}
	} else {
		int t = 1;
		ll ans = 0;
		for (int i = 0; i < n; i++) {
			if (s[i] == s[i+1]) t++;
			else {
				ans += t / 2;
				t = 1;
			}
		}
		ans += t / 2;
		cout << ans * k << endl;
	}
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long ll;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
vector<ll> weight;
vector<ll> value;
ll dp[101][100001];
ll solve(int n, int w){
	if(dp[n][w] > -1){
		return dp[n][w];
	}
	if(n == 0){
		if(w - weight[n] >= 0){
			return dp[n][w] = value[n];
		}
		else{
			return dp[n][w] = 0;
		}
	}
	if(w - weight[n] >= 0)
		return dp[n][w] = max(value[n] + solve(n-1, w-weight[n]), solve(n-1, w));
	return dp[n][w] = solve(n-1, w);
}
int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	int n, w;
  	cin >> n >> w;
  	weight.resize(n);
  	value.resize(n);
  	for(int i = 0; i < n; i++){
  		ll w1, v1;
  		cin >> w1 >> v1;
  		weight[i] = w1;
  		value[i] = v1;
  	}
  	for(int i = 0; i < 101; i++){
  		for(int j = 0; j < 100001; j++){
  			dp[i][j] = -1;
  		}
  	}
  	cout << solve(n-1, w) << endl;
	return 0;
}


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



int solution(int* arr , int n , int k){
    
    int* dp = new int[k];
    for(int i=0 ; i<=k ; i++){
        dp[i] = 0;
    }
    
    dp[0] = 0;

    for(int i=1 ; i<=k ; i++){
        bool flag = 0;
        for(int j=0 ; j<n ; j++){
            if(((i-arr[j]) >= 0) && (dp[i-arr[j]] == 0)){
                flag = 1;
                break;
            }
        }
        dp[i] = flag;
    }
    
    return dp[k];
}


int main(){
    int n , k;
    cin>>n>>k;
    int* arr = new int[n];
    for(int i=0 ; i<n ; i++){
        cin>>arr[i];
    }
    
    if(solution(arr , n , k)){
        cout<<"First"<<endl;
    }else{
        cout<<"Second"<<endl;
    }
}

Measured memory_bytes: 640
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    string s; cin >> s;

    int index = 0;
    while (index + 1 < s.size()){
        if (s[index] == s[index + 1]) {
            cout << index + 1 << " " << index + 2 << endl;
            return 0;
        }
        index++;
    }

    index = 0;
    while (index + 2 < s.size()) {
        if (s[index] == s[index + 2]) {
            cout << index + 1 << " " << index + 3 << endl;
            return 0;
        }
        index++;
    }

    cout << "-1 -1" << endl;

}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>

using namespace std;

#define N_MAX 100001
#define INF 1000000001

void solv()
{
	int N; scanf("%d", &N);
	int A[N_MAX], absA[N_MAX];
	bool zero = false;
	long long int sum = 0, minabsA = INF;
	for (int i = 0; i < N; i++){
		int a; scanf("%d", &a);
		A[i] = a;
		absA[i] = abs(a);
		if (0 == a){
			zero = true;
		}
		sum = sum + (long long int)absA[i];
		minabsA = min(minabsA, (long long int)absA[i]);
	}

	long long int ret;
	if (zero){
		ret = sum;
	}
	else{
		for (int i = 0; i < N - 1; i++){
			if (A[i] < 0){
				A[i] = -A[i];
				A[i + 1] = -A[i + 1];
			}
		}
		if (A[N - 1]<0){
			ret = sum - minabsA*2;
		}
		else{
			ret = sum;
		}
	}

	printf("%lld", ret);

	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

Measured memory_bytes: 512
package main

import "fmt"

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

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

func main() {
	const V = 100000 + 5
	var N, W int
	fmt.Scan(&N, &W)

	w := make([]int, N+1)
	v := make([]int, N+1)
	for i := 1; i <= N; i++ {
		fmt.Scan(&w[i], &v[i])
	}

	dp := make([][]int, N+5)
	for i := 0; i <= N; i++ {
		dp[i] = make([]int, V+5)
	}

	for i := 0; i <= N; i++ {
		for j := 0; j <= V; j++ {
			dp[i][j] = W + 1
		}
	}
	dp[0][0] = 0

	for i := 1; i <= N; i++ {
		for j := 0; j <= V; j++ {
			if j-v[i] < 0 {
				dp[i][j] = dp[i-1][j]
				continue
			}
			dp[i][j] = min(dp[i-1][j], dp[i-1][j-v[i]]+w[i])
		}
	}

	var result int
	for i := 0; i <= V; i++ {
		w := dp[N][i]
		if w <= W {
			result = i
		}
	}
	fmt.Println(result)
}

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

bool used[200001];

int main()
{
	int n, m; cin >> n >> m;
	vector<int>e;
	for (int i = 0; i < m; i++) {
		int a; cin >> a;
		e.push_back(a);
	}
	for (int i = e.size() - 1; i >= 0; i--) {
		if (used[e[i]] == false) {
			cout << e[i] << endl;
			used[e[i]] = true;
		}
	}
	for (int i = 1; i <= n; i++) {
		if (used[i] == false) cout << i << endl;
	}

	return 0;
}

Measured memory_bytes: 3588
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: [usize; 3]);

    let max = n.iter().max().unwrap();

    let mut menseki: f64 = 1.0;
    for v in &n {
        if *v == *max {
            continue;
        }
        menseki *= *v as f64;
    }

    println!("{}", menseki / 2.0);
}


Measured memory_bytes: 2180
#include "bits/stdc++.h"
using namespace std;

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(int i=0; i<(n); i++)
#define REPj(n) for(int j=0; j<(n); j++)
#define REPinit(i,a,n) for(int i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(int j=(a); j<(n); j++)

//algorithm
//#define SORT(c) sort((c).begin(),(c).end())

//constant

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/* 
	add utility Algorithm
*/

int main(int argc, char const *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int K;
    cin >> K;

    cout << (int(K / 2) * int((K + 2 - 1)/2)) << endl;

    return 0;
}


Measured memory_bytes: 3640
#include<cstdio>
#include<iostream>
#include<queue>
#include<cstring>
#define N 100010
using namespace std;
struct Dis{
	int x,z;
};
queue<Dis>Q;
int a[N],c[N],d[N],e[N],f[N],num,h[N],n,m,p,q,t,col;
bool bo[N];
struct Edge{
	int p,q,n;
}b[N*2];
void ljb(int p,int q){
	b[++num].n=h[p];
	h[p]=num;
	b[num].p=p;
	b[num].q=q;
}
void Bfs(){
	int x,y,z;
	while(!Q.empty()){
		x=Q.front().x; z=Q.front().z; Q.pop(); 
//		printf("%d %d\n",x,z);
		if(!f[x])f[x]=col;
		if(z<=e[x]||z==0)continue;
		e[x]=z;
		for(int i=h[x];i!=0;i=b[i].n){
			y=b[i].q;
			if(!bo[y]){
				Q.push((Dis){y,z-1});
				bo[y]=1;
			}
		}
	}
}
int main(){
	memset(e,-1,sizeof(e));
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d%d",&p,&q);
		ljb(p,q);
		ljb(q,p);
	}
	scanf("%d",&t);
	for(int i=1;i<=t;i++)scanf("%d%d%d",&a[i],&d[i],&c[i]);
	for(int i=t;i>=1;i--){
		memset(bo,0,sizeof(bo));
		if(e[a[i]]>=d[i])continue;
		col=c[i];
		Q.push((Dis){a[i],d[i]});
		bo[a[i]]=1;
		Bfs();
	}
	for(int i=1;i<=n;i++)printf("%d\n",f[i]);
}

Measured memory_bytes: 5932