akhauriyash/Code-Regression huggingface dataset:
<?php
list($n) = ints();
$d = ints();
for ($i = 0; $i < $n; ++$i) {
    if (isset($cnt[$d[$i]])) ++$cnt[$d[$i]];
    else $cnt[$d[$i]] = 1;
}
if (max($cnt) > 2) exit('0');
if (isset($cnt[0]) && $cnt[0] > 0) exit('0');
if (isset($cnt[12]) && $cnt[12] > 1) exit('0');
echo dfs();
function dfs($d = 0, $a = [0])
{
    global $cnt;
    if ($d === 13) return calcMinD($a);
    if (!isset($cnt[$d])) return dfs($d + 1, $a);
    if ($d === 0 || $d === 12) return dfs($d + 1, array_merge($a, [$d]));

    if ($cnt[$d] === 2) return dfs($d + 1, array_merge($a, [$d, 24 - $d]));

    $res[] = dfs($d + 1, array_merge($a, [$d]));
    $res[] = dfs($d + 1, array_merge($a, [24 - $d]));

    return max($res);
}
function calcMinD($a)
{
    $n = count($a);
    $min = PHP_INT_MAX;
    for ($i = 0; $i < $n - 1; ++$i) {
        for ($j = $i + 1; $j < $n; ++$j) {
            $d = min(abs($a[$i] - $a[$j]), 24 - abs($a[$i] - $a[$j]));
            $min = min($min, $d);
        }
    }
    return $min;
}
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


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

using Int = long long;
const char newl = '\n';

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
template<typename T=Int>
vector<T> read(size_t n){
  vector<T> ts(n);
  for(size_t i=0;i<n;i++) cin>>ts[i];
  return ts;
}

//INSERT ABOVE HERE

const Int MAX = 3030;
Int dp[4][MAX][MAX]={};
Int vs[MAX][MAX]={};
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  Int h,w,n;
  cin>>h>>w>>n;

  for(Int i=0;i<n;i++){
    Int r,c,v;
    cin>>r>>c>>v;
    r--;c--;
    vs[r][c]=v;
  }

  dp[1][0][0]=vs[0][0];

  for(Int i=0;i<h;i++){
    for(Int j=0;j<w;j++){
      for(Int k=0;k<4;k++){
        if(i+1<h){
          chmax(dp[0][i+1][j],dp[k][i][j]);
          chmax(dp[1][i+1][j],dp[k][i][j]+vs[i+1][j]);
        }
        if(j+1<w){
          chmax(dp[k][i][j+1],dp[k][i][j]);
          if(k+1<4) chmax(dp[k+1][i][j+1],dp[k][i][j]+vs[i][j+1]);
        }
      }
    }
  }

  Int ans=0;
  for(Int k=0;k<4;k++) chmax(ans,dp[k][h-1][w-1]);
  cout<<ans<<newl;
  return 0;
}


Measured memory_bytes: 358516
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
from re import split
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy
import re

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

k, n = LI()
A = LI()
ret = k - A[n - 1] + A[0]
for i in range(n - 1):
    ret = max(ret, A[i + 1] - A[i])

print(k - ret)


Measured memory_bytes: 67008
s = gets.chomp.split("")

p = 0
ans = 0
s.each do |v|
    if v == 'p' && p > 0
        p -= 1
    elsif v == 'p' && p == 0
        p += 1
        ans -= 1
    elsif v == 'g' && p > 0
        p -= 1
        ans += 1
    elsif v == 'g' && p == 0
        p += 1
    end
end
puts ans

Measured memory_bytes: 9468
#include<stdio.h>

int main(){
  int n,i,j;
  float x;
  int h[6]={};
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%f",&x);
    
    if(x<165)
      h[0]++;
    else if(x<170)
      h[1]++;
    else if(x<175)
      h[2]++;
    else if(x<180)
      h[3]++;
    else if(x<185)
      h[4]++;
    else
      h[5]++;
  }
  
  //output
  for(i=1;i<=6;i++){
    printf("%d:",i);
    for(j=0;j<h[i-1];j++)
      printf("*");
    puts("");
  }
  return 0;
}

Measured memory_bytes: 0
S, T = [input() for x in range(2)]
lenT = len(T)
max_match_len = 0

for i in range(len(S)-lenT+1):
  compareS = S[i:i+lenT]
  match_len = 0
  for j in range(lenT):
    if compareS[j] == T[j]:
      match_len += 1
  else:
    if max_match_len < match_len:
      max_match_len = match_len
print(lenT - max_match_len)


Measured memory_bytes: 9048
#include <stdio.h>

int main(void) {
    int n = 0;
    int l[100] = { 0 };
    int count = 0;
    int i = 0, j = 0, k = 0;

    scanf("%d", &n);

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

    for (i = 0; i < n - 2; i++) {
        for (j = i + 1; j < n - 1; j++) {
            for (k = j + 1; k < n; k++) {
                if (l[i] == l[j])continue;
                if (l[j] == l[k])continue;
                if (l[k] == l[i])continue;
                if (l[i] >= l[j]+l[k])continue;
                if (l[j] >= l[k]+l[i])continue;
                if (l[k] >= l[i]+l[j])continue;
                count++;
            }
        }
    }

    printf("%d", count);

    return 0;
}


Measured memory_bytes: 1712
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
//long long num[100000];
int main(){
	ll n,ans=0;
	cin>>n;
	ll a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	ll p,f;
	while(p<n){
		ll c=a[p];
		f=0;
		while(p<n&&a[p]==c){
			f++;
			p++;
		}
		ans+=f%2;
	}
	cout<<ans<<endl;
	return 0;
}

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


int main() {
  ll S, W;
  cin >> S >> W;
  if (W >= S) cout << "unsafe" << endl;
  else cout << "safe" << endl;
}


Measured memory_bytes: 3648
#include <stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int i,count=0;
  int data[n];
  for(i=0;i<n;i++){
    scanf("%d",&data[i]);
  }
  int j,min,tmp;
  for(i = 0;i<n-1;i++){
    min = i;
    for(j=i+1;j<n;j++){
      if(data[min]>data[j]){
	min = j;
      }
    }
      if(min != i){
	count++;
	tmp = data[i];
	data[i]=data[min];
	data[min]=tmp;
      }
    
  }
  for(i =0 ;i<n-1;i++){
    printf("%d ",data[i]);
  }
  printf("%d\n",data[i]);
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 2668
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <vector>

using namespace std;

int main() {
	long long  N,M,LL;
	cin >> N >> M;

	
	long long x[M],d[M];
	for(int i=0; i<M; i++) cin >> x[i]; 
	
	if (( M == 1 ) || ( N >= M)) {
		cout << 0 << endl;
		return 0;
	}
	
	sort(x, x+M);
	for(int i=0; i<M-1; i++) d[i] = abs(x[i+1] -x[i]);
	sort(d, d+M-1, greater<>() );
	
//		cout<< "x: ";for(int i=0; i<M; i++) cout << x[i] << " " ;
//		cout << endl;
//		cout<< "d: ";for(int i=0; i<M-1; i++) cout << d[i] << " " ;
//		cout << endl;
	
	LL = abs(x[M-1] - x[0]);
	
//		cout << "LL=" << LL << endl;
	
	for(int i=0; i<N-1; i++) {
		LL = LL -d[i];
	}
	cout << LL << endl;
	return 0;
}

Measured memory_bytes: 1792
h1, m1, h2, m2, k = gets.split.map(&:to_i)


time1 = (h2 - h1) * 60 + (m2 - m1)

time2 = m2 - m1

if h1 == h2
  if time2 > k
    puts time2 - k
  elsif time2 <= k
    puts 0
  end

elsif h1 != h2
  if time1 > k
    puts time1 - k
  elsif time1 <= k
    puts 0
  end
end

Measured memory_bytes: 14384
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>
#include <random>

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

using namespace std;
typedef long long int ll;
const ll INF = 1000000000;
const double PI = acos(-1);
const int mod = 1000000007;


int main()
{
    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if (m1 != m2) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}


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

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

long gcd(long c, long d){ // 最大公約数を求めるプログラム
    long mx = max(c,d);
    long mi = min(c,d);
    long tmp=0;
    while(mi > 0){
        tmp = mx % mi;
        if(tmp==0){
            return mi;
        } else{
            mx = mi;
            mi = tmp;
        }
    }
    return 1;
} 

int main() {
  int N;
  ll sum = 0;
  cin >> N;
  for(int i = 1; i <= N; i++){
    for(int j = 1; j <= N; j++){
      for(int k = 1; k <= N; k++){
        sum += gcd(i, gcd(j, k));
      }
    }
  }
  
  cout << sum << endl;

}


Measured memory_bytes: 3632
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        long a = scan.nextInt();
        long b = scan.nextInt();
        long gcd = gcd(a, b);
        System.out.println(a * b / gcd);
        scan.close();
    }
    public static long gcd(long x, long y){
        if(x % y == 0) return y;
        return gcd(y, x % y);
    }
}

Measured memory_bytes: 22996
package main

import "fmt"

func main() {
	var N, cnt int
	fmt.Scan(&N)
	p := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&p[i])
	}
	for i := 0; i < N; i++ {
		if p[i] == i+1 {
			cnt++
			i++
		}
	}
	fmt.Println(cnt)
}


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

int main()
{
    ll N, sqr, ans;
    cin >> N;

    sqr = sqrt(N);

    rep(i, sqr) {
        if (N % (sqr - i) != 0) {
            continue;
        }
        ans = ( sqr - i )+ N / (sqr - i) -2;
        break;
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
   
int main(void)
{
char str[1001], p[1001], cmd[10];
int a, b, q;
   
scanf("%s", str);
   
scanf("%d", &q);
   
while (q > 0)
{
scanf("%s", cmd);
scanf("%d", &a);
scanf("%d", &b);
if (cmd[0] == 'p')
{
 while (a <= b)
 {
 putchar(str[a]);
 a++;
 }
 putchar('\n');
   
} else if (cmd[2] == 'v')
{
 while (a < b)
 {
  p[0] = str[a];
  str[a] = str[b];
  str[b] = p[0];
  a++;
  b--;
 }
} else {
 scanf("%s", p);
 while (a <= b)
 {
  str[b] = p[b - a];
  b--;
 }
}
q--;
}
   
return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;

class Point{
public:
  int x;
  int y;
};

class Cost{
public:
  int x;
  int y;
  int c;
};

int w, h, n;
Point data[11];
char mdata[20][20];
int cost[11][11];
bool visited[20][20];
int dx[]={0,1,0,-1};
int dy[]={-1,0,1,0};

int bfs(Point, Point);

main(){
  while(1){
    cin >> w >> h;
    if(w==0 && h==0) break;
    int k=1;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin >> mdata[i][j];
	if(mdata[i][j]=='o'){
	  data[0].y=i;
	  data[0].x=j;
	}
	if(mdata[i][j]=='*'){
	  data[k].y=i;
	  data[k].x=j;
	  k++;
	}
      }
    }
    n=k;
    bool flag=false;
    for(int i=0;i<n;i++){
      if(flag) break;
      for(int j=i;j<n;j++){
	if(i==j){
	  cost[i][j]=cost[j][i]=0;
	}
	else{
	  for(int a=0;a<h;a++){
	    for(int b=0;b<w;b++){
	      visited[a][b]=false;
	    }
	  }
	  cost[i][j]=cost[j][i]=bfs(data[i], data[j]);
	  if(cost[i][j]==-1){
	    flag=true;
	    break;
	  }
	}
      }
    }
    if(flag){
      cout << -1 << endl;
      continue;
    }

    int A[10];
    for(int i=1;i<n;i++){
      A[i-1]=i;
    }

    int ans=-1;
    do{
      int tmp=cost[0][A[0]];
      for(int i=1;i<n-1;i++){
	tmp+=cost[A[i-1]][A[i]];
      }
      if(ans==-1 || ans>tmp){
	ans=tmp;
      }
    }while(next_permutation(A, A+n-1));

    cout << ans << endl;
  }
  return 0;
}


int bfs(Point start, Point goal){
  queue<Cost> q;

  Cost s;
  s.x=start.x;
  s.y=start.y;
  s.c=0;

  q.push(s);
  int ans=-1;
  Cost u, v;
  while(!q.empty()){
    u=q.front(), q.pop();
    if(u.y==goal.y && u.x==goal.x){
      ans=u.c;
      break;
    }
    for(int i=0;i<4;i++){
      v.y=u.y+dy[i];
      v.x=u.x+dx[i];
      v.c=u.c+1;
      if(v.y>=0 && v.y<h){
	if(v.x>=0 && v.x<w){
	  if(mdata[v.y][v.x]!='x'){
	    if(!visited[v.y][v.x]){
	      visited[v.y][v.x]=true;	      
	      q.push(v);
	    }
	  }
	}
      }
    }
  }
  return ans;
}

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

int main() {
    int N,K;
    cin >> N >> K;
    string S;
    cin >> S;
    if (S.at(K-1)=='A')
    S.at(K-1)='a';
    if (S.at(K-1)=='B')
    S.at(K-1)='b';
    if (S.at(K-1)=='C')
    S.at(K-1)='c';
    cout << S << endl;
}

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

int t1, t2, t3, n, a[105][105];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> t1 >> t2;
		for (int j = 0; j < t2; j++) {
			cin >> t3;
			a[t1][t3] = 1;
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			cout << a[i][j] << ((j < n) ? ' ' : '\n');
		}
	}
}


Measured memory_bytes: 3104
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>

#define pb push_back
#define mp make_pair

using namespace std;

template<typename T>inline void upmin(T &x,T y) { y<x?x=y:0; }
template<typename T>inline void upmax(T &x,T y) { x<y?x=y:0; }

typedef unsigned int u32;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod pi=acos(-1);
const int oo=1<<30;
const LL OO=1e18;

const int N=2010*2010;

int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}

bitset<N>bit;
int main()
{
	int n=gi(),sum=0,k;
	bit[0]=1;
	while (n--) {
		sum+=k=gi();
		bit|=bit<<k;
	}
	cout<<bit._Find_next((sum-1)/2)<<endl;
	return 0;
}


Measured memory_bytes: 1664
def inpl(): return list(map(int, input().split()))
N, M = inpl()
f, n = [], []
for i in range(M):
    temp = inpl()
    if 1 in temp:
        f.append(temp[1])
    if N in temp:
        n.append(temp[0])
if len(set(f) & set(n)) > 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

int main(){
  int N;
  cin >> N;
  int x=0;
  for (int i=1; i<N; i++){
    for (int j=1; j<N; j++){
      if (i*j <N)
        x++;
      else
        break;
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 3636
import numpy as np

N,M = list(map(int, input().split()))
ABs = [list(map(int, input().split())) for _ in range(M)]


par = [i for i in range(N+1)]
size = [1 for _ in range(N+1)]

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x]) #経路圧縮
        return par[x]
def same(x,y):
    return find(x) == find(y)
def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    par[x] = y
    size[y] = size[x] + size[y]
    size[x] = 0

for AB in ABs:
    unite(AB[0],AB[1])

print(max(size))

Measured memory_bytes: 72896
N, M = map(int, input().split())
inf = float("inf")
dist = [[inf for _ in range(N)] for _ in range(N)]
for i in range(N):
    dist[i][i] = 0

T = []
for i in range(M):
    a, b, c = map(int, input().split())
    a, b = a-1, b-1
    T.append((a, b, c))
    dist[a][b] = min(dist[a][b], c)
    dist[b][a] = min(dist[b][a], c)

for k in range(N):
    for i in range(N):
        for j in range(N):
            dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j])

ans = M
for a, b, c in T:
    check = False
    for i in range(N):
        if dist[i][a] + c == dist[i][b]:
            check = True
    if check:
        ans -= 1
print(ans)
    

Measured memory_bytes: 47452
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

inline ll read(){
    ll Hashimoto=0;
	bool Kanna=1;
    char I_Love=getchar();
    while(I_Love<'0'||I_Love>'9'){
        if(I_Love=='-')Kanna=0;
        I_Love=getchar();
    }
    while(I_Love>='0'&&I_Love<='9'){
        Hashimoto=Hashimoto*10+I_Love-'0';
        I_Love=getchar();
    }
    return (Kanna?Hashimoto:-Hashimoto);
}
template<typename T1,typename T2> inline void Umax(T1 &a,T2 b){
	if(a<b)a=b;
}
template<typename T1,typename T2> inline void Umin(T1 &a,T2 b){
	if(a>b)a=b;
}

#define I_Love_35_Marblue_And_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<(Kanna);++I_Love)cout<<Hashimoto[I_Love]<<(I_Love==(Kanna)-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<(Kanna);++I_Love)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define UNIQUE(Kanna) Kanna.erase(unique(Kanna.begin(),Kanna.end()),Kanna.end());
#define inf (1000000000)
#define linf (1000000000000000000ll)
#define mod (1000000007)

bool fuck(string a,string b){
	FOR(i,0,10)if(isdigit(a[i])){
		if(a[i]=='0')a[i]-=10;
		if(b[i]=='0')b[i]-=10;
		if(a[i]>b[i])return 0;
		if(a[i]<b[i])return 1;
	}
	return 1;
}

int I_Love_35_Marblue_And_Hashimoto_Kanna() {
	//完全想清楚了再开始写。
	//写不顺、不知道怎么写、很乱的时候，停下来好好想想。
	//做得慢总比做不出好。
	fastio;
	string s;
	cin>>s;
	if(fuck(s,"2019/04/30"))Tone("Heisei")
	else Tone("TBD")
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
//if((a==b&&b==c)||(a!=b&&b!=c)){
//	printf("No");
//}
 if((a==b&&b!=c)||(b==c&&a!=c)||(a==c&&b!=c)){
	printf("Yes");
}
else{
	printf("No");
}
}

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

int main(){
    
    int m,f,r,S;
    
    while(1){
        cin >> m >> f >> r;
        if ( m == -1 && f == -1 && r == -1 ) break;
        
        if ( m == -1 || f == -1 ) cout << "F" << endl;
        else{
             S = m + f;
            if ( S >= 80 ) cout << "A" << endl;
            else if ( 80 > S && S >= 65 ) cout << "B" << endl;
            else if ( ( 65 > S && S >= 50 ) || ( 50 > S && S >= 30 && r >= 50 ) ) cout << "C" << endl;
            else if ( 50 > S && S >= 30 && 50 > r ) cout << "D" << endl;
            else if ( 30 > S ) cout << "F" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3108
import java.util.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] x = new int[5];
		for (int i = 0;i<x.length;i++) {
			x[i] = sc.nextInt();
		}
		for (int i = 0;i<x.length;i++) {
			if (x[i] == 0) {
                        System.out.println(i+1);	
                }
           }
     }
}

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

int main() {
	int i, j, n, mini, count = 0, a[100];
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}

	for (i = 0; i < n; i++) {
		mini = i;
		for (j = i + 1; j < n; j++) {
			if (a[j] < a[mini]) {
				mini = j;
			}
		}
		if (i != mini) {
			swap(a[i], a[mini]);
			count++;
		}
	}

	for (i = 0; i < n; i++) {
		cout << a[i];
		if (i != n - 1)cout << " ";
		else cout << endl;
	}
	cout << count << endl;

	return 0;
}

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

int main() {
  string S;
  
  cin >> S;
  vector<int> n(S.size());
  rep(i, S.size())
  {
    n.at(i) = S.at(i) -  '0';
  }
  
  ll sum = 0;
  for(int tmp = 0; tmp < (1 << S.size() - 1); tmp++)
  {
  	bitset<10> p(tmp);
    //cout << p << endl;
    ll tmp_sum = 0;
    ll tmp_sum_no_plus = 0;
    rep(i, S.size())
    {
      if (i == S.size() - 1) //最後の数字
      {
        tmp_sum += tmp_sum_no_plus + n.at(i);
      }
      else if (p.test(i)) // +がある
      {
        tmp_sum += tmp_sum_no_plus + n.at(i);
        tmp_sum_no_plus = 0;
      }
      else
      {
        tmp_sum_no_plus = (tmp_sum_no_plus + n.at(i) ) * 10;
      }
    }
    //cout << tmp_sum << endl;
    sum += tmp_sum;
  }
  cout << sum ;
}

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

int main()
{
	int a,b,av=0,s;
	
	cin>>a>>b;
	s=a+b;
	if(s%2==0)
	{av=s/2;
	cout<<av<<endl;
	return 0;}
	
	if(s%2==1)
	{s++;
	av=s/2;
	cout<<av<<endl;}
	return 0;
}

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

template<typename A, typename B>
struct pair_hash{
    inline size_t operator()(const pair<A, B> &p) const{
        const auto h1 = hash<A>()(p.first);
        const auto h2 = hash<B>()(p.second);
        return h1^(h2<<18);
    }
};

ll gcd(ll n, ll m){
    while(true){
        if(n<m) swap(n, m);
        if(!m) break;
        n %= m;
    }
    return n;
}

ll pow_mod(ll n, ll m, ll mod=1000000007){
    ll a = 1;
    while(m>0){
        if(m&1) a = a*n % mod;
        n = n*n % mod;
        m >>= 1;
    }
    return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);

    ll N;
    cin >> N;
    vll A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];

    unordered_map<pair<ll, ll>, pair<ll, ll>, pair_hash<ll, ll>> m;
    rep(i, N){
        ll a = A[i];
        ll b = B[i];
        ll g = gcd(abs(a), abs(b));
        if(g>0){
            a /= g;
            b /= g;
        }
        if(a<0){
            a = -a;
            b = -b;
        }
        else if(a==0) b = b==0? 0 : 1;

        ll oa = -b;
        ll ob = a;
        ll og = gcd(abs(oa), abs(ob));
        if(og>0){
            oa /= og;
            ob /= og;
        }
        if(oa<0){
            oa = -oa;
            ob = -ob;
        }
        else if(oa==0) ob = ob==0? 0 : 1;

        if(b>ob){
            if(m.find({a, b})!=m.end()){
                ++m[{a, b}].first;
            }
            else{
                m[{a, b}] = {1, 0};
            }
        }
        else{
            if(m.find({oa, ob})!=m.end()){
                ++m[{oa, ob}].second;
            }
            else{
                m[{oa, ob}] = {0, 1};
            }
        }
    }

    ll ans = 1;
    ll r = 0;
    for(auto p : m){
        auto k = p.first;
        auto v = p.second;
        if(k.first==0 && k.second==0){
            r = v.first + v.second;
            continue;
        }
        ll t = pow_mod(2, v.first) + pow_mod(2, v.second) - 1;
        ans = ans*t % 1000000007;
    }
    ans = (ans+r-1+1000000007) % 1000000007;

    cout << ans << endl;
}


Measured memory_bytes: 20888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18,MOD = 1e9 + 7;
const int INT_INF = 1e9,INT_MOD=1e9+7;
#define rep(i, N) for(int i = 0; i < N; i++)
typedef pair<int, int> Pi;
typedef pair<double, double> P;
signed main(){
    vector<string> poll;
    int n;cin>>n;
    int a[n];
    rep(i,n){
        string str;cin>>str;
        poll.push_back(str);
        a[i]=0;
    }
    sort(poll.begin(),poll.end());
    poll.push_back("daruma3");
    int amax=-INT_INF,tmp=1;
    rep(i,n){
        if(poll[i+1]==poll[i]){
            tmp++;
        }else{
            a[i]=tmp;
            amax=max(amax,tmp);
            tmp=1;
        }
    }
    rep(i,n){
        if(a[i]==amax) cout<<poll[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 15088
#include <iostream>

using namespace std;

enum Mode { Neutral, Increasing, Decreasing };

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

	int res = 0;
	int last = -1;
	Mode mode = Mode::Neutral;

	for (int i = 1; i <= n; ++i) {
		int curr;
		cin >> curr;

		if (i > 1) {
			if (curr > last) {
				if (mode == Decreasing) {
					++res;
					mode = Mode::Neutral;
				} else {
					mode = Mode::Increasing;
				}
			} else if (curr < last) {
				if (mode == Mode::Increasing) {
					++res;
					mode = Mode::Neutral;
				} else {
					mode = Mode::Decreasing;
				}
			}
		}
		last = curr;
	}

	cout << res + 1 << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ull unsigned long long
#define db double
#define pb push_back
#define ppb pop_back
#define all(x) (x).begin(), (x).end()

template <typename T>
using pr = array <T, 3>;

template <typename T>
using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 200003;
int n, sz[N], par[N];
ll d, a[N];
vector <pr <ll> > cand;

void rec(int l, int r) {
	if (l >= r) {
		return;
	}
	int m = l + r >> 1;
	int L = -1, R = -1;
	for (int i = l; i <= m; i++) {
		if (L == -1 || a[i] - i * d < a[L] - L * d) {
			L = i;
		}
	}
	for (int i = m + 1; i <= r; i++) {
		cand.pb({a[L] + a[i] + (i - L) * d, L, i});
		if (R == -1 || a[i] + i * d < a[R] + R * d) {
			R = i;
		}
	}
	for (int i = l; i <= m; i++) {
		cand.pb({a[R] + a[i] + (R - i) * d, i, R});
	}
	rec(l, m);
	rec(m + 1, r);
}

void make_set(int x) {
	par[x] = x;
	sz[x] = 1;
}

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

bool union_set(int x, int y) {
	x = find_set(x), y = find_set(y);
	if (x == y) {
		return false;
	}
	if (sz[x] < sz[y]) {
		swap(x, y);
	}
	par[y] = x;
	sz[x] += sz[y];
	return true;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n >> d;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	rec(1, n);
	sort(all(cand));
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		make_set(i);
	}
	for (auto i : cand) {
		ll w = i[0];
		int x = i[1], y = i[2];
		if (union_set(x, y)) {
			ans += w;
		}
	}
	cout << ans;
}


Measured memory_bytes: 103356
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
ll mx,n,j,x,res,d,y,sm,b,k;
const int N = 1e5 + 5;
vector <ll> v[N],ans(N),v2;
string s;
ll a[N];
ll dp[N];
ll go(ll idx , ll k , ll n) {
    if(idx == n ) return 0;
    if(dp[idx] != -1) return dp[idx];
    ll xx = INT_MAX , temp = INT_MAX ;
    for( ll  i = idx + 1; i <= min(n , idx + k) ; i++){

        xx = min(abs (a[i] - a[idx]) + go( i ,k, n), xx);
    }
   return dp[idx] =  xx;


}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    cin >> n  >> k;
    for( ll i = 1; i <= n; i++) {
        cin >> a[i];
    }
    memset(dp, -1, sizeof(dp));
    cout << go( 1 , k ,n);

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);  
  
  for (int i=0; i<N; i++){
    cin >> a[i];
  }
  
    sort (a.begin(), a.end());
    reverse (a.begin(), a.end());
    int alice = 0, bob = 0;
    
    for (int i=0; i<N; i+=2){
      alice +=a[i];
    }
   for (int i=1; i<N; i+=2){
      bob +=a[i];
    }
 
 cout << alice - bob << endl;     
       
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
 
main :: IO ()
main = do
    [a, b] <- map read . words <$> getLine
    putStrLn $ show (solve a b)
    
solve :: Int -> Int -> Int
solve a b = if a - 2 * b >= 0 then a - 2 * b else 0

Measured memory_bytes: 508
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = 0;
    if(n>=100000){
        ans = 90909;
    }else if(n>=10000){
        ans += n-9999;
        ans += 909;
    }else if(n>=1000){
        ans = 909;
    }else if(n>=100){
        ans += n-99;
        ans+=9;
    }else if(n>=10){
        ans += 9;
    }else{
        ans += n;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); ++i)
using namespace std;
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;
}
long long INF = 1LL << 60;
const int MAX_N = 110;
const int MAX_V = 100100;
long long dp[MAX_N][MAX_V];

int main()
{
    int N, W;
    cin >> N >> W;
    vector<long long> w(N), v(N);
    rep(i, N)
    {
        cin >> w[i] >> v[i];
    }
    rep(i, MAX_N)
    {
        rep(j, MAX_V)
        {
            dp[i][j] = INF;
        }
    }

    dp[0][0] = 0;

    rep(i, N)
    {
        rep(j, MAX_V)
        {
            if (j - v[i] >= 0)
                chmin(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
            chmin(dp[i + 1][j], dp[i][j]);
        }
    }
    long long res = 0;
    rep(j, MAX_V)
    {
        if (dp[N][j] <= W)
        {
            res = j;
        }
    }
    cout << res << endl;

    return 0;
}


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 //πの値
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

 
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
  ll A, N;
  bool judge = false;
  vector<vector<ll>> bingo(3,vector<ll>(3));
  REP(i,3) REP(j,3) cin >> bingo[i][j];
  cin >> N;
  REP(i,N) {
   cin >> A;
    REP(j,3) {
      REP(k,3) {
    if(bingo[j][k] == A) bingo[j][k] = 0;
      }
    }
  }
  REP(i,3) if(bingo[0][i]==0&&bingo[1][i]==0&&bingo[2][i]==0) judge = true;
  REP(i,3) if(bingo[i][0]==0&&bingo[i][1]==0&&bingo[i][2]==0) judge = true;
  if(bingo[0][0]==0&&bingo[1][1]==0&&bingo[2][2]==0) judge = true;
  if(bingo[0][2]==0&&bingo[1][1]==0&&bingo[2][0]==0) judge = true;
  
  if(judge) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 256
import math
N=int(input())
S=[input() for i in range(N)]
ans=[]
count = 0
cnt=0
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
"""
def anagram(a,b):
    A=[]
    B=[]
    for i in range(10):
        A.append(a[i])
        B.append(b[i])
    A.sort()
    B.sort()
    if A==B:
        return "Yes" """
for i in range(N):
    kari=[]
    for j in range(10):
        kari.append(S[i][j])
    else:
        kari.sort()
        ans.append(kari)
ans.sort()
kari=[]
for i in range(N-1):
    if ans[i]==ans[i+1]:
        count+=1
    else:
        kari.append(count+1)
        count=0
else:
    kari.append(count+1)
#print(kari)
for j in range(len(kari)):
    if kari[j]>=2:
        cnt+=comb(kari[j],2)
print(cnt)

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(int i=x;i<y;i++)
#define frr(i,x,y) for(int i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    ll r,c,k;
    cin>>r>>c>>k;
    vector<string> arr(r);
    fr(i,0,r)
        cin>>arr[i];
    ll x=power(2,r);
    ll y=power(2,c);
    ll ans=0;
    fr(i,0,x)
    {
        vector<string> tmp(r);
        tmp=arr;
        fr(p,0,r)
        {
            if((i&(1<<p)))
            {
                fr(f,0,c)
                {
                    tmp[p][f]='@';
                }
            }
        }
        fr(j,0,y)
        {
            vector<string> tmp2;
            tmp2=tmp;   
            fr(p,0,c)
            {
                if((j&(1<<p)))
                {
                    fr(f,0,r)
                    {
                        tmp2[f][p]='@';
                    }
                }
            }
            ll ct=0;
            fr(v,0,r)
            {
                fr(e,0,c)
                {
                    if(tmp2[v][e]=='#')
                        ct++;
                }
            }
            if(ct==k)
                ans++;
        }
    }
    cout<<ans<<endl;
    return;
}
int main()
{
    IOS;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

Measured memory_bytes: 3656
#include <iostream>
#include <stdio.h>
using namespace std;

typedef long long LL;

int main () {
	LL a[4];
	for (int i=0;4>i;i++) cin >> a[i];
	LL n;
	cin >> n;
	LL ans=0;
	while (n>=2) {
		LL ii[4] = {a[0]*8,a[1]*4,a[2]*2,a[3]};
		LL mn = ii[0];
		for (int i=1;3>=i;i++) mn = min(mn,ii[i]);
		ans += (n/2)*mn;
		n%=2;
	}
	if (n) ans += min(min(a[0]*4,a[1]*2),a[2]);
	printf("%lld\n",ans);
}


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

namespace AtCoder
{
	public class ABC
	{
		static int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//int x = int.Parse(Console.ReadLine());
			string s = Console.ReadLine();
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int ans = int.MaxValue;
			for (int i = 2; i < s.Length; i++) {
				ans = Math.Min(ans, Math.Abs(753 - int.Parse(s.Substring(i - 2, 3))));
			}
			Console.WriteLine(ans);


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <map>
#include <utility>
#include <set>
#include <climits>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ll n;
    scanf ("%lld", &n);
    ll botneck = LLONG_MAX;
    for (int i = 0; i < 5; ++i) {
        ll t;
        scanf("%lld", &t);
        botneck = min(t, botneck);
    }

    printf("%lld\n", 4 + n / botneck + (n % botneck != 0));
    return 0;
}



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

struct Bit
{
    int size;
    vector<int> bit;

    Bit() {}
    Bit(int sz)
    {
        size = sz;
        bit.resize(sz + 1);
    }

    void add(int a, int w)
    {
        for (int i = a; i <= size; i += (i & -i))
            bit[i] += w;
    }

    int sum(int a)
    {
        int ret = 0;
        for (int i = a; i > 0; i -= (i & -i))
            ret += bit[i];
        return ret;
    }
};

int main()
{
    int n, a, ans = 0;
    cin >> n;
    Bit bit(n);
    while (n--)
    {
        cin >> a;
        bit.add(a, 1);
        ans += (bit.sum(a) == 1);
    }
    cout << ans << "\n";
    return 0;
}


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

char str[10];

bool ask(std::string row[], bool left) {
    std::string tmpRow[2];
    for(int i = 0; i < 4; ++ i) {
        tmpRow[0] = row[0];
        tmpRow[1] = row[1];
        if(left) {
            tmpRow[0] = ((i & 1) ? "." : "#") + row[0];
            tmpRow[1] = ((i & 2) ? "." : "#") + row[1];
        } else {
            tmpRow[0] = row[0] + ((i & 1) ? "." : "#");
            tmpRow[1] = row[1] + ((i & 2) ? "." : "#");
        }
        printf("%s\n%s\n", tmpRow[0].c_str(), tmpRow[1].c_str());
        fflush(stdout);
        scanf("%s", str);
        if(str[0] == 'T') {
            row[0] = tmpRow[0];
            row[1] = tmpRow[1];
            return true;
        }
    }
    return false;
}

void MAIN() {
    int n;
    scanf("%d", &n);
    bool left = true;
    std::string row[2] = { "", "" };
    for(int i = 0; i < n; ++ i) {
        if(ask(row, left)) {
            continue;
        } else {
            left = !left;
            ask(row, left);
        }
    }
    printf("%s\n%s\n", row[0].c_str(), row[1].c_str());
}

int main() {
    MAIN();
    return 0;
}


Measured memory_bytes: 596
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define initdp(a, b)  for (int i = 0; i <= a; i++)   for (int j = 0; j <= b; j++) dp[i][j] = -1;
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repd(i, n) for (int i = n - 1; i >= 0; i--)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 1000005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
using namespace std;




void solve(){
  

  string s;
  cin>>s;

  if(s=="ABC") {
    cout<<"ARC";
  } else {
    cout<<"ABC";
  }


 
}
 
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(20);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
}

Measured memory_bytes: 3580
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S, T;
    cin >> S >> T;
    rep(i, S.length()) {
        bool ok = true;
        rep(j, S.length()) {
            if(S[(i + j) % S.length()] != T[j]) ok = false;
        }
        if(ok) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3456
import java.util.Scanner;
public class Main{
	
	public void solve(){
		Scanner sc = new Scanner(System.in);
		int i = sc.nextInt();
		if(i>=0 && i<86400){
			int h = i / 3600;
			int m = i % 3600 /60;
			int s = i % 60;
			System.out.println(h+":"+m+":"+s);
		}
	}
	public static void main(String[] args){
		Main obj = new Main();
		obj.solve();
	}
}

Measured memory_bytes: 17164
/// Bismillahir Rahmanir Rahim
//Author: Tanvir Hussain
//ICE,NSTU
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

using namespace std;

const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define PII pair<int, int>
#define pf printf

#define sf scanf

#define ALL(x) x.begin(),x.end()
#define pb push_back

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define BOUNDARY(i, j) ((i >= 0 && i < row) && (j >= 0 && j < column))
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define sz(a) int(a.size())
#define ff first
#define ss second
#define endl "\n"
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}
int ext_gcd(int a, int b, int & x, int & y) {
    //for finding modular inverse
    //if its return 1 ,then a has a mod inverse x mod b.
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    int x1, y1;
    int d = ext_gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}

int main()

{
    IOS;
    //freopen("input.txt", "r", stdin);
     //freopen("output.txt", "w", stdout);
     double a,b;
     cin>>a>>b;
     double aa=a+1;
     double bb=b+1;
     a*=100,b*=100;
     a/=8;
     b/=10;
     aa*=100,bb*=100;
     aa/=8,bb/=10;
     if(aa<=b || bb<=a) {
        cout<<-1<<endl;
        return 0;
     }
     cout<<max(ceil(a),ceil(b))<<endl;

     return 0;

}
///Alhamdulillah


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI;
typedef pair<int,int> pii;
const int mod = (int)1e9+7;


struct Segtree{
	typedef ll sgT;
	vector<sgT> seg;
	int nbn; sgT INF;
	void init(int n){
		for(nbn=1; nbn<n+2; nbn<<=1); INF=1LL<<58; // min:+inf,max:-inf
		seg.assign(nbn*2, INF);
	}
	sgT comp(sgT l, sgT r){return min(l, r);}  //min<->max
	void update(int k,sgT x){
		k+=nbn-1; seg[k]=x;
		while(k>0){ k=(k-1)/2; seg[k]=comp(seg[k*2+1],seg[k*2+2]); }
	}
	sgT query2(int a,int b,int l,int r,int k){
		if(b<=l||r<=a) return INF;
		if(a<=l&&r<=b) return seg[k];
		return comp(query2(a,b,l,(l+r)/2,k*2+1), query2(a,b,(l+r)/2,r,k*2+2));
	}
	sgT query(int a,int b){ return query2(a,b,0,nbn,0); }
	sgT get(int a){return seg[nbn+a-1];}  // =query(a,a+1)
	//void disp(){ for(auto x :seg) cout<<x<<", "; puts("");}
};



int main()
{
	
	cin.tie(0); ios_base::sync_with_stdio(false);
	ll n ,x;
	cin >>n >>x;
	vector<ll> a(n);
	rep(i,n) cin >>a[i];
	
	Segtree sga;
	sga.init(2*n+10);
	rep(i,n){ sga.update(i, a[i]); sga.update(i+n, a[i]);}
	ll ans = accumulate(all(a),0LL);
	rep2(i,1,n){
		ll w=0;
		rep(j, n) w += sga.query(j+n-i, j+n+1);
		ans = min(ans, w + x*i);

	}
	
	cout << ans << endl;
	return 0;
}


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

int j[100];

int n;

int getAns(int k, int sum, priority_queue<int, vector<int>, greater<int> > q)
{
	while (k > 0 && q.size() > 0 && q.top() < 0)
	{
		sum -= q.top();
		q.pop();
		k--;
	}
	return sum;
}

int moveRight(int k, int sum, priority_queue<int, vector<int>, greater<int> > q)
{
	int i = n - 1, ans = getAns(k, sum, q);
	while (q.size() < n && k > 0)
	{
		q.push(j[i]);
		sum += j[i];
		i--;
		k--;
		ans = max(ans, getAns(k, sum, q));
	}
	return ans;
}


int main()
{
	int k;
	priority_queue<int, vector<int>, greater<int> > q;
	int sum = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> j[i];
	int ans = moveRight(k, sum, q);
	for (int l = 0; l < min(n, k); l++)
	{
		q.push(j[l]);
		sum += j[l];
		ans = max(ans, moveRight(k - l - 1, sum,q));
	}
	cout << ans;
}

Measured memory_bytes: 256