akhauriyash/Code-Regression huggingface dataset:
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

signed main() {
    int N, A, B, C, D; cin >> N >> A >> B >> C >> D;
    string s; cin >> s;

    A--; B--; C--; D--;
    bool ok = true;
    {
        // A -> C
        int cons = 0, max_cons = 0;
        for(int i=A; i<=C; i++) {
            if(s[i] == '.') {
                max_cons = max(max_cons, cons);
                cons = 0;
            }
            else {
                cons++;
            }
        }

        ok &= (max_cons < 2);
        fprintf(stderr, "ok1 = %d\n", max_cons < 2);
    }
    {
        int cons = 0, max_cons = 0;
        for(int i=B; i<=D; i++) {
            if(s[i] == '.') {
                max_cons = max(max_cons, cons);
                cons = 0;
            }
            else cons++;
        }
        ok &= (max_cons < 2);
        fprintf(stderr, "ok2 = %d\n", max_cons < 2);
    }

    if(C > D) {
        bool can = false;
        can |= (0 < B and B < N - 1 and s[B-1] == '.' and s[B+1] == '.');
        can |= (0 < D and D < N - 1 and s[D-1] == '.' and s[D+1] == '.');

        // 追い越す場合は 3 マス以上の空きがどこかに必要
        int cons = 0, max_cons = 0;
        for(int i=B-1; i<=D+1; i++) {
            if(s[i] == '#') {
                max_cons = max(max_cons, cons);
                cons = 0;
            }
            else cons++;
        }
        can |= (max_cons >= 3);
        // fprintf(stderr, "max_cons = %lld, can = %d\n", max_cons, can);

        ok &= can;
    }

    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <iomanip>
#include <type_traits>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
constexpr long long MOD = 1e9 + 7;
constexpr long long MAX = 1000000;

//long long MOD = 998244353;
constexpr ll INF = 1e17;
constexpr double PI = 3.141592653589793;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }



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

    ll n;
    cin >> n;

    vector<ll> a(n);
    vector<vector<ll>> x(n);
    vector<vector<ll>> y(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        for (int j = 0; j < a[i]; j++)
        {
            ll tx, ty;
            cin >> tx >> ty;
            tx--;
            x[i].emplace_back(tx);
            y[i].emplace_back(ty);
        }
    }

    ll max = 0ll;
    for (ll bit = 0; bit < (1ll << n); ++bit) {
        vector<ll> isHonest(n, -1ll);
        bool hasContraditction = false;
        for (ll i = 0; i < n; ++i) {
            if (bit & (1ll << i)) {
                // i is honest
                isHonest[i] = 1ll;
            }
            else {
                // i is dishonest
                isHonest[i] = 0ll;
            }
        }
        for (ll i = 0; i < n; ++i) {
            if (bit & (1ll << i)) {
                // i is honest
                for (ll j = 0; j < a[i]; j++)
                {
                    if (isHonest[x[i][j]] != y[i][j]) {
                        hasContraditction = true;
                        break; break; //contradiction
                    }
                }
            }
            else {
                // i is dishonest
                continue;
            }
        }

        if (hasContraditction) {
            continue;
        }
        ll sum = 0ll;
        for (const auto& e : isHonest) {
            if (e == 1ll) {
                sum++;
            }
        }
        max = max < sum ? sum : max;
    }

    cout << max << endl;

    return 0;
}



Measured memory_bytes: 256
from collections import Counter
from heapq import heappop,heappush
n,k = (int(i) for i in input().split())
p = [input()[0] for i in range(n)]
c,h,ans = Counter(p),[],0
for i,j in c.most_common(): heappush(h,-j)
while len(h)>=k:
	x,ans = [],ans+1
	for i in range(k):
		m = heappop(h)
		if m+1<0: x.append(m+1)
	for i in x: heappush(h,i)
print(ans)

Measured memory_bytes: 3444
#include<iostream>
#include<vector>
#include<string>
#include<iomanip>
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    int i;
    for(i=0;i<n;i++)cin>>a.at(i);
    double sum=0;
    for(i=0;i<n;i++)sum+=(double)1/(a.at(i));
    cout << fixed << setprecision(10) << 1.0/sum << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}

int main(){
  ll n,m;
  cin>>n>>m;
  ll a = min(m,n);
  ll b = max(m,n);
  if(a==1){
    if(b==1){
      cout<<1<<endl;
    }
    else{
      cout<<b-2<<endl;
    }
  }
  else if(a==2){
    cout<<0<<endl;
  }
  else{
    cout<<(m-2)*(n-2)<<endl;
  }
  return 0;
}

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

using namespace std;

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

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

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


int main(void){

    int n;
    cin >> n;

    vector<int> a(n), b(n);
    for(int i = 0; i < n; ++i){
        int x, y;
        cin >> x >> y;
        a[i] = x + y;
        b[i] = x - y;
    }

    int o = -INF, p = INF, q = -INF, r = INF;
    for(int i = 0; i < n; ++i){
        o = max(o, a[i]);
        p = min(p, a[i]);
        q = max(q, b[i]);
        r = min(r, b[i]);
    }
    int ans = max(o - p, q - r);
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 4776
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<=n;++i)
int main(){
  string s;cin>>s;
  int ans=0;
  int n=(int)s.length();
  rep(i,n/2){
    if(s[i]!=s[n-1-i])ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  long long int i,j,n,a=0,b=0,c=0,ans;
  string s;
  scanf("%lld\n",&n);
  cin >> s;
  for(i=0;i<n;i++){
    if(s[i]=='R'){
      a++;
    }
    else if(s[i]=='G'){
      b++;
    }
    else{
      c++;
    }
  }
  ans=a*b*c;
  for(i=1;i<n;i++){
    for(j=0;j<n;j++){
        if(j+i+i>=n){
            break;
        }
      if(s[j]!=s[j+i] && s[j+i]!=s[j+i+i] && s[j]!=s[j+i+i]){
        ans--;
      }
    }
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 3784
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int flag=0;
 string s;
  cin>>s;
  int l=s.length();
  for(int i=0;i<l;i++)
  {
    if((i%2==0)&&(s[i]=='R'||s[i]=='U'||s[i]=='D'))
      flag++;
    else if((i%2!=0)&&(s[i]=='L'||s[i]=='U'||s[i]=='D'))
      flag++;
  }
  if(flag==l)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}
      

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

public class Main {

	public static void main(String[] args) {
		Queue<String[]> tasks = new LinkedList<String[]>(), finished = new LinkedList<String[]>();
		Scanner sc = new Scanner(System.in);
		String[] l1 = sc.nextLine().split(" ");
		int quantum = Integer.valueOf(l1[1]), eclipsedTime=0;
		for (int i = 0; i < Integer.valueOf(l1[0]); i++) {
			String[] line = sc.nextLine().split(" ");
			tasks.add(new String[]{line[0],line[1]});
		}
		while(tasks.size()>0) {
			String[] currentTask = tasks.poll();
			if(Integer.valueOf(currentTask[1])<=quantum) { 
				int partialTime = Integer.valueOf(currentTask[1]);
				finished.add(new String[] {currentTask[0],Integer.toString(partialTime+eclipsedTime)});
				eclipsedTime+=partialTime;
			}
			else {
				currentTask[1]=Integer.toString(Integer.valueOf(currentTask[1])-quantum);
				tasks.add(currentTask);
				eclipsedTime+=quantum;
			}

		}
		for(String[] task: finished) {
			System.out.println(task[0]+" "+task[1]);
		}
	}

}



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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll fexp (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = fexp (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return fexp (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/gcd(num1,num2))*num2;}


// end of Template

set <int> z[30];
ll cop,ans;
str s,t;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>s;
    cin>>t;
    for(int i=0;i<s.size();i++){
        int d = numerize(s[i]);
        z[d].insert(i+1);
    }

    bool valid=true;
    int idx = -1;
    for(int i=0;i<t.size();i++){
        int d = numerize(t[i]);
        if(z[d].empty()){valid = false;break;}
        else{
            if(*z[d].rbegin() <= idx){
                cop++;
                idx = *z[d].begin();
            }
            else{
                idx++;
                idx = *z[d].lower_bound(idx);
            }
        }
        //cout<<t[i]<<" "<<cop<<" "<<idx<<newl;
    }

    idx = max(idx,0);

    ans = (ll) cop*s.size() + idx;
    if(!valid)ans=-1;
    cout<<ans<<newl;


}



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

using namespace std;

int main(void)
{
	int n;

	cin >> n;

	n %= 10;

	string ans;

	switch (n)
	{
	case 2:
	case 4:
	case 5:
	case 7:
	case 9:
		ans = "hon";
		break;
	case 0:
	case 1:
	case 6:
	case 8:
		ans = "pon";
		break;
	default:
		ans = "bon";
	}

	cout << ans << endl;

	return 0;
}

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

using namespace std;

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

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define present(i, c) ((c).find(i) != (c).end())

#define for0(i, n) for(int i = 0; i < n; i++)
#define for1(i, n) for(int i = 1; i <= n; i++)
#define fora(i, a, b) for(int i = (a); i < (b); i++)
#define ford(i, n) for(int i = (n)-1; i >= 0; i--)

#define TRACE(x...) x
#define watch(x) TRACE(cerr << #x" = " << x << endl)
#define watch_all(x) TRACE(cerr << #x" = "; for(auto __i : x) cerr << __i << " "; cerr << endl)
	
#define INF 0x3F3F3F3F

//=========================

int A[100001][3];
int dp[100001][3];

void run_test() {
	int N; cin >> N;
    for1(i, N) cin >> A[i][0] >> A[i][1] >> A[i][2];
    ini(dp, 0);
    for1(i, N)
        for0(a, 3) 
            for0(b, 3)
                if(a != b)
                    dp[i][a] = max(dp[i][a], dp[i-1][b] + A[i][a]);
    int ans = 0;
    for0(i, 3) ans = max(ans, dp[N][i]);
    cout << ans << endl;
}

//=========================

ifstream infile;
clock_t start__;
void open_func();
void close_func();

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	open_func();
	//int t; cin >> t; while(t--) run_test();
	run_test();
	close_func();
	return 0;	
}

void open_func() {
	//infile = ifstream("input.in"); if(infile.good()) cin.rdbuf(infile.rdbuf());
	start__ = clock();
	cerr << "---" << endl;
}

void close_func() {
	clock_t elapsed = clock()-start__;
	cerr << "---" << endl << "(time " << fixed << setprecision(2) << elapsed * (1.0/CLOCKS_PER_SEC) << "s)" << endl;	
	//if(infile.good()) infile.close();
}


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

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
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 N, L; scan(N, L);

    int taste(int i) {
        return L + i - 1;
    }

    int sum = 0;
    for (int i = 1; i <= N; i++) {
        sum += taste(i);
    }

    int ans = 0;
    int best = int.max;
    for (int i = 1; i <= N; i++) {
        int s = 0;
        for (int j = 1; j <= N; j++) {
            if (i == j) continue;
            s += taste(j);
        }

        if (abs(sum - s) < best) {
            best = abs(sum - s);
            ans = s;
        }
    }
    writeln(ans);
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}
const int LIMIT = 200001;

VI operator*(const VI &x, const VI &y) {
    VI z(LIMIT);
    REP (i, LIMIT) z[i] = y[x[i]];
    return z;
}
VI pow(VI x, LL k) {
    VI z(LIMIT);
    REP (i, LIMIT) z[i] = i;
    for (;k; k>>=1) {
	if (k & 1) z = z * x;
	x = x * x;
    }
    return z;
}

int N;
LL K;
int A[LIMIT];
bool in[LIMIT];

void MAIN() {
    scanf("%d%lld", &N, &K);
    REP (i, N) scanf("%d", A+i);

#ifdef LOCAL_
    N = 200000;
    K = 1e12;
    REP (i, N) A[i] = rand() % 200000 + 1;
#endif

    VI x(LIMIT);
    REP (i, LIMIT) x[i] = i;
    for (int i=N; i--;) {
	swap(x[0], x[A[i]]);
    }
    VI z = pow(x, K);

    int head = z[0];
    if (head == 0) {
	puts("");
    } else {
	VI ans;
	for (int i=N; i--;) if (A[i] == head) {
	    for (; i<N; i++) {
		if (in[A[i]]) {
		    while (1) {
			int v = ans.back();
			in[v] = false;
			ans.pop_back();
			if (v == A[i]) break;
		    }
		} else {
		    ans.push_back(A[i]);
		    in[A[i]] = true;
		}
	    }
	    break;
	}
	rprintf("%d", ans.begin(), ans.end());
    }
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 5856
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
	string c;
	cin>>c;
	for(int i=0;i<c.length();i++){
		if(c[i]==c[i+1]&&c[i+1]==c[i+2]) {
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

struct ZAlgorithm
{
	std::vector<int> z;
	ZAlgorithm(std::string s) : z(s.size(),0) {
		int l,r;
		// [l,r)
		l=r=0;
		z[0] = s.size();
		for(int i=1;i<s.size();i++) {
			if(i>=r) {
				l=r=i;
				while(r<s.size() && s[r]==s[r-l]) r++;
				z[i] = r-l;
				continue;
			}
			if(z[i-l]<r-i) {
				z[i] = z[i-l];
				continue;
			}
			l=i;
			while(r<s.size() && s[r]==s[r-l]) r++;
			z[i] = r-l;
			continue;
		}
	}
};


signed main() {
	int n;
	std::cin >> n;
	std::string s;
	std::cin >> s;
	int max = 0;
	for(int i=0;i<n;i++) {
		ZAlgorithm z(s.substr(i,n-i));
		for(int j=1;j<z.z.size();j++) {
			if(z.z[j]<=j) max = std::max(max,z.z[j]);
		}
	}
	print(max);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 1111116
#define next nxt

int n,m,x[N],y[N],z[N],w[N],next[N],p[N],h[N][3];
long long cnt,cmt,c[3],ans;

void travel(int x,int k){
	if (!h[x][0]&&!h[x][1]&&!h[x][2]) cnt++;
	h[x][k]=1;c[k]++;
	for (int t=p[x];t;t=next[t]){
		if (!w[t]) cmt++;w[t]=1;
		if (!h[y[t]][(k+z[t])%3])
		travel(y[t],(k+z[t])%3);
	}
}

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-')  f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	n=read();m=read();
	for (int i=1;i<=m;i++){
		x[2*i-1]=y[2*i]=read();
		y[2*i-1]=x[2*i]=read();
		z[2*i-1]=1;z[2*i]=2;
		next[2*i-1]=p[x[2*i-1]];p[x[2*i-1]]=2*i-1;
		next[2*i]=p[x[2*i]];p[x[2*i]]=2*i;
	}
	for (int i=1;i<=n;i++)
		if (!h[i][0]&&!h[i][1]&&!h[i][2]){
			cnt=0;cmt=0;c[0]=c[1]=c[2]=0;travel(i,0);
			if (h[i][1]) ans+=cnt*cnt;
			else if (c[1]&&c[2]) ans+=c[0]*c[1]+c[1]*c[2]+c[2]*c[0];
			else ans+=cmt/2;
		}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 29184
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.Iterator;

public class Main {

	static BufferedReader reader;
	final static boolean MODE_DEBUG = false;
	//static field here
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		int[] NM = readLineInt();
		int N = NM[0];
		int[] a = readLineInt();
		int ans = 0;
		Person[] ps = new Person[N];
		ps[0] = new Person(0);
		for(int k=1;k<N;k++) {
			Person p = (ps[k] = new Person(k));
			p.u = ps[a[k-1]-1];
			p.u.d.add(p);
		}
		for(int k=0;k<N;k++) {
			print(ps[k].countD());
		}
		
	}
	
	//functions here
	//note that all methods should be STATIC


	private static <T> int arraySearch(T needle, T[] heystack) {
		for(int i=0;i<heystack.length;i++) {
			if(needle.equals(heystack[i])) {
				return i;
			}
		}
		return -1;
	}
	private static int[] sort(int[] base) {
		int[] copy = array_copy(base);
		Arrays.sort(copy);
		return copy;
	}
	private static int[] array_copy(int[] base) {
		int[] copy = new int[base.length];
		for(int i=0;i<base.length;i++) {
			copy[i] = base[i];
		}
		return copy;
	}
	private static int[] asArray(ArrayList<Integer> ints) {
		int[] intlist = new int[ints.size()];
		for(int i=0;i<intlist.length;i++) {
			intlist[i] = ints.get(i);
		}
		return intlist;
	}
	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static int[] readLineInt(){
		try{
			String[] s = readLine();
			int[] ints = new int[s.length];
			for(int i=0;i<ints.length;i++) {
				ints[i] = Integer.parseInt(s[i]);
			}
			return ints;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static byte[] readLineByte(){
		try{
			String[] s = readLine();
			byte[] bytes = new byte[s.length];
			for(int i=0;i<bytes.length;i++) {
				bytes[i] = Byte.parseByte(s[i]);
			}
			return bytes;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static char[] readLineChar(){
		try{
			String[] s = readLine();
			char[] chars = new char[s.length];
			for(int i=0;i<chars.length;i++) {
				chars[i] = (char)Integer.parseInt(s[i]);
			}
			return chars;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
	private static void printd(Object o){
		if(MODE_DEBUG)System.err.println(o);
	}
	private static void printd(){
		if(MODE_DEBUG)System.err.println();
	}
}

class Person{
	int id;
	Person u = null;
	ArrayList<Person> d;
	int dcnt = 0;
	
	public Person(int id){
		// TODO 自動生成されたコンストラクター・スタブ
		this.id = id;
		d = new ArrayList<>();
	}
	
	int countD() {
		return d.size();
	}
}


Measured memory_bytes: 88952
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
using namespace std;
int main(){
int a,b;
//cout<<1<<endl;
while(cin>>a>>b){
int h[100000]={0};
h[a]++;
h[b]++;
while(cin>>a>>b,a||b){
h[a]++;
h[b]++;
}
int han=0;
loop(i,0,100000){
if(h[i]%2!=0)han++;
}
if(h[1]%2==1&&h[2]%2==1&&han==2)cout<<"OK"<<endl;
else cout<<"NG"<<endl;
}
}

Measured memory_bytes: 1552
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7,INF=1e18;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //Let's Concentrate on learning
    //Rating ka kya hai aaj niche to kl upar...
    ll t=1;
    // cin>>t;
    while(t--)
    {
        int n,t;
        cin>>n>>t;
        vector<int> a(n),ma(n,0),co(n);
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
        ma[n-1]=a[n-1];
        for(int i=n-2;i>=0;i--)
        {
            ma[i]=max(a[i],ma[i+1]);
        }
        int maxi=0,count=0;
        for(int i=0;i<n-1;i++)
        {
            co[i]=max(0,ma[i+1]-a[i]);
            maxi=max(maxi,co[i]);
        }
        for(int i=0;i<n-1;i++)
        if(co[i]==maxi)
        {
            count++;
        }
        cout<<count<<"\n";
    }
    return 0;
}

Measured memory_bytes: 4484
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<(n);i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;

int main(){
    string s;cin>>s;
    int n =s.length();
    int ans =1;
    char a = s[0];
    rep(i,n){
        if(i==0)continue;
        if(s[i]!=a){
            ans++;
            a=s[i];
        }
    }
    cout<<ans-1<<endl;
}

Measured memory_bytes: 512
n = int(input())
a = [[0 for x in range(n)] for x in range(n)]
for i in range(n):
	t = list(map(int, input().split()))
	x = t[0]-1
	for j in range(t[1]):
		y = t[j+2]-1
		a[x][y] = 1

for i in range(n):
	print(a[i][0],end='')
	for j in range(1, n):
		print(' ' + str(a[i][j]),end='')
	print()



Measured memory_bytes: 6536
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String a = in.next();
        String b = in.next();
        String c = in.next();
        System.out.println( a.toUpperCase().charAt(0) + "" + 
                            b.toUpperCase().charAt(0) + "" +
                            c.toUpperCase().charAt(0));
    }
}

Measured memory_bytes: 21844
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#include <iostream> 
using namespace __gnu_pbds; 
using namespace std; 
#include<bits/stdc++.h>
#define int long long
#define pb push_back 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define repa(i,a,b) for (int i=a; i<=b; i++)
#define repd(i,b,a) for (int i=b; i>=a; i--)
#define endl "\n"
typedef tree<int, null_type, less<int>, 
rb_tree_tag, tree_order_statistics_node_update> pbset; 
//debugging
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

const int N = 1e+6+5;
int big = 1e+18+3;
int mod = 1e+9+7;

signed main()
{
    IOS;
         
    int n; cin>>n;
    string s; cin>>s;

    s = " " + s;

    int red[n+2]={0};
    int white[n+2]={0};

    repa(i,1,n)
    {
        red[i] = red[i-1];
        white[i] = white[i-1];

        if (s[i]=='R')
            red[i]++;
        if (s[i]=='W')
            white[i]++;
    }   

    int ans = min(red[n],white[n]);

    repa(i,1,n)
    {
        int cur = 0;
        int req_Red = i - red[i];
        int have_Red = red[n] - red[i];

        int req_White = n - i -( white[n] - white[i] );
        int have_White = white[i];

        //red transfer
        int taking = min(req_Red,have_Red);
        req_Red-=taking;
        cur+=taking;
        cur+=req_Red;

        req_White-=taking;
        have_White-=taking;
        
        //white transfer
        taking = min(req_White,have_White);
        req_White-=taking;
        cur+=taking;

        cur+=(req_White+req_Red);

        ans = min(ans,cur);
    }          

    cout<< ans <<endl;
}

Measured memory_bytes: 6896
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>

using namespace std;
int main() {
	long long int n, i, j, sum = 0, min;
	cin >> n;
	min = n;
	for (i = 1; i <= sqrt(n); i++) {
		sum = 0;
		if (n % i == 0) {
			j = n / i;
			sum = i + j - 2;
			if (min > sum) {
				min = sum;
			}
		}
		
	}
	cout << min << endl;
	return 0;
}

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

int main() {
	ll N; cin >> N;
	string S; cin >> S;
	vector<ll> left_west(N); // 今いる場所より左に西を向いている人が何人いるか
	vector<ll> right_east(N); // 今いる場所より右に東を向いている人が何人いるか
	
	/* 西を向いている人に対して累積和を取る */
	ll sum_left = 0;
	for (ll i = 0; i < N; i++) {
		left_west[i] = sum_left;
		if (S[i] == 'W') sum_left++;
	}

	/* 東を向いている人に対して累積和を取る */
	ll sum_right = 0;
	for (ll i = N - 1; i >= 0; i--) {
		right_east[i] = sum_right;
		if (S[i] == 'E') sum_right++;
	}

	ll ans = 1001001001;
	for (ll i = 0; i < N; i++) {
		ans = min(ans, left_west[i] + right_east[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5380
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var abc = IO.RSInt;
            Array.Sort(abc);
            int cnt = 0;
            while (abc[0] <= abc[2] - 2)
            {
                abc[0] += 2;
                cnt++;
            }
            while (abc[1] <= abc[2] - 2)
            {
                abc[1] += 2;
                cnt++;
            }
            if (abc[0] != abc[1])
            {
                cnt += 2;
            }
            else
            {
                if (abc[0] != abc[2])
                {
                    cnt++;
                }
            }
            WriteLine(cnt);
        }

        public class IO
        {
            #region Input
            public static int RInt => int.Parse(ReadLine());
            public static long RLong => long.Parse(ReadLine());
            public static double RDouble => double.Parse(ReadLine());

            public static string[] RSString => ReadLine().Split();
            public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
            public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
            #endregion

            #region Output
            public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
            public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
            public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
            #endregion
        }

        public class Mod
        {
            #region
            private readonly static long M = 1000000007;

            public static long Add(long a, long b) => (a * b) % M;
            public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
            public static long Multi(long a, long b) => (a * b) % M;
            #endregion
        }
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
int n,q;
long long a[233333],dp[233333],ans[233333];
int main()
{
	ios_base::sync_with_stdio(false);
	cin>>n>>q;
	for(int i=1;i<=n;i++)a[i]=i;
	int w=n;
	for(int i=n+1;i<=n+q;i++)
	{
		cin>>a[i];
		if(a[i]<w)w=a[i];
		while(a[i]<=a[i-1])
		{
			a[i-1]=a[i];
			i--;q--;
		}
	}
	q+=n;
//	for(int i=0;i<=q;i++)cout<<a[i]<<endl;
	dp[q]=1;
	for(int i=q;i>w;i--)
	{
		long long t=a[i],d;
		while(t)
		{
			d=upper_bound(a+1,a+i,t)-a-1;
//			cerr<<i<<' '<<t<<' '<<d<<' '<<a[d]<<endl;
			dp[d]+=t/a[d]*dp[i];
			t%=a[d];
		}
	}
	for(int i=w;i>=1;i--)ans[i]=dp[i]+ans[i+1];
	for(int i=1;i<=n;i++)cout<<ans[i]<<endl;
	return 0;
}

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

int min(int x, int y) 
{ 
  return (x < y) ? x : y ;
} 

int main() {
    int n,b,a,sum;
    cin >> n;
    cin >> b;
    a = b;
    sum = b;
    for (int i=1; i<n-1; i++)
    {
        int b;
        cin >> b;
        sum += min(b, a);
        a = b;
    }
    sum += a;
    cout << sum;
    return 0;
}

Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())
d1, d2 = x2 - x1, y2 - y1
x3, y3 = x2 - d2, y2 + d1
x4, y4 = x3 - d1, y3 - d2
print(x3, y3, x4, y4)

Measured memory_bytes: 2940
n=int(input())
x=list(map(int,input().split()))

x2=sorted(x)

n1=int(n/2-1)
n2=int(n/2)

if x2[n1]==x2[n2]:
	cnt=0
else:
	cnt=x2[n2]-x2[n1]

print(cnt)

Measured memory_bytes: 14428
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

S=input()
lft = 0
rgt = len(S)-1

cnt = 0
while lft <= rgt:
    cnt += S[lft] != S[rgt]
    lft += 1
    rgt -= 1

print(cnt)


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

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define F first
#define S second
#define INF 1 << 30

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int n, m, f, dis, pos;
char c[100];

int main(){
  while(scanf("%d%d", &n, &m) && n){
    rep(i, n) c[i] = '#';
    char p[2];
    rep(k, m){
      scanf("%s", p);
      switch(p[0]){
      case 'A':
	rep(i, n) if(c[i] == '#'){ c[i] = 'A'; break;;}
	break;
      case 'B':
	if(c[n-2] != 'A' && c[n-1] == '#'){ c[n-1] = 'B'; break;}
	for(int i = n-2; i > 0; i--) if(c[i+1] != 'A' && c[i-1] != 'A' && c[i] == '#'){ c[i] = 'B'; goto e1;}
	if(c[1] != 'A' && c[0] == '#'){ c[0] = 'B'; break;}
	rep(i, n) if(c[i] == '#'){ c[i] = 'B'; break;}
      e1:
	break;
      case 'C':
	rep(i, n) if(c[i] != '#'){
	  if(i+1 < n && c[i+1] == '#'){ c[i+1] = 'C'; goto e2;}
	  else if(i-1 >= 0 && c[i-1] == '#'){ c[i-1] = 'C'; goto e2;}
	}

	if(n%2) c[(n+1)/2-1] = 'C';
	else c[n/2] = 'C';
      e2:
	break;
      case 'D':
	dis = 0, pos = 0;
	rep(i, n){
	  if(c[i] != '#') continue;
	  int j;
	  f = 0;
	  for(j = 1; j < n; j++){
	    if(i-j >= 0 && c[i-j] != '#') f = 1;
	    //	    printf("%d ", f);
	    if(i+j < n && c[i+j] != '#') f = 1;
	    //	    printf("%d ", f);
	    if(f){
	      if(dis < j){
		dis = j;
		pos = i;
	      }
	      break;
	    }
	  }
	  //	  printf("%d %d %d\n",i, dis, pos);
	}

	c[pos] = 'D';
	break;
      }
    }
  
    rep(i, n) putchar(c[i]); puts("");
  }
  return 0;
}

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

LL pw(LL a , LL b , LL mod){
	LL z = 1;
	for(; b > 0 ; b >>= 1){
		if(b&1) (z *= a) %= mod;
		(a *= a) %= mod;
	}
	return z;
}

void NTT(vector<LL> &a , LL mod , LL pr , bool rev = 0){
	int n = a.size();
	int lg = 0;
	for(int i = 0 ; 1 << i < n ; ++i) ++lg;
	for(int i = 0 ; i < n ; ++i){
		int j = 0;
		for(int k = 0 ; k < lg ; ++k) j |= (i >> k & 1) << (lg - 1 - k);
		if(i < j) swap(a[i] , a[j]);
	}
	for(int i = 1 ; i < n ; i *= 2){
		LL wb = pw(pr,(mod-1)/i/2,mod);
		if(rev) wb = pw(wb,mod-2,mod);
		LL w = 1;
		for(int j = 0 ; j < i ; ++j){
			for(int k = 0 ; k < n ; k += i * 2){
				LL s = a[j + k];
				LL t = (a[j + k + i] * w) % mod;
				a[j + k] = (s + t) % mod;
				a[j + k + i] = (s - t + mod) % mod;
			}
			(w *= wb) %= mod;
		}
	}
	if(rev){
		LL inv = pw(n,mod-2,mod);
		for(int i = 0 ; i < n ; ++i) (a[i] *= inv) %= mod;
	}
}
	
void conv(vector<LL> &a , vector<LL> b , LL mod){
	LL pr = 3;
	int s = a.size() + b.size() - 1;
	int t = 1;
	while(t < s) t *= 2;
	a.resize(t);
	b.resize(t);
	NTT(a,mod,pr);
	NTT(b,mod,pr);
	for(int i = 0 ; i < t ; ++i) (a[i] *= b[i]) %= mod;
	NTT(a,mod,pr,1);
	a.resize(s);
}

const LL mod = 998244353;
const int MC = 10010;
LL fct[MC];
LL inv[MC];
char A[MC] , B[MC];
vector<LL> ans;
vector<LL> base;

void build(){
	fct[0] = fct[1] = 1;
	repp(i,2,MC+1){
		fct[i] = fct[i-1] * i % mod;
	}
	LL x = fct[MC];
	inv[MC] = 1;
	for(int i = mod - 2 ; i > 0 ; i >>= 1){
		if(i % 2 == 1) (inv[MC] *= x) %= mod;
		(x *= x) %= mod;
	}
	repm(i,MC,0){
		inv[i-1] = inv[i] * i % mod;
	}
}

int main(){
	build();
	scanf("%s %s" , A , B);
	int x = 0 , y = 0;
	for(int i = 0 ; A[i] ; ++i){
		if(A[i] == '0') continue;
		if(A[i] == B[i]) ++x;
		else ++y;
	}
	repp(i,0,x+1){
		ans.PB(1);
		base.PB(inv[i+1]);
	}
	for(int i = y ; i > 0 ; i >>= 1){
		if(i%2){
			conv(ans,base,mod);
			ans.resize(x+1);
		}
		conv(base,base,mod);
		base.resize(x+1);
	}
	printf("%lld\n" , ans[x] * fct[x] % mod * fct[y] % mod * fct[x+y] % mod);
	return 0;
}


Measured memory_bytes: 1452
n=int(input())
a=[0]*n
a[:]=map(int,input().split())
import numpy as np
r=0
c=0
#for ii in np.arange(n-1,-1,-1):
  #print(ii)
for ii in np.arange(1,n):
  if a[ii-1]>=a[ii]:
    c+=1
  else:
    r=max(r,c)
    c=0
  #print(c,r)
print(max(r,c))

Measured memory_bytes: 19152
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T & a, const T & b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T & a, const T & b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}


#define ARRAY_MAX 100005
const int INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

int dx2[2] = { 1,0 };
int dy2[2] = { 0,1 };

/******************************************************************************************/



int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);

	ll n, a, b;
	cin >> n >> a >> b;


	ll tm = n / (a + b);

	ll blue = a * tm;
	ll red = b * tm;
	n -= (a + b) * tm;
	
	ll mini = min(n, a);
	blue += mini;
	n -= mini;

	red += min(n, b);

	cout << blue << endl;
	

	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

ll gcd(ll  a,ll b){
    ll r;
    if(a < b){
        ll tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}
/*
ll Integer_factorization(ll n){
    ll num = 0;
    ll ndash = n;
    if(n == 1) return 1;
    ll a = 2;
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    return num;
}
*/

ll r_fuct[2000];
ll fuct[2000];

//MOD逆元
void conb(ll n,ll k){
    fuct[0] = 1;
    for(int i = 1;i < k+1;i++){
        fuct[i] *= fuct[i-1]%MOD;
        
        ll b = MOD, u = 1, v = 0;
        ll value = fuct[i];
        while (b) {
            ll t = value / b;
            value -= t * b;
            swap(value, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        r_fuct[i] = u;
    }
}

ll factrial(ll n){
    if(n == 0) return 1;
    ll p = factrial(n-1)*n%MOD;
    return p;
}

//MOD逆元
ll farmat(ll n,ll p){    
    if(p == 0) return 1;
    else if(p == 1) return n%MOD;
    ll d = farmat(n,p/2);
    if(p%2 == 0){
        return (d*d)%MOD;
    }else{
        return ((n*d)%MOD*d)%MOD;
    }
}

ll conbination(ll n,ll k){
    ll a = factrial(n);
    ll b = factrial(k);
    ll c = factrial(n-k);
    return (a*farmat(b,MOD-2)%MOD*farmat(c,MOD-2))%MOD;
}

int memo[10000000];

int fib(int i){
    if(i <= 1) return i;
    if(memo[i] != 0) return memo[i];
    return memo[i] = fib(i-1)+fib(i-2);
}

ll dig(ll n){
    ll d = 0;
    while(n != 0){
        n/=10;
        d++;
    }
    return d;
}

void solve() {
    char a,b;
    cin >> a >> b;
    if(a > b) cout <<">" << endl;
    else if(a == b) cout << "=" << endl;
    else cout << "<" << endl;
    
/*
  ll n,k;
  cin >> n >> k;
  vector<ll> x(n+1);
  vector<ll> sub(n);
  for(int i = 0;i < n;i++){
      cin >> x[i];
  }
  if(n == 1){
      cout << abs(x[0]) << endl;
      return;
  } 
  x[n] = 0;
  sort(x.begin(),x.end());
  for(int i = 0;i < n;i++){
      sub[i] = x[i+1]-x[i];
  }
  vector<ll> right(n);
  right[0] = sub[0];
  for(int i = 1;i < n;i++){
      right[i] = right[i-1]+sub[i];
  }

  ll ans = right[k-1];
  for(int i = 0;i < n-k;i++){
      ans = min(ans,right[i+k]-right[i]);
  }
  cout << ans << endl;
  */
}




int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
int main()
{
    ll a;
    ll b;
    ll c;
    ll k;
    ll ans = 0;
    std::cin >> a >> b >> c >> k;
    while (a >= b) {
        b *= 2;
        ++ans;
    }
    while (b >= c) {
        c *= 2;
        ++ans;
    }
    if (k >= ans) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<a.size();zz++) cerr<<a[zz]<<" ";cerr<<endl
#define mod 1000000007
#define inf 9999999999999999ll
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    vi a(n);
    for(ll i=0;i<n;i++)
        cin>>a[i];
    set <ll> even;
    set <ll> odd;
    map <ll,ll> ce,co;
    for(ll i=0;i<n;i++)
    {
        if(i%2==0)
        {
            ce[a[i]]++;
        }
        else
        {
            co[a[i]]++;
        }
    }
    ii fe=mp(0,0),se=mp(0,0),fo=mp(0,0),so=mp(0,0);
    for(auto &i:ce)
    {
        ll ele=i.F;
        ll count=i.S;
        ii p=mp(count,ele);
        if(fe<p)
        {
            se=fe;
            fe=p;
        }
        else if(se<p)
        {
            se=p;
        }
    }
    for(auto &i:co)
    {
        ll ele=i.F;
        ll count=i.S;
        ii p=mp(count,ele);
        if(fo<p)
        {
            so=fo;
            fo=p;
        }
        else if(so<p)
            so=p;
    }
    if(fe.S!=fo.S)
    {
        cout<<n-(fe.F+fo.F)<<endl;
    }
    else
    {
        cout<<n-max(fe.F+so.F,se.F+fo.F)<<endl;
    }
}


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

int main() {
  int K,X;
  cin >> K >>X;
  if(K*500 >= X) cout << "Yes";
  else cout << "No";
}



Measured memory_bytes: 256