akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
 
public class Main {
 
	void submit() {
	    int[] A = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	    int N = nextInt();
	        out.println(A[N-1]);
	}
 
	void preCalc() {
 
	}
 
	void stress() {
 
	}
 
	void test() {
 
	}
 
	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		preCalc();
		submit();
		//stress();
		//test();
		out.close();
	}
 
	static final Random rng = new Random();
 
	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}
 
	public static void main(String[] args) throws IOException {
		new Main();
	}
 
	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
 
	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}
 
	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
 
	int nextInt() {
		return Integer.parseInt(nextToken());
	}
 
	long nextLong() {
		return Long.parseLong(nextToken());
	}
 
	double nextDouble() {
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 21204
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
  int n, k;
  int h[100000];

  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> h[i];

  int count = 0;

  for (int i = 0; i < n; ++i) {
    if (h[i] >= k) count += 1;
  }

  cout << count << endl;
}


Measured memory_bytes: 640
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Scan()
	cnt, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}

	sc.Scan()
	t, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}

	var tsum int
	taste := make([]int, cnt)
	for i := 1; i <= cnt; i++ {
		taste[i-1] = t + i - 1
		tsum += t + i - 1
	}

	var sbst int
	absmin := tsum
	if absmin < 0 {
		absmin = absmin * -1
	}
	for i := 1; i <= cnt; i++ {
		if taste[i-1] > 0 {
			if absmin > taste[i-1] {
				absmin = taste[i-1]
				sbst = taste[i-1]
			}
		} else {
			if absmin > taste[i-1]*-1 {
				absmin = taste[i-1] * -1
				sbst = taste[i-1]
			}
		}
	}

	if tsum > 0 {
		if sbst > 0 {
			fmt.Println(tsum - sbst)
		} else {
			fmt.Println(tsum + sbst)
		}
	} else {
		if sbst > 0 {
			fmt.Println(tsum + sbst)
		} else {
			fmt.Println(tsum - sbst)
		}
	}

}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
	  Scanner sc = new Scanner(System.in);
	  int A = sc.nextInt();
	  int B = sc.nextInt();
	  int C = sc.nextInt();
	  int x=0;
	  for(int i=1; i<=B;i++) {  //一巡
	    if((A*i)%B==C) {
		    x++;
		    break;
	    }
	  }
	  if(x==1)System.out.print("YES");
	  else System.out.print("NO");
	  sc.close();
    }
}

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

int n;
char c[999][999];
int dx[] = {0,1,0,-1};
int dy[] = {-1,0,1,0};

bool chk(int y, int x){
  if(y > -1 && x > -1 && y < n+2 && x < n+2 && c[y][x] != ' ') return true;
  return false;
}

void solve(int y, int x, int p){

  int py = y + dy[p], px = x + dx[p];
  int pyy = y + dy[p]*3, pxx = x + dx[p]*3;
  
  if(n == 1){ c[y][x] = '#'; return; }
  if(y < 0 || x < 0 || y == n || x == n || c[y][x] != ' ') return;
  for(int i=0;i<4;i++) if(c[py][px] != ' ' && (i+2)%4 != p) return;
  
  c[y][x] = '#';
  
  if((!py || chk(pyy, pxx)) && !p) p++;
  else if((px == n-1 || chk(pyy, pxx)) && p == 1) p++;
  else if((py == n-1 || chk(pyy, pxx)) && p == 2) p++;
  else if((!px || chk(pyy, pxx)) && p == 3) p = 0;
  
  solve(py, px, p);
}

int main(){

  int l;
  cin >> l;
  while(l--){
    memset(c, ' ', sizeof(c));
    cin >> n;
    solve(n-1,0,0);
    for(int i=0;i<n;i++) c[i][n] = '\0', cout << c[i] << endl;
    if(l) cout << endl;
  }
}

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

int main() {
    string t, p;
    cin >> t >> p;
    int n = t.size(), m = p.size();
    for (int i = 0; i < n - m + 1; i++) {
        bool same = true;
        for (int j = 0; j < m; j++) {
            if (t[i + j] != p[j]) {
                same = false;
                break;
            }
        }
        if (same) printf("%d\n", i);
    }
}


Measured memory_bytes: 3280
#include<iostream>
#include<vector>

using namespace std;

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

    int c,t;

    int c_min = 1001;
    for(int i=0;i<n;i++){
        cin >> c >> t;
        if((t <= t_max)&&(c_min > c))c_min = c; 
    }

    if(c_min == 1001)cout << "TLE" << endl;
    else cout << c_min << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.*;
class Main
{
    public static void main(String args[])throws IOException
    {
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	String str=input.readLine();
	for(int i=0;i<str.length();i++)
	    {
		char b=str.charAt(i);
			
		if(('a'<=b) && (b<='z'))
			    System.out.print(Character.toUpperCase(b));
			
		else if(('A'<=b) && (b<='Z'))
			    System.out.print(Character.toLowerCase(b));
		else System.out.print(b);	
			    

		    
		
	    }
	System.out.println();
    }
}

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


#define _fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pi acos(-1)
#define MAXS 1e(18)
#define MOD 1000000007
#define all(v) v.begin(),v.end()

typedef long long ll;

int main()
{

    _fastIO;

    ll x, y;

    while(cin>>x>>y){
        map<ll, ll> mp;
        mp[3] = 100000;
        mp[2] = 200000;
        mp[1] = 300000;
        ll ans=0;
        if(x==1 && y==1){
            ans += 400000;
        }
        ans += mp[x] + mp[y];
        cout<<ans<<endl;
    }

    return 0;
}


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

int main(){
    int n;
    cin >> n;
    cout << 24+(24-n) << endl;
    return 0;
    
}

Measured memory_bytes: 256
N=int(input())
point=[]
merge=0
for num in range(0,N):
    x,y=map(int,input().split())
    point.append([x,y])
p=0
q=0
point.sort()
ans=0
for i in range(0,N-1):
    for j in range(i+1,N):
        p=point[j][0]-point[i][0]
        q=point[j][1]-point[i][1]
        merge=0
        for k in range(0,N):
            if([point[k][0]+p,point[k][1]+q] in point):
                merge+=1
        ans=max(ans,merge)
print(N-ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)
int Min(int a, int b, int c) {
	if (a <= b) { return std::min(a, c); }
	else return std::min(b, c);
}
int main(void) {
	string str; cin >> str;
	if (str.at(0) == '9' || str.at(1) == '9')
		cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  ll N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  REP(m, N) {
    ll mn = A + m * C - (N - 1 - m) * D;
    ll mx = A + m * D - (N - 1 - m) * C;
    if (mn <= B && B <= mx) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
flag = 0
ans = ['a','a','a']
for _ in range(m):
    s, c = map(int,input().split())
    if ans[s+2-n]=='a' or ans[s+2-n]==c:
        ans[s+2-n]=c
    else:
        flag = 1
        
if flag:
    print(-1)
elif n == 3:
    if ans[0]==0:print(-1)
    else:
        if ans[0]=='a':ans[0]=1
        if ans[1]=='a':ans[1]=0
        if ans[2]=='a':ans[2]=0
        print(100*ans[0] + 10*ans[1] + ans[2])
    
elif n ==2:
    if ans[1]==0:print(-1)
    else:
        if ans[1]=='a':ans[1]=1
        if ans[2]=='a':ans[2]=0
        print(10*ans[1] + ans[2])
    
    
else:
    if ans[2]=='a':ans[2]=0
    print(ans[2])

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int H, W,N;
	cin >> H >> W >> N;

	vector<vector<int>> ans(H, vector<int>(W, 0));

	int sum = 0;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;

		int cnt = 0;
		while (cnt < tmp) {
			ans[(sum + cnt) / W][(sum + cnt) % W] = i + 1;
			cnt++;
		}
		sum += tmp;
	}

	for (int i = 1; i < H; i += 2) reverse(ans[i].begin(), ans[i].end());

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cout << ans[i][j] << " ";
		}
		cout << endl;
	}


	return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int N,K;
int ans[21][1<<17];
main()
{
	cin>>N>>K;
	if(K>20)
	{
		cout<<0<<endl;
		return 0;
	}
	for(int i=1;i<=N;i++)ans[0][i]=1;
	for(int i=0;i<K-1;i++)
	{
		for(int j=1;j<=N;j++)
		{
			if(ans[i][j]==0)continue;
			for(int k=j+j;k<=N;k+=j)ans[i+1][k]+=ans[i][j];
		}
	}
	int ret=0;
	for(int i=1;i<=N;i++)ret+=ans[K-1][i];
	cout<<ret<<endl;
}



Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  int sum = 0;
  while(n > 0){
    sum += n%10;
    n /= 10;
  }
  if(sum == 1)sum = 10;
  cout << sum << endl;
}

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

fatigue = 0
for i, x in enumerate(list_x):
  if i > 0:
    if (x - list_x[i - 1]) * a < b:
      fatigue += a * (x - list_x[i - 1])
    else:
      fatigue += b
print(fatigue)

Measured memory_bytes: 15020
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N,L,T = MI()
q,r = T//L,T % L
A = []
a = 0  # 開始時点で、(時計回りの蟻の数)-(半時計まわりの蟻)
for i in range(N):
    x,w = MI()
    a += (-2)*w+3
    for j in range(-1,2):
        A.append(x+r*((-2)*w+3)+j*L)
A.sort()

print(*[A[N+(i+q*a)%N] % L for i in range(N)],sep='\n')


Measured memory_bytes: 94772
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;

  int i = 1;
  while(1){
	int x =i;

	if(x%3==0){
	cout<<" "<<i;
	}
	else {
	  while(1){
		if(x%10==3){
		  cout << " " << i;
		  break;
		}
		x/=10;
		if(x==0) break;
	  }
	}

	if(++i > n) break;


  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
#define ll long long
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vvvl vector<vector<vector<ll> > >
#define vd vector<double>
#define vvd vector<vector<double> >
#define vvvd vector<vector<vector<double> > >
#define mod 1000000007
using namespace std;


int main(void){
    ll n; cin>>n;
    vl a(n+1),b(n);
    for(int i=0;i<n+1;++i) cin>>a[i];
    for(int i=0;i<n;++i) cin>>b[i];
    ll ans = 0;
    for(int i=0;i<n;++i){
        if(b[i] <= a[i]) ans += b[i];
        else{
            ans += a[i];
            b[i] -= a[i];
            if(b[i] <= a[i+1]){
                ans += b[i];
                a[i+1] -= b[i];
            }else{
                ans += a[i+1];
                a[i+1] = 0;
            }
        }
    }cout<<ans<<endl;
}


Measured memory_bytes: 1792
from itertools import permutations

n, m = map(int, input().split())

path = [[False] * n for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    path[a-1][b-1] = True
    path[b-1][a-1] = True

ans = 0
for i in permutations(range(n), n):
    if i[0] == 0:
        for j in range(n):
            if j == n - 1:
                ans += 1
                break
            if not path[i[j]][i[j+1]]:
                break

print(ans)

Measured memory_bytes: 3064
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    i64 n,c,k;
    cin>>n>>c>>k;
    vi64 a(n), d(n);
    i64 cnt=1, bus=1;
    
    forn(i,n)
    {
        cin>>a[i];
        d[i] = a[i] + k;
    }
    
    sort(all(d));
    
    i64 i=0,j=1;
    while(i<n && j<n){
        if((d[j]-d[i]<=k) && cnt<c)
        {  
            j++;
            cnt++;
        }
        else
        {   
            bus++;
            i=j;
            j++;
            cnt=1;
        }
    }
    cout<<bus<<endl;
    return 0;
}



Measured memory_bytes: 4668
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
using namespace std;
using namespace __gnu_pbds;

#define sp << " " <<
#define mod 1000000007
#define PI 3.14159265358979323
#define y second
#define x first
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define pqueue priority_queue< ll >
//#define pdqueue priority_queue< ll,vector<ll> ,greater< ll > >
#define codejamDebug(x) cout<<"Case #"<<x<<": ";
#define debug(x) cout<<"Case "<<x<<": "
#define rep(i,n) for(long long i=0;i<n;i++)
#define f(i,a,b) for(long long i = a; i < b; i++)
#define fd(i,a,b) for(long long i = a; i >=b; i--)
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int           ll;
typedef long double             ld;
typedef unsigned long long int ull;
typedef vector <int>            vi;
typedef vector <ll>            vll;
typedef pair <int, int>        pii;
typedef pair <ll, ll>          pll;
typedef vector < pii >        vpii;
typedef vector < pll >        vpll;
typedef vector <string>         vs;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//Handle:cyber_rajat

int main(int argc, char const *argv[])
{
	sync;
	/*#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif*/
	ll n,l;
	cin>>n>>l;
	ll a[n+5]={0};
	f(i,1,n+1)a[i]=l+i-1;
	sort(a+1,a+n+1);
	ll sum=0;
	f(i,1,n+1)sum+=a[i];
	ll neg=0;
	f(i,1,n+1)if(a[i]<=0)neg++;
	if(neg==0)
	{
		cout<<sum-a[1]<<endl;
		return 0;
	}
	ll poss1=sum-a[neg];
	ll poss2;
	if(neg!=n){
		 poss2=sum-a[neg+1];
	}
	poss1=abs(sum-poss1);
	if(neg!=n)
	{
		poss2=abs(sum-poss1);
	}
	if(neg==n)
		cout<<sum-a[neg]<<endl;
	else
	{
		if(poss1>poss2)
			cout<<sum-a[neg+1]<<endl;
		else
			cout<<sum-a[neg]<<endl;
	}
	return 0;
}


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


int main(void) {
	int n, k, i, ans;

	cin >> n >> k;

	ans = k;
	for (i = 0; i < n - 1; i++) ans *= k - 1;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
A, B = gets.split.map(&:to_i)

def gcd(a, b)
  a, b = b, a if a > b
  until a == 0
    a, b = b%a, a
  end
  return b
end


require "prime"
prime_factorization = Prime.prime_division(gcd(A,B))

divisor = []
prime_factorization.each do |pf|
  divisor << pf[0]
end

ans = divisor.count + 1
p ans

Measured memory_bytes: 4220
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    T=ST()
    E="E" in T
    W="W" in T
    N="N" in T
    S="S" in T
    if(W^E or N^S):
        print("No")
    else:
        print("Yes")
if __name__ == '__main__':
    main()

Measured memory_bytes: 5460
#include<iostream>

using namespace std;

#define N 10001
#define Q 501

int main(){

  int n[N];
  int q[Q];

  int num,num2,i,j,count=0;

  cin >>num;

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

  cin >>num2;
  for(i=0;i<num2;i++){
    cin >>q[i];
  }

  for(i=0;i<num2;i++){
    for(j=0;j<num;j++){
      if(q[i]==n[j]){
	count++;
	break;
      }
    }
  }

  cout <<count<<endl;

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
const int mod=1e9+7;

int64_t f(int64_t x){
  return x*(x+1)/2;
}
int main() {
  int N;
  cin>>N;
  int64_t sum=0;
  for(int64_t i=1;i<=N;i++){
    int x=N/i;
    sum+=i*f(x);
  }
  cout<<sum<<endl;
  return 0;
}


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

		int N = sc.nextInt();
		long[] a = new long[N+1];
		long[] ans = new long[N+1];
		for( int i=1; i<=N; i++ ){
			a[i] = sc.nextLong();
		}
		int b = 1;
		int c = 1;
		if( N%2!=0 ){
			for( int i=N; i>=1; i-=2 ){
				ans[b] = a[i];
				System.out.println(ans[b]+" ");              
				b++;
			}
			for( int i=2; i<=N-1; i+=2 ){
				ans[b] = a[i];
				System.out.println(ans[b]+" ");              
				b++;
			}
		}
		if( N%2==0 ){
			for( int i=N; i>=2; i-=2 ){
				ans[c] = a[i];
				System.out.println(ans[c]+" ");              
				c++;
			}
			for( int i=1; i<=N-1; i+=2 ){
				ans[c] = a[i];
				System.out.println(ans[c]+" ");              
				c++;
			}
		}
	}
}


Measured memory_bytes: 97384
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <functional>
#include <numeric>
using namespace std;
#define rep(p,q) for(int i = p;i < q; i++)

int main(void) {
	string str;
	string input;
	cin >> input;
	str = "CODEFESTIVAL2016";
	int count = 0;
	rep(0,16) {
		if (str[i] != input[i]) count++;
	}
	cout << count << endl;
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
template <class T>
T GCD(T a, T b)
{
    T r;
    while (a)
        r = b, b = a, a = r % a;
    return b;
}
template <class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<ll> vl;
#define ERASE(x) x.erase(unique(ALL(x)), x.end()); // erase same elements
#define VEC(type, c, n)     \
    std::vector<type> c(n); \
    for (auto &i : c)       \
        std::cin >> i;

// input
#define INIT                          \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define VAR(type, ...) \
    type __VA_ARGS__;  \
    MACRO_VAR_Scan(__VA_ARGS__);

// output
template <typename T>
void MACRO_OUT(const T t) { std::cout << t; }

#define OUT(...) MACRO_OUT(__VA_ARGS__);
#define SP std::cout << " ";
#define TAB std::cout << "\t";
#define BR std::cout << "\n";
#define ENDL std::cout << std::endl;

#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
    cout << a;
    ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
    cout << a << ' ';
}

int ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b, c, d, n;
int x, y;
int sum;
char ch;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// cout << (conditon ? (result:  == 1 ): (==0)) << endl; <- output result of if
// long long 型が表せる値の上限はおよそ 9 × 10＾18 です．
int main()
{
    cin >> n >> y;
    vs ss(n);

    rep(i, n) cin >> ss[i];
    sort(ALL(ss));

    rep(i, n) cout << (ss[i]);
    BR;

    return 0;
}


Measured memory_bytes: 3676
import java.util.*;

public class Main{
	static public void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();
		int k=sc.nextInt();
		int kari=0;
		int count=0;
		while(b<=a){
			b*=2;
			count++;
		}
		while(c<=b){
			c*=2;
			count++;
		}
		
		if(count>k)System.out.println("No");
		else System.out.println("Yes");
		sc.close();
		
	}
}

Measured memory_bytes: 35812
import collections
n=int(input())
a=list(map(int,input().split()))
c=0
l=[0]
for i in range(n):
  x=l[i]+a[i]
  l.append(x)
L=collections.Counter(l)
for j in L.values():
  c+=int(j*(j-1)/2)
print(c)


Measured memory_bytes: 41708
import sys
import math


def input():
    return sys.stdin.readline().rstrip()


def main():
    W, H, x, y = map(int, input().split())

    t = H*W
    if W/2 ==x and H/2 ==y:
        print(t/2,1)
    else:
        print(t/2,0)


if __name__ == "__main__":
    main()


Measured memory_bytes: 61944
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

class Combination(object):
	def __init__(self, N, con):
		self.fac = [0] * (N + 1)
		self.inv = [0] * (N + 1)
		self.finv = [0] * (N + 1)
		self.fac[0], self.fac[1] = 1, 1
		self.inv[1] = 1
		self.finv[0], self.finv[1] = 1, 1

		# 前計算
		for i in range(2, N + 1):
			self.fac[i] = self.fac[i - 1] * i % con
			self.inv[i] = self.inv[con % i] * (con - (con // i)) % con
			self.finv[i] = self.finv[i - 1] * self.inv[i] % con

	def com(self, N, k):
		return (self.fac[N] * self.finv[k] * self.finv[N - k]) % con

#処理内容
def main():
	N, K = getlist()
	if K >= N:
		Com = Combination(2 * N - 1, con)
		ans = Com.com(2 * N - 1, N)
		print(ans)

	else:
		Com1 = Combination(N, con)
		Com2 = Combination(N - 1, con)
		ans = 0
		for i in range(1, K + 1):
			ans += Com1.com(N, i) * Com2.com(N - 1, i)
			ans %= con
		ans = (ans + 1) % con
		print(ans)
	
if __name__ == '__main__':
	main()

Measured memory_bytes: 50412
#include <iostream>
#include <algorithm>
#include <map>
#include <regex>
#include <string>
#include <cstdlib>
using namespace std;
int main() {
  int K, S;
  cin >> K >> S;
  int cnt = 0;
  for (int x = 0; x <= K; x++) {
    for (int y = 0; y <= K; y++) {
      if (x + y > S) break;
      if (S - x - y <= K) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

l,r,d = inm()
sm = 0
for i in range(l,r+1):
    if i%d==0:
        sm += 1
print(sm)


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

int a[105];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    int al=0,b=0;
    bool is=false;
    for(int i=n-1;i>=0;i--)
    {
        if(!is)
        {
            al+=a[i];
            is=true;
        }
        else
        {
            b+=a[i];
            is=false;
        }
    }
    cout<<al-b<<endl;
}



Measured memory_bytes: 256
import copy

S=input()
K=int(input())
S=list(S)
n=len(S)
ans=0
j=1

def allsame(str):
    flag = True
    for i in range(len(str)-1):
        if str[i+1]!=str[i]:
            flag=False
            break;
    return flag

if S[0]!=S[n-1]:
    for i in range(n):
        if i==n-1:
            ans += j//2
            break
        if S[i+1]==S[i]:
            j += 1
        else:
            ans += j//2
            j=1
    ans = ans*K
elif allsame(S):
    ans = n*K//2
else:
    i=0
    l=1
    for i in range(n):
        if S[i+1]==S[i]:
            l += 1
        else:
            tempans =l//2
            break;
    T=copy.copy(S)
    T.reverse()
    k=1
    for i in range(n):
        if T[i+1]==T[i]:
            k += 1
        else:
            tempans +=k//2
            break;
        
    for i in range(n-l-k):
        if i==n-l-k-1:
            ans += j//2
            break;
        if S[i+l+1]==S[i+l]:
            j += 1
        else:
            ans += j//2
            j=1
    ans = (ans+(l+k)//2)*K
    ans = ans + tempans -(k+l)//2
    
print(ans)

Measured memory_bytes: 3444
from collections import deque

N, M = map(int, input().split())
g = [[] for _ in range(N)]
e = []
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)
    e.append([a, b])

ans = 0
for i, j in e:
    used = {}
    q = deque([0])
    while q:
        u = q.popleft()
        for v in g[u]:
            if (v in used) or (i == u and j == v) or (i == v and j == u):
                continue
            else:
                q.append(v)
                used[v] = True
    if len(used) < N:
        ans += 1
print(ans)


Measured memory_bytes: 71224
import re
Srd = "".join(reversed(input()))
T = input()
Tr = "".join(reversed(T))
Trd = "".join(["[{}?]".format(x) for x in Tr])

S = "".join(reversed(re.sub(Trd, Tr, Srd, 1))).replace("?", "a")
if S.count(T):
  print(S)
else:
  print("UNRESTORABLE")


Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>

#define INF 100000000

using namespace std;
bool NODE_FLAG[10] = {false}, SIDE_FLAG[30] = {false};
int n, m, ans_count = 0;

pair<int, int> SIDE[30];

//すべてのNODEを通ったかチェック
bool reach_check()
{
    int cnt = 0;
    for (int i = 1; i <= n; i++)
    {
        if (NODE_FLAG[i] == true)
        {
            cnt++;
        }
        //cout << NODE_FLAG[i] << " ";
    }
    //cout << "\n\n";
    if (cnt == n)
    {
        return true;
    }
    return false;
}

void BFS(int E_NODE)
{
    for (int i = 0; i < m; i++)
    {
        //順方向から見
        if (SIDE[i].first == E_NODE && NODE_FLAG[SIDE[i].second] == false && SIDE_FLAG[i] == false)
        {
            //cout << SIDE[i].first << " " << SIDE[i].second << endl;
            SIDE_FLAG[i] = true;
            NODE_FLAG[SIDE[i].second] = true;
            if (!reach_check()) //未到達のNODEがあればBFSへ
            {
                BFS(SIDE[i].second);
            }
            else
            {
                ans_count++;
            }
            NODE_FLAG[SIDE[i].second] = false;
            SIDE_FLAG[i] = false;
        }

        //逆方向から
        else if (SIDE[i].second == E_NODE && NODE_FLAG[SIDE[i].first] == false && SIDE_FLAG[i] == false)
        {
            //cout << SIDE[i].first << " " << SIDE[i].second << endl;
            SIDE_FLAG[i] = true;
            NODE_FLAG[SIDE[i].first] = true;
            if (!reach_check())
            {
                BFS(SIDE[i].first);
            }
            else
            {
                ans_count++;
            }
            NODE_FLAG[SIDE[i].first] = false;
            SIDE_FLAG[i] = false;
        }
    }
}

int main()
{
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        cin >> SIDE[i].first >> SIDE[i].second;
    }
    //cout << "\n";
    NODE_FLAG[1] = true;
    //cout << SIDE[i].first << " " << SIDE[i].second << endl;
    BFS(1);
    cout << ans_count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define ll long long
#define rep(i,n) for (int i = 0; i < (n); i++)

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


  int ans=0;
  int cnt=0;
  int temp=0;
  int c=min(A,B);
  int d=max(A,B);
    vector<int> v;
    for(int i=1;i<=c;i++){
      if(c%i==0 && d%i==0){
        v.push_back(i);
      }
    }

  cout << v[v.size()-K] << endl;
}


Measured memory_bytes: 3576
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	int x;
	cin >> x;
	for (int a = -125; a < 130; a++) {
		for (int b = -130; b < a; b++) {
			if (pow(a, 5) - pow(b, 5) == x) {
				cout << a << " " << b << endl;
				return 0;
			}
		}
	}
	return 0;
}

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


int main()
{
    int i, j ,k, n;
    int b, f, r, v;
    int room[4][3][10];  
   
    for(i=0; i<4; i++)
        for(j=0; j<3; j++)
            for(k=0; k<10; k++)
                room[i][j][k] = 0;


    cin >> n;
    for(i=0; i<n; i++)
    {
        cin >> b >> f >> r >> v;
        room[b-1][f-1][r-1] += v;
    }
   
    for(i=0; i<4; i++)
    {
        for(j=0; j<3; j++)
        {
            for(k=0; k<10; k++)
            {
                cout << " " << room[i][j][k];
            }
            cout << endl;
        }
        if(i<3)
            cout << "####################" << endl;
    }
}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

int N, Y;

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

  cin >> N >> Y;
  REP(i, N + 1) {
    REP(j, N + 1 - i) {
      int z  = N - i - j;
      if (i * 10000 + j * 5000 + z * 1000 == Y) {
	cout << i << " " << j << " " << z << endl;
	return 0;
      }
    }
  }

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

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
void read(int &x)
{
    int f=1;
    x=0;
    char s=getchar();
    while(s<'0'||s>'9')
    {
        if(s=='-')
            f=-1;
        s=getchar();
    }
    while(s>='0'&&s<='9')
    {
        x=x*10+s-'0';
        s=getchar();
    }
    x*=f;
}


int main(){
    int a,b,c,d,k;
    cin>>a>>b>>c>>d>>k;
    int t = (c-a)*60+d-b;
    cout<<t-k;
    return 0;
}

Measured memory_bytes: 3596
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
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 Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 22;
char dn[dm], * di = dn;
char C[10];
int keta = 0;
inline void putint(int X) {
	keta = 0;
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}
inline void putmae() {
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

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


	int N = getint();
	int n = 1 << N;
	int dp1[1 << 18], dp2[1 << 18];
	rep(i, n) {
		dp1[i] = getint();
		dp2[i] = 0;
	}

	rep(k, N) {
		int m = 1 << k;
		int m1 = n - 1 << k;
		int m2 = ~m1;
		for (int p = (n >> 1) - 1; p >= 0; p--) {
			int j = ((p & m1) << 1) + (p & m2);
			int i = j | m;
			int k = min(dp1[i], dp1[j]);
			dp1[i] = max(dp1[i], dp1[j]);
			dp2[i] = max(dp2[i], k);
			dp2[i] = max(dp2[i], dp2[j]);
		}
	}

	int saidai = 0;
	rep1(i, n - 1) {
		if (saidai < dp1[i] + dp2[i]) {
			saidai = dp1[i] + dp2[i];
			putint(saidai);
		}
		else putmae();
	}
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 9216
N,M = list(map(int,input().split()))

if N ==1 and M == 1:
  print(1)
elif min(N,M) == 1 and max(N,M) >= 3:
  print(N*M-2)
elif N == 2 or M == 2:
  print(0)
else:
  print((N-2)*(M-2))

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

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

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

//constexpr lint mod = 998'244'353LL;
constexpr lint Mod = 1000'000'007LL;
constexpr lint Inf = 4'500'000'000'000'000'007LL; //4.5e18+7
constexpr double Pi = 3.141592653589793;

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

void print(string a, string b, bool f) { cout << (f ? a : b) << endl; }

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

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

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

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

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

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

int n;
lint cnt, ans, a[2 * 100010];
int main() {
	cin >> n;
	arrin(a, a + n);

	cnt = a[0];
	rep1(i, n) {
		ans += max((lint)0LL, cnt - a[i]);
		cnt = max(cnt, a[i]);
	}

	cout << ans << endl;
}

Measured memory_bytes: 5152
#include <bits/stdc++.h>
using namespace std;
typedef bool boolean;

const int N = 1e5 + 5;

int n, m;
int a[N];
char s[N];

int uf[N];
int find(int x) {
	return uf[x] == x ? x : (uf[x] = find(uf[x]));
}
void unit(int x, int y) {
	x = find(x), y = find(y);
	if (x ^ y) {
		uf[x] = y;
		a[y] += a[x];
	}
}

int main() {
	scanf("%s", s + 1);
	n = strlen(s + 1);
	scanf("%d", &m);
	for (int i = 1; i <= n; i++) {
		a[i] = s[i] - 'a';
	}
	for (int i = 1; i <= n + 1; i++) {
		uf[i] = i;
	}
	for (int i = n + 1; i; i--) {
		a[i] -= a[i - 1];
	}
	for (int l = 1, r = n; l + 1 < r; l++, r--) {
		unit(l + 1, r);		
	}
	for (int i = 1, l, r; i <= m; i++) {
		scanf("%d%d", &l, &r);
		unit(l, ++r);
	}
	for (int i = 2; i <= n; i++) {
		if (find(i) == i && (a[i] % 26) && find(i) != find(1) && find(i) != find(n + 1)) {
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 1152
// #pragma GCC optimize(3,"Ofast","inline")
// #pragma GCC optimize(2)
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <string>
#include <iostream>
#include <list>
#include <cstdlib>
#include <bitset>
#include <assert.h>
#include <time.h>
#include <iomanip>
// #define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
// char buf[(1 << 21) + 1], * p1 = buf, * p2 = buf;
// #define int long long
#define lowbit(x) (x & (-x))
#define lson root << 1, l, mid
#define rson root << 1 | 1, mid + 1, r
#define pb push_back
typedef unsigned long long ull;
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::vector<ll> VI;
#define rep(i, a, n) for (int i = a; i < n; ++i)
#define SZ(x) ((int)((x).size()))
#define bug puts("BUG")
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
const double eps = 1e-6;
template <class T>
inline void read(T &x)
{
    int sign = 1;char c = getchar();x = 0;
    while (c > '9' || c < '0'){if (c == '-')sign = -1;c = getchar();}
    while (c >= '0' && c <= '9'){x = x * 10 + c - '0';c = getchar();}
    x *= sign;
}
#ifdef LOCAL
    FILE* _INPUT=freopen("input.txt", "r", stdin);
    // FILE* _OUTPUT=freopen("output.txt", "w", stdout);
#endif
using namespace std;
ll dp[20][20][20];
ll w[20][20][20];
int t[20];
int n, m, q;
int a, b, c, d;
ll ans = 0;
void dfs(int cur, int pre,ll res)
{
    if (cur > n)
        return;
    for (int i = pre; i <= m; ++i)
    {
        t[cur] = i;
        for (int j = 1; j < cur; ++j)
        {
            res += w[j][cur][t[cur] - t[j]];
        }
        dfs(cur + 1, i, res);
        if (cur == n)
            ans = max(ans, res);
        for (int j = 1; j < cur; ++j)
        {
            res -= w[j][cur][t[cur] - t[j]];
        }
    }
}

int main()
{
    read(n), read(m), read(q);
    for (int i = 0; i < q; ++i)
    {
        read(a);
        read(b);
        read(c);
        read(d);
        w[a][b][c] = d;
    }
    dfs(1, 1, 0);
    printf("%lld\n", ans);
}

Measured memory_bytes: 3788
<?php
//error_reporting(0);
//$K = trim(fgets(STDIN));
list($x1,$y1,$x2,$y2) = explode(" ",trim(fgets(STDIN)));
//$A = explode(" ",trim(fgets(STDIN)));

$dx = $x2 - $x1;
$dy = $y2 - $y1;
$x = $x2;
$y = $y2;
for($i=0;$i<2;$i++) {
  $tmp = $dy;
  $dy = $dx;
  $dx = $tmp;
  $dx = -$dx;
  $x += $dx;
  $y += $dy;
  printf("%d %d ",$x,$y);
}
printf("\n");


Measured memory_bytes: 3828
#include<cstdio>
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)


int main()
{
    int n;
    cin >> n;
    const long long DEV = pow(10, 9) + 7;
    long long pow = 1;
    FOR(i, 1, n+1){
        pow = (pow * i) % DEV; 
    }
    cout << pow << endl;
    return 0;
} 

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

inline int toInt(string s) {int 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;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define tm first
#define sm second.first
#define dm second.second

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int main(void){
    for(int n, m, res; cin >> n >> m, n; cout << res << endl){
        res = 1;
        
        vi infected(n + 1); infected[1] = 1;
        vector< pair<int, pii> > log(m);
        rep(i, m){
            cin >> log[i].tm >> log[i].sm >> log[i].dm;
        }

        sort(all(log));
        rep(i, m){
            if(infected[log[i].sm])
                infected[log[i].dm] = 1;
        }

        res = count(all(infected), 1);
    }

	return 0;
}

Measured memory_bytes: 1512
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    vint x(N);
    REP(i,N) cin>>x[i];

    vint y=x;
    sort(ALL(y));

    REP(i,N){
        if(x[i]<=y[N/2-1]) cout<<y[N/2]<<endl;
        else cout<<y[N/2-1]<<endl;
    }
}


Measured memory_bytes: 5376
#include<bits/stdc++.h>
#include<string>
#include<cmath>

using namespace std;

#define ll long long int
#define ld long double
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define deb(x) cout<< #x << '=' << x <<endl
#define MOD 1000000007

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

    ll a , b , c , d;
    cin>>a>>b>>c>>d;
    ll ans1 = max(b*d, a*c);
    ll ans2 = max(a*d, b*c);
    cout<<max(ans1,ans2);    
}

Measured memory_bytes: 3688
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
using namespace std;


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

int main(){

    int D, T, S;
    cin >> D >> T >> S;
    if(D/(S*1.0) <= T){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;;
    }

    return 0;
}

Measured memory_bytes: 3632
from collections import Counter
N = int(input())
s =[str(input()) for _ in range(N)]
M = int(input())
t =[str(input()) for _ in range(M)]

#print(Counter(s))
cs = Counter(s)
ct = Counter(t)
for i in cs:
    #print(i,cs[i])
    for j in ct:
        #print(j,ct[j])
        if i == j:
            cs[i]=cs[i]-ct[j]
            
#print(cs)
print(max(0,cs.most_common(1)[0][1]))
    

Measured memory_bytes: 9404
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
 
int main()
{
    int n;
    cin>>n;
    map<string,int>m;int c=0;string s;
  for(int i=0;i<n;i++)
  { cin>>s;
    if(m.count(s)==0)c++;
   m[s]++;
  }
  cout<<c<<endl;
    
}

Measured memory_bytes: 19168
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>

using namespace std;
typedef long long int ll;typedef pair<int, int> P;
const long long mod = 1e9 + 7;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(a) (a).begin(),(a).end()

int main(void) {
	int a, b; cin >> a >> b;
	int x = b - a - 1;
	int sum = (1 + x) * x / 2;
	cout << sum - a << endl;
	return 0;
}

Measured memory_bytes: 256