akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <cassert>
#include <stack> 

#define INFLL 2000000000000000000
#define INF 2000000000
#define MOD 1000000007
#define PI acos(-1.0)
#define MAXLEN 29

typedef std::pair <int, int> pii;
typedef long long ll;
typedef std::vector <ll> vll;

using namespace std;

ll arr[100000];
int k;

int main() {
	//freopen("greedy.in", "r", stdin);
	//freopen("greedy.out", "w", stdout);	
	cin >> k;
	for (int i = 0; i < k; i++) cin >> arr[i];
	ll mini = 2, maxi = 2;
	if (arr[k - 1] != 2) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = k - 1; i >= 0; i--) {
		mini = (mini + arr[i] - 1) / arr[i] * arr[i];
		maxi = maxi / arr[i] * arr[i] + arr[i] - 1;
		if (mini > maxi) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << mini << " " << maxi << endl;
	return 0;
}

Measured memory_bytes: 1024
<?php
list($A, $B, $H, $M) = array_map(function ($n) {
    return (int)$n;
}, explode(' ', fgets(STDIN)));

$long_omega = 0.5;
$short_omega = 6.0;

$min = $H * 60 + $M;
$long_angle = $long_omega * $min;
$short_angle = $short_omega * $min % 360.0;

$angle = abs($long_angle - $short_angle);

echo sqrt($A * $A + $B * $B - 2 * $A * $B * cos(2 * pi() * ($angle / 360.0)));


Measured memory_bytes: 16524
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;
typedef long long ll;  /* 10^18 くらいまでいける */

int main(){
  char b;
  cin >> b;
  if (b=='A')
    cout << 'T' << endl;
  else if (b=='T')
    cout << 'A' << endl;
  else if(b=='C')
    cout << 'G' << endl;
  else if (b=='G')
    cout << 'C' << endl;

  return 0;
}

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

namespace Contest_01_Valeo_P5
{
    class Program
    {

        static void Main(string[] args)
        {
            //while (true)
            //{
            //    Console.WriteLine("start problem");
                string input = Console.ReadLine();
                long n = long.Parse(input.Split(' ')[0]);
                input = Console.ReadLine();

                string[] a_string = input.Split(' ');
                List<long> p = new List<long>();
                a_string.ToList().ForEach(x => p.Add(long.Parse(x)));
                long result = getNumberOfIntegers(n, p);
                Console.WriteLine(result);
            //    Console.Write("press y to exit : ");
            //    if (Console.ReadLine() == "y")
            //        return;
            //}
        }

        /// <summary>
        /// in session 
        /// </summary>
        /// <param name="n"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        private static long getNumberOfIntegers(long n, List<long> p)
        {
            long count = 1;
            long minimum = p[0];
            for (int i = 1; i < p.Count; i++)
            {
                if(p[i] < minimum)
                {
                    minimum = p[i];
                    count++;
                }
            }
            return count;
        }
        
    }
}


Measured memory_bytes: 36956
#include<bits/stdc++.h>
using namespace std;
struct poi{
    int time;
    int zt;
}a[100010];
vector<int> l[100010];
int n;
void bfs(int x,int fa,int head,int len){
    for(int i=0;i<l[x].size();i++){
        if(l[x][i]!=fa){
                if(a[l[x][i]].time==1000010){
                    a[l[x][i]].time=len;
                    a[l[x][i]].zt=head;
                    bfs(l[x][i],x,head,len+1);
                }
                else if(a[l[x][i]].time>len){
                    a[l[x][i]].time=len;
                    a[l[x][i]].zt=head;
                    bfs(l[x][i],x,head,len+1);
                }
        }
    }
    return ;
}
int main(){

    scanf("%d",&n);
    for(int i=0;i<n-1;i++){
        int tempa,tempb;
        scanf("%d%d",&tempa,&tempb);
        l[tempa].push_back(tempb);
        l[tempb].push_back(tempa);
    }
    for(int i=1;i<=n;i++){
        a[i].time=1000010;
    }

    bfs(1,-1,1,1);
    bfs(n,-1,n,1);
    int temp1=0;
    int temp2=0;
    for(int i=2;i<n;i++){
     
        if(a[i].zt==1)
            temp1++;
        if(a[i].zt==n)
            temp2++;
    }
    if(temp1>temp2){
        printf("Fennec\n");

    }
    else
        printf("Snuke\n");

}


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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++)

#define F first
#define S second

typedef pair<li, li> PI;
map<PI, li> cnt;

int main(void)
{
	li n;
	cin>>n;
	string s;
	cin>>s;
	li res=0;
	rep(i,s.size() - 2) {
		if(s.substr(i,3)=="ABC"){
			res++;
		}
	}
	cout<<res<<endl;


	return 0;
}

Measured memory_bytes: 3560
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int n, m, x; cin >> n >> m >> x;
  vector<int> a(m); rep(i, m) cin >> a[i];

  int suml = 0, sumr = 0;
  for (int i = 0; i < m; i++) {
    if (x < a[i]) sumr++;
    else suml++;
  }
  // debug2(suml, sumr);
  outl(min(suml, sumr));
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 256
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();

        sc.close();

        if (b - a == c - b) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 21844
buildings = [[[0 for room in range(10)] for floor in range(3)] for building in range(4)]

n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    buildings[b - 1][f - 1][r - 1] += v

for i in range(4):
    for floor in buildings[i]:
        print("".join(map("{:2}".format, floor)))
    if i != 3:
        print("#" * 20)



Measured memory_bytes: 5620
#include<stdio.h>
#include<math.h>
int A[10000];

int main(){
    int num=0, length, i, j, sq, flag;

    scanf("%d", &length);
    for(i=0; i<length; i++){
        scanf("%d",&A[i]);
    }

    for(i=0; i<length; i++){
        flag = 0;
        sq = (int)sqrt(A[i]);
        for(j=2; j<=sq; j++){
            if((A[i]%j) == 0){
                flag = 1;
                break;
            }
        }

        if(!flag)num++;
    }

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


    return 0;
}

Measured memory_bytes: 628
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

void solve(long N)
{
    if(N%2==1 || N<10){
        std::cout << 0 << std::endl;
    }else{
        double temp1 = log(N/2);
        double temp2 = log(5);
        long keta = std::floor(temp1/temp2);
        long result=0;
        for(long i=1;i<=keta; i++){
            long temp=(long)N/(long(std::pow(5,i)*2));
            result+=temp;
        }
        std::cout << result << std::endl;
    }
}


int main()
{
    long N;
    std::cin >> N;
    solve(N);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A; cin >> A;
  int B; cin >> B;
  if(A >= 13){
    cout << B << endl;
  }else if(A >= 6){
    cout << B / 2 << endl;
  }else{
    cout << 0 << endl;
  }
}

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

using namespace std;

int tab[1007];

int main()
{
    int n, i, k, w=0;
    cin >> n >> k;
    for(i=0; i<n; i++){
        cin >> tab[i];
    }
    sort(tab, tab+n);
    for(i=0; i<k; i++){
        w+=tab[i];
    }
    cout << w << '\n';
    return 0;
}


Measured memory_bytes: 3632
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# DP[0, 0], Aの数、ABの数、ABCの数
MOD = 10 ** 9 + 7
S = sr()
dp = [0, 0, 0]
total = 1
for s in S:
    if s == 'A':
        dp[0] += total
    elif s == 'B':
        dp[1] += dp[0]
    elif s == 'C':
        dp[2] += dp[1]
    elif s == '?':
        dp[2] = dp[2]*3 + dp[1]
        dp[1] = dp[1]*3 + dp[0]
        dp[0] = dp[0]*3 + total
        total *= 3
    total %= MOD; dp[0] %= MOD; dp[1] %= MOD; dp[2] %= MOD
    #print(dp, total)

answer = dp[2] % MOD
print(answer)


Measured memory_bytes: 40688
'use strict'

function main(s) {

  s = s.split('\n')[0].split(' ').map(n => Number(n));

  const a = s[0];
  const b = s[1];

  const set1 = new Set([1, 3, 5, 7, 8, 10, 12]);
  const set2 = new Set([4, 6, 9, 11]);
  const set3 = new Set([2]);

  const has1 = set1.has(a) && set1.has(b);
  const has2 = set2.has(a) && set2.has(b);
  const has3 = set3.has(a) && set3.has(b);

  const ans = (has1 || has2 || has3) ? 'Yes' : 'No';

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
n, k = map(int, input().split())
s = input()

m = []

cnt = 1
for i in range(n-1):
    if(s[i] != s[i+1]):
        m.append(cnt)
        cnt = 1
    else:
        cnt += 1

m.append(cnt)

sums = []

ans = 0

l = 0
r = 0
turn = 0

sums.append(0)
for i in range(len(m)):
    sums.append(sums[i] + m[i])

if(2*k + 1 >= len(m)):
    ans = n - 1
else:
    for i in range(len(m) - (2 * k + 1)):
        ansi = 0
        ansi += sums[i] - sums[0] - i
        ansi += sums[len(m)] - sums[i+2*k+1] - (len(m) - (2 * k + 1))
        ansi += sums[i+2*k+1] - sums[i] - 1
        ans = max(ans, ansi)
print(ans)


Measured memory_bytes: 7932
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{

    int N;
    cin >> N;
    string s;
    cin >> s;
    int r = 0,b = 0;
    rep(i,N){
        if(s[i] == 'R') r++;
        else b++;
    }
    
    r>b ? cyes:cno;
    
    

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    char[] S = scanner.next().toCharArray();
    BinaryIndexTree[] trees = new BinaryIndexTree[26];
    for (int i = 0; i < 26; i++) trees[i] = new BinaryIndexTree(N);
    for (int i = 1; i <= N; i++) {
      trees[S[i - 1] - 'a'].add(i, 1);
    }

    int Q = scanner.nextInt();
    for (int i = 0; i < Q; i++) {
      int type = scanner.nextInt();
      switch (type) {
        case 1:
          int idx = scanner.nextInt();
          char ch = scanner.next().charAt(0);
          trees[S[idx - 1] - 'a'].add(idx, -1);
          trees[ch - 'a'].add(idx, 1);
          S[idx - 1] = ch;
          break;
        case 2:
          int l = scanner.nextInt();
          int r = scanner.nextInt();
          int count = 0;
          for (int j = 0; j < 26; j++) {
            int f = trees[j].compute(r) - trees[j].compute(l - 1);
            if (f > 0) count++;
          }
          System.out.println(count);
          break;
      }
    }
  }

  public static class BinaryIndexTree {
    private final int[] a;

    public BinaryIndexTree(int size) {
      a = new int[size + 1];
    }

    public int compute(int index) {
      int res = 0;
      while (index > 0) {
        res += a[index];
        index -= index & -index;
      }
      return res;
    }

    public void add(int index, int value) {
      while (index < a.length) {
        a[index] += value;
        index += index & -index;
      }
    }
  }
}


Measured memory_bytes: 133788
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	priority_queue<double,vector<double>,greater<double> > qu1;
	for(int i=0;i<n;i++){
		double a;
		scanf("%lf",&a);
		qu1.push(a);
	}
	double t1;
	while(1){
		t1=qu1.top();
		qu1.pop();
		if(qu1.empty()){
			break;
		}
		double t2=qu1.top();
		qu1.pop();
		double t3=(t1+t2)/2;
		//cout<<t1<<" "<<t2<<" "<<t3<<endl;
		qu1.push(t3); 
	}
	printf("%lf",t1);
}
/*

*/

Measured memory_bytes: 256
X = int(input())

if X < 600:
    print(8)
elif X < 800:
    print(7)
elif X < 1000:
    print(6)
elif X < 1200:
    print(5)
elif X < 1400:
    print(4)
elif X < 1600:
    print(3)
elif X < 1800:
    print(2)
elif X < 2000:
    print(1)


Measured memory_bytes: 9172
import java.util.*;
import java.io.*;
public class Main {
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    long mod = 998244353;
    List<Integer>[] tree;
    ArrayList<Integer> ans;
    public static void main(String[] args) throws Exception {
        Main main = new Main();
        // int t = sc.nextInt();
        int t= 1;
        while(t-->0){
            out.println(main.solve());
        }
        out.flush();
    }
    long solve() throws Exception{
        int H = sc.nextInt(), W = sc.nextInt(), K = sc.nextInt();
        long[][] rec = new long[H+1][W+1];
        long[][] rowMax = new long[H+1][W+1];
        for(int i=0; i<K; i++){
            int r = sc.nextInt(), c = sc.nextInt(), v = sc.nextInt();
            rec[r][c] = v;
        }
        long[][][] res = new long[H+1][W+1][4];
        for(int i=1; i<=H;i++){
            for(int j=1;j<=W;j++){
                long maxi = 0;
                for(int k=0; k<4;k++) maxi = Math.max(maxi, res[i-1][j][k]);
                res[i][j][0] = maxi;
                for(int k=1; k<4;k++) res[i][j][k] = res[i][j-1][k];
                if(rec[i][j]!=0){
                    // another possibility
                    res[i][j][1] = Math.max(res[i][j][1], res[i][j][0]+rec[i][j]);
                    res[i][j][2] = Math.max(res[i][j][2], res[i][j-1][1]+rec[i][j]);
                    res[i][j][3] = Math.max(res[i][j][3], res[i][j-1][2]+rec[i][j]);
                }
            }
        }
        long ans = 0;
        for(int i=0; i<4;i++) ans = Math.max(ans, res[H][W][i]);
        return ans;
    }
    int paIn(String s){return Integer.parseInt(s);}
}

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

ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x; }

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

  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  ll ans = a[0];
  for(int i = 1; i < n; ++i) {
    ans = gcd(ans, a[i]);
  }
  cout << ans << '\n';
  return 0;
}


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

#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    int n;
    cin >> n;

    int at = 1;
    int ans = 0;
    int ant = 0;
    fo(i, n) {
        int a;
        cin >> a;
        if ( a == at ) {
            at++;
            ans += i - ant;
            ant = i + 1;
        } else if ( i == n - 1 ) {
            ans += n - ant;
        }
    }

    cout << (ans == n ? -1 : ans) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

const int INF = 123456789;

int m, n;
int p[10000];
int c[500], e[500];

int dp[10001];
int ndp[10001];

int main(void)
{
	scanf("%d %d",&m,&n);
	for (int i = 0; i < m; ++i)scanf("%d", p + i);
	for (int j = 0; j < n; ++j)scanf("%d %d", c + j, e + j);
	sort(p, p + m, [](int a, int b) {return a > b; });
	for (int i = 1; i < m; ++i)p[i] += p[i - 1];
	fill(dp, dp + m + 1, INF);
	fill(ndp, ndp + m + 1, INF);
	dp[0] = 0;
	for (int j = 0; j < n; ++j)
	{
		int cap = c[j]; int exp = e[j];
		for (int i = 0; i <= m; ++i)
		{
			ndp[i] = dp[i];
			if (i - cap >= 0)
			{
				ndp[i] = min(ndp[i], dp[i - cap] + exp);
			}
		}
		if (cap > m)
		{
			ndp[m] = min(ndp[m],dp[0] + exp);
		}
		for (int i = m; i >= 0; --i)
		{
			if (i != 0 && ndp[i - 1] > ndp[i])
			{
				ndp[i - 1] = ndp[i];
			}
			dp[i] = ndp[i];
		}
	}
	int answer = 0;
	for (int i = 1; i <= m; ++i)
	{
		answer = max(answer, p[i - 1] - dp[i]);
	}
	printf("%d\n", answer);
	return 0;
}

Measured memory_bytes: 2888
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray();

        Scanner scan = new Scanner(System.in);

        long n = scan.nextLong();

        StringBuilder name = new StringBuilder();
        int surplus;
        for (; n > 0; n = (n - 1) / 26) {
            surplus = (int) ((n - 1) % 26);
            name.append(alphabet[surplus]);
        }

        System.out.println(name.reverse().toString());
    }
}

Measured memory_bytes: 35568
program digits_parade
  implicit none
  integer(8), parameter :: md = 1000000007_8
  character(100000) :: s
  integer :: n, i, j, k
  integer(8) :: dp(0:100000,0:12) = 0_8
  read(*,*) s
  s = trim(adjustl(s))
  n = len_trim(s)
  dp(0,0) = 1_8
  do i = 1, n
    if (s(i:i) == "?") then
      do k = 0, 9
        do j = 0, 12
          dp(i,mod(10*j+k,13)) = mod(dp(i,mod(10*j+k,13))+dp(i-1,j),md)
        end do
      end do
    else
      k = ichar(s(i:i))-48
      do j = 0, 12
        dp(i,mod(10*j+k,13)) = dp(i-1,j)
      end do
    end if
  end do
  write(*,'(i0)') dp(n,5)
  stop
end program digits_parade

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

import sys

lst = list(map(int, input().split()))

a_value = lst[0]
b_value = lst[1]
c_value = lst[2]
a_number = lst[3]
b_number = lst[4]

value = 0

if a_value + b_value <= c_value * 2:
    value = a_value * a_number + b_value * b_number
    print (value)
else:
    if a_number >= b_number:
        value += c_value * 2 * b_number
        if (a_number - b_number) * a_value >= (a_number - b_number) * c_value * 2:
            value += (a_number - b_number) * c_value * 2
        else:
            value += (a_number - b_number) * a_value

    else:
        value += c_value * 2 * a_number
        if (b_number - a_number) * b_value >= (b_number - a_number) * c_value * 2:
            value += (b_number - a_number) * c_value * 2
        else:
            value += (b_number - a_number) * b_value
    print (value)


Measured memory_bytes: 3064
bingo = [list(map(int, input().split())) for i in range(3)]
n = int(input())
check = [[0,0,0] for i in range(3)]

for k in range(n):
  tmp = int(input())
  for i in range(3):
    for j in range(3):
      if bingo[i][j] == tmp:
        check[i][j] = 1


flag = False
for i in range(3):
  if check[i][0] == check[i][1] == check[i][2]==1:
    flag = True
for i in range(3):
  if check[0][i] == check[1][i] == check[2][i] == 1:
    flag = True
if check[0][0] == check[1][1] == check[2][2]==1 or check[0][2] == check[1][1] == check[2][0]==1:
  flag = True
    
if flag:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 3064
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>

#include <climits>
#include <cmath>
#include <cstring>

#include <iomanip>

using namespace std;

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

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	int n,m;
	cin >> n >> m;
	
	if(n == m)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (w, h, x, y) = readLine()!!.split(" ").map {it.toDouble()}
    val half_area = w * h / 2.0
    val s = if (w / 2.0 == x && h / 2.0 == y) 1 else 0

    println("${half_area} ${s}")
    
}

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

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

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() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, l;
    cin >> n >> l;
    vi apples(n);
    rep(i, n) apples[i] = l + i;

    int sum = accumulate(all(apples), 0);
    int ans = 0;
    int diff = INF;
    int idx;
    rep(i, n) {
        int d = accumulate(all(apples), 0) - apples[i];
        if (abs(sum - d) < diff) diff = abs(sum - d), idx = i;
    }

    ans = sum - apples[idx];
    out(ans);
}


Measured memory_bytes: 256
#include <stdio.h>

/* 配列の要素を順番に出力 */
void trace(int A[], int N)
{
   int i;
   for( i = 0; i < N; i++ ){
      if( i > 0 ) printf(" "); /* 隣接する要素の間に1つの空白を出力 */
      printf("%d", A[i]);
   }
   printf("\n");
}

/* 挿入ソート（0オリジン配列） */
void insertionSort(int A[], int N)
{
   int j, i, v;
   for( i = 1; i < N; i++ ){
      v = A[i];
      j = i - 1;
      while( j >= 0 && A[j] > v ){
	 A[j + 1] = A[j];
	 j--;
      }
      A[j + 1] = v;
      trace(A, N);
   }
}

int main()
{
   int N, i, j;
   int A[100];

   scanf("%d", &N);
   for( i = 0; i < N; i++ ) scanf("%d", &A[i]);

   trace(A, N);
   insertionSort(A, N);

   return 0;
}

Measured memory_bytes: 604
import java.util.Scanner;
import java.util.Queue;
import java.util.LinkedList;

public class Main{
	private static int timer = 0;

	public static void processor(Queue<Process> p, int q){
		Process x;
		timer = 0;
		while(!p.isEmpty()){
			x = p.remove();
			if(!x.handle(q)) p.add(x);
		}
	}	

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int quantum = sc.nextInt();

		Queue<Process> p = new LinkedList<Process>();
		String name;
		int time;
		for(int i=0; i<n; i++){
			name = sc.next();
			time = sc.nextInt();
			Process x = new Process(name, time);
			p.add(x);
		}

		sc.close();

		processor(p,quantum);
	}

	private static class Process{
		String name;
		int time; //remaining time

		public Process(String n, int t){
			name = n;
			time = t;
		}

		//return if it ends
		public boolean handle(int q){
			if(q<time){
				time -= q;
				timer +=q;
				return false;
			} 
			else{
				timer += time;
				System.out.println(name+" "+timer);
				return true;
			}
		}
	}
}


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

template<class Iterator>
int LIS(Iterator l, Iterator r){
	auto x = *l;
	pair<int, decltype(x)> p1x(1, x);
//	printf("p1x = (%d, %d)\n", p1x.first, p1x.second);
	vector<pair<int, decltype(x)>> dp(r - l + 1, p1x);
/*	for(int i = 0; i < dp.size(); i++){
		printf("dp[%d] = (%d, %d)\n", i, dp[i].first, dp[i].second);
	}
*/	const auto comp = [&](pair<int, decltype(x)> a, pair<int, decltype(x)> b){
		return a.first != b.first ? a.first < b.first : a.second < b.second;
	};
	for(Iterator i = l; i < r; i++){
		pair<int, decltype(x)> val(0, *i);
//		printf("val[%d] = (%d, %d)\n", i - l, val.first, val.second);
//		printf("%d\n", lower_bound(dp.begin(), dp.end(), val, comp) - dp.begin());
		*lower_bound(dp.begin(), dp.end(), val, comp) = val;
	}
/*	for(int i = 0; i < dp.size(); i++){
		printf("dp[%d] = (%d, %d)\n", i, dp[i].first, dp[i].second);
	}
*/	return lower_bound(dp.begin(), dp.end(), p1x, comp) - dp.begin();
/*	if(r - l <= 1) return 0;
	Iterator i, j, k, h = l + (r - l) / 2;
	int ans = inversion_number(l, h) + inversion_number(h, r);
	auto x = *l;
	vector<decltype(x)> tmp(l, r);
	for(i = l, j = l, k = h; i < r; i++){
		if(k == r || (j < h && tmp[j - l] <= tmp[k - l])){
			*i = tmp[j - l];
			j++;
		}
		else{
			*i = tmp[k - l];
			ans += k - i;
			k++;
		}
	}
	return ans;
*/
}
/*
int LIS(int *array, int N){
	int i, l, h, r;
	int *dp = (int *)malloc(sizeof(int) * (N + 2));
	dp[0] = -inf;
	for(i = 1; i <= N + 1; i++){
		dp[i] = inf;
	}
	for(i = 0; i < N; i++){
		l = 0;
		r = N + 1;
		while(r - l > 1){
			h = (l + r) / 2;
			if(dp[h] > array[i]){ // > なら広義, >= なら狭義の単調増加
				r = h;
			}
			else{
				l = h;
			}
		}
		dp[r] = array[i];
	}
	for(i = 0; dp[i] < inf; i++){}
	return i - 1;
}
*/

int main(){
	int N, i;
	scanf("%d", &N);
	vector<int> A(N);
	for(i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}
//	printf("LISA = %d\n", LIS(A.begin(), A.end()));
	vector<pair<int, int>> B(N);
	for(i = 0; i < N; i++){
		B[i].first = -A[i];
		B[i].second = i;
	}
	printf("%d\n", LIS(B.begin(), B.end()));
	return 0;
}

Measured memory_bytes: 2560
#include<iostream>

using namespace std;

int GCD(int M, int N) {
	
    while(N != 0) { 
        int r = M % N; 
        M = N; 
        N = r; 
    } 
    return M;
}

int main() { 
    int m, n; 

    cin >> m >> n;

    cout << GCD(m, n) << "\n"; 
    
    return 0; 
} 


Measured memory_bytes: 3076
n, k, c = map(int, input().split())
S = input()

DP1 = []
DP2 = []

day = 0
work = 0
while day < n and work < k:
    if S[day] == 'o':
        DP1.append(day)
        day += c + 1
        work += 1

    else:
        day += 1

day = n-1
work = 0
while day >= 0 and work < k:
    if S[day] == 'o':
        DP2.append(day)
        day -= c + 1
        work += 1
    else:
        day -= 1

for day1, day2 in zip(DP1, DP2[::-1]):
    if day1 == day2:
        print(day1+1)


Measured memory_bytes: 59572
import math
import itertools

k = int(input())
result = 0

for a in range(1, k+1):
  for b in range(a+1, k+1):
    for c in range(b+1, k+1):
      r = math.gcd(math.gcd(a, b), c)
      r *= 6
      result += r

for a in range(1, k+1):
  for b in range(a+1, k+1):
    r = math.gcd(a, b)
    r *= 6
    result += r
    
for a in range(1, k+1):
  result += a

print(result)

Measured memory_bytes: 9220
#include <bits/stdc++.h>
#define LL long long
#define FOR(i,c) for(__typeof(c.begin()) i = c.begin(); i != c.end(); i++)
#define F first
#define S second
using namespace std;

const LL mod = 1e9 + 7;

template<typename T> T gcd(T a, T b) { return b == 0?a: gcd(b, a % b); }
template<typename T> T LCM(T a, T b) { return a*(b/gcd(a, b)); }
template<typename T> T expo(T base, T e, T mod) { T res = 1;
  while(e > 0) { if(e&1) res = res * base % mod; base = base * base % mod; e >>= 1; }
  return res;
}
template<typename T, typename S> T expo(T b, S e){if(e <= 1)return e == 0?1: b;\
	return (e&1) == 0?expo((b*b), e>>1): (b*expo((b*b), e>>1));}
template<typename T, typename S> T modinv(T a, S mod) { return expo(a, mod-2, mod); }
template<class T, class S> std::ostream& operator<<(std::ostream &os, const std::pair<T, S> &t) {
	os<<"("<<t.first<<", "<<t.second<<")";
	return os;
}
template<class T> std::ostream& operator<<(std::ostream &os, const std::vector<T> &t) {
	os<<"["; FOR(it,t) { if(it != t.begin()) os<<", "; os<<*it; } os<<"]";
	return os;
}

const int MAXN = 1e5 + 100;
int arr[MAXN];
int n;

int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  int odd = 0, four = 0;
  for(int i = 0; i < n; i++) {
    cin >> arr[i];
    if(arr[i] % 4 == 0) {
      four++;
    } else if(arr[i] % 2 == 1) {
      odd++;
    }
  }
  if(four >= odd) {
    cout << "Yes" << endl;
  } else if(four + 1 == odd && four + odd == n) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
//void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////

int main(){fastio
    ll n;cin>>n;
    ll c[n];
    string s;string debri;
    rep(i,0,n-1){
        cin>>c[i];
        if(i!=n-1){
            cin>>debri;
            s+=debri;
        }
    }
    if(n==1){
        cout<<c[0]<<endl;return 0;
    }
    rep(i,0,n-2){
        if(s[i]=='-')break;
        if(i==n-2){
            ll ans=0;rep(i,0,n-1)ans+=c[i];
            cout<<ans<<endl;return 0;
        }
    }
    ll spos=0;
    ll anspre=c[0];
    rep(i,0,n-2){
        if(s[i]=='+'){
            anspre+=c[i+1];
        }else{
            spos=i+1;
            break;
        }
    }
    vector<ll>a,b;
    while(spos<=n-1){
        a.pb(c[spos]);//s[i-1]=='='
        spos++;
        ll sum=0;
        while(spos<=n-1&&s[spos-1]=='+'){
            sum+=c[spos];
            spos++;
        }
        b.pb(sum);
    }
    //for(auto x:a)cout<<x<<" ";cout<<endl;
    //for(auto x:b)cout<<x<<" ";cout<<endl;
    ll vs=a.size();
    ll xs[vs],ys[vs];
    xs[0]=0;
    rep(i,1,vs-1){
        xs[i]=xs[i-1]+b[i-1]-a[i-1];
    }
    ys[vs-1]=0;
    for(ll i=vs-2;i>=0;i--){
        ys[i]=ys[i+1]+a[i+1]+b[i+1];
    }
    //rep(i,0,vs-1)cout<<xs[i]<<" ";cout<<endl;
    //rep(i,0,vs-1)cout<<ys[i]<<" ";cout<<endl;
    ll ans=-inf;
    rep(i,0,vs-1){
        Max(ans,xs[i]+ys[i]-a[i]-b[i]);
    }
    cout<<ans+anspre<<endl;
    
    return 0;
}


Measured memory_bytes: 4588
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int D;
  cin >> D;
  
  if (D == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
  }
  else if (D == 23) {
    cout << "Christmas Eve Eve" << endl;
  }
  else if (D == 24) {
    cout << "Christmas Eve" << endl;
  }
  else {
    cout << "Christmas" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}

using P = pair<int,int>;
int N,Q,M;
vector<vector<int>> G;
vector<vector<int>> dist;
vector<int> X,Y;
map<P,int> xy2eid;
vector<vector<int>> e2paths;
vector<int> cnt;

vector<int> d_;
void dfs1(int v,int p=-1){
	if(p!=-1) d_[v] = d_[p]+1;
	for(int u:G[v]) if(u!=p) dfs1(u,v);
}

void calcdist(){
	rep(i,N){
		d_ = vector<int>(N,0);
		dfs1(i);
		dist.pb(d_);
	}
}

vector<int> dir;
bool done[2000][2];

void doit(int q,int d){
	assert(dir[q] == -1);
	dir[q] = d;
	int x = X[q], y = Y[q];
	if(d) swap(x,y);
	while(x!=y){
		int nx = -1;
		for(int u:G[x]) if(dist[u][y]<dist[x][y]) nx = u;
		int dir_eid = xy2eid[P(x,nx)];
		int eid = dir_eid%M;
		int dd = dir_eid/M;
		done[eid][dd] = 1;
		cnt[eid]--;
		x = nx;
	}
	x = X[q], y = Y[q];
	if(d) swap(x,y);

	while(x!=y){
		int nx = -1;
		for(int u:G[x]) if(dist[u][y]<dist[x][y]) nx = u;
		int dir_eid = xy2eid[P(x,nx)];
		int eid = dir_eid%M;
		int dd = dir_eid/M;

		if(!done[eid][dd^1] && cnt[eid]==1){
			int inveid = eid + (dd ? 0 : M);
			for(int dir_nq: e2paths[inveid]){
				int nq = dir_nq % Q;
				if(dir[nq] == -1){
					int nd = (dir_nq<Q ? 0 : 1);
					doit(nq,nd);
					break;
				}
			}
		}
		x = nx;
	}
}

int main(){
	cin>>N>>Q;
	M = N-1;
	G.resize(N);
	rep(i,N-1){
		int x,y;
		cin>>x>>y;
		x--,y--;
		G[x].pb(y);
		G[y].pb(x);
		xy2eid[P(x,y)] = i;
		xy2eid[P(y,x)] = i+M;
	}
	calcdist();
	X.resize(Q);Y.resize(Q);
	e2paths.resize(M*2);
	cnt.resize(M);
	rep(i,Q){
		cin>>X[i]>>Y[i];
		X[i]--,Y[i]--;
		int x = X[i], y = Y[i];
		while(x!=y){
			int nx = -1;
			for(int u:G[x]) if(dist[u][y]<dist[x][y]) nx = u;
			e2paths[xy2eid[P(x,nx)]].pb(i);
			e2paths[xy2eid[P(nx,x)]].pb(i+Q);
			x = nx;
		}
	}
	rep(i,M) cnt[i] = e2paths[i].size();

	dir = vector<int>(Q,-1);
	rep(i,Q) if(dir[i] == -1){
		doit(i,0);
	}
	int ans = 0;
	rep(i,M) rep(t,2) if(done[i][t]) ans++;
	cout<<ans<<endl;

	int ans2 = 0;
	rep(i,M){
		int n = e2paths[i].size();
		chmin(n,2);
		ans2 += n;
	}
	assert(ans == ans2);
	rep(i,Q){
		if(dir[i]==0) cout<<X[i]+1<<" "<<Y[i]+1<<endl;
		else cout<<Y[i]+1<<" "<<X[i]+1<<endl;
	}
}

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

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;
 
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;

int main() {

  int n,m,x;
  cin >> n >> m;
  
  vector<int> a(100);
  
  for(int i = 0; i < m; i++){
    cin >> x;
    a[x]++;
    cin >> x;
    a[x]++;
  }
  
  for ( int i = 1; i <= n; i++){
    cout << a[i] << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int n, W;
int v[1010], w[1010];
int dp[1010][1010];

void solve() {
	for (int i=0; i<n; i++) {
		for (int j=0; j<=W; j++) {
			if (w[i] <= j) dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
			else dp[i+1][j] = dp[i][j];
		}
	}
	
	int sumV = 0, sumW = 0;
	for (int i=0; i<=W; i++) {
		if (dp[n][i] > sumV) {
			sumV = dp[n][i];
			sumW = i;
		}
	}
	cout << sumV << endl;
	cout << sumW << endl;
}

int main() {
	int Case = 0;
	
	while (1) {
		cin >> W; if (W==0) break;
		
		Case++;
		cout << "Case " << Case << ":" << endl;
		
		cin >> n;
		
		char dumy;
		for (int i=0; i<n; i++) cin >> v[i] >> dumy >> w[i];
		
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 5120
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int[] cnt = new int[13];
		cnt[0]++;
		for(int i=0;i<N;i++){
			cnt[D[i]]++;
		}
		
		for(int i=0;i<13;i++){
			if(i == 0 || i == 12){
				if(cnt[i] >= 2){
					Console.WriteLine(0);
					return;
				}
			}
			if(cnt[i] >= 3){
				Console.WriteLine(0);
				return;
			}
		}
		
		int max = 0;
		
		for(int t=0;t<1<<12;t++){
			bool[] choice = new bool[24];
			
			if(cnt[0] == 1) choice[0] = true;
			
			for(int j=1;j<12;j++){
				if(cnt[j] == 2){
					choice[j] = true;
					choice[24 - j] = true;
				}
				if(cnt[j] == 1){
					if(((t >> j) & 1) == 1){
						choice[j] = true;
					} else {
						choice[24 - j] = true;
					}
				}
			}
			
			if(cnt[12] == 1) choice[12] = true;
			
			
			int last = 0;
			int min = 24;
			for(int j=1;j<=24;j++){
				if(!choice[j % 24]) continue;
				int dist = j - last;
				min = Math.Min(min, dist);
				last = j;
			}
			
			max = Math.Max(max, min);
			
		}
		
		Console.WriteLine(max);
	}
	int N;
	int[] D;
	public Sol(){
		N = ri();
		D = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
int main() {
    int A,B,C,D;
    cin >> A >> B >> C;
   if(A == B && B == C  ){//A=B=C
    D = 1;
     
   }   
   else if (A == B){//A=B
     D = 2;
     
   }
    else if (A == C){//A=C
     D = 2;
     
   }
    else if (B == C){//B=C
     D = 2;
     
   }
   else {
       D = 3;
   }
  
    cout << D << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define F first
#define S second
#define MEM(i,j) memset(i,j,sizeof i)
#define ALL(v) v.begin(),v.end()
#define MP make_pair
#define ET cout << "\n"
#define DB(a,s,e) {for(int i=s;i<e;i++) cout << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const ll MOD=1e9+7;
string s;
ll dp[3005][3005];

int main()
{jizz
	ll n,ans=0;
	cin >> n >> s;
	dp[1][1]=1;
	for(ll i=2;i<=n;++i)
	{
		if(s[i-2]=='>')
			for(ll j=i,x=0;j>0;--j,x=(x+dp[j][i-1])%MOD)
				dp[j][i]=x;
		else
			for(ll j=1,x=0;j<=i;x=(x+dp[j][i-1])%MOD,++j)
				dp[j][i]=x;
	}
	for(ll i=1;i<=n;++i)
		ans=(ans+dp[i][n])%MOD;
	cout << ans << "\n";
}

Measured memory_bytes: 70016
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())

int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}
using namespace std;
int main(){
    string a,b="";
    cin >> a ;

    REP(i,a.size()){
        b += 'x';
    }
    cout << b <<endl;
}





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

int main()
{
    int n;
    while (cin >> n && n) {
        int t[100] = {0}, h[100] = {0}, c[200] = {0};
        for(int i=0;i < n;++i) { int idx; cin >> idx; c[idx-1] = 1; }
        
        for(int i=0,idx[2]={0};i < n*2;++i) {
            if (c[i]) t[idx[0]++] = i+1;
            else h[idx[1]++] = i+1;
        }
        
        int tn, hn, mx = 0; tn = hn = n;
        
        while (tn && hn) {
            bool flag = true;
            
            for(int i=0;i < n;++i) {
                if (t[i] && mx < t[i]) {
                    mx = t[i]; --tn; t[i] = 0;
                    flag = false;
                    break;
                }
            }
            
            if (!tn || !hn) break;
            if (flag) mx = 0;
            
            flag = true;
            
            for(int i=0;i < n;++i) {
                if (h[i] && mx < h[i]) {
                    mx = h[i]; --hn; h[i] = 0;
                    flag = false;
                    break;
                }
            }
            
            if (flag) mx = 0;
        }

        printf("%d\n%d\n", hn, tn);
    }

    return 0;
}

Measured memory_bytes: 1144
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        string s, t;
        cin >> s >> t;
        int cnt = 0;
        for(int i = 0; i < s.length(); i++){
            if(s[i] != t[i]){
                cnt++;
            }
        }
        cout << cnt << '\n';
    }
}

Measured memory_bytes: 35048
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(20);
}

#define int ll
void solve(){
	long double d;
	cin >> d;
	long double hoge = floor(d);
	d *= sqrt(2);
	cout << max(d, hoge+1.0) << endl;
}

#undef int
int main() {
	init();
	solve();
}


Measured memory_bytes: 3384
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
using namespace std;

int main(int argc, char const *argv[])
{
	int a,b;
	cin>>a>>b;
	bool flag=0;

	int x = 2*a;
	int y = 4*a;

	if(b >= x && b <= y && (b%2==0)){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

	// if(b % 4 == 0){
	// 	int x = (b / 4);
	// 	if(a==x){
	// 		cout<<"Yes"<<endl;
	// 	}else{
	// 		while(x){
	// 			x--;
	// 			a++;
	// 			//cout<<x<<" "<<a<<endl;
	// 			if((a) == (x*4)){
	// 				cout<<"Yes"<<endl;
	// 				flag=1;
	// 				break;
	// 			}
	// 		}
	// 		if(!flag){
	// 			cout<<"No"<<endl;
	// 		}
	// 	}
	// }else if(b % 2 == 0){
	// 	if((b / 2) != a){
	// 		cout<<"No"<<endl;
	// 	}else{
	// 		cout<<"Yes"<<endl;
	// 	}
	// }else{
	// 	cout<<"NO"<<endl;
	// }
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
#define trav(x,c) for(auto &x:c)
using namespace std;

int toint(string s) {
  int ans = 0;
  for(char x: s) ans = ans*10 + (x - '0');
  return ans;
}

int sum(int x) {
  int s = 0;
  while(x) {
    s += x%10;
    x /= 10;
  }
  return s;
} 

bool equal(string s) {
  for(int i = 0,j = s.size()/2;j < s.size();i++,j++) {
    if(s[i] != s[j]) return false;
  }
  return true;
}

int main() {
  string a,b;
  cin>>a>>b;
  string ans = "EQUAL";
  if(a.size() < b.size()) ans = "LESS";
  else if(a.size() > b.size()) ans = "GREATER";
  else {
    frn(i,a.size()) {
      if(a[i] < b[i]) {ans = "LESS"; break;}
      else if(a[i] > b[i]) {ans = "GREATER"; break;}
    }
  } 
  cout<<ans;
}

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

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int a = readint;
    int b = readint;
    int c = readint;
    int d = readint;
    writeln(min(a, b) + min(c, d));
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <vector>
#define LL long long
using namespace std;
char a[105];
char b[105];
int cmp(char a,char b){
	return a>b;
}
int main(){
	//freopen("in.txt","r",stdin);
 	scanf("%s %s",&a,&b);
 	//printf("%s",b);
 	int na=strlen(a);
 	int nb=strlen(b);
 	sort(a,a+na);
 	sort(b,b+nb,cmp);
 	int n = min(na,nb);
 	//printf("\n%d %s %s\n",n,a,b);
 	for(int i=0;i<n;i++){
 		//printf("\nA");
 		if(a[i]<b[i]){
 			printf("Yes\n");
 			return 0;
		 }else if(a[i]==b[i]){
		 	continue;
		 }else{
		 	printf("No\n");
		 	return 0;
		 }
	 }
	 if(na==nb){
	 	printf("No\n");
	 }else if(n<nb){
	 	printf("Yes\n");
	 }else{
	 	printf("No\n");
	 } 
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
int main() {
	int w,h;
	while (true){
	std::cin >> w >> h;
	if(w==0 && h==0){break;}
	int wc=1;
	int hc=1;
	while(wc<=w){
		while(hc<=h){
			if(wc==1 || wc==w || hc==1 || hc==h){
			std::cout << "#";}else{
				std::cout << ".";
			}
			hc++;
		}
		hc=1;
		std::cout << std::endl;
		wc++;
	}
	std::cout << std::endl;
}
	return 0;
}

Measured memory_bytes: 3076
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		int d[]=new int[b];
		for(int i=0;i!=b;i++) {
			d[i]=scan.nextInt();
		}
		int count=0;
		for(int i=c;i!=a;i++) {
			for(int j=0;j!=b;j++) {
				if(i==d[j]) {
					count++;
				}
			}
		}
		int count2=0;
		for(int i=c;i!=0;i--) {
			for(int j=0;j!=b;j++) {
				if(i==d[j]) {
					count2++;
				}
			}
		}
		System.out.println(count<=count2?count:count2);
		}
}

Measured memory_bytes: 21844